Received: by 10.223.185.116 with SMTP id b49csp3753509wrg; Tue, 13 Feb 2018 07:16:09 -0800 (PST) X-Google-Smtp-Source: AH8x22751CkXv7TdEsfxoqilODZEmbthLhuAq0hgTgMpFWCWVONeXeJ1v7yY3A/GHWi/KtfWMHrM X-Received: by 10.99.173.7 with SMTP id g7mr1241486pgf.391.1518534968984; Tue, 13 Feb 2018 07:16:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518534968; cv=none; d=google.com; s=arc-20160816; b=Vj57JPUpGqYf+sL0G9dnHKfxJZzya5bHeV4fTZfrSoRNENWmRzLYHXi+c9QYAzlGtb c9vwrDM7HxaMNZfWVfZWl7rqG541dPNE99XlOsn6T4Cq/YAZ7p8EBccLt07qjoYWaoHP tdeR89B463HkSoWyW5vvrRdbDcrQRilMdAakDA10GNfGyjNkODdlpV+ny6axu94t+8IK UA/jrihYg+h9o9KDd/n5b1qnvhvxvZIPVVwpkQECJWh+oEMQ+mbRsJP8Gwuo0oUMxiLN ffBVzhSRzIodxLtA/AVMTBbPVSXJURM8ffcdCGM45hSpEVFK5yFqyCBz4+FIq8EoPlO4 4GgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=NMBC7qRcftJmYtBRkXCTIpK4gGerOxat0OqbWPxS7J4=; b=Babi507dN/UTwQbNTh+wOrgD0jAgDzNGhHHEQPN4WFMkmfV8Af4/UQHIeg40sBIO+g ewKgiYWt/6PdWW82BNiWJWn0/Zr/4rTxJcUB4ANSy29U9GWDDx70e9tkBZ1oLVMHVNLH hIStRvbsv5Axn43jVy+Us5ENB4+2Nj3MDuLod5/v7DNPE1RKxUYQcJO2bUgr4SECJJox GFAJoJqLItESgrlV11b4S8SjZ04Ab2xzpteOc7N50lKnNf0MCt1oRmLKqWbEptLAxVKA 913LBUt5lixBXTVPzfdx9WfGIW2rDFqRQweQSekgHPLy27PG3LmAdbhBbm8iimakX8zm 83WQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36-v6si1667698plc.433.2018.02.13.07.15.54; Tue, 13 Feb 2018 07:16:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965219AbeBMPOj (ORCPT + 99 others); Tue, 13 Feb 2018 10:14:39 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51844 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965054AbeBMPOg (ORCPT ); Tue, 13 Feb 2018 10:14:36 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1DFAKEn044008 for ; Tue, 13 Feb 2018 10:14:36 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2g426m910n-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 13 Feb 2018 10:14:35 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Feb 2018 15:14:33 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 Feb 2018 15:14:30 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1DFEUBF48496888; Tue, 13 Feb 2018 15:14:30 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 659DD11C05E; Tue, 13 Feb 2018 15:07:44 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35F6811C054; Tue, 13 Feb 2018 15:07:44 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 13 Feb 2018 15:07:44 +0000 (GMT) From: Thomas Richter To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, Thomas Richter Subject: [PATCH 2/4] perf annotate: Scan cpuid for s390 and save machine type Date: Tue, 13 Feb 2018 16:14:17 +0100 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180213151419.80737-1-tmricht@linux.vnet.ibm.com> References: <20180213151419.80737-1-tmricht@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18021315-0040-0000-0000-0000040F4CE8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021315-0041-0000-0000-000026131029 Message-Id: <20180213151419.80737-2-tmricht@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802130180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Scan the cpuid string and extract the type number for later use. Signed-off-by: Thomas Richter Reviewed-by: Hendrik Brueckner --- 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 8c72b44444cb..01df9d8303e1 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; } -- 2.14.3