Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 21 Jan 2019 19:54:59 -0000 Received: from mga11.intel.com ([192.55.52.93]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gkeqY-0003N5-FW for speck@linutronix.de; Sat, 19 Jan 2019 01:50:50 +0100 From: Andi Kleen Subject: [MODERATED] [PATCH v5 20/27] MDSv5 27 Date: Fri, 18 Jan 2019 16:50:35 -0800 Message-Id: <2f46fabcaebc9c470b72112f228261ef69d2d355.1547858934.git.ak@linux.intel.com> In-Reply-To: References: In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: speck@linutronix.de Cc: Andi Kleen List-ID: Schedule a clear cpu on next kernel exit for string PIO or memcpy_from/to_io calls, when they are called in interrupts. The PIO case is likely already handled by old drivers not opting in their interrupt handlers to not clear, but let's do it just to be sure. Signed-off-by: Andi Kleen --- arch/x86/include/asm/io.h | 3 +++ include/asm-generic/io.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 686247db3106..19e2208eaa94 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -321,6 +322,7 @@ static inline void outs##bwl(int port, const void *addr, unsigned long count) \ : "+S"(addr), "+c"(count) \ : "d"(port) : "memory"); \ } \ + lazy_clear_cpu_interrupt(); \ } \ \ static inline void ins##bwl(int port, void *addr, unsigned long count) \ @@ -337,6 +339,7 @@ static inline void ins##bwl(int port, void *addr, unsigned long count) \ : "+D"(addr), "+c"(count) \ : "d"(port) : "memory"); \ } \ + lazy_clear_cpu_interrupt(); \ } BUILDIO(b, b, char) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index d356f802945a..cf58bceea042 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -14,6 +14,7 @@ #include /* I/O is all done through memory accesses */ #include /* for memset() and memcpy() */ #include +#include #ifdef CONFIG_GENERIC_IOMAP #include @@ -1115,6 +1116,7 @@ static inline void memcpy_fromio(void *buffer, size_t size) { memcpy(buffer, __io_virt(addr), size); + lazy_clear_cpu_interrupt(); } #endif @@ -1132,6 +1134,7 @@ static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, size_t size) { memcpy(__io_virt(addr), buffer, size); + lazy_clear_cpu_interrupt(); } #endif -- 2.17.2