From patchwork Fri Feb 9 17:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 199031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp999054dyd; Fri, 9 Feb 2024 09:13:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQfogQm2p420hK0g5o2TBWkyYqX9GS0OqGk2nbAUkZ0bCA4B1JF2GMnf3YT4cynKkpOh3V X-Received: by 2002:a17:907:d14:b0:a38:70d9:8482 with SMTP id gn20-20020a1709070d1400b00a3870d98482mr1830977ejc.27.1707498807481; Fri, 09 Feb 2024 09:13:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707498807; cv=pass; d=google.com; s=arc-20160816; b=XpnMwO3lg+x9932pZnQqllkDOLZ8QlB93l1tC4959QJkJwVPnAB17Doamtreaj5S2T 3Nun7knjQ79YAdTg22lfd4pf+ygAqCU/AAgw8pS+lhB1roT29Y93qUMEtYjML+F1siMo LKgnujpi1mvJQ8QzbyyjRdpQ0rX4eiZrqW//kb5xn0pUVGRX32bsU1AqmOBRiDcm+ARg 0chAoyhbhcHE+ZBSiNPFtZD+XPiMyqhG33CRxV8UvkZdMIGffO4KNS6B1nFuHzqXc/yx ANKP0ry1mryUNt743rdzZ7NmOzurzheYHvr/iqiqoNC7APPrrSprWA6aTLgosBnUnwhf uFWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=0Qn+4LOAVuEyY1d3tZ2EaitrPQv5WeQ2ieE/uwlJGNg=; fh=d6xAZeZr3B9eWJqX7xhlqoZgBqd/IvIgUnkkMi/iS9I=; b=iwGczx6hvjz86i/vbRHDXywzJV6Coe6HoF0LU7Aa5LSwkCfmiAZ+EQeOhVeL7xGkxe uwPIs7UoN9lQdmS4Ub465U0xrJjUTXiIRfHk4HWgmB7MaBdT2EjIb/fOtnrrzUNv1W0M TWhyJb7YoVOKC6XQX4G/0mWTj4fSmRgGIx1yvndOuHFeNOGkLtJcL1YjWvTF/9XbneGb bLC/KQ9Xm+9cfxy+ohKq5sHRskLAa6tUVAGMVnVBrg0UhFeO84QF+3JdCa67nNqW7Muw ICGj7baHbWX2OKtclmBYglNyTOCTLgD/W56scOBcN4lNVMyYTmaWCiw+n0kuFcOFZ6qY GBBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-59704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59704-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCXihZ9dPuklRzShJ7cAT/o0r8iqazaRwCiQahdHJN1CcwZRJfsyafUuQJDwv5PqgwlBUh8gJpqXSB9HPBSvO6QgL1aHZQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ov19-20020a170906fc1300b00a3c10037eefsi189503ejb.236.2024.02.09.09.13.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 09:13:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-59704-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59704-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 53C8A1F254CD for ; Fri, 9 Feb 2024 17:11:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 737EA7EEF3; Fri, 9 Feb 2024 17:11:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BC274D112 for ; Fri, 9 Feb 2024 17:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707498682; cv=none; b=L7qHpyR7mam6i+bGMsP/8PLArlK0Okx7zghmxFC58InNq6oLV0IpxLZMomrJChH6W4Mt6NmiPpk1X8zemQlJCKUzbdUy7kX6nm+UPFoi7c8HWj70twLXxIukpdAPcYg5ZQjfp9AJheFMp2gPl6ytSLClQCvh4h4wLc1mnbHRUQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707498682; c=relaxed/simple; bh=2ubGVaizyiqtk+gGQol1RLvxzIDmXy1/p9toUpaKFdA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=dFpr0/eDOm50KArXlnjAi1W1GEo/EPiu3Oj7hELOs3URvZqFxPzjXORST/2WnlnxjkknhRQePqXO56XdhFNpx2bd7iFTCzP8/dHiqk+3Kqzd0hSu0D4zp9gHoJNkYenT3t5UmuUkyXMpBQq7TjB5bE1WtUq+B28GjCReeEuTyPc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2EB7DA7; Fri, 9 Feb 2024 09:12:01 -0800 (PST) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 145513F64C; Fri, 9 Feb 2024 09:11:18 -0800 (PST) From: Robin Murphy To: will@kernel.org Cc: mark.rutland@arm.com, ilkka@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count) Date: Fri, 9 Feb 2024 17:11:09 +0000 Message-Id: X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790442269842071987 X-GMAIL-MSGID: 1790442269842071987 From: Ilkka Koskinen AmpereOneX mesh implementation has a bug in HN-P nodes that makes them report incorrect child count. The failing crosspoints report 8 children while they only have two. When the driver tries to access the inexistent child nodes, it believes it has reached an invalid node type and probing fails. The workaround is to ignore those incorrect child nodes and continue normally. Signed-off-by: Ilkka Koskinen [ rm: rewrote simpler generalised version ] Tested-by: Ilkka Koskinen Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index c584165b13ba..7e3aa7e2345f 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -2305,6 +2305,17 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) dev_dbg(cmn->dev, "ignoring external node %llx\n", reg); continue; } + /* + * AmpereOneX erratum AC04_MESH_1 makes some XPs report a bogus + * child count larger than the number of valid child pointers. + * A child offset of 0 can only occur on CMN-600; otherwise it + * would imply the root node being its own grandchild, which + * we can safely dismiss in general. + */ + if (reg == 0 && cmn->part != PART_CMN600) { + dev_dbg(cmn->dev, "bogus child pointer?\n"); + continue; + } arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADDR, dn);