* [PATCH v1] PCI: Add support for ACS Enhanced Capability
@ 2026-01-19 18:11 Wei Wang
2026-01-20 16:41 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Wei Wang @ 2026-01-19 18:11 UTC (permalink / raw)
To: bhelgaas, akpm, bp, rdunlap, alex, jgg, kevin.tian
Cc: linux-kernel, linux-pci, wei.w.wang
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 4558 bytes --]
Add support for the ACS (Access Control Services) Enhanced Capability,
introduced with PCIe Gen 5. These new configuration options can be
controlled via the config_acs= boot parameter.
By default, the ACS Unclaimed Request Redirect Control (URRC) bit is
enabled if supported by the hardware (i.e., if the ACS Enhanced Capability
is present). This setting is particularly important for device passthrough
in virtualization scenarios.
Without URRC, a DMA transaction from a device may target a guest physical
address that lies within the memory aperture of the switch's upstream
port, but not within any memory aperture or BAR space of a downstream
port. In such cases, the switch would generate an Unsupported Request (UR)
response to the device, which is undesirable. Enabling URRC ensures that
these DMA requests are forwarded upstream instead of being rejected.
Signed-off-by: Wei Wang <wei.w.wang@hotmail.com>
---
.../admin-guide/kernel-parameters.txt | 23 +++++++++++++------
drivers/pci/pci.c | 7 +++++-
include/uapi/linux/pci_regs.h | 5 ++++
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 31844c70f8bb..c6156a50b249 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5249,13 +5249,22 @@ Kernel parameters
flags.
ACS Flags is defined as follows:
- bit-0 : ACS Source Validation
- bit-1 : ACS Translation Blocking
- bit-2 : ACS P2P Request Redirect
- bit-3 : ACS P2P Completion Redirect
- bit-4 : ACS Upstream Forwarding
- bit-5 : ACS P2P Egress Control
- bit-6 : ACS Direct Translated P2P
+ bit-0 : ACS Source Validation
+ bit-1 : ACS Translation Blocking
+ bit-2 : ACS P2P Request Redirect
+ bit-3 : ACS P2P Completion Redirect
+ bit-4 : ACS Upstream Forwarding
+ bit-5 : ACS P2P Egress Control
+ bit-6 : ACS Direct Translated P2P
+ bit-7 : ACS I/O Request Blocking
+ bit-9:8 : ACS DSP Memory Target Access Ctrl
+ 00 : Direct Request access enabled
+ 01 : Request blocking enabled
+ 10 : Request redirect enabled
+ 11 : Reserved
+ bit-11:10 : ACS USP Memory Target Access Ctrl
+ Same encoding as bit-9:8
+ bit-12 : ACS Unclaimed Request Redirect Ctrl
Each bit can be marked as:
'0' – force disabled
'1' – force enabled
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 382ce8992387..3744d681bcb2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -948,7 +948,8 @@ static void __pci_config_acs(struct pci_dev *dev, struct pci_acs *caps,
}
if (mask & ~(PCI_ACS_SV | PCI_ACS_TB | PCI_ACS_RR | PCI_ACS_CR |
- PCI_ACS_UF | PCI_ACS_EC | PCI_ACS_DT)) {
+ PCI_ACS_UF | PCI_ACS_EC | PCI_ACS_DT | PCI_ACS_IB |
+ PCI_ACS_DMAC | PCI_ACS_UMAC | PCI_ACS_URRC)) {
pci_err(dev, "Invalid ACS flags specified\n");
return;
}
@@ -1008,6 +1009,10 @@ static void pci_std_enable_acs(struct pci_dev *dev, struct pci_acs *caps)
/* Upstream Forwarding */
caps->ctrl |= (caps->cap & PCI_ACS_UF);
+ /* Unclaimed Request Redirect Control */
+ if (caps->cap & PCI_ACS_ECAP)
+ caps->ctrl |= PCI_ACS_URRC;
+
/* Enable Translation Blocking for external devices and noats */
if (pci_ats_disabled() || dev->external_facing || dev->untrusted)
caps->ctrl |= (caps->cap & PCI_ACS_TB);
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 3add74ae2594..9cbde1ebd14a 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -1018,6 +1018,11 @@
#define PCI_ACS_UF 0x0010 /* Upstream Forwarding */
#define PCI_ACS_EC 0x0020 /* P2P Egress Control */
#define PCI_ACS_DT 0x0040 /* Direct Translated P2P */
+#define PCI_ACS_ECAP 0x0080 /* ACS Ehanced Capability */
+#define PCI_ACS_IB 0x0080 /* I/O Request Blocking */
+#define PCI_ACS_DMAC 0x0300 /* DSP Memory Target Access Control */
+#define PCI_ACS_UMAC 0x0c00 /* USP Memory Target Access Control */
+#define PCI_ACS_URRC 0x1000 /* Unclaimed Request Redirect Ctrl */
#define PCI_ACS_EGRESS_BITS 0x05 /* ACS Egress Control Vector Size */
#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] PCI: Add support for ACS Enhanced Capability
2026-01-19 18:11 [PATCH v1] PCI: Add support for ACS Enhanced Capability Wei Wang
@ 2026-01-20 16:41 ` Jason Gunthorpe
2026-01-21 9:18 ` Wei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2026-01-20 16:41 UTC (permalink / raw)
To: Wei Wang
Cc: bhelgaas, akpm, bp, rdunlap, alex, kevin.tian, linux-kernel,
linux-pci
On Tue, Jan 20, 2026 at 02:11:30AM +0800, Wei Wang wrote:
> Add support for the ACS (Access Control Services) Enhanced Capability,
> introduced with PCIe Gen 5. These new configuration options can be
> controlled via the config_acs= boot parameter.
>
> By default, the ACS Unclaimed Request Redirect Control (URRC) bit is
> enabled if supported by the hardware (i.e., if the ACS Enhanced Capability
> is present). This setting is particularly important for device passthrough
> in virtualization scenarios.
The memory target access bits should be set to request redirect as
well. Linux's grouping logic effectively has assumed the enabled behavior
forever.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] PCI: Add support for ACS Enhanced Capability
2026-01-20 16:41 ` Jason Gunthorpe
@ 2026-01-21 9:18 ` Wei Wang
2026-01-22 15:39 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Wei Wang @ 2026-01-21 9:18 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: bhelgaas, akpm, bp, rdunlap, alex, kevin.tian, linux-kernel,
linux-pci
On 1/21/26 12:41 AM, Jason Gunthorpe wrote:
> On Tue, Jan 20, 2026 at 02:11:30AM +0800, Wei Wang wrote:
>> Add support for the ACS (Access Control Services) Enhanced Capability,
>> introduced with PCIe Gen 5. These new configuration options can be
>> controlled via the config_acs= boot parameter.
>>
>> By default, the ACS Unclaimed Request Redirect Control (URRC) bit is
>> enabled if supported by the hardware (i.e., if the ACS Enhanced Capability
>> is present). This setting is particularly important for device passthrough
>> in virtualization scenarios.
>
> The memory target access bits should be set to request redirect as
> well. Linux's grouping logic effectively has assumed the enabled behavior
> forever.
>
Yes, sounds good, thanks.
I think the REQ_ACS_FLAGS also needs to include the check.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] PCI: Add support for ACS Enhanced Capability
2026-01-21 9:18 ` Wei Wang
@ 2026-01-22 15:39 ` Jason Gunthorpe
2026-01-23 1:06 ` Wei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2026-01-22 15:39 UTC (permalink / raw)
To: Wei Wang
Cc: bhelgaas, akpm, bp, rdunlap, alex, kevin.tian, linux-kernel,
linux-pci
On Wed, Jan 21, 2026 at 05:18:46PM +0800, Wei Wang wrote:
> On 1/21/26 12:41 AM, Jason Gunthorpe wrote:
> > On Tue, Jan 20, 2026 at 02:11:30AM +0800, Wei Wang wrote:
> > > Add support for the ACS (Access Control Services) Enhanced Capability,
> > > introduced with PCIe Gen 5. These new configuration options can be
> > > controlled via the config_acs= boot parameter.
> > >
> > > By default, the ACS Unclaimed Request Redirect Control (URRC) bit is
> > > enabled if supported by the hardware (i.e., if the ACS Enhanced Capability
> > > is present). This setting is particularly important for device passthrough
> > > in virtualization scenarios.
> >
> > The memory target access bits should be set to request redirect as
> > well. Linux's grouping logic effectively has assumed the enabled behavior
> > forever.
> >
> Yes, sounds good, thanks.
> I think the REQ_ACS_FLAGS also needs to include the check.
That would make a mess, I think leave it alone. I tried to make some
patches for it once but it is going to be problematic..
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] PCI: Add support for ACS Enhanced Capability
2026-01-22 15:39 ` Jason Gunthorpe
@ 2026-01-23 1:06 ` Wei Wang
0 siblings, 0 replies; 5+ messages in thread
From: Wei Wang @ 2026-01-23 1:06 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: bhelgaas, akpm, bp, rdunlap, alex, kevin.tian, linux-kernel,
linux-pci
On 1/22/26 11:39 PM, Jason Gunthorpe wrote:
> On Wed, Jan 21, 2026 at 05:18:46PM +0800, Wei Wang wrote:
>> On 1/21/26 12:41 AM, Jason Gunthorpe wrote:
>>> On Tue, Jan 20, 2026 at 02:11:30AM +0800, Wei Wang wrote:
>>>> Add support for the ACS (Access Control Services) Enhanced Capability,
>>>> introduced with PCIe Gen 5. These new configuration options can be
>>>> controlled via the config_acs= boot parameter.
>>>>
>>>> By default, the ACS Unclaimed Request Redirect Control (URRC) bit is
>>>> enabled if supported by the hardware (i.e., if the ACS Enhanced Capability
>>>> is present). This setting is particularly important for device passthrough
>>>> in virtualization scenarios.
>>>
>>> The memory target access bits should be set to request redirect as
>>> well. Linux's grouping logic effectively has assumed the enabled behavior
>>> forever.
>>>
>> Yes, sounds good, thanks.
>> I think the REQ_ACS_FLAGS also needs to include the check.
>
> That would make a mess, I think leave it alone. I tried to make some
> patches for it once but it is going to be problematic..
>
What problems did you encounter? I've prepared a new version that adds
the enhanced ACS controls check to pci_acs_enabled() (not via
REQ_ACS_FLAGS though). I can post it soon so we can see if the issues
you ran into still apply.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-23 1:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 18:11 [PATCH v1] PCI: Add support for ACS Enhanced Capability Wei Wang
2026-01-20 16:41 ` Jason Gunthorpe
2026-01-21 9:18 ` Wei Wang
2026-01-22 15:39 ` Jason Gunthorpe
2026-01-23 1:06 ` Wei Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox