From patchwork Fri Nov 23 08:54:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Barrat X-Patchwork-Id: 1002196 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 431VW34L8nz9ryk for ; Fri, 23 Nov 2018 19:54:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 431VW30szWzDqW3 for ; Fri, 23 Nov 2018 19:54:55 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=fbarrat@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 431VVv4rhVzDqVx for ; Fri, 23 Nov 2018 19:54:47 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAN8s8tt089600 for ; Fri, 23 Nov 2018 03:54:44 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nxdnhsy8y-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 23 Nov 2018 03:54:44 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Nov 2018 08:54:42 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 23 Nov 2018 08:54:41 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAN8sdZG62652660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Nov 2018 08:54:39 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B00E711C05E; Fri, 23 Nov 2018 08:54:39 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8740911C054; Fri, 23 Nov 2018 08:54:39 +0000 (GMT) Received: from borneo.home (unknown [9.145.4.55]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 23 Nov 2018 08:54:39 +0000 (GMT) From: Frederic Barrat To: andrew.donnellan@au1.ibm.com, skiboot@lists.ozlabs.org Date: Fri, 23 Nov 2018 09:54:37 +0100 X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18112308-0016-0000-0000-0000022B82D5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112308-0017-0000-0000-00003283CC83 Message-Id: <20181123085439.5697-1-fbarrat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-23_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811230071 Subject: [Skiboot] [PATCH 1/3] npu2-opencapi: Log extra information on link training failure X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Log the link training status register in case of failure to train. It can have useful information for the hardware team. Signed-off-by: Frederic Barrat Reviewed-by: Andrew Donnellan --- hw/npu2-opencapi.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c index 8c4f3462..c771fae8 100644 --- a/hw/npu2-opencapi.c +++ b/hw/npu2-opencapi.c @@ -150,6 +150,30 @@ static uint64_t get_odl_status(uint32_t gcid, uint64_t index) { return reg; } +static uint64_t get_odl_training_status(uint32_t gcid, uint64_t index) +{ + uint64_t status_xscom, reg; + + switch (index) { + case 2: + status_xscom = OB0_ODL0_TRAINING_STATUS; + break; + case 3: + status_xscom = OB0_ODL1_TRAINING_STATUS; + break; + case 4: + status_xscom = OB3_ODL1_TRAINING_STATUS; + break; + case 5: + status_xscom = OB3_ODL0_TRAINING_STATUS; + break; + default: + assert(false); + } + xscom_read(gcid, status_xscom, ®); + return reg; +} + static void disable_nvlink(uint32_t gcid, int index) { uint64_t phy_config_scom, reg; @@ -1017,7 +1041,8 @@ static int64_t npu2_opencapi_get_link_state(struct pci_slot *slot, uint8_t *val) return rc; } -static int64_t npu2_opencapi_retry_state(struct pci_slot *slot) +static int64_t npu2_opencapi_retry_state(struct pci_slot *slot, + uint64_t odl_status) { struct npu2_dev *dev = phb_to_npu2_dev_ocapi(slot->phb); uint32_t chip_id = dev->npu->chip_id; @@ -1031,11 +1056,17 @@ static int64_t npu2_opencapi_retry_state(struct pci_slot *slot) */ OCAPIERR(dev, "Link failed to train, final link status: %016llx\n", - get_odl_status(chip_id, dev->brick_index)); + odl_status); + OCAPIDBG(dev, "Final link training status: %016llx\n", + get_odl_training_status(chip_id, dev->brick_index)); return OPAL_HARDWARE; } OCAPIERR(dev, "Link failed to train, retrying\n"); + OCAPIDBG(dev, "Link status: %016llx, training status: %016llx\n", + odl_status, + get_odl_training_status(chip_id, dev->brick_index)); + pci_slot_set_state(slot, OCAPI_SLOT_FRESET_INIT); return pci_slot_set_sm_timeout(slot, msecs_to_tb(1)); } @@ -1062,7 +1093,7 @@ static int64_t npu2_opencapi_poll_link(struct pci_slot *slot) return pci_slot_set_sm_timeout(slot, msecs_to_tb(1)); } if (slot->retries-- == 0) - return npu2_opencapi_retry_state(slot); + return npu2_opencapi_retry_state(slot, reg); return pci_slot_set_sm_timeout(slot, msecs_to_tb(1)); From patchwork Fri Nov 23 08:54:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Barrat X-Patchwork-Id: 1002197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 431VWQ6Sdfz9ryk for ; Fri, 23 Nov 2018 19:55:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 431VWQ4dYszDqW5 for ; Fri, 23 Nov 2018 19:55:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=fbarrat@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 431VVx5plszDqVx for ; Fri, 23 Nov 2018 19:54:49 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAN8s97q041900 for ; Fri, 23 Nov 2018 03:54:47 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nxdc4arnu-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 23 Nov 2018 03:54:46 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Nov 2018 08:54:44 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 23 Nov 2018 08:54:42 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAN8sfD45177830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Nov 2018 08:54:41 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01D5111C054; Fri, 23 Nov 2018 08:54:41 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCEDA11C052; Fri, 23 Nov 2018 08:54:40 +0000 (GMT) Received: from borneo.home (unknown [9.145.4.55]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 23 Nov 2018 08:54:40 +0000 (GMT) From: Frederic Barrat To: andrew.donnellan@au1.ibm.com, skiboot@lists.ozlabs.org Date: Fri, 23 Nov 2018 09:54:38 +0100 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123085439.5697-1-fbarrat@linux.ibm.com> References: <20181123085439.5697-1-fbarrat@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18112308-0016-0000-0000-0000022B82D7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112308-0017-0000-0000-00003283CC85 Message-Id: <20181123085439.5697-2-fbarrat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-23_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=924 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811230071 Subject: [Skiboot] [PATCH 2/3] npu2-opencapi: Detect if link trained in degraded mode X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" There's no status readily available to tell the effective link width. Instead, we have to look at the individual status of each lane, on the transmit and receive direction. All relevant information is in the ODL status register. Signed-off-by: Frederic Barrat Reviewed-by: Andrew Donnellan --- hw/npu2-opencapi.c | 50 ++++++++++++++++++++++++++++----------------- include/npu2-regs.h | 2 ++ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c index c771fae8..da86b46c 100644 --- a/hw/npu2-opencapi.c +++ b/hw/npu2-opencapi.c @@ -1013,32 +1013,43 @@ static int64_t npu2_opencapi_get_presence_state(struct pci_slot __unused *slot, return OPAL_SUCCESS; } +static enum OpalShpcLinkState get_link_width(uint64_t odl_status) +{ + uint64_t tx_lanes, rx_lanes, state; + + /* + * On P9, the 'trained mode' field of the ODL status is + * hard-coded to x8 and is useless for us. We need to look at + * the status of the individual lanes. + * The link trains at x8, x4 or not at all. + */ + state = GETFIELD(OB_ODL_STATUS_TRAINING_STATE_MACHINE, odl_status); + if (state != OCAPI_LINK_STATE_TRAINED) + return OPAL_SHPC_LINK_DOWN; + + rx_lanes = GETFIELD(OB_ODL_STATUS_RX_TRAINED_LANES, odl_status); + tx_lanes = GETFIELD(OB_ODL_STATUS_TX_TRAINED_LANES, odl_status); + if ((rx_lanes != 0xFF) || (tx_lanes != 0xFF)) + return OPAL_SHPC_LINK_UP_x4; + else + return OPAL_SHPC_LINK_UP_x8; +} + static int64_t npu2_opencapi_get_link_state(struct pci_slot *slot, uint8_t *val) { struct npu2_dev *dev = phb_to_npu2_dev_ocapi(slot->phb); uint64_t reg; - int64_t link_width, training_status, rc = OPAL_SUCCESS; reg = get_odl_status(dev->npu->chip_id, dev->brick_index); - link_width = GETFIELD(OB_ODL_STATUS_TRAINED_MODE, reg); - training_status = GETFIELD(OB_ODL_STATUS_TRAINING_STATE_MACHINE, reg); - - if (training_status != OCAPI_LINK_STATE_TRAINED) { - *val = OPAL_SHPC_LINK_DOWN; - return OPAL_SUCCESS; - } + *val = get_link_width(reg); + return OPAL_SUCCESS; +} - switch (link_width) { - case 0b0001: - *val = OPAL_SHPC_LINK_UP_x4; - break; - case 0b0010: - *val = OPAL_SHPC_LINK_UP_x8; - break; - default: - rc = OPAL_HARDWARE; - } - return rc; +static void check_trained_link(struct npu2_dev *dev, uint64_t odl_status) +{ + if (get_link_width(odl_status) != OPAL_SHPC_LINK_UP_x8) + OCAPIERR(dev, "Link trained in degraded mode (%016llx)\n", + odl_status); } static int64_t npu2_opencapi_retry_state(struct pci_slot *slot, @@ -1089,6 +1100,7 @@ static int64_t npu2_opencapi_poll_link(struct pci_slot *slot) OCAPI_LINK_STATE_TRAINED) { OCAPIINF(dev, "link trained in %lld ms\n", OCAPI_LINK_TRAINING_TIMEOUT - slot->retries); + check_trained_link(dev, reg); pci_slot_set_state(slot, OCAPI_SLOT_LINK_TRAINED); return pci_slot_set_sm_timeout(slot, msecs_to_tb(1)); } diff --git a/include/npu2-regs.h b/include/npu2-regs.h index 165e0b79..c5096dd1 100644 --- a/include/npu2-regs.h +++ b/include/npu2-regs.h @@ -741,6 +741,8 @@ void npu2_scom_write(uint64_t gcid, uint64_t scom_base, #define OB3_ODL0_STATUS 0xC01082C #define OB3_ODL1_STATUS 0xC01082D #define OB_ODL_STATUS_TRAINED_MODE PPC_BITMASK(0,3) +#define OB_ODL_STATUS_RX_TRAINED_LANES PPC_BITMASK(16, 23) +#define OB_ODL_STATUS_TX_TRAINED_LANES PPC_BITMASK(24, 31) #define OB_ODL_STATUS_TRAINING_STATE_MACHINE PPC_BITMASK(49, 51) #define OB0_ODL0_TRAINING_STATUS 0x901082E From patchwork Fri Nov 23 08:54:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Barrat X-Patchwork-Id: 1002198 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 431VWm1x6Sz9ryk for ; Fri, 23 Nov 2018 19:55:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 431VWl71wjzDqW2 for ; Fri, 23 Nov 2018 19:55:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=fbarrat@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 431VVz1mcwzDqVv for ; Fri, 23 Nov 2018 19:54:51 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAN8s8vw089577 for ; Fri, 23 Nov 2018 03:54:49 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nxdnhsyce-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 23 Nov 2018 03:54:48 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Nov 2018 08:54:46 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 23 Nov 2018 08:54:43 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAN8sgqp5243230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Nov 2018 08:54:42 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 464D511C05E; Fri, 23 Nov 2018 08:54:42 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D99C11C052; Fri, 23 Nov 2018 08:54:42 +0000 (GMT) Received: from borneo.home (unknown [9.145.4.55]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 23 Nov 2018 08:54:42 +0000 (GMT) From: Frederic Barrat To: andrew.donnellan@au1.ibm.com, skiboot@lists.ozlabs.org Date: Fri, 23 Nov 2018 09:54:39 +0100 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123085439.5697-1-fbarrat@linux.ibm.com> References: <20181123085439.5697-1-fbarrat@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18112308-0028-0000-0000-0000031F4EF6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112308-0029-0000-0000-000023DB5EF0 Message-Id: <20181123085439.5697-3-fbarrat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-23_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=871 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811230071 Subject: [Skiboot] [PATCH 3/3] npu2-opencapi: Log ODL endpoint information register X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" If the link trains in degraded mode, log the ODL endpoint information register for debug. Its content is specific to the DLx and TLx implementation, so this is really information useful for the hardware team. Signed-off-by: Frederic Barrat Reviewed-by: Andrew Donnellan --- hw/npu2-opencapi.c | 29 ++++++++++++++++++++++++++++- include/npu2-regs.h | 5 +++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c index da86b46c..65f623c7 100644 --- a/hw/npu2-opencapi.c +++ b/hw/npu2-opencapi.c @@ -174,6 +174,30 @@ static uint64_t get_odl_training_status(uint32_t gcid, uint64_t index) return reg; } +static uint64_t get_odl_endpoint_info(uint32_t gcid, uint64_t index) +{ + uint64_t status_xscom, reg; + + switch (index) { + case 2: + status_xscom = OB0_ODL0_ENDPOINT_INFO; + break; + case 3: + status_xscom = OB0_ODL1_ENDPOINT_INFO; + break; + case 4: + status_xscom = OB3_ODL1_ENDPOINT_INFO; + break; + case 5: + status_xscom = OB3_ODL0_ENDPOINT_INFO; + break; + default: + assert(false); + } + xscom_read(gcid, status_xscom, ®); + return reg; +} + static void disable_nvlink(uint32_t gcid, int index) { uint64_t phy_config_scom, reg; @@ -1047,9 +1071,12 @@ static int64_t npu2_opencapi_get_link_state(struct pci_slot *slot, uint8_t *val) static void check_trained_link(struct npu2_dev *dev, uint64_t odl_status) { - if (get_link_width(odl_status) != OPAL_SHPC_LINK_UP_x8) + if (get_link_width(odl_status) != OPAL_SHPC_LINK_UP_x8) { OCAPIERR(dev, "Link trained in degraded mode (%016llx)\n", odl_status); + OCAPIDBG(dev, "Link endpoint info: %016llx\n", + get_odl_endpoint_info(dev->npu->chip_id, dev->brick_index)); + } } static int64_t npu2_opencapi_retry_state(struct pci_slot *slot, diff --git a/include/npu2-regs.h b/include/npu2-regs.h index c5096dd1..10a28166 100644 --- a/include/npu2-regs.h +++ b/include/npu2-regs.h @@ -751,4 +751,9 @@ void npu2_scom_write(uint64_t gcid, uint64_t scom_base, #define OB3_ODL1_TRAINING_STATUS 0xC01082F #define OB_ODL_TRAINING_STATUS_STS_RX_PATTERN_B PPC_BITMASK(8, 15) +#define OB0_ODL0_ENDPOINT_INFO 0x9010832 +#define OB0_ODL1_ENDPOINT_INFO 0x9010833 +#define OB3_ODL0_ENDPOINT_INFO 0xC010832 +#define OB3_ODL1_ENDPOINT_INFO 0xC010833 + #endif /* __NPU2_REGS_H */