Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp274353rdf; Tue, 21 Nov 2023 02:16:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3AGMGhXiuL+s27mO8sqmU8DauA2CirzdsYH+g5ws3QqrDYD3dOjh20ULPeJDWrUTHJb9f X-Received: by 2002:a17:90b:4f4e:b0:27c:f8bd:9a98 with SMTP id pj14-20020a17090b4f4e00b0027cf8bd9a98mr6757816pjb.40.1700561808569; Tue, 21 Nov 2023 02:16:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700561808; cv=none; d=google.com; s=arc-20160816; b=e7mmEBJStr1s55+rU7hGKvu9SU/ChbpRS4l4ojXFQj84/XcxT3m6N6Qdq+R++Nd+Lg umN3N6c3dqpCvLNxvOZgJ3PrrM9xpLRWk4khK/mgYF45I8yAWOuYFZ1AZ0XlHWIFLBC1 quXf80F2f3dG1RK0ayfcgx04vqsMLb0ebJwtAk2cVI/XcXzwiu9VTWUxVbKbjM6zlfje 65NTcsjLPKF3wzSTMtM97+QSM+4SZwKpDFNnIUGcPkqJFkot7e4+KxiFItFBTEse0TxU ZelWUZalgaEA6wsHAPvrFrca5z7HmYuvNQmjFtoVYDB9YqjI6NOg96SEtRG5pEr3yj+X WHSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=mYm78Hisuy1ePPqTX/s4hxM58GYIgklQz3oZwzIZHCA=; fh=nHM9mH83VXtGwh8LWtY1or5ruEFjUi+tHQloFKAm1S0=; b=UOyJX1b0VfFzfu6Z+8LxnmoQFgDb1S8r+/dYqciNPjxXa9Cb4KYOgNAOReznl5CIS3 WnENlIq/BIKkQbrDkupS+AtwG4yblLS72pP+8VwM0zP/CbYU2gSpsfDPAy5vhkd/SMt7 kExg1v4qdZp49OeNSBDQOpmPZ5Ego87YiLJHtUigtEZNp71IgbKLA/JXJRGHrXY+q14J OzDplB4mjFXSucyf4eX+/YhFgBu2P1EA9SXgfxk4fOQNODAd0xH7QjQlYZmqQfQqBYPH sNFg+jycm1PlD1xtMOPCbrTvZ09+5Xv+MPnelivhlyaTd4QSyQNOIn5btwN/f62plGqA dFIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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. [23.128.96.32]) by mx.google.com with ESMTPS id h23-20020a17090adb9700b00283bc49ad11si7407954pjv.183.2023.11.21.02.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:16:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 8D6A88082DEB; Tue, 21 Nov 2023 02:15:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbjKUKPK (ORCPT + 99 others); Tue, 21 Nov 2023 05:15:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjKUKPJ (ORCPT ); Tue, 21 Nov 2023 05:15:09 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7E37A2; Tue, 21 Nov 2023 02:15:05 -0800 (PST) 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 1EE661FB; Tue, 21 Nov 2023 02:15:52 -0800 (PST) Received: from [10.57.42.32] (unknown [10.57.42.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A3833F73F; Tue, 21 Nov 2023 02:15:04 -0800 (PST) Message-ID: Date: Tue, 21 Nov 2023 10:15:02 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/3] arm64: perf: Include threshold control fields in PMEVTYPER mask Content-Language: en-GB To: James Clark , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, will@kernel.org, mark.rutland@arm.com Cc: Catalin Marinas , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231113112507.917107-1-james.clark@arm.com> <20231113112507.917107-2-james.clark@arm.com> From: Suzuki K Poulose In-Reply-To: <20231113112507.917107-2-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Tue, 21 Nov 2023 02:15:20 -0800 (PST) On 13/11/2023 11:25, James Clark wrote: > FEAT_PMUv3_TH (Armv8.8) adds two new fields to PMEVTYPER, so include > them in the mask. These aren't writable on 32 bit kernels as they are in > the high part of the register, so only include them for arm64. > > It would be difficult to do this statically in the asm header files for > each platform without resulting in circular includes or #ifdefs inline > in the code. For that reason the ARMV8_PMU_EVTYPE_MASK definition has > been removed and the mask is constructed programmatically. > > Signed-off-by: James Clark Reviewed-by: Suzuki K Poulose > --- > drivers/perf/arm_pmuv3.c | 9 ++++++++- > include/linux/perf/arm_pmuv3.h | 3 ++- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c > index 6ca7be05229c..1d40d794f5e4 100644 > --- a/drivers/perf/arm_pmuv3.c > +++ b/drivers/perf/arm_pmuv3.c > @@ -555,8 +555,15 @@ static void armv8pmu_write_counter(struct perf_event *event, u64 value) > static inline void armv8pmu_write_evtype(int idx, u32 val) > { > u32 counter = ARMV8_IDX_TO_COUNTER(idx); > + unsigned long mask = ARMV8_PMU_EVTYPE_EVENT | > + ARMV8_PMU_INCLUDE_EL2 | > + ARMV8_PMU_EXCLUDE_EL0 | > + ARMV8_PMU_EXCLUDE_EL1; > > - val &= ARMV8_PMU_EVTYPE_MASK; > + if (IS_ENABLED(CONFIG_ARM64)) > + mask |= ARMV8_PMU_EVTYPE_TC | ARMV8_PMU_EVTYPE_TH; > + > + val &= mask; > write_pmevtypern(counter, val); > } > > diff --git a/include/linux/perf/arm_pmuv3.h b/include/linux/perf/arm_pmuv3.h > index 9c226adf938a..ddd1fec86739 100644 > --- a/include/linux/perf/arm_pmuv3.h > +++ b/include/linux/perf/arm_pmuv3.h > @@ -228,7 +228,8 @@ > /* > * PMXEVTYPER: Event selection reg > */ > -#define ARMV8_PMU_EVTYPE_MASK 0xc800ffff /* Mask for writable bits */ > +#define ARMV8_PMU_EVTYPE_TH GENMASK(43, 32) > +#define ARMV8_PMU_EVTYPE_TC GENMASK(63, 61) > #define ARMV8_PMU_EVTYPE_EVENT 0xffff /* Mask for EVENT bits */ > > /*