]> xenbits.xensource.com Git - xen.git/commitdiff
x86: Remove CONFIG_COMPAT ifdef'ery from arch/x86 -- it is always defined.
authorKeir Fraser <keir@xen.org>
Wed, 12 Sep 2012 19:21:02 +0000 (20:21 +0100)
committerKeir Fraser <keir@xen.org>
Wed, 12 Sep 2012 19:21:02 +0000 (20:21 +0100)
Signed-off-by: Keir Fraser <keir@xen.org>
13 files changed:
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/domain.c
xen/arch/x86/domctl.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/machine_kexec.c
xen/arch/x86/oprofile/xenoprof.c
xen/arch/x86/setup.c
xen/arch/x86/traps.c
xen/include/asm-x86/desc.h
xen/include/asm-x86/domain.h
xen/include/asm-x86/mm.h
xen/include/asm-x86/processor.h
xen/include/asm-x86/shared.h

index a89df6d157b02f1c4dce313bca6e7f25a3aea3c8..f60d14fd1e1affe1f6e2eb20fd8a2fab1e2b7748 100644 (file)
@@ -1299,7 +1299,6 @@ static void x86_cmci_inject(void *data)
 #error BITS_PER_LONG definition absent
 #endif
 
-#ifdef CONFIG_COMPAT
 # include <compat/arch-x86/xen-mca.h>
 
 # define xen_mcinfo_msr              mcinfo_msr
@@ -1349,12 +1348,6 @@ CHECK_mcinfo_recovery;
 # undef xen_cpu_offline_action
 # undef xen_page_offline_action
 # undef xen_mcinfo_recovery
-#else
-# define compat_mc_fetch xen_mc_fetch
-# define compat_mc_physcpuinfo xen_mc_physcpuinfo
-# define compat_handle_is_null guest_handle_is_null
-# define copy_to_compat copy_to_guest
-#endif
 
 /* Machine Check Architecture Hypercall */
 long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u_xen_mc)
index 9cd7cf4827ee60db80ac142bcf33fd1593f37701..9f9bfd3af795fbec174ddae0633fe1e1461ad143 100644 (file)
@@ -58,9 +58,7 @@
 #include <asm/amd.h>
 #include <xen/numa.h>
 #include <xen/iommu.h>
-#ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
-#endif
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 DEFINE_PER_CPU(unsigned long, cr4);
@@ -665,13 +663,11 @@ unsigned long pv_guest_cr4_fixup(const struct vcpu *v, unsigned long guest_cr4)
     return (hv_cr4 & hv_cr4_mask) | (guest_cr4 & ~hv_cr4_mask);
 }
 
-#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
-#endif
 
 /* Called by XEN_DOMCTL_setvcpucontext and VCPUOP_initialise. */
 int arch_set_info_guest(
@@ -688,11 +684,7 @@ int arch_set_info_guest(
      * we expect the tools to DTRT even in compat-mode callers. */
     compat = is_pv_32on64_domain(d);
 
-#ifdef CONFIG_COMPAT
 #define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld))
-#else
-#define c(fld) (c.nat->fld)
-#endif
     flags = c(flags);
 
     if ( !is_hvm_vcpu(v) )
@@ -724,7 +716,6 @@ int arch_set_info_guest(
                                   LDT_ENTRY_SIZE) )
                 return -EINVAL;
         }
-#ifdef CONFIG_COMPAT
         else
         {
             fixup_guest_stack_selector(d, c.cmp->user_regs.ss);
@@ -744,7 +735,6 @@ int arch_set_info_guest(
                                          LDT_ENTRY_SIZE) )
                 return -EINVAL;
         }
-#endif
     }
 
     v->fpu_initialised = !!(flags & VGCF_I387_VALID);
