From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 02:57:57
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().
Fixes: 166dd7d3fbf2 ("powerpc/64: Move MMU backend selection out of platform code")
Reported-by: Stephen Rothwell <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -391,7 +391,15 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,externvoidadd_gpage(u64addr,u64page_size,unsignedlongnumber_of_pages);externvoiddemote_segment_4k(structmm_struct*mm,unsignedlongaddr);-externvoidhpte_init_native(void);+#ifdef CONFIG_PPC_NATIVE+voidhpte_init_native(void);+#else+staticinlinevoidhpte_init_native(void)+{+panic("hpte_init_native: No noative hash table support compiled in!\n");+}+#endif+externvoidhpte_init_lpar(void);externvoidhpte_init_beat(void);externvoidhpte_init_beat_v3(void);
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 02:57:58
hpte_init_lpar() is part of the pseries platform, so name it as such.
Provide the fallback implementation in a header, rather than using a
weak function.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 10 +++++++++-
arch/powerpc/mm/hash_utils_64.c | 7 +------
arch/powerpc/platforms/pseries/lpar.c | 2 +-
3 files changed, 11 insertions(+), 8 deletions(-)
@@ -885,11 +885,6 @@ static void __init htab_initialize(void)#undef KB#undef MB-void__init__weakhpte_init_lpar(void)-{-panic("FW_FEATURE_LPAR set but no LPAR support compiled\n");-}-void__inithash__early_init_mmu(void){/*
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 02:57:58
We removed the BEAT support in 2015 in commit bf4981a00636 ("powerpc:
Remove the celleb support"). These externs are unused since then.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 3 ---
1 file changed, 3 deletions(-)
From: Stephen Rothwell <hidden> Date: 2016-07-25 04:03:33
Hi Michael,
On Mon, 25 Jul 2016 12:57:49 +1000 Michael Ellerman [off-list ref] 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.
--
Cheers,
Stephen Rothwell
From: Stephen Rothwell <hidden> Date: 2016-07-25 04:13:26
Hi Michael,
On Mon, 25 Jul 2016 12:57:50 +1000 Michael Ellerman [off-list ref] wrote:
hpte_init_lpar() is part of the pseries platform, so name it as such.
Provide the fallback implementation in a header, rather than using a
weak function.
firmware_has_feature(FW_FEATURE_LPAR) can also be true for
CONFIG_PPC_PS3. Is this a problem?
--
Cheers,
Stephen Rothwell
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2016-07-25 04:43:09
On Mon, 2016-07-25 at 14:13 +1000, Stephen Rothwell wrote:
Hi Michael,
On Mon, 25 Jul 2016 12:57:50 +1000 Michael Ellerman [off-list ref] wrote:
quoted
hpte_init_lpar() is part of the pseries platform, so name it as such.
Provide the fallback implementation in a header, rather than using a
weak function.
firmware_has_feature(FW_FEATURE_LPAR) can also be true for
CONFIG_PPC_PS3. Is this a problem?
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 05:33:03
Stephen Rothwell [off-list ref] writes:
Hi Michael,
On Mon, 25 Jul 2016 12:57:50 +1000 Michael Ellerman [off-list ref] wrote:
quoted
hpte_init_lpar() is part of the pseries platform, so name it as such.
Provide the fallback implementation in a header, rather than using a
weak function.
firmware_has_feature(FW_FEATURE_LPAR) can also be true for
CONFIG_PPC_PS3. Is this a problem?
No it shouldn't be, because the PS3_LV1 check should have already hit:
/* Select appropriate backend */
if (firmware_has_feature(FW_FEATURE_PS3_LV1))
ps3_early_mm_init();
else if (firmware_has_feature(FW_FEATURE_LPAR))
hpte_init_pseries();
else
hpte_init_native();
When we detect a PS3 we set both PS3_LV1 and LPAR at the same time, so
there should be no way they can get out of sync, other than due to a
bug in the code.
cheers
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 06:17:53
Stephen Rothwell [off-list ref] writes:
Hi Michael,
On Mon, 25 Jul 2016 12:57:49 +1000 Michael Ellerman [off-list ref] wrote:
quoted
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().
cheers
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2016-07-25 09:50:17
On Mon, 2016-07-25 at 15:33 +1000, Michael Ellerman wrote:
When we detect a PS3 we set both PS3_LV1 and LPAR at the same time,
so
there should be no way they can get out of sync, other than due to a
bug in the code.
I thought I had changed PS3 to no longer set LPAR ? I like having a
flag that basically says PAPR and that's pretty much what LPAR is,
in fact I think I've been using it elsewhere with that meaning
Cheers,
Ben.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 10:36:15
Benjamin Herrenschmidt [off-list ref] writes:
On Mon, 2016-07-25 at 15:33 +1000, Michael Ellerman wrote:
quoted
When we detect a PS3 we set both PS3_LV1 and LPAR at the same time,
so
there should be no way they can get out of sync, other than due to a
bug in the code.
I thought I had changed PS3 to no longer set LPAR ?
I like having a flag that basically says PAPR and that's pretty much
what LPAR is, in fact I think I've been using it elsewhere with that
meaning
That would be nice, but these look fishy at least:
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR))
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR)) {
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR))
arch/powerpc/platforms/pasemi/iommu.c: !firmware_has_feature(FW_FEATURE_LPAR)) {
drivers/net/ethernet/pasemi/pasemi_mac.c: return firmware_has_feature(FW_FEATURE_LPAR);
cheers
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-07-25 10:39:31
Quoting Michael Ellerman (2016-07-25 16:17:52)
Stephen Rothwell [off-list ref] writes:
=
quoted
Hi Michael,
On Mon, 25 Jul 2016 12:57:49 +1000 Michael Ellerman <mpe@ellerman.id.au=
wrote:
quoted
quoted
The recent commit to rework the hash MMU setup broke the build when
CONFIG_PPC_NATIVE=3Dn. 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
@@ -885,11 +885,6 @@ static void __init htab_initialize(void)#undef KB#undef MB=-void__init__weakhpte_init_lpar(void)-{-panic("FW_FEATURE_LPAR set but no LPAR support compiled\n");-}-void__inithash__early_init_mmu(void){/*
@@ -931,9 +926,12 @@ void __init hash__early_init_mmu(void)ps3_early_mm_init();elseif(firmware_has_feature(FW_FEATURE_LPAR))hpte_init_lpar();-else+elseifIS_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*ofmemory.HastobedonebeforeSLBinitializationasthisis*currentlywherethepagesizeencodingisobtained.
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2016-07-25 12:11:38
On Mon, 2016-07-25 at 20:36 +1000, Michael Ellerman wrote:
That would be nice, but these look fishy at least:
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR))
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR)) {
quoted
arch/powerpc/platforms/cell/spu_manage.c: if (!firmware_has_feature(FW_FEATURE_LPAR))
From: Michael Ellerman <hidden> Date: 2016-07-27 14:32:49
On Mon, 2016-25-07 at 02:57:51 UTC, Michael Ellerman wrote:
We removed the BEAT support in 2015 in commit bf4981a00636 ("powerpc:
Remove the celleb support"). These externs are unused since then.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>