]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: max_low_pfn_mapped fix, #2
authorYinghai Lu <yhlu.kernel@gmail.com>
Sat, 12 Jul 2008 21:31:28 +0000 (14:31 -0700)
committerIngo Molnar <mingo@elte.hu>
Sun, 13 Jul 2008 06:19:16 +0000 (08:19 +0200)
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>
arch/x86/kernel/cpu/amd_64.c
arch/x86/mm/pageattr.c
arch/x86/mm/pat.c
arch/x86/pci/i386.c

index bd182b7616ee2a3a595ed798e810df137e16de03..7c36fb8a28d46455c2a51b8adabc8511e1f9386c 100644 (file)
@@ -200,6 +200,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                 * benefit in doing so.
                 */
                if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) {
+                   printk(KERN_DEBUG "tseg: %010llx\n", tseg);
                    if ((tseg>>PMD_SHIFT) <
                                (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) ||
                        ((tseg>>PMD_SHIFT) <
index 0389cb8f6b1ab16846c642ee0d7feaa6d9a517f4..fb6f2ab40dda092f5029b1e29542fb2d9accb6f7 100644 (file)
@@ -658,11 +658,11 @@ static int cpa_process_alias(struct cpa_data *cpa)
        struct cpa_data alias_cpa;
        int ret = 0;
 
-       if (cpa->pfn > max_pfn_mapped)
+       if (cpa->pfn >= max_pfn_mapped)
                return 0;
 
 #ifdef CONFIG_X86_64
-       if (cpa->pfn > max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT)))
+       if (cpa->pfn >= max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT)))
                return 0;
 #endif
        /*
index 749766c3c5cd68eaac4c8b6c45646919cff68e00..d4585077977a0bd1c6c7234b09051d671851a6aa 100644 (file)
@@ -449,8 +449,8 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
        if (retval < 0)
                return 0;
 
-       if (((pfn <= max_low_pfn_mapped) ||
-            (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn <= max_pfn_mapped)) &&
+       if (((pfn < max_low_pfn_mapped) ||
+            (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn < max_pfn_mapped)) &&
            ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
                free_memtype(offset, offset + size);
                printk(KERN_INFO
index 5281e343dd9f85d36dea527e99cd275ca2e4820b..2aafb67dc5f1df254de17ff64a1523283c341f32 100644 (file)
@@ -334,9 +334,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                flags = new_flags;
        }
 
-       if (((vma->vm_pgoff <= max_low_pfn_mapped) ||
+       if (((vma->vm_pgoff < max_low_pfn_mapped) ||
             (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) &&
-             vma->vm_pgoff <= max_pfn_mapped)) &&
+             vma->vm_pgoff < max_pfn_mapped)) &&
            ioremap_change_attr((unsigned long)__va(addr), len, flags)) {
                free_memtype(addr, addr + len);
                return -EINVAL;