From patchwork Mon Oct 9 05:17:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 13412944 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 6CAAAE95A8D for ; Mon, 9 Oct 2023 05:18:40 +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: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:In-Reply-To:References: List-Owner; bh=LpvftQdbvkSCt7lhkX8nchKzRHCjOUeK9SpOcE4H2Gw=; b=BH+qPANvKT8AGS UrVp9yGAQiXJkuQSbkwPQVuGbRjJQCny5Cmm4d8ZDiMAV30aeaRH1DmhA3j2AQRRDH99FfeW2XP0Z k72n+hr3bengstnN+EeJnxaDZM50bUfBq5ElAut/4+nVHwOQNrKQAXOtH3hkZ+boDfmenOEgdr2T0 3/t+8tT0Ve2R1W1y+jdeiXVtU8FHvH7/wGdHXQ2hpTkyO41Is7j0U7pbfvXRai6daAoQ0mGp7dqJI XmALqNDEV4B15K6Bfj/mmmpVinTGXukMOJhsn7nUPDJ45WqnRlQL06PATAfmtSsupriQBR/t+RFRj 6DPrIsLVoHfN5ipxwLdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpieh-009mTr-35; Mon, 09 Oct 2023 05:18:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpiec-009mTA-2p for linux-arm-kernel@lists.infradead.org; Mon, 09 Oct 2023 05:18:09 +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 41FB21FB; Sun, 8 Oct 2023 22:18:42 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E2F523F7A6; Sun, 8 Oct 2023 22:17:59 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org Subject: [PATCH] driver: perf: arm_pmuv3: Identify 'event->attr.config1' based attributes Date: Mon, 9 Oct 2023 10:47:53 +0530 Message-Id: <20231009051753.179355-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231008_221806_963750_319F3FE8 X-CRM114-Status: UNSURE ( 8.26 ) X-CRM114-Notice: Please train this message. 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 This defines macros to identify long and rdpmc attributes which get carried inside 'event->attr.config1', thus making the code explicit and clear. Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This applies on v6.6-rc5. drivers/perf/arm_pmuv3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 94723d00548e..797ffd5a8fed 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -298,16 +298,19 @@ PMU_FORMAT_ATTR(event, "config:0-15"); PMU_FORMAT_ATTR(long, "config1:0"); PMU_FORMAT_ATTR(rdpmc, "config1:1"); +#define ARM_PMUV3_ATTR_LONG 0x01 +#define ARM_PMUV3_ATTR_RDPMC 0x02 + static int sysctl_perf_user_access __read_mostly; static inline bool armv8pmu_event_is_64bit(struct perf_event *event) { - return event->attr.config1 & 0x1; + return event->attr.config1 & ARM_PMUV3_ATTR_LONG; } static inline bool armv8pmu_event_want_user_access(struct perf_event *event) { - return event->attr.config1 & 0x2; + return event->attr.config1 & ARM_PMUV3_ATTR_RDPMC; } static struct attribute *armv8_pmuv3_format_attrs[] = {