From patchwork Thu Sep 22 11:30:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 76743 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2542742qgf; Thu, 22 Sep 2016 04:32:45 -0700 (PDT) X-Received: by 10.66.180.111 with SMTP id dn15mr2458510pac.125.1474543965637; Thu, 22 Sep 2016 04:32:45 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w64si1717430pfb.193.2016.09.22.04.32.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 04:32:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bn2EF-0001Da-8P; Thu, 22 Sep 2016 11:31:47 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bn2DL-0000fn-7A for linux-arm-kernel@lists.infradead.org; Thu, 22 Sep 2016 11:30:53 +0000 Received: by mail-wm0-x22d.google.com with SMTP id l132so322107793wmf.0 for ; Thu, 22 Sep 2016 04:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FsC/2VlI+eL04gOMnnr/aEQXuFXfLnsNktTvhYTDuGk=; b=MdNRlSyaESIfFNpP7OHvOQs7cmfQBkek7UpsmVj4s53PvmOWaaGmwuxUv/uxuLp1bq H4QFma+iWxgUwYR6bfj57FTA69oXRRS4yPKzpFkbiwcnkfGByqAAAJqtCsaJ6x6lz+ST 7Ajeds5R80ks4Mk8O8pglYhTU5CYkmfRg3ylo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FsC/2VlI+eL04gOMnnr/aEQXuFXfLnsNktTvhYTDuGk=; b=M57AL3w358LqCv+c/8GtxEbJw6wNOhD36zQqfKnIq9Rywfpe4IWWun4QyNlXrCBQm8 yAcbbBdedNO9U0rf+2ZMhcBbe/A9YevrFxTyVe24wAEL7H0LOCw5H6bKiBn4Oa84qPSE KuDaM0Ahzl4pDJxGAmDTWSTSiMkWOQVScZ/q606HDJLS/LvpfHUuuCrJAHLVxXLEMNYh EniixGwcWmAqmuwan7A8jARWJ467VWYlUyCTBaH8h839nU7kgOpTjBTr92LvLIc7VxPW pf7stJvd8w52FbxoBOP5XalqNvBV0bFJKc+dH2AOL8aAbH0WqPczKISxm6fbf6be/j2d 7NlA== X-Gm-Message-State: AE9vXwPo2CdZsZGYe7ly2WSfgF3FXFNqAe1fuid0uJGGBcR8fHcvv9xD/MIcFfBJotZnjNVT X-Received: by 10.28.71.205 with SMTP id m74mr7222526wmi.47.1474543829431; Thu, 22 Sep 2016 04:30:29 -0700 (PDT) Received: from localhost.localdomain ([105.138.52.229]) by smtp.gmail.com with ESMTPSA id bl3sm1629143wjc.26.2016.09.22.04.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 04:30:28 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt@codeblueprint.co.uk, mark.rutland@arm.com, leif.lindholm@linaro.org Subject: [RFC PATCH 1/3] efi/arm64: add SIMD stash/unstash operations Date: Thu, 22 Sep 2016 12:30:04 +0100 Message-Id: <1474543806-19210-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474543806-19210-1-git-send-email-ard.biesheuvel@linaro.org> References: <1474543806-19210-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160922_043051_627638_9B467D90 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: glikely@secretlab.ca, john.stultz@linaro.org, haojian.zhuang@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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 --- arch/arm64/include/asm/efi.h | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 */