lkml.org 
[lkml]   [2022]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 04/12] iommu/sva: Basic data structures for SVA
From
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

\
 
 \ /
  Last update: 2022-05-07 10:35    [W:0.084 / U:1.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site