From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 17:17:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2869C34F6; Sat, 23 Mar 2013 17:17:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0CE805F7; Sat, 23 Mar 2013 17:17:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NHH6BK012447; Sat, 23 Mar 2013 17:17:06 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NHH6O0012446; Sat, 23 Mar 2013 17:17:06 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303231717.r2NHH6O0012446@svn.freebsd.org> From: Ian Lepore Date: Sat, 23 Mar 2013 17:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248655 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 17:17:07 -0000 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;