diff options
Diffstat (limited to 'arch/x86/include/asm/pgtable.h')
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index b444d83cfc95..89d5c8886c85 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -65,7 +65,7 @@ extern pmdval_t early_pmd_flags; | |||
65 | 65 | ||
66 | #ifndef __PAGETABLE_P4D_FOLDED | 66 | #ifndef __PAGETABLE_P4D_FOLDED |
67 | #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd) | 67 | #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd) |
68 | #define pgd_clear(pgd) native_pgd_clear(pgd) | 68 | #define pgd_clear(pgd) (pgtable_l5_enabled ? native_pgd_clear(pgd) : 0) |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | #ifndef set_p4d | 71 | #ifndef set_p4d |
@@ -859,6 +859,8 @@ static inline unsigned long p4d_index(unsigned long address) | |||
859 | #if CONFIG_PGTABLE_LEVELS > 4 | 859 | #if CONFIG_PGTABLE_LEVELS > 4 |
860 | static inline int pgd_present(pgd_t pgd) | 860 | static inline int pgd_present(pgd_t pgd) |
861 | { | 861 | { |
862 | if (!pgtable_l5_enabled) | ||
863 | return 1; | ||
862 | return pgd_flags(pgd) & _PAGE_PRESENT; | 864 | return pgd_flags(pgd) & _PAGE_PRESENT; |
863 | } | 865 | } |
864 | 866 | ||
@@ -876,6 +878,8 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd) | |||
876 | /* to find an entry in a page-table-directory. */ | 878 | /* to find an entry in a page-table-directory. */ |
877 | static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address) | 879 | static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address) |
878 | { | 880 | { |
881 | if (!pgtable_l5_enabled) | ||
882 | return (p4d_t *)pgd; | ||
879 | return (p4d_t *)pgd_page_vaddr(*pgd) + p4d_index(address); | 883 | return (p4d_t *)pgd_page_vaddr(*pgd) + p4d_index(address); |
880 | } | 884 | } |
881 | 885 | ||
@@ -883,6 +887,9 @@ static inline int pgd_bad(pgd_t pgd) | |||
883 | { | 887 | { |
884 | unsigned long ignore_flags = _PAGE_USER; | 888 | unsigned long ignore_flags = _PAGE_USER; |
885 | 889 | ||
890 | if (!pgtable_l5_enabled) | ||
891 | return 0; | ||
892 | |||
886 | if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) | 893 | if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) |
887 | ignore_flags |= _PAGE_NX; | 894 | ignore_flags |= _PAGE_NX; |
888 | 895 | ||
@@ -891,6 +898,8 @@ static inline int pgd_bad(pgd_t pgd) | |||
891 | 898 | ||
892 | static inline int pgd_none(pgd_t pgd) | 899 | static inline int pgd_none(pgd_t pgd) |
893 | { | 900 | { |
901 | if (!pgtable_l5_enabled) | ||
902 | return 0; | ||
894 | /* | 903 | /* |
895 | * There is no need to do a workaround for the KNL stray | 904 | * There is no need to do a workaround for the KNL stray |
896 | * A/D bit erratum here. PGDs only point to page tables | 905 | * A/D bit erratum here. PGDs only point to page tables |