linux-stable/arch/arm64
Ard Biesheuvel 7bc1a0f9e1 arm64: mm: use single quantity to represent the PA to VA translation
On arm64, the global variable memstart_addr represents the physical
address of PAGE_OFFSET, and so physical to virtual translations or
vice versa used to come down to simple additions or subtractions
involving the values of PAGE_OFFSET and memstart_addr.

When support for 52-bit virtual addressing was introduced, we had to
deal with PAGE_OFFSET potentially being outside of the region that
can be covered by the virtual range (as the 52-bit VA capable build
needs to be able to run on systems that are only 48-bit VA capable),
and for this reason, another translation was introduced, and recorded
in the global variable physvirt_offset.

However, if we go back to the original definition of memstart_addr,
i.e., the physical address of PAGE_OFFSET, it turns out that there is
no need for two separate translations: instead, we can simply subtract
the size of the unaddressable VA space from memstart_addr to make the
available physical memory appear in the 48-bit addressable VA region.

This simplifies things, but also fixes a bug on KASLR builds, which
may update memstart_addr later on in arm64_memblock_init(), but fails
to update vmemmap and physvirt_offset accordingly.

Fixes: 5383cc6efe ("arm64: mm: Introduce vabits_actual")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Link: https://lore.kernel.org/r/20201008153602.9467-2-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
2020-10-15 11:14:57 +01:00
..
boot arm64: dts: k3-am65: Update the RM resource types 2020-08-16 22:01:20 +01:00
configs ARM: SoC driver updates for v5.9 2020-08-03 19:30:59 -07:00
crypto crypto: arm64/gcm - use inline helper to suppress indirect calls 2020-07-09 22:14:32 +10:00
include arm64: mm: use single quantity to represent the PA to VA translation 2020-10-15 11:14:57 +01:00
kernel arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
kvm Merge branch 'for-next/mte' into for-next/core 2020-10-02 12:16:11 +01:00
lib arm64: mte: Enable swap of tagged pages 2020-09-04 12:46:07 +01:00
mm arm64: mm: use single quantity to represent the PA to VA translation 2020-10-15 11:14:57 +01:00
net bpf, arm64: Add BPF exception tables 2020-07-31 00:43:40 +02:00
xen
Kbuild
Kconfig Merge branch 'for-next/mte' into for-next/core 2020-10-02 12:16:11 +01:00
Kconfig.debug arm64: remove TEXT_OFFSET randomization 2020-06-15 13:10:59 +01:00
Kconfig.platforms ARM: new SoC support for v5.9 2020-08-03 19:38:30 -07:00
Makefile arm64: get rid of TEXT_OFFSET 2020-09-07 15:00:52 +01:00