From patchwork Wed Jan 24 03:44:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 865155 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 3zR9zk2V45z9s7F for ; Wed, 24 Jan 2018 14:45:22 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zR9zk13WmzDr3K for ; Wed, 24 Jan 2018 14:45:22 +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 3zR9zJ5QS8zDr1n for ; Wed, 24 Jan 2018 14:45:00 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 3zR9zJ3JPNz9s7n; Wed, 24 Jan 2018 14:45:00 +1100 (AEDT) From: Alistair Popple To: skiboot@lists.ozlabs.org Date: Wed, 24 Jan 2018 14:44:58 +1100 Message-Id: <20180124034458.12027-2-alistair@popple.id.au> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180124034458.12027-1-alistair@popple.id.au> References: <20180124034458.12027-1-alistair@popple.id.au> Subject: [Skiboot] [PATCH 2/2] npu2-hw-procedures.c: Correct phy lane mapping X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arbab@linux.vnet.ibm.com, Alistair Popple , andrew.donnellan@au1.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Each nvlink device is associated with a particular group of OBUS lanes via a lane mask which is read from HDAT via the device-tree. However Skiboot's interpretation of lane mask was different to what is exported from the HDAT. Specifically the lane mask bits in the HDAT are encoded in IBM bit ordering for a 24-bit wide value. So for example in normal bit ordering lane-0 is represented by having lane-mask bit 23 set and lane-23 is represented by lane-mask bit 0. This patch alters the Skiboot interpretation to match what is passed from HDAT. Signed-off-by: Alistair Popple Reviewed-by: Frederic Barrat Reviewed-by: Reza Arbab Reviewed-by: Andrew Donnellan --- hw/npu2-hw-procedures.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c index a43952d7..b21c399d 100644 --- a/hw/npu2-hw-procedures.c +++ b/hw/npu2-hw-procedures.c @@ -102,12 +102,12 @@ struct npu2_phy_reg NPU2_PHY_RX_CTL_DATASM_CLKDIST_PDWN = {0x2e0, 60, 1}; #define NPU2_PHY_REG(scom_base, reg, lane) \ SETFIELD(PPC_BITMASK(27, 31), ((reg)->offset << 42) | scom_base, lane) -#define NPU2_MAX_PHY_LANES 24 +#define NPU2_MAX_PHY_LANE 23 /* This is a bit of a gross hack but it does the job */ #define FOR_EACH_LANE(ndev, lane) \ - for (lane = 0; lane < NPU2_MAX_PHY_LANES; lane++) \ - if (!(ndev->lane_mask & (1 << lane))) \ + for (lane = 0; lane <= NPU2_MAX_PHY_LANE; lane++) \ + if (!(ndev->lane_mask & (1 << (NPU2_MAX_PHY_LANE - lane)))) \ continue; \ else