From patchwork Mon Jun 27 12:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12896597 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 DEA9BC433EF for ; Mon, 27 Jun 2022 12:31:55 +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=X4XdNVfvxu8BKj/NpEChKKp/2zX1fr/rjDuj9HdzYPM=; b=5CYswEHa6zO81M +OYH8zCt3rHQSyDZC3Sj39uRtV20YzZ1PQEt5Xq3+ZbfU5kCGOPLtinS87zEDMOmVwXVC0kjp6YyU 7KS3dv2/CDNLHNA4LTt6inJwunQqqm5jwV0IcvikD74j8m6jXWzlriryIm0rw251gp6Wd+Y2v5r7y lgWXRLcDonXq2092mkeUQJcSOzfQUr1omz9Jhvl8wIsJkBsfgQCF134fdhgWBsvfuy07jRYiTJ1Tp ZJThe5n8rZ2SPUjPBRdTANb+UMKic1e8uoiPZEub8g3xFzl9oSM/lSjg3FfrfHn4jsjXya1hubwO5 drFhkZ9c3NH2vOCzNroA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o5ntJ-000sFm-2r; Mon, 27 Jun 2022 12:30:57 +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 1o5ntF-000sEy-Ov for linux-arm-kernel@lists.infradead.org; Mon, 27 Jun 2022 12:30:55 +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 AB42C1758; Mon, 27 Jun 2022 05:30:52 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D5C53F792; Mon, 27 Jun 2022 05:30:50 -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 v3 0/9] SCMIv3.1 Powercap protocol and driver Date: Mon, 27 Jun 2022 13:30:29 +0100 Message-Id: <20220627123038.1427067-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-20220627_053053_944266_7D9433EE X-CRM114-Status: GOOD ( 14.10 ) 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 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 (9): 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 firmware: arm_scmi: Make use of FastChannels configurable include: trace: Add SCMI FastChannel tracing firmware: arm_scmi: Use FastChannel tracing firmware: arm_scmi: Add scmi_driver optional setup/teardown callbacks powercap: arm_scmi: Add SCMI Powercap based driver .../bindings/firmware/arm,scmi.yaml | 10 + drivers/firmware/arm_scmi/Kconfig | 13 + drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/bus.c | 15 +- drivers/firmware/arm_scmi/driver.c | 173 ++++ 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 | 537 +++++++++++ include/linux/scmi_protocol.h | 129 +++ include/trace/events/scmi.h | 25 + 13 files changed, 1858 insertions(+), 174 deletions(-) create mode 100644 drivers/firmware/arm_scmi/powercap.c create mode 100644 drivers/powercap/arm_scmi_powercap.c