[PATCH qemu-8.2.0 0/2] Add ipiv=on/off option

Add `-accel kvm,ipiv=on` to enable ipiv on the virtual machine. Jinqian Yang (2): Revert "hw/arm/virt: Introduce a IPIV machine option" target/arm: add ipiv=on/off option hw/arm/virt.c | 19 ------------------- include/hw/arm/virt.h | 1 - include/sysemu/kvm_int.h | 1 + target/arm/kvm.c | 28 +++++++++++++++++++++++----- 4 files changed, 24 insertions(+), 25 deletions(-) -- 2.33.0

This reverts commit 9db5487d84eef5ba38adefb70138644d1012f05f. This patch will cause virsh to fail to start because libvirt first starts a QEMU process with `-machine none` for initialization, and then starts one with `-machine virt`. When using `-machine none`, the VIRT_MACHINE conversion will result in an error. Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- hw/arm/virt.c | 19 ------------------- include/hw/arm/virt.h | 1 - target/arm/kvm.c | 10 ++-------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index db1b9715e0..f7a9ba9a58 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3044,20 +3044,6 @@ static void virt_set_its(Object *obj, bool value, Error **errp) vms->its = value; } -static bool virt_get_ipiv(Object *obj, Error **errp) -{ - VirtMachineState *vms = VIRT_MACHINE(obj); - - return vms->ipiv; -} - -static void virt_set_ipiv(Object *obj, bool value, Error **errp) -{ - VirtMachineState *vms = VIRT_MACHINE(obj); - - vms->ipiv = value; -} - static void virt_get_dtb_randomness(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -4100,11 +4086,6 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) "in ACPI table header." "The string may be up to 8 bytes in size"); - object_class_property_add_bool(oc, "ipiv", - virt_get_ipiv, - virt_set_ipiv); - object_class_property_set_description(oc, "ipiv", - "Set on/off to enable/disable IPIV"); } static char *virt_get_kvm_type(Object *obj, Error **errp G_GNUC_UNUSED) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index a54b0057fb..fee7c27e0c 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -225,7 +225,6 @@ struct VirtMachineState { bool cpu_hotplug_enabled; bool ras; bool mte; - bool ipiv; OnOffAuto dtb_randomness; bool pmu; int smmu_accel_count; diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 7d443a967d..f45783a9da 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -34,7 +34,6 @@ #include "hw/irq.h" #include "qapi/visitor.h" #include "qemu/log.h" -#include "hw/arm/virt.h" const KVMCapabilityInfo kvm_arch_required_capabilities[] = { KVM_CAP_LAST_INFO @@ -260,15 +259,10 @@ int kvm_arch_get_default_type(MachineState *ms) return fixed_ipa ? 0 : size; } -static void kvm_update_ipiv_cap(MachineState *ms, KVMState *s) +static void kvm_update_ipiv_cap(KVMState *s) { - VirtMachineState *vms = VIRT_MACHINE(ms); int ret; - if (!vms->ipiv) { - return; - } - if (!kvm_check_extension(s, KVM_CAP_ARM_HISI_IPIV)) { return; } @@ -355,7 +349,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } kvm_arm_init_debug(s); - kvm_update_ipiv_cap(ms, s); + kvm_update_ipiv_cap(s); ret = kvm_arm_rme_init(ms); if (ret) { -- 2.33.0

If IPIV is required to be enabled on the virtual machine, must add `-accel kvm,ipiv=on`. Adding the IPIV switch in QEMU ensures that the guest's IPIV can be flexibly disabled in certain scenarios, such as cross-generation live migration. Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- include/sysemu/kvm_int.h | 1 + target/arm/kvm.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index 9a7bc1a4b8..7b90117a86 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -122,6 +122,7 @@ struct KVMState uint32_t xen_caps; uint16_t xen_gnttab_max_frames; uint16_t xen_evtchn_max_pirq; + bool ipiv; }; void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, diff --git a/target/arm/kvm.c b/target/arm/kvm.c index f45783a9da..599c2c2462 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -263,6 +263,10 @@ static void kvm_update_ipiv_cap(KVMState *s) { int ret; + if (!s->ipiv) { + return; + } + if (!kvm_check_extension(s, KVM_CAP_ARM_HISI_IPIV)) { return; } @@ -1364,6 +1368,20 @@ static void kvm_arch_set_eager_split_size(Object *obj, Visitor *v, s->kvm_eager_split_size = value; } +static bool virt_get_ipiv(Object *obj, Error **errp) +{ + KVMState *s = KVM_STATE(obj); + + return s->ipiv; +} + +static void virt_set_ipiv(Object *obj, bool value, Error **errp) +{ + KVMState *s = KVM_STATE(obj); + + s->ipiv = value; +} + void kvm_arch_accel_class_init(ObjectClass *oc) { object_class_property_add(oc, "eager-split-size", "size", @@ -1372,4 +1390,10 @@ void kvm_arch_accel_class_init(ObjectClass *oc) object_class_property_set_description(oc, "eager-split-size", "Eager Page Split chunk size for hugepages. (default: 0, disabled)"); + + object_class_property_add_bool(oc, "ipiv", + virt_get_ipiv, + virt_set_ipiv); + object_class_property_set_description(oc, "ipiv", + "Set on/off to enable/disable IPIV"); } -- 2.33.0
participants (1)
-
Jinqian Yang