MFi386 r272761.

Noted by:	Holger Hans Peter Freyther <holger at freyther.de>
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
This commit is contained in:
kib 2014-10-11 16:17:49 +00:00
parent 93f2095877
commit ddec0099d1

View File

@ -888,15 +888,19 @@ pmap_invalidate_cache(void)
#define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024)
void
pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva)
pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force)
{
KASSERT((sva & PAGE_MASK) == 0,
("pmap_invalidate_cache_range: sva not page-aligned"));
KASSERT((eva & PAGE_MASK) == 0,
("pmap_invalidate_cache_range: eva not page-aligned"));
if (force) {
sva &= ~(vm_offset_t)cpu_clflush_line_size;
} else {
KASSERT((sva & PAGE_MASK) == 0,
("pmap_invalidate_cache_range: sva not page-aligned"));
KASSERT((eva & PAGE_MASK) == 0,
("pmap_invalidate_cache_range: eva not page-aligned"));
}
if (cpu_feature & CPUID_SS)
if ((cpu_feature & CPUID_SS) != 0 && !force)
; /* If "Self Snoop" is supported, do nothing. */
else if ((cpu_feature & CPUID_CLFSH) != 0 &&
eva - sva < PMAP_CLFLUSH_THRESHOLD) {
@ -4073,7 +4077,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode)
for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE)
pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode);
pmap_invalidate_range(kernel_pmap, va, va + tmpsize);
pmap_invalidate_cache_range(va, va + size);
pmap_invalidate_cache_range(va, va + size, FALSE);
return ((void *)(va + offset));
}
@ -4241,7 +4245,7 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int mode)
*/
if (changed) {
pmap_invalidate_range(kernel_pmap, base, tmpva);
pmap_invalidate_cache_range(base, tmpva);
pmap_invalidate_cache_range(base, tmpva, FALSE);
}
return (0);
}