Commit 69ce97f2 authored by Andy Shevchenko's avatar Andy Shevchenko

Merge branch 'for-next'

Merge branch 'for-next' of
https://github.com/spandruvada/linux-kernel.git
to update Intel SST tools.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parents 78d15eea f65e1311
...@@ -15,7 +15,7 @@ struct process_cmd_struct { ...@@ -15,7 +15,7 @@ struct process_cmd_struct {
int arg; int arg;
}; };
static const char *version_str = "v1.4"; static const char *version_str = "v1.5";
static const int supported_api_ver = 1; static const int supported_api_ver = 1;
static struct isst_if_platform_info isst_platform_info; static struct isst_if_platform_info isst_platform_info;
static char *progname; static char *progname;
...@@ -44,6 +44,9 @@ static int force_online_offline; ...@@ -44,6 +44,9 @@ static int force_online_offline;
static int auto_mode; static int auto_mode;
static int fact_enable_fail; static int fact_enable_fail;
static int mbox_delay;
static int mbox_retries = 3;
/* clos related */ /* clos related */
static int current_clos = -1; static int current_clos = -1;
static int clos_epp = -1; static int clos_epp = -1;
...@@ -198,7 +201,7 @@ int out_format_is_json(void) ...@@ -198,7 +201,7 @@ int out_format_is_json(void)
static int get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die_id) static int get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die_id)
{ {
const char *pathname = "/tmp/isst_cpu_topology.dat"; const char *pathname = "/var/run/isst_cpu_topology.dat";
struct cpu_topology cpu_top; struct cpu_topology cpu_top;
FILE *fp; FILE *fp;
int ret; int ret;
...@@ -230,7 +233,7 @@ static int get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die ...@@ -230,7 +233,7 @@ static int get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die
static void store_cpu_topology(void) static void store_cpu_topology(void)
{ {
const char *pathname = "/tmp/isst_cpu_topology.dat"; const char *pathname = "/var/run/isst_cpu_topology.dat";
FILE *fp; FILE *fp;
int i; int i;
...@@ -247,6 +250,8 @@ static void store_cpu_topology(void) ...@@ -247,6 +250,8 @@ static void store_cpu_topology(void)
return; return;
} }
fprintf(stderr, "Caching topology information\n");
for (i = 0; i < topo_max_cpus; ++i) { for (i = 0; i < topo_max_cpus; ++i) {
struct cpu_topology cpu_top; struct cpu_topology cpu_top;
...@@ -734,7 +739,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command, ...@@ -734,7 +739,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
unsigned int req_data, unsigned int *resp) unsigned int req_data, unsigned int *resp)
{ {
const char *pathname = "/dev/isst_interface"; const char *pathname = "/dev/isst_interface";
int fd; int fd, retry;
struct isst_if_mbox_cmds mbox_cmds = { 0 }; struct isst_if_mbox_cmds mbox_cmds = { 0 };
debug_printf( debug_printf(
...@@ -786,29 +791,42 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command, ...@@ -786,29 +791,42 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
mbox_cmds.mbox_cmd[0].parameter = parameter; mbox_cmds.mbox_cmd[0].parameter = parameter;
mbox_cmds.mbox_cmd[0].req_data = req_data; mbox_cmds.mbox_cmd[0].req_data = req_data;
if (mbox_delay)
usleep(mbox_delay * 1000);
fd = open(pathname, O_RDWR); fd = open(pathname, O_RDWR);
if (fd < 0) if (fd < 0)
err(-1, "%s open failed", pathname); err(-1, "%s open failed", pathname);
if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) { retry = mbox_retries;
if (errno == ENOTTY) {
perror("ISST_IF_MBOX_COMMAND\n"); do {
fprintf(stderr, "Check presence of kernel modules: isst_if_mbox_pci or isst_if_mbox_msr\n"); if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) {
exit(0); if (errno == ENOTTY) {
perror("ISST_IF_MBOX_COMMAND\n");
fprintf(stderr, "Check presence of kernel modules: isst_if_mbox_pci or isst_if_mbox_msr\n");
exit(0);
}
debug_printf(
"Error: mbox_cmd cpu:%d command:%x sub_command:%x parameter:%x req_data:%x errorno:%d\n",
cpu, command, sub_command, parameter, req_data, errno);
--retry;
} else {
*resp = mbox_cmds.mbox_cmd[0].resp_data;
debug_printf(
"mbox_cmd response: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x resp:%x\n",
cpu, command, sub_command, parameter, req_data, *resp);
break;
} }
debug_printf( } while (retry);
"Error: mbox_cmd cpu:%d command:%x sub_command:%x parameter:%x req_data:%x errorno:%d\n",
cpu, command, sub_command, parameter, req_data, errno);
return -1;
} else {
*resp = mbox_cmds.mbox_cmd[0].resp_data;
debug_printf(
"mbox_cmd response: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x resp:%x\n",
cpu, command, sub_command, parameter, req_data, *resp);
}
close(fd); close(fd);
if (!retry) {
debug_printf("Failed mbox command even after retries\n");
return -1;
}
return 0; return 0;
} }
...@@ -1245,7 +1263,11 @@ static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3, ...@@ -1245,7 +1263,11 @@ static void set_tdp_level_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
fprintf(stderr, "Option is set to online/offline\n"); fprintf(stderr, "Option is set to online/offline\n");
ctdp_level.core_cpumask_size = ctdp_level.core_cpumask_size =
alloc_cpu_set(&ctdp_level.core_cpumask); alloc_cpu_set(&ctdp_level.core_cpumask);
isst_get_coremask_info(cpu, tdp_level, &ctdp_level); ret = isst_get_coremask_info(cpu, tdp_level, &ctdp_level);
if (ret) {
isst_display_error_info_message(1, "Can't get coremask, online/offline option is ignored", 0, 0);
return;
}
if (ctdp_level.cpu_count) { if (ctdp_level.cpu_count) {
int i, max_cpus = get_topo_max_cpus(); int i, max_cpus = get_topo_max_cpus();
for (i = 0; i < max_cpus; ++i) { for (i = 0; i < max_cpus; ++i) {
...@@ -2593,6 +2615,8 @@ static void usage(void) ...@@ -2593,6 +2615,8 @@ static void usage(void)
printf("\t[-i|--info] : Print platform information\n"); printf("\t[-i|--info] : Print platform information\n");
printf("\t[-o|--out] : Output file\n"); printf("\t[-o|--out] : Output file\n");
printf("\t\t\tDefault : stderr\n"); printf("\t\t\tDefault : stderr\n");
printf("\t[-p|--pause] : Delay between two mail box commands in milliseconds\n");
printf("\t[-r|--retry] : Retry count for mail box commands on failure, default 3\n");
printf("\t[-v|--version] : Print version\n"); printf("\t[-v|--version] : Print version\n");
printf("\nResult format\n"); printf("\nResult format\n");
...@@ -2624,6 +2648,7 @@ static void print_version(void) ...@@ -2624,6 +2648,7 @@ static void print_version(void)
static void cmdline(int argc, char **argv) static void cmdline(int argc, char **argv)
{ {
const char *pathname = "/dev/isst_interface"; const char *pathname = "/dev/isst_interface";
char *ptr;
FILE *fp; FILE *fp;
int opt; int opt;
int option_index = 0; int option_index = 0;
...@@ -2635,7 +2660,9 @@ static void cmdline(int argc, char **argv) ...@@ -2635,7 +2660,9 @@ static void cmdline(int argc, char **argv)
{ "format", required_argument, 0, 'f' }, { "format", required_argument, 0, 'f' },
{ "help", no_argument, 0, 'h' }, { "help", no_argument, 0, 'h' },
{ "info", no_argument, 0, 'i' }, { "info", no_argument, 0, 'i' },
{ "pause", required_argument, 0, 'p' },
{ "out", required_argument, 0, 'o' }, { "out", required_argument, 0, 'o' },
{ "retry", required_argument, 0, 'r' },
{ "version", no_argument, 0, 'v' }, { "version", no_argument, 0, 'v' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
...@@ -2688,6 +2715,20 @@ static void cmdline(int argc, char **argv) ...@@ -2688,6 +2715,20 @@ static void cmdline(int argc, char **argv)
fclose(outf); fclose(outf);
outf = fopen_or_exit(optarg, "w"); outf = fopen_or_exit(optarg, "w");
break; break;
case 'p':
ret = strtol(optarg, &ptr, 10);
if (!ret)
fprintf(stderr, "Invalid pause interval, ignore\n");
else
mbox_delay = ret;
break;
case 'r':
ret = strtol(optarg, &ptr, 10);
if (!ret)
fprintf(stderr, "Invalid retry count, ignore\n");
else
mbox_retries = ret;
break;
case 'v': case 'v':
print_version(); print_version();
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment