From nobody Sat Nov 1 22:42:59 2025 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.zohomail.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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509354494580703.387356985538; Mon, 30 Oct 2017 02:08:14 -0700 (PDT) Received: from localhost ([::1]:39276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e963C-0004Z2-OA for importer@patchew.org; Mon, 30 Oct 2017 05:08:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e95zM-0002Hl-Ti for qemu-devel@nongnu.org; Mon, 30 Oct 2017 05:04:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e95zJ-000701-OO for qemu-devel@nongnu.org; Mon, 30 Oct 2017 05:04:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e95zJ-0006zb-FN for qemu-devel@nongnu.org; Mon, 30 Oct 2017 05:04:05 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9U93ub0041005 for ; Mon, 30 Oct 2017 05:03:59 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dx12906kw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 30 Oct 2017 05:03:57 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Oct 2017 09:03:26 -0000 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; Mon, 30 Oct 2017 09:03:22 -0000 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 v9U93M5I25952350; Mon, 30 Oct 2017 09:03:22 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 231634C063; Mon, 30 Oct 2017 08:58:54 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B38B4C058; Mon, 30 Oct 2017 08:58:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 30 Oct 2017 08:58:54 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id B93C220F62F; Mon, 30 Oct 2017 10:03:21 +0100 (CET) From: Christian Borntraeger To: Peter Maydell Date: Mon, 30 Oct 2017 10:03:18 +0100 X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171030090320.93625-1-borntraeger@de.ibm.com> References: <20171030090320.93625-1-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17103009-0016-0000-0000-000004FB590A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17103009-0017-0000-0000-00002836DB77 Message-Id: <20171030090320.93625-3-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-30_02:, , 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=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710300130 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 2/4] s390x/kvm: use cpu model for gscb on compat machines 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: Thomas Huth , David Hildenbrand , Cornelia Huck , qemu-devel , Alexander Graf , Christian Borntraeger , Halil Pasic , 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" Starting a guest with hvm on an IBM z14 results in "qemu-system-s390x: Some features requested in the CPU model are not available in the configuration: gs" This is because guarded storage is fenced for compat machines that did not have guarded storage support. While this prevents future migration abort (by not starting the guest at all), not being able to start a "host-model" guest is very much unexpected. As it turns out, even if we would modify libvirt to not expand the cpu model to contain "gs" for compat machines, it cannot guarantee that a migration will succeed. For example if the kernel changes its features (or the user has nested=3D1 on one host but not on the other) the migration will fail nevertheless. So instead of fencing "gs" for machines <=3D 2.9 lets allow it for all machine types that support the CPU model. This will make "host-model" runnable all the time, while relying on the CPU model to reject invalid migration attempts. We also need to change the migration for guarded storage. Additional discussions about host-model are still pending but are out of scope of this patch. Suggested-by: David Hildenbrand Signed-off-by: Christian Borntraeger Acked-by: David Hildenbrand Acked-by: Cornelia Huck Acked-by: Halil Pasic --- hw/s390x/s390-virtio-ccw.c | 8 -------- include/hw/s390x/s390-virtio-ccw.h | 3 --- target/s390x/kvm.c | 2 +- target/s390x/machine.c | 2 +- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index baeafdc..6a57f94 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -432,7 +432,6 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) s390mc->ri_allowed =3D true; s390mc->cpu_model_allowed =3D true; s390mc->css_migration_enabled =3D true; - s390mc->gs_allowed =3D true; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->hot_add_cpu =3D s390_hot_add_cpu; @@ -513,12 +512,6 @@ bool cpu_model_allowed(void) return get_machine_class()->cpu_model_allowed; } =20 -bool gs_allowed(void) -{ - /* for "none" machine this results in true */ - return get_machine_class()->gs_allowed; -} - static char *machine_get_loadparm(Object *obj, Error **errp) { S390CcwMachineState *ms =3D S390_CCW_MACHINE(obj); @@ -758,7 +751,6 @@ static void ccw_machine_2_9_class_options(MachineClass = *mc) { S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); =20 - s390mc->gs_allowed =3D false; ccw_machine_2_10_class_options(mc); SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); s390mc->css_migration_enabled =3D false; diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index a9a90c2..ac896e3 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -40,15 +40,12 @@ typedef struct S390CcwMachineClass { bool ri_allowed; bool cpu_model_allowed; bool css_migration_enabled; - bool gs_allowed; } S390CcwMachineClass; =20 /* runtime-instrumentation allowed by the machine */ bool ri_allowed(void); /* cpu model allowed by the machine */ bool cpu_model_allowed(void); -/* guarded-storage allowed by the machine */ -bool gs_allowed(void); =20 /** * Returns true if (vmstate based) migration of the channel subsystem diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 88f27d7..b03f583 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -306,7 +306,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_ri =3D 1; } } - if (gs_allowed()) { + if (cpu_model_allowed()) { if (kvm_vm_enable_cap(s, KVM_CAP_S390_GS, 0) =3D=3D 0) { cap_gs =3D 1; } diff --git a/target/s390x/machine.c b/target/s390x/machine.c index e1b7015..b78f326 100644 --- a/target/s390x/machine.c +++ b/target/s390x/machine.c @@ -180,7 +180,7 @@ const VMStateDescription vmstate_exval =3D { =20 static bool gscb_needed(void *opaque) { - return kvm_s390_get_gs(); + return s390_has_feat(S390_FEAT_GUARDED_STORAGE); } =20 const VMStateDescription vmstate_gscb =3D { --=20 2.9.4