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

[Xen-changelog] [xen-unstable] x86: reduce the uses of CONFIG_COMPAT



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1255348560 -3600
# Node ID 5d779377a9ae1c9ed1eda30d24b52314ca1894a3
# Parent  18e80cd73366095dc50925c8a44a0774b2ca323a
x86: reduce the uses of CONFIG_COMPAT

... to where it really is needed and meaningful (i.e. in some places
it seems to make more sense to use __x86_64__ instead).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/domain.c              |   16 ++++++----------
 xen/arch/x86/mm.c                  |   10 +++++-----
 xen/arch/x86/setup.c               |   28 +++++++---------------------
 xen/arch/x86/smpboot.c             |    2 --
 xen/arch/x86/x86_64/Makefile       |   14 +++++++-------
 xen/arch/x86/x86_64/asm-offsets.c  |    4 ----
 xen/arch/x86/x86_64/compat/mm.c    |    4 ----
 xen/arch/x86/x86_64/compat/traps.c |    4 ----
 xen/arch/x86/x86_64/mm.c           |    2 --
 xen/include/asm-x86/domain.h       |   10 +++-------
 xen/include/asm-x86/hypercall.h    |   22 +++++++++-------------
 xen/include/asm-x86/mm.h           |    4 ----
 12 files changed, 37 insertions(+), 83 deletions(-)

diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/domain.c     Mon Oct 12 12:56:00 2009 +0100
@@ -208,7 +208,7 @@ void free_vcpu_struct(struct vcpu *v)
     free_xenheap_pages(v, get_order_from_bytes(sizeof(*v)));
 }
 
-#ifdef CONFIG_COMPAT
+#ifdef __x86_64__
 
 static int setup_compat_l4(struct vcpu *v)
 {
@@ -445,12 +445,10 @@ int arch_domain_create(struct domain *d,
         l3e_from_page(virt_to_page(d->arch.mm_perdomain_l2),
                             __PAGE_HYPERVISOR);
 
-#endif /* __x86_64__ */
-
-#ifdef CONFIG_COMPAT
     HYPERVISOR_COMPAT_VIRT_START(d) =
         is_hvm_domain(d) ? ~0u : __HYPERVISOR_COMPAT_VIRT_START;
-#endif
+
+#endif /* __x86_64__ */
 
     if ( (rc = paging_domain_init(d)) != 0 )
         goto fail;
@@ -768,9 +766,7 @@ int arch_set_info_guest(
 
             v->arch.guest_table_user = pagetable_from_pfn(cr3_pfn);
         }
-#endif
-    }
-#ifdef CONFIG_COMPAT
+    }
     else
     {
         l4_pgentry_t *l4tab;
@@ -790,8 +786,8 @@ int arch_set_info_guest(
         l4tab = __va(pagetable_get_paddr(v->arch.guest_table));
         *l4tab = l4e_from_pfn(
             cr3_pfn, _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);
-    }
-#endif
+#endif
+    }
 
     if ( v->vcpu_id == 0 )
         update_domain_wallclock_time(d);
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/mm.c Mon Oct 12 12:56:00 2009 +0100
@@ -158,7 +158,7 @@ boolean_param("allowhugepage", opt_allow
       !has_arch_pdevs(d)) ?                                     \
      L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
 
-#ifdef CONFIG_COMPAT
+#ifdef __x86_64__
 l2_pgentry_t *compat_idle_pg_table_l2 = NULL;
 #define l3_disallow_mask(d) (!is_pv_32on64_domain(d) ?  \
                              L3_DISALLOW_MASK :         \
