mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: "Tian, Kevin" <kevin.tian@intel.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	Christoph Hellwig <hch@infradead.org>,
	"Raj, Ashok" <ashok.raj@intel.com>, Will Deacon <will@kernel.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Eric Auger <eric.auger@redhat.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA
Date: Wed, 6 Apr 2022 13:32:07 +0100	[thread overview]
Message-ID: <d0f6caea-0cd9-d839-c9fb-0fe49c2bad16@arm.com> (raw)
In-Reply-To: <BN9PR11MB52764E3DE16E19D1F1515D008CE79@BN9PR11MB5276.namprd11.prod.outlook.com>

On 2022-04-06 06:58, Tian, Kevin wrote:
>> From: Jason Gunthorpe <jgg@nvidia.com>
>> Sent: Wednesday, April 6, 2022 9:24 AM
>>
>> On Wed, Apr 06, 2022 at 01:00:13AM +0000, Tian, Kevin wrote:
>>
>>>> Because domains wrap more than just the IOPTE format, they have
>>>> additional data related to the IOMMU HW block itself. Imagine a SOC
>>>> with two IOMMU HW blocks that can both process the CPU IOPTE format,
>>>> but have different configuration.
>>>
>>> Curious. Is it hypothesis or real? If real can you help give a concrete
>>> example?
>>
>> Look at arm_smmu_attach_dev() - the domain has exactly one smmu
>> pointer which contains the base address for the SMMU IP block. If the
>> domain doesn't match the smmu pointer from the struct device it won't
>> allow attaching.
>>
>> I know of ARM SOCs with many copies of the SMMU IP block.
>>
>> So at least with current drivers ARM seems to have this limitation.
>>
> 
> I saw that code, but before this series it is used only for stage-2 instead
> of SVA. and I didn't see similar check in the old sva related paths (though
> it doesn't use domain):
> 
> arm_smmu_master_sva_enable_iopf()
> arm_smmu_master_enable_sva{}
> __arm_smmu_sva_bind()
> 
> If I didn't overlook some trick hiding in the call chain of those functions,
> is there a bug in the existing SMMU sva logic or is it conceptually correct
> to not have such check for SVA?

The current SVA APIs are all device-based, so implicitly reflect 
whichever SMMU instance serves the given device. Once domains come into 
the picture, callers are going to have to be more aware that a domain 
may be specific to a particular IOMMU instance, and potentially allocate 
separate domains for separate devices to represent the same address 
space, much like vfio_iommu_type1_attach_group() does.

It's not really worth IOMMU drivers trying to support a domain spanning 
potentially-heterogeneous instances internally, since they can't 
reasonably know what matters in any particular situation. That's 
primarily why we've never tried to do it in the SMMU drivers. It's a lot 
easier for relevant callers to look at what they get and figure out 
whether any mismatch in capabilities is tolerable or not.

Robin.

> If the former then yes we have to take SMMU IP block into consideration
> thus could have multiple domains per CPU page table. If the latter then
> this is not a valid example for that configuration.
> 
> Which one is correct?
> 
> Thanks
> Kevin

  reply	other threads:[~2022-04-06 15:21 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  5:37 [PATCH RFC v2 00/11] iommu: SVA and IOPF refactoring Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 01/11] iommu: Add pasid_bits field in struct dev_iommu Lu Baolu
2022-03-29 21:00   ` Jacob Pan
2022-03-30  4:30     ` Lu Baolu
2022-03-30  7:05   ` Tian, Kevin
2022-03-30 11:58     ` Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 02/11] iommu: Add iommu_group_singleton_lockdown() Lu Baolu
2022-03-29  8:42   ` Tian, Kevin
2022-03-29 11:42     ` Jason Gunthorpe
2022-03-30  6:50       ` Tian, Kevin
2022-03-30 11:57         ` Lu Baolu
2022-03-30 11:58         ` Jason Gunthorpe
2022-03-30 14:12           ` Tian, Kevin
2022-03-30 14:30             ` Jason Gunthorpe
2022-04-02  7:12               ` Tian, Kevin
2022-04-02 23:29                 ` Jason Gunthorpe
2022-04-06 10:02                 ` Lu Baolu
2022-04-06 10:44                   ` Tian, Kevin
2022-04-06 11:03                     ` Lu Baolu
2022-04-06 23:56                       ` Tian, Kevin
2022-03-30 14:18           ` Tian, Kevin
2022-03-30 15:04             ` Alex Williamson
2022-04-04  5:43           ` Lu Baolu
2022-04-04 17:24             ` Jason Gunthorpe
2022-04-05  6:12               ` Lu Baolu
2022-04-05 14:10                 ` Jason Gunthorpe
2022-04-06  9:51                   ` Lu Baolu
2022-04-01  6:20       ` Yi Liu
2022-04-01 11:52         ` Jason Gunthorpe
2022-03-30  4:59     ` Lu Baolu
2022-03-30  6:55       ` Tian, Kevin
2022-04-01  5:49     ` Yi Liu
2022-03-29  5:37 ` [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA Lu Baolu
2022-03-29 21:38   ` Jacob Pan
2022-03-30  4:35     ` Lu Baolu
2022-03-30 19:02   ` Jason Gunthorpe
2022-04-02  8:43     ` Tian, Kevin
2022-04-02 23:32       ` Jason Gunthorpe
2022-04-04  6:09         ` Lu Baolu
2022-04-06  1:00         ` Tian, Kevin
2022-04-06  1:23           ` Jason Gunthorpe
2022-04-06  5:58             ` Tian, Kevin
2022-04-06 12:32               ` Robin Murphy [this message]
2022-04-06 13:06                 ` Jason Gunthorpe
2022-04-06 13:37                   ` Robin Murphy
2022-04-06 14:01                     ` Jason Gunthorpe
2022-04-07  0:11                 ` Tian, Kevin
2022-03-29  5:37 ` [PATCH RFC v2 04/11] iommu: Add attach/detach_dev_pasid domain ops Lu Baolu
2022-03-30 19:08   ` Jason Gunthorpe
2022-04-04  6:47     ` Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 05/11] iommu/vt-d: Remove SVM_FLAG_SUPERVISOR_MODE suport Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 06/11] iommu/vt-d: Add SVA domain support Lu Baolu
2022-03-30 19:09   ` Jason Gunthorpe
2022-04-04  6:52     ` Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 07/11] arm-smmu-v3/sva: " Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 08/11] iommu/sva: Use attach/detach_pasid_dev in SVA interfaces Lu Baolu
2022-03-31 20:59   ` Jacob Pan
2022-03-31 22:26     ` Jason Gunthorpe
2022-04-04  5:55       ` Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 09/11] iommu: Remove SVA related callbacks from iommu ops Lu Baolu
2022-03-29  5:37 ` [PATCH RFC v2 10/11] iommu: Per-domain I/O page fault handling Lu Baolu
2022-03-29  5:38 ` [PATCH RFC v2 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=d0f6caea-0cd9-d839-c9fb-0fe49c2bad16@arm.com \
    --to=robin.murphy@arm.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.com \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    /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

all inboxes | Powered by JetHome®