From patchwork Tue Jun 6 18:29:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 9769607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B7AB86035D for ; Tue, 6 Jun 2017 18:37:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB4126CFC for ; Tue, 6 Jun 2017 18:37:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A36FF28472; Tue, 6 Jun 2017 18:37:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2448526CFC for ; Tue, 6 Jun 2017 18:37:54 +0000 (UTC) Received: from localhost ([::1]:39697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJMX-0004KP-8W for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 14:37:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJES-0006PN-Az for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIJEN-00034W-RJ for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38850) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIJEN-000343-Hb for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:27 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v56IT5C7115921 for ; Tue, 6 Jun 2017 14:29:25 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2aww80y4vf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 06 Jun 2017 14:29:25 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Jun 2017 19:29:22 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Jun 2017 19:29:19 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v56ITJAD2884086; Tue, 6 Jun 2017 18:29:19 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94E274C044; Tue, 6 Jun 2017 19:27:39 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FAE64C040; Tue, 6 Jun 2017 19:27:39 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 6 Jun 2017 19:27:39 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id C636F20F677; Tue, 6 Jun 2017 20:29:18 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Tue, 6 Jun 2017 20:29:14 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496773755-53343-1-git-send-email-borntraeger@de.ibm.com> References: <1496773755-53343-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060618-0008-0000-0000-000004601E0A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060618-0009-0000-0000-00001DE7EF27 Message-Id: <1496773755-53343-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-06_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706060316 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 4/5] s390x/cpumodel: take care of the cpuid format bit for KVM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , qemu-devel , Alexander Graf , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Hildenbrand Let's also properly forward that bit. It should always be set. I verified it under z/VM, it seems to be always set there. For now, zKVM guests never get that bit set when the CPU model is active. The PoP mentiones, that z800 + z900 (HW generation 7) always set this bit to 0, so let's take care of that. Signed-off-by: David Hildenbrand Message-Id: <20170531193434.6918-2-david@redhat.com> Acked-by: Jason J. Herne Signed-off-by: Christian Borntraeger --- target/s390x/cpu_models.c | 1 + target/s390x/cpu_models.h | 10 +++++++--- target/s390x/kvm.c | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 8d27363..9e23535 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -740,6 +740,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) /* copy over properties that can vary */ cpu->model->lowest_ibc = max_model->lowest_ibc; cpu->model->cpu_id = max_model->cpu_id; + cpu->model->cpu_id_format = max_model->cpu_id_format; cpu->model->cpu_ver = max_model->cpu_ver; check_consistency(cpu->model); diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h index 136a602..d41f8d6 100644 --- a/target/s390x/cpu_models.h +++ b/target/s390x/cpu_models.h @@ -46,6 +46,7 @@ typedef struct S390CPUModel { /* values copied from the "host" model, can change during migration */ uint16_t lowest_ibc; /* lowest IBC that the hardware supports */ uint32_t cpu_id; /* CPU id */ + uint8_t cpu_id_format; /* CPU id format bit */ uint8_t cpu_ver; /* CPU version, usually "ff" for kvm */ } S390CPUModel; @@ -54,12 +55,14 @@ typedef struct S390CPUModel { * * bits 0-7: Zeroes (ff for kvm) * bits 8-31: CPU ID (serial number) - * bits 32-48: Machine type - * bits 48-63: Zeroes + * bits 32-47: Machine type + * bit 48: CPU ID format + * bits 49-63: Zeroes */ #define cpuid_type(x) (((x) >> 16) & 0xffff) #define cpuid_id(x) (((x) >> 32) & 0xffffff) #define cpuid_ver(x) (((x) >> 56) & 0xff) +#define cpuid_format(x) (((x) >> 15) & 0x1) #define lowest_ibc(x) (((uint32_t)(x) >> 16) & 0xfff) #define unblocked_ibc(x) ((uint32_t)(x) & 0xfff) @@ -92,7 +95,8 @@ static inline uint64_t s390_cpuid_from_cpu_model(const S390CPUModel *model) { return ((uint64_t)model->cpu_ver << 56) | ((uint64_t)model->cpu_id << 32) | - ((uint64_t)model->def->type << 16); + ((uint64_t)model->def->type << 16) | + (model->def->gen == 7 ? 0 : (uint64_t)model->cpu_id_format << 15); } S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga, S390FeatBitmap features); diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ba1e60f..a3d0019 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2580,6 +2580,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp) unblocked_ibc = unblocked_ibc(prop.ibc); } model->cpu_id = cpuid_id(prop.cpuid); + model->cpu_id_format = cpuid_format(prop.cpuid); model->cpu_ver = 0xff; /* get supported cpu features indicated via STFL(E) */