summaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-04-08 17:27:42 +0200
committerBorislav Petkov <bp@suse.de>2020-04-20 12:39:11 +0200
commit1f6f655e01adebf5bd5e6c3da2e843c104ded051 (patch)
tree8c382295cdeffe4367294800b384bb99beea9e22 /arch/x86/mm/init.c
parentae83d0b416db002fe95601e7f97f64b59514d936 (diff)
downloadlinux-1f6f655e01adebf5bd5e6c3da2e843c104ded051.tar.gz
linux-1f6f655e01adebf5bd5e6c3da2e843c104ded051.tar.bz2
linux-1f6f655e01adebf5bd5e6c3da2e843c104ded051.zip
x86/mm: Add a x86_has_pat_wp() helper
Abstract the ioremap code away from the caching mode internals. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200408152745.1565832-2-hch@lst.de
Diffstat (limited to 'arch/x86/mm/init.c')
-rw-r--r--arch/x86/mm/init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 1bba16c5742b..6005f83b8111 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -71,6 +71,12 @@ uint8_t __pte2cachemode_tbl[8] = {
};
EXPORT_SYMBOL(__pte2cachemode_tbl);
+/* Check that the write-protect PAT entry is set for write-protect */
+bool x86_has_pat_wp(void)
+{
+ return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
+}
+
static unsigned long __initdata pgt_buf_start;
static unsigned long __initdata pgt_buf_end;
static unsigned long __initdata pgt_buf_top;