linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/3] efi/arm64: add SIMD stash/unstash operations
Date: Thu, 22 Sep 2016 12:30:04 +0100	[thread overview]
Message-ID: <1474543806-19210-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1474543806-19210-1-git-send-email-ard.biesheuvel@linaro.org>

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 <ard.biesheuvel@linaro.org>
---
 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

  reply	other threads:[~2016-09-22 11:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 11:30 [RFC PATCH 0/3] efi: MMC proxy support for the UEFI varstore Ard Biesheuvel
2016-09-22 11:30 ` Ard Biesheuvel [this message]
2016-09-22 11:30 ` [RFC PATCH 2/3] efi/arm: add SIMD stash/unstash operations Ard Biesheuvel
2016-09-22 11:30 ` [RFC PATCH 3/3] efi: implement MMC proxy support for the UEFI variable store Ard Biesheuvel
2016-09-22 12:58 ` [RFC PATCH 0/3] efi: MMC proxy support for the UEFI varstore Mark Rutland
2016-09-22 13:37   ` Ard Biesheuvel
2016-09-23  9:19     ` Mark Rutland
2016-09-26 15:53   ` Mark Rutland
2016-09-28 23:54 ` Arnd Bergmann
2016-09-29  0:13   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474543806-19210-2-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).