From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 2/6] xenbus: Use grant-table wrapper functions Date: Mon, 24 Oct 2011 17:57:59 -0400 Message-ID: <20111024215759.GL2441@phenom.dumpdata.com> References: <1318969583-23902-1-git-send-email-dgdegra@tycho.nsa.gov> <1319124957-32269-1-git-send-email-dgdegra@tycho.nsa.gov> <1319124957-32269-3-git-send-email-dgdegra@tycho.nsa.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1319124957-32269-3-git-send-email-dgdegra@tycho.nsa.gov> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel De Graaf Cc: xen-devel@lists.xensource.com, Ian.Campbell@citrix.com, david.vrabel@citrix.com List-Id: xen-devel@lists.xenproject.org On Thu, Oct 20, 2011 at 11:35:53AM -0400, Daniel De Graaf wrote: > The gnttab_set_{map,unmap}_op functions should be used instead of > directly populating the fields of gnttab_map_grant_ref. You could also mention that this has the side effect that under HVM, this happens automatically: op->host_addr = __pa(vaddr); while under PV it is unchanged. > > Signed-off-by: Daniel De Graaf > --- > drivers/xen/xenbus/xenbus_client.c | 17 +++++++---------- > 1 files changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c > index 534e744..ca7c287 100644 > --- a/drivers/xen/xenbus/xenbus_client.c > +++ b/drivers/xen/xenbus/xenbus_client.c > @@ -544,12 +544,10 @@ EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); > int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref, > grant_handle_t *handle, void *vaddr) > { > - struct gnttab_map_grant_ref op = { > - .host_addr = (unsigned long)vaddr, > - .flags = GNTMAP_host_map, > - .ref = gnt_ref, > - .dom = dev->otherend_id, > - }; > + struct gnttab_map_grant_ref op; > + > + gnttab_set_map_op(&op, (phys_addr_t)vaddr, GNTMAP_host_map, gnt_ref, > + dev->otherend_id); > > if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)) > BUG(); > @@ -674,10 +672,9 @@ EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree); > int xenbus_unmap_ring(struct xenbus_device *dev, > grant_handle_t handle, void *vaddr) > { > - struct gnttab_unmap_grant_ref op = { > - .host_addr = (unsigned long)vaddr, > - .handle = handle, > - }; > + struct gnttab_unmap_grant_ref op; > + > + gnttab_set_unmap_op(&op, (phys_addr_t)vaddr, GNTMAP_host_map, handle); > > if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)) > BUG(); > -- > 1.7.6.4