From e300a993d8831df294dbcafa6f3fe4e5fc6eed97 Mon Sep 17 00:00:00 2001 From: Sean Khan Date: Sun, 9 Jun 2024 23:54:37 -0400 Subject: [PATCH] qualcommax: add ramoops memory region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for allocating reserved memory for ramoops. This is required to get PSTORE option working. Tested with the following options: ``` CONFIG_PACKAGE_kmod-pstore=y CONFIG_PACKAGE_kmod-ramoops=y CONFIG_PACKAGE_kmod-reed-solomon=y ``` dmesg output ``` ➤ dmesg | grep -Ei "psto|ramo" [Sun Jun 9 23:22:01 2024] OF: reserved mem: 0x0000000051200000..0x00000000512fffff (1024 KiB) map non-reusable ramoops@51200000 [Sun Jun 9 23:22:05 2024] pstore: Using crash dump compression: deflate [Sun Jun 9 23:22:05 2024] pstore: Registered ramoops as persistent store backend [Sun Jun 9 23:22:05 2024] ramoops: using 0x100000@0x51200000, ecc: 0 ``` Triggering kernel panic ``` sh -c 'echo 10 > /proc/sys/kernel/panic; echo c > /proc/sysrq-trigger' ``` After rebooting ``` mkdir -p /tmp/ramoops mount -t pstore pstore /tmp/ramoops ``` ``` ➤ l /tmp/ramoops drwxr-x--- 2 root root 0 Jun 9 23:02 . drwxr-xr-x 8 root root 4.0K Jun 9 23:23 .. -r--r--r-- 1 root root 6.6K Jun 9 23:21 dmesg-ramoops-0 ``` Truncated output ``` Panic#1 Part1 <6>[ 21.656119] remoteproc remoteproc0: remote processor cd00000.q6v5_wcss is now up <14>[ 21.657910] kmodloader: done loading kernel modules from /etc/modules.d/* <6>[ 21.710545] ath11k c000000.wifi: chip_id 0x0 chip_family 0x0 board_id 0xff soc_id 0xffffffff <6>[ 21.710594] ath11k c000000.wifi: fw_version 0x270204a5 fw_build_timestamp 2022-08-04 13:05 fw_build_id WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 <6>[ 91.416867] br-lan: topology change detected, sending tcn bpdu <6>[ 1256.023874] sysrq: Trigger a crash <0>[ 1256.023911] Kernel panic - not syncing: sysrq triggered crash <4>[ 1256.026176] CPU: 2 PID: 2842 Comm: sh Tainted: G O 6.6.32 #0 <4>[ 1256.031993] Hardware name: Linksys MX5300 (DT) <4>[ 1256.039106] Call trace: <4>[ 1256.043354] dump_backtrace+0xb0/0x10c <4>[ 1256.045701] show_stack+0x18/0x24 <4>[ 1256.049519] dump_stack_lvl+0x48/0x60 <4>[ 1256.052906] dump_stack+0x18/0x24 <4>[ 1256.056550] panic+0x2d0/0x31c <4>[ 1256.059848] sysrq_handle_moom+0x0/0x30 <4>[ 1256.062800] __handle_sysrq+0xe4/0x1e0 <4>[ 1256.066534] write_sysrq_trigger+0xbc/0xfc <4>[ 1256.070354] proc_reg_write+0xb0/0xf8 <4>[ 1256.074434] vfs_write+0xa4/0x298 <4>[ 1256.078165] ksys_write+0x5c/0xe0 <4>[ 1256.081464] __arm64_sys_write+0x1c/0x28 <4>[ 1256.084763] invoke_syscall.constprop.0+0x5c/0x100 <4>[ 1256.088758] do_el0_svc+0x40/0xc8 <4>[ 1256.093355] el0_svc+0x30/0xb8 <4>[ 1256.096740] el0t_64_sync_handler+0x120/0x12c <4>[ 1256.099694] el0t_64_sync+0x178/0x17c <2>[ 1256.104122] SMP: stopping secondary CPUs <0>[ 1256.107773] Kernel Offset: disabled <0>[ 1256.111759] CPU features: 0x0,00000000,00000000,0000400b <0>[ 1256.114975] Memory Limit: none ``` Signed-off-by: Sean Khan --- ...1-arm64-dts-qcom-ipq8074-add-ramoops.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 target/linux/qualcommax/patches-6.6/0911-arm64-dts-qcom-ipq8074-add-ramoops.patch diff --git a/target/linux/qualcommax/patches-6.6/0911-arm64-dts-qcom-ipq8074-add-ramoops.patch b/target/linux/qualcommax/patches-6.6/0911-arm64-dts-qcom-ipq8074-add-ramoops.patch new file mode 100644 index 00000000000000..419a88cdf99a00 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0911-arm64-dts-qcom-ipq8074-add-ramoops.patch @@ -0,0 +1,25 @@ +--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +@@ -198,6 +198,12 @@ + no-map; + reg = <0x0 0x51000000 0x0 0x100000>; + }; ++ ++ ramoops_region: ramoops@51200000 { ++ compatible = "ramoops"; ++ reg = <0x0 0x51200000 0x0 0x100000>; ++ record-size = <0x1000>; ++ }; + }; + + firmware { +--- a/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi +@@ -17,3 +17,7 @@ + &m3_dump_region { + reg = <0x0 0x4e800000 0x0 0x100000>; + }; ++ ++&ramoops_region { ++ reg = <0x0 0x4e900000 0x0 0x100000>; ++};