mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
930d06bf07
The clearing of the package thermal status is done by Read-Modify-Write operation. This may result in clearing of some new status bits which are being or about to be processed. For example, while clearing of HFI status, after read of thermal status register, a new thermal status bit is set by the hardware. But during write back, the newly generated status bit will be set to 0 or cleared. So, it is not safe to do read-modify-write. Since thermal status Read-Write bits can be set to only 0 not 1, it is safe to set all other bits to 1 which are not getting cleared. Create a common interface for clearing package thermal status bits. Use this interface to replace existing code to clear thermal package status bits. It is safe to call from different CPUs without protection as there is no read-modify-write. Also wrmsrl results in just single instruction. For example while CPU 0 and CPU 3 are clearing bit 1 and 3 respectively. If CPU 3 wins the race, it will write 0x4000aa2, then CPU 1 will write 0x4000aa8. The bits which are not part of clear are set to 1. The default mask for bits, which can be written here is 0x4000aaa. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
25 lines
771 B
C
25 lines
771 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _INTEL_THERMAL_INTERRUPT_H
|
|
#define _INTEL_THERMAL_INTERRUPT_H
|
|
|
|
#define CORE_LEVEL 0
|
|
#define PACKAGE_LEVEL 1
|
|
|
|
/* Interrupt Handler for package thermal thresholds */
|
|
extern int (*platform_thermal_package_notify)(__u64 msr_val);
|
|
|
|
/* Interrupt Handler for core thermal thresholds */
|
|
extern int (*platform_thermal_notify)(__u64 msr_val);
|
|
|
|
/* Callback support of rate control, return true, if
|
|
* callback has rate control */
|
|
extern bool (*platform_thermal_package_rate_control)(void);
|
|
|
|
/* Handle HWP interrupt */
|
|
extern void notify_hwp_interrupt(void);
|
|
|
|
/* Common function to clear Package thermal status register */
|
|
extern void thermal_clear_package_intr_status(int level, u64 bit_mask);
|
|
|
|
#endif /* _INTEL_THERMAL_INTERRUPT_H */
|