public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 3/3] arm64: reduce trampoline data alignment
@ 2020-03-16 12:40 Rémi Denis-Courmont
  2020-03-17 22:34 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2020-03-16 12:40 UTC (permalink / raw)
  To: catalin.marinas, will, linux-arm-kernel; +Cc: mark.rutland, linux-kernel

From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>

The trampoline data, currently consisting of two relocated pointers,
must be within a single page. However, there are no needs for it to
start a page.

This reduces the alignment to 16 bytes (with SDEI) or 8 bytes (without
SDEI), which is sufficient to ensure that the data is entirely within a
single page of the fixmap.

Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
---
 arch/arm64/kernel/entry.S | 4 ++--
 arch/arm64/mm/mmu.c       | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index af17fcb4aaea..b648f9fe1e33 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -858,12 +858,12 @@ SYM_CODE_END(tramp_exit_compat)
 	.popsection				// .entry.tramp.text
 #ifdef CONFIG_RANDOMIZE_BASE
 	.pushsection ".rodata", "a"
-	.align PAGE_SHIFT
 #ifdef CONFIG_ARM_SDE_INTERFACE
+	.align	4	// all .rodata must be in a single fixmap page
 SYM_DATA_START(__sdei_asm_trampoline_next_handler)
 	.quad	__sdei_asm_handler
 SYM_DATA_END(__sdei_asm_trampoline_next_handler)
-#endif
+#endif /* CONFIG_ARM_SDE_INTERFACE */
 SYM_DATA_START(__entry_tramp_data_start)
 	.quad	vectors
 SYM_DATA_END(__entry_tramp_data_start)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9b08f7c7e6f0..6a0e75f48e7b 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -599,9 +599,8 @@ static int __init map_entry_trampoline(void)
 	if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
 		extern char __entry_tramp_data_start[];
 
-		__set_fixmap(FIX_ENTRY_TRAMP_DATA,
-			     __pa_symbol(__entry_tramp_data_start),
-			     PAGE_KERNEL_RO);
+		pa_start = __pa_symbol(__entry_tramp_data_start) & PAGE_MASK;
+		__set_fixmap(FIX_ENTRY_TRAMP_DATA, pa_start, PAGE_KERNEL_RO);
 	}
 
 	return 0;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCHv3 0/3] clean up KPTI / SDEI trampoline data alignment
@ 2020-03-19  9:12 Rémi Denis-Courmont
  2020-03-19  9:14 ` [PATCH 3/3] arm64: reduce " Rémi Denis-Courmont
  0 siblings, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2020-03-19  9:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, linux-arm-kernel
  Cc: Mark Rutland, James Morse, linux-kernel

	Hi,

The KPTI and SDE trampolines each load a pointer from the same fixmap data
page. This reduces the data alignment to the useful value, and tries to
clarify the assembler code.

Changes since v2:
- Retain alignment even when SDEI is disabled to keep ld happy.

----------------------------------------------------------------
Rémi Denis-Courmont (3):
      arm64: clean up trampoline vector loads
      arm64/sdei: gather trampolines' .rodata
      arm64: reduce trampoline data alignment

 arch/arm64/kernel/entry.S | 23 ++++++++++-------------
 arch/arm64/mm/mmu.c       |  5 ++---
 2 files changed, 12 insertions(+), 16 deletions(-)

-- 
Реми Дёни-Курмон
http://www.remlab.net/




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-23 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16 12:40 [PATCH 3/3] arm64: reduce trampoline data alignment Rémi Denis-Courmont
2020-03-17 22:34 ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2020-03-19  9:12 [PATCHv3 0/3] clean up KPTI / SDEI " Rémi Denis-Courmont
2020-03-19  9:14 ` [PATCH 3/3] arm64: reduce " Rémi Denis-Courmont
2020-03-21 13:40   ` Catalin Marinas
2020-03-23 11:58     ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox