Commit 3d24bbd7 authored by Stefano Stabellini's avatar Stefano Stabellini

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: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>

Changes in v9:
- add in-code comments.
parent 3d1975b5
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <xen/grant_table.h> #include <xen/grant_table.h>
#include <xen/interface/memory.h> #include <xen/interface/memory.h>
#include <xen/hvc-console.h> #include <xen/hvc-console.h>
#include <xen/swiotlb-xen.h>
#include <asm/xen/hypercall.h> #include <asm/xen/hypercall.h>
#include <asm/xen/interface.h> #include <asm/xen/interface.h>
...@@ -898,8 +899,16 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, ...@@ -898,8 +899,16 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i, gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i,
&map_ops[i].status, __func__); &map_ops[i].status, __func__);
if (xen_feature(XENFEAT_auto_translated_physmap)) /* this is basically a nop on x86 */
if (xen_feature(XENFEAT_auto_translated_physmap)) {
for (i = 0; i < count; i++) {
if (map_ops[i].status)
continue;
set_phys_to_machine(map_ops[i].host_addr >> PAGE_SHIFT,
map_ops[i].dev_bus_addr >> PAGE_SHIFT);
}
return ret; return ret;
}
if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) {
arch_enter_lazy_mmu_mode(); arch_enter_lazy_mmu_mode();
...@@ -942,8 +951,14 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, ...@@ -942,8 +951,14 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
if (ret) if (ret)
return ret; return ret;
if (xen_feature(XENFEAT_auto_translated_physmap)) /* this is basically a nop on x86 */
if (xen_feature(XENFEAT_auto_translated_physmap)) {
for (i = 0; i < count; i++) {
set_phys_to_machine(unmap_ops[i].host_addr >> PAGE_SHIFT,
INVALID_P2M_ENTRY);
}
return ret; return ret;
}
if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { if (!in_interrupt() && paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) {
arch_enter_lazy_mmu_mode(); arch_enter_lazy_mmu_mode();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment