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

platform/x86/intel-uncore-freq: Process read/write blocked feature status

When a feature is read blocked, don't continue to read uncore information
and register with uncore core.

When the feature is write blocked, continue to offer read interface but
block setting uncore limits.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231204221740.3645130-6-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Srinivas Pandruvada and committed by
Hans de Goede
b06458d1 8bed9ff7

+15
+15
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c
··· 66 66 int min_ratio; 67 67 struct tpmi_uncore_power_domain_info *pd_info; 68 68 struct tpmi_uncore_cluster_info root_cluster; 69 + bool write_blocked; 69 70 }; 70 71 71 72 #define UNCORE_GENMASK_MIN_RATIO GENMASK_ULL(21, 15) ··· 158 157 cluster_info = container_of(data, struct tpmi_uncore_cluster_info, uncore_data); 159 158 uncore_root = cluster_info->uncore_root; 160 159 160 + if (uncore_root->write_blocked) 161 + return -EPERM; 162 + 161 163 /* Update each cluster in a package */ 162 164 if (cluster_info->root_domain) { 163 165 struct tpmi_uncore_struct *uncore_root = cluster_info->uncore_root; ··· 237 233 238 234 static int uncore_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id) 239 235 { 236 + bool read_blocked = 0, write_blocked = 0; 240 237 struct intel_tpmi_plat_info *plat_info; 241 238 struct tpmi_uncore_struct *tpmi_uncore; 242 239 int ret, i, pkg = 0; 243 240 int num_resources; 241 + 242 + ret = tpmi_get_feature_status(auxdev, TPMI_ID_UNCORE, &read_blocked, &write_blocked); 243 + if (ret) 244 + dev_info(&auxdev->dev, "Can't read feature status: ignoring blocked status\n"); 245 + 246 + if (read_blocked) { 247 + dev_info(&auxdev->dev, "Firmware has blocked reads, exiting\n"); 248 + return -ENODEV; 249 + } 244 250 245 251 /* Get number of power domains, which is equal to number of resources */ 246 252 num_resources = tpmi_get_resource_count(auxdev); ··· 280 266 } 281 267 282 268 tpmi_uncore->power_domain_count = num_resources; 269 + tpmi_uncore->write_blocked = write_blocked; 283 270 284 271 /* Get the package ID from the TPMI core */ 285 272 plat_info = tpmi_get_platform_data(auxdev);