Skip to content

Commit

Permalink
powerpc/mm: Disable hugepd for 64K page size.
Browse files Browse the repository at this point in the history
After commit e2b3d20
("powerpc: Switch 16GB and 16MB explicit hugepages to a
different page table format"), we don't need to support
is_hugepd() for 64K page size.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Aneesh Kumar K.V authored and Michael Ellerman committed Oct 12, 2015
1 parent c13e1c0 commit ec2640b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arch/powerpc/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,20 @@ typedef struct { signed long pd; } hugepd_t;

#ifdef CONFIG_HUGETLB_PAGE
#ifdef CONFIG_PPC_BOOK3S_64
#ifdef CONFIG_PPC_64K_PAGES
/*
* With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
* need to setup hugepage directory for them. Our pte and page directory format
* enable us to have this enabled. But to avoid errors when implementing new
* features disable hugepd for 64K. We enable a debug version here, So we catch
* wrong usage.
*/
#ifdef CONFIG_DEBUG_VM
extern int hugepd_ok(hugepd_t hpd);
#else
#define hugepd_ok(x) (0)
#endif
#else
static inline int hugepd_ok(hugepd_t hpd)
{
/*
Expand All @@ -372,6 +386,7 @@ static inline int hugepd_ok(hugepd_t hpd)
*/
return (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0));
}
#endif
#else
static inline int hugepd_ok(hugepd_t hpd)
{
Expand Down
19 changes: 19 additions & 0 deletions arch/powerpc/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ int pgd_huge(pgd_t pgd)
*/
return ((pgd_val(pgd) & 0x3) != 0x0);
}

#if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_DEBUG_VM)
/*
* This enables us to catch the wrong page directory format
* Moved here so that we can use WARN() in the call.
*/
int hugepd_ok(hugepd_t hpd)
{
bool is_hugepd;

/*
* We should not find this format in page directory, warn otherwise.
*/
is_hugepd = (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0));
WARN(is_hugepd, "Found wrong page directory format\n");
return 0;
}
#endif

#else
int pmd_huge(pmd_t pmd)
{
Expand Down

0 comments on commit ec2640b

Please sign in to comment.