Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_bus_dma.c
Show All 40 Lines | |||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/memdesc.h> | #include <sys/memdesc.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <machine/vmparam.h> | |||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/vm_page.h> | #include <vm/vm_page.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <cam/cam.h> | #include <cam/cam.h> | ||||
#include <cam/cam_ccb.h> | #include <cam/cam_ccb.h> | ||||
▲ Show 20 Lines • Show All 599 Lines • ▼ Show 20 Lines | bus_dmamap_load_crp_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, | ||||
case CRYPTO_BUF_MBUF: | case CRYPTO_BUF_MBUF: | ||||
error = _bus_dmamap_load_mbuf_sg(dmat, map, cb->cb_mbuf, | error = _bus_dmamap_load_mbuf_sg(dmat, map, cb->cb_mbuf, | ||||
NULL, &nsegs, flags); | NULL, &nsegs, flags); | ||||
break; | break; | ||||
case CRYPTO_BUF_UIO: | case CRYPTO_BUF_UIO: | ||||
error = _bus_dmamap_load_uio(dmat, map, cb->cb_uio, &nsegs, | error = _bus_dmamap_load_uio(dmat, map, cb->cb_uio, &nsegs, | ||||
flags); | flags); | ||||
break; | break; | ||||
#if PMAP_HAS_DMAP | |||||
case CRYPTO_BUF_VMPAGE: | |||||
kib: We have b_bus_dmamap_load_ma() which is more efficient than roundtrip through sf_buf_kva()… | |||||
error = _bus_dmamap_load_ma(dmat, map, cb->cb_vm_page, | |||||
cb->cb_vm_page_len, cb->cb_vm_page_offset, flags, NULL, | |||||
&nsegs); | |||||
break; | |||||
#endif /* PMAP_HAS_DMAP */ | |||||
default: | default: | ||||
error = EINVAL; | error = EINVAL; | ||||
} | } | ||||
nsegs++; | nsegs++; | ||||
CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", | CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", | ||||
__func__, dmat, flags, error, nsegs); | __func__, dmat, flags, error, nsegs); | ||||
Show All 26 Lines |
We have b_bus_dmamap_load_ma() which is more efficient than roundtrip through sf_buf_kva()->pmap_kextract() from bus_dmamap_load_buffer(). I am not sure how easy is to pass bio_ma up to this point, but it is definitely better than use VA-based load_buffer() in _bus_dmamap_load_sf_buf().
It might be worth reconstructing bio_ma[] from sf_buf array with sf_buf_page() if passing bio_ma is too problematic.