* [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported
@ 2025-09-15 6:29 Lu Baolu
2025-09-15 11:30 ` Joel Granados
2025-09-18 4:35 ` Baolu Lu
0 siblings, 2 replies; 5+ messages in thread
From: Lu Baolu @ 2025-09-15 6:29 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe, Joel Granados
Cc: iommu, linux-kernel, Lu Baolu, stable
The specification, Section 7.10, "Software Steps to Drain Page Requests &
Responses," requires software to submit an Invalidation Wait Descriptor
(inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with
the Invalidation Wait Completion Status Write flag (SW=1). It then waits
for the Invalidation Wait Descriptor's completion.
However, the PD field in the Invalidation Wait Descriptor is optional, as
stated in Section 6.5.2.9, "Invalidation Wait Descriptor":
"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this
field as reserved."
This implies that if the IOMMU doesn't support the PDS capability, software
can't drain page requests and group responses as expected.
Do not enable PCI/PRI if the IOMMU doesn't support PDS.
Reported-by: Joel Granados <joel.granados@kernel.org>
Closes: https://lore.kernel.org/r/20250909-jag-pds-v1-1-ad8cba0e494e@kernel.org
Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
Cc: stable@vger.kernel.org
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 9c3ab9d9f69a..92759a8f8330 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
}
if (info->ats_supported && ecap_prs(iommu->ecap) &&
- pci_pri_supported(pdev))
+ ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
info->pri_supported = 1;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported
2025-09-15 6:29 [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported Lu Baolu
@ 2025-09-15 11:30 ` Joel Granados
2025-09-16 1:58 ` Baolu Lu
2025-09-18 4:35 ` Baolu Lu
1 sibling, 1 reply; 5+ messages in thread
From: Joel Granados @ 2025-09-15 11:30 UTC (permalink / raw)
To: Lu Baolu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe, iommu, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]
On Mon, Sep 15, 2025 at 02:29:46PM +0800, Lu Baolu wrote:
> The specification, Section 7.10, "Software Steps to Drain Page Requests &
> Responses," requires software to submit an Invalidation Wait Descriptor
> (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with
> the Invalidation Wait Completion Status Write flag (SW=1). It then waits
> for the Invalidation Wait Descriptor's completion.
>
> However, the PD field in the Invalidation Wait Descriptor is optional, as
> stated in Section 6.5.2.9, "Invalidation Wait Descriptor":
>
> "Page-request Drain (PD): Remapping hardware implementations reporting
> Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this
> field as reserved."
>
> This implies that if the IOMMU doesn't support the PDS capability, software
> can't drain page requests and group responses as expected.
>
> Do not enable PCI/PRI if the IOMMU doesn't support PDS.
After giving the spec another look, this is probably the way to go.
However the PDS also mentions that DT must be set. Should we check
ecap_dev_iotlb_support(iommu->ecap) as well?
>
> Reported-by: Joel Granados <joel.granados@kernel.org>
> Closes: https://lore.kernel.org/r/20250909-jag-pds-v1-1-ad8cba0e494e@kernel.org
> Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 9c3ab9d9f69a..92759a8f8330 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
> }
>
> if (info->ats_supported && ecap_prs(iommu->ecap) &&
> - pci_pri_supported(pdev))
> + ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
Should this be
+ ecap_dev_iotlb_support(iommu->ecap) && ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
???
best
--
Joel Granados
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported
2025-09-15 11:30 ` Joel Granados
@ 2025-09-16 1:58 ` Baolu Lu
2025-09-19 7:13 ` Joel Granados
0 siblings, 1 reply; 5+ messages in thread
From: Baolu Lu @ 2025-09-16 1:58 UTC (permalink / raw)
To: Joel Granados
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe, iommu, linux-kernel, stable
On 9/15/25 19:30, Joel Granados wrote:
> On Mon, Sep 15, 2025 at 02:29:46PM +0800, Lu Baolu wrote:
>> The specification, Section 7.10, "Software Steps to Drain Page Requests &
>> Responses," requires software to submit an Invalidation Wait Descriptor
>> (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with
>> the Invalidation Wait Completion Status Write flag (SW=1). It then waits
>> for the Invalidation Wait Descriptor's completion.
>>
>> However, the PD field in the Invalidation Wait Descriptor is optional, as
>> stated in Section 6.5.2.9, "Invalidation Wait Descriptor":
>>
>> "Page-request Drain (PD): Remapping hardware implementations reporting
>> Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this
>> field as reserved."
>>
>> This implies that if the IOMMU doesn't support the PDS capability, software
>> can't drain page requests and group responses as expected.
>>
>> Do not enable PCI/PRI if the IOMMU doesn't support PDS.
>
> After giving the spec another look, this is probably the way to go.
> However the PDS also mentions that DT must be set. Should we check
> ecap_dev_iotlb_support(iommu->ecap) as well?
It has already been checked.
>>
>> Reported-by: Joel Granados <joel.granados@kernel.org>
>> Closes: https://lore.kernel.org/r/20250909-jag-pds-v1-1-ad8cba0e494e@kernel.org
>> Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>> drivers/iommu/intel/iommu.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index 9c3ab9d9f69a..92759a8f8330 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
>> }
>>
>> if (info->ats_supported && ecap_prs(iommu->ecap) &&
>> - pci_pri_supported(pdev))
>> + ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
> Should this be
> + ecap_dev_iotlb_support(iommu->ecap) && ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
>
> ???
ecap_dev_iotlb_support() has already been checked as it's part of the
info->ats_supported check. The dependency chain is:
ecap_dev_iotlb_support() -> ats_support -> pri_support.
Thanks,
baolu
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported
2025-09-16 1:58 ` Baolu Lu
@ 2025-09-19 7:13 ` Joel Granados
0 siblings, 0 replies; 5+ messages in thread
From: Joel Granados @ 2025-09-19 7:13 UTC (permalink / raw)
To: Baolu Lu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe, iommu, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]
On Tue, Sep 16, 2025 at 09:58:14AM +0800, Baolu Lu wrote:
> On 9/15/25 19:30, Joel Granados wrote:
> > On Mon, Sep 15, 2025 at 02:29:46PM +0800, Lu Baolu wrote:
> > > The specification, Section 7.10, "Software Steps to Drain Page Requests &
> > > Responses," requires software to submit an Invalidation Wait Descriptor
> > > (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with
> > > the Invalidation Wait Completion Status Write flag (SW=1). It then waits
> > > for the Invalidation Wait Descriptor's completion.
> > >
> > > However, the PD field in the Invalidation Wait Descriptor is optional, as
> > > stated in Section 6.5.2.9, "Invalidation Wait Descriptor":
> > >
> > > "Page-request Drain (PD): Remapping hardware implementations reporting
> > > Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this
> > > field as reserved."
> > >
> > > This implies that if the IOMMU doesn't support the PDS capability, software
> > > can't drain page requests and group responses as expected.
> > >
> > > Do not enable PCI/PRI if the IOMMU doesn't support PDS.
> >
> > After giving the spec another look, this is probably the way to go.
> > However the PDS also mentions that DT must be set. Should we check
> > ecap_dev_iotlb_support(iommu->ecap) as well?
>
> It has already been checked.
Yes. In intel_iommu_probe_device. Thx for the clarification.
Best
--
Joel Granados
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported
2025-09-15 6:29 [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported Lu Baolu
2025-09-15 11:30 ` Joel Granados
@ 2025-09-18 4:35 ` Baolu Lu
1 sibling, 0 replies; 5+ messages in thread
From: Baolu Lu @ 2025-09-18 4:35 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
Jason Gunthorpe, Joel Granados
Cc: iommu, linux-kernel, stable
On 9/15/25 14:29, Lu Baolu wrote:
> The specification, Section 7.10, "Software Steps to Drain Page Requests &
> Responses," requires software to submit an Invalidation Wait Descriptor
> (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with
> the Invalidation Wait Completion Status Write flag (SW=1). It then waits
> for the Invalidation Wait Descriptor's completion.
>
> However, the PD field in the Invalidation Wait Descriptor is optional, as
> stated in Section 6.5.2.9, "Invalidation Wait Descriptor":
>
> "Page-request Drain (PD): Remapping hardware implementations reporting
> Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this
> field as reserved."
>
> This implies that if the IOMMU doesn't support the PDS capability, software
> can't drain page requests and group responses as expected.
>
> Do not enable PCI/PRI if the IOMMU doesn't support PDS.
>
> Reported-by: Joel Granados<joel.granados@kernel.org>
> Closes:https://lore.kernel.org/r/20250909-jag-pds-v1-1-ad8cba0e494e@kernel.org
> Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
> Cc:stable@vger.kernel.org
> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Queued for v6.18.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-19 7:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15 6:29 [PATCH 1/1] iommu/vt-d: PRS isn't usable if PDS isn't supported Lu Baolu
2025-09-15 11:30 ` Joel Granados
2025-09-16 1:58 ` Baolu Lu
2025-09-19 7:13 ` Joel Granados
2025-09-18 4:35 ` Baolu Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox