hvf: arm: add experimental VHE (x-vhe) toggle
cover hvf: arm: add experimental VHE (x-vhe) toggle
macOS 27.0 has a pre-release VHE implementation. Add support for it in QEMU.
The first patch in the series is an independent bugfix that should be backported to QEMU 11.1 too.
Mohamed Mediouni (3):
hvf: arm: advertise ID_AA64PFR0_EL1.GIC
hvf: arm: add experimental VHE toggle
hvf: arm: advertise EL3 support when VHE is on
accel/hvf/hvf-all.c | 2 + include/system/hvf_int.h | 1 + target/arm/hvf/hvf.c | 103 +++++++++++++++++++++++++++++++++++++++ target/i386/hvf/hvf.c | 4 ++ 4 files changed, 110 insertions(+)
Signature · 1 line
2.54.0 (Apple Git-156)
PATCH 1/3 hvf: arm: advertise ID_AA64PFR0_EL1.GIC
For the kernel-irqchip=on case, advertise ID_AA64PFR0_EL1.GIC.
--- target/arm/hvf/hvf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
target/arm/hvf/hvf.c +12 -0
@@ -1229,6 +1229,18 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)FIELD_DP64_IDREG (&host_isar,ID_AA64PFR1 ,SME ,0 ); } +/* +* On HVF, kernel-irqchip implies GICv3. +* The kernel-irqchip=off,gic-version=3 legacy case also supports +* the host CPU interface but advertising it in ID_AA64PFR0_EL1 +* is not implemented yet. +*/ + +if (hvf_irqchip_in_kernel ()) { +/* Advertise the GIC system register interface */ +FIELD_DP64_IDREG (&host_isar,ID_AA64PFR0 ,GIC ,1 ); + } + ahcf->isar = host_isar;/*
Signature · 1 line
2.54.0 (Apple Git-156)
PATCH 2/3 hvf: arm: add experimental VHE toggle
In reply to Mohamed MediounimacOS 27.0 ships with an experimental VHE enablement private API. Expose support for it as x-vhe.
--- accel/hvf/hvf-all.c | 2 + include/system/hvf_int.h | 1 + target/arm/hvf/hvf.c | 89 ++++++++++++++++++++++++++++++++++++++++ target/i386/hvf/hvf.c | 4 ++ 4 files changed, 96 insertions(+)
accel/hvf/hvf-all.c +2 -0
@@ -282,6 +282,8 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data) NULL, NULL);object_class_property_set_description (oc,"kernel-irqchip" ,"Configure HVF irqchip" ); + +hvf_arch_accel_class_init (oc); }static const TypeInfo hvf_accel_type = {
include/system/hvf_int.h +1 -0
@@ -110,5 +110,6 @@ int hvf_update_guest_debug(CPUState *cpu);bool hvf_arch_cpu_realize (CPUState *cpu,Error **errp);uint32_t hvf_arch_get_default_ipa_bit_size (void );uint32_t hvf_arch_get_max_ipa_bit_size (void ); +void hvf_arch_accel_class_init (ObjectClass *oc);#endif
target/arm/hvf/hvf.c +89 -0
119 lines not on this page · raw message
target/i386/hvf/hvf.c +4 -0
@@ -1068,3 +1068,7 @@ void hvf_arch_remove_all_gdbstub_hw_breakpoints(void)void hvf_arch_update_guest_debug (CPUState *cpu) { } + +void hvf_arch_accel_class_init (ObjectClass *oc) +{ +}
Signature · 1 line
2.54.0 (Apple Git-156)
PATCH 3/3 hvf: arm: advertise EL3 support when VHE is on
In reply to Mohamed MediouniThis replicates the typical KVM configuration, and Hyper-V wants it.
--- target/arm/hvf/hvf.c | 2 ++ 1 file changed, 2 insertions(+)
target/arm/hvf/hvf.c +2 -0
@@ -1286,6 +1286,8 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)if (hvf_get_vhe ()) {FIELD_DP64_IDREG (&host_isar,ID_AA64MMFR1 ,VH ,0x1 ); } +/* Hyper-V doesn't launch if EL3 isn't advertised. */ +FIELD_DP64_IDREG (&host_isar,ID_AA64PFR0 ,EL3 ,0x1 ); }/*
Signature · 1 line
2.54.0 (Apple Git-156)