From: Jason Gunthorpe jgg@nvidia.com Sent: Wednesday, September 27, 2023 12:29 AM
On Tue, Sep 26, 2023 at 06:37:55AM +0000, Tian, Kevin wrote:
From: Robin Murphy robin.murphy@arm.com Sent: Friday, September 22, 2023 5:48 PM
I could go on enjoying myself, but basically yeah, "default" can't be a type in itself (at best it would be a meta-type which could be requested, such that it resolves to some real type to actually allocate), so a good name should reflect what the type functionally *means* to the user. IIUC the important distinction is that it's an abstract kernel-owned pagetable for the user to indirectly control via the API, rather than one it owns and writes directly (and thus has to be in a specific agreed format).
IOMMU_HWPT_TYPE_KERNEL then?
IOMMU_HWPT_TYPE_GENERIC also doesn't sound a straight word.
At the end of the day this enum is the type tag for:
struct iommu_hwpt_alloc { __u32 size; __u32 pt_id; __u32 out_hwpt_id; __u32 __reserved;
- __u32 hwpt_type;
- __u32 data_len;
- __aligned_u64 data_uptr;
};
That pointer.
IOMMU_HWPT_ALLOC_DATA_NONE = 0 IOMMU_HWPT_ALLOC_DATA_INTEL_VTD IOMMU_HWPT_ALLOC_DATA_ARM_SMMUV3
etc?
DATA_NONE requires data_len == 0
Looks good. Probably hwpt_type can be also renamed to data_type to better match this interpretation.