[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190513005104.20140-1-shawn@git.icu>
Date: Sun, 12 May 2019 21:51:04 -0300
From: Shawn Landden <shawn@....icu>
To: linuxppc-dev@...ts.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org, Shawn Landden <shawn@....icu>
Subject: [PATCH RESEND] powerpc: add simd.h implementation specific to PowerPC
It is safe to do SIMD in an interrupt on PowerPC.
Only disable when there is no SIMD available
(and this is a static branch).
Tested and works with the WireGuard (Zinc) patch I wrote that needs this.
Also improves performance of the crypto subsystem that checks this.
Re-sending because this linuxppc-dev didn't seem to accept it.
Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=203571
Signed-off-by: Shawn Landden <shawn@....icu>
---
arch/powerpc/include/asm/simd.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 arch/powerpc/include/asm/simd.h
diff --git a/arch/powerpc/include/asm/simd.h b/arch/powerpc/include/asm/simd.h
new file mode 100644
index 000000000..b3fecb95a
--- /dev/null
+++ b/arch/powerpc/include/asm/simd.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#include <asm/cpu_has_feature.h>
+
+/*
+ * may_use_simd - whether it is allowable at this time to issue SIMD
+ * instructions or access the SIMD register file
+ *
+ * As documented in Chapter 6.2.1 Machine Status Save/Restore Registers
+ * of Power ISA (2.07 and 3.0), all registers are saved/restored in an interrupt.
+ */
+static inline bool may_use_simd(void)
+{
+ return !cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE);
+}
--
2.21.0.1020.gf2820cf01a
Powered by blists - more mailing lists