Skip to content

Commit c7f4a55

Browse files
bp3tk0vSasha Levin
authored andcommitted
x86/mm: Carve out INVLPG inline asm for use by others
[ Upstream commit f1d84b5 ] No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/ZyulbYuvrkshfsd2@antipodes Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8f8df74 commit c7f4a55

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

arch/x86/include/asm/tlb.h

Lines changed: 4 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <asm/cacheflush.h>
2020
#include <asm/apic.h>
2121
#include <asm/perf_event.h>
22+
#include <asm/tlb.h>
2223

2324
#include "mm_internal.h"
2425

@@ -1145,7 +1146,7 @@ STATIC_NOPV void native_flush_tlb_one_user(unsigned long addr)
11451146
bool cpu_pcide;
11461147

11471148
/* Flush 'addr' from the kernel PCID: */
1148-
asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
1149+
invlpg(addr);
11491150

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

0 commit comments

Comments
 (0)