From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: David Woodhouse <dwmw@amazon.co.uk>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
"Stefano Stabellini" <sstabellini@kernel.org>,
qemu-block@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-arm@nongnu.org, "Paul Durrant" <paul@xen.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>
Subject: [PATCH-for-9.0 09/10] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h'
Date: Mon, 13 Nov 2023 16:21:12 +0100 [thread overview]
Message-ID: <20231113152114.47916-10-philmd@linaro.org> (raw)
In-Reply-To: <20231113152114.47916-1-philmd@linaro.org>
"hw/xen/xen_pt.h" requires "hw/xen/xen_native.h" which is target
specific. It also declares IGD methods, which are not target
specific.
Target-agnostic code can use IGD methods. To allow that, extract
these methos into a new "hw/xen/xen_igd.h" header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
What license for the new "hw/xen/xen_igd.h" header?
---
hw/xen/xen_pt.h | 14 --------------
include/hw/xen/xen_igd.h | 23 +++++++++++++++++++++++
accel/xen/xen-all.c | 1 +
hw/i386/pc_piix.c | 1 +
hw/xen/xen_pt.c | 3 ++-
hw/xen/xen_pt_config_init.c | 3 ++-
hw/xen/xen_pt_graphics.c | 3 ++-
hw/xen/xen_pt_stub.c | 2 +-
8 files changed, 32 insertions(+), 18 deletions(-)
create mode 100644 include/hw/xen/xen_igd.h
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index 31bcfdf705..da5af67638 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -5,9 +5,6 @@
#include "xen-host-pci-device.h"
#include "qom/object.h"
-bool xen_igd_gfx_pt_enabled(void);
-void xen_igd_gfx_pt_set(bool value, Error **errp);
-
void xen_pt_log(const PCIDevice *d, const char *f, ...) G_GNUC_PRINTF(2, 3);
#define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, ##_a)
@@ -52,12 +49,6 @@ typedef struct XenPTDeviceClass {
XenPTQdevRealize pci_qdev_realize;
} XenPTDeviceClass;
-uint32_t igd_read_opregion(XenPCIPassthroughState *s);
-void xen_igd_reserve_slot(PCIBus *pci_bus);
-void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val);
-void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s,
- XenHostPCIDevice *dev);
-
/* function type for config reg */
typedef int (*xen_pt_conf_reg_init)
(XenPCIPassthroughState *, XenPTRegInfo *, uint32_t real_offset,
@@ -343,11 +334,6 @@ static inline bool xen_pt_has_msix_mapping(XenPCIPassthroughState *s, int bar)
void *pci_assign_dev_load_option_rom(PCIDevice *dev, int *size,
unsigned int domain, unsigned int bus,
unsigned int slot, unsigned int function);
-static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
-{
- return (xen_igd_gfx_pt_enabled()
- && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
-}
int xen_pt_register_vga_regions(XenHostPCIDevice *dev);
int xen_pt_unregister_vga_regions(XenHostPCIDevice *dev);
void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev,
diff --git a/include/hw/xen/xen_igd.h b/include/hw/xen/xen_igd.h
new file mode 100644
index 0000000000..52f1f8244c
--- /dev/null
+++ b/include/hw/xen/xen_igd.h
@@ -0,0 +1,23 @@
+#ifndef XEN_IGD_H
+#define XEN_IGD_H
+
+#include "hw/xen/xen-host-pci-device.h"
+
+typedef struct XenPCIPassthroughState XenPCIPassthroughState;
+
+bool xen_igd_gfx_pt_enabled(void);
+void xen_igd_gfx_pt_set(bool value, Error **errp);
+
+uint32_t igd_read_opregion(XenPCIPassthroughState *s);
+void xen_igd_reserve_slot(PCIBus *pci_bus);
+void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val);
+void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s,
+ XenHostPCIDevice *dev);
+
+static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
+{
+ return (xen_igd_gfx_pt_enabled()
+ && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
+}
+
+#endif
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
index 5ff0cb8bd9..0bdefce537 100644
--- a/accel/xen/xen-all.c
+++ b/accel/xen/xen-all.c
@@ -15,6 +15,7 @@
#include "hw/xen/xen_native.h"
#include "hw/xen/xen-legacy-backend.h"
#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#include "chardev/char.h"
#include "qemu/accel.h"
#include "sysemu/cpus.h"
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index eace854335..a607dcb56c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -56,6 +56,7 @@
#ifdef CONFIG_XEN
#include <xen/hvm/hvm_info_table.h>
#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#endif
#include "hw/xen/xen-x86.h"
#include "hw/xen/xen.h"
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 36e6f93c37..a8edabdabc 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -59,7 +59,8 @@
#include "hw/pci/pci.h"
#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
-#include "xen_pt.h"
+#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#include "hw/xen/xen.h"
#include "hw/xen/xen-legacy-backend.h"
#include "qemu/range.h"
diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index 2b8680b112..ba4cd78238 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -15,7 +15,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/timer.h"
-#include "xen_pt.h"
+#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#include "hw/xen/xen-legacy-backend.h"
#define XEN_PT_MERGE_VALUE(value, data, val_mask) \
diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c
index 0aed3bb6fd..6c2e3f4840 100644
--- a/hw/xen/xen_pt_graphics.c
+++ b/hw/xen/xen_pt_graphics.c
@@ -3,7 +3,8 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
-#include "xen_pt.h"
+#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#include "xen-host-pci-device.h"
static unsigned long igd_guest_opregion;
diff --git a/hw/xen/xen_pt_stub.c b/hw/xen/xen_pt_stub.c
index 5c108446a8..72feebeb20 100644
--- a/hw/xen/xen_pt_stub.c
+++ b/hw/xen/xen_pt_stub.c
@@ -6,7 +6,7 @@
*/
#include "qemu/osdep.h"
-#include "hw/xen/xen_pt.h"
+#include "hw/xen/xen_igd.h"
#include "qapi/error.h"
bool xen_igd_gfx_pt_enabled(void)
--
2.41.0
next prev parent reply other threads:[~2023-11-13 15:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 15:21 [PATCH-for-9.0 00/10] hw/xen: Have most of Xen files become target-agnostic Philippe Mathieu-Daudé
2023-11-13 15:21 ` [PATCH-for-9.0 01/10] sysemu/xen: Forbid using Xen headers in user emulation Philippe Mathieu-Daudé
2023-11-13 18:10 ` Richard Henderson
2023-11-13 20:13 ` David Woodhouse
2023-11-13 15:21 ` [PATCH-for-9.0 02/10] hw/xen/xen_arch_hvm: Rename prototypes using 'xen_arch_' prefix Philippe Mathieu-Daudé
2023-11-13 17:29 ` David Woodhouse
2023-11-13 18:12 ` Richard Henderson
2023-11-13 15:21 ` [PATCH-for-9.0 03/10] hw/xen: Merge 'hw/xen/arch_hvm.h' in 'hw/xen/xen-hvm-common.h' Philippe Mathieu-Daudé
2023-11-13 17:30 ` David Woodhouse
2023-11-13 18:13 ` Richard Henderson
2023-11-13 15:21 ` [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq() Philippe Mathieu-Daudé
2023-11-13 17:36 ` David Woodhouse
2023-11-13 18:16 ` Richard Henderson
2023-11-14 7:42 ` Philippe Mathieu-Daudé
2023-11-13 15:21 ` [PATCH-for-9.0 05/10] hw/xen: Use target-agnostic qemu_target_page_bits() Philippe Mathieu-Daudé
2023-11-13 18:18 ` Richard Henderson
2023-11-13 19:39 ` David Woodhouse
2023-11-13 15:21 ` [PATCH-for-9.0 06/10] hw/xen: Reduce inclusion of 'cpu.h' to target-specific sources Philippe Mathieu-Daudé
2023-11-13 18:19 ` Richard Henderson
2023-11-13 19:40 ` David Woodhouse
2023-11-13 15:21 ` [PATCH-for-9.0 07/10] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE Philippe Mathieu-Daudé
2023-11-13 19:52 ` David Woodhouse
2023-11-14 12:25 ` Philippe Mathieu-Daudé
2023-11-14 13:18 ` David Woodhouse
2023-11-14 13:55 ` Philippe Mathieu-Daudé
2023-11-13 15:21 ` [PATCH-for-9.0 08/10] system/physmem: Only include 'hw/xen/xen.h' when Xen is available Philippe Mathieu-Daudé
2023-11-13 20:03 ` David Woodhouse
2023-11-14 7:43 ` Philippe Mathieu-Daudé
2023-11-13 15:21 ` Philippe Mathieu-Daudé [this message]
2023-11-13 20:09 ` [PATCH-for-9.0 09/10] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' David Woodhouse
2023-11-13 15:21 ` [PATCH-for-9.0 10/10] hw/xen: Have most of Xen files become target-agnostic Philippe Mathieu-Daudé
2023-11-13 20:12 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231113152114.47916-10-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=dwmw@amazon.co.uk \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).