@@ -763,7 +753,6 @@ int arch_set_info_guest(
             memcpy(v->arch.pv_vcpu.trap_ctxt, c.nat->trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
-#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&v->arch.user_regs, &c.cmp->user_regs);
@@ -771,7 +760,6 @@ int arch_set_info_guest(
             XLAT_trap_info(v->arch.pv_vcpu.trap_ctxt + i,
                            c.cmp->trap_ctxt + i);
     }
-#endif
     for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i )
         v->arch.debugreg[i] = c(debugreg[i]);
 
@@ -871,7 +859,6 @@ int arch_set_info_guest(
 
     if ( !compat )
         rc = (int)set_gdt(v, c.nat->gdt_frames, c.nat->gdt_ents);
-#ifdef CONFIG_COMPAT
     else
     {
         unsigned long gdt_frames[ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames)];
@@ -883,7 +870,6 @@ int arch_set_info_guest(
             gdt_frames[i] = c.cmp->gdt_frames[i];
         rc = (int)set_gdt(v, gdt_frames, c.cmp->gdt_ents);
     }
-#endif
     if ( rc != 0 )
         return rc;
 
@@ -1463,7 +1449,6 @@ static void update_runstate_area(struct vcpu *v)
     if ( guest_handle_is_null(runstate_guest(v)) )
         return;
 
-#ifdef CONFIG_COMPAT
     if ( has_32bit_shinfo(v->domain) )
     {
         struct compat_vcpu_runstate_info info;
@@ -1472,7 +1457,6 @@ static void update_runstate_area(struct vcpu *v)
         __copy_to_guest(v->runstate_guest.compat, &info, 1);
         return;
     }
-#endif
 
     __copy_to_guest(runstate_guest(v), &v->runstate, 1);
 }
@@ -1593,7 +1577,6 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
     {
         __context_switch();
 
-#ifdef CONFIG_COMPAT
         if ( !is_hvm_vcpu(next) &&
              (is_idle_vcpu(prev) ||
               is_hvm_vcpu(prev) ||
@@ -1603,7 +1586,6 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
             if ( !(efer & EFER_SCE) )
                 write_efer(efer | EFER_SCE);
         }
-#endif
 
         /* Re-enable interrupts before restoring state which may fault. */
         local_irq_enable();
@@ -1776,7 +1758,6 @@ unsigned long hypercall_create_continuation(
     return op;
 }
 
-#ifdef CONFIG_COMPAT
 int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...)
 {
     int rc = 0;
@@ -1865,7 +1846,6 @@ int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...)
 
     return rc;
 }
-#endif
 
 static int relinquish_memory(
     struct domain *d, struct page_list_head *list, unsigned long type)
index 7a89040cf6d7955a8d2a56635db70349ca0d76f7..f4e57051e00f17af21a520b9d3e1d118231dd010 100644 (file)
@@ -594,14 +594,12 @@ long arch_do_domctl(
 
         switch ( domctl->u.address_size.size )
         {
-#ifdef CONFIG_COMPAT
         case 32:
             ret = switch_compat(d);
             break;
         case 64:
             ret = switch_native(d);
             break;
-#endif
         default:
             ret = (domctl->u.address_size.size == BITS_PER_LONG) ? 0 : -EINVAL;
             break;
@@ -1522,23 +1520,17 @@ long arch_do_domctl(
     return ret;
 }
 
-#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
-#endif
 
 void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 {
     unsigned int i;
     bool_t compat = is_pv_32on64_domain(v->domain);
-#ifdef CONFIG_COMPAT
 #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))
-#else
-#define c(fld) (c.nat->fld)
-#endif
 
     if ( is_hvm_vcpu(v) )
         memset(c.nat, 0, sizeof(*c.nat));
@@ -1555,7 +1547,6 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             memcpy(c.nat->trap_ctxt, v->arch.pv_vcpu.trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
-#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&c.cmp->user_regs, &v->arch.user_regs);
@@ -1563,7 +1554,6 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             XLAT_trap_info(c.cmp->trap_ctxt + i,
                            v->arch.pv_vcpu.trap_ctxt + i);
     }
-#endif
 
     for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i )
         c(debugreg[i] = v->arch.debugreg[i]);
@@ -1606,10 +1596,8 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
         c(ldt_ents = v->arch.pv_vcpu.ldt_ents);
         for ( i = 0; i < ARRAY_SIZE(v->arch.pv_vcpu.gdt_frames); ++i )
             c(gdt_frames[i] = v->arch.pv_vcpu.gdt_frames[i]);
-#ifdef CONFIG_COMPAT
         BUILD_BUG_ON(ARRAY_SIZE(c.nat->gdt_frames) !=
                      ARRAY_SIZE(c.cmp->gdt_frames));
-#endif
         for ( ; i < ARRAY_SIZE(c.nat->gdt_frames); ++i )
             c(gdt_frames[i] = 0);
         c(gdt_ents = v->arch.pv_vcpu.gdt_ents);
@@ -1649,7 +1637,6 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             c.nat->debugreg[7] |= c.nat->debugreg[5];
             c.nat->debugreg[5] = 0;
         }
-#ifdef CONFIG_COMPAT
         else
         {
             l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
@@ -1659,7 +1646,6 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             c.cmp->debugreg[7] |= c.cmp->debugreg[5];
             c.cmp->debugreg[5] = 0;
         }
-#endif
 
         if ( guest_kernel_mode(v, &v->arch.user_regs) )
             c(flags |= VGCF_in_kernel);
index 2cb08c93b63294a8e50554d8d1ed9d72e75f8694..485f2c055379127730e355c174f44cfc8d277866 100644 (file)
@@ -1046,11 +1046,9 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     v->arch.hvm_vcpu.inject_trap.vector = -1;
 
-#ifdef CONFIG_COMPAT
     rc = setup_compat_arg_xlat(v);
     if ( rc != 0 )
         goto fail4;
-#endif
 
     rc = hvm_vcpu_cacheattr_init(v);
     if ( rc != 0 )
@@ -1081,9 +1079,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
     return 0;
 
  fail5:
-#ifdef CONFIG_COMPAT
     free_compat_arg_xlat(v);
-#endif
  fail4:
     nestedhvm_vcpu_destroy(v);
  fail3:
@@ -1098,9 +1094,7 @@ void hvm_vcpu_destroy(struct vcpu *v)
 {
     nestedhvm_vcpu_destroy(v);
 
-#ifdef CONFIG_COMPAT
     free_compat_arg_xlat(v);
-#endif
 
     tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
     hvm_vcpu_cacheattr_destroy(v);
index d47fa604382c84331a943e6b43f05145cb12288f..8d99cc4b11b8c5313c429191c92b343acefdcae3 100644 (file)
@@ -94,7 +94,6 @@ void machine_kexec(xen_kexec_image_t *image)
      */
     asm volatile ( "lgdt %0" : : "m" (gdt_desc) );
 
-#ifdef CONFIG_COMPAT
     if ( is_pv_32on64_domain(dom0) )
     {
         compat_machine_kexec(image->page_list[1],
@@ -103,7 +102,6 @@ void machine_kexec(xen_kexec_image_t *image)
                              image->start_address);
     }
     else
-#endif
     {
         relocate_new_kernel_t rnk;
 
index 71f00ef7daeef1cce4a160c3c43109f3337f771f..160abac1bf5bfcda00f051bffc03b4bc972d79d0 100644 (file)
@@ -12,9 +12,7 @@
 #include <xen/sched.h>
 #include <xen/xenoprof.h>
 #include <public/xenoprof.h>
-#ifdef CONFIG_COMPAT
 #include <compat/xenoprof.h>
-#endif
 #include <asm/hvm/support.h>
 
 #include "op_counter.h"
@@ -56,7 +54,6 @@ int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE(void) arg)
     return 0;
 }
 
-#ifdef CONFIG_COMPAT
 int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
 {
     struct compat_oprof_counter counter;
@@ -76,7 +73,6 @@ int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
 
     return 0;
 }
-#endif
 
 int xenoprofile_get_mode(const struct vcpu *v,
                          const struct cpu_user_regs *regs)
index ccacc2faa2d4d6e9df13dabdab5d1e8ddb19300a..1108881b97e47d84c8b0ee8522c8ece8e9d6abe6 100644 (file)
 #include <xen/pfn.h>
 #include <xen/nodemask.h>
 #include <public/version.h>
-#ifdef CONFIG_COMPAT
 #include <compat/platform.h>
 #include <compat/xen.h>
-#endif
 #include <asm/bitops.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
@@ -1082,12 +1080,10 @@ void __init __start_xen(unsigned long mbi_p)
     BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
 
-#ifdef CONFIG_COMPAT
     BUILD_BUG_ON(sizeof(((struct compat_platform_op *)0)->u) !=
                  sizeof(((struct compat_platform_op *)0)->u.pad));
     BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
-#endif
 
     /* Check definitions in public headers match internal defs. */
     BUILD_BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
index 43e50529ba806c147074f08c846cb3fe1a518e07..8a6f646d15861f1ea74a3f98f1a38add2aed4d90 100644 (file)
@@ -92,9 +92,7 @@ DEFINE_PER_CPU(u64, efer);
 DEFINE_PER_CPU_READ_MOSTLY(u32, ler_msr);
 
 DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, gdt_table);
-#ifdef CONFIG_COMPAT
 DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, compat_gdt_table);
