[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71f61d8a-9188-4e67-88ca-e5b48a91e6b5@linux.intel.com>
Date: Thu, 12 Sep 2024 19:22:30 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Joel Granados <j.granados@...sung.com>
Cc: baolu.lu@...ux.intel.com, 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 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?
Thanks,
baolu
Powered by blists - more mailing lists