From nobody Sat May 4 09:11:47 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 1506496967101539.7225349461785; Wed, 27 Sep 2017 00:22:47 -0700 (PDT) Received: from localhost ([::1]:52580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6g7-0002l9-A8 for importer@patchew.org; Wed, 27 Sep 2017 03:22:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6eC-0001Fq-Tk for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx6e9-0007c7-Nq for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx6e9-0007bk-Ei for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:41 -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 v8R7JZJH064751 for ; Wed, 27 Sep 2017 03:20:38 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d808abdj9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Sep 2017 03:20:37 -0400 Received: from localhost by e06smtp12.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 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; Wed, 27 Sep 2017 08:20:32 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8R7KVCY21102644; Wed, 27 Sep 2017 07:20:31 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C89511C04C; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7BA9911C04A; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 3FC3320F62D; Wed, 27 Sep 2017 09:20:31 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Wed, 27 Sep 2017 09:20:28 +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-0008-0000-0000-0000049A758C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092707-0009-0000-0000-00001E2BC278 Message-Id: <20170927072030.35737-2-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 1/3] s390x/cpumodel: remove ais from z14 default model-> also for 2.10.1 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 , 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" We disabled ais for 2.10 lets also remove it from the z14 default model. Fixes: 3f2d07b3b01e s390x/ais: for 2.10 stable: disable ais facility Signed-off-by: Christian Borntraeger --- target/s390x/gen-features.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index c8dc104..68e6c31 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -527,7 +527,6 @@ static uint16_t default_GEN13_GA1[] =3D { #define default_GEN13_GA2 EmptyFeat =20 static uint16_t default_GEN14_GA1[] =3D { - S390_FEAT_ADAPTER_INT_SUPPRESSION, S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_GUARDED_STORAGE, S390_FEAT_VECTOR_PACKED_DECIMAL, --=20 2.9.4 From nobody Sat May 4 09:11:47 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 1506496970877712.531790467807; Wed, 27 Sep 2017 00:22:50 -0700 (PDT) Received: from localhost ([::1]:52581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6g9-0002m3-2w for importer@patchew.org; Wed, 27 Sep 2017 03:22:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx6eG-0001I7-G1 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx6e9-0007cC-OE for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:48 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx6e9-0007bj-En for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:20:41 -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 v8R7JX0O064638 for ; Wed, 27 Sep 2017 03:20:38 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d808abdjb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 27 Sep 2017 03:20:38 -0400 Received: from localhost by e06smtp13.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 b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 27 Sep 2017 08:20:32 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8R7KWLj25100292; Wed, 27 Sep 2017 07:20:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F113011C054; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1A7B11C04A; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 27 Sep 2017 08:16:24 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 978A620F62C; Wed, 27 Sep 2017 09:20:31 +0200 (CEST) From: Christian Borntraeger To: Cornelia Huck Date: Wed, 27 Sep 2017 09:20:29 +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-0012-0000-0000-0000057C7E78 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092707-0013-0000-0000-000018F5CDF9 Message-Id: <20170927072030.35737-3-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 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: Alexander Graf , Thomas Huth , Yi Min Zhao , David Hildenbrand , Michael Roth , qemu-devel , 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" 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 (and cpu models). Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand --- hw/intc/s390_flic.c | 8 ++------ hw/intc/s390_flic_kvm.c | 16 +++++++++++----- hw/s390x/css.c | 4 ++-- hw/s390x/s390-virtio-ccw.c | 10 +++++++--- include/hw/s390x/s390_flic.h | 1 - target/s390x/kvm.c | 10 ++-------- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 6eaf178..9858f0e 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 IBM Corp. 2014, 2017 * Author(s): Jens Freimann * Cornelia Huck * @@ -136,9 +136,7 @@ static void qemu_s390_flic_reset(DeviceState *dev) =20 bool ais_needed(void *opaque) { - S390FLICState *s =3D opaque; - - return s->ais_supported; + return s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION); } =20 static const VMStateDescription qemu_s390_flic_vmstate =3D { @@ -185,8 +183,6 @@ static void s390_flic_common_realize(DeviceState *dev, = Error **errp) " (%d > %d)", max_batch, ADAPTER_ROUTES_MAX_GSI); return; } - - fs->ais_supported =3D s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION); } =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..0a370a9 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 IBM Corp. 2014, 2017 * Author(s): Jens Freimann * Cornelia Huck * @@ -164,7 +164,7 @@ static int kvm_s390_modify_ais_mode(S390FLICState *fs, = uint8_t isc, .addr =3D (uint64_t)&req, }; =20 - if (!fs->ais_supported) { + if (!s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION)) { return -ENOSYS; } =20 @@ -181,7 +181,7 @@ static int kvm_s390_inject_airq(S390FLICState *fs, uint= 8_t type, .attr =3D id, }; =20 - if (!fs->ais_supported) { + if (!s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION)) { return -ENOSYS; } =20 @@ -459,7 +459,7 @@ static int kvm_flic_ais_post_load(void *opaque, int ver= sion_id) * migration from a host that has AIS to a host that has no AIS. * In that case the target system will reject the migration here. */ - if (!ais_needed(flic)) { + if (!s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION)) { return -ENOSYS; } =20 @@ -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); @@ -578,7 +584,7 @@ static void kvm_s390_flic_reset(DeviceState *dev) =20 flic_disable_wait_pfault(flic); =20 - if (fs->ais_supported) { + if (s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION)) { for (isc =3D 0; isc <=3D MAX_ISC; isc++) { rc =3D kvm_s390_modify_ais_mode(fs, isc, SIC_IRQ_MODE_ALL); if (rc) { diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 75d4f30..1d4bb73 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -1,7 +1,7 @@ /* * Channel subsystem base support. * - * Copyright 2012 IBM Corp. + * Copyright IBM Corp. 2012, 2017 * Author(s): Cornelia Huck * * This work is licensed under the terms of the GNU GPL, version 2 or (at @@ -672,7 +672,7 @@ void css_adapter_interrupt(CssIoAdapterType type, uint8= _t isc) } =20 trace_css_adapter_interrupt(isc); - if (fs->ais_supported) { + if (s390_has_feat(S390_FEAT_ADAPTER_INT_SUPPRESSION)) { if (fsc->inject_airq(fs, type, isc, adapter->flags)) { error_report("Failed to inject airq with AIS supported"); exit(1); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fafbc6d..98c82c2 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -1,7 +1,7 @@ /* * virtio ccw machine * - * Copyright 2012 IBM Corp. + * Copyright IBM Corp. 2012, 2017 * Copyright (c) 2009 Alexander Graf * Author(s): Cornelia Huck * @@ -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..75fd83c 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -44,7 +44,6 @@ typedef struct S390FLICState { SysBusDevice parent_obj; /* to limit AdapterRoutes.num_routes for compat */ uint32_t adapter_routes_max_batch; - bool ais_supported; } S390FLICState; =20 #define S390_FLIC_COMMON_CLASS(klass) \ diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ebb75ca..9ee2ada 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2,7 +2,7 @@ * QEMU S390x KVM implementation * * Copyright (c) 2009 Alexander Graf - * Copyright IBM Corp. 2012 + * Copyright IBM Corp. 2012, 2017 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -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 09:11:47 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 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