Commit 95f8e569 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Andy Shevchenko

tools/power/x86/intel-speed-select: Kernel interface error handling

Treat a case when mailbox/mmio command can't be handled by the kernel
drivers when the module is removed or send a command which no driver can
handle. In this case ENOTTY result is returned, so print error.

Also when the isst_if_mmio module is removed, we can't send CLOS message
messages via Mailbox on non SKX based platforms. When this module is
removed,  isst_platform_info.mmio_supported is set to 0. So it can't be
used as a condition to send via mailbox. Here replace check for Skylake
based platform to send via mailbox, other platforms can't use mailbox in
lieu of MMIO.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent a9fd6ae7
...@@ -95,6 +95,14 @@ int is_clx_n_platform(void) ...@@ -95,6 +95,14 @@ int is_clx_n_platform(void)
return 0; return 0;
} }
int is_skx_based_platform(void)
{
if (cpu_model == 0x55)
return 1;
return 0;
}
static int update_cpu_model(void) static int update_cpu_model(void)
{ {
unsigned int ebx, ecx, edx; unsigned int ebx, ecx, edx;
...@@ -695,7 +703,11 @@ static int isst_send_mmio_command(unsigned int cpu, unsigned int reg, int write, ...@@ -695,7 +703,11 @@ static int isst_send_mmio_command(unsigned int cpu, unsigned int reg, int write,
} }
if (ioctl(fd, cmd, &io_regs) == -1) { if (ioctl(fd, cmd, &io_regs) == -1) {
perror("ISST_IF_IO_CMD"); if (errno == ENOTTY) {
perror("ISST_IF_IO_COMMAND\n");
fprintf(stderr, "Check presence of kernel modules: isst_if_mmio\n");
exit(0);
}
fprintf(outf, "Error: mmio_cmd cpu:%d reg:%x read_write:%x\n", fprintf(outf, "Error: mmio_cmd cpu:%d reg:%x read_write:%x\n",
cpu, reg, write); cpu, reg, write);
} else { } else {
...@@ -724,7 +736,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command, ...@@ -724,7 +736,7 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
"mbox_send: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n", "mbox_send: cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n",
cpu, command, sub_command, parameter, req_data); cpu, command, sub_command, parameter, req_data);
if (isst_platform_info.mmio_supported && command == CONFIG_CLOS && if (!is_skx_based_platform() && command == CONFIG_CLOS &&
sub_command != CLOS_PM_QOS_CONFIG) { sub_command != CLOS_PM_QOS_CONFIG) {
unsigned int value; unsigned int value;
int write = 0; int write = 0;
...@@ -774,10 +786,14 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command, ...@@ -774,10 +786,14 @@ int isst_send_mbox_command(unsigned int cpu, unsigned char command,
err(-1, "%s open failed", pathname); err(-1, "%s open failed", pathname);
if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) { if (ioctl(fd, ISST_IF_MBOX_COMMAND, &mbox_cmds) == -1) {
perror("ISST_IF_MBOX_COMMAND"); if (errno == ENOTTY) {
fprintf(outf, perror("ISST_IF_MBOX_COMMAND\n");
"Error: mbox_cmd cpu:%d command:%x sub_command:%x parameter:%x req_data:%x\n", fprintf(stderr, "Check presence of kernel modules: isst_if_mbox_pci or isst_if_mbox_msr\n");
cpu, command, sub_command, parameter, req_data); 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);
return -1; return -1;
} else { } else {
*resp = mbox_cmds.mbox_cmd[0].resp_data; *resp = mbox_cmds.mbox_cmd[0].resp_data;
......
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