Thread (8 messages) 8 messages, 3 authors, 2021-11-09

Re: [PATCH] vdpa: add driver_override support

flat view

From: Stefano Garzarella <sgarzare@redhat.com>
Date: 2021-11-05 08:31:22
Also in: lkml

On Fri, Nov 05, 2021 at 04:26:44PM +0800, Jason Wang wrote:
On Fri, Nov 5, 2021 at 4:05 PM Stefano Garzarella [off-list ref] wrote:
quoted
On Fri, Nov 05, 2021 at 11:01:30AM +0800, Jason Wang wrote:
quoted
On Fri, Nov 5, 2021 at 12:17 AM Stefano Garzarella [off-list ref] wrote:
quoted
`driver_override` allows to control which of the vDPA bus drivers
binds to a vDPA device.

If `driver_override` is not set, the previous behaviour is followed:
devices use the first vDPA bus driver loaded (unless auto binding
is disabled).

Tested on Fedora 34 with driverctl(8):
  $ modprobe virtio-vdpa
  $ modprobe vhost-vdpa
  $ modprobe vdpa-sim-net

  $ vdpa dev add mgmtdev vdpasim_net name dev1

  # dev1 is attached to the first vDPA bus driver loaded
  $ driverctl -b vdpa list-devices
    dev1 virtio_vdpa

  $ driverctl -b vdpa set-override dev1 vhost_vdpa

  $ driverctl -b vdpa list-devices
    dev1 vhost_vdpa [*]

  Note: driverctl(8) integrates with udev so the binding is
  preserved.

Suggested-by: Jason Wang <redacted>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
 include/linux/vdpa.h |  2 ++
 drivers/vdpa/vdpa.c  | 74 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)
diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index c3011ccda430..ae34015b37b7 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -64,6 +64,7 @@ struct vdpa_mgmt_dev;
  * struct vdpa_device - representation of a vDPA device
  * @dev: underlying device
  * @dma_dev: the actual device that is performing DMA
+ * @driver_override: driver name to force a match
This seems useless?
I'm a bit lost, do you mean we should remove the documentation of
`driver_override`?
I misread the code which was misled by vdpa_mgmt_dev above:(
Yeah, the same thing happened to me now while double checking ;-)
The code should be fine.

So:

Acked-by: Jason Wang <redacted>
Thanks,
Stefano

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help