[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNuq+17Gv/d3lEin@nvidia.com>
Date: Tue, 15 Aug 2023 13:42:35 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Yi Liu <yi.l.liu@...el.com>
Cc: joro@...tes.org, alex.williamson@...hat.com, kevin.tian@...el.com,
robin.murphy@....com, baolu.lu@...ux.intel.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
Subject: Re: [PATCH v7 3/4] iommufd: Add IOMMU_GET_HW_INFO
On Fri, Aug 11, 2023 at 12:15:00AM -0700, Yi Liu wrote:
> Under nested IOMMU translation, userspace owns the stage-1 translation
> table (e.g. the stage-1 page table of Intel VT-d or the context table
> of ARM SMMUv3, and etc.). Stage-1 translation tables are vendor specific,
> and need to be compatible with the underlying IOMMU hardware. Hence,
> userspace should know the IOMMU hardware capability before creating and
> configuring the stage-1 translation table to kernel.
>
> This adds IOMMU_GET_HW_INFO ioctl to query the IOMMU hardware information
> (a.k.a capability) for a given device. The returned data is vendor specific,
> userspace needs to decode it with the structure mapped by the @out_data_type
> field.
>
> As only physical devices have IOMMU hardware, so this will return error
> if the given device is not a physical device.
>
> Reviewed-by: Lu Baolu <baolu.lu@...ux.intel.com>
> Co-developed-by: Nicolin Chen <nicolinc@...dia.com>
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> Signed-off-by: Yi Liu <yi.l.liu@...el.com>
> ---
> drivers/iommu/iommufd/main.c | 85 ++++++++++++++++++++++++++++++++++++
> include/uapi/linux/iommufd.h | 36 +++++++++++++++
> 2 files changed, 121 insertions(+)
>
> diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
> index 94c498b8fdf6..d459811c5381 100644
> --- a/drivers/iommu/iommufd/main.c
> +++ b/drivers/iommu/iommufd/main.c
> @@ -17,6 +17,7 @@
I was looking at this more and this code should be in device.c:
> +static int iommufd_fill_hw_info(struct device *dev, void __user *user_ptr,
> + unsigned int *length, u32 *type)
> +{
Since it is working on devices
main.c is primarily for context related stuff
Jason
Powered by blists - more mailing lists