From patchwork Thu Jun 1 03:01:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13262925 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 D5F8BC77B7A for ; Thu, 1 Jun 2023 03:03:27 +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=6a3BqaAdS7UOH9dRNcbWXdb/EfxxvKm60+m3PJXNXMc=; b=mke90i3unpAmYC esJvdUYzucxmTa9keLk7T9OAVTPX+0yJdimCjatQQEPp9M9XZMb3GBGhIgnsS83/JJ9EP0jnuyBTH TDQm9lcEXorUCyOE9zJGOXHQ1QFg1cOho4zvbiCoYkTD6eNbi+OiVqugw4INLDjdsN5Kl9SGbHpNg 9+gOrDmFdek2KcdboeO1F8rxDMUjQoQN1cCIrKRfduk1zOgXednNcb4VOgH51BKK6WfuFvW//wuiI 2akDX7pxaZC5zg3/a7NFmt4cy35wMD/fQXhCta6rAzKBYlxzZ+ax1de+8jJMNKRMURX+jFRdxM5l8 U5C19V7QlHqPUAuBrQ+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4Yag-001lV0-1h; Thu, 01 Jun 2023 03:03:06 +0000 Received: from mail-mw2nam04on20728.outbound.protection.outlook.com ([2a01:111:f400:7e8c::728] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4YaN-001lOq-0d for linux-arm-kernel@lists.infradead.org; Thu, 01 Jun 2023 03:02:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oJ+reJTB+3gtdVk21ZR6Z8Eu1rMZbdcdyAIBmsl5Hdkuf2rGpSHGWu0Vs/OQ5Vs+k9EXnkz3ETpcNm8mHnvEv9sxfuAf3MgNDhq2FMX8gNNdaUkfZbz72G+p1sLtWDCFBhFpQlf2ViF3AKlOcMfzMwPwHlORZuU77CsVqpS/IMisCeSVU7Rg3TWXD8S5Pbg0rkK89HmTjyQvHSyj6GTo0GP8PYmr5GCYaS3Vzo7Q3Yj1tsds2POkqp6CckACEFj4cX0H3BxG8Erh8eKB6206OU0xaMbG9UA6Rg+s50MaPxCLzzIXTvxB7IeNG36vtCrLoTIeEu5jGVKMWDIc4QOGcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yLhvL625UaqprOKkGQ4xA/u91qvjSkkor2jAZ0bOrjI=; b=S3wx7Vl6lQa0HRN17aNNtujSicBdImjPyG51Z6pfT1c1VejbNhh4Ook5Wtx5HkJyaLdCWfGDC+8qx+jxDG8WhHpaaC4sveL0lkV1W3R+M4HFCDfmMM7lQp67ijAxcrfTSYta4ZcJajCuPJ050DQElNA1fYpA4+lR7KkLE6ROJLHFLmNfFctoBHtdQ+z28psqSLewkXmyxoNQLAfcig6zm4NjmVebA/oNm4pfTakZkPjD94WPXprCLhV9Y1Ol0tb/gfywMR5xZzLkJy/qELcP69pNgngapG+qXIxRF2m6GTvq5NYtSXt6LEz+TuBjjV39iS0BUwtM8IYL5ONvuV25oA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yLhvL625UaqprOKkGQ4xA/u91qvjSkkor2jAZ0bOrjI=; b=Xu3jpp4AJz3NmaCILjzJ+zNxyS0y+qcqzW+HQjvH/GM81tYeRfqAyYi+dj0U9yH0M6u0KJQujTw4Jk+yebsL6xL/XI6oHxj6wnYKiUmgQ9+6UYENq8+q0aNZZwGnKV6Y4yO5CiNPDxKMeKRXbVEjpCAFBdRBN7YofegCpkaGlUo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) by CO1PR01MB6709.prod.exchangelabs.com (2603:10b6:303:f9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Thu, 1 Jun 2023 03:02:41 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::5aae:2a5e:15f5:8196]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::5aae:2a5e:15f5:8196%2]) with mapi id 15.20.6433.022; Thu, 1 Jun 2023 03:02:41 +0000 From: Ilkka Koskinen To: Jonathan Corbet , Will Deacon , Mark Rutland , Besar Wicaksono , Suzuki K Poulose , Robin Murphy Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ilkka Koskinen Subject: [PATCH v2 3/5] perf: arm_cspmu: Support implementation specific filters Date: Wed, 31 May 2023 20:01:42 -0700 Message-Id: <20230601030144.3458136-4-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601030144.3458136-1-ilkka@os.amperecomputing.com> References: <20230601030144.3458136-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR08CA0015.namprd08.prod.outlook.com (2603:10b6:610:33::20) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|CO1PR01MB6709:EE_ X-MS-Office365-Filtering-Correlation-Id: a2fa18a8-e9ed-41b3-7fbe-08db624caa12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pI1vGDzUeVnQK/ZJWsIIzGgXNRCzv9+naJIDiUQAB87VATQ87HqI9yrslkWJqfKk9Dl5byohIMrTVyETXklQrJCHS1t7xjqRt7jm6Vk9xJeQAL4Md1gcyAMkyl20DlIj9kzEauTcPp/4ADfnikaeLgogRBJSsQgxDqKXiZ504dxX1DAdZbRVVGReUlQwzigBuqUgsoLa/4u9wSyrhkB0Qzh2sb2ahLDS5q4wkYuNZ6wQYLX590Ughe3KAtxHR0EZigZijVpMDJVQf8YKy7j4xi5Yr03va61P8pEmq2kK93WSqELZsMY9URXAo2yXsINQFjA8H7h4Up21NI9pT4O/CWDUs+Qgbkeo1b2w3ym7BrR7vRaQxIpJ99phqHX24WaaAZ+zjgrJrxjG/+pMJW6S4lcRR0INirmu6OLzHe1y0Xtzx8K+SFniOX5ruHUtN6El+F+VjvjpPqdV3mMe9xIkbS3mgaFdLtn9Z7/f1rh49MgkCNGeCurc2M6xd7vhvu9xz5gnm4sEjCB0Iqp1pSTlVb/w8Kc6/Vo8+NdeZawmoF5E5EyTK9AKyII5lHwkiexVOhQ+p+cfm0e7q96nc1/xq1A1hSqBf3es5XJ4tJMTe0OFtK3abLWGsc/c/91Wd8M41cyTCi7KivgJfoazakCxBVS09qHdmPhKXkj7/uv6iqw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3590.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(136003)(366004)(376002)(346002)(451199021)(316002)(83380400001)(2906002)(110136005)(6506007)(1076003)(38100700002)(26005)(6512007)(66556008)(66476007)(4326008)(38350700002)(66946007)(86362001)(2616005)(478600001)(5660300002)(186003)(41300700001)(52116002)(6486002)(8676002)(8936002)(107886003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P7VCHjPxzt4Elu162CnqtNFFOPtelN4k+O7GkIUp2ZGtfXAEDzE0YqwEE1nXR3UKBhKdJA/1U1kg/3MMblsY5LT6l3XmOM9XV53vdImS8t+TNdybTJGUQBH3XhKKO97MmwlSuixGb2fp26InskgC7/o/ToiGotOuYyAevSXh9G6hHjxLQ/e8K+X88fhKQ7MvKPX/Gcz9/9E+mUvbTCKDPxZWHwP6pN7vn2i2XauQ/XiNG2TIDpuVC0/BvzvbV4JyYl2OvJy/uR9scuM8o6hznn6rpZJp7ndnKwzU3CvP012TVR5xRnMkgGhCE4jPzTJtbk1cfJvDSFX8WwNwLrDXFU92Hu9v7Bfw3ZxTRJE0Rn13bg7yzSmcMcarKfY8Fw7eVhFoZYnZdjvEIHOPZosvBivVHWIGkwQJX6DnLOz4Ys1GUR4fE8DLnvTEaqTCZubEdM2niyRgrDYC/RC2DwUYYvB1xp7ec5bv3XbsBzFSM5G4Vtb89P+9pkzDCfpyz/xl1tMY7FX+RcgMssTxpxHpzPiEnRrqBBhrPA/23MElF9BbdfLvtTZcnM03T51G42sc+M61Equ7rgU+9AdDi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com X-MS-Exchange-CrossTenant-Network-Message-Id: a2fa18a8-e9ed-41b3-7fbe-08db624caa12 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 03:02:41.5518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nlVoaBElR7l6F7zcveT56qYb3xhhKPgLsrBX5tRVh/W36k9iFHRy0/lRKhIKuJi9JDDVBnYxzdUAeF2LEJ4KK+IcJ08usbupKg5Rsp8RwOjyQV7c4F1X4MFQg3rqMQ7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6709 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230531_200247_236211_1C840547 X-CRM114-Status: GOOD ( 14.42 ) 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 Generic filters aren't used in all the platforms. Instead, the platforms may use different means to filter events. Add support for implementation specific filters. Signed-off-by: Ilkka Koskinen --- drivers/perf/arm_cspmu/arm_cspmu.c | 8 ++++++-- drivers/perf/arm_cspmu/arm_cspmu.h | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index cc5204d1b5fb..b4c4ef81c719 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -122,6 +122,9 @@ static unsigned long arm_cspmu_cpuhp_state; +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, + struct hw_perf_event *hwc, u32 filter); + /* * In CoreSight PMU architecture, all of the MMIO registers are 32-bit except * counter register. The counter register can be implemented as 32-bit or 64-bit @@ -432,6 +435,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu) CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type); CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter); CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible); + CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter); return 0; } @@ -799,7 +803,7 @@ static inline void arm_cspmu_set_event(struct arm_cspmu *cspmu, writel(hwc->config, cspmu->base0 + offset); } -static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu, struct hw_perf_event *hwc, u32 filter) { @@ -833,7 +837,7 @@ static void arm_cspmu_start(struct perf_event *event, int pmu_flags) arm_cspmu_set_cc_filter(cspmu, filter); } else { arm_cspmu_set_event(cspmu, hwc); - arm_cspmu_set_ev_filter(cspmu, hwc, filter); + cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter); } hwc->state = 0; diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h index c0412cf2bd97..4a29b921f7e8 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -102,6 +102,10 @@ struct arm_cspmu_impl_ops { u32 (*event_type)(const struct perf_event *event); /* Decode filter value from configs */ u32 (*event_filter)(const struct perf_event *event); + /* Set event filter */ + void (*set_ev_filter)(struct arm_cspmu *cspmu, + struct hw_perf_event *hwc, + u32 filter); /* Hide/show unsupported events */ umode_t (*event_attr_is_visible)(struct kobject *kobj, struct attribute *attr, int unused);