]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm64: Expose the end of the linear map in PHYSMEM_END
authorD Scott Phillips <scott@os.amperecomputing.com>
Tue, 3 Sep 2024 16:45:32 +0000 (09:45 -0700)
committerWill Deacon <will@kernel.org>
Wed, 4 Sep 2024 15:39:58 +0000 (16:39 +0100)
The memory hot-plug and resource management code needs to know the
largest address which can fit in the linear map, so set PHYSMEM_END for
that purpose.

This fixes a crash at boot when amdgpu tries to create
DEVICE_PRIVATE_MEMORY and is given a physical address by the resource
management code which is outside the range which can have a `struct
page`

 | Unable to handle kernel paging request at virtual address 000001ffa6000034
 | user pgtable: 4k pages, 48-bit VAs, pgdp=000008000287c000
 | [000001ffa6000034] pgd=0000000000000000, p4d=0000000000000000
 | Call trace:
 |  __init_zone_device_page.constprop.0+0x2c/0xa8
 |  memmap_init_zone_device+0xf0/0x210
 |  pagemap_range+0x1e0/0x410
 |  memremap_pages+0x18c/0x2e0
 |  devm_memremap_pages+0x30/0x90
 |  kgd2kfd_init_zone_device+0xf0/0x200 [amdgpu]
 |  amdgpu_device_ip_init+0x674/0x888 [amdgpu]
 |  amdgpu_device_init+0x7a4/0xea0 [amdgpu]
 |  amdgpu_driver_load_kms+0x28/0x1c0 [amdgpu]
 |  amdgpu_pci_probe+0x1a0/0x560 [amdgpu]

Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
Link: https://lore.kernel.org/r/20240903164532.3874988-1-scott@os.amperecomputing.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/memory.h

index 54fb014eba058220257766d195c683fa30a98522..0480c61dbb4f30f592cdd27f08a51ff01bd940b2 100644 (file)
 #define PAGE_END               (_PAGE_END(VA_BITS_MIN))
 #endif /* CONFIG_KASAN */
 
+#define PHYSMEM_END            __pa(PAGE_END - 1)
+
 #define MIN_THREAD_SHIFT       (14 + KASAN_THREAD_SHIFT)
 
 /*