[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240913080208.t4tbqskmuyaozhyw@joelS2.panther.com>
Date: Fri, 13 Sep 2024 10:02:08 +0200
From: Joel Granados <j.granados@...sung.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
CC: David Woodhouse <dwmw2@...radead.org>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>, Jason
Gunthorpe <jgg@...pe.ca>, Kevin Tian <kevin.tian@...el.com>, Klaus Jensen
<its@...elevant.dk>, <linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>
Subject: Re: [PATCH 5/6] iommu: init pasid array while doing domain_replace
and iopf is active
On Thu, Sep 12, 2024 at 07:22:30PM +0800, Baolu Lu wrote:
> On 2024/9/12 16:25, Joel Granados wrote:
> > /**
> > * iommu_attach_group_handle - Attach an IOMMU domain to an IOMMU group
> > * @domain: IOMMU domain to attach
> > diff --git i/drivers/iommu/iommufd/fault.c w/drivers/iommu/iommufd/fault.c
> > index ea7f1bf64892..51cb70465b87 100644
> > --- i/drivers/iommu/iommufd/fault.c
> > +++ w/drivers/iommu/iommufd/fault.c
> > @@ -189,8 +189,15 @@ static int iommufd_init_pasid_array(struct iommu_domain *domain,
> > if (!handle)
> > return -ENOMEM;
> > handle->idev = idev;
> > + handle->handle.domain = domain;
> > +
> > + mutex_lock(&group->mutex);
> > + ret = xa_insert(&group->pasid_array, IOMMU_NO_PASID, handle, GFP_KERNEL);
> > + mutex_unlock(&group->mutex);
> > +
> > + if (ret == -EBUSY)
> > + ret = 0;
> >
> > - ret = iommu_init_pasid_array(domain, group, &handle->handle);
> > if (ret)
> > kfree(handle);
>
> This is supposed to be done automatically when an iopf capable domain is
> attached to or replaced with a device. Please refer to
> iommufd_fault_domain_attach_dev() and
> iommufd_fault_domain_replace_dev().
>
> Is there anything preventing this from happening?
Nope, You are correct. This does indeed happen through
iommufd_fault_domain_replace_dev
-> __fault_domain_replace_dev
-> iommu_replace_group_handle.
This was probably left from trying to do this outside the replace path.
Sorry for the noise; will remove it in V2.
Thx for the review
Best
--
Joel Granados
Powered by blists - more mailing lists