From patchwork Thu Aug 10 21:11:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Grimm X-Patchwork-Id: 1820045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=YH+q5r+k; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RMKPP71y5z1yf7 for ; Fri, 11 Aug 2023 07:12:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=YH+q5r+k; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RMKPM4S2nz2ym1 for ; Fri, 11 Aug 2023 07:12:07 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=YH+q5r+k; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=grimm@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-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 4RMKPF1Fw4z2yLV for ; Fri, 11 Aug 2023 07:12:00 +1000 (AEST) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37AL9RBK001595 for ; Thu, 10 Aug 2023 21:11:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=xJ7M6+75plsjWXtmKPkMwpQnRDLDPpYALadhnbvdDdg=; b=YH+q5r+kn0GRumRvWmvBdTqGXTOM0e6m+er9zenhMOUqEi5zoC6Ukbj35cQUQzDseGJa sPtQx0hozEboRHH043m9kG9U4tUuTIx+B7rviPF9Jt1KEYIozzsKxg2C+7Pv0O/ludvn XRtOsHlCZ0+52BKAG3BmJsRFd6L1ZB0I1BBEHfN6HLkiMM+HJ+o6n2uz+j47hs7lz66h IUof66uAg8vGkQTtfwZiGKpBIa96XSdcOe99X/5x7MAAFQfnCvFxM0Yq8w9i8+CtR3gs ITPUDyZFyrBoB/0oXBK7LF7+4QQf1xDG+Lp3D8odzgiuzc1eSosVKz5cPmQot4oAj9KA eg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sd78k0k37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Aug 2023 21:11:56 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 37AKU8Nr030361 for ; Thu, 10 Aug 2023 21:11:55 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa1rnw4np-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Aug 2023 21:11:55 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 37ALBspu18678296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Aug 2023 21:11:54 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A736A58043; Thu, 10 Aug 2023 21:11:54 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 795A158059; Thu, 10 Aug 2023 21:11:54 +0000 (GMT) Received: from alain.ibmuc.com (unknown [9.61.57.20]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 10 Aug 2023 21:11:54 +0000 (GMT) From: Ryan Grimm To: skiboot@lists.ozlabs.org Date: Thu, 10 Aug 2023 17:11:49 -0400 Message-Id: <20230810211149.428158-1-grimm@linux.ibm.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: cd6Hdmq8kalT_oCDhUpSwvfhz5UXtEt4 X-Proofpoint-GUID: cd6Hdmq8kalT_oCDhUpSwvfhz5UXtEt4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_16,2023-08-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308100181 Subject: [Skiboot] [PATCH] hw/imc: Detect BML and fix core counters 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: Ryan Grimm Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" On systems running BML we started noticing this in the skiboot log: [ 409.088819302,3] XSCOM: write error gcid=0x0 pcb_addr=0x20000060 stat=0x4 [ 409.088823446,3] ELOG: Error getting buffer to log error [ 409.088824806,3] XSCOM: Write failed, ret = -26 [ 409.088825797,3] IMC: error in xscom_write for pdbar [ 0.468976][ T19] core_imc memory allocation for cpu 0 failed [ 0.468993][ T1] IMC PMU core_imc Register failed I tracked down that bad pcb_addr to this line in the code: pdbar_addr = get_imc_scom_addr_for_quad(phys_core_id, pdbar_scom_index[port_id]); I found that pdbar_scom_index was not initialized because, like mambo, we don't have the IMC catalog in memory. So, in imc_init we error out and never initialize it in setup_imc_scoms. This patch adds a chip quirk QUIRK_BML because it seems like a reasonable thing to do and it's easy to put a BML {}; in the device tree like Mambo, Awan, etc. It is tested on a Rainier and errors are gone and /sys/devices/core_imc shows up as expected. Signed-off-by: Ryan Grimm --- core/chip.c | 4 ++++ hw/imc.c | 10 +++++----- include/chip.h | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/chip.c b/core/chip.c index cee65822..0e96e625 100644 --- a/core/chip.c +++ b/core/chip.c @@ -190,6 +190,10 @@ void init_chips(void) proc_chip_quirks |= QUIRK_QEMU | QUIRK_NO_DIRECT_CTL | QUIRK_NO_RNG; prlog(PR_NOTICE, "CHIP: Detected QEMU simulator\n"); } + if (dt_find_by_path(dt_root, "/bml")) { + proc_chip_quirks |= QUIRK_BML; + prlog(PR_NOTICE, "CHIP: Detected BML\n"); + } /* We walk the chips based on xscom nodes in the tree */ dt_for_each_compatible(dt_root, xn, "ibm,xscom") { diff --git a/hw/imc.c b/hw/imc.c index 97e0809f..dc3a59ae 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -475,7 +475,7 @@ void imc_catalog_preload(void) int ret = OPAL_SUCCESS; compress_buf_size = MAX_COMPRESSED_IMC_DTB_SIZE; - if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) + if (proc_chip_quirks & (QUIRK_MAMBO_CALLOUTS | QUIRK_BML)) return; /* Enable only for power 9/10 */ @@ -613,13 +613,13 @@ void imc_init(void) struct dt_node *dev; int err_flag = -1; - if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) { + if ((proc_chip_quirks & (QUIRK_MAMBO_CALLOUTS) || QUIRK_BML)) { dev = dt_find_compatible_node(dt_root, NULL, "ibm,opal-in-memory-counters"); if (!dev) return; - goto imc_mambo; + goto imc_mambo_bml; } /* Enable only for power 9/10 */ @@ -662,7 +662,7 @@ void imc_init(void) goto err; } -imc_mambo: +imc_mambo_bml: if (setup_imc_scoms()) { prerror("IMC: Failed to setup the scoms\n"); goto err; @@ -683,7 +683,7 @@ imc_mambo: /* Update the base_addr and chip-id for nest nodes */ imc_dt_update_nest_node(dev); - if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) + if (proc_chip_quirks & (QUIRK_MAMBO_CALLOUTS | QUIRK_BML)) return; /* diff --git a/include/chip.h b/include/chip.h index cfa5ce35..c90b8a7f 100644 --- a/include/chip.h +++ b/include/chip.h @@ -187,6 +187,7 @@ enum proc_chip_quirks { QUIRK_NO_RNG = 0x00000100, QUIRK_QEMU = 0x00000200, QUIRK_AWAN = 0x00000400, + QUIRK_BML = 0x00000800, }; extern enum proc_chip_quirks proc_chip_quirks;