[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH xen-4.6] xen: Remove CONFIG_X86_SUPERVISOR_MODE_KERNEL as x86_32 builds are unsupported



supervisor_mode_kernel was an x86_32-only feature which permitted a PV dom0 to
run in ring 0, but at the expense of not being able to start any domUs.

As the x86_32 Xen build has been removed from tree, removing the remaining
supervisor_mode_kernel code.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Keir Fraser <keir@xxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>

---

One complication is that PVH has reused XENFEAT_supervisor_mode_kernel with a
modified meaning, and the Linux PVH code actively uses the flag as to indicate
running as a PVH guest.

This causes an discontinuity between PVH and HVM guests, both of which run
their kernels with the PVH-taken meaning of XENFEAT_supervisor_mode_kernel.

It also means that a dom0 kernel is unable to express "PVH-only" by requiring
this feature, as a 64bit Xen will validly reject an attempt to require a
32bit-only Xen feature.

Someone with more tuits than I currently have will need to see about
untangling this as part of unifying the PVH and HVM guest types, preferably
before the ABI is declared stable.
---
 xen/arch/x86/Rules.mk        |   10 ----------
 xen/arch/x86/domain.c        |    3 ---
 xen/arch/x86/domain_build.c  |   24 ++++++------------------
 xen/common/domctl.c          |    3 +--
 xen/common/kernel.c          |    2 --
 xen/include/asm-arm/config.h |    2 --
 xen/include/asm-x86/config.h |    6 ------
 xen/include/asm-x86/desc.h   |   10 ----------
 8 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 6775cb5..ef8c222 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -15,12 +15,6 @@ HAS_GDBSX := y
 HAS_PDX := y
 xenoprof := y
 
-#
-# If you change any of these configuration options then you must
-# 'make clean' before rebuilding.
-#
-supervisor_mode_kernel ?= n
-
 CFLAGS += -I$(BASEDIR)/include 
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
@@ -34,10 +28,6 @@ $(call as-insn-check,CFLAGS,CC,"vmcall",-DHAVE_GAS_VMX)
 $(call as-insn-check,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_GAS_EPT)
 $(call as-insn-check,CFLAGS,CC,"rdfsbase %rax",-DHAVE_GAS_FSGSBASE)
 
-ifeq ($(supervisor_mode_kernel),y)
-CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
-endif
-
 x86 := y
 x86_32 := n
 x86_64 := y
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 11c7d9f..b699510 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1726,9 +1726,6 @@ unsigned long hypercall_create_continuation(
         }
         else
         {
-            if ( supervisor_mode_kernel )
-                regs->eip &= ~31; /* re-execute entire hypercall entry stub */
-
             for ( i = 0; *p != '\0'; i++ )
             {
                 arg = next_arg(p, args);
diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
index 7993b17..7a912e9 100644
--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -1410,24 +1410,12 @@ int __init construct_dom0(
             paging_update_paging_modes(v);
     }
 
-    if ( supervisor_mode_kernel )
-    {
-        v->arch.pv_vcpu.kernel_ss &= ~3;
-        v->arch.user_regs.ss &= ~3;
-        v->arch.user_regs.es &= ~3;
-        v->arch.user_regs.ds &= ~3;
-        v->arch.user_regs.fs &= ~3;
-        v->arch.user_regs.gs &= ~3;
-        printk("Dom0 runs in ring 0 (supervisor mode)\n");
-        if ( !test_bit(XENFEAT_supervisor_mode_kernel,
-                       parms.f_supported) )
-            panic("Dom0 does not support supervisor-mode execution");
-    }
-    else
-    {
-        if ( test_bit(XENFEAT_supervisor_mode_kernel, parms.f_required) )
-            panic("Dom0 requires supervisor-mode execution");
-    }
+    /*
+     * PVH Fixme: XENFEAT_supervisor_mode_kernel has been reused in PVH with a
+     * different meaning.
+     */
+    if ( test_bit(XENFEAT_supervisor_mode_kernel, parms.f_required) )
+        panic("Dom0 requires supervisor-mode execution");
 
     rc = 0;
 
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index f15dcfe..edadf74 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -534,8 +534,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
         unsigned int domcr_flags;
 
         ret = -EINVAL;
-        if ( supervisor_mode_kernel ||
-             (op->u.createdomain.flags &
+        if ( (op->u.createdomain.flags &
              ~(XEN_DOMCTL_CDF_hvm_guest
                | XEN_DOMCTL_CDF_pvh_guest
                | XEN_DOMCTL_CDF_hap
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d23c422..0d9e519 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -308,8 +308,6 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                 fi.submap |= 
                     (1U << XENFEAT_writable_page_tables) |
                     (1U << XENFEAT_auto_translated_physmap);
-            if ( supervisor_mode_kernel )
-                fi.submap |= 1U << XENFEAT_supervisor_mode_kernel;
             if ( is_hardware_domain(current->domain) )
                 fi.submap |= 1U << XENFEAT_dom0;
 #ifdef CONFIG_X86
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 264e2c1..9e165db 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -196,8 +196,6 @@ extern unsigned long xenheap_phys_end;
 extern unsigned long frametable_virt_end;
 #endif
 
-#define supervisor_mode_kernel (0)
-
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 3802721..ad52d5b 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -70,12 +70,6 @@
 /* Maximum we can support with current vLAPIC ID mapping. */
 #define MAX_HVM_VCPUS 128
 
-#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
-# define supervisor_mode_kernel (1)
-#else
-# define supervisor_mode_kernel (0)
-#endif
-
 /* Linkage for x86 */
 #define __ALIGN .align 16,0x90
 #define __ALIGN_STR ".align 16,0x90"
diff --git a/xen/include/asm-x86/desc.h b/xen/include/asm-x86/desc.h
index 225913a..20c47d2 100644
--- a/xen/include/asm-x86/desc.h
+++ b/xen/include/asm-x86/desc.h
@@ -47,17 +47,7 @@
     (sel) = (((sel) & 3) >= _rpl) ? (sel) : (((sel) & ~3) | _rpl); \
 })
 
-/* Stack selectors don't need fixing up if the kernel runs in ring 0. */
-#ifdef CONFIG_X86_SUPERVISOR_MODE_KERNEL
-#define fixup_guest_stack_selector(d, ss) ((void)0)
-#else
 #define fixup_guest_stack_selector(d, ss) __fixup_guest_selector(d, ss)
-#endif
-
-/*
- * Code selectors are always fixed up. It allows the Xen exit stub to detect
- * return to guest context, even when the guest kernel runs in ring 0.
- */
 #define fixup_guest_code_selector(d, cs)  __fixup_guest_selector(d, cs)
 
 /*
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.