Commit d01dc25e authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s/radix: mm->context.id should always be valid

The MMU_NO_CONTEXT checks are an unnecessary complication. Make
these warn to prepare to remove them in future.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230203111718.1149852-3-npiggin@gmail.com
parent 45abf5d9
...@@ -700,12 +700,13 @@ static inline void _tlbiel_va_range_multicast(struct mm_struct *mm, ...@@ -700,12 +700,13 @@ static inline void _tlbiel_va_range_multicast(struct mm_struct *mm,
*/ */
void radix__local_flush_tlb_mm(struct mm_struct *mm) void radix__local_flush_tlb_mm(struct mm_struct *mm)
{ {
unsigned long pid; unsigned long pid = mm->context.id;
if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return;
preempt_disable(); preempt_disable();
pid = mm->context.id; _tlbiel_pid(pid, RIC_FLUSH_TLB);
if (pid != MMU_NO_CONTEXT)
_tlbiel_pid(pid, RIC_FLUSH_TLB);
preempt_enable(); preempt_enable();
} }
EXPORT_SYMBOL(radix__local_flush_tlb_mm); EXPORT_SYMBOL(radix__local_flush_tlb_mm);
...@@ -713,12 +714,13 @@ EXPORT_SYMBOL(radix__local_flush_tlb_mm); ...@@ -713,12 +714,13 @@ EXPORT_SYMBOL(radix__local_flush_tlb_mm);
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
void radix__local_flush_all_mm(struct mm_struct *mm) void radix__local_flush_all_mm(struct mm_struct *mm)
{ {
unsigned long pid; unsigned long pid = mm->context.id;
if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return;
preempt_disable(); preempt_disable();
pid = mm->context.id; _tlbiel_pid(pid, RIC_FLUSH_ALL);
if (pid != MMU_NO_CONTEXT)
_tlbiel_pid(pid, RIC_FLUSH_ALL);
preempt_enable(); preempt_enable();
} }
EXPORT_SYMBOL(radix__local_flush_all_mm); EXPORT_SYMBOL(radix__local_flush_all_mm);
...@@ -732,12 +734,13 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm) ...@@ -732,12 +734,13 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr, void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
int psize) int psize)
{ {
unsigned long pid; unsigned long pid = mm->context.id;
if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return;
preempt_disable(); preempt_disable();
pid = mm->context.id; _tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
if (pid != MMU_NO_CONTEXT)
_tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
preempt_enable(); preempt_enable();
} }
...@@ -945,7 +948,7 @@ void radix__flush_tlb_mm(struct mm_struct *mm) ...@@ -945,7 +948,7 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
preempt_disable(); preempt_disable();
...@@ -985,7 +988,7 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm) ...@@ -985,7 +988,7 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
preempt_disable(); preempt_disable();
...@@ -1024,7 +1027,7 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr, ...@@ -1024,7 +1027,7 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
preempt_disable(); preempt_disable();
...@@ -1130,7 +1133,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm, ...@@ -1130,7 +1133,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
preempt_disable(); preempt_disable();
...@@ -1330,7 +1333,7 @@ static void __radix__flush_tlb_range_psize(struct mm_struct *mm, ...@@ -1330,7 +1333,7 @@ static void __radix__flush_tlb_range_psize(struct mm_struct *mm,
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
fullmm = (end == TLB_FLUSH_ALL); fullmm = (end == TLB_FLUSH_ALL);
...@@ -1406,7 +1409,7 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr) ...@@ -1406,7 +1409,7 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
enum tlb_flush_type type; enum tlb_flush_type type;
pid = mm->context.id; pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT)) if (WARN_ON_ONCE(pid == MMU_NO_CONTEXT))
return; return;
/* 4k page size, just blow the world */ /* 4k page size, just blow the world */
......
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