Skip to content

Commit f1d84b5

Browse files
committed
x86/mm: Carve out INVLPG inline asm for use by others
No functional changes. Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/ZyulbYuvrkshfsd2@antipodes
1 parent d9bb405 commit f1d84b5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

arch/x86/include/asm/tlb.h

+4
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ static inline void __tlb_remove_table(void *table)
3434
free_page_and_swap_cache(table);
3535
}
3636

37+
static inline void invlpg(unsigned long addr)
38+
{
39+
asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
40+
}
3741
#endif /* _ASM_X86_TLB_H */

arch/x86/mm/tlb.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/cacheflush.h>
2121
#include <asm/apic.h>
2222
#include <asm/perf_event.h>
23+
#include <asm/tlb.h>
2324

2425
#include "mm_internal.h"
2526

@@ -1140,7 +1141,7 @@ STATIC_NOPV void native_flush_tlb_one_user(unsigned long addr)
11401141
bool cpu_pcide;
11411142

11421143
/* Flush 'addr' from the kernel PCID: */
1143-
asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
1144+
invlpg(addr);
11441145

11451146
/* If PTI is off there is no user PCID and nothing to flush. */
11461147
if (!static_cpu_has(X86_FEATURE_PTI))

0 commit comments

Comments
 (0)