@@ -1002,7 +1002,7 @@ get_page_from_l4e(
 
 #endif
 
-#ifdef CONFIG_COMPAT
+#ifdef __x86_64__
 #define unadjust_guest_l3e(pl3e, d)                                         \
     do {                                                                    \
         if ( unlikely(is_pv_32on64_domain(d)) &&                            \
@@ -1330,7 +1330,7 @@ static int alloc_l2_table(struct page_in
                                     __PAGE_HYPERVISOR));
         pl2e[l2_table_offset(LINEAR_PT_VIRT_START)] =
             l2e_from_pfn(pfn, __PAGE_HYPERVISOR);
-#elif defined(CONFIG_COMPAT)
+#else
         memcpy(&pl2e[COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)],
                &compat_idle_pg_table_l2[
                    l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
@@ -1511,7 +1511,7 @@ static void free_l1_table(struct page_in
 
 static int free_l2_table(struct page_info *page, int preemptible)
 {
-#ifdef CONFIG_COMPAT
+#ifdef __x86_64__
     struct domain *d = page_get_owner(page);
 #endif
     unsigned long pfn = page_to_mfn(page);
@@ -2446,7 +2446,7 @@ int new_guest_cr3(unsigned long mfn)
     int okay;
     unsigned long old_base_mfn;
 
-#ifdef CONFIG_COMPAT
+#ifdef __x86_64__
     if ( is_pv_32on64_domain(d) )
     {
         okay = paging_mode_refcounts(d)
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/setup.c      Mon Oct 12 12:56:00 2009 +0100
@@ -1154,8 +1154,10 @@ void arch_get_xen_caps(xen_capabilities_
 
     (*info)[0] = '\0';
 
-#if defined(CONFIG_X86_32)
-
+#ifdef CONFIG_X86_64
+    snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor);
+    safe_strcat(*info, s);
+#endif
     snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
     safe_strcat(*info, s);
     if ( hvm_enabled )
@@ -1164,27 +1166,11 @@ void arch_get_xen_caps(xen_capabilities_
         safe_strcat(*info, s);
         snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
         safe_strcat(*info, s);
-    }
-
-#elif defined(CONFIG_X86_64)
-
-    snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor);
-    safe_strcat(*info, s);
-#ifdef CONFIG_COMPAT
-    snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
-    safe_strcat(*info, s);
-#endif
-    if ( hvm_enabled )
-    {
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
-        safe_strcat(*info, s);
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
-        safe_strcat(*info, s);
+#ifdef CONFIG_X86_64
         snprintf(s, sizeof(s), "hvm-%d.%d-x86_64 ", major, minor);
         safe_strcat(*info, s);
-    }
-
-#endif
+#endif
+    }
 }
 
 int xen_in_range(paddr_t start, paddr_t end)
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/smpboot.c    Mon Oct 12 12:56:00 2009 +0100
@@ -864,14 +864,12 @@ static int __devinit do_boot_cpu(int api
        if (gdt == boot_cpu_gdt_table) {
                order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
 #ifdef __x86_64__
-#ifdef CONFIG_COMPAT
                page = alloc_domheap_pages(NULL, order,
                                           MEMF_node(cpu_to_node(cpu)));
                per_cpu(compat_gdt_table, cpu) = gdt = page_to_virt(page);
                memcpy(gdt, boot_cpu_compat_gdt_table,
                       NR_RESERVED_GDT_PAGES * PAGE_SIZE);
                gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
-#endif
                page = alloc_domheap_pages(NULL, order,
                                           MEMF_node(cpu_to_node(cpu)));
                per_cpu(gdt_table, cpu) = gdt = page_to_virt(page);
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile      Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/x86_64/Makefile      Mon Oct 12 12:56:00 2009 +0100
@@ -9,12 +9,12 @@ obj-y += acpi_mmcfg.o
 obj-y += acpi_mmcfg.o
 obj-y += mmconfig_64.o
 obj-y += mmconfig-shared.o
+obj-y += compat.o
+obj-y += compat_kexec.o
+obj-y += domain.o
+obj-y += physdev.o
+obj-y += platform_hypercall.o
+obj-y += cpu_idle.o
+obj-y += cpufreq.o
 
 obj-$(crash_debug)   += gdbstub.o
-obj-$(CONFIG_COMPAT) += compat.o
-obj-$(CONFIG_COMPAT) += compat_kexec.o
-obj-$(CONFIG_COMPAT) += domain.o
-obj-$(CONFIG_COMPAT) += physdev.o
-obj-$(CONFIG_COMPAT) += platform_hypercall.o
-obj-$(CONFIG_COMPAT) += cpu_idle.o
-obj-$(CONFIG_COMPAT) += cpufreq.o
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/x86_64/asm-offsets.c Mon Oct 12 12:56:00 2009 +0100
@@ -7,9 +7,7 @@
 #include <xen/config.h>
 #include <xen/perfc.h>
 #include <xen/sched.h>
-#ifdef CONFIG_COMPAT
 #include <compat/xen.h>
-#endif
 #include <asm/fixmap.h>
 #include <asm/hardirq.h>
 
@@ -128,11 +126,9 @@ void __dummy__(void)
     OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask);
     BLANK();
 
-#ifdef CONFIG_COMPAT
     OFFSET(COMPAT_VCPUINFO_upcall_pending, struct compat_vcpu_info, 
evtchn_upcall_pending);
     OFFSET(COMPAT_VCPUINFO_upcall_mask, struct compat_vcpu_info, 
evtchn_upcall_mask);
     BLANK();
-#endif
 
     OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu);
     DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info));
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c   Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/x86_64/compat/mm.c   Mon Oct 12 12:56:00 2009 +0100
@@ -1,5 +1,3 @@
-#ifdef CONFIG_COMPAT
-
 #include <xen/event.h>
 #include <xen/multicall.h>
 #include <compat/memory.h>
@@ -343,8 +341,6 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mm
     return rc;
 }
 
