riscv: Improve tlb_flush()
[platform/kernel/linux-starfive.git] / arch / riscv / include / asm / tlb.h
index 120bcf2..1eb5682 100644 (file)
@@ -15,7 +15,13 @@ static void tlb_flush(struct mmu_gather *tlb);
 
 static inline void tlb_flush(struct mmu_gather *tlb)
 {
-       flush_tlb_mm(tlb->mm);
+#ifdef CONFIG_MMU
+       if (tlb->fullmm || tlb->need_flush_all)
+               flush_tlb_mm(tlb->mm);
+       else
+               flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end,
+                                  tlb_get_unmap_size(tlb));
+#endif
 }
 
 #endif /* _ASM_RISCV_TLB_H */