From patchwork Wed Sep 13 23:39: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: 13383908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23EBEEE0212 for ; Wed, 13 Sep 2023 23:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ng2lFl02Sz4E5nqTLQKBhtMmAuHK0nofhHZf2QTDm+M=; b=LEXdMN8nT9KpR9 k9TWAoMLolmdurip5WuLvRnb8o6QagLffto9l2nMfweBVvMdrSv1yp2kUEHXj7HtGcBrnUZipgZRr L2NciF8VNt18VY/gm7OIR2+K/GOw5c+ziFlxSvRHyjl1isQn+24XKcc+pqB8oxloPiAuJLctGj5Sy pvQOXuZN2QRr83CMZpGGrzs8I+4+QS0Cb+papbKk/jdxZYV9iUkExPpKN5xydTNPJWZLZTzyZz/fB zw1qfRudWZZOpZSoEjsZj8Ay+1zwU2ZDlgy7LTMiHPU0HwlLiwmjO+ETyeW0G9TgNgft0cRX2U1eR 7RBZZc1P/goxa2af6blg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgZTn-006u7j-2q; Wed, 13 Sep 2023 23:41:07 +0000 Received: from mail-dm6nam12on20704.outbound.protection.outlook.com ([2a01:111:f400:fe59::704] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgZTi-006u6Y-0K for linux-arm-kernel@lists.infradead.org; Wed, 13 Sep 2023 23:41:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fEE/5oxMBUf513pBS7SXqYJCoUovmZCo75g66U5h2Z7MBg84vqDQ/fJxQ+qMvhvEe65o4RmijFXRd27Q01gOwmchY2Zi1uaLZmlCSi/Bey/XlFTnFmW3AD5+64ETAA9YkcxlSuTUcYIVKuN4t+jBQT6+/hsMFN4Rq8+8FfMWEMR+g2fd4x26S9EZ6zin8diQ1actY0BIFdhfN4VFfL6uCKlABd+b+GKb5hFx5/Kg/Q44XZbjZsmyQg62rznL89kc6I1SdEkdu+vSpcM58i5G758jBS+flnkk+YaOZ+58YFwCAQDKohD6jBKJAs23L7UwhZazc+fUTluXnZ8hrw7HIQ== 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=kDFIFck4UWrz+RGf11qmLKfLxBYiP9tsmvdwPpcKwN4=; b=hL5jV7rQTVfvWwCLzjjCXSyzccWdHk5ABq8+C3rvsiacVNkzox0moqf9lpzgdQv2W+ajS0bxXjU2OMaOy4GW28QJEVWHU5CVbugb8ZUiPPNcotIR+/og9oFoHwuKiawVWAa5RJHDvv5jur8RAX0Y0XPe5dvbh6EXe0lGiHiH1GGSq3Ei8Vbwzo3gzn+RjkjZ6oRfuh+4fvZuD09JnhShxytXdlT4M+3Fqge61V4VWBMmQFN/r2wNtHJSTkFj4wkusxVCsrr3OJyk9l+OD5yQ//4/j1BKKUB1NCAulO+MS385zEDIxnWnGB3oI2MZNqEd8XQz+DbVcnUXaSW4eWZ2dA== 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=kDFIFck4UWrz+RGf11qmLKfLxBYiP9tsmvdwPpcKwN4=; b=BtD/pTGLBkPdXKmVKfhOHMcnXn+HXNsFN+H48e0g9RzCvEBNlZrGDOFcZ7vdPQoKew4w0oO7kGzY/SSb6PI57rEBe02G5WQCBvvcUN2xcCHjkQsFZVngsA4wk7LGefe6jzCQaivtTWhqCtKeQmOKVGhx3CQrkcamnOSPCqamDAo= 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 CO1PR01MB7258.prod.exchangelabs.com (2603:10b6:303:151::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Wed, 13 Sep 2023 23:40:50 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::bfa4:8250:f526:5015]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::bfa4:8250:f526:5015%6]) with mapi id 15.20.6792.019; Wed, 13 Sep 2023 23:40:50 +0000 From: Ilkka Koskinen To: Will Deacon , Mark Rutland , Suzuki K Poulose , Besar Wicaksono , Robin Murphy , Jonathan Cameron , Jonathan Corbet , Ilkka Koskinen Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v7 0/4] perf: arm_cspmu: ampere: Add support for Ampere SoC PMUs Date: Wed, 13 Sep 2023 16:39:37 -0700 Message-Id: <20230913233941.9814-1-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: CH2PR18CA0040.namprd18.prod.outlook.com (2603:10b6:610:55::20) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|CO1PR01MB7258:EE_ X-MS-Office365-Filtering-Correlation-Id: e498b74c-d84b-4b41-8465-08dbb4b2dc94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kZStJyY3nNlxKA2yqcqeRq5xoowrNBeOJNXAn3mmMM3Y2ZB5LG6tWVxvAesaWX4zrl/E24588eYtI1hHodhZBEEOh3O4UzLcQx+kGiu3185LyxRUi64Cs1zZzcPau3VJs2CNR0ib7CR51RswiXae0n8OtlMT7pEMZXqHmIaNNwnWUkeEJHvvuX8qEsYTSsHnPgIdYSgWHZoFy7u3Lfjw8tXaxuTOZXl150WimJttcMJVwF74paB0H6nbPGl1R2s4yXWawJXOq6xVviezOxRUElYyXmAOBTJ5lthcW3StzeApx65OdPSGMXmC4azWbKExSq4Zmz1IlfTRwzwdJR1kw66xyDMz4nwBbvN6Lw+CVd6SziX5Qm+0BIuk773ppPBV+KfhBK7QmZZ6A+g4Tf9u8mo6YLDvT9zRHpPDcL9cUTWd2p5ADlwvQeUDK5HxcAHXJE9Cv+zy8mGMF7L4tmG8Md4gYfEsWEw32tVNjWugRT1dBZdobJ7fjlbEsNisLLrBVq37+hyoQi3dGSWI2Es1LyW02BbyEkNCl1NhTN3Kx/hL7C6rNihCs/NfGM+w2fdGaR0/n4qk1UmAACTmDfyCuDYQ/58r/eVsInM+i3ywMT0STeOA/IGm+YtdjrPVLoiZhjtUiL4wH9auuuNVig430w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3590.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39850400004)(346002)(136003)(376002)(396003)(451199024)(1800799009)(186009)(7049001)(26005)(1076003)(2616005)(478600001)(6486002)(6506007)(6512007)(52116002)(6666004)(83380400001)(966005)(5660300002)(7416002)(316002)(2906002)(110136005)(8676002)(4326008)(8936002)(66556008)(66476007)(66946007)(41300700001)(86362001)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xlyBmmdW42WN68fTtuQRSNaGRSW9SMbiXhlwZYP8J1efOZ3m0xrkFuwLDATQwZFnz4OeXwEG8xgPnqXyc/SmIAAEwoU2UpDpslCSzwhC2uAFJZfo4X4EigVeJbW98SSAZDduSKNwlavV1HAAKnbWx/IQn3cbaR9Rr4dvQkQ05F/cqd1qTo05V5YwqUt0r54LHgMBRa77mXuEGDAHjV2Qbd3Lm0wcxBGx53efus7hWBPDJKD1BAqcRFCN1L14PR/HHLg7AJ70tYpFqqJDpyI45qTQHu/xAjh8Jj8msKGHo/i0UhsrgQ7KRRAGPjTNpGco6xtwQqSbUnO/9anvFPdTrbNPFk2Rw7lBcuCzXr7Vtqu9RxQK6TASPwIrXAROL8Ugbv5bsG9u6CNkwqgmucmprLuEFFiyVWsR3iSGHn/0g/9iUUANxn9nZ1yNba6RoVmwgqsDdP+cqf8w2g9r3KPR+e2ABQQQojnjZF4+7n2uqNxN9LkB2UcXIyuL0ABKX0R2794Pa9AO0CdkbxG+sbur4Mi57Vl6g7ZElLmMpghuxl28IwMeyjWP0x+SVkqEgmAP+AMz4tTBZ9CzSsWWd3CLqGSg1cuKJNfxredZ9c83zuEea4rILjLktW9RXeHJpK1KXaSJJNiA9oNiearqRQFRRBrOTeJcWd4/8KZtMrrQAC7DY4obNKdJaUrIjMwIE7AU/bt1GpDV4yPaOff5EbxtfI9hCvN+/71TV913NqIgorwgj8BFQJ4TAwYiGzpqedeyz90XuwhEwK9FfuBlzHBEJxHDYhUAlOJi47pOXBDNMb62P3DXoIlCKAQybjvUE3t5uGFsfiMkmOwAbEfft6HyN6m1YFp6XyfUNx55zQD4xjHcsGjG92T0KdSv93OyDtvdeKlYM8cOzg+C/+ycUqueAsXei9qInqsxESArJN6DdqZ96+llt47DhkKOMyZoBMwKunVsvme0+j1QzEzyk370JTLHpyYkpXmT934BT+1T9Wcia6cfjXQ71DFt+uA07KuSNMa47XMQOo8FHGktRbpxB/HaFlnZUSuN1MAO1vkuQDBJc3I+ifCbRM1nSMbrXPaeC/Hz5JoqTZo7DD6yeiB6i++zrJeDvqRZPqlZkUGOwW+/jRB+J44Le7VUfljXJtfOfa7DvCdgJmMpCgGeIaaTr0vYN8AsjjPBH/vaIj3aj337bcX6vB8HGRj/ifzCTSAewJwOrA5ZKrQ8yxyrDz20IHjSP1tk0+4U2ddYI+YXocWw39kYQkq/uNjQFDupFstM0WtgQdY4h8wCQxVsbMhLaWjCDk8BXqfTzs9ZmLdZHoc9wC0VmqHPI9+CuvAhs3ibRMNU3qchIDQz+Jex60wuxbFwb17jXaLbfp5XDlNe8C5MV3L1StkzS49Ut1dP64xWgFskl8TEfg8RLDQy5KtGaruEDLMesaUeap0LUK1D4nrxLMtUiTXa/L8yqcnWjCbkwxyl/+gf54zHnsfaAUJ4w6IohtYEQsWSz5wuxBaal0ut17SSnN0hys/zz7A8XMOY6rpP6z3LEUyc32CFu265OTEzqrDa8PyF67Kut0hUMX7DcV/zJL8VkNwiAXLQeE25uqDIBskinJ2agQqCMEz//TL7nHdBUbCAyj2hUMTnc6E= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e498b74c-d84b-4b41-8465-08dbb4b2dc94 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 23:40:50.2184 (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: xQzkktqRU5b8TWUOocEqIm5NN9++PaBLrCuTuLzEDGBbotG2tnSt2tFmX8ThWdJZckCbR5PZjWb2OK2WJKI+6ucyKrkeUsueATI9K/qxUdO9f4Sagi4K3l2/J2L5mOiw X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB7258 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_164102_162770_4FB8FF31 X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes since v6: * Rebased on top of Besar's updated patch [PATCH v6] perf: arm_cspmu: Separate Arm and vendor module https://lore.kernel.org/all/20230821231608.50911-1-bwicaksono@nvidia.com/ * Changed Ampere specific module to use ida/ida_alloc() instead of idr/idr_alloc() Changes since v5: * Implemented the needed parts for vendor registration API * Rebased on top of Besar's patch [PATCH v5] perf: arm_cspmu: Separate Arm and vendor module https://lore.kernel.org/all/20230705104745.52255-1-bwicaksono@nvidia.com/ * v5: https://lore.kernel.org/all/20230714010141.824226-1-ilkka@os.amperecomputing.com/ Changes since v4: * "Support implementation specific filters" patch: - Added comment about filter and impdef registers and reference to the Coresight PMU specification to the commit message * "Add support for Ampere SoC PMU" patch: - Fixed the documentation and added more comments - Changed the incrementing PMU index number to idr_alloc() (Needs a impdef release hook patch to release unused index) - Fixed style in init_ops() to more reasonable - Moved bank parameter to config1 Changes since v3: * use_64b_counter_reg => has_atomic_dword (patch 1/4) * Removed the unnecessary hook for group validation (patch 3/4) * Added group config validation to ampere_cspmu_validate_event() (patch 4/4) * Rebased the patchset Changes since v2: * Changed to use supports_64bits_atomics() and replaced the split writes with lo_hi_writeq() * Added implementation specific group validation to patch 3 * Dropped shared interrupt patch * Removed unnecessary filter_enable parameter from ampere module * Added group validation to ampere module Changes since v1: * Rather than creating a completely new driver, implemented as a submodule of Arm CoreSight PMU driver * Fixed shared filter handling Ilkka Koskinen (4): perf: arm_cspmu: Split 64-bit write to 32-bit writes perf: arm_cspmu: Support implementation specific filters perf: arm_cspmu: Support implementation specific validation perf: arm_cspmu: ampere_cspmu: Add support for Ampere SoC PMU .../admin-guide/perf/ampere_cspmu.rst | 29 ++ drivers/perf/arm_cspmu/Kconfig | 10 + drivers/perf/arm_cspmu/Makefile | 2 + drivers/perf/arm_cspmu/ampere_cspmu.c | 271 ++++++++++++++++++ drivers/perf/arm_cspmu/arm_cspmu.c | 33 ++- drivers/perf/arm_cspmu/arm_cspmu.h | 7 + 6 files changed, 346 insertions(+), 6 deletions(-) create mode 100644 Documentation/admin-guide/perf/ampere_cspmu.rst create mode 100644 drivers/perf/arm_cspmu/ampere_cspmu.c