Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp431518rwd; Wed, 7 Jun 2023 01:49:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xgLCi4EVv4w5jtaAZfmtxchm4waYAqFT5iE/X6/3nES8aHV+Pi9a0Ss6NV+lNjXeHq6w0 X-Received: by 2002:a9d:6f14:0:b0:6b0:49d:15a with SMTP id n20-20020a9d6f14000000b006b0049d015amr4764314otq.3.1686127779376; Wed, 07 Jun 2023 01:49:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686127779; cv=pass; d=google.com; s=arc-20160816; b=PhRKz+ZXaD5VT8/xIP/4bwBxA7UsHb5WXXEYnUZ6hfTrBwS7Ow7UVsxZxTDQhycC8I jxAx91E20VNqlAGL77WblSH+j49+JDqBvFd9zkqX9vRmJA+yEkF6WArHJKWaHFe2l0QA EYfc5ky2tykv6e/XrAHT+j5u++WQDGMQ8Ge9p76T9QRmutNhIv7AjEV+E+VRtu+OIj+z eptDwSLL0L6jYXERCXxuM6PvXiFfUaYCYeDp19u7BPmDXsNc9xDsdaVsRkMxlunlENvR S44jt2leOA5jfYxE6SuvAlETZiOxEk3VKijvaiApF2z1quwqPj4RTwnd4A2jDy7VTZ79 FaQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z0eoh+Vvo8fahUMSQ/WbE/8KYLoyFe/I0uhsa3+sAt4=; b=yTgzCr9m05GYmca+/SjGgrOhWQTGXv3jteJ1bQC+WIuAPIrX8Vg6ibshLKXrmms/ar jDiQqPy/OSr7qwu3QwMG5Z51vr++IOenPuk86tcoQFCwNrvvWysce729Hk+UEh0F59t1 Hax22P8Z8X3gHfA00Y+mmCpS3pHdKw/J1mJ9xl2t0DpxHNEdchfavTpzgr5XIrTRLsAN UPj7nHbx2CRVTJo/NwzFkT112TAMaVadSsxBYoZX+joCnob80b072tzcXNrgz0oDFO/9 UxJheMpEuiXiTVamvF8icYOl5A7/yrHof00p6R+lEhCe4eRFQA9UBcxb0VE3QU+CPRJY 2jFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=oz38jWuB; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a639547000000b00543b1713e9esi4626005pgn.722.2023.06.07.01.49.27; Wed, 07 Jun 2023 01:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=oz38jWuB; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239234AbjFGIc7 (ORCPT + 99 others); Wed, 7 Jun 2023 04:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238721AbjFGIc5 (ORCPT ); Wed, 7 Jun 2023 04:32:57 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2102.outbound.protection.outlook.com [40.107.243.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1959A199A; Wed, 7 Jun 2023 01:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GCgeJ1WaOVE1i9+jWkVoPTaWYjcrSjW2U4dRcbNblPkLNTtJVDmBTRhAdgix1FlFQnK1IgvkrQUNJ+yWtaVbCa40n/eo5PYX5TRELiG8AQNydm4PtsjCk2BRQWne2FMe/gCpt5OhsXDgl2fbo52K1M1lvq+j6pVMiuGKpCIxM1Eu6TQMneui0qLNgyE822Pgy99FDoq/wee7Soai4dyWJ/LWFQNyfWXOnSp3tQhxpc0RkcRWlbBk2uGiDHtU03tBv8NRipw2TK4TADIyzeO2pFZhKPjIgkSxqQ6naeep08cNl9tNkAKi0Lu21Ehgf1Q5eRmb8RqV0Vl34zqT4LIlOA== 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=z0eoh+Vvo8fahUMSQ/WbE/8KYLoyFe/I0uhsa3+sAt4=; b=DCEhp/pLzpibRxCja7I4FhfEatjw6bw56YFjUjhXY5bo0Oy0K0Dx6xZBNDUV4uYkx3eOzRs/ERXLLPEQvwsbj+zz5w6F00DK7WIw65hh3tH724EcUYdr51O/CR+PO5zsNQrVf7jnqXmU1kwSAR1JgLC2XaiA0wyRCfrE+v+euCphApUbLE77ZMmJJqP/FGvGD87vhN25VwCrNzCaZg/3PQL4o8WGvqOsHM2E9FK6RplYNaBBWRvZwhIW+IUuQx9xPqYsQ71iiBtHtpBVppnsZMb0TPynwJURQYTs3J8PMQJG6IhGuPO1wZzA2PWDZVcwNxaxbEnWhil7sCe4gzzv9w== 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=z0eoh+Vvo8fahUMSQ/WbE/8KYLoyFe/I0uhsa3+sAt4=; b=oz38jWuBYXEBfTzj2RO0sLiw82zJHuPecL73JO4SGV4vxX5I3EELBPhqd37oPDZLWzyYXZF4Jr1VQeQx1l4FVeYYvxsFrqZ9f5JHArHHH1XrbHCQdtE7AUDgbZiCW+a3y51KJ/fPtJP/PuA7whAh3uQxrRvxVpvxIGZA3wqLlVM= 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 SJ0PR01MB6304.prod.exchangelabs.com (2603:10b6:a03:297::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 08:32:46 +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.6455.030; Wed, 7 Jun 2023 08:32:46 +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 v3 2/4] perf: arm_cspmu: Support implementation specific filters Date: Wed, 7 Jun 2023 01:31:37 -0700 Message-Id: <20230607083139.3498788-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607083139.3498788-1-ilkka@os.amperecomputing.com> References: <20230607083139.3498788-1-ilkka@os.amperecomputing.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CH2PR19CA0009.namprd19.prod.outlook.com (2603:10b6:610:4d::19) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|SJ0PR01MB6304:EE_ X-MS-Office365-Filtering-Correlation-Id: edc0abf7-958b-4da6-976e-08db6731c55e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dCarWHALdyP/0WlcbHtxdJ2LBe+WEeqjuEU2fIeajcYbYyFCB1S/uITYRz4KxL7oTq57F2ExpVSA3u3IR5FQzu3B6801qM4BFvql8i/GLGfzlfFIQCz7Dpd/3FTFNfqqqlJowexD9J5OJztMPx4Waon70+JNsgP4K57udozDUrzIbQryHAW6KhYaEUIMkWcxHY+RBuvPAz3LsRkM5bZU40y0o+T9Jp2IcdZ3LI47M7wRKWCxbF1/PR6o63TEHdnyeY4zeEiMKQDne5Br4XppXh4ZMw2hEDxgsCL7Bv7iSHQ8VQKpXOOCSQo/woPXNU9Bv3CHfNuYyVAPbDmQpU4Lg9w71usLRDuhslho3LTk1Y1QtgYuRDL4FafjnS94B7WoX09m8imkqPrL5HnjgZZ7UB4vdmY9V1e87enq+GQlxTry8EUPL8cml2fySSP1mIgkJ4aIRHOkmIPHHBtL95akKgQ3sR8DP4n1//yiXDv/fjiNdTMb4v/XWvfEC82lweejrynccGEk9JjJ1nnIhYxh2xe6W/B5abfcqdDVxTBtLcde9X1ndZqB0ZijNUkJ5LmQncFBiqXOjU+xMgVOJk5HjntwIa20HE99e9Rm0xBN5kO3UWPIwhu+Ojrss/kSBy1/ 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)(136003)(39860400002)(346002)(366004)(376002)(396003)(451199021)(107886003)(6506007)(1076003)(186003)(26005)(6512007)(2616005)(83380400001)(52116002)(6486002)(6666004)(2906002)(8676002)(8936002)(110136005)(478600001)(41300700001)(5660300002)(316002)(38350700002)(86362001)(38100700002)(4326008)(66476007)(66556008)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?v0Wsy+ITHFmbbqq0MEbheCfqqosoWjprTArzFbToxiWKKTSZczB6EwzX7eE7?= =?us-ascii?Q?7UVAukawyHHiQwFisIm1r3U83zUErPW1U6rdRza9qs6apKZT49UWt7w8cFSh?= =?us-ascii?Q?Y8vIUnX2MW/Ii9N2vPyudb4C3Oc47sIss3E6xho+5PvMrjwRBzSxjucMzM44?= =?us-ascii?Q?ktw+DM5mcAZdpTUTb2CZQYvjhcAIcPDhiRxQ5NTmvbUme5AeM8dl2SVk+t06?= =?us-ascii?Q?RlXR87BghO+2CBbSlfcAjcKnmHJ7OGbWSJQh6buBxPNSJnb+AqkcJurPvXW9?= =?us-ascii?Q?HcIBbaJYdr3CMnYFe2I/NDSkqrtgTK2abxW7XMJG1wFbDQQcZ+JuxtVeFwS2?= =?us-ascii?Q?wTOnWxtMEQCvKqxawqHOkk62alol6r7GRLVL7kFXYKzPJmLJ3gkKObf8lghw?= =?us-ascii?Q?aT2B1w5ZO62x0mzq6Qv2A4c7yU3qql9zIX88symR+lb51Q6IFdsf9C/eaeHK?= =?us-ascii?Q?I/eqXqruch/WrVaplgIH1Xv6pB+RoHjHZknK2yPurRD+vCvHwtdu07JYMafQ?= =?us-ascii?Q?RAA3VI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wVG3wVSdBEmnCQFAVOY5?= =?us-ascii?Q?62Lr5tvL4fk9/leD8v5IPVctPAfuCqIBLtw79SVcJ0tVqDpM27u+ZUOnc7Ew?= =?us-ascii?Q?5XUgLvD3qq0BzGFEdTUzcqY5Le/LGktSb0yEZ8umCboYx9fmW7sjp1oyT43t?= =?us-ascii?Q?0czFh1rYGK9HZ7E6bv4Wply2CZ8ZnpOf42Plx2ejnKHeuaPDYlyHEz/mDPoo?= =?us-ascii?Q?Sg=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: edc0abf7-958b-4da6-976e-08db6731c55e X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 08:32:46.6864 (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: omVLUv0nnBTFjFIGr+qZn5cYNJdLCxsuvNIO984HygXu+Who/Lg6Nxhh4qEJjT1fbctt3bMWSIxgFFO8CP1O0L8FvOPaZ42BUfsqSi9krTkyam70F9rRFTcusKUGzXVF X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR01MB6304 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 f8b4a149eb88..72ca4f56347c 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; } @@ -798,7 +802,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) { @@ -832,7 +836,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 51323b175a4a..f89ae2077164 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); -- 2.40.1