qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 03/10] vfio/iommufd: Return errno in iommufd_cdev_attach_i


From: Cédric Le Goater
Subject: Re: [PATCH v3 03/10] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt()
Date: Mon, 8 Jul 2024 17:28:03 +0200
User-agent: Mozilla Thunderbird

Hello Joao,

On 7/8/24 4:34 PM, Joao Martins wrote:
In preparation to implement auto domains have the attach function
return the errno it got during domain attach instead of a bool.

-EINVAL is tracked to track domain incompatibilities, and decide whether
to create a new IOMMU domain.

Please leave the return value as a bool unless there is a very
good reason not to.


Thanks,

C.



Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
  hw/vfio/iommufd.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 9cee71659b1c..5a5993b17c2e 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -172,7 +172,7 @@ out:
      return ret;
  }
-static bool iommufd_cdev_attach_ioas_hwpt(VFIODevice *vbasedev, uint32_t id,
+static int iommufd_cdev_attach_ioas_hwpt(VFIODevice *vbasedev, uint32_t id,
                                           Error **errp)
  {
      int iommufd = vbasedev->iommufd->fd;
@@ -187,12 +187,12 @@ static bool iommufd_cdev_attach_ioas_hwpt(VFIODevice 
*vbasedev, uint32_t id,
          error_setg_errno(errp, errno,
                           "[iommufd=%d] error attach %s (%d) to id=%d",
                           iommufd, vbasedev->name, vbasedev->fd, id);
-        return false;
+        return -errno;
      }
trace_iommufd_cdev_attach_ioas_hwpt(iommufd, vbasedev->name,
                                          vbasedev->fd, id);
-    return true;
+    return 0;
  }
static bool iommufd_cdev_detach_ioas_hwpt(VFIODevice *vbasedev, Error **errp)
@@ -216,7 +216,7 @@ static bool iommufd_cdev_attach_container(VFIODevice 
*vbasedev,
                                            VFIOIOMMUFDContainer *container,
                                            Error **errp)
  {
-    return iommufd_cdev_attach_ioas_hwpt(vbasedev, container->ioas_id, errp);
+    return !iommufd_cdev_attach_ioas_hwpt(vbasedev, container->ioas_id, errp);
  }
static void iommufd_cdev_detach_container(VFIODevice *vbasedev,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]