mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 09:09:36 +07:00
5f307be18b
Provide a generic tlb_flush() implementation that relies on flush_tlb_range(). This is a little awkward because flush_tlb_range() assumes a VMA for range invalidation, but we no longer have one. Audit of all flush_tlb_range() implementations shows only vma->vm_mm and vma->vm_flags are used, and of the latter only VM_EXEC (I-TLB invalidates) and VM_HUGETLB (large TLB invalidate) are used. Therefore, track VM_EXEC and VM_HUGETLB in two more bits, and create a 'fake' VMA. This allows architectures that have a reasonably efficient flush_tlb_range() to not require any additional effort. No change in behavior intended. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Will Deacon <will.deacon@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Nick Piggin <npiggin@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@surriel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_TLB_H
|
|
#define _ASM_X86_TLB_H
|
|
|
|
#define tlb_start_vma(tlb, vma) do { } while (0)
|
|
#define tlb_end_vma(tlb, vma) do { } while (0)
|
|
#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
|
|
|
|
#define tlb_flush tlb_flush
|
|
static inline void tlb_flush(struct mmu_gather *tlb);
|
|
|
|
#include <asm-generic/tlb.h>
|
|
|
|
static inline void tlb_flush(struct mmu_gather *tlb)
|
|
{
|
|
unsigned long start = 0UL, end = TLB_FLUSH_ALL;
|
|
unsigned int stride_shift = tlb_get_unmap_shift(tlb);
|
|
|
|
if (!tlb->fullmm && !tlb->need_flush_all) {
|
|
start = tlb->start;
|
|
end = tlb->end;
|
|
}
|
|
|
|
flush_tlb_mm_range(tlb->mm, start, end, stride_shift, tlb->freed_tables);
|
|
}
|
|
|
|
/*
|
|
* While x86 architecture in general requires an IPI to perform TLB
|
|
* shootdown, enablement code for several hypervisors overrides
|
|
* .flush_tlb_others hook in pv_mmu_ops and implements it by issuing
|
|
* a hypercall. To keep software pagetable walkers safe in this case we
|
|
* switch to RCU based table free (HAVE_RCU_TABLE_FREE). See the comment
|
|
* below 'ifdef CONFIG_HAVE_RCU_TABLE_FREE' in include/asm-generic/tlb.h
|
|
* for more details.
|
|
*/
|
|
static inline void __tlb_remove_table(void *table)
|
|
{
|
|
free_page_and_swap_cache(table);
|
|
}
|
|
|
|
#endif /* _ASM_X86_TLB_H */
|