[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNu3gw/d0wj4qBpU@Asurada-Nvidia>
Date: Tue, 15 Aug 2023 10:36:03 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Yi Liu <yi.l.liu@...el.com>, <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>,
<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 Tue, Aug 15, 2023 at 01:42:35PM -0300, Jason Gunthorpe wrote:
> 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
Ack for that. We'd make similar changes to the other handlers too.
Thanks
Nic
Powered by blists - more mailing lists