Created
February 24, 2012 16:08
-
-
Save liuw/1901795 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c | |
index 1b267e7..2a6f677 100644 | |
--- a/arch/x86/xen/p2m.c | |
+++ b/arch/x86/xen/p2m.c | |
@@ -724,7 +724,9 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |
return 0; | |
} | |
EXPORT_SYMBOL_GPL(m2p_add_override); | |
-int m2p_remove_override(struct page *page, bool clear_pte) | |
+int m2p_remove_override(struct page *page, bool clear_pte, | |
+ uint64_t host_addr, uint64_t dev_bus_addr, | |
+ grant_handle_t handle) | |
{ | |
unsigned long flags; | |
unsigned long mfn; | |
@@ -754,9 +756,16 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |
ClearPagePrivate(page); | |
if (clear_pte) { | |
+ int retrieve_map_op = !(host_addr != ~0ULL && handle != ~0UL && | |
+ dev_bus_addr != ~0ULL); | |
struct gnttab_map_grant_ref *map_op = | |
(struct gnttab_map_grant_ref *) page->index; | |
- set_phys_to_machine(pfn, map_op->dev_bus_addr); | |
+ | |
+ if (!retrieve_map_op) | |
+ set_phys_to_machine(pfn, dev_bus_addr); | |
+ else | |
+ set_phys_to_machine(pfn, map_op->dev_bus_addr); | |
+ | |
if (!PageHighMem(page)) { | |
struct multicall_space mcs; | |
struct gnttab_unmap_grant_ref *unmap_op; | |
@@ -768,7 +777,7 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |
* issued. In this case handle is going to -1 because | |
* it hasn't been modified yet. | |
*/ | |
- if (map_op->handle == -1) | |
+ if (retrieve_map_op && map_op->handle == -1) | |
xen_mc_flush(); | |
/* | |
* Now if map_op->handle is negative it means that the | |
@@ -784,8 +793,13 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |
mcs = xen_mc_entry( | |
sizeof(struct gnttab_unmap_grant_ref)); | |
unmap_op = mcs.args; | |
- unmap_op->host_addr = map_op->host_addr; | |
- unmap_op->handle = map_op->handle; | |
+ if (!retrieve_map_op) { | |
+ unmap_op->host_addr = host_addr; | |
+ unmap_op->handle = handle; | |
+ } else { | |
+ unmap_op->host_addr = map_op->host_addr; | |
+ unmap_op->handle = map_op->handle; | |
+ } | |
unmap_op->dev_bus_addr = 0; | |
MULTI_grant_table_op(mcs.mc, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment