Commit eb67f4ff authored by Nikita Panov's avatar Nikita Panov Committed by Denis Darvish
Browse files

arm64: add support of NUMA replication for efi page tables

kunpeng inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IBOJU2



-------------------------------------------------

Acked-by: default avatarArtem Kuzin <artem.kuzin@huawei.com>
Acked-by: default avatarAlexander Grubnikov <alexander.grubnikov@huawei.com>
Acked-by: default avatarIlya Hanov <ilya.hanov@huawei-partners.com>
Acked-by: default avatarDenis Darvish <darvish.denis@huawei.com>
Signed-off-by: default avatarNikita Panov <panov.nikita@huawei.com>
parent de855d39
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -87,8 +87,6 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)

static inline unsigned long efi_get_kimg_min_align(void)
{
	extern bool efi_nokaslr;

	/*
	 * Although relocatable kernels can fix up the misalignment with
	 * respect to MIN_KIMG_ALIGN, the resulting virtual text addresses are
@@ -97,7 +95,23 @@ static inline unsigned long efi_get_kimg_min_align(void)
	 * 2M alignment if KASLR was explicitly disabled, even if it was not
	 * going to be activated to begin with.
	 */

#ifdef CONFIG_KERNEL_REPLICATION
	/* If kernel replication is enabled, the special alignment is necessary.
	 * Due to this fact for now we map kernel by huge pages even
	 * in case of KASLR enabled. Ugly but works.
	 */
#ifdef CONFIG_ARM64_4K_PAGES
	return HPAGE_SIZE;
#else
	return CONT_PTE_SIZE;
#endif

#else
	extern bool efi_nokaslr;

	return efi_nokaslr ? MIN_KIMG_ALIGN : EFI_KIMG_ALIGN;
#endif
}

#define EFI_ALLOC_ALIGN		SZ_64K
+16 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/pgtable.h>
#include <linux/numa_kernel_replication.h>

#include <asm/cacheflush.h>
#include <asm/efi.h>
@@ -49,6 +50,18 @@ device_initcall(ptdump_init);

#endif

#ifdef CONFIG_KERNEL_REPLICATION
static void populate_efi_pgd(struct mm_struct *efi_mm)
{
	int nid;

	for_each_memory_node(nid)
		memcpy(per_node_pgd(efi_mm, nid), efi_mm->pgd, PGD_SIZE);
	dsb(ishst);
	isb();
}
#endif /* CONFIG_KERNEL_REPLICATION */

static bool __init efi_virtmap_init(void)
{
	efi_memory_desc_t *md;
@@ -73,7 +86,9 @@ static bool __init efi_virtmap_init(void)
			return false;
		}
	}

#ifdef CONFIG_KERNEL_REPLICATION
	populate_efi_pgd(&efi_mm);
#endif
	if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions))
		return false;