summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2016-10-06 17:00:26 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2016-10-06 17:00:26 +0000
commit84236d3a753ade4196345e1a902bea125283d914 (patch)
treeb1827637111038acc73749ea2f029d60a2c13007 /sys
parentd52f4a2fd6795462f50e4293b1551a8dde28d829 (diff)
Remove _ds_boundary abuse (again)
The logic behind this change is this: a single mbuf may reference only a contiguous chunk of memory. When this chunk crosses a page boundary only the first part of it has a non-zero offset while all other chunks start at the beginning of the page. We take advantage of this fact and calculate the offset of a first chunk as a simple "mtod(m, vaddr_t) & PAGE_MASK".
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/if_xnf.c6
-rw-r--r--sys/dev/pv/xen.c6
-rw-r--r--sys/dev/pv/xenvar.h11
3 files changed, 6 insertions, 17 deletions
diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c
index 22805f52304..5e5dd4148a8 100644
--- a/sys/dev/pv/if_xnf.c
+++ b/sys/dev/pv/if_xnf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xnf.c,v 1.39 2016/09/13 10:16:22 mikeb Exp $ */
+/* $OpenBSD: if_xnf.c,v 1.40 2016/10/06 17:00:25 mikeb Exp $ */
/*
* Copyright (c) 2015, 2016 Mike Belopuhov
@@ -586,7 +586,9 @@ xnf_encap(struct xnf_softc *sc, struct mbuf *m_head, uint32_t *prod)
/* The chunk flag will be removed from the last one */
txd->txd_req.txq_flags |= XNF_TXF_CHUNK;
txd->txd_req.txq_ref = dmap->dm_segs[n].ds_addr;
- txd->txd_req.txq_offset = dmap->dm_segs[n].ds_offset;
+ if (n == 0)
+ txd->txd_req.txq_offset =
+ mtod(m, vaddr_t) & PAGE_MASK;
(*prod)++;
}
}
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index 27759ffa982..602984d5905 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.63 2016/09/12 17:22:45 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.64 2016/10/06 17:00:25 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -1191,8 +1191,6 @@ xen_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
xen_grant_table_enter(sc, gm[i].gm_ref, map->dm_segs[i].ds_addr,
domain, flags & BUS_DMA_WRITE ? GTF_readonly : 0);
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);
@@ -1214,8 +1212,6 @@ xen_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
for (i = 0; i < map->dm_nsegs; i++) {
xen_grant_table_enter(sc, gm[i].gm_ref, map->dm_segs[i].ds_addr,
domain, flags & BUS_DMA_WRITE ? GTF_readonly : 0);
- map->dm_segs[i].ds_offset = map->dm_segs[i].ds_addr &
- PAGE_MASK;
gm[i].gm_paddr = map->dm_segs[i].ds_addr;
map->dm_segs[i].ds_addr = gm[i].gm_ref;
}
diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h
index 718880282b6..a0786b7f531 100644
--- a/sys/dev/pv/xenvar.h
+++ b/sys/dev/pv/xenvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenvar.h,v 1.38 2016/09/14 17:48:28 mikeb Exp $ */
+/* $OpenBSD: xenvar.h,v 1.39 2016/10/06 17:00:25 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -94,15 +94,6 @@ 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