[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211026142058.17702-6-jiangshanlai@gmail.com>
Date: Tue, 26 Oct 2021 22:20:18 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Lai Jiangshan <laijs@...ux.alibaba.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>
Subject: [PATCH V4 10/50] x86: Replace PTI_PGTABLE_SWITCH_BIT with PTI_USER_PGTABLE_BIT
From: Lai Jiangshan <laijs@...ux.alibaba.com>
They are the same in meaning and value.
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
arch/x86/include/asm/pgtable.h | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 65542106464b..c8909457574a 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -5,6 +5,7 @@
#include <linux/mem_encrypt.h>
#include <asm/page.h>
#include <asm/pgtable_types.h>
+#include <asm/processor-flags.h>
/*
* Macro to mark a page protection value as UC-
@@ -1164,14 +1165,6 @@ static inline bool pgdp_maps_userspace(void *__ptr)
static inline int pgd_large(pgd_t pgd) { return 0; }
#ifdef CONFIG_PAGE_TABLE_ISOLATION
-/*
- * All top-level PAGE_TABLE_ISOLATION page tables are order-1 pages
- * (8k-aligned and 8k in size). The kernel one is at the beginning 4k and
- * the user one is in the last 4k. To switch between them, you
- * just need to flip the 12th bit in their addresses.
- */
-#define PTI_PGTABLE_SWITCH_BIT PAGE_SHIFT
-
/*
* This generates better code than the inline assembly in
* __set_bit().
@@ -1193,12 +1186,12 @@ static inline void *ptr_clear_bit(void *ptr, int bit)
static inline pgd_t *kernel_to_user_pgdp(pgd_t *pgdp)
{
- return ptr_set_bit(pgdp, PTI_PGTABLE_SWITCH_BIT);
+ return ptr_set_bit(pgdp, PTI_USER_PGTABLE_BIT);
}
static inline pgd_t *user_to_kernel_pgdp(pgd_t *pgdp)
{
- return ptr_clear_bit(pgdp, PTI_PGTABLE_SWITCH_BIT);
+ return ptr_clear_bit(pgdp, PTI_USER_PGTABLE_BIT);
}
#endif /* CONFIG_PAGE_TABLE_ISOLATION */
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists