[PATCH 1/3] x86: Remove native_set_iopl_mask()

From: Brian Gerst
Date: Wed Jun 14 2017 - 08:41:09 EST


On native hardware, IRET and POPF will correctly restore the IOPL bits.
This was left over from when the SYSEXIT path did not restore the user
flags with POPF.

Signed-off-by: Brian Gerst <brgerst@xxxxxxxxx>
---
arch/x86/include/asm/processor.h | 21 +--------------------
arch/x86/kernel/paravirt.c | 2 +-
2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 3cada99..06c4795 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -482,25 +482,6 @@ struct thread_struct {
*/
#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/

-/*
- * Set IOPL bits in EFLAGS from given mask
- */
-static inline void native_set_iopl_mask(unsigned mask)
-{
-#ifdef CONFIG_X86_32
- unsigned int reg;
-
- asm volatile ("pushfl;"
- "popl %0;"
- "andl %1, %0;"
- "orl %2, %0;"
- "pushl %0;"
- "popfl"
- : "=&r" (reg)
- : "i" (~X86_EFLAGS_IOPL), "r" (mask));
-#endif
-}
-
static inline void
native_load_sp0(struct tss_struct *tss, struct thread_struct *thread)
{
@@ -542,7 +523,7 @@ static inline void load_sp0(struct tss_struct *tss,
native_load_sp0(tss, thread);
}

-#define set_iopl_mask native_set_iopl_mask
+static inline void set_iopl_mask(unsigned mask) { }
#endif /* CONFIG_PARAVIRT */

/* Free all resources held by a thread. */
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 3586996..1d50eb5 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -367,7 +367,7 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
.iret = native_iret,
.swapgs = native_swapgs,

- .set_iopl_mask = native_set_iopl_mask,
+ .set_iopl_mask = paravirt_nop,
.io_delay = native_io_delay,

.start_context_switch = paravirt_nop,
--
2.9.4