diff mbox series

[1/1] armv8: Fix compilation error with SYS_DCACHE_OFF

Message ID 20230811054228.3721455-1-bhupesh.sharma@linaro.org
State New
Headers show
Series [1/1] armv8: Fix compilation error with SYS_DCACHE_OFF | expand

Commit Message

Bhupesh Sharma Aug. 11, 2023, 5:42 a.m. UTC
If CONFIG_SYS_ICACHE_OFF and CONFIG_SYS_DCACHE_OFF are set, we see the
following errors while compiling u-boot:

  arch/arm/cpu/armv8/cpu.c:60: undefined reference to `icache_disable'
  aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:68: undefined reference to `dcache_disable'
  aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:69: undefined reference to `invalidate_dcache_all'
  aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `entry_non_secure':
  arch/arm/cpu/armv8/exception_level.c:29: undefined reference to `dcache_enable'
  aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `switch_to_non_secure_mode':
  arch/arm/cpu/armv8/exception_level.c:52: undefined reference to `dcache_disable'
  aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.o: in function `relocate_done':
  arch/arm/lib/relocate_64.S:92: undefined reference to `__asm_flush_dcache_range'
  aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.S:93: undefined reference to `__asm_flush_l3_dcache'
  aarch64-linux-gnu-ld.bfd: arch/arm/lib/bootm.o: in function `do_nonsec_virt_switch':
  arch/arm/lib/bootm.c:191: undefined reference to `dcache_disable'
  aarch64-linux-gnu-ld.bfd: boot/bootm_os.o: in function `do_bootm_qnxelf':
  boot/bootm_os.c:392: undefined reference to `dcache_status'
  aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:394: undefined reference to `dcache_disable'
  aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:399: undefined reference to `dcache_enable'
  aarch64-linux-gnu-ld.bfd: cmd/elf.o: in function `do_bootvx':
  cmd/elf.c:280: undefined reference to `dcache_disable'

While the following error message is expected when SYS_DCACHE_OFF is
set:
  arch/arm/cpu/armv8/cache_v8.c:697:2: error:
      #error Please describe your MMU layout in CONFIG_SYS_MEM_MAP and enable dcache.

the rest of the compilation errors should be fixed.

Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
---
 arch/arm/cpu/armv8/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Tom Rini Aug. 11, 2023, 2:01 p.m. UTC | #1
On Fri, Aug 11, 2023 at 11:12:28AM +0530, Bhupesh Sharma wrote:

> If CONFIG_SYS_ICACHE_OFF and CONFIG_SYS_DCACHE_OFF are set, we see the
> following errors while compiling u-boot:
> 
>   arch/arm/cpu/armv8/cpu.c:60: undefined reference to `icache_disable'
>   aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:68: undefined reference to `dcache_disable'
>   aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:69: undefined reference to `invalidate_dcache_all'
>   aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `entry_non_secure':
>   arch/arm/cpu/armv8/exception_level.c:29: undefined reference to `dcache_enable'
>   aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `switch_to_non_secure_mode':
>   arch/arm/cpu/armv8/exception_level.c:52: undefined reference to `dcache_disable'
>   aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.o: in function `relocate_done':
>   arch/arm/lib/relocate_64.S:92: undefined reference to `__asm_flush_dcache_range'
>   aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.S:93: undefined reference to `__asm_flush_l3_dcache'
>   aarch64-linux-gnu-ld.bfd: arch/arm/lib/bootm.o: in function `do_nonsec_virt_switch':
>   arch/arm/lib/bootm.c:191: undefined reference to `dcache_disable'
>   aarch64-linux-gnu-ld.bfd: boot/bootm_os.o: in function `do_bootm_qnxelf':
>   boot/bootm_os.c:392: undefined reference to `dcache_status'
>   aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:394: undefined reference to `dcache_disable'
>   aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:399: undefined reference to `dcache_enable'
>   aarch64-linux-gnu-ld.bfd: cmd/elf.o: in function `do_bootvx':
>   cmd/elf.c:280: undefined reference to `dcache_disable'
> 
> While the following error message is expected when SYS_DCACHE_OFF is
> set:
>   arch/arm/cpu/armv8/cache_v8.c:697:2: error:
>       #error Please describe your MMU layout in CONFIG_SYS_MEM_MAP and enable dcache.
> 
> the rest of the compilation errors should be fixed.
> 
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
> ---
>  arch/arm/cpu/armv8/Makefile | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

