Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Jan 2016 20:23:33 +0000 (12:23 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Jan 2016 20:23:33 +0000 (12:23 -0800)
Pull arm64 updates from Will Deacon:
 "Here is the core arm64 queue for 4.5.  As you might expect, the
  Christmas break resulted in a number of patches not making the final
  cut, so 4.6 is likely to be larger than usual.  There's still some
  useful stuff here, however, and it's detailed below.

  The EFI changes have been Reviewed-by Matt and the memblock change got
  an "OK" from akpm.

  Summary:

   - Support for a separate IRQ stack, although we haven't reduced the
     size of our thread stack just yet since we don't have enough data
     to determine a safe value

   - Refactoring of our EFI initialisation and runtime code into
     drivers/firmware/efi/ so that it can be reused by arch/arm/.

   - Ftrace improvements when unwinding in the function graph tracer

   - Document our silicon errata handling process

   - Cache flushing optimisation when mapping executable pages

   - Support for hugetlb mappings using the contiguous hint in the pte"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (45 commits)
  arm64: head.S: use memset to clear BSS
  efi: stub: define DISABLE_BRANCH_PROFILING for all architectures
  arm64: entry: remove pointless SPSR mode check
  arm64: mm: move pgd_cache initialisation to pgtable_cache_init
  arm64: module: avoid undefined shift behavior in reloc_data()
  arm64: module: fix relocation of movz instruction with negative immediate
  arm64: traps: address fallout from printk -> pr_* conversion
  arm64: ftrace: fix a stack tracer's output under function graph tracer
  arm64: pass a task parameter to unwind_frame()
  arm64: ftrace: modify a stack frame in a safe way
  arm64: remove irq_count and do_softirq_own_stack()
  arm64: hugetlb: add support for PTE contiguous bit
  arm64: Use PoU cache instr for I/D coherency
  arm64: Defer dcache flush in __cpu_copy_user_page
  arm64: reduce stack use in irq_handler
  arm64: mm: ensure that the zero page is visible to the page table walker
  arm64: Documentation: add list of software workarounds for errata
  arm64: mm: place __cpu_setup in .text
  arm64: cmpxchg: Don't incldue linux/mmdebug.h
  arm64: mm: fold alternatives into .init
  ...

1  2 
arch/arm64/include/asm/pgtable.h
arch/arm64/kernel/vmlinux.lds.S

@@@ -167,6 -167,16 +167,16 @@@ extern struct page *empty_zero_page
        ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
  #define pte_valid_not_user(pte) \
        ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
+ #define pte_valid_young(pte) \
+       ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))
+ /*
+  * Could the pte be present in the TLB? We must check mm_tlb_flush_pending
+  * so that we don't erroneously return false for pages that have been
+  * remapped as PROT_NONE but are yet to be flushed from the TLB.
+  */
+ #define pte_accessible(mm, pte)       \
+       (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte))
  
  static inline pte_t clear_pte_bit(pte_t pte, pgprot_t prot)
  {
@@@ -217,7 -227,8 +227,8 @@@ static inline pte_t pte_mkspecial(pte_
  
  static inline pte_t pte_mkcont(pte_t pte)
  {
-       return set_pte_bit(pte, __pgprot(PTE_CONT));
+       pte = set_pte_bit(pte, __pgprot(PTE_CONT));
+       return set_pte_bit(pte, __pgprot(PTE_TYPE_PAGE));
  }
  
  static inline pte_t pte_mknoncont(pte_t pte)
        return clear_pte_bit(pte, __pgprot(PTE_CONT));
  }
  
+ static inline pmd_t pmd_mkcont(pmd_t pmd)
+ {
+       return __pmd(pmd_val(pmd) | PMD_SECT_CONT);
+ }
  static inline void set_pte(pte_t *ptep, pte_t pte)
  {
        *ptep = pte;
@@@ -276,14 -292,10 +292,14 @@@ static inline void set_pte_at(struct mm
         * hardware updates of the pte (ptep_set_access_flags safely changes
         * valid ptes without going through an invalid entry).
         */
 -      if (IS_ENABLED(CONFIG_DEBUG_VM) && IS_ENABLED(CONFIG_ARM64_HW_AFDBM) &&
 -          pte_valid(*ptep)) {
 -              BUG_ON(!pte_young(pte));
 -              BUG_ON(pte_write(*ptep) && !pte_dirty(pte));
 +      if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) &&
 +          pte_valid(*ptep) && pte_valid(pte)) {
 +              VM_WARN_ONCE(!pte_young(pte),
 +                           "%s: racy access flag clearing: 0x%016llx -> 0x%016llx",
 +                           __func__, pte_val(*ptep), pte_val(pte));
 +              VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(pte),
 +                           "%s: racy dirty state clearing: 0x%016llx -> 0x%016llx",
 +                           __func__, pte_val(*ptep), pte_val(pte));
        }
  
        set_pte(ptep, pte);
  /*
   * Hugetlb definitions.
   */
- #define HUGE_MAX_HSTATE               2
+ #define HUGE_MAX_HSTATE               4
  #define HPAGE_SHIFT           PMD_SHIFT
  #define HPAGE_SIZE            (_AC(1, UL) << HPAGE_SHIFT)
  #define HPAGE_MASK            (~(HPAGE_SIZE - 1))
@@@ -664,7 -676,8 +680,8 @@@ extern int kern_addr_valid(unsigned lon
  
  #include <asm-generic/pgtable.h>
  
- #define pgtable_cache_init() do { } while (0)
+ void pgd_cache_init(void);
+ #define pgtable_cache_init    pgd_cache_init
  
  /*
   * On AArch64, the cache coherency is handled via the set_pte_at() function.
@@@ -5,7 -5,6 +5,7 @@@
   */
  
  #include <asm-generic/vmlinux.lds.h>
 +#include <asm/cache.h>
  #include <asm/kernel-pgtable.h>
  #include <asm/thread_info.h>
  #include <asm/memory.h>
@@@ -113,7 -112,6 +113,6 @@@ SECTION
                *(.got)                 /* Global offset table          */
        }
  
-       ALIGN_DEBUG_RO
        RO_DATA(PAGE_SIZE)
        EXCEPTION_TABLE(8)
        NOTES
                ARM_EXIT_KEEP(EXIT_TEXT)
        }
  
-       ALIGN_DEBUG_RO_MIN(16)
        .init.data : {
                INIT_DATA
                INIT_SETUP(16)
                ARM_EXIT_KEEP(EXIT_DATA)
        }
  
 -      PERCPU_SECTION(64)
 +      PERCPU_SECTION(L1_CACHE_BYTES)
  
-       . = ALIGN(PAGE_SIZE);
-       __init_end = .;
        . = ALIGN(4);
        .altinstructions : {
                __alt_instructions = .;
        }
  
        . = ALIGN(PAGE_SIZE);
+       __init_end = .;
        _data = .;
        _sdata = .;
 -      RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
 +      RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
        PECOFF_EDATA_PADDING
        _edata = .;