Skip to content

Commit bbdbc11

Browse files
Bhupesh Sharmactmarinas
authored andcommitted
arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo
TCR_EL1.TxSZ, which controls the VA space size, is configured by a single kernel image to support either 48-bit or 52-bit VA space. If the ARMv8.2-LVA optional feature is present and we are running with a 64KB page size, then it is possible to use 52-bits of address space for both userspace and kernel addresses. However, any kernel binary that supports 52-bit must also be able to fall back to 48-bit at early boot time if the hardware feature is not present. Since TCR_EL1.T1SZ indicates the size of the memory region addressed by TTBR1_EL1, export the same in vmcoreinfo. User-space utilities like makedumpfile and crash-utility need to read this value from vmcoreinfo for determining if a virtual address lies in the linear map range. While at it also add documentation for TCR_EL1.T1SZ variable being added to vmcoreinfo. It indicates the size offset of the memory region addressed by TTBR1_EL1. Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> Tested-by: John Donnelly <john.p.donnelly@oracle.com> Tested-by: Kamlakant Patel <kamlakantp@marvell.com> Tested-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Reviewed-by: James Morse <james.morse@arm.com> Reviewed-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Steve Capper <steve.capper@arm.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Dave Anderson <anderson@redhat.com> Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org Link: https://lore.kernel.org/r/1589395957-24628-3-git-send-email-bhsharma@redhat.com [catalin.marinas@arm.com: removed vabits_actual from the commit log] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 1d50e5d commit bbdbc11

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

Documentation/admin-guide/kdump/vmcoreinfo.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,17 @@ KERNELPACMASK
404404
The mask to extract the Pointer Authentication Code from a kernel virtual
405405
address.
406406

407+
TCR_EL1.T1SZ
408+
------------
409+
410+
Indicates the size offset of the memory region addressed by TTBR1_EL1.
411+
The region size is 2^(64-T1SZ) bytes.
412+
413+
TTBR1_EL1 is the table base address register specified by ARMv8-A
414+
architecture which is used to lookup the page-tables for the Virtual
415+
addresses in the higher VA range (refer to ARMv8 ARM document for
416+
more details).
417+
407418
arm
408419
===
409420

arch/arm64/include/asm/pgtable-hwdef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
#define TCR_TxSZ(x) (TCR_T0SZ(x) | TCR_T1SZ(x))
217217
#define TCR_TxSZ_WIDTH 6
218218
#define TCR_T0SZ_MASK (((UL(1) << TCR_TxSZ_WIDTH) - 1) << TCR_T0SZ_OFFSET)
219+
#define TCR_T1SZ_MASK (((UL(1) << TCR_TxSZ_WIDTH) - 1) << TCR_T1SZ_OFFSET)
219220

220221
#define TCR_EPD0_SHIFT 7
221222
#define TCR_EPD0_MASK (UL(1) << TCR_EPD0_SHIFT)

arch/arm64/kernel/crash_core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
#include <linux/crash_core.h>
88
#include <asm/cpufeature.h>
99
#include <asm/memory.h>
10+
#include <asm/pgtable-hwdef.h>
11+
12+
static inline u64 get_tcr_el1_t1sz(void);
13+
14+
static inline u64 get_tcr_el1_t1sz(void)
15+
{
16+
return (read_sysreg(tcr_el1) & TCR_T1SZ_MASK) >> TCR_T1SZ_OFFSET;
17+
}
1018

1119
void arch_crash_save_vmcoreinfo(void)
1220
{
@@ -16,6 +24,8 @@ void arch_crash_save_vmcoreinfo(void)
1624
kimage_voffset);
1725
vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
1826
PHYS_OFFSET);
27+
vmcoreinfo_append_str("NUMBER(TCR_EL1_T1SZ)=0x%llx\n",
28+
get_tcr_el1_t1sz());
1929
vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
2030
vmcoreinfo_append_str("NUMBER(KERNELPACMASK)=0x%llx\n",
2131
system_supports_address_auth() ?

0 commit comments

Comments
 (0)