Skip to content

Commit 77ad4ce

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: memory: rename VA_START to PAGE_END
Prior to commit: 14c127c ("arm64: mm: Flip kernel VA space") ... VA_START described the start of the TTBR1 address space for a given VA size described by VA_BITS, where all kernel mappings began. Since that commit, VA_START described a portion midway through the address space, where the linear map ends and other kernel mappings begin. To avoid confusion, let's rename VA_START to PAGE_END, making it clear that it's not the start of the TTBR1 address space and implying that it's related to PAGE_OFFSET. Comments and other mnemonics are updated accordingly, along with a typo fix in the decription of VMEMMAP_SIZE. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Tested-by: Steve Capper <steve.capper@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent 233947e commit 77ad4ce

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

arch/arm64/include/asm/memory.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@
2828
* a struct page array
2929
*
3030
* If we are configured with a 52-bit kernel VA then our VMEMMAP_SIZE
31-
* neads to cover the memory region from the beginning of the 52-bit
32-
* PAGE_OFFSET all the way to VA_START for 48-bit. This allows us to
31+
* needs to cover the memory region from the beginning of the 52-bit
32+
* PAGE_OFFSET all the way to PAGE_END for 48-bit. This allows us to
3333
* keep a constant PAGE_OFFSET and "fallback" to using the higher end
3434
* of the VMEMMAP where 52-bit support is not available in hardware.
3535
*/
36-
#define VMEMMAP_SIZE ((_VA_START(VA_BITS_MIN) - PAGE_OFFSET) \
36+
#define VMEMMAP_SIZE ((_PAGE_END(VA_BITS_MIN) - PAGE_OFFSET) \
3737
>> (PAGE_SHIFT - STRUCT_PAGE_MAX_SHIFT))
3838

3939
/*
40-
* PAGE_OFFSET - the virtual address of the start of the linear map (top
41-
* (VA_BITS - 1))
42-
* KIMAGE_VADDR - the virtual address of the start of the kernel image
40+
* PAGE_OFFSET - the virtual address of the start of the linear map, at the
41+
* start of the TTBR1 address space.
42+
* PAGE_END - the end of the linear map, where all other kernel mappings begin.
43+
* KIMAGE_VADDR - the virtual address of the start of the kernel image.
4344
* VA_BITS - the maximum number of bits for virtual addresses.
44-
* VA_START - the first kernel virtual address.
4545
*/
4646
#define VA_BITS (CONFIG_ARM64_VA_BITS)
4747
#define _PAGE_OFFSET(va) (-(UL(1) << (va)))
@@ -64,7 +64,7 @@
6464
#define VA_BITS_MIN (VA_BITS)
6565
#endif
6666

67-
#define _VA_START(va) (-(UL(1) << ((va) - 1)))
67+
#define _PAGE_END(va) (-(UL(1) << ((va) - 1)))
6868

6969
#define KERNEL_START _text
7070
#define KERNEL_END _end
@@ -87,7 +87,7 @@
8787
#define KASAN_THREAD_SHIFT 1
8888
#else
8989
#define KASAN_THREAD_SHIFT 0
90-
#define KASAN_SHADOW_END (_VA_START(VA_BITS_MIN))
90+
#define KASAN_SHADOW_END (_PAGE_END(VA_BITS_MIN))
9191
#endif /* CONFIG_KASAN */
9292

9393
#define MIN_THREAD_SHIFT (14 + KASAN_THREAD_SHIFT)
@@ -173,7 +173,7 @@
173173

174174
#ifndef __ASSEMBLY__
175175
extern u64 vabits_actual;
176-
#define VA_START (_VA_START(vabits_actual))
176+
#define PAGE_END (_PAGE_END(vabits_actual))
177177

178178
#include <linux/bitops.h>
179179
#include <linux/mmdebug.h>

arch/arm64/include/asm/pgtable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
856856

857857
#define update_mmu_cache_pmd(vma, address, pmd) do { } while (0)
858858

