[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/common: grant-table: only call IOMMU if paging mode translate is disabled



commit e5a6f60206f58a35601b2bada6ec4fedf5d2ace7
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Tue Apr 22 14:14:19 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri May 2 13:14:10 2014 +0100

    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@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Cc: Keir Fraser <keir@xxxxxxx>
---
 xen/common/grant_table.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 107b000..778bdb7 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -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);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.