Re: [PATCH v3 1/6] arm64: rsi: Add RSI host call structure and helper function
Will Deacon <[email protected]> Tue, 4 Aug 2026 14:25:42 +0100
| Newsgroups | org.kernel.vger.linux-arch,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-hyperv,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <anHoVr_PRkBHRGu3@willie-the-truck> |
On Tue, Jul 21, 2026 at 01:11:43PM -0700, Kameron Carr wrote: > Add struct rsi_host_call to rsi_smc.h, which represents the host call > data structure used by the Realm Management Monitor (RMM) for the > RSI_HOST_CALL interface. The structure contains a 16-bit immediate field > and 31 general-purpose register values, aligned to 256 bytes as required > by the CCA RMM specification. > > Add rsi_host_call() static inline wrapper in rsi_cmds.h that invokes > SMC_RSI_HOST_CALL with the physical address of the host call structure. > This will be used by Hyper-V guest code to route hypercalls through the > RSI interface when running inside an Arm CCA Realm. > > Signed-off-by: Kameron Carr <[email protected]> > --- > arch/arm64/include/asm/rsi_cmds.h | 22 ++++++++++++++++++++++ > arch/arm64/include/asm/rsi_smc.h | 7 +++++++ > 2 files changed, 29 insertions(+) > > diff --git a/arch/arm64/include/asm/rsi_cmds.h b/arch/arm64/include/asm/rsi_cmds.h > index 2c8763876dfb7..9daf8008e5da2 100644 > --- a/arch/arm64/include/asm/rsi_cmds.h > +++ b/arch/arm64/include/asm/rsi_cmds.h > @@ -88,6 +88,28 @@ static inline long rsi_set_addr_range_state(phys_addr_t start, > return res.a0; > } > > +/** > + * rsi_host_call - Make a Host call. > + * @host_call_struct: IPA of host call structure > + * > + * This call will fail if the IPA of the host call structure: > + * * is not aligned to 256 bytes, > + * * is not protected / encrypted, > + * * is RIPAS_EMPTY > + * > + * Returns: > + * On success, returns RSI_SUCCESS. > + * Otherwise, returns an error code. > + */ > +static inline unsigned long rsi_host_call(phys_addr_t host_call_struct) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_smc(SMC_RSI_HOST_CALL, host_call_struct, 0, 0, 0, 0, 0, 0, > + &res); > + return res.a0; > +} As I've mentioned to Aneesh on two occasions already [1][2], this code should be moved out of arch/arm64 before we add anything else to it. Thanks, Will [1] https://lore.kernel.org/r/agsNO9cc7H-b0H8L@willie-the-truck [2] https://lore.kernel.org/r/al_svOwkb5SleTWg@willie-the-truck