[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <669fb111-9821-aadc-acbf-de42bc551fc4@linux.intel.com>
Date: Sat, 7 May 2022 16:32:58 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jean-Philippe Brucker <jean-philippe@...aro.org>
Cc: Kevin Tian <kevin.tian@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Robin Murphy <robin.murphy@....com>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
Vinod Koul <vkoul@...nel.org>,
Jacob jun Pan <jacob.jun.pan@...el.com>,
Jason Gunthorpe <jgg@...dia.com>, Will Deacon <will@...nel.org>
Subject: Re: [PATCH v5 04/12] iommu/sva: Basic data structures for SVA
Hi Jean,
On 2022/5/5 14:42, Baolu Lu wrote:
> On 2022/5/4 02:09, Jean-Philippe Brucker wrote:
>> On Mon, May 02, 2022 at 09:48:34AM +0800, Lu Baolu wrote:
>>> Use below data structures for SVA implementation in the IOMMU core:
>>>
>>> - struct iommu_sva_ioas
>>> Represent the I/O address space shared with an application CPU
>>> address
>>> space. This structure has a 1:1 relationship with an mm_struct. It
>>> grabs a "mm->mm_count" refcount during creation and drop it on
>>> release.
>>
>> Do we actually need this structure? At the moment it only keeps track of
>> bonds, which we can move to struct dev_iommu. Replacing it by a mm
>> pointer
>> in struct iommu_domain simplifies the driver and seems to work
>
> Fair enough.
>
> +struct iommu_sva_ioas {
> + struct mm_struct *mm;
> + ioasid_t pasid;
> +
> + /* Counter of domains attached to this ioas. */
> + refcount_t users;
> +
> + /* All bindings are linked here. */
> + struct list_head bonds;
> +};
>
> By moving @mm to struct iommu_domain and @bonds to struct dev_iommu, the
> code looks simpler. The mm, sva domain and per-device dev_iommu are
> guaranteed to be valid during bind() and unbind().
>
> Will head this direction in the next version.
I'm trying to implement this idea in real code. It seems that we need
additional fields in struct iommu_domain to track which devices the mm
was bound to. It doesn't simplify the code much. Any thoughts?
Best regards,
baolu
Powered by blists - more mailing lists