Commit 70c7605c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Palmer Dabbelt

riscv: pass the mm_struct to __sbi_tlb_flush_range

Move the call mm_cpumask from the callers into __sbi_tlb_flush_range to
reduce a bit of duplicate code and prepare for future changes.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarGuo Ren <guoren@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent c9811e37
...@@ -10,13 +10,10 @@ void flush_tlb_all(void) ...@@ -10,13 +10,10 @@ void flush_tlb_all(void)
sbi_remote_sfence_vma(NULL, 0, -1); sbi_remote_sfence_vma(NULL, 0, -1);
} }
/* static void __sbi_tlb_flush_range(struct mm_struct *mm, unsigned long start,
* This function must not be called with cmask being null.
* Kernel may panic if cmask is NULL.
*/
static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start,
unsigned long size, unsigned long stride) unsigned long size, unsigned long stride)
{ {
struct cpumask *cmask = mm_cpumask(mm);
struct cpumask hmask; struct cpumask hmask;
unsigned int cpuid; unsigned int cpuid;
...@@ -41,23 +38,23 @@ static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start, ...@@ -41,23 +38,23 @@ static void __sbi_tlb_flush_range(struct cpumask *cmask, unsigned long start,
void flush_tlb_mm(struct mm_struct *mm) void flush_tlb_mm(struct mm_struct *mm)
{ {
__sbi_tlb_flush_range(mm_cpumask(mm), 0, -1, PAGE_SIZE); __sbi_tlb_flush_range(mm, 0, -1, PAGE_SIZE);
} }
void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
{ {
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), addr, PAGE_SIZE, PAGE_SIZE); __sbi_tlb_flush_range(vma->vm_mm, addr, PAGE_SIZE, PAGE_SIZE);
} }
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), start, end - start, PAGE_SIZE); __sbi_tlb_flush_range(vma->vm_mm, start, end - start, PAGE_SIZE);
} }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start, void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end) unsigned long end)
{ {
__sbi_tlb_flush_range(mm_cpumask(vma->vm_mm), start, end - start, PMD_SIZE); __sbi_tlb_flush_range(vma->vm_mm, start, end - start, PMD_SIZE);
} }
#endif #endif
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