[PATCH v3 4/7] riscv/runtime-const: Introduce runtime_const_mask_32()

K Prateek Nayak kprateek.nayak at amd.com
Fri Apr 3 03:35:17 PDT 2026


Hello Guo,

On 4/3/2026 3:12 PM, Guo Ren wrote:
>> diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
>> index d766e2b9e6df..85efba8ecf12 100644
>> --- a/arch/riscv/include/asm/runtime-const.h
>> +++ b/arch/riscv/include/asm/runtime-const.h
>> @@ -153,6 +153,22 @@
>>         __ret;                                                  \
>>  })
>>
>> +#define runtime_const_mask_32(val, sym)                                \
>> +({                                                             \
>> +       u32 __mask;                                             \
>> +       asm_inline(".option push\n\t"                           \
>> +               ".option norvc\n\t"                             \
>> +               "1:\t"                                          \
>> +               "lui    %[__mask],0x89abd\n\t"                  \
>> +               "addi   %[__mask],%[__mask],-0x211\n\t"         \
> Ref include/uapi/linux/reboot.h:
> #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
> 
> #define RUNTIME_MAGIC 0x89ABCDEF
> 
> "lui %[__mask], %%hi(RUNTIME_MAGIC)\n\t"
> "addi %[__mask], %[__mask], %%lo(RUNTIME_MAGIC)\n\t"

Ack! I'll clean it up in the next version while also fixing the
stuff that Sashiko reported.

Thanks a ton for taking a look at the series.

> 
> 
>> +               ".option pop\n\t"                               \
>> +               ".pushsection runtime_mask_" #sym ",\"a\"\n\t"  \
>> +               ".long 1b - .\n\t"                              \
>> +               ".popsection"                                   \
>> +               : [__mask] "=r" (__mask));                      \
>> +       (__mask & val);                                         \
>> +})
-- 
Thanks and Regards,
Prateek




More information about the linux-arm-kernel mailing list