From nobody Sat May 4 05:31:58 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1506069724864571.802927738396; Fri, 22 Sep 2017 01:42:04 -0700 (PDT) Received: from localhost ([::1]:57365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJWx-0007Om-Qg for importer@patchew.org; Fri, 22 Sep 2017 04:41:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJUM-0005TA-Iu for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvJUJ-0003uX-Ff for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dvJUJ-0003tl-6W for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:07 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8M8cwID093334 for ; Fri, 22 Sep 2017 04:39:02 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d4xnn1k9e-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 22 Sep 2017 04:39:02 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Sep 2017 09:38:59 +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; Fri, 22 Sep 2017 09:38:56 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8M8cuZF12452092; Fri, 22 Sep 2017 08:38:56 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDD1342042; Fri, 22 Sep 2017 09:35:04 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC75742041; Fri, 22 Sep 2017 09:35:04 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 22 Sep 2017 09:35:04 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id D846A20F62D; Fri, 22 Sep 2017 10:38:55 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Fri, 22 Sep 2017 10:38:53 +0200 X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170922083855.102341-1-borntraeger@de.ibm.com> References: <20170922083855.102341-1-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092208-0016-0000-0000-000004EF3F67 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092208-0017-0000-0000-000028297FCA Message-Id: <20170922083855.102341-2-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-22_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-1709220120 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/RFC 1/3] s390x/ais: disable ais facility as it is broken 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 , Yi Min Zhao , David Hildenbrand , qemu-devel , Alexander Graf , Christian Borntraeger , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The migration interface for ais was introduced with kernel 4.13 but the capability itself had been active since 4.12. As migration support is considered necessary lets disable ais in the 2.10 stable version. A proper fix and re-enablement will be done for qemu 2.11. Signed-off-by: Christian Borntraeger Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand --- target/s390x/kvm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 720cb1d..ebb75ca 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -311,8 +311,13 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } =20 - /* Try to enable AIS facility */ - kvm_vm_enable_cap(s, KVM_CAP_S390_AIS, 0); + /* + * The migration interface for ais was introduced with kernel 4.13 + * but the capability itself had been active since 4.12. As migration + * support is considered necessary let's disable ais in the 2.10 + * machine. + */ + /* kvm_vm_enable_cap(s, KVM_CAP_S390_AIS, 0); */ =20 qemu_mutex_init(&qemu_sigp_mutex); =20 --=20 2.9.4 From nobody Sat May 4 05:31:58 2024 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 150606965164563.553280937925706; Fri, 22 Sep 2017 01:40:51 -0700 (PDT) Received: from localhost ([::1]:57362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJVw-0006V5-Sj for importer@patchew.org; Fri, 22 Sep 2017 04:40:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJUM-0005TC-JD for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvJUJ-0003uY-Fh for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dvJUJ-0003tm-6l for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:07 -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 v8M8cwpY140374 for ; Fri, 22 Sep 2017 04:39:03 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d4xb5ad92-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 22 Sep 2017 04:39:02 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Sep 2017 09:39:00 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Sep 2017 09:38:57 +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 v8M8cu9E12452094; Fri, 22 Sep 2017 08:38:56 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 515F24C04E; Fri, 22 Sep 2017 09:35:18 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 389E14C044; Fri, 22 Sep 2017 09:35:18 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 22 Sep 2017 09:35:18 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 2AF9020F62C; Fri, 22 Sep 2017 10:38:56 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Fri, 22 Sep 2017 10:38:54 +0200 X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170922083855.102341-1-borntraeger@de.ibm.com> References: <20170922083855.102341-1-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092208-0020-0000-0000-000003BA3E25 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092208-0021-0000-0000-0000424C02A5 Message-Id: <20170922083855.102341-3-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-22_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-1709220120 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/RFC 2/3] s390x/ais: enable ais when migration is available 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 , Yi Min Zhao , David Hildenbrand , qemu-devel , Alexander Graf , Christian Borntraeger , "Jason J . Herne" , 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" Instead of unconditionally enabling the KVM AIS capability in the kvm arch init function, do this in the flic realize function when we know if migration is available. This requires to initialize flic before the CPUs. Signed-off-by: Christian Borntraeger --- hw/intc/s390_flic.c | 11 +++++++++-- hw/intc/s390_flic_kvm.c | 8 +++++++- hw/s390x/s390-virtio-ccw.c | 8 ++++++-- include/hw/s390x/s390_flic.h | 1 + target/s390x/cpu_models.c | 6 ++++++ target/s390x/kvm.c | 8 +------- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 6eaf178..08040fe 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -1,7 +1,7 @@ /* * QEMU S390x floating interrupt controller (flic) * - * Copyright 2014 IBM Corp. + * Copyright 2014,2017 IBM Corp. * Author(s): Jens Freimann * Cornelia Huck * @@ -49,6 +49,13 @@ void s390_flic_init(void) qdev_init_nofail(dev); } =20 +void s390_flic_enable_ais(void) +{ + S390FLICState *fs =3D s390_get_flic(); + + fs->ais_supported =3D true; +} + static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id, uint8_t isc, bool swap, bool is_maskable, uint8_t flags) @@ -186,7 +193,7 @@ static void s390_flic_common_realize(DeviceState *dev, = Error **errp) return; } =20 - fs->ais_supported =3D s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION); + fs->ais_supported =3D false; } =20 static void s390_flic_class_init(ObjectClass *oc, void *data) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 7ead17a..a655567 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -1,7 +1,7 @@ /* * QEMU S390x KVM floating interrupt controller (flic) * - * Copyright 2014 IBM Corp. + * Copyright 2014,2017 IBM Corp. * Author(s): Jens Freimann * Cornelia Huck * @@ -557,6 +557,12 @@ static void kvm_s390_flic_realize(DeviceState *dev, Er= ror **errp) test_attr.group =3D KVM_DEV_FLIC_CLEAR_IO_IRQ; flic_state->clear_io_supported =3D !ioctl(flic_state->fd, 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)) { + kvm_vm_enable_cap(kvm_state, KVM_CAP_S390_AIS, 0); + } + return; fail: error_propagate(errp, errp_local); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fafbc6d..11d4dc4 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -279,11 +279,15 @@ static void ccw_init(MachineState *machine) s390_sclp_init(); s390_memory_init(machine->ram_size); =20 + /* + * This might also enable some KVM features like AIS, so it must + * be called before the CPU model + */ + s390_flic_init(); + /* init CPUs (incl. CPU model) early so s390_has_feature() works */ s390_init_cpus(machine); =20 - s390_flic_init(); - /* get a BUS */ css_bus =3D virtual_css_bus_init(); s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 7aab6ef..ac4e170 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -90,6 +90,7 @@ void s390_flic_init(void); =20 S390FLICState *s390_get_flic(void); bool ais_needed(void *opaque); +void s390_flic_enable_ais(void); =20 #ifdef CONFIG_KVM DeviceState *s390_flic_kvm_create(void); diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 5169379..03ff583 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -23,6 +23,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qmp/qbool.h" #ifndef CONFIG_USER_ONLY +#include "hw/s390x/s390_flic.h" #include "sysemu/arch_init.h" #endif =20 @@ -901,6 +902,11 @@ static inline void apply_cpu_model(const S390CPUModel = *model, Error **errp) applied_model =3D *model; } } + + if (model && + test_bit(S390_FEAT_ADAPTER_INT_SUPPRESSION, model->features)) { + s390_flic_enable_ais(); + } #endif } =20 diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ebb75ca..6c5c57e 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -311,13 +311,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } =20 - /* - * The migration interface for ais was introduced with kernel 4.13 - * but the capability itself had been active since 4.12. As migration - * support is considered necessary let's disable ais in the 2.10 - * machine. - */ - /* kvm_vm_enable_cap(s, KVM_CAP_S390_AIS, 0); */ + /* The AIS enablement happens in the flic realize */ =20 qemu_mutex_init(&qemu_sigp_mutex); =20 --=20 2.9.4 From nobody Sat May 4 05:31:58 2024 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 15060698267681002.590066612584; Fri, 22 Sep 2017 01:43:46 -0700 (PDT) Received: from localhost ([::1]:57370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJYi-0000Uh-TY for importer@patchew.org; Fri, 22 Sep 2017 04:43:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dvJUN-0005Tl-Ay for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dvJUK-0003v8-85 for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:11 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43902) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dvJUJ-0003uP-Ud for qemu-devel@nongnu.org; Fri, 22 Sep 2017 04:39:08 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8M8cwJk090484 for ; Fri, 22 Sep 2017 04:39:02 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d4pnhhpkw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 22 Sep 2017 04:39:02 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Sep 2017 09:38:59 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Sep 2017 09:38:57 +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 v8M8cujJ21757970; Fri, 22 Sep 2017 08:38:56 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 980BF52041; Fri, 22 Sep 2017 08:33:52 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 776F75203F; Fri, 22 Sep 2017 08:33:52 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 7909020F62D; Fri, 22 Sep 2017 10:38:56 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Fri, 22 Sep 2017 10:38:55 +0200 X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170922083855.102341-1-borntraeger@de.ibm.com> References: <20170922083855.102341-1-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092208-0020-0000-0000-000003BA3E26 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092208-0021-0000-0000-0000424C02A6 Message-Id: <20170922083855.102341-4-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-22_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-1709220120 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/RFC 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: Halil Pasic , Yi Min Zhao , David Hildenbrand , qemu-devel , Alexander Graf , Christian Borntraeger , "Jason J . Herne" , "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: _snip_ error while loading state for instance 0x0 of device 's390-flic' _snip_ making the whole compat machine dis-functional. As a permanent fix, we need to fence the ais feature for machines <=3D 2.10 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 _snip_ 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 _snip_ 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 a655567..2a94bfc 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 11d4dc4..ce8391b 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