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
19#include <linux/uaccess.h>19#include <linux/uaccess.h>
20#include <uapi/linux/isst_if.h>20#include <uapi/linux/isst_if.h>
21 21
22#include <asm/cpu_device_id.h>
23#include <asm/intel-family.h>
24
22#include "isst_if_common.h"25#include "isst_if_common.h"
23 26
24#define MSR_THREAD_ID_INFO 0x5327#define MSR_THREAD_ID_INFO 0x53
28#define MSR_PM_LOGICAL_ID 0x54
25#define MSR_CPU_BUS_NUMBER 0x12829#define MSR_CPU_BUS_NUMBER 0x128
26 30
27static struct isst_if_cmd_cb punit_callbacks[ISST_IF_DEV_MAX];31static struct isst_if_cmd_cb punit_callbacks[ISST_IF_DEV_MAX];
@@ -31,6 +35,7 @@ static int punit_msr_white_list[] = { · 3 unmodified lines
31 MSR_CONFIG_TDP_CONTROL,35 MSR_CONFIG_TDP_CONTROL,
32 MSR_TURBO_RATIO_LIMIT1,36 MSR_TURBO_RATIO_LIMIT1,
33 MSR_TURBO_RATIO_LIMIT2,37 MSR_TURBO_RATIO_LIMIT2,
38 MSR_PM_LOGICAL_ID,
34};39};
35 40
36struct isst_valid_cmd_ranges {41struct isst_valid_cmd_ranges {
@@ -73,6 +78,8 @@ struct isst_cmd { · 36 unmodified lines
73 u32 param;78 u32 param;
74};79};
75 80
81static bool isst_hpm_support;
82
76static DECLARE_HASHTABLE(isst_hash, 8);83static DECLARE_HASHTABLE(isst_hash, 8);
77static DEFINE_MUTEX(isst_hash_lock);84static DEFINE_MUTEX(isst_hash_lock);
78 85
@@ -411,11 +418,20 @@ static int isst_if_cpu_online(unsigned int cpu) · 332 unmodified lines
411 isst_cpu_info[cpu].pci_dev[1] = _isst_if_get_pci_dev(cpu, 1, 30, 1);418 isst_cpu_info[cpu].pci_dev[1] = _isst_if_get_pci_dev(cpu, 1, 30, 1);
412 }419 }
413 420
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
414 ret = rdmsrl_safe(MSR_THREAD_ID_INFO, &data);428 ret = rdmsrl_safe(MSR_THREAD_ID_INFO, &data);
415 if (ret) {429 if (ret) {
416 isst_cpu_info[cpu].punit_cpu_id = -1;430 isst_cpu_info[cpu].punit_cpu_id = -1;
417 return ret;431 return ret;
418 }432 }
433
434set_punit_id:
419 isst_cpu_info[cpu].punit_cpu_id = data;435 isst_cpu_info[cpu].punit_cpu_id = data;
420 436
421 isst_restore_msr_local(cpu);437 isst_restore_msr_local(cpu);
@@ -704,6 +720,12 @@ static struct miscdevice isst_if_char_driver = { · 282 unmodified lines
704 .fops = &isst_if_char_driver_ops,720 .fops = &isst_if_char_driver_ops,
705};721};
706 722
723static 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
707static int isst_misc_reg(void)729static int isst_misc_reg(void)
708{730{
709 mutex_lock(&punit_misc_dev_reg_lock);731 mutex_lock(&punit_misc_dev_reg_lock);
@@ -711,6 +733,12 @@ static int isst_misc_reg(void) · 1 unmodified line
711 goto unlock_exit;733 goto unlock_exit;
712 734
713 if (!misc_usage_count) {735 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
714 misc_device_ret = isst_if_cpu_info_init();742 misc_device_ret = isst_if_cpu_info_init();
715 if (misc_device_ret)743 if (misc_device_ret)
716 goto unlock_exit;744 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