Re: [PATCH v17 7/7] firmware: arm_rmm: Add wrappers for Realm related RMI commands

From: Suzuki K Poulose

Date: Wed Sep 09 2026 - 04:58:21 EST


On 09/09/2026 08:15, Gavin Shan wrote:
On 9/7/26 7:59 PM, Suzuki K Poulose wrote:
From: Steven Price <steven.price@xxxxxxx>

Introduce wrappers for the RMI functions needed for creating and
managing realm guests. This will be used by the KVM to manage the
Realms

Signed-off-by: Steven Price <steven.price@xxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
Changes since v16:
   * Split into a separate patch and move away from arch/arm64 to
     include/linux/.
   * Also moved into the firmware_rmm series from the KVM CCA support.
     This is done in a hope to reduce the merge conflicts and make
     the KVM CCA upstreaming in independent parallel chunks
---
  include/linux/arm-rmi-cmds.h | 453 +++++++++++++++++++++++++++++++++++
  1 file changed, 453 insertions(+)

diff --git a/include/linux/arm-rmi-cmds.h b/include/linux/arm-rmi-cmds.h
index 79e2c1f165112..746257d77dd61 100644
--- a/include/linux/arm-rmi-cmds.h
+++ b/include/linux/arm-rmi-cmds.h
@@ -222,4 +222,457 @@ static inline long rmi_granule_range_undelegate(unsigned long base,
      return ret;
  }
+/**
+ * rmi_rtt_data_map_init() - Create a protected mapping with data contents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

s/Create a protected mapping with data contents/Create a mappings in protected IPA with known contents

Ack.


With this, it's consistently counterpart of the comments for rmi_rtt_data_map().




...



The nested if statements can be avoided if we have:

    if (ret != RMI_SUCCESS)
        return ret;

    if (out_top)
        *out_top = regs.a1;
    if (out_range)
        *out_range = regs.a2;
    if (out_count)
        *out_count = regs.a3;

    return RMI_SUCCESS;

Done for all of them.

...
+/**
+ * rmi_realm_activate() - Active a realm
+ * @rd: PA of the RD
+ *
+ * Mark a realm as Active signalling that creation is complete and allowing
                                                         ^^^^^^^^

s/complete/completed ?

I have changed this :

/**
- * rmi_realm_activate() - Active a realm
+ * rmi_realm_activate() - Activate a realm
* @rd: PA of the RD
*
- * Mark a realm as Active signalling that creation is complete and allowing
+ * Mark a realm as Active, signalling that creation is completed, allowing
* execution of the realm.

Addressed the rest of the comments.

Thank you for your detailed look at the patches, much appreciated !

Cheers
Suzuki