[Skiboot] [PATCH v2] phb4/capp: Update DMA read engines set in APC_FSM_READ_MASK based on link-width

Vaibhav Jain vaibhav at linux.ibm.com
Tue Aug 14 12:19:26 AEST 2018


Commit 47c09cdfe7a3("phb4/capp: Calculate STQ/DMA read engines based
on link-width for PEC") update the CAPP init sequence by calculating
the needed STQ/DMA-read engines based on link width and populating it
in XPEC_NEST_CAPP_CNTL register. This however needs to be synchronized
with the value set in CAPP APC FSM Read Machine Mask Register.

Hence this patch update phb4_init_capp_regs() to calculate the link
width of the stack on PEC2 and populate the same values as previously
populated in PEC CAPP_CNTL register.

Cc: stable # v5.7+
Fixes: 47c09cdfe7a3("phb4/capp: Calculate STQ/DMA read engines based on link-width for PEC")
Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>
---
Change-log:

v2 -> Suffixed the constants with 'ULL' [Andrew]
---
 hw/phb4.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index 5e07e2bc..707ef2ee 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -3948,10 +3948,24 @@ static void phb4_init_capp_regs(struct phb4 *p, uint32_t capp_eng)
 		xscom_write(p->chip_id, XPT_FSM_RMM + offset, reg);
 	}
 	if (p->index == CAPP1_PHB_INDEX) {
-		/* Set 30 Read machines for CAPP Minus 20-27 for DMA */
-		reg = 0xFFFFF00E00000000;
-		if (capp_eng & CAPP_MAX_DMA_READ_ENGINES)
-			reg = 0xF000000000000000;
+
+		if (capp_eng & CAPP_MAX_DMA_READ_ENGINES) {
+			reg = 0xF000000000000000ULL;
+		} else {
+			/* Check if PEC is in x8 or x16 mode */
+			xscom_read(p->chip_id, XPEC_PCI2_CPLT_CONF1, &reg);
+			if ((reg & XPEC_PCI2_IOVALID_MASK) ==
+			    XPEC_PCI2_IOVALID_X16)
+				/* 0-47 (Read machines) are available for
+				 * capp use
+				 */
+				reg = 0x0000FFFFFFFFFFFFULL;
+			else
+				/* Set 30 Read machines for CAPP Minus
+				 * 20-27 for DMA
+				 */
+				reg = 0xFFFFF00E00000000ULL;
+		}
 		xscom_write(p->chip_id, APC_FSM_READ_MASK + offset, reg);
 		xscom_write(p->chip_id, XPT_FSM_RMM + offset, reg);
 	}
-- 
2.17.1



More information about the Skiboot mailing list