Allows to set the kvm-hidden-regs and kvm-fake-regs array properties.
This will allow to define such compat machine props like:
static GlobalProperty arm_virt_kernel_compat_10_1[] = {
/* KVM_REG_ARM_VENDOR_HYP_BMAP_2 */
{ TYPE_ARM_CPU, "kvm-hidden-regs", "0x6030000000160003" },
{ TYPE_ARM_CPU, "kvm-enforced-regs",
/* TCR_EL1, PIRE0_EL1, PIR_EL1 */
"0x603000000013c103, 0x603000000013c512, 0x603000000013c513" },
}
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
target/arm/kvm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 1a95e2c667..d103d4293d 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -39,6 +39,8 @@
#include "qemu/log.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/ghes.h"
+#include "hw/qdev-properties.h"
+#include "hw/qdev-properties-system.h"
#include "target/arm/gtimer.h"
#include "migration/blocker.h"
@@ -484,6 +486,15 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)
ARM_CPU(obj)->kvm_steal_time = value ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
}
+static const Property arm_cpu_kvm_compat_hidden_regs_property =
+ DEFINE_PROP_ARRAY("kvm-hidden-regs", ARMCPU,
+ nr_kvm_hidden_regs, kvm_hidden_regs, qdev_prop_uint64, uint64_t);
+
+static const Property arm_cpu_kvm_compat_enforced_regs_property =
+ DEFINE_PROP_ARRAY("kvm-enforced-regs", ARMCPU,
+ nr_kvm_enforced_regs, kvm_enforced_regs,
+ qdev_prop_uint64, uint64_t);
+
/* KVM VCPU properties should be prefixed with "kvm-". */
void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
{
@@ -505,6 +516,9 @@ void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
kvm_steal_time_set);
object_property_set_description(obj, "kvm-steal-time",
"Set off to disable KVM steal time.");
+
+ qdev_property_add_static(DEVICE(obj), &arm_cpu_kvm_compat_hidden_regs_property);
+ qdev_property_add_static(DEVICE(obj), &arm_cpu_kvm_compat_enforced_regs_property);
}
bool kvm_arm_pmu_supported(void)
--
2.49.0