Thread (10 messages) 10 messages, 3 authors, 2016-09-29
STALE3545d

[RFC PATCH 1/3] efi/arm64: add SIMD stash/unstash operations

From: Ard Biesheuvel <hidden>
Date: 2016-09-22 11:30:04
Also in: linux-efi
Subsystem: arm64 port (aarch64 architecture), extensible firmware interface (efi), the rest · Maintainers: Catalin Marinas, Will Deacon, Ard Biesheuvel, Linus Torvalds

This adds the SIMD stash/unstash operations that we need to allow UEFI
runtime services calls to call back into the kernel.

The UEFI bindings for arm64 stipulate that the ordinary AAPCS rules apply,
which means that code may use FP/NEON registers, and may also expect that
the values of the callee saved registers q8 - q15 are preserved across
function calls.

Signed-off-by: Ard Biesheuvel <redacted>
---
 arch/arm64/include/asm/efi.h | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index a9e54aad15ef..d6bbbcba9820 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -81,4 +81,37 @@ static inline void efi_set_pgd(struct mm_struct *mm)
 void efi_virtmap_load(void);
 void efi_virtmap_unload(void);
 
+struct efi_simd_reg_stash {
+	u8	q8[16];
+	u8	q9[16];
+	u8	q10[16];
+	u8	q11[16];
+	u8	q12[16];
+	u8	q13[16];
+	u8	q14[16];
+	u8	q15[16];
+};
+
+static inline void arch_efi_stash_simd_regs(struct efi_simd_reg_stash *stash)
+{
+	asm(	"stp	q8,  q9,  [%1];"
+		"stp	q10, q11, [%1, #32];"
+		"stp	q12, q13, [%1, #64];"
+		"stp	q14, q15, [%1, #96];"
+
+		: "=m"(*stash)
+		: "r"(stash));
+}
+
+static inline void arch_efi_unstash_simd_regs(struct efi_simd_reg_stash *stash)
+{
+	asm(	"ldp	q8,  q9,  [%1];"
+		"ldp	q10, q11, [%1, #32];"
+		"ldp	q12, q13, [%1, #64];"
+		"ldp	q14, q15, [%1, #96];"
+
+		:
+		: "m"(*stash), "r"(stash));
+}
+
 #endif /* _ASM_EFI_H */
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help