qualcommax: add ramoops memory region

This patch adds support for allocating 1MB of reserved memory
for ramoops on IPQ807x and IPQ6018 platforms.

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 <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2024-06-09 23:54:37 -04:00
parent 768866a99f
commit e018af5fbb
4 changed files with 40 additions and 0 deletions

View File

@ -21,3 +21,7 @@
reg = <0x0 0x4ab00000 0x0 0x03700000>;
no-map;
};
&ramoops_region {
reg = <0x0 0x4e200000 0x0 0x100000>;
};

View File

@ -17,3 +17,7 @@
&m3_dump_region {
reg = <0x0 0x4e800000 0x0 0x100000>;
};
&ramoops_region {
reg = <0x0 0x4e900000 0x0 0x100000>;
};

View File

@ -0,0 +1,16 @@
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -198,6 +198,13 @@
no-map;
reg = <0x0 0x51000000 0x0 0x100000>;
};
+
+ ramoops_region: ramoops@51200000 {
+ compatible = "ramoops";
+ reg = <0x0 0x51200000 0x0 0x100000>;
+ no-map;
+ record-size = <0x1000>;
+ };
};
firmware {

View File

@ -0,0 +1,16 @@
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -223,6 +223,13 @@
reg = <0x0 0x4ab00000 0x0 0x5500000>;
no-map;
};
+
+ ramoops_region: ramoops@50000000 {
+ compatible = "ramoops";
+ reg = <0x0 0x50000000 0x0 0x100000>;
+ no-map;
+ record-size = <0x1000>;
+ };
};
smem {