-#endif /* CONFIG_COMPAT */
-
 /*
  * Local variables:
  * mode: C
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/x86_64/compat/traps.c
--- a/xen/arch/x86/x86_64/compat/traps.c        Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/x86_64/compat/traps.c        Mon Oct 12 12:56:00 2009 +0100
@@ -1,5 +1,3 @@
-#ifdef CONFIG_COMPAT
-
 #include <xen/event.h>
 #include <asm/regs.h>
 #include <compat/callback.h>
@@ -361,8 +359,6 @@ int compat_set_trap_table(XEN_GUEST_HAND
     return rc;
 }
 
-#endif /* CONFIG_COMPAT */
-
 static void hypercall_page_initialise_ring1_kernel(void *hypercall_page)
 {
     char *p;
diff -r 18e80cd73366 -r 5d779377a9ae xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/arch/x86/x86_64/mm.c  Mon Oct 12 12:56:00 2009 +0100
@@ -43,9 +43,7 @@ unsigned long __read_mostly pfn_hole_mas
 unsigned long __read_mostly pfn_hole_mask = 0;
 unsigned int __read_mostly pfn_pdx_hole_shift = 0;
 
-#ifdef CONFIG_COMPAT
 unsigned int m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;
-#endif
 
 DEFINE_PER_CPU_READ_MOSTLY(void *, compat_arg_xlat);
 
diff -r 18e80cd73366 -r 5d779377a9ae xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h      Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/include/asm-x86/domain.h      Mon Oct 12 12:56:00 2009 +0100
@@ -234,17 +234,13 @@ struct arch_domain
     struct page_info **mm_perdomain_pt_pages;
     l2_pgentry_t *mm_perdomain_l2;
     l3_pgentry_t *mm_perdomain_l3;
+
+    unsigned int hv_compat_vstart;
 #else
     l1_pgentry_t *mm_perdomain_pt;
-#endif
-
-#ifdef CONFIG_X86_32
+
     /* map_domain_page() mapping cache. */
     struct mapcache_domain mapcache;
-#endif
-
-#ifdef CONFIG_COMPAT
-    unsigned int hv_compat_vstart;
 #endif
 
     bool_t s3_integrity;
diff -r 18e80cd73366 -r 5d779377a9ae xen/include/asm-x86/hypercall.h
--- a/xen/include/asm-x86/hypercall.h   Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/include/asm-x86/hypercall.h   Mon Oct 12 12:56:00 2009 +0100
@@ -127,6 +127,15 @@ do_set_segment_base(
     unsigned int which,
     unsigned long base);
 
+extern int
+compat_physdev_op(
+    int cmd,
+    XEN_GUEST_HANDLE(void) arg);
+
+extern int
+arch_compat_vcpu_op(
+    int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
+
 #else
 
 extern long
@@ -138,17 +147,4 @@ do_set_callbacks(
 
 #endif
 
-#ifdef CONFIG_COMPAT
-
-extern int
-compat_physdev_op(
-    int cmd,
-    XEN_GUEST_HANDLE(void) arg);
-
-extern int
-arch_compat_vcpu_op(
-    int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
-
-#endif
-
 #endif /* __ASM_X86_HYPERCALL_H__ */
diff -r 18e80cd73366 -r 5d779377a9ae xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Fri Oct 09 09:34:03 2009 +0100
+++ b/xen/include/asm-x86/mm.h  Mon Oct 12 12:56:00 2009 +0100
@@ -455,10 +455,8 @@ TYPE_SAFE(unsigned long,mfn);
 
 #define INVALID_MFN             (~0UL)
 
-#ifdef CONFIG_COMPAT
 #define compat_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 
20))
 #define compat_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 
20))
-#endif
 
 #ifdef MEMORY_GUARD
 void memguard_init(void);
@@ -506,10 +504,8 @@ int __sync_lazy_execstate(void);
 /* Arch-specific portion of memory_op hypercall. */
 long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
 long subarch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
-#ifdef CONFIG_COMPAT
 int compat_arch_memory_op(int op, XEN_GUEST_HANDLE(void));
 int compat_subarch_memory_op(int op, XEN_GUEST_HANDLE(void));
-#endif
 
 int steal_page(
     struct domain *d, struct page_info *page, unsigned int memflags);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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