ia64/linux-2.6.18-xen.hg

changeset 761:5e1269aa5c29

blktap, gntdev: fix highpte handling

In case of highpte, virt_to_machine() can't be used. Introduce
ptep_to_machine() and use it, also to simplify xen_l1_entry_update().

Original patch from: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 10 13:32:32 2008 +0000 (2008-12-10)
parents 0d10be086a78
children a070228ac76e
files arch/i386/mm/hypervisor.c drivers/xen/blktap/blktap.c drivers/xen/gntdev/gntdev.c include/asm-i386/mach-xen/asm/pgtable.h include/asm-ia64/maddr.h include/asm-x86_64/mach-xen/asm/pgtable.h
line diff
     1.1 --- a/arch/i386/mm/hypervisor.c	Wed Dec 10 13:31:38 2008 +0000
     1.2 +++ b/arch/i386/mm/hypervisor.c	Wed Dec 10 13:32:32 2008 +0000
     1.3 @@ -47,12 +47,7 @@
     1.4  void xen_l1_entry_update(pte_t *ptr, pte_t val)
     1.5  {
     1.6  	mmu_update_t u;
     1.7 -#ifdef CONFIG_HIGHPTE
     1.8 -	u.ptr = ((unsigned long)ptr >= (unsigned long)high_memory) ?
     1.9 -		arbitrary_virt_to_machine(ptr) : virt_to_machine(ptr);
    1.10 -#else
    1.11 -	u.ptr = virt_to_machine(ptr);
    1.12 -#endif
    1.13 +	u.ptr = ptep_to_machine(ptr);
    1.14  	u.val = __pte_val(val);
    1.15  	BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
    1.16  }
     2.1 --- a/drivers/xen/blktap/blktap.c	Wed Dec 10 13:31:38 2008 +0000
     2.2 +++ b/drivers/xen/blktap/blktap.c	Wed Dec 10 13:32:32 2008 +0000
     2.3 @@ -364,7 +364,7 @@ static pte_t blktap_clear_pte(struct vm_
     2.4  		BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
     2.5  
     2.6  		copy = *ptep;
     2.7 -		gnttab_set_unmap_op(&unmap[count], virt_to_machine(ptep), 
     2.8 +		gnttab_set_unmap_op(&unmap[count], ptep_to_machine(ptep),
     2.9  				    GNTMAP_host_map 
    2.10  				    | GNTMAP_application_map 
    2.11  				    | GNTMAP_contains_pte,
     3.1 --- a/drivers/xen/gntdev/gntdev.c	Wed Dec 10 13:31:38 2008 +0000
     3.2 +++ b/drivers/xen/gntdev/gntdev.c	Wed Dec 10 13:32:32 2008 +0000
     3.3 @@ -769,7 +769,7 @@ static pte_t gntdev_clear_pte(struct vm_
     3.4  		    GNTDEV_INVALID_HANDLE && 
     3.5  		    !xen_feature(XENFEAT_auto_translated_physmap)) {
     3.6  			/* NOT USING SHADOW PAGE TABLES. */
     3.7 -			gnttab_set_unmap_op(&op, virt_to_machine(ptep), 
     3.8 +			gnttab_set_unmap_op(&op, ptep_to_machine(ptep), 
     3.9  					    GNTMAP_contains_pte,
    3.10  					    private_data->grants[slot_index]
    3.11  					    .u.valid.user_handle);
     4.1 --- a/include/asm-i386/mach-xen/asm/pgtable.h	Wed Dec 10 13:31:38 2008 +0000
     4.2 +++ b/include/asm-i386/mach-xen/asm/pgtable.h	Wed Dec 10 13:32:32 2008 +0000
     4.3 @@ -488,6 +488,19 @@ void make_pages_writable(void *va, unsig
     4.4  	(((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT)		\
     4.5  	 | ((unsigned long)(va) & (PAGE_SIZE - 1)))
     4.6  
     4.7 +#ifdef CONFIG_HIGHPTE
     4.8 +#include <asm/io.h>
     4.9 +struct page *kmap_atomic_to_page(void *);
    4.10 +#define ptep_to_machine(ptep)						\
    4.11 +({									\
    4.12 +	pte_t *__ptep = (ptep);						\
    4.13 +	page_to_phys(kmap_atomic_to_page(__ptep))			\
    4.14 +		| ((unsigned long)__ptep & (PAGE_SIZE - 1));		\
    4.15 +})
    4.16 +#else
    4.17 +#define ptep_to_machine(ptep)	virt_to_machine(ptep)
    4.18 +#endif
    4.19 +
    4.20  #endif /* !__ASSEMBLY__ */
    4.21  
    4.22  #ifdef CONFIG_FLATMEM
     5.1 --- a/include/asm-ia64/maddr.h	Wed Dec 10 13:31:38 2008 +0000
     5.2 +++ b/include/asm-ia64/maddr.h	Wed Dec 10 13:32:32 2008 +0000
     5.3 @@ -100,6 +100,7 @@ mfn_to_local_pfn(unsigned long mfn)
     5.4  #define virt_to_mfn(virt) (__pa(virt) >> PAGE_SHIFT)
     5.5  #define virt_to_machine(virt) __pa(virt) /* for tpmfront.c */
     5.6  #define arbitrary_virt_to_machine(virt) virt_to_machine(ia64_imva(virt))
     5.7 +#define ptep_to_machine(virt) virt_to_machine(virt)
     5.8  
     5.9  #define set_phys_to_machine(pfn, mfn) do { } while (0)
    5.10  
     6.1 --- a/include/asm-x86_64/mach-xen/asm/pgtable.h	Wed Dec 10 13:31:38 2008 +0000
     6.2 +++ b/include/asm-x86_64/mach-xen/asm/pgtable.h	Wed Dec 10 13:32:32 2008 +0000
     6.3 @@ -30,6 +30,8 @@ extern pte_t *lookup_address(unsigned lo
     6.4  #define arbitrary_virt_to_machine(va)					\
     6.5  	(((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT)		\
     6.6  	 | ((unsigned long)(va) & (PAGE_SIZE - 1)))
     6.7 +
     6.8 +#define ptep_to_machine(ptep)	virt_to_machine(ptep)
     6.9  #endif
    6.10  
    6.11  extern pud_t level3_kernel_pgt[512];