Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599AbdFNMql (ORCPT ); Wed, 14 Jun 2017 08:46:41 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:35116 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbdFNMlA (ORCPT ); Wed, 14 Jun 2017 08:41:00 -0400 From: Brian Gerst To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Juergen Gross , Boris Ostrovsky Subject: [PATCH 2/3] x86-32: Simplify IOPL switch check Date: Wed, 14 Jun 2017 08:40:31 -0400 Message-Id: <20170614124032.4159-3-brgerst@gmail.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614124032.4159-1-brgerst@gmail.com> References: <20170614124032.4159-1-brgerst@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1384 Lines: 40 Remove the get_kernel_rpl() call from the test for switching IOPL. Instead make set_iopl_mask() a no-op when Xen is running in supervisor mode. Signed-off-by: Brian Gerst --- arch/x86/kernel/process_32.c | 2 +- arch/x86/xen/enlighten_pv.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index ffeae81..b2d1f7c 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -263,7 +263,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) * is running virtualized at a non-zero CPL, the popf will * not restore flags, so it must be done in a separate step. */ - if (get_kernel_rpl() && unlikely(prev->iopl != next->iopl)) + if (unlikely(prev->iopl != next->iopl)) set_iopl_mask(next->iopl); /* diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index f33eef4..05257c0 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1350,8 +1350,10 @@ asmlinkage __visible void __init xen_start_kernel(void) #ifdef CONFIG_X86_32 pv_info.kernel_rpl = 1; - if (xen_feature(XENFEAT_supervisor_mode_kernel)) + if (xen_feature(XENFEAT_supervisor_mode_kernel)) { pv_info.kernel_rpl = 0; + pv_cpu_ops.set_iopl_mask = paravirt_nop; + } #else pv_info.kernel_rpl = 0; #endif -- 2.9.4