mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 00:40:53 +07:00
[PATCH] uml: add skas0 command-line option
This adds the "skas0" parameter to force skas0 operation on SKAS3 host and shows which operating mode has been selected. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
b6b038a24a
commit
cb66504d65
@ -212,12 +212,26 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
|
|||||||
|
|
||||||
static int force_sysemu_disabled = 0;
|
static int force_sysemu_disabled = 0;
|
||||||
|
|
||||||
|
int ptrace_faultinfo = 1;
|
||||||
|
int proc_mm = 1;
|
||||||
|
|
||||||
|
static int __init skas0_cmd_param(char *str, int* add)
|
||||||
|
{
|
||||||
|
ptrace_faultinfo = proc_mm = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int __init nosysemu_cmd_param(char *str, int* add)
|
static int __init nosysemu_cmd_param(char *str, int* add)
|
||||||
{
|
{
|
||||||
force_sysemu_disabled = 1;
|
force_sysemu_disabled = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__uml_setup("skas0", skas0_cmd_param,
|
||||||
|
"skas0\n"
|
||||||
|
" Disables SKAS3 usage, so that SKAS0 is used, unless you \n"
|
||||||
|
" specify mode=tt.\n\n");
|
||||||
|
|
||||||
__uml_setup("nosysemu", nosysemu_cmd_param,
|
__uml_setup("nosysemu", nosysemu_cmd_param,
|
||||||
"nosysemu\n"
|
"nosysemu\n"
|
||||||
" Turns off syscall emulation patch for ptrace (SYSEMU) on.\n"
|
" Turns off syscall emulation patch for ptrace (SYSEMU) on.\n"
|
||||||
@ -359,12 +373,10 @@ void forward_pending_sigio(int target)
|
|||||||
kill(target, SIGIO);
|
kill(target, SIGIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptrace_faultinfo = 0;
|
|
||||||
int proc_mm = 1;
|
|
||||||
|
|
||||||
extern void *__syscall_stub_start, __syscall_stub_end;
|
extern void *__syscall_stub_start, __syscall_stub_end;
|
||||||
|
|
||||||
#ifdef UML_CONFIG_MODE_SKAS
|
#ifdef UML_CONFIG_MODE_SKAS
|
||||||
|
|
||||||
static inline void check_skas3_ptrace_support(void)
|
static inline void check_skas3_ptrace_support(void)
|
||||||
{
|
{
|
||||||
struct ptrace_faultinfo fi;
|
struct ptrace_faultinfo fi;
|
||||||
@ -375,6 +387,7 @@ static inline void check_skas3_ptrace_support(void)
|
|||||||
|
|
||||||
n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
|
n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
|
ptrace_faultinfo = 0;
|
||||||
if(errno == EIO)
|
if(errno == EIO)
|
||||||
printf("not found\n");
|
printf("not found\n");
|
||||||
else {
|
else {
|
||||||
@ -382,7 +395,9 @@ static inline void check_skas3_ptrace_support(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ptrace_faultinfo = 1;
|
if (!ptrace_faultinfo)
|
||||||
|
printf("found but disabled on command line\n");
|
||||||
|
else
|
||||||
printf("found\n");
|
printf("found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,13 +411,13 @@ int can_do_skas(void)
|
|||||||
if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
|
if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
|
||||||
proc_mm = 0;
|
proc_mm = 0;
|
||||||
printf("not found\n");
|
printf("not found\n");
|
||||||
goto out;
|
} else {
|
||||||
}
|
if (!proc_mm)
|
||||||
else {
|
printf("found but disabled on command line\n");
|
||||||
|
else
|
||||||
printf("found\n");
|
printf("found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
check_skas3_ptrace_support();
|
check_skas3_ptrace_support();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
#include "choose-mode.h"
|
#include "choose-mode.h"
|
||||||
#include "mode_kern.h"
|
#include "mode_kern.h"
|
||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
|
#ifdef UML_CONFIG_MODE_SKAS
|
||||||
|
#include "skas.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_COMMAND_LINE "root=98:0"
|
#define DEFAULT_COMMAND_LINE "root=98:0"
|
||||||
|
|
||||||
@ -318,6 +321,7 @@ int linux_main(int argc, char **argv)
|
|||||||
unsigned long avail, diff;
|
unsigned long avail, diff;
|
||||||
unsigned long virtmem_size, max_physmem;
|
unsigned long virtmem_size, max_physmem;
|
||||||
unsigned int i, add;
|
unsigned int i, add;
|
||||||
|
char * mode;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++){
|
for (i = 1; i < argc; i++){
|
||||||
if((i == 1) && (argv[i][0] == ' ')) continue;
|
if((i == 1) && (argv[i][0] == ' ')) continue;
|
||||||
@ -338,6 +342,21 @@ int linux_main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_MODE_SKAS
|
||||||
|
mode = "TT";
|
||||||
|
#else
|
||||||
|
/* Show to the user the result of selection */
|
||||||
|
if (mode_tt)
|
||||||
|
mode = "TT";
|
||||||
|
else if (proc_mm && ptrace_faultinfo)
|
||||||
|
mode = "SKAS3";
|
||||||
|
else
|
||||||
|
mode = "SKAS0";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("UML running in %s mode\n", mode);
|
||||||
|
|
||||||
uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
|
uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
|
||||||
&host_task_size, &task_size);
|
&host_task_size, &task_size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user