Skip to contentSkip to conversation

arm: a37xx: pci: Fix condition for CRS response

PATCH In review Pali Rohár 2 participants 3 messages Oct 19, 2021 – Oct 21, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: a37xx: pci: Fix condition for CRS response

As stated in comment above the code, CRS response can be returned to OS only for 4-byte PCI_VENDOR_ID config read request. So fix the code.

Fixes 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port")
---
 drivers/pci/pci-aardvark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-aardvark.c +1 -1
index ade5ab056f84..9e623b6e617b 100644
@@ -445,7 +445,7 @@ static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
 	 * for returning CRS, so that if U-Boot does support CRS in the future,
 	 * it will work for Aardvark.
 	 */
-	allow_crs = pcie->cfgcrssve;
+	allow_crs = (offset == PCI_VENDOR_ID) && (size == PCI_SIZE_32) && pcie->cfgcrssve;
 
 	if (advk_readl(pcie, PIO_START)) {
 		dev_err(pcie->dev,
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Pali Rohár

As stated in comment above the code, CRS response can be returned to OS only for 4-byte PCI_VENDOR_ID config read request. So fix the code.

Fixes 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port")

Thanks,
Stefan

Quoted 10 lines
---
  drivers/pci/pci-aardvark.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-aardvark.c +0 -0
index ade5ab056f84..9e623b6e617b 100644

drivers/pci/pci-aardvark.c static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf, · line 451

Quoted 8 lines
drivers/pci/pci-aardvark.c +1 -1
@@ -445,7 +445,7 @@ static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
  	 * for returning CRS, so that if U-Boot does support CRS in the future,
  	 * it will work for Aardvark.
  	 */
-	allow_crs = pcie->cfgcrssve;
+	allow_crs = (offset == PCI_VENDOR_ID) && (size == PCI_SIZE_32) && pcie->cfgcrssve;
 
  	if (advk_readl(pcie, PIO_START)) {
  		dev_err(pcie->dev,

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#2 lore raw
In reply to Pali Rohár
Quoted 5 lines · Pali Rohár

As stated in comment above the code, CRS response can be returned to OS only for 4-byte PCI_VENDOR_ID config read request. So fix the code.

Fixes 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port")

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 10 lines
---
  drivers/pci/pci-aardvark.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-aardvark.c +0 -0
index ade5ab056f84..9e623b6e617b 100644

drivers/pci/pci-aardvark.c static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf, · line 451

Quoted 8 lines
drivers/pci/pci-aardvark.c +1 -1
@@ -445,7 +445,7 @@ static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
  	 * for returning CRS, so that if U-Boot does support CRS in the future,
  	 * it will work for Aardvark.
  	 */
-	allow_crs = pcie->cfgcrssve;
+	allow_crs = (offset == PCI_VENDOR_ID) && (size == PCI_SIZE_32) && pcie->cfgcrssve;
 
  	if (advk_readl(pcie, PIO_START)) {
  		dev_err(pcie->dev,

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]