diff options
author | cem <cem@FreeBSD.org> | 2015-10-29 19:07:00 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2015-10-29 19:07:00 +0000 |
commit | dffa7f059007d1b280106319e1aafa8d4958ba45 (patch) | |
tree | bee12950ac06adecf86cd5e7d87ab3933af430b7 /sys/amd64 | |
parent | 7d7f09674bd0f6b0a587ec9bc977d8828a4c74aa (diff) | |
download | FreeBSD-src-dffa7f059007d1b280106319e1aafa8d4958ba45.zip FreeBSD-src-dffa7f059007d1b280106319e1aafa8d4958ba45.tar.gz |
pmap_change_attr: Only fixup DMAP for DMAPed ranges
pmap_change_attr must change the memory type of both the requested KVA
and the corresponding DMAP mappings (if such mappings exist), to satisfy
an Intel requirement that two or more mappings to the same physical
pages must have the same memory type.
However, not all kernel mapped pages have corresponding DMAP mappings --
for example, 64-bit BARs. Skip fixing up the DMAP for out-of-bounds
addresses.
Submitted by: Steve Wahl <steve_wahl@dell.com>
Reviewed by: alc, jhb
Sponsored by: Dell Compellent
Differential Revision: https://reviews.freebsd.org/D4030
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/pmap.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 94a7d0c..883c1c5 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -6411,7 +6411,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (*pdpe == 0) + if (pdpe == NULL || *pdpe == 0) return (EINVAL); if (*pdpe & PG_PS) { /* @@ -6484,7 +6484,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) X86_PG_PDE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pdpe & PG_PS_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pdpe & PG_PS_FRAME; @@ -6513,7 +6514,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) X86_PG_PDE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pde & PG_PS_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pde & PG_PS_FRAME; @@ -6540,7 +6542,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) X86_PG_PTE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pte & PG_PS_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pte & PG_FRAME; |