diff mbox

[1/4] PHB3: Fix corruption of pref window register

Message ID 87oa8tf1uh.fsf@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith April 29, 2016, 4:58 a.m. UTC
Gavin Shan <gwshan@linux.vnet.ibm.com> writes:
> On P8+ Garrison platform, the root port's pref window register might
> be not writable and we have to emulate the window because of hardware
> defect. In order to detect that, we read the register content, write
> inversed value and read the register content again. The register is
> regarded as read-only if the values from the two continuous read are
> same. However, the original register content isn't written back and
> it causes corruption on pref window register if it's writable.
>
> This fixes the above issue by writing the original content back to
> the register at the end.
>
> Fixes: d40160f6 ("PHB3: Emulate root complex pref 64-bits window")
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Following IM discussion on the topic, merged to
5.2.x as of a2c5ede
master as of f849108

I also added some comments around what the vendor/device IDs are there,
because it turns out I'm unable to keep that mapping in my head. Patch
below:
diff mbox

Patch

--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -505,7 +505,7 @@  static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev)
                 * adjust some settings for performances
                 */
                xscom_read(p->chip_id, p->pe_xscom + 0x0b, &modectl);
-               if (vendor == 0x15b3 &&
+               if (vendor == 0x15b3 &&         /* Mellanox */
                    (device == 0x1003 ||        /* Travis3-EN (CX3) */
                     device == 0x1011 ||        /* HydePark (ConnectIB) */
                     device == 0x1013)) {       /* GlacierPark (CX4) */
@@ -518,7 +518,8 @@  static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev)
 
                xscom_write(p->chip_id, p->pe_xscom + 0x0b, modectl);
        } else if (dev->primary_bus == 0) {
-               if (vendor == 0x1014 && device == 0x03dc) {
+               if (vendor == 0x1014 &&         /* IBM */
+                   device == 0x03dc) {         /* P8/P8E/P8NVL Root port */
                        uint32_t pref_hi, tmp;
 
                        pci_cfg_read32(phb, dev->bdfn,