On 9/25/2025 10:23 PM, Zhenzhong Duan wrote:
On source side, if there are more than one VFIO devices and they
attach to same container, only the first device saves cpr.ioas_id,
                                             nit: sets cpr.ioas_id

the others are bypassed. We should same it for each device, or
                                nit: set it> else only first device works.

Fixes: 4296ee07455e ("vfio/iommufd: reconstruct device")
Signed-off-by: Zhenzhong Duan <[email protected]>

Reviewed-by: Steve Sistare <[email protected]>

Thanks for fixing this!

- Steve

---
  hw/vfio/iommufd.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 8c27222f75..103ff43426 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -607,7 +607,6 @@ skip_ioas_alloc:
      container->be = vbasedev->iommufd;
      container->ioas_id = ioas_id;
      QLIST_INIT(&container->hwpt_list);
-    vbasedev->cpr.ioas_id = ioas_id;
bcontainer = &container->bcontainer;
      vfio_address_space_insert(space, bcontainer);
@@ -641,6 +640,8 @@ skip_ioas_alloc:
      bcontainer->initialized = true;
found_container:
+    vbasedev->cpr.ioas_id = container->ioas_id;
+
      ret = ioctl(devfd, VFIO_DEVICE_GET_INFO, &dev_info);
      if (ret) {
          error_setg_errno(errp, errno, "error getting device info");


Reply via email to