Message ID | 20230714010141.824226-4-ilkka@os.amperecomputing.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2193122vqm; Thu, 13 Jul 2023 18:08:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdonp4O0WdzzW8DeOYxUM8LMRcQHpIY5HogLlWK4Wdkq3EBxUZ9FjR4QY3Yy0AlnsP9W8d X-Received: by 2002:a05:6358:9184:b0:125:a552:4389 with SMTP id j4-20020a056358918400b00125a5524389mr4133509rwa.22.1689296917518; Thu, 13 Jul 2023 18:08:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689296917; cv=pass; d=google.com; s=arc-20160816; b=fMFzfkZhSjOJXF/k2B6/GIleSFb1+H6ROEoMKmXP2Obbyy6jK1MsMam+RiyOkhBQxA 3pJtzl9HQn0EI5xASM0R+ncqLZtTvq6qe9Ltzuypz4MZYvLaZZDEKu6xjb4vgwJ3dcA9 EhND8N9HTIrDS2Yc4+rGhyWfnmv7kf6JqnDPh9WDhMXVgUNG7PkVuBTSBRn3WKfhiMrp 2u08kgOkkjHb/qqk8p3dU/VKRMuHa9dlhtg9+XDxH2iqk59rVLk6XP2m89l1t5wCjIiB azZql2PkNcJLpVCFMdJFo+vRQDdCEH2ipXkUbLAMIdFp2H1SBmnefp9oLROsBG/5XMp5 C4KQ== 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=+9tazuVe05QCK17nT3MvqQqUmm72WRzCSQgnqL1GZGM=; fh=26GyE49KjSE4+CIbBX0WsKdZgEMElM+fJ8Bjkxk50VU=; b=DVuaXM7rIbq2yrtO0pXHf4N/YaVx9IHdFJiTYH4wpex9eNsMLnaMT6pSgJdB6j51VU WsGWKMz7WQaYttwau1oEwJSduP1GEjfFxdvxqxYCr+skPYKOrm+Z+gisDQheFQfMzv7G Oo28b0JdcDAJHu/mvGwOEmA5Yw/HOz0qAxK8MXyAQ7BNOBysarMnHS+EJQDUebR+DZvZ U6A4+7g+kN7v+RYH5W70VmEdt+x09Cw3H3SO+vWEPBhHi4MOUhq7qfWOs0XLa29eTZfn 27zK8aM0wkVe7A82PcCpBx9hTh7KcCst+jG8fBiuxXrzjZskvc504PJIw5saYOe6aMsv vDhg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=afUr4LR8; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id in7-20020a17090b438700b002636ac73ffdsi278321pjb.63.2023.07.13.18.08.24; Thu, 13 Jul 2023 18:08:37 -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=afUr4LR8; 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 S234639AbjGNBCr (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 13 Jul 2023 21:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234613AbjGNBCn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 21:02:43 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72802D69; Thu, 13 Jul 2023 18:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmEY7TvI9bnz0cTMlwVyy2i9GRMvm/h7xNthtzeSHl9sFtCoaUgZukrLv0mx3DTtMuYpU/QqsciWG4iEs+cCPAgRfbo5Y3IqKwfGWlf65bNon+8W2h6dFOc3THu7sA3Mb+8IKHHfUQY5BaevdvqX37+Rf+pfOSi+cbIk5UxG2JwJprTLYcREDL6uIDUWJfhN1fiF4dnbLG5Mgu7FqFCvhngXeZiyFTjaALO7SIDHZPfP6EYzsPSOLrWQeOo400ygpNUtmoU4iiR7zYy0J6BFVVFYuuolEVKd5W/llH69Unvan0VQ7wh7UcljTmpRpLY52Cn1zS+ecpomBkt6wyyPUw== 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=+9tazuVe05QCK17nT3MvqQqUmm72WRzCSQgnqL1GZGM=; b=QZURTLfi6MOeCPNrtrAlEeFdhQn+UgZC3d9/zWKOu38Vm9w+oJziN/Zz+F9bzcDuOQ9cqWXZvP6cll0yBga7gSwsZjGBUo6Vo/fXtCsmnhq6NOrsJSPdTkvVbYkz+S7UYJw6vmYIIOFb9lQYlq9KZcaEDAb/gcijNmK37qx40xdWBeBeJDCuUR3Nxk+0JFRkYt8GJv4ZOkEcEj+OCc1Ipe8Au6Quw5QLE6XsHRsxd7r1S+ybBxkFwpNVoecaXAiURZ3BAhoPzLgZT2hPWF6GTMjpDk1WIf1V6u2/dMgpzQGxi7c3jBeSZY6B7ikNgAKhSeWEQW/+eTxUgFVf0vMg5w== 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=+9tazuVe05QCK17nT3MvqQqUmm72WRzCSQgnqL1GZGM=; b=afUr4LR8ytU7YvSkWMALrkgsykVssMNCu60GY3wme04hMlOoIFvXuZetjaaMDrTsLTr5zA+tBlFSfsnkR8I0g+nHcjMKeWuiZ+WOWEfRGQBgDZ7TvRB2xaZPMSHlGYTku+Ot1ITGl5GrxwI+XBCXlCW2OW6s4v0LdfRq1Gn38cU= 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 BY3PR01MB6611.prod.exchangelabs.com (2603:10b6:a03:36a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.27; Fri, 14 Jul 2023 01:02:31 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::235a:622:9239:3963]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::235a:622:9239:3963%7]) with mapi id 15.20.6588.017; Fri, 14 Jul 2023 01:02:31 +0000 From: Ilkka Koskinen <ilkka@os.amperecomputing.com> To: Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Besar Wicaksono <bwicaksono@nvidia.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Mark Rutland <mark.rutland@arm.com>, Jonathan Corbet <corbet@lwn.net> Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v5 3/4] perf: arm_cspmu: Support implementation specific validation Date: Thu, 13 Jul 2023 18:01:40 -0700 Message-Id: <20230714010141.824226-4-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230714010141.824226-1-ilkka@os.amperecomputing.com> References: <20230714010141.824226-1-ilkka@os.amperecomputing.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CH0P223CA0013.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::30) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|BY3PR01MB6611:EE_ X-MS-Office365-Filtering-Correlation-Id: dccc69be-d871-44f6-b83f-08db8406002d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kx4b5ouMq/YFSKJVYW96DTkOe9jF6CldRekkQKm52kNqaO++H9O2fRzB6urOBOGnt0KrE+L7vag3PcWwIVm3trG7makW8z0lydx6kB+eHTJssEypr83C+dRdPyImmVVl0ZGBjzNGYI120X5d4t1RBP6vka2T728BODh8XvjijQZ8xNkn3xtBEWTNUaRyg5WLkevBmf57nAtv5+BAzBjapbjho/uy0ssNeQkFJLKcXy+1PQBvwZAxSQ2lUMNl3V+1CYnawn0FDmHe0UPdBWwi0Cz/qdEXLXi1NA1hWkglSfGiJzgiF5qgSLfSCXzsaFptlcb/6DX2LBAgOQCJVpqwcLoKMg4DqU8EnTWwnbQRfoyBGzlpi6qNUX37iC2Jgt75Hb3BcpNLj9ZHBFSD00ZeycpmpRSAa1Coq5yYvTEwTufqrYXhwl1pM+Pn/9EIx2QAE5YRwTAHERO7AY3ttwyxrFu+YXYgY504IbpymbAbDJgFmP1TtHDAKj+ajs70SnX3Io3Ev1Ac1dV5Jo3SX2igYImce11/2FYE+SaiWwJcxqgskdf5Fw2iCGDXFc4Jiv19b+4SgmxESjH2JTb3m5AqKrLO+eTWjVsqC7sJymfu/3Za3048ijLLssiQl45rNLMO 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)(366004)(346002)(136003)(39850400004)(376002)(451199021)(2906002)(38100700002)(38350700002)(6512007)(83380400001)(186003)(2616005)(26005)(1076003)(86362001)(6506007)(5660300002)(8676002)(8936002)(7416002)(110136005)(478600001)(6486002)(52116002)(6666004)(41300700001)(66946007)(66556008)(66476007)(316002)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0c7sVpTBWFN2ChyTz119wBvWNXTXcmHh8Gw2ZD8NNrUH7E8USNnzjOAu99GyMfGESYnIFIxERTe9C+M8CZoA5/i5fPqSH0arszcb4w7BWcjy2+xaGvkZP5vwELziwTV9jHsCSDe44PRXAyac/GDjEqAL5fzMiG1tBKRTNhdCbBVgxvLlFZbK4+bDlOSZCacyQ9/krUjDXMY950epQPqJD9ACkagAd2jsiijK023FV2ej18vxzqSdADDHUgzOY24iRtROIE0oCqe7LKYivCx3BdB1Rcrx7T0kop6KsapquVNk2VJb+KyxsJzkhr8foW6ZvjHOYzI1gOQGWe3uc0JsUggLl/9nuMjsmUAN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Ba8PHNX44AfSAB3MEZlDIjiIkEORO+VrcGKq/4n5jfPeQItGWMeM08YU3+YAv72BuCJu6Sb7E6U9IVSRFod5XG12p2vTDLabWn9+9AD82ZxuDEyZIMOsmrRqjc+dNRDaysUr0xU7+ofFdnE9inBc08hdVN/StZuPqW7UjL0XvDipkHr63EWi5Fe2j634bNpAhVw= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: dccc69be-d871-44f6-b83f-08db8406002d X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2023 01:02:31.2553 (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: FFNDnIvJ1DniGw68Z/UZMvSgbAKGw6z7nUAgguYeH8XR2Mq4SjFR6Xccx9dD/LD3tRWUMUB/MryvID/Ov3RDG0dpMMh7Gw3rkqAM41z4R1Sj5wbFDX/7dn4OImT5rT5Z X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR01MB6611 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771356204566283101 X-GMAIL-MSGID: 1771356204566283101 |
Series |
perf: ampere: Add support for Ampere SoC PMUs
|
|
Commit Message
Ilkka Koskinen
July 14, 2023, 1:01 a.m. UTC
Some platforms may use e.g. different filtering mechanism and, thus, may need different way to validate the events and group. Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- drivers/perf/arm_cspmu/arm_cspmu.c | 8 +++++++- drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index fafd734c3218..471d6d7ac81a 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -553,7 +553,7 @@ static void arm_cspmu_disable(struct pmu *pmu) static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events, struct perf_event *event) { - int idx; + int idx, ret; struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu); if (supports_cycle_counter(cspmu)) { @@ -587,6 +587,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events, if (idx >= cspmu->num_logical_ctrs) return -EAGAIN; + if (cspmu->impl.ops.validate_event) { + ret = cspmu->impl.ops.validate_event(cspmu, event); + if (ret) + return ret; + } + set_bit(idx, hw_events->used_ctrs); return idx; diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h index d6d88c246a23..5070d34c2285 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -104,6 +104,9 @@ struct arm_cspmu_impl_ops { /* Set event filter */ void (*set_ev_filter)(struct arm_cspmu *cspmu, struct hw_perf_event *hwc, u32 filter); + /* Implementation specific event validation */ + int (*validate_event)(struct arm_cspmu *cspmu, + struct perf_event *event); /* Hide/show unsupported events */ umode_t (*event_attr_is_visible)(struct kobject *kobj, struct attribute *attr, int unused);