public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>, "Raj, Ashok" <ashok.raj@intel.com>
Cc: baolu.lu@linux.intel.com,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	Robin Murphy <robin.murphy@arm.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Vinod Koul <vkoul@kernel.org>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH v8 04/11] iommu: Add sva iommu_domain support
Date: Mon, 20 Jun 2022 08:34:50 +0800	[thread overview]
Message-ID: <8dacfbe6-3f00-c61e-49e1-712c369a2285@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB52765DEC46616F67185B1F1F8CAF9@BN9PR11MB5276.namprd11.prod.outlook.com>

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

  reply	other threads:[~2022-06-20  0:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  1:49 [PATCH v8 00/11] iommu: SVA and IOPF refactoring Lu Baolu
2022-06-07  1:49 ` [PATCH v8 01/11] iommu: Add max_pasids field in struct iommu_device Lu Baolu
2022-06-09 17:25   ` Raj, Ashok
2022-06-09 23:53     ` Jason Gunthorpe
2022-06-10  8:45       ` Tian, Kevin
2022-06-10  6:33     ` Baolu Lu
2022-06-07  1:49 ` [PATCH v8 02/11] iommu: Add max_pasids field in struct dev_iommu Lu Baolu
2022-06-09 19:01   ` Raj, Ashok
2022-06-10  6:46     ` Baolu Lu
2022-06-10  9:01       ` Tian, Kevin
2022-06-10  9:07         ` Baolu Lu
2022-06-07  1:49 ` [PATCH v8 03/11] iommu: Remove SVM_FLAG_SUPERVISOR_MODE support Lu Baolu
2022-06-07  1:49 ` [PATCH v8 04/11] iommu: Add sva iommu_domain support Lu Baolu
2022-06-09 20:25   ` Raj, Ashok
2022-06-10  7:16     ` Baolu Lu
2022-06-17  7:43       ` Tian, Kevin
2022-06-20  0:34         ` Baolu Lu [this message]
2022-06-07  1:49 ` [PATCH v8 05/11] iommu/vt-d: Add SVA domain support Lu Baolu
2022-06-17  7:47   ` Tian, Kevin
2022-06-20  0:35     ` Baolu Lu
2022-06-07  1:49 ` [PATCH v8 06/11] arm-smmu-v3/sva: " Lu Baolu
2022-06-07  1:49 ` [PATCH v8 07/11] iommu/sva: Refactoring iommu_sva_bind/unbind_device() Lu Baolu
2022-06-07  1:49 ` [PATCH v8 08/11] iommu: Remove SVA related callbacks from iommu ops Lu Baolu
2022-06-07  1:49 ` [PATCH v8 09/11] iommu: Prepare IOMMU domain for IOPF Lu Baolu
2022-06-07  1:49 ` [PATCH v8 10/11] iommu: Per-domain I/O page fault handling Lu Baolu
2022-06-07  1:49 ` [PATCH v8 11/11] iommu: Rename iommu-sva-lib.{c,h} Lu Baolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8dacfbe6-3f00-c61e-49e1-712c369a2285@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.com \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox