From patchwork Mon Feb 12 12:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 13552999 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 9E8A4C48297 for ; Mon, 12 Feb 2024 12:33:24 +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=YpB73uERchdtYzrVJItDaM2tG1DmmTm05fsRlpU0BD8=; b=Z9bJLKqex0yW7h qzKy1+zNgla+4NZZFIzT7YJT45a+NvltIV+KxFM9R21YhChqJHAj+jK1VhbVeRdDmQSn3TmZTwW0f 7Vpu7EHh1JQ1ekS6mfEMc4qQaeaLOKEHhT3vQ6GAdvwakyFu+uBgSXhkdDYzFbfZvy5l/36CNTO8o cuVWVHD68kmdLbpAifLWvc/tLHpV73LBIcuSEfvAi8xUhA8W0OyW6fYYX2Ao1nEa4pbodOAW1IhOg kCjwFaPQ4YVSgcP9PHe3tEjccA+wsulKhEzegFkJpxtUI3ewFvd8diOZ8ChZOmkk4BNW0iCd3wCmB Lb2UQKo9fohjyABVte3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZVUl-00000005H39-03Ar; Mon, 12 Feb 2024 12:33:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZVUh-00000005H0c-12re for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 12:33:08 +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 94BA5DA7; Mon, 12 Feb 2024 04:33:42 -0800 (PST) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9DBEC3F7BD; Mon, 12 Feb 2024 04:32:59 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, vincent.guittot@linaro.org, peng.fan@oss.nxp.com, michal.simek@amd.com, quic_sibis@quicinc.com, quic_nkela@quicinc.com, souvik.chakravarty@arm.com, Cristian Marussi Subject: [PATCH 00/11] Add SCMI core checks for notification support. Date: Mon, 12 Feb 2024 12:32:22 +0000 Message-ID: <20240212123233.1230090-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_043307_434836_076F3AB6 X-CRM114-Status: GOOD ( 16.74 ) 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, this small series adds a new logic into the SCMI core to implicitly check for notification support when some SCMI driver attempts to register for notifications. Till now, trying to register a notifier for an unsuppported notification returned an error and this behaviour generated unneeded message exchanges: the only way to avoid this was to lookup in advance the specific protocol and resources available in order to avoid registering at all any notifier where not supported. Anyway, not all protocols currently expose the related notification info to lookup and, moreover, no check was performed anywhere to verify if the specific notification enable/disable command was supported at all (almost all of these notification enable commands are optional). Last but not least, this kind of support checks could and should be handled transparently by the SCMI core. With this series each protocol can optionally provide an event_ops callcback that will be invoked by the core to lookup if the specific command and event/resource notification is supported on the running platform; the SCMI core then, at initialization time, will use such callbacks to take care to collect such info and mark unsupported events/resources. Later on, when an SCMI driver attempts to register a notifier for a specific event/resources, it will fail and return an error to the caller if the requested notification was not supported. The end-result is that the SCMI driver user will fail to register a notifier if the related command or resource is not supported (like before), BUT without the need of exchanging any message NOR the need to actively lookup if the specified notification is supported. The last two patches in the series, instead, take care to extend the Perf notification report to provide the pre-calculated frequencies corresponding to the level or index carried by the specific notification report. These latter 2 patches are indeed only slighly related to this series at large but are provided here for ease of access. Based on sudeep/for-next/scmi/updates on top of commit 7dd3d11f4dac ("clk: scmi: Add support for forbidden clock state controls") Thanks, Cristian --- Cristian Marussi (11): firmware: arm_scmi: Check for notification support firmware: arm_scmi: Add a common helper to check if a message is supported firmware: arm_scmi: Implement Perf .is_notify_supported callback firmware: arm_scmi: Implement Power .is_notify_supported callback firmware: arm_scmi: Implement SysPower .is_notify_supported callback firmware: arm_scmi: Implement Clock .is_notify_supported callback firmware: arm_scmi: Implement Sensor .is_notify_supported callback firmware: arm_scmi: Implement Reset .is_notify_supported callback firmware: arm_scmi: Implement Powercap .is_notify_supported callback firmware: arm_scmi: Use opps_by_lvl to store opps firmware: arm_scmi: Report frequencies in Perf notifications drivers/firmware/arm_scmi/clock.c | 47 ++++++++- drivers/firmware/arm_scmi/driver.c | 34 ++++++ drivers/firmware/arm_scmi/notify.c | 17 ++- drivers/firmware/arm_scmi/notify.h | 4 + drivers/firmware/arm_scmi/perf.c | 144 +++++++++++++++++++++++--- drivers/firmware/arm_scmi/power.c | 30 +++++- drivers/firmware/arm_scmi/powercap.c | 45 +++++++- drivers/firmware/arm_scmi/protocols.h | 4 + drivers/firmware/arm_scmi/reset.c | 37 +++++-- drivers/firmware/arm_scmi/sensors.c | 37 ++++++- drivers/firmware/arm_scmi/system.c | 16 +++ include/linux/scmi_protocol.h | 3 + 12 files changed, 383 insertions(+), 35 deletions(-)