]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: LPAE: Invalidate the TLB before freeing the PMD
authorCatalin Marinas <catalin.marinas@arm.com>
Tue, 22 Nov 2011 17:30:29 +0000 (17:30 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 8 Dec 2011 10:30:40 +0000 (10:30 +0000)
Similar to the PTE freeing, this patch introduced __pmd_free_tlb() which
invalidates the TLB before freeing a PMD page. This is needed because on
newer processors the entry in the upper page table may be cached by the
TLB and point to random data after the PMD has been freed.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm/include/asm/tlb.h

index b509e441e0ad4b71915ceeedc6ee256daed458f3..5d3ed7e38561dd43553d1d3bf1b2af07e0d2b747 100644 (file)
@@ -202,8 +202,17 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
        tlb_remove_page(tlb, pte);
 }
 
+static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
+                                 unsigned long addr)
+{
+#ifdef CONFIG_ARM_LPAE
+       tlb_add_flush(tlb, addr);
+       tlb_remove_page(tlb, virt_to_page(pmdp));
+#endif
+}
+
 #define pte_free_tlb(tlb, ptep, addr)  __pte_free_tlb(tlb, ptep, addr)
-#define pmd_free_tlb(tlb, pmdp, addr)  pmd_free((tlb)->mm, pmdp)
+#define pmd_free_tlb(tlb, pmdp, addr)  __pmd_free_tlb(tlb, pmdp, addr)
 #define pud_free_tlb(tlb, pudp, addr)  pud_free((tlb)->mm, pudp)
 
 #define tlb_migrate_finish(mm)         do { } while (0)