[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 1/2] gnttab: add IOMMU entries for grant mappings on auto-translated guests
When using grant mappings with auto-translated guests (PVH, HVM), Xen was not updating the IOMMU entries for the domain. This patch adds the necessary bits in order to properly update the IOMMU when doing grant maps/unmap on auto-translated guests. Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx> Cc: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/grant_table.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 107b000..665f34b 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -749,6 +749,22 @@ __gnttab_map_grant_ref( goto undo_out; } } + else if ( need_iommu(ld) ) + { + int err; + + BUG_ON(!paging_mode_translate(ld)); + err = iommu_map_page(ld, op->host_addr >> PAGE_SHIFT, frame, + op->flags & GNTMAP_readonly ? + IOMMUF_readable : + IOMMUF_readable|IOMMUF_writable); + if ( err ) + { + double_gt_unlock(lgt, rgt); + rc = GNTST_general_error; + goto undo_out; + } + } TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom); @@ -947,6 +963,18 @@ __gnttab_unmap_common( goto unmap_out; } } + else if ( need_iommu(ld) ) + { + int err; + + BUG_ON(!paging_mode_translate(ld)); + err = iommu_unmap_page(ld, op->host_addr >> PAGE_SHIFT); + if ( err ) + { + rc = GNTST_general_error; + goto unmap_out; + } + } /* If just unmapped a writable mapping, mark as dirtied */ if ( !(op->flags & GNTMAP_readonly) ) -- 1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |