Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86/intel-uncore-freq: Add efficiency latency control to sysfs interface

Add the TPMI efficiency latency control fields to the sysfs interface.
The sysfs files are mapped to the TPMI uncore driver via the registered
uncore_read and uncore_write driver callbacks. These fields are not
populated on older non TPMI hardware.

Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240828153657.1296410-4-tero.kristo@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Tero Kristo and committed by
Hans de Goede
24b66163 bb516dc7

+49 -6
+37 -5
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
··· 60 60 static ssize_t store_attr(struct uncore_data *data, const char *buf, ssize_t count, 61 61 enum uncore_index index) 62 62 { 63 - unsigned int input; 63 + unsigned int input = 0; 64 64 int ret; 65 65 66 - if (kstrtouint(buf, 10, &input)) 67 - return -EINVAL; 66 + if (index == UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE) { 67 + if (kstrtobool(buf, (bool *)&input)) 68 + return -EINVAL; 69 + } else { 70 + if (kstrtouint(buf, 10, &input)) 71 + return -EINVAL; 72 + } 68 73 69 74 mutex_lock(&uncore_lock); 70 75 ret = uncore_write(data, input, index); ··· 107 102 show_uncore_attr(max_freq_khz, UNCORE_INDEX_MAX_FREQ); 108 103 109 104 show_uncore_attr(current_freq_khz, UNCORE_INDEX_CURRENT_FREQ); 105 + 106 + store_uncore_attr(elc_low_threshold_percent, UNCORE_INDEX_EFF_LAT_CTRL_LOW_THRESHOLD); 107 + store_uncore_attr(elc_high_threshold_percent, UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD); 108 + store_uncore_attr(elc_high_threshold_enable, 109 + UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE); 110 + store_uncore_attr(elc_floor_freq_khz, UNCORE_INDEX_EFF_LAT_CTRL_FREQ); 111 + 112 + show_uncore_attr(elc_low_threshold_percent, UNCORE_INDEX_EFF_LAT_CTRL_LOW_THRESHOLD); 113 + show_uncore_attr(elc_high_threshold_percent, UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD); 114 + show_uncore_attr(elc_high_threshold_enable, 115 + UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE); 116 + show_uncore_attr(elc_floor_freq_khz, UNCORE_INDEX_EFF_LAT_CTRL_FREQ); 110 117 111 118 #define show_uncore_data(member_name) \ 112 119 static ssize_t show_##member_name(struct kobject *kobj, \ ··· 163 146 164 147 static int create_attr_group(struct uncore_data *data, char *name) 165 148 { 166 - int ret, freq, index = 0; 149 + int ret, index = 0; 150 + unsigned int val; 167 151 168 152 init_attribute_rw(max_freq_khz); 169 153 init_attribute_rw(min_freq_khz); ··· 186 168 data->uncore_attrs[index++] = &data->initial_min_freq_khz_kobj_attr.attr; 187 169 data->uncore_attrs[index++] = &data->initial_max_freq_khz_kobj_attr.attr; 188 170 189 - ret = uncore_read(data, &freq, UNCORE_INDEX_CURRENT_FREQ); 171 + ret = uncore_read(data, &val, UNCORE_INDEX_CURRENT_FREQ); 190 172 if (!ret) 191 173 data->uncore_attrs[index++] = &data->current_freq_khz_kobj_attr.attr; 174 + 175 + ret = uncore_read(data, &val, UNCORE_INDEX_EFF_LAT_CTRL_LOW_THRESHOLD); 176 + if (!ret) { 177 + init_attribute_rw(elc_low_threshold_percent); 178 + init_attribute_rw(elc_high_threshold_percent); 179 + init_attribute_rw(elc_high_threshold_enable); 180 + init_attribute_rw(elc_floor_freq_khz); 181 + 182 + data->uncore_attrs[index++] = &data->elc_low_threshold_percent_kobj_attr.attr; 183 + data->uncore_attrs[index++] = &data->elc_high_threshold_percent_kobj_attr.attr; 184 + data->uncore_attrs[index++] = 185 + &data->elc_high_threshold_enable_kobj_attr.attr; 186 + data->uncore_attrs[index++] = &data->elc_floor_freq_khz_kobj_attr.attr; 187 + } 192 188 193 189 data->uncore_attrs[index] = NULL; 194 190
+12 -1
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h
··· 34 34 * @domain_id_kobj_attr: Storage for kobject attribute domain_id 35 35 * @fabric_cluster_id_kobj_attr: Storage for kobject attribute fabric_cluster_id 36 36 * @package_id_kobj_attr: Storage for kobject attribute package_id 37 + * @elc_low_threshold_percent_kobj_attr: 38 + Storage for kobject attribute elc_low_threshold_percent 39 + * @elc_high_threshold_percent_kobj_attr: 40 + Storage for kobject attribute elc_high_threshold_percent 41 + * @elc_high_threshold_enable_kobj_attr: 42 + Storage for kobject attribute elc_high_threshold_enable 43 + * @elc_floor_freq_khz_kobj_attr: Storage for kobject attribute elc_floor_freq_khz 37 44 * @uncore_attrs: Attribute storage for group creation 38 45 * 39 46 * This structure is used to encapsulate all data related to uncore sysfs ··· 68 61 struct kobj_attribute domain_id_kobj_attr; 69 62 struct kobj_attribute fabric_cluster_id_kobj_attr; 70 63 struct kobj_attribute package_id_kobj_attr; 71 - struct attribute *uncore_attrs[9]; 64 + struct kobj_attribute elc_low_threshold_percent_kobj_attr; 65 + struct kobj_attribute elc_high_threshold_percent_kobj_attr; 66 + struct kobj_attribute elc_high_threshold_enable_kobj_attr; 67 + struct kobj_attribute elc_floor_freq_khz_kobj_attr; 68 + struct attribute *uncore_attrs[13]; 72 69 }; 73 70 74 71 #define UNCORE_DOMAIN_ID_INVALID -1