]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/xen: Rename xen_common.h to xen_native.h
authorDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 2 Jan 2023 00:39:13 +0000 (00:39 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 10 Jan 2023 11:51:42 +0000 (11:51 +0000)
This header is now only for native Xen code, not PV backends that may be
used in Xen emulation. Since the toolstack libraries may depend on the
specific version of Xen headers that they pull in (and will set the
__XEN_TOOLS__ macro to enable internal definitions that they depend on),
the rule is that xen_native.h (and thus the toolstack library headers)
must be included *before* any of the headers in standard-headers/xen.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
16 files changed:
accel/xen/xen-all.c
hw/9pfs/xen-9p-backend.c
hw/block/dataplane/xen-block.c
hw/block/xen-block.c
hw/i386/xen/xen-hvm.c
hw/i386/xen/xen-mapcache.c
hw/i386/xen/xen_platform.c
hw/xen/trace-events
hw/xen/xen-operations.c
hw/xen/xen_pt.c
hw/xen/xen_pt.h
hw/xen/xen_pt_config_init.c
hw/xen/xen_pt_msi.c
include/hw/xen/xen.h
include/hw/xen/xen_native.h [moved from include/hw/xen/xen_common.h with 98% similarity]
include/hw/xen/xen_pvdev.h

index 514bc9eea4e8d18c781ef81d7fe7ad0d66e6dbf5..fcdc8364bf3824744a14b481b7a6e60ed644a0c1 100644 (file)
@@ -12,6 +12,7 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qapi/error.h"
+#include "hw/xen/xen_native.h"
 #include "hw/xen/xen-legacy-backend.h"
 #include "hw/xen/xen_pt.h"
 #include "chardev/char.h"
index d8bb0e847c808f1ecd2fdfcb1a8c62810272f34e..74f3a05f880c313d136056152a484e75e08f2f65 100644 (file)
@@ -22,6 +22,7 @@
 #include "qemu/config-file.h"
 #include "qemu/main-loop.h"
 #include "qemu/option.h"
+#include "qemu/iov.h"
 #include "fsdev/qemu-fsdev.h"
 
 #define VERSIONS "1"
index 8322a1de82e39e67bc080cb80ad253466bc82cb6..d44e39e2a1fb0573f02cd807b80d3211b9a14103 100644 (file)
@@ -23,8 +23,9 @@
 #include "qemu/main-loop.h"
 #include "qemu/memalign.h"
 #include "qapi/error.h"
-#include "hw/xen/xen_common.h"
 #include "hw/block/xen_blkif.h"
+#include "hw/xen/xen.h"
+#include "hw/xen/interface/io/ring.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/iothread.h"
 #include "xen-block.h"
index 345b284d70181727f17a64d51bf2514cfb202957..87299615e354a8c02cee8a1e46da131b23c9ec40 100644 (file)
@@ -19,7 +19,6 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
 #include "qom/object_interfaces.h"
-#include "hw/xen/xen_common.h"
 #include "hw/block/xen_blkif.h"
 #include "hw/qdev-properties.h"
 #include "hw/xen/xen-block.h"
index 38146efb5a0e0c6b60e27eab8904a53ae9fcb185..779d923e104c9b7648952784a634ebbe2042a20e 100644 (file)
@@ -18,8 +18,8 @@
 #include "hw/irq.h"
 #include "hw/hw.h"
 #include "hw/i386/apic-msidef.h"
+#include "hw/xen/xen_native.h"
 #include "hw/xen/xen_backend_ops.h"
-#include "hw/xen/xen_common.h"
 #include "hw/xen/xen-legacy-backend.h"
 #include "hw/xen/xen-bus.h"
 #include "hw/xen/xen-x86.h"
@@ -54,8 +54,8 @@ static bool xen_in_migration;
 /* Compatibility with older version */
 
 /* This allows QEMU to build on a system that has Xen 4.5 or earlier
- * installed.  This here (not in hw/xen/xen_common.h) because xen/hvm/ioreq.h
- * needs to be included before this block and hw/xen/xen_common.h needs to
+ * installed.  This here (not in hw/xen/xen_native.h) because xen/hvm/ioreq.h
+ * needs to be included before this block and hw/xen/xen_native.h needs to
  * be included before xen/hvm/ioreq.h
  */
 #ifndef IOREQ_TYPE_VMWARE_PORT
index a2f93096e7a3750817c15211c1b9bc0ee015fb76..30cea6ee4254b53ee19d825057575fbfebc36832 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <sys/resource.h>
 
-#include "hw/xen/xen-legacy-backend.h"
+#include "hw/xen/xen_native.h"
 #include "qemu/bitmap.h"
 
 #include "sysemu/runstate.h"
index 00f0527b3087e7118be9714ff899f4d1da4be4a7..a5fb1c96d092caa398fc99b30e2c7241143f0f7f 100644 (file)
@@ -29,7 +29,6 @@
 #include "hw/ide/pci.h"
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
-#include "hw/xen/xen.h"
 #include "net/net.h"
 #include "trace.h"
 #include "sysemu/xen.h"
 #include "qom/object.h"
 
 #ifdef CONFIG_XEN
-#include "hw/xen/xen_common.h"
-#include "hw/xen/xen-legacy-backend.h"
+#include "hw/xen/xen_native.h"
 #endif
 
+/* The rule is that xen_native.h must come first */
+#include "hw/xen/xen.h"
+
 //#define DEBUG_PLATFORM
 
 #ifdef DEBUG_PLATFORM
index 3da3fd8348397d984678226d0b1d222a00a4681a..55c9e1df680b891f652b77acacbbf2c6685a9c93 100644 (file)
@@ -1,6 +1,6 @@
 # See docs/devel/tracing.rst for syntax documentation.
 
-# ../../include/hw/xen/xen_common.h
+# ../../include/hw/xen/xen_native.h
 xen_default_ioreq_server(void) ""
 xen_ioreq_server_create(uint32_t id) "id: %u"
 xen_ioreq_server_destroy(uint32_t id) "id: %u"
index b2b76c63af2326e52946da279cad7aaae25a24f8..352153c974ee120974ba53515f472c9dca3c4df0 100644 (file)
@@ -13,8 +13,8 @@
 #include "qemu/uuid.h"
 #include "qapi/error.h"
 
+#include "hw/xen/xen_native.h"
 #include "hw/xen/xen_backend_ops.h"
-#include "hw/xen/xen_common.h"
 
 /*
  * If we have new enough libxenctrl then we do not want/need these compat
index 0ec7e52183333b4b737aea3319e230dcc74cf7d4..d0b68925b5deddf99b59975b37f22bc47a4d35f3 100644 (file)
@@ -59,9 +59,9 @@
 #include "hw/pci/pci.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
+#include "xen_pt.h"
 #include "hw/xen/xen.h"
 #include "hw/xen/xen-legacy-backend.h"
-#include "xen_pt.h"
 #include "qemu/range.h"
 
 static bool has_igd_gfx_passthru;
index e7c4316a7d65a2e1953ceda6af8c11aefb21bf66..25887a35456e17dbbc2bb8e0a0a0c698fe3a51ee 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef XEN_PT_H
 #define XEN_PT_H
 
-#include "hw/xen/xen_common.h"
+#include "hw/xen/xen_native.h"
 #include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
 #include "qom/object.h"
index cde898b7442b949755bdf41d7501b8268bbf88db..0cd9fbd22c4f9f855ab701ab6370f3bed17995b9 100644 (file)
@@ -15,8 +15,8 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
-#include "hw/xen/xen-legacy-backend.h"
 #include "xen_pt.h"
+#include "hw/xen/xen-legacy-backend.h"
 
 #define XEN_PT_MERGE_VALUE(value, data, val_mask) \
     (((value) & (val_mask)) | ((data) & ~(val_mask)))
index b71563f98a8bc61069b2e6e7200713d396cc52d0..09cca4eecb1c0b46a4187933d94cdbf61537381e 100644 (file)
@@ -11,9 +11,9 @@
 
 #include "qemu/osdep.h"
 
-#include "hw/xen/xen-legacy-backend.h"
-#include "xen_pt.h"
 #include "hw/i386/apic-msidef.h"
+#include "xen_pt.h"
+#include "hw/xen/xen-legacy-backend.h"
 
 
 #define XEN_PT_AUTO_ASSIGN -1
index fcc6c5b52294ea5c188f4b1126da253bdb5fe762..416c833a298c9141305e1a6100b6def6c99b7602 100644 (file)
@@ -8,15 +8,21 @@
 #define QEMU_HW_XEN_H
 
 /*
- * As a temporary measure while the headers are being untangled, define
- * __XEN_TOOLS__ here before any Xen headers are included. Otherwise, if
- * the Xen toolstack library headers are later included, they will find
- * some of the "internal" definitions missing and the build will fail. In
- * later commits, we'll end up with a rule that the native libraries have
- * to be included first, which will ensure that the libraries get the
- * version of Xen libraries that they expect.
+ * C files using Xen toolstack libraries will have included those headers
+ * already via xen_native.h, and hving __XEM_TOOLS__ defined will have
+ * automatically set __XEN_INTERFACE_VERSION__ to the latest supported
+ * by the *system* Xen headers which were transitively included.
+ *
+ * C files which are part of the internal emulation, and which did not
+ * include xen_native.h may need this defined so that the Xen headers
+ * imported to standard-headers/xen will expose the appropriate API
+ * version.
+ *
+ * This is why there's a rule that xen_native.h must be included first.
  */
-#define __XEN_TOOLS__ 1
+#ifndef __XEN_INTERFACE_VERSION__
+#define __XEN_INTERFACE_VERSION__ 0x00040e00
+#endif
 
 #include "exec/cpu-common.h"
 
similarity index 98%
rename from include/hw/xen/xen_common.h
rename to include/hw/xen/xen_native.h
index f116ef3f72c3c95fbaa55fd47b9de02ac120a665..8becc261d0c979635ecaa3bc424b0d05e1b75302 100644 (file)
@@ -1,5 +1,9 @@
-#ifndef QEMU_HW_XEN_COMMON_H
-#define QEMU_HW_XEN_COMMON_H
+#ifndef QEMU_HW_XEN_NATIVE_H
+#define QEMU_HW_XEN_NATIVE_H
+
+#ifdef __XEN_INTERFACE_VERSION__
+#error In Xen native files, include xen_native.h before other Xen headers
+#endif
 
 /*
  * If we have new enough libxenctrl then we do not want/need these compat
@@ -622,4 +626,4 @@ static inline int xen_set_ioreq_server_state(domid_t dom,
 
 #endif
 
-#endif /* QEMU_HW_XEN_COMMON_H */
+#endif /* QEMU_HW_XEN_NATIVE_H */
index d8eea353b84453fddbfcf743034d2b53cd693624..ddad4b9f36af55ab0d44047e0b833fc82ef7e465 100644 (file)
@@ -1,8 +1,9 @@
 #ifndef QEMU_HW_XEN_PVDEV_H
 #define QEMU_HW_XEN_PVDEV_H
 
+#include "hw/qdev-core.h"
 #include "hw/xen/xen_backend_ops.h"
-#include "hw/xen/xen_common.h"
+
 /* ------------------------------------------------------------- */
 
 #define XEN_BUFSIZE 1024