From patchwork Sun Jan 7 23:56:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ji Sheng Teoh X-Patchwork-Id: 13512977 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 14B61C4707B for ; Sun, 7 Jan 2024 23:58:31 +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=bvzl05VI6udQHPsS4UUMZmFJxyJkXC91jimxZ6DoYj8=; b=QBO/2R43TkhHNz KBTs7dWgtwvce3BBQrYXucwgnSfVGYLFVGnd8h5c7UpyiagAKFpsWAmCLKQEIDsdJ78g6UojmUXPb LLY48wWnLpPlMyP/QNzO3DgB9Nf8kilN2JZQjFC6R8UOIMufxevlLG1AaL9lTenTB/QHH2DS2elJE 2Hci5iucHBWdQFI8qBsKNRDKzJsEnzdZ4WG9EwL5OlrpdOI3plypHgi88xsu+g/cYpQ12HRJG79fq qBdlWmf0y8HTQaVBiLMz9RwogCsEQu3+tX2Wp5D8Fk+vhW8puDtLCPrzBt3iczfGlCn8gOLt/1ZOE vMjwWC2Kzwenqmhf7nzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rMd1e-003jMI-0b; Sun, 07 Jan 2024 23:57:54 +0000 Received: from mail-sh0chn02on2062b.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62b] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rMd1a-003jLk-0h for linux-arm-kernel@lists.infradead.org; Sun, 07 Jan 2024 23:57:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jdW86ByBO/wPWADvlmvUYMosSXBZTJf6R4TAKjv+YKUC71RbPeln4mOpKmwEO3ypNKSN+rpLjNWA2qxREqUFB8jCF7LmLLKYNBSChXLlxc+ROBMRzkKEgQzvNqZ4JIEpg6Yos274pwvVG6e4bT6KtKRMCAtp0kw1SrSg5NUt5NiWBxwyKsYNOs2vvzdGoQLrxWeYFJGeKKunxXuAFymPWnyYOsU+kYEgNLd6txSs83i1LFycp+HxZbHfS2J1F/x79IhpUUEdpJRfnFQSOSX0v+WZmfMsv/uhy+npHCd2u/IUrmtsNZeqw1L2CRnOH/G0MuDHvx+/b2dPNqtAXDvyBA== 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=o+vrQFgSoKTZO2A5Rdzo/XRCDPP2BiuuJUSfRaHALPE=; b=mRChNppbO8JFWRJYXOS9FiEJXcdylBAa2DZlez6DB+NiYUIQeRp83iSLUxz6/LXDVAAkb5j3GyBEjuB64P0HEa+tmG+xBKu+yV7TgKRbvs1i+HLAPYoXdhXb/Aby/RNjuDqSFYoZNa8cWc1oE4/N3epBtOKZmbXovLjhoCcWQV3/drgLYQfSExrA9qEYOoMA8ME5SStOPW2OPwNFYmv7xwivugXHog+MxyzmtbtykNzUvI4/LXw9f10tm/iRHotB6LXSjkhnPUwlnElNHgY7JvQtghO5fki9bZD2IFDwE+E0st66FLWsP3oYSJA1Fm8UJ7H+2mKt+FIAQ1B7Pg8ddA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:19::6) by ZQ0PR01MB1032.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21; Sun, 7 Jan 2024 23:57:37 +0000 Received: from ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn ([fe80::1dbb:b090:7d89:4e22]) by ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn ([fe80::1dbb:b090:7d89:4e22%4]) with mapi id 15.20.7135.032; Sun, 7 Jan 2024 23:57:37 +0000 From: Ji Sheng Teoh To: Jonathan Corbet , Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dan Williams , Ilkka Koskinen , Jonathan Cameron , Dave Jiang Cc: Ji Sheng Teoh , Ley Foon Tan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v5 RESEND 0/3] StarFive's StarLink PMU Support Date: Mon, 8 Jan 2024 07:56:54 +0800 Message-ID: <20240107235657.2372910-1-jisheng.teoh@starfivetech.com> X-Mailer: git-send-email 2.43.0 X-ClientProxiedBy: ZQ0PR01CA0015.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:5::9) To ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:19::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ0PR01MB1160:EE_|ZQ0PR01MB1032:EE_ X-MS-Office365-Filtering-Correlation-Id: 0be37f59-d6ad-48d9-b6d3-08dc0fdc6ce8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SjFmBKYbvL96+cLVcihqLlLUsL2yQWF0uupnOMf/gYM1OoINnHUD8uO0ckpZbKUbHgCgBWuummi7+taAQZGJH9A8oMf9Ks3IsD80vJJ2/NgySvEK6Ckme31sKGILBPx3aBosGVXJ4HAijZdEypnvAKtUdsuFGqZ6LM/YTwgoXzJx33aVW6KtXtWgqnZg/7XlK/vilwcR6I8vtQMcHdtkA2cQ6hS75w7ANQlX2Ho0m7egnC82CxMM6pd1ypvQZisVVzRypWBExd6P/vXonDAR+x9hky/hJttMN/9W1+xEFvIVsjPUr+9/3JpNOWvgqSuk9NxOGBFt1VpVALWApK0Kbg5jlfDLW1vE0FbK6bcNKY6Zzh2lH70q+d12sbmPOsm7etsGHNpti5aiZ5lJLgjfwieO2mgB62bBop3wLism8QHn5s3YgfPAUR8Zm5UIWllFy4xtQ7Vz8JW9sTjivBFXrplqtvO41aIBFfr7enWQC9mFcYPJuddIMRWlPY50pZwFCC6mRTCTAhz+D3gBdKuzGcg8urAv7ewhk2K3bryyqzwz1ayTSDAh1Tbndl70S6E/zzIe4D7wnOz1gdnuyX2w7C2DsXHaXPVlXDRz8XjYZHEQ72Noadmdm9+vRZDSNwZ7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(396003)(346002)(39830400003)(230922051799003)(230273577357003)(230173577357003)(1800799012)(451199024)(186009)(64100799003)(36756003)(38100700002)(921011)(38350700005)(86362001)(83380400001)(508600001)(41320700001)(8676002)(4326008)(1076003)(66946007)(66556008)(40180700001)(110136005)(2616005)(26005)(8936002)(40160700002)(54906003)(52116002)(6666004)(66476007)(7416002)(5660300002)(41300700001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2nALaVY4sj4oWb0xg+wu0lBEhGYX2aIkhh8Azc14EhhkML+Sto34AhRza1PEdqm6i75qb3iN15BhAlYi6TvDeQfsIJDfOA7VRzZJz90kqq+wF4Jxyk6olieJ20QhytDmUQ/odtdxZrKtl2x23qBV3p4uvdbM/aITwoMsMQUMcDfx6pzrg5ouj0Rya0KcK+e1ph4z76H7F2Vd5RV45PLPovvRptVKv7xMJAwGVmeT86Z2cKQji/gy7Q9gaPgi2sVfbRNTQx1hJ8N9l/eueQ6KqB+4H90UoG7syQmDDfegIuL5FvKmfbmJu6mlNe1ysN76A5B6IvtcZaX49/kExCHL7Nz9gbAzzv4UN8Lr1C7G5CWiKIquXIsporfc1H36+hBKf4IriGexoirVwMviMSEM49lTGkTotMFTfNNrh02iBR5kYVC4sdMEB8j80ewAH0Apg/HGXz1fS+SUhOqQv1vsdjACWIflH7R4DVy8/1MhCBdr4U+N6tCn1z/4MkG2j3QTzxZ+nKBeTfsKRxOatMnaxMBEf3TCdOPz/3iVz/adOufVqECfQaoHv/EwK9Qh0mwzKvnHuSe6wz4bPmD4eYWUZXHK4BQ5ThUY/7jLNCfTACpP59w2g7NPrjBYjql2aWR0U3hUJQ9lZQTho+POlISSfy2VFmqyhFIsc4+5aoapG4AOe0gQq3Ru8vPiHo1KYPZ/dKhcvAGHisVWidi3bEZ5MA0aptutCEC5DZxvyGxeBLrKVj6P51pPNYTPg0UdBFSZCCW5NJ3wS0VOjZLEwCdMbaNQWkJ25aQ7ympGKvps40d20+JHzYv8YxBDi7ugVrrbT/1GJJD1/tZOYZ9ng31AVP3onbgnGRRb1ejG9/4I5mvqA2Uj5CpSp2FX2HauCP+N06U6qtMbUxSdpuUTAGAxY5PR8h5xJRFBhhXnvj347KISEdLEjeDb4lZkz+cv74X7vGO56oaq7ic7UvXgKKJ5gz1A233LPF+eX7z802OjJgnBIE/D/uTu7E0nLAD1GlfQqHEj6NTePNkZHGJQ+5ET0P5oac0Nc0oHAbFeQVNZspZfcfWmRQStwNdIgrzdU8oysRvaWAVxosNBi0qxj2I3cEjCkQCiDUTTNJWhSIGvMi5bbUbpoNvp3wLazZJJjhHm0/lLKK5/TeG1nvXAl1bNDmL9NL8v9xV1xAdwvzE6piHW9ep56gjrmWUNplMqkuxmtWhy4r7jnbU0mkM5l667LjJCDroJUe3y6pps3uhUD3ymIxPftemJ0KFMrTZEZ0YPey7TPOK/rFs/Hze/liOthYWPOHxJbhklKxtcVQ51BQGEmUO67fp7wfmSaIbC3xIftDxCtZuaKMefNe0CNdWkKYVTQdiBb0DQbZJE5jmKdQRcrSyN1xphK40lg1gwpFP9WO1GkloyJatfIp3x4dQHPT8wNjFXcAxNTdyptHXR1Dy+nymnuZBqzfjlz+XAcVa2CnTPwq/ZKXrCiGoKkgGQ9+Je0POA7KpKIEaz6vQp+baw1RLDQXKTZCluZ71+oS9MiX70a3XWrkpTRqBkB9IYywP8M0DnAWBTxzjaNKzoGlTPHcV2+pWrtIzHB4MmpR0mIRam+s5P+ncHXVxX6+aE9A== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0be37f59-d6ad-48d9-b6d3-08dc0fdc6ce8 X-MS-Exchange-CrossTenant-AuthSource: ZQ0PR01MB1160.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2024 23:57:37.6310 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PHxguTKNS9tbAsP20eYpMscySQRTlJU9x0O0FDZawZx4D+e9KWvDEtP08LSEuQLgBelezkvKyNx7bZjeEv+nno8nven3KutdFwC6TTxx1Is= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ0PR01MB1032 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240107_155750_281755_BF3AF92B X-CRM114-Status: GOOD ( 12.27 ) 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: - Add Reviewed-by tag from Conor to dt-bindings. - Add Documentation/admin-guide/perf/starfive_starlink_pmu.rst. - Rework starfive_starlink_pmu.c based on Jonathan's comment. Changes since v3: - Change dt-bindings filename along with the compatible field to "starfive,jh8100-starlink-pmu" with SOC specific naming convention. - Drop unused label defined in examples section in dt-bindings. - Update compatible field in starfive_starlink_pmu.c to the aforementioned. Changes since v2: - Change compatible field from generic "starfive,starlink-pmu" to "starfive,starlink-500-pmu" with specific IP versioning in bindings and driver. - Fix warning '-Wmissing-prototypes' reported by kernel test robot, by appending static to starlink_pmu_set_event_period() in starfive_starlink_pmu.c. Changes since v1: - Change 'depends on SOC_STARFIVE' to 'depends on ARCH_STARFIVE' in Kconfig ---- This patch series adds support for StarFive's Starlink Performance Monitor Unit(PMU). StarFive's StarLink PMU integrates one or more CPU cores with a shared L3 memory system. The PMU supports overflow interrupt, up to 16 programmable 64bit event counters, and an independent 64bit cycle counter. StarLink PMU is accessed via MMIO. Example Perf stat output: [root@user]# perf stat -a -e /starfive_starlink_pmu/cycles/ \ -e /starfive_starlink_pmu/read_miss/ \ -e /starfive_starlink_pmu/read_hit/ \ -e /starfive_starlink_pmu/release_request/ \ -e /starfive_starlink_pmu/write_hit/ \ -e /starfive_starlink_pmu/write_miss/ \ -e /starfive_starlink_pmu/write_request/ \ -e /starfive_starlink_pmu/writeback/ \ -e /starfive_starlink_pmu/read_request/ \ -- openssl speed rsa2048 Doing 2048 bits private rsa's for 10s: 5 2048 bits private RSA's in 2.84s Doing 2048 bits public rsa's for 10s: 169 2048 bits public RSA's in 2.42s version: 3.0.11 built on: Tue Sep 19 13:02:31 2023 UTC options: bn(64,64) CPUINFO: N/A sign verify sign/s verify/s rsa 2048 bits 0.568000s 0.014320s 1.8 69.8 ///////// Performance counter stats for 'system wide': 649991998 starfive_starlink_pmu/cycles/ 1009690 starfive_starlink_pmu/read_miss/ 1079750 starfive_starlink_pmu/read_hit/ 2089405 starfive_starlink_pmu/release_request/ 129 starfive_starlink_pmu/write_hit/ 70 starfive_starlink_pmu/write_miss/ 194 starfive_starlink_pmu/write_request/ 150080 starfive_starlink_pmu/writeback/ 2089423 starfive_starlink_pmu/read_request/ 27.062755678 seconds time elapsed Ji Sheng Teoh (3): perf: starfive: Add StarLink PMU support dt-bindings: perf: starfive: Add JH8100 StarLink PMU docs: perf: Add description for StarFive's StarLink PMU Documentation/admin-guide/perf/index.rst | 1 + .../perf/starfive_starlink_pmu.rst | 46 ++ .../perf/starfive,jh8100-starlink-pmu.yaml | 46 ++ drivers/perf/Kconfig | 9 + drivers/perf/Makefile | 1 + drivers/perf/starfive_starlink_pmu.c | 643 ++++++++++++++++++ 6 files changed, 746 insertions(+) create mode 100644 Documentation/admin-guide/perf/starfive_starlink_pmu.rst create mode 100644 Documentation/devicetree/bindings/perf/starfive,jh8100-starlink-pmu.yaml create mode 100644 drivers/perf/starfive_starlink_pmu.c