[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527679FF12B6D990A5E596A88CB89@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 28 Jun 2022 08:50:16 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
Jason Gunthorpe <jgg@...dia.com>,
Christoph Hellwig <hch@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
"Robin Murphy" <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
"Jiang, Dave" <dave.jiang@...el.com>, Vinod Koul <vkoul@...nel.org>
CC: Eric Auger <eric.auger@...hat.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Jean-Philippe Brucker" <jean-philippe@...aro.org>
Subject: RE: [PATCH v9 04/11] iommu: Add sva iommu_domain support
> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Tuesday, June 28, 2022 1:41 PM
> >
> >> struct iommu_domain {
> >> unsigned type;
> >> const struct iommu_domain_ops *ops;
> >> unsigned long pgsize_bitmap; /* Bitmap of page sizes in use */
> >> - iommu_fault_handler_t handler;
> >> - void *handler_token;
> >> struct iommu_domain_geometry geometry;
> >> struct iommu_dma_cookie *iova_cookie;
> >> + union {
> >> + struct { /* IOMMU_DOMAIN_DMA */
> >> + iommu_fault_handler_t handler;
> >> + void *handler_token;
> >> + };
> >
> > why is it DMA domain specific? What about unmanaged
> > domain? Unrecoverable fault can happen on any type
> > including SVA. Hence I think above should be domain type
> > agnostic.
>
> The report_iommu_fault() should be replaced by the new
> iommu_report_device_fault(). Jean has already started this work.
>
> https://lore.kernel.org/linux-iommu/Yo4Nw9QyllT1RZbd@myrica/
>
> Currently this is only for DMA domains, hence Robin suggested to make it
> exclude with the SVA domain things.
>
> https://lore.kernel.org/linux-iommu/f3170016-4d7f-e78e-db48-
> 68305f683349@....com/
Then it's worthy a comment that those two fields are for
some legacy fault reporting stuff and DMA type only.
> >
> >> +
> >> + mutex_lock(&group->mutex);
> >> + curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain,
> >> GFP_KERNEL);
> >> + if (curr)
> >> + goto out_unlock;
> >
> > Need check xa_is_err(old).
>
> Either
>
> (1) old entry is a valid pointer, or
return -EBUSY in this case
> (2) xa_is_err(curr)
return xa_err(cur)
>
> are failure cases. Hence, "curr == NULL" is the only check we need. Did
> I miss anything?
>
But now you always return -EBUSY for all kinds of xa errors.
Powered by blists - more mailing lists