mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
ARM pmap fixes.
a) nocache-remap problem When a page is remapped into a non-cacheable virtual memory region there was no associated write-back invalidate operation performed. We remove writeback of the original buffer size from bus_dmamem_alloc() and add appropriate L1/L2 flush operation. b) missing write-back invalidate operation In pmap_kremove a page is removed so we must do a write-back invalidate operation aligned to the page virtual address. Submitted by: Michal Hajduk Reviewed by: Mark Tinguely, rpaulo, stas Approved by: re (kib) Obtained from: Semihalf
This commit is contained in:
parent
17ef1feb8a
commit
331f685743
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195779
@ -630,10 +630,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
|||||||
((vm_offset_t)*vaddr & PAGE_MASK));
|
((vm_offset_t)*vaddr & PAGE_MASK));
|
||||||
newmap->origbuffer = *vaddr;
|
newmap->origbuffer = *vaddr;
|
||||||
newmap->allocbuffer = tmpaddr;
|
newmap->allocbuffer = tmpaddr;
|
||||||
cpu_idcache_wbinv_range((vm_offset_t)*vaddr,
|
|
||||||
dmat->maxsize);
|
|
||||||
cpu_l2cache_wbinv_range((vm_offset_t)*vaddr,
|
|
||||||
dmat->maxsize);
|
|
||||||
*vaddr = tmpaddr;
|
*vaddr = tmpaddr;
|
||||||
} else
|
} else
|
||||||
newmap->origbuffer = newmap->allocbuffer = NULL;
|
newmap->origbuffer = newmap->allocbuffer = NULL;
|
||||||
|
@ -2984,6 +2984,7 @@ pmap_kremove(vm_offset_t va)
|
|||||||
pmap_free_pv_entry(pve);
|
pmap_free_pv_entry(pve);
|
||||||
PMAP_UNLOCK(pmap_kernel());
|
PMAP_UNLOCK(pmap_kernel());
|
||||||
vm_page_unlock_queues();
|
vm_page_unlock_queues();
|
||||||
|
va = va & ~PAGE_MASK;
|
||||||
cpu_dcache_wbinv_range(va, PAGE_SIZE);
|
cpu_dcache_wbinv_range(va, PAGE_SIZE);
|
||||||
cpu_l2cache_wbinv_range(va, PAGE_SIZE);
|
cpu_l2cache_wbinv_range(va, PAGE_SIZE);
|
||||||
cpu_tlb_flushD_SE(va);
|
cpu_tlb_flushD_SE(va);
|
||||||
|
@ -426,10 +426,15 @@ arm_remap_nocache(void *addr, vm_size_t size)
|
|||||||
vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE;
|
vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE;
|
||||||
void *ret = (void *)tomap;
|
void *ret = (void *)tomap;
|
||||||
vm_paddr_t physaddr = vtophys((vm_offset_t)addr);
|
vm_paddr_t physaddr = vtophys((vm_offset_t)addr);
|
||||||
|
vm_offset_t vaddr = (vm_offset_t) addr;
|
||||||
|
|
||||||
|
vaddr = vaddr & ~PAGE_MASK;
|
||||||
for (; tomap < (vm_offset_t)ret + size; tomap += PAGE_SIZE,
|
for (; tomap < (vm_offset_t)ret + size; tomap += PAGE_SIZE,
|
||||||
physaddr += PAGE_SIZE, i++) {
|
vaddr += PAGE_SIZE, physaddr += PAGE_SIZE, i++) {
|
||||||
|
cpu_idcache_wbinv_range(vaddr, PAGE_SIZE);
|
||||||
|
cpu_l2cache_wbinv_range(vaddr, PAGE_SIZE);
|
||||||
pmap_kenter_nocache(tomap, physaddr);
|
pmap_kenter_nocache(tomap, physaddr);
|
||||||
|
cpu_tlb_flushID_SE(vaddr);
|
||||||
arm_nocache_allocated[i / BITS_PER_INT] |= 1 << (i %
|
arm_nocache_allocated[i / BITS_PER_INT] |= 1 << (i %
|
||||||
BITS_PER_INT);
|
BITS_PER_INT);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user