[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcde6757-8d14-6460-c75e-c30d69219e4b@arm.com>
Date: Fri, 22 Sep 2023 10:47:32 +0100
From: Robin Murphy <robin.murphy@....com>
To: Jason Gunthorpe <jgg@...dia.com>,
Baolu Lu <baolu.lu@...ux.intel.com>
Cc: Yi Liu <yi.l.liu@...el.com>, joro@...tes.org,
alex.williamson@...hat.com, kevin.tian@...el.com,
cohuck@...hat.com, eric.auger@...hat.com, nicolinc@...dia.com,
kvm@...r.kernel.org, mjrosato@...ux.ibm.com,
chao.p.peng@...ux.intel.com, yi.y.sun@...ux.intel.com,
peterx@...hat.com, jasowang@...hat.com,
shameerali.kolothum.thodi@...wei.com, lulu@...hat.com,
suravee.suthikulpanit@....com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
zhenzhong.duan@...el.com, joao.m.martins@...cle.com
Subject: Re: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for
domain_alloc_user op
On 2023-09-21 17:44, Jason Gunthorpe wrote:
> On Thu, Sep 21, 2023 at 08:12:03PM +0800, Baolu Lu wrote:
>> On 2023/9/21 15:51, Yi Liu wrote:
>>> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
>>> index 4a7c5c8fdbb4..3c8660fe9bb1 100644
>>> --- a/include/uapi/linux/iommufd.h
>>> +++ b/include/uapi/linux/iommufd.h
>>> @@ -357,6 +357,14 @@ enum iommufd_hwpt_alloc_flags {
>>> IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0,
>>> };
>>> +/**
>>> + * enum iommu_hwpt_type - IOMMU HWPT Type
>>> + * @IOMMU_HWPT_TYPE_DEFAULT: default
>>
>> How about s/default/vendor agnostic/ ?
>
> Please don't use the word vendor :)
>
> IOMMU_HWPT_TYPE_GENERIC perhaps if we don't like default
Ah yes, a default domain type, not to be confused with any default
domain type, including the default default domain type. Just in case
anyone had forgotten how gleefully fun this is :D
I particularly like the bit where we end up with this construct later:
switch (hwpt_type) {
case IOMMU_HWPT_TYPE_DEFAULT:
/* allocate a domain */
default:
/* allocate a different domain */
}
But of course neither case allocates a *default* domain, because it's
quite obviously the wrong place to be doing that.
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).
Thanks,
Robin.
Powered by blists - more mailing lists