]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/boards: Add a MachineState parameter to kvm_type callback
authorEric Auger <eric.auger@redhat.com>
Mon, 4 Mar 2019 10:13:33 +0000 (11:13 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 5 Mar 2019 15:55:09 +0000 (15:55 +0000)
On ARM, the kvm_type will be resolved by querying the KVMState.
Let's add the MachineState handle to the callback so that we
can retrieve the  KVMState handle. in kvm_init, when the callback
is called, the kvm_state variable is not yet set.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 20190304101339.25970-5-eric.auger@redhat.com
[ppc parts]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
accel/kvm/kvm-all.c
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c
hw/ppc/spapr.c
include/hw/boards.h

index fd92b6f37547dda48c5edc0d8578adb5470a421c..241db496c3d5c198b3ba3e6cdaffcb3070db4f4c 100644 (file)
@@ -1593,7 +1593,7 @@ static int kvm_init(MachineState *ms)
 
     kvm_type = qemu_opt_get(qemu_get_machine_opts(), "kvm-type");
     if (mc->kvm_type) {
-        type = mc->kvm_type(kvm_type);
+        type = mc->kvm_type(ms, kvm_type);
     } else if (kvm_type) {
         ret = -EINVAL;
         fprintf(stderr, "Invalid argument kvm-type=%s\n", kvm_type);
index 98461052ac0a80d4e3c931f2201322d70a7251dd..97e88171450ebfef2d1424ec0bd7da004a64f910 100644 (file)
@@ -564,8 +564,7 @@ static char *core99_fw_dev_path(FWPathProvider *p, BusState *bus,
 
     return NULL;
 }
-
-static int core99_kvm_type(const char *arg)
+static int core99_kvm_type(MachineState *machine, const char *arg)
 {
     /* Always force PR KVM */
     return 2;
index 284431ddd68278c077246cb72ad9e4226fecedb5..cc1e463466d4178acc959f5e716f4b486c61117f 100644 (file)
@@ -420,7 +420,7 @@ static char *heathrow_fw_dev_path(FWPathProvider *p, BusState *bus,
     return NULL;
 }
 
-static int heathrow_kvm_type(const char *arg)
+static int heathrow_kvm_type(MachineState *machine, const char *arg)
 {
     /* Always force PR KVM */
     return 2;
index b6a571b6f184fdfd24ede7fdcddc0e75dbc6585e..d7850ada7dfbbf8ac690d57624ede239d681225c 100644 (file)
@@ -3023,7 +3023,7 @@ static void spapr_machine_init(MachineState *machine)
     }
 }
 
-static int spapr_kvm_type(const char *vm_type)
+static int spapr_kvm_type(MachineState *machine, const char *vm_type)
 {
     if (!vm_type) {
         return 0;
index 21212f085902a0a17c5eaa7291e3afdbd20c9729..9690c71a6d7916615df6269a83d9d367702642bd 100644 (file)
@@ -156,6 +156,9 @@ typedef struct {
  *    should instead use "unimplemented-device" for all memory ranges where
  *    the guest will attempt to probe for a device that QEMU doesn't
  *    implement and a stub device is required.
+ * @kvm_type:
+ *    Return the type of KVM corresponding to the kvm-type string option or
+ *    computed based on other criteria such as the host kernel capabilities.
  */
 struct MachineClass {
     /*< private >*/
@@ -171,7 +174,7 @@ struct MachineClass {
     void (*init)(MachineState *state);
     void (*reset)(void);
     void (*hot_add_cpu)(const int64_t id, Error **errp);
-    int (*kvm_type)(const char *arg);
+    int (*kvm_type)(MachineState *machine, const char *arg);
 
     BlockInterfaceType block_default_type;
     int units_per_default_bus;