From patchwork Mon Oct 23 10:22:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCC20DBlz9t7X for ; Mon, 23 Oct 2017 21:22:38 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCC13BvNzDqjk for ; Mon, 23 Oct 2017 21:22:37 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBv54k0zDqhg for ; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBt671hz9t2h; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id A29E2EEA9E9; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:14 +1100 Message-Id: <20171023102222.25997-1-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 Subject: [Skiboot] [PATCH v2 1/9] phb4: Update comment X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" No functional change. Signed-off-by: Michael Neuling --- v2: pest -> PEST --- hw/phb4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/phb4.c b/hw/phb4.c index 48b01e7b63..206b0b7402 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -1140,7 +1140,7 @@ static int64_t phb4_ioda_reset(struct phb *phb, bool purge) /* Additional OPAL specific inits */ - /* Clear RTT and PELTV */ + /* Clear RTT and PELTV and PEST */ if (p->tbl_rtt) memcpy((void *)p->tbl_rtt, p->rte_cache, RTT_TABLE_SIZE); if (p->tbl_peltv) From patchwork Mon Oct 23 10:22:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCCK6Yndz9t2m for ; Mon, 23 Oct 2017 21:22:53 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCCK2vrtzDqls for ; Mon, 23 Oct 2017 21:22:53 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBv5MdwzDqhh for ; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBt6911z9t2m; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id A71C2EEA9EA; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:15 +1100 Message-Id: <20171023102222.25997-2-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 2/9] phb4: Move code around to avoid indenting X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" No functional change. Signed-off-by: Michael Neuling --- hw/phb4.c | 104 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 206b0b7402..755f0965ce 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -3179,72 +3179,70 @@ static int64_t phb4_eeh_next_error(struct phb *phb, } } - /* Mapping errors */ - if (phb4_err_pending(p)) { - /* - * If the frozen PE is caused by a malfunctioning TLP, we - * need reset the PHB. So convert ER to PHB-fatal error - * for the case. - */ - if (p->err.err_class == PHB4_ERR_CLASS_ER) { + if (!phb4_err_pending(p)) + return OPAL_SUCCESS; + /* + * If the frozen PE is caused by a malfunctioning TLP, we + * need reset the PHB. So convert ER to PHB-fatal error + * for the case. + */ + if (p->err.err_class == PHB4_ERR_CLASS_ER) { #if 0 - // FIXME XXXXX - fir = phb4_read_reg_asb(p, PHB_LEM_FIR_ACCUM); - if (fir & PPC_BIT(60)) { - phb4_pcicfg_read32(&p->phb, 0, - p->aercap + PCIECAP_AER_UE_STATUS, &cfg32); - if (cfg32 & PCIECAP_AER_UE_MALFORMED_TLP) - p->err.err_class = PHB4_ERR_CLASS_FENCED; - } -#endif + // FIXME XXXXX + fir = phb4_read_reg_asb(p, PHB_LEM_FIR_ACCUM); + if (fir & PPC_BIT(60)) { + phb4_pcicfg_read32(&p->phb, 0, + p->aercap + PCIECAP_AER_UE_STATUS, &cfg32); + if (cfg32 & PCIECAP_AER_UE_MALFORMED_TLP) + p->err.err_class = PHB4_ERR_CLASS_FENCED; } +#endif + } - switch (p->err.err_class) { - case PHB4_ERR_CLASS_DEAD: - *pci_error_type = OPAL_EEH_PHB_ERROR; - *severity = OPAL_EEH_SEV_PHB_DEAD; - break; - case PHB4_ERR_CLASS_FENCED: - *pci_error_type = OPAL_EEH_PHB_ERROR; - *severity = OPAL_EEH_SEV_PHB_FENCED; - break; - case PHB4_ERR_CLASS_ER: - *pci_error_type = OPAL_EEH_PE_ERROR; - *severity = OPAL_EEH_SEV_PE_ER; - - for (i = peev_size - 1; i >= 0; i--) { - phb4_ioda_sel(p, IODA3_TBL_PEEV, i, false); - peev = in_be64(p->regs + PHB_IODA_DATA0); - for (j = 0; j < 64; j++) { - if (peev & PPC_BIT(j)) { - *first_frozen_pe = i * 64 + j; - break; - } - } + switch (p->err.err_class) { + case PHB4_ERR_CLASS_DEAD: + *pci_error_type = OPAL_EEH_PHB_ERROR; + *severity = OPAL_EEH_SEV_PHB_DEAD; + break; + case PHB4_ERR_CLASS_FENCED: + *pci_error_type = OPAL_EEH_PHB_ERROR; + *severity = OPAL_EEH_SEV_PHB_FENCED; + break; + case PHB4_ERR_CLASS_ER: + *pci_error_type = OPAL_EEH_PE_ERROR; + *severity = OPAL_EEH_SEV_PE_ER; - if (*first_frozen_pe != (uint64_t)(-1)) + for (i = peev_size - 1; i >= 0; i--) { + phb4_ioda_sel(p, IODA3_TBL_PEEV, i, false); + peev = in_be64(p->regs + PHB_IODA_DATA0); + for (j = 0; j < 64; j++) { + if (peev & PPC_BIT(j)) { + *first_frozen_pe = i * 64 + j; break; + } } - /* No frozen PE ? */ - if (*first_frozen_pe == (uint64_t)-1) { - *pci_error_type = OPAL_EEH_NO_ERROR; - *severity = OPAL_EEH_SEV_NO_ERROR; - phb4_set_err_pending(p, false); - } + if (*first_frozen_pe != (uint64_t)(-1)) + break; + } - break; - case PHB4_ERR_CLASS_INF: - *pci_error_type = OPAL_EEH_PHB_ERROR; - *severity = OPAL_EEH_SEV_INF; - break; - default: + /* No frozen PE ? */ + if (*first_frozen_pe == (uint64_t)-1) { *pci_error_type = OPAL_EEH_NO_ERROR; *severity = OPAL_EEH_SEV_NO_ERROR; phb4_set_err_pending(p, false); } - } + break; + case PHB4_ERR_CLASS_INF: + *pci_error_type = OPAL_EEH_PHB_ERROR; + *severity = OPAL_EEH_SEV_INF; + break; + default: + *pci_error_type = OPAL_EEH_NO_ERROR; + *severity = OPAL_EEH_SEV_NO_ERROR; + phb4_set_err_pending(p, false); + } return OPAL_SUCCESS; } From patchwork Mon Oct 23 10:22:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCCY2ZZBz9t2h for ; Mon, 23 Oct 2017 21:23:05 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCCY1L3SzDqmr for ; Mon, 23 Oct 2017 21:23:05 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBv513BzDqhf for ; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBt6MS8z9t3p; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id AC0FEEEA9EB; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:16 +1100 Message-Id: <20171023102222.25997-3-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 3/9] phb4: Remove unused code X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This is old unused code from phb3 so just remove it. No functional change Signed-off-by: Michael Neuling --- hw/phb4.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 755f0965ce..c84378c4f5 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -3187,16 +3187,6 @@ static int64_t phb4_eeh_next_error(struct phb *phb, * for the case. */ if (p->err.err_class == PHB4_ERR_CLASS_ER) { -#if 0 - // FIXME XXXXX - fir = phb4_read_reg_asb(p, PHB_LEM_FIR_ACCUM); - if (fir & PPC_BIT(60)) { - phb4_pcicfg_read32(&p->phb, 0, - p->aercap + PCIECAP_AER_UE_STATUS, &cfg32); - if (cfg32 & PCIECAP_AER_UE_MALFORMED_TLP) - p->err.err_class = PHB4_ERR_CLASS_FENCED; - } -#endif } switch (p->err.err_class) { From patchwork Mon Oct 23 10:22:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCCl56FGz9t2h for ; Mon, 23 Oct 2017 21:23:15 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCCl3mqYzDqm0 for ; Mon, 23 Oct 2017 21:23:15 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBv5t9MzDqhj for ; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBt6V5xz9t5C; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id AF67BEEA9EC; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:17 +1100 Message-Id: <20171023102222.25997-4-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 4/9] phb4: Improve config space logging X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Log root complex accesses and print BFDN on device access Signed-off-by: Michael Neuling --- v2: fix casting in logging --- hw/phb4.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index c84378c4f5..ed0952164f 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -324,13 +324,19 @@ static int64_t phb4_rc_read(struct phb4 *p, uint32_t offset, uint8_t sz, case 1: offset &= 3; *((uint8_t *)data) = (oval >> (offset << 3)) & 0xff; + PHBLOGCFG(p, "000 CFG08 Rd %02x=%02x\n", + offset, *((uint8_t *)data)); break; case 2: offset &= 2; *((uint16_t *)data) = (oval >> (offset << 3)) & 0xffff; + PHBLOGCFG(p, "000 CFG16 Rd %02x=%04x\n", + offset, *((uint16_t *)data)); break; case 4: *((uint32_t *)data) = oval; + PHBLOGCFG(p, "000 CFG32 Rd %02x=%08x\n", + offset, *((uint32_t *)data)); break; default: assert(false); @@ -417,6 +423,7 @@ static int64_t phb4_rc_write(struct phb4 *p, uint32_t offset, uint8_t sz, /* Workaround PHB config space enable */ if ((p->rev == PHB4_REV_NIMBUS_DD10) && (reg == PCI_CFG_CMD)) val |= PCI_CFG_CMD_MEM_EN | PCI_CFG_CMD_BUS_MASTER_EN; + PHBLOGCFG(p, "000 CFG%02d Wr %02x=%08x\n", 8 * sz, reg, val); if (use_asb) phb4_write_reg_asb(p, PHB_RC_CONFIG_BASE + reg, val); else @@ -485,19 +492,19 @@ static int64_t phb4_pcicfg_read(struct phb4 *p, uint32_t bdfn, case 1: *((uint8_t *)data) = in_8(p->regs + PHB_CONFIG_DATA + (offset & 3)); - PHBLOGCFG(p, "CFG8 Rd %02x=%02x\n", - offset, *((uint8_t *)data)); + PHBLOGCFG(p, "%03x CFG08 Rd %02x=%02x\n", + bdfn, offset, *((uint8_t *)data)); break; case 2: *((uint16_t *)data) = in_le16(p->regs + PHB_CONFIG_DATA + (offset & 2)); - PHBLOGCFG(p, "CFG16 Rd %02x=%04x\n", - offset, *((uint16_t *)data)); + PHBLOGCFG(p, "%03x CFG16 Rd %02x=%04x\n", + bdfn, offset, *((uint16_t *)data)); break; case 4: *((uint32_t *)data) = in_le32(p->regs + PHB_CONFIG_DATA); - PHBLOGCFG(p, "CFG32 Rd %02x=%08x\n", - offset, *((uint32_t *)data)); + PHBLOGCFG(p, "%03x CFG32 Rd %02x=%08x\n", + bdfn, offset, *((uint32_t *)data)); break; default: return OPAL_PARAMETER; @@ -574,7 +581,7 @@ static int64_t phb4_pcicfg_write(struct phb4 *p, uint32_t bdfn, return OPAL_PARAMETER; } } - PHBLOGCFG(p, "CFG%d Wr %02x=%08x\n", 8 * size, offset, data); + PHBLOGCFG(p, "%03x CFG%d Wr %02x=%08x\n", bdfn, 8 * size, offset, data); return OPAL_SUCCESS; } From patchwork Mon Oct 23 10:22:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829215 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCCx607jz9t2h for ; Mon, 23 Oct 2017 21:23:25 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCCx4ls4zDqwt for ; Mon, 23 Oct 2017 21:23:25 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBv6RwjzDqjF for ; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBt6j1Yz9t5Q; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id B6B3FEEA9ED; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:18 +1100 Message-Id: <20171023102222.25997-5-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 5/9] phb4: Use phb4_ioda_sel() more X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Use phb4_ioda_sel() in phb4_read_phb_status() rather than re-implementing it. Signed-off-by: Michael Neuling --- hw/phb4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index ed0952164f..b75cec0480 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -1795,7 +1795,6 @@ static void phb4_read_phb_status(struct phb4 *p, { uint16_t val = 0; uint32_t i; - uint64_t val64 = 0; uint64_t *pPEST; memset(stat, 0, sizeof(struct OpalIoPhb4ErrorData)); @@ -1905,17 +1904,13 @@ static void phb4_read_phb_status(struct phb4 *p, * resident tables. */ pPEST = (uint64_t *)p->tbl_pest; - val64 = PHB_IODA_AD_AUTOINC; - val64 = SETFIELD(PHB_IODA_AD_TSEL, val64, IODA3_TBL_PESTA); - phb4_write_reg_asb(p, PHB_IODA_ADDR, val64); + phb4_ioda_sel(p, IODA3_TBL_PESTA, 0, true); for (i = 0; i < OPAL_PHB4_NUM_PEST_REGS; i++) { stat->pestA[i] = phb4_read_reg_asb(p, PHB_IODA_DATA0); stat->pestA[i] |= pPEST[2 * i]; } - val64 = PHB_IODA_AD_AUTOINC; - val64 = SETFIELD(PHB_IODA_AD_TSEL, val64, IODA3_TBL_PESTB); - phb4_write_reg_asb(p, PHB_IODA_ADDR, val64); + phb4_ioda_sel(p, IODA3_TBL_PESTB, 0, true); for (i = 0; i < OPAL_PHB4_NUM_PEST_REGS; i++) { stat->pestB[i] = phb4_read_reg_asb(p, PHB_IODA_DATA0); stat->pestB[i] |= pPEST[2 * i + 1]; From patchwork Mon Oct 23 10:22:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCD863XCz9t2m for ; Mon, 23 Oct 2017 21:23:36 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCD85CmTzDr28 for ; Mon, 23 Oct 2017 21:23:36 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBw0zrWzDqkH for ; Mon, 23 Oct 2017 21:22:32 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBv5M8hz9t5R; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id B9214EEA9EE; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:19 +1100 Message-Id: <20171023102222.25997-6-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 6/9] phb4: Enable PHB MMIO in phb4_root_port_init() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Linux EEH flow is somewhat broken. It saves the PCIe config space of the PHB on boot, which it then uses to restore on EEH recovery. It does this to restore MMIO bars and some other pieces. Unfortunately this save is done before any drivers are bound to devices under the PHB. A number of other things are configured in the PHB after drivers start, hence some configuration space settings aren't saved correctly. These include bus master and MMIO bits in the command register. Linux tried to hack around this in this linux commit bf898ec5cb powerpc/eeh: Enable PCI_COMMAND_MASTER for PCI bridges This sets the bus master bit but ignores the MMIO bit. Hence we lose MMIO after a full PHB reset. This causes the next MMIO access to the device to fail and for us to perform a PE freeze recovery, which still doesn't set the MMIO bit and hence we still fail. This works around this by forcing MMIO on during phb4_root_port_init(). With this we can recovery from a PHB fence event on POWER9. Signed-off-by: Michael Neuling --- v2: Move the hacking of MMIO bit from phb4_rc_write() to phb4_root_port_init() which is more palatable. It also better describes the problem. I'm still not super happy with this, but modulo rewriting our EEH stack, this works. --- hw/phb4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index b75cec0480..cb24188a42 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -139,7 +139,6 @@ static void phb4_init_hw(struct phb4 *p, bool first_init); #define PHBERR(p, fmt, a...) prlog(PR_ERR, "PHB#%04x[%d:%d]: " fmt, \ (p)->phb.opal_id, (p)->chip_id, \ (p)->index, ## a) - #ifdef LOG_CFG #define PHBLOGCFG(p, fmt, a...) PHBDBG(p, fmt, ## a) #else @@ -639,7 +638,8 @@ static void phb4_root_port_init(struct phb *phb, struct pci_device *dev, /* Enable SERR and parity checking */ pci_cfg_read16(phb, bdfn, PCI_CFG_CMD, &val16); - val16 |= (PCI_CFG_CMD_SERR_EN | PCI_CFG_CMD_PERR_RESP); + val16 |= (PCI_CFG_CMD_SERR_EN | PCI_CFG_CMD_PERR_RESP | + PCI_CFG_CMD_MEM_EN); pci_cfg_write16(phb, bdfn, PCI_CFG_CMD, val16); /* Enable reporting various errors */ From patchwork Mon Oct 23 10:22:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCDL2hT3z9t2h for ; Mon, 23 Oct 2017 21:23:46 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCDL1rTDzDr6D for ; Mon, 23 Oct 2017 21:23:46 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBw0spJzDqjm for ; Mon, 23 Oct 2017 21:22:32 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBv5M9Fz9t5b; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id C0656EEA9EF; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:20 +1100 Message-Id: <20171023102222.25997-7-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 7/9] phb4: Update some init registers X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" New inits based on next PHB4 workbook. Increases some timeouts to avoid some spurious error conditions. Signed-off-by: Michael Neuling --- hw/phb4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index cb24188a42..78e536bb18 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -3621,7 +3621,7 @@ static void phb4_init_capp_regs(struct phb4 *p) static void phb4_init_capp_errors(struct phb4 *p) { /* Init_77: TXE Error AIB Fence Enable Register */ - out_be64(p->regs + 0x0d30, 0xdff7ff0bf7ddfff0ull); + out_be64(p->regs + 0x0d30, 0xdff7bf0bf7ddfff0ull); /* Init_86: RXE_ARB Error AIB Fence Enable Register */ out_be64(p->regs + 0x0db0, 0xfbffd7bbfb7fbfefull); @@ -4194,7 +4194,7 @@ static void phb4_init_errors(struct phb4 *p) out_be64(p->regs + 0x0d08, 0x0000000000000000ull); out_be64(p->regs + 0x0d18, 0xffffff0fffffffffull); out_be64(p->regs + 0x0d28, 0x0000400a00000000ull); - out_be64(p->regs + 0x0d30, 0xdff7fd01f7ddfff0ull); /* XXX CAPI has diff. value */ + out_be64(p->regs + 0x0d30, 0xdff7fb01f7ddfff0ull); /* XXX CAPI has diff. value */ out_be64(p->regs + 0x0d40, 0x0000000000000000ull); out_be64(p->regs + 0x0d48, 0x0000000000000000ull); out_be64(p->regs + 0x0d50, 0x0000000000000000ull); @@ -4442,7 +4442,7 @@ static void phb4_init_hw(struct phb4 *p, bool first_init) out_be64(p->regs + PHB_TCE_SPEC_CTL, 0x0000000000000000ull); /* Init_133 - Timeout Control Register 1 */ - out_be64(p->regs + PHB_TIMEOUT_CTRL1, 0x0018150000200000ull); + out_be64(p->regs + PHB_TIMEOUT_CTRL1, 0x0018150000160000ull); /* Init_134 - Timeout Control Register 2 */ out_be64(p->regs + PHB_TIMEOUT_CTRL2, 0x0000181700000000ull); From patchwork Mon Oct 23 10:22:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCDg3G0Mz9t2h for ; Mon, 23 Oct 2017 21:24:03 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCDg2PBJzDqjP for ; Mon, 23 Oct 2017 21:24:03 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBw0nHlzDqjP for ; Mon, 23 Oct 2017 21:22:32 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBv5MV0z9t6B; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id C4F41EEA9F0; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:21 +1100 Message-Id: <20171023102222.25997-8-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 8/9] phb4: Move code to find frozen PE earlier X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We are going to reuse this so move it earlier. No functional change Signed-off-by: Michael Neuling --- hw/phb4.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 78e536bb18..b3dc4da72e 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -3189,6 +3189,19 @@ static int64_t phb4_eeh_next_error(struct phb *phb, * for the case. */ if (p->err.err_class == PHB4_ERR_CLASS_ER) { + for (i = peev_size - 1; i >= 0; i--) { + phb4_ioda_sel(p, IODA3_TBL_PEEV, i, false); + peev = in_be64(p->regs + PHB_IODA_DATA0); + for (j = 0; j < 64; j++) { + if (peev & PPC_BIT(j)) { + *first_frozen_pe = i * 64 + j; + break; + } + } + if (*first_frozen_pe != (uint64_t)(-1)) + break; + } + } switch (p->err.err_class) { @@ -3204,20 +3217,6 @@ static int64_t phb4_eeh_next_error(struct phb *phb, *pci_error_type = OPAL_EEH_PE_ERROR; *severity = OPAL_EEH_SEV_PE_ER; - for (i = peev_size - 1; i >= 0; i--) { - phb4_ioda_sel(p, IODA3_TBL_PEEV, i, false); - peev = in_be64(p->regs + PHB_IODA_DATA0); - for (j = 0; j < 64; j++) { - if (peev & PPC_BIT(j)) { - *first_frozen_pe = i * 64 + j; - break; - } - } - - if (*first_frozen_pe != (uint64_t)(-1)) - break; - } - /* No frozen PE ? */ if (*first_frozen_pe == (uint64_t)-1) { *pci_error_type = OPAL_EEH_NO_ERROR; From patchwork Mon Oct 23 10:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 829218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLCDV4Mx7z9t2h for ; Mon, 23 Oct 2017 21:23:54 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLCDV350bzDrCy for ; Mon, 23 Oct 2017 21:23:54 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLCBw0rBgzDqjk for ; Mon, 23 Oct 2017 21:22:32 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3yLCBv5MT6z9t5s; Mon, 23 Oct 2017 21:22:31 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id C83DCEEA9F1; Mon, 23 Oct 2017 21:22:30 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Mon, 23 Oct 2017 21:22:22 +1100 Message-Id: <20171023102222.25997-9-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171023102222.25997-1-mikey@neuling.org> References: <20171023102222.25997-1-mikey@neuling.org> Subject: [Skiboot] [PATCH v2 9/9] phb4: Escalate freeze to fence to avoid checkstop X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Freeze events such as MMIO loads can cause the PHB to lose it's limited powerbus credits. If all credits are used and a further MMIO will cause a checkstop. To work around this, we escalate the troublesome freeze events to a fence. The fence will cause a full PHB reset which resets the powerbus credits and avoids the checkstop. Signed-off-by: Michael Neuling --- hw/phb4.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------ include/phb4-regs.h | 4 ++++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index b3dc4da72e..ce2ae99085 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -2973,6 +2973,29 @@ static struct pci_slot *phb4_slot_create(struct phb *phb) return slot; } +static uint64_t phb4_get_pesta(struct phb4 *p, uint64_t pe_number) +{ + uint64_t pesta, *pPEST; + + pPEST = (uint64_t *)p->tbl_pest; + + phb4_ioda_sel(p, IODA3_TBL_PESTA, pe_number, false); + pesta = phb4_read_reg(p, PHB_IODA_DATA0); + if (pesta & IODA3_PESTA_MMIO_FROZEN) + pesta |= pPEST[2*pe_number]; + + return pesta; +} + +static bool phb4_freeze_escalate(uint64_t pesta) +{ + if ((GETFIELD(IODA3_PESTA_TRANS_TYPE, pesta) == + IODA3_PESTA_TRANS_TYPE_MMIOLOAD) && + (pesta & (IODA3_PESTA_CA_CMPLT_TMT | IODA3_PESTA_UR))) + return true; + return false; +} + static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, uint8_t *freeze_state, uint16_t *pci_error_type, @@ -3016,13 +3039,21 @@ static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, if (severity) *severity = OPAL_EEH_SEV_PE_ER; - /* Read the PESTA & PESTB */ - phb4_ioda_sel(p, IODA3_TBL_PESTA, pe_number, false); - pesta = in_be64(p->regs + PHB_IODA_DATA0); + /* Read the full PESTA */ + pesta = phb4_get_pesta(p, pe_number); + /* Check if we need to escalate to fence */ + if (phb4_freeze_escalate(pesta)) { + PHBERR(p, "Escalating freeze to fence PESTA[%lli]=%016llx\n", + pe_number, pesta); + *severity = OPAL_EEH_SEV_PHB_FENCED; + *pci_error_type = OPAL_EEH_PHB_ERROR; + } + + /* Read the PESTB in the PHB */ phb4_ioda_sel(p, IODA3_TBL_PESTB, pe_number, false); - pestb = in_be64(p->regs + PHB_IODA_DATA0); + pestb = phb4_read_reg(p, PHB_IODA_DATA0); - /* Convert them */ + /* Convert PESTA/B to freeze_state */ if (pesta & IODA3_PESTA_MMIO_FROZEN) *freeze_state |= OPAL_EEH_STOPPED_MMIO_FREEZE; if (pestb & IODA3_PESTB_DMA_STOPPED) @@ -3134,7 +3165,7 @@ static int64_t phb4_eeh_next_error(struct phb *phb, uint16_t *severity) { struct phb4 *p = phb_to_phb4(phb); - uint64_t peev; + uint64_t peev, pesta; uint32_t peev_size = p->num_pes/64; int32_t i, j; @@ -3201,7 +3232,15 @@ static int64_t phb4_eeh_next_error(struct phb *phb, if (*first_frozen_pe != (uint64_t)(-1)) break; } + } + if (*first_frozen_pe != (uint64_t)(-1)) { + pesta = phb4_get_pesta(p, *first_frozen_pe); + if (phb4_freeze_escalate(pesta)) { + PHBINF(p, "Escalating freeze to fence. PESTA[%lli]=%016llx\n", + *first_frozen_pe, pesta); + p->err.err_class = PHB4_ERR_CLASS_FENCED; + } } switch (p->err.err_class) { diff --git a/include/phb4-regs.h b/include/phb4-regs.h index e83c8c391d..0d8aa48bef 100644 --- a/include/phb4-regs.h +++ b/include/phb4-regs.h @@ -435,6 +435,10 @@ /* PESTA */ #define IODA3_PESTA_MMIO_FROZEN PPC_BIT(0) +#define IODA3_PESTA_TRANS_TYPE PPC_BITMASK(5,7) +#define IODA3_PESTA_TRANS_TYPE_MMIOLOAD 0x4 +#define IODA3_PESTA_CA_CMPLT_TMT PPC_BIT(8) +#define IODA3_PESTA_UR PPC_BIT(9) /* PESTB */ #define IODA3_PESTB_DMA_STOPPED PPC_BIT(0)