Re: [PATCH v18 3/7] firmware: arm_rmm: Configure the RMM with the host's page size

From: Suzuki K Poulose

Date: Mon Sep 21 2026 - 05:39:41 EST


On 19/09/2026 02:27, Jonathan Cameron 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.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Signed-off-by: Steven Price <steven.price@xxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>

One trivial but looks like it is getting quite a few changes from
Gavin's comments so no tags yet.

...

+
+ config = (struct rmm_config *)get_zeroed_page(GFP_KERNEL);
+ if (!config) {
+ pr_err("Unable to allocate memory for RMM config\n");
+ return -ENOMEM;
+ }
+
+ config->rmi_granule_size = granule_size;
+
+ /*
+ * 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 (%d)\n", ret);
+ ret = -EINVAL;
+ }
+
+ free_page((unsigned long)config);

Maybe some __free() magic is applicable here - would let you just
return in the error path above making for tidier flow and get
rid of need to assign ret above.

Ack

Cheers
Suzuki>