]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/5e1269aa5c29 |
2 | # HG changeset 761 patch | |
3 | # User Keir Fraser <keir.fraser@citrix.com> | |
4 | # Date 1228915952 0 | |
5 | # Node ID 5e1269aa5c2933e0cb0272bf5867e1214174bfde | |
6 | # Parent 0d10be086a781afa2dd220e247e4a8047a296b38 | |
7 | Subject: blktap, gntdev: fix highpte handling | |
8 | Patch-mainline: obsolete | |
9 | ||
10 | In case of highpte, virt_to_machine() can't be used. Introduce | |
11 | ptep_to_machine() and use it, also to simplify xen_l1_entry_update(). | |
12 | ||
13 | Original patch from: Isaku Yamahata <yamahata@valinux.co.jp> | |
14 | Signed-off-by: Jan Beulich <jbeulich@novell.com> | |
15 | ||
16 | --- head-2008-12-15.orig/arch/x86/mm/hypervisor.c 2008-12-15 11:13:20.000000000 +0100 | |
17 | +++ head-2008-12-15/arch/x86/mm/hypervisor.c 2008-12-15 11:13:45.000000000 +0100 | |
18 | @@ -47,12 +47,7 @@ | |
19 | void xen_l1_entry_update(pte_t *ptr, pte_t val) | |
20 | { | |
21 | mmu_update_t u; | |
22 | -#ifdef CONFIG_HIGHPTE | |
23 | - u.ptr = ((unsigned long)ptr >= (unsigned long)high_memory) ? | |
24 | - arbitrary_virt_to_machine(ptr) : virt_to_machine(ptr); | |
25 | -#else | |
26 | - u.ptr = virt_to_machine(ptr); | |
27 | -#endif | |
28 | + u.ptr = ptep_to_machine(ptr); | |
29 | u.val = __pte_val(val); | |
30 | BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0); | |
31 | } | |
32 | --- head-2008-12-15.orig/drivers/xen/blktap/blktap.c 2008-12-15 11:13:20.000000000 +0100 | |
33 | +++ head-2008-12-15/drivers/xen/blktap/blktap.c 2008-12-15 11:13:45.000000000 +0100 | |
34 | @@ -364,7 +364,7 @@ static pte_t blktap_clear_pte(struct vm_ | |
35 | BUG_ON(xen_feature(XENFEAT_auto_translated_physmap)); | |
36 | ||
37 | copy = *ptep; | |
38 | - gnttab_set_unmap_op(&unmap[count], virt_to_machine(ptep), | |
39 | + gnttab_set_unmap_op(&unmap[count], ptep_to_machine(ptep), | |
40 | GNTMAP_host_map | |
41 | | GNTMAP_application_map | |
42 | | GNTMAP_contains_pte, | |
43 | --- head-2008-12-15.orig/drivers/xen/gntdev/gntdev.c 2008-12-15 11:13:20.000000000 +0100 | |
44 | +++ head-2008-12-15/drivers/xen/gntdev/gntdev.c 2008-12-15 11:13:45.000000000 +0100 | |
45 | @@ -769,7 +769,7 @@ static pte_t gntdev_clear_pte(struct vm_ | |
46 | GNTDEV_INVALID_HANDLE && | |
47 | !xen_feature(XENFEAT_auto_translated_physmap)) { | |
48 | /* NOT USING SHADOW PAGE TABLES. */ | |
49 | - gnttab_set_unmap_op(&op, virt_to_machine(ptep), | |
50 | + gnttab_set_unmap_op(&op, ptep_to_machine(ptep), | |
51 | GNTMAP_contains_pte, | |
52 | private_data->grants[slot_index] | |
53 | .u.valid.user_handle); | |
54 | --- head-2008-12-15.orig/include/asm-x86/mach-xen/asm/pgtable_32.h 2008-12-15 11:13:20.000000000 +0100 | |
55 | +++ head-2008-12-15/include/asm-x86/mach-xen/asm/pgtable_32.h 2008-12-15 11:13:45.000000000 +0100 | |
56 | @@ -488,6 +488,19 @@ void make_pages_writable(void *va, unsig | |
57 | (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ | |
58 | | ((unsigned long)(va) & (PAGE_SIZE - 1))) | |
59 | ||
60 | +#ifdef CONFIG_HIGHPTE | |
61 | +#include <asm/io.h> | |
62 | +struct page *kmap_atomic_to_page(void *); | |
63 | +#define ptep_to_machine(ptep) \ | |
64 | +({ \ | |
65 | + pte_t *__ptep = (ptep); \ | |
66 | + page_to_phys(kmap_atomic_to_page(__ptep)) \ | |
67 | + | ((unsigned long)__ptep & (PAGE_SIZE - 1)); \ | |
68 | +}) | |
69 | +#else | |
70 | +#define ptep_to_machine(ptep) virt_to_machine(ptep) | |
71 | +#endif | |
72 | + | |
73 | #endif /* !__ASSEMBLY__ */ | |
74 | ||
75 | #ifdef CONFIG_FLATMEM | |
76 | --- head-2008-12-15.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-15 11:13:20.000000000 +0100 | |
77 | +++ head-2008-12-15/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-15 11:13:45.000000000 +0100 | |
78 | @@ -30,6 +30,8 @@ extern pte_t *lookup_address(unsigned lo | |
79 | #define arbitrary_virt_to_machine(va) \ | |
80 | (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ | |
81 | | ((unsigned long)(va) & (PAGE_SIZE - 1))) | |
82 | + | |
83 | +#define ptep_to_machine(ptep) virt_to_machine(ptep) | |
84 | #endif | |
85 | ||
86 | extern pud_t level3_kernel_pgt[512]; |