* [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n
@ 2016-07-26 3:38 Michael Ellerman
2016-07-26 3:38 ` [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header Michael Ellerman
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Michael Ellerman @ 2016-07-26 3:38 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Benjamin Herrenschmidt, Stephen Rothwell
The recent commit to rework the hash MMU setup broke the build when
CONFIG_PPC_NATIVE=n. Fix it by adding an IS_ENABLED() check before
calling hpte_init_native().
Removing the else clause opens the possibility that we don't set any
ops, which would probably lead to a strange crash later. So add a check
that we correctly initialised at least one member of the struct.
Fixes: 166dd7d3fbf2 ("powerpc/64: Move MMU backend selection out of platform code")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/hash_utils_64.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 341632471b9d..381b5894cc99 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -931,9 +931,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.
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header
2016-07-26 3:38 [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Michael Ellerman
@ 2016-07-26 3:38 ` Michael Ellerman
2016-07-26 3:47 ` Stephen Rothwell
2016-07-26 3:47 ` [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Stephen Rothwell
2016-07-27 14:32 ` [v2,1/2] " Michael Ellerman
2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2016-07-26 3:38 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Benjamin Herrenschmidt, Stephen Rothwell
hpte_init_lpar() is part of the pseries platform, so name it as such.
Move the fallback implementation for when PSERIES=n into the header,
dropping the weak implementation. The panic() is now handled by the
calling code.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 7 ++++++-
arch/powerpc/mm/hash_utils_64.c | 7 +------
arch/powerpc/platforms/pseries/lpar.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index b0f4dffe12ae..450b017fdc19 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -391,8 +391,13 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
extern void add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages);
extern void demote_segment_4k(struct mm_struct *mm, unsigned long addr);
+#ifdef CONFIG_PPC_PSERIES
+void hpte_init_pseries(void);
+#else
+static inline void hpte_init_pseries(void) { }
+#endif
+
extern void hpte_init_native(void);
-extern void hpte_init_lpar(void);
extern void hpte_init_beat(void);
extern void hpte_init_beat_v3(void);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 381b5894cc99..1ff11c1bb182 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)
{
/*
@@ -930,7 +925,7 @@ void __init hash__early_init_mmu(void)
if (firmware_has_feature(FW_FEATURE_PS3_LV1))
ps3_early_mm_init();
else if (firmware_has_feature(FW_FEATURE_LPAR))
- hpte_init_lpar();
+ hpte_init_pseries();
else if IS_ENABLED(CONFIG_PPC_NATIVE)
hpte_init_native();
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 0e91388d0af9..86707e67843f 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -589,7 +589,7 @@ static int __init disable_bulk_remove(char *str)
__setup("bulk_remove=", disable_bulk_remove);
-void __init hpte_init_lpar(void)
+void __init hpte_init_pseries(void)
{
mmu_hash_ops.hpte_invalidate = pSeries_lpar_hpte_invalidate;
mmu_hash_ops.hpte_updatepp = pSeries_lpar_hpte_updatepp;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header
2016-07-26 3:38 ` [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header Michael Ellerman
@ 2016-07-26 3:47 ` Stephen Rothwell
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2016-07-26 3:47 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Benjamin Herrenschmidt
Hi Michael,
On Tue, 26 Jul 2016 13:38:38 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> hpte_init_lpar() is part of the pseries platform, so name it as such.
>
> Move the fallback implementation for when PSERIES=n into the header,
> dropping the weak implementation. The panic() is now handled by the
> calling code.
Of course, this could have been handled the same way as the native one.
> else if (firmware_has_feature(FW_FEATURE_LPAR))
else if (IS_ENABLED(CONFIG_PPC_PSERIES) && firmware_has_feature(FW_FEATURE_LPAR))
> - hpte_init_lpar();
> + hpte_init_pseries();
and no need to modify the header file.
--
Cheers,
Stephen Rothwell
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n
2016-07-26 3:38 [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Michael Ellerman
2016-07-26 3:38 ` [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header Michael Ellerman
@ 2016-07-26 3:47 ` Stephen Rothwell
2016-07-27 14:32 ` [v2,1/2] " Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2016-07-26 3:47 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Benjamin Herrenschmidt
Hi Michael,
On Tue, 26 Jul 2016 13:38:37 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> The recent commit to rework the hash MMU setup broke the build when
> CONFIG_PPC_NATIVE=n. Fix it by adding an IS_ENABLED() check before
> calling hpte_init_native().
>
> Removing the else clause opens the possibility that we don't set any
> ops, which would probably lead to a strange crash later. So add a check
> that we correctly initialised at least one member of the struct.
>
> Fixes: 166dd7d3fbf2 ("powerpc/64: Move MMU backend selection out of platform code")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
--
Cheers,
Stephen Rothwell
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [v2,1/2] powerpc/mm: Fix build break when PPC_NATIVE=n
2016-07-26 3:38 [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Michael Ellerman
2016-07-26 3:38 ` [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header Michael Ellerman
2016-07-26 3:47 ` [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Stephen Rothwell
@ 2016-07-27 14:32 ` Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2016-07-27 14:32 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: Stephen Rothwell
On Tue, 2016-26-07 at 03:38:37 UTC, Michael Ellerman wrote:
> The recent commit to rework the hash MMU setup broke the build when
> CONFIG_PPC_NATIVE=n. Fix it by adding an IS_ENABLED() check before
> calling hpte_init_native().
>
> Removing the else clause opens the possibility that we don't set any
> ops, which would probably lead to a strange crash later. So add a check
> that we correctly initialised at least one member of the struct.
>
> Fixes: 166dd7d3fbf2 ("powerpc/64: Move MMU backend selection out of platform code")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Series applied to powerpc next.
https://git.kernel.org/powerpc/c/7353644fa9df875aee778a802e
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-07-27 14:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 3:38 [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Michael Ellerman
2016-07-26 3:38 ` [PATCH v2 2/2] powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header Michael Ellerman
2016-07-26 3:47 ` Stephen Rothwell
2016-07-26 3:47 ` [PATCH v2 1/2] powerpc/mm: Fix build break when PPC_NATIVE=n Stephen Rothwell
2016-07-27 14:32 ` [v2,1/2] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).