[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 18/28] hw/xen: only remove peers of PCI NICs on unplug
From: |
David Woodhouse |
Subject: |
[PATCH v3 18/28] hw/xen: only remove peers of PCI NICs on unplug |
Date: |
Wed, 25 Oct 2023 15:50:32 +0100 |
From: David Woodhouse <dwmw@amazon.co.uk>
When the Xen guest asks to unplug *emulated* NICs, it's kind of unhelpful
also to unplug the peer of the *Xen* PV NIC.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
hw/i386/xen/xen_platform.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 17457ff3de..e2dd1b536a 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -140,9 +140,14 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
/* Remove the peer of the NIC device. Normally, this would be a tap device. */
static void del_nic_peer(NICState *nic, void *opaque)
{
- NetClientState *nc;
+ NetClientState *nc = qemu_get_queue(nic);
+ ObjectClass *klass = module_object_class_by_name(nc->model);
+
+ /* Only delete peers of PCI NICs that we're about to delete */
+ if (!klass || !object_class_dynamic_cast(klass, TYPE_PCI_DEVICE)) {
+ return;
+ }
- nc = qemu_get_queue(nic);
if (nc->peer)
qemu_del_net_client(nc->peer);
}
--
2.40.1
- Re: [PATCH v3 28/28] docs: update Xen-on-KVM documentation, (continued)
[PATCH v3 02/28] i386/xen: fix per-vCPU upcall vector for Xen emulation, David Woodhouse, 2023/10/25
[PATCH v3 12/28] hw/xen: populate store frontend nodes with XenStore PFN/port, David Woodhouse, 2023/10/25
[PATCH v3 20/28] net: do not delete nics in net_cleanup(), David Woodhouse, 2023/10/25
[PATCH v3 04/28] hw/xen: don't clear map_track[] in xen_gnttab_reset(), David Woodhouse, 2023/10/25
[PATCH v3 01/28] i386/xen: Don't advertise XENFEAT_supervisor_mode_kernel, David Woodhouse, 2023/10/25
[PATCH v3 10/28] include: update Xen public headers to Xen 4.17.2 release, David Woodhouse, 2023/10/25
[PATCH v3 15/28] hw/xen: do not repeatedly try to create a failing backend device, David Woodhouse, 2023/10/25
[PATCH v3 18/28] hw/xen: only remove peers of PCI NICs on unplug,
David Woodhouse <=
[PATCH v3 25/28] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot(), David Woodhouse, 2023/10/25
[PATCH v3 17/28] hw/xen: add support for Xen primary console in emulated mode, David Woodhouse, 2023/10/25
[PATCH v3 06/28] hw/xen: take iothread mutex in xen_evtchn_reset_op(), David Woodhouse, 2023/10/25
[PATCH v3 08/28] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer(), David Woodhouse, 2023/10/25
[PATCH v3 13/28] hw/xen: automatically assign device index to block devices, David Woodhouse, 2023/10/25