On Fri, Apr 21, 2023 at 11:19:23AM -0700, Nicolin Chen wrote: > On Fri, Apr 21, 2023 at 02:59:37PM -0300, Jason Gunthorpe wrote: > > On Fri, Apr 21, 2023 at 10:37:22AM -0700, Nicolin Chen wrote: > > > > > How about the following piece? Needs a test with QEMU though.. > > > > > > static const size_t iommufd_device_data_size[] = { > > > [IOMMU_HW_INFO_TYPE_NONE] = 0, > > > [IOMMU_HW_INFO_TYPE_INTEL_VTD] = 0, > > > [IOMMU_HW_INFO_TYPE_ARM_SMMUV3] = > > > sizeof(struct iommu_device_data_arm_smmuv3), > > > }; > > > > If we need more than one of these things we'll need a better > > solution.. > > How about adding ops->device_data_size to store the value? https://lore.kernel.org/linux-iommu/cover.1682234302.git.nicolinc@xxxxxxxxxx/ I sent a v3 that includes this replacing the data_size array. If it looks good, we can drop the other two data_size arrays for hwpt in the nesting series too. Thanks Nic