aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Barrat <fbarrat@linux.ibm.com>2018-08-14 14:10:01 +0200
committerStewart Smith <stewart@linux.ibm.com>2018-08-15 22:41:30 -0500
commit3b9bc869a4fee22c99a4d24ba87ce938d46b11f4 (patch)
tree17f0b0af6ac9066084f378a53b7bc74fed45252b
parentec954f764efe064d7fc99e8a21a0ebdb7b8a3c91 (diff)
downloadskiboot-3b9bc869a4fee22c99a4d24ba87ce938d46b11f4.zip
skiboot-3b9bc869a4fee22c99a4d24ba87ce938d46b11f4.tar.gz
skiboot-3b9bc869a4fee22c99a4d24ba87ce938d46b11f4.tar.bz2
phb4: Disable 32-bit MSI in capi mode
If a capi device does a DMA write targeting an address lower than 4GB, it does so through a 32-bit operation, per the PCI spec. In capi mode, the first TVE entry is configured in bypass mode, so the address is valid. But with any (bad) luck, the address could be 0xFFFFxxxx, thus looking like a 32-bit MSI. We currently enable both 32-bit and 64-bit MSIs, so the PHB will interpret the DMA write as a MSI, which very likely results in an EEH (MSI with a bad payload size). We can fix it by disabling 32-bit MSI when switching the PHB to capi mode. Capi devices are 64-bit. Cc: stable Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com> Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--hw/phb4.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/phb4.c b/hw/phb4.c
index 56f8900..d1245dc 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -4249,6 +4249,15 @@ static int64_t enable_capi_mode(struct phb4 *p, uint64_t pe_number,
for (i = 0; i < p->tvt_size; i++)
out_be64(p->regs + PHB_IODA_DATA0, p->tve_cache[i]);
+ /*
+ * Since TVT#0 is in by-pass mode, disable 32-bit MSI, as a
+ * DMA write targeting 0x00000000FFFFxxxx would be interpreted
+ * as a 32-bit MSI
+ */
+ reg = in_be64(p->regs + PHB_PHB4_CONFIG);
+ reg &= ~PHB_PHB4C_32BIT_MSI_EN;
+ out_be64(p->regs + PHB_PHB4_CONFIG, reg);
+
/* set mbt bar to pass capi mmio window and keep the other
* mmio values
*/