Skip to content

Commit ac1f923

Browse files
ricardonrafaeljw
authored andcommitted
thermal: intel: hfi: Enable an HFI instance from its first online CPU
Previously, HFI instances were never disabled once enabled. A CPU in an instance only had to check during boot whether another CPU had previously initialized the instance and its corresponding data structure. A subsequent changeset will add functionality to disable instances to support hibernation. Such change will also make possible to disable an HFI instance during runtime via CPU hotplug. Enable an HFI instance from the first of its CPUs that comes online. This covers the boot, CPU hotplug, and resume-from-suspend cases. It also covers systems with one or more HFI instances (i.e., packages). Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8a8b6bb commit ac1f923

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/thermal/intel/intel_hfi.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,12 @@ void intel_hfi_online(unsigned int cpu)
410410
/*
411411
* Now check if the HFI instance of the package/die of @cpu has been
412412
* initialized (by checking its header). In such case, all we have to
413-
* do is to add @cpu to this instance's cpumask.
413+
* do is to add @cpu to this instance's cpumask and enable the instance
414+
* if needed.
414415
*/
415416
mutex_lock(&hfi_instance_lock);
416-
if (hfi_instance->hdr) {
417-
cpumask_set_cpu(cpu, hfi_instance->cpus);
418-
goto unlock;
419-
}
417+
if (hfi_instance->hdr)
418+
goto enable;
420419

421420
/*
422421
* Hardware is programmed with the physical address of the first page
@@ -442,10 +441,14 @@ void intel_hfi_online(unsigned int cpu)
442441
raw_spin_lock_init(&hfi_instance->table_lock);
443442
raw_spin_lock_init(&hfi_instance->event_lock);
444443

444+
enable:
445445
cpumask_set_cpu(cpu, hfi_instance->cpus);
446446

447-
hfi_set_hw_table(hfi_instance);
448-
hfi_enable();
447+
/* Enable this HFI instance if this is its first online CPU. */
448+
if (cpumask_weight(hfi_instance->cpus) == 1) {
449+
hfi_set_hw_table(hfi_instance);
450+
hfi_enable();
451+
}
449452

450453
unlock:
451454
mutex_unlock(&hfi_instance_lock);

0 commit comments

Comments
 (0)