Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1190779rdb; Fri, 20 Oct 2023 10:51:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDu2PsrodTPQbVBX4HyokyGT2Xka3zApNhcnRyjcRJ8EHExkosA7ypGhNGOjDyYHbW1mWJ X-Received: by 2002:aa7:8439:0:b0:6b3:55fd:d851 with SMTP id q25-20020aa78439000000b006b355fdd851mr2090417pfn.10.1697824315067; Fri, 20 Oct 2023 10:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697824315; cv=none; d=google.com; s=arc-20160816; b=TZPZRM3j/mRWsdsG8JvZ/qFTsCzVgpo1pgm7V1yZ3nZ7qNuDl8QCIsmS1Wxl/D+Sc4 bVODWAtuqjQcXybrrxWGrcc60u13qKLca0hFMVfU08B3HBaHIzHw4FAwCHGWkPtjYQba IIX0iAVAdmNjwtJJ3xspIdNX7dbXz94M/VY6DjHDgq0/MWY+fr4K1Mn7fM+MNe8ObS4h SJbbjokVwtBzymJ07wrz0GqB6VMui2Prl+ShIe5IYXdaV3zNNk11Ujq5X7heiYmeIIoU Q1eP5A4eU3EUjEHgVowGwcy0DRbE5c3DmI9Mgj4iVR2NucR17IrrVfK6Q6lP5R1gd0F+ YryQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TDr25jaNyQJQh7f+KiE7JD1i9PI1j24qH6I5wuo7kv0=; fh=5eTsl8DZJtk22FZMserOlh83jaey1v40CuRMPgl25m8=; b=qhelWC1CpVYrWz8A8ef4KHobH5zYpybt/uhN7vuHvLpSQkl6eMML/hDKHnOgoy4plW nf//mkX19xlFyIyVxMcCfPWM9gcn+AidTtAndAh0iHR54wHYgZHo2eeQfpELRuUGIm5e eoba8BO6SNhAy+5lY4N/scyBJJbAof9TYVL3YmRohDA/WfACBcSnG1YMR/C59b4sFMWU 804wtc9JueUkKI70LI1kQ3Vt5do/EczuJ0sxjXXZvN5nD+4LqcmW75smJ6+HnBxDkdjX m1oOVvwi8tS2Msk6IlUzKA/YGPGsI6xwuDuSOehbV2hfLItRUiYLmln9pTavc+nGaZ/W MGhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c29-20020a63725d000000b005ac341a88ccsi2264702pgn.6.2023.10.20.10.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 10:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 07F7D82DEAD2; Fri, 20 Oct 2023 10:51:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377934AbjJTRvg (ORCPT + 99 others); Fri, 20 Oct 2023 13:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377915AbjJTRvf (ORCPT ); Fri, 20 Oct 2023 13:51:35 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E7B38FA for ; Fri, 20 Oct 2023 10:51:33 -0700 (PDT) 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 9B9AE153B; Fri, 20 Oct 2023 10:52:14 -0700 (PDT) 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 B7A233F762; Fri, 20 Oct 2023 10:51:32 -0700 (PDT) From: Robin Murphy To: will@kernel.org Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jeremy.linton@arm.com, ilkka@os.amperecomputing.com, renyu.zj@linux.alibaba.com Subject: [PATCH 1/3] perf/arm-cmn: Fix DTC domain detection Date: Fri, 20 Oct 2023 18:51:25 +0100 Message-Id: <3076ee83d0554f6939fbb6ee49ab2bdb28d8c7ee.1697824215.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 20 Oct 2023 10:51:48 -0700 (PDT) It transpires that dtm_unit_info is another register which got shuffled in CMN-700 without me noticing. Fix that in a way which also proactively fixes the fragile laziness of its consumer, just in case any further fields ever get added alongside dtc_domain. Fixes: 23760a014417 ("perf/arm-cmn: Add CMN-700 support") Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 913dc04b3a40..f1ac8d0cdb3b 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -112,7 +112,9 @@ #define CMN_DTM_PMEVCNTSR 0x240 -#define CMN_DTM_UNIT_INFO 0x0910 +#define CMN650_DTM_UNIT_INFO 0x0910 +#define CMN_DTM_UNIT_INFO 0x0960 +#define CMN_DTM_UNIT_INFO_DTC_DOMAIN GENMASK_ULL(1, 0) #define CMN_DTM_NUM_COUNTERS 4 /* Want more local counters? Why not replicate the whole DTM! Ugh... */ @@ -2117,6 +2119,16 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn) return 0; } +static unsigned int arm_cmn_dtc_domain(struct arm_cmn *cmn, void __iomem *xp_region) +{ + int offset = CMN_DTM_UNIT_INFO; + + if (cmn->part == PART_CMN650 || cmn->part == PART_CI700) + offset = CMN650_DTM_UNIT_INFO; + + return FIELD_GET(CMN_DTM_UNIT_INFO_DTC_DOMAIN, readl_relaxed(xp_region + offset)); +} + static void arm_cmn_init_node_info(struct arm_cmn *cmn, u32 offset, struct arm_cmn_node *node) { int level; @@ -2248,7 +2260,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) if (cmn->part == PART_CMN600) xp->dtc = 0xf; else - xp->dtc = 1 << readl_relaxed(xp_region + CMN_DTM_UNIT_INFO); + xp->dtc = 1 << arm_cmn_dtc_domain(cmn, xp_region); xp->dtm = dtm - cmn->dtms; arm_cmn_init_dtm(dtm++, xp, 0); -- 2.39.2.101.g768bb238c484.dirty