[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZW7NwSCzswweHZh6@yzhao56-desk.sh.intel.com>
Date: Tue, 5 Dec 2023 15:14:09 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <iommu@...ts.linux.dev>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <alex.williamson@...hat.com>,
<pbonzini@...hat.com>, <seanjc@...gle.com>, <joro@...tes.org>,
<will@...nel.org>, <robin.murphy@....com>, <kevin.tian@...el.com>,
<baolu.lu@...ux.intel.com>, <dwmw2@...radead.org>,
<yi.l.liu@...el.com>
Subject: Re: [RFC PATCH 16/42] iommufd: Enable device feature IOPF during
device attachment to KVM HWPT
On Mon, Dec 04, 2023 at 02:36:03PM -0400, Jason Gunthorpe wrote:
> On Sat, Dec 02, 2023 at 05:23:11PM +0800, Yan Zhao wrote:
> > Enable device feature IOPF during device attachment to KVM HWPT and abort
> > the attachment if feature enabling is failed.
> >
> > "pin" is not done by KVM HWPT. If VMM wants to create KVM HWPT, it must
> > know that all devices attached to this HWPT support IOPF so that pin-all
> > is skipped.
> >
> > Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
> > ---
> > drivers/iommu/iommufd/device.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> > index 83af6b7e2784b..4ea447e052ce1 100644
> > --- a/drivers/iommu/iommufd/device.c
> > +++ b/drivers/iommu/iommufd/device.c
> > @@ -381,10 +381,26 @@ int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
> > goto err_unresv;
> > idev->igroup->hwpt = hwpt;
> > }
> > + if (hwpt_is_kvm(hwpt)) {
> > + /*
> > + * Feature IOPF requires ats is enabled which is true only
> > + * after device is attached to iommu domain.
> > + * So enable dev feature IOPF after iommu_attach_group().
> > + * -EBUSY will be returned if feature IOPF is already on.
> > + */
> > + rc = iommu_dev_enable_feature(idev->dev, IOMMU_DEV_FEAT_IOPF);
> > + if (rc && rc != -EBUSY)
> > + goto err_detach;
>
> I would like to remove IOMMU_DEV_FEAT_IOPF completely please
So, turn on device PRI during device attachment in IOMMU vendor driver?
Powered by blists - more mailing lists