From patchwork Wed Jun 7 08:31:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 104345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp104794vqr; Wed, 7 Jun 2023 01:44:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6R018EgyMjr+vCnbjTq7CfVeRamPWxh7ixvgm1o9q0qCLHVeswEVSKzI2n8wW0F/WcRwHl X-Received: by 2002:a17:90b:23d1:b0:253:74f8:1e31 with SMTP id md17-20020a17090b23d100b0025374f81e31mr3978933pjb.39.1686127497022; Wed, 07 Jun 2023 01:44:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686127497; cv=pass; d=google.com; s=arc-20160816; b=nRpzxDVS4IfG3TrcpvmbmHi503Ln2AOFLgOrjvZfpX1OJTR7VgsVJJv+v8ylz5Gfxc /h5AmZnC4n+ItRGCwbgjZEobdPP8Aqn/0sP/WcyDooFVogr4OdI1XKOvGCG/X5unxrVL N7pqSwcVcBF6l5fdWPTA/e/hQV+wMCBoYmJEDdSAvk5QV28vvOPudobq6Xuz2XRnYnMK a7e6lfoJtKFUre0O3/vJomZK5fU4GoV2ypO0khJjsR3ht3t3ZCHO5UuA9m9oTeSPwgDw ghC8bEn9+tp0tYiE9IRnIi5AZHKDaW1DB2/tddERlY60rZ5rCbasJ2UmQkFNk/B/NKDG mtEw== 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=qRZxhGQrvCK/OKIHPpTr118yEW8wCmUFrDRdcojm2Gg=; b=J91CFwRfkLYZlZ5dzxwSRL2v7qrdNs5qycOvS9C9IsMqLOyfcjryG/g8eHSOZ8kIDx wxq1tfsXNiBhLM5A/em94OXJzRJnpbByNs46wk50f44CfxZKx1mKkrK7Y0uBs627c/Ci ysJXVW9KlNbzojDd9C8xcQ+c+75a+DuJ/EhYWpmowiOHt0zZ6jNJjiuYXwNTWg/GBH9e n12ovVQUhwEjagsQBTJPgbWYGS7NxAqqdDR3/0bS6z568SDiI/71W4cj3ONJxJYDwZ7J QbyBXmY4SvcAG8K2aEjLkK7fqHZ45eM6qO0inKUMB0Pl1t8DSUNH3ZnO4/5q5IEXFYph LrpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=ZhnG+3T9; 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 29-20020a17090a195d00b0025870834638si747490pjh.190.2023.06.07.01.44.44; Wed, 07 Jun 2023 01:44:56 -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=ZhnG+3T9; 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 S238831AbjFGIcz (ORCPT + 99 others); Wed, 7 Jun 2023 04:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238762AbjFGIct (ORCPT ); Wed, 7 Jun 2023 04:32:49 -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 5CAA2173B; Wed, 7 Jun 2023 01:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eLWXgikKLtuRonol6spYzSaenBmzB0an3gPpZcgP5IZLnTFZtbhLArXIQNMxkp+M6V74QVJt8Jhy+wb3udgd1kUTDDNgDGPqPDpOr+D4wWWKqVFeGscQBeQCOrO/wkxmOM+eJgf043SEgd+a9arK5p/GdafGlPrZFazx3xTXHpIvoHZjhnievrv/3WDB62wH4/NtB9zuugoIvRI88Z4WwpeFVom//raw/9C3kMhk0WeXJ8AHQ633MlyhYe/IggZMJ7WclObnUffQL0HJ9B4Wqo+5k0mSdwHZV5Nh4Y/nvh86IPdwgq5hOFQ+9nB+5Mw7TlBx/WAh139H0/UaTQZFeQ== 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=qRZxhGQrvCK/OKIHPpTr118yEW8wCmUFrDRdcojm2Gg=; b=ZLTa4MyxcppcH04rDyfE7/qmzZ2VMo42ScYlNO+8Wi+Nx+Jc3SBfc5EHs0qm3krKNwEdgcG5FuhXcS7dMZCb6BZ1yJ/i3+5lXNT6/ckbFASRs194M0pk8GYYS/f9UlLZ4S8S0IOVmmg2bh6d9FjJrTr3+FSSR+sQnncgCp/nezis6bEJviBwqyL5rYO6bOx2pjnsRfg/cwgjjdU4NffyUkrJeRajUqgvK2Nv2sn4T4NAm3qLneXIQQJQJbAy/NlKRxBtrw5Rqi0UVlb2bGTuPfMsERmDP/c09y0+Jz6eRyZoUTpgSjlP/u4HhuCyMSkwy+kJPQchFSO8DXpstH6jwQ== 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=qRZxhGQrvCK/OKIHPpTr118yEW8wCmUFrDRdcojm2Gg=; b=ZhnG+3T9rLLg0mlIAQKOdpfFtE1JoefF1cM1DWvjbsF4vDDUDinIZ1YHL3PX5rX8iXmOjstI5uplAdkfPRhkbJIXM4TZbWYamjrNjj74FavbXqfIg4VzFM5nUzSl/7g2zteeMT1hBxVhV32TaylSslwG1u4EDysHW4d6jpBymBU= 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:43 +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:43 +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 1/4] perf: arm_cspmu: Split 64-bit write to 32-bit writes Date: Wed, 7 Jun 2023 01:31:36 -0700 Message-Id: <20230607083139.3498788-2-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> 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: 377a1352-ecfb-440e-a4e9-08db6731c33c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4wB8M7nkXrsw/zPVL7RaFOj+qSoo1GmryHXnmSr8QDIqfbI4kq6DeEhluW7yTpfzawXMEdlOLQkqaf/Sx2lfX6YQByfTmj6Ge00+5OYXOVUwGLyG+rRDu4o59Md8hNlBnWiZaS6ufX0n4maar03HHgJJkpFFWIi4xdWsdWv/G6/Zo+P2DkX3Y/mSzfvLl9Q7yyhmBPVRqCpRCA5d5RLk7yYS5QIA0v6OLMWW2FQ11GBC5n5MwDIMQikfDHuVdcZ5hn355Ltv+v+PqBk65w8he0ceCMEs4gEvwLSyBOm0eZ+ZnwVC9jbaiShJxJLkIouUQEdBCsGxkcyFoInNH68vumni6wAZ8Nx0WoqLamWduhKEf0t80XU1C3JQjyyllj1/e+0SGkGDEg5D0jckLmxSTjEjwxRcwRhK2Zwj4IDxbRMa5g7SUeLutldLbxGKRoUUj0fRo51s7K8t9joZQk2BOGcNhKwBmP/5cut6iEKzAByVPojr219zKLuRE/pwBskBNyslK/RGIy0HeyosdYMVutlYVmRSxrBei4MeRASlD0y78IE5OPpyo57amMU9yiLUGwbaxJ8KZJakzejrE20n5o5g1e+AvbuqLkp8iN/Z/YKlnCFlJnY5Qwf9UvZHITDJ 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)(4744005)(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: /NyPUTRQifks3ng3fY3UyWvMrde3UKKjDnf4UIjRafhMDuOxQYHYw6kjiVWigdVYqieb+Nce3wF3ZMWhWXoh3V29LNClCLGZBkDRwSPPU6EqGeJMtvOVIbno0aTnEwy29nkfwg+Hk2PU1gMzJ/xzxPNmN/guUIP4wQj5DIqcG8kQOZ/fTcximX5YQToXuJ0LzcpPhcqAS2l666Vg5/P8PvYmBTI+XflmuWeSbivQ0V/ptW250DpDT67aPQh8wUjISz24jqv1JKJk9QgJId2AFmbjFfsbTCvCShBZzZRazs8b2aMVE61YnwKs4IEFcE/9fA4BTnm7UvAdLPxJ2BH7+qQnrmln7nMUKs5gpuwYUr6uzzM/ee6SyRJ2EFBSvDH0yBIH+ZTsiZ95A2PcqZ0MSpAdFKQFvZ6quWAa9SST+oFiy2n+5PUHy5mZNJ/5JcHq10Ysym1JQCo9/Z11qcVGH+rauunqKNFaqv5IUgbHEI1dwaAxkqL4u4BPW2qGURmyRtLBzkAbMzhjpygSjK6lpeGclZP2YK7bzOMSf6UOio5VippeW+qhIi+5XpcIi8NXepYL8J5CXEFgPJREPNzuv+j+92z3TxcvJEhAP1LNG1BNK0x+9SIwfoEv95lB9TXBZVSoiZa/4iaiX2w92trp2o4gCRF8h7dvareQ1M7aux8J+UGph6ThWqq2gVZfSQpUhD+BNeqig3lB4JEaWvN9BKzxT0/pQHYiS7xZa6HGcNPMN7WDrVyeVzRPf3cAhaOwSP1QA0ZCE9bGy4tT0Lc47vWyQPm7GGdXInQ3r4sfJwQuwI2lVSw9jOmsDhCvLsHqeCoXVM98okKK70Zn0fSJLJdvhNjC+nZvURWaHHisEGhgBcIZgJxQJrhdukCZ9rdwOQES5uHo5OiHEpJvz45DhoxWTM6LXS4U5mADowFyr9BbFCR95LQeWtOOrGgcz7G+PhvrcO5O12thpyZs5YQP/g2G9ZIbu45Ew4v7gMWJMELBnDeA4EArlNdlOKiNxLulDQgqm053e0Ell7Epz++DM5WBDT1oCPpTE6luCjycu2aQaPS0PgOYNpWe68WKbRXLJw3JXiV7uiTPieTSIJDO1a3jDAFv16PP+9Jf86cqBocWpxNizMRkbhSWfUELTHrs2hFEAye9QcJWBrk6b89FfDstb3Rz98xt0MdDaNAosWhUw+AQRWzmRIvQG2WfAyGiNKqMahVoYJuXa4zd3CLZVr5gmwycooPqs6XhUxkkfrt/knlzDbEFhj2m+/YTvyk4AGgPipHhPzRAPY1zESSx1orGAqp6blAUabhYwcNqKow9sXbEWXe/3MxbBfQmosGMHMkBuhXQ7XyMBX1o2Nt3XpMCDKVsMRVSwlq+aZBcRpcnmGYnvCw39Y7VuLeKea8zDqQMPiLMDUwUuezGqsr3sVQ6rokY1bjELXqquzTjLlEZTjWxpXGV1EjBkda/h3H7dCp+Ouzn/DRXobvfxqdnUkxb6efuQJe+58R+HsRP6GQq4rTrR6+4DnoewvkcP94DOkeLGu3bR5/mXegMWv/DHkFCtJEgIz72wMNS90umgGwaifi4Etp2heAZ6Mw3whxGGy76O82gA9FtkAYdoMZ2Uw== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 377a1352-ecfb-440e-a4e9-08db6731c33c 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:43.1132 (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: DH00x18ptTWAQoPpvPNhCBu1vwb7i5syYSjB9SW2DFaY1MDktKkPjInxOYO/kb1scBjT4qDmlCarnwawPA6YLZW1KnqCTsqc1NNoWtrMAH6kqN+su6fE1LvX4L7VWMqE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768032826187832082?= X-GMAIL-MSGID: =?utf-8?q?1768032826187832082?= Split the 64-bit register accesses if 64-bit access is not supported by the PMU. Signed-off-by: Ilkka Koskinen --- 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 a3f1c410b417..f8b4a149eb88 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -702,7 +702,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 (supports_64bit_atomics(cspmu)) + writeq(val, cspmu->base1 + offset); + else + lo_hi_writeq(val, cspmu->base1 + offset); } else { offset = counter_offset(sizeof(u32), event->hw.idx); From patchwork Wed Jun 7 08:31:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 104341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101977vqr; Wed, 7 Jun 2023 01:37:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5F6aKZ7RzPBOj3ozUtR1xvUXDHkmO+7LjlETHpppgLIWn2IVaDP76TB32F/obzTYkIGpxh X-Received: by 2002:a05:6359:18:b0:123:6652:f581 with SMTP id en24-20020a056359001800b001236652f581mr3212626rwb.4.1686127068433; Wed, 07 Jun 2023 01:37:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686127068; cv=pass; d=google.com; s=arc-20160816; b=OvgVdrzrW7UAXUFiz8Z0CBmJsWMN+E41AVWR/8He4A75pHwXuaSLwHLXtTipfdiSTM zNj89qaaRar8h5Z6wZ2fggsGUAoACGIcaJFvx098zgcSjFw4BFSntb0l52gICRgSMpHK 3rKnufFqzz4u4htGsIXmV5H1PCrmCzLh41Jd5ame/m2PaKF3LyNe5LZZ/YSUBKEuU0pZ NxwHBmcuhSNKDhlx0Txpsf9aJXua0nRr35hh0O0piPPcPpDvSqyX4NaMF7GPMyiZEYOZ XdwUCh5UlAFkNFgvFxPpwVDiWpB28tNx3kPwbZDl1C3cFD/42tI2Br4ijFnLyZnDQ0Ui /+3Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l192-20020a6391c9000000b00543fccf522dsi1872609pge.449.2023.06.07.01.37.33; Wed, 07 Jun 2023 01:37:48 -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 S239237AbjFGIc7 (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> 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: v0Wsy+ITHFmbbqq0MEbheCfqqosoWjprTArzFbToxiWKKTSZczB6EwzX7eE77UVAukawyHHiQwFisIm1r3U83zUErPW1U6rdRza9qs6apKZT49UWt7w8cFShY8vIUnX2MW/Ii9N2vPyudb4C3Oc47sIss3E6xho+5PvMrjwRBzSxjucMzM44ktw+DM5mcAZdpTUTb2CZQYvjhcAIcPDhiRxQ5NTmvbUme5AeM8dl2SVk+t06RlXR87BghO+2CBbSlfcAjcKnmHJ7OGbWSJQh6buBxPNSJnb+AqkcJurPvXW9HcIBbaJYdr3CMnYFe2I/NDSkqrtgTK2abxW7XMJG1wFbDQQcZ+JuxtVeFwS2wTOnWxtMEQCvKqxawqHOkk62alol6r7GRLVL7kFXYKzPJmLJ3gkKObf8lghwaT2B1w5ZO62x0mzq6Qv2A4c7yU3qql9zIX88symR+lb51Q6IFdsf9C/eaeHKI/eqXqruch/WrVaplgIH1Xv6pB+RoHjHZknK2yPurRD+vCvHwtdu07JYMafQRAA3VIGuKAFiW0KkiLU9cbphdFuTGdwc1efz54Z5tjQGHznfa0wShbw/0jIYPOpgogzIS0I8l90QeBOoA9ZU2djlHH08l1xwBm8mYvXVw5Q7m0ey+aOaAxzH40zAn33pwmT+XgafvfF5X9RK1f/cT2UYBMdpc7cZHPx2YqpbgLOiJMsZUmQxoO+LN/0ch5/m3IutNqh2NQ0NRtKgTpuRgwqtKnf4Mcb+d3VQnxgS2TuvT1i5Gs/dvyHet6FSUFHfV4U3ZgGg+DPk4h+9cUuQyPOdzMENuRQmgH2gGFLXjPc6TikXpRz3yLZ6yeWz1eM9q0xgtIPHTXb8oJkCfPkA5qZOujG1/4y0qlYjcWLWv1dX2/qY95Df+yE5eh6FoWgNM04/BSkHBocVJnecifjGaYDqQk9R76zo2+yiIuJ8Cfz8aG510oKWd7v8Vo/nv2XIflGd1kVl2Z9gGVpsDtLGGuyODpl16bIvJUa5PYNGXx5qEMkmx8urg4CGxnAv8XUiDyD1EVqpwIqNvTW/wJCUZpz9D7DlvDzVTUHQMEABPlPkl+TJhtkCapdGM9EK80bKARYfABF1Ob/gS0rbxmvvm6xqfmDGoWrSEcQkFdbOIMrTvy86yq4q7OZAQW6ojrSMnkGbkE9tmBmVpNumYM626ITI49/0Tq8AxDfqw47ytI0XtjIe6T7KrIp+ErYE8bMvZORogYowEN1+wB+Mcxtxil8JzIlUPzDnmRsX1Pgw74uvknktFfOd2Vz9WtS9IZrb2EGqOO0n5ybYU6HFLEDGeafVKqGVoYib9/uIIJCfZU+/+VEcmz+1CNUYGBGa8ED11iHHDAfiEw5Ra7nm4NiWSPTg04u9gH3oyZ83FVSuN3EFPz+mwVG3wVSdBEmnCQFAVOY562Lr5tvL4fk9/leD8v5IPVctPAfuCqIBLtw79SVcJ0tVqDpM27u+ZUOnc7Ew5XUgLvD3qq0BzGFEdTUzcqY5Le/LGktSb0yEZ8umCboYx9fmW7sjp1oyT43t0czFh1rYGK9HZ7E6bv4Wply2CZ8ZnpOf42Plx2ejnKHeuaPDYlyHEz/mDPooSg== 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768032376753115566?= X-GMAIL-MSGID: =?utf-8?q?1768032376753115566?= 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 Reviewed-by: Besar Wicaksono --- 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); From patchwork Wed Jun 7 08:31: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: 104343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102696vqr; Wed, 7 Jun 2023 01:39:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5s0j2G5Yei98NDxzpGO59dVGKd8uCKath22J+qRZ+RFJNiwyNYUac+QRKtgbijmNuHon9O X-Received: by 2002:a54:4805:0:b0:398:4761:20d with SMTP id j5-20020a544805000000b003984761020dmr4757753oij.19.1686127178555; Wed, 07 Jun 2023 01:39:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686127178; cv=pass; d=google.com; s=arc-20160816; b=U5mJpkhMujUN2k0nhxdHqwZjLGitItfhgRIXx+DZZlnz55onNAO7jVvWUf361ogvgK DjhKBpxkX38vsPs2C7Ub2MsVnxPsyxjWJrCnbmxeGMeGoBw/vn45KB/pc4aZSsxYsgRQ hZKBb40W//U4Z0Mnf4VgyUB+ZI9xph+AaK7mLrpzibgxsP4v4anncTRzt0UX6H0RDVQP smf48Am8ZBR8C0ilx2obKCI+DAooc5j7kQlCF4/is+b0vPuNpARHU0wffXPmpJKpo2tV fLWkSsA1D161papPDjBqTrUQWvsYOnhmPWIKCso1DxPMPZWpLuC0euWG1M6ee173lqi/ N3qg== 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=yjxAoSfZQ8qgcO7MR9/+POxtx+TQexaZJm7xrMM5Wyc=; b=0/+Om21nAsHeZtXpK868LEBOKo3LDAPeZyJonibgQzI6aEHUR/UPUqFerv5WYCFUPu u+Q/UZC1lbJDhfFMHqkQ9/5/9/Wcjeszb9gH2BMcNhGtobZ15OkmfVimLSPBoWzMT5bM 5T4BArLCq4es4Pk6V4Ms8Ysg38txi00RehevnWUVl6U6Qrz6Cr3MWnrfDXbhJWt9cGdQ KpKJjBLLcsqVeVc1YdKpUk5SHzeokC7I1n/SgAnP/0tEIOAi7IC7WLig5dcbzmaCrfCD OtSEASQBi0Aul7QNjZIIn/kMtj5iCHFvdO2RUUITsypoPtugLc5XjfT4fKXJU4q316cO kzVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Q1OJgEx3; 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 u4-20020a17090282c400b001ae5e755a12si8300149plz.186.2023.06.07.01.39.23; Wed, 07 Jun 2023 01:39:38 -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=Q1OJgEx3; 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 S238663AbjFGIdU (ORCPT + 99 others); Wed, 7 Jun 2023 04:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238858AbjFGIdH (ORCPT ); Wed, 7 Jun 2023 04:33:07 -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 3FDD01730; Wed, 7 Jun 2023 01:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cL8aH1h/1sL4INO5HupaiXjZzDIsSRpFI7s+44RCoeaCJ+nMOWaxmps12TYp/RFu7CpnS87oAB5mHtr8Sdz2XpLfsx4u7HbXcytWkr109eqs8czTxMcsIvrhYRKbEjvk/RnYMaZkQ//QTK9cdc1Q63/7Xm4fUkizMXluYM645jJaSc47/Z5udOODC93MBr+k6+6GZbXphLB1rCF0j33mtIts5ReE97G5KjcggMeTK126byQ7KJBMYYBrigXDt9vOV3oI5HVZOxlxmDap6ujR/C9hySpf3JX15iKLu0REApnzkpldv4Wsr971qhov1kdO+L82Mi0OeHdFeBSJrniv/w== 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=yjxAoSfZQ8qgcO7MR9/+POxtx+TQexaZJm7xrMM5Wyc=; b=C/4zFXMHDLNs2il30mDWEEfs2twSq6HJAn5HH5TofiHfF+vixewENKjvmwOGtTKpGqNg8WhhHRmjW+hE8SGi5X/ib1G2yiA7tXz6kLYHQ9LouQcoLTNlLUYmunFjfaS778DNlqZjGub0aBg8lQaP9SDt9ze5qjQLKwVSW5IjTKZh6sH99P839pkku3R7ucnPQ5f27Modl2P8tUi+uIHOX8WCve6mh8AIpOK2SjKiKKbCykTLShWL82UWbk6lAPsIu3whI9coVbhD8+H92OghQQhLacaBdxngwXIEArlxYSCNkIXsa2PP8KmK9mul/IQ50gzkO0jenC07BECh7RALEQ== 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=yjxAoSfZQ8qgcO7MR9/+POxtx+TQexaZJm7xrMM5Wyc=; b=Q1OJgEx3t4wzdAy9u59HL2tvxbCtDMo+uwsjyM9EYaoWsnu0HyqcpHuug8JC5ENTru6Q1l9hvYRnf57oIxgmGktz88LwDnzzV0TzFqUJ8DPJXUo8J9BgdccoBVNPmkAG6HwH7ZWjH8JnA8INN5BmzQmP7JuCln4VUvIIYTQyQ64= 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:51 +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:51 +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 3/4] perf: arm_cspmu: Support implementation specific validation Date: Wed, 7 Jun 2023 01:31:38 -0700 Message-Id: <20230607083139.3498788-4-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> 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: 475f0c83-cc23-4494-1a7d-08db6731c857 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k3oG+wrTuXUQ+/9UTCWe3zc7snU3Sh6bOVYOIGRDQQfmfCRLHLb6Wku92jrs3VkGUqVP3OSgw8yljf5jkR3oTuVDTHXXedOgoomheRL4IbgvE6zcOjMrZWhpNagNVoWMF+F+3/4C42IEooX4dgQiZugqZdaL/QLrClOZAM70BG8vpb3Vvr7iUn/SGhEFNd3K/HyzPLys8p27e9kRbzxGnfzYTcnkNMJWKKFYHUc4xdlOnnzVxUNK1Lx0C2ECvX9QOiARFVkASAR7cEhV5A+5Ep0ExIUOD4UOgHc4maHNBMq1NqMzpOagWK7j4hYAEHS3+VHKLiCFnazKlbT/GozIEtf+YCZJw+AcgV8dO5VixCU5AcHxl1z2SUTLgQ7H6/AYhCEJVtCKYCkiMWSD3jijKG0rdrw08MjZ4rmCyYZrGCJN/0VVJMoMT6g/ihjekeePVNjrGW+dwxTyxAHyE+fqu4LUVWXcYvQ+BkeFR9aFORmKFZoGUzWs3oJsdTJZv9gqvZmQI6PhyJZCsNQQN0jqQ281wpVudaPwuYeXMlKRyPxVZ2ikUVWKjf4AJz96hGErUJK8k+D86FtTlVnWhsxPYuMNBG2ZTDJWicLTB0GMEKIuQ4NRA8F98QJD1x3WQSk/ 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: L2MWHXjPDdRdBTZU7dnEyPvxgwfZ4UXU4OsyZjeLj0s5wDhlxhF/2OxQQB0tZfDq6E7TxkkXgQWMu9uebz3HVd5jEI9ZULp/UcSZEo6Xm0vbOTNXRRLLOfbRph8yqjuHYbGLHsso1tIv2+mQZajlKVu++t1Y05ZbSPq7/OrFFPm4lACnQOL8igIlp+ZWEZKJa2Qh8WerPJ7yb8QgCWrVKlk+UC+CWU9mWlLU5pBEHiyG7WIPUtSl5iZTBbIiSpY6tlJac7JpGewnaYvTk2WT9W8soHK2PBxXG9C9fQTbj60nL8GHAtSx/EPHvcdotR/mLFQvqFOawLQ3gVdYytmgrNMQf149RwI6xo+PfkexpNNKOab05qCOMxeIPTIFFNf2mPWehMlYjBfKwTuGAjiACucCEkO+Q18In71alcLpNUtKaIj/uq6w4+ROwV4RJAZvxmlVu6XSK6bSkmDg25R7t+w5MN7mzgou4QH3UbeL152VvEKPbbXURUr9iG7qcPffdwRydKVJkE9AhueO2PsEc273e5W4k/bHeP7HZDkJsDMB15/xKVzM9mfzmdI3DVYXMHKyyhuk0HtrvapuR2w0qZOQsNC3kXILV6OslKrOQJumu5KIFF7ljU2XYn2Gs3ddEfCNBi3v0UdM7vAFd3E+bJL4oRAhu4IprHyyZo0LVsiBdOjN0ocXYG1TBlgMgZVxdpFnMcKQKLOaafpDt9q2H0wVB30CjLTB9gX88PxzH7TMEB8UGVGKbcD92c2QStFf0uxW+RYn3FCRKYA5cXBnWIDFFWETMXfjckgAoN3sWXoaQEIFiD9gvajMP5FIhhC980OmDZlcpyb+kMOK0OMHf+sIJftXwKJQ832YCTNI47wDwWtTyT4mxTyikm9zev4UNjR2NwUA/bIUHKDsAN7f7aX4uoxdRtk+CD4ViFq4ptEBIezvaGoIAlFAyHC1zld5Ax95ka/27mlfj7FL6TtF3I1aw4G59XkyxZXYoX2G+yqPi3EMvBWEpRKc14RlIkDqXaAAZKwuC0tGz3Fdi79m596TITGHM3G8wHmXF0NIH5KnL4EJ27UWcH4GbCyHNJCdw78PtNm3k05MD68SSzdAUEYMANgNn3kFhmeRrnehrZMC3v8wFommQNSgO/O9tnXbdXeqR/mLUF3SMUUc1NVcCq3xDu7yo7NPmWd+3I/mnaTxhydejkGvJYNBN0G4+5HPRYKQ1OPrdL7RiUOH5tCBgGdG9tqtQ5nAskiJFb6kC8YNEDK8tLeLMxv9qBO7VGSgfhMNCnKCKsY8lUeaaansPSeTE1c0iBdo7p9kvdsaB4wgfEri1rhFAIBnlBdB1LjtdLMoaAct5LsXLFS53B5Mrd2Iq33Dq67aYJICXYNMF67ZXNkcXEo8DqGcwSaHa5aMDRXFM+Z0L1mP77JhYQfv5BJzzP/K6F8xNfXJOcRalp6gl6Fy+k45bpIIDBRLQ12oYgS1f28nkj7R/ftiwfbBavnzZawueP+6tR7t/7Pe5hmwoicFvw22qH/Q8i5mFmEjGsghLvAdWPgOHOrW1GBlS439OdgY+rM/HIi4nsYgC4gtSxJJenJyTHMHImJVz/BQzhDVKs2MEQ7s7sedcEnlrw== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 475f0c83-cc23-4494-1a7d-08db6731c857 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:51.6637 (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: +ogIkfR074TxTPQS3Pv205KYCImmD/BVogpcSmkSbu3B1YI4o2CySygF4JWuEw0487VUDoS8ElJ5pfmwbICzjQPCyRgiU21q5VSqVmPsSYtJUv7vk1pKpH6FK382SDS2 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768032492452105983?= X-GMAIL-MSGID: =?utf-8?q?1768032492452105983?= 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 --- drivers/perf/arm_cspmu/arm_cspmu.c | 13 ++++++++++++- drivers/perf/arm_cspmu/arm_cspmu.h | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 72ca4f56347c..9021d1878250 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -559,7 +559,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)) { @@ -593,6 +593,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; @@ -618,6 +624,7 @@ static bool arm_cspmu_validate_event(struct pmu *pmu, */ static bool arm_cspmu_validate_group(struct perf_event *event) { + struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu); struct perf_event *sibling, *leader = event->group_leader; struct arm_cspmu_hw_events fake_hw_events; @@ -635,6 +642,10 @@ static bool arm_cspmu_validate_group(struct perf_event *event) return false; } + if (cspmu->impl.ops.validate_group && + cspmu->impl.ops.validate_group(event)) + return false; + return arm_cspmu_validate_event(event->pmu, &fake_hw_events, event); } diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h index f89ae2077164..291cedb196ea 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.h +++ b/drivers/perf/arm_cspmu/arm_cspmu.h @@ -106,6 +106,10 @@ struct arm_cspmu_impl_ops { void (*set_ev_filter)(struct arm_cspmu *cspmu, struct hw_perf_event *hwc, u32 filter); + /* Implementation specific group validation */ + int (*validate_group)(struct perf_event *event); + /* Implementation specific event validation */ + int (*validate_event)(struct arm_cspmu *cspmu, struct perf_event *new); /* Hide/show unsupported events */ umode_t (*event_attr_is_visible)(struct kobject *kobj, struct attribute *attr, int unused); From patchwork Wed Jun 7 08:31: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: 104342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp102416vqr; Wed, 7 Jun 2023 01:38:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71y50sWPNDRDWtmJaY8LSdzZuBb2yb0Fp9a31ISSyPun0IFZ1EM+/E38xnifSHSdu55S9V X-Received: by 2002:a9d:66da:0:b0:6b1:5fa6:cb4a with SMTP id t26-20020a9d66da000000b006b15fa6cb4amr4853014otm.13.1686127138391; Wed, 07 Jun 2023 01:38:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686127138; cv=pass; d=google.com; s=arc-20160816; b=LdQS5t+5Cw4kOYWMy4gkekBM0CrMX0SjinMZ1x0A4KphtmqXVyAgDYZWH+2Jz+Kyjm tgOTzCMPiuewGsjgBKZCiZ9i14X5EdDLN2yxnwsMfLn6YXi25zFXurXTSjx25j195Z7C wupH7Y15swAJfXspsvbw/HJDBa/MCr0Qi0Vw5wdqu2bIK/FjWH1ttIbfACwFUcgt395i hirllGda+lHytSZhpYn5medAR6I1XX8QRPHnLu2eQbk6W0ehWW9n4tpzqOmkupcJWmTb 3sdweA+3nLvMB2d4JT7z4jzWgN3XTeocuXgE3EMQzYey6XSjhFDOgowMVRsjGLETzaIX q6wA== 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=LMHx0l0kalUhGd26c392PtqTJJnl0JPQWJmrDNddKio=; b=u77WxSDoFBVNRaVq6mCmVENbRrZSXTi69p0MPwxszxnEtaik57IbXCTw3m+fbY33kV rJSv3UCL8cWPMWDP2IVhH/9XWjmsgaIsVqps3wPo43KzxW9yYL8DkxRwqLCoGCXPnK60 PUUw5xKS8/YvlqB46sUaPHDKNslc2AbYPW0KJcCghqkDton4ifcs++lXGv1rPtUoSmgh J/Hx2m+JOtb7a3M4bTUkbIcYeWn4/6tItit8HKml0ZQVldJqoksTQycRfv9WIvzK2cce +YyA2+gieiz0OTjOkl7bsZm/yLRD2L4DJrWBaKpYeEU/7khaoisq7hEvNtamGBtxMPVl 8d7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="DrAW/Nit"; 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 m189-20020a6258c6000000b0064f78c32b89si8475342pfb.95.2023.06.07.01.38.43; Wed, 07 Jun 2023 01:38:58 -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="DrAW/Nit"; 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 S235583AbjFGIdg (ORCPT + 99 others); Wed, 7 Jun 2023 04:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239528AbjFGId1 (ORCPT ); Wed, 7 Jun 2023 04:33:27 -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 0491B1BFD; Wed, 7 Jun 2023 01:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXmSFKiKWtP60Nm1shUUTAd1hCx3v49mHIdzJXkNZ4wR/JXj2B/+8E56Psb2m9R/oeI5GpDuG+WqDqPbGHK/LwMQcAbV1Fr+uCAFwoIuaS+xjxBSyLk8ugCIHX6E5fQ7md0/F8jZMSO5TSaDkXoDVVG9xGvsNPbK1/+uDO5TaX94YuTTgIjmUD8v4zvErA9a+MMApzjY5gTSagHA02wEbRIl9mLQt3FIMLWNNupVVj1MBzmtkjveUYgb5zfsn5Vpjou6sraaLRi+RX+q0bmX8ocFcOk5UJBh64rkyI9cgEln77lVU52FD0u8p2/nubfWw+L/WdwZ1S8voL77oyvQmA== 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=LMHx0l0kalUhGd26c392PtqTJJnl0JPQWJmrDNddKio=; b=flo9AEINpLXR6pebzN7MV6mR7wKj72gRzU89LVDi3uCsxWdWNQkOPnQioD4sUdVv/Udf8M/jwaZXzSu7uFhHyLcBe+oXtjMNxw5jcB2sWCf8IMzr1xKBPHeYgG3EgyTmM/QFDHkiQuRj4akFo+bdeCS12V523hVf0HKIAybmMx+XtHo5gsR7H+SsAtc7fJ2MANZJF27GE/G0UrAwdym0juj+1wrh5LmYMDtiKrPcZUB7d50mVywcNE6LOwaQXBJPM6UjPvil36aEnEZWgDTDReCSWXS4WAMXh0hxUA+x5trxwF1xWfHTuj6G3AIwE3Y1MlQ1V2rhkJf3ANFW7C90MQ== 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=LMHx0l0kalUhGd26c392PtqTJJnl0JPQWJmrDNddKio=; b=DrAW/Nitkmsy2gKYG3+prYPSSS6+5n30/6BMFCmqzgRogoJpzqDh16VmewnfF41AMeLlseUWtE6pAiZMGBt1mLNzxIMPR8U1zLF3k7XK12mK4FhNR5BZw3EV2phT5FbxH0jPC1RPsaf6qm770qAEBTyOW+fuMTQQ2O04UPCenHU= 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:58 +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:57 +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 4/4] perf: arm_cspmu: ampere_cspmu: Add support for Ampere SoC PMU Date: Wed, 7 Jun 2023 01:31:39 -0700 Message-Id: <20230607083139.3498788-5-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> 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: 84ea2b9e-6f57-4743-56ee-08db6731cc0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jL9l2/1nCgevr/sqDzCU9X/IuSMuySqLazS3Lnsm5Nj71vx9HaS9VzGJJgoGu0g6tEubByVlBo6GvUvEYznnkJinlfePdn4P0J8tEjXg07CNeQoR+ynuZRMK4jaQM9Ec01+1lFo+HeKSQRPAlKEZOYDL0k9VsL/jlorvyPS6D5DxSztgOK8EylKX356UiBaTPshqTYvj8O2AWmekUEKI88/LLgfZCwm5fosFiruda6o+tADps+OBH+J5ilbYkbxQzLHSzWzDmGb4mryjIqMxz2wUMj2vU5hTSaBrTPzgkKP+I4HNWKmXvyAad54zCl4UPj6k4/cwm0FspuurqXDlRIQyXU6jVoqFeZdNnHUSOJNfAdyOfcwl2YdT5CA/xXOehKsd2LfWWEducTZyi63RSoTaKAHA0irR7qSZ75Z/GL0PAphxNVw2//F9x2+eHM9Sep1TdTzjGMqYoIY741siseRHcy+Rt+a+K6D6ihmLCVNEaaFVB5ws7JBHHKevO9bz6RNjs8NwAUXxJz4kxDN0Pzkoe0LRmaD2/6lOvivtokD1ULyztv0oK6x7fv1zmPyvmf+e1RthjP3Rgbq+h3YnO9JNSrcqAPaFueHVuI5Ri6sAl58peUsL78z6/+HNDPPY 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)(30864003)(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: 9/W+frkZY+CWoKv1oHLKM3gQPe3Ruz5pzCFMX9F9paN2SpTcyksjU+N8DGm9UfUVlAfcFO4LeYMiAbtNeQUHeaeY10VAytLHW+VHpoXTw6P0e7nMpX/DRJGi/MkPib2QdJaQoITqn2hUsSL4yvntTtKjESG2H17IaryJumDYoaWtGSdmk0F2QMH/9lD7H6Es1ACLwDAhlUA6ws2vWewfcKELLlmzjQawRjWicU7sCn2RlmlV5bM+wyRb6tQPJ3QJr7M1Xw5AyOpAuWKvWrW+Ahz8aDoKORQXCylRJCiSbLr5ePt5GCOnQO1HccTOdg31g6Xxd2vkSB8C7DXdxuYInW9bJJloTAjE+vLCfbYE3d5dV7Dm9faqYYsIwZp3hlEDZkD7e1u/REtHi6I+xbOQZ5OrSEf+OK3NIxs01rhWgQtkuzZZVOX0xijBb2sGPNAH5hqxl+ThezLnSPLVHT0VkkfDEJN3QNbOYzox7d6+xJC1lFEW1kWd+e2+BbkXStgDZOIe7o8FALxDyl38WckWY3rwasNv4hlyfaFw8jekM7ei6T9MufHr/g204gEmcL0BX9bV4lyI+joPvavOyo4NJFcWaVqSATSOV1PFGF6NxSiNf7O9RN0LmS8RYXbsjsKuJQJLxWyuhYHChWv5B9kU3iVveH3HmvPfVv6/d96kpQOTYWLHh1GVvlYOaRKU+fUBUEY/dzLVrXlw0mcllrb4p26+RlQ1s5+uKGe2xYNECNzQyusADgu5zv+q60eZbz9G47pf9uF9vXlJiRJVwZe+750K7IyiVzi2uJpe8gq8Ik0qWzdlrEGoEXP7H05seORG8wA/tETX9++gCIQCrEScV5QoqJxmRqbfozvE6/vt5z8I7kUp1+AujjNPjbQfi7Ce77XsDlEuqcijhwYSCUk0r9UdXPimz64fCpkd0jMozvNOMRy2JRe94/TwS8XA5ETAduXoXDuUKrzY6yeX/QvieSYOdixxiOyeDHuV8a8tHXiaD2VKnW6v1tdJjaU5KlYf09zI9AdLJkNMkBLOvfq7mEmP8Qb1pbD6n+OKIiNluXcsCZ0ZvhyioBV6BaDAA2mJX0rdJWhw8TrSoBKVEu4muzkG6keiaYGd92NfNFeYUUsAfDdUb8LbDFz7xu5XjHixKmKNR4U7BlU+oc1voxUO9+PSHIG1qSklMvyXYQSrM7ZSfFYk3OrE1gQNNdkJDp8iPiLNzY9mC3eVogjaVzvh7VteTAHpm9Egy9Rj9uD8m9bhVHsKZwQUeHgECvsm3ad3DrvLsPO4aO1nCi6f8XFoV7J/nNJdnUCLciPQItTBFUnKxzV5caS+vneEToiDV6u0WUD/EGYqv91/DwGSxM9reMafnj4KFZvdSelZbrV5yQmhg9eGvRpoRA5SUzuPCc6hl6kIsELwa8pW+J8Xassg5c/BCsG1oAQwB3BbsJbZHx9hAuIdsuwQSSmsK0FnMgRfiXGkLRe6slhXNgVzbVI/NsM3F8pCHPa/2P8mszpiNnbb7k6/dlcLdKWAHi1MUbP/GTzlcq48LPPPfJLo+cJy1E2wzg0AP7iT8dU5lzILeLHc97/ceOCgQ1D3J0b+6I3hVqjEQ9KJv/z/siXDiXGogw== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84ea2b9e-6f57-4743-56ee-08db6731cc0e 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:57.9245 (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: Tn+q3x4GVYhSzDaK9sBELVI+dDC/Q0DHsVMZl8SwI5Y5f3UIAJTy3EQAHw7uYXp8tYAaRBvDberwY6bLIRJW2oUAmxJ/v7WADQH7cr+GrGgMuGq6wlrs/9DQdMaPiVzd 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768032450508556419?= X-GMAIL-MSGID: =?utf-8?q?1768032450508556419?= 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 | 243 ++++++++++++++++++ drivers/perf/arm_cspmu/ampere_cspmu.h | 17 ++ drivers/perf/arm_cspmu/arm_cspmu.c | 7 + 5 files changed, 297 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..94f93f5aee6c --- /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,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..1c57feb4b6ce --- /dev/null +++ b/drivers/perf/arm_cspmu/ampere_cspmu.c @@ -0,0 +1,243 @@ +// 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_params(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_group(struct perf_event *event) +{ + struct perf_event *sibling, *leader = event->group_leader; + int ret; + + ret = ampere_cspmu_validate_params(event, leader); + if (ret) + return ret; + + for_each_sibling_event(sibling, leader) { + ret = ampere_cspmu_validate_params(sibling, leader); + if (ret) + return ret; + } + + return 0; +} + +static int ampere_cspmu_validate_event(struct arm_cspmu *cspmu, + struct perf_event *new) +{ + struct perf_event *curr; + unsigned int idx; + + /* 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_params(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_group = ampere_cspmu_validate_group; + 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; +} 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 9021d1878250..885393ed993e 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -30,6 +30,7 @@ #include #include +#include "ampere_cspmu.h" #include "arm_cspmu.h" #include "nvidia_cspmu.h" @@ -119,6 +120,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; @@ -394,6 +396,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 + }, {} };