Re: [PATCH] vdpa: add driver_override support

From: Stefano Garzarella
Date: Fri Nov 05 2021 - 04:31:22 EST


On Fri, Nov 05, 2021 at 04:26:44PM +0800, Jason Wang wrote:
On Fri, Nov 5, 2021 at 4:05 PM Stefano Garzarella <sgarzare@xxxxxxxxxx> wrote:

On Fri, Nov 05, 2021 at 11:01:30AM +0800, Jason Wang wrote:
>On Fri, Nov 5, 2021 at 12:17 AM Stefano Garzarella <sgarzare@xxxxxxxxxx> wrote:
>>
>> `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 <jasowang@xxxxxxxxxx>
>> Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
>> ---
>> 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 <jasowang@xxxxxxxxxx>


Thanks,
Stefano