From: Sai Prakash Ranjan <hidden> Date: 2021-08-12 09:18:04
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.
Sai Prakash Ranjan (3):
soc: qcom: Add download mode support
dt-bindings: msm: Add QTI download mode support binding
arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 ++++++
MAINTAINERS | 7 +
arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++
drivers/soc/qcom/Kconfig | 10 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/download_mode.c | 152 ++++++++++++++++++
6 files changed, 244 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
create mode 100644 drivers/soc/qcom/download_mode.c
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
From: Sai Prakash Ranjan <hidden> Date: 2021-08-12 09:18:26
Add support for download mode on QTI platforms with SDI
(System Debug Image) enabled firmware. SDI checks for
the download mode cookies set by the kernel to decide on
whether to enter download mode or not. Additionally, SDI
needs to be disabled in case of normal reboot to prevent
entering download mode for every reboot and is enabled for
for crash reboots such as kernel panic and other crashes
such as watchdog bite/NOC errors handled by other entities
like secure world.
Signed-off-by: Sai Prakash Ranjan <redacted>
---
MAINTAINERS | 7 ++
drivers/soc/qcom/Kconfig | 10 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/download_mode.c | 152 +++++++++++++++++++++++++++++++
4 files changed, 170 insertions(+)
create mode 100644 drivers/soc/qcom/download_mode.c
From: Sai Prakash Ranjan <hidden> Date: 2021-08-12 09:19:04
Add device tree binding for QTI download mode cookies
region found in IMEM.
Signed-off-by: Sai Prakash Ranjan <redacted>
---
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Qualcomm Download Mode binding++maintainers:+-Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>++description:+Qualcomm download mode cookies memory region in IMEM is used by SDI+(System Debug Image) firmware to determine whether to enter download+mode or not to collect ramdump for post mortem debug.++properties:+compatible:+const:qcom,dload-mode++reg:+maxItems:1++qcom,sdi-disable-regs:+$ref:/schemas/types.yaml#/definitions/phandle-array+description:+Phandle reference to a syscon representing TCSR followed by the+offset and length for SDI disable register.++required:+-compatible+-reg++additionalProperties:false++examples:+-|+imem@146aa000 {+compatible = "simple-mfd";+reg = <0x146aa000 0x2000>;++#address-cells = <1>;+#size-cells = <1>;++ranges = <0 0x146aa000 0x2000>;++dload-mode@1c00 {+compatible = "qcom,dload-mode";+reg = <0x1c00 0x1000>;+qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;+};+};+...
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
From: Sai Prakash Ranjan <hidden> Date: 2021-08-12 09:19:04
Add IMEM, pil info and download mode DT nodes for SC7180 SoC which
will help in the post-mortem debug.
Signed-off-by: Sai Prakash Ranjan <redacted>
---
arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
From: Stephen Boyd <hidden> Date: 2021-08-13 00:16:15
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
or clear it on normal reboot. The normal reboot PSCI call would clear
the cookie in the firmware, in case something goes wrong after the
kernel hands off control to PSCI, and then panics that want to go into
download mode would make the SYSTEM_RESET2 reboot call into PSCI that
sets the cookie.
Maybe it could be a linux specific psci number or maybe we could
configure the reboot call in the psci node to be this specific number so
that it can be different based on the firmware implementation if
consolidating around a single number doesn't work. Either way, that all
seems manageable and we can keep these cookie details out of the kernel
and the reboot/panic paths.
Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.
Sai Prakash Ranjan (3):
soc: qcom: Add download mode support
dt-bindings: msm: Add QTI download mode support binding
arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 ++++++
MAINTAINERS | 7 +
arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++
drivers/soc/qcom/Kconfig | 10 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/download_mode.c | 152 ++++++++++++++++++
6 files changed, 244 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
create mode 100644 drivers/soc/qcom/download_mode.c
From: Trilok Soni <hidden> Date: 2021-08-13 04:31:13
Stephen,
On 8/12/2021 5:16 PM, Stephen Boyd wrote:
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
quoted
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
Some discussion by Elliot on the PSCI_SYSTEM_RESET2 and vendor bits was done here. You may want to check.
https://lkml.org/lkml/2020/2/24/1137
---Trilok Soni
From: Sai Prakash Ranjan <hidden> Date: 2021-08-16 10:39:37
On 2021-08-13 05:46, Stephen Boyd wrote:
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
quoted
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
or clear it on normal reboot. The normal reboot PSCI call would clear
the cookie in the firmware, in case something goes wrong after the
kernel hands off control to PSCI, and then panics that want to go into
download mode would make the SYSTEM_RESET2 reboot call into PSCI that
sets the cookie.
Maybe it could be a linux specific psci number or maybe we could
configure the reboot call in the psci node to be this specific number so
that it can be different based on the firmware implementation if
consolidating around a single number doesn't work. Either way, that all
seems manageable and we can keep these cookie details out of the kernel
and the reboot/panic paths.
Alright, I think we can probably make it work without much/any changes
in kernel. So following what you said, we can just implement
PSCI_SYSTEM_RESET2 in firmware to enter the download mode having cookies
already set by default and the cookie is cleared when we have a normal
reboot via PSCI_SYSTEM_RESET. For panic reboot, we already have a cmdline
*reboot=panic_warm* to identify panic reboots and can call into
PSCI_SYSTEM_RESET2. I have just tested and it works fine if we have
psci_system_reset2_supported as true.
@Trilok/@Elliot, you can check if above works for your usecases in android
as well and it doesn't need any of your additional changes to kernel.
Thanks,
Sai
quoted
Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.
Sai Prakash Ranjan (3):
soc: qcom: Add download mode support
dt-bindings: msm: Add QTI download mode support binding
arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 ++++++
MAINTAINERS | 7 +
arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++
drivers/soc/qcom/Kconfig | 10 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/download_mode.c | 152 ++++++++++++++++++
6 files changed, 244 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
create mode 100644 drivers/soc/qcom/download_mode.c
From: Rob Herring <robh@kernel.org> Date: 2021-08-17 21:28:46
On Thu, Aug 12, 2021 at 02:47:41PM +0530, Sai Prakash Ranjan wrote:
quoted hunk
Add device tree binding for QTI download mode cookies
region found in IMEM.
Signed-off-by: Sai Prakash Ranjan <redacted>
---
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Qualcomm Download Mode binding++maintainers:+-Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>++description:+Qualcomm download mode cookies memory region in IMEM is used by SDI+(System Debug Image) firmware to determine whether to enter download+mode or not to collect ramdump for post mortem debug.++properties:+compatible:+const:qcom,dload-mode++reg:+maxItems:1++qcom,sdi-disable-regs:+$ref:/schemas/types.yaml#/definitions/phandle-array+description:+Phandle reference to a syscon representing TCSR followed by the+offset and length for SDI disable register.++required:+-compatible+-reg++additionalProperties:false++examples:+-|+imem@146aa000 {+compatible = "simple-mfd";
If this is just internal RAM, then we already have a binding for it and
'simple-mfd' is not it.
+ qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+ };
+ };
+...
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
From: Sai Prakash Ranjan <hidden> Date: 2021-08-18 03:36:06
On 2021-08-18 02:58, Rob Herring wrote:
On Thu, Aug 12, 2021 at 02:47:41PM +0530, Sai Prakash Ranjan wrote:
quoted
Add device tree binding for QTI download mode cookies
region found in IMEM.
Signed-off-by: Sai Prakash Ranjan <redacted>
---
.../bindings/arm/msm/qcom,dload-mode.yaml | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Qualcomm Download Mode binding++maintainers:+-Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>++description:+Qualcomm download mode cookies memory region in IMEM is used by SDI+(System Debug Image) firmware to determine whether to enter download+mode or not to collect ramdump for post mortem debug.++properties:+compatible:+const:qcom,dload-mode++reg:+maxItems:1++qcom,sdi-disable-regs:+$ref:/schemas/types.yaml#/definitions/phandle-array+description:+Phandle reference to a syscon representing TCSR followed by the+offset and length for SDI disable register.++required:+-compatible+-reg++additionalProperties:false++examples:+-|+imem@146aa000 {+compatible = "simple-mfd";
If this is just internal RAM, then we already have a binding for it and
'simple-mfd' is not it.
Hmm, I followed qcom,pil-info.yaml as a reference but maybe that's old.
Sorry my mistake. I am dropping this series as we will move
to using PSCI_SYSTEM_RESET2 as detailed in cover letter.
Thanks,
Sai
quoted
+ qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+ };
+ };
+...
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation