summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/xen.c6
-rw-r--r--sys/dev/pv/xenvar.h11
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index 436d6dda956..047c74c384a 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.21 2016/01/04 16:07:52 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.22 2016/01/05 13:47:28 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -1048,6 +1048,8 @@ xen_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
return (error);
}
gm[i].gm_paddr = map->dm_segs[i].ds_addr;
+ map->dm_segs[i].ds_offset = map->dm_segs[i].ds_addr &
+ PAGE_MASK;
map->dm_segs[i].ds_addr = gm[i].gm_ref;
}
return (0);
@@ -1073,6 +1075,8 @@ xen_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
return (error);
}
gm[i].gm_paddr = map->dm_segs[i].ds_addr;
+ map->dm_segs[i].ds_offset = map->dm_segs[i].ds_addr &
+ PAGE_MASK;
map->dm_segs[i].ds_addr = gm[i].gm_ref;
}
return (0);
diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h
index b1494c90f3e..3f03673d93d 100644
--- a/sys/dev/pv/xenvar.h
+++ b/sys/dev/pv/xenvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenvar.h,v 1.18 2016/01/04 16:05:43 mikeb Exp $ */
+/* $OpenBSD: xenvar.h,v 1.19 2016/01/05 13:47:28 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -86,6 +86,15 @@ struct xen_attach_args {
};
/*
+ * Grant table references don't convey the information about an actual
+ * offset of the data within the page, however Xen needs to know it.
+ * We (ab)use bus_dma_segment's _ds_boundary member to store it. Please
+ * note that we don't save or restore it's original value atm because
+ * neither i386 nor amd64 bus_dmamap_unload(9) code needs it.
+ */
+#define ds_offset _ds_boundary
+
+/*
* Hypercalls
*/
#define XC_MEMORY 12