All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1
@ 2021-10-26  3:48 Reiji Watanabe
  2021-10-26  9:06 ` Catalin Marinas
  2021-10-26 11:22 ` Robin Murphy
  0 siblings, 2 replies; 10+ messages in thread
From: Reiji Watanabe @ 2021-10-26  3:48 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Marc Zyngier, linux-arm-kernel, Peter Shier, Ricardo Koller,
	Oliver Upton, Jing Zhang, Raghavendra Rao Anata, Reiji Watanabe

Currently, clear_page() uses DC ZVA instruction unconditionally.  But it
should make sure that DCZID_EL0.DZP, which indicates whether or not use
of DC ZVA instruction is prohibited, is zero when using the instruction.
Use stp as memset does instead when DCZID_EL0.DZP == 1.

Signed-off-by: Reiji Watanabe <reijiw@google.com>
---
 arch/arm64/lib/clear_page.S | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/lib/clear_page.S b/arch/arm64/lib/clear_page.S
index b84b179edba3..7ce1bfa4081c 100644
--- a/arch/arm64/lib/clear_page.S
+++ b/arch/arm64/lib/clear_page.S
@@ -16,6 +16,7 @@
  */
 SYM_FUNC_START_PI(clear_page)
 	mrs	x1, dczid_el0
+	tbnz	x1, #4, 2f	/* Branch if DC GVA is prohibited */
 	and	w1, w1, #0xf
 	mov	x2, #4
 	lsl	x1, x2, x1
@@ -25,5 +26,15 @@ SYM_FUNC_START_PI(clear_page)
 	tst	x0, #(PAGE_SIZE - 1)
 	b.ne	1b
 	ret
+
+2:	mov	x1, #(PAGE_SIZE)
+	sub	x0, x0, #16	/* Pre-bias. */
+3:	stp	xzr, xzr, [x0, #16]
+	stp	xzr, xzr, [x0, #32]
+	stp	xzr, xzr, [x0, #48]
+	stp	xzr, xzr, [x0, #64]!
+	subs	x1, x1, #64
+	b.gt	3b
+	ret
 SYM_FUNC_END_PI(clear_page)
 EXPORT_SYMBOL(clear_page)
-- 
2.33.0.1079.g6e70778dc9-goog


_______________________________________________
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] 10+ messages in thread

end of thread, other threads:[~2021-10-28  9:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26  3:48 [PATCH] arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1 Reiji Watanabe
2021-10-26  9:06 ` Catalin Marinas
2021-10-27  1:35   ` Reiji Watanabe
2021-10-26 11:22 ` Robin Murphy
2021-10-26 12:23   ` Mark Rutland
2021-10-27  6:44     ` Reiji Watanabe
2021-10-27 11:09       ` Mark Rutland
2021-10-28  1:49         ` Reiji Watanabe
2021-10-28  7:46         ` Will Deacon
2021-10-28  9:03           ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.