Unverified Commit 4e06490b authored by liuzh's avatar liuzh Committed by Liu Zhehui
Browse files

haoc: fix memory recognization issue

community inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBTMTU



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

add support for large memory (more than 1TB) in HAOC-ARM64 IEE.

Fixes: 8d2e6d1b ("haoc: add support for lagre memory")
Signed-off-by: default avatarliuzh <liuzhh@zgclab.edu.cn>
parent fa8019b6
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -77,11 +77,7 @@
#define KASAN_THREAD_SHIFT	1
#else
#define KASAN_THREAD_SHIFT	0
#ifdef CONFIG_IEE
#define PAGE_END		((UL(1) << ((VA_BITS_MIN) - 2)) | PAGE_OFFSET)
#else
#define PAGE_END		(_PAGE_END(VA_BITS_MIN))
#endif
#endif /* CONFIG_KASAN */

#define MIN_THREAD_SHIFT	(14 + KASAN_THREAD_SHIFT)
+4 −0
Original line number Diff line number Diff line
@@ -217,6 +217,9 @@ void put_pages_into_iee(unsigned long addr, int order)
{
	unsigned long end = addr + (PAGE_SIZE << order);

	if (addr & IEE_OFFSET)
		return;

	/* Split the address range if needed. */
	if (order < IEE_DATA_ORDER)
		put_pages_into_iee_block(addr, order);
@@ -312,3 +315,4 @@ asmlinkage void notrace iee_bad_mode(struct pt_regs *regs, int reason,

	panic("bad mode");
}
+6 −1
Original line number Diff line number Diff line
@@ -436,13 +436,18 @@ static void __init __create_pgd_mapping_for_iee_locked(pgd_t *pgdir, phys_addr_t

	do {
		next = pgd_addr_end(addr, end);
		p4dp = p4d_offset(pgdp, addr);
		p4d = READ_ONCE(*p4dp);
		if (!p4d_none(p4d) && !(p4d_val(p4d) & PGD_APTABLE_RO)) {
			phys += next - addr;
			continue;
		}
		iee_alloc_init_pud(pgdp, addr, next, phys, prot, pgtable_alloc,
			       flags);

		/* Set APTable RO on pgd entries of IEE mappings to prevent kernel access
		 * when TCR.HPD1 == 0.
		 */
		p4dp = p4d_offset(pgdp, addr);
		p4d = READ_ONCE(*p4dp);
		__p4d_populate(p4dp, __p4d_to_phys(p4d), (PGD_APTABLE_RO | PGD_PXNTABLE |
				PGD_UXNTABLE | PUD_TYPE_TABLE));