From patchwork Sun Aug 27 06:45:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13366847 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 AE2CEC83F01 for ; Sun, 27 Aug 2023 06:45:09 +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=NoT818hGGwBJoKDx7KEpbh/0UCKtCLf6j7fHC/26ORg=; b=0IxD13xLn4/9qE fjo88wLZRU7MXyWI9SKgyKNDKVU8Fkr1S2c+lmW9Grnkpy5o6nnWDnDXuP4IG5D4arsZHWLp+nvT2 k/+7z8rrm9/7R7ns8P3FJrcLl1wnxKg0ErM61+77xwt3JIQf1H5hYIZiN/nfTONEqRQfCXTfNy7Wx LPO9iHKo4P8FDNnsVzyXcF3kiJpDxechR9H1TDELmrRfd87EA0yTj83NmL+kvIsBijwh25qpdAmaF FGN5+Vghpwufb67pfqyMyFw02BN18cOFiqcWvArE2WXaRXO55VA38la8hyxhjNKY4DQImpwIH0yF+ MtOQr1D4K7Lw6LYdZ9EA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qa9Vk-007Zko-1m; Sun, 27 Aug 2023 06:44:36 +0000 Received: from mail-bn8nam12acsn20809.outbound.protection.outlook.com ([2a01:111:f400:fe5b::809] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qa9Vh-007Zjn-1M; Sun, 27 Aug 2023 06:44:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wd7e605dm7MVBf9tRxwRnkkt73E6gFvFGKYoRr+VkQchUCXNFzFmVr3GuzIfsoZtt/jSEFbt0sglGB2I4R1FrmabUyO8W1w3l/y02HingipnOpJFzAH6W+j5XSrgX2j8QFdk7WdcR2SzuZ5qDluIkwX5NywyXEsi91eOunLmbjI+yDwHFpuaUZnrv/+BX7jo8SXuEHEqvFxP7xNJ2wb+2xblIHjVWda4C6o5YpkNeZbu7SQeKnyqM6X0itDkPAAP5uTzmtXau8bIIWB70plZ3CW3nI3j+l07C8VltVcSkzWUwqF4TZm/9BZdXxbfrT9FIz6ZUVLxZA4jyXLBDQFT4A== 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=1/nd6LL+gkb8O7N4oR/KO+bRTvndC6Qs0ftYAJUeqd0=; b=EtAtp8slAk8Dg0p0matpWlBKVnkS4V6ZaNBrsWin7tTK9wLRCmWKUto1h+5kq0gu8CE3oSbqQJIoAoRDH9XHydceR5CruXU9RN8KaVPxq6ebqqIQ/uAsvV0RxDXTlqmi3hp69ASIR3NrhGvK+uxECvjB0zFUT5d74HN1KkLm8WnZMHhHBKF3HftKIA7a1FU5ct7sr0nuEROFWKYxIUU2AIb4yMJskgCkKL8auzwyGyYPa22RAgl7b/nsjwDM8iy4Lqy2xIzt22lx28VaWpjW2+zLb9hfRGhM2HyogmN4Ladn/2gYULKYisScR0n2gQ0Udq0+YuQTiHCvtd0CKh0yNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1/nd6LL+gkb8O7N4oR/KO+bRTvndC6Qs0ftYAJUeqd0=; b=EeJ//cjVzC0Q4SmmW7Uno95vcEMxvC46sCJmv07mhAs3gLa+WY69gFzF+a5PYqNs4V+I7Y4VD5rfFUzQ44+3G+Sfl2C0L/+l5eNsQmvNcdscYqlcmPhWyaptqYNXrxF2piSPFPbLxQQ3YZdMGx+qMlXFKPPGJ4uG5LW/orVVaqom0O2673d2INfZUynEPfbSs0IhadJvc2e6yoaS2HsOMsPaHTCP6inKtdwS4c4ArCZHeGGRxu1NN8b2pvzyi5lIGNnYT0QduWuBvq0000gchyOGm+/T0n18BDqM8LPhRZA6q5re8PeZH77LWbYhw1R5w0thbAm5wcMNN3zAUQHHOQ== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS0PR20MB5757.namprd20.prod.outlook.com (2603:10b6:8:136::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Sun, 27 Aug 2023 06:44:19 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::cbad:4566:1f3e:4e1f]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::cbad:4566:1f3e:4e1f%4]) with mapi id 15.20.6699.034; Sun, 27 Aug 2023 06:44:19 +0000 From: Inochi Amaoto To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Inochi Amaoto , Heiko Stuebner , Wei Fu , Pei Chen , Wenhan Chen , Guo Ren Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] riscv: dts: allwinner: d1: Add PMU event node Date: Sun, 27 Aug 2023 14:45:01 +0800 Message-ID: X-Mailer: git-send-email 2.42.0 X-TMN: [eG0EICRNxrDhs226+QL68iyFWVEBi3em0O6KXS/w6p8=] X-ClientProxiedBy: TYAPR01CA0019.jpnprd01.prod.outlook.com (2603:1096:404::31) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20230827064501.392205-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS0PR20MB5757:EE_ X-MS-Office365-Filtering-Correlation-Id: 38bbe6e6-88e3-4ec8-ee1e-08dba6c909c6 X-MS-Exchange-SLBlob-MailProps: cn60g5V53KNKBQSRra15jT4jAkk0OqZJ1BeJTn3sqKn7TtKOvZ/DsauzV2I3NaGLTdkcckoThhvU8zSAaAR8bmriPfM3+Zj9aIYyTDgUIksUgNocMqi741hmn05F49P3nNiCO9rN/McT8ot4L6YAiy2VqM7WpCUDc91TojAL4krzVIjrxOe0m7EfP9FbsE01GiO3jJJoccdADXpBNm1xK98OsfPdbs7EWWEhi7sbf7nk7Ru+DU2ecp5IMlxUfZTC0kNr4bnBh/HFCyKoPHyrycz6LScpZYL2am7KqSLuhvzH1sMLwDKfaO98aUDFB5jHu8NON+On8O5rPsHBfkwN0Lc2uRMNOF6QyjMP2OX+yGK45lvKcQjwjIb4d5qsOVigWQKI0VrCW8lxS5mWBCraCsDIsyCIwlTpJ9guepJJ5LfGRVCCZZsPZq+y4z2puBE8SRA51PdCczukm7TbLHJ/MRCWRsoXtIni2uvh8Sw9az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LVIGk34d+aRb8UUVC29l9rSFmPSfAG7u4J3m5khvr/Q7471zTVrfyOx8s8339d+Vv1RePat8XN2Y5zzABAcfw67bdDjgADPB1kVEF1UxLZkPHimrWUbFx1EYY4eRbVIC9QYvhUrPHJwm98rtu3jT7O8o/T1IHFlif6vRFokVK8q9WIR2pLHvfFARzpUoHOjnjLYro5CL9RUCFsU= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38bbe6e6-88e3-4ec8-ee1e-08dba6c909c6 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2023 06:44:19.1476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR20MB5757 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230826_234433_478925_D62FF80E X-CRM114-Status: UNSURE ( 9.20 ) 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 D1 has several pmu events supported by opensbi. These events can be used by perf for profiling. Signed-off-by: Inochi Amaoto Link: https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf Acked-by: Conor Dooley --- changed from v2: 1. move pmu node from /soc to / to avoid warnings when cheching. The meaning of T-HEAD events can be found in this pending patch: https://lore.kernel.org/linux-perf-users/IA1PR20MB4953DD82D0116EC291C21777BBE2A@IA1PR20MB4953.namprd20.prod.outlook.com The patch above also provides a example that shows how to setup environment and use perf with T-HEAD events. --- arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.42.0 diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi index 8275630af977..ed981af63b55 100644 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi @@ -73,4 +73,44 @@ plic: interrupt-controller@10000000 { #interrupt-cells = <2>; }; }; + + pmu { + compatible = "riscv,pmu"; + riscv,event-to-mhpmcounters = + <0x00003 0x00003 0x00000008>, + <0x00004 0x00004 0x00000010>, + <0x00005 0x00005 0x00000200>, + <0x00006 0x00006 0x00000100>, + <0x10000 0x10000 0x00004000>, + <0x10001 0x10001 0x00008000>, + <0x10002 0x10002 0x00010000>, + <0x10003 0x10003 0x00020000>, + <0x10019 0x10019 0x00000040>, + <0x10021 0x10021 0x00000020>; + riscv,event-to-mhpmevent = + <0x00003 0x00000000 0x00000001>, + <0x00004 0x00000000 0x00000002>, + <0x00005 0x00000000 0x00000007>, + <0x00006 0x00000000 0x00000006>, + <0x0000a 0x00000000 0x0000000b>, + <0x10000 0x00000000 0x0000000c>, + <0x10001 0x00000000 0x0000000d>, + <0x10002 0x00000000 0x0000000e>, + <0x10003 0x00000000 0x0000000f>, + <0x10019 0x00000000 0x00000004>, + <0x10021 0x00000000 0x00000003>; + riscv,raw-event-to-mhpmcounters = + <0x00000000 0x00000001 0xffffffff 0xffffffff 0x00000008>, + <0x00000000 0x00000002 0xffffffff 0xffffffff 0x00000010>, + <0x00000000 0x00000003 0xffffffff 0xffffffff 0x00000020>, + <0x00000000 0x00000004 0xffffffff 0xffffffff 0x00000040>, + <0x00000000 0x00000005 0xffffffff 0xffffffff 0x00000080>, + <0x00000000 0x00000006 0xffffffff 0xffffffff 0x00000100>, + <0x00000000 0x00000007 0xffffffff 0xffffffff 0x00000200>, + <0x00000000 0x0000000b 0xffffffff 0xffffffff 0x00002000>, + <0x00000000 0x0000000c 0xffffffff 0xffffffff 0x00004000>, + <0x00000000 0x0000000d 0xffffffff 0xffffffff 0x00008000>, + <0x00000000 0x0000000e 0xffffffff 0xffffffff 0x00010000>, + <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>; + }; };