Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 6 May 2015 17:57:37 +0000 (10:57 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 6 May 2015 17:57:37 +0000 (10:57 -0700)
Pull x86 fixes from Ingo Molnar:
 "EFI fixes, and FPU fix, a ticket spinlock boundary condition fix and
  two build fixes"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/fpu: Always restore_xinit_state() when use_eager_cpu()
  x86: Make cpu_tss available to external modules
  efi: Fix error handling in add_sysfs_runtime_map_entry()
  x86/spinlocks: Fix regression in spinlock contention detection
  x86/mm: Clean up types in xlate_dev_mem_ptr()
  x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr
  efivarfs: Ensure VariableName is NUL-terminated

1  2 
arch/x86/mm/ioremap.c
fs/efivarfs/super.c

diff --combined arch/x86/mm/ioremap.c
@@@ -67,13 -67,8 +67,13 @@@ static int __ioremap_check_ram(unsigne
  
  /*
   * Remap an arbitrary physical address space into the kernel virtual
 - * address space. Needed when the kernel wants to access high addresses
 - * directly.
 + * address space. It transparently creates kernel huge I/O mapping when
 + * the physical address is aligned by a huge page size (1GB or 2MB) and
 + * the requested size is at least the huge page size.
 + *
 + * NOTE: MTRRs can override PAT memory types with a 4KB granularity.
 + * Therefore, the mapping code falls back to use a smaller page toward 4KB
 + * when a mapping range is covered by non-WB type of MTRRs.
   *
   * NOTE! We need to allow non-page-aligned mappings too: we will obviously
   * have to convert them into an offset in a page-aligned mapping, but the
@@@ -331,38 -326,26 +331,40 @@@ void iounmap(volatile void __iomem *add
  }
  EXPORT_SYMBOL(iounmap);
  
 +int arch_ioremap_pud_supported(void)
 +{
 +#ifdef CONFIG_X86_64
 +      return cpu_has_gbpages;
 +#else
 +      return 0;
 +#endif
 +}
 +
 +int arch_ioremap_pmd_supported(void)
 +{
 +      return cpu_has_pse;
 +}
 +
  /*
   * Convert a physical pointer to a virtual kernel pointer for /dev/mem
   * access
   */
  void *xlate_dev_mem_ptr(phys_addr_t phys)
  {
-       void *addr;
-       unsigned long start = phys & PAGE_MASK;
+       unsigned long start  = phys &  PAGE_MASK;
+       unsigned long offset = phys & ~PAGE_MASK;
+       unsigned long vaddr;
  
        /* If page is RAM, we can use __va. Otherwise ioremap and unmap. */
        if (page_is_ram(start >> PAGE_SHIFT))
                return __va(phys);
  
-       addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
-       if (addr)
-               addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
+       vaddr = (unsigned long)ioremap_cache(start, PAGE_SIZE);
+       /* Only add the offset on success and return NULL if the ioremap() failed: */
+       if (vaddr)
+               vaddr += offset;
  
-       return addr;
+       return (void *)vaddr;
  }
  
  void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
diff --combined fs/efivarfs/super.c
@@@ -121,7 -121,7 +121,7 @@@ static int efivarfs_callback(efi_char16
        int len, i;
        int err = -ENOMEM;
  
-       entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (!entry)
                return err;
  
  
        name[len + EFI_VARIABLE_GUID_LEN+1] = '\0';
  
 -      inode = efivarfs_get_inode(sb, root->d_inode, S_IFREG | 0644, 0);
 +      inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0644, 0);
        if (!inode)
                goto fail_name;