dt-bindings: firmware: qcom,scm: Document SDI disable
PATCH v2 1/5 dt-bindings: firmware: qcom,scm: Document SDI disable
IPQ5018 has SDI (Secure Debug Image) enabled by TZ by default, and that means that WDT being asserted or just trying to reboot will hang the board in the debug mode and only pulling the power and repowering will help. Some IPQ4019 boards like Google WiFI have it enabled as well.
So, lets add a boolean property to indicate that SDI should be disabled.
--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/firmware/qcom,scm.yaml +8 -0
@@ -89,6 +89,14 @@ properties: protocol to handle sleeping SCM calls. maxItems: 1 + qcom,sdi-disable: + description: + Indicates that the SDI (Secure Debug Image) has been enabled by TZ + by default and it needs to be disabled. + If not disabled WDT assertion or reboot will cause the board to hang + in the debug mode. + type: boolean + qcom,dload-mode: $ref: /schemas/types.yaml#/definitions/phandle-array items:
Signature · 1 line
2.41.0
PATCH v2 2/5 firmware: qcom: scm: Add SDI disable support
Some SoC-s like IPQ5018 require SDI(Secure Debug Image) to be disabled before trying to reboot, otherwise board will just hang after reboot has been issued via PSCI.
So, provide a call to SCM that allows disabling it.
--- drivers/firmware/qcom_scm.c | 23 +++++++++++++++++++++++ drivers/firmware/qcom_scm.h | 1 + 2 files changed, 24 insertions(+)
drivers/firmware/qcom_scm.c +23 -0
@@ -403,6 +403,29 @@ int qcom_scm_set_remote_state(u32 state, u32 id) }EXPORT_SYMBOL_GPL (qcom_scm_set_remote_state); +static int qcom_scm_disable_sdi (void ) +{ +int ret; +struct qcom_scm_desc desc = { + .svc =QCOM_SCM_SVC_BOOT , + .cmd =QCOM_SCM_BOOT_SDI_CONFIG , + .args[0 ] =1 ,/* Disable watchdog debug */ + .args[1 ] =0 ,/* Disable SDI */ + .arginfo =QCOM_SCM_ARGS (2 ), + .owner =ARM_SMCCC_OWNER_SIP , + }; +struct qcom_scm_res res; + + ret =qcom_scm_clk_enable (); +if (ret) +return ret; + ret =qcom_scm_call (__scm->dev, &desc, &res); + +qcom_scm_clk_disable (); + +return ret ? : res.result[0 ]; +} +static int __qcom_scm_set_dload_mode (struct device *dev,bool enable) {struct qcom_scm_desc desc = {
drivers/firmware/qcom_scm.h +1 -0
@@ -80,6 +80,7 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,#define QCOM_SCM_SVC_BOOT 0x01#define QCOM_SCM_BOOT_SET_ADDR 0x01#define QCOM_SCM_BOOT_TERMINATE_PC 0x02 +#define QCOM_SCM_BOOT_SDI_CONFIG 0x09#define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10#define QCOM_SCM_BOOT_SET_ADDR_MC 0x11#define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a
Signature · 1 line
2.41.0
Re: [PATCH v2 2/5] firmware: qcom: scm: Add SDI disable support
Quoted 4 lines · Robert Marko
Some SoC-s like IPQ5018 require SDI(Secure Debug Image) to be disabled before trying to reboot, otherwise board will just hang after reboot has been issued via PSCI.
Quoted 8 lines
So, provide a call to SCM that allows disabling it.
Signed-off-by Robert Marko <[email protected]>Acked-by Mukesh Ojha <[email protected]>--- drivers/firmware/qcom_scm.c | 23 +++++++++++++++++++++++ drivers/firmware/qcom_scm.h | 1 + 2 files changed, 24 insertions(+)
This should be squashed with next patch. Adding local function without user is useless.
Best regards,
Krzysztof
PATCH v2 3/5 firmware: qcom_scm: disable SDI if required
In reply to Robert MarkoIPQ5018 has SDI (Secure Debug Image) enabled by TZ by default, and that means that WDT being asserted or just trying to reboot will hang the board in the debug mode and only pulling the power and repowering will help. Some IPQ4019 boards like Google WiFI have it enabled as well.
So, lets use the boolean DT property to disable SDI during SCM probe. It is important to disable it as soon as possible as we might have a WDT assertion at any time which would then leave the board in debug mode, thus disabling it during SCM removal is not enough.
--- drivers/firmware/qcom_scm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/firmware/qcom_scm.c +6 -0
@@ -1491,6 +1491,12 @@ static int qcom_scm_probe(struct platform_device *pdev)if (download_mode)qcom_scm_set_download_mode (true); +/* +* Disable SDI if indicated by DT. +*/ +if (of_property_read_bool (pdev->dev.of_node,"qcom,sdi-disable" )) +qcom_scm_disable_sdi (); +return 0 ; }
Signature · 1 line
2.41.0
PATCH v2 4/5 dt-bindings: firmware: qcom,scm: document IPQ5018 compatible
In reply to Robert MarkoIt seems that IPQ5018 compatible was never documented in the bindings.
--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/firmware/qcom,scm.yaml +1 -0
@@ -24,6 +24,7 @@ properties: - qcom,scm-apq8064 - qcom,scm-apq8084 - qcom,scm-ipq4019 + - qcom,scm-ipq5018 - qcom,scm-ipq5332 - qcom,scm-ipq6018 - qcom,scm-ipq806x
Signature · 1 line
2.41.0
Re: [PATCH v2 4/5] dt-bindings: firmware: qcom,scm: document IPQ5018 compatible
Quoted 5 lines · Robert Marko
It seems that IPQ5018 compatible was never documented in the bindings.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 1 +
Best regards,
Krzysztof
Re: [PATCH v2 4/5] dt-bindings: firmware: qcom,scm: document IPQ5018 compatible
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Robert Marko
It seems that IPQ5018 compatible was never documented in the bindings.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 1 +Reviewed-by Krzysztof Kozlowski <[email protected]>
I earlier posted this here, [1]
[1] https://www.spinics.net/lists/linux-mmc/msg77015.html
Regards,
Sricharan
Re: [PATCH v2 4/5] dt-bindings: firmware: qcom,scm: document IPQ5018 compatible
Quoted 10 lines · Sricharan Ramabadhran
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Robert Marko
It seems that IPQ5018 compatible was never documented in the bindings.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 1 +
Quoted 6 lines
Quoted 2 lines
Reviewed-by Krzysztof Kozlowski <[email protected]>I earlier posted this here, [1]
So it should be applied... although status said superseded. No clue, please check with Bjorn.
https://patchwork.kernel.org/project/linux-arm-msm/list/?series=770464&state=*
Best regards,
Krzysztof
PATCH v2 5/5 arm64: dts: qcom: ipq5018: indicate that SDI should be disabled
In reply to Robert MarkoNow that SCM has support for disabling SDI if indicated by DT, lets set it for IPQ5018 as it has SDI enabled by default and it must be disabled.
--- arch/arm64/boot/dts/qcom/ipq5018.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/ipq5018.dtsi +1 -0
@@ -57,6 +57,7 @@ L2_0: l2-cache { firmware { scm { compatible = "qcom,scm-ipq5018", "qcom,scm"; + qcom,sdi-disable; }; };
Signature · 1 line
2.41.0
Quoted 17 lines · Robert Marko
IPQ5018 has SDI (Secure Debug Image) enabled by TZ by default, and that means that WDT being asserted or just trying to reboot will hang the board in the debug mode and only pulling the power and repowering will help. Some IPQ4019 boards like Google WiFI have it enabled as well.
So, lets add a boolean property to indicate that SDI should be disabled.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/firmware/qcom,scm.yaml +0
-0
Documentation/devicetree/bindings/firmware/qcom,scm.yaml properties: · line 92
Quoted 4 lines
Documentation/devicetree/bindings/firmware/qcom,scm.yaml +1
-0@@ -89,6 +89,14 @@ properties: protocol to handle sleeping SCM calls. maxItems: 1 + qcom,sdi-disable:
The property should describe rather current hardware/firmware state, instead of expressing your intention for OS what to do. Therefore rather:
qcom,sdi-enabled
or
qcom,secure-debug-image
Best regards,
Krzysztof
Rob Herring
maintainerQuoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Robert Marko
IPQ5018 has SDI (Secure Debug Image) enabled by TZ by default, and that means that WDT being asserted or just trying to reboot will hang the board in the debug mode and only pulling the power and repowering will help. Some IPQ4019 boards like Google WiFI have it enabled as well.
So, lets add a boolean property to indicate that SDI should be disabled.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/firmware/qcom,scm.yaml +0
-0@@ -89,6 +89,14 @@ properties: protocol to handle sleeping SCM calls. maxItems: 1
Quoted 7 lines
Documentation/devicetree/bindings/firmware/qcom,scm.yaml properties: · line 92
Quoted 1 line
Documentation/devicetree/bindings/firmware/qcom,scm.yaml +1
-0+ qcom,sdi-disable:The property should describe rather current hardware/firmware state, instead of expressing your intention for OS what to do. Therefore rather:
qcom,sdi-enabled
or
qcom,secure-debug-image
Why can't you just disable SDI unconditionally when going into debug mode? Is doing that when not enabled going to crash the system or something?
Rob
Quoted 31 lines · Rob Herring
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Robert Marko
IPQ5018 has SDI (Secure Debug Image) enabled by TZ by default, and that means that WDT being asserted or just trying to reboot will hang the board in the debug mode and only pulling the power and repowering will help. Some IPQ4019 boards like Google WiFI have it enabled as well.
So, lets add a boolean property to indicate that SDI should be disabled.
Signed-off-by Robert Marko <[email protected]>--- Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/firmware/qcom,scm.yaml +0
-0@@ -89,6 +89,14 @@ properties: protocol to handle sleeping SCM calls. maxItems: 1Quoted 7 lines
Documentation/devicetree/bindings/firmware/qcom,scm.yaml properties: · line 92
Quoted 1 line
Documentation/devicetree/bindings/firmware/qcom,scm.yaml +1
-0+ qcom,sdi-disable:The property should describe rather current hardware/firmware state, instead of expressing your intention for OS what to do. Therefore rather:
qcom,sdi-enabled
or
qcom,secure-debug-image
Quoted 3 lines
Why can't you just disable SDI unconditionally when going into debug mode? Is doing that when not enabled going to crash the system or something?
Because if not disabled you will enter the Secure Debug mode even on a regular reboot and then you have to pull the power in order to boot again. Even according to QCA docs they intended for the Linux to disable SDI as TZ/QSEE will always enable it as part of booting.
Regards,
Robert
Quoted 3 lines
Rob
Quoted 4 lines · Robert Marko
Quoted 3 lines · Rob Herring
Why can't you just disable SDI unconditionally when going into debug mode? Is doing that when not enabled going to crash the system or something?
I asked the same, to resounding silence:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/ZNlhSdh0qDMieTAS@localhost/
Quoted 4 lines
Because if not disabled you will enter the Secure Debug mode even on a regular reboot and then you have to pull the power in order to boot again. Even according to QCA docs they intended for the Linux to disable SDI as TZ/QSEE will always enable it as part of booting.
NB: I've never read such docs. Presumably they're internal/private to Qualcomm and/or its direct partners? I'd love to see them.
But, I think you (robinmarko) are not really answering the same question that Rob (robh) is asking. Rob is asking why you ever *don't* want to disable SDI. You're answering why we ever need to disable it at all. I don't think the latter question is controversial.
FWIW, your description of those docs sounds like we should unconditionally *disable* SDI (like my first RFC above), which would answer Rob's question, and would agree with my RFC above :) And as a bonus, no Device Tree change would be required.
Brian
Quoted 12 lines · Brian Norris
Quoted 4 lines · Robert Marko
Quoted 3 lines · Rob Herring
Why can't you just disable SDI unconditionally when going into debug mode? Is doing that when not enabled going to crash the system or something?
I asked the same, to resounding silence:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/ZNlhSdh0qDMieTAS@localhost/
Quoted 7 lines
Quoted 4 lines
Because if not disabled you will enter the Secure Debug mode even on a regular reboot and then you have to pull the power in order to boot again. Even according to QCA docs they intended for the Linux to disable SDI as TZ/QSEE will always enable it as part of booting.
NB: I've never read such docs. Presumably they're internal/private to Qualcomm and/or its direct partners? I'd love to see them.
Sadly they are all behind the NDA.
Quoted 5 lines
But, I think you (robinmarko) are not really answering the same question that Rob (robh) is asking. Rob is asking why you ever *don't* want to disable SDI. You're answering why we ever need to disable it at all. I don't think the latter question is controversial.
I understood his question differently, hence my answer.
Quoted 5 lines
FWIW, your description of those docs sounds like we should unconditionally *disable* SDI (like my first RFC above), which would answer Rob's question, and would agree with my RFC above :) And as a bonus, no Device Tree change would be required.
Well, the thing is that I only have docs for some of the IPQ chips, and with the insane variety of SoC-s that use SCM and TZ/QSEE but completely different FW base or version something would break for sure so I would prefer to opt-in if its really required as SDI was something that was until IPQ5018 came along, always disabled by default, except for the weird Google WiFI board.
Regards,
Robert
Quoted 2 lines
Brian