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

Gavin Shan gwshan at linux.vnet.ibm.com
Tue Apr 26 11:56:51 AEST 2016

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 at linux.vnet.ibm.com>
 hw/phb3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/phb3.c b/hw/phb3.c
index adff5bc..598dab7 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -527,6 +527,8 @@ static void phb3_check_device_quirks(struct phb *phb, struct pci_device *dev)
 				PCI_CFG_PREF_MEM_BASE_U32, ~pref_hi);
 			pci_cfg_read32(phb, dev->bdfn,
 				PCI_CFG_PREF_MEM_BASE_U32, &tmp);
+			pci_cfg_write32(phb, dev->bdfn,
+				PCI_CFG_PREF_MEM_BASE_U32, pref_hi);
 			if (tmp == pref_hi)
 					PCI_CFG_PREF_MEM_BASE_U32, 12,

More information about the Skiboot mailing list