]> git.proxmox.com Git - mirror_qemu.git/commitdiff
machine: Replace QEMUMachine by MachineClass in accelerator configuration
authorMarcel Apfelbaum <marcel.a@redhat.com>
Wed, 9 Apr 2014 17:34:52 +0000 (20:34 +0300)
committerAndreas Färber <afaerber@suse.de>
Mon, 5 May 2014 17:08:49 +0000 (19:08 +0200)
This minimizes QEMUMachine usage, as part of machine QOM-ification.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
include/hw/boards.h
include/hw/xen/xen.h
include/qemu/typedefs.h
include/sysemu/kvm.h
include/sysemu/qtest.h
kvm-all.c
kvm-stub.c
qtest.c
vl.c
xen-all.c
xen-stub.c

index be2e4329b7c5c8720fc3a23346fb7434b0aaf120..8f533341110b7129a50d071c11fc20505fa40296 100644 (file)
@@ -3,12 +3,11 @@
 #ifndef HW_BOARDS_H
 #define HW_BOARDS_H
 
+#include "qemu/typedefs.h"
 #include "sysemu/blockdev.h"
 #include "hw/qdev.h"
 #include "qom/object.h"
 
-typedef struct MachineClass MachineClass;
-
 typedef struct QEMUMachineInitArgs {
     const MachineClass *machine;
     ram_addr_t ram_size;
index 9d549fc83d208ce951c1c2b2a35340d970d60781..85fda3dee470ee262799cb40129cf17222a13e99 100644 (file)
@@ -36,7 +36,7 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level);
 
 qemu_irq *xen_interrupt_controller_init(void);
 
-int xen_init(QEMUMachine *machine);
+int xen_init(MachineClass *mc);
 int xen_hvm_init(MemoryRegion **ram_memory);
 void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
 
index bf8daac659894c84f859f0386a5dc87d5602822f..86bab123a40d30c3a23960fbe253029bb9f5f91d 100644 (file)
@@ -31,6 +31,7 @@ typedef struct MemoryListener MemoryListener;
 typedef struct MemoryMappingList MemoryMappingList;
 
 typedef struct QEMUMachine QEMUMachine;
+typedef struct MachineClass MachineClass;
 typedef struct NICInfo NICInfo;
 typedef struct HCIInfo HCIInfo;
 typedef struct AudioState AudioState;
index 192fe893b7cc59d18df4fa8efde161917eeb6a9d..5ad4e0e1e281f36053827d17fed3f352b7471c17 100644 (file)
@@ -152,7 +152,7 @@ extern KVMState *kvm_state;
 
 /* external API */
 
-int kvm_init(QEMUMachine *machine);
+int kvm_init(MachineClass *mc);
 
 int kvm_has_sync_mmu(void);
 int kvm_has_vcpu_events(void);
index 224131f29805ad5a7ca854bf85a76329fb7ceb02..95c9ade7784259097e84be16e651af5ebfdaa5c6 100644 (file)
@@ -26,7 +26,7 @@ static inline bool qtest_enabled(void)
 
 bool qtest_driver(void);
 
-int qtest_init_accel(QEMUMachine *machine);
+int qtest_init_accel(MachineClass *mc);
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
 
 static inline int qtest_available(void)
index 82a91199e11a4544266d956a75fb81dc845d9608..5cb7f26f4f2ab8cf41433f67ffc9d8638029c50d 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1341,7 +1341,7 @@ static int kvm_max_vcpus(KVMState *s)
     return (ret) ? ret : kvm_recommended_vcpus(s);
 }
 
-int kvm_init(QEMUMachine *machine)
+int kvm_init(MachineClass *mc)
 {
     static const char upgrade_note[] =
         "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n"
@@ -1433,8 +1433,8 @@ int kvm_init(QEMUMachine *machine)
     }
 
     kvm_type = qemu_opt_get(qemu_get_machine_opts(), "kvm-type");
