Skip to contentSkip to conversation

spl: atf: Fix clang -Wasm-operand-widths warning

PATCH In review Alistair Delva 2 participants 2 messages Sep 26, 2022 – Oct 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: atf: Fix clang -Wasm-operand-widths warning

common/spl/spl_atf.c:187:51: warning: value size does not match register
size specified by the constraint and modifier [-Wasm-operand-widths]

    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                                     ^
common/spl/spl_atf.c:187:34: note: use constraint modifier "w"
    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                    ^~
                                    %w0

Use %x0 to match what Linux does in <asm/sysreg.h> write_sysreg().

Cc Kever Yang <[email protected]>
Cc Michael Walle <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 common/spl/spl_atf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_atf.c +1 -1
index e1b68dd561..bae5c010c8 100644
@@ -184,7 +184,7 @@ __weak struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry,
 
 static inline void raw_write_daif(unsigned int daif)
 {
-	__asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
+	__asm__ __volatile__("msr DAIF, %x0\n\t" : : "r" (daif) : "memory");
 }
 
 typedef void (*atf_entry_t)(struct bl31_params *params, void *plat_params);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 9 lines · Alistair Delva

common/spl/spl_atf.c:187:51: warning: value size does not match register
size specified by the constraint and modifier [-Wasm-operand-widths]

    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                                     ^
common/spl/spl_atf.c:187:34: note: use constraint modifier "w"
    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                    ^~
                                    %w0
Quoted 8 lines

Use %x0 to match what Linux does in <asm/sysreg.h> write_sysreg().

Cc Kever Yang <[email protected]>
Cc Michael Walle <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Nick Desaulniers <[email protected]>

Applied to u-boot/master, thanks!

Signature · 1 line
Tom