Skip to contentSkip to conversation

x86: Add UV memory protection bios call

PATCH In review Russ Anderson 2 participants 3 messages Oct 21, 2008 – Oct 22, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 x86: Add UV memory protection bios call

Add UV bios call to change memory protections.

---
 arch/x86/kernel/bios_uv.c |    8 ++++++++
 include/asm-x86/uv/bios.h |   10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/x86/kernel/bios_uv.c +8 -0
Index: linux/arch/x86/kernel/bios_uv.c
===================================================================
@@ -134,6 +134,14 @@ uv_bios_mq_watchlist_free(int blade, int
 }
 EXPORT_SYMBOL_GPL(uv_bios_mq_watchlist_free);
 
+s64
+uv_bios_change_memprotect(u64 paddr, u64 len, enum uv_memprotect perms)
+{
+	return uv_bios_call_irqsave(UV_BIOS_MEMPROTECT, paddr, len,
+					perms, 0, 0);
+}
+EXPORT_SYMBOL_GPL(uv_bios_change_memprotect);
+
 s64 uv_bios_freq_base(u64 clock_type, u64 *ticks_per_second)
 {
 	return uv_bios_call(UV_BIOS_FREQ_BASE, clock_type,
include/asm-x86/uv/bios.h +9 -1
Index: linux/include/asm-x86/uv/bios.h
===================================================================
@@ -34,7 +34,8 @@ enum uv_bios_cmd {
 	UV_BIOS_GET_SN_INFO,
 	UV_BIOS_FREQ_BASE,
 	UV_BIOS_WATCHLIST_ALLOC,
-	UV_BIOS_WATCHLIST_FREE
+	UV_BIOS_WATCHLIST_FREE,
+	UV_BIOS_MEMPROTECT
 };
 
 /*
@@ -82,6 +83,12 @@ union uv_watchlist_u {
 	};
 };
 
+enum uv_memprotect {
+	UV_MEMPROT_RESTRICT_ACCESS,
+	UV_MEMPROT_ALLOW_AMO,
+	UV_MEMPROT_ALLOW_RW
+};
+
 /*
  * bios calls have 6 parameters
  */
@@ -94,6 +101,7 @@ extern s64 uv_bios_freq_base(u64, u64 *)
 extern int uv_bios_mq_watchlist_alloc(int, void *, unsigned int,
 					unsigned long *);
 extern int uv_bios_mq_watchlist_free(int, int);
+extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
 
 extern void uv_bios_init(void);
 
Signature · 2 lines
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          [email protected]
#1 lore raw
Quoted 9 lines · Russ Anderson

Add UV bios call to change memory protections.

---
 arch/x86/kernel/bios_uv.c |    8 ++++++++
 include/asm-x86/uv/bios.h |   10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

include/asm-x86/uv/bios.h union uv_watchlist_u { · line 89

Quoted 8 lines
include/asm-x86/uv/bios.h +6 -1
-	UV_BIOS_WATCHLIST_FREE
+	UV_BIOS_WATCHLIST_FREE,
+	UV_BIOS_MEMPROTECT
 
+enum uv_memprotect {
+	UV_MEMPROT_RESTRICT_ACCESS,
+	UV_MEMPROT_ALLOW_AMO,
+	UV_MEMPROT_ALLOW_RW

hm, what does this do? Does it twiddle the southbridge to protect given physical RAM rages from the CPU altogether?

Ingo

#2 lore raw
Quoted 16 lines · Ingo Molnar
Quoted 12 lines · Russ Anderson

Add UV bios call to change memory protections.

---
 arch/x86/kernel/bios_uv.c |    8 ++++++++
 include/asm-x86/uv/bios.h |   10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
include/asm-x86/uv/bios.h +2 -1
-	UV_BIOS_WATCHLIST_FREE
+	UV_BIOS_WATCHLIST_FREE,
+	UV_BIOS_MEMPROTECT
Quoted 7 lines

include/asm-x86/uv/bios.h union uv_watchlist_u { · line 89

Quoted 4 lines
include/asm-x86/uv/bios.h +4 -0
+enum uv_memprotect {
+	UV_MEMPROT_RESTRICT_ACCESS,
+	UV_MEMPROT_ALLOW_AMO,
+	UV_MEMPROT_ALLOW_RW

hm, what does this do? Does it twiddle the southbridge to protect given physical RAM rages from the CPU altogether?

The SGI UV hardware has memory protection to control what types of memory references are allowed to specific physical RAM ranges. This bios call is used to change the protection settings.

This is used by the xp driver (drivers/misc/sgi-xp/xp_sn2.c). Dean Nelson submitted a patch yesterday that uses this bios call.

http://marc.info/?l=linux-kernel&m=122462425819289&w=2

Thanks,

Signature · 2 lines
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          [email protected]