[RFC kvmtool 14/31] arm64: Add configuration step for Realms
Suzuki K Poulose
suzuki.poulose at arm.com
Fri Jan 27 03:39:15 PST 2023
Realm must be configured before it is created. Add the
step to specify the parameters for the Realm.
Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
---
arm/aarch64/realm.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arm/aarch64/realm.c b/arm/aarch64/realm.c
index 3a4adb66..31543e55 100644
--- a/arm/aarch64/realm.c
+++ b/arm/aarch64/realm.c
@@ -2,6 +2,29 @@
#include <asm/realm.h>
+
+static void realm_configure_hash_algo(struct kvm *kvm)
+{
+ struct kvm_cap_arm_rme_config_item hash_algo_cfg = {
+ .cfg = KVM_CAP_ARM_RME_CFG_HASH_ALGO,
+ .hash_algo = kvm->arch.measurement_algo,
+ };
+
+ struct kvm_enable_cap rme_config = {
+ .cap = KVM_CAP_ARM_RME,
+ .args[0] = KVM_CAP_ARM_RME_CONFIG_REALM,
+ .args[1] = (u64)&hash_algo_cfg,
+ };
+
+ if (ioctl(kvm->vm_fd, KVM_ENABLE_CAP, &rme_config) < 0)
+ die_perror("KVM_CAP_RME(KVM_CAP_ARM_RME_CONFIG_REALM) hash_algo");
+}
+
+static void realm_configure_parameters(struct kvm *kvm)
+{
+ realm_configure_hash_algo(kvm);
+}
+
void kvm_arm_realm_create_realm_descriptor(struct kvm *kvm)
{
struct kvm_enable_cap rme_create_rd = {
@@ -9,6 +32,7 @@ void kvm_arm_realm_create_realm_descriptor(struct kvm *kvm)
.args[0] = KVM_CAP_ARM_RME_CREATE_RD,
};
+ realm_configure_parameters(kvm);
if (ioctl(kvm->vm_fd, KVM_ENABLE_CAP, &rme_create_rd) < 0)
die_perror("KVM_CAP_RME(KVM_CAP_ARM_RME_CREATE_RD)");
}
--
2.34.1
More information about the linux-arm-kernel
mailing list