-#endif
 
 /* Master table, used by CPU0. */
 idt_entry_t idt_table[IDT_ENTRIES];
@@ -2273,14 +2271,12 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
                 *reg = xen_pfn_to_cr3(mfn_to_gmfn(
                     v->domain, mfn));
             }
-#ifdef CONFIG_COMPAT
             else
             {
                 mfn = l4e_get_pfn(*(l4_pgentry_t *)__va(pagetable_get_paddr(v->arch.guest_table)));
                 *reg = compat_pfn_to_cr3(mfn_to_gmfn(
                     v->domain, mfn));
             }
-#endif
             /* PTs should not be shared */
             BUG_ON(page_get_owner(mfn_to_page(mfn)) == dom_cow);
         }
@@ -2337,14 +2333,8 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
             unsigned long gfn;
             struct page_info *page;
             domain_lock(v->domain);
-            if ( !is_pv_32on64_vcpu(v) )
-            {
-                gfn = xen_cr3_to_pfn(*reg);
-#ifdef CONFIG_COMPAT
-            } else {
-                gfn = compat_cr3_to_pfn(*reg);
-#endif
-            }
+            gfn = !is_pv_32on64_vcpu(v)
+                ? xen_cr3_to_pfn(*reg) : compat_cr3_to_pfn(*reg);
             page = get_page_from_gfn(v->domain, gfn, NULL, P2M_ALLOC);
             rc = page ? new_guest_cr3(page_to_mfn(page)) : 0;
             if ( page )
