Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1693591rdb; Sun, 8 Oct 2023 22:18:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGV657w6KzySYQpiAO3hhpDZYgLbgjq9iz/Glz5/WYMwwKyn/IB1cjHCy4QySq6kft6pcwP X-Received: by 2002:a05:6808:1313:b0:3af:8050:369f with SMTP id y19-20020a056808131300b003af8050369fmr19245438oiv.6.1696828694317; Sun, 08 Oct 2023 22:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696828694; cv=none; d=google.com; s=arc-20160816; b=itqP7TMiPTvvkeOuki88vG2cSxTxeBF3GJPFZ/0O2ToZIX8woMMOx+8aJMMsU5LhUC WZn9VDoCC8qq8TQ5VsL/jfhtuBjcqwW7D25q0lLiFg00VXWJfVswo43v34rumx2E3lsA Jpz7gw6RkrbDDJBwP8+YLPyKhJ2lDEC0RQdObpc1He5G6obvRTvDyjojhFEvFbFx/CaA ra3vlX6gh/ZPRYHCwyvA1KCcsFjA8aUUOavvWt8HYQAOf/00Y6+3MkTPDdYMCa9xD3gW VL1Sar6H6WoqWpL+RI25Mr2sTrGEC01Yq2MecdpQipfTpptakzzlNFTUDJ5XJyUim/Ch 7+Tg== 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 :message-id:date:subject:cc:to:from; bh=1pvQpH7Tz5KDa6aqu4hnr8u/19OuwE9Lit6lECXIxzs=; fh=s03SIMIeJHh4tNM3mw7pRMBjGeQiA04Y7AfUJ3pCpAI=; b=0SKMmrJc1SgZCjyjK/NrnJwKddQzBPuuTw2268rwCZ8KE2CLtsCNHsuCAsk8Pcguua oWPe7LJ7nbTd5cyBDiJydD6t1U3R/uwUsj8kbBrHO8BiJWAfdMADvMVsYCwBHNEH1WFZ XoFW4fDoywuYoJ6pO9YA13P54513g/vnTrBqZDZDq5ko0gn8z/DYF4rJ+7p5t5u8spod 2IPShZq9FnG9fz7pHv8vtReIyIFRNo60S5HZJ5S2ddXbSEmymX0M0NgLWZl+EZMWZ72y BoFXw/8gBcgH7pm9SEovSfTBrMRK/Et/Mk/cqXgUugKZwYN6HDR+AeMLBsTsOXM3FC+V BvrQ== 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 bk13-20020a056a02028d00b0055fd1bfb109si8544806pgb.679.2023.10.08.22.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 22:18:14 -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 7A3A080C1100; Sun, 8 Oct 2023 22:18:13 -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 S1345097AbjJIFSJ (ORCPT + 99 others); Mon, 9 Oct 2023 01:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345099AbjJIFSI (ORCPT ); Mon, 9 Oct 2023 01:18:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50695FA for ; Sun, 8 Oct 2023 22:18:02 -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 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 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]); Sun, 08 Oct 2023 22:18:13 -0700 (PDT) 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[] = { -- 2.25.1