xref: /linux/arch/arm64/kernel/vmcore_info.c (revision e6a901a00822659181c93c86d8bbc2a17779fddc)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) Linaro.
4  * Copyright (C) Huawei Futurewei Technologies.
5  */
6 
7 #include <linux/vmcore_info.h>
8 #include <asm/cpufeature.h>
9 #include <asm/memory.h>
10 #include <asm/pgtable-hwdef.h>
11 #include <asm/pointer_auth.h>
12 
13 static inline u64 get_tcr_el1_t1sz(void);
14 
15 static inline u64 get_tcr_el1_t1sz(void)
16 {
17 	return (read_sysreg(tcr_el1) & TCR_T1SZ_MASK) >> TCR_T1SZ_OFFSET;
18 }
19 
20 void arch_crash_save_vmcoreinfo(void)
21 {
22 	VMCOREINFO_NUMBER(VA_BITS);
23 	/* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
24 	vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
25 	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
26 	vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
27 	vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
28 	vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
29 	vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
30 						kimage_voffset);
31 	vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
32 						PHYS_OFFSET);
33 	vmcoreinfo_append_str("NUMBER(TCR_EL1_T1SZ)=0x%llx\n",
34 						get_tcr_el1_t1sz());
35 	vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
36 	vmcoreinfo_append_str("NUMBER(KERNELPACMASK)=0x%llx\n",
37 						system_supports_address_auth() ?
38 						ptrauth_kernel_pac_mask() : 0);
39 }
40