[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] arm/pci-designware: Make config space iATU index configurable


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Wed, 2 Dec 2026 09:53:34 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mclshlnKCVfZLhTpvFBbRtMKnLP101THPCVbuPHv6i4=; b=QMJ04xlQwgBaIW3Wpr3uaRWoFwbpHK8kawi6U22L9QQ8/uDSbZlRRACQdOTbj+vd3juy6Am1gLX29/0oij+G2ffAmIYGcp2NqcFzSs1cwsnUIws8icHYQCxeQhohQg/CDJilizhGEgWeKP8lzDwnn0uqib5FuW9J/o0ktJMuy6m64AxLbNRNsaLsiUEDADdmg3WlyJhYFJJ0+PPj3FjZWM+JlAS7aGOZgZFmpW1E8pbJefF7P/pnWotNjm4J1GF4AQCogAaYbfQ14621vNlNmSKNtdwuAN2zChuT0+6zXlSX84V7T1zKqzk9DfVtLrpJ/ClNNQg6g9egj7M9NZ8UxQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=waCm3Qk5e8ceok3AtHafcelSveCx6/vLviRb499suueOVYpBo3ztrrUwjCJDiUdJaWAhMAwvq+G7rpCrt/ysQaaQjoeLq1IQYgRscXrBz8ibLkKDzEVvEZB4XvScdsv6cOx5cXINSmqO9ejakptOLt8KyEt2n8hy/vFuXk4eYeYJS/aN26V50LY2ER+IjosC19JCQVioQN9fOSK0zeoG+uJO0Adc7o6wctf3e1H0Si2xayVj7O++hvdXMEalCLAuaYrP8S+Rz6I2gvk2drjWYLVCPH7A/oo8OnvNqLlnzHcmYyokScXyXa9xC/GIF2KBT7x3Bt+FBE34RiJCRATHGQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>
  • Delivery-date: Wed, 02 Dec 2026 09:53:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdgkL+mXAthoWhPUu85iW1eqm+hQ==
  • Thread-topic: [PATCH] arm/pci-designware: Make config space iATU index configurable

Xen programs outbound iATU window 1 for child bus config space
accesses, following the pre-5.11 Linux layout. Since Linux commit
9f9e59a48095 ("PCI: dwc: Support multiple ATU memory regions") the
hardware domain uses window 0 for config space and windows 1 and up
for MEM ranges, so every config access from Xen overwrites the first
MEM window.

Add the "pci-dw-cfg-atu" command line option to select the window and
default it to 0 to match current Linux. Older kernels need
pci-dw-cfg-atu=1.

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
 docs/misc/xen-command-line.pandoc | 10 ++++++++++
 xen/arch/arm/pci/pci-designware.c | 12 ++++++++----
 xen/arch/arm/pci/pci-designware.h |  1 -
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc 
b/docs/misc/xen-command-line.pandoc
index a6f08463d1..ccc8f849dd 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2077,6 +2077,16 @@ behavior.**
   In its negative form, allows to suppress certain quirk workarounds, in case
   they cause issues.
 
+### pci-dw-cfg-atu (arm)
+> `= <integer>`
+
+> Default: `0`
+
+Outbound iATU window used by Xen for config space accesses on DesignWare PCIe
+host bridges.  It must not clash with the windows programmed by the hardware
+domain.  Linux 5.11 and later use window 0 for config space, older versions
+use window 1.
+
 ### pci-phantom
 > `=[<seg>:]<bus>:<device>,<stride>`
 
diff --git a/xen/arch/arm/pci/pci-designware.c 
b/xen/arch/arm/pci/pci-designware.c
index 902da19e8c..13cb585096 100644
--- a/xen/arch/arm/pci/pci-designware.c
+++ b/xen/arch/arm/pci/pci-designware.c
@@ -8,6 +8,7 @@
  */
 
 #include <xen/delay.h>
+#include <xen/param.h>
 #include <asm/io.h>
 
 #include "pci-designware.h"
@@ -27,6 +28,10 @@
  */
 #define lower_32_bits(n) ((uint32_t)((n) & 0xffffffffU))
 
+/* Linux >= 5.11 uses outbound window 0 for config space, older ones use 1. */
+static unsigned int __ro_after_init cfg_atu_index;
+integer_param("pci-dw-cfg-atu", cfg_atu_index);
+
 static int dw_pcie_read(void __iomem *addr, unsigned int len, uint32_t *val)
 {
     if ( !IS_ALIGNED((uintptr_t)addr, len) )
@@ -282,8 +287,7 @@ void __iomem *dw_pcie_child_map_bus(struct pci_host_bridge 
*bridge,
              PCIE_ATU_FUNC(PCI_FUNC(sbdf.devfn));
 
     /* FIXME: Parent is the root bus, so use PCIE_ATU_TYPE_CFG0. */
-    ret = dw_pcie_prog_outbound_atu(bridge, PCIE_ATU_REGION_INDEX1,
-                                    PCIE_ATU_TYPE_CFG0,
+    ret = dw_pcie_prog_outbound_atu(bridge, cfg_atu_index, PCIE_ATU_TYPE_CFG0,
                                     bridge->child_cfg->phys_addr, busdev,
                                     bridge->child_cfg->size);
     if ( ret )
@@ -313,7 +317,7 @@ int dw_pcie_child_config_read(struct pci_host_bridge 
*bridge, pci_sbdf_t sbdf,
 
     ret = pci_generic_config_read(bridge, sbdf, reg, len, value);
     if ( !ret && (priv->num_viewport <= 2) )
-        ret = dw_pcie_prog_outbound_atu(bridge, PCIE_ATU_REGION_INDEX1,
+        ret = dw_pcie_prog_outbound_atu(bridge, cfg_atu_index,
                                         PCIE_ATU_TYPE_IO,
                                         bridge->child_cfg->phys_addr, 0,
                                         bridge->child_cfg->size);
@@ -329,7 +333,7 @@ int dw_pcie_child_config_write(struct pci_host_bridge 
*bridge, pci_sbdf_t sbdf,
 
     ret = pci_generic_config_write(bridge, sbdf, reg, len, value);
     if ( !ret && (priv->num_viewport <= 2) )
-        ret = dw_pcie_prog_outbound_atu(bridge, PCIE_ATU_REGION_INDEX1,
+        ret = dw_pcie_prog_outbound_atu(bridge, cfg_atu_index,
                                         PCIE_ATU_TYPE_IO,
                                         bridge->child_cfg->phys_addr, 0,
                                         bridge->child_cfg->size);
diff --git a/xen/arch/arm/pci/pci-designware.h 
b/xen/arch/arm/pci/pci-designware.h
index bd93dab6f2..6dfe27d7e4 100644
--- a/xen/arch/arm/pci/pci-designware.h
+++ b/xen/arch/arm/pci/pci-designware.h
@@ -25,7 +25,6 @@
 #define PCIE_ATU_UPPER_TARGET           0x91C
 #define PCIE_ATU_UPPER_LIMIT            0x924
 
-#define PCIE_ATU_REGION_INDEX1  0x1
 #define PCIE_ATU_TYPE_IO        0x2
 #define PCIE_ATU_TYPE_CFG0      0x4
 

---
base-commit: abc47aca98fa87e9fdebd0e9f7fbbbaa482056fb
change-id: 20261202-pci-dw-cfg-atu-0117d18b4630

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.