From patchwork Mon Jun 6 10:02:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12870201 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 1FA39C433EF for ; Mon, 6 Jun 2022 10:04:03 +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=PZMPynmJjzQvIsF6QNBbA1J+tt1fkw5kXRu6MFAgoaU=; b=IDe25FRYWTBz8s LIk3mSrLOaQQ0J78S+2QbgaZYyPfQwXRsY0ijNWqz2Zmr3DvVtEi9c8k7sA3sp9dqOSp+R9eH3thZ B8vWAKta06x7/JG+qRmNENsOYOijPeoAIaLcrm5NxjV80VVfzwmrTquwmPVFibiH+R4mjBzxAzS4A ui/OBdeyd/DSLSRCzeZ7xofIKuzigME+dZn0vprDrz4iCmnjfJrSbxCLqvmZsqyb4pkd4MUdTsOWG vHbTSDuFxLUJwFtL6J0kURTF2J4NxIpSY9GTJha05mnSeYU3eTf+MfAMFpKV7d2xtbvMh0HZkvEWn Llsx0X4uOQ+9Ly+puJog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ny9ZY-000aD6-M7; Mon, 06 Jun 2022 10:02:56 +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 1ny9ZV-000aCB-6m for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 10:02: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 7307F1596; Mon, 6 Jun 2022 03:02:51 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7F1C33F66F; Mon, 6 Jun 2022 03:02:49 -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 v2 0/7] SCMIv3.1 Powercap protocol and driver Date: Mon, 6 Jun 2022 11:02:23 +0100 Message-Id: <20220606100230.3465828-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-20220606_030253_329281_3837FEB9 X-CRM114-Status: GOOD ( 12.29 ) 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. 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 ef189d7c6156 ("firmware: arm_scmi: Remove all the unused local variables") Thanks, Cristian 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 firmware: arm_scmi: Make use of FastChannels configurable 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 | 167 ++++ drivers/firmware/arm_scmi/perf.c | 218 +---- drivers/firmware/arm_scmi/powercap.c | 857 ++++++++++++++++++ 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 +++ 12 files changed, 1810 insertions(+), 175 deletions(-) create mode 100644 drivers/firmware/arm_scmi/powercap.c create mode 100644 drivers/powercap/arm_scmi_powercap.c