mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 09:24:37 +07:00
platform/x86: intel_pmc_core: Fix the slp_s0 counter displayed value
slp_s0 counter value displayed via debugfs interface is calculated by multiplying the granularity for crystal oscillator tick as 100us with the value read from using slp_s0 offset. But the granularity of the tick varies from platform to platform and it needs to be fixed. Hence, specify granularity of the tick for each platform, so that the value of the slp_s0 counter is accurate. Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20201006224702.12697-4-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
652036bd5b
commit
025f26de7f
@ -154,6 +154,7 @@ static const struct pmc_reg_map spt_reg_map = {
|
||||
.ltr_show_sts = spt_ltr_show_map,
|
||||
.msr_sts = msr_map,
|
||||
.slp_s0_offset = SPT_PMC_SLP_S0_RES_COUNTER_OFFSET,
|
||||
.slp_s0_res_counter_step = SPT_PMC_SLP_S0_RES_COUNTER_STEP,
|
||||
.ltr_ignore_offset = SPT_PMC_LTR_IGNORE_OFFSET,
|
||||
.regmap_length = SPT_PMC_MMIO_REG_LEN,
|
||||
.ppfear0_offset = SPT_PMC_XRAM_PPFEAR0A,
|
||||
@ -380,6 +381,7 @@ static const struct pmc_bit_map cnp_ltr_show_map[] = {
|
||||
static const struct pmc_reg_map cnp_reg_map = {
|
||||
.pfear_sts = ext_cnp_pfear_map,
|
||||
.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
|
||||
.slp_s0_res_counter_step = SPT_PMC_SLP_S0_RES_COUNTER_STEP,
|
||||
.slps0_dbg_maps = cnp_slps0_dbg_maps,
|
||||
.ltr_show_sts = cnp_ltr_show_map,
|
||||
.msr_sts = msr_map,
|
||||
@ -396,6 +398,7 @@ static const struct pmc_reg_map cnp_reg_map = {
|
||||
static const struct pmc_reg_map icl_reg_map = {
|
||||
.pfear_sts = ext_icl_pfear_map,
|
||||
.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
|
||||
.slp_s0_res_counter_step = ICL_PMC_SLP_S0_RES_COUNTER_STEP,
|
||||
.slps0_dbg_maps = cnp_slps0_dbg_maps,
|
||||
.ltr_show_sts = cnp_ltr_show_map,
|
||||
.msr_sts = msr_map,
|
||||
@ -558,6 +561,7 @@ static const struct pmc_bit_map *tgl_lpm_maps[] = {
|
||||
static const struct pmc_reg_map tgl_reg_map = {
|
||||
.pfear_sts = ext_tgl_pfear_map,
|
||||
.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
|
||||
.slp_s0_res_counter_step = TGL_PMC_SLP_S0_RES_COUNTER_STEP,
|
||||
.ltr_show_sts = cnp_ltr_show_map,
|
||||
.msr_sts = msr_map,
|
||||
.ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET,
|
||||
@ -586,9 +590,9 @@ static inline void pmc_core_reg_write(struct pmc_dev *pmcdev, int reg_offset,
|
||||
writel(val, pmcdev->regbase + reg_offset);
|
||||
}
|
||||
|
||||
static inline u64 pmc_core_adjust_slp_s0_step(u32 value)
|
||||
static inline u64 pmc_core_adjust_slp_s0_step(struct pmc_dev *pmcdev, u32 value)
|
||||
{
|
||||
return (u64)value * SPT_PMC_SLP_S0_RES_COUNTER_STEP;
|
||||
return (u64)value * pmcdev->map->slp_s0_res_counter_step;
|
||||
}
|
||||
|
||||
static int pmc_core_dev_state_get(void *data, u64 *val)
|
||||
@ -598,7 +602,7 @@ static int pmc_core_dev_state_get(void *data, u64 *val)
|
||||
u32 value;
|
||||
|
||||
value = pmc_core_reg_read(pmcdev, map->slp_s0_offset);
|
||||
*val = pmc_core_adjust_slp_s0_step(value);
|
||||
*val = pmc_core_adjust_slp_s0_step(pmcdev, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define SPT_PMC_MPHY_CORE_STS_1 0x1142
|
||||
#define SPT_PMC_MPHY_COM_STS_0 0x1155
|
||||
#define SPT_PMC_MMIO_REG_LEN 0x1000
|
||||
#define SPT_PMC_SLP_S0_RES_COUNTER_STEP 0x64
|
||||
#define SPT_PMC_SLP_S0_RES_COUNTER_STEP 0x68
|
||||
#define PMC_BASE_ADDR_MASK ~(SPT_PMC_MMIO_REG_LEN - 1)
|
||||
#define MTPMC_MASK 0xffff0000
|
||||
#define PPFEAR_MAX_NUM_ENTRIES 12
|
||||
@ -185,8 +185,10 @@ enum ppfear_regs {
|
||||
#define ICL_PPFEAR_NUM_ENTRIES 9
|
||||
#define ICL_NUM_IP_IGN_ALLOWED 20
|
||||
#define ICL_PMC_LTR_WIGIG 0x1BFC
|
||||
#define ICL_PMC_SLP_S0_RES_COUNTER_STEP 0x64
|
||||
|
||||
#define TGL_NUM_IP_IGN_ALLOWED 22
|
||||
#define TGL_PMC_SLP_S0_RES_COUNTER_STEP 0x7A
|
||||
|
||||
/*
|
||||
* Tigerlake Power Management Controller register offsets
|
||||
@ -245,6 +247,7 @@ struct pmc_reg_map {
|
||||
const struct pmc_bit_map *msr_sts;
|
||||
const struct pmc_bit_map **lpm_sts;
|
||||
const u32 slp_s0_offset;
|
||||
const int slp_s0_res_counter_step;
|
||||
const u32 ltr_ignore_offset;
|
||||
const int regmap_length;
|
||||
const u32 ppfear0_offset;
|
||||
|
Loading…
Reference in New Issue
Block a user