kvm: allow target-specific accelerator properties
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 29 Sep 2022 07:20:12 +0000 (15:20 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 10 Oct 2022 07:23:16 +0000 (09:23 +0200)
Several hypervisor capabilities in KVM are target-specific.  When exposed
to QEMU users as accelerator properties (i.e. -accel kvm,prop=value), they
should not be available for all targets.

Add a hook for targets to add their own properties to -accel kvm, for
now no such property is defined.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220929072014.20705-3-chenyi.qiang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c
include/sysemu/kvm.h
target/arm/kvm.c
target/i386/kvm/kvm.c
target/mips/kvm.c
target/ppc/kvm.c
target/riscv/kvm.c
target/s390x/kvm/kvm.c

index 423fb1936f6179c643eda484c8c6709be9551aa0..03a69cf053895026ac3a025a9f10dc40df518087 100644 (file)
@@ -3731,6 +3731,8 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data)
         NULL, NULL);
     object_class_property_set_description(oc, "dirty-ring-size",
         "Size of KVM dirty page ring buffer (default: 0, i.e. use bitmap)");
+
+    kvm_arch_accel_class_init(oc);
 }
 
 static const TypeInfo kvm_accel_type = {
index 790d35ef783dd04042076fc9e89a42e8ad2c1fbd..e9a97eda8c00c177ddb5725e49160c1c0f82c30e 100644 (file)
@@ -349,6 +349,8 @@ bool kvm_device_supported(int vmfd, uint64_t type);
 
 extern const KVMCapabilityInfo kvm_arch_required_capabilities[];
 
+void kvm_arch_accel_class_init(ObjectClass *oc);
+
 void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run);
 MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run);
 
index e5c1bd50d29baf1795ae38b93ac13eac53965f46..d21603cf28e33793ea9a62f7b6cbeed7a468aa10 100644 (file)
@@ -1056,3 +1056,7 @@ bool kvm_arch_cpu_check_are_resettable(void)
 {
     return true;
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}
index 3ebe8b7f1f7ea224b0723b144f2a31b880d5f825..f18d21413c87696dcaa69275fc6bc68bbdee656a 100644 (file)
@@ -5468,3 +5468,7 @@ void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask)
         mask &= ~BIT_ULL(bit);
     }
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}
index caf70decd2a5ca372b2326ff2c8aeeb243ad8866..bcb8e06b2cb40b7fbdaff268138bd31e4f67e421 100644 (file)
@@ -1294,3 +1294,7 @@ bool kvm_arch_cpu_check_are_resettable(void)
 {
     return true;
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}
index 466d0d2f4c85fc4df5b13b8dd05757c91b26af91..7c25348b7b240fef3d7894a88d3f1bc8590a0281 100644 (file)
@@ -2966,3 +2966,7 @@ bool kvm_arch_cpu_check_are_resettable(void)
 {
     return true;
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}
index 70b4cff06fbb31fdeb4f535a7646505d84cdc930..30f21453d69ca0aa71737dcaa9b27d84aa4d6713 100644 (file)
@@ -532,3 +532,7 @@ bool kvm_arch_cpu_check_are_resettable(void)
 {
     return true;
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}
index 6a8dbadf7ed0f8a15a8c22e64a439a6c8bc01b9d..508c24cfec6d2090c37056255ac2668be34a34a3 100644 (file)
@@ -2581,3 +2581,7 @@ int kvm_s390_get_zpci_op(void)
 {
     return cap_zpci_op;
 }
+
+void kvm_arch_accel_class_init(ObjectClass *oc)
+{
+}