Subject: linux-next: manual merge of the tip tree with the arm64 tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 23 May 2014 16:44:02 +1000

Hi all,

Today's linux-next merge of the tip tree got a conflict in
arch/arm64/mm/mmu.c between commit a501e32430d4 ("arm64: Clean up the
default pgprot setting") and 206a2a73a62d ("arm64: mm: Create gigabyte
kernel logical mappings where possible") from the arm64 tree and commit
d7ecbddf4cae ("arm64: Add function to create identity mappings") from
the tip tree.

I fixed it up (maybe - see below - this may not be complete) and can
carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc arch/arm64/mm/mmu.c
index 3a729de96f15,4a829a210bb6..000000000000
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@@ -158,6 -192,17 +160,17 @@@ static void __init alloc_init_pmd(pud_
  {
  	pmd_t *pmd;
  	unsigned long next;
+ 	pmdval_t prot_sect;
+ 	pgprot_t prot_pte;
+ 
+ 	if (map_io) {
+ 		prot_sect = PMD_TYPE_SECT | PMD_SECT_AF |
+ 			    PMD_ATTRINDX(MT_DEVICE_nGnRE);
+ 		prot_pte = __pgprot(PROT_DEVICE_nGnRE);
+ 	} else {
 -		prot_sect = prot_sect_kernel;
++		prot_sect = PROT_SECT_NORMAL_EXEC;
+ 		prot_pte = PAGE_KERNEL_EXEC;
+ 	}
  
  	/*
  	 * Check for initial section mappings in the pgd/pud and remove them.
@@@ -195,30 -242,7 +210,30 @@@ static void __init alloc_init_pud(pgd_
  
  	do {
  		next = pud_addr_end(addr, end);
 -		alloc_init_pmd(pud, addr, next, phys, map_io);
 +
 +		/*
 +		 * For 4K granule only, attempt to put down a 1GB block
 +		 */
 +		if ((PAGE_SHIFT == 12) &&
 +		    ((addr | next | phys) & ~PUD_MASK) == 0) {
 +			pud_t old_pud = *pud;
 +			set_pud(pud, __pud(phys | PROT_SECT_NORMAL_EXEC));
 +
 +			/*
 +			 * If we have an old value for a pud, it will
 +			 * be pointing to a pmd table that we no longer
 +			 * need (from swapper_pg_dir).
 +			 *
 +			 * Look up the old pmd table and free it.
 +			 */
 +			if (!pud_none(old_pud)) {
 +				phys_addr_t table = __pa(pmd_offset(&old_pud, 0));
 +				memblock_free(table, PAGE_SIZE);
 +				flush_tlb_all();
 +			}
 +		} else {
- 			alloc_init_pmd(pud, addr, next, phys);
++			alloc_init_pmd(pud, addr, next, phys, map_io);
 +		}
  		phys += next - addr;
  	} while (pud++, addr = next, addr != end);
  }