[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1562855138-19507-10-git-send-email-alexandre.chartre@oracle.com>
Date: Thu, 11 Jul 2019 16:25:21 +0200
From: Alexandre Chartre <alexandre.chartre@...cle.com>
To: pbonzini@...hat.com, rkrcmar@...hat.com, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, hpa@...or.com,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
kvm@...r.kernel.org, x86@...nel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: konrad.wilk@...cle.com, jan.setjeeilers@...cle.com,
liran.alon@...cle.com, jwadams@...gle.com, graf@...zon.de,
rppt@...ux.vnet.ibm.com, alexandre.chartre@...cle.com
Subject: [RFC v2 09/26] mm/asi: Helper functions to map module into ASI
Add helper functions to easily map a module into an ASI.
Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
---
arch/x86/include/asm/asi.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/asi.h b/arch/x86/include/asm/asi.h
index 19656aa..b5dbc49 100644
--- a/arch/x86/include/asm/asi.h
+++ b/arch/x86/include/asm/asi.h
@@ -6,6 +6,7 @@
#ifndef __ASSEMBLY__
+#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/pgtable.h>
#include <linux/xarray.h>
@@ -81,6 +82,26 @@ extern int asi_map_range(struct asi *asi, void *ptr, size_t size,
extern int asi_map(struct asi *asi, void *ptr, unsigned long size);
/*
+ * Copy the memory mapping for the current module. This is defined as a
+ * macro to ensure it is expanded in the module making the call so that
+ * THIS_MODULE has the correct value.
+ */
+#define ASI_MAP_THIS_MODULE(asi) \
+ (asi_map(asi, THIS_MODULE->core_layout.base, \
+ THIS_MODULE->core_layout.size))
+
+static inline int asi_map_module(struct asi *asi, char *module_name)
+{
+ struct module *module;
+
+ module = find_module(module_name);
+ if (!module)
+ return -ESRCH;
+
+ return asi_map(asi, module->core_layout.base, module->core_layout.size);
+}
+
+/*
* Function to exit the current isolation. This is used to abort isolation
* when a task using isolation is scheduled out.
*/
--
1.7.1
Powered by blists - more mailing lists