[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276C7E6D55C93D2EB987C1B8CA42@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 10 Jul 2024 00:32:06 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Jason Gunthorpe <jgg@...pe.ca>, Baolu Lu <baolu.lu@...ux.intel.com>
CC: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>, "Robin
Murphy" <robin.murphy@....com>, Jean-Philippe Brucker
<jean-philippe@...aro.org>, Nicolin Chen <nicolinc@...dia.com>, "Liu, Yi L"
<yi.l.liu@...el.com>, Jacob Pan <jacob.jun.pan@...ux.intel.com>, "Joel
Granados" <j.granados@...sung.com>, "iommu@...ts.linux.dev"
<iommu@...ts.linux.dev>, "virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v7 07/10] iommufd: Fault-capable hwpt
attach/detach/replace
> From: Jason Gunthorpe <jgg@...pe.ca>
> Sent: Wednesday, July 10, 2024 1:37 AM
>
> On Mon, Jul 01, 2024 at 01:55:12PM +0800, Baolu Lu wrote:
> > On 2024/6/29 5:17, Jason Gunthorpe wrote:
> > > On Sun, Jun 16, 2024 at 02:11:52PM +0800, Lu Baolu wrote:
> > > > +static int iommufd_fault_iopf_enable(struct iommufd_device *idev)
> > > > +{
> > > > + struct device *dev = idev->dev;
> > > > + int ret;
> > > > +
> > > > + /*
> > > > + * Once we turn on PCI/PRI support for VF, the response failure code
> > > > + * should not be forwarded to the hardware due to PRI being a
> shared
> > > > + * resource between PF and VFs. There is no coordination for this
> > > > + * shared capability. This waits for a vPRI reset to recover.
> > > > + */
> > > > + if (dev_is_pci(dev) && to_pci_dev(dev)->is_virtfn)
> > > > + return -EINVAL;
> > > I don't quite get this remark, isn't not supporting PRI on VFs kind of
> > > useless? What is the story here?
> >
> > This remark is trying to explain why attaching an iopf-capable hwpt to a
> > VF is not supported for now. The PCI sepc (section 10.4.2.1) states that
> > a response failure will disable the PRI on the function. But for PF/VF
> > case, the PRI is a shared resource, therefore a response failure on a VF
> > might cause iopf on other VFs to malfunction. So, we start from simple
> > by not allowing it.
>
> You are talking about IOMMU_PAGE_RESP_FAILURE ?
>
> But this is bad already, something like SVA could trigger
> IOMMU_PAGE_RESP_FAILURE on a VF without iommufd today. Due to
> memory
> allocation failure in iommu_report_device_fault()
>
> And then we pass in code from userspace and blindly cast it to
> enum iommu_page_response_code ?
>
> Probably we should just only support
> IOMMU_PAGE_RESP_SUCCESS/INVALID
> from userspace and block FAILURE entirely. Probably the VMM should
> emulate FAILURE by disabling PRI on by changing to a non PRI domain.
>
Agree. The definition of response failure is same as disabling the PRI
interface and requires re-enablement of PRI to recover. Using domain
switch can naturally leverage future fix on coordinating PRI enable/disable
between PF/VF.
Powered by blists - more mailing lists