kvm: move cpu synchronization code
authorVincent Palatin <vpalatin@chromium.org>
Tue, 10 Jan 2017 10:59:55 +0000 (11:59 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 19 Jan 2017 21:07:46 +0000 (22:07 +0100)
Move the generic cpu_synchronize_ functions to the common hw_accel.h header,
in order to prepare for the addition of a second hardware accelerator.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Message-Id: <f5c3cffe8d520011df1c2e5437bb814989b48332.1484045952.git.vpalatin@chromium.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
21 files changed:
cpus.c
gdbstub.c
hw/i386/kvm/apic.c
hw/i386/kvmvapic.c
hw/misc/vmport.c
hw/ppc/pnv_xscom.c
hw/ppc/ppce500_spin.c
hw/ppc/spapr.c
hw/ppc/spapr_hcall.c
hw/s390x/s390-pci-inst.c
include/sysemu/hw_accel.h [new file with mode: 0644]
include/sysemu/kvm.h
monitor.c
qom/cpu.c
target/arm/cpu.c
target/i386/helper.c
target/i386/kvm.c
target/ppc/kvm.c
target/ppc/mmu-hash64.c
target/ppc/translate_init.c
target/s390x/gdbstub.c

diff --git a/cpus.c b/cpus.c
index 5213351c6d380fcef6208e83a2690f692c8aeccf..fc78502ce5f747b3eb9b05d5330a0a8ec882ce50 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -33,6 +33,7 @@
 #include "sysemu/block-backend.h"
 #include "exec/gdbstub.h"
 #include "sysemu/dma.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "qmp-commands.h"
 #include "exec/exec-all.h"
index de62d2609647ec52dd1aaef0e6eab87bfc69fe1d..de9b62b8f8628cbb731135cd878b2429b924f2d1 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -32,6 +32,7 @@
 #define MAX_PACKET_LENGTH 4096
 
 #include "qemu/sockets.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "exec/semihost.h"
 #include "exec/exec-all.h"
index df5180b1e0fed5636fde4690b359399356c29169..1df6d26816f97b70c1256214cfefc6068bd5b66c 100644 (file)
@@ -14,6 +14,7 @@
 #include "cpu.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/pci/msi.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "target/i386/kvm_i386.h"
 
index b30d1b90c6cd51660a00e05b62b365d4e3b52ad0..2f767b620e282fbab9bfaf354f8b360cab3ea25a 100644 (file)
@@ -14,6 +14,7 @@
 #include "exec/exec-all.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/sysbus.h"
index c763811a9f0bbddd3991586ef8ec238213a4fbba..be40930b8b66cb217ab944962ba52ce659a2e02c 100644 (file)
@@ -25,7 +25,7 @@
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "hw/qdev.h"
 
 //#define VMPORT_DEBUG
index b82af4f0866d7a7d9b4c8dbee4ed28826744ccb9..38bc85f117f6d8c7e99584cac6f0aad3b64de9cc 100644 (file)
@@ -20,7 +20,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "qemu/log.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "target/ppc/cpu.h"
 #include "hw/sysbus.h"
 
index cf958a9e00826a26597d0fd8b96ff3fb9782b4a2..eb219abdffefcbe96d0ed9f26796f1d8d946004c 100644 (file)
@@ -29,9 +29,9 @@
 
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
+#include "sysemu/sysemu.h"
 #include "e500.h"
 
 #define MAX_CPUS 32
index 208ef7b1101304ece819ac864193c28468864fea..a642e663d497c27c029a254ed2b1306b1125ccea 100644 (file)
@@ -36,7 +36,7 @@
 #include "sysemu/device_tree.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/cpus.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "migration/migration.h"
 #include "mmu-hash64.h"
index 9a9bedf1bdd3161a1033ad117bd05c3411e8a67d..b2a8e48569c7c324327ef5439e1a19b242266e5e 100644 (file)
@@ -1,5 +1,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 #include "cpu.h"
@@ -9,7 +10,6 @@
 #include "mmu-hash64.h"
 #include "cpu-models.h"
 #include "trace.h"
-#include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "hw/ppc/spapr_ovec.h"
 
index 0864d9be124bcaf2efb183dfa63170a149695ae6..4d0775c83f21c220012ca3a49ac47f7360f02f75 100644 (file)
@@ -18,6 +18,7 @@
 #include "s390-pci-bus.h"
 #include "exec/memory-internal.h"
 #include "qemu/error-report.h"
+#include "sysemu/hw_accel.h"
 
 /* #define DEBUG_S390PCI_INST */
 #ifdef DEBUG_S390PCI_INST
diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h
new file mode 100644 (file)
index 0000000..03812cf
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * QEMU Hardware accelertors support
+ *
+ * Copyright 2016 Google, Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_HW_ACCEL_H
+#define QEMU_HW_ACCEL_H
+
+#include "qom/cpu.h"
+#include "sysemu/hax.h"
+#include "sysemu/kvm.h"
+
+static inline void cpu_synchronize_state(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_state(cpu);
+    }
+}
+
+static inline void cpu_synchronize_post_reset(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_post_reset(cpu);
+    }
+}
+
+static inline void cpu_synchronize_post_init(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_post_init(cpu);
+    }
+}
+
+#endif /* QEMU_HW_ACCEL_H */
index df67cc067209d698bb40f45c319a1a12e8796a3f..3045ee7678d7b23fc3e3df261ebfa364348c00bc 100644 (file)
@@ -461,29 +461,6 @@ void kvm_cpu_synchronize_state(CPUState *cpu);
 void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 void kvm_cpu_synchronize_post_init(CPUState *cpu);
 