-    if (machine->kvm_type) {
-        type = machine->kvm_type(kvm_type);
+    if (mc->kvm_type) {
+        type = mc->kvm_type(kvm_type);
     } else if (kvm_type) {
         fprintf(stderr, "Invalid argument kvm-type=%s\n", kvm_type);
         goto err;
index ccdba62d67b8889fedd146579874b2d07cb7d876..8acda86ced5c829017ba62662ccd14ed6a2df27a 100644 (file)
@@ -34,7 +34,7 @@ int kvm_init_vcpu(CPUState *cpu)
     return -ENOSYS;
 }
 
-int kvm_init(QEMUMachine *machine)
+int kvm_init(MachineClass *mc)
 {
     return -ENOSYS;
 }
diff --git a/qtest.c b/qtest.c
index 0ac9f429f5d142c9d3262a6d9957f7724358dfe4..2aba20d1042fb541c6d934f0356385cc31b38890 100644 (file)
--- a/qtest.c
+++ b/qtest.c
@@ -500,7 +500,7 @@ static void qtest_event(void *opaque, int event)
     }
 }
 
-int qtest_init_accel(QEMUMachine *machine)
+int qtest_init_accel(MachineClass *mc)
 {
     configure_icount("0");
 
diff --git a/vl.c b/vl.c
index 2c2b625b3753cb243c1bbc678d79b49499c92aec..f423b2e116c89b0ee941df63c42c873bef02a91f 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2725,7 +2725,7 @@ static MachineClass *machine_parse(const char *name)
     exit(!name || !is_help_option(name));
 }
 
-static int tcg_init(QEMUMachine *machine)
+static int tcg_init(MachineClass *mc)
 {
     tcg_exec_init(tcg_tb_size * 1024 * 1024);
     return 0;
@@ -2735,7 +2735,7 @@ static struct {
     const char *opt_name;
     const char *name;
     int (*available)(void);
-    int (*init)(QEMUMachine *);
+    int (*init)(MachineClass *mc);
     bool *allowed;
 } accel_list[] = {
     { "tcg", "tcg", tcg_available, tcg_init, &tcg_allowed },
@@ -2744,7 +2744,7 @@ static struct {
     { "qtest", "QTest", qtest_available, qtest_init_accel, &qtest_allowed },
 };
 
-static int configure_accelerator(QEMUMachine *machine)
+static int configure_accelerator(MachineClass *mc)
 {
     const char *p;
     char buf[10];
@@ -2771,7 +2771,7 @@ static int configure_accelerator(QEMUMachine *machine)
                     break;
                 }
                 *(accel_list[i].allowed) = true;
-                ret = accel_list[i].init(machine);
+                ret = accel_list[i].init(mc);
                 if (ret < 0) {
                     init_failed = true;
                     fprintf(stderr, "failed to initialize %s: %s\n",
@@ -4222,7 +4222,7 @@ int main(int argc, char **argv, char **envp)
         exit(0);
     }
 
-    configure_accelerator(machine);
+    configure_accelerator(machine_class);
 
     if (qtest_chrdev) {
         Error *local_err = NULL;
index ba3473901e6a5e47602f417706200cb01929b579..a63b53152aaf001dbef9c453a4470d5ea5aa71ae 100644 (file)
--- a/xen-all.c
+++ b/xen-all.c
@@ -1001,7 +1001,7 @@ static void xen_exit_notifier(Notifier *n, void *data)
     xs_daemon_close(state->xenstore);
 }
 
-int xen_init(QEMUMachine *machine)
+int xen_init(MachineClass *mc)
 {
     xen_xc = xen_xc_interface_open(0, 0, 0);
     if (xen_xc == XC_HANDLER_INITIAL_VALUE) {
index 59927cb5d63554599322a8daf050467478081d1f..de26583a23b692ab20f4bbc1d1677feaa9a79498 100644 (file)
@@ -47,7 +47,7 @@ qemu_irq *xen_interrupt_controller_init(void)
     return NULL;
 }
 
-int xen_init(QEMUMachine *machine)
+int xen_init(MachineClass *mc)
 {
     return -ENOSYS;
 }