[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/15] hw/xen: only remove peers of PCI NICs on unplug
From: |
David Woodhouse |
Subject: |
[PULL 11/15] hw/xen: only remove peers of PCI NICs on unplug |
Date: |
Tue, 7 Nov 2023 09:21:43 +0000 |
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>
Reviewed-by: Paul Durrant <paul@xen.org>
---
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.41.0
- [PULL 00/15] xenfv.for-upstream queue, David Woodhouse, 2023/11/07
- [PULL 09/15] hw/xen: update Xen console to XenDevice model, David Woodhouse, 2023/11/07
- [PULL 04/15] i386/xen: advertise XEN_HVM_CPUID_UPCALL_VECTOR in CPUID, David Woodhouse, 2023/11/07
- [PULL 15/15] docs: update Xen-on-KVM documentation, David Woodhouse, 2023/11/07
- [PULL 10/15] hw/xen: add support for Xen primary console in emulated mode, David Woodhouse, 2023/11/07
- [PULL 02/15] hw/xen: Clean up event channel 'type_val' handling to use union, David Woodhouse, 2023/11/07
- [PULL 01/15] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer(), David Woodhouse, 2023/11/07
- [PULL 13/15] hw/i386/pc: support '-nic' for xen-net-device, David Woodhouse, 2023/11/07
- [PULL 11/15] hw/xen: only remove peers of PCI NICs on unplug,
David Woodhouse <=
- [PULL 05/15] hw/xen: populate store frontend nodes with XenStore PFN/port, David Woodhouse, 2023/11/07
- [PULL 03/15] include: update Xen public headers to Xen 4.17.2 release, David Woodhouse, 2023/11/07
- [PULL 12/15] hw/xen: update Xen PV NIC to XenDevice model, David Woodhouse, 2023/11/07
- [PULL 07/15] hw/xen: add get_frontend_path() method to XenDeviceClass, David Woodhouse, 2023/11/07
- [PULL 14/15] xen-platform: unplug AHCI disks, David Woodhouse, 2023/11/07
- [PULL 06/15] hw/xen: automatically assign device index to block devices, David Woodhouse, 2023/11/07
- [PULL 08/15] hw/xen: do not repeatedly try to create a failing backend device, David Woodhouse, 2023/11/07
- Re: [PULL 00/15] xenfv.for-upstream queue, Stefan Hajnoczi, 2023/11/07