@@ -3422,13 +3412,11 @@ void load_TR(void)
         (unsigned long)tss,
         offsetof(struct tss_struct, __cacheline_filler) - 1,
         9);
-#ifdef CONFIG_COMPAT
     _set_tssldt_desc(
         this_cpu(compat_gdt_table) + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
         (unsigned long)tss,
         offsetof(struct tss_struct, __cacheline_filler) - 1,
         11);
-#endif
 
     /* Switch to non-compat GDT (which has B bit clear) to execute LTR. */
     asm volatile (
@@ -3504,9 +3492,7 @@ void __init trap_init(void)
     idt_tables[0] = idt_table;
 
     this_cpu(gdt_table) = boot_cpu_gdt_table;
-#ifdef CONFIG_COMPAT
     this_cpu(compat_gdt_table) = boot_cpu_compat_gdt_table;
-#endif
 
     percpu_traps_init();
 
index 8eeb54977886316f5536f48e5ddf3ebdb4a901f9..7466ba8c94b61c262d494c8d4e75dbae9bf133b2 100644 (file)
@@ -143,13 +143,8 @@ struct desc_ptr {
 
 extern struct desc_struct boot_cpu_gdt_table[];
 DECLARE_PER_CPU(struct desc_struct *, gdt_table);
-#ifdef CONFIG_COMPAT
 extern struct desc_struct boot_cpu_compat_gdt_table[];
 DECLARE_PER_CPU(struct desc_struct *, compat_gdt_table);
-#else
-# define boot_cpu_compat_gdt_table boot_cpu_gdt_table
-# define per_cpu__compat_gdt_table per_cpu__gdt_table
-#endif
 
 extern void set_intr_gate(unsigned int irq, void * addr);
 extern void load_TR(void);
index 1d9cb6675ff58303717c4e8f1db799205a56da82..973a774f1b76b0319075e5d24e06c7bcf92bc623 100644 (file)
@@ -447,9 +447,7 @@ struct arch_vcpu
     /* A secondary copy of the vcpu time info. */
     XEN_GUEST_HANDLE(vcpu_time_info_t) time_info_guest;
 
-#ifdef CONFIG_COMPAT
     void *compat_arg_xlat;
-#endif
 
 } __cacheline_aligned;
 
index 3c1336c1a91ca4dd185491b03340d61478f4ac8d..6e1e57cd7c32ea4110647b7c7dc3e8f69eae3536 100644 (file)
@@ -473,7 +473,6 @@ TYPE_SAFE(unsigned long,mfn);
 #define SHARED_M2P_ENTRY         (~0UL - 1UL)
 #define SHARED_M2P(_e)           ((_e) == SHARED_M2P_ENTRY)
 
-#ifdef CONFIG_COMPAT
 #define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START)
 #define _set_gpfn_from_mfn(mfn, pfn) ({                        \
     struct domain *d = page_get_owner(__mfn_to_page(mfn));     \
@@ -483,15 +482,6 @@ TYPE_SAFE(unsigned long,mfn);
             (compat_machine_to_phys_mapping[(mfn)] = (unsigned int)(entry))), \
      machine_to_phys_mapping[(mfn)] = (entry));                \
     })
