soc: qcom: Add download mode support for QTI platforms
Subsystems (4)
cover soc: qcom: Add download mode support for QTI platforms
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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH 1/3 soc: qcom: Add download mode support
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.
--- 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
MAINTAINERS +7 -0
@@ -15327,6 +15327,13 @@ L: [email protected] S: Maintained F: drivers/crypto/qce/ +QUALCOMM DOWNLOAD MODE DRIVER +M: Sai Prakash Ranjan <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml +F: drivers/soc/qcom/download_mode.c + QUALCOMM EMAC GIGABIT ETHERNET DRIVER M: Timur Tabi <[email protected]> L: [email protected]
drivers/soc/qcom/Kconfig +10 -0
@@ -42,6 +42,16 @@ config QCOM_CPR To compile this driver as a module, choose M here: the module will be called qcom-cpr +config QCOM_DLOAD_MODE + tristate "QCOM Download Mode support" + depends on ARCH_QCOM || COMPILE_TEST + help + Say Y here to enable support for download mode on QTI platforms. + + Download mode driver configures the download mode cookies and SDI + (System Debug Image) required to collect ramdump for post-mortem + debug on Qualcomm Technologies, Inc. platforms. + config QCOM_GENI_SE tristate "QCOM GENI Serial Engine Driver" depends on ARCH_QCOM || COMPILE_TEST
drivers/soc/qcom/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_QCOM_AOSS_QMP) += qcom_aoss.o obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o obj-$(CONFIG_QCOM_CPR) += cpr.o +obj-$(CONFIG_QCOM_DLOAD_MODE) += download_mode.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_OCMEM) += ocmem.o
drivers/soc/qcom/download_mode.c new file +152 -0
152 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH 2/3 dt-bindings: msm: Add QTI download mode support binding
In reply to Sai Prakash RanjanAdd device tree binding for QTI download mode cookies region found in IMEM.
--- .../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
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +53 -0
@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.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 <[email protected]> + +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>; + }; + }; +...
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH 3/3 arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
In reply to Sai Prakash RanjanAdd IMEM, pil info and download mode DT nodes for SC7180 SoC which will help in the post-mortem debug.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/sc7180.dtsi +21 -0
@@ -3222,6 +3222,27 @@ spmi_bus: spmi@c440000 { cell-index = <0>; }; + imem@146aa000 { + compatible = "simple-mfd"; + reg = <0 0x146aa000 0 0x2000>; + + #address-cells = <1>; + #size-cells = <1>; + + ranges = <0 0 0x146aa000 0x2000>; + + pil-reloc@94c { + compatible = "qcom,pil-reloc-info"; + reg = <0x94c 0xc8>; + }; + + dload-mode@1c00 { + compatible = "qcom,dload-mode"; + reg = <0x1c00 0x1000>; + qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>; + }; + }; + apps_smmu: iommu@15000000 { compatible = "qcom,sc7180-smmu-500", "arm,mmu-500"; reg = <0 0x15000000 0 0x100000>;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
Quoted 11 lines
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.
Quoted 21 lines
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
Stephen,
Quoted 13 lines · Stephen Boyd
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
Quoted 11 lines
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.
Quoted 8 lines
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_RESET2support 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 cookieQuoted 1 line
create mode 100644
drivers/soc/qcom/download_mode.c
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
Quoted 26 lines · Stephen Boyd
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
Quoted 11 lines
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_RESET2support 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 theSYSTEM_RESET2reboot call into PSCI that sets the cookie.
Quoted 7 lines
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 29 lines
Quoted 13 lines
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
regionQuoted 11 lines
.../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_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Rob Herring
maintainerRe: [PATCH 2/3] dt-bindings: msm: Add QTI download mode support binding
In reply to Sai Prakash RanjanQuoted 44 lines · Sai Prakash Ranjan
Add device tree binding for QTI download mode cookies region found in IMEM.
Signed-off-by Sai Prakash Ranjan <[email protected]>--- .../bindings/arm/msm/qcom,dload-mode.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yamlDocumentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +29
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.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 <[email protected]> + +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. +
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +10
-0+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.
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml line 49
Quoted 10 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +10
-0+ reg = <0x146aa000 0x2000>; + + #address-cells = <1>; + #size-cells = <1>; + + ranges = <0 0x146aa000 0x2000>; + + dload-mode@1c00 { + compatible = "qcom,dload-mode"; + reg = <0x1c00 0x1000>;
0x1c00 + 0x1000 > 0x2000
Quoted 9 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +4
-0+ qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>; + }; + }; +...Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 2/3] dt-bindings: msm: Add QTI download mode support binding
Quoted 53 lines · Rob Herring
Quoted 52 lines · Sai Prakash Ranjan
Add device tree binding for QTI download mode cookies region found in IMEM.
Signed-off-by Sai Prakash Ranjan <[email protected]>--- .../bindings/arm/msm/qcom,dload-mode.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yamlDocumentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +14
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.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 <[email protected]> + +description: + Qualcomm download mode cookies memory region in IMEM is used by SDI + (System Debug Image) firmware to determine whether to enterdownload
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +20
-0+ 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
Quoted 9 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml line 39
Quoted 5 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +5
-0+ +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.
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +4
-0+ reg = <0x146aa000 0x2000>; + + #address-cells = <1>; + #size-cells = <1>;
Quoted 9 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml line 49
Quoted 6 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +6
-0+ + ranges = <0 0x146aa000 0x2000>; + + dload-mode@1c00 { + compatible = "qcom,dload-mode"; + reg = <0x1c00 0x1000>;
0x1c00+0x1000>0x2000
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 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml new file +4
-1+ 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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Bjorn Andersson
AppliedRe: (subset) [PATCH 3/3] arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
In reply to Sai Prakash RanjanQuoted 4 lines · Sai Prakash Ranjan
Add IMEM, pil info and download mode DT nodes for SC7180 SoC which will help in the post-mortem debug.
Applied, thanks!
[3/3] arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
commit: ede638c42c82b1e6648a3c6ac71aaf088ff830e2
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>