[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW
From: |
Joao Martins |
Subject: |
Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure |
Date: |
Tue, 9 Jul 2024 09:56:10 +0100 |
On 09/07/2024 04:43, Duan, Zhenzhong wrote:
> Hi Joao,
>
>> -----Original Message-----
>> From: Joao Martins <joao.m.martins@oracle.com>
>> Subject: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on
>> IOMMU_GET_HW_INFO failure
>>
>> mdevs aren't "physical" devices and when asking for backing IOMMU info, it
>> fails the entire provisioning of the guest. Fix that by filling caps info
>> when IOMMU_GET_HW_INFO succeeds plus discarding the error we would
>> get into
>> iommufd_backend_get_device_info().
>>
>> Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> Fixes: 930589520128 ("vfio/iommufd: Implement
>> HostIOMMUDeviceClass::realize() handler")
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> ---
>> hw/vfio/iommufd.c | 12 +++++-------
>> 1 file changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
>> index c2f158e60386..a4d23f488b01 100644
>> --- a/hw/vfio/iommufd.c
>> +++ b/hw/vfio/iommufd.c
>> @@ -631,15 +631,13 @@ static bool
>> hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
>>
>> hiod->agent = opaque;
>>
>> - if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
>> - &type, &data, sizeof(data), errp))
>> {
>> - return false;
>> + if (iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
>> + &type, &data, sizeof(data), NULL))
>> {
>
> This will make us miss the real error. What about bypassing host IOMMU device
> creation for mdev as it's not "physical device", passing corresponding host
> IOMMU
> device to vIOMMU make no sense.
Yeap -- This was my second alternative.
I can add an helper for vfio_is_mdev()) and just call
iommufd_backend_get_device_info() if !vfio_is_mdev(). I am assuming you meant
to skip the initialization of HostIOMMUDeviceCaps::caps as I think that
initializing hiod still makes sense as we are still using a
TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO somewhat?
- [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking, Joao Martins, 2024/07/08
- [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Joao Martins, 2024/07/08
- RE: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Duan, Zhenzhong, 2024/07/08
- Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure,
Joao Martins <=
- Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Joao Martins, 2024/07/09
- Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Joao Martins, 2024/07/09
- RE: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Duan, Zhenzhong, 2024/07/09
- Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Joao Martins, 2024/07/10
- RE: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Duan, Zhenzhong, 2024/07/10
- Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure, Joao Martins, 2024/07/10
[PATCH v3 02/10] backends/iommufd: Extend iommufd_backend_get_device_info() to fetch HW capabilities, Joao Martins, 2024/07/08
[PATCH v3 03/10] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt(), Joao Martins, 2024/07/08