Skip to contentSkip to conversation

ssb: Clear RETRY_TIMEOUT in PCI Configuration

PATCH New Larry Finger 4 participants 9 messages Oct 19, 2010 – Nov 16, 2010 Sonics silicon backplane driver (ssb)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

drivers/ssb/driver_pcicore.c +7 -0
Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 {
 	u8 lat;
+	u32 val;
 
 	if (dev->bus->ops != &ssb_pcicore_pciops) {
 		/* This is not a device on the PCI-core bridge. */
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
 		return;
 	}
 
+	/* Disable the RETRY_TIMEOUT register (0x41) to keep
+	 * PCI Tx retries from interfering with C3 CPU state */
+	pci_read_config_dword(pci_dev, 0x40, &val);
+	if ((val & 0x0000ff00) != 0)
+		pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
 	/* Enable PCI bridge BAR1 prefetch and burst */
 	pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
 
#1 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 8 lines · Larry Finger

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

Quoted 8 lines

---

John,

No particular urgency for this patch.

Larry

I nearly missed it! Please do Cc linux-wireless at vger.kernel.org on patches.

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.
#2 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 12 lines · John W. Linville
Quoted 11 lines · Larry Finger

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

Quoted 7 lines
Quoted 5 lines

John,

No particular urgency for this patch.

Larry

I nearly missed it! Please do Cc linux-wireless at vger.kernel.org on patches.

Sorry. I guess I'm out of practice.

Larry

#3 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

In reply to Larry Finger
Quoted 32 lines · Larry Finger

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================

drivers/ssb/driver_pcicore.c +1 -0
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 {
 	u8 lat;
+	u32 val;
 
 	if (dev->bus->ops != &ssb_pcicore_pciops) {
 		/* This is not a device on the PCI-core bridge. */
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
 		return;

drivers/ssb/driver_pcicore.c static void ssb_pcicore_fixup_pcibridge( · line 299

Quoted 10 lines
drivers/ssb/driver_pcicore.c +6 -0
 	}
 
+	/* Disable the RETRY_TIMEOUT register (0x41) to keep
+	 * PCI Tx retries from interfering with C3 CPU state */
+	pci_read_config_dword(pci_dev, 0x40, &val);
+	if ((val & 0x0000ff00) != 0)
+		pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
 	/* Enable PCI bridge BAR1 prefetch and burst */
 	pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);

Hm, do you realize that this function will only be executed for PCI devices that live on top of a native SSB bus? Is that intentional?

It won't affect normal broadcom wireless PCI devices.
It will only have an affect on a broadcom wireless PCI device that lives behind a SSB->PCI bridge on an embedded device.

Signature · 1 line
Greetings Michael.
#4 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

2010/10/19 Michael B?sch <[email protected]>:

Quoted 48 lines · Larry Finger
Quoted 40 lines

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================

drivers/ssb/driver_pcicore.c +1 -0
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 ?static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 ?{
 ? ? ? u8 lat;
+ ? ? u32 val;
 
 ? ? ? if (dev->bus->ops != &ssb_pcicore_pciops) {

? ? ? ? ? ? ? /* This is not a device on the PCI-core bridge. */

drivers/ssb/driver_pcicore.c +6 -0
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
 ? ? ? ? ? ? ? return;
 ? ? ? }
 
+ ? ? /* Disable the RETRY_TIMEOUT register (0x41) to keep
+ ? ? ?* PCI Tx retries from interfering with C3 CPU state */
+ ? ? pci_read_config_dword(pci_dev, 0x40, &val);
+ ? ? if ((val & 0x0000ff00) != 0)
+ ? ? ? ? ? ? pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
Quoted 2 lines

? ? ? /* Enable PCI bridge BAR1 prefetch and burst */ ? ? ? pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);

Hm, do you realize that this function will only be executed for PCI devices that live on top of a native SSB bus? Is that intentional?

Quoted 3 lines

It won't affect normal broadcom wireless PCI devices.
It will only have an affect on a broadcom wireless PCI device that lives behind a SSB->PCI bridge on an embedded device.

Is this patch needed? Shouldn't this be replaced by second version affecting "normal devices"?

I can see both applied to wireless-testing.

Signature · 1 line
Rafa?
#5 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 49 lines · Rafa? Mi?ecki

2010/10/19 Michael B?sch <[email protected]>:

Quoted 48 lines · Larry Finger
Quoted 32 lines

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================

drivers/ssb/driver_pcicore.c +1 -0
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 {
      u8 lat;
+     u32 val;
 
      if (dev->bus->ops != &ssb_pcicore_pciops) {
              /* This is not a device on the PCI-core bridge. */
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
              return;

drivers/ssb/driver_pcicore.c static void ssb_pcicore_fixup_pcibridge( · line 299

Quoted 10 lines
drivers/ssb/driver_pcicore.c +6 -0
      }
 
+     /* Disable the RETRY_TIMEOUT register (0x41) to keep
+      * PCI Tx retries from interfering with C3 CPU state */
+     pci_read_config_dword(pci_dev, 0x40, &val);
+     if ((val & 0x0000ff00) != 0)
+             pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
      /* Enable PCI bridge BAR1 prefetch and burst */
      pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);

Hm, do you realize that this function will only be executed for PCI devices that live on top of a native SSB bus? Is that intentional?

Quoted 8 lines
Quoted 3 lines

It won't affect normal broadcom wireless PCI devices.
It will only have an affect on a broadcom wireless PCI device that lives behind a SSB->PCI bridge on an embedded device.

Is this patch needed? Shouldn't this be replaced by second version affecting "normal devices"?

I can see both applied to wireless-testing.

They certainly should _not_ be applied both. John, some fixing is needed. Please remove this patch.

Signature · 1 line
Greetings Michael.
#6 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 54 lines · Michael B?sch
Quoted 53 lines · Rafa? Mi?ecki

2010/10/19 Michael B?sch <[email protected]>:

Quoted 51 lines · Larry Finger
Quoted 32 lines

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================

drivers/ssb/driver_pcicore.c +1 -0
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 {
      u8 lat;
+     u32 val;
 
      if (dev->bus->ops != &ssb_pcicore_pciops) {
              /* This is not a device on the PCI-core bridge. */
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
              return;

drivers/ssb/driver_pcicore.c static void ssb_pcicore_fixup_pcibridge( · line 299

Quoted 10 lines
drivers/ssb/driver_pcicore.c +6 -0
      }
 
+     /* Disable the RETRY_TIMEOUT register (0x41) to keep
+      * PCI Tx retries from interfering with C3 CPU state */
+     pci_read_config_dword(pci_dev, 0x40, &val);
+     if ((val & 0x0000ff00) != 0)
+             pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
      /* Enable PCI bridge BAR1 prefetch and burst */
      pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);

Hm, do you realize that this function will only be executed for PCI devices that live on top of a native SSB bus? Is that intentional?

It won't affect normal broadcom wireless PCI devices.
It will only have an affect on a broadcom wireless PCI device that lives behind a SSB->PCI bridge on an embedded device.

Quoted 7 lines
Quoted 4 lines

Is this patch needed? Shouldn't this be replaced by second version affecting "normal devices"?

I can see both applied to wireless-testing.

They certainly should _not_ be applied both. John, some fixing is needed. Please remove this patch.

Does the other patch handle this case (i.e. devices behind SSB->PCI bridge)? If so, can you explain how? It looks to me like the code in ssb_pcihost_register is only called for PCI-attached b43 (or b44) devices.

Or are you saying the RETRY_TIMEOUT change is inappropriate for a device behind an SSB->PCI bridge?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.
#7 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 58 lines · John W. Linville
Quoted 57 lines · Michael B?sch
Quoted 56 lines · Rafa? Mi?ecki

2010/10/19 Michael B?sch <[email protected]>:

Quoted 48 lines · Larry Finger
Quoted 32 lines

MMIO log traces obtained using the Broadcom wl hybrid driver show that the RETRY_TIMEOUT register (0x41) in PCI configuration space is cleared if non-zero. Similar code found in other drivers such as ipw2100 show this operation is needed to keep PCI Tx retries from interfering with C3 CPU state. There are no known cases where omission of this code has caused a problem, but this patch is offered just in case such a situation occurs.

---

John,

No particular urgency for this patch.

Larry
---

Index: wireless-testing/drivers/ssb/driver_pcicore.c
===================================================================

drivers/ssb/driver_pcicore.c +1 -0
@@ -271,6 +271,7 @@ int ssb_pcicore_plat_dev_init(struct pci
 static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
 {
      u8 lat;
+     u32 val;
 
      if (dev->bus->ops != &ssb_pcicore_pciops) {
              /* This is not a device on the PCI-core bridge. */
@@ -288,6 +289,12 @@ static void ssb_pcicore_fixup_pcibridge(
              return;

drivers/ssb/driver_pcicore.c static void ssb_pcicore_fixup_pcibridge( · line 299

Quoted 10 lines
drivers/ssb/driver_pcicore.c +6 -0
      }
 
+     /* Disable the RETRY_TIMEOUT register (0x41) to keep
+      * PCI Tx retries from interfering with C3 CPU state */
+     pci_read_config_dword(pci_dev, 0x40, &val);
+     if ((val & 0x0000ff00) != 0)
+             pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
+
      /* Enable PCI bridge BAR1 prefetch and burst */
      pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);

Hm, do you realize that this function will only be executed for PCI devices that live on top of a native SSB bus? Is that intentional?

Quoted 3 lines

It won't affect normal broadcom wireless PCI devices.
It will only have an affect on a broadcom wireless PCI device that lives behind a SSB->PCI bridge on an embedded device.

Is this patch needed? Shouldn't this be replaced by second version affecting "normal devices"?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I can see both applied to wireless-testing.

They certainly should _not_ be applied both. John, some fixing is needed. Please remove this patch.

Does the other patch handle this case (i.e. devices behind SSB->PCI bridge)? If so, can you explain how?

Yes. For embedded it goes:

native-ssb -> pci-core -> pci-bridge module -> wireless ssb

For PCI it goes:

native pci bus -> pci-bridge module -> wireless ssb

So you see that the pci bridge module is the bus glue for all SSB based PCI devices. So we do not need the workaround in the pci-core driver code. Just in the pci-bridge code (which is drivers/ssb/pcihost_wrapper.c)

Quoted 3 lines

It looks to me like the code
in ssb_pcihost_register is only called for PCI-attached b43 (or b44) devices.

Yeah. But devices connected to the ssb-pci-core _are_ PCI attached devices.

Quoted 2 lines

Or are you saying the RETRY_TIMEOUT change is inappropriate for a device behind an SSB->PCI bridge?

No. But we already handle that, because the glue code (pcihost_wrapper.c) is used for both types.

Signature · 1 line
Greetings Michael.
#8 lore raw

PATCH 1/1 ssb: Clear RETRY_TIMEOUT in PCI Configuration

Quoted 22 lines · Michael B?sch
Quoted 2 lines · John W. Linville

Does the other patch handle this case (i.e. devices behind SSB->PCI bridge)? If so, can you explain how?

Yes. For embedded it goes:

native-ssb -> pci-core -> pci-bridge module -> wireless ssb

For PCI it goes:

native pci bus -> pci-bridge module -> wireless ssb

So you see that the pci bridge module is the bus glue for all SSB based PCI devices. So we do not need the workaround in the pci-core driver code. Just in the pci-bridge code (which is drivers/ssb/pcihost_wrapper.c)

Quoted 3 lines

It looks to me like the code
in ssb_pcihost_register is only called for PCI-attached b43 (or b44) devices.

Quoted 8 lines

Yeah. But devices connected to the ssb-pci-core _are_ PCI attached devices.

Quoted 2 lines

Or are you saying the RETRY_TIMEOUT change is inappropriate for a device behind an SSB->PCI bridge?

No. But we already handle that, because the glue code (pcihost_wrapper.c) is used for both types.

Thanks for the explanation!

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.