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 853ADC433EF for ; Wed, 1 Dec 2021 13:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OsmeKfqr9WmunNE1fpfLnQiQ23LP5VubbKJGnE13q10=; b=D7jn6xdxzXeis6 6Jmyy/kAQ6k5xmCEwYZiyTQiq4TG+bYBF9ktlkzD4FBMdoJ302O97Syir5EKdawPrD5vI1VZNnp4q C4+zmqGmXZvuOsTaHTUXKFNFdYR2iEkvvhLzsMLL0m+0j0vOc5lFawBTtw5Ow+AzsX3ldgMCjaAM3 dIkmfdahVrv9unK6cZJ+mW651Xzzb1K4SU5CS7TAHgeFxrm8pDKKnE8FvKihtGGsrUmryvTfXPzrD HOUDjIF8Iwvdn+g6vyaJTXxC3kVQ+LDI2rI421ZCQ/dJAHn+NChNRPsRM44R7ja9Gutp6+74YqVbP RMITOm7uoCfI08xHmiPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msQ0R-008tuK-HE; Wed, 01 Dec 2021 13:50:43 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msPzB-008tK7-W6 for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 13:49:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 42414CE1EC7; Wed, 1 Dec 2021 13:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9497C53FAD; Wed, 1 Dec 2021 13:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638366562; bh=ubMvbkyG3fbA7PXxZrJzwClBOdnD1Ai0NXgnl6pNNMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuErtqKszv1Ws220RKzT+tdPCvZw+pV8mEFwqfKVCuxvXEf4meHBrAU81/FZ2UsNq oAhsQ9mAhS1usgaB1g7LcJQerUz/qZRuuuSjfFSwvg32drsJTqBDjpo9aAei5Rg4W/ xnR9h7qUKHHn9MddLigwg/m5pQOtaiIuOwQubeOwmJH2R488JTRs8pl65CFWZwF8wM 5vOncVz6+PwMIu9kyb7OQli27wtmXXDYEke9UY7iq3QhJgGxMv/Pb8h/8pvYlZh6A2 KlTxidXQTK1J7OtbtQro7T+xNEQXEyh2vGfW9Zm0VaHh3bUVr02ceuvNSmqL8fS3NM 2GNrCgo/gJ21A== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1msPz6-0098G7-Pl; Wed, 01 Dec 2021 13:49:20 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mark Rutland , Will Deacon , Hector Martin , Sven Peter , Alyssa Rosenzweig , Rob Herring , Thomas Gleixner , Dougall , kernel-team@android.com Subject: [PATCH v2 7/8] drivers/perf: arm_pmu: Handle 47 bit counters Date: Wed, 1 Dec 2021 13:49:08 +0000 Message-Id: <20211201134909.390490-8-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201134909.390490-1-maz@kernel.org> References: <20211201134909.390490-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, will@kernel.org, marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, robh+dt@kernel.org, tglx@linutronix.de, dougallj@gmail.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_054926_247183_F380F324 X-CRM114-Status: GOOD ( 13.86 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current ARM PMU framework can only deal with 32 or 64bit counters. Teach it about a 47bit flavour. Yes, this is odd. Signed-off-by: Marc Zyngier --- drivers/perf/arm_pmu.c | 2 ++ include/linux/perf/arm_pmu.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 295cc7952d0e..0a9ed1a061ac 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -109,6 +109,8 @@ static inline u64 arm_pmu_event_max_period(struct perf_event *event) { if (event->hw.flags & ARMPMU_EVT_64BIT) return GENMASK_ULL(63, 0); + else if (event->hw.flags & ARMPMU_EVT_47BIT) + return GENMASK_ULL(46, 0); else return GENMASK_ULL(31, 0); } diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 2512e2f9cd4e..0407a38b470a 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -26,6 +26,8 @@ */ /* Event uses a 64bit counter */ #define ARMPMU_EVT_64BIT 1 +/* Event uses a 47bit counter */ +#define ARMPMU_EVT_47BIT 2 #define HW_OP_UNSUPPORTED 0xFFFF #define C(_x) PERF_COUNT_HW_CACHE_##_x -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel