rpms/kernel-xen-2.6/devel Makefile, 1.12, 1.13 Makefile.config, 1.12, 1.13 kernel.spec, 1.32, 1.33 linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch, 1.2, 1.3

Mark McLoughlin (markmc) fedora-extras-commits at redhat.com
Tue Apr 8 12:49:13 UTC 2008


Author: markmc

Update of /cvs/pkgs/rpms/kernel-xen-2.6/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17219

Modified Files:
	Makefile Makefile.config kernel.spec 
	linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch 
Log Message:
* Tue Apr  8 2008 Mark McLoughlin <markmc at redhat.com>
- Some more pagetable-pinning fixes







Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/kernel.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- kernel.spec	7 Apr 2008 20:48:14 -0000	1.32
+++ kernel.spec	8 Apr 2008 12:48:30 -0000	1.33
@@ -1855,6 +1855,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Tue Apr  8 2008 Mark McLoughlin <markmc at redhat.com>
+- Some more pagetable-pinning fixes
+
 * Mon Apr 07 2008 Mark McLoughlin <markmc at redhat.com>
 - Small fixup to pagetable-pinning fix
 

linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch:

Index: linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch	7 Apr 2008 20:48:14 -0000	1.2
+++ linux-2.6-xen-0020-xen-x86_64-Initial-x86_64-support-for-Xen-paravirt_.patch	8 Apr 2008 12:48:30 -0000	1.3
@@ -1,9 +1,9 @@
-From 9a157353e9b1f9bc13b1eaf1a75608476fa2c7e2 Mon Sep 17 00:00:00 2001
+From 912f40e47645c2549d037e8ae2df1cefa08fc814 Mon Sep 17 00:00:00 2001
 From: Eduardo Habkost <ehabkost at redhat.com>
-Date: Wed, 2 Apr 2008 18:17:24 +0100
+Date: Wed, 2 Apr 2008 15:36:36 +0100
 Subject: [PATCH] xen x86_64: Initial x86_64 support for Xen paravirt_ops
 
-Taken from the xen-64-2008-04-07-0.1 tag.
+Taken from the xen-pvops-64-2.6.25-rc8-markmc4 tag.
 
 Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
 Signed-off-by: Mark McLoughlin <markmc at redhat.com>
@@ -20,7 +20,7 @@
  arch/x86/kernel/paravirt.c       |    5 +
  arch/x86/kernel/process_64.c     |    9 +
  arch/x86/kernel/setup64.c        |    5 +
- arch/x86/kernel/setup_64.c       |   41 +++-
+ arch/x86/kernel/setup_64.c       |   46 +++-
  arch/x86/kernel/smpboot_64.c     |    4 +-
  arch/x86/kernel/vsyscall_64.c    |   29 ++-
  arch/x86/mm/init_64.c            |  568 ++++++++++++++++++++++++++++++++++++--
@@ -28,7 +28,7 @@
  arch/x86/vdso/vdso32-setup.c     |    4 +
  arch/x86/xen/Kconfig             |    1 -
  arch/x86/xen/Makefile            |    6 +
- arch/x86/xen/enlighten.c         |  309 +++++++++++++++------
+ arch/x86/xen/enlighten.c         |  264 +++++++++++++++---
  arch/x86/xen/entry.S             |    5 +
  arch/x86/xen/entry_32.S          |   81 ++++++
  arch/x86/xen/entry_64.S          |   68 +++++
@@ -37,8 +37,8 @@
  arch/x86/xen/init.h              |   20 ++
  arch/x86/xen/init_32.c           |    3 +
  arch/x86/xen/init_64.c           |  181 ++++++++++++
- arch/x86/xen/mmu.c               |  454 +++++++++++++++++++++----------
- arch/x86/xen/mmu.h               |   47 ++--
+ arch/x86/xen/mmu.c               |  348 ++++++++++++++---------
+ arch/x86/xen/mmu.h               |   41 ++--
  arch/x86/xen/multicalls.c        |    9 +-
  arch/x86/xen/setup.c             |   22 ++
  arch/x86/xen/smp.c               |   16 +
@@ -50,7 +50,7 @@
  drivers/acpi/thermal.c           |    5 +
  drivers/char/hvc_xen.c           |    6 +
  include/asm-x86/asm-hack.h       |   27 ++
- include/asm-x86/cmpxchg_64.h     |   36 +++
+ include/asm-x86/cmpxchg_64.h     |   47 ++++
  include/asm-x86/desc_defs.h      |    4 +
  include/asm-x86/fixmap_32.h      |   16 +-
  include/asm-x86/fixmap_64.h      |   28 ++-
@@ -65,7 +65,7 @@
  include/asm-x86/proto.h          |    1 +
  include/asm-x86/smp_64.h         |    3 +
  include/asm-x86/system.h         |    3 +-
- include/asm-x86/xen/hypercall.h  |  205 +++++++++++---
+ include/asm-x86/xen/hypercall.h  |  194 +++++++++++---
  include/asm-x86/xen/hypervisor.h |    3 -
  include/asm-x86/xen/interface.h  |   35 ++-
  include/linux/dmi.h              |    1 +
@@ -75,7 +75,7 @@
  include/xen/page.h               |   34 ++-
  init/main.c                      |   10 +
  mm/slab.c                        |    8 +-
- 67 files changed, 2803 insertions(+), 677 deletions(-)
+ 67 files changed, 2714 insertions(+), 614 deletions(-)
  create mode 100644 arch/x86/xen/entry.S
  create mode 100644 arch/x86/xen/entry_32.S
  create mode 100644 arch/x86/xen/entry_64.S
@@ -648,7 +648,7 @@
  
  void __cpuinit check_efer(void)
 diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
-index f4f7ecf..055a28f 100644
+index f4f7ecf..e2ba835 100644
 --- a/arch/x86/kernel/setup_64.c
 +++ b/arch/x86/kernel/setup_64.c
 @@ -73,6 +73,12 @@
@@ -673,7 +673,7 @@
  #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
  	if (init_ohci1394_dma_early)
  		init_ohci1394_dma_on_all_controllers();
-@@ -342,10 +346,15 @@ void __init setup_arch(char **cmdline_p)
+@@ -342,6 +346,8 @@ void __init setup_arch(char **cmdline_p)
  	check_efer();
  
  	init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
@@ -682,42 +682,43 @@
  	if (efi_enabled)
  		efi_init();
  
-+#ifndef CONFIG_XEN
-+	/*FIXME: make dmi_scan_machine() work under Xen */
- 	dmi_scan_machine();
-+#endif
- 
- 	io_delay_init();
- 
-@@ -399,6 +408,27 @@ void __init setup_arch(char **cmdline_p)
+@@ -399,6 +405,35 @@ void __init setup_arch(char **cmdline_p)
  	if (efi_enabled)
  		efi_reserve_bootmem();
  
 +#ifdef CONFIG_XEN
 +	/*FIXME: pvops */
 +	/* Reserve phys_to_machine_mapping */
-+	reserve_bootmem(__pa(phys_to_machine_mapping), sizeof(unsigned long*)*xen_start_info->nr_pages, BOOTMEM_DEFAULT);
++	reserve_bootmem(__pa(phys_to_machine_mapping),
++			sizeof(unsigned long *)*xen_start_info->nr_pages,
++			BOOTMEM_DEFAULT);
 +
 +	/* Reserve initial pagetables*/
 +	/*FIXME: probably they are not used anymore and may be made
 +	 * writeable again after the kernel page tables are set up.
 +	 */
-+	reserve_bootmem(__pa(xen_start_info->pt_base), xen_start_info->nr_pt_frames*PAGE_SIZE, BOOTMEM_DEFAULT);
++	reserve_bootmem(__pa(xen_start_info->pt_base),
++			xen_start_info->nr_pt_frames*PAGE_SIZE,
++			BOOTMEM_DEFAULT);
 +
 +	/* Reserve xen_start_info area */
-+	reserve_bootmem(__pa(xen_start_info), sizeof(*xen_start_info), BOOTMEM_DEFAULT);
++	reserve_bootmem(__pa(xen_start_info),
++			sizeof(*xen_start_info),
++			BOOTMEM_DEFAULT);
 +
 +	if (!is_initial_xendomain()) {
 +		/* Reserve the xenstore and console interface pages */
-+		reserve_bootmem(mfn_to_pfn(xen_start_info->store_mfn) << PAGE_SHIFT, PAGE_SIZE, BOOTMEM_DEFAULT);
-+		reserve_bootmem(mfn_to_pfn(xen_start_info->console.domU.mfn) << PAGE_SHIFT, PAGE_SIZE, BOOTMEM_DEFAULT);
++		reserve_bootmem(mfn_to_pfn(xen_start_info->store_mfn) << PAGE_SHIFT,
++				PAGE_SIZE, BOOTMEM_DEFAULT);
++		reserve_bootmem(mfn_to_pfn(xen_start_info->console.domU.mfn) << PAGE_SHIFT,
++				PAGE_SIZE, BOOTMEM_DEFAULT);
 +	}
 +#endif
 +
         /*
  	* Find and reserve possible boot-time SMP configuration:
  	*/
-@@ -425,7 +455,11 @@ void __init setup_arch(char **cmdline_p)
+@@ -425,7 +460,11 @@ void __init setup_arch(char **cmdline_p)
  	}
  #endif
  	reserve_crashkernel();
@@ -729,7 +730,7 @@
  	map_vsyscall();
  
  	early_quirks();
-@@ -444,7 +478,10 @@ void __init setup_arch(char **cmdline_p)
+@@ -444,7 +483,10 @@ void __init setup_arch(char **cmdline_p)
  	 */
  	if (smp_found_config)
  		get_smp_config();
@@ -1654,7 +1655,7 @@
 +
  obj-$(CONFIG_SMP)	+= smp.o
 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index 1e4df8a..b025105 100644
+index 1e4df8a..0a2ace7 100644
 --- a/arch/x86/xen/enlighten.c
 +++ b/arch/x86/xen/enlighten.c
 @@ -37,6 +37,7 @@
@@ -1859,104 +1860,44 @@
  
  	/* Update while interrupts are disabled, so its atomic with
  	   respect to ipis */
-@@ -700,86 +736,66 @@ static void xen_write_cr3(unsigned long cr3)
+@@ -700,12 +736,56 @@ static void xen_write_cr3(unsigned long cr3)
  	   been submitted. */
  	xen_mc_callback(set_current_cr3, (void *)cr3);
  
--	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
--}
--
--/* Early in boot, while setting up the initial pagetable, assume
--   everything is pinned. */
--static __init void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn)
--{
--	BUG_ON(mem_map);	/* should only be used early */
--	make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
--}
 +#ifdef CONFIG_X86_64
 +	{
 +	pgd_t *pgd = __va(cr3);
 +	unsigned long user_mfn = virt_to_mfn(__user_pgd(pgd));
- 
--/* Early release_pt assumes that all pts are pinned, since there's
--   only init_mm and anything attached to that is pinned. */
--static void xen_release_pt_init(u32 pfn)
--{
--	make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
--}
++
 +	mcs = __xen_mc_entry(sizeof(*op));
- 
--static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
--{
--	struct mmuext_op op;
--	op.cmd = cmd;
--	op.arg1.mfn = pfn_to_mfn(pfn);
--	if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF))
--		BUG();
--}
++
 +	op = mcs.args;
 +	op->cmd = MMUEXT_NEW_USER_BASEPTR;
 +	/* pgd_alloc() allocates two pages for us. the second one is the
 +	 * user page table
 +	 */
 +	op->arg1.mfn = user_mfn;
- 
--/* This needs to make sure the new pte page is pinned iff its being
--   attached to a pinned pagetable. */
--static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn,
--			     enum pt_level level)
--{
--	struct page *page = pfn_to_page(pfn);
--
--	if (PagePinned(virt_to_page(mm->pgd))) {
--		SetPagePinned(page);
--
--		if (!PageHighMem(page)) {
--			make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
--			if (level == PT_PTE)
--				pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
--		} else
--			/* make sure there are no stray mappings of
--			   this page */
--			kmap_flush_unused();
++
 +	MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
- 	}
--}
++	}
 +#endif
- 
--static void xen_alloc_pt(struct mm_struct *mm, u32 pfn)
--{
--	xen_alloc_ptpage(mm, pfn, PT_PTE);
-+	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
++
+ 	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
  }
  
--static void xen_alloc_pd(struct mm_struct *mm, u32 pfn)
 +#ifdef CONFIG_X86_64
 +#if 0
 +/*
 + * FIXME: unused
 + */
 +static void xen_new_user_baseptr(unsigned long pfn)
- {
--	xen_alloc_ptpage(mm, pfn, PT_PMD);
--}
++{
 +	struct mmuext_op *op;
 +	struct multicall_space mcs;
 +	unsigned long mfn = pfn_to_mfn(PFN_DOWN(pfn));
- 
--/* This should never happen until we're OK to use struct page */
--static void xen_release_ptpage(u32 pfn, enum pt_level level)
--{
--	struct page *page = pfn_to_page(pfn);
++
 +	xprintk("%s: %lx\n", __func__, pfn);
- 
--	if (PagePinned(page)) {
--		if (!PageHighMem(page)) {
--			if (level == PT_PTE)
--				pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
--			make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
--		}
--	}
++
 +	mcs = xen_mc_entry(sizeof(*op));  /* disables interrupts */
 +
 +	op = mcs.args;
@@ -1966,31 +1907,79 @@
 +	MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 +
 +	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
- }
++}
 +#endif
 +#endif
++
+ /* Early in boot, while setting up the initial pagetable, assume
+    everything is pinned. */
+-static __init void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn)
++static __init void xen_alloc_pt_init(struct mm_struct *mm, unsigned long pfn)
+ {
+ 	BUG_ON(mem_map);	/* should only be used early */
+ 	make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
+@@ -713,7 +793,7 @@ static __init void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn)
+ 
+ /* Early release_pt assumes that all pts are pinned, since there's
+    only init_mm and anything attached to that is pinned. */
+-static void xen_release_pt_init(u32 pfn)
++static void xen_release_pt_init(unsigned long pfn)
+ {
+ 	make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
+ }
+@@ -729,8 +809,8 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
+ 
+ /* This needs to make sure the new pte page is pinned iff its being
+    attached to a pinned pagetable. */
+-static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn,
+-			     enum pt_level level)
++static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn,
++			     unsigned level)
+ {
+ 	struct page *page = pfn_to_page(pfn);
+ 
+@@ -748,18 +828,18 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn,
+ 	}
+ }
+ 
+-static void xen_alloc_pt(struct mm_struct *mm, u32 pfn)
++static void xen_alloc_pt(struct mm_struct *mm, unsigned long pfn)
+ {
+ 	xen_alloc_ptpage(mm, pfn, PT_PTE);
+ }
+ 
+-static void xen_alloc_pd(struct mm_struct *mm, u32 pfn)
++static void xen_alloc_pd(struct mm_struct *mm, unsigned long pfn)
+ {
+ 	xen_alloc_ptpage(mm, pfn, PT_PMD);
+ }
+ 
+ /* This should never happen until we're OK to use struct page */
+-static void xen_release_ptpage(u32 pfn, enum pt_level level)
++static void xen_release_ptpage(unsigned long pfn, unsigned level)
+ {
+ 	struct page *page = pfn_to_page(pfn);
+ 
+@@ -769,15 +849,16 @@ static void xen_release_ptpage(u32 pfn, enum pt_level level)
+ 				pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
+ 			make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
+ 		}
++		ClearPagePinned(page);
+ 	}
+ }
  
 -static void xen_release_pt(u32 pfn)
-+/* Early in boot, while setting up the initial pagetable, assume
-+   everything is pinned. */
-+static __init void xen_alloc_pt_init(struct mm_struct *mm, unsigned long pfn)
++static void xen_release_pt(unsigned long pfn)
  {
--	xen_release_ptpage(pfn, PT_PTE);
-+	BUG_ON(mem_map);	/* should only be used early */
-+	make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
+ 	xen_release_ptpage(pfn, PT_PTE);
  }
  
 -static void xen_release_pd(u32 pfn)
-+/* Early release_pt assumes that all pts are pinned, since there's
-+   only init_mm and anything attached to that is pinned. */
-+static void xen_release_pt_init(unsigned long pfn)
++static void xen_release_pd(unsigned long pfn)
  {
--	xen_release_ptpage(pfn, PT_PMD);
-+	make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
+ 	xen_release_ptpage(pfn, PT_PMD);
  }
- 
- #ifdef CONFIG_HIGHPTE
-@@ -818,14 +834,25 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
+@@ -818,14 +899,25 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
  	xen_set_pte(ptep, pte);
  }
  
@@ -2016,7 +2005,7 @@
  	/*
  	 * copy top-level of Xen-supplied pagetable into place.	 For
  	 * !PAE we can use this as-is, but for PAE it is a stand-in
-@@ -864,6 +891,7 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
+@@ -864,6 +956,7 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
  	 * added to the table can be prepared properly for Xen.
  	 */
  	xen_write_cr3(__pa(base));
@@ -2024,7 +2013,7 @@
  
  	/* Unpin initial Xen pagetable */
  	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE,
-@@ -907,6 +935,9 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
+@@ -907,6 +1000,9 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
  
  	setup_shared_info();
  
@@ -2034,7 +2023,7 @@
  	/* Actually pin the pagetable down, but we can't set PG_pinned
  	   yet because the page structures don't exist yet. */
  	{
-@@ -920,6 +951,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
+@@ -920,6 +1016,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
  
  		pin_pagetable_pfn(level, PFN_DOWN(__pa(base)));
  	}
@@ -2042,7 +2031,7 @@
  }
  
  /* This is called once we have the cpu_possible_map */
-@@ -962,10 +994,12 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
+@@ -962,10 +1059,12 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
  	goto patch_site
  
  	switch (type) {
@@ -2055,7 +2044,7 @@
  #undef SITE
  
  	patch_site:
-@@ -997,6 +1031,37 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
+@@ -997,6 +1096,37 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
  	return ret;
  }
  
@@ -2093,7 +2082,7 @@
  static const struct pv_info xen_info __initdata = {
  	.paravirt_enabled = 1,
  	.shared_kernel_pmd = 0,
-@@ -1044,8 +1109,13 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+@@ -1044,8 +1174,13 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
  	.read_tsc = native_read_tsc,
  	.read_pmc = native_read_pmc,
  
@@ -2107,7 +2096,7 @@
  
  	.load_tr_desc = paravirt_nop,
  	.set_ldt = xen_set_ldt,
-@@ -1055,6 +1125,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+@@ -1055,6 +1190,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
  	.load_gdt = xen_load_gdt,
  	.load_idt = xen_load_idt,
  	.load_tls = xen_load_tls,
@@ -2117,7 +2106,7 @@
  
  	.store_gdt = native_store_gdt,
  	.store_idt = native_store_idt,
-@@ -1123,7 +1196,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
+@@ -1123,7 +1261,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
  	.kmap_atomic_pte = xen_kmap_atomic_pte,
  #endif
  
@@ -2126,7 +2115,7 @@
  	.set_pte_at = xen_set_pte_at,
  	.set_pmd = xen_set_pmd,
  
-@@ -1136,13 +1209,21 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
+@@ -1136,13 +1274,21 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
  #ifdef CONFIG_X86_PAE
  	.set_pte_atomic = xen_set_pte_atomic,
  	.set_pte_present = xen_set_pte_at,
@@ -2150,7 +2139,7 @@
  
  	.activate_mm = xen_activate_mm,
  	.dup_mmap = xen_dup_mmap,
-@@ -1152,6 +1233,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
+@@ -1152,6 +1298,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
  		.enter = paravirt_enter_lazy_mmu,
  		.leave = xen_leave_lazy,
  	},
@@ -2159,7 +2148,7 @@
  };
  
  #ifdef CONFIG_SMP
-@@ -1207,6 +1290,7 @@ static const struct machine_ops __initdata xen_machine_ops = {
+@@ -1207,6 +1355,7 @@ static const struct machine_ops __initdata xen_machine_ops = {
  };
  
  
@@ -2167,7 +2156,7 @@
  static void __init xen_reserve_top(void)
  {
  	unsigned long top = HYPERVISOR_VIRT_START;
-@@ -1217,6 +1301,11 @@ static void __init xen_reserve_top(void)
+@@ -1217,6 +1366,11 @@ static void __init xen_reserve_top(void)
  
  	reserve_top_address(-top + 2 * PAGE_SIZE);
  }
@@ -2179,7 +2168,7 @@
  
  /* First C function to be called on Xen boot */
  asmlinkage void __init xen_start_kernel(void)
-@@ -1228,6 +1317,21 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1228,6 +1382,21 @@ asmlinkage void __init xen_start_kernel(void)
  
  	BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);
  
@@ -2201,7 +2190,7 @@
  	/* Install Xen paravirt ops */
  	pv_info = xen_info;
  	pv_init_ops = xen_init_ops;
-@@ -1237,7 +1341,10 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1237,7 +1406,10 @@ asmlinkage void __init xen_start_kernel(void)
  	pv_apic_ops = xen_apic_ops;
  	pv_mmu_ops = xen_mmu_ops;
  
@@ -2212,7 +2201,7 @@
  
  #ifdef CONFIG_SMP
  	smp_ops = xen_smp_ops;
-@@ -1251,19 +1358,35 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1251,19 +1423,35 @@ asmlinkage void __init xen_start_kernel(void)
  
  	pgd = (pgd_t *)xen_start_info->pt_base;
  
@@ -2220,12 +2209,12 @@
 +	/*FIXME: x86_64 equivalent */
  	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
 +#endif
-+
+ 
 +#ifdef CONFIG_X86_64
 +	/* used by alloc_low_page() */
 +	xen_start_pfn = xen_alloc_pfn = PFN_UP(__pa_symbol(xen_start_info->pt_base)) + xen_start_info->nr_pt_frames;
 +#endif
- 
++
 +#ifdef CONFIG_X86_32
  	init_mm.pgd = pgd; /* use the Xen pagetables to start */
  
@@ -2248,7 +2237,7 @@
  	pv_info.kernel_rpl = 1;
  	if (xen_feature(XENFEAT_supervisor_mode_kernel))
  		pv_info.kernel_rpl = 0;
-@@ -1271,10 +1394,12 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1271,10 +1459,12 @@ asmlinkage void __init xen_start_kernel(void)
  	/* set the limit of our address space */
  	xen_reserve_top();
  
@@ -2888,7 +2877,7 @@
 +
 +
 diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
-index 2a054ef..9480fc5 100644
+index 2a054ef..254cae6 100644
 --- a/arch/x86/xen/mmu.c
 +++ b/arch/x86/xen/mmu.c
 @@ -53,6 +53,8 @@
@@ -3315,24 +3304,7 @@
  {
  	struct mmuext_op *op;
  	struct multicall_space mcs;
-@@ -443,8 +488,14 @@ static int pin_page(struct page *page, enum pt_level level)
- 					pfn_pte(pfn, PAGE_KERNEL_RO),
- 					level == PT_PGD ? UVMF_TLB_FLUSH : 0);
- 
--		if (level == PT_PTE)
--			xen_do_pin(MMUEXT_PIN_L1_TABLE, pfn);
-+		switch (level) {
-+#ifdef CONFIG_X86_64
-+			case PT_PUD: xen_do_pin(MMUEXT_PIN_L3_TABLE, pfn);break;
-+			case PT_PMD: xen_do_pin(MMUEXT_PIN_L2_TABLE, pfn);break;
-+#endif
-+			case PT_PTE: xen_do_pin(MMUEXT_PIN_L1_TABLE, pfn);break;
-+			default: break;
-+		}
- 
- 		if (ptl) {
- 			/* Queue a deferred unlock for when this batch
-@@ -465,20 +516,22 @@ void xen_pgd_pin(pgd_t *pgd)
+@@ -465,20 +510,22 @@ void xen_pgd_pin(pgd_t *pgd)
  
  	xen_mc_batch();
  
@@ -3358,7 +3330,7 @@
  
  	xen_mc_issue(0);
  }
-@@ -492,27 +545,48 @@ static __init int mark_pinned(struct page *page, enum pt_level level)
+@@ -492,9 +539,19 @@ static __init int mark_pinned(struct page *page, enum pt_level level)
  	return 0;
  }
  
@@ -3379,39 +3351,7 @@
  }
  
  static int unpin_page(struct page *page, enum pt_level level)
- {
- 	unsigned pgfl = test_and_clear_bit(PG_pinned, &page->flags);
- 
--	if (pgfl && !PageHighMem(page)) {
-+	if (!PageHighMem(page)) {
- 		void *pt = lowmem_page_address(page);
- 		unsigned long pfn = page_to_pfn(page);
- 		spinlock_t *ptl = NULL;
- 		struct multicall_space mcs;
- 
--		if (level == PT_PTE) {
-+		if (level == PT_PTE)
- 			ptl = lock_pte(page);
- 
--			xen_do_pin(MMUEXT_UNPIN_TABLE, pfn);
-+		if (pgfl) { 
-+			switch (level) {
-+#ifdef CONFIG_X86_64
-+				case PT_PUD:
-+				case PT_PMD:
-+#endif
-+				case PT_PTE:
-+					xen_do_pin(MMUEXT_UNPIN_TABLE, pfn);
-+				break;
-+				default: break;
-+	 		}
- 		}
- 
-+		/* Restore read-write status even when the page is not pinned */
- 		mcs = __xen_mc_entry(0);
- 
- 		MULTI_update_va_mapping(mcs.mc, (unsigned long)pt,
-@@ -533,9 +607,15 @@ static void xen_pgd_unpin(pgd_t *pgd)
+@@ -533,9 +590,15 @@ static void xen_pgd_unpin(pgd_t *pgd)
  {
  	xen_mc_batch();
  
@@ -3429,7 +3369,7 @@
  
  	xen_mc_issue(0);
  }
-@@ -544,6 +624,9 @@ void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)
+@@ -544,6 +607,9 @@ void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next)
  {
  	spin_lock(&next->page_table_lock);
  	xen_pgd_pin(next->pgd);
@@ -3439,7 +3379,7 @@
  	spin_unlock(&next->page_table_lock);
  }
  
-@@ -551,6 +634,9 @@ void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
+@@ -551,6 +617,9 @@ void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
  {
  	spin_lock(&mm->page_table_lock);
  	xen_pgd_pin(mm->pgd);
@@ -3449,7 +3389,7 @@
  	spin_unlock(&mm->page_table_lock);
  }
  
-@@ -562,7 +648,12 @@ static void drop_other_mm_ref(void *info)
+@@ -562,7 +631,12 @@ static void drop_other_mm_ref(void *info)
  {
  	struct mm_struct *mm = info;
  
@@ -3462,94 +3402,11 @@
  		leave_mm(smp_processor_id());
  
  	/* If this cpu still has a stale cr3 reference, then make sure
-@@ -638,3 +729,82 @@ void xen_exit_mmap(struct mm_struct *mm)
- 
- 	spin_unlock(&mm->page_table_lock);
- }
-+
-+void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
-+{
-+	struct mmuext_op op;
-+	op.cmd = cmd;
-+	op.arg1.mfn = pfn_to_mfn(pfn);
-+	if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF))
-+		/*FIXME: we should avoid redundant unpins */
-+		BUG_ON (cmd != MMUEXT_UNPIN_TABLE);
-+}
-+
-+
-+/* This needs to make sure the new pte page is pinned iff its being
-+   attached to a pinned pagetable. */
-+static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn,
-+			     enum pt_level level)
-+{
-+	struct page *page = pfn_to_page(pfn);
-+
-+	if (PagePinned(virt_to_page(mm->pgd))) {
-+		if (!PageHighMem(page)) {
-+			/* Make it read-only so it can be used as
-+			 * a pagetable.
-+			 *
-+			 * It is not pinned here because pv-ops interface
-+			 * doesn't tell us the level of the page table
-+			 * being allocated.
-+			 */
-+			make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
-+
-+			/* PTE is the only level we are really sure is right,
-+			 * by now. The other levels need to be correctly
-+			 * indicated by the pvops interface
-+			 */
-+			if (level == PT_PTE)
-+				pin_page(page, MMUEXT_PIN_L1_TABLE);
-+		} else
-+			/* make sure there are no stray mappings of
-+			   this page */
-+			kmap_flush_unused();
-+	}
-+}
-+
-+void xen_alloc_pt(struct mm_struct *mm, unsigned long pfn)
-+{
-+	xen_alloc_ptpage(mm, pfn, PT_PTE);
-+}
-+
-+void xen_alloc_pd(struct mm_struct *mm, unsigned long pfn)
-+{
-+	xen_alloc_ptpage(mm, pfn, PT_PMD);
-+}
-+
-+/* This should never happen until we're OK to use struct page */
-+static void xen_release_ptpage(unsigned long pfn, enum pt_level level)
-+{
-+	struct page *page = pfn_to_page(pfn);
-+	unsigned pinned = test_and_clear_bit(PG_pinned, &page->flags);
-+	
-+	if (pinned && level == PT_PTE)
-+		pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
-+
-+	/* Make it read-write even when it wasn't pinned, because it
-+	 * has been made read-only without pinning on xen_alloc_ptpage()
-+	 */
-+	if (!PageHighMem(page))
-+		make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
-+
-+}
-+
-+void xen_release_pt(unsigned long pfn)
-+{
-+	xen_release_ptpage(pfn, PT_PTE);
-+}
-+
-+void xen_release_pd(unsigned long pfn)
-+{
-+	xen_release_ptpage(pfn, PT_PMD);
-+}
 diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
-index b5e189b..9b208c7 100644
+index b5e189b..b25b8e4 100644
 --- a/arch/x86/xen/mmu.h
 +++ b/arch/x86/xen/mmu.h
-@@ -28,40 +28,45 @@ void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
+@@ -28,7 +28,6 @@ void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
  void xen_set_pte(pte_t *ptep, pte_t pteval);
  void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
  		    pte_t *ptep, pte_t pteval);
@@ -3557,14 +3414,8 @@
  
  void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
  void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
- void xen_exit_mmap(struct mm_struct *mm);
+@@ -36,32 +35,32 @@ void xen_exit_mmap(struct mm_struct *mm);
  
-+void pin_pagetable_pfn(unsigned level, unsigned long pfn);
-+void xen_alloc_pt(struct mm_struct *mm, unsigned long pfn);
-+void xen_alloc_pd(struct mm_struct *mm, unsigned long pfn);
-+void xen_release_pt(unsigned long pfn);
-+void xen_release_pd(unsigned long pfn);
-+
  void xen_pgd_pin(pgd_t *pgd);
  //void xen_pgd_unpin(pgd_t *pgd);
 +//
@@ -4516,15 +4367,21 @@
 +
 +#endif /* __ASM_ASM_HACK_H */
 diff --git a/include/asm-x86/cmpxchg_64.h b/include/asm-x86/cmpxchg_64.h
-index 56f5b41..57d8608 100644
+index 56f5b41..1556f64 100644
 --- a/include/asm-x86/cmpxchg_64.h
 +++ b/include/asm-x86/cmpxchg_64.h
-@@ -91,6 +91,39 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+@@ -91,6 +91,45 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
  	return old;
  }
  
-+static inline unsigned long __sync_cmpxchg(volatile void *ptr, unsigned long old,
-+				      unsigned long new, int size)
++/*
++ * Always use locked operations when touching memory shared with a
++ * hypervisor, since the system may be SMP even if the guest kernel
++ * isn't.
++ */
++static inline unsigned long __sync_cmpxchg(volatile void *ptr,
++					    unsigned long old,
++					    unsigned long new, int size)
 +{
 +	unsigned long prev;
 +	switch (size) {
@@ -4559,13 +4416,18 @@
  static inline unsigned long __cmpxchg_local(volatile void *ptr,
  			unsigned long old, unsigned long new, int size)
  {
-@@ -132,6 +165,9 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
+@@ -132,6 +171,14 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
  	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\
  	cmpxchg((ptr), (o), (n));					\
    })
-+#define sync_cmpxchg(ptr,o,n)\
-+	((__typeof__(*(ptr)))__sync_cmpxchg((ptr),(unsigned long)(o),\
-+					(unsigned long)(n),sizeof(*(ptr))))
++#define sync_cmpxchg(ptr, o, n)						\
++	((__typeof__(*(ptr)))__sync_cmpxchg((ptr), (unsigned long)(o),	\
++					(unsigned long)(n), sizeof(*(ptr))))
++#define sync_cmpxchg64(ptr, o, n)					\
++  ({									\
++	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\
++	sync_cmpxchg((ptr), (o), (n));					\
++  })
  #define cmpxchg_local(ptr, o, n)					\
  	((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o),	\
  					(unsigned long)(n), sizeof(*(ptr))))
@@ -4890,7 +4752,7 @@
  
  #ifdef __ASSEMBLY__
 diff --git a/include/asm-x86/pgalloc_64.h b/include/asm-x86/pgalloc_64.h
-index 982e1cb..6181290 100644
+index 982e1cb..1188281 100644
 --- a/include/asm-x86/pgalloc_64.h
 +++ b/include/asm-x86/pgalloc_64.h
 @@ -2,6 +2,7 @@
@@ -5011,13 +4873,13 @@
 -#define __pud_free_tlb(tlb,x)   tlb_remove_page((tlb),virt_to_page(x))
 +#define __pmd_free_tlb(tlb,x)				\
 +do {							\
-+	paravirt_release_pt(page_to_pfn(virt_to_page(x)));	\
++	paravirt_release_pd(page_to_pfn(virt_to_page(x)));	\
 +	tlb_remove_page((tlb),virt_to_page(x));			\
 +} while (0)
 +
 +#define __pud_free_tlb(tlb,x)				\
 +do {							\
-+	paravirt_release_pt(page_to_pfn(virt_to_page(x)));	\
++	paravirt_release_pd(page_to_pfn(virt_to_page(x)));	\
 +	tlb_remove_page((tlb),virt_to_page(x));			\
 +} while (0)
  
@@ -5162,10 +5024,10 @@
  
  /* Clear the 'TS' bit */
 diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
-index b0c518c..77108b4 100644
+index b0c518c..965b823 100644
 --- a/include/asm-x86/xen/hypercall.h
 +++ b/include/asm-x86/xen/hypercall.h
-@@ -42,13 +42,43 @@
+@@ -42,13 +42,42 @@
  
  extern struct { char _entry[32]; } hypercall_page[];
  
