From 6953fba32d63c8d105694ec7174ae28fcee711d7 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Thu, 18 Jan 2024 15:41:31 +0100 Subject: [PATCH] pgtable: add pmd_index() fallback It is needed for ARM 32bit non-LPAE builds. Change-Id: Ic38faf98600a7f9cb46142c1bd39649df3b14692 Signed-off-by: Marek Szyprowski --- include/asm-generic/pgtable.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index e5d4e2b..1925c06 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1220,6 +1220,14 @@ static inline bool arch_has_pfn_modify_check(void) #define pmd_leaf(x) 0 #endif +#ifndef pmd_index +static inline unsigned long pmd_index(unsigned long address) +{ + return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); +} +#define pmd_index pmd_index +#endif + #ifndef pud_index static inline unsigned long pud_index(unsigned long address) { -- 2.7.4