From patchwork Mon Jul 4 10:22:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12905067 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 D7D98C433EF for ; Mon, 4 Jul 2022 10:53:53 +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=8KJ6kJfmw7zX7Faf8EVKwTaxIJeZiZ6On8KWKMEvI0A=; b=c9WzM5dgWC0PL6 9JvMZ0OR2b3m5e2zXjBCk3NK+hf+qGuJ7nOmoNcyZeBryKGp5IXG2GceoK/7h2P2xr0hibarrtQKu uM+GjWR27Fkt45m+v7GMLDFogMy16KejkjpxvetY2XMfQckKa1grLB5fJscRzR1X8oKuIWfNYq7u4 IiCbwLuIwVMYRvIhiSzH6pWDCeo+8646FvAEpSoaoISkDSclm+KErvsQrQ9R6eN9Vt8Hiv1CrAsBb 0NGJhJwnrOZKeepl6EW3mKCugL9rdMMDNye/GwNLGubAR8DrtTkH+vpLqaesMnVewED0Q22iV8/0/ h9C6eXYApv08qAEa7OsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8Jh5-007Gzn-9e; Mon, 04 Jul 2022 10:52:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8JEO-006wLg-BL for linux-arm-kernel@lists.infradead.org; Mon, 04 Jul 2022 10:23:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33CF923A; Mon, 4 Jul 2022 03:23:03 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 00A793F792; Mon, 4 Jul 2022 03:23:00 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, tarek.el-sherbiny@arm.com, adrian.slatineanu@arm.com, souvik.chakravarty@arm.com, wleavitt@marvell.com, wbartczak@marvell.com, Cristian Marussi Subject: [PATCH v4 0/7] SCMIv3.1 Powercap protocol and driver Date: Mon, 4 Jul 2022 11:22:34 +0100 Message-Id: <20220704102241.2988447-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_032304_578061_979E2F36 X-CRM114-Status: GOOD ( 14.21 ) 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 Hi all, this short series introduces the last missing bit of SCMIv3.1, Powercap protocol. Along the series, there is a small refactoring around the SCMI FastChannels handling routines so as to reuse as much as possible the pre-existent (and tested) FastChannel code from the Perf protocol. New SCMI FC tracing support is added too along the way. As a last step in the series an ARM SCMI based powercap driver is added, which takes care to expose via the Powercap framework all the SCMI Powercap zones that have been discovered asking the SCMI platform firmware. Basic testing has been performed against an emulated SCMI platform supporting SCMIv3.1 Powercap protocol using powercap-utils, with the exclusion of the FCs bits whose generalization has been only tested for regression on a JUNO platform sporting a regular SCP/SCMI v2.10 fw. The series is based on sudeep/for-next/scmi [1] on top of: commit 754f04cac362 ("firmware: arm_scmi: Relax CLOCK_DESCRIBE_RATES out-of-spec checks") Thanks, Cristian v3 --> v4 - fixed GENMASK usage in thresholds state u64 (was broken on 32bit systems) - dropped SCMI setup/teardown helpers patch in favour of standard module_init/exit - dropping FCs usage configurability via Kconfig v2 --> v3: - added and used some SCMI Fastchannel tracing support - reverted logic of Kconfig to configure usage of SCMI FC - using strscpy with new SHORT_NAME_SZ in Powercap protocol - added devm_protocol_acquire helper v1 --> v2: - fixed measurements thresholds updates to trigger notification enable update commands - added a bit more comments - usig bitfield.h macros - fixed sparse complaint about missing static on global [1]: https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git/log/?h=for-next/scmi ---- Cristian Marussi (7): dt-bindings: firmware: arm,scmi: Add powercap protocol firmware: arm_scmi: Add SCMIv3.1 Powercap protocol basic support firmware: arm_scmi: Generalize FastChannel support firmware: arm_scmi: Add SCMIv3.1 Powercap FastChannels support include: trace: Add SCMI FastChannel tracing firmware: arm_scmi: Use FastChannel tracing powercap: arm_scmi: Add SCMI Powercap based driver .../bindings/firmware/arm,scmi.yaml | 10 + drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/driver.c | 167 ++++ drivers/firmware/arm_scmi/perf.c | 225 ++--- drivers/firmware/arm_scmi/powercap.c | 866 ++++++++++++++++++ drivers/firmware/arm_scmi/protocols.h | 23 + drivers/powercap/Kconfig | 13 + drivers/powercap/Makefile | 1 + drivers/powercap/arm_scmi_powercap.c | 538 +++++++++++ include/linux/scmi_protocol.h | 127 +++ include/trace/events/scmi.h | 25 + 11 files changed, 1825 insertions(+), 172 deletions(-) create mode 100644 drivers/firmware/arm_scmi/powercap.c create mode 100644 drivers/powercap/arm_scmi_powercap.c