FROMLIST: KVM: arm64: Page-align the .hyp sections
We will soon unmap the .hyp sections from the host stage 2 in Protected nVHE mode, which obviously works with at least page granularity, so make sure to align them correctly. Acked-by: Will Deacon <will@kernel.org> Signed-off-by: Quentin Perret <qperret@google.com> Link: https://lore.kernel.org/r/20210315143536.214621-35-qperret@google.com Bug: 178098380 Change-Id: Ia631ed37a9cc66d83604fa84f901706800529a94
This commit is contained in:
@@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
#define HYPERVISOR_DATA_SECTIONS \
|
#define HYPERVISOR_DATA_SECTIONS \
|
||||||
HYP_SECTION_NAME(.rodata) : { \
|
HYP_SECTION_NAME(.rodata) : { \
|
||||||
|
. = ALIGN(PAGE_SIZE); \
|
||||||
__hyp_rodata_start = .; \
|
__hyp_rodata_start = .; \
|
||||||
*(HYP_SECTION_NAME(.data..ro_after_init)) \
|
*(HYP_SECTION_NAME(.data..ro_after_init)) \
|
||||||
*(HYP_SECTION_NAME(.rodata)) \
|
*(HYP_SECTION_NAME(.rodata)) \
|
||||||
|
. = ALIGN(PAGE_SIZE); \
|
||||||
__hyp_rodata_end = .; \
|
__hyp_rodata_end = .; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,21 +74,14 @@ ENTRY(_text)
|
|||||||
jiffies = jiffies_64;
|
jiffies = jiffies_64;
|
||||||
|
|
||||||
#define HYPERVISOR_TEXT \
|
#define HYPERVISOR_TEXT \
|
||||||
/* \
|
. = ALIGN(PAGE_SIZE); \
|
||||||
* Align to 4 KB so that \
|
|
||||||
* a) the HYP vector table is at its minimum \
|
|
||||||
* alignment of 2048 bytes \
|
|
||||||
* b) the HYP init code will not cross a page \
|
|
||||||
* boundary if its size does not exceed \
|
|
||||||
* 4 KB (see related ASSERT() below) \
|
|
||||||
*/ \
|
|
||||||
. = ALIGN(SZ_4K); \
|
|
||||||
__hyp_idmap_text_start = .; \
|
__hyp_idmap_text_start = .; \
|
||||||
*(.hyp.idmap.text) \
|
*(.hyp.idmap.text) \
|
||||||
__hyp_idmap_text_end = .; \
|
__hyp_idmap_text_end = .; \
|
||||||
__hyp_text_start = .; \
|
__hyp_text_start = .; \
|
||||||
*(.hyp.text) \
|
*(.hyp.text) \
|
||||||
HYPERVISOR_EXTABLE \
|
HYPERVISOR_EXTABLE \
|
||||||
|
. = ALIGN(PAGE_SIZE); \
|
||||||
__hyp_text_end = .;
|
__hyp_text_end = .;
|
||||||
|
|
||||||
#define IDMAP_TEXT \
|
#define IDMAP_TEXT \
|
||||||
@@ -324,11 +319,12 @@ SECTIONS
|
|||||||
#include "image-vars.h"
|
#include "image-vars.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The HYP init code and ID map text can't be longer than a page each,
|
* The HYP init code and ID map text can't be longer than a page each. The
|
||||||
* and should not cross a page boundary.
|
* former is page-aligned, but the latter may not be with 16K or 64K pages, so
|
||||||
|
* it should also not cross a page boundary.
|
||||||
*/
|
*/
|
||||||
ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
|
ASSERT(__hyp_idmap_text_end - __hyp_idmap_text_start <= PAGE_SIZE,
|
||||||
"HYP init code too big or misaligned")
|
"HYP init code too big")
|
||||||
ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
|
ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
|
||||||
"ID map text too big or misaligned")
|
"ID map text too big or misaligned")
|
||||||
#ifdef CONFIG_HIBERNATION
|
#ifdef CONFIG_HIBERNATION
|
||||||
|
Reference in New Issue
Block a user