>-----Original Message----- >From: Cédric Le Goater <c...@redhat.com> >Subject: Re: [PATCH v3 11/19] backends/iommufd: Implement >HostIOMMUDeviceClass::check_cap() handler > >>>>>> +static int hiod_iommufd_check_cap(HostIOMMUDevice *hiod, int >cap, >>>>> Error **errp) >>>>>> +{ >>>>>> + switch (cap) { >>>>>> + case HOST_IOMMU_DEVICE_CAP_IOMMUFD: >>>>>> + return 1; >>>>> >>>>> I don't understand this value. >>>> >>>> 1 means this host iommu device is attached to IOMMUFD backend, >>>> or else 0 if attached to legacy backend. >>> >>> Hmm, this looks hacky to me and it is not used anywhere in the patchset. >>> Let's reconsider when there is actually a use for it. Until then, please >>> drop. My feeling is that a new HostIOMMUDeviceClass >handler/attributed >>> should be introduced instead. >> >> Got it, will drop it in this series. >> >> Is "return 1" directly the concern on your side? > >I don't know yet why the implementation would need to know if the host >IOMMU device is of type IOMMUFD. If that's the case, there are alternative >ways, like using OBJECT_CHECK( ..., TYPE_HOST_IOMMU_DEVICE_IOMMUFD) >or >a class attribute defined at build time but that's a bit the same. Let's >see when the need arises.
Got it, let's revisit it in nesting series, will drop it for now. Thanks Zhenzhong