From owner-p4-projects@FreeBSD.ORG Tue Apr 11 06:16:48 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 007E216A404; Tue, 11 Apr 2006 06:16:48 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD52316A401 for ; Tue, 11 Apr 2006 06:16:47 +0000 (UTC) (envelope-from jmg@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C19643D4C for ; Tue, 11 Apr 2006 06:16:47 +0000 (GMT) (envelope-from jmg@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3B6GlDG033608 for ; Tue, 11 Apr 2006 06:16:47 GMT (envelope-from jmg@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3B6GkUx033605 for perforce@freebsd.org; Tue, 11 Apr 2006 06:16:46 GMT (envelope-from jmg@freebsd.org) Date: Tue, 11 Apr 2006 06:16:46 GMT Message-Id: <200604110616.k3B6GkUx033605@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmg@freebsd.org using -f From: John-Mark Gurney To: Perforce Change Reviews Cc: Subject: PERFORCE change 94972 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2006 06:16:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=94972 Change 94972 by jmg@jmg_carbon-60 on 2006/04/11 06:15:49 remove duplicate define.. use _getmap to get the ra of the mapping for syncing.. we need to store the offset so we can index into the page... Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hviommu.c#9 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hviommu.c#9 (text+ko) ==== @@ -368,6 +368,7 @@ dvmend = dvmaddr + size; if (dvmend <= BDR_END(r)) { r->dr_used = dvmend - BDR_START(r); + r->dr_offset = voffs; return (dvmaddr); } } @@ -529,8 +530,6 @@ } #define IOTTE_CNT 64 -#define HVIOMMU_TSBID(him, dvmaddr) \ - (((dvmaddr) - (him)->him_dvmabase) >> IO_PAGE_SHIFT) static void hviommu_map_pages(struct hviommu *him, bus_addr_t dvmaddr, uint64_t *iottes, pages_t iottecnt) @@ -547,7 +546,7 @@ /* push tte's */ cntdone = 0; while (cntdone < iottecnt) { - if ((err = hvio_iommu_map(him->him_handle, HVIOMMU_TSBID(him, + if ((err = hvio_iommu_map(him->him_handle, VA_TO_TSBID(him, dvmaddr), iottecnt, PCI_MAP_ATTR_READ | PCI_MAP_ATTR_WRITE, (io_page_list_t *)pmap_kextract((vm_offset_t)&iotteaddr[0]), &mapcnt))) { @@ -884,7 +883,9 @@ vm_offset_t va; vm_size_t len; size_t synced; + bus_addr_t ra; uint64_t err; + uint32_t ioattr; io_sync_direction_t iodir; if ((map->dm_flags & DMF_LOADED) == 0) @@ -900,11 +901,17 @@ membar(Sync); HIM_LOCK(him); SLIST_FOREACH(r, &map->dm_reslist, dr_link) { - va = (vm_offset_t)BDR_START(r); + va = (vm_offset_t)BDR_START(r) + r->dr_offset; len = r->dr_used; while (len > 0) { - if ((err = hvio_dma_sync(him->him_handle, va, len, iodir, - &synced))) { + if ((err = hvio_iommu_getmap(him->him_handle, + VA_TO_TSBID(him, va), &ra, &ioattr))) { + printf("failed to _getmap: err: %ld, handle: %#lx, tsbid: %#lx", err, him->him_handle, VA_TO_TSBID(him, va)); + continue; + } + if ((err = hvio_dma_sync(him->him_handle, ra, + min(len, (trunc_io_page(ra) + IO_PAGE_SIZE) - ra), + iodir, &synced))) { printf("failed to dma_sync: err: %ld, handle: %#lx, va: %#lx, len: %#lx, dir: %d\n", err, him->him_handle, va, len, iodir); synced = 1;