platform/x86/intel/pmc: Display LPM requirements for multiple PMCs

Update the substate_requirements attribute to display the requirements for
all the PMCs on a package.

Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231129222132.2331261-17-david.e.box@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Rajvi Jingar
2023-11-29 14:21:28 -08:00
committed by Hans de Goede
parent 104f74943f
commit 0f601dec18

View File

@ -728,7 +728,7 @@ static int pmc_core_substate_l_sts_regs_show(struct seq_file *s, void *unused)
} }
DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_l_sts_regs); DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_l_sts_regs);
static void pmc_core_substate_req_header_show(struct seq_file *s) static void pmc_core_substate_req_header_show(struct seq_file *s, int pmc_index)
{ {
struct pmc_dev *pmcdev = s->private; struct pmc_dev *pmcdev = s->private;
int i, mode; int i, mode;
@ -743,21 +743,38 @@ static void pmc_core_substate_req_header_show(struct seq_file *s)
static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused) static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused)
{ {
struct pmc_dev *pmcdev = s->private; struct pmc_dev *pmcdev = s->private;
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; u32 sts_offset;
const struct pmc_bit_map **maps = pmc->map->lpm_sts; u32 *lpm_req_regs;
const struct pmc_bit_map *map; int num_maps, mp, pmc_index;
const int num_maps = pmc->map->lpm_num_maps;
u32 sts_offset = pmc->map->lpm_status_offset; for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs); ++pmc_index) {
u32 *lpm_req_regs = pmc->lpm_req_regs; struct pmc *pmc = pmcdev->pmcs[pmc_index];
int mp; const struct pmc_bit_map **maps;
if (!pmc)
continue;
maps = pmc->map->lpm_sts;
num_maps = pmc->map->lpm_num_maps;
sts_offset = pmc->map->lpm_status_offset;
lpm_req_regs = pmc->lpm_req_regs;
/*
* When there are multiple PMCs, though the PMC may exist, the
* requirement register discovery could have failed so check
* before accessing.
*/
if (!lpm_req_regs)
continue;
/* Display the header */ /* Display the header */
pmc_core_substate_req_header_show(s); pmc_core_substate_req_header_show(s, pmc_index);
/* Loop over maps */ /* Loop over maps */
for (mp = 0; mp < num_maps; mp++) { for (mp = 0; mp < num_maps; mp++) {
u32 req_mask = 0; u32 req_mask = 0;
u32 lpm_status; u32 lpm_status;
const struct pmc_bit_map *map;
int mode, idx, i, len = 32; int mode, idx, i, len = 32;
/* /*
@ -776,35 +793,31 @@ static int pmc_core_substate_req_regs_show(struct seq_file *s, void *unused)
for (i = 0; map[i].name && i < len; i++) { for (i = 0; map[i].name && i < len; i++) {
u32 bit_mask = map[i].bit_mask; u32 bit_mask = map[i].bit_mask;
if (!(bit_mask & req_mask)) if (!(bit_mask & req_mask)) {
/* /*
* Not required for any enabled states * Not required for any enabled states
* so don't display * so don't display
*/ */
continue; continue;
}
/* Display the element name in the first column */ /* Display the element name in the first column */
seq_printf(s, "%30s |", map[i].name); seq_printf(s, "pmc%d: %26s |", pmc_index, map[i].name);
/* Loop over the enabled states and display if required */ /* Loop over the enabled states and display if required */
pmc_for_each_mode(idx, mode, pmcdev) { pmc_for_each_mode(idx, mode, pmcdev) {
if (lpm_req_regs[mp + (mode * num_maps)] & bit_mask) bool required = lpm_req_regs[mp + (mode * num_maps)] &
seq_printf(s, " %9s |", bit_mask;
"Required"); seq_printf(s, " %9s |", required ? "Required" : " ");
else
seq_printf(s, " %9s |", " ");
} }
/* In Status column, show the last captured state of this agent */ /* In Status column, show the last captured state of this agent */
if (lpm_status & bit_mask) seq_printf(s, " %9s |", lpm_status & bit_mask ? "Yes" : " ");
seq_printf(s, " %9s |", "Yes");
else
seq_printf(s, " %9s |", " ");
seq_puts(s, "\n"); seq_puts(s, "\n");
} }
} }
}
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_req_regs); DEFINE_SHOW_ATTRIBUTE(pmc_core_substate_req_regs);