Skip to contentSkip to conversation

riscv: remove log_debug() in enable_caches()

PATCH In review Charles Perry 2 participants 4 messages Jun 23 – Jul 26 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: remove log_debug() in enable_caches()

log_debug() cannot be used before log_init() has been called. Remove the log_debug() statement in enable_caches() since it is called after log_init() in initcall_run_r().

This fixes a bug where a RISC-V system which does not have the "zicbom" extension (such as PIC64-HPSC/HX) would get lost in an infinite loop in log_dispatch().

Fixes 9e859849e2ca ("riscv: cache: Add CBO instructions")
---
 arch/riscv/lib/cache.c | 2 --
 1 file changed, 2 deletions(-)
arch/riscv/lib/cache.c +0 -2
index 31aa30bc7d72..ac5136fa6bec 100644
@@ -149,8 +149,6 @@ __weak int dcache_status(void)
 __weak void enable_caches(void)
 {
 	zicbom_block_size = riscv_get_cbom_block_size();
-	if (!zicbom_block_size)
-		log_debug("Zicbom not initialized.\n");
 }
 
 int __weak pgprot_set_attrs(phys_addr_t addr, size_t size, enum pgprot_attrs perm)
Signature · 1 line
2.47.3
Reviewed-by Leo Yu-Chi Liang on v1 1/1
#1 lore raw
Quoted 8 lines · Charles Perry

log_debug() cannot be used before log_init() has been called. Remove the log_debug() statement in enable_caches() since it is called after log_init() in initcall_run_r().

This fixes a bug where a RISC-V system which does not have the "zicbom" extension (such as PIC64-HPSC/HX) would get lost in an infinite loop in log_dispatch().

Quoted 5 lines
Fixes 9e859849e2ca ("riscv: cache: Add CBO instructions")
---
 arch/riscv/lib/cache.c | 2 --
 1 file changed, 2 deletions(-)

Applied to u-boot-riscv/main, thanks.

Best regards,
Leo

#2 lore raw
Quoted 2 lines

Date: Sat, 25 Jul 2026 18:41:58 +0800
From: Leo Liang via U-Boot <[email protected]>

Sorry I didn't spot it before but...

Quoted 4 lines · Charles Perry
Quoted 3 lines

log_debug() cannot be used before log_init() has been called. Remove the log_debug() statement in enable_caches() since it is called after log_init() in initcall_run_r().

This part of the commit message contradicts itself. Should "after" in the second sentence be "before"?

Quoted 18 lines
Quoted 10 lines

This fixes a bug where a RISC-V system which does not have the "zicbom" extension (such as PIC64-HPSC/HX) would get lost in an infinite loop in log_dispatch().

Fixes 9e859849e2ca ("riscv: cache: Add CBO instructions")
---
 arch/riscv/lib/cache.c | 2 --
 1 file changed, 2 deletions(-)

Applied to u-boot-riscv/main, thanks.

Best regards,
Leo

#3 lore raw

Hi Mark,

Quoted 6 lines · Mark Kettenis
Quoted 3 lines

Date: Sat, 25 Jul 2026 18:41:58 +0800
From: Leo Liang via U-Boot <[email protected]>

Sorry I didn't spot it before but...

Quoted 8 lines
Quoted 4 lines · Charles Perry
Quoted 3 lines

log_debug() cannot be used before log_init() has been called. Remove the log_debug() statement in enable_caches() since it is called after log_init() in initcall_run_r().

This part of the commit message contradicts itself. Should "after" in the second sentence be "before"?

Thanks for the catch!
It should be
'log_debug() statement in enable_caches() since it is called **before** log_init() in initcall_run_r().'
I will correct it when merging the patch.

Best regards,
Leo

Quoted 18 lines
Quoted 18 lines
Quoted 10 lines

This fixes a bug where a RISC-V system which does not have the "zicbom" extension (such as PIC64-HPSC/HX) would get lost in an infinite loop in log_dispatch().

Fixes 9e859849e2ca ("riscv: cache: Add CBO instructions")
---
 arch/riscv/lib/cache.c | 2 --
 1 file changed, 2 deletions(-)

Applied to u-boot-riscv/main, thanks.

Best regards,
Leo