Date: Sat, 23 Mar 2013 17:17:06 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248655 - head/sys/arm/arm Message-ID: <201303231717.r2NHH6O0012446@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sat Mar 23 17:17:06 2013 New Revision: 248655 URL: http://svnweb.freebsd.org/changeset/base/248655 Log: Don't check and warn about pmap mismatch on every call to busdma sync. With some recent busdma refactoring, sometimes it happens that a sync op gets called when bus_dmamap_load() never got called, which results in a spurious warning about a map mismatch when no sync operations will actually happen anyway. Now the check is done only if a sync operation is actually performed, and the result of the check is a panic, not just a printf. Reviewed by: cognet (who prevented me from donning a point hat) Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Sat Mar 23 16:55:07 2013 (r248654) +++ head/sys/arm/arm/busdma_machdep-v6.c Sat Mar 23 17:17:06 2013 (r248655) @@ -1150,19 +1150,16 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus vm_offset_t bbuf; char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align]; #endif - /* if buffer was from user space, it it possible that this - * is not the same vm map. The fix is to map each page in - * the buffer into the current address space (KVM) and then - * do the bounce copy or sync list cache operation. - * - * The sync list entries are already broken into - * their respective physical pages. - */ - if (!pmap_dmap_iscurrent(map->pmap)) - printf("_bus_dmamap_sync: wrong user map: %p %x\n", map->pmap, op); - + /* + * If the buffer was from user space, it is possible that this is not + * the same vm map, especially on a POST operation. It's not clear that + * dma on userland buffers can work at all right now, certainly not if a + * partial cacheline flush has to be handled. To be safe, until we're + * able to test direct userland dma, panic on a map mismatch. + */ if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - + if (!pmap_dmap_iscurrent(map->pmap)) + panic("_bus_dmamap_sync: wrong user map for bounce sync."); /* Handle data bouncing. */ CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x " "performing bounce", __func__, dmat, dmat->flags, op); @@ -1188,9 +1185,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus } if (op & BUS_DMASYNC_POSTREAD) { - if (!pmap_dmap_iscurrent(map->pmap)) - panic("_bus_dmamap_sync: wrong user map. apply fix"); - cpu_dcache_inv_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_inv_range((vm_offset_t)bpage->vaddr, @@ -1230,6 +1224,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus return; if (map->sync_count != 0) { + if (!pmap_dmap_iscurrent(map->pmap)) + panic("_bus_dmamap_sync: wrong user map for sync."); /* ARM caches are not self-snooping for dma */ sl = &map->slist[0]; @@ -1303,8 +1299,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus #ifdef FIX_DMAP_BUS_DMASYNC_POSTREAD case BUS_DMASYNC_POSTREAD: - if (!pmap_dmap_iscurrent(map->pmap)) - panic("_bus_dmamap_sync: wrong user map. apply fix"); while (sl != end) { /* write back the unaligned portions */ vm_paddr_t physaddr;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303231717.r2NHH6O0012446>