[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240507235847.GL4718@ziepe.ca>
Date: Tue, 7 May 2024 20:58:47 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Kevin Tian <kevin.tian@...el.com>, 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>, Yi Liu <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Joel Granados <j.granados@...sung.com>, iommu@...ts.linux.dev,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/9] iommu: Replace sva_iommu with iommu_attach_handle
On Tue, Apr 30, 2024 at 10:57:03PM +0800, Lu Baolu wrote:
> diff --git a/drivers/iommu/iommu-priv.h b/drivers/iommu/iommu-priv.h
> index da1addaa1a31..ae65e0b85d69 100644
> --- a/drivers/iommu/iommu-priv.h
> +++ b/drivers/iommu/iommu-priv.h
> @@ -30,6 +30,13 @@ void iommu_device_unregister_bus(struct iommu_device *iommu,
>
> struct iommu_attach_handle {
> struct iommu_domain *domain;
> + union {
> + /* attach data for SVA domain */
> + struct {
> + struct device *dev;
> + refcount_t users;
> + };
> + };
> };
FWIW I was thinking of having the caller allocate the handle and pass it
down, but this seems workable too and is a bit simpler.
> diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
> index bdc2e6fda782..b325097421c1 100644
> --- a/drivers/misc/uacce/uacce.c
> +++ b/drivers/misc/uacce/uacce.c
> @@ -106,7 +106,7 @@ static long uacce_fops_compat_ioctl(struct file *filep,
> static int uacce_bind_queue(struct uacce_device *uacce, struct uacce_queue *q)
> {
> u32 pasid;
> - struct iommu_sva *handle;
> + struct iommu_attach_handle *handle;
Though I'm much less keen on this..
Maybe
struct iommu_attach_handle {
struct iommu_domain *domain;
union {
struct iommu_sva sva;
};
};
?
Then container_of(sva) to get back to handle and keep the meaningful
type?
Jason
Powered by blists - more mailing lists