Centos-kernel-stream-9/drivers/platform/x86/intel/tpmi_power_domains.h

19 lines
452 B
C
Raw Normal View History

platform/x86/intel: TPMI domain id and CPU mapping JIRA: https://issues.redhat.com/browse/RHEL-46074 commit 17ca2780458cdb0afc623e3432b1977847da3d15 Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Date: Tue May 28 10:34:57 2024 +0300 platform/x86/intel: TPMI domain id and CPU mapping Each TPMI power domain includes a group of CPUs. Several power management settings in this case applicable to a group of CPUs. There can be several power domains in a CPU package. So, provide interfaces for: - Get power domain id for a Linux CPU - Get mask of Linux CPUs in a power domain Hardware Punit uses different CPU numbering, which is not based on APIC (Advanced Programmable Interrupt Controller) CPU numbering. The Linux CPU numbering is based on APIC CPU numbering. Some PM features like Intel Speed Select, the CPU core mask provided by the hardware is based on the Punit CPU numbering. To use the core mask, this mask needs to be converted to a Linux CPUs mask. So, provide interfaces for: - Convert to a Linux CPU number from a Punit CPU number - Convert to a Punit CPU number from a Linux CPU number On each CPU online, MSR 0x54 is used to read the mapping and stores in a per cpu array. Create a hash for faster searching of a Linux CPU number from a Punit CPU number. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> [tero.kristo: minor updates] Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com> Link: https://lore.kernel.org/r/20240528073457.497816-1-tero.kristo@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: David Arcari <darcari@redhat.com>
2024-12-04 14:43:53 +00:00
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Mapping of TPMI power domain and CPUs
*
* Copyright (c) 2024, Intel Corporation.
*/
#ifndef _TPMI_POWER_DOMAINS_H_
#define _TPMI_POWER_DOMAINS_H_
#include <linux/cpumask.h>
int tpmi_get_linux_cpu_number(int package_id, int die_id, int punit_core_id);
int tpmi_get_punit_core_number(int cpu_no);
int tpmi_get_power_domain_id(int cpu_no);
cpumask_t *tpmi_get_power_domain_mask(int cpu_no);
#endif