Thread (5 messages) flat view 5 messages, 3 authors, 2016-11-11

Re: [PATCH] powerpc/mm: Move hpte encode routine to platform specific files

From: Balbir Singh <bsingharora@gmail.com>
Date: 2016-11-11 01:11:49
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds


On 11/11/16 10:54, Balbir Singh wrote:

On 10/11/16 20:24, Aneesh Kumar K.V wrote:
quoted
They differ between powernv and pseries. While we are at it copy
a version for ps3 too. For now this is same as what we have for pSeries.

Fixes: 50de596de8be6 ("powerpc/mm/hash: Add support for Power9 Hash")
Signed-off-by: Aneesh Kumar K.V <redacted>

I have not looked at the patch closely, but do we want all of this
duplication. I was wondering if instead of

cpu_has_feature() we could firmware_has_feature() for now
Basically something like

Not-yet-signed-off-by: Balbir Singh [off-list ref]

diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index ac6d26e..2b23366 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -282,7 +282,8 @@ 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 (!cpu_has_feature(CPU_FTR_ARCH_300) ||
+		firmware_has_feature(FW_FEATURE_LPAR))
 		v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
 	return v;
 }
@@ -310,7 +311,8 @@ static inline unsigned long hpte_encode_r(unsigned long pa, int base_psize,
 					  int actual_psize, int ssize)
 {
 
-	if (cpu_has_feature(CPU_FTR_ARCH_300))
+	if (cpu_has_feature(CPU_FTR_ARCH_300) &&
+		!firmware_has_feature(FW_FEATURE_LPAR))
 		pa |= ((unsigned long) ssize) << HPTE_R_3_0_SSIZE_SHIFT;
 
 	/* A 4K page needs no special encoding */
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help