From patchwork Thu Jun 22 01:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 111384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4756908vqr; Wed, 21 Jun 2023 18:27:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jHR6RajL2AB10CltKDQa3oYtVIA8eDTM/m8qcaNVvzliwcFB7iZkLl9on/Vbu3IJgn6nD X-Received: by 2002:a17:902:ef8c:b0:1b0:378e:2768 with SMTP id iz12-20020a170902ef8c00b001b0378e2768mr16054179plb.7.1687397239919; Wed, 21 Jun 2023 18:27:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687397239; cv=pass; d=google.com; s=arc-20160816; b=H6u6zoas3t37L7GDOzNOx5DhP3TTa15Y9N/y5O1/jHEa30n2n/J1G1zpSkrkKeDeNR 9n49DuSfdHKqlJsbG0rQJv+hz+5e6w88/CwydF1QH4pEzc3Zovvg5U3FwgMJNgzoa6FD e59QSCrrDjz8vIYBSvMJoJC1u2TomiKVquk9Cxh7eN8LCNEd/GQKdQDyYjNOcRkB0zBo 3UJqs8P8ipfnibBjyFdhZpWLrrOMVRc531fp/Qr/a1jd8+aKN7m/hdkxOMnRO+rebCd1 j/a+S5ODBEaRzP/LfX56jUAHRCMyFcqdTZNUcyVhiykrBHnYHHO2aLxyFBAwohCHF3xO h24g== 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=EyMeNQ8VaSBnknESOsgXFmP1HiOq2LuciqZ4VQX0NLQ=; b=S4Ey9EA5ESuOI0YJSdE3oROdlNVDXQdD5XiowckwZtbueCRtk02b0nti8rT1TRJ9U5 Igy7XQxhKL6HOlj48c6KdYfX03+Su1/s+hZ3hCGGFoYA/BWNrs/wpUBPPRSxUuv+4xRW kfssyVPEvIcELBi30Ni+cc0/HLXm0TFdVmnU+OCoU9tXWf3Obv14WRYDfssNsnFXpxYJ A6fbMDZfJ5LBulGoPNGt/1vj5MxLlazPmeyHlVjsUblKZOirhvc04WjqoJZ6lf74pEDT r+1qv48G90w4hUVn1OOFIj7E/zuCJfmRunrP+3PMknjXzvnEmH8ZRhYxFxXsPrRZNgWP B2Ig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=pibXVK4H; 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 ku6-20020a170903288600b001a2513b8e14si4962394plb.84.2023.06.21.18.27.07; Wed, 21 Jun 2023 18:27:19 -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=pibXVK4H; 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 S230010AbjFVBMf (ORCPT + 99 others); Wed, 21 Jun 2023 21:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjFVBMd (ORCPT ); Wed, 21 Jun 2023 21:12:33 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2095.outbound.protection.outlook.com [40.107.95.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A0010D for ; Wed, 21 Jun 2023 18:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dRuklgT6U014cvzJofzj7ZjO2yYZu7m8u1xtH54MrzD2mH/bTE1w0fl2d/EL+tbS1nOvs93PiDLip3R+HvZRJDlEQ14updBDZIPD0keHU9lo0jM+n0d1FmGWAqZsDf53S12Un1vKRfiGGA4F6xVsY/mtQQnVFVXZF1V+b9BRNVD6oB4hjgCL6hsUI/mDjvKMgeLcphP4UDasLLE+vfNafHBWC3LA6Ga2FdNVnYZTnxwnmjF2GYqc7ZSLYhMK4FJ/iaFfQUT7uVjYBHftOkzRVLv0dtBocXqi7UoHBX3mBSyJs95P2UILCe3Cbdq6GTGuWC8wcvmNKM7qViNIq/r4CQ== 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=EyMeNQ8VaSBnknESOsgXFmP1HiOq2LuciqZ4VQX0NLQ=; b=AaOZ2ULwX+KCCPqv4mi7p5g9YJ+1OZNgJwmyKIJEpHdRc+GEzEbok2s7tl7JN8N+xBYaRtWc/lt0gSRx73S6ZyH0k0j5Th7xdJT5WCu4ZhQy6AO5xIDPffD07qrFI2vwnb2tZhQqYxwRty1dQ/61gkjz+2WO29imTNa2NwGKAKhEZGNVL4UXTlaQMyBV7G83aXtLJeKVC9WmnGoJh5abq4QFNOfAPUs0lXZw8nPPaKkM1EM0llAIRa6SZE17CM/sINbxSgvZE4bVMhQi8o3HKgHiXIl7zfhc4fL7+n8gTUeeE3NLfgByQs6a6u6zDvdioQ+hzHP3ad8ZwFxOC9jjnA== 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=EyMeNQ8VaSBnknESOsgXFmP1HiOq2LuciqZ4VQX0NLQ=; b=pibXVK4H/pVSDY5CjuvGRTlj3nHRiTelAvX604C9x5tJiTVzzyGb30FkwGqYAz4b8vf2cAx68YNuWVmGlA9gVYGfGHVhg4FmJDuORAryPC0+bqnUYd7aMDwspl+XAlvFO9xwBu85MZ/fDRYNw2+Ek3XX7WXynynC/BLm8/QYCJc= 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 DS7PR01MB7805.prod.exchangelabs.com (2603:10b6:8:7c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Thu, 22 Jun 2023 01:12:29 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621%4]) with mapi id 15.20.6500.036; Thu, 22 Jun 2023 01:12:29 +0000 From: Ilkka Koskinen To: Will Deacon , Robin Murphy , Besar Wicaksono , Suzuki K Poulose , Mark Rutland Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] perf: arm_cspmu: Split 64-bit write to 32-bit writes Date: Wed, 21 Jun 2023 18:11:38 -0700 Message-Id: <20230622011141.328029-2-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622011141.328029-1-ilkka@os.amperecomputing.com> References: <20230622011141.328029-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR13CA0017.namprd13.prod.outlook.com (2603:10b6:610:b1::22) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|DS7PR01MB7805:EE_ X-MS-Office365-Filtering-Correlation-Id: 794599c0-eb21-4ec2-4806-08db72bdbf80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3T/ANUbScoYp5dWglgH9lY2+1DAL5BGiZYCGOjEdxt1txH4u+1QVuBl9oOM4z1yS9dlQKaOMM2VQ1464VojjfQJOn5RjdQ3ZX5cCBGxzsyrxzkR+PqizZfTRFbbvzeg+/O6VIh5d9whLUtOeqPIXIs0V05qhrM65AzXysWNLMmlz5nUVwWHBzSHJ6jU/Ax5zGLPchWfChSf4j3p1yEMv/p9jtsAt4J3QRCYQ2h+3bTwEDAkO/m2QhI3jmIMHFJMhhvKlDSENCyBh8jk+9t+l/iLs+CQCb1OOzRGmiZyp0wA2Wnveul7Rd4tMzXAOvLmfZ/bVGLxhqyylCKzAk9ASiULrnhMjW72UypHZJMWjGRz3Ic1veVfVsmHVQDySmC508sdfLlk99M5HsAJEotpoGdXdLasZQXm+a+3p+2SkItK4kBGAXZghDKzwob5cRpG/T25vA3uX3e7C5s/FIfTGqIkDBUY6sHelVKiojkJdDTBg/VQUc9MquU1ZOTgwk3P2tChq6YgiNRkwdQxbjiXOtGQd6OrO+Xo4Xo8UjvbyNCb5YmthwsgUuujWu5L1mQZcyaC0kEOn6kPosYO2YgpabLW06OfhcTVZPWKjgDwN9LKJPmuDOENJfNd+QNENqZAE 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)(376002)(39850400004)(346002)(136003)(366004)(396003)(451199021)(8936002)(41300700001)(186003)(8676002)(26005)(1076003)(6506007)(2906002)(6512007)(86362001)(110136005)(66476007)(66556008)(4326008)(66946007)(6486002)(6666004)(316002)(38350700002)(38100700002)(478600001)(52116002)(2616005)(83380400001)(4744005)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1SyzApxP7MosD/4QAC9nqppPDFrk1fGiaWPrJBrPfXwnCv47s5ITOc4Z4330uywpzR9sEOOjDIJWwoMVjm3ijlaDZ7v7xXT6kyIT9b5jC81lTbHsOd5p+EMexmEehoWmWFPxVbrt0JXhRLfD6fkfaNKL1FG+KfDaw55G02R5GkqshVMhHZRz2IZb7tlzF5rrN9JXPFc6XBk48/k8p1mpEGAJsb3/VS+Igbx+j2pFJS5hm0YKG3DITJ1aAg+r/Z762t6Hcp1rAUDOllPJB3JaaJ0LFk8D95QVveGqjusvIF63utSDT22/nIn3kMDH53DCENyIa/ebs8SH3hLOv0PkpdnD59XrtCJ/M9cKccL8rbuCiB1LcnCkq1TvgzdHoAsDzcm69vPUJkspka+I5cgHo7wOzVFsv4I6hJ65ta7kZqIJKsOVS3W6irHLSMlO9xukyoERwgRE5AzIzqFG+nVG/9xNACF7WX/rwqu5pH+n8c933bziVNB+Y3CkSHe0R3xMiSZdKvUOygYSWq5+82/z2ggqQi4VxWavJPEU5mW8V+o5UqHJLzEr4XQa/G/Rqc4LfequswwlvnzQRq0a+Vy05qWNfxt8er3FyA27ABVC81UK+MqU1WIn8VCgSGk0uVHMN7bWxLy0A3xvq3/JqTyvBeeUmvXqksPumQqBxYCWDSFdhMghwpTl7IokZOAuNCE0gNWBYFfnAocYUyXESgqX7UBIw6JoAtc+lmoA0RppMxQA0Oi5ynlld86oJP+YL1Y0OyK++wJAyLSKYexg9SCa5U6Eh3xjNiyrZFD0mDILFeNMKIHcjzXCIFsdNca8FLR5OcP7cWYYg1CVwcoedJeDdJA+iMItjqRX1PkEGRLzkcyk0KrcV2IFytU08g+H6QCXMOgTjb6E//8oxASF/qrPK0bjZbPjOCiY7my/PlFumDxz8zhknUDA5w/2DqT3GpwQzOprVhdVRvdE1kPr4g5mfIgE7MzPLe7CX+rbxt7kbg5lPFB5v7pStOI9IpT117gLkBz7Q+jCn0bj8k2WrxEjeEuUmHzf9dzgFzXUtDcNqfNLfs40+7hkOK7IEpVn2/Mo45htn3S/fOJhuJwe8eTlyGktJnzS3fmUXzKfu1vUsRloDnx+MNqjn1KME4JRH97R0QwuIdg4+D11p8ePRysTO+OkHV9QbkmckwlVI15L73dfV0stgyAjHzGjCjRqt7Z3DpbK1XrVw2JMiUaaEqPDK2GUJaWLlQqVALKnXFbbV+NNtvOfOoFrADBBL8smjR0H0qvwOafOF+Tw2G84JIVbDKmVMheUm0TDcxUtmESOm8JSlpPWJeMeE0Np+Q9tEzhwlpL/HctWLc7JvA4NaTiWiYcuN0i5IJ/cRdBly06lYn1e466f/2t67N5lk6R7Q1NGYxUTH0Pu8ztqXetJdtv4tJQOAHnPOwbPV2ErSlTwdhHr9MbWSLcpp9pShhs9pU5AhKbBOTtGJd+0McRSewbnrQJvgL1k8fLy+XmJpJ3P5zqdhldJtPB4K7XJXpt2qNDmrIT67UskHraGAj+UcVCGgqk9qyi3OM14ICHVt+gQgs9P0Dw5D79MCAzV1HWAa3qzbclDWVDZRkWMJf1FW4l0KaOWQYI0j3wIzN1eE+mmlzQ= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 794599c0-eb21-4ec2-4806-08db72bdbf80 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 01:12:29.1639 (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: rzPN8FWw1q3iLGW6+tSVy0WDur8CY2zNXlTvcxIvD4s6JGGE58UzVjB2lErCUbUQFucZmjfDh+Md12diMRqJDRS7AGbE7P2TnMLozp2LgZJvwxO2ZgOpxmIDBla93Iyj X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR01MB7805 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769364248257115458?= X-GMAIL-MSGID: =?utf-8?q?1769364248257115458?= Split the 64-bit register accesses if 64-bit access is not supported by the PMU. Signed-off-by: Ilkka Koskinen Reviewed-by: Besar Wicaksono --- drivers/perf/arm_cspmu/arm_cspmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index e2b7827c4563..0f517152cb4e 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -696,7 +696,10 @@ static void arm_cspmu_write_counter(struct perf_event *event, u64 val) if (use_64b_counter_reg(cspmu)) { offset = counter_offset(sizeof(u64), event->hw.idx); - writeq(val, cspmu->base1 + offset); + if (cspmu->has_atomic_dword) + writeq(val, cspmu->base1 + offset); + else + lo_hi_writeq(val, cspmu->base1 + offset); } else { offset = counter_offset(sizeof(u32), event->hw.idx); From patchwork Thu Jun 22 01:11:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 111383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4756896vqr; Wed, 21 Jun 2023 18:27:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ndge33Sssip9srY0HqH92oa3FK13hOYHo27w99DTjzEAVsz4HJprPBaURMMCpAgSOFtYz X-Received: by 2002:a17:903:230d:b0:1b6:b1f3:add5 with SMTP id d13-20020a170903230d00b001b6b1f3add5mr7821plh.27.1687397236539; Wed, 21 Jun 2023 18:27:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687397236; cv=pass; d=google.com; s=arc-20160816; b=qYVtZXIiBEIgKkzB5lp31H+DUeryizyGhcp5aSLFc2kSED824NDJ/pRgAlktWIxMcG aXdcbBYnZijRuYE3Ggz7X6fVIzB+7mGiiP7cBTW55WBOh0ipzRsKfVYGjZIRbDEmYCiQ OHPCDbPFZkzgz/h5CaPZ4MhV5DFgatnxNRbJR80S1suNVdOHQdqRy/8+90TVWRLeP9P/ lRt+pCvVL0PlHSo2nkXJnQVjjcpD29WbHbQyzxJR5EPUNQgcmu/Ed/Ym12/8vnwgxV+Y 9MceC8b6FQxGiSUn+s3pI11drec+U3QxGMdW7JUjB3WPJDxzH0Xq/tQREfpqDd2dMjr/ D2pA== 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=TUW8DdEbZGpX9/HSB5buvJTgiz7tmh4Y8yrkYhFvdys=; b=q57itP6KV16Jr/UfZ+yCNvNJhQxP0dU02lkJz4FGjB7rmpB35F8mTfnnQMLjUzbiku d47cqaxkGyKPoCbEf9K/TkjEZudD74O+Sjbc+3w89dOvQna9y4k807xcjK0+FAXEolIY 9rm6ktyt79okANeN5zfkv2fkVjTA6LxsTZe+TuBswfJHk6TPyNpSznO9nSJfQyWw8Up3 cymREaodqMAk0+QCyHdtUfuyCEwxavFfVB0iJ0ULnLQHVLOXW/h9wpzU6+J4ZYXw2+Sa qpcQNLZdodCyU/Je+NukpQQF3b+MSsb8X9RTH6OeC9QAvgTTJbYn57NScNAHmh1L6jlo j9kg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Ru2xvST8; 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 jw5-20020a170903278500b001b3c62d71ccsi5102296plb.227.2023.06.21.18.27.03; Wed, 21 Jun 2023 18:27:16 -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=Ru2xvST8; 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 S230030AbjFVBMm (ORCPT + 99 others); Wed, 21 Jun 2023 21:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjFVBMg (ORCPT ); Wed, 21 Jun 2023 21:12:36 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2111.outbound.protection.outlook.com [40.107.95.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19871BD2 for ; Wed, 21 Jun 2023 18:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LN+f+7FEwKNVKvk8eLAcDQrO/2lAWqLgNGoh40dpGzROglh1UHib2VfRrmz8cFAokO9ljadh3xtHl5e96NIWU7J/TjUEDp2CT2CbVX8oJQhIjxP/hV7f98Kd1Y1hIp3PCkQuQj+Us7d+ZQ4yK3LuZ9KbddEm7JaD8/trm4Ytmabi8R6VoJU/DbQVqJzEVigi/Apa7Ok29nD96/MgqkemxwJ0iKeKL46MhLpm0XO7j/Ba9guGoku3K8/7lPTaQR9Tx1fsRnpjUGTpPfdsjRaV5yBaUztSa8TDd9PmBWhWMit+UPUlcIA2CRh1mQcIty7WhShtvQgfJ3UTLBdMmcAHQQ== 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=TUW8DdEbZGpX9/HSB5buvJTgiz7tmh4Y8yrkYhFvdys=; b=KdiIDo1W0JnuRfWmDGUFNSk4dXKs3r7s4VBLSLwPQkpZXsB8Jnava03wCQXIV3/9N9OMDIU1yi43/TXASUED+CiFeIWzimQD/TY9rq59eAROvATEy4PNRJLdhTM0aQy4nIwHtRiS4srMr5iLSYJRaQpUSgMlsdosHaRWf8pTrwa7RRYAtzy01b4zW11z0lATF6elSKcNLofqFor4d5X0FR3lhujvjVhYMhUVdTgicIYizDVvaXn586j/61yirR2iY5VuDem4Ump2jbJE+0YsJuWyU3BjqouqdbNP6C2zdm+BaRnOhmy00d0tY2Sishtw593V9WOTD2TfCNKuRBT8Ug== 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=TUW8DdEbZGpX9/HSB5buvJTgiz7tmh4Y8yrkYhFvdys=; b=Ru2xvST8vSaE6eAPAuc5VO9EFMIZeiICVHZYXhxQPPSW7P5Z+0nlECEW5hwf6VqK918yvNAA6OVP/PyRmTXqED4sDzO3Hw3OStQbb0J2E9p7ottWw+gPBVkURAEua/qvgjPyR0WbjdohitnbNmdwQJoYROQbaI72t+mSkN8epzs= 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 DS7PR01MB7805.prod.exchangelabs.com (2603:10b6:8:7c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Thu, 22 Jun 2023 01:12:33 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621%4]) with mapi id 15.20.6500.036; Thu, 22 Jun 2023 01:12:33 +0000 From: Ilkka Koskinen To: Will Deacon , Robin Murphy , Besar Wicaksono , Suzuki K Poulose , Mark Rutland Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] perf: arm_cspmu: Support implementation specific filters Date: Wed, 21 Jun 2023 18:11:39 -0700 Message-Id: <20230622011141.328029-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622011141.328029-1-ilkka@os.amperecomputing.com> References: <20230622011141.328029-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR13CA0017.namprd13.prod.outlook.com (2603:10b6:610:b1::22) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|DS7PR01MB7805:EE_ X-MS-Office365-Filtering-Correlation-Id: a9518d6d-9893-4859-586b-08db72bdc244 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xVY61FUD5ltH0pLckkpZCp42l5iq/edZshy52EYpcVSkqyELajnr4oMkPuYGJudwBGp78VZBSJB9K15KtMpKouy+vrxh+6kxhrub7YjSX55dSUmmUYgZPLeizYfVgr2kk1V5lmUMio9/aqmtRIjNiGjzoA1ZyvudsaRnPyy6SieXasxbR/2vc9y5HrilBMxqtic4+1vySLCoDFhrRp0gR+CydQ5/ZEo9a7O86OEv8tII8SBQAKg+EQxJqZ715eeQ45mgOVpdAVoqUxAx46MPU4KdwzMCz9vGNIUv8ThDGTdKnmdjFO+chcVSmbaKzk+YItllO19Y2m6YMFytEQnOxMzV3S91lrXRFsUKWlJKTgHI/Z6mUqRu8dXeXOuv5y04GuJZwxXDvPjIYACFOeBRSQZWi0kiIzd9KeUVzz6xwcIhjjUKyLxBIqBI1zOZ81zvwkLsiWHHPxEyWATLS410/nbR53N4gjbDrtgQxAOFkAESwf5ZMeOxmnW+UiCHRLUrHDx9uxFyRBgebqhmCYxZ+kVHCEnWdxWiNSnQAbGusZ5DME8R/rumuAfZ3QU6RZn45ItL4vXvZs5QCXqUOjQ6nD062t4L5ovK5vVV5u6g4w+bMic2imWO3CaN6wW7jIC/ 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)(376002)(39850400004)(346002)(136003)(366004)(396003)(451199021)(8936002)(41300700001)(186003)(8676002)(26005)(1076003)(6506007)(2906002)(6512007)(86362001)(110136005)(66476007)(66556008)(4326008)(66946007)(6486002)(316002)(38350700002)(38100700002)(478600001)(52116002)(2616005)(83380400001)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pkuPsPkdfHTIPp1JCqsfhkeh9TwBRcUS6FbgYHCG4WdygQh5nU+9hhROIgB8IhTcVqNW72yWhPOB0MjY0BXehW0mIh7dPi1aIaL/JNAJSuDNWSQSIl+rIyKDIvilcu5btfXSmyfvsG00vAPDBOGv8vZEseDCd0N+R+LjV3qRlrekKCuthBLuPAFQGAlmORstrBde6SFjgDbnHLTTxQfKvVhqNUxvgsRmTFT7Z4ESLBamoKUli/qxznYcgKo/kowVSYqqJCcO97qnsY6HMlYKJCW0+vLnPchIfvJLkvo67041npd07nkCqDOb6yYZatz4asIHuyHQUR1vVS+6GTlcnOt0W0CoqQS/PAQ+xHfV7lDzMBA6iBLLLx/vsb8osNkJ+Pi3HiWUXzZjb48jTtQJKEbsLFh/NTSo9K7UCzX72TL6YijZUM0r6+lgVDdEym4+ytXCN5BW4mk7oIXC9xzpLiHskl3H3DAIS/Mfzhkz0bLchYNM0a4dWwuObCyitj2oESVgyeO5JKrmfymg7UUwujhDmz1SF1fNHS6Sh7PoXgEaCEGAfwG+yyTXS3B+pC7UOwqjIYaSdk4bRZCk+/jORfJHROsDZjg0TIaT4d9tOo6jBP8QRBU1DNKeb5UQwQnf/voD8EivXPOWdi3bNTewJp1dBEk17EV2UV36Olc5g4+FFoVt9R/LIybG+dNC5zZgUETvZfc03TU0GXnBwDvN5nf9RnpHXDA9/v4mO1T8a/yQ3KL2JqAgM/qX5KHX73oqc13U98XrB5PotOOBh9wcLUMFtqQoE05Yye+ZiCvpU3mOfRc6/CXOFiW89VOz1NB/cR1Oz2msDauLOVMXJiYfj1gk5ZQynK5epT0vObUuSR2lOi57HcOl5CjpEo0oCko4XNrvJ9gmDTcdLDKBn3rQ0PTeNVdMKufCcCvEXD+wuUy9n1nmrdwEmGKUoNqUY/N3psH3S0SNg2ltC8BsRRFgHX6HqBTMAAAKs1Xv+2pbRFGLxvw3j4UQh82vzHo2ovWdsHZfH7aKwVdAMZKfB3oSyyFFGHncNkSCdWJeBPQHkQWWB7mdZ9s2JT2WF02hVkGLWQIL5j6bS8AJ+YVRQ/6/DkxhgopNS+svfaBhl7muI0/at5YLEBK2XjA8M1iZ3OX9u3Dh5auL28C/JInCDm4yMvp4cxMci08osVpbAfFgaPuL8Mz4Mc8Z2I4/CFUB6d4Q3RWNuiFKgYSqvFcvukSlJWRbuMEDDbcThp+vUym23fcXJxZJJXWOEj0yU7VxUt7/tf0IGglXNr5XE/c0NFg2AkBcOBybs+sNNrjkAM3Pj7cCnWFQl7OaiDlr3nZK6StolmHX6iX5x6AfIYt8raRYDaarv/t+LiwEyHDK8Cii/guNDSdtNnmOD1Ya4lk0FeZh39kDf/AYGIeyEpLVWDlt8Az+6SlIGeXev9bnT1h/jFyfqXVvAQ3HknfJGqj+N7IdI4gum/6p4D4Q1YYCCGNeJatYNKErFkCSpfMdvvYbIZQbNSTIQHZlPS4L7nMMpGs3/9dSfkTdq95gjnMlZ5pFHnv2JMRgm61qZQwnPIJy8h6KhzaBeGTS/YJDWZmioTzJk5xWmrg8hL/IGp///8zWbXq94brsjr/SDR6H9KSTVt4= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9518d6d-9893-4859-586b-08db72bdc244 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 01:12:33.8197 (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: +gR3n2WQPHFt219mW6tdgwqEb/sZm7z6wDWZCtK+MqaKrlDI9rbKxmHkj4/VJ2U9YxQLZt9ovzI0MgbIijIUr9Ntsn2OPNyZeMWenpaJpviYgRAGF/tD/0QTpCHPV31W X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR01MB7805 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769364244731347415?= X-GMAIL-MSGID: =?utf-8?q?1769364244731347415?= 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. Reviewed-by: Besar Wicaksono Signed-off-by: Ilkka Koskinen --- drivers/perf/arm_cspmu/arm_cspmu.c | 8 ++++++-- drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 0f517152cb4e..fafd734c3218 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -117,6 +117,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); + static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev) { return *(struct acpi_apmt_node **)dev_get_platdata(dev); @@ -426,6 +429,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; } @@ -792,7 +796,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) { @@ -826,7 +830,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 83df53d1c132..d6d88c246a23 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -101,6 +101,9 @@ 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); From patchwork Thu Jun 22 01:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 111385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4756929vqr; Wed, 21 Jun 2023 18:27:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uQzdQwsRluloQNGzzRL886p8JyU7GNihjMH2k0YDXNAsVo/bxu25qvFfo8D1wl+gIJVk8 X-Received: by 2002:a05:6214:500f:b0:625:aa49:c345 with SMTP id jo15-20020a056214500f00b00625aa49c345mr21137508qvb.57.1687397245711; Wed, 21 Jun 2023 18:27:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687397245; cv=pass; d=google.com; s=arc-20160816; b=w4cEG4WvKYk8XLnzMiOrNqrZgQ/dHZX4N17YAn5zBS/ILzI/lsOz4PhONT/oMIku07 yzZ5bEe9v/OK216cpPDjZb5OpoUH/tC5GtHt+H6/MBMUbvd1Tx9495qXjWwk/as0HSYS Rzi9Vzzxp+nFZQkaNTV6LyMln7sH07DECtA2tE9e410vT2ZcgeOL6yrnqewnxdX6t7YE XrXkkAYyuJteNgvBfaaPlGWmVCzI0voHiOZLOoJr2ODLrcU3CcTnp/hDHzVhvR6eVaUl Il6pscghHI5UUhXJ3DUrONSpbVmE6jqqClRsjxG/+j0Qut0eRbC5OX2u798uWOZk0GIj lFTA== 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=j1Np9axgFb3diOIO8yZgWlgDmY3jjcwVHh+rWeAvk3s=; b=daEXdwXhDnbN8gIW4aBmqeSnAeGnR8zF3T3XkafYPs2fjlVSrQbbkrg/e5ZQxbyvz0 vZBJj2KDQECwehn0fUqG6EjTML0JiXvZldFsg010fFGFKthtYozs/t2lAb85OntakiTG 0+2SlKtlrh2tcbctcdMuWJkKKb3zrhIlHGRqOVZVGtwjgIIf5gN9GXM/bYKVMzJfnp9K R0oLyB2D+9eBN8waUlVqtYmGA0Bu7ikiSig+AKlXEAfwLjsDz8F2JeMo1Bqee5YLCbRd m+MSRFKn51HId85069m1j3G7q6KPkvN6prBouKBWGrXo/A8PQh/YmCJ1nQXyO5E/fFFE 8Gdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Y1bXb8Qf; 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 f5-20020aa79685000000b00666e9830c1csi5072777pfk.381.2023.06.21.18.27.13; Wed, 21 Jun 2023 18:27:25 -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=Y1bXb8Qf; 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 S230047AbjFVBMp (ORCPT + 99 others); Wed, 21 Jun 2023 21:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230074AbjFVBMl (ORCPT ); Wed, 21 Jun 2023 21:12:41 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2092.outbound.protection.outlook.com [40.107.92.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB551BEA for ; Wed, 21 Jun 2023 18:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WvT84yydpXI6FjX1/bCSC8vhLO/uKVQ5kuP+ti1hng/SGUm855FIc/Chbas9u292e8gUorcpRfAZSPdjn9VeVDkOVYwxIjPJdjJRfT2TVRQ5dMzyNZf+6etoXZPodj3+F9rRAUsPvNjGjAZb40xBbiabFjXRTuskcA1DgRl9ypOR9zRrqKZ1iPehT5ZFzMcstVt8KlbQtO0wa9V3MNS4IjCYykL+doPKGEe1XtTON8yi8GMwUOrz3BwbdZ8wAwkb3dDaV0h6Yta7xuGFBxENqw4T10sIqiwh2OAPyejgfqKtKx0a1DzlZuFu5bHmuL07ieB/e+6B1brkvJQ9MOab4g== 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=j1Np9axgFb3diOIO8yZgWlgDmY3jjcwVHh+rWeAvk3s=; b=CQUffigQLuCmFmJ5jIIWBOp01zQL2hrVtnMVwiqG4k12Lz4LUHisQwDm8oXYzH5KcERIOFz4WUpmaddv23w88RSQYQ0flAf1HnW2aW+sqYLsd5aGmoPf5GJPqQcZxpwUfQUQ/Ef46Zz+rVY2QWpZjNsPDOPtW4rJD3BPx1uLGdE5ZfhpsPAA8hencd7rJEtN4uWH04LDDgSQIggHq9slM0LB1K0lMJyV78gZph0aZfNtV/vnbDdk4DgwtOYsa/7DfqyNR/sW/kMhT1hTveH+NWAE0R3S38A14MwIYdSZ3sXtI11VgwetAcLuPqv0q+O1CS5h3R44CWLweDmaJ2acMw== 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=j1Np9axgFb3diOIO8yZgWlgDmY3jjcwVHh+rWeAvk3s=; b=Y1bXb8Qfv6xSh5yrH92rmEx9/4SZDucnnVJoHFHUlBLrh4lOpqF3OxrCfmde66+4u4BCfqZTYufkVKntprJUnScylLbRomIXyl9i+7lJyfuv6bx3h59P5kZIaQfx3CIxRcPNNnyfQMQeNowIKg6F+XNJBXnYoCQYuEwt9d8lA90= 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 DS7PR01MB7805.prod.exchangelabs.com (2603:10b6:8:7c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Thu, 22 Jun 2023 01:12:36 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621%4]) with mapi id 15.20.6500.036; Thu, 22 Jun 2023 01:12:36 +0000 From: Ilkka Koskinen To: Will Deacon , Robin Murphy , Besar Wicaksono , Suzuki K Poulose , Mark Rutland Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] perf: arm_cspmu: Support implementation specific validation Date: Wed, 21 Jun 2023 18:11:40 -0700 Message-Id: <20230622011141.328029-4-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622011141.328029-1-ilkka@os.amperecomputing.com> References: <20230622011141.328029-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR13CA0017.namprd13.prod.outlook.com (2603:10b6:610:b1::22) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|DS7PR01MB7805:EE_ X-MS-Office365-Filtering-Correlation-Id: 58d710fb-c0aa-450b-8c29-08db72bdc404 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HeKi/zMF7y0QTVMmtGnfVgXkbnupKL73vwe9dqVoAWvAsBv+fveHiFDxDW3F8gSTDb6Zch5Kd0WzMFxyYgusnkXyo1O9EUM60zRnaQaE1U/ijSd792acEyPK7LtEhN8JdV3b7WPgOiyobVpM+XuCFmuKLoVKaZPiJjajdnQKros7K+f0oDWGtOs/qiEXFllwIyX5R0Gxlj1lgol5HwTCIKdGPLeosP69Ew/FGsLe6nyxeQSkOSg+8Uvb0U3vnkshgkKrhRJYFcJEf4LALEoH78rg/gditgLDE07axzokpZfIjwG4BCdLZRCXnsP1qmtyDwGNt7o7bsW5p4Sh1Wq7RCida+d/s7R+2R1YAYI0DLnDKWg/8Bjoii0bxD2u9xM6KAvLh9X04zXHY6/MCoe/Dl9woq94QbpTb6tqI63e3ldOH4cBtnm9l1BOPlUlC/q85De219EExXhdnt4adkPZ1zbevmOKw2ecM3Mug4M1yIzse0LFJCHaz+DqDvh8UR4EVc/Rz1qVy2tY+Kym1Y9SjTJu71Bu4YFIb0oFYSnxA1FHsh5Ti7AGlQplHFFBfP9Oe/fXDUpjwmvAgnDwMFcjWMFF0oRM7rLD4aFvp/LOKhBuMq12GEpAhgmYXxoJHZcl 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)(376002)(39850400004)(346002)(136003)(366004)(396003)(451199021)(8936002)(41300700001)(186003)(8676002)(26005)(1076003)(6506007)(2906002)(6512007)(86362001)(110136005)(66476007)(66556008)(4326008)(66946007)(6486002)(6666004)(316002)(38350700002)(38100700002)(478600001)(52116002)(2616005)(83380400001)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EBLSFT27DV2Zes68rL0GL3RYrznhxz8rFs8QzKbnKiUF28EdWrIm01AbsiZgsk3IzEoHehl/8Tis8788m7sDGRi0RpdN5BsVbDSDGxeFQpIgdOtn8TcmBXFj5sq7pIfItFGjKf1YdH+5RFQWVvMz6astFBOT+lwvBuSPc7Lz6vWNS6uLuxYAoHcD+YUyWnSpp+/Peoi+R/ZiBcvHSvDwGe7IykSdkW6HgFdFHy/KDDJNwjQNIkXxgsf42QZGx9D35LqKQF4nSDkjuXNBXEOYIJIolEU16CStXvID4uRMf4wPJjqNMnl+kwG3ULgtEu8zz+7lw08COYjD2+gLaktExlmVN4Vtr7QJR2Ap5u6QUQo6BuyW/Uav8FX+AnGib7Dia0KGNJO36JrS944hX7aubXfSZhQls3DJ7XdI1cVYWffrK0X/t+cJxrc0TiRYm7nLQ1ZrnNrTFe/uNGTLJk/Kzw87EZLfYwtA/lMfFeEj0sX+4VcLNLH8aCD8KyCXSCZHUeiorz8UbZOos3EsV3tWuKSnmvmn82//dT0NWUePr/rYTXECuqtxWzMPuZNztgfqz7HsLtCD4B8YwOlEAEoLTN+ZK1sNMDJaRMHuxPw/W+ZuB5kCKFfc0XfTKh3irdI65XHHXzhLZE2VTx4xAL5DNWA8MTsKhbJ8LkAwpCuljFULOHI/HoWZP/+ukbMl9wjzhQ40H+85sWq5nzvVhZMm1HtkepPcYdQp85C478Ps7DnzOwp3XYZLx/zKGhd7wamh6L5YslIjkQKaXKL418rKNf+dNDsc/2La1Fn4s9CXPSRLv3yRInbvPhM0wJDv7UCjjRPOz/bt6SsLPMOH9Y3tHxLA7Vasy5aJ6Ci+gCh/eW1OawNs7NIaXuEjUKhnBXSzdyzrfH30IG/VfPsJY3tBjkHCpoePIVp1+s4Mu3KaEczMR0bCoTORSpt2pn3eQKJDL8M9+8ORfU2XoScVoeAlWzKgxsx/txdlO0kucEOru6xwEMWaRKHuUZaqIEZokVcDJY+qkdVFJyVNnP8SuFernLFtEz2fJb1n+FwSMl7kcN+ELWiW4f6Fw8kT3nPM0EiSysAm2SrrKKzey2mUh6LJb6OShC0S52tUPK2dx8cUiIRfuBn+nN4lnFLFXYXIiL9TmH8B3VaIFsEo68TXyFP7Qe2rlU0RCUX/HI2isAk21XB5ks1Y7iqwMyDT/Xr3aIeGHbHm+xsR5/j/njf1zFjgIoxHNSp8f+RoWgRJ9GSenM7dyDNcdT/rbfMxhVzZrerGpYias39RKNSJN7iC4EYARlJSylcZ4Ye6qJ2KSnHgCBNc1yGlWZL3ySxDNNUgfOt+fQcdqeKEPmf6kliYo7Ng6dLUoVPU50fZWido7Pezz/rlGPM1hcYbCiE6biPX+iI0UwEgHxw9NDCEYt4LhW7E6zw9XMf8C9anIVyP88VqhPMPzfnrOi0Mqp4s9v5lg5s11NrZgSh0alZDKeL3jvZUCEdei2Azz3dWmB8Zzd9dbuQZEuLh6KsfUENk3BDfKgMYK1IpI5UyGwV7f7MdE67yoydnylXXgkMCIGw6DeLGkDCtY9adjdzvOkr9rl/12FCLaKL0wNki1I2+zkAMYOREX/o9imAgjAKH1bHjdUXzhw0= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58d710fb-c0aa-450b-8c29-08db72bdc404 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 01:12:36.7319 (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: mlKnYQeJQOZySLBJqrVe5XPQZ39uYyfPnUfhVhEXTYF7oKeX0ThA9ah+0vqxf0XuetNrRvNeh0BTUaBKbhXGozwP3Q1fu6KZRWTpDI3uVx6VvYJGpTo+FNCTZulI6otR X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR01MB7805 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769364254516000398?= X-GMAIL-MSGID: =?utf-8?q?1769364254516000398?= 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 Reviewed-by: Jonathan Cameron --- 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); From patchwork Thu Jun 22 01:11:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 111386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4757158vqr; Wed, 21 Jun 2023 18:28:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JqvDR6fjSxlZyd2YJl6Pn4w+53FYfBbfAuOlPbizNyEhMWQQeMSz4BAOL4FKoXKEfoYZL X-Received: by 2002:a05:6a21:339a:b0:122:450b:48aa with SMTP id yy26-20020a056a21339a00b00122450b48aamr7386403pzb.21.1687397286719; Wed, 21 Jun 2023 18:28:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687397286; cv=pass; d=google.com; s=arc-20160816; b=XL8hTZX4IfudWsXAZFtUyQH20HDHywGCxqeNRpeIXWFxyhTRnPI3DLhsyk51yurN0W QWTB7fk32E1tGbrNlehkNlpw5am7Ml5J+0d36YceHixdJn1IPoTu1S51fjdI6YI9kTTv ZBGUJJktM98TwxXZG7D7+ztTDGHmyS9HOl15/pFEmLDMdlSjG9nPSlJqxi/Ml4IvatSN H7w8anK28ePxJ4k7r06Cid9aBV0j9PPL8JmVwRlSfdJ2fC9H9wgIe0tWzKY9QpQfqs8G TkLszwcQvjSNQzY3Vqszs72Hw6xR5KC8z6sLl9WcDiUidrL3ru0i1NMsvjvRqApUrAua hQXw== 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=Ty7h61NH/aqjod1K1j+vBv8EmKWo6p+iMP5xswS5Pic=; b=yVBPLxSKUJUC4LGNvZtfIAigOPj1QpH0+6JBDgrZvjDq0zLMZLEvkxpWuGBC3eHCNr mgvYgMHpUfAvUoB+y0tWOgxLouYX8fIo2tUkDNS5P0zriYQ7SmOZ/G/w7Qea2QrVVmwl TwqpUnCCL+wXzzC0G25r3Hbz4Zax3AxHQpSUpDkjjEHxmO/wTCJWKmfDtR316dIBnDZf rtna6UNfUCCV4bM9POOrJJkf+vHtJwj2N2yD//zJqB0zSspYhVCa2nW381WHXGTgKEoL 9rBhNYu4j1Sv4n3HB1XfED6W6nlnzYy6nMcEkgw4gtEeELTL/6U+fTLa+rR4L256PQbG DIBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=iX350sP+; 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 v188-20020a6261c5000000b006687ed7b4a5si5022483pfb.140.2023.06.21.18.27.53; Wed, 21 Jun 2023 18:28:06 -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=iX350sP+; 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 S230071AbjFVBM4 (ORCPT + 99 others); Wed, 21 Jun 2023 21:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbjFVBMt (ORCPT ); Wed, 21 Jun 2023 21:12:49 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2116.outbound.protection.outlook.com [40.107.95.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B93A1BD9 for ; Wed, 21 Jun 2023 18:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WL/pf9TTPuUaEze8YYGOkuMyRIcPFEdIohwPIOlscNIsLIEez5Yzx8x6JSjDIIaJMDAOpyqJWPxVrACr44d12TU+JlDMxm4KCHq98GmOsYuovAtVFV5L0NwbkjdlKEDCdPpWb36b2Bm3Qp45ISy7xK29gpYzhGvxZVh396TUmM4azBoud1L+v7Ka72J4AqGoM3IaGRrsLK4oAEiwYgNmjc8LaaWSqqiakPiiDpBv1GlnZ2D8t34B0sg6xMhHBOoadfHI8xnaJj8pUu/Xz4kzeslC3vB87/s0+Ju4Q0j280EqVg+ABouzJEigyy0+BtB4hAasrRJp8a6bJilFyro2+Q== 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=Ty7h61NH/aqjod1K1j+vBv8EmKWo6p+iMP5xswS5Pic=; b=gMdSUJ+bZhZ3bDa/oJTH/+m7NTmdyqmuAdTui/JrefojlFGdjY6g49RQyUAqD/7fpEI02MaEGv66rm3LF/8ff9MTGkP/0M4+EI9CsGQqLdZvTnPQB4hdVnSEfJueJZPXBcXM6YxT5zr8NT5wq+2snFkLn5XuOEnDu2TMY8171gEk9klQtiW+Q6RTAQBB1bwrqB1Dy1WgJfwHhwoqCMMLMS9ucyu+QsyQXV+wCruv3fk6pPcRtK6EMqFqLuwm4PjoXXZ7viSdLVUED5OyLkY8oEPCdMocLyfgkRD1l5XVhCu0AAbWqeaUGR9dTFBR4qJhQv80huEL2CoZ7lyULske2Q== 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=Ty7h61NH/aqjod1K1j+vBv8EmKWo6p+iMP5xswS5Pic=; b=iX350sP+jZ6mZnoJKrK1Z/LnEAS2z5xL4dJqvwwd38ZQ8I3RcUBq6iDs+qqb78BpXJnI0C+meJ4RgjsDc/fmcGZqkklUGMqAPMVbHrqzffDDeac6S086XJIIo04KJtMjGFYymTevf4Hm3H7KrRAh0f31ZHRg9jqG0UQbpnQH9r4= 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 DS7PR01MB7805.prod.exchangelabs.com (2603:10b6:8:7c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Thu, 22 Jun 2023 01:12:39 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::a323:29a7:2fd7:621%4]) with mapi id 15.20.6500.036; Thu, 22 Jun 2023 01:12:39 +0000 From: Ilkka Koskinen To: Will Deacon , Robin Murphy , Besar Wicaksono , Suzuki K Poulose , Mark Rutland Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] perf: arm_cspmu: ampere_cspmu: Add support for Ampere SoC PMU Date: Wed, 21 Jun 2023 18:11:41 -0700 Message-Id: <20230622011141.328029-5-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622011141.328029-1-ilkka@os.amperecomputing.com> References: <20230622011141.328029-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR13CA0017.namprd13.prod.outlook.com (2603:10b6:610:b1::22) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|DS7PR01MB7805:EE_ X-MS-Office365-Filtering-Correlation-Id: a9da79b9-ecb1-470f-8486-08db72bdc5c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zVAybRCmso13uuuEZDoP8f5bc7w2rZ1P/HkUEjDYF61sD5QVcwhh6mh/Y8sHtJ81eYtWg6Bv+TqCrbSWGt8Cj/nbBBY6GBFjT3fbi4YK2hTCqsQ98h11K2WOupESv7aLhLZlLTuTvu12EaKF0nTHxHGIxgYrbXDrMHZWKn6n1hQT7RpUoq0mkq6kQdsMymrou0HQnnyVNbVHTIX3IDZF4D5TS4OZ3KRvo9oModvZna6ujkGHzuKc1itusNiy/98qva+86JRvOs2LrmRS3+oMShToWkiSzUUgMvstnNKWsrs78hgJOKEU8nBQGw99PRguIpNnxR4kj4XK7qIld/Jc1OwoRbPbWafo9y5RhepXJvTByPltLAZpy5F/YkOVDr5PLzvHm4/zbWSTxHcvn0BHJwRh1M9ebkNeeh5sBqnoJKGD432zkyI+sexVL0fG2aHsFngM7kJDafD7CookGxCJREr5QtV/bpBrKZjUvDMMQ6JelxRjp6tRzr3HDM6k+pm36ZwGQxz8x5Kau/ewmLOFyJ8RThuhcjuihhYkVnXaBlmleIH/4Jgpek1pRb7ik0nN0A3xNghhNlQQ/JjGUaRCJ4CSIJ3G0C+eRBc/ggdIoj6TFPVgTZexnmjJHkrilKpj 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)(376002)(39850400004)(346002)(136003)(366004)(396003)(451199021)(8936002)(41300700001)(186003)(8676002)(26005)(1076003)(6506007)(2906002)(6512007)(86362001)(110136005)(66476007)(66556008)(4326008)(66946007)(6486002)(6666004)(316002)(38350700002)(38100700002)(478600001)(52116002)(2616005)(83380400001)(30864003)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: USw9BD6nzBn8P9ApKp37Rvkg7ewLO540zN9RfhdWq+AwI/wQ0VgaOWBrtP+DNU8O/jkvcJF3OSvmnYXRNgXMXUUwEcSH0vD8o0Iyrj09aCpmujNawnhwjJGhvF8Aw52HeXajjF0WjN80wpsuqM/pJI4Pn2rSID41wd7Qry6v/6apBgDP/LiGPfYEJBnxJYZNW3mXfUIeMprj4s9jhvoVyj74Oh7diIR8QiUFDz+ccm7LxqBq+F1MIGAeH3zLM/2DRJ8o7RJ2lCsj4PM/XAo5kxUaMxdXWO8tvTf4U4V0RciHQzGltQ0YAjuoCu3qITQQYMWhXWWMbl70DWvf3Kf1bNPwG461V9oV3+/Kn/aHABiycriqrDque5X4MmR8uVuf0yRrFtjQIJCFnttYDC3STd2q4bGz5ura6cOi4VnTvvD/2IddD78i8OJEqyZ1yxp3ggsa3Rw6On8f+LhgIHcduMkChFMUpUo2E4frdp1sSJzQ9MFrKqJySG8goMLn5nfLXA8RuvSMYTixPfQd4FA4SLnn5T+io83YgzEFfhfCiaze0J9VCMYBqXTVUDSObaqbbskI+MCm2Krf1LiyydEd+V0swrvxn5txJ9v+jzmQCF58PTbutwMdug9jlnA5NN2FXLl5mhgQlKtE3NSHJaduIslyxdLYN9bOO4pRa384UqfKhNO7IMs9mXh2oRyShyvDVA7iR8hVcR05bdyaLX3ow6mS75Es8qtwhfrXwiQwejnkE/oJSC89cXZ1iV1DM0QfFLQgFkV2RthJYw8fGcZXdfAIuO/jBvbF9zIZH36VOLYjJuQyM7lFQE6o5RYGc9Y7ZMqDeTC1iEV9p8xP2ayrpm/T0a3LuaBmIDyMJyNt4OD69f2ekyMmo9jGz++FX2dhOZVt8IIxPsWf+DryCK2tMcISIk6tfMLOhYvWyNEa2aJiBlsKdlz0snU8RnW25Zyj746NnzgT5VFiWFi9cn/Vzsk2hx1RFrSWtePuYASuKvItBujFVH4TfhiKoXU7BftSC9wbl6Mr1i9lcHufnwXZBZMRcoNHkkqV+bLXWexoU7LmMauWs0QWbQ2ho3vRkXv9xZCL9I563SfnjMBdT0fXSAfIzbjQu9yXyfPWburupMWNDcux+IviqrErV+2S36GWeE6RkuKxoBkv4jGy391yK1vYaFq6frgWvqfwbibJPgsR+6K9oorFYik0bvg90jkxsQmwTACxupflaVG+OGuRWV3FQ2VR2o7rKp+Up2sU0s74mkYWgSl4ZmefQ8m1WHad4WMaQ8+Kb6nePNRLwwJatjrDwKDfo+qMIhDYz5XSg51/6rrvgBWHsR6PYXon2Cw1WOLxtt1P1Q4ywoCfVw/4HgQNTmLwfHM4IsM/RawhfbQBrUzUVszJa55ymQ+1l2UDKUx32yLGBzzuOM3KwQbPNo0jMdeXVoHkcJ6nFtlYLfjXXz92kl2a0wGAL03FJEQDaC8kAHe1wj+spSoysWyfI3+OLBr/k7F2wQEfbDEYU+M0k+idRzA+LEWoYIblJsdabNh8oFXZVJd24gztSGDDztCsYeNIqYj8mK9KZC0AvbQXfFGv4wwdz48bY9Y59v3ecp3ARywGsm9fe8ybMaEJB7AMYgf1FfPoH0q1g9RzygY= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9da79b9-ecb1-470f-8486-08db72bdc5c9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 01:12:39.7275 (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: SWIaxcTQp/5PQgwSNTeKftj3eeo26Vx7+sn52+m745vtWrSvMUo8eOVyZYMnPyU/9tSk24HsyliH97kB8eRTBV06YigYR1t3QPL+QNLG8W6WvMZm99MH+LxFSJavHXXO X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR01MB7805 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 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769364297168879840?= X-GMAIL-MSGID: =?utf-8?q?1769364297168879840?= Ampere SoC PMU follows CoreSight PMU architecture. It uses implementation specific registers to filter events rather than PMEVFILTnR registers. Signed-off-by: Ilkka Koskinen --- .../admin-guide/perf/ampere_cspmu.rst | 29 +++ drivers/perf/arm_cspmu/Makefile | 2 +- drivers/perf/arm_cspmu/ampere_cspmu.c | 232 ++++++++++++++++++ drivers/perf/arm_cspmu/ampere_cspmu.h | 17 ++ drivers/perf/arm_cspmu/arm_cspmu.c | 7 + 5 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/perf/ampere_cspmu.rst create mode 100644 drivers/perf/arm_cspmu/ampere_cspmu.c create mode 100644 drivers/perf/arm_cspmu/ampere_cspmu.h diff --git a/Documentation/admin-guide/perf/ampere_cspmu.rst b/Documentation/admin-guide/perf/ampere_cspmu.rst new file mode 100644 index 000000000000..bf86bffeef63 --- /dev/null +++ b/Documentation/admin-guide/perf/ampere_cspmu.rst @@ -0,0 +1,29 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============================================ +Ampere SoC Performance Monitoring Unit (PMU) +============================================ + +Ampere SoC PMU is a generic PMU IP that follows Arm CoreSight PMU architecture. +Therefore, the driver is implemented as a submodule of arm_cspmu driver. At the +first phase it's used for counting MCU events on AmpereOne. + + +MCU PMU events +-------------- + +The PMU driver supports setting filters for "rank", "bank", and "threshold". +Note, that the filters are per PMU instance rather than per event. + + +Example for perf tool use:: + + / # perf list ampere + + ampere_mcu_pmu_0/act_sent/ [Kernel PMU event] + <...> + ampere_mcu_pmu_1/rd_sent/ [Kernel PMU event] + <...> + + / # perf stat -a -e ampere_mcu_pmu_0/act_sent,filter_enable=3,bank=5,rank=3,threshold=2/,ampere_mcu_pmu_1/rd_sent/ \ + sleep 1 diff --git a/drivers/perf/arm_cspmu/Makefile b/drivers/perf/arm_cspmu/Makefile index fedb17df982d..b80a8bd8da54 100644 --- a/drivers/perf/arm_cspmu/Makefile +++ b/drivers/perf/arm_cspmu/Makefile @@ -3,4 +3,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu_module.o -arm_cspmu_module-y := arm_cspmu.o nvidia_cspmu.o +arm_cspmu_module-y := arm_cspmu.o nvidia_cspmu.o ampere_cspmu.o diff --git a/drivers/perf/arm_cspmu/ampere_cspmu.c b/drivers/perf/arm_cspmu/ampere_cspmu.c new file mode 100644 index 000000000000..62dc893c94c1 --- /dev/null +++ b/drivers/perf/arm_cspmu/ampere_cspmu.c @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Ampere SoC PMU (Performance Monitor Unit) + * + * Copyright (c) 2023, Ampere Computing LLC + */ + +#include "ampere_cspmu.h" + +#define PMAUXR0 0xD80 +#define PMAUXR1 0xD84 +#define PMAUXR2 0xD88 +#define PMAUXR3 0xD8C + +#define to_ampere_cspmu_ctx(cspmu) ((struct ampere_cspmu_ctx *)(cspmu->impl.ctx)) + +struct ampere_cspmu_ctx { + const char *name; + struct attribute **event_attr; + struct attribute **format_attr; +}; + +#define SOC_PMU_EVENT_ATTR_EXTRACTOR(_name, _config, _start, _end) \ + static inline u32 get_##_name(const struct perf_event *event) \ + { \ + return FIELD_GET(GENMASK_ULL(_end, _start), \ + event->attr._config); \ + } \ + +SOC_PMU_EVENT_ATTR_EXTRACTOR(event, config, 0, 8); +SOC_PMU_EVENT_ATTR_EXTRACTOR(threshold, config1, 0, 7); +SOC_PMU_EVENT_ATTR_EXTRACTOR(rank, config1, 8, 23); +SOC_PMU_EVENT_ATTR_EXTRACTOR(bank, config2, 0, 31); + +static struct attribute *ampereone_mcu_pmu_event_attrs[] = { + ARM_CSPMU_EVENT_ATTR(cycle_count, 0x00), + ARM_CSPMU_EVENT_ATTR(act_sent, 0x01), + ARM_CSPMU_EVENT_ATTR(pre_sent, 0x02), + ARM_CSPMU_EVENT_ATTR(rd_sent, 0x03), + ARM_CSPMU_EVENT_ATTR(rda_sent, 0x04), + ARM_CSPMU_EVENT_ATTR(wr_sent, 0x05), + ARM_CSPMU_EVENT_ATTR(wra_sent, 0x06), + ARM_CSPMU_EVENT_ATTR(pd_entry_vld, 0x07), + ARM_CSPMU_EVENT_ATTR(sref_entry_vld, 0x08), + ARM_CSPMU_EVENT_ATTR(prea_sent, 0x09), + ARM_CSPMU_EVENT_ATTR(pre_sb_sent, 0x0a), + ARM_CSPMU_EVENT_ATTR(ref_sent, 0x0b), + ARM_CSPMU_EVENT_ATTR(rfm_sent, 0x0c), + ARM_CSPMU_EVENT_ATTR(ref_sb_sent, 0x0d), + ARM_CSPMU_EVENT_ATTR(rfm_sb_sent, 0x0e), + ARM_CSPMU_EVENT_ATTR(rd_rda_sent, 0x0f), + ARM_CSPMU_EVENT_ATTR(wr_wra_sent, 0x10), + ARM_CSPMU_EVENT_ATTR(raw_hazard, 0x11), + ARM_CSPMU_EVENT_ATTR(war_hazard, 0x12), + ARM_CSPMU_EVENT_ATTR(waw_hazard, 0x13), + ARM_CSPMU_EVENT_ATTR(rar_hazard, 0x14), + ARM_CSPMU_EVENT_ATTR(raw_war_waw_hazard, 0x15), + ARM_CSPMU_EVENT_ATTR(hprd_lprd_wr_req_vld, 0x16), + ARM_CSPMU_EVENT_ATTR(lprd_req_vld, 0x17), + ARM_CSPMU_EVENT_ATTR(hprd_req_vld, 0x18), + ARM_CSPMU_EVENT_ATTR(hprd_lprd_req_vld, 0x19), + ARM_CSPMU_EVENT_ATTR(prefetch_tgt, 0x1a), + ARM_CSPMU_EVENT_ATTR(wr_req_vld, 0x1b), + ARM_CSPMU_EVENT_ATTR(partial_wr_req_vld, 0x1c), + ARM_CSPMU_EVENT_ATTR(rd_retry, 0x1d), + ARM_CSPMU_EVENT_ATTR(wr_retry, 0x1e), + ARM_CSPMU_EVENT_ATTR(retry_gnt, 0x1f), + ARM_CSPMU_EVENT_ATTR(rank_change, 0x20), + ARM_CSPMU_EVENT_ATTR(dir_change, 0x21), + ARM_CSPMU_EVENT_ATTR(rank_dir_change, 0x22), + ARM_CSPMU_EVENT_ATTR(rank_active, 0x23), + ARM_CSPMU_EVENT_ATTR(rank_idle, 0x24), + ARM_CSPMU_EVENT_ATTR(rank_pd, 0x25), + ARM_CSPMU_EVENT_ATTR(rank_sref, 0x26), + ARM_CSPMU_EVENT_ATTR(queue_fill_gt_thresh, 0x27), + ARM_CSPMU_EVENT_ATTR(queue_rds_gt_thresh, 0x28), + ARM_CSPMU_EVENT_ATTR(queue_wrs_gt_thresh, 0x29), + ARM_CSPMU_EVENT_ATTR(phy_updt_complt, 0x2a), + ARM_CSPMU_EVENT_ATTR(tz_fail, 0x2b), + ARM_CSPMU_EVENT_ATTR(dram_errc, 0x2c), + ARM_CSPMU_EVENT_ATTR(dram_errd, 0x2d), + ARM_CSPMU_EVENT_ATTR(read_data_return, 0x32), + ARM_CSPMU_EVENT_ATTR(chi_wr_data_delta, 0x33), + ARM_CSPMU_EVENT_ATTR(zq_start, 0x34), + ARM_CSPMU_EVENT_ATTR(zq_latch, 0x35), + ARM_CSPMU_EVENT_ATTR(wr_fifo_full, 0x36), + ARM_CSPMU_EVENT_ATTR(info_fifo_full, 0x37), + ARM_CSPMU_EVENT_ATTR(cmd_fifo_full, 0x38), + ARM_CSPMU_EVENT_ATTR(dfi_nop, 0x39), + ARM_CSPMU_EVENT_ATTR(dfi_cmd, 0x3a), + ARM_CSPMU_EVENT_ATTR(rd_run_len, 0x3b), + ARM_CSPMU_EVENT_ATTR(wr_run_len, 0x3c), + + ARM_CSPMU_EVENT_ATTR(cycles, ARM_CSPMU_EVT_CYCLES_DEFAULT), + NULL, +}; + +static struct attribute *ampereone_mcu_format_attrs[] = { + ARM_CSPMU_FORMAT_EVENT_ATTR, + ARM_CSPMU_FORMAT_ATTR(threshold, "config1:0-7"), + ARM_CSPMU_FORMAT_ATTR(rank, "config1:8-23"), + ARM_CSPMU_FORMAT_ATTR(bank, "config2:0-31"), + NULL, +}; + +static struct attribute ** +ampere_cspmu_get_event_attrs(const struct arm_cspmu *cspmu) +{ + const struct ampere_cspmu_ctx *ctx = to_ampere_cspmu_ctx(cspmu); + + return ctx->event_attr; +} + +static struct attribute ** +ampere_cspmu_get_format_attrs(const struct arm_cspmu *cspmu) +{ + const struct ampere_cspmu_ctx *ctx = to_ampere_cspmu_ctx(cspmu); + + return ctx->format_attr; +} + +static const char * +ampere_cspmu_get_name(const struct arm_cspmu *cspmu) +{ + const struct ampere_cspmu_ctx *ctx = to_ampere_cspmu_ctx(cspmu); + + return ctx->name; +} + +static u32 ampere_cspmu_event_filter(const struct perf_event *event) +{ + return 0; +} + +static void ampere_cspmu_set_ev_filter(struct arm_cspmu *cspmu, + struct hw_perf_event *hwc, + u32 filter) +{ + struct perf_event *event; + unsigned int idx; + u32 threshold, rank, bank; + + /* + * At this point, all the events have the same filter settings. + * Therefore, take the first event and use its configuration. + */ + idx = find_first_bit(cspmu->hw_events.used_ctrs, + cspmu->cycle_counter_logical_idx); + + event = cspmu->hw_events.events[idx]; + + threshold = get_threshold(event); + rank = get_rank(event); + bank = get_bank(event); + + writel(threshold, cspmu->base0 + PMAUXR0); + writel(rank, cspmu->base0 + PMAUXR1); + writel(bank, cspmu->base0 + PMAUXR2); +} + +static int ampere_cspmu_validate_configs(struct perf_event *event, + struct perf_event *event2) +{ + if (get_threshold(event) != get_threshold(event2) || + get_rank(event) != get_rank(event2) || + get_bank(event) != get_bank(event2)) + return -EINVAL; + + return 0; +} + +static int ampere_cspmu_validate_event(struct arm_cspmu *cspmu, + struct perf_event *new) +{ + struct perf_event *curr, *leader = new->group_leader; + unsigned int idx; + int ret; + + ret = ampere_cspmu_validate_configs(new, leader); + if (ret) + return ret; + + /* We compare the global filter settings to existing events */ + idx = find_first_bit(cspmu->hw_events.used_ctrs, + cspmu->cycle_counter_logical_idx); + + /* This is the first event */ + if (idx == cspmu->cycle_counter_logical_idx) + return 0; + + curr = cspmu->hw_events.events[idx]; + + return ampere_cspmu_validate_configs(curr, new); +} + +static char *ampere_cspmu_format_name(const struct arm_cspmu *cspmu, + const char *name_pattern) +{ + struct device *dev = cspmu->dev; + static atomic_t pmu_generic_idx = {0}; + + return devm_kasprintf(dev, GFP_KERNEL, name_pattern, + atomic_fetch_inc(&pmu_generic_idx)); +} + +int ampere_cspmu_init_ops(struct arm_cspmu *cspmu) +{ + struct device *dev = cspmu->dev; + struct ampere_cspmu_ctx *ctx; + struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops; + + ctx = devm_kzalloc(dev, sizeof(struct ampere_cspmu_ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->event_attr = ampereone_mcu_pmu_event_attrs; + ctx->format_attr = ampereone_mcu_format_attrs; + ctx->name = ampere_cspmu_format_name(cspmu, + "ampere_mcu_pmu_%u"); + cspmu->impl.ctx = ctx; + + impl_ops->event_filter = ampere_cspmu_event_filter; + impl_ops->set_ev_filter = ampere_cspmu_set_ev_filter; + impl_ops->validate_event = ampere_cspmu_validate_event; + impl_ops->get_name = ampere_cspmu_get_name; + impl_ops->get_event_attrs = ampere_cspmu_get_event_attrs; + impl_ops->get_format_attrs = ampere_cspmu_get_format_attrs; + + return 0; +} + +MODULE_LICENSE("GPL v2"); diff --git a/drivers/perf/arm_cspmu/ampere_cspmu.h b/drivers/perf/arm_cspmu/ampere_cspmu.h new file mode 100644 index 000000000000..9b3e1628d1d6 --- /dev/null +++ b/drivers/perf/arm_cspmu/ampere_cspmu.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Ampere SoC PMU (Performance Monitor Unit) + * + * Copyright (c) 2023, Ampere Computing LLC + */ + +#ifndef __AMPERE_CSPMU_H__ +#define __AMPERE_CSPMU_H__ + +#include "arm_cspmu.h" + +/* Allocate AMPERE descriptor. */ +int ampere_cspmu_init_ops(struct arm_cspmu *cspmu); + +#endif /* __AMPERE_CSPMU_H__ */ diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 471d6d7ac81a..587515eea0b4 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -29,6 +29,7 @@ #include #include +#include "ampere_cspmu.h" #include "arm_cspmu.h" #include "nvidia_cspmu.h" @@ -114,6 +115,7 @@ /* JEDEC-assigned JEP106 identification code */ #define ARM_CSPMU_IMPL_ID_NVIDIA 0x36B +#define ARM_CSPMU_IMPL_ID_AMPERE 0xA16 static unsigned long arm_cspmu_cpuhp_state; @@ -388,6 +390,11 @@ static const struct impl_match impl_match[] = { .mask = ARM_CSPMU_PMIIDR_IMPLEMENTER, .impl_init_ops = nv_cspmu_init_ops }, + { + .pmiidr = ARM_CSPMU_IMPL_ID_AMPERE, + .mask = ARM_CSPMU_PMIIDR_IMPLEMENTER, + .impl_init_ops = ampere_cspmu_init_ops + }, {} };