Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2442400rda; Wed, 25 Oct 2023 02:57:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHW5liiozP1yd+3N7dDnKnotqMI2gyuNhuRKNDznwXmd1nGVQABMGTHmE1+FjnECo1RLrwx X-Received: by 2002:a81:a0c8:0:b0:57a:8456:3401 with SMTP id x191-20020a81a0c8000000b0057a84563401mr14908104ywg.29.1698227868054; Wed, 25 Oct 2023 02:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698227868; cv=none; d=google.com; s=arc-20160816; b=JiS1f+gSdoOftmo3gUZnMrt554ZyJUKWspQstuSjzM5jZ/9CBLNzVEQGTQ55TAQRZ2 YVWdFhZ3NSZoSZ1OEfV+yo4/7p0IumDSl8J+SOk56+CwJNIpLyVx0enwmdg/7n7GXfQ3 VaDS5ucmnFzzeS+ig/JKdRn5r6ZzjwjW2B+zF58ATP0niBjLG1RQQCHI2dBLxHzcp01Z do9tZM54BNKWBZBWxIYZFxVfrCWehcV4EjOkzxyrDPZP+9FADzV1jHgysjhfjxlXYC2w 1hFd3LzqBGhF9Un2bJYzFu+AYU9jEFijHMoin31UdwqN6duyCkQ5Eg8rlMBoUKUjGXLO fGpw== 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=edy5WY1sFjUakyZl+OZWFmhX/E9KP4lvSTT2Run2lsQ=; fh=+qglQRbI7SZnWv9+AJu3XwNhf3sPyrDJ9LvrHcehM2c=; b=pjPChl5Jf9yWC95iLKCmhd9rAefI0zjfOKW4m/8YGhHyXMQXcLpR21qqyJB0Q1hYvt uMDmxoYBhLncz4T47vc+0cQ/sPkw2Z2lVaTSLcRZO8zk7FY5R3gCwPeKGdUTZnChkYma 4/Ee3brB1yQamhO+qYYYM9Pw7z7XvQNVOVmY2MA2bu+FvVbL1MpMJNnhf+C6w1maaPIu KRBucctudaDKUOwU42hlHFGGaq51UDtiDQLEJ3lcJUH6XDincrgT25VMc+Qso9lHw5Wz 0Y/t0yZgDXdiMWYRUHsSbC6FFdQ/RMMUK4AaAmuiFGfuYG6GA89SjrMRJXRFL++aWaQm 3GbA== 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b187-20020a0dd9c4000000b0059f7c9f32dbsi10692050ywe.17.2023.10.25.02.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 02:57:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 91167801B3A8; Wed, 25 Oct 2023 02:57:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234336AbjJYJ5m (ORCPT + 99 others); Wed, 25 Oct 2023 05:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234093AbjJYJ5i (ORCPT ); Wed, 25 Oct 2023 05:57:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 54EEFDD; Wed, 25 Oct 2023 02:57:36 -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 937582F4; Wed, 25 Oct 2023 02:58:17 -0700 (PDT) Received: from e127643.arm.com (unknown [10.57.70.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AB5953F738; Wed, 25 Oct 2023 02:57:33 -0700 (PDT) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, suzuki.poulose@arm.com, oliver.upton@linux.dev Cc: kvmarm@lists.linux.dev, James Clark , Catalin Marinas , Will Deacon , Jonathan Corbet , Russell King , Mark Rutland , Marc Zyngier , Zaid Al-Bassam , Reiji Watanabe , Geert Uytterhoeven , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/3] arm: perf: Include threshold control fields valid in PMEVTYPER mask Date: Wed, 25 Oct 2023 10:57:03 +0100 Message-Id: <20231025095710.1559601-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025095710.1559601-1-james.clark@arm.com> References: <20231025095710.1559601-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 02:57:46 -0700 (PDT) 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 split the mask definition to the asm files for each platform. Despite not being used on aarch32, TH and TC macros are added to the shared header file, because will be used in arm_pmuv3.c which is compiled for both platforms. Signed-off-by: James Clark --- arch/arm/include/asm/arm_pmuv3.h | 3 +++ arch/arm64/include/asm/arm_pmuv3.h | 4 ++++ include/linux/perf/arm_pmuv3.h | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arm_pmuv3.h b/arch/arm/include/asm/arm_pmuv3.h index 72529f5e2bed..491310133d09 100644 --- a/arch/arm/include/asm/arm_pmuv3.h +++ b/arch/arm/include/asm/arm_pmuv3.h @@ -9,6 +9,9 @@ #include #include +/* Mask for writable bits */ +#define ARMV8_PMU_EVTYPE_MASK 0xc800ffff + #define PMCCNTR __ACCESS_CP15_64(0, c9) #define PMCR __ACCESS_CP15(c9, 0, c12, 0) diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h index 18dc2fb3d7b7..4faf4f7385a5 100644 --- a/arch/arm64/include/asm/arm_pmuv3.h +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -11,6 +11,10 @@ #include #include +/* Mask for writable bits */ +#define ARMV8_PMU_EVTYPE_MASK (0xc800ffffUL | ARMV8_PMU_EVTYPE_TH | \ + ARMV8_PMU_EVTYPE_TC) + #define RETURN_READ_PMEVCNTRN(n) \ return read_sysreg(pmevcntr##n##_el0) static inline unsigned long read_pmevcntrn(int n) 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 */ /* -- 2.34.1