diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-07-12 17:31:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-13 02:19:16 -0400 |
commit | 965194c15dc9e4f3bc44432b39c441c86af7f11d (patch) | |
tree | 0afa32ccb270ff2f506299744c184a4c9ab83c7a | |
parent | 7ab073b6e0cde1544f4e79fadb75532528af7595 (diff) |
x86: max_low_pfn_mapped fix, #2
tighten the boundary checks around max_low_pfn_mapped - dont overmap
nor undermap into holes.
also print out tseg for AMD cpus, for diagnostic purposes.
(this is an SMM area, and we split up any big mappings around that area)
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/cpu/amd_64.c | 1 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pat.c | 4 | ||||
-rw-r--r-- | arch/x86/pci/i386.c | 4 |
4 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/amd_64.c b/arch/x86/kernel/cpu/amd_64.c index bd182b7616ee..7c36fb8a28d4 100644 --- a/arch/x86/kernel/cpu/amd_64.c +++ b/arch/x86/kernel/cpu/amd_64.c | |||
@@ -200,6 +200,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
200 | * benefit in doing so. | 200 | * benefit in doing so. |
201 | */ | 201 | */ |
202 | if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) { | 202 | if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) { |
203 | printk(KERN_DEBUG "tseg: %010llx\n", tseg); | ||
203 | if ((tseg>>PMD_SHIFT) < | 204 | if ((tseg>>PMD_SHIFT) < |
204 | (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) || | 205 | (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) || |
205 | ((tseg>>PMD_SHIFT) < | 206 | ((tseg>>PMD_SHIFT) < |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 0389cb8f6b1a..fb6f2ab40dda 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -658,11 +658,11 @@ static int cpa_process_alias(struct cpa_data *cpa) | |||
658 | struct cpa_data alias_cpa; | 658 | struct cpa_data alias_cpa; |
659 | int ret = 0; | 659 | int ret = 0; |
660 | 660 | ||
661 | if (cpa->pfn > max_pfn_mapped) | 661 | if (cpa->pfn >= max_pfn_mapped) |
662 | return 0; | 662 | return 0; |
663 | 663 | ||
664 | #ifdef CONFIG_X86_64 | 664 | #ifdef CONFIG_X86_64 |
665 | if (cpa->pfn > max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT))) | 665 | if (cpa->pfn >= max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT))) |
666 | return 0; | 666 | return 0; |
667 | #endif | 667 | #endif |
668 | /* | 668 | /* |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 749766c3c5cd..d4585077977a 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -449,8 +449,8 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
449 | if (retval < 0) | 449 | if (retval < 0) |
450 | return 0; | 450 | return 0; |
451 | 451 | ||
452 | if (((pfn <= max_low_pfn_mapped) || | 452 | if (((pfn < max_low_pfn_mapped) || |
453 | (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn <= max_pfn_mapped)) && | 453 | (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn < max_pfn_mapped)) && |
454 | ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { | 454 | ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { |
455 | free_memtype(offset, offset + size); | 455 | free_memtype(offset, offset + size); |
456 | printk(KERN_INFO | 456 | printk(KERN_INFO |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 5281e343dd9f..2aafb67dc5f1 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -334,9 +334,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
334 | flags = new_flags; | 334 | flags = new_flags; |
335 | } | 335 | } |
336 | 336 | ||
337 | if (((vma->vm_pgoff <= max_low_pfn_mapped) || | 337 | if (((vma->vm_pgoff < max_low_pfn_mapped) || |
338 | (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) && | 338 | (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) && |
339 | vma->vm_pgoff <= max_pfn_mapped)) && | 339 | vma->vm_pgoff < max_pfn_mapped)) && |
340 | ioremap_change_attr((unsigned long)__va(addr), len, flags)) { | 340 | ioremap_change_attr((unsigned long)__va(addr), len, flags)) { |
341 | free_memtype(addr, addr + len); | 341 | free_memtype(addr, addr + len); |
342 | return -EINVAL; | 342 | return -EINVAL; |