[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 11/17] hw/xen: only remove peers of PCI NICs on unplug
From: |
David Woodhouse |
Subject: |
[PATCH v4 11/17] hw/xen: only remove peers of PCI NICs on unplug |
Date: |
Mon, 6 Nov 2023 14:35:01 +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.34.1
- Re: [PATCH v4 16/17] doc/sphinx/hxtool.py: add optional label argument to SRST directive, (continued)
- [PATCH v4 13/17] hw/i386/pc: support '-nic' for xen-net-device, David Woodhouse, 2023/11/06
- [PATCH v4 15/17] xen-platform: unplug AHCI disks, David Woodhouse, 2023/11/06
- [PATCH v4 14/17] net: do not delete nics in net_cleanup(), David Woodhouse, 2023/11/06
- [PATCH v4 08/17] hw/xen: do not repeatedly try to create a failing backend device, David Woodhouse, 2023/11/06
- [PATCH v4 17/17] docs: update Xen-on-KVM documentation, David Woodhouse, 2023/11/06
- [PATCH v4 11/17] hw/xen: only remove peers of PCI NICs on unplug,
David Woodhouse <=
- [PATCH v4 12/17] hw/xen: update Xen PV NIC to XenDevice model, David Woodhouse, 2023/11/06