lkml.org 
[lkml]   [2019]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v2 09/26] mm/asi: Helper functions to map module into ASI
Date
Add helper functions to easily map a module into an ASI.

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.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
\
 
 \ /
  Last update: 2019-07-11 16:30    [W:0.118 / U:1.096 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site