#include <linux/mm.h>
#include <linux/init.h>
#include <linux/percpu.h>
+#include <linux/hardirq.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/tlb.h>
-#include <asm/hardirq.h>
#include <linux/highmem.h>
DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
ptepage = virt_to_page(ptep);
mm = (struct mm_struct *) ptepage->mapping;
- addr = ptepage->index +
- (((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE);
+ addr = ptepage->index;
+ if (pte_huge(pte))
+ addr += ((unsigned long)ptep & ~PAGE_MASK)
+ / sizeof(*ptep) * HPAGE_SIZE;
+ else
+ addr += ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
if (REGION_ID(addr) == USER_REGION_ID)
context = mm->context.id;