LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linuxppc-dev@ozlabs.org, eranian@google.com, ak@linux.intel.com,
	srivatsa@mit.edu, Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Subject: [RFC PATCH 1/7] powerpc/powernv: Data structure and macros definition
Date: Wed, 11 Mar 2015 18:37:07 +0530	[thread overview]
Message-ID: <1426079233-16720-2-git-send-email-maddy@linux.vnet.ibm.com> (raw)
In-Reply-To: <1426079233-16720-1-git-send-email-maddy@linux.vnet.ibm.com>

Patch adds the data structures and macros 
needed for nest pmu support. "type" structure will 
hold each nest unit and sub-unit information.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
 arch/powerpc/perf/uncore_pmu.h | 89 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 arch/powerpc/perf/uncore_pmu.h

diff --git a/arch/powerpc/perf/uncore_pmu.h b/arch/powerpc/perf/uncore_pmu.h
new file mode 100644
index 0000000..ba4b3f4
--- /dev/null
+++ b/arch/powerpc/perf/uncore_pmu.h
@@ -0,0 +1,89 @@
+/*
+ * Uncore Performance Monitor counter support.
+ *
+ * Derived from Intel's uncore framework
+ *   written by: Liang,Kan
+ *               Zheng, Yan
+ *               Andi Keen
+ *
+ *   Copyright Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; under version
+ * 2 of the License.
+ */
+
+#include <linux/perf_event.h>
+#include <linux/cpumask.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <asm/prom.h>
+#include <asm/opal.h>
+#include <asm/cputhreads.h>
+
+/*
+ * Macros for pmu groups
+ */
+#define pmu_group attr_groups[0]
+#define format_group attr_groups[1]
+#define events_group attr_groups[2]
+
+/*
+ * uncore specific macros
+ */
+#define P8_MAX_CHIP		256
+#define MAX_PMU_NAME_LEN 	128
+#define MAX_UNITS_SUPPORTED	16
+#define MAX_SUB_UNITS		8
+#define MAX_TYPE_EVENTS		16
+#define MAX_EVENTS_SUPPORTED	256
+
+/*
+ * Structure to hold event information for a
+ * uncore pmu type. Device-Tree contain events
+ * and memory offsets to access the counter for
+ * a gievn event. Some events will also carry
+ * unit and scale.
+ */
+struct ppc64_uncore_type_events {
+	int ev_offset[MAX_EVENTS_SUPPORTED];
+	const char *ev_name[MAX_EVENTS_SUPPORTED];
+	const char *ev_value[MAX_EVENTS_SUPPORTED];
+};
+
+/*
+ * Structure to hold per chip specific memory address
+ * information for uncore pmus, since uncore pmus are
+ * per-chip.
+ */
+struct ppc64_uncore_unit {
+	uint32_t chip_id;
+	uint64_t preg_base;
+	uint64_t vreg_base;
+	uint32_t size;
+};
+
+/*
+ * Structure for each uncore unit.
+ */
+struct ppc64_uncore_type {
+	const char *name;
+	int num_boxes;
+	struct pmu *pmu;
+	struct ppc64_uncore_pmu *pmus;
+	struct attribute **event_attrs;
+	const struct attribute_group *attr_groups[4];
+	struct ppc64_uncore_type_events event_arry[MAX_SUB_UNITS];
+};
+
+
+struct ppc64_uncore_pmu {
+	struct pmu pmu;
+	char name[MAX_PMU_NAME_LEN];
+	int pmu_idx;
+	struct ppc64_uncore_type *type;
+};
+
+struct ppc64_uncore_pmu *uncore_event_to_pmu(struct perf_event *event);
+extern int uncore_p8_init(void);
-- 
1.9.1


  reply	other threads:[~2015-03-11 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 13:07 [RFC PATCH 0/7] powerpc/powernv: Nest Instrumentation support Madhavan Srinivasan
2015-03-11 13:07 ` Madhavan Srinivasan [this message]
2015-03-11 13:07 ` [RFC PATCH 2/7] powerpc/powernv: uncore foundation code Madhavan Srinivasan
2015-03-11 13:07 ` [RFC PATCH 3/7] powerpc/powernv: uncore cpumask and CPU hotplug Madhavan Srinivasan
2015-03-11 13:07 ` [RFC PATCH 4/7]powerpc/powernv: Add OPAL support for Nest pmu Madhavan Srinivasan
2015-03-11 22:57   ` Stewart Smith
2015-03-12  8:47     ` maddy
2015-03-11 13:07 ` [RFC PATCH 5/7]powerpc/powernv: Add POWER8 specific nest pmu support Madhavan Srinivasan
2015-03-11 13:07 ` [RFC PATCH 6/7]powerpc/powernv: add support to parse dt for nest pmu Madhavan Srinivasan
2015-03-11 13:07 ` [RFC PATCH 7/7]powerpc/powernv: enable nest pmu related file in Makefile Madhavan Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426079233-16720-2-git-send-email-maddy@linux.vnet.ibm.com \
    --to=maddy@linux.vnet.ibm.com \
    --cc=ak@linux.intel.com \
    --cc=benh@kernel.crashing.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=srivatsa@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).