[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/24] hw/xen: only remove peers of PCI NICs on unplug
From: |
David Woodhouse |
Subject: |
[PATCH v2 17/24] hw/xen: only remove peers of PCI NICs on unplug |
Date: |
Thu, 19 Oct 2023 16:40:13 +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
- [PATCH v2 07/24] hw/xen: Clean up event channel 'type_val' handling to use union, (continued)
- [PATCH v2 07/24] hw/xen: Clean up event channel 'type_val' handling to use union, David Woodhouse, 2023/10/19
- [PATCH v2 04/24] hw/xen: don't clear map_track[] in xen_gnttab_reset(), David Woodhouse, 2023/10/19
- [PATCH v2 08/24] include: update Xen public headers to Xen 4.17.2 release, David Woodhouse, 2023/10/19
- [PATCH v2 13/24] hw/xen: do not repeatedly try to create a failing backend device, David Woodhouse, 2023/10/19
- [PATCH v2 09/24] i386/xen: advertise XEN_HVM_CPUID_UPCALL_VECTOR in CPUID, David Woodhouse, 2023/10/19
- [PATCH v2 02/24] i386/xen: fix per-vCPU upcall vector for Xen emulation, David Woodhouse, 2023/10/19
- [PATCH v2 24/24] docs: update Xen-on-KVM documentation, David Woodhouse, 2023/10/19
- [PATCH v2 18/24] hw/xen: update Xen PV NIC to XenDevice model, David Woodhouse, 2023/10/19
- [PATCH v2 22/24] tests/avocado: switch to using xen-net-device for Xen guest tests, David Woodhouse, 2023/10/19
- [PATCH v2 17/24] hw/xen: only remove peers of PCI NICs on unplug,
David Woodhouse <=
- [PATCH v2 06/24] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer(), David Woodhouse, 2023/10/19
- [PATCH v2 14/24] hw/xen: update Xen console to XenDevice model, David Woodhouse, 2023/10/19
- [PATCH v2 23/24] xen-platform: unplug AHCI disks, David Woodhouse, 2023/10/19