[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] blktap, gntdev: fix highpte handling
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1228915952 0 # Node ID 5e1269aa5c2933e0cb0272bf5867e1214174bfde # Parent 0d10be086a781afa2dd220e247e4a8047a296b38 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@xxxxxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- arch/i386/mm/hypervisor.c | 7 +------ drivers/xen/blktap/blktap.c | 2 +- drivers/xen/gntdev/gntdev.c | 2 +- include/asm-i386/mach-xen/asm/pgtable.h | 13 +++++++++++++ include/asm-ia64/maddr.h | 1 + include/asm-x86_64/mach-xen/asm/pgtable.h | 2 ++ 6 files changed, 19 insertions(+), 8 deletions(-) diff -r 0d10be086a78 -r 5e1269aa5c29 arch/i386/mm/hypervisor.c --- a/arch/i386/mm/hypervisor.c Wed Dec 10 13:31:38 2008 +0000 +++ b/arch/i386/mm/hypervisor.c Wed Dec 10 13:32:32 2008 +0000 @@ -47,12 +47,7 @@ void xen_l1_entry_update(pte_t *ptr, pte void xen_l1_entry_update(pte_t *ptr, pte_t val) { mmu_update_t u; -#ifdef CONFIG_HIGHPTE - u.ptr = ((unsigned long)ptr >= (unsigned long)high_memory) ? - arbitrary_virt_to_machine(ptr) : virt_to_machine(ptr); -#else - u.ptr = virt_to_machine(ptr); -#endif + u.ptr = ptep_to_machine(ptr); u.val = __pte_val(val); BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0); } diff -r 0d10be086a78 -r 5e1269aa5c29 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Wed Dec 10 13:31:38 2008 +0000 +++ b/drivers/xen/blktap/blktap.c Wed Dec 10 13:32:32 2008 +0000 @@ -364,7 +364,7 @@ static pte_t blktap_clear_pte(struct vm_ BUG_ON(xen_feature(XENFEAT_auto_translated_physmap)); copy = *ptep; - gnttab_set_unmap_op(&unmap[count], virt_to_machine(ptep), + gnttab_set_unmap_op(&unmap[count], ptep_to_machine(ptep), GNTMAP_host_map | GNTMAP_application_map | GNTMAP_contains_pte, diff -r 0d10be086a78 -r 5e1269aa5c29 drivers/xen/gntdev/gntdev.c --- a/drivers/xen/gntdev/gntdev.c Wed Dec 10 13:31:38 2008 +0000 +++ b/drivers/xen/gntdev/gntdev.c Wed Dec 10 13:32:32 2008 +0000 @@ -769,7 +769,7 @@ static pte_t gntdev_clear_pte(struct vm_ GNTDEV_INVALID_HANDLE && !xen_feature(XENFEAT_auto_translated_physmap)) { /* NOT USING SHADOW PAGE TABLES. */ - gnttab_set_unmap_op(&op, virt_to_machine(ptep), + gnttab_set_unmap_op(&op, ptep_to_machine(ptep), GNTMAP_contains_pte, private_data->grants[slot_index] .u.valid.user_handle); diff -r 0d10be086a78 -r 5e1269aa5c29 include/asm-i386/mach-xen/asm/pgtable.h --- a/include/asm-i386/mach-xen/asm/pgtable.h Wed Dec 10 13:31:38 2008 +0000 +++ b/include/asm-i386/mach-xen/asm/pgtable.h Wed Dec 10 13:32:32 2008 +0000 @@ -487,6 +487,19 @@ void make_pages_writable(void *va, unsig #define arbitrary_virt_to_machine(va) \ (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ | ((unsigned long)(va) & (PAGE_SIZE - 1))) + +#ifdef CONFIG_HIGHPTE +#include <asm/io.h> +struct page *kmap_atomic_to_page(void *); +#define ptep_to_machine(ptep) \ +({ \ + pte_t *__ptep = (ptep); \ + page_to_phys(kmap_atomic_to_page(__ptep)) \ + | ((unsigned long)__ptep & (PAGE_SIZE - 1)); \ +}) +#else +#define ptep_to_machine(ptep) virt_to_machine(ptep) +#endif #endif /* !__ASSEMBLY__ */ diff -r 0d10be086a78 -r 5e1269aa5c29 include/asm-ia64/maddr.h --- a/include/asm-ia64/maddr.h Wed Dec 10 13:31:38 2008 +0000 +++ b/include/asm-ia64/maddr.h Wed Dec 10 13:32:32 2008 +0000 @@ -100,6 +100,7 @@ mfn_to_local_pfn(unsigned long mfn) #define virt_to_mfn(virt) (__pa(virt) >> PAGE_SHIFT) #define virt_to_machine(virt) __pa(virt) /* for tpmfront.c */ #define arbitrary_virt_to_machine(virt) virt_to_machine(ia64_imva(virt)) +#define ptep_to_machine(virt) virt_to_machine(virt) #define set_phys_to_machine(pfn, mfn) do { } while (0) diff -r 0d10be086a78 -r 5e1269aa5c29 include/asm-x86_64/mach-xen/asm/pgtable.h --- a/include/asm-x86_64/mach-xen/asm/pgtable.h Wed Dec 10 13:31:38 2008 +0000 +++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Wed Dec 10 13:32:32 2008 +0000 @@ -30,6 +30,8 @@ extern pte_t *lookup_address(unsigned lo #define arbitrary_virt_to_machine(va) \ (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ | ((unsigned long)(va) & (PAGE_SIZE - 1))) + +#define ptep_to_machine(ptep) virt_to_machine(ptep) #endif extern pud_t level3_kernel_pgt[512]; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |