thermal: intel: hfi: Enable notification interrupt
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>
Thu, 27 Jan 2022 19:34:52 +0000 (11:34 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Feb 2022 18:50:49 +0000 (19:50 +0100)
commitab09b0744a9944cbdc0ac9a5cb00bef72adf79d5
tree8985cf78578fa4977bc98b6a6b2cee10eb73f0d4
parent2d74e6319abe278981e79166b6c2d0c3ed39b1ae
thermal: intel: hfi: Enable notification interrupt

When hardware wants to inform the operating system about updates in the HFI
table, it issues a package-level thermal event interrupt. For this,
hardware has new interrupt and status bits in the IA32_PACKAGE_THERM_
INTERRUPT and IA32_PACKAGE_THERM_STATUS registers. The existing thermal
throttle driver already handles thermal event interrupts: it initializes
the thermal vector of the local APIC as well as per-CPU and package-level
interrupt reporting. It also provides routines to service such interrupts.
Extend its functionality to also handle HFI interrupts.

The frequency of the thermal HFI interrupt is specific to each processor
model. On some processors, a single interrupt happens as soon as the HFI is
enabled and hardware will never update HFI capabilities afterwards. On
other processors, thermal and power constraints may cause thermal HFI
interrupts every tens of milliseconds.

To not overwhelm consumers of the HFI data, use delayed work to throttle
the rate at which HFI updates are processed. Use a dedicated workqueue to
not overload system_wq if hardware issues many HFI updates.

Reviewed-by: Len Brown <len.brown@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/intel/intel_hfi.c
drivers/thermal/intel/intel_hfi.h
drivers/thermal/intel/therm_throt.c