xen/common: grant-table: only call IOMMU if paging mode translate is disabled

From Xen point of view, ARM guests are PV guest with paging auto translate
enabled.

When IOMMU support will be added for ARM, mapping grant ref will always crash
Xen due to the BUG_ON in __gnttab_map_grant_ref.

On x86:
    - PV guests always have paging mode translate disabled
    - PVH and HVM guests have always paging mode translate enabled

It means that we can safely replace the check that the domain is a PV guests
by checking if the guest has paging mode translate enabled.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Keir Fraser <keir@xen.org>
This commit is contained in:
Julien Grall authored and Ian Campbell committed 2014-05-02 13:14:10 +01:00
1 parent c93e9e4124
commit e5a6f60206
1 file changed
+2 -5
+2 -5
View File
@@ -721,12 +721,10 @@ __gnttab_map_grant_ref(
double_gt_lock(lgt, rgt);
if ( is_pv_domain(ld) && need_iommu(ld) )
if ( !paging_mode_translate(ld) && need_iommu(ld) )
{
unsigned int wrc, rdc;
int err = 0;
/* Shouldn't happen, because you can't use iommu in a HVM domain. */
BUG_ON(paging_mode_translate(ld));
/* We're not translated, so we know that gmfns and mfns are
the same things, so the IOMMU entry is always 1-to-1. */
mapcount(lgt, rd, frame, &wrc, &rdc);
@@ -931,11 +929,10 @@ __gnttab_unmap_common(
act->pin -= GNTPIN_hstw_inc;
}
if ( is_pv_domain(ld) && need_iommu(ld) )
if ( !paging_mode_translate(ld) && need_iommu(ld) )
{
unsigned int wrc, rdc;
int err = 0;
BUG_ON(paging_mode_translate(ld));
mapcount(lgt, rd, op->frame, &wrc, &rdc);
if ( (wrc + rdc) == 0 )
err = iommu_unmap_page(ld, op->frame);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.