ia64/xen-unstable

changeset 16068:062fe1c7b09f

Clean up grant-table code after recent changes.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Oct 04 10:31:44 2007 +0100 (2007-10-04)
parents 9f9f9b68cd08
children 56b543dd0da2
files xen/common/grant_table.c xen/include/xen/iocap.h
line diff
     1.1 --- a/xen/common/grant_table.c	Thu Oct 04 10:26:21 2007 +0100
     1.2 +++ b/xen/common/grant_table.c	Thu Oct 04 10:31:44 2007 +0100
     1.3 @@ -332,19 +332,21 @@ static void
     1.4      if ( op->flags & GNTMAP_host_map ) 
     1.5      {
     1.6          /* Could be an iomem page for setting up permission */
     1.7 -        if( iomem_page_test(frame, mfn_to_page(frame)) ) {
     1.8 +        if ( iomem_page_test(frame, mfn_to_page(frame)) )
     1.9 +        {
    1.10              is_iomem = 1;
    1.11 -            if ( iomem_permit_access(ld, frame, frame) ) {
    1.12 +            if ( iomem_permit_access(ld, frame, frame) )
    1.13 +            {
    1.14                  gdprintk(XENLOG_WARNING, 
    1.15 -                         "Could not permit access to grant frame %lx as iomem\n",
    1.16 -                         frame);
    1.17 +                         "Could not permit access to grant frame "
    1.18 +                         "%lx as iomem\n", frame);
    1.19                  rc = GNTST_general_error;
    1.20                  goto undo_out;
    1.21              }
    1.22          }
    1.23      } 
    1.24  
    1.25 -    if (!is_iomem ) 
    1.26 +    if ( !is_iomem ) 
    1.27      {
    1.28          if ( unlikely(!mfn_valid(frame)) ||
    1.29               unlikely(!((op->flags & GNTMAP_readonly) ?
    1.30 @@ -353,7 +355,8 @@ static void
    1.31                                            PGT_writable_page))))
    1.32          {
    1.33              if ( !rd->is_dying )
    1.34 -                gdprintk(XENLOG_WARNING, "Could not pin grant frame %lx\n", frame);
    1.35 +                gdprintk(XENLOG_WARNING,
    1.36 +                         "Could not pin grant frame %lx\n", frame);
    1.37              rc = GNTST_general_error;
    1.38              goto undo_out;
    1.39          }
    1.40 @@ -558,7 +561,8 @@ static void
    1.41  
    1.42      rd = op->rd;
    1.43  
    1.44 -    if ( rd == NULL ) { 
    1.45 +    if ( rd == NULL )
    1.46 +    { 
    1.47          /*
    1.48           * Suggests that __gntab_unmap_common failed in
    1.49           * rcu_lock_domain_by_id() or earlier, and so we have nothing
    1.50 @@ -653,7 +657,8 @@ gnttab_unmap_grant_ref(
    1.51      struct gnttab_unmap_grant_ref op;
    1.52      struct gnttab_unmap_common common[GNTTAB_UNMAP_BATCH_SIZE];
    1.53  
    1.54 -    while (count != 0) {
    1.55 +    while ( count != 0 )
    1.56 +    {
    1.57          c = min(count, (unsigned int)GNTTAB_UNMAP_BATCH_SIZE);
    1.58          partial_done = 0;
    1.59  
    1.60 @@ -670,9 +675,7 @@ gnttab_unmap_grant_ref(
    1.61          flush_tlb_mask(current->domain->domain_dirty_cpumask);
    1.62  
    1.63          for ( i = 0; i < partial_done; i++ )
    1.64 -        {
    1.65              __gnttab_unmap_common_complete(&(common[i]));
    1.66 -        }
    1.67  
    1.68          count -= c;
    1.69          done += c;
    1.70 @@ -684,9 +687,7 @@ fault:
    1.71      flush_tlb_mask(current->domain->domain_dirty_cpumask);
    1.72  
    1.73      for ( i = 0; i < partial_done; i++ )
    1.74 -    {
    1.75          __gnttab_unmap_common_complete(&(common[i]));
    1.76 -    }
    1.77      return -EFAULT;
    1.78  }
    1.79  
    1.80 @@ -715,7 +716,8 @@ gnttab_unmap_and_replace(
    1.81      struct gnttab_unmap_and_replace op;
    1.82      struct gnttab_unmap_common common[GNTTAB_UNMAP_BATCH_SIZE];
    1.83  
    1.84 -    while (count != 0) {
    1.85 +    while ( count != 0 )
    1.86 +    {
    1.87          c = min(count, (unsigned int)GNTTAB_UNMAP_BATCH_SIZE);
    1.88          partial_done = 0;
    1.89          
    1.90 @@ -732,9 +734,7 @@ gnttab_unmap_and_replace(
    1.91          flush_tlb_mask(current->domain->domain_dirty_cpumask);
    1.92          
    1.93          for ( i = 0; i < partial_done; i++ )
    1.94 -        {
    1.95              __gnttab_unmap_common_complete(&(common[i]));
    1.96 -        }
    1.97  
    1.98          count -= c;
    1.99          done += c;
   1.100 @@ -746,9 +746,7 @@ fault:
   1.101      flush_tlb_mask(current->domain->domain_dirty_cpumask);
   1.102  
   1.103      for ( i = 0; i < partial_done; i++ )
   1.104 -    {
   1.105          __gnttab_unmap_common_complete(&(common[i]));
   1.106 -    }
   1.107      return -EFAULT;    
   1.108  }
   1.109  
   1.110 @@ -1427,9 +1425,6 @@ do_grant_table_op(
   1.111              guest_handle_cast(uop, gnttab_map_grant_ref_t);
   1.112          if ( unlikely(!guest_handle_okay(map, count)) )
   1.113              goto out;
   1.114 -        rc = -EPERM;
   1.115 -        if ( unlikely(!grant_operation_permitted(d)) )
   1.116 -            goto out;
   1.117          rc = gnttab_map_grant_ref(map, count);
   1.118          break;
   1.119      }
   1.120 @@ -1439,9 +1434,6 @@ do_grant_table_op(
   1.121              guest_handle_cast(uop, gnttab_unmap_grant_ref_t);
   1.122          if ( unlikely(!guest_handle_okay(unmap, count)) )
   1.123              goto out;
   1.124 -        rc = -EPERM;
   1.125 -        if ( unlikely(!grant_operation_permitted(d)) )
   1.126 -            goto out;
   1.127          rc = gnttab_unmap_grant_ref(unmap, count);
   1.128          break;
   1.129      }
   1.130 @@ -1451,9 +1443,6 @@ do_grant_table_op(
   1.131              guest_handle_cast(uop, gnttab_unmap_and_replace_t);
   1.132          if ( unlikely(!guest_handle_okay(unmap, count)) )
   1.133              goto out;
   1.134 -        rc = -EPERM;
   1.135 -        if ( unlikely(!grant_operation_permitted(d)) )
   1.136 -            goto out;
   1.137          rc = -ENOSYS;
   1.138          if ( unlikely(!replace_grant_supported()) )
   1.139              goto out;
   1.140 @@ -1472,9 +1461,6 @@ do_grant_table_op(
   1.141              guest_handle_cast(uop, gnttab_transfer_t);
   1.142          if ( unlikely(!guest_handle_okay(transfer, count)) )
   1.143              goto out;
   1.144 -        rc = -EPERM;
   1.145 -        if ( unlikely(!grant_operation_permitted(d)) )
   1.146 -            goto out;
   1.147          rc = gnttab_transfer(transfer, count);
   1.148          break;
   1.149      }
     2.1 --- a/xen/include/xen/iocap.h	Thu Oct 04 10:26:21 2007 +0100
     2.2 +++ b/xen/include/xen/iocap.h	Thu Oct 04 10:31:44 2007 +0100
     2.3 @@ -31,6 +31,4 @@
     2.4  #define multipage_allocation_permitted(d)               \
     2.5      (!rangeset_is_empty((d)->iomem_caps))
     2.6  
     2.7 -#define grant_operation_permitted(d) (1)
     2.8 -
     2.9  #endif /* __XEN_IOCAP_H__ */