From mboxrd@z Thu Jan 1 00:00:00 1970 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 F1A76C54FC6 for ; Tue, 3 Sep 2024 00:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=c/QZVt/20yE6CROiX3sc/IYnNH9lb/ZTAxD+C8+6Kqc=; b=uTmagEu6Od2hK8pK3u/i00YQqP D0VHObu+42wGacl/H2JbEgbECbziFOxYO71un9+NxlzeTj5eS69W+70/ght2i79FD3/uwqhslgDuo I0yawR7WyWL88LU/NP5lSvAYNJVHGXBz8mzVFMf8bokXtmtLEGmm3Xo96UiNVvyuxrFZVpttnvCE8 T9B8ig8cEFRZ1goKPel8VvT0v6NokDU31eCT+IGi0AfZmtI3mXeiKoB5G/oxnijHByNo7vlbwqxIc fDwGDKkyANe26IpzUbioFhscgqbnyOsdh5BJ43RYNvIb5fyiZhNg4ao3xO5cFQblGw/bwsGMoKpZl hVreSi5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slHpJ-0000000FtlK-2Ou0; Tue, 03 Sep 2024 00:55:21 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slHoP-0000000Ftdc-401N for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2024 00:54:27 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0B67FA40091; Tue, 3 Sep 2024 00:54:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4608C4CEC2; Tue, 3 Sep 2024 00:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725324864; bh=PcGrK34WfaOT41arniGBOCZWp4Nbd4SJ0LJW2GsW2XA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=azxADvZ0j15BfNU2DzUHEzWMNXCSNTKeFCu0w/CTbYf838uxk1WBDnCRH5wTGPPE1 XXtsokI1j5tt/8f65q5A5kxYRbC/aBc5es2l5PtqM/r8LJf/wsiFWZMMMOVQ7dactm isBtM4qp9BewzK1XJenJzCabFm2aFQTMTrcBTVbZDpt+INSdbLQfd7txhu9uiwZcce Rg4nNMWDsDJ2z8nALvdcxh3EytXuvec2DiZ8iCXl+pbW7Lc6MX0XwEi7ler5Jcjbv5 VZklMFAP8IyRyPkuSVhJObU48lcix6aoV2mx3AULq5y5Om8yk0VNe/yXvJoy1K1bqm 9ZcAxA8vqBCAg== Date: Mon, 2 Sep 2024 17:54:22 -0700 From: Nathan Chancellor To: Markus Schneider-Pargmann Cc: Nishanth Menon , Tero Kristo , Santosh Shilimkar , Vibhore Vardhan , Kevin Hilman , Dhruva Gole , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 4/4] firmware: ti_sci: add CPU latency constraint management Message-ID: <20240903005422.GA4638@thelio-3990X> References: <20240829201606.1407773-1-msp@baylibre.com> <20240829201606.1407773-5-msp@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240829201606.1407773-5-msp@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_175426_142736_824E2870 X-CRM114-Status: GOOD ( 25.24 ) 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 Markus, On Thu, Aug 29, 2024 at 10:16:05PM +0200, Markus Schneider-Pargmann wrote: > From: Kevin Hilman > > During system-wide suspend, check if any of the CPUs have PM QoS > resume latency constraints set. If so, set TI SCI constraint. > > TI SCI has a single system-wide latency constraint, so use the max of > any of the CPU latencies as the system-wide value. > > Note: DM firmware clears all constraints at resume time, so > constraints need to be checked/updated/sent at each system suspend. > > Co-developed-by: Vibhore Vardhan > Signed-off-by: Vibhore Vardhan > Reviewed-by: Dhruva Gole > Signed-off-by: Dhruva Gole > Signed-off-by: Kevin Hilman > Tested-by: Dhruva Gole > Signed-off-by: Markus Schneider-Pargmann > --- > drivers/firmware/ti_sci.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c > index 8482b7077eef..d5d64e5ffbd7 100644 > --- a/drivers/firmware/ti_sci.c > +++ b/drivers/firmware/ti_sci.c > @@ -10,6 +10,7 @@ > #define pr_fmt(fmt) "%s: " fmt, __func__ > > #include > +#include > #include > #include > #include > @@ -20,6 +21,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -3669,7 +3671,27 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info) > static int __maybe_unused ti_sci_suspend(struct device *dev) > { > struct ti_sci_info *info = dev_get_drvdata(dev); > - int ret; > + struct device *cpu_dev, *cpu_dev_max = NULL; > + s32 val, cpu_lat = 0; > + int i, ret; > + > + if (info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED) { > + for_each_possible_cpu(i) { > + cpu_dev = get_cpu_device(i); > + val = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_RESUME_LATENCY); This change is now in -next as commit 458d22d2e064 ("firmware: ti_sci: add CPU latency constraint management"), where it breaks the build when this driver is built as a module because dev_pm_qos_read_value() is not exported to modules: ERROR: modpost: "dev_pm_qos_read_value" [drivers/firmware/ti_sci.ko] undefined! Obviously exporting it would fix the build but sometimes that is controversial, hence just the report. > + if (val != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) { > + cpu_lat = max(cpu_lat, val); > + cpu_dev_max = cpu_dev; > + } > + } > + if (cpu_dev_max) { > + dev_dbg(cpu_dev_max, "%s: sending max CPU latency=%u\n", __func__, cpu_lat); > + ret = ti_sci_cmd_set_latency_constraint(&info->handle, > + cpu_lat, TISCI_MSG_CONSTRAINT_SET); > + if (ret) > + return ret; > + } > + } > > ret = ti_sci_prepare_system_suspend(info); > if (ret) > -- > 2.45.2 >