]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm64: mm: support zero page coloring
authorKrishna Reddy <vdumpa@nvidia.com>
Wed, 26 Mar 2014 22:02:37 +0000 (15:02 -0700)
committerKrishna Reddy <vdumpa@nvidia.com>
Mon, 31 Mar 2014 19:12:30 +0000 (12:12 -0700)
This patch supports eight zero pages. Based on bits 14:12, virtual address
is mapped to one of eight zero pages.

Bug 1485297

Change-Id: I8c77699d799771b2dca4d8c361db1701dc6cdabd
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/387281
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Reviewed-by: Richard Wiley <rwiley@nvidia.com>
arch/arm64/include/asm/mmu_context.h
arch/arm64/include/asm/pgtable.h
arch/arm64/mm/mmu.c

index 78ae69a7f07c18262e79b6865e06a48a5b65a433..237635d8a46ffac72f17de35ab1f2aac6bb71b78 100644 (file)
@@ -55,7 +55,7 @@ static inline void contextidr_thread_switch(struct task_struct *next)
  */
 static inline void cpu_set_reserved_ttbr0(void)
 {
-       unsigned long ttbr = page_to_phys(empty_zero_page);
+       unsigned long ttbr = page_to_phys(virt_to_page(empty_zero_page));
 
        asm(
        "       msr     ttbr0_el1, %0                   // set TTBR0\n"
index b5d0aabebb1248728af2265c1d9651c7bb1d46c3..625c7d69079b6094cd2d538a06a1ea61d8795ff9 100644 (file)
@@ -124,8 +124,12 @@ extern pgprot_t pgprot_default;
  * ZERO_PAGE is a global shared page that is always zero: used
  * for zero-mapped memory areas etc..
  */
-extern struct page *empty_zero_page;
-#define ZERO_PAGE(vaddr)       (empty_zero_page)
+extern unsigned long empty_zero_page;
+extern unsigned long zero_page_mask;
+
+#define ZERO_PAGE(vaddr) \
+       (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
+#define __HAVE_COLOR_ZERO_PAGE
 
 #define pte_pfn(pte)           ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
 
index dd18e83eb04538ac5ac434db7123dbd151357c94..2c050339dc7a5a89863fa678d106ba6c238ab026 100644 (file)
  * Empty_zero_page is a special page that is used for zero-initialized data
  * and COW.
  */
-struct page *empty_zero_page;
+unsigned long empty_zero_page;
 EXPORT_SYMBOL(empty_zero_page);
+unsigned long zero_page_mask;
+static zero_page_order = 3;
 
 pgprot_t pgprot_default;
 EXPORT_SYMBOL(pgprot_default);
@@ -371,8 +373,6 @@ static void __init map_mem(void)
  */
 void __init paging_init(void)
 {
-       void *zero_page;
-
        /*
         * Maximum PGDIR_SIZE addressable via the initial direct kernel
         * mapping in swapper_pg_dir.
@@ -396,11 +396,11 @@ void __init paging_init(void)
        flush_tlb_all();
 
        /* allocate the zero page. */
-       zero_page = early_alloc(PAGE_SIZE);
+       empty_zero_page = (ulong)early_alloc(PAGE_SIZE << zero_page_order);
+       zero_page_mask = ((PAGE_SIZE << zero_page_order) - 1) & PAGE_MASK;
 
        bootmem_init();
 
-       empty_zero_page = virt_to_page(zero_page);
 
        dma_contiguous_remap();
        /*