@@ -5189,7 +5051,7 @@
 + * invalid for `call'"
 + */
 +#define HYPERCALL_STR(name)						\
-+        "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
++	"call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
 +
 +#ifdef CONFIG_X86_64
 +#define IGN1 "=D"
@@ -5207,11 +5069,10 @@
 +		HYPERCALL_STR(name)					\
  		: "=a" (__res)						\
 -		: [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-+		: 						\
  		: "memory" );						\
  	(type)__res;							\
  })
-@@ -57,10 +87,10 @@ extern struct { char _entry[32]; } hypercall_page[];
+@@ -57,10 +86,9 @@ extern struct { char _entry[32]; } hypercall_page[];
  ({									\
  	long __res, __ign1;						\
  	asm volatile (							\
@@ -5220,13 +5081,12 @@
 -		: "1" ((long)(a1)),					\
 -		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
 +		HYPERCALL_STR(name)					\
-+		: "=a" (__res), IGN1 (__ign1)				\
++		: "=a" (__res), IGN1(__ign1)				\
 +		: "1" ((long)(a1))					\
-+		  						\
  		: "memory" );						\
  	(type)__res;							\
  })
-@@ -69,10 +99,10 @@ extern struct { char _entry[32]; } hypercall_page[];
+@@ -69,10 +97,9 @@ extern struct { char _entry[32]; } hypercall_page[];
  ({									\
  	long __res, __ign1, __ign2;					\
  	asm volatile (							\
@@ -5234,27 +5094,25 @@
 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)		\
 -		: "1" ((long)(a1)), "2" ((long)(a2)),			\
 -		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-+		HYPERCALL_STR(name)						\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2)		\
++		HYPERCALL_STR(name)					\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2)		\
 +		: "1" ((long)(a1)), "2" ((long)(a2))			\
-+		  						\
  		: "memory" );						\
  	(type)__res;							\
  })
-@@ -81,26 +111,65 @@ extern struct { char _entry[32]; } hypercall_page[];
+@@ -81,27 +108,64 @@ extern struct { char _entry[32]; } hypercall_page[];
  ({									\
  	long __res, __ign1, __ign2, __ign3;				\
  	asm volatile (							\
 -		"call %[call]"						\
 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-+		HYPERCALL_STR(name)						\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2),		\
++		HYPERCALL_STR(name)					\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2),		\
  		"=d" (__ign3)						\
  		: "1" ((long)(a1)), "2" ((long)(a2)),			\
 -		  "3" ((long)(a3)),					\
 -		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
 +		  "3" ((long)(a3))					\
-+		  						\
  		: "memory" );						\
  	(type)__res;							\
  })
@@ -5272,11 +5130,11 @@
 +	asm volatile (						\
 +		"movq %7,%%r10; "				\
 +		HYPERCALL_STR(name)				\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2),	\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2),	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
 +		"3" ((long)(a3)), "g" ((long)(a4))		\
-+		: "memory", "r10" );				\
++		: "memory", "r10");				\
 +	(type)__res;						\
 +})
 +
@@ -5286,12 +5144,12 @@
 +	asm volatile (						\
 +		"movq %7,%%r10; movq %8,%%r8; "			\
 +		HYPERCALL_STR(name)				\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2),	\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2),	\
 +		"=d" (__ign3)					\
 +		: "1" ((long)(a1)), "2" ((long)(a2)),		\
 +		"3" ((long)(a3)), "g" ((long)(a4)),		\
 +		"g" ((long)(a5))				\
-+		: "memory", "r10", "r8" );			\
++		: "memory", "r10", "r8");			\
 +	(type)__res;						\
 +})
 +
@@ -5304,33 +5162,34 @@
  	asm volatile (							\
 -		"call %[call]"						\
 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-+		HYPERCALL_STR(name)						\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2),		\
++		HYPERCALL_STR(name)					\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2),		\
  		"=d" (__ign3), "=S" (__ign4)				\
  		: "1" ((long)(a1)), "2" ((long)(a2)),			\
 -		  "3" ((long)(a3)), "4" ((long)(a4)),			\
 -		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
+-		: "memory" );						\
 +		  "3" ((long)(a3)), "4" ((long)(a4))			\
-+		  						\
- 		: "memory" );						\
++		: "memory");						\
  	(type)__res;							\
  })
-@@ -109,17 +178,28 @@ extern struct { char _entry[32]; } hypercall_page[];
+ 
+@@ -109,17 +173,27 @@ extern struct { char _entry[32]; } hypercall_page[];
  ({									\
  	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;		\
  	asm volatile (							\
 -		"call %[call]"						\
 -		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-+		HYPERCALL_STR(name)						\
-+		: "=a" (__res), IGN1 (__ign1), IGN2 (__ign2),		\
++		HYPERCALL_STR(name)					\
++		: "=a" (__res), IGN1(__ign1), IGN2(__ign2),		\
  		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)		\
  		: "1" ((long)(a1)), "2" ((long)(a2)),			\
  		  "3" ((long)(a3)), "4" ((long)(a4)),			\
 -		  "5" ((long)(a5)),					\
 -		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
+-		: "memory" );						\
 +		  "5" ((long)(a5))					\
-+		  						\
- 		: "memory" );						\
++		: "memory");						\
  	(type)__res;							\
  })
  
@@ -5348,7 +5207,7 @@
  static inline int
  HYPERVISOR_set_trap_table(struct trap_info *table)
  {
-@@ -152,6 +232,7 @@ HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
+@@ -152,6 +226,7 @@ HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
  	return _hypercall2(int, stack_switch, ss, esp);
  }
  
@@ -5356,7 +5215,7 @@
  static inline int
  HYPERVISOR_set_callbacks(unsigned long event_selector,
  			 unsigned long event_address,
-@@ -162,6 +243,17 @@ HYPERVISOR_set_callbacks(unsigned long event_selector,
+@@ -162,6 +237,17 @@ HYPERVISOR_set_callbacks(unsigned long event_selector,
  			   event_selector, event_address,
  			   failsafe_selector, failsafe_address);
  }
@@ -5374,7 +5233,7 @@
  
  static inline int
  HYPERVISOR_fpu_taskswitch(int set)
-@@ -195,11 +287,20 @@ HYPERVISOR_get_debugreg(int reg)
+@@ -195,11 +281,20 @@ HYPERVISOR_get_debugreg(int reg)
  	return _hypercall1(unsigned long, get_debugreg, reg);
  }
  
@@ -5395,7 +5254,7 @@
  
  static inline int
  HYPERVISOR_memory_op(unsigned int cmd, void *arg)
-@@ -217,12 +318,17 @@ static inline int
+@@ -217,12 +312,17 @@ static inline int
  HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
  			     unsigned long flags)
  {
@@ -5403,19 +5262,17 @@
 +	return _hypercall3(int, update_va_mapping, va,
 +			   new_val.pte, flags);
 +#else
-+#  ifdef CONFIG_X86_PAE
  	unsigned long pte_hi = 0;
--#ifdef CONFIG_X86_PAE
+ #ifdef CONFIG_X86_PAE
  	pte_hi = new_val.pte_high;
--#endif
-+#  endif
+ #endif
  	return _hypercall4(int, update_va_mapping, va,
  			   new_val.pte_low, pte_hi, flags);
 +#endif
  }
  
  static inline int
-@@ -275,12 +381,17 @@ static inline int
+@@ -275,12 +375,17 @@ static inline int
  HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
  					 unsigned long flags, domid_t domid)
  {
@@ -5424,18 +5281,16 @@
 +			   new_val.pte, flags, domid);
 +#else
  	unsigned long pte_hi = 0;
--#ifdef CONFIG_X86_PAE
-+#  ifdef CONFIG_X86_PAE
+ #ifdef CONFIG_X86_PAE
  	pte_hi = new_val.pte_high;
--#endif
-+#  endif
+ #endif
  	return _hypercall5(int, update_va_mapping_otherdomain, va,
  			   new_val.pte_low, pte_hi, flags, domid);
 +#endif
  }
  
  static inline int
-@@ -295,6 +406,16 @@ HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
+@@ -295,6 +400,16 @@ HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
  	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  }
  
@@ -5452,14 +5307,7 @@
  static inline int
  HYPERVISOR_suspend(unsigned long srec)
  {
-@@ -307,21 +428,24 @@ HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
- {
- 	return _hypercall2(int, nmi_op, op, arg);
- }
--
- static inline void
- MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
- 			pte_t new_val, unsigned long flags)
+@@ -314,14 +429,18 @@ MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
  {
  	mcl->op = __HYPERVISOR_update_va_mapping;
  	mcl->args[0] = va;
@@ -5482,7 +5330,7 @@
  }
  
  static inline void
-@@ -341,15 +465,18 @@ MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long v
+@@ -341,15 +460,18 @@ MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long v
  {
  	mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
  	mcl->args[0] = va;
@@ -5506,14 +5354,14 @@
  }
  
  static inline void
-@@ -357,10 +484,16 @@ MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
+@@ -357,10 +479,16 @@ MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
  			struct desc_struct desc)
  {
  	mcl->op = __HYPERVISOR_update_descriptor;
 +#ifdef CONFIG_X86_64
 +	BUG_ON(sizeof(desc) != sizeof(mcl->args[2]));
 +	mcl->args[0] = maddr;
-+	mcl->args[1] = *((unsigned long*)&desc);
++	mcl->args[1] = *((unsigned long *)&desc);
 +#else
  	mcl->args[0] = maddr;
  	mcl->args[1] = maddr >> 32;




More information about the fedora-extras-commits mailing list