From: Peng Liu liupeng256@huawei.com
hulk inclusion category: bugfix bugzilla: 175103 https://gitee.com/openeuler/kernel/issues/I4DDEL
-------------------------------------------------
Patch "arm64: mm: account for hotplug memory when randomizing the linear region" will skip randomizing of memstart_addr when VA less than PA. For example, when VA=39bit and PA=48bit, range will be negtive and will skip randomizing of memstart_addr. This problem is also exist in linux master. To solve this problem, revert this patch temporarily. This reverts commit 2e7257c3a2d18a193737bc8bd0788b9c70244b9f. Signed-off-by: Peng Liu liupeng256@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com
Signed-off-by: Chen Jun chenjun102@huawei.com --- arch/arm64/mm/init.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 2da4cee7f3a3..3b9401ee9c58 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -575,18 +575,15 @@ void __init arm64_memblock_init(void)
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { extern u16 memstart_offset_seed; - u64 mmfr0 = read_cpuid(ID_AA64MMFR0_EL1); - int parange = cpuid_feature_extract_unsigned_field( - mmfr0, ID_AA64MMFR0_PARANGE_SHIFT); - s64 range = linear_region_size - - BIT(id_aa64mmfr0_parange_to_phys_shift(parange)); + u64 range = linear_region_size - + (memblock_end_of_DRAM() - memblock_start_of_DRAM());
/* * If the size of the linear region exceeds, by a sufficient - * margin, the size of the region that the physical memory can - * span, randomize the linear region as well. + * margin, the size of the region that the available physical + * memory spans, randomize the linear region as well. */ - if (memstart_offset_seed > 0 && range >= (s64)ARM64_MEMSTART_ALIGN) { + if (memstart_offset_seed > 0 && range >= ARM64_MEMSTART_ALIGN) { range /= ARM64_MEMSTART_ALIGN; memstart_addr -= ARM64_MEMSTART_ALIGN * ((range * memstart_offset_seed) >> 16);