From: Vasant Hegde <vasant.hegde@amd.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Baolu Lu <baolu.lu@linux.intel.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>, Yi Liu <yi.l.liu@intel.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] iommu/vt-d: Move PCI PASID enablement to probe path
Date: Mon, 26 Aug 2024 14:41:18 +0530 [thread overview]
Message-ID: <0f80d53f-ea8b-4f16-acf8-aa1c99966dfa@amd.com> (raw)
In-Reply-To: <20240820135153.GW3468552@ziepe.ca>
Jason,
On 8/20/2024 7:21 PM, Jason Gunthorpe wrote:
> On Tue, Aug 20, 2024 at 02:00:08PM +0530, Vasant Hegde wrote:
>
>>> Some architectures, including VT-d non-scalable mode, doesn't support
>>> ATS translation and translated requests when it is working in the
>>> IDENTITY domain mode.
>
> ARM has a similar issue.
>
> ATS enablement should be done when the domain is attached in those
> cases.
>
> Arguably you don't want to turn ATS on anyhow for pure IDENTITY with
> no PASID because it is just pointless.
>
>> In that case, probably PCI ATS still need to be
>>> disabled when such domain is attached and re-enabled when the domain is
>>> detached.
>>
>> Does it make sense to move both PASID/PRI enablement to probe() path? something
>> like below :
>
> It makes sense.
>
> I don't see any ordering restriction in the PCI specification.
>
> Notice that PASID does have a specific called out restriction:
>
> /*
> * Note that PASID must be enabled before, and disabled after ATS:
> * PCI Express Base 4.0r1.0 - 10.5.1.3 ATS Control Register
> *
> * Behavior is undefined if this bit is Set and the value of the PASID
> * Enable, Execute Requested Enable, or Privileged Mode Requested bits
> * are changed.
> */
>
>> [I am assuming ops->dev_enable_feat() interface is going away]
>
> Is the plan
>
>> - Enable device side PASID/PRI during ops->probe_device()
>
> Yes
>
>> - In device attach path (ops->attach_dev()), depending on IOMMU, device and
>> domain capability configure the features like PASID, IOPF and ATS. That means
>> ATS enablement is still done at attach device path.
>
> From a PCI perspective only ATS can be changed at this point..
>
> The SW construct of IOPF can be changed during domain attachment.
>
> Everything that is PF-only must be setup during probe_device only
> otherwise SRIOV VFs will be broken insome cases.
Makes sense. I will modify AMD driver to enable PRI/PASID in probe() path.
>
> See
> https://lore.kernel.org/all/0-v1-0fb4d2ab6770+7e706-ats_vf_jgg@nvidia.com/
> for this concept applied to ATS.
>
> This means probe_device() has to do:
>
> - ATS properties
> - PRI
> - PASID properties
>
> At a minimum.
>
> It would be nice if the iommu core code did this setup in one place
> immediately after calling probe_device() but before attaching a
> domain.
>
> There is no particularly good reason to have this coded in all the
> iommu drivers.
Yeah. that makes sense. We may have to adjust few things in driver (at least AMD
driver). But its doable.
-Vasant
next prev parent reply other threads:[~2024-08-26 9:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 10:49 Lu Baolu
2024-08-16 12:16 ` Vasant Hegde
2024-08-16 13:09 ` Baolu Lu
2024-08-16 13:31 ` Jason Gunthorpe
2024-08-19 6:34 ` Vasant Hegde
2024-08-19 7:09 ` Baolu Lu
2024-08-19 7:11 ` Baolu Lu
2024-08-19 12:34 ` Jason Gunthorpe
2024-08-20 4:10 ` Baolu Lu
2024-08-20 8:30 ` Vasant Hegde
2024-08-20 8:55 ` Yi Liu
2024-08-20 13:52 ` Jason Gunthorpe
2024-08-20 13:51 ` Jason Gunthorpe
2024-08-26 9:11 ` Vasant Hegde [this message]
2024-08-19 7:32 ` Yi Liu
2024-08-19 3:14 ` Yi Liu
2024-08-19 3:34 ` Baolu Lu
2024-08-19 4:51 ` Yi Liu
2024-08-19 5:15 ` Baolu Lu
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=0f80d53f-ea8b-4f16-acf8-aa1c99966dfa@amd.com \
--to=vasant.hegde@amd.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--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®