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

arm64: align kernel text and rodata

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



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

In order to comply with AArch64 page table entries type -
table and block descriptor format, we need to use correct alignment
for replicated memory areas. Physical blocks allocated for replicated areas
must have the same offset for all replicas and same relative offset
to the virtual address.
For simplicity, we just use an explicit alignment for kernel sections.
If 4K pages are used,  2MB alignment should be applied.
Otherwise CONT_PTE_SIZE alignment is used.

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 15a53037
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -170,6 +170,13 @@ SECTIONS
		_text = .;
		HEAD_TEXT
	}
#ifdef CONFIG_KERNEL_REPLICATION
#ifdef CONFIG_ARM64_4K_PAGES
	. = ALIGN(PMD_SIZE);
#else
	. = ALIGN(CONT_PTE_SIZE);
#endif
#endif
	.text : ALIGN(SEGMENT_ALIGN) {	/* Real text segment		*/
		_stext = .;		/* Text and read-only data	*/
			IRQENTRY_TEXT
@@ -184,10 +191,25 @@ SECTIONS
	}

	. = ALIGN(SEGMENT_ALIGN);
#ifdef CONFIG_KERNEL_REPLICATION
#ifdef CONFIG_ARM64_4K_PAGES
	. = ALIGN(PMD_SIZE);
#else
	. = ALIGN(CONT_PTE_SIZE);
#endif
#endif
	_etext = .;			/* End of text section */

	/* everything from this point to __init_begin will be marked RO NX */
#ifdef CONFIG_KERNEL_REPLICATION
#ifdef CONFIG_ARM64_4K_PAGES
	RO_DATA(PMD_SIZE)
#else
	RO_DATA(CONT_PTE_SIZE)
#endif
#else
	RO_DATA(PAGE_SIZE)
#endif

	HYPERVISOR_DATA_SECTIONS