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 E34B0C5321D for ; Mon, 26 Aug 2024 14:47:07 +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=pPEGbHnUl6bS+lX9tOFAU103bzjhD10ROCh/EJUSveI=; b=B8Ekzh4+yIzoeNUbsHYjJkWyzE 1ugMOTPUs57jxc94dhLjp3m4KLJUXPkneaL67Fc3SUp63qDgzyTz3V85QY+ss6BzyFkDAL9wuZNWf PTvOxX6UR4QTd3nDW1uDPtJG77xIFuQqcmH0GbCA2ewSs466KFCac2w2pZxuH3DdEn0mxmM1PiDDT xRXnRgwgz7g/p1UoRGeN8O7KUZiOXRkJkKPj810ux/1O8RnVWdIISMBwRN6xZsG58NEkae1XsKywO cMgPfNw2uZDM2x/ZNeCvrzqgqIM4P5Ls0n9TyBykOUES3uA/e0bMfvgqwPc/iqydhx/BfbOZdHxIm QY8GjBmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siazi-00000007i7A-1hj5; Mon, 26 Aug 2024 14:46:58 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siayu-00000007hxV-06gP for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 14:46:09 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47QEk0rx068367; Mon, 26 Aug 2024 09:46:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724683560; bh=pPEGbHnUl6bS+lX9tOFAU103bzjhD10ROCh/EJUSveI=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=eI2DpobvE7xfuYnwkiPe1sNHwtRjlE7/W2C8oTLCDC7ROhUhJGZh6MGzBOL4Zu0UI ZlNQys3gXPv2+ZqGLea+U5M+tVaORHfQNjTAMv8JcTv0JhGH51GGT5pSP3tbK8EyFl Sy1+nQdzspBz2eIAqVaIhPKksGNOWTUZoN94P+AM= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47QEk0qM102196 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Aug 2024 09:46:00 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 26 Aug 2024 09:46:00 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 26 Aug 2024 09:46:00 -0500 Received: from localhost (uda0133052.dhcp.ti.com [128.247.81.232]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47QEk0IM073445; Mon, 26 Aug 2024 09:46:00 -0500 Date: Mon, 26 Aug 2024 09:46:00 -0500 From: Nishanth Menon To: Kevin Hilman CC: Tero Kristo , Santosh Shilimkar , , , Vibhore Vardhan , Dhruva Gole , Akashdeep Kaur , Markus Schneider-Pargmann Subject: Re: [PATCH v10 1/4] firmware: ti_sci: Add support for querying the firmware caps Message-ID: <20240826144600.phsed6horodp3jlg@unhappy> References: <20240814-lpm-constraints-firmware-msp-v10-0-bee4314bbdc8@baylibre.com> <20240814-lpm-constraints-firmware-msp-v10-1-bee4314bbdc8@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240814-lpm-constraints-firmware-msp-v10-1-bee4314bbdc8@baylibre.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_074608_273419_B7874CA8 X-CRM114-Status: GOOD ( 28.67 ) 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 On 08:39-20240814, Kevin Hilman wrote: > From: Georgi Vlaev > Mostly minor nits below: > Add support for the TISCI_MSG_QUERY_FW_CAPS message, used to retrieve > the firmware capabilities of the currently running system firmware. The > message belongs to the TISCI general core message API [1] and is > available in SysFW version 08.04.03 and above. Currently, the message is > supported on devices with split architecture of the system firmware (DM > + TIFS) like AM62x. Old revisions or not yet supported platforms will > NACK this request. > > We're using this message locally in ti_sci.c to get the low power > featutes of the FW/SoC. As there's no other kernel consumers yet, this s/featutes/features/ ? > is not added to struct ti_sci_core_ops. > > Sysfw version >= 10.00.04 support LPM_DM_MANAGED capability [2], where > Device Mgr firmware now manages which low power mode is chosen. Going > forward, this is the default configuration supported for TI AM62 family > of devices. The state chosen by the DM can be influenced by sending > constraints using the new LPM constraint APIs. > > [1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/general/core.html > [2] https://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/general/core.html#tisci-msg-query-fw-caps While both the links are valid, https://software-dl.ti.com/tisci/esd/latest/index.html has been used in documentation, so we should stay consistent on the domain name here. > > Signed-off-by: Georgi Vlaev > [vibhore@ti.com: Support for LPM_DM_MANAGED mode] > Signed-off-by: Vibhore Vardhan > Signed-off-by: Markus Schneider-Pargmann > Signed-off-by: Kevin Hilman > --- > drivers/firmware/ti_sci.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > drivers/firmware/ti_sci.h | 22 ++++++++++++++++++++++ [...] > > +/** > + * ti_sci_msg_cmd_query_fw_caps() - Get the FW/SoC capabilities > + * @handle: Pointer to TI SCI handle > + * @fw_caps: Each bit in fw_caps indicating one FW/SOC capability > + * > + * Return: 0 if all went well, else returns appropriate error value. > + */ > +static int ti_sci_msg_cmd_query_fw_caps(const struct ti_sci_handle *handle, > + u64 *fw_caps) > +{ > + struct ti_sci_info *info; > + struct ti_sci_xfer *xfer; > + struct ti_sci_msg_resp_query_fw_caps *resp; > + struct device *dev; > + int ret = 0; > + > + if (IS_ERR(handle)) > + return PTR_ERR(handle); > + if (!handle) > + return -EINVAL; > + > + info = handle_to_ti_sci_info(handle); > + dev = info->dev; > + > + xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_QUERY_FW_CAPS, > + TI_SCI_FLAG_REQ_ACK_ON_PROCESSED, > + sizeof(struct ti_sci_msg_hdr), > + sizeof(*resp)); > + if (IS_ERR(xfer)) { > + ret = PTR_ERR(xfer); > + dev_err(dev, "Message alloc failed(%d)\n", ret); > + return ret; > + } > + > + ret = ti_sci_do_xfer(info, xfer); > + if (ret) { > + dev_err(dev, "Mbox send fail %d\n", ret); > + goto fail; > + } > + > + resp = (struct ti_sci_msg_resp_query_fw_caps *)xfer->xfer_buf; > + > + if (!ti_sci_is_response_ack(resp)) { Add a dev_err here and indicating failure to detect caps? > + ret = -ENODEV; > + goto fail; > + } > + > + if (fw_caps) > + *fw_caps = resp->fw_caps; > + > +fail: > + ti_sci_put_one_xfer(&info->minfo, xfer); > + > + return ret; > +} > + > static int ti_sci_cmd_core_reboot(const struct ti_sci_handle *handle) > { > struct ti_sci_info *info; > @@ -3390,6 +3449,14 @@ static int ti_sci_probe(struct platform_device *pdev) > goto out; > } > > + /* > + * Check if the firmware supports any optional low power modes. > + * Old revisions of TIFS (< 08.04) will NACK the request. Move this comment as part of the function documentation > + */ > + ret = ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps); > + if (ret || !(info->fw_caps & MSG_FLAG_CAPS_GENERIC)) ret can be set for various reasons including older firmware that may not support fw_caps - just checking against fw_caps might suffice for the dev_debug ? > + pr_debug("Unable to detect LPM capabilities in fw_caps\n"); Please use dev_dbg Just 2 cents: adding a dev_dbg with details on what matches we got might be helpful for products in the field? [...] -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D