[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v11 07/59] xen-platform: exclude vfio-pci from the PCI platform u
From: |
David Woodhouse |
Subject: |
[PATCH v11 07/59] xen-platform: exclude vfio-pci from the PCI platform unplug |
Date: |
Thu, 16 Feb 2023 06:23:52 +0000 |
From: Joao Martins <joao.m.martins@oracle.com>
Such that PCI passthrough devices work for Xen emulated guests.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
hw/i386/xen/xen_platform.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 66e6de31a6..d601a5509d 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -109,12 +109,25 @@ static void log_writeb(PCIXenPlatformState *s, char val)
#define _UNPLUG_NVME_DISKS 3
#define UNPLUG_NVME_DISKS (1u << _UNPLUG_NVME_DISKS)
+static bool pci_device_is_passthrough(PCIDevice *d)
+{
+ if (!strcmp(d->name, "xen-pci-passthrough")) {
+ return true;
+ }
+
+ if (xen_mode == XEN_EMULATE && !strcmp(d->name, "vfio-pci")) {
+ return true;
+ }
+
+ return false;
+}
+
static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
{
/* We have to ignore passthrough devices */
if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
PCI_CLASS_NETWORK_ETHERNET
- && strcmp(d->name, "xen-pci-passthrough") != 0) {
+ && !pci_device_is_passthrough(d)) {
object_unparent(OBJECT(d));
}
}
@@ -187,9 +200,8 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void
*opaque)
!(flags & UNPLUG_IDE_SCSI_DISKS);
/* We have to ignore passthrough devices */
- if (!strcmp(d->name, "xen-pci-passthrough")) {
+ if (pci_device_is_passthrough(d))
return;
- }
switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) {
case PCI_CLASS_STORAGE_IDE:
--
2.39.0
- [PATCH v11 22/59] i386/xen: handle VCPUOP_register_vcpu_time_info, (continued)
- [PATCH v11 22/59] i386/xen: handle VCPUOP_register_vcpu_time_info, David Woodhouse, 2023/02/16
- [PATCH v11 16/59] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/02/16
- [PATCH v11 35/59] hw/xen: Implement EVTCHNOP_alloc_unbound, David Woodhouse, 2023/02/16
- [PATCH v11 53/59] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests, David Woodhouse, 2023/02/16
- [PATCH v11 37/59] hw/xen: Implement EVTCHNOP_bind_vcpu, David Woodhouse, 2023/02/16
- [PATCH v11 38/59] hw/xen: Implement EVTCHNOP_reset, David Woodhouse, 2023/02/16
- [PATCH v11 11/59] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/02/16
- [PATCH v11 25/59] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/02/16
- [PATCH v11 58/59] kvm/i386: Add xen-evtchn-max-pirq property, David Woodhouse, 2023/02/16
- [PATCH v11 04/59] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2023/02/16
- [PATCH v11 07/59] xen-platform: exclude vfio-pci from the PCI platform unplug,
David Woodhouse <=
- [PATCH v11 48/59] i386/xen: Reserve Xen special pages for console, xenstore rings, David Woodhouse, 2023/02/16
- [PATCH v11 51/59] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/02/16
- [PATCH v11 01/59] include: import Xen public headers to hw/xen/interface, David Woodhouse, 2023/02/16
- [PATCH v11 12/59] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield, David Woodhouse, 2023/02/16
- [PATCH v11 55/59] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/02/16
- [PATCH v11 29/59] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/02/16
- [PATCH v11 18/59] i386/xen: implement XENMEM_add_to_physmap_batch, David Woodhouse, 2023/02/16
- [PATCH v11 54/59] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/02/16
- [PATCH v11 03/59] xen: Add XEN_DISABLED mode and make it default, David Woodhouse, 2023/02/16
- [PATCH v11 52/59] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/02/16