[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/62] xen-platform: exclude vfio-pci from the PCI platform unplug
From: |
Paolo Bonzini |
Subject: |
[PULL 07/62] xen-platform: exclude vfio-pci from the PCI platform unplug |
Date: |
Thu, 2 Mar 2023 13:29:34 +0100 |
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 3795a203d4d3..8a616970539c 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -108,12 +108,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));
}
}
@@ -186,9 +199,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.1
- [PULL 00/62] i386, misc changes for QEMU 8.0 soft freeze, Paolo Bonzini, 2023/03/02
- [PULL 02/62] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation, Paolo Bonzini, 2023/03/02
- [PULL 03/62] xen: Add XEN_DISABLED mode and make it default, Paolo Bonzini, 2023/03/02
- [PULL 05/62] i386/kvm: handle Xen HVM cpuid leaves, Paolo Bonzini, 2023/03/02
- [PULL 04/62] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, Paolo Bonzini, 2023/03/02
- [PULL 01/62] include: import Xen public headers to hw/xen/interface, Paolo Bonzini, 2023/03/02
- [PULL 06/62] i386/kvm: Set Xen vCPU ID in KVM, Paolo Bonzini, 2023/03/02
- [PULL 07/62] xen-platform: exclude vfio-pci from the PCI platform unplug,
Paolo Bonzini <=
- [PULL 08/62] xen-platform: allow its creation with XEN_EMULATE mode, Paolo Bonzini, 2023/03/02
- [PULL 09/62] i386/xen: handle guest hypercalls, Paolo Bonzini, 2023/03/02
- [PULL 10/62] i386/xen: implement HYPERVISOR_xen_version, Paolo Bonzini, 2023/03/02
- [PULL 11/62] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, Paolo Bonzini, 2023/03/02
- [PULL 12/62] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield, Paolo Bonzini, 2023/03/02
- [PULL 13/62] hw/xen: Add xen_overlay device for emulating shared xenheap pages, Paolo Bonzini, 2023/03/02
- [PULL 15/62] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, Paolo Bonzini, 2023/03/02
- [PULL 14/62] xen: Permit --xen-domid argument when accel is KVM, Paolo Bonzini, 2023/03/02
- [PULL 16/62] i386/xen: manage and save/restore Xen guest long_mode setting, Paolo Bonzini, 2023/03/02
- [PULL 19/62] i386/xen: implement HYPERVISOR_hvm_op, Paolo Bonzini, 2023/03/02