184c57dbdSJames Morse // SPDX-License-Identifier: GPL-2.0 284c57dbdSJames Morse /* 384c57dbdSJames Morse * Copyright (C) Linaro. 484c57dbdSJames Morse * Copyright (C) Huawei Futurewei Technologies. 584c57dbdSJames Morse */ 684c57dbdSJames Morse 784c57dbdSJames Morse #include <linux/crash_core.h> 8203b1152SAmit Daniel Kachhap #include <asm/cpufeature.h> 984c57dbdSJames Morse #include <asm/memory.h> 10bbdbc118SBhupesh Sharma #include <asm/pgtable-hwdef.h> 11bbdbc118SBhupesh Sharma 12bbdbc118SBhupesh Sharma static inline u64 get_tcr_el1_t1sz(void); 13bbdbc118SBhupesh Sharma 14bbdbc118SBhupesh Sharma static inline u64 get_tcr_el1_t1sz(void) 15bbdbc118SBhupesh Sharma { 16bbdbc118SBhupesh Sharma return (read_sysreg(tcr_el1) & TCR_T1SZ_MASK) >> TCR_T1SZ_OFFSET; 17bbdbc118SBhupesh Sharma } 1884c57dbdSJames Morse 1984c57dbdSJames Morse void arch_crash_save_vmcoreinfo(void) 2084c57dbdSJames Morse { 2184c57dbdSJames Morse VMCOREINFO_NUMBER(VA_BITS); 2284c57dbdSJames Morse /* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */ 2384c57dbdSJames Morse vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n", 2484c57dbdSJames Morse kimage_voffset); 2584c57dbdSJames Morse vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n", 2684c57dbdSJames Morse PHYS_OFFSET); 27bbdbc118SBhupesh Sharma vmcoreinfo_append_str("NUMBER(TCR_EL1_T1SZ)=0x%llx\n", 28bbdbc118SBhupesh Sharma get_tcr_el1_t1sz()); 2984c57dbdSJames Morse vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); 30203b1152SAmit Daniel Kachhap vmcoreinfo_append_str("NUMBER(KERNELPACMASK)=0x%llx\n", 31203b1152SAmit Daniel Kachhap system_supports_address_auth() ? 32203b1152SAmit Daniel Kachhap ptrauth_kernel_pac_mask() : 0); 3384c57dbdSJames Morse } 34