We want to rework how set_pXd() behaves for generic compile-time folded
page tables by disallowing its use and triggering a compile-time error
when it is used improperly, ensuring that the actual first-level
set_pXd() function is used instead.

Therefore, replace set_pgd() with set_pmd() when CONFIG_PGTABLE_LEVELS=2.

There should be no functional change.

Signed-off-by: Yeoreum Yun <[email protected]>
---
 arch/x86/platform/olpc/olpc_ofw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/olpc/olpc_ofw.c 
b/arch/x86/platform/olpc/olpc_ofw.c
index 6bab0f0aa8f3e..d709534d48373 100644
--- a/arch/x86/platform/olpc/olpc_ofw.c
+++ b/arch/x86/platform/olpc/olpc_ofw.c
@@ -25,6 +25,8 @@ void __init setup_olpc_ofw_pgd(void)
 {
        pgd_t *base, *ofw_pde;
 
+       BUILD_BUG_ON(CONFIG_PGTABLE_LEVELS != 2);
+
        if (!olpc_ofw_cif)
                return;
 
@@ -38,7 +40,8 @@ void __init setup_olpc_ofw_pgd(void)
        ofw_pde = &base[OLPC_OFW_PDE_NR];
 
        /* install OFW's PDE permanently into the kernel's pgtable */
-       set_pgd(&swapper_pg_dir[OLPC_OFW_PDE_NR], *ofw_pde);
+       set_pmd((pmd_t *)&swapper_pg_dir[OLPC_OFW_PDE_NR],
+               *(pmd_t *)ofw_pde);
        /* implicit optimization barrier here due to uninline function return */
 
        early_iounmap(base, sizeof(olpc_ofw_pgd) * PTRS_PER_PGD);
-- 
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}


Reply via email to