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

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3669d

14 messages, 4 authors, 2016-07-27 · open the first message on its own page

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

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(-)
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index b0f4dffe12ae..45dfa2e4f0d1 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -391,7 +391,15 @@ 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);
 
-extern void hpte_init_native(void);
+#ifdef CONFIG_PPC_NATIVE
+void hpte_init_native(void);
+#else
+static inline void hpte_init_native(void)
+{
+	panic("hpte_init_native: No noative hash table support compiled in!\n");
+}
+#endif
+
 extern void hpte_init_lpar(void);
 extern void hpte_init_beat(void);
 extern void hpte_init_beat_v3(void);
-- 
2.7.4

[PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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(-)
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index 45dfa2e4f0d1..23cff86aa779 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -400,7 +400,15 @@ static inline void hpte_init_native(void)
 }
 #endif
 
-extern void hpte_init_lpar(void);
+#ifdef CONFIG_PPC_PSERIES
+void hpte_init_pseries(void);
+#else
+static inline void hpte_init_pseries(void)
+{
+	panic("hpte_init_pseries: No LPAR hash table support compiled in!\n");
+}
+#endif
+
 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 341632471b9d..92043204363c 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
 		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

[PATCH 3/3] powerpc/mm: Drop unused externs for hpte_init_beat[_v3]()

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(-)
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index 23cff86aa779..e520ee7731a8 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -409,9 +409,6 @@ static inline void hpte_init_pseries(void)
 }
 #endif
 
-extern void hpte_init_beat(void);
-extern void hpte_init_beat_v3(void);
-
 extern void slb_initialize(void);
 extern void slb_flush_and_rebolt(void);
 
-- 
2.7.4

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

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

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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?
Shouldn't be with my latest series

Cheers,
Ben.

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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

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

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

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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.

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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 ?
Nope:

FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,

...

#ifdef CONFIG_PPC_PS3
	/* Identify PS3 firmware */
	if (of_flat_dt_is_compatible(of_get_flat_dt_root(), "sony,ps3"))
		powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;
#endif
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

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

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
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_6=
4.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.

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

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))
Those can just be checks for LV1, I think .. 
quoted
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);
And that was some experiemtal PAPR'ish thing wasn't it ?

Cheers,
Ben.

Re: [PATCH 2/3] powerpc/mm: Rename hpte_init_lpar() & put fallback in a header

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-07-27 00:27:56

Benjamin Herrenschmidt [off-list ref] writes:
On Mon, 2016-07-25 at 20:36 +1000, Michael Ellerman wrote:
quoted
That would be nice, but these look fishy at least:
=20
arch/powerpc/platforms/cell/spu_manage.c:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 if (!firmware_has_feature(FW_FEATURE_LPAR))
quoted
arch/powerpc/platforms/cell/spu_manage.c:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
quoted
quoted
arch/powerpc/platforms/cell/spu_manage.c:=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 if (!firmware_has_feature(FW_FEATURE_LPAR))
Those can just be checks for LV1, I think ..=C2=A0
Yeah they can now.

Previously we had BEAT (the celleb HV), but now that's gone we can
switch those to LV1.
quoted
quoted
arch/powerpc/platforms/pasemi/iommu.c:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 !=
firmware_has_feature(FW_FEATURE_LPAR)) {
quoted
drivers/net/ethernet/pasemi/pasemi_mac.c:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 return firmware_has_feature(FW_FEATURE_LPAR);
And that was some experiemtal PAPR'ish thing wasn't it ?
Not sure, it was news to me that pasemi ever had any HV support.

cheers

Re: [3/3] powerpc/mm: Drop unused externs for hpte_init_beat[_v3]()

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>
Applied to powerpc next.

https://git.kernel.org/powerpc/c/1a1cee843c4a532f57083ffe8c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help