History

platform/x86: ISST: Add support for MSR 0x54

To map Linux CPU numbering scheme to hardware CPU numbering scheme MSR 0x53 is getting used. But for new generation of CPUs, this MSR is not valid. Since this is model specific MSR, this is possible. A new MSR 0x54 is defined for this purpose. User space can use the API version to distinguish format from MSR 0x53. Intel speed select utility is updated to use the new format based on the API version.

Srinivas Pandruvada committed 3 years ago

Commit e6d34181 parent 3ed0b881 file · +28 −0Browse files

Unified · Split

drivers/platform/x86/intel/speed_select_if/isst_if_common.c+28−0
@@ -19,9 +19,13 @@ · 18 unmodified lines
1919 #include <linux/uaccess.h>
2020 #include <uapi/linux/isst_if.h>
2121
22+#include <asm/cpu_device_id.h>
23+#include <asm/intel-family.h>
24+
2225 #include "isst_if_common.h"
2326
2427 #define MSR_THREAD_ID_INFO 0x53
28+#define MSR_PM_LOGICAL_ID 0x54
2529 #define MSR_CPU_BUS_NUMBER 0x128
2630
2731 static struct isst_if_cmd_cb punit_callbacks[ISST_IF_DEV_MAX];
@@ -31,6 +35,7 @@ static int punit_msr_white_list[] = { · 3 unmodified lines
3135 MSR_CONFIG_TDP_CONTROL,
3236 MSR_TURBO_RATIO_LIMIT1,
3337 MSR_TURBO_RATIO_LIMIT2,
38+ MSR_PM_LOGICAL_ID,
3439 };
3540
3641 struct isst_valid_cmd_ranges {
@@ -73,6 +78,8 @@ struct isst_cmd { · 36 unmodified lines
7378 u32 param;
7479 };
7580
81+static bool isst_hpm_support;
82+
7683 static DECLARE_HASHTABLE(isst_hash, 8);
7784 static DEFINE_MUTEX(isst_hash_lock);
7885
@@ -411,11 +418,20 @@ static int isst_if_cpu_online(unsigned int cpu) · 332 unmodified lines
411418 isst_cpu_info[cpu].pci_dev[1] = _isst_if_get_pci_dev(cpu, 1, 30, 1);
412419 }
413420
421+ if (isst_hpm_support) {
422+
423+ ret = rdmsrl_safe(MSR_PM_LOGICAL_ID, &data);
424+ if (!ret)
425+ goto set_punit_id;
426+ }
427+
414428 ret = rdmsrl_safe(MSR_THREAD_ID_INFO, &data);
415429 if (ret) {
416430 isst_cpu_info[cpu].punit_cpu_id = -1;
417431 return ret;
418432 }
433+
434+set_punit_id:
419435 isst_cpu_info[cpu].punit_cpu_id = data;
420436
421437 isst_restore_msr_local(cpu);
@@ -704,6 +720,12 @@ static struct miscdevice isst_if_char_driver = { · 282 unmodified lines
704720 .fops = &isst_if_char_driver_ops,
705721 };
706722
723+static const struct x86_cpu_id hpm_cpu_ids[] = {
724+ X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X, NULL),
725+ X86_MATCH_INTEL_FAM6_MODEL(SIERRAFOREST_X, NULL),
726+ {}
727+};
728+
707729 static int isst_misc_reg(void)
708730 {
709731 mutex_lock(&punit_misc_dev_reg_lock);
@@ -711,6 +733,12 @@ static int isst_misc_reg(void) · 1 unmodified line
711733 goto unlock_exit;
712734
713735 if (!misc_usage_count) {
736+ const struct x86_cpu_id *id;
737+
738+ id = x86_match_cpu(hpm_cpu_ids);
739+ if (id)
740+ isst_hpm_support = true;
741+
714742 misc_device_ret = isst_if_cpu_info_init();
715743 if (misc_device_ret)
716744 goto unlock_exit;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t