Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp37938rdg; Tue, 10 Oct 2023 03:42:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4Igr41Rk9cNH+xNlmaUnz9zXlb7di7tV+uTlq42B3keZu2pJl+3ZfoCVBfbHbZNwpzPT/ X-Received: by 2002:a17:90a:e912:b0:26b:59b7:edb with SMTP id ki18-20020a17090ae91200b0026b59b70edbmr15722275pjb.33.1696934519950; Tue, 10 Oct 2023 03:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696934519; cv=none; d=google.com; s=arc-20160816; b=IABdU2JBUeqMm1eFOArmgfdRPv50mRL/lwEPah/vkwdZd8tOV0eRdFpTzfFDBOL0pO u1OtvcdiDKQyHuaKBEelWjWX7MyC7+FQCVlsXGw3PG3pVvbNkjMBPRWm9sd7jMB2CxNN Gf+OL/1OXr0P+VxgvmAP5ADkBH7aGnfXTGvUk+/8mu8QBplWwBZK9NZ7Fwi/slz1gDRQ NSwuwhz9AJGWp2U2R66dHehZ/5FZ16pASAVog/4w3wT3o7xmf5QaiRQiG55wqJwu9R7E ja3esnrcBijBszRJL1rGtlFzHhbgza445w36SPiVjqCKBhDStrzMK3zw9lr1GAEA3c8v ES3Q== 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=2k2TcOKyF96N3ph0bBvOTCuf/T32HrOD9r4sVyC5R0I=; fh=FiwhyeArbhrGbGqkI7suClk/SuK4po8XwFNjMRUg0hk=; b=nM6z3eLiYaIVTUkk+hOTzDZrU5ENQszAtLcllmKsE3NAvQ5j0+5FDPZA2tK4LheLPD d6AQplcH+igfKWxESPZHaUUMvDXmwBR4x8GECMCp+3kKf0d9Lkz63T1gzX5M4vbktXEq 399572yARUtW1x8/0wvdUXKRDdiRk55o3MwsxI2iuUN5/kFME3uQA2DvnxR6EcSx7ukD ViFcp1M9h8wI4FwkSWWlv9kMD5LsYhe5ono0dKPHheytgJZbozrjpWRMfStahq4OnnZ0 4Uz5JUDPgayI9adooUJvWoVoYL9GKVIcG23SmJdWkUodqzpNXKmCyuoh9ODyfPDL4nKV rwGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z11-20020a6552cb000000b0056da0ae25d1si11107212pgp.831.2023.10.10.03.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 03:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 03174802580F; Tue, 10 Oct 2023 03:41:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231184AbjJJKlr (ORCPT + 99 others); Tue, 10 Oct 2023 06:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjJJKlq (ORCPT ); Tue, 10 Oct 2023 06:41:46 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72EA99E; Tue, 10 Oct 2023 03:41:44 -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 C0E0B1FB; Tue, 10 Oct 2023 03:42:24 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 908423F762; Tue, 10 Oct 2023 03:41:41 -0700 (PDT) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, suzuki.poulose@arm.com Cc: James Clark , Catalin Marinas , Will Deacon , Jonathan Corbet , Russell King , Marc Zyngier , Oliver Upton , James Morse , Zenghui Yu , Mark Rutland , Reiji Watanabe , Geert Uytterhoeven , Zaid Al-Bassam , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev Subject: [PATCH v2 1/3] arm: perf: Include threshold control fields valid in PMEVTYPER mask Date: Tue, 10 Oct 2023 11:40:27 +0100 Message-Id: <20231010104048.1923484-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010104048.1923484-1-james.clark@arm.com> References: <20231010104048.1923484-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 03:41:57 -0700 (PDT) X-Spam-Level: ** 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. Now where the value is used in some parts of KVM, include the asm file. Despite not being used on aarch32, TH and TC macros are added to the shared header file, because they are 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 ++++ arch/arm64/kvm/pmu-emul.c | 1 + arch/arm64/kvm/sys_regs.c | 1 + include/linux/perf/arm_pmuv3.h | 3 ++- 5 files changed, 11 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/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index 6b066e04dc5d..0666212c0c15 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index e92ec810d449..d0e11e684f07 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/include/linux/perf/arm_pmuv3.h b/include/linux/perf/arm_pmuv3.h index e3899bd77f5c..ec3a01502e7c 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