From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, stephen@networkplumber.org,
bruce.richardson@intel.com, fengchengwen@huawei.com,
longli@microsoft.com, hemant.agrawal@nxp.com,
Wei Hu <weh@microsoft.com>
Subject: [PATCH v2 10/10] bus/vmbus: support unplug
Date: Thu, 18 Jun 2026 17:28:25 +0200 [thread overview]
Message-ID: <20260618152826.490569-11-david.marchand@redhat.com> (raw)
In-Reply-To: <20260618152826.490569-1-david.marchand@redhat.com>
Add .unplug callback to handle driver removal, device unmapping, and
interrupt cleanup. This enables use of the generic bus cleanup helper.
The cleanup function was already performing these operations, so it
seems safe to expose them through the unplug operation.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
doc/guides/rel_notes/release_26_07.rst | 4 +++
drivers/bus/vmbus/vmbus_common.c | 41 ++++++++++++--------------
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
index 5d7aa8d1bf..55d3b44527 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -114,6 +114,10 @@ New Features
Added no-IOMMU mode for devices without or not enabling IOMMU/SVA.
+* **Added unplug operation support to VMBUS bus.**
+
+ Implemented device unplug operation to allow runtime removal of VMBUS devices.
+
* **Added selective Rx in ethdev API.**
Some parts of packets may be discarded in Rx
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index a6e3a24a7c..cd6e851e4c 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -144,34 +144,29 @@ rte_vmbus_probe(void)
}
static int
-rte_vmbus_cleanup(struct rte_bus *bus)
+vmbus_unplug_device(struct rte_device *rte_dev)
{
- struct rte_vmbus_device *dev;
- int error = 0;
-
- RTE_BUS_FOREACH_DEV(dev, bus) {
- const struct rte_vmbus_driver *drv;
- int ret;
-
- if (!rte_dev_is_probed(&dev->device))
- continue;
- drv = RTE_BUS_DRIVER(dev->device.driver, *drv);
- if (drv->remove == NULL)
- continue;
+ const struct rte_vmbus_driver *drv = RTE_BUS_DRIVER(rte_dev->driver, *drv);
+ struct rte_vmbus_device *dev = RTE_BUS_DEVICE(rte_dev, *dev);
+ int ret = 0;
+ if (drv->remove != NULL) {
ret = drv->remove(dev);
if (ret < 0)
- error = -1;
+ return ret;
+ }
- rte_vmbus_unmap_device(dev);
- rte_intr_instance_free(dev->intr_handle);
+ rte_vmbus_unmap_device(dev);
+ rte_intr_instance_free(dev->intr_handle);
+ dev->intr_handle = NULL;
- dev->device.driver = NULL;
- rte_bus_remove_device(bus, &dev->device);
- free(dev);
- }
+ return 0;
+}
- return error;
+static void
+vmbus_free_device(struct rte_device *dev)
+{
+ free(RTE_BUS_DEVICE(dev, struct rte_vmbus_device));
}
static int
@@ -222,10 +217,12 @@ rte_vmbus_unregister(struct rte_vmbus_driver *driver)
struct rte_bus rte_vmbus_bus = {
.scan = rte_vmbus_scan,
.probe = rte_bus_generic_probe,
- .cleanup = rte_vmbus_cleanup,
+ .free_device = vmbus_free_device,
+ .cleanup = rte_bus_generic_cleanup,
.find_device = rte_bus_generic_find_device,
.match = vmbus_bus_match,
.probe_device = vmbus_probe_device,
+ .unplug_device = vmbus_unplug_device,
.parse = vmbus_parse,
.dev_compare = vmbus_dev_compare,
};
--
2.53.0
next prev parent reply other threads:[~2026-06-18 15:29 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 9:45 [PATCH 00/13] Bus cleanup infrastructure and fixes David Marchand
2026-06-11 9:45 ` [PATCH 01/13] bus: fix reference to plug callback David Marchand
2026-06-11 9:45 ` [PATCH 02/13] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-11 9:45 ` [PATCH 03/13] bus/vdev: remove driver setting in probe David Marchand
2026-06-11 9:45 ` [PATCH 04/13] drivers/bus: cleanup device freeing in NXP bus David Marchand
2026-06-11 9:45 ` [PATCH 05/13] drivers/bus: allocate interrupt during probing " David Marchand
2026-06-11 9:45 ` [PATCH 06/13] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-11 9:45 ` [PATCH 07/13] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-11 9:45 ` [PATCH 08/13] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-15 19:13 ` [EXTERNAL] " Long Li
2026-06-11 9:45 ` [PATCH 09/13] bus: align unplug with device probe David Marchand
2026-06-11 9:45 ` [PATCH 10/13] bus: implement cleanup in EAL David Marchand
2026-06-11 9:45 ` [PATCH 11/13] bus/dpaa: support unplug David Marchand
2026-06-11 9:45 ` [PATCH 12/13] bus/vmbus: store name in bus specific device David Marchand
2026-06-11 9:45 ` [PATCH 13/13] bus/vmbus: support unplug David Marchand
2026-06-11 10:09 ` [PATCH 00/13] Bus cleanup infrastructure and fixes David Marchand
2026-06-15 19:14 ` [EXTERNAL] " Long Li
2026-06-15 23:55 ` Long Li
2026-06-16 6:55 ` David Marchand
2026-06-16 7:47 ` David Marchand
2026-06-17 9:16 ` Hemant Agrawal
2026-06-18 8:39 ` David Marchand
2026-06-18 15:28 ` David Marchand
2026-06-18 15:28 ` [PATCH v2 00/10] " David Marchand
2026-06-18 15:28 ` [PATCH v2 01/10] bus: fix reference to plug callback David Marchand
2026-06-22 9:49 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 02/10] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-22 9:48 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 03/10] bus/vdev: remove driver setting in probe David Marchand
2026-06-18 15:28 ` [PATCH v2 04/10] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-18 15:28 ` [PATCH v2 05/10] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-19 22:04 ` [EXTERNAL] " Long Li
2026-06-18 15:28 ` [PATCH v2 06/10] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-19 22:05 ` [EXTERNAL] " Long Li
2026-06-18 15:28 ` [PATCH v2 07/10] bus: align unplug with device probe David Marchand
2026-06-22 10:19 ` Bruce Richardson
2026-06-22 12:44 ` David Marchand
2026-06-18 15:28 ` [PATCH v2 08/10] bus: implement cleanup in EAL David Marchand
2026-06-22 10:26 ` Bruce Richardson
2026-06-18 15:28 ` [PATCH v2 09/10] bus/vmbus: store name in bus specific device David Marchand
2026-06-22 10:28 ` Bruce Richardson
2026-06-18 15:28 ` David Marchand [this message]
2026-06-23 10:54 ` [PATCH v3 00/11] Bus cleanup infrastructure and fixes David Marchand
2026-06-23 10:54 ` [PATCH v3 01/11] bus: fix reference to plug callback David Marchand
2026-06-23 10:54 ` [PATCH v3 02/11] dma/idxd: remove next pointer in bus specific device David Marchand
2026-06-23 10:54 ` [PATCH v3 03/11] bus/vdev: remove driver setting in probe David Marchand
2026-06-23 10:54 ` [PATCH v3 04/11] bus/pci: fix mapping leak in bus cleanup David Marchand
2026-06-23 10:54 ` [PATCH v3 05/11] bus/vmbus: fix interrupt leak in cleanup David Marchand
2026-06-23 10:54 ` [PATCH v3 06/11] bus/vmbus: allocate interrupt during probing David Marchand
2026-06-23 10:54 ` [PATCH v3 07/11] bus/ifpga: " David Marchand
2026-06-23 11:25 ` Bruce Richardson
2026-06-23 10:54 ` [PATCH v3 08/11] bus: align unplug with device probe David Marchand
2026-06-23 10:54 ` [PATCH v3 09/11] bus: implement cleanup in EAL David Marchand
2026-06-23 10:54 ` [PATCH v3 10/11] bus/vmbus: store name in bus specific device David Marchand
2026-06-23 10:54 ` [PATCH v3 11/11] bus/vmbus: support unplug David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260618152826.490569-11-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=hemant.agrawal@nxp.com \
--cc=longli@microsoft.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=weh@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox