[Skiboot] [PATCH 6/7] phb4/capp: Implement sequence to disable CAPP and enable fast-reset

Vaibhav Jain vaibhav at linux.ibm.com
Sun Sep 16 00:39:25 AEST 2018


We implement h/w sequence to disable CAPP in disable_capi_mode() and
with it also enable fast-reset for CAPI mode in phb4_set_capi_mode().

Sequence to disable CAPP is executed in three phases. The first two
phase is implemented in disable_capi_mode() where we reset the CAPP
registers followed by PEC registers to their init values. The final
third final phase is to reset the PHB CAPI Compare/Mask Register and
is done in phb4_init_ioda3(). The reason to move the PHB reset to
phb4_init_ioda3() is because by the time Opal PCI reset state machine
reaches this function the PHB is already un-fenced and its
configuration registers accessible via mmio.

Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
---
 hw/phb4.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 66 insertions(+), 6 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index 16a4a62a..2e0ed191 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -3182,7 +3182,68 @@ static void disable_capi_mode(struct phb4 *p)
 
 	PHBINF(p, "CAPP: Disabling CAPI mode\n");
 
-	/* Implement procedure to disable CAPP based on h/w sequence */
+	/* First Phase Reset CAPP Registers */
+	/* CAPP about to be disabled mark TLBI_FENCED and tlbi_psl_is_dead */
+	xscom_write(p->chip_id, CAPP_ERR_STATUS_CTRL + offset, PPC_BIT(3)|
+		    PPC_BIT(4));
+
+	/* Flush SUE uOP1 Register */
+	if (!(p->rev == PHB4_REV_NIMBUS_DD10))
+		xscom_write(p->chip_id, FLUSH_SUE_UOP1 + offset, 0);
+
+	/* Release DMA/STQ engines */
+	xscom_write(p->chip_id, APC_FSM_READ_MASK + offset, 0ull);
+	xscom_write(p->chip_id, XPT_FSM_RMM + offset, 0ull);
+
+	/* Disable snoop */
+	xscom_write(p->chip_id, SNOOP_CAPI_CONFIG + offset, 0);
+
+	/* Clear flush SUE state map register */
+	xscom_write(p->chip_id, FLUSH_SUE_STATE_MAP + offset, 0);
+
+	/* Disable epoch timer */
+	xscom_write(p->chip_id, EPOCH_RECOVERY_TIMERS_CTRL + offset, 0);
+
+	/* CAPP Transport Control Register */
+	xscom_write(p->chip_id, TRANSPORT_CONTROL + offset, PPC_BIT(15));
+
+	/* Disable snooping */
+	xscom_write(p->chip_id, SNOOP_CONTROL + offset, 0);
+	xscom_write(p->chip_id, SNOOP_CAPI_CONFIG + offset, 0);
+
+	/* APC Master PB Control Register - disable examining cResps */
+	xscom_write(p->chip_id, APC_MASTER_PB_CTRL + offset, 0);
+
+	/* APC Master Config Register - de-select PHBs */
+	xscom_write_mask(p->chip_id, APC_MASTER_CAPI_CTRL + offset, 0,
+		    PPC_BITMASK(2, 3));
+
+	/* Clear all error registers */
+	xscom_write(p->chip_id, CAPP_ERR_RPT_CLR + offset, 0);
+	xscom_write(p->chip_id, CAPP_FIR + offset, 0);
+	xscom_write(p->chip_id, CAPP_FIR_ACTION0 + offset, 0);
+	xscom_write(p->chip_id, CAPP_FIR_ACTION1 + offset, 0);
+	xscom_write(p->chip_id, CAPP_FIR_MASK + offset, 0);
+
+	/* Second Phase Reset PEC/PHB Registers */
+
+	/* Reset the stack overrides if any */
+	xscom_write(p->chip_id, p->pci_xscom + XPEC_PCI_PRDSTKOVR, 0);
+	xscom_write(p->chip_id, p->pe_xscom +
+		    XPEC_NEST_READ_STACK_OVERRIDE, 0);
+
+	/* PE Bus AIB Mode Bits. Disable Tracing. Leave HOL Blocking as it is */
+	if (!(p->rev == PHB4_REV_NIMBUS_DD10) && p->index == CAPP1_PHB_INDEX)
+		xscom_write_mask(p->chip_id,
+				 p->pci_xscom + XPEC_PCI_PBAIB_HW_CONFIG, 0,
+				 PPC_BIT(30));
+
+	/* Reset for PCI to PB data movement */
+	xscom_write_mask(p->chip_id, p->pe_xscom + XPEC_NEST_PBCQ_HW_CONFIG,
+			 0, XPEC_NEST_PBCQ_HW_CONFIG_PBINIT);
+
+	/* Disable CAPP mode in PEC CAPP Control Register */
+	xscom_write(p->chip_id, p->pe_xscom + XPEC_NEST_CAPP_CNTL, 0ull);
 }
 
 
@@ -4510,13 +4571,9 @@ static int64_t phb4_set_capi_mode(struct phb *phb, uint64_t mode,
 					(CAPP_MAX_STQ_ENGINES |
 					 CAPP_MIN_DMA_READ_ENGINES)));
 
-		if (ret == OPAL_SUCCESS) {
+		if (ret == OPAL_SUCCESS)
 			/* register notification on system shutdown */
 			opal_add_host_sync_notifier(&phb4_host_sync_reset, p);
-
-			/* Disable fast reboot for CAPP */
-			disable_fast_reboot("CAPP being enabled");
-		}
 		else
 			/* In case of an error mark the PHB detached */
 			chip->capp_phb4_attached_mask ^= 1 << p->index;
@@ -4731,6 +4788,9 @@ static void phb4_init_ioda3(struct phb4 *p)
 
 	/* Init_26 - CAPI Compare/Mask */
 	/* See enable_capi_mode() */
+	/* if CAPP being disabled then reset CAPI Compare/Mask Register */
+	if (p->flags & PHB4_CAPP_DISABLE)
+		out_be64(p->regs + PHB_CAPI_CMPM, 0);
 
 	/* Init_27 - PCIE Outbound upper address */
 	out_be64(p->regs + PHB_M64_UPPER_BITS, 0);
-- 
2.17.1



More information about the Skiboot mailing list