Re: [PATCH v19 15/20] KVM: arm64: CCA: Introduce Realms
From: Gavin Shan
Date: Sun Sep 27 2026 - 21:28:36 EST
On 9/21/26 7:28 AM, Suzuki K Poulose wrote:
From: Steven Price <steven.price@xxxxxxx>Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>
Add foundational work for supporting Realms.
- Add a new VM flavor.
- At KVM init, check if the KVM can support Realms (though not functional yet)
and will be advertised by static key kvm_rmi_is_available. This will be
turned on in a later patches, once we have all the bits and pieces ready.
For now check if we are blessed with KVM_MODE_RMM.
- Add realm specific tracking in kvm_arch. Since Realm and protected pKVM
states are mutually exclusive, move them into a union.
Please note that we cannot create Realm VMs yet. This requires further changes
to the UABI and core RMI driver support, which will come later.
Signed-off-by: Steven Price <steven.price@xxxxxxx>
Co-developed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
Changes since v16:
* Share mutually exclusive pKVM and Realm per-VM storage in a union.
* Move to the new VM flavor infrastructure, split bits out. Trimmed down
* Move in Realm state and basic boiler plates
Changes since v13:
* Most of the init has been moved out of the 'kvm' directory so this is
much more basic now.
Changes since v12:
* Drop check for 4k page size.
Changes since v11:
* Reword slightly the comments on the realm states.
Changes since v10:
* kvm_is_realm() no longer has a NULL check.
* Rename from "rme" to "rmi" when referring to the RMM interface.
* Check for RME (hardware) support before probing for RMI support.
Changes since v8:
* No need to guard kvm_init_rme() behind 'in_hyp_mode'.
Changes since v6:
* Improved message for an unsupported RMI ABI version.
Changes since v5:
* Reword "unsupported" message from "host supports" to "we want" to
clarify that 'we' are the 'host'.
Changes since v2:
* Drop return value from kvm_init_rme(), it was always 0.
* Rely on the RMM return value to identify whether the RSI ABI is
compatible.
---
arch/arm64/include/asm/kvm_emulate.h | 16 ++++++++
arch/arm64/include/asm/kvm_host.h | 18 +++++---
arch/arm64/include/asm/kvm_rmi.h | 61 ++++++++++++++++++++++++++++
arch/arm64/include/asm/virt.h | 1 +
arch/arm64/kvm/Makefile | 2 +-
arch/arm64/kvm/arm.c | 6 +++
arch/arm64/kvm/mmu.c | 1 +
arch/arm64/kvm/rmi.c | 18 ++++++++
8 files changed, 117 insertions(+), 6 deletions(-)
create mode 100644 arch/arm64/include/asm/kvm_rmi.h
create mode 100644 arch/arm64/kvm/rmi.c