From patchwork Fri Jul 14 01:01: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: 13312813 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 21BF8C001DF for ; Fri, 14 Jul 2023 01:02:56 +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=adRB3jSQbeAJWC3tXbQ7IDAD43KbltV81KQpfW9Pr28=; b=MR29UOzUM0n2Cv AEA4RmgWPwAZFtc96E+Sphgt7slR+otOumWLMjDoJuIXmKlXPMjONXbd8bFCajKerMAEvj2+20wbq Ct7qzuPxLgqNvarlwyJ9UPsMzeGZzYGyZOMEFj9BipiojtsjS/mzNwVEqN2xK9NakCDU05Qz9mzeR cqryHNcZ8D8kSamIz/1wN1ALccBNQwF4W2KvSPWaHavxYV0mYkSaN1Y8cBufPsRoTpWorqfeYBC89 nrQz8hGM3VfBedYdLsLvKg+RjswwwKzEGfcIp7DE6QVKJV7RuVlX6NJrG0PAjimHOnP5FMwyGKy51 tiEE4PeRBrkzkhdnWidg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qK7CU-004fo2-0G; Fri, 14 Jul 2023 01:02:26 +0000 Received: from mail-dm6nam10on2070e.outbound.protection.outlook.com ([2a01:111:f400:7e88::70e] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qK7CQ-004fnP-2q for linux-arm-kernel@lists.infradead.org; Fri, 14 Jul 2023 01:02:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JOIJ2yJRoq6vd8QYQG9/NpWlkH6f6SkhGuqRS5USiR++pTC5X4Mb9ub7D3jvtqxWhQY0BbRBl4KB+CpkVjJPgkNFpxf1mhAWlIirgnQpyDUZkAbqmiFAk/5N2S5RYrRjiEAx6DXoZ/GjFCdjJYbKePRPgVfw0a+CRROMYXLXA0yIgMEB2JGbBz+th2fTtYLMsMOE7nuLybqiGGKP1AMdO0YlJoqmtItS3Pw5RpdZzeGDMqcvc3Mb9iC7e8pywDscSYF5d2URmdbheThzy6h2Mnmj/STCsiJSgGnHPrH0uw4YTAyrHm+lDu+bKU4l3WLAFE00ZwVM5/IWRR5oVXJKaA== 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=t7xHvM/kA4l9rUNrVhBg9XsMqEcNUDOakWs0wrg+nPg=; b=gYMrqJhtWx7vjIXKc2n09XwMmLS3dNOTfdC+SJv9rrHbSL5cn6cs5fwGe2TLRTnTBzEFit6mmDaDgXXob2/x/dNeFYGzaH1daCm3vnrfMk1sKn0Zvb461iY4UMrt+SSy6Z1p6jgJEYhJh6ZqCv9nq+j+A1K4456Vj1bPQnNCByXXEunKv4LxzRnK4LAjUdg4VFctCDvKOv4/EQNmNdO0MgZSvkCoBxrNo36n5brB0A8e2EvFonpQZOcRWnbR6OCwNd0bws3ipIwSu1mCLlUYXZlogI6xcyT7oNj3YA/JmC89eXmSd+Qsm9r46jSt6uhy+udiC4ys2Z/ztyInAUiiJQ== 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=t7xHvM/kA4l9rUNrVhBg9XsMqEcNUDOakWs0wrg+nPg=; b=CTeQ1aG9I8IRH2APo/vfiiOG8zG7SJBAI10ZcF7S3neQ/b/j7QUf2lkJ1LIfNTx6kPV4/hV9HateOSMH7+/Aw+CHXpnaWRU7Yw6btkl4cqkicOg4NLYe1/XHkqrZkhfFDIR9kczMUvrCF8b9WVus+hdSxaTqOmSgFiNJ2ynypQw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) by BY3PR01MB6611.prod.exchangelabs.com (2603:10b6:a03:36a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.27; Fri, 14 Jul 2023 01:02:08 +0000 Received: from DM5PR0102MB3590.prod.exchangelabs.com ([fe80::235a:622:9239:3963]) by DM5PR0102MB3590.prod.exchangelabs.com ([fe80::235a:622:9239:3963%7]) with mapi id 15.20.6588.017; Fri, 14 Jul 2023 01:02:08 +0000 From: Ilkka Koskinen To: Will Deacon , Robin Murphy , Besar Wicaksono , Jonathan Cameron , Suzuki K Poulose , Mark Rutland , Jonathan Corbet Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v5 0/4] perf: ampere: Add support for Ampere SoC PMUs Date: Thu, 13 Jul 2023 18:01:37 -0700 Message-Id: <20230714010141.824226-1-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: CH0P223CA0013.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::30) To DM5PR0102MB3590.prod.exchangelabs.com (2603:10b6:4:a4::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0102MB3590:EE_|BY3PR01MB6611:EE_ X-MS-Office365-Filtering-Correlation-Id: e513d80a-87d7-4697-510c-08db8405f284 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kOdoI20KWQbLL/ZZQf08H/fTIeR1Zpyz0mi9K9HnOfob4qowXaEo3PwarwIRI0VLAAgu6/SxxOzv4atJrzNTXebBdagp34cNIekQMEobKzT22fviOYevFTtj/BgekzO7xKAfSXtWcx622KUHtDFQG9UjAK8MFwjdCt6KEKJGj3O8JelRKvutyx10OmHbsF3iQ0dY9iBpoXSfOEn/5MOgkPjhIObvkbjJujrHvms9tEzF0CeRhbeysgZsP+sLqby12azXWp6FczTVxDu0ZvusQs35qa95gAVEJHoKYhPET7zfwB8WBLGmDQfrcoib9L4cQfYgJh1E48NCKCfg7/rlYfNeutmp2nC1DhjpVtQD+b4uOskefkueQ5NsPzmIvOkw6nc507LxAeiK3sk6CUedAKy6t9r5Zge3++yOl6XzM2JX9mUPpBtgBkQYEXVdE6RkgpRNMUGyWCRkrEXSADmtg5ZsEMw+YIqH1cO7XyJAuxHE+0DmOIIk/F/souguSXF7eiB/RfcKBFVtYFLEKzXd+Ft7Y/eQV7ISUuRYjlS9GCMxWdYWLBr4yemRq7V9MhhYSZImkEGhFJumPzpOXMGBmimltkeGeDyAbtZngTgPgdGCjWt6FMmxkHbnMM44eNvW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0102MB3590.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(346002)(136003)(39850400004)(376002)(451199021)(2906002)(38100700002)(38350700002)(6512007)(83380400001)(186003)(2616005)(26005)(1076003)(86362001)(6506007)(5660300002)(8676002)(8936002)(7416002)(110136005)(478600001)(6486002)(52116002)(6666004)(41300700001)(66946007)(66556008)(66476007)(316002)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Jnw15+n75xoLosSPJdD+yHVvDIQTO8rfOc3bqn/eNlxJC3zGlYg0FNChb6iUtpAz61R5sU/yFnZrUydKx8KL6YTmdJp8wHEjp0i4fsfmgo1pBSFovwi8rN7FFd9/uoKAht3iwfhAMrwez6G6MUaFec0ZG7hVTv353e9I5F0BqExj2AG6IY/3zLuYBqN0MEaHuizuLl3zBWxUIxBV9OrZ9ES04VWklhR2V6KPyQkXa+YzQm0vT5GITaDr0m5VjFAiulWMKlM9/mgQZR/77VlyQSwGr/6JPA/5uHyUYNap0R1Gg1y98+XhqcqTlQs3tnHr6Isb96BPvfU2d/jtXPaoPZQbPfIlZLOFBM1slStKa4TXOKwiEMYIIyQOVMd0C6PMvoYnDw654zNmqtasYCgX9CK5lok9pcgbDK59YKXY6tuMkhBHufHSo7ql33hy6cdgJl/pCs77oCpkJ0MxgzL3eC0wxyMcYANAAjkUFc8GwmuKOeReVCVk0mFiXsqJSJ/myPLiIe58OUv7/5aHObDjIl7NJxCNAZKc94f/U60z/3cdm6M9kQcRKO0SPLF7IcOzgM6mJpRcm+4EqhP7I83WUrsn7KRZY9mA1vmzrbNyQ2oy1Bwb3UIc+KLZSuErHsR8iePEYgwsaUPla73HLfVG6rHDuXB/Fdf3+ikMqJmlp8JdmOgYn0fuwFIh1alQWclJyzAX7AcUOmdniynkp4OQXBJSV1pUwt1wlcytgiv9XTiFwZYL34kQlvWITsiXYcEIzEVAJSORVDTtTm/v4zUwX0WYwpUqOCZJC+KEHKV/vBe2Qrwmtous7m41UkyUK1qY0ZJ2pzdxaZTFfl+eZXRwyf8CHlTtV7xEcrgRNuWg/Rz58m9BP0DFN6rSxyC8daDIU7cIuJ4OJ7PXAcM8g46oQSgbUXFv6F8w5Q33gEa+58qHLpD6QeKyD6RYf/l8YFEIZ310FyTZllXTtCnl2TR3vrAr4pzVlkToRRWGNvGH0rpsL2ESiz78041x4sdgx1BJL2ReSZ78hF0RAJS7lUW7xL/ylJShdpV+5k3SpkqmU5ej85+rnfKCUIc4ujkhi/6UkESrda93K3BdTm0J4scv5jSClM/jt8eVYH9ssSGZ+WdZ7STp69my0C4PkBc2HYTHIKiNgrBq9pkAHOVufnj+XQ3QiIaNEGeSD8p1bP/zNMsb17hiMBuxXGjrRaCXAjIf5VdyahN1+FR8RY8WG4ytRZp7FSBTAR1ROY583n6+lutNckS4bpORSywzQMikwXZ4qmCcsmb4liQbgde7lhQaaQO4JF8y1b+JvhK8lPSMQSj31eAOcH5D4iKKBT5hgGc73HqIjmhB1XsyN5KmAYLgI93vaiTc20tS5f7cKPTALvOBXKdqTx8NZ0HE1IVdt2f6cRyZ1D/oCIo3JvugvypqUbdOu89CmXsSFR0tpnfWF3iPWw0jdhmchW/vNX3XoOthcbBJesAPU0yZWjbP9/ovfk8TEn3LyR5H/CNrbMRdudlsVKEPrzg2pTEYigHoqh40BY8Qij7l2tUUd3GXRqrsOaUhvpTxu31wysZoLMbH2Xb5qIiby65/zy9A/Qm+tQEfcCtLcaOeVkgYdsG4CJfNCQ== X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e513d80a-87d7-4697-510c-08db8405f284 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0102MB3590.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2023 01:02:08.4384 (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: VvL3LwkUaI9lwSnrkLRPtupK6ENLV7Z3/cCEFB0+b1LslIpsAeDbxPGN+DGRJHZDQd2914bc7V0c+74ayJmPKM+9kXKUu0aselbsIuzT774G9NsL2IEUHFc8u3SWS14R X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR01MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230713_180222_965441_9A393FE3 X-CRM114-Status: UNSURE ( 9.77 ) X-CRM114-Notice: Please train this message. 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 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/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 | 29 ++- drivers/perf/arm_cspmu/arm_cspmu.h | 6 + 6 files changed, 321 insertions(+), 5 deletions(-) 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