Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120973
b: refs/heads/master
c: 6c1c325
h: refs/heads/master
i:
  120971: 850e55b
v: v3
  • Loading branch information
Dean Nelson authored and H. Peter Anvin committed Nov 6, 2008
1 parent fc79768 commit ac98b3c
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 23c357003b3671cdfb17bc4d5383589e74b71511
refs/heads/master: 6c1c325de908cbc444cf284f59c3a892161012e9
7 changes: 5 additions & 2 deletions trunk/drivers/misc/sgi-xp/xp.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ enum xp_retval {
xpGruSendMqError, /* 59: gru send message queue related error */

xpBadChannelNumber, /* 60: invalid channel number */
xpBadMsgType, /* 60: invalid message type */
xpBadMsgType, /* 61: invalid message type */
xpBiosError, /* 62: BIOS error */

xpUnknownReason /* 61: unknown reason - must be last in enum */
xpUnknownReason /* 63: unknown reason - must be last in enum */
};

/*
Expand Down Expand Up @@ -341,6 +342,8 @@ extern unsigned long (*xp_pa) (void *);
extern enum xp_retval (*xp_remote_memcpy) (unsigned long, const unsigned long,
size_t);
extern int (*xp_cpu_to_nasid) (int);
extern enum xp_retval (*xp_expand_memprotect) (unsigned long, unsigned long);
extern enum xp_retval (*xp_restrict_memprotect) (unsigned long, unsigned long);

extern u64 xp_nofault_PIOR_target;
extern int xp_nofault_PIOR(void *);
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/misc/sgi-xp/xp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ EXPORT_SYMBOL_GPL(xp_remote_memcpy);
int (*xp_cpu_to_nasid) (int cpuid);
EXPORT_SYMBOL_GPL(xp_cpu_to_nasid);

enum xp_retval (*xp_expand_memprotect) (unsigned long phys_addr,
unsigned long size);
EXPORT_SYMBOL_GPL(xp_expand_memprotect);
enum xp_retval (*xp_restrict_memprotect) (unsigned long phys_addr,
unsigned long size);
EXPORT_SYMBOL_GPL(xp_restrict_memprotect);

/*
* xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
* users of XPC.
Expand Down
34 changes: 34 additions & 0 deletions trunk/drivers/misc/sgi-xp/xp_sn2.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,38 @@ xp_cpu_to_nasid_sn2(int cpuid)
return cpuid_to_nasid(cpuid);
}

static enum xp_retval
xp_expand_memprotect_sn2(unsigned long phys_addr, unsigned long size)
{
u64 nasid_array = 0;
int ret;

ret = sn_change_memprotect(phys_addr, size, SN_MEMPROT_ACCESS_CLASS_1,
&nasid_array);
if (ret != 0) {
dev_err(xp, "sn_change_memprotect(,, "
"SN_MEMPROT_ACCESS_CLASS_1,) failed ret=%d\n", ret);
return xpSalError;
}
return xpSuccess;
}

static enum xp_retval
xp_restrict_memprotect_sn2(unsigned long phys_addr, unsigned long size)
{
u64 nasid_array = 0;
int ret;

ret = sn_change_memprotect(phys_addr, size, SN_MEMPROT_ACCESS_CLASS_0,
&nasid_array);
if (ret != 0) {
dev_err(xp, "sn_change_memprotect(,, "
"SN_MEMPROT_ACCESS_CLASS_0,) failed ret=%d\n", ret);
return xpSalError;
}
return xpSuccess;
}

enum xp_retval
xp_init_sn2(void)
{
Expand All @@ -132,6 +164,8 @@ xp_init_sn2(void)
xp_pa = xp_pa_sn2;
xp_remote_memcpy = xp_remote_memcpy_sn2;
xp_cpu_to_nasid = xp_cpu_to_nasid_sn2;
xp_expand_memprotect = xp_expand_memprotect_sn2;
xp_restrict_memprotect = xp_restrict_memprotect_sn2;

return xp_register_nofault_code_sn2();
}
Expand Down
66 changes: 66 additions & 0 deletions trunk/drivers/misc/sgi-xp/xp_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@

#include <linux/device.h>
#include <asm/uv/uv_hub.h>
#if defined CONFIG_X86_64
#include <asm/uv/bios.h>
#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
#include <asm/sn/sn_sal.h>
#endif
#include "../sgi-gru/grukservices.h"
#include "xp.h"

Expand Down Expand Up @@ -49,6 +54,65 @@ xp_cpu_to_nasid_uv(int cpuid)
return UV_PNODE_TO_NASID(uv_cpu_to_pnode(cpuid));
}

static enum xp_retval
xp_expand_memprotect_uv(unsigned long phys_addr, unsigned long size)
{
int ret;

#if defined CONFIG_X86_64
ret = uv_bios_change_memprotect(phys_addr, size, UV_MEMPROT_ALLOW_RW);
if (ret != BIOS_STATUS_SUCCESS) {
dev_err(xp, "uv_bios_change_memprotect(,, "
"UV_MEMPROT_ALLOW_RW) failed, ret=%d\n", ret);
return xpBiosError;
}

#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
u64 nasid_array;

ret = sn_change_memprotect(phys_addr, size, SN_MEMPROT_ACCESS_CLASS_1,
&nasid_array);
if (ret != 0) {
dev_err(xp, "sn_change_memprotect(,, "
"SN_MEMPROT_ACCESS_CLASS_1,) failed ret=%d\n", ret);
return xpSalError;
}
#else
#error not a supported configuration
#endif
return xpSuccess;
}

static enum xp_retval
xp_restrict_memprotect_uv(unsigned long phys_addr, unsigned long size)
{
int ret;

#if defined CONFIG_X86_64
ret = uv_bios_change_memprotect(phys_addr, size,
UV_MEMPROT_RESTRICT_ACCESS);
if (ret != BIOS_STATUS_SUCCESS) {
dev_err(xp, "uv_bios_change_memprotect(,, "
"UV_MEMPROT_RESTRICT_ACCESS) failed, ret=%d\n", ret);
return xpBiosError;
}

#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
u64 nasid_array;

ret = sn_change_memprotect(phys_addr, size, SN_MEMPROT_ACCESS_CLASS_0,
&nasid_array);
if (ret != 0) {
dev_err(xp, "sn_change_memprotect(,, "
"SN_MEMPROT_ACCESS_CLASS_0,) failed ret=%d\n", ret);
return xpSalError;
}
#else
#error not a supported configuration
#endif
return xpSuccess;
}

enum xp_retval
xp_init_uv(void)
{
Expand All @@ -61,6 +125,8 @@ xp_init_uv(void)
xp_pa = xp_pa_uv;
xp_remote_memcpy = xp_remote_memcpy_uv;
xp_cpu_to_nasid = xp_cpu_to_nasid_uv;
xp_expand_memprotect = xp_expand_memprotect_uv;
xp_restrict_memprotect = xp_restrict_memprotect_uv;

return xpSuccess;
}
Expand Down
15 changes: 5 additions & 10 deletions trunk/drivers/misc/sgi-xp/xpc_sn2.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,22 +553,17 @@ static u64 xpc_prot_vec_sn2[MAX_NUMNODES];
static enum xp_retval
xpc_allow_amo_ops_sn2(struct amo *amos_page)
{
u64 nasid_array = 0;
int ret;
enum xp_retval ret = xpSuccess;

/*
* On SHUB 1.1, we cannot call sn_change_memprotect() since the BIST
* collides with memory operations. On those systems we call
* xpc_allow_amo_ops_shub_wars_1_1_sn2() instead.
*/
if (!enable_shub_wars_1_1()) {
ret = sn_change_memprotect(ia64_tpa((u64)amos_page), PAGE_SIZE,
SN_MEMPROT_ACCESS_CLASS_1,
&nasid_array);
if (ret != 0)
return xpSalError;
}
return xpSuccess;
if (!enable_shub_wars_1_1())
ret = xp_expand_memprotect(ia64_tpa((u64)amos_page), PAGE_SIZE);

return ret;
}

/*
Expand Down

0 comments on commit ac98b3c

Please sign in to comment.