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

2016-07-26 Thread Michael Ellerman
Benjamin Herrenschmidt  writes:

> 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)) {
>> > arch/powerpc/platforms/cell/spu_manage.c:   if 
>> > (!firmware_has_feature(FW_FEATURE_LPAR))
>
> Those can just be checks for LV1, I think .. 

Yeah they can now.

Previously we had BEAT (the celleb HV), but now that's gone we can
switch those to LV1.

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

Not sure, it was news to me that pasemi ever had any HV support.

cheers
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-25 Thread Benjamin Herrenschmidt
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)) {
> > arch/powerpc/platforms/cell/spu_manage.c:   if 
> > (!firmware_has_feature(FW_FEATURE_LPAR))

Those can just be checks for LV1, I think .. 

> > 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.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-25 Thread Michael Ellerman
Benjamin Herrenschmidt  writes:

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

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
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-25 Thread Benjamin Herrenschmidt
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.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-24 Thread Michael Ellerman
Stephen Rothwell  writes:

> Hi Michael,
>
> On Mon, 25 Jul 2016 12:57:50 +1000 Michael Ellerman  
> 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?

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
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-24 Thread Benjamin Herrenschmidt
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  
> 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?

Shouldn't be with my latest series

Cheers,
Ben.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-24 Thread Stephen Rothwell
Hi Michael,

On Mon, 25 Jul 2016 12:57:50 +1000 Michael Ellerman  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
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

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

2016-07-24 Thread Michael Ellerman
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 
---
 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

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev