public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Thomas Richter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, heiko.carstens@de.ibm.com,
	tmricht@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	schwidefsky@de.ibm.com, mingo@kernel.org,
	brueckner@linux.vnet.ibm.com, acme@redhat.com,
	tglx@linutronix.de
Subject: [tip:perf/core] perf annotate: Scan cpuid for s390 and save machine type
Date: Sat, 17 Feb 2018 03:37:42 -0800	[thread overview]
Message-ID: <tip-c59124fa59757fadc80ad881056a21f98c71b146@git.kernel.org> (raw)
In-Reply-To: <20180213151419.80737-2-tmricht@linux.vnet.ibm.com>

Commit-ID:  c59124fa59757fadc80ad881056a21f98c71b146
Gitweb:     https://git.kernel.org/tip/c59124fa59757fadc80ad881056a21f98c71b146
Author:     Thomas Richter <tmricht@linux.vnet.ibm.com>
AuthorDate: Tue, 13 Feb 2018 16:14:17 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Feb 2018 15:16:57 -0300

perf annotate: Scan cpuid for s390 and save machine type

Scan the cpuid string and extract the type number for later use.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180213151419.80737-2-tmricht@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/s390/annotate/instructions.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c
index 8c72b44..01df9d8 100644
--- a/tools/perf/arch/s390/annotate/instructions.c
+++ b/tools/perf/arch/s390/annotate/instructions.c
@@ -23,12 +23,37 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na
 	return ops;
 }
 
+static int s390__cpuid_parse(struct arch *arch, char *cpuid)
+{
+	unsigned int family;
+	char model[16], model_c[16], cpumf_v[16], cpumf_a[16];
+	int ret;
+
+	/*
+	 * cpuid string format:
+	 * "IBM,family,model-capacity,model[,cpum_cf-version,cpum_cf-authorization]"
+	 */
+	ret = sscanf(cpuid, "%*[^,],%u,%[^,],%[^,],%[^,],%s", &family, model_c,
+		     model, cpumf_v, cpumf_a);
+	if (ret >= 2) {
+		arch->family = family;
+		arch->model = 0;
+		return 0;
+	}
+
+	return -1;
+}
+
 static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
 {
+	int err = 0;
+
 	if (!arch->initialized) {
 		arch->initialized = true;
 		arch->associate_instruction_ops = s390__associate_ins_ops;
+		if (cpuid)
+			err = s390__cpuid_parse(arch, cpuid);
 	}
 
-	return 0;
+	return err;
 }

  reply	other threads:[~2018-02-17 11:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 15:14 [PATCH 1/4] perf record: Provide detailed information on s390 CPU Thomas Richter
2018-02-13 15:14 ` [PATCH 2/4] perf annotate: Scan cpuid for s390 and save machine type Thomas Richter
2018-02-17 11:37   ` tip-bot for Thomas Richter [this message]
2018-02-13 15:14 ` [PATCH 3/4] perf cpuid: Introduce a platform specfic cpuid compare function Thomas Richter
2018-02-17 11:38   ` [tip:perf/core] perf cpuid: Introduce a platform specific " tip-bot for Thomas Richter
2018-02-13 15:14 ` [PATCH 4/4] perf test: Fix test case 23 for s390 z/VM or KVM guests Thomas Richter
2018-02-17 11:38   ` [tip:perf/core] " tip-bot for Thomas Richter
2018-02-15 14:50 ` [PATCH 1/4] perf record: Provide detailed information on s390 CPU Arnaldo Carvalho de Melo
2018-02-16 16:55 ` Arnaldo Carvalho de Melo
2018-02-16 18:17   ` Arnaldo Carvalho de Melo
2018-02-17 11:37 ` [tip:perf/core] " tip-bot for Thomas Richter

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=tip-c59124fa59757fadc80ad881056a21f98c71b146@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tmricht@linux.vnet.ibm.com \
    /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