[RFC v4][PATCH part-3 01/14] mm/asi: Define the test ASI type

From: Alexandre Chartre
Date: Mon May 04 2020 - 11:06:34 EST


Define the test ASI type which can be used for testing or experimenting
ASI.

Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
---
arch/x86/include/asm/asi.h | 2 ++
arch/x86/mm/asi.c | 1 +
drivers/staging/Makefile | 1 +
3 files changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/asi.h b/arch/x86/include/asm/asi.h
index eafed750e07f..de4f790c630b 100644
--- a/arch/x86/include/asm/asi.h
+++ b/arch/x86/include/asm/asi.h
@@ -66,6 +66,7 @@ struct asi_tlb_state {
#ifdef CONFIG_PAGE_TABLE_ISOLATION
#define ASI_PCID_PREFIX_USER 0x80 /* user ASI */
#endif
+#define ASI_PCID_PREFIX_TEST 0xff /* test ASI */

struct asi_type {
int pcid_prefix; /* PCID prefix */
@@ -156,6 +157,7 @@ extern int asi_init_dpt(struct dpt *dpt);
#ifdef CONFIG_PAGE_TABLE_ISOLATION
DECLARE_ASI_TYPE(user);
#endif
+DECLARE_ASI_TYPE(test);

static inline void asi_set_log_policy(struct asi *asi, int policy)
{
diff --git a/arch/x86/mm/asi.c b/arch/x86/mm/asi.c
index 8b670ed13729..e0b0d70415d7 100644
--- a/arch/x86/mm/asi.c
+++ b/arch/x86/mm/asi.c
@@ -17,6 +17,7 @@
#ifdef CONFIG_PAGE_TABLE_ISOLATION
DEFINE_ASI_TYPE(user, ASI_PCID_PREFIX_USER, false);
#endif
+DEFINE_ASI_TYPE(test, ASI_PCID_PREFIX_TEST, true);

static void asi_log_fault(struct asi *asi, struct pt_regs *regs,
unsigned long error_code, unsigned long address,
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 4d34198151b3..fb50e669579b 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -50,3 +50,4 @@ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/
obj-$(CONFIG_KPC2000) += kpc2000/
obj-$(CONFIG_QLGE) += qlge/
obj-$(CONFIG_WFX) += wfx/
+obj-$(CONFIG_ADDRESS_SPACE_ISOLATION) += asi/
--
2.18.2