Message ID | 20230913233941.9814-4-ilkka@os.amperecomputing.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp117vqi; Wed, 13 Sep 2023 16:41:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVdBuDl/baZhS2M1rVjCk2S3rehw+XleclHyof+KqAjZDG1vf+q1DrDvX0pCLaTyVH6MdV X-Received: by 2002:a17:90b:1d81:b0:271:7ce5:2572 with SMTP id pf1-20020a17090b1d8100b002717ce52572mr308135pjb.22.1694648516301; Wed, 13 Sep 2023 16:41:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694648516; cv=pass; d=google.com; s=arc-20160816; b=d38/xqYWftd2CYT1SA/ZdPhdMD0aX6Scd4jwgMDyWOhj555lIg8v6GwXVOBILeZn0S LtQ0gxtMyTNtzlZGRe+54Y4O+h7PrhukzuqWiuj/2JI3V0gzD7S1cDuLVJ52yqopssmF ecrFHdnFsiUmk/YirlBw7+qVWX5QyA5HKiH0hOki5+IY90f6IzoEmIfmN0mqhshpQSq2 Mtj1AwvsHzQVaBTzQyuJROasxsZ3sR2YGZDZDC+Y6kg1X85vcKSdoAvSuOAaE6lh5oW8 kMbEWMOlu+Hb30YgAsfeVTlRZcwQRKaOShXb0N45v5dKUC1p4LCmbMA6kXUOzW0a1EYQ FnWA== 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=W3/J/RcVZVEcbTEF3idazog43gf9tPcFmeS+D1eu1VA=; fh=IEoFe2iQFm6SUuCpNpNNbiKaS5TLJmb2jz2vayPQO4I=; b=XYZXKcZHptUVn/3b1LrjGAv9iXPAgcYhI0VpRXeXgcg6qM6WUZI4DvyvPjWluUJtSX p+MmKa8SNHHYU6SFYdQWPttdINNJCwZNCySfv36qSiQM8+MT7Qc3svfphFOYuYjQU+th 5Vuei1+VCTVpa68E0aIpq+gzQuSmbOCBtZ8x9wBQXGdrsvQtOXc8bBIFlhapr9HZgB7D 3CJ+/5vK/+OQRSpfvTIyQBmbwX6qJ/nDLXuIT7CWDKsSfBSZvDsUPbjYQ+Ydfbh3e7JU 7crC34LOdmgQJihMrJK5QVX0vC/k9SdKwlO7H3DxiWC5Rrea57Gu2ivxhjaZ7x6S1uqD FIiA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=CYU+VKln; 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::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id y22-20020a17090aa41600b0026b46704d43si366178pjp.92.2023.09.13.16.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 16:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=CYU+VKln; 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::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EA9A180417D6; Wed, 13 Sep 2023 16:41:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233232AbjIMXlT (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Wed, 13 Sep 2023 19:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbjIMXlQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Sep 2023 19:41:16 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2133.outbound.protection.outlook.com [40.107.223.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6DFF1738; Wed, 13 Sep 2023 16:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coumVvkFB/SEa6SQ6GG5PxC0ToURn8wKYZuExQF0vq3P+PfpSMMarM2hsS5PRAqc43oNe5TbX1Iu5b4HWhxVskaTJ6mYlVzs1oHGsS6fAzzTswyGpow4CV0zpF6exT4KuQOpfqt3GWfgPSCq7JW0DuCiJo5cDAonZMJIVY0vNiUgqKp20Pj2M7MpMIvcwGT3yVOcaHslaPcpov12Dp7qY3HtKbASVXjgPNCzDm23sjlZfLeiIImm2QPPYPSCS2+1JWrW0iykPTyueswLuRiq+RvYpzlH80HAjn0HUSCMWIni1a2G/Bk49LulqAJkILua9Jv1WBt4ACwgh3qt1mNluA== 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=W3/J/RcVZVEcbTEF3idazog43gf9tPcFmeS+D1eu1VA=; b=I9UT0CrefpUePnFteNGZggDFH17AeTXFEQkcbsSNozdievC/1eOfHhXwokQWb8is/mx6ng9PlOz0DxdB0JAqzYs5x4r+yf+JvNkfTHKQCfl8xHyJbonp1rHHVKFgTFTKE45SBOTDtx2PjWqm0Fayrzg2fz02lWs4K3depXULyONtrFMVEhWQWTshJl47brLmz3C2ec4JjnC/gX+WIbMSpPv1ubkPhs11cO56zpKQtBVPolOa8NVvWvxp79LgJtSRqOJOZW/kdGZrC2mDkmklgowEQ3nxxGHe71+x3kC94Sy3V9mmEhFyhUJUHY5o8sF9X54PMAVS3Ix1qKyM8wMGmg== 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=W3/J/RcVZVEcbTEF3idazog43gf9tPcFmeS+D1eu1VA=; b=CYU+VKlnNMGxUtqeNJMvqdVbp18EYJcrwoAzaECW/sfsDZEBvUdhCDP+pszbThKKwxaDn4dPbjEV8sTwB1gaMSPWoCbAPD1yD0tWPTA2WmTICXTrvBOPvMQwxDeu/kNw5jdXcP9keOVRlLDZsmgVej0JMdukMdSiHykuRABpT4U= 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 MW4PR01MB6241.prod.exchangelabs.com (2603:10b6:303:64::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Wed, 13 Sep 2023 23:41:08 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::bfa4:8250:f526:5015]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::bfa4:8250:f526:5015%6]) with mapi id 15.20.6792.019; Wed, 13 Sep 2023 23:41:08 +0000 From: Ilkka Koskinen <ilkka@os.amperecomputing.com> To: Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Besar Wicaksono <bwicaksono@nvidia.com>, Robin Murphy <robin.murphy@arm.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Jonathan Corbet <corbet@lwn.net>, Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v7 3/4] perf: arm_cspmu: Support implementation specific validation Date: Wed, 13 Sep 2023 16:39:40 -0700 Message-Id: <20230913233941.9814-4-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913233941.9814-1-ilkka@os.amperecomputing.com> References: <20230913233941.9814-1-ilkka@os.amperecomputing.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CH2PR18CA0040.namprd18.prod.outlook.com (2603:10b6:610:55::20) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|MW4PR01MB6241:EE_ X-MS-Office365-Filtering-Correlation-Id: cd72b84a-bd02-4238-6049-08dbb4b2e783 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UHen+zY4EH0FmrHTZJgzdv4kZ7Qtyj8sBbrpCcpTw9XWFwVccfQZ8mjE5OIrLwYpWAjbngjqO55xvFqN6QxLWku0xv/S/JI4ABpAz00XZeHOmTXNHAXKrL+3ADhcYhDibU8z3zsYjtFerjAwjGz0s9yJaXPco4YJvJGW7ZRyNuVMGvgl8uKumH7YZW4WS/TjAw1CBQHIDzIOcCXemx9UvMRZGrpU3u3evwBFMPfUB0tbQXKRKjQULeyedh6Fb1oy6grOjcf3IRrlAIbMpiXilDFKpRqbJmaMlSQ+7wKNyj1pkua4Og2nbC8mnj2z/kKg+mRU8tnXfKDt4xdDMrLy9dwt/46jVtYuarhmb0gE5yiudUWU/Yb/bV2Cyz3t/QbwHArK0NCdnVhzjCLYSLAqn4YkyIYlMNdVyFb52QfiVSu43h7ksD+uRrsyaA7bS+DfioF65Kw8wFCr5GVsP5sKkAkMJrNuOb/eBlrUGqjdmt2xDD6kexxi0K5UouXiSX7tNHtsWVj+uTPamzo1aY3NvLTONGhUgTivyVTHD92YuP1HpF2I1D8FNxSRwmfLACcIJ8MLKli0+NAUCPDDOaFUnQxb3R4g+rgM2K9D9EmyJrufuYgE7s6CVjm/nWGq6YzN 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:(13230031)(396003)(366004)(346002)(39850400004)(136003)(376002)(1800799009)(451199024)(186009)(7049001)(52116002)(6486002)(6512007)(6506007)(6666004)(478600001)(38100700002)(38350700002)(2906002)(2616005)(1076003)(7416002)(316002)(83380400001)(26005)(86362001)(66946007)(66476007)(66556008)(110136005)(41300700001)(8936002)(4326008)(5660300002)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FwZL8D/88+d2pU64tOe06sTXGNt/nDackjroEwhlf6P21Nh0Hb6RO5M61HpS4i9TmxH/3jkd0el6pgG70lsg0kE1O+FC7mVqakIux0iXU+kDVeVaowoNnjRxmvMebrpWQpFctGIOQFpRMX7nCISlPYyBnlGJrmJ04u7Bd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uwt5QcReVnOgwJsJpaUlnagAVGfw+n/2VF/9+zyJwUyI8ocZO68b8za2gzXAWs/HQiSJa8Ay62bD2ZvcA6N8j51TgNKLwAy4IeWZfI2z4zS/oq6vtSr8q0VZnQhYvzGlKdKiV6S3EjXlsv8vywAFL+WZ7ogGf4omYY6r2pligzuUc8kr9/GbO+0PTLj3RsTpuyUpHcHjVO6OELLITOJl3rXxKGRCfnQ4cwtmgQgZu0TuszHxnABY33VPIGolIs3FS9dAiDKzGNMgG77otIiPOQuY+R9JNANqQXpmhD8zwgFTRlx5iXJ9ZkWBa/86/aNC+wgrx8WQ+pMfmzoZ6EwlSSd0jIpexXJ1aqNVYh2/2BihtnjVIffRP8OCenYpJNZTmuqkWRcRp9ftywU= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd72b84a-bd02-4238-6049-08dbb4b2e783 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 23:41:08.5293 (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: QaCvjXbD3Cl//tBOkPA1h0voDF42/F3nHO4+IXn2xKW8sEb6VE826keAKmB29YBfcuru50We4ugxIgRWNFGpJ2HeS/7cTWAoexzF8FaM+yDi31HeOwkTSMj/oufazCin X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6241 Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 16:41:37 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776967762758288031 X-GMAIL-MSGID: 1776967762758288031 |
Series |
perf: arm_cspmu: ampere: Add support for Ampere SoC PMUs
|
|
Commit Message
Ilkka Koskinen
Sept. 13, 2023, 11:39 p.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> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.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 2ecbf8d7714b..1ba00d640352 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -576,7 +576,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)) { @@ -610,6 +610,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 e0cca5b4aab9..a30c8372214c 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -107,6 +107,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);