ia64/xen-unstable

changeset 4102:72960d67a3c4

bitkeeper revision 1.1236.25.4 (4231c1a6aZYdlOMWe-sDNCbcYqausA)

grant tables: tiny tiny change to maptracking in unmap ref.
author cwc22@centipede.cl.cam.ac.uk
date Fri Mar 11 16:04:54 2005 +0000 (2005-03-11)
parents 00c3e9ce38eb
children d5c2dbd99373
files xen/common/grant_table.c
line diff
     1.1 --- a/xen/common/grant_table.c	Fri Mar 11 15:15:34 2005 +0000
     1.2 +++ b/xen/common/grant_table.c	Fri Mar 11 16:04:54 2005 +0000
     1.3 @@ -296,7 +296,6 @@ static int
     1.4                                                          _PAGE_DIRTY    |
     1.5                         ((flags & GNTMAP_readonly) ? 0 : _PAGE_RW),
     1.6                         ld, led );
     1.7 -        DPRINTK("update_grant_va_mapping : rc %d\n", rc);
     1.8  
     1.9          spin_lock(&rd->grant_table->lock);
    1.10  
    1.11 @@ -389,7 +388,7 @@ static int
    1.12      active_grant_entry_t *act;
    1.13      grant_entry_t *sha;
    1.14      grant_mapping_t *map;
    1.15 -    s16            rc = -EFAULT;
    1.16 +    s16            rc = 1;
    1.17      unsigned long  frame, virt;
    1.18  
    1.19      ld = current->domain;
    1.20 @@ -431,8 +430,6 @@ static int
    1.21      act = &rd->grant_table->active[ref];
    1.22      sha = &rd->grant_table->shared[ref];
    1.23  
    1.24 -    // cwc22: TODO: put_maptrack_handle
    1.25 -
    1.26      spin_lock(&rd->grant_table->lock);
    1.27  
    1.28      if ( frame != 0 )
    1.29 @@ -443,10 +440,14 @@ static int
    1.30          if ( map->ref_and_flags & GNTMAP_device_map )
    1.31              act->pin -= (map->ref_and_flags & GNTMAP_readonly) ? 
    1.32                  GNTPIN_devr_inc : GNTPIN_devw_inc;
    1.33 +
    1.34 +        map->ref_and_flags &= ~GNTMAP_device_map;
    1.35 +        (void)__put_user(0, &uop->dev_bus_addr);
    1.36      }
    1.37      else
    1.38          frame = act->frame;
    1.39  
    1.40 +    /* frame is now unmapped for device access */
    1.41  
    1.42      if ( (virt != 0) &&
    1.43           (map->ref_and_flags & GNTMAP_host_map) &&
    1.44 @@ -485,13 +486,17 @@ static int
    1.45              goto fail;
    1.46          }
    1.47  
    1.48 +        map->ref_and_flags &= ~GNTMAP_host_map;
    1.49 +
    1.50          act->pin -= (map->ref_and_flags & GNTMAP_readonly) ?
    1.51                          GNTPIN_hstr_inc : GNTPIN_hstw_inc;
    1.52 -
    1.53          rc = 0;
    1.54          *va = virt;
    1.55      }
    1.56  
    1.57 +    if ( (map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0)
    1.58 +        put_maptrack_handle(ld->grant_table, handle);
    1.59 +
    1.60      /* If the last writable mapping has been removed, put_page_type */
    1.61      if ( ((act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0) &&
    1.62                !(map->ref_and_flags & GNTMAP_readonly) )