Skip to contentSkip to conversation

powerpc/mm: Add missing global TLBI if cxl is active

PATCH Applied Frederic Barrat 3 participants 3 messages Mar 29, 2017 – Apr 6, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mm: Add missing global TLBI if cxl is active

Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local TLBIs to global if the cxl driver is active. It is necessary because the CAPP snoops invalidations to forward them to the PSL on the cxl adapter.
However one path was apparently forgotten. native_flush_hash_range() still sends local TLBIs, as found out the hard way recently.

This patch fixes it by following the same logic as previously: if the cxl driver is active, the local TLBIs are 'upgraded' to global.

Fixes 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")
---
 arch/powerpc/mm/hash_native_64.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/mm/hash_native_64.c +5 -2
index cc33260..65bb8f3 100644
@@ -638,6 +638,10 @@ static void native_flush_hash_range(unsigned long number, int local)
 	unsigned long psize = batch->psize;
 	int ssize = batch->ssize;
 	int i;
+	unsigned int use_local;
+
+	use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&
+		mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();
 
 	local_irq_save(flags);
 
@@ -667,8 +671,7 @@ static void native_flush_hash_range(unsigned long number, int local)
 		} pte_iterate_hashed_end();
 	}
 
-	if (mmu_has_feature(MMU_FTR_TLBIEL) &&
-	    mmu_psize_defs[psize].tlbiel && local) {
+	if (use_local) {
 		asm volatile("ptesync":::"memory");
 		for (i = 0; i < number; i++) {
 			vpn = batch->vpn[i];
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Frederic Barrat

Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local TLBIs to global if the cxl driver is active. It is necessary because the CAPP snoops invalidations to forward them to the PSL on the cxl adapter.
However one path was apparently forgotten. native_flush_hash_range() still sends local TLBIs, as found out the hard way recently.

Quoted 6 lines

This patch fixes it by following the same logic as previously: if the cxl driver is active, the local TLBIs are 'upgraded' to global.

Fixes 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")
Quoted 31 lines
---
 arch/powerpc/mm/hash_native_64.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/mm/hash_native_64.c +5 -2
index cc33260..65bb8f3 100644
@@ -638,6 +638,10 @@ static void native_flush_hash_range(unsigned long number, int local)
 	unsigned long psize = batch->psize;
 	int ssize = batch->ssize;
 	int i;
+	unsigned int use_local;
+
+	use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&
+		mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();
 
 	local_irq_save(flags);
 
@@ -667,8 +671,7 @@ static void native_flush_hash_range(unsigned long number, int local)
 		} pte_iterate_hashed_end();
 	}
 
-	if (mmu_has_feature(MMU_FTR_TLBIEL) &&
-	    mmu_psize_defs[psize].tlbiel && local) {
+	if (use_local) {
 		asm volatile("ptesync":::"memory");
 		for (i = 0; i < number; i++) {
 			vpn = batch->vpn[i];
Signature · 1 line
2.9.3
#2 lore raw
In reply to Frederic Barrat
Quoted 7 lines · Frederic Barrat

Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local TLBIs to global if the cxl driver is active. It is necessary because the CAPP snoops invalidations to forward them to the PSL on the cxl adapter.
However one path was apparently forgotten. native_flush_hash_range() still sends local TLBIs, as found out the hard way recently.

Quoted 7 lines

This patch fixes it by following the same logic as previously: if the cxl driver is active, the local TLBIs are 'upgraded' to global.

Fixes 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/88b1bf7268f56887ca88eb09c6fb0f

cheers