diff options
author | raj <raj@FreeBSD.org> | 2010-03-11 21:16:54 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2010-03-11 21:16:54 +0000 |
commit | b08392829588ce824d72e589f80a705c89839134 (patch) | |
tree | 5d8d8ca77e40d26e4af5a0a4ae96ed16b6c0908e /sys | |
parent | 9540239dfe2d5f660fdcda5f1d6f24c4f8439016 (diff) | |
download | FreeBSD-src-b08392829588ce824d72e589f80a705c89839134.zip FreeBSD-src-b08392829588ce824d72e589f80a705c89839134.tar.gz |
Fix ARM cache handling yet more.
1) vm_machdep.c: remove the dangling allocations so they do not
un-necessarily turn off the cache upon consecutive access.
2) busdma_machdep.c: remove the same amount than shadow mapped.
Reported by: Maks Verver
Submitted by: Mark Tinguely
Reviewed by: Grzegorz Bernacki
MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arm/arm/busdma_machdep.c | 3 | ||||
-rw-r--r-- | sys/arm/arm/vm_machdep.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 7080671..b7aa14f 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -649,7 +649,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) KASSERT(map->allocbuffer == vaddr, ("Trying to freeing the wrong DMA buffer")); vaddr = map->origbuffer; - arm_unmap_nocache(map->allocbuffer, dmat->maxsize); + arm_unmap_nocache(map->allocbuffer, + dmat->maxsize + ((vm_offset_t)vaddr & PAGE_MASK)); } if (dmat->maxsize <= PAGE_SIZE && dmat->alignment < dmat->maxsize && diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 95b9ca8..9b530ab 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -171,6 +171,9 @@ sf_buf_free(struct sf_buf *sf) if (sf->ref_count == 0) { TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry); nsfbufsused--; + pmap_kremove(sf->kva); + sf->m = NULL; + LIST_REMOVE(sf, list_entry); if (sf_buf_alloc_want > 0) wakeup_one(&sf_buf_freelist); } @@ -502,9 +505,12 @@ arm_unmap_nocache(void *addr, vm_size_t size) size = round_page(size); i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE); - for (; size > 0; size -= PAGE_SIZE, i++) + for (; size > 0; size -= PAGE_SIZE, i++) { arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % BITS_PER_INT)); + pmap_kremove(raddr); + raddr += PAGE_SIZE; + } } #ifdef ARM_USE_SMALL_ALLOC |