[PATCH 1/3] powerpc/mm: Fix build break due when PPC_NATIVE=n

Michael Ellerman mpe at ellerman.id.au
Mon Jul 25 20:39:30 AEST 2016


Quoting Michael Ellerman (2016-07-25 16:17:52)
> Stephen Rothwell <sfr at canb.auug.org.au> writes:
> 
> > Hi Michael,
> >
> > On Mon, 25 Jul 2016 12:57:49 +1000 Michael Ellerman <mpe at ellerman.id.au> wrote:
> >>
> >> The recent commit to rework the hash MMU setup broke the build when
> >> CONFIG_PPC_NATIVE=n. Fix it by providing a fallback implementation of
> >> hpte_init_native().
> >
> > Alternatively, you could make the call site dependent on
> > IS_ENABLED(CONFIG_PPC_NATIVE) and not need the fallback.
> >
> > so:
> >
> >       else if (IS_ENABLED(CONFIG_PPC_NATIVE))
> >               hpte_init_native();
> >
> > in arch/powerpc/mm/hash_utils_64.c and let the compiler elide the call.
> 
> That would mean we might fall through and not assign any ops, so I think
> it's preferable to have a fallback that explicitly panics().

Actually I think this works and is smaller all round.

Will test and resend.

cheers

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 341632471b9d..e44f2d759055 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -885,11 +885,6 @@ static void __init htab_initialize(void)
 #undef KB
 #undef MB
 
-void __init __weak hpte_init_lpar(void)
-{
-	panic("FW_FEATURE_LPAR set but no LPAR support compiled\n");
-}
-
 void __init hash__early_init_mmu(void)
 {
 	/*
@@ -931,9 +926,12 @@ void __init hash__early_init_mmu(void)
 		ps3_early_mm_init();
 	else if (firmware_has_feature(FW_FEATURE_LPAR))
 		hpte_init_lpar();
-	else
+	else if IS_ENABLED(CONFIG_PPC_NATIVE)
 		hpte_init_native();
 
+	if (!mmu_hash_ops.hpte_insert)
+		panic("hash__early_init_mmu: No MMU hash ops defined!\n");
+
 	/* Initialize the MMU Hash table and create the linear mapping
 	 * of memory. Has to be done before SLB initialization as this is
 	 * currently where the page size encoding is obtained.


More information about the Linuxppc-dev mailing list