diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2013-10-25 06:41:44 -0400 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2013-10-25 06:41:44 -0400 |
commit | 3d24bbd7dddbea54358a9795abaf051b0f18973c (patch) | |
tree | 3c93cf1e6884e88d5f84699e8ef9a789c357a516 /drivers/xen/grant-table.c | |
parent | 3d1975b57097820c131c692d2e0d075641370369 (diff) |
grant-table: call set_phys_to_machine after mapping grant refs
When mapping/unmapping grant refs, call
set_phys_to_machine to update the P2M with the new mappings for
autotranslate guests.
This is (almost) a nop on x86.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Changes in v9:
- add in-code comments.
Diffstat (limited to 'drivers/xen/grant-table.c')
-rw-r--r-- | drivers/xen/grant-table.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index c4d2298893b1..62ccf5424ba8 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <xen/grant_table.h> | 49 | #include <xen/grant_table.h> |
50 | #include <xen/interface/memory.h> | 50 | #include <xen/interface/memory.h> |
51 | #include <xen/hvc-console.h> | 51 | #include <xen/hvc-console.h> |
52 | #include <xen/swiotlb-xen.h> | ||
52 | #include <asm/xen/hypercall.h> | 53 | #include <asm/xen/hypercall.h> |
53 | #include <asm/xen/interface.h> | 54 | #include <asm/xen/interface.h> |
54 | 55 | ||
@@ -898,8 +899,16 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
898 | gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i, | 899 | gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i, |
899 | &map_ops[i].status, __func__); | 900 | &map_ops[i].status, __func__); |
900 | 901 | ||
901 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 902 | /* this is basically a nop on x86 */ |
903 | if (xen_feature(XENFEAT_auto_translated_physmap)) { | ||
904 | for (i = 0; i < count; i++) { | ||
905 | if (map_ops[i].status) | ||
906 | continue; | ||
907 | set_phys_to_machine(map_ops[i].host_addr >> PAGE_SHIFT, | ||
908 | map_ops[i].dev_bus_addr >> PAGE_SHIFT); | ||
909 | } | ||
902 | return ret; | 910 | return ret; |
911 | } | ||
903 | 912 | ||
904 | if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { | 913 | if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { |
905 | arch_enter_lazy_mmu_mode(); | 914 | arch_enter_lazy_mmu_mode(); |
@@ -942,8 +951,14 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
942 | if (ret) | 951 | if (ret) |
943 | return ret; | 952 | return ret; |
944 | 953 | ||
945 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 954 | /* this is basically a nop on x86 */ |
955 | if (xen_feature(XENFEAT_auto_translated_physmap)) { | ||
956 | for (i = 0; i < count; i++) { | ||
957 | set_phys_to_machine(unmap_ops[i].host_addr >> PAGE_SHIFT, | ||
958 | INVALID_P2M_ENTRY); | ||
959 | } | ||
946 | return ret; | 960 | return ret; |
961 | } | ||
947 | 962 | ||
948 | if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { | 963 | if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { |
949 | arch_enter_lazy_mmu_mode(); | 964 | arch_enter_lazy_mmu_mode(); |