foss-for-synopsys-dwc-arc-processors / linux

Helpful resources for users & developers of Linux kernel for ARC
22 stars 13 forks source link

CCM size checks in arch/arc/kernel/setup.c fail due to incorrect units #18

Closed pmgreco closed 3 years ago

pmgreco commented 4 years ago

In the file arch/arc/kernel/setup.c the CCM size checks are incorrectly using mismatched units (KiB checked against bytes), and will always fail. The CONFIG_ARC_DCCM_SZ and CONFIG_ARC_ICCM_SZ are in KiB (indicated by both defaults and comments in Kconfig, and well as used in vmlinux.lds.S), but setup uses units of bytes for cpu->dccm.sz and cpu->iccm.sz.

Seems like the correct fix is to add TO_KB() to the size checks, as follows:

if (CONFIG_ARC_DCCM_SZ != TO_KB(cpu->dccm.sz))
    panic("Linux built with incorrect DCCM Size\n");

endif

ifdef CONFIG_ARC_HAS_ICCM

if (CONFIG_ARC_ICCM_SZ != TO_KB(cpu->iccm.sz))
    panic("Linux built with incorrect ICCM Size\n");

endif

Can one of your developers who support ARC for Linux make and submit the appropriate patch(es) to mainline kernel(s)?

vineetgarc commented 3 years ago

Merged upstream in 5.7 kernel 43900edf67d7ef3 ARC: Fix ICCM & DCCM runtime size checks