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

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
Loading
Loading
Loading
Loading
+61 −20
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ struct process_cmd_struct {
	int arg;
};

static const char *version_str = "v1.4";
static const char *version_str = "v1.5";
static const int supported_api_ver = 1;
static struct isst_if_platform_info isst_platform_info;
static char *progname;
@@ -44,6 +44,9 @@ static int force_online_offline;
static int auto_mode;
static int fact_enable_fail;

static int mbox_delay;
static int mbox_retries = 3;

/* clos related */
static int current_clos = -1;
static int clos_epp = -1;
@@ -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)
{
	const char *pathname = "/tmp/isst_cpu_topology.dat";
	const char *pathname = "/var/run/isst_cpu_topology.dat";
	struct cpu_topology cpu_top;
	FILE *fp;
	int ret;
@@ -230,7 +233,7 @@ err_ret:

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;
	int i;

@@ -247,6 +250,8 @@ static void store_cpu_topology(void)
		return;
	}

	fprintf(stderr, "Caching topology information\n");

	for (i = 0; i < topo_max_cpus; ++i) {
		struct cpu_topology cpu_top;

@@ -734,7 +739,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
			   unsigned int req_data, unsigned int *resp)
{
	const char *pathname = "/dev/isst_interface";
	int fd;
	int fd, retry;
	struct isst_if_mbox_cmds mbox_cmds = { 0 };

	debug_printf(
@@ -786,10 +791,16 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
	mbox_cmds.mbox_cmd[0].parameter = parameter;
	mbox_cmds.mbox_cmd[0].req_data = req_data;

	if (mbox_delay)
		usleep(mbox_delay * 1000);

	fd = open(pathname, O_RDWR);
	if (fd < 0)
		err(-1, "%s open failed", pathname);

	retry = mbox_retries;

	do {
		if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) {
			if (errno == ENOTTY) {
				perror("ISST_IF_MBOX_COMMAND\n");
@@ -799,16 +810,23 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
			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);
		return -1;
			--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;
		}
	} while (retry);

	close(fd);

	if (!retry) {
		debug_printf("Failed mbox command even after retries\n");
		return -1;

	}
	return 0;
}

@@ -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");
			ctdp_level.core_cpumask_size =
				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) {
				int i, max_cpus = get_topo_max_cpus();
				for (i = 0; i < max_cpus; ++i) {
@@ -2593,6 +2615,8 @@ static void usage(void)
	printf("\t[-i|--info] : Print platform information\n");
	printf("\t[-o|--out] : Output file\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("\nResult format\n");
@@ -2624,6 +2648,7 @@ static void print_version(void)
static void cmdline(int argc, char **argv)
{
	const char *pathname = "/dev/isst_interface";
	char *ptr;
	FILE *fp;
	int opt;
	int option_index = 0;
@@ -2635,7 +2660,9 @@ static void cmdline(int argc, char **argv)
		{ "format", required_argument, 0, 'f' },
		{ "help", no_argument, 0, 'h' },
		{ "info", no_argument, 0, 'i' },
		{ "pause", required_argument, 0, 'p' },
		{ "out", required_argument, 0, 'o' },
		{ "retry", required_argument, 0, 'r' },
		{ "version", no_argument, 0, 'v' },
		{ 0, 0, 0, 0 }
	};
@@ -2688,6 +2715,20 @@ static void cmdline(int argc, char **argv)
				fclose(outf);
			outf = fopen_or_exit(optarg, "w");
			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':
			print_version();
			break;