[PATCH] armv8: fix Clang warning on writing 32-bit variable to a 64-bit register

Raymond Mao raymond.mao at linaro.org
Tue May 27 23:04:31 CEST 2025


Clang is stricter than GCC when it comes to inline assembly and expects the
register to be written with explicitly same type of variable.

Fixes: c0e1775a867c ("armv8: Add arch-specific sysinfo platform driver")
Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
 arch/arm/cpu/armv8/sysinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/sysinfo.c b/arch/arm/cpu/armv8/sysinfo.c
index 850142da37d..ff0abee4c6b 100644
--- a/arch/arm/cpu/armv8/sysinfo.c
+++ b/arch/arm/cpu/armv8/sysinfo.c
@@ -134,7 +134,7 @@ int sysinfo_get_cache_info(u8 level, struct cache_info *cinfo)
 
 	/* Select cache level */
 	csselr_el1 = (level << 1);
-	asm volatile("msr csselr_el1, %0" : : "r" (csselr_el1));
+	asm volatile("msr csselr_el1, %0" : : "r" ((u64)csselr_el1));
 
 	/* Read CCSIDR_EL1 */
 	asm volatile("mrs %0, ccsidr_el1" : "=r" (creg.data));
-- 
2.25.1



More information about the U-Boot mailing list