Commit 4c6d9acc authored by Ian Munsie's avatar Ian Munsie Committed by Michael Ellerman

powerpc/mm: Add hooks for cxl

This adds hooks into the core powerpc mm code for cxl.

The core powerpc code sometimes uses local tlbie. Unfortunately this won't
work with the current cxl driver as it relies on snooping tlbie broadcasts.

The cxl hardware can have TLB entries invalidated via MMIO but this is not
currently supported by the driver. In future we can make local tlbie smarter so
that it invalidates cxl contexts via MMIO when it needs to but for now we have
this workaround.

This workaround checks for any active cxl contexts and if so, disables local
tlbie.

This also adds a hook for when SLBs are invalidated. This ensures any
corresponding SLBs in cxl are also invalidated at the same time. This is
required for segment demotion.
Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 09521736
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/reg.h> #include <asm/reg.h>
#include <asm/copro.h> #include <asm/copro.h>
#include <asm/spu.h> #include <asm/spu.h>
#include <misc/cxl.h>
/* /*
* This ought to be kept in sync with the powerpc specific do_page_fault * This ought to be kept in sync with the powerpc specific do_page_fault
...@@ -143,5 +144,6 @@ void copro_flush_all_slbs(struct mm_struct *mm) ...@@ -143,5 +144,6 @@ void copro_flush_all_slbs(struct mm_struct *mm)
#ifdef CONFIG_SPU_BASE #ifdef CONFIG_SPU_BASE
spu_flush_all_slbs(mm); spu_flush_all_slbs(mm);
#endif #endif
cxl_slbia(mm);
} }
EXPORT_SYMBOL_GPL(copro_flush_all_slbs); EXPORT_SYMBOL_GPL(copro_flush_all_slbs);
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/ppc-opcode.h> #include <asm/ppc-opcode.h>
#include <misc/cxl.h>
#ifdef DEBUG_LOW #ifdef DEBUG_LOW
#define DBG_LOW(fmt...) udbg_printf(fmt) #define DBG_LOW(fmt...) udbg_printf(fmt)
#else #else
...@@ -149,9 +151,11 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) ...@@ -149,9 +151,11 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
static inline void tlbie(unsigned long vpn, int psize, int apsize, static inline void tlbie(unsigned long vpn, int psize, int apsize,
int ssize, int local) int ssize, int local)
{ {
unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL); unsigned int use_local;
int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) && !cxl_ctx_in_use();
if (use_local) if (use_local)
use_local = mmu_psize_defs[psize].tlbiel; use_local = mmu_psize_defs[psize].tlbiel;
if (lock_tlbie && !use_local) if (lock_tlbie && !use_local)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment