]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/mm: Carve out INVLPG inline asm for use by others
authorBorislav Petkov (AMD) <bp@alien8.de>
Tue, 19 Nov 2024 11:21:32 +0000 (12:21 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 25 Nov 2024 10:28:02 +0000 (11:28 +0100)
No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/ZyulbYuvrkshfsd2@antipodes
arch/x86/include/asm/tlb.h
arch/x86/mm/tlb.c

index 580636cdc257b78930db0d9b9236cfa9fd62ed21..4d3c9d00d6b6b2e08617e068f449ac8564f203a6 100644 (file)
@@ -34,4 +34,8 @@ static inline void __tlb_remove_table(void *table)
        free_page_and_swap_cache(table);
 }
 
+static inline void invlpg(unsigned long addr)
+{
+       asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
+}
 #endif /* _ASM_X86_TLB_H */
index b0d5a644fc84dc2c405d42bb102fd20873441744..a2becb85bea79689439fb1ebe43f2d20d4957953 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/cacheflush.h>
 #include <asm/apic.h>
 #include <asm/perf_event.h>
+#include <asm/tlb.h>
 
 #include "mm_internal.h"
 
@@ -1140,7 +1141,7 @@ STATIC_NOPV void native_flush_tlb_one_user(unsigned long addr)
        bool cpu_pcide;
 
        /* Flush 'addr' from the kernel PCID: */
-       asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
+       invlpg(addr);
 
        /* If PTI is off there is no user PCID and nothing to flush. */
        if (!static_cpu_has(X86_FEATURE_PTI))