WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] iommu: Map correct permissions in IOMMU o

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] iommu: Map correct permissions in IOMMU on grant read-only map request.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 29 May 2010 00:30:45 -0700
Delivery-date: Sat, 29 May 2010 00:35:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1275034080 -3600
# Node ID 69a8e9b6961fda8ee2f38019156323fee0caaf3d
# Parent  9ee5c292b1125bcd281629fc957bbe4c92545014
iommu: Map correct permissions in IOMMU on grant read-only map request.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/grant_table.c |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)

diff -r 9ee5c292b112 -r 69a8e9b6961f xen/common/grant_table.c
--- a/xen/common/grant_table.c  Fri May 28 08:48:50 2010 +0100
+++ b/xen/common/grant_table.c  Fri May 28 09:08:00 2010 +0100
@@ -596,17 +596,20 @@ __gnttab_map_grant_ref(
         goto undo_out;
     }
 
-    if ( (!is_hvm_domain(ld) && need_iommu(ld)) &&
-         !(old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
-         (act_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
-    {
-        /* Shouldn't happen, because you can't use iommu in a HVM
-         * domain. */
+    if ( !is_hvm_domain(ld) && need_iommu(ld) )
+    {
+        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. */
-        if ( iommu_map_page(ld, frame, frame,
-                            IOMMUF_readable|IOMMUF_writable) )
+        if ( (act_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
+             !(old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
+            err = iommu_map_page(ld, frame, frame,
+                                 IOMMUF_readable|IOMMUF_writable);
+        else if ( act_pin && !old_pin )
+            err = iommu_map_page(ld, frame, frame, IOMMUF_readable);
+        if ( err )
         {
             rc = GNTST_general_error;
             goto undo_out;
@@ -780,12 +783,16 @@ __gnttab_unmap_common(
             act->pin -= GNTPIN_hstw_inc;
     }
 
-    if ( (!is_hvm_domain(ld) && need_iommu(ld)) &&
-         (old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
-         !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
-    {
+    if ( !is_hvm_domain(ld) && need_iommu(ld) )
+    {
+        int err = 0;
         BUG_ON(paging_mode_translate(ld));
-        if ( iommu_unmap_page(ld, op->frame) )
+        if ( old_pin && !act->pin )
+            err = iommu_unmap_page(ld, op->frame);
+        else if ( (old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) &&
+                  !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
+            err = iommu_map_page(ld, op->frame, op->frame, IOMMUF_readable);
+        if ( err )
         {
             rc = GNTST_general_error;
             goto unmap_out;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] iommu: Map correct permissions in IOMMU on grant read-only map request., Xen patchbot-unstable <=