]> xenbits.xensource.com Git - people/sstabellini/linux-pvhvm-deprecated.git/commitdiff
xenbus: Use grant-table wrapper functions
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Wed, 14 Dec 2011 20:12:10 +0000 (15:12 -0500)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 2 Jul 2012 14:13:23 +0000 (14:13 +0000)
For xenbus_{map,unmap}_ring to work on HVM, the grant table operations
must be set up using the gnttab_set_{map,unmap}_op functions instead of
directly populating the fields of gnttab_map_grant_ref. These functions
simply populate the structure on paravirtualized Xen; however, on HVM
they must call __pa() on vaddr when populating op->host_addr because the
hypervisor cannot directly interpret guest-virtual addresses.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
[v1: Fixed cleanpatch error]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xenbus/xenbus_client.c

index 374b916f6c782747b231de017df1d823fce4cced..4f0896c64f53ff85ed626a68481aaa61ddd7f394 100644 (file)
@@ -568,12 +568,10 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev,
 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();
@@ -699,10 +697,9 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr)
 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();