From: Borislav Petkov <bp@kernel.org>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>
Subject: [PATCH 1/2] x86/mm: Carve out INVLPG inline asm for use by others
Date: Tue, 19 Nov 2024 12:21:32 +0100 [thread overview]
Message-ID: <20241119112133.20552-1-bp@kernel.org> (raw)
In-Reply-To: <ZyulbYuvrkshfsd2@antipodes>
From: "Borislav Petkov (AMD)" <bp@alien8.de>
No functional changes.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
arch/x86/include/asm/tlb.h | 4 ++++
arch/x86/mm/tlb.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h
index 580636cdc257..4d3c9d00d6b6 100644
--- a/arch/x86/include/asm/tlb.h
+++ b/arch/x86/include/asm/tlb.h
@@ -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 */
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 86593d1b787d..b0678d59ebdb 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -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))
--
2.43.0
next prev parent reply other threads:[~2024-11-19 11:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 17:20 x86/amd late microcode thread loading slows down boot Thomas De Schampheleire
2024-11-06 18:50 ` Andrew Cooper
2024-11-07 15:30 ` Borislav Petkov
2024-11-07 20:58 ` Thomas De Schampheleire
2024-11-14 9:56 ` Borislav Petkov
2024-11-14 12:03 ` Andrew Cooper
2024-11-15 20:51 ` Borislav Petkov
2024-11-16 19:32 ` Andrew Cooper
2024-11-17 18:23 ` David Laight
2024-11-17 19:52 ` Borislav Petkov
2024-11-18 15:13 ` Thomas De Schampheleire
2024-11-18 15:28 ` Borislav Petkov
2024-11-18 15:58 ` Thomas De Schampheleire
2024-11-19 10:46 ` Thomas De Schampheleire
2024-11-19 11:17 ` Borislav Petkov
2024-11-18 19:16 ` Borislav Petkov
2024-11-14 20:01 ` Thomas De Schampheleire
2024-11-19 11:21 ` Borislav Petkov [this message]
2024-11-19 11:21 ` [PATCH 2/2] x86/microcode/AMD: Flush patch buffer mapping after application Borislav Petkov
2024-11-25 11:04 ` [tip: x86/urgent] x86/mm: Carve out INVLPG inline asm for use by others tip-bot2 for Borislav Petkov (AMD)
2024-11-25 11:04 ` [tip: x86/urgent] x86/microcode/AMD: Flush patch buffer mapping after application tip-bot2 for Borislav Petkov (AMD)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241119112133.20552-1-bp@kernel.org \
--to=bp@kernel.org \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.de_schampheleire@nokia.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox