[PATCH 4/6] firmware: arm_rmm: Configure the RMM with the host's page size
Suzuki K Poulose
suzuki.poulose at arm.com
Fri Jul 31 06:21:27 PDT 2026
On 15/07/2026 15:27, Steven Price wrote:
> RMM v2.0 brings the ability to set the RMM's granule size. Check the
> feature registers and configure the RMM so that it matches the host's
> page size. This means that operations can be done with a granularity
> equal to PAGE_SIZE.
>
> Signed-off-by: Steven Price <steven.price at arm.com>
> ---
> Changes since v14:
> * Move the implementation into drivers/firmware/arm_rmm.
> Changes since v13:
> * Moved out of KVM.
> ---
> drivers/firmware/arm_rmm/rmi.c | 43 ++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/drivers/firmware/arm_rmm/rmi.c b/drivers/firmware/arm_rmm/rmi.c
> index c4850976544f..e7ab4a7df3ca 100644
> --- a/drivers/firmware/arm_rmm/rmi.c
> +++ b/drivers/firmware/arm_rmm/rmi.c
> @@ -76,6 +76,45 @@ static int rmi_read_features(void)
> return 0;
> }
>
> +static int rmi_configure(void)
> +{
> + unsigned long ret;
> + struct rmm_config *config __free(free_page) = (struct rmm_config *)get_zeroed_page(GFP_KERNEL);
> +
> + if (!config)
> + return -ENOMEM;
> +
> + switch (PAGE_SIZE) {
> + case SZ_4K:
> + config->rmi_granule_size = RMI_GRANULE_SIZE_4KB;
> + break;
> + case SZ_16K:
> + config->rmi_granule_size = RMI_GRANULE_SIZE_16KB;
> + break;
> + case SZ_64K:
> + config->rmi_granule_size = RMI_GRANULE_SIZE_64KB;
> + break;
> + default:
> + BUILD_BUG();
> + }
> +
> + /*
> + * For now we set the tracking_region_size to 0 which is the only option
> + * for 4KB PAGE_SIZE (1GB for 4KB PAGE_SIZE, 32MB/512MB for 16KB/64KB).
> + * TODO: Support other tracking sizes via Kconfig option for other
> + * PAGE_SIZES
> + */
> + config->tracking_region_size = 0;
> +
> + ret = rmi_rmm_config_set(virt_to_phys(config));
> + if (ret) {
> + pr_err("RMM config set failed\n");
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> static int __init arm64_init_rmi(void)
> {
> int ret;
> @@ -89,6 +128,10 @@ static int __init arm64_init_rmi(void)
> if (ret)
> return ret;
>
> + ret = rmi_configure();
> + if (ret)
> + return ret;
> +
Reviewed-by: Suzuki K Poulose <suzuki.poulose at arm.com>
> return 0;
> }
>
More information about the linux-arm-kernel
mailing list