[PATCH v7 05/45] arm64: RME: Add wrappers for RMI calls
Steven Price
steven.price at arm.com
Mon Mar 3 07:05:25 PST 2025
On 03/03/2025 03:42, Gavin Shan wrote:
> On 2/14/25 2:13 AM, Steven Price wrote:
>> The wrappers make the call sites easier to read and deal with the
>> boiler plate of handling the error codes from the RMM.
>>
>> Signed-off-by: Steven Price <steven.price at arm.com>
>> ---
>> Changes from v5:
>> * Further improve comments
>> Changes from v4:
>> * Improve comments
>> Changes from v2:
>> * Make output arguments optional.
>> * Mask RIPAS value rmi_rtt_read_entry()
>> * Drop unused rmi_rtt_get_phys()
>> ---
>> arch/arm64/include/asm/rmi_cmds.h | 508 ++++++++++++++++++++++++++++++
>> 1 file changed, 508 insertions(+)
>> create mode 100644 arch/arm64/include/asm/rmi_cmds.h
>>
>
> With the following nitpicks addressed:
>
> Reviewed-by: Gavin Shan <gshan at redhat.com>
Thanks, there were a couple of other pages and params_ptr references
that I've updated to granules and just 'params' too now. With hindsight
conflating pages and granules in the earlier versions of this series was
a big mistake ;)
Steve
>> diff --git a/arch/arm64/include/asm/rmi_cmds.h b/arch/arm64/include/
>> asm/rmi_cmds.h
>> new file mode 100644
>> index 000000000000..043b7ff278ee
>> --- /dev/null
>> +++ b/arch/arm64/include/asm/rmi_cmds.h
>> @@ -0,0 +1,508 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/*
>> + * Copyright (C) 2023 ARM Ltd.
>> + */
>> +
>> +#ifndef __ASM_RMI_CMDS_H
>> +#define __ASM_RMI_CMDS_H
>> +
>
> [...]
>
>> +
>> +/**
>> + * rmi_rec_aux_count() - Get number of auxiliary granules required
>> + * @rd: PA of the RD
>> + * @aux_count: Number of pages written to this pointer
> ^^^^^^^^^^^^^^^
> Number of granules
>> + *
>> + * A REC may require extra auxiliary pages to be delegated for the
>> RMM to
> ^^^^^
> granules
>
>> + * store metadata (not visible to the normal world) in. This function
>> provides
>> + * the number of pages that are required.
> ^^^^^
> granules
>> + *
>> + * Return: RMI return code
>> + */
>> +static inline int rmi_rec_aux_count(unsigned long rd, unsigned long
>> *aux_count)
>> +{
>> + struct arm_smccc_res res;
>> +
>> + arm_smccc_1_1_invoke(SMC_RMI_REC_AUX_COUNT, rd, &res);
>> +
>> + if (aux_count)
>> + *aux_count = res.a1;
>> + return res.a0;
>> +}
>> +
>> +/**
>> + * rmi_rec_create() - Create a REC
>> + * @rd: PA of the RD
>> + * @rec: PA of the target REC
>> + * @params_ptr: PA of REC parameters
>> + *
>> + * Create a REC using the parameters specified in the struct
>> rec_params pointed
>> + * to by @params_ptr.
>> + *
>> + * Return: RMI return code
>> + */
>> +static inline int rmi_rec_create(unsigned long rd, unsigned long rec,
>> + unsigned long params_ptr)
>> +{
>> + struct arm_smccc_res res;
>> +
>> + arm_smccc_1_1_invoke(SMC_RMI_REC_CREATE, rd, rec, params_ptr, &res);
>> +
>> + return res.a0;
>> +}
>> +
>
> 'params_ptr' may be renamed to 'params'.
>
>
> [...]
>> +#endif /* __ASM_RMI_CMDS_H */
>
> Thanks,
> Gavin
>
More information about the linux-arm-kernel
mailing list