859-
#define kc_vaddr_to_offset(v) ((v) & ~VA_START)
860-
#define kc_offset_to_vaddr(o) ((o) | VA_START)
859+
#define kc_vaddr_to_offset(v) ((v) & ~PAGE_END)
860+
#define kc_offset_to_vaddr(o) ((o) | PAGE_END)
861861

862862
#ifdef CONFIG_ARM64_PA_BITS_52
863863
#define phys_to_ttbr(addr) (((addr) | ((addr) >> 46)) & TTBR_BADDR_MASK_52)

arch/arm64/kernel/hibernate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ int swsusp_arch_resume(void)
496496
rc = -ENOMEM;
497497
goto out;
498498
}
499-
rc = copy_page_tables(tmp_pg_dir, PAGE_OFFSET, VA_START);
499+
rc = copy_page_tables(tmp_pg_dir, PAGE_OFFSET, PAGE_END);
500500
if (rc)
501501
goto out;
502502

arch/arm64/mm/dump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828

2929
enum address_markers_idx {
3030
PAGE_OFFSET_NR = 0,
31-
VA_START_NR,
31+
PAGE_END_NR,
3232
#ifdef CONFIG_KASAN
3333
KASAN_START_NR,
3434
#endif
3535
};
3636

3737
static struct addr_marker address_markers[] = {
3838
{ PAGE_OFFSET, "Linear Mapping start" },
39-
{ 0 /* VA_START */, "Linear Mapping end" },
39+
{ 0 /* PAGE_END */, "Linear Mapping end" },
4040
#ifdef CONFIG_KASAN
4141
{ 0 /* KASAN_SHADOW_START */, "Kasan shadow start" },
4242
{ KASAN_SHADOW_END, "Kasan shadow end" },
@@ -411,7 +411,7 @@ void ptdump_check_wx(void)
411411

412412
static int ptdump_init(void)
413413
{
414-
address_markers[VA_START_NR].start_address = VA_START;
414+
address_markers[PAGE_END_NR].start_address = PAGE_END;
415415
#ifdef CONFIG_KASAN
416416
address_markers[KASAN_START_NR].start_address = KASAN_SHADOW_START;
417417
#endif

arch/arm64/mm/kasan_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void __init kasan_init(void)
226226
kasan_map_populate(kimg_shadow_start, kimg_shadow_end,
227227
early_pfn_to_nid(virt_to_pfn(lm_alias(_text))));
228228

229-
kasan_populate_early_shadow(kasan_mem_to_shadow((void *) VA_START),
229+
kasan_populate_early_shadow(kasan_mem_to_shadow((void *)PAGE_END),
230230
(void *)mod_shadow_start);
231231
kasan_populate_early_shadow((void *)kimg_shadow_end,
232232
(void *)KASAN_SHADOW_END);

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static phys_addr_t pgd_pgtable_alloc(int shift)
399399
static void __init create_mapping_noalloc(phys_addr_t phys, unsigned long virt,
400400
phys_addr_t size, pgprot_t prot)
401401
{
402-
if ((virt >= VA_START) && (virt < VMALLOC_START)) {
402+
if ((virt >= PAGE_END) && (virt < VMALLOC_START)) {
403403
pr_warn("BUG: not creating mapping for %pa at 0x%016lx - outside kernel range\n",
404404
&phys, virt);
405405
return;
@@ -426,7 +426,7 @@ void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
426426
static void update_mapping_prot(phys_addr_t phys, unsigned long virt,
427427
phys_addr_t size, pgprot_t prot)
428428
{
429-
if ((virt >= VA_START) && (virt < VMALLOC_START)) {
429+
if ((virt >= PAGE_END) && (virt < VMALLOC_START)) {
430430
pr_warn("BUG: not updating mapping for %pa at 0x%016lx - outside kernel range\n",
431431
&phys, virt);
432432
return;

0 commit comments

Comments
 (0)