Merge branch 'x86/urgent' into x86/pat
H. Peter Anvin [Thu, 27 Aug 2009 00:17:51 +0000 (17:17 -0700)]
Reason: Change to is_new_memtype_allowed() in x86/urgent

Resolved semantic conflicts in:

 arch/x86/mm/pat.c
 arch/x86/mm/ioremap.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>

1  2 
arch/x86/Kconfig
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/perfctr-watchdog.c
arch/x86/kvm/x86.c
arch/x86/mm/ioremap.c
arch/x86/mm/pat.c
kernel/smp.c

Simple merge
@@@ -400,8 -398,15 +400,15 @@@ static void __cpuinit init_amd(struct c
                u32 level;
  
                level = cpuid_eax(1);
 -              if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
 +              if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
                        set_cpu_cap(c, X86_FEATURE_REP_GOOD);
+               /*
+                * Some BIOSes incorrectly force this feature, but only K8
+                * revision D (model = 0x14) and later actually support it.
+                */
+               if (c->x86_model < 0x14)
+                       clear_cpu_cap(c, X86_FEATURE_LAHF_LM);
        }
        if (c->x86 == 0x10 || c->x86 == 0x11)
                set_cpu_cap(c, X86_FEATURE_REP_GOOD);
Simple merge
Simple merge
@@@ -233,8 -233,19 +233,9 @@@ static void __iomem *__ioremap_caller(r
        }
  
        if (prot_val != new_prot_val) {
-               if (!is_new_memtype_allowed(prot_val, new_prot_val)) {
 -              /*
 -               * Do not fallback to certain memory types with certain
 -               * requested type:
 -               * - request is uc-, return cannot be write-back
 -               * - request is uc-, return cannot be write-combine
 -               * - request is write-combine, return cannot be write-back
 -               */
 -              if ((prot_val == _PAGE_CACHE_UC_MINUS &&
 -                   (new_prot_val == _PAGE_CACHE_WB ||
 -                    new_prot_val == _PAGE_CACHE_WC)) ||
 -                  (prot_val == _PAGE_CACHE_WC &&
 -                   new_prot_val == _PAGE_CACHE_WB)) {
 -                      pr_debug(
++              if (!is_new_memtype_allowed(phys_addr, size,
++                                          prot_val, new_prot_val)) {
 +                      printk(KERN_ERR
                "ioremap error for 0x%llx-0x%llx, requested 0x%lx, got 0x%lx\n",
                                (unsigned long long)phys_addr,
                                (unsigned long long)(phys_addr + size),
@@@ -573,100 -496,6 +573,101 @@@ unlock_ret
  }
  
  
 +/**
 + * lookup_memtype - Looksup the memory type for a physical address
 + * @paddr: physical address of which memory type needs to be looked up
 + *
 + * Only to be called when PAT is enabled
 + *
 + * Returns _PAGE_CACHE_WB, _PAGE_CACHE_WC, _PAGE_CACHE_UC_MINUS or
 + * _PAGE_CACHE_UC
 + */
 +static unsigned long lookup_memtype(u64 paddr)
 +{
 +      int rettype = _PAGE_CACHE_WB;
 +      struct memtype *entry;
 +
 +      if (is_ISA_range(paddr, paddr + PAGE_SIZE - 1))
 +              return rettype;
 +
 +      if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {
 +              struct page *page;
 +              spin_lock(&memtype_lock);
 +              page = pfn_to_page(paddr >> PAGE_SHIFT);
 +              rettype = get_page_memtype(page);
 +              spin_unlock(&memtype_lock);
 +              /*
 +               * -1 from get_page_memtype() implies RAM page is in its
 +               * default state and not reserved, and hence of type WB
 +               */
 +              if (rettype == -1)
 +                      rettype = _PAGE_CACHE_WB;
 +
 +              return rettype;
 +      }
 +
 +      spin_lock(&memtype_lock);
 +
 +      entry = memtype_rb_search(&memtype_rbroot, paddr);
 +      if (entry != NULL)
 +              rettype = entry->type;
 +      else
 +              rettype = _PAGE_CACHE_UC_MINUS;
 +
 +      spin_unlock(&memtype_lock);
 +      return rettype;
 +}
 +
 +/**
 + * io_reserve_memtype - Request a memory type mapping for a region of memory
 + * @start: start (physical address) of the region
 + * @end: end (physical address) of the region
 + * @type: A pointer to memtype, with requested type. On success, requested
 + * or any other compatible type that was available for the region is returned
 + *
 + * On success, returns 0
 + * On failure, returns non-zero
 + */
 +int io_reserve_memtype(resource_size_t start, resource_size_t end,
 +                      unsigned long *type)
 +{
++      resource_size_t size = end - start;
 +      unsigned long req_type = *type;
 +      unsigned long new_type;
 +      int ret;
 +
-       WARN_ON_ONCE(iomem_map_sanity_check(start, end - start));
++      WARN_ON_ONCE(iomem_map_sanity_check(start, size));
 +
 +      ret = reserve_memtype(start, end, req_type, &new_type);
 +      if (ret)
 +              goto out_err;
 +
-       if (!is_new_memtype_allowed(req_type, new_type))
++      if (!is_new_memtype_allowed(start, size, req_type, new_type))
 +              goto out_free;
 +
-       if (kernel_map_sync_memtype(start, end - start, new_type) < 0)
++      if (kernel_map_sync_memtype(start, size, new_type) < 0)
 +              goto out_free;
 +
 +      *type = new_type;
 +      return 0;
 +
 +out_free:
 +      free_memtype(start, end);
 +      ret = -EBUSY;
 +out_err:
 +      return ret;
 +}
 +
 +/**
 + * io_free_memtype - Release a memory type mapping for a region of memory
 + * @start: start (physical address) of the region
 + * @end: end (physical address) of the region
 + */
 +void io_free_memtype(resource_size_t start, resource_size_t end)
 +{
 +      free_memtype(start, end);
 +}
 +
  pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
                                unsigned long size, pgprot_t vma_prot)
  {
diff --cc kernel/smp.c
Simple merge