Re: [PATCH v9 3/7] firmware: arm_rmm: Move RSI support out of arch/arm64

Aneesh Kumar K.V <[email protected]>
Newsgroups dev.linux.lists.linux-coco,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Catalin Marinas <[email protected]> writes:

> On Wed, Aug 05, 2026 at 12:02:51PM +0530, Aneesh Kumar K.V (Arm) wrote:
>> The RSI SMCCC function IDs describe a firmware ABI and are not arm64
>> architecture specific definitions. Follow-up changes need to use them from
>> non-arch code, including drivers/firmware/smccc and the Arm CCA guest
>> driver.
>> 
>> Move the complete Realm Service Interface (RSI) implementation from
>> arch/arm64 to drivers/firmware/arm_rmm. The RSI SMCCC definitions and
>> command helpers are also moved to include/linux so they can be shared by
>> architecture code and firmware or driver code. This also keeps the
>> firmware interface outside architecture code, as requested [1].
>> 
>> [1] https://lore.kernel.org/all/agsNO9cc7H-b0H8L@willie-the-truck
>> 
>> Signed-off-by: Aneesh Kumar K.V (Arm) <[email protected]>
>
> I haven't checked but Sashiko has some points that it may break the
> build on other architectures with COMPILE_TEST.
>
> https://sashiko.dev/#/patchset/[email protected]
>
> (for some reason I get error 502 above; hopefully it's temporary)
>

Below is the sashiko output

>> -#endif /* __ASM_RSI_CMDS_H */
>> +#endif /* __LINUX_ARM_RSI_CMDS_H_ */
> Now that this header is moved to include/linux/ to be shared by cross
> architecture code, will it break non-ARM64 builds?
> Looking at rsi_attestation_token_init() further up in this file:
>    struct arm_smccc_1_2_regs regs;
>    ...
>    arm_smccc_1_2_smc(&args.regs, &args.regs);
>    
> Both struct arm_smccc_1_2_regs and arm_smccc_1_2_smc() are guarded by
> CONFIG_ARM64 in include/linux/arm-smccc.h. If a generic firmware driver
> using COMPILE_TEST includes this header on a different architecture, it
> seems compilation will fail.

Only arm64 code is including that header for now.

arch/arm64/mm/init.c:37:#include <linux/arm-rsi-cmds.h>
arch/arm64/include/asm/mem_encrypt.h:5:#include <linux/arm-rsi-cmds.h>
arch/arm64/include/asm/pgtable-prot.h:69:#include <linux/arm-rsi-cmds.h>
arch/arm64/include/asm/io.h:11:#include <linux/arm-rsi-cmds.h>
arch/arm64/kernel/setup.c:10:#include <linux/arm-rsi-cmds.h>
drivers/virt/coco/arm-cca-guest/arm-cca.c:6:#include <linux/arm-rsi-cmds.h>
drivers/firmware/arm_rmm/rsi.c:11:#include <linux/arm-rsi-cmds.h>

-aneesh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.