-#else
-#define _set_gpfn_from_mfn(mfn, pfn) ({                        \
-    struct domain *d = page_get_owner(__mfn_to_page(mfn));     \
-    if(d && (d == dom_cow))                                    \
-        machine_to_phys_mapping[(mfn)] = SHARED_M2P_ENTRY;     \
-    else                                                       \
-        machine_to_phys_mapping[(mfn)] = (pfn);                \
-    })
-#endif
 
 /*
  * Disable some users of set_gpfn_from_mfn() (e.g., free_heap_pages()) until
@@ -579,13 +569,8 @@ int map_ldt_shadow_page(unsigned int);
 
 extern int memory_add(unsigned long spfn, unsigned long epfn, unsigned int pxm);
 
-#ifdef CONFIG_COMPAT
 void domain_set_alloc_bitsize(struct domain *d);
 unsigned int domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits);
-#else
-# define domain_set_alloc_bitsize(d) ((void)0)
-# define domain_clamp_alloc_bitsize(d, b) (b)
-#endif
 
 unsigned long domain_get_maximum_gpfn(struct domain *d);
 
index 5db2d9d7331260f18a9525e9970f390f878da36a..acff24b868937c6146f46a1b4ff042ea92525912 100644 (file)
@@ -504,11 +504,7 @@ void show_execution_state(struct cpu_user_regs *regs);
 void show_page_walk(unsigned long addr);
 void fatal_trap(int trapnr, struct cpu_user_regs *regs);
 
-#ifdef CONFIG_COMPAT
 void compat_show_guest_stack(struct vcpu *, struct cpu_user_regs *, int lines);
-#else
-#define compat_show_guest_stack(vcpu, regs, lines) ((void)0)
-#endif
 
 extern void mtrr_ap_init(void);
 extern void mtrr_bp_init(void);
index ceca564d623d208b6a708f3da72ff53fb21b7428..af5d959d043b9931dc9381302e791bfcd4951199 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef __XEN_X86_SHARED_H__
 #define __XEN_X86_SHARED_H__
 
-#ifdef CONFIG_COMPAT
-
 #define nmi_reason(d) (!has_32bit_shinfo(d) ?                             \
                        (u32 *)&(d)->shared_info->native.arch.nmi_reason : \
                        (u32 *)&(d)->shared_info->compat.arch.nmi_reason)
@@ -39,33 +37,6 @@ static inline void arch_set_##field(struct vcpu *v,             \
         v->vcpu_info->compat.arch.field = val;                  \
 }
 
-#else
-
-#define nmi_reason(d) ((u32 *)&(d)->shared_info->arch.nmi_reason)
-
-#define GET_SET_SHARED(type, field)                             \
-static inline type arch_get_##field(const struct domain *d)     \
-{                                                               \
-    return d->shared_info->arch.field;                          \
-}                                                               \
-static inline void arch_set_##field(struct domain *d,           \
-                                    type val)                   \
-{                                                               \
-    d->shared_info->arch.field = val;                           \
-}
-
-#define GET_SET_VCPU(type, field)                               \
-static inline type arch_get_##field(const struct vcpu *v)       \
-{                                                               \
-    return v->vcpu_info->arch.field;                            \
-}                                                               \
-static inline void arch_set_##field(struct vcpu *v,             \
-                                    type val)                   \
-{                                                               \
-    v->vcpu_info->arch.field = val;                             \
-}
-#endif
-
 GET_SET_SHARED(unsigned long, max_pfn)
 GET_SET_SHARED(xen_pfn_t, pfn_to_mfn_frame_list_list)
 GET_SET_SHARED(unsigned long, nmi_reason)