Received: by 10.223.185.116 with SMTP id b49csp1706880wrg; Sat, 17 Feb 2018 03:38:46 -0800 (PST) X-Google-Smtp-Source: AH8x225lyUDdiq7rvVBj3v9Lnktu88CqBcbuWqt/WuYvdx0zV5CBXkbV1Jt3UBpGUMas/MsUAeEN X-Received: by 10.99.114.86 with SMTP id c22mr7511628pgn.41.1518867526842; Sat, 17 Feb 2018 03:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518867526; cv=none; d=google.com; s=arc-20160816; b=EYyk8i8+rAyAseO3U6n4/OA+j5WyuUkoA3yw8l6zLzBX9t16YzSNo0ftzYQf40GHQc dH6DrCMnPxnFLoSBma8DX9ew7xwE6P5Ct3Wc4iwaKTWdlSKdQxTXCVfJxzIZIyUnNmPt ZDTPdcVLfpnLV/yjnc1WiE+sGHs2NmslavwyXt1QzagXabFdRNCXzwwT3kZaYMpyeP2R rQ3aiWAmg4PIHnSgthGO5CAMmhdJJlYC+zrYIDDnx42HUHVVY35SKVQGdY0iyVU5huG5 l6b4sXzJrH2A87y6nnCc5ukZ5iBZIGwah2umjVw/bjEB9L5W4vz4NZWpRpHQ9s9RSfL6 6W7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=HKt+eqGDNXz+Yrt76VdgNsMF/tfDT0J+hmGgKYpUfak=; b=K7xtY3xZ636/jYqR5XGhlMSDxsmYUYU/OUaa7wAlEnk2rKH9aRgyqy5URnxyc9OQYG lt5hXXD3/0yu+/rgyrOzl/ygXoi140UTTFDnQs0tiM+ZH4ldodYbsoNVr7jmIesNoDcZ KiMi4gZSpSCwEkaxwFf/rUqb2rNifFnG7ZocijjZOq5ATZz8JuD0MRKX6SfipNxKgaw2 WvALLAiY2R2FVKoo8ftYhXFuy8ZiqSVpX3zJu5pe4/n3nAAZQiqYUBMgTVFkOZzWbjrI 399mN0TI2b6HTAuHYy6sMOcNk8Nejqco4lWxPIsjfCPEBFAvQj/7FiIYwMotLtIFzSd8 TFuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l131si2505469pga.536.2018.02.17.03.38.32; Sat, 17 Feb 2018 03:38:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751257AbeBQLhz (ORCPT + 99 others); Sat, 17 Feb 2018 06:37:55 -0500 Received: from terminus.zytor.com ([198.137.202.136]:58361 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbeBQLhy (ORCPT ); Sat, 17 Feb 2018 06:37:54 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1HBbiQY008209; Sat, 17 Feb 2018 03:37:44 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1HBbgt5008196; Sat, 17 Feb 2018 03:37:42 -0800 Date: Sat, 17 Feb 2018 03:37:42 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Thomas Richter Message-ID: 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 Reply-To: linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com, mingo@kernel.org, acme@redhat.com, brueckner@linux.vnet.ibm.com, tglx@linutronix.de, hpa@zytor.com, tmricht@linux.vnet.ibm.com, heiko.carstens@de.ibm.com In-Reply-To: <20180213151419.80737-2-tmricht@linux.vnet.ibm.com> References: <20180213151419.80737-2-tmricht@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf annotate: Scan cpuid for s390 and save machine type Git-Commit-ID: c59124fa59757fadc80ad881056a21f98c71b146 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c59124fa59757fadc80ad881056a21f98c71b146 Gitweb: https://git.kernel.org/tip/c59124fa59757fadc80ad881056a21f98c71b146 Author: Thomas Richter AuthorDate: Tue, 13 Feb 2018 16:14:17 +0100 Committer: Arnaldo Carvalho de Melo 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 Reviewed-by: Hendrik Brueckner Cc: Heiko Carstens Cc: Martin Schwidefsky Link: http://lkml.kernel.org/r/20180213151419.80737-2-tmricht@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- 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; }