On 09/12/2025 15:59, Stefan Hajnoczi wrote:
On Mon, Dec 08, 2025 at 06:18:14PM +0200, Max Gurtovoy wrote:
On 08/12/2025 17:54, Stefan Hajnoczi wrote:
On Mon, Dec 08, 2025 at 04:39:25PM +0200, Max Gurtovoy wrote:
Add support for the 'driver_override' attribute to Virtio devices. This
allows users to control which Virtio bus driver binds to a given Virtio
device.
If 'driver_override' is not set, the existing behavior is preserved and
devices will continue to auto-bind to the first matching Virtio bus
driver.
Signed-off-by: Avraham Evdaev <[email protected]>
Signed-off-by: Max Gurtovoy <[email protected]>
---
drivers/virtio/virtio.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/virtio.h | 4 ++++
2 files changed, 38 insertions(+)
What is the use case? Is there something missing in existing drivers
that cannot be added to them by extending the code?
Stefan
The main goal is to align the virtio bus with the flexibility that already
exists for other buses in the Linux device model.
On buses such as PCI and vDPA, it is possible to override or replace the
default driver for a given device and bind it to an alternative driver.
Allowing the selection of which driver is bound to a device can be useful in
both development and production environments.
There are use cases for PCI and vDPA, like binding vfio_pci to a device
that would normally use its device-specific driver.
For VIRTIO, I'm not sure what the use case would be. Is there another
driver that could bind to virtio-net devices, for example?
Yes.
Giving a concrete example would be useful to help people understand why
this is necessary.
See example in my v2.
-Max
Stefan