lkml.org 
[lkml]   [2022]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v8 04/11] iommu: Add sva iommu_domain support
    From
    On 2022/6/17 15:43, Tian, Kevin wrote:
    >> From: Baolu Lu
    >> Sent: Friday, June 10, 2022 3:16 PM
    >>>
    >>>> +#define __IOMMU_DOMAIN_HOST_VA (1U << 5) /* Host CPU virtual
    >> address */
    >>>
    >>> Do you mean general CPU VA? or Host CPU VA, I'm reading the latter as
    >> 2nd
    >>> stage?
    >>
    >> Host CPU VA. In the near future, we will add another flag _GUEST_VA, so
    >> that the shared page table types are distiguished.
    >
    > How does the kernel knows that an user page table translates guest VA?
    > IMHO I don't think the kernel should care about it except managing
    > all the aspects related to the user page table itself...

    Okay.

    >
    >>
    >>>
    >>>> +
    >>>> /*
    >>>> * This are the possible domain-types
    >>>> *
    >>>> @@ -86,15 +89,24 @@ struct iommu_domain_geometry {
    >>>> #define IOMMU_DOMAIN_DMA_FQ
    >> (__IOMMU_DOMAIN_PAGING | \
    >>>> __IOMMU_DOMAIN_DMA_API | \
    >>>> __IOMMU_DOMAIN_DMA_FQ)
    >>>> +#define IOMMU_DOMAIN_SVA (__IOMMU_DOMAIN_SHARED |
    >> \
    >>>> + __IOMMU_DOMAIN_HOST_VA)
    >>>
    >>> Doesn't shared automatically mean CPU VA? Do we need another flag?
    >>
    >> Yes. Shared means CPU VA, but there're many types. Besides above two, we
    >> also see the shared KVM/EPT.
    >>
    >
    > Will the two sharing scenarios share any common code? If not then
    > having a separate flag bit is meaningless.

    So far, I haven't seen the need for common code. I've ever thought about
    the common notifier callback for page table entry update of SVA and KVM.
    But there has been no feasible plan.

    >
    > It might be more straightforward to be:
    >
    > #define IOMMU_DOMAIN_SVA __IOMMU_DOMAIN_SVA
    > #define IOMMU_DOMAIN_KVM __IOMMU_DOMAIN_KVM
    > #define IOMMU_DOMAIN_USER __IOMMU_DOMAIN_USER

    I am okay with this and we can add some shared bits later if we need to
    consolidate any code.

    --
    Best regards,
    baolu

    \
     
     \ /
      Last update: 2022-06-20 02:37    [W:2.813 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site