From: "Jan Beulich" Subject: [PATCH] x86: reduce the uses of CONFIG_COMPAT Date: Fri, 09 Oct 2009 13:19:14 +0100 Message-ID: <4ACF4662020000780001901B@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org ... 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 --- 2009-09-21.orig/xen/arch/x86/domain.c 2009-09-22 16:47:17.0000000= 00 +0200 +++ 2009-09-21/xen/arch/x86/domain.c 2009-10-09 13:48:32.000000000 = +0200 @@ -217,7 +217,7 @@ void free_vcpu_struct(struct vcpu *v) free_xenheap_pages(v, get_order_from_bytes(sizeof(*v))); } =20 -#ifdef CONFIG_COMPAT +#ifdef __x86_64__ =20 static int setup_compat_l4(struct vcpu *v) { @@ -454,12 +454,10 @@ int arch_domain_create(struct domain *d, l3e_from_page(virt_to_page(d->arch.mm_perdomain_l2), __PAGE_HYPERVISOR); =20 -#endif /* __x86_64__ */ - -#ifdef CONFIG_COMPAT HYPERVISOR_COMPAT_VIRT_START(d) =3D is_hvm_domain(d) ? ~0u : __HYPERVISOR_COMPAT_VIRT_START; -#endif + +#endif /* __x86_64__ */ =20 if ( (rc =3D paging_domain_init(d)) !=3D 0 ) goto fail; @@ -779,9 +777,7 @@ int arch_set_info_guest( =20 v->arch.guest_table_user =3D pagetable_from_pfn(cr3_pfn); } -#endif } -#ifdef CONFIG_COMPAT else { l4_pgentry_t *l4tab; @@ -801,8 +797,8 @@ int arch_set_info_guest( l4tab =3D __va(pagetable_get_paddr(v->arch.guest_table)); *l4tab =3D l4e_from_pfn( cr3_pfn, _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED); - } #endif + } =20 if ( v->vcpu_id =3D=3D 0 ) update_domain_wallclock_time(d); --- 2009-09-21.orig/xen/arch/x86/mm.c 2009-10-09 11:43:31.000000000 = +0200 +++ 2009-09-21/xen/arch/x86/mm.c 2009-10-09 13:45:56.000000000 = +0200 @@ -159,7 +159,7 @@ bool_t __read_mostly mpt_valid; !has_arch_pdevs(d)) ? \ L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS)) =20 -#ifdef CONFIG_COMPAT +#ifdef __x86_64__ l2_pgentry_t *compat_idle_pg_table_l2 =3D NULL; #define l3_disallow_mask(d) (!is_pv_32on64_domain(d) ? \ L3_DISALLOW_MASK : \ @@ -1005,7 +1005,7 @@ get_page_from_l4e( =20 #endif =20 -#ifdef CONFIG_COMPAT +#ifdef __x86_64__ #define unadjust_guest_l3e(pl3e, d) = \ do { = \ if ( unlikely(is_pv_32on64_domain(d)) && = \ @@ -1333,7 +1333,7 @@ static int alloc_l2_table(struct page_in __PAGE_HYPERVISOR)); pl2e[l2_table_offset(LINEAR_PT_VIRT_START)] =3D 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)], @@ -1514,7 +1514,7 @@ static void free_l1_table(struct page_in =20 static int free_l2_table(struct page_info *page, int preemptible) { -#ifdef CONFIG_COMPAT +#ifdef __x86_64__ struct domain *d =3D page_get_owner(page); #endif unsigned long pfn =3D page_to_mfn(page); @@ -2449,7 +2449,7 @@ int new_guest_cr3(unsigned long mfn) int okay; unsigned long old_base_mfn; =20 -#ifdef CONFIG_COMPAT +#ifdef __x86_64__ if ( is_pv_32on64_domain(d) ) { okay =3D paging_mode_refcounts(d) --- 2009-09-21.orig/xen/arch/x86/setup.c 2009-09-22 15:47:03.0000000= 00 +0200 +++ 2009-09-21/xen/arch/x86/setup.c 2009-10-09 13:51:40.000000000 = +0200 @@ -1142,37 +1142,23 @@ void arch_get_xen_caps(xen_capabilities_ =20 (*info)[0] =3D '\0'; =20 -#if defined(CONFIG_X86_32) - - snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor); - safe_strcat(*info, s); - 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); - } - -#elif defined(CONFIG_X86_64) - +#ifdef CONFIG_X86_64 snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor); safe_strcat(*info, s); -#ifdef CONFIG_COMPAT +#endif 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 + } } =20 int xen_in_range(paddr_t start, paddr_t end) --- 2009-09-21.orig/xen/arch/x86/smpboot.c 2009-08-19 17:01:49.0000000= 00 +0200 +++ 2009-09-21/xen/arch/x86/smpboot.c 2009-10-09 13:52:03.000000000 = +0200 @@ -856,14 +856,12 @@ static int __devinit do_boot_cpu(int api if (gdt =3D=3D boot_cpu_gdt_table) { order =3D get_order_from_pages(NR_RESERVED_GDT_PAGES); #ifdef __x86_64__ -#ifdef CONFIG_COMPAT page =3D alloc_domheap_pages(NULL, order, MEMF_node(cpu_to_node(cpu))); per_cpu(compat_gdt_table, cpu) =3D gdt =3D page_to_virt(pag= e); memcpy(gdt, boot_cpu_compat_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SIZE); gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a =3D = cpu; -#endif page =3D alloc_domheap_pages(NULL, order, MEMF_node(cpu_to_node(cpu))); per_cpu(gdt_table, cpu) =3D gdt =3D page_to_virt(page); --- 2009-09-21.orig/xen/arch/x86/x86_64/Makefile 2009-06-03 = 12:22:45.000000000 +0200 +++ 2009-09-21/xen/arch/x86/x86_64/Makefile 2009-10-09 13:34:03.0000000= 00 +0200 @@ -9,12 +9,12 @@ obj-y +=3D pci.o obj-y +=3D acpi_mmcfg.o obj-y +=3D mmconfig_64.o obj-y +=3D mmconfig-shared.o +obj-y +=3D compat.o +obj-y +=3D compat_kexec.o +obj-y +=3D domain.o +obj-y +=3D physdev.o +obj-y +=3D platform_hypercall.o +obj-y +=3D cpu_idle.o +obj-y +=3D cpufreq.o =20 obj-$(crash_debug) +=3D gdbstub.o -obj-$(CONFIG_COMPAT) +=3D compat.o -obj-$(CONFIG_COMPAT) +=3D compat_kexec.o -obj-$(CONFIG_COMPAT) +=3D domain.o -obj-$(CONFIG_COMPAT) +=3D physdev.o -obj-$(CONFIG_COMPAT) +=3D platform_hypercall.o -obj-$(CONFIG_COMPAT) +=3D cpu_idle.o -obj-$(CONFIG_COMPAT) +=3D cpufreq.o --- 2009-09-21.orig/xen/arch/x86/x86_64/asm-offsets.c 2008-12-17 = 16:52:27.000000000 +0100 +++ 2009-09-21/xen/arch/x86/x86_64/asm-offsets.c 2009-10-09 = 13:34:24.000000000 +0200 @@ -7,9 +7,7 @@ #include #include #include -#ifdef CONFIG_COMPAT #include -#endif #include #include =20 @@ -128,11 +126,9 @@ void __dummy__(void) OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask); BLANK(); =20 -#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 =20 OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu); DEFINE(CPUINFO_sizeof, sizeof(struct cpu_info)); --- 2009-09-21.orig/xen/arch/x86/x86_64/compat/mm.c 2009-09-17 = 09:08:28.000000000 +0200 +++ 2009-09-21/xen/arch/x86/x86_64/compat/mm.c 2009-10-09 13:34:37.0000000= 00 +0200 @@ -1,5 +1,3 @@ -#ifdef CONFIG_COMPAT - #include #include #include @@ -343,8 +341,6 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mm return rc; } =20 -#endif /* CONFIG_COMPAT */ - /* * Local variables: * mode: C --- 2009-09-21.orig/xen/arch/x86/x86_64/compat/traps.c 2009-06-19 = 11:11:23.000000000 +0200 +++ 2009-09-21/xen/arch/x86/x86_64/compat/traps.c 2009-10-09 = 13:34:45.000000000 +0200 @@ -1,5 +1,3 @@ -#ifdef CONFIG_COMPAT - #include #include #include @@ -361,8 +359,6 @@ int compat_set_trap_table(XEN_GUEST_HAND return rc; } =20 -#endif /* CONFIG_COMPAT */ - static void hypercall_page_initialise_ring1_kernel(void *hypercall_page) { char *p; --- 2009-09-21.orig/xen/arch/x86/x86_64/mm.c 2009-09-22 16:35:10.0000000= 00 +0200 +++ 2009-09-21/xen/arch/x86/x86_64/mm.c 2009-10-09 13:32:54.000000000 = +0200 @@ -42,9 +42,7 @@ DEFINE_WRITE_ONCE(unsigned long, ma_top_ unsigned long __read_mostly pfn_hole_mask =3D 0; unsigned int __read_mostly pfn_pdx_hole_shift =3D 0; =20 -#ifdef CONFIG_COMPAT unsigned int m2p_compat_vstart =3D __HYPERVISOR_COMPAT_VIRT_START; -#endif =20 DEFINE_PER_CPU_READ_MOSTLY(void *, compat_arg_xlat); =20 --- 2009-09-21.orig/xen/include/asm-x86/domain.h 2009-09-22 = 16:15:41.000000000 +0200 +++ 2009-09-21/xen/include/asm-x86/domain.h 2009-10-09 13:37:28.0000000= 00 +0200 @@ -234,19 +234,15 @@ 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 =20 -#ifdef CONFIG_X86_32 /* map_domain_page() mapping cache. */ struct mapcache_domain mapcache; #endif =20 -#ifdef CONFIG_COMPAT - unsigned int hv_compat_vstart; -#endif - bool_t s3_integrity; =20 /* I/O-port admin-specified access capabilities. */ --- 2009-09-21.orig/xen/include/asm-x86/hypercall.h 2008-01-21 = 11:03:09.000000000 +0100 +++ 2009-09-21/xen/include/asm-x86/hypercall.h 2009-10-09 13:40:38.0000000= 00 +0200 @@ -121,19 +121,6 @@ do_set_segment_base( unsigned int which, unsigned long base); =20 -#else - -extern long -do_set_callbacks( - unsigned long event_selector, - unsigned long event_address, - unsigned long failsafe_selector, - unsigned long failsafe_address); - -#endif - -#ifdef CONFIG_COMPAT - extern int compat_physdev_op( int cmd, @@ -143,6 +130,15 @@ extern int arch_compat_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg); =20 +#else + +extern long +do_set_callbacks( + unsigned long event_selector, + unsigned long event_address, + unsigned long failsafe_selector, + unsigned long failsafe_address); + #endif =20 #endif /* __ASM_X86_HYPERCALL_H__ */ --- 2009-09-21.orig/xen/include/asm-x86/mm.h 2009-09-21 11:47:56.0000000= 00 +0200 +++ 2009-09-21/xen/include/asm-x86/mm.h 2009-10-09 13:36:30.000000000 = +0200 @@ -457,10 +457,8 @@ extern bool_t mpt_valid; =20 #define INVALID_MFN (~0UL) =20 -#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 =20 #ifdef MEMORY_GUARD void memguard_init(void); @@ -508,10 +506,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 =20 int steal_page( struct domain *d, struct page_info *page, unsigned int memflags);