-/* generic hooks - to be moved/refactored once there are more users */
-
-static inline void cpu_synchronize_state(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_state(cpu);
-    }
-}
-
-static inline void cpu_synchronize_post_reset(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_reset(cpu);
-    }
-}
-
-static inline void cpu_synchronize_post_init(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_init(cpu);
-    }
-}
-
 /**
  * kvm_irqchip_add_msi_route - Add MSI route for specific vector
  * @s:      KVM state
index 0841d436b0c22a8443650858100b2e54811497d4..d38956fd836d3ab8c1864dd72f971006baebdc86 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -50,7 +50,7 @@
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
 #include "migration/migration.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
 #include "qapi/qmp/qerror.h"
index 03d9190f8ce8eb60ed81a1e748869f9e82164955..2c5274f0f6a2e58ba3ff0aa149b033cd385e979c 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -22,7 +22,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qom/cpu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "qemu/notify.h"
 #include "qemu/log.h"
 #include "exec/log.h"
index f5cb30af6c1a08041efa091150bd5ea7f48a7ed9..f7f20d33d06c17761475f302bb5984c6474cc772 100644 (file)
@@ -31,7 +31,7 @@
 #endif
 #include "hw/arm/arm.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_arm.h"
 
 static void arm_cpu_set_pc(CPUState *cs, vaddr value)
index 43e87ddba001f9fb3d3176a5ea8858f86664d860..19b265699558ff225bc9e4f09a9427155e6befff 100644 (file)
@@ -24,6 +24,7 @@
 #include "kvm_i386.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu/sysemu.h"
+#include "sysemu/hw_accel.h"
 #include "monitor/monitor.h"
 #include "hw/i386/apic_internal.h"
 #endif
index 10a9cd8f7f3d2d5fb2d2d559824d9c5871383d40..e6c4f754ab513f0abc20cd27480bc34694b15ba0 100644 (file)
@@ -23,6 +23,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm_int.h"
 #include "kvm_i386.h"
 #include "hyperv.h"
index 6c53a6dd1aa464c690135a3f1a1c8f5d01e59588..ec92c64159d132e78f275e421e1b28124ab80516 100644 (file)
@@ -26,7 +26,7 @@
 #include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/numa.h"
 #include "kvm_ppc.h"
 #include "sysemu/cpus.h"
index fdb7a787bf3758b5c72bdede50d1099480fed61d..0efc8c63fa7ce6d2b8c4268d3dd43c5cf5031124 100644 (file)
@@ -23,7 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
 #include "exec/log.h"
index 19ef2505e4a3c3dbb2831bc2d696f925f466dc29..b0c65b9ecb0c2ec2e94e06e2cf85f5a833888570 100644 (file)
 #include "qemu/osdep.h"
 #include "disas/bfd.h"
 #include "exec/gdbstub.h"
-#include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/cpus.h"
+#include "sysemu/hw_accel.h"
 #include "cpu-models.h"
 #include "mmu-hash32.h"
 #include "mmu-hash64.h"
index 3d223dec978bbb6582c201ff2501e84341c8c256..3c652fba6206681ed8ef4243a314162f9557d6c4 100644 (file)
@@ -23,6 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 #include "qemu/bitops.h"
+#include "sysemu/hw_accel.h"
 
 int s390_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
 {