Skip to content

Commit b755367

Browse files
zhang-ruirafaeljw
authored andcommitted
thermal: intel: hfi: Give HFI instances package scope
The Intel Software Developer's Manual defines the scope of HFI (registers and memory buffer) as a package. Use package scope(*) in the software representation of an HFI instance. Using die scope in HFI instances has the effect of creating multiple conflicting instances for the same package: each instance allocates its own memory buffer and configures the same package-level registers. Specifically, only one of the allocated memory buffers can be set in the MSR_IA32_HW_FEEDBACK_PTR register. CPUs get incorrect HFI data from the table. The problem does not affect current HFI-capable platforms because they all have single-die processors. (*) We used die scope for HFI instances because there had been processors with packages enumerated as dies. None of those systems supported HFI, though. If such a system emerged, it would need to be quirked. Co-developed-by: Chen Yu <[email protected]> Signed-off-by: Chen Yu <[email protected]> Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Ricardo Neri <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5539732 commit b755367

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

drivers/thermal/intel/intel_hfi.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ static void hfi_disable(void)
401401
* intel_hfi_online() - Enable HFI on @cpu
402402
* @cpu: CPU in which the HFI will be enabled
403403
*
404-
* Enable the HFI to be used in @cpu. The HFI is enabled at the die/package
405-
* level. The first CPU in the die/package to come online does the full HFI
404+
* Enable the HFI to be used in @cpu. The HFI is enabled at the package
405+
* level. The first CPU in the package to come online does the full HFI
406406
* initialization. Subsequent CPUs will just link themselves to the HFI
407-
* instance of their die/package.
407+
* instance of their package.
408408
*
409409
* This function is called before enabling the thermal vector in the local APIC
410410
* in order to ensure that @cpu has an associated HFI instance when it receives
@@ -414,31 +414,31 @@ void intel_hfi_online(unsigned int cpu)
414414
{
415415
struct hfi_instance *hfi_instance;
416416
struct hfi_cpu_info *info;
417-
u16 die_id;
417+
u16 pkg_id;
418418

419419
/* Nothing to do if hfi_instances are missing. */
420420
if (!hfi_instances)
421421
return;
422422

423423
/*
424-
* Link @cpu to the HFI instance of its package/die. It does not
424+
* Link @cpu to the HFI instance of its package. It does not
425425
* matter whether the instance has been initialized.
426426
*/
427427
info = &per_cpu(hfi_cpu_info, cpu);
428-
die_id = topology_logical_die_id(cpu);
428+
pkg_id = topology_logical_package_id(cpu);
429429
hfi_instance = info->hfi_instance;
430430
if (!hfi_instance) {
431-
if (die_id >= max_hfi_instances)
431+
if (pkg_id >= max_hfi_instances)
432432
return;
433433

434-
hfi_instance = &hfi_instances[die_id];
434+
hfi_instance = &hfi_instances[pkg_id];
435435
info->hfi_instance = hfi_instance;
436436
}
437437

438438
init_hfi_cpu_index(info);
439439

440440
/*
441-
* Now check if the HFI instance of the package/die of @cpu has been
441+
* Now check if the HFI instance of the package of @cpu has been
442442
* initialized (by checking its header). In such case, all we have to
443443
* do is to add @cpu to this instance's cpumask and enable the instance
444444
* if needed.
@@ -504,7 +504,7 @@ void intel_hfi_online(unsigned int cpu)
504504
*
505505
* On some processors, hardware remembers previous programming settings even
506506
* after being reprogrammed. Thus, keep HFI enabled even if all CPUs in the
507-
* die/package of @cpu are offline. See note in intel_hfi_online().
507+
* package of @cpu are offline. See note in intel_hfi_online().
508508
*/
509509
void intel_hfi_offline(unsigned int cpu)
510510
{
@@ -674,9 +674,13 @@ void __init intel_hfi_init(void)
674674
if (hfi_parse_features())
675675
return;
676676

677-
/* There is one HFI instance per die/package. */
678-
max_hfi_instances = topology_max_packages() *
679-
topology_max_dies_per_package();
677+
/*
678+
* Note: HFI resources are managed at the physical package scope.
679+
* There could be platforms that enumerate packages as Linux dies.
680+
* Special handling would be needed if this happens on an HFI-capable
681+
* platform.
682+
*/
683+
max_hfi_instances = topology_max_packages();
680684

681685
/*
682686
* This allocation may fail. CPU hotplug callbacks must check

0 commit comments

Comments
 (0)