[PATCH 07/10] perf/x86/intel/uncore: Support die scope counters on CLX-AP

kan.liang
2019-02-19T20:01:31Z

CLX-AP has the same uncore counters as SKX, but they are die scope.
Add a bool variable to indicate die scope only uncore counters.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
arch/x86/events/intel/uncore.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index f795a73..f850ab9 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -20,6 +20,8 @@ static cpumask_t uncore_cpu_mask[DOMAIN_TYPE_MAX];

static unsigned int uncore_domain_type_mask;

+static bool die_only;
+
/* constraint for the fixed counter */
static struct event_constraint uncore_constraint_fixed =
EVENT_CONSTRAINT(~0ULL, 1 << UNCORE_PMC_IDX_FIXED, ~0ULL);
@@ -895,6 +897,9 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
if (!pmus)
return -ENOMEM;

+ if (die_only)
+ type->type.type = DIE_DOMAIN;
+
if (domain_type_init(&type->type)) {
kfree(pmus);
return -ENOMEM;
@@ -1503,6 +1508,15 @@ static int __init intel_uncore_init(void)
return -ENODEV;

uncore_init = (struct intel_uncore_init_fun *)id->driver_data;
+
+ /*
+ * CLX-AP has the same uncore counters as SKX,
+ * but they are die scope.
+ */
+ if ((boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X) &&
+ (boot_cpu_data.x86_max_dies > 1))
+ die_only = true;
+
if (uncore_init->pci_init) {
pret = uncore_init->pci_init();
if (!pret)
--
2.7.4