From: Yi Liu <yi.l.liu@intel.com>
To: Robin Murphy <robin.murphy@arm.com>,
Baolu Lu <baolu.lu@linux.intel.com>, <joro@8bytes.org>,
<jgg@nvidia.com>, <kevin.tian@intel.com>
Cc: <eric.auger@redhat.com>, <nicolinc@nvidia.com>,
<chao.p.peng@linux.intel.com>, <iommu@lists.linux.dev>,
<vasant.hegde@amd.com>, <will@kernel.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v6 09/14] iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support
Date: Thu, 13 Feb 2025 18:10:04 +0800 [thread overview]
Message-ID: <deb77d13-5722-49fe-a5a7-8ba6bc370763@intel.com> (raw)
In-Reply-To: <95ab1ac7-f0a8-4b9d-b88e-72ce0d72ca98@arm.com>
On 2025/2/12 21:00, Robin Murphy wrote:
> On 2025-02-12 7:47 am, Yi Liu wrote:
>> On 2024/12/25 15:13, Baolu Lu wrote:
>>> On 2024/12/25 12:30, Yi Liu wrote:
>>>> On 2024/12/25 09:02, Baolu Lu wrote:
>>>>> On 12/24/24 19:35, Yi Liu wrote:
>>>>>>> Another related consideration is the support for page faults in nested
>>>>>>> domains once PASID is available in user space. Would it be
>>>>>>> reasonable to
>>>>>>> support page faults for nested domains?
>>>>>>
>>>>>> yeah, it's good to discuss it.
>>>>>>
>>>>>>> If so, perhaps it's time to open intel_iommu_domain_alloc_nested() to
>>>>>>> support IOMMU_HWPT_FAULT_ID_VALID when PRI is enabled on the device?
>>>>>>
>>>>>> IMHO, the PRQ support for nested domains requires some more facility.
>>>>>> PRQ
>>>>>> can happen at either stage-1 or stage-2, iommu driver may need to tell
>>>>>> it and forward to the correct domain (nested domain or parent
>>>>>> domain). Or
>>>>>> the stage-2 is always pinned just as the VFIO/iommufd does. Hence,
>>>>>> any PRQ
>>>>>> happens under nested translation should be due to stage-1.
>>>>>
>>>>> The parent domain is currently always pinned and does not yet support
>>>>> page faults. Therefore, when a page fault occurs within a nested domain,
>>>>> it apparently should be routed to user space...
>>>>>
>>>>> If we decide to support page faults on the stage-2 domain in the future,
>>>>> we will need to figure out the correct destination of each page fault
>>>>> and route it accordingly, either to the parent domain or the user space
>>>>> nested domain. Hardware assistance would be beneficial, otherwise the
>>>>> software may need to traverse the parent domain, which is not
>>>>> performance friendly.
>>>>
>>>> this is my question. Is it still true the parent domain is always pinned
>>>> after the below series? If yes, then it's fine to enable IOPF for nested
>>>> domain.
>>>>
>>>> https://lore.kernel.org/linux-iommu/20241015-jag-iopfv8-v4-0-
>>>> b696ca89ba29@kernel.org/
>>>
>>> Then, perhaps we could enforce this in iommufd for a short-term purpose?
>>>
>>> When allocating a hwpt in iommufd, we should enforce that the flags
>>> IOMMU_HWPT_ALLOC_NEST_PARENT and IOMMU_HWPT_FAULT_ID_VALID cannot be set
>>> at the same time.
>>
>> Let's consult with other vendors. We need this enforcement because we lack
>> a straightforward method to distinguish between PRIs in stage-1 and stage-2
>> under nested translation. If other vendors share this requirement, it would
>> be appropriate to implement this enforcement in IOMMUFD. Otherwise, we may
>> check it in intel iommu driver.
>>
>> @arm and amd folks. :)
>
> Yup, SMMUv3 is more or less in the same boat - we *could* reasonably manage
> unpinned S2 for non-PCI devices using the stall model where the
> F_TRANSLATION or F_PERMISSION event tells us all we need, but for ATS it's
> the same thing where by the time the fault has taken a round-trip through
> an ATS response and a PRI request, we've lost the details of exactly how it
> faulted (or if the PRI request was sent eagerly without a prior translation
> request, then we simply have no idea at all). Thus the prospective
> mechanism would be to inject a virtual PRI, wait until we see the guest
> issue a matching CMD_PRI_RESP, then sniff the IPA/GPA for the given input
> address out of the guest pagetables to see if there's anything to do at S2
> as well/instead. Yuck.
Thanks for the response, Robin. It seems we're in the same situation. :(
Out of curiosity, will the vPRI response provide the IPA/GPA to the
hypervisor? If not, the hypervisor will need to derive it from the GVA on
its own, possibly requiring software to traverse the guest page table.
--
Regards,
Yi Liu
next prev parent reply other threads:[~2025-02-13 10:05 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 13:27 [PATCH v6 00/14] iommufd support pasid attach/replace Yi Liu
2024-12-19 13:27 ` [PATCH v6 01/14] iommu: Introduce a replace API for device pasid Yi Liu
2024-12-20 2:47 ` Baolu Lu
2025-01-09 7:08 ` Tian, Kevin
2025-01-09 7:20 ` Tian, Kevin
2025-01-09 14:43 ` Jason Gunthorpe
2025-01-10 2:31 ` Baolu Lu
2025-01-10 7:21 ` Tian, Kevin
2025-01-16 10:00 ` Yi Liu
2025-01-13 20:21 ` Jason Gunthorpe
2025-01-14 8:10 ` Tian, Kevin
2025-01-14 13:45 ` Jason Gunthorpe
2025-01-15 4:43 ` Tian, Kevin
2025-01-15 14:43 ` Jason Gunthorpe
2025-01-16 5:48 ` Tian, Kevin
2025-01-17 10:32 ` Yi Liu
2024-12-19 13:27 ` [PATCH v6 02/14] iommufd: Refactor __fault_domain_replace_dev() to be a wrapper of iommu_replace_group_handle() Yi Liu
2024-12-19 13:27 ` [PATCH v6 03/14] iommufd: Move the iommufd_handle helpers to device.c Yi Liu
2024-12-20 3:31 ` Baolu Lu
2024-12-20 6:34 ` Yi Liu
2024-12-19 13:27 ` [PATCH v6 04/14] iommufd: Always pass iommu_attach_handle to iommu core Yi Liu
2024-12-20 4:35 ` Nicolin Chen
2024-12-20 6:40 ` Yi Liu
2024-12-20 6:58 ` Nicolin Chen
2025-01-09 7:44 ` Tian, Kevin
2025-01-17 12:33 ` Yi Liu
2025-01-17 19:03 ` Nicolin Chen
2024-12-19 13:27 ` [PATCH v6 05/14] iommufd: Pass pasid through the device attach/replace path Yi Liu
2025-01-09 7:53 ` Tian, Kevin
2025-01-09 14:51 ` Jason Gunthorpe
2025-01-10 7:22 ` Tian, Kevin
2024-12-19 13:27 ` [PATCH v6 06/14] iommufd: Mark PASID-compatible domain Yi Liu
2025-01-09 7:56 ` Tian, Kevin
2025-01-09 14:54 ` Jason Gunthorpe
2025-01-17 10:50 ` Yi Liu
2024-12-19 13:27 ` [PATCH v6 07/14] iommufd: Support pasid attach/replace Yi Liu
2025-01-09 8:25 ` Tian, Kevin
2024-12-19 13:27 ` [PATCH v6 08/14] iommufd: Enforce PASID-compatible domain for RID Yi Liu
2025-01-09 8:31 ` Tian, Kevin
2024-12-19 13:27 ` [PATCH v6 09/14] iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support Yi Liu
2024-12-23 2:51 ` Baolu Lu
2024-12-24 11:35 ` Yi Liu
2024-12-25 1:02 ` Baolu Lu
2024-12-25 4:30 ` Yi Liu
2024-12-25 7:13 ` Baolu Lu
2025-02-12 7:47 ` Yi Liu
2025-02-12 12:59 ` Jason Gunthorpe
2025-02-13 9:34 ` Yi Liu
2025-02-13 12:56 ` Jason Gunthorpe
2025-02-14 3:24 ` Yi Liu
2025-02-12 13:00 ` Robin Murphy
2025-02-12 13:08 ` Jason Gunthorpe
2025-02-13 10:10 ` Yi Liu [this message]
2025-02-13 10:24 ` Robin Murphy
2025-02-13 12:53 ` Yi Liu
2025-02-19 8:02 ` Tian, Kevin
2025-02-19 12:50 ` Yi Liu
2025-02-20 6:57 ` Tian, Kevin
2025-01-09 15:27 ` Jason Gunthorpe
2025-01-10 2:41 ` Baolu Lu
2025-01-10 7:34 ` Tian, Kevin
2025-01-17 10:57 ` Yi Liu
2025-01-10 7:38 ` Tian, Kevin
2025-01-14 8:13 ` Tian, Kevin
2025-01-13 20:31 ` Jason Gunthorpe
2025-01-14 8:19 ` Tian, Kevin
2024-12-19 13:27 ` [PATCH v6 10/14] iommufd: Allow allocating PASID-compatible domain Yi Liu
2024-12-19 13:27 ` [PATCH v6 11/14] iommufd/selftest: Add set_dev_pasid in mock iommu Yi Liu
2024-12-19 13:27 ` [PATCH v6 12/14] iommufd/selftest: Add a helper to get test device Yi Liu
2024-12-19 13:27 ` [PATCH v6 13/14] iommufd/selftest: Add test ops to test pasid attach/detach Yi Liu
2024-12-19 13:27 ` [PATCH v6 14/14] iommufd/selftest: Add coverage for iommufd " Yi Liu
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=deb77d13-5722-49fe-a5a7-8ba6bc370763@intel.com \
--to=yi.l.liu@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=chao.p.peng@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
--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