We should disable SYS_DCACHE_OFF (and SYS_ICACHE_OFF?) for ARMv8, and
then rework the Makefiles too.
Bhupesh Sharma Aug. 22, 2023, 7:51 a.m. UTC | #2
On 8/11/23 7:31 PM, Tom Rini <trini@konsulko.com> wrote:
> On Fri, Aug 11, 2023 at 11:12:28AM +0530, Bhupesh Sharma wrote:
> 
> > If CONFIG_SYS_ICACHE_OFF and CONFIG_SYS_DCACHE_OFF are set, we see the
> > following errors while compiling u-boot:
> >
> >    arch/arm/cpu/armv8/cpu.c:60: undefined reference to `icache_disable'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:68: undefined reference to `dcache_disable'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/cpu.c:69: undefined reference to `invalidate_dcache_all'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `entry_non_secure':
> >    arch/arm/cpu/armv8/exception_level.c:29: undefined reference to `dcache_enable'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/cpu/armv8/exception_level.o: in function `switch_to_non_secure_mode':
> >    arch/arm/cpu/armv8/exception_level.c:52: undefined reference to `dcache_disable'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.o: in function `relocate_done':
> >    arch/arm/lib/relocate_64.S:92: undefined reference to `__asm_flush_dcache_range'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/lib/relocate_64.S:93: undefined reference to `__asm_flush_l3_dcache'
> >    aarch64-linux-gnu-ld.bfd: arch/arm/lib/bootm.o: in function `do_nonsec_virt_switch':
> >    arch/arm/lib/bootm.c:191: undefined reference to `dcache_disable'
> >    aarch64-linux-gnu-ld.bfd: boot/bootm_os.o: in function `do_bootm_qnxelf':
> >    boot/bootm_os.c:392: undefined reference to `dcache_status'
> >    aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:394: undefined reference to `dcache_disable'
> >    aarch64-linux-gnu-ld.bfd: boot/bootm_os.c:399: undefined reference to `dcache_enable'
> >    aarch64-linux-gnu-ld.bfd: cmd/elf.o: in function `do_bootvx':
> >    cmd/elf.c:280: undefined reference to `dcache_disable'
> >
> > While the following error message is expected when SYS_DCACHE_OFF is
> > set:
> >    arch/arm/cpu/armv8/cache_v8.c:697:2: error:
> >        #error Please describe your MMU layout in CONFIG_SYS_MEM_MAP and enable dcache.
> >
> > the rest of the compilation errors should be fixed.
> >
> > Cc: Tom Rini <trini@konsulko.com>
> > Cc: Simon Glass <sjg@chromium.org>
> > Cc: Peng Fan <peng.fan@nxp.com>
> > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
> > ---
> >   arch/arm/cpu/armv8/Makefile | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> We should disable SYS_DCACHE_OFF (and SYS_ICACHE_OFF?) for ARMv8, and
> then rework the Makefiles too.


Ok, I have sent a v2 accordingly. Please help review the same.

Thanks,
Bhupesh
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/Makefile b/arch/arm/cpu/armv8/Makefile
index bba4f570db..6168032ffb 100644
--- a/arch/arm/cpu/armv8/Makefile
+++ b/arch/arm/cpu/armv8/Makefile
@@ -5,14 +5,12 @@ 
 
 extra-y	:= start.o
 
+obj-y	+= cache_v8.o
+obj-y	+= cache.o
 obj-y	+= cpu.o
 ifndef CONFIG_$(SPL_TPL_)TIMER
 obj-$(CONFIG_SYS_ARCH_TIMER) += generic_timer.o
 endif
-ifndef CONFIG_$(SPL_)SYS_DCACHE_OFF
-obj-y	+= cache_v8.o
-obj-y	+= cache.o
-endif
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) += exceptions.o
 else