This patch has been lightly tested and needs testing
on additional platforms and different page sizes, largely
due to the mmu_features changes noted below
Commit 50de596de introduced support for the new PTE
format in the functions hpte_encode_r and hpte_encode_avpn.
This patch abstracts the change under
MMU_FTR_ISA3_HPTE_FORMAT. This bit is provided by the
ibm,pa-feature mechanism; hypervisor for guests
and via firmware for powernv.
The patch has a larger impact as the new feature bit
changes the definition of mmu_features from unsigned int
to unsigned long and also changes the print in setup_64.c
of the same feature.
This patch needs complementary changes to the
ibm,client-architecture in arch/powerpc/kernel/prom_init.c.
This is noted as a TODO
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Aneesh Kumar K.V <redacted>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 ++---
arch/powerpc/include/asm/cputable.h | 2 +-
arch/powerpc/include/asm/mmu.h | 11 ++++++++++-
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/kernel/setup_64.c | 2 +-
5 files changed, 15 insertions(+), 6 deletions(-)
@@ -229,7 +229,7 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,*/v=(vpn>>(23-VPN_SHIFT))&~(mmu_psize_defs[psize].avpnm);v<<=HPTE_V_AVPN_SHIFT;-if(!cpu_has_feature(CPU_FTR_ARCH_300))+if(!mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))v|=((unsignedlong)ssize)<<HPTE_V_SSIZE_SHIFT;returnv;}
@@ -256,8 +256,7 @@ static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,staticinlineunsignedlonghpte_encode_r(unsignedlongpa,intbase_psize,intactual_psize,intssize){--if(cpu_has_feature(CPU_FTR_ARCH_300))+if(mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))pa|=((unsignedlong)ssize)<<HPTE_R_3_0_SSIZE_SHIFT;/* A 4K page needs no special encoding */
@@ -58,7 +58,7 @@ struct cpu_spec {unsignedlongcpu_features;/* Kernel features */unsignedintcpu_user_features;/* Userland features */unsignedintcpu_user_features2;/* Userland features v2 */-unsignedintmmu_features;/* MMU features */+unsignedlongmmu_features;/* MMU features *//* cache line sizes */unsignedinticache_bsize;
This patch has been lightly tested and needs testing
on additional platforms and different page sizes, largely
due to the mmu_features changes noted below
Commit 50de596de introduced support for the new PTE
format in the functions hpte_encode_r and hpte_encode_avpn.
This patch abstracts the change under
MMU_FTR_ISA3_HPTE_FORMAT. This bit is provided by the
ibm,pa-feature mechanism; hypervisor for guests
and via firmware for powernv.
IIUC, ISA 3.0 require new hpte format. So not sure why would need a mmu
feature bit for it. For a guest running in P8 compat mode, which is
negotiated via ibm,client-architecture-support , the HCALL interface
should do the necessary mapping from the HPTE format we use with p8
kernel to the new ISA 3.0 format.
quoted hunk
The patch has a larger impact as the new feature bit
changes the definition of mmu_features from unsigned int
to unsigned long and also changes the print in setup_64.c
of the same feature.
This patch needs complementary changes to the
ibm,client-architecture in arch/powerpc/kernel/prom_init.c.
This is noted as a TODO
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Aneesh Kumar K.V <redacted>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 ++---
arch/powerpc/include/asm/cputable.h | 2 +-
arch/powerpc/include/asm/mmu.h | 11 ++++++++++-
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/kernel/setup_64.c | 2 +-
5 files changed, 15 insertions(+), 6 deletions(-)
@@ -229,7 +229,7 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,*/v=(vpn>>(23-VPN_SHIFT))&~(mmu_psize_defs[psize].avpnm);v<<=HPTE_V_AVPN_SHIFT;-if(!cpu_has_feature(CPU_FTR_ARCH_300))+if(!mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))v|=((unsignedlong)ssize)<<HPTE_V_SSIZE_SHIFT;returnv;}
@@ -256,8 +256,7 @@ static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,staticinlineunsignedlonghpte_encode_r(unsignedlongpa,intbase_psize,intactual_psize,intssize){--if(cpu_has_feature(CPU_FTR_ARCH_300))+if(mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))pa|=((unsignedlong)ssize)<<HPTE_R_3_0_SSIZE_SHIFT;/* A 4K page needs no special encoding */
@@ -58,7 +58,7 @@ struct cpu_spec {unsignedlongcpu_features;/* Kernel features */unsignedintcpu_user_features;/* Userland features */unsignedintcpu_user_features2;/* Userland features v2 */-unsignedintmmu_features;/* MMU features */+unsignedlongmmu_features;/* MMU features *//* cache line sizes */unsignedinticache_bsize;
IIUC, that bit indicate the usage of segment table. Not really new HPTE
format. With ISA 3.0, hash mode always need the new hpte format. Hence it
is not a something we could disable. ie, if we are on ISA 3.0 and using
hash mode, hash page table entries should have new format.
On Wed, Jun 15, 2016 at 2:51 AM, Aneesh Kumar K.V
[off-list ref] wrote:
Balbir Singh [off-list ref] writes:
quoted
This patch has been lightly tested and needs testing
on additional platforms and different page sizes, largely
due to the mmu_features changes noted below
Commit 50de596de introduced support for the new PTE
format in the functions hpte_encode_r and hpte_encode_avpn.
This patch abstracts the change under
MMU_FTR_ISA3_HPTE_FORMAT. This bit is provided by the
ibm,pa-feature mechanism; hypervisor for guests
and via firmware for powernv.
IIUC, ISA 3.0 require new hpte format. So not sure why would need a mmu
feature bit for it. For a guest running in P8 compat mode, which is
negotiated via ibm,client-architecture-support , the HCALL interface
should do the necessary mapping from the HPTE format we use with p8
kernel to the new ISA 3.0 format.
The point is that this capability needs to be advertised. It provides
greater flexibility. You are right in that the PTE needs to be stored
in the new format, but it should be done if advertised.
quoted
The patch has a larger impact as the new feature bit
changes the definition of mmu_features from unsigned int
to unsigned long and also changes the print in setup_64.c
of the same feature.
This patch needs complementary changes to the
ibm,client-architecture in arch/powerpc/kernel/prom_init.c.
This is noted as a TODO
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Aneesh Kumar K.V <redacted>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 ++---
arch/powerpc/include/asm/cputable.h | 2 +-
arch/powerpc/include/asm/mmu.h | 11 ++++++++++-
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/kernel/setup_64.c | 2 +-
5 files changed, 15 insertions(+), 6 deletions(-)
@@ -229,7 +229,7 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,*/v=(vpn>>(23-VPN_SHIFT))&~(mmu_psize_defs[psize].avpnm);v<<=HPTE_V_AVPN_SHIFT;-if(!cpu_has_feature(CPU_FTR_ARCH_300))+if(!mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))v|=((unsignedlong)ssize)<<HPTE_V_SSIZE_SHIFT;returnv;}
@@ -256,8 +256,7 @@ static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,staticinlineunsignedlonghpte_encode_r(unsignedlongpa,intbase_psize,intactual_psize,intssize){--if(cpu_has_feature(CPU_FTR_ARCH_300))+if(mmu_has_feature(MMU_FTR_ISA3_HPTE_FORMAT))pa|=((unsignedlong)ssize)<<HPTE_R_3_0_SSIZE_SHIFT;/* A 4K page needs no special encoding */
@@ -58,7 +58,7 @@ struct cpu_spec {unsignedlongcpu_features;/* Kernel features */unsignedintcpu_user_features;/* Userland features */unsignedintcpu_user_features2;/* Userland features v2 */-unsignedintmmu_features;/* MMU features */+unsignedlongmmu_features;/* MMU features *//* cache line sizes */unsignedinticache_bsize;
IIUC, that bit indicate the usage of segment table. Not really new HPTE
format. With ISA 3.0, hash mode always need the new hpte format. Hence it
is not a something we could disable. ie, if we are on ISA 3.0 and using
hash mode, hash page table entries should have new format.
The bit is for new hashing facility as per ISA 3.0. The plan of the
overall implementation is
This bit is advertised when new hashing capabilities are supported via
pa-features. The client the selects whether it supports it or not and
the hypervisor does the right thing for legacy guests.
Thanks for a review, I'll do a V2 with some changes
Balbir
Michael, please review and check if you like the #ifdef,
since we are crossing the 32 bit boundary, I've used a
conditional define to select the feature.
Changelog v2:
The new feature name is MMU_FTR_ISA3_HASH_SUPPORT
Fix build breakage
Commit 50de596de introduced support for the new PTE
format in the functions hpte_encode_r and hpte_encode_avpn.
This patch abstracts the change under
MMU_FTR_ISA3_HASH_SUPPORT. This bit is provided by the
ibm,pa-feature mechanism with the hypervisor for guests
and via firmware for powernv.
The patch has a larger impact as the new feature bit
changes the definition of mmu_features from unsigned int
to unsigned long and also changes the print in setup_64.c
of the same feature.
This patch needs complementary changes to the
ibm,client-architecture in arch/powerpc/kernel/prom_init.c.
This is noted as a TODO
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Aneesh Kumar K.V <redacted>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 ++---
arch/powerpc/include/asm/cputable.h | 2 +-
arch/powerpc/include/asm/mmu.h | 13 ++++++++++++-
arch/powerpc/kernel/prom.c | 1 +
arch/powerpc/kernel/setup_64.c | 2 +-
5 files changed, 17 insertions(+), 6 deletions(-)
@@ -229,7 +229,7 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,*/v=(vpn>>(23-VPN_SHIFT))&~(mmu_psize_defs[psize].avpnm);v<<=HPTE_V_AVPN_SHIFT;-if(!cpu_has_feature(CPU_FTR_ARCH_300))+if(!mmu_has_feature(MMU_FTR_ISA3_HASH_SUPPORT))v|=((unsignedlong)ssize)<<HPTE_V_SSIZE_SHIFT;returnv;}
@@ -256,8 +256,7 @@ static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,staticinlineunsignedlonghpte_encode_r(unsignedlongpa,intbase_psize,intactual_psize,intssize){--if(cpu_has_feature(CPU_FTR_ARCH_300))+if(mmu_has_feature(MMU_FTR_ISA3_HASH_SUPPORT))pa|=((unsignedlong)ssize)<<HPTE_R_3_0_SSIZE_SHIFT;/* A 4K page needs no special encoding */
@@ -58,7 +58,7 @@ struct cpu_spec {unsignedlongcpu_features;/* Kernel features */unsignedintcpu_user_features;/* Userland features */unsignedintcpu_user_features2;/* Userland features v2 */-unsignedintmmu_features;/* MMU features */+unsignedlongmmu_features;/* MMU features *//* cache line sizes */unsignedinticache_bsize;
Thanks for a review, I'll do a V2 with some changes
Balbir
Michael, please review and check if you like the #ifdef,
since we are crossing the 32 bit boundary, I've used a
conditional define to select the feature.
Changelog v2:
The new feature name is MMU_FTR_ISA3_HASH_SUPPORT
Fix build breakage
Commit 50de596de introduced support for the new PTE
format in the functions hpte_encode_r and hpte_encode_avpn.
This patch abstracts the change under
MMU_FTR_ISA3_HASH_SUPPORT. This bit is provided by the
ibm,pa-feature mechanism with the hypervisor for guests
and via firmware for powernv.
The patch has a larger impact as the new feature bit
changes the definition of mmu_features from unsigned int
to unsigned long and also changes the print in setup_64.c
of the same feature.
This patch needs complementary changes to the
ibm,client-architecture in arch/powerpc/kernel/prom_init.c.
This is noted as a TODO
@@ -229,7 +229,7 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,*/v=(vpn>>(23-VPN_SHIFT))&~(mmu_psize_defs[psize].avpnm);v<<=HPTE_V_AVPN_SHIFT;-if(!cpu_has_feature(CPU_FTR_ARCH_300))+if(!mmu_has_feature(MMU_FTR_ISA3_HASH_SUPPORT))v|=((unsignedlong)ssize)<<HPTE_V_SSIZE_SHIFT;returnv;}
@@ -256,8 +256,7 @@ static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,staticinlineunsignedlonghpte_encode_r(unsignedlongpa,intbase_psize,intactual_psize,intssize){--if(cpu_has_feature(CPU_FTR_ARCH_300))+if(mmu_has_feature(MMU_FTR_ISA3_HASH_SUPPORT))pa|=((unsignedlong)ssize)<<HPTE_R_3_0_SSIZE_SHIFT;/* A 4K page needs no special encoding */
@@ -58,7 +58,7 @@ struct cpu_spec {unsignedlongcpu_features;/* Kernel features */unsignedintcpu_user_features;/* Userland features */unsignedintcpu_user_features2;/* Userland features v2 */-unsignedintmmu_features;/* MMU features */+unsignedlongmmu_features;/* MMU features *//* cache line sizes */unsignedinticache_bsize;
Thanks for a review, I'll do a V2 with some changes
Balbir
Michael, please review and check if you like the #ifdef,
since we are crossing the 32 bit boundary, I've used a
conditional define to select the feature.
The comment in the file states that
/*
* First half is MMU families
*/
So effectively the first 16 bits are for families. Unless we decide to override
that decision. One can also debate the description of what a MMU family is :)
But I still am not sure why we need an mmu feature for selecting new hpte
format. Why would the exiting ISA 3.0 check won't work?
I thought I answered it in my previous email. The check for CPU_FTR_ARCH_300 is
too large and we don't want to use it unless advertised via ibm,pa-features.