[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/43] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h'
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 10/43] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' |
Date: |
Sat, 9 Mar 2024 20:21:37 +0100 |
"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>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20231114143816.71079-18-philmd@linaro.org>
---
hw/xen/xen_pt.h | 14 --------------
include/hw/xen/xen_igd.h | 33 +++++++++++++++++++++++++++++++++
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, 42 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 d3180bb134..095a0f0365 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -15,9 +15,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)
@@ -62,12 +59,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,
@@ -353,11 +344,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..7ffca06c10
--- /dev/null
+++ b/include/hw/xen/xen_igd.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2007, Neocleus Corporation.
+ * Copyright (c) 2007, Intel Corporation.
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * Alex Novik <alex@neocleus.com>
+ * Allen Kay <allen.m.kay@intel.com>
+ * Guy Zana <guy@neocleus.com>
+ */
+#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 ce6aad758d..e123458bbc 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -55,6 +55,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
- [PULL 00/43] Misc HW patches for 2024-03-09, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 01/43] hw/i386: Rename kvmvapic.c -> vapic.c, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 02/43] sysemu/xen: Forbid using Xen headers in user emulation, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 03/43] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 04/43] system/physmem: Do not include 'hw/xen/xen.h' but 'sysemu/xen.h', Philippe Mathieu-Daudé, 2024/03/09
- [PULL 05/43] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 06/43] hw/xen: Remove unnecessary xen_hvm_inject_msi() stub, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 07/43] hw/xen: Rename 'ram_memory' global variable as 'xen_memory', Philippe Mathieu-Daudé, 2024/03/09
- [PULL 08/43] hw/xen: Use target-agnostic qemu_target_page_bits(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 09/43] hw/xen/xen_pt: Add missing license, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 10/43] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h',
Philippe Mathieu-Daudé <=
- [PULL 11/43] hw/i386/xen: Compile 'xen-hvm.c' with Xen CPPFLAGS, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 12/43] hw/xen/hvm: Inline TARGET_PAGE_ALIGN() macro, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 13/43] hw/xen/hvm: Propagate page_mask to a pair of functions, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 14/43] hw/xen/hvm: Get target page size at runtime, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 16/43] hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 17/43] hw/remote/remote-obj: hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 19/43] hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 18/43] target/i386/sev: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 20/43] hw/i386/pc: Use generated NotifyVmexitOption_str(), Philippe Mathieu-Daudé, 2024/03/09