diff options
Diffstat (limited to 'arch/x86/xen/p2m.c')
-rw-r--r-- | arch/x86/xen/p2m.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index b5e4d302a067..95fb2aa5927e 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -906,9 +906,6 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
906 | 906 | ||
907 | xen_mc_issue(PARAVIRT_LAZY_MMU); | 907 | xen_mc_issue(PARAVIRT_LAZY_MMU); |
908 | } | 908 | } |
909 | /* let's use dev_bus_addr to record the old mfn instead */ | ||
910 | kmap_op->dev_bus_addr = page->index; | ||
911 | page->index = (unsigned long) kmap_op; | ||
912 | } | 909 | } |
913 | spin_lock_irqsave(&m2p_override_lock, flags); | 910 | spin_lock_irqsave(&m2p_override_lock, flags); |
914 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); | 911 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); |
@@ -935,7 +932,8 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
935 | return 0; | 932 | return 0; |
936 | } | 933 | } |
937 | EXPORT_SYMBOL_GPL(m2p_add_override); | 934 | EXPORT_SYMBOL_GPL(m2p_add_override); |
938 | int m2p_remove_override(struct page *page, bool clear_pte) | 935 | int m2p_remove_override(struct page *page, |
936 | struct gnttab_map_grant_ref *kmap_op) | ||
939 | { | 937 | { |
940 | unsigned long flags; | 938 | unsigned long flags; |
941 | unsigned long mfn; | 939 | unsigned long mfn; |
@@ -965,10 +963,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
965 | WARN_ON(!PagePrivate(page)); | 963 | WARN_ON(!PagePrivate(page)); |
966 | ClearPagePrivate(page); | 964 | ClearPagePrivate(page); |
967 | 965 | ||
968 | if (clear_pte) { | 966 | set_phys_to_machine(pfn, page->index); |
969 | struct gnttab_map_grant_ref *map_op = | 967 | if (kmap_op != NULL) { |
970 | (struct gnttab_map_grant_ref *) page->index; | ||
971 | set_phys_to_machine(pfn, map_op->dev_bus_addr); | ||
972 | if (!PageHighMem(page)) { | 968 | if (!PageHighMem(page)) { |
973 | struct multicall_space mcs; | 969 | struct multicall_space mcs; |
974 | struct gnttab_unmap_grant_ref *unmap_op; | 970 | struct gnttab_unmap_grant_ref *unmap_op; |
@@ -980,13 +976,13 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
980 | * issued. In this case handle is going to -1 because | 976 | * issued. In this case handle is going to -1 because |
981 | * it hasn't been modified yet. | 977 | * it hasn't been modified yet. |
982 | */ | 978 | */ |
983 | if (map_op->handle == -1) | 979 | if (kmap_op->handle == -1) |
984 | xen_mc_flush(); | 980 | xen_mc_flush(); |
985 | /* | 981 | /* |
986 | * Now if map_op->handle is negative it means that the | 982 | * Now if kmap_op->handle is negative it means that the |
987 | * hypercall actually returned an error. | 983 | * hypercall actually returned an error. |
988 | */ | 984 | */ |
989 | if (map_op->handle == GNTST_general_error) { | 985 | if (kmap_op->handle == GNTST_general_error) { |
990 | printk(KERN_WARNING "m2p_remove_override: " | 986 | printk(KERN_WARNING "m2p_remove_override: " |
991 | "pfn %lx mfn %lx, failed to modify kernel mappings", | 987 | "pfn %lx mfn %lx, failed to modify kernel mappings", |
992 | pfn, mfn); | 988 | pfn, mfn); |
@@ -996,8 +992,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
996 | mcs = xen_mc_entry( | 992 | mcs = xen_mc_entry( |
997 | sizeof(struct gnttab_unmap_grant_ref)); | 993 | sizeof(struct gnttab_unmap_grant_ref)); |
998 | unmap_op = mcs.args; | 994 | unmap_op = mcs.args; |
999 | unmap_op->host_addr = map_op->host_addr; | 995 | unmap_op->host_addr = kmap_op->host_addr; |
1000 | unmap_op->handle = map_op->handle; | 996 | unmap_op->handle = kmap_op->handle; |
1001 | unmap_op->dev_bus_addr = 0; | 997 | unmap_op->dev_bus_addr = 0; |
1002 | 998 | ||
1003 | MULTI_grant_table_op(mcs.mc, | 999 | MULTI_grant_table_op(mcs.mc, |
@@ -1008,10 +1004,9 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
1008 | set_pte_at(&init_mm, address, ptep, | 1004 | set_pte_at(&init_mm, address, ptep, |
1009 | pfn_pte(pfn, PAGE_KERNEL)); | 1005 | pfn_pte(pfn, PAGE_KERNEL)); |
1010 | __flush_tlb_single(address); | 1006 | __flush_tlb_single(address); |
1011 | map_op->host_addr = 0; | 1007 | kmap_op->host_addr = 0; |
1012 | } | 1008 | } |
1013 | } else | 1009 | } |
1014 | set_phys_to_machine(pfn, page->index); | ||
1015 | 1010 | ||
1016 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present | 1011 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present |
1017 | * somewhere in this domain, even before being added to the | 1012 | * somewhere in this domain, even before being added to the |