aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/pgtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/pgtable.h')
-rw-r--r--arch/x86/include/asm/pgtable.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index fc304279b559..1e672234c4ff 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -395,6 +395,7 @@ pte_t *populate_extra_pte(unsigned long vaddr);
395 395
396#ifndef __ASSEMBLY__ 396#ifndef __ASSEMBLY__
397#include <linux/mm_types.h> 397#include <linux/mm_types.h>
398#include <linux/log2.h>
398 399
399static inline int pte_none(pte_t pte) 400static inline int pte_none(pte_t pte)
400{ 401{
@@ -620,6 +621,8 @@ static inline int pgd_none(pgd_t pgd)
620#ifndef __ASSEMBLY__ 621#ifndef __ASSEMBLY__
621 622
622extern int direct_gbpages; 623extern int direct_gbpages;
624void init_mem_mapping(void);
625void early_alloc_pgt_buf(void);
623 626
624/* local pte updates need not use xchg for locking */ 627/* local pte updates need not use xchg for locking */
625static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep) 628static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
@@ -786,6 +789,20 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
786 memcpy(dst, src, count * sizeof(pgd_t)); 789 memcpy(dst, src, count * sizeof(pgd_t));
787} 790}
788 791
792#define PTE_SHIFT ilog2(PTRS_PER_PTE)
793static inline int page_level_shift(enum pg_level level)
794{
795 return (PAGE_SHIFT - PTE_SHIFT) + level * PTE_SHIFT;
796}
797static inline unsigned long page_level_size(enum pg_level level)
798{
799 return 1UL << page_level_shift(level);
800}
801static inline unsigned long page_level_mask(enum pg_level level)
802{
803 return ~(page_level_size(level) - 1);
804}
805
789/* 806/*
790 * The x86 doesn't have any external MMU info: the kernel page 807 * The x86 doesn't have any external MMU info: the kernel page
791 * tables contain all the necessary information. 808 * tables contain all the necessary information.