diff mbox series

[v2] firmware: qcom: scm: Disable SDI and write no dump to dump mode

Message ID 20240708155332.4056479-1-quic_mojha@quicinc.com (mailing list archive)
State Accepted
Headers show
Series [v2] firmware: qcom: scm: Disable SDI and write no dump to dump mode | expand

Commit Message

Mukesh Ojha July 8, 2024, 3:53 p.m. UTC
SDI is enabled for most of the Qualcomm SoCs and as per commit
ff4aa3bc9825 ("firmware: qcom_scm: disable SDI if required")
it was recommended to disable SDI by mentioning it in device tree
to avoid hang during watchdog or during reboot.

However, for some cases if download mode tcsr register already
configured from boot firmware to collect dumps and if SDI is
disabled via means of mentioning it in device tree we could
still end up with dump collection. Disabling SDI alone is
not completely enough to disable dump mode and we also need to
zero out the bits download bits from tcsr register.

Current commit now, unconditionally call qcom_scm_set_download_mode()
based on download_mode flag, at max if TCSR register is not mentioned
or available for a SoC it will fallback to legacy way of setting
download mode through command which may be no-ops or return error
in case current firmware does not implements QCOM_SCM_INFO_IS_CALL_AVAIL
so, at worst it does nothing if it fails.

It also does to call SDI disable call if dload mode is disabled, which
looks fine to do as intention is to disable dump collection even if
system crashes.

Fixes: ff4aa3bc9825 ("firmware: qcom_scm: disable SDI if required")
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
Changes in v2: https://lore.kernel.org/lkml/20240705120623.1424931-1-quic_mojha@quicinc.com/
 - Modified the commit description to make the problem description more clearer. [eberman]
 - Added Fixes tag and removed conditional operator from qcom_scm_set_download_mode()
   argument. [eberman]

 drivers/firmware/qcom/qcom_scm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Bjorn Andersson Aug. 15, 2024, 8:40 p.m. UTC | #1
On Mon, 08 Jul 2024 21:23:32 +0530, Mukesh Ojha wrote:
> SDI is enabled for most of the Qualcomm SoCs and as per commit
> ff4aa3bc9825 ("firmware: qcom_scm: disable SDI if required")
> it was recommended to disable SDI by mentioning it in device tree
> to avoid hang during watchdog or during reboot.
> 
> However, for some cases if download mode tcsr register already
> configured from boot firmware to collect dumps and if SDI is
> disabled via means of mentioning it in device tree we could
> still end up with dump collection. Disabling SDI alone is
> not completely enough to disable dump mode and we also need to
> zero out the bits download bits from tcsr register.
> 
> [...]

Applied, thanks!

[1/1] firmware: qcom: scm: Disable SDI and write no dump to dump mode
      commit: 79cb2cb8d89b7eca87e8dac031dadea4aeafeaa7

Best regards,
diff mbox series

Patch

diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 00c379a3cceb..0f5ac346bda4 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -1954,14 +1954,12 @@  static int qcom_scm_probe(struct platform_device *pdev)
 	 * will cause the boot stages to enter download mode, unless
 	 * disabled below by a clean shutdown/reboot.
 	 */
-	if (download_mode)
-		qcom_scm_set_download_mode(true);
-
+	qcom_scm_set_download_mode(download_mode);
 
 	/*
 	 * Disable SDI if indicated by DT that it is enabled by default.
 	 */
-	if (of_property_read_bool(pdev->dev.of_node, "qcom,sdi-enabled"))
+	if (of_property_read_bool(pdev->dev.of_node, "qcom,sdi-enabled") || !download_mode)
 		qcom_scm_disable_sdi();
 
 	ret = of_reserved_mem_device_init(__scm->dev);