[PATCH] Set stubDriverName from hostdev driver model attribute during pci device setup

Laine Stump posted 1 patch 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20240216184511.374412-1-laine@redhat.com
src/hypervisor/virhostdev.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] Set stubDriverName from hostdev driver model attribute during pci device setup
Posted by Laine Stump 2 months, 1 week ago
commit v9.10.0-129-g8b93d78c83 (first appearing in libvirt-10.0.0) was
supposed to allow forcing a PCI hostdev to be bound to a particular
driver by adding <driver model='blah'/> to the XML for the
device. Unfortunately, a single line was missed during the final
changes to the patch prior to pushing, and the result was that the
driver model could be set to *anything* and it would be accepted but
just ignored.

This patch adds the missing line, which will set the stubDriverName
field of the virPCIDevice object from the hostdev object as the
virPCIDevice is being created. This ends up being used by
virPCIDeviceBindToStub() as the driver that it binds the device to.

Fixes: 8b93d78c8325f1fba5db98848350f3db43f5e7d5
Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/hypervisor/virhostdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 40f8a4bc2c..53327f4f4d 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -242,6 +242,8 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
         return -1;
 
     virPCIDeviceSetManaged(actual, hostdev->managed);
+    virPCIDeviceSetStubDriverName(actual, pcisrc->driver.model);
+
 
     if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
         virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH] Set stubDriverName from hostdev driver model attribute during pci device setup
Posted by Michal Prívozník 2 months, 1 week ago
On 2/16/24 19:45, Laine Stump wrote:
> commit v9.10.0-129-g8b93d78c83 (first appearing in libvirt-10.0.0) was
> supposed to allow forcing a PCI hostdev to be bound to a particular
> driver by adding <driver model='blah'/> to the XML for the
> device. Unfortunately, a single line was missed during the final
> changes to the patch prior to pushing, and the result was that the
> driver model could be set to *anything* and it would be accepted but
> just ignored.
> 
> This patch adds the missing line, which will set the stubDriverName
> field of the virPCIDevice object from the hostdev object as the
> virPCIDevice is being created. This ends up being used by
> virPCIDeviceBindToStub() as the driver that it binds the device to.
> 
> Fixes: 8b93d78c8325f1fba5db98848350f3db43f5e7d5
> Signed-off-by: Laine Stump <laine@redhat.com>
> ---
>  src/hypervisor/virhostdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
> index 40f8a4bc2c..53327f4f4d 100644
> --- a/src/hypervisor/virhostdev.c
> +++ b/src/hypervisor/virhostdev.c
> @@ -242,6 +242,8 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
>          return -1;
>  
>      virPCIDeviceSetManaged(actual, hostdev->managed);
> +    virPCIDeviceSetStubDriverName(actual, pcisrc->driver.model);
> +
>  

No need for the extra line.

>      if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
>          virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);


Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org