mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-04-03 12:05:13 +02:00
commitbf74bb73cdupstream. Currently, LPA2 kernel support implies support for up to 52 bits of physical addressing, and this is reflected in global definitions such as PHYS_MASK_SHIFT and MAX_PHYSMEM_BITS. This is potentially problematic, given that LPA2 hardware support is modeled as a CPU feature which can be overridden, and with LPA2 hardware support turned off, attempting to map physical regions with address bits [51:48] set (which may exist on LPA2 capable systems booting with arm64.nolva) will result in corrupted mappings with a truncated output address and bogus shareability attributes. This means that the accepted physical address range in the mapping routines should be at most 48 bits wide when LPA2 support is configured but not enabled at runtime. Fixes:352b0395b5("arm64: Enable 52-bit virtual addressing for 4k and 16k granule configs") Cc: stable@vger.kernel.org Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241212081841.2168124-9-ardb+git@google.com Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 lines
747 B
C
33 lines
747 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*/
|
|
#ifndef __ASM_SPARSEMEM_H
|
|
#define __ASM_SPARSEMEM_H
|
|
|
|
#include <asm/pgtable-prot.h>
|
|
|
|
#define MAX_PHYSMEM_BITS PHYS_MASK_SHIFT
|
|
#define MAX_POSSIBLE_PHYSMEM_BITS (52)
|
|
|
|
/*
|
|
* Section size must be at least 512MB for 64K base
|
|
* page size config. Otherwise it will be less than
|
|
* MAX_PAGE_ORDER and the build process will fail.
|
|
*/
|
|
#ifdef CONFIG_ARM64_64K_PAGES
|
|
#define SECTION_SIZE_BITS 29
|
|
|
|
#else
|
|
|
|
/*
|
|
* Section size must be at least 128MB for 4K base
|
|
* page size config. Otherwise PMD based huge page
|
|
* entries could not be created for vmemmap mappings.
|
|
* 16K follows 4K for simplicity.
|
|
*/
|
|
#define SECTION_SIZE_BITS 27
|
|
#endif /* CONFIG_ARM64_64K_PAGES */
|
|
|
|
#endif
|