Commit f362cdcc authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Andy Shevchenko

tools/power/x86/intel-speed-select: Helpful warning for missing kernel interface

When the device file "/dev/isst_interface" is not present, instead of
failing on access, check at the start and print a helpful warning.

Here CLX platform is an exception, which doesn't depend on the device
file. So continue for CLX platform.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent fb186158
......@@ -2408,6 +2408,8 @@ static void print_version(void)
static void cmdline(int argc, char **argv)
{
const char *pathname = "/dev/isst_interface";
FILE *fp;
int opt;
int option_index = 0;
int ret;
......@@ -2423,6 +2425,28 @@ static void cmdline(int argc, char **argv)
{ 0, 0, 0, 0 }
};
if (geteuid() != 0) {
fprintf(stderr, "Must run as root\n");
exit(0);
}
ret = update_cpu_model();
if (ret)
err(-1, "Invalid CPU model (%d)\n", cpu_model);
printf("Intel(R) Speed Select Technology\n");
printf("Executing on CPU model:%d[0x%x]\n", cpu_model, cpu_model);
if (!is_clx_n_platform()) {
fp = fopen(pathname, "rb");
if (!fp) {
fprintf(stderr, "Intel speed select drivers are not loaded on this system.\n");
fprintf(stderr, "Verify that kernel config includes CONFIG_INTEL_SPEED_SELECT_INTERFACE.\n");
fprintf(stderr, "If the config is included then this is not a supported platform.\n");
exit(0);
}
fclose(fp);
}
progname = argv[0];
while ((opt = getopt_long_only(argc, argv, "+c:df:hio:v", long_options,
&option_index)) != -1) {
......@@ -2457,20 +2481,10 @@ static void cmdline(int argc, char **argv)
}
}
if (geteuid() != 0) {
fprintf(stderr, "Must run as root\n");
exit(0);
}
if (optind > (argc - 2)) {
fprintf(stderr, "Feature name and|or command not specified\n");
exit(0);
}
ret = update_cpu_model();
if (ret)
err(-1, "Invalid CPU model (%d)\n", cpu_model);
printf("Intel(R) Speed Select Technology\n");
printf("Executing on CPU model:%d[0x%x]\n", cpu_model, cpu_model);
set_max_cpu_num();
store_cpu_topology();
set_cpu_present_cpu_mask();
......
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