[RFC PATCH v1 11/38] KVM: arm64: CCA: register host tsm platform device

Aneesh Kumar K.V (Arm)
2025-07-28T13:53:42Z

Register a platform device if the CCA DA feature is supported.
A driver for this platform device will further drive the CCA DA workflow.

Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
---
arch/arm64/include/asm/rmi_smc.h | 3 +++
arch/arm64/kvm/rme.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)

diff --git a/arch/arm64/include/asm/rmi_smc.h b/arch/arm64/include/asm/rmi_smc.h
index 504009a42035..42708d500048 100644
--- a/arch/arm64/include/asm/rmi_smc.h
+++ b/arch/arm64/include/asm/rmi_smc.h
@@ -12,6 +12,8 @@

#include <linux/arm-smccc.h>

+#define RMI_DEV_NAME "arm-rmi-dev"
+
#define SMC_RMI_CALL(func) \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
ARM_SMCCC_SMC_64, \
@@ -87,6 +89,7 @@ enum rmi_ripas {
#define RMI_FEATURE_REGISTER_0_GICV3_NUM_LRS GENMASK(37, 34)
#define RMI_FEATURE_REGISTER_0_MAX_RECS_ORDER GENMASK(41, 38)
#define RMI_FEATURE_REGISTER_0_Reserved GENMASK(63, 42)
+#define RMI_FEATURE_REGISTER_0_DA BIT(42)

#define RMI_REALM_PARAM_FLAG_LPA2 BIT(0)
#define RMI_REALM_PARAM_FLAG_SVE BIT(1)
diff --git a/arch/arm64/kvm/rme.c b/arch/arm64/kvm/rme.c
index ec8093ec2da3..d1c147aba2ed 100644
--- a/arch/arm64/kvm/rme.c
+++ b/arch/arm64/kvm/rme.c
@@ -4,6 +4,7 @@
*/

#include <linux/kvm_host.h>
+#include <linux/platform_device.h>

#include <asm/kvm_emulate.h>
#include <asm/kvm_mmu.h>
@@ -1724,6 +1725,18 @@ int kvm_init_realm_vm(struct kvm *kvm)
return 0;
}

+static struct platform_device cca_host_dev = {
+ .name = RMI_DEV_NAME,
+ .id = PLATFORM_DEVID_NONE
+};
+
+static void rmm_tsm_init(void)
+{
+ if (!platform_device_register(&cca_host_dev))
+ pr_info("CCA host DA platform device initialized.\n");
+
+}
+
void kvm_init_rme(void)
{
if (PAGE_SIZE != SZ_4K)
@@ -1737,6 +1750,9 @@ void kvm_init_rme(void)
if (WARN_ON(rmi_features(0, &rmm_feat_reg0)))
return;

+ if (rme_has_feature(RMI_FEATURE_REGISTER_0_DA))
+ rmm_tsm_init();
+
if (rme_vmid_init())
return;

--
2.43.0