ia64/linux-2.6.18-xen.hg

changeset 314:55705fbc4b0e

merge with linux-2.6.18-xen.hg (staging)
author Alex Williamson <alex.williamson@hp.com>
date Tue Nov 20 11:53:03 2007 -0700 (2007-11-20)
parents 4576e10034d6 037c44559e55
children dea67c1a8efa
files
line diff
     1.1 --- a/drivers/char/tpm/tpm_xen.c	Tue Nov 20 09:33:53 2007 -0700
     1.2 +++ b/drivers/char/tpm/tpm_xen.c	Tue Nov 20 11:53:03 2007 -0700
     1.3 @@ -266,8 +266,7 @@ static void destroy_tpmring(struct tpm_p
     1.4  	tpmif_set_connected_state(tp, 0);
     1.5  
     1.6  	if (tp->ring_ref != GRANT_INVALID_REF) {
     1.7 -		gnttab_end_foreign_access(tp->ring_ref, 0,
     1.8 -					  (unsigned long)tp->tx);
     1.9 +		gnttab_end_foreign_access(tp->ring_ref, (unsigned long)tp->tx);
    1.10  		tp->ring_ref = GRANT_INVALID_REF;
    1.11  		tp->tx = NULL;
    1.12  	}
     2.1 --- a/drivers/xen/blkfront/blkfront.c	Tue Nov 20 09:33:53 2007 -0700
     2.2 +++ b/drivers/xen/blkfront/blkfront.c	Tue Nov 20 11:53:03 2007 -0700
     2.3 @@ -622,7 +622,7 @@ static int blkif_queue_request(struct re
     2.4  				ref,
     2.5  				info->xbdev->otherend_id,
     2.6  				buffer_mfn,
     2.7 -				rq_data_dir(req) );
     2.8 +				rq_data_dir(req) ? GTF_readonly : 0 );
     2.9  
    2.10  			info->shadow[id].frame[ring_req->nr_segments] =
    2.11  				mfn_to_pfn(buffer_mfn);
    2.12 @@ -790,7 +790,7 @@ static void blkif_free(struct blkfront_i
    2.13  
    2.14  	/* Free resources associated with old device channel. */
    2.15  	if (info->ring_ref != GRANT_INVALID_REF) {
    2.16 -		gnttab_end_foreign_access(info->ring_ref, 0,
    2.17 +		gnttab_end_foreign_access(info->ring_ref, 
    2.18  					  (unsigned long)info->ring.sring);
    2.19  		info->ring_ref = GRANT_INVALID_REF;
    2.20  		info->ring.sring = NULL;
    2.21 @@ -804,7 +804,7 @@ static void blkif_completion(struct blk_
    2.22  {
    2.23  	int i;
    2.24  	for (i = 0; i < s->req.nr_segments; i++)
    2.25 -		gnttab_end_foreign_access(s->req.seg[i].gref, 0, 0UL);
    2.26 +		gnttab_end_foreign_access(s->req.seg[i].gref, 0UL);
    2.27  }
    2.28  
    2.29  static void blkif_recover(struct blkfront_info *info)
    2.30 @@ -846,9 +846,9 @@ static void blkif_recover(struct blkfron
    2.31  				req->seg[j].gref,
    2.32  				info->xbdev->otherend_id,
    2.33  				pfn_to_mfn(info->shadow[req->id].frame[j]),
    2.34 -				rq_data_dir(
    2.35 -					(struct request *)
    2.36 -					info->shadow[req->id].request));
    2.37 +				rq_data_dir((struct request *)
    2.38 +					    info->shadow[req->id].request) ?
    2.39 +				GTF_readonly : 0);
    2.40  		info->shadow[req->id].req = *req;
    2.41  
    2.42  		info->ring.req_prod_pvt++;
     3.1 --- a/drivers/xen/core/gnttab.c	Tue Nov 20 09:33:53 2007 -0700
     3.2 +++ b/drivers/xen/core/gnttab.c	Tue Nov 20 11:53:03 2007 -0700
     3.3 @@ -140,7 +140,7 @@ static void put_free_entry(grant_ref_t r
     3.4   */
     3.5  
     3.6  int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
     3.7 -				int readonly)
     3.8 +				int flags)
     3.9  {
    3.10  	int ref;
    3.11  
    3.12 @@ -150,19 +150,21 @@ int gnttab_grant_foreign_access(domid_t 
    3.13  	shared[ref].frame = frame;
    3.14  	shared[ref].domid = domid;
    3.15  	wmb();
    3.16 -	shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0);
    3.17 +	BUG_ON(flags & (GTF_accept_transfer | GTF_reading | GTF_writing));
    3.18 +	shared[ref].flags = GTF_permit_access | flags;
    3.19  
    3.20  	return ref;
    3.21  }
    3.22  EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
    3.23  
    3.24  void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
    3.25 -				     unsigned long frame, int readonly)
    3.26 +				     unsigned long frame, int flags)
    3.27  {
    3.28  	shared[ref].frame = frame;
    3.29  	shared[ref].domid = domid;
    3.30  	wmb();
    3.31 -	shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0);
    3.32 +	BUG_ON(flags & (GTF_accept_transfer | GTF_reading | GTF_writing));
    3.33 +	shared[ref].flags = GTF_permit_access | flags;
    3.34  }
    3.35  EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_ref);
    3.36  
    3.37 @@ -177,7 +179,7 @@ int gnttab_query_foreign_access(grant_re
    3.38  }
    3.39  EXPORT_SYMBOL_GPL(gnttab_query_foreign_access);
    3.40  
    3.41 -int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly)
    3.42 +int gnttab_end_foreign_access_ref(grant_ref_t ref)
    3.43  {
    3.44  	u16 flags, nflags;
    3.45  
    3.46 @@ -194,10 +196,9 @@ int gnttab_end_foreign_access_ref(grant_
    3.47  }
    3.48  EXPORT_SYMBOL_GPL(gnttab_end_foreign_access_ref);
    3.49  
    3.50 -void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
    3.51 -			       unsigned long page)
    3.52 +void gnttab_end_foreign_access(grant_ref_t ref, unsigned long page)
    3.53  {
    3.54 -	if (gnttab_end_foreign_access_ref(ref, readonly)) {
    3.55 +	if (gnttab_end_foreign_access_ref(ref)) {
    3.56  		put_free_entry(ref);
    3.57  		if (page != 0)
    3.58  			free_page(page);
     4.1 --- a/drivers/xen/netfront/netfront.c	Tue Nov 20 09:33:53 2007 -0700
     4.2 +++ b/drivers/xen/netfront/netfront.c	Tue Nov 20 11:53:03 2007 -0700
     4.3 @@ -663,8 +663,7 @@ static void network_tx_buf_gc(struct net
     4.4  				       "domain.\n");
     4.5  				BUG();
     4.6  			}
     4.7 -			gnttab_end_foreign_access_ref(
     4.8 -				np->grant_tx_ref[id], GNTMAP_readonly);
     4.9 +			gnttab_end_foreign_access_ref(np->grant_tx_ref[id]);
    4.10  			gnttab_release_grant_reference(
    4.11  				&np->gref_tx_head, np->grant_tx_ref[id]);
    4.12  			np->grant_tx_ref[id] = GRANT_INVALID_REF;
    4.13 @@ -888,7 +887,7 @@ static void xennet_make_frags(struct sk_
    4.14  
    4.15  		mfn = virt_to_mfn(data);
    4.16  		gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id,
    4.17 -						mfn, GNTMAP_readonly);
    4.18 +						mfn, GTF_readonly);
    4.19  
    4.20  		tx->gref = np->grant_tx_ref[id] = ref;
    4.21  		tx->offset = offset;
    4.22 @@ -910,7 +909,7 @@ static void xennet_make_frags(struct sk_
    4.23  
    4.24  		mfn = pfn_to_mfn(page_to_pfn(frag->page));
    4.25  		gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id,
    4.26 -						mfn, GNTMAP_readonly);
    4.27 +						mfn, GTF_readonly);
    4.28  
    4.29  		tx->gref = np->grant_tx_ref[id] = ref;
    4.30  		tx->offset = frag->page_offset;
    4.31 @@ -972,7 +971,7 @@ static int network_start_xmit(struct sk_
    4.32  	BUG_ON((signed short)ref < 0);
    4.33  	mfn = virt_to_mfn(data);
    4.34  	gnttab_grant_foreign_access_ref(
    4.35 -		ref, np->xbdev->otherend_id, mfn, GNTMAP_readonly);
    4.36 +		ref, np->xbdev->otherend_id, mfn, GTF_readonly);
    4.37  	tx->gref = np->grant_tx_ref[id] = ref;
    4.38  	tx->offset = offset;
    4.39  	tx->size = len;
    4.40 @@ -1198,7 +1197,7 @@ static int xennet_get_responses(struct n
    4.41  			}
    4.42  			pages_flipped++;
    4.43  		} else {
    4.44 -			ret = gnttab_end_foreign_access_ref(ref, 0);
    4.45 +			ret = gnttab_end_foreign_access_ref(ref);
    4.46  			BUG_ON(!ret);
    4.47  		}
    4.48  
    4.49 @@ -1531,8 +1530,7 @@ static void netif_release_tx_bufs(struct
    4.50  			continue;
    4.51  
    4.52  		skb = np->tx_skbs[i];
    4.53 -		gnttab_end_foreign_access_ref(
    4.54 -			np->grant_tx_ref[i], GNTMAP_readonly);
    4.55 +		gnttab_end_foreign_access_ref(np->grant_tx_ref[i]);
    4.56  		gnttab_release_grant_reference(
    4.57  			&np->gref_tx_head, np->grant_tx_ref[i]);
    4.58  		np->grant_tx_ref[i] = GRANT_INVALID_REF;
    4.59 @@ -1642,7 +1640,7 @@ static void netif_release_rx_bufs_copy(s
    4.60  
    4.61  		skb = np->rx_skbs[i];
    4.62  
    4.63 -		if (!gnttab_end_foreign_access_ref(ref, 0))
    4.64 +		if (!gnttab_end_foreign_access_ref(ref))
    4.65  		{
    4.66  			busy++;
    4.67  			continue;
    4.68 @@ -2151,7 +2149,7 @@ static void netif_disconnect_backend(str
    4.69  static void end_access(int ref, void *page)
    4.70  {
    4.71  	if (ref != GRANT_INVALID_REF)
    4.72 -		gnttab_end_foreign_access(ref, 0, (unsigned long)page);
    4.73 +		gnttab_end_foreign_access(ref, (unsigned long)page);
    4.74  }
    4.75  
    4.76  
     5.1 --- a/drivers/xen/pcifront/xenbus.c	Tue Nov 20 09:33:53 2007 -0700
     5.2 +++ b/drivers/xen/pcifront/xenbus.c	Tue Nov 20 11:53:03 2007 -0700
     5.3 @@ -57,7 +57,7 @@ static void free_pdev(struct pcifront_de
     5.4  		xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
     5.5  
     5.6  	if (pdev->gnt_ref != INVALID_GRANT_REF)
     5.7 -		gnttab_end_foreign_access(pdev->gnt_ref, 0,
     5.8 +		gnttab_end_foreign_access(pdev->gnt_ref,
     5.9  					  (unsigned long)pdev->sh_info);
    5.10  
    5.11  	pdev->xdev->dev.driver_data = NULL;
     6.1 --- a/include/xen/gnttab.h	Tue Nov 20 09:33:53 2007 -0700
     6.2 +++ b/include/xen/gnttab.h	Tue Nov 20 11:53:03 2007 -0700
     6.3 @@ -51,14 +51,14 @@ struct gnttab_free_callback {
     6.4  };
     6.5  
     6.6  int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
     6.7 -				int readonly);
     6.8 +				int flags);
     6.9  
    6.10  /*
    6.11   * End access through the given grant reference, iff the grant entry is no
    6.12   * longer in use.  Return 1 if the grant entry was freed, 0 if it is still in
    6.13   * use.
    6.14   */
    6.15 -int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
    6.16 +int gnttab_end_foreign_access_ref(grant_ref_t ref);
    6.17  
    6.18  /*
    6.19   * Eventually end access through the given grant reference, and once that
    6.20 @@ -66,8 +66,7 @@ int gnttab_end_foreign_access_ref(grant_
    6.21   * immediately iff the grant entry is not in use, otherwise it will happen
    6.22   * some time later.  page may be 0, in which case no freeing will occur.
    6.23   */
    6.24 -void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
    6.25 -			       unsigned long page);
    6.26 +void gnttab_end_foreign_access(grant_ref_t ref, unsigned long page);
    6.27  
    6.28  int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
    6.29  
    6.30 @@ -97,7 +96,7 @@ void gnttab_request_free_callback(struct
    6.31  void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
    6.32  
    6.33  void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
    6.34 -				     unsigned long frame, int readonly);
    6.35 +				     unsigned long frame, int flags);
    6.36  
    6.37  void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
    6.38  				       unsigned long pfn);
     7.1 --- a/include/xen/interface/grant_table.h	Tue Nov 20 09:33:53 2007 -0700
     7.2 +++ b/include/xen/interface/grant_table.h	Tue Nov 20 11:53:03 2007 -0700
     7.3 @@ -119,6 +119,7 @@ typedef struct grant_entry grant_entry_t
     7.4   *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
     7.5   *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
     7.6   *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
     7.7 + *  GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags for the grant [GST]
     7.8   */
     7.9  #define _GTF_readonly       (2)
    7.10  #define GTF_readonly        (1U<<_GTF_readonly)
    7.11 @@ -126,6 +127,12 @@ typedef struct grant_entry grant_entry_t
    7.12  #define GTF_reading         (1U<<_GTF_reading)
    7.13  #define _GTF_writing        (4)
    7.14  #define GTF_writing         (1U<<_GTF_writing)
    7.15 +#define _GTF_PWT            (5)
    7.16 +#define GTF_PWT             (1U<<_GTF_PWT)
    7.17 +#define _GTF_PCD            (6)
    7.18 +#define GTF_PCD             (1U<<_GTF_PCD)
    7.19 +#define _GTF_PAT            (7)
    7.20 +#define GTF_PAT             (1U<<_GTF_PAT)
    7.21  
    7.22  /*
    7.23   * Subflags for GTF_accept_transfer: