[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 07/19] vfio/container: Implement HostIOMMUDeviceClass::rea
From: |
Eric Auger |
Subject: |
Re: [PATCH v6 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler |
Date: |
Mon, 3 Jun 2024 13:23:18 +0200 |
User-agent: |
Mozilla Thunderbird |
Hi Zhenzhong,
On 6/3/24 08:10, Zhenzhong Duan wrote:
> Utilize range_get_last_bit() to get host IOMMU address width and
> package it in HostIOMMUDeviceCaps for query with .get_cap().
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
> hw/vfio/container.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
> index c4fca2dfca..48800fe92f 100644
> --- a/hw/vfio/container.c
> +++ b/hw/vfio/container.c
> @@ -1136,6 +1136,31 @@ static void vfio_iommu_legacy_class_init(ObjectClass
> *klass, void *data)
> vioc->pci_hot_reset = vfio_legacy_pci_hot_reset;
> };
>
> +static bool hiod_legacy_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
> + Error **errp)
> +{
> + VFIODevice *vdev = opaque;
> + /* iova_ranges is a sorted list */
> + GList *l = g_list_last(vdev->bcontainer->iova_ranges);
> +
> + /* Only support query HOST_IOMMU_DEVICE_CAP_AW_BITS with legacy backend
> */
I don't get the comment as HOST_IOMMU_DEVICE_CAP_AW_BITS support seems
to be introduced in [PATCH v6 11/19] backends/iommufd: Implement
HostIOMMUDeviceClass::get_cap() handler
> + if (l) {
> + Range *range = l->data;
> + hiod->caps.aw_bits = range_get_last_bit(range) + 1;
> + } else {
> + hiod->caps.aw_bits = 0xff;
why this value?
> + }
> +
> + return true;
> +}
> +
> +static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data)
> +{
> + HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
> +
> + hioc->realize = hiod_legacy_vfio_realize;
> +};
> +
> static const TypeInfo types[] = {
> {
> .name = TYPE_VFIO_IOMMU_LEGACY,
> @@ -1144,6 +1169,7 @@ static const TypeInfo types[] = {
> }, {
> .name = TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO,
> .parent = TYPE_HOST_IOMMU_DEVICE,
> + .class_init = hiod_legacy_vfio_class_init,
> }
> };
>
Thanks
Eric
- [PATCH v6 03/19] backends/iommufd: Introduce abstract TYPE_HOST_IOMMU_DEVICE_IOMMUFD device, (continued)
- [PATCH v6 03/19] backends/iommufd: Introduce abstract TYPE_HOST_IOMMU_DEVICE_IOMMUFD device, Zhenzhong Duan, 2024/06/03
- [PATCH v6 04/19] vfio/iommufd: Introduce TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO device, Zhenzhong Duan, 2024/06/03
- [PATCH v6 05/19] backends/host_iommu_device: Introduce HostIOMMUDeviceCaps, Zhenzhong Duan, 2024/06/03
- [PATCH v6 06/19] range: Introduce range_get_last_bit(), Zhenzhong Duan, 2024/06/03
- [PATCH v6 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/06/03
- Re: [PATCH v6 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler,
Eric Auger <=
[PATCH v6 08/19] backends/iommufd: Introduce helper function iommufd_backend_get_device_info(), Zhenzhong Duan, 2024/06/03
[PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/06/03
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/03
- RE: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Duan, Zhenzhong, 2024/06/03
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/04
- RE: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Duan, Zhenzhong, 2024/06/04
- Re: [PATCH v6 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Eric Auger, 2024/06/04