Re: [PATCH v4 01/15] arm64: rsi: Add RSI definitions

Gavin Shan
2024-07-09T05:19:18Z

On 7/1/24 7:54 PM, Steven Price wrote:
> From: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> The RMM (Realm Management Monitor) provides functionality that can be
> accessed by a realm guest through SMC (Realm Services Interface) calls.
>
> The SMC definitions are based on DEN0137[1] version A-eac5.
>
> [1] https://developer.arm.com/documentation/den0137/latest
>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
> Changes since v3:
> * Drop invoke_rsi_fn_smc_with_res() function and call arm_smccc_smc()
> directly instead.
> * Rename header guard in rsi_smc.h to be consistent.
> Changes since v2:
> * Rename rsi_get_version() to rsi_request_version()
> * Fix size/alignment of struct realm_config
> ---
> arch/arm64/include/asm/rsi_cmds.h | 38 ++++++++
> arch/arm64/include/asm/rsi_smc.h | 142 ++++++++++++++++++++++++++++++
> 2 files changed, 180 insertions(+)
> create mode 100644 arch/arm64/include/asm/rsi_cmds.h
> create mode 100644 arch/arm64/include/asm/rsi_smc.h
>

[...]

> --- /dev/null
> +++ b/arch/arm64/include/asm/rsi_smc.h
> @@ -0,0 +1,142 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2023 ARM Ltd.
> + */
> +
> +#ifndef __ASM_RSI_SMC_H_
> +#define __ASM_RSI_SMC_H_
> +
> +/*
> + * This file describes the Realm Services Interface (RSI) Application Binary
> + * Interface (ABI) for SMC calls made from within the Realm to the RMM and
> + * serviced by the RMM.
> + */
> +
> +#define SMC_RSI_CALL_BASE 0xC4000000
> +

These fields have been defined in include/linux/arm-smccc.h. Those definitions
can be reused. Otherwise, it's not obvious to reader what does 0xC4000000 represent.

#define SMC_RSI_CALL_BASE ((ARM_SMCCC_FAST_CALL << ARM_SMCCC_TYPE_SHIFT) | \
(ARM_SMCCC_SMC_64 << ARM_SMCCC_CALL_CONV_SHIFT) | \
(ARM_SMCCC_OWNER_STANDARD << ARM_SMCCC_OWNER_SHIFT))

or

#define SMC_RSI_CALL_BASE ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_STANDARD, \
0)

Thanks,
Gavin