From patchwork Thu Nov 30 12:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-Chien Peter Lin X-Patchwork-Id: 1870106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=sbLVD5k8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SgwpJ0Fdlz1ySd for ; Thu, 30 Nov 2023 23:43:03 +1100 (AEDT) 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=7UoPwkoWcFPxnWAvqAvHkT7d2sYAI2YzK3Og8oj7BZY=; b=sbLVD5k8VGdfpp Hlmx8VB+zgV0Ta55H7dLRd+g3i2T+C8XaDWvw00Uffv3NtIRQCZys2wkpKhVLNgIGW6djgJf/z79q lcSx/BV+Ja+W69N5k1giPJtklQcuMPqeXUQ6Hjyv768KXk39EZGpIg7rb4nPohfVVcP/TGtXisaQL D8cLpW32awiHNE/rcoo9gIO87NoxPFpmD4dqDk07pvzGkvpWpPgg1X41sTt7bb5NU7zgAKeFxQAx6 ltwny7hwFA08MLUCKI5Ai2MGdqhYf+fcpr1JR6piYgQorBchYQK07UbU6qrB9ib0RYr4oUahKxinm sgN5Nb3N/DDtwSlVnX5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8gNV-00AtBt-06; Thu, 30 Nov 2023 12:42:49 +0000 Received: from 60-248-80-70.hinet-ip.hinet.net ([60.248.80.70] helo=Atcsqr.andestech.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8gNQ-00At9d-1L for opensbi@lists.infradead.org; Thu, 30 Nov 2023 12:42:47 +0000 Received: from mail.andestech.com (ATCPCS16.andestech.com [10.0.1.222]) by Atcsqr.andestech.com with ESMTP id 3AUCgNj3055887; Thu, 30 Nov 2023 20:42:23 +0800 (+08) (envelope-from peterlin@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.498.0; Thu, 30 Nov 2023 20:42:22 +0800 From: Yu Chien Peter Lin To: CC: , , , , , , , , , Yu Chien Peter Lin Subject: [PATCH v4 00/15] Add Andes PMU extension support Date: Thu, 30 Nov 2023 20:41:58 +0800 Message-ID: <20231130124213.2590640-1-peterlin@andestech.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.0.15.183] X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 3AUCgNj3055887 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231130_044245_159735_D937333C X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This patch series enables perf tool to utilize Andes PMU extension via PMU SBI calls, provides PMU device callbacks to achieve event sampling and mode filtering. The last patch provides a PMU node example used on AX45MP cores. Content analysis details: (0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_IP Message was received from an IP address -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch series enables perf tool to utilize Andes PMU extension via PMU SBI calls, provides PMU device callbacks to achieve event sampling and mode filtering. The last patch provides a PMU node example used on AX45MP cores. The OpenSBI and Linux patches can be found on Andes Technology GitHub - https://github.com/andestech/opensbi/commits/andes-pmu-support-v4 - https://github.com/andestech/linux/commits/andes-pmu-support-v4 For more details about Andes PMU extension, see Counter Related Registers in the AX45MP datasheet: http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf Leo Yu-Chi Liang (1): lib: ipi: Adjust Andes PLICSW to single-bit-per-hart scheme Yu Chien Peter Lin (14): sbi: sbi_pmu: Improve sbi_pmu_init() error handling lib: sbi: Add XAndesPMU in hart extensions sbi: sbi_pmu: Add hw_counter_filter_mode() to pmu device platform: include: andes45: Add PMU related CSR defines platform: generic: Introduce pmu_init() platform override platform: andes: Add Andes custom PMU support platform: andes: Enable Andes PMU for AE350 platform: rzfive: Enable Andes PMU for RZ/Five lib: utils: fdt_fixup: Allow preserving PMU properties platform: andes: Factor out is_andes() helper lib: utils: fdt_pmu: Make the fdt_pmu_evt_select table global variable lib: utils: fdt_pmu: Do not iterate over the fdt_pmu_evt_select table platform: andes: Add Andes default PMU mapping support docs: pmu: Add Andes PMU node example docs/pmu_support.md | 82 ++++ include/sbi/sbi_ecall_interface.h | 5 + include/sbi/sbi_hart.h | 2 + include/sbi/sbi_pmu.h | 6 + include/sbi_utils/fdt/fdt_helper.h | 17 + include/sbi_utils/fdt/fdt_pmu.h | 6 + include/sbi_utils/ipi/andes_plicsw.h | 23 +- lib/sbi/sbi_hart.c | 3 + lib/sbi/sbi_pmu.c | 26 +- lib/utils/fdt/Kconfig | 7 + lib/utils/fdt/fdt_fixup.c | 3 + lib/utils/fdt/fdt_pmu.c | 17 +- lib/utils/ipi/andes_plicsw.c | 104 ++--- platform/generic/Kconfig | 4 + platform/generic/andes/Kconfig | 15 + platform/generic/andes/ae350.c | 19 +- platform/generic/andes/andes_hpm.c | 405 +++++++++++++++++++ platform/generic/andes/andes_pmu.c | 105 +++++ platform/generic/andes/objects.mk | 2 + platform/generic/include/andes/andes45.h | 32 ++ platform/generic/include/andes/andes_hpm.h | 81 ++++ platform/generic/include/andes/andes_pmu.h | 34 ++ platform/generic/include/platform_override.h | 1 + platform/generic/platform.c | 14 +- platform/generic/renesas/rzfive/rzfive.c | 5 +- 25 files changed, 908 insertions(+), 110 deletions(-) create mode 100644 platform/generic/andes/andes_hpm.c create mode 100644 platform/generic/andes/andes_pmu.c create mode 100644 platform/generic/include/andes/andes_hpm.h create mode 100644 platform/generic/include/andes/andes_pmu.h