From nobody Sun Feb 8 23:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928147664989.1364650861134; Thu, 8 Jun 2017 06:22:27 -0700 (PDT) Received: from localhost ([::1]:49581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxOK-0000JM-UM for importer@patchew.org; Thu, 08 Jun 2017 09:22:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxMe-0007ZQ-8S for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxMa-00046x-Tg for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55593 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIxMa-00046h-Ms for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:36 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v58DKFl0086208 for ; Thu, 8 Jun 2017 09:20:35 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2axyutw7v0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Jun 2017 09:20:26 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jun 2017 14:19:07 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jun 2017 14:19:05 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v58DJ5HC31391956; Thu, 8 Jun 2017 13:19:05 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A4854C120; Thu, 8 Jun 2017 14:17:24 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44E1F4C125; Thu, 8 Jun 2017 14:17:24 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 8 Jun 2017 14:17:24 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 0FD5D20F67B; Thu, 8 Jun 2017 15:19:05 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Thu, 8 Jun 2017 15:18:56 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> References: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060813-0016-0000-0000-000004B82314 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060813-0017-0000-0000-000027E823D0 Message-Id: <1496927940-13301-2-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-08_05:, , 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-1706080239 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL 1/5] s390x/css: catch section mismatch on load 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: Halil Pasic , Stefan Hajnoczi , qemu-stable@nongnu.org, qemu-devel , Alexander Graf , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Halil Pasic Prior to the virtio-ccw-2.7 machine (and commit 2a79eb1a), our virtio devices residing under the virtual-css bus do not have qdev_path based migration stream identifiers (because their qdev_path is NULL). The ids are instead generated when the device is registered as a composition of the so called idstr, which takes the vmsd name as its value, and an instance_id, which is which is calculated as a maximal instance_id registered with the same idstr plus one, or zero (if none was registered previously). That means, under certain circumstances, one device might try, and even succeed, to load the state of a different device. This can lead to trouble. Let us fail the migration if the above problem is detected during load. How to reproduce the problem: 1) start qemu-system-s390x making sure you have the following devices defined on your command line: -device virtio-rng-ccw,id=3Drng1,devno=3Dfe.0.0001 -device virtio-rng-ccw,id=3Drng2,devno=3Dfe.0.0002 2) detach the devices and reattach in reverse order using the monitor: (qemu) device_del rng1 (qemu) device_del rng2 (qemu) device_add virtio-rng-ccw,id=3Drng2,devno=3Dfe.0.0002 (qemu) device_add virtio-rng-ccw,id=3Drng1,devno=3Dfe.0.0001 3) save the state of the vm into a temporary file and quit QEMU: (qemu) migrate "exec:gzip -c > /tmp/tmp_vmstate.gz" (qemu) q 4) use your command line from step 1 with -incoming "exec:gzip -c -d /tmp/tmp_vmstate.gz" appended to reproduce the problem (while trying to to load the saved vm) CC: qemu-stable@nongnu.org Signed-off-by: Halil Pasic Reviewed-by: Dong Jia Shi Reviewed-by: Cornelia Huck Message-Id: <20170518111405.56947-1-pasic@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger --- hw/s390x/css.c | 14 ++++++++++++++ hw/s390x/virtio-ccw.c | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 1e2f26b..cc76c53 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -15,6 +15,7 @@ #include "hw/qdev.h" #include "qemu/error-report.h" #include "qemu/bitops.h" +#include "qemu/error-report.h" #include "exec/address-spaces.h" #include "cpu.h" #include "hw/s390x/ioinst.h" @@ -1800,13 +1801,26 @@ void subch_device_save(SubchDev *s, QEMUFile *f) int subch_device_load(SubchDev *s, QEMUFile *f) { SubchDev *old_s; + Error *err =3D NULL; uint16_t old_schid =3D s->schid; + uint16_t old_devno =3D s->devno; int i; =20 s->cssid =3D qemu_get_byte(f); s->ssid =3D qemu_get_byte(f); s->schid =3D qemu_get_be16(f); s->devno =3D qemu_get_be16(f); + if (s->devno !=3D old_devno) { + /* Only possible if machine < 2.7 (no css_dev_path) */ + + error_setg(&err, "%x !=3D %x", old_devno, s->devno); + error_append_hint(&err, "Devno mismatch, tried to load wrong secti= on!" + " Likely reason: some sequences of plug and unpl= ug" + " can break migration for machine versions prior= to" + " 2.7 (known design flaw).\n"); + error_report_err(err); + return -EINVAL; + } /* Re-assign subch. */ if (old_schid !=3D s->schid) { old_s =3D channel_subsys.css[s->cssid]->sch_set[s->ssid]->sch[old_= schid]; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index e6a6f74..90d37cb 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1279,9 +1279,13 @@ static int virtio_ccw_load_config(DeviceState *d, QE= MUFile *f) SubchDev *s =3D ccw_dev->sch; VirtIODevice *vdev =3D virtio_ccw_get_vdev(s); int len; + int ret; =20 s->driver_data =3D dev; - subch_device_load(s, f); + ret =3D subch_device_load(s, f); + if (ret) { + return ret; + } /* Re-fill subch_id after loading the subchannel states.*/ if (ck->refill_ids) { ck->refill_ids(ccw_dev); --=20 2.7.4 From nobody Sun Feb 8 23:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928162394709.9533992290415; Thu, 8 Jun 2017 06:22:42 -0700 (PDT) Received: from localhost ([::1]:49583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxOZ-0000bf-Oq for importer@patchew.org; Thu, 08 Jun 2017 09:22:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxLK-00061E-OH for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxLH-0003Vx-Dt for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:18 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34758 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIxLH-0003Sa-8m for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:15 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v58DJ7U1073742 for ; Thu, 8 Jun 2017 09:19:12 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ay72frxp9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Jun 2017 09:19:12 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jun 2017 14:19:09 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jun 2017 14:19:06 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v58DJ5wp26738878; Thu, 8 Jun 2017 13:19:05 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB685A4140; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B0F8A413F; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 51C0920F67A; Thu, 8 Jun 2017 15:19:05 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Thu, 8 Jun 2017 15:18:57 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> References: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060813-0016-0000-0000-000004B82313 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060813-0017-0000-0000-000027E823D2 Message-Id: <1496927940-13301-3-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-08_05:, , 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-1706080239 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL 2/5] s390x/css: fence off MIDA 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: Stefan Hajnoczi , qemu-devel , Alexander Graf , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Cornelia Huck MIDA (modified indirect data addressing) is an optional facility, and we (currently) don't support it. Let's post an operand exception if the guest tries to set it in the orb and a channel program check if it is set in a ccw, as specified in the Principles of Operation. Reviewed-by: Claudio Imbrenda Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- hw/s390x/css.c | 5 +++++ include/hw/s390x/ioinst.h | 1 + target/s390x/ioinst.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index cc76c53..599805d 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -433,6 +433,11 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw= _addr, return -EINVAL; } =20 + /* We don't support MIDA. */ + if (ccw.flags & CCW_FLAG_MIDA) { + return -EINVAL; + } + if (ccw.flags & CCW_FLAG_SUSPEND) { return suspend_allowed ? -EINPROGRESS : -EINVAL; } diff --git a/include/hw/s390x/ioinst.h b/include/hw/s390x/ioinst.h index c559f53..92d1565 100644 --- a/include/hw/s390x/ioinst.h +++ b/include/hw/s390x/ioinst.h @@ -182,6 +182,7 @@ typedef struct CCW1 { #define CCW_FLAG_PCI 0x08 #define CCW_FLAG_IDA 0x04 #define CCW_FLAG_SUSPEND 0x02 +#define CCW_FLAG_MIDA 0x01 =20 #define CCW_CMD_NOOP 0x03 #define CCW_CMD_BASIC_SENSE 0x04 diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 62a7771..d5e6b80 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -201,6 +201,10 @@ static int ioinst_orb_valid(ORB *orb) (orb->ctrl1 & ORB_CTRL1_MASK_INVALID)) { return 0; } + /* We don't support MIDA. */ + if (orb->ctrl1 & ORB_CTRL1_MASK_MIDAW) { + return 0; + } if ((orb->cpa & HIGH_ORDER_BIT) !=3D 0) { return 0; } --=20 2.7.4 From nobody Sun Feb 8 23:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928393806910.9124435865396; Thu, 8 Jun 2017 06:26:33 -0700 (PDT) Received: from localhost ([::1]:49608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxSI-0004Fw-Mo for importer@patchew.org; Thu, 08 Jun 2017 09:26:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxMK-0007JS-Pm for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxMG-00040a-28 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIxMF-0003UF-PU for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:16 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v58DJ1lw013880 for ; Thu, 8 Jun 2017 09:19:13 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ay3vmhubs-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Jun 2017 09:19:12 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jun 2017 14:19:09 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jun 2017 14:19:06 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v58DJ5iR8651056; Thu, 8 Jun 2017 13:19:05 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9771A4141; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D858DA413F; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 8 Jun 2017 14:17:06 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 8EC9F20F67B; Thu, 8 Jun 2017 15:19:05 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Thu, 8 Jun 2017 15:18:58 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> References: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060813-0040-0000-0000-000003A52515 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060813-0041-0000-0000-0000259D191B Message-Id: <1496927940-13301-4-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-08_05:, , 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-1706080239 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 3/5] pc-bios/s390-ccw: use STRIP variable in Makefile 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: Alexander Graf , Stefan Hajnoczi , Greg Kurz , qemu-devel , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz The docker-run-test-build@debian-s390x-cross target fails with: strip --strip-unneeded s390-ccw.elf -o s390-ccw.img strip: Unable to recognise the format of the input file `s390-ccw.elf' The configure script defines a STRIP makefile variable whose default value is ${cross_prefix}strip. Let's use it. We default to using the non-prefixed strip command in case --enable-debug or --disable-strip was passed to configure during a regular build. Signed-off-by: Greg Kurz Message-Id: <149623617700.4947.12490877660892961664.stgit@bahia.lan> Reviewed-by: Laurent Vivier Reviewed-by: Fam Zheng Signed-off-by: Christian Borntraeger --- pc-bios/s390-ccw/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 79a46b6..fb88c13 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -21,8 +21,10 @@ build-all: s390-ccw.img s390-ccw.elf: $(OBJECTS) $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_= DIR)$@") =20 +STRIP ?=3D strip + s390-ccw.img: s390-ccw.elf - $(call quiet-command,strip --strip-unneeded $< -o $@,"STRIP","$(TARGET_DI= R)$@") + $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET= _DIR)$@") =20 $(OBJECTS): Makefile =20 --=20 2.7.4 From nobody Sun Feb 8 23:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928282209395.0092666212122; Thu, 8 Jun 2017 06:24:42 -0700 (PDT) Received: from localhost ([::1]:49594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxQW-0002SD-J3 for importer@patchew.org; Thu, 08 Jun 2017 09:24:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxMJ-0007IK-B0 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxMG-00040U-0m for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIxMF-0003Ti-Nw for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:20:15 -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 v58DJ2OO108985 for ; Thu, 8 Jun 2017 09:19:13 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ay49h0ssw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Jun 2017 09:19:12 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jun 2017 14:19:10 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jun 2017 14:19:06 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v58DJ6ak16711750; Thu, 8 Jun 2017 13:19:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 599F452045; Thu, 8 Jun 2017 13:15:56 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 3A9075203F; Thu, 8 Jun 2017 13:15:56 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id D0B5820F67A; Thu, 8 Jun 2017 15:19:05 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Thu, 8 Jun 2017 15:18:59 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> References: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060813-0020-0000-0000-0000038321E5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060813-0021-0000-0000-000041FE8A3B Message-Id: <1496927940-13301-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-08_05:, , 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-1706080239 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 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 , Stefan Hajnoczi , qemu-devel , Alexander Graf , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 =3D max_model->lowest_ibc; cpu->model->cpu_id =3D max_model->cpu_id; + cpu->model->cpu_id_format =3D max_model->cpu_id_format; cpu->model->cpu_ver =3D max_model->cpu_ver; =20 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; =20 @@ -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) =20 #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 S3= 90CPUModel *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 =3D=3D 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 =3D unblocked_ibc(prop.ibc); } model->cpu_id =3D cpuid_id(prop.cpuid); + model->cpu_id_format =3D cpuid_format(prop.cpuid); model->cpu_ver =3D 0xff; =20 /* get supported cpu features indicated via STFL(E) */ --=20 2.7.4 From nobody Sun Feb 8 23:31:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928197944492.6331410652879; Thu, 8 Jun 2017 06:23:17 -0700 (PDT) Received: from localhost ([::1]:49584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxPA-00017E-Gp for importer@patchew.org; Thu, 08 Jun 2017 09:23:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxLx-0006vA-SE for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxLu-0003kB-J0 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49986 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIxLu-0003Rq-Cz for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:19:54 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v58DJ14X081269 for ; Thu, 8 Jun 2017 09:19:12 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2axxux7krb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Jun 2017 09:19:10 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jun 2017 14:19:08 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jun 2017 14:19:06 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v58DJ6Q616711754; Thu, 8 Jun 2017 13:19:06 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63CA44C11F; Thu, 8 Jun 2017 14:17:25 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 534DA4C11E; Thu, 8 Jun 2017 14:17:25 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 8 Jun 2017 14:17:25 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 1C1EE20F67B; Thu, 8 Jun 2017 15:19:06 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Thu, 8 Jun 2017 15:19:00 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> References: <1496927940-13301-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060813-0008-0000-0000-0000046221FE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060813-0009-0000-0000-00001DEA157B Message-Id: <1496927940-13301-6-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-08_05:, , 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-1706080239 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL 5/5] s390x/cpumodel: improve defintion search without an IBC 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 , Stefan Hajnoczi , qemu-devel , Alexander Graf , Christian Borntraeger , Cornelia Huck , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Currently, under z/VM on a 0x2827, QEMU will detect a 0x2828 if no IBC value is provided. QEMU will simply take the last model of that HW generation, which happens to be the BC version. Let's improve our search for that case by selecting the latest CPU definition that matches the CPU type. This for example will avoid detecting an z13 as a z13s. We might still detect a GA2 version on a GA1 system, but as we don't have further information at hand, there isn't too much we can do about it. The alternative of always presenting the oldest GA is not backward compatible, e.g: You're running on 0x2827 GA2. Old QEMU version indicated "0x2828 GA1 =3D=3D 0x2827 GA2". After you updated QEMU, you suddenly detect "0x2827 GA1". You're previous libvirt guest might suddenly refuse to run. In the end presenting a newer GA level does not matter because: 1: All GAX models share the same base feature set. A GAX++ might support "more features". 2: Without an IBC, the guest can't detect the GA version. If we have no IBC (esp. unblocked_ibc =3D=3D 0), the IBC we will present to the guest in read_SCP_info() will be 0. The guest will not know which GA version it has. The problem of missing IBC propagates. If we don't have a feature of the GA++ version, also our guest won't have it. So in summary, the guest also has no idea of its GA version. Signed-off-by: David Hildenbrand Message-Id: <20170531193434.6918-3-david@redhat.com> Acked-by: Jason J. Herne Reviewed-by: Halil Pasic Signed-off-by: Christian Borntraeger [improve patch description by reusing mailing list discussion] --- target/s390x/cpu_models.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 9e23535..b6220c8 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -184,6 +184,7 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint= 8_t gen, uint8_t ec_ga, S390FeatBitmap features) { const S390CPUDef *last_compatible =3D NULL; + const S390CPUDef *matching_cpu_type =3D NULL; int i; =20 if (!gen) { @@ -218,8 +219,16 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uin= t8_t gen, uint8_t ec_ga, if (def->type =3D=3D type && def->ec_ga =3D=3D ec_ga) { return def; } + /* remember if we've at least seen one with the same cpu type */ + if (def->type =3D=3D type) { + matching_cpu_type =3D def; + } last_compatible =3D def; } + /* prefer the model with the same cpu type, esp. don't take the BC for= EC */ + if (matching_cpu_type) { + return matching_cpu_type; + } return last_compatible; } =20 --=20 2.7.4