[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250603122403.GI376789@nvidia.com>
Date: Tue, 3 Jun 2025 09:24:03 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: kevin.tian@...el.com, corbet@....net, will@...nel.org,
bagasdotme@...il.com, robin.murphy@....com, joro@...tes.org,
thierry.reding@...il.com, vdumpa@...dia.com, jonathanh@...dia.com,
shuah@...nel.org, jsnitsel@...hat.com, nathan@...nel.org,
peterz@...radead.org, yi.l.liu@...el.com, mshavit@...gle.com,
praan@...gle.com, zhangzekun11@...wei.com, iommu@...ts.linux.dev,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
linux-kselftest@...r.kernel.org, patches@...ts.linux.dev,
mochs@...dia.com, alok.a.tiwari@...cle.com, vasant.hegde@....com,
dwmw2@...radead.org, baolu.lu@...ux.intel.com
Subject: Re: [PATCH v5 14/29] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC
ioctl
On Mon, Jun 02, 2025 at 10:41:05PM -0700, Nicolin Chen wrote:
> I found that the size_viommu or size_hw_queue might not work using
> a static macro as that RDMA one does:
>
> - The size in vIOMMU case is type dependent. E.g. smmuv3 driver
> uses one iommu_ops to support two types: vSMMU and vCMDQ
Maybe they can just be max()'d?
> 1) Define a get_viommu_size(unsigned int type) op: use a similar
> macro in the driver function to return with:
>
> #define VIOMMU_STRUCT_SIZE(ib_struct, drv_struct, member) \
> (sizeof(drv_struct) + \
> BUILD_BUG_ON_ZERO(offsetof(drv_struct, member)) + \
> BUILD_BUG_ON_ZERO(!__same_type(((drv_struct *)NULL)->member, \
> ib_struct)))
>
> if (type == SMMU)
> return VIOMMU_STRUCT_SIZE(
> struct arm_vsmmu, struct iommufd_viommu, core);
> return 0;
I guess this is best?
> 2) Let core allocate with sizeof(struct iommufd_viommu), then let
> driver krealloc during the viommu_init op call:
No.. memmoving things like locks doesn't work.
Jason
Powered by blists - more mailing lists