From nobody Mon Feb 9 20:32:25 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.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506496967221571.9027916558908; Wed, 27 Sep 2017 00:22:47 -0700 (PDT) Received: from localhost ([::1]:52579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6g4-0002it-DI for importer@patchew.org; Wed, 27 Sep 2017 03:22:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6eE-0001Gg-7u for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx6eB-0007cp-2U for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40204) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx6eA-0007cO-PO for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:42 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8R7KYvB140994 for ; Wed, 27 Sep 2017 03:20:38 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d806h3acp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Sep 2017 03:20:37 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Sep 2017 08:20:35 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 27 Sep 2017 08:20:32 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8R7KWnF19136616; Wed, 27 Sep 2017 07:20:32 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4557E52043; Wed, 27 Sep 2017 07:15:21 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 269675203F; Wed, 27 Sep 2017 07:15:21 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id E321C20F62D; Wed, 27 Sep 2017 09:20:31 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Wed, 27 Sep 2017 09:20:30 +0200 X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170927072030.35737-1-borntraeger@de.ibm.com> References: <20170927072030.35737-1-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092707-0040-0000-0000-000003FD732D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092707-0041-0000-0000-0000209EBFF0 Message-Id: <20170927072030.35737-4-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-27_02:, , 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-1707230000 definitions=main-1709270108 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 v3 3/3] s390x/ais: disable ais for 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: Alexander Graf , Thomas Huth , Yi Min Zhao , David Hildenbrand , Michael Roth , qemu-devel , Christian Borntraeger , Halil Pasic , "Dr. David Alan Gilbert" , 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" With newer kernels that do support the ais feature (4.13) a qemu 2.11 will not only enable the ais feature for the 2.11 machine, but also for a <=3D2.10 compat machine. As this feature is not available in QEMU <=3D2.9 (and QEMU 2.10.1), this guest will fail to migrate back to an older qemu like 2.9 with: error while loading state for instance 0x0 of device 's390-flic' making the whole compat machine dis-functional. As a permanent fix, we need to fence the ais feature for machines <=3D 2.10 similar to what we do for guarded storage, runtime instrumentation and css migration. Due to ais being enabled on 2.10.0 (fixed in 2.10.1) this will prevent migration of ais-enabled guests from 2.10.0 with qemu-system-s390x: Failed to load s390-flic/ais:tmp qemu-system-s390x: error while loading state for instance 0x0 of device 's3= 90-flic' qemu-system-s390x: load of migration failed: Function not implemented Signed-off-by: Christian Borntraeger Cc: Yi Min Zhao Cc: Dr. David Alan Gilbert --- hw/intc/s390_flic_kvm.c | 4 +++- hw/s390x/s390-virtio-ccw.c | 10 ++++++++++ include/hw/s390x/s390-virtio-ccw.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 0a370a9..fddda2b 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -22,6 +22,7 @@ #include "hw/s390x/s390_flic.h" #include "hw/s390x/adapter.h" #include "hw/s390x/css.h" +#include "hw/s390x/s390-virtio-ccw.h" #include "trace.h" =20 #define FLIC_SAVE_INITIAL_SIZE getpagesize() @@ -559,7 +560,8 @@ static void kvm_s390_flic_realize(DeviceState *dev, Err= or **errp) KVM_HAS_DEVICE_ATTR, test_attr= ); /* try enable the AIS facility */ test_attr.group =3D KVM_DEV_FLIC_AISM_ALL; - if (!ioctl(flic_state->fd, KVM_HAS_DEVICE_ATTR, test_attr)) { + if (ais_allowed() && + !ioctl(flic_state->fd, KVM_HAS_DEVICE_ATTR, test_attr)) { kvm_vm_enable_cap(kvm_state, KVM_CAP_S390_AIS, 0); } =20 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 98c82c2..41b770a 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -435,6 +435,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) s390mc->cpu_model_allowed =3D true; s390mc->css_migration_enabled =3D true; s390mc->gs_allowed =3D true; + s390mc->ais_allowed =3D true; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->hot_add_cpu =3D s390_hot_add_cpu; @@ -519,6 +520,11 @@ bool gs_allowed(void) return get_machine_class()->gs_allowed; } =20 +bool ais_allowed(void) +{ + return get_machine_class()->ais_allowed; +} + static char *machine_get_loadparm(Object *obj, Error **errp) { S390CcwMachineState *ms =3D S390_CCW_MACHINE(obj); @@ -742,6 +748,10 @@ static void ccw_machine_2_10_instance_options(MachineS= tate *machine) =20 static void ccw_machine_2_10_class_options(MachineClass *mc) { + S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); + + s390mc->ais_allowed =3D false; + ccw_machine_2_11_class_options(mc); SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10); } diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index a9a90c2..d25a98f 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -41,6 +41,7 @@ typedef struct S390CcwMachineClass { bool cpu_model_allowed; bool css_migration_enabled; bool gs_allowed; + bool ais_allowed; } S390CcwMachineClass; =20 /* runtime-instrumentation allowed by the machine */ @@ -49,6 +50,8 @@ bool ri_allowed(void); bool cpu_model_allowed(void); /* guarded-storage allowed by the machine */ bool gs_allowed(void); +/* ais allowed by the machine */ +bool ais_allowed(void); =20 /** * Returns true if (vmstate based) migration of the channel subsystem --=20 2.9.4