From patchwork Mon Jul 8 21:07:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reza Arbab X-Patchwork-Id: 1129354 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) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45jJ3b3C2Mz9sP7 for ; Tue, 9 Jul 2019 07:09:15 +1000 (AEST) 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 45jJ3b2KP1zDqMm for ; Tue, 9 Jul 2019 07:09:15 +1000 (AEST) 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=arbab@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 45jJ2D5blPzDqLN for ; Tue, 9 Jul 2019 07:08:04 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x68L7vWg083280 for ; Mon, 8 Jul 2019 17:08:02 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tmbg5ku1n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 08 Jul 2019 17:07:58 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Jul 2019 22:07:25 +0100 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 8 Jul 2019 22:07:21 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x68L7KCS49414522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jul 2019 21:07:20 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8101112063; Mon, 8 Jul 2019 21:07:20 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC3EF112066; Mon, 8 Jul 2019 21:07:20 +0000 (GMT) Received: from arbab-laptop.localdomain (unknown [9.53.179.210]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 8 Jul 2019 21:07:20 +0000 (GMT) Received: by arbab-laptop.localdomain (Postfix, from userid 152845) id E8A3246538F; Mon, 8 Jul 2019 16:07:18 -0500 (CDT) From: Reza Arbab To: skiboot@lists.ozlabs.org Date: Mon, 8 Jul 2019 16:07:16 -0500 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1562620038-7017-1-git-send-email-arbab@linux.ibm.com> References: <1562620038-7017-1-git-send-email-arbab@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19070821-0060-0000-0000-0000035A70B7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011397; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01229372; UDB=6.00647449; IPR=6.01010631; MB=3.00027640; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-08 21:07:24 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070821-0061-0000-0000-00004A0FA39A Message-Id: <1562620038-7017-7-git-send-email-arbab@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-08_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 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-1907080264 Subject: [Skiboot] [PATCH v2 6/8] npu2: Add checks to npu2-only codepaths 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: , Cc: Michael Neuling , Andrew Donnellan , Alistair Popple , Christophe Lombard MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" To prepare for npu3, add a few checks in codepaths that are only for npu2. Compare against PVR_TYPE_P9, as npu3 will be in systems of PVR_TYPE_P9P (or greater). Alternatively, check for dt compatibility with "ibm,power9-npu" because npu3 will use "ibm,power9-npu3". Signed-off-by: Reza Arbab Reviewed-by: Andrew Donnellan --- core/hmi.c | 4 ++++ hdata/spira.c | 6 +++--- hw/npu2-common.c | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/hmi.c b/core/hmi.c index 5cde67138109..2202bfba9ca2 100644 --- a/core/hmi.c +++ b/core/hmi.c @@ -636,6 +636,10 @@ static void find_npu2_checkstop_reason(int flat_chip_id, int total_errors = 0; const char *loc; + /* NPU2 only */ + if (PVR_TYPE(mfspr(SPR_PVR)) != PVR_TYPE_P9) + return; + /* Find the NPU on the chip associated with the HMI. */ for_each_phb(phb) { /* NOTE: if a chip ever has >1 NPU this will need adjusting */ diff --git a/hdata/spira.c b/hdata/spira.c index 6891a9c71bdf..804d90da34a1 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1506,7 +1506,8 @@ static void add_npus(void) int phb_index = 7; /* Start counting from 7, for no reason */ int npu_index = 0; - if (proc_gen < proc_gen_p9) + /* Only consult HDAT for npu2 */ + if (cpu_type != PVR_TYPE_P9) return; dt_for_each_compatible(dt_root, xscom, "ibm,xscom") { @@ -1633,8 +1634,7 @@ int parse_hdat(bool is_opal) io_parse(); /* Add NPU nodes */ - if (proc_gen >= proc_gen_p9) - add_npus(); + add_npus(); /* Parse VPD */ vpd_parse(); diff --git a/hw/npu2-common.c b/hw/npu2-common.c index f3f2f45a10d4..776030759693 100644 --- a/hw/npu2-common.c +++ b/hw/npu2-common.c @@ -654,6 +654,10 @@ void probe_npu2(void) struct dt_node *np; const char *zcal; + /* npu2 only */ + if (!dt_find_compatible_node(dt_root, NULL, "ibm,power9-npu")) + return; + /* Abort if we're running on POWER9C DD1 (P9N DD1 is not supported) */ if (chip && chip->type == PROC_CHIP_P9_CUMULUS &&