From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5542BC3DA4A for ; Fri, 16 Aug 2024 18:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lQ9Ystpx92j4cF0TlD88Be2w/5F7UqqJdjGcFkTj5F0=; b=izU5CaaHh/uKVM7AlKavkcJW9i xl4rbSoo4zjIkEm+0Rz/5cEKOqTiLz8E5k4G8/n4b/QBGzGbC4g4CvWdBpf21SFbsxcEyuu/n+gOt jMnFK2KdGWPHbuPgTShOzQjZVC0U4O+6uBVPj5C2ycAsd/6AJjnsWn62e4XmbEpza5RN5GFPiy4fp wRbRNNh9prJmOz6/yMWuf+XBJWlz/6/av/wI9kB4iJMo4rFF2br2Qup7H+RtTGHqEmrVZvgJODb2x 5IUoQqhPa4D6Q2XOcKqPZX8yEdXgzAD9ionxQuhYJv1tGE1+IZQ/gQz/J1hlzDVSH/TLvqEfdzgx2 6N4dl33Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sf1lt-0000000Dr1g-1p5i; Fri, 16 Aug 2024 18:33:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sf1lB-0000000Dqsq-3ktB for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 18:33:16 +0000 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 3022913D5; Fri, 16 Aug 2024 11:33:39 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DF303F6A8; Fri, 16 Aug 2024 11:33:12 -0700 (PDT) Message-ID: Date: Fri, 16 Aug 2024 19:33:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/8] perf/arm-cmn: Fix CCLA register offset To: Mark Rutland Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ilkka@os.amperecomputing.com References: From: Robin Murphy Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_113314_033836_3772F25E X-CRM114-Status: GOOD ( 24.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 16/08/2024 11:00 am, Mark Rutland wrote: > On Fri, Aug 09, 2024 at 08:15:41PM +0100, Robin Murphy wrote: >> Apparently pmu_event_sel is offset by 8 for all CCLA nodes, not just >> the CCLA_RNI combination type. > > Was there some reason we used to think that was specific to CCLA_RNI > nodes, or was that just an oversight? I imagine it was just oversight/confusion helped by the original r0p0 TRM listing both a por_ccla_pmu_event_sel and a por_ccla_rni_pmu_event_sel as CCLA registers, which I could well believe I misread at a glance while scrolling up and down. > Looking at the CMN-700 TRM and scanning for pmu_event_sel, we have: > > 16'h2000 por_ccg_ha_pmu_event_sel > 16'h2000 por_ccg_ra_pmu_event_sel > 16'h2008 por_ccla_pmu_event_sel > 16'h2000 por_dn_pmu_event_sel > 16'h2000 cmn_hns_pmu_event_sel > 16'h2000 por_hni_pmu_event_sel > 16'h2008 por_hnp_pmu_event_sel > 16'h2000 por_mxp_pmu_event_sel > 16'h2000 por_rnd_pmu_event_sel > 16'h2000 por_rni_pmu_event_sel > 16'h2000 por_sbsx_pmu_event_sel > >> Fixes: 23760a014417 ("perf/arm-cmn: Add CMN-700 support") >> Signed-off-by: Robin Murphy >> --- >> drivers/perf/arm-cmn.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c >> index fd2122a37f22..0e2e12e2f4fb 100644 >> --- a/drivers/perf/arm-cmn.c >> +++ b/drivers/perf/arm-cmn.c >> @@ -2393,10 +2393,13 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) >> case CMN_TYPE_CXHA: >> case CMN_TYPE_CCRA: >> case CMN_TYPE_CCHA: >> - case CMN_TYPE_CCLA: >> case CMN_TYPE_HNS: >> dn++; >> break; >> + case CMN_TYPE_CCLA: >> + dn->pmu_base += CMN_HNP_PMU_EVENT_SEL; >> + dn++; >> + break; > > When reading this for the first time, it looks like a copy-paste error > since CMN_HNP_PMU_EVENT_SEL doesn't have any obvious relationship with > CCLA nodes. > > I reckon it'd be worth adding CMN_CCLA_PMU_EVENT_SEL, and replacing the > existing comment above the definition of CMN_HNP_PMU_EVENT_SEL, e.g. > > /* > * Some nodes place common registers at different offsets from most > * other nodes. > */ > #define CMN_HNP_PMU_EVENT_SEL 0x008 > #define CMN_CCLA_PMU_EVENT_SEL 0x008 > > That way the switch looks less suspicious, and the comment is a bit more > helpful to anyone trying to figure out what's going on here. Sure, that's a reasonable argument. > With that: > > Acked-by: Mark Rutland Thanks, Robin. > > Mark. > >> /* Nothing to see here */ >> case CMN_TYPE_MPAM_S: >> case CMN_TYPE_MPAM_NS: >> -- >> 2.39.2.101.g768bb238c484.dirty >>