From nobody Wed May 1 09:14:50 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.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 1494005955666420.7374600994194; Fri, 5 May 2017 10:39:15 -0700 (PDT) Received: from localhost ([::1]:48324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hC8-0004IL-Bt for importer@patchew.org; Fri, 05 May 2017 13:39:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8U-00011V-UA for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8R-0005HD-Mg for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:22 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59484 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 1d6h8R-0005Gk-HL for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:19 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXliV108950 for ; Fri, 5 May 2017 13:35:18 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a8v0tw3g5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:18 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:16 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:13 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZC9P33488944; Fri, 5 May 2017 17:35:13 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFB9FAE051; Fri, 5 May 2017 18:33:38 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ABA2BAE045; Fri, 5 May 2017 18:33:38 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:38 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:34:58 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0016-0000-0000-00000493B811 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0017-0000-0000-0000278A8053 Message-Id: <20170505173507.74077-2-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 01/10] s390x: add helper get_machine_class 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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 will need the machine class at machine initialization time, so the usual way via qdev won't do. Let's cache the machine class and also use the default values of the base machine for capability discovery. Signed-off-by: Halil Pasic --- hw/s390x/s390-virtio-ccw.c | 46 +++++++++++++++++++++++-------------------= ---- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 04bd0eb..7a053a4 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -242,36 +242,35 @@ static inline void machine_set_dea_key_wrap(Object *o= bj, bool value, ms->dea_key_wrap =3D value; } =20 -bool ri_allowed(void) -{ - if (kvm_enabled()) { - MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine()); - if (object_class_dynamic_cast(OBJECT_CLASS(mc), - TYPE_S390_CCW_MACHINE)) { - S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); +static S390CcwMachineClass *current_mc; =20 - return s390mc->ri_allowed; - } +static S390CcwMachineClass *get_machine_class(void) +{ + if (unlikely(!current_mc)) { /* - * Make sure the "none" machine can have ri, otherwise it won't * = be - * unlocked in KVM and therefore the host CPU model might be wrong. - */ - return true; + * No s390 ccw machine was instantiated, we are likely to + * be called for the 'none' machine. The properties will + * have their after-initialization values. + */ + current_mc =3D S390_MACHINE_CLASS( + object_class_by_name(TYPE_S390_CCW_MACHINE)); } - return 0; + return current_mc; } =20 -bool cpu_model_allowed(void) +bool ri_allowed(void) { - MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine()); - if (object_class_dynamic_cast(OBJECT_CLASS(mc), - TYPE_S390_CCW_MACHINE)) { - S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); - - return s390mc->cpu_model_allowed; + if (!kvm_enabled()) { + return false; } - /* allow CPU model qmp queries with the "none" machine */ - return true; + /* for "none" machine this results in true */ + return get_machine_class()->ri_allowed; +} + +bool cpu_model_allowed(void) +{ + /* for "none" machine this results in true */ + return get_machine_class()->cpu_model_allowed; } =20 static inline void s390_machine_initfn(Object *obj) @@ -323,6 +322,7 @@ static const TypeInfo ccw_machine_info =3D { static void ccw_machine_##suffix##_instance_init(Object *obj) = \ { = \ MachineState *machine =3D MACHINE(obj); = \ + current_mc =3D S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); = \ ccw_machine_##suffix##_instance_options(machine); = \ } = \ static const TypeInfo ccw_machine_##suffix##_info =3D { = \ --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494006049191486.59968500656475; Fri, 5 May 2017 10:40:49 -0700 (PDT) Received: from localhost ([::1]:48336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hDc-0005PB-Q0 for importer@patchew.org; Fri, 05 May 2017 13:40:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8W-00011p-Cv for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8T-0005Hh-AH for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8T-0005HP-1M for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:21 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXqKa038250 for ; Fri, 5 May 2017 13:35:19 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8u4g8afy-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:19 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:17 +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; Fri, 5 May 2017 18:35:14 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZESP15991260; Fri, 5 May 2017 17:35:14 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D40AAE045; Fri, 5 May 2017 18:33:40 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3BD7AE055; Fri, 5 May 2017 18:33:39 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:39 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:34:59 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0012-0000-0000-00000522FABA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0013-0000-0000-000018594C36 Message-Id: <20170505173507.74077-3-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 02/10] s390x: add css_migration_enabled to machine class 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" Currently the migration of the channel subsystem (css) is only partial and is done by the virtio ccw proxies -- the only css devices existing at the moment. With the current efforts towards emulated and passthrough devices we need to improve on the migration of the css. This however will necessarily break the migration compatibility. So let us introduce a switch (at the machine class) and put it in off state for now. We will turn the switch on for future machines once all preparations are met. Signed-off-by: Halil Pasic --- hw/s390x/s390-virtio-ccw.c | 13 +++++++++++++ include/hw/s390x/s390-virtio-ccw.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 7a053a4..698e8fc 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -196,6 +196,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) =20 s390mc->ri_allowed =3D true; s390mc->cpu_model_allowed =3D true; + s390mc->css_migration_enabled =3D false; /* TODO: set to true */ mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->hot_add_cpu =3D s390_hot_add_cpu; @@ -307,6 +308,11 @@ static const TypeInfo ccw_machine_info =3D { }, }; =20 +bool css_migration_enabled(void) +{ + return get_machine_class()->css_migration_enabled; +} + #define DEFINE_CCW_MACHINE(suffix, verstr, latest) = \ static void ccw_machine_##suffix##_class_init(ObjectClass *oc, = \ void *data) = \ @@ -408,6 +414,10 @@ static const TypeInfo ccw_machine_info =3D { =20 static void ccw_machine_2_10_instance_options(MachineState *machine) { + /* + * TODO Once preparations are done register vmstate for the css if + * css_migration_enabled(). + */ } =20 static void ccw_machine_2_10_class_options(MachineClass *mc) @@ -422,8 +432,11 @@ static void ccw_machine_2_9_instance_options(MachineSt= ate *machine) =20 static void ccw_machine_2_9_class_options(MachineClass *mc) { + S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); + ccw_machine_2_10_class_options(mc); SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); + s390mc->css_migration_enabled =3D false; } DEFINE_CCW_MACHINE(2_9, "2.9", false); =20 diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index 6ecae00..b043550 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -37,6 +37,7 @@ typedef struct S390CcwMachineClass { /*< public >*/ bool ri_allowed; bool cpu_model_allowed; + bool css_migration_enabled; } S390CcwMachineClass; =20 /* runtime-instrumentation allowed by the machine */ @@ -44,4 +45,10 @@ bool ri_allowed(void); /* cpu model allowed by the machine */ bool cpu_model_allowed(void); =20 +/** + * Returns true if (vmstate based) migration of the channel subsystem + * is enabled, false if it is disabled. + */ +bool css_migration_enabled(void); + #endif --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494005957595160.65441165137463; Fri, 5 May 2017 10:39:17 -0700 (PDT) Received: from localhost ([::1]:48327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hCC-0004LV-3Q for importer@patchew.org; Fri, 05 May 2017 13:39:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8X-00012A-5H for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8T-0005Hy-Tn for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42642 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 1d6h8T-0005Hl-NE for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:21 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXl0B028360 for ; Fri, 5 May 2017 13:35:21 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a8vep3w47-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:20 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:18 +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; Fri, 5 May 2017 18:35:16 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZFe55833118; Fri, 5 May 2017 17:35:15 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60A5BAE055; Fri, 5 May 2017 18:33:41 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 277AFAE051; Fri, 5 May 2017 18:33:41 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:41 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:00 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0040-0000-0000-00000380B577 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0041-0000-0000-000025403AB0 Message-Id: <20170505173507.74077-4-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 03/10] s390x/css: add vmstate entities for css 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" As a preparation for switching to a vmstate based migration let us introduce vmstate entities (e.g. VMStateDescription) for the css entities to be migrated. Alongside some comments explaining or indicating the not migration of certain members are introduced too. No changes in behavior, we just added some dead code -- which should rise to life soon. Signed-off-by: Halil Pasic --- hw/s390x/css.c | 276 +++++++++++++++++++++++++++++++++++++++++++++= ++++ include/hw/s390x/css.h | 10 +- 2 files changed, 285 insertions(+), 1 deletion(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index c03bb20..2bda7d0 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -20,29 +20,231 @@ #include "hw/s390x/css.h" #include "trace.h" #include "hw/s390x/s390_flic.h" +#include "hw/s390x/s390-virtio-ccw.h" =20 typedef struct CrwContainer { CRW crw; QTAILQ_ENTRY(CrwContainer) sibling; } CrwContainer; =20 +static const VMStateDescription vmstate_crw =3D { + .name =3D "s390_crw", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT16(flags, CRW), + VMSTATE_UINT16(rsid, CRW), + VMSTATE_END_OF_LIST() + }, +}; + +static const VMStateDescription vmstate_crw_container =3D { + .name =3D "s390_crw_container", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT(crw, CrwContainer, 0, vmstate_crw, CRW), + VMSTATE_END_OF_LIST() + }, +}; + typedef struct ChpInfo { uint8_t in_use; uint8_t type; uint8_t is_virtual; } ChpInfo; =20 +static const VMStateDescription vmstate_chp_info =3D { + .name =3D "s390_chp_info", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(in_use, ChpInfo), + VMSTATE_UINT8(type, ChpInfo), + VMSTATE_UINT8(is_virtual, ChpInfo), + VMSTATE_END_OF_LIST() + } +}; + typedef struct SubchSet { SubchDev *sch[MAX_SCHID + 1]; unsigned long schids_used[BITS_TO_LONGS(MAX_SCHID + 1)]; unsigned long devnos_used[BITS_TO_LONGS(MAX_SCHID + 1)]; } SubchSet; =20 +static const VMStateDescription vmstate_scsw =3D { + .name =3D "s390_scsw", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT16(flags, SCSW), + VMSTATE_UINT16(ctrl, SCSW), + VMSTATE_UINT32(cpa, SCSW), + VMSTATE_UINT8(dstat, SCSW), + VMSTATE_UINT8(cstat, SCSW), + VMSTATE_UINT16(count, SCSW), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_pmcw =3D { + .name =3D "s390_pmcw", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(intparm, PMCW), + VMSTATE_UINT16(flags, PMCW), + VMSTATE_UINT16(devno, PMCW), + VMSTATE_UINT8(lpm, PMCW), + VMSTATE_UINT8(pnom, PMCW), + VMSTATE_UINT8(lpum, PMCW), + VMSTATE_UINT8(pim, PMCW), + VMSTATE_UINT16(mbi, PMCW), + VMSTATE_UINT8(pom, PMCW), + VMSTATE_UINT8(pam, PMCW), + VMSTATE_UINT8_ARRAY(chpid, PMCW, 8), + VMSTATE_UINT32(chars, PMCW), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_schib =3D { + .name =3D "s390_schib", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT(pmcw, SCHIB, 0, vmstate_pmcw, PMCW), + VMSTATE_STRUCT(scsw, SCHIB, 0, vmstate_scsw, SCSW), + VMSTATE_UINT64(mba, SCHIB), + VMSTATE_UINT8_ARRAY(mda, SCHIB, 4), + VMSTATE_END_OF_LIST() + } +}; + + +static const VMStateDescription vmstate_ccw1 =3D { + .name =3D "s390_ccw1", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(cmd_code, CCW1), + VMSTATE_UINT8(flags, CCW1), + VMSTATE_UINT16(count, CCW1), + VMSTATE_UINT32(cda, CCW1), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_ciw =3D { + .name =3D "s390_ciw", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(type, CIW), + VMSTATE_UINT8(command, CIW), + VMSTATE_UINT16(count, CIW), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_sense_id =3D { + .name =3D "s390_sense_id", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(reserved, SenseId), + VMSTATE_UINT16(cu_type, SenseId), + VMSTATE_UINT8(cu_model, SenseId), + VMSTATE_UINT16(dev_type, SenseId), + VMSTATE_UINT8(dev_model, SenseId), + VMSTATE_UINT8(unused, SenseId), + VMSTATE_STRUCT_ARRAY(ciw, SenseId, MAX_CIWS, 0, vmstate_ciw, CIW), + VMSTATE_END_OF_LIST() + } +}; + +static int subch_dev_post_load(void *opaque, int version_id); +static void subch_dev_pre_save(void *opaque); + +const VMStateDescription vmstate_subch_dev =3D { + .name =3D "s390_subch_dev", + .version_id =3D 1, + .minimum_version_id =3D 1, + .post_load =3D subch_dev_post_load, + .pre_save =3D subch_dev_pre_save, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8_EQUAL(cssid, SubchDev), + VMSTATE_UINT8_EQUAL(ssid, SubchDev), + VMSTATE_UINT16(migrated_schid, SubchDev), + VMSTATE_UINT16_EQUAL(devno, SubchDev), + VMSTATE_BOOL(thinint_active, SubchDev), + VMSTATE_STRUCT(curr_status, SubchDev, 0, vmstate_schib, SCHIB), + VMSTATE_UINT8_ARRAY(sense_data, SubchDev, 32), + VMSTATE_UINT64(channel_prog, SubchDev), + VMSTATE_STRUCT(last_cmd, SubchDev, 0, vmstate_ccw1, CCW1), + VMSTATE_BOOL(last_cmd_valid, SubchDev), + VMSTATE_STRUCT(id, SubchDev, 0, vmstate_sense_id, SenseId), + VMSTATE_BOOL(ccw_fmt_1, SubchDev), + VMSTATE_UINT8(ccw_no_data_cnt, SubchDev), + VMSTATE_END_OF_LIST() + } +}; + +static int css_get_ind_addr(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + int32_t len; + IndAddr **ind_addr =3D pv; + + len =3D qemu_get_be32(f); + if (len !=3D 0) { + *ind_addr =3D get_indicator(qemu_get_be64(f), len); + } else { + qemu_get_be64(f); + *ind_addr =3D NULL; + } + return 0; +} + +static int css_put_ind_addr(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) +{ + IndAddr *ind_addr =3D *(IndAddr **) pv; + + if (ind_addr !=3D NULL) { + qemu_put_be32(f, ind_addr->len); + qemu_put_be64(f, ind_addr->addr); + } else { + qemu_put_be32(f, 0); + qemu_put_be64(f, 0UL); + } + return 0; +} + +const VMStateInfo vmstate_info_ind_addr =3D { + .name =3D "s390_ind_addr", + .get =3D css_get_ind_addr, + .put =3D css_put_ind_addr +}; + typedef struct CssImage { SubchSet *sch_set[MAX_SSID + 1]; ChpInfo chpids[MAX_CHPID + 1]; } CssImage; =20 +static const VMStateDescription vmstate_css_img =3D { + .name =3D "s390_css_img", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + /* Subchannel sets have no relevant state. */ + VMSTATE_STRUCT_ARRAY(chpids, CssImage, MAX_CHPID + 1, 0, + vmstate_chp_info, ChpInfo), + VMSTATE_END_OF_LIST() + } + +}; + typedef struct IoAdapter { uint32_t id; uint8_t type; @@ -60,10 +262,34 @@ typedef struct ChannelSubSys { uint64_t chnmon_area; CssImage *css[MAX_CSSID + 1]; uint8_t default_cssid; + /* don't migrate */ IoAdapter *io_adapters[CSS_IO_ADAPTER_TYPE_NUMS][MAX_ISC + 1]; + /* don't migrate */ QTAILQ_HEAD(, IndAddr) indicator_addresses; } ChannelSubSys; =20 +static const VMStateDescription vmstate_css =3D { + .name =3D "s390_css", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_QTAILQ_V(pending_crws, ChannelSubSys, 1, vmstate_crw_conta= iner, + CrwContainer, sibling), + VMSTATE_BOOL(sei_pending, ChannelSubSys), + VMSTATE_BOOL(do_crw_mchk, ChannelSubSys), + VMSTATE_BOOL(crws_lost, ChannelSubSys), + /* These were kind of migrated by virtio */ + VMSTATE_UINT8(max_cssid, ChannelSubSys), + VMSTATE_UINT8(max_ssid, ChannelSubSys), + VMSTATE_BOOL(chnmon_active, ChannelSubSys), + VMSTATE_UINT64(chnmon_area, ChannelSubSys), + VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(css, ChannelSubSys, MAX_CSSID += 1, + 0, vmstate_css_img, CssImage), + VMSTATE_UINT8(default_cssid, ChannelSubSys), + VMSTATE_END_OF_LIST() + } +}; + static ChannelSubSys channel_subsys =3D { .pending_crws =3D QTAILQ_HEAD_INITIALIZER(channel_subsys.pending_crws), .do_crw_mchk =3D true, @@ -75,6 +301,56 @@ static ChannelSubSys channel_subsys =3D { QTAILQ_HEAD_INITIALIZER(channel_subsys.indicator_addresses), }; =20 +static void subch_dev_pre_save(void *opaque) +{ + SubchDev *s =3D opaque; + + /* Prepare remote_schid for save */ + s->migrated_schid =3D s->schid; +} + +static int subch_dev_post_load(void *opaque, int version_id) +{ + + SubchDev *s =3D opaque; + + /* Re-assign the subchannel to remote_schid if necessary */ + if (s->migrated_schid !=3D s->schid) { + if (css_find_subch(true, s->cssid, s->ssid, s->schid) =3D=3D s) { + /* + * Cleanup the slot before moving to s->migrated_schid provided + * it still belongs to us, i.e. it was not changed by previous + * invocation of this function. + */ + css_subch_assign(s->cssid, s->ssid, s->schid, s->devno, NULL); + } + /* It's OK to re-assign without a prior de-assign. */ + s->schid =3D s->migrated_schid; + css_subch_assign(s->cssid, s->ssid, s->schid, s->devno, s); + } + + if (css_migration_enabled()) { + /* No compat voodoo to do ;) */ + return 0; + } + /* + * Hack alert. If we don't migrate the channel subsystem status + * we still need to find out if the guest enabled mss/mcss-e. + * If the subchannel is enabled, it certainly was able to access it, + * so adjust the max_ssid/max_cssid values for relevant ssid/cssid + * values. This is not watertight, but better than nothing. + */ + if (s->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA) { + if (s->ssid) { + channel_subsys.max_ssid =3D MAX_SSID; + } + if (s->cssid !=3D channel_subsys.default_cssid) { + channel_subsys.max_cssid =3D MAX_CSSID; + } + } + return 0; +} + IndAddr *get_indicator(hwaddr ind_addr, int len) { IndAddr *indicator; diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index f1f0d7f..6a451b2 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -87,6 +87,7 @@ struct SubchDev { bool ccw_fmt_1; bool thinint_active; uint8_t ccw_no_data_cnt; + uint16_t migrated_schid; /* used for missmatch detection */ /* transport-provided data: */ int (*ccw_cb) (SubchDev *, CCW1); void (*disable_cb)(SubchDev *); @@ -94,14 +95,21 @@ struct SubchDev { void *driver_data; }; =20 +extern const VMStateDescription vmstate_subch_dev; + typedef struct IndAddr { hwaddr addr; uint64_t map; unsigned long refcnt; - int len; + int32_t len; QTAILQ_ENTRY(IndAddr) sibling; } IndAddr; =20 +extern const VMStateInfo vmstate_info_ind_addr; + +#define VMSTATE_PTR_TO_IND_ADDR(_f, _s) \ + VMSTATE_SINGLE(_f, _s, 1 , vmstate_info_ind_addr, IndAddr*) + IndAddr *get_indicator(hwaddr ind_addr, int len); void release_indicator(AdapterInfo *adapter, IndAddr *indicator); int map_indicator(AdapterInfo *adapter, IndAddr *indicator); --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494005826001788.9522540809869; Fri, 5 May 2017 10:37:06 -0700 (PDT) Received: from localhost ([::1]:48317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hA7-00022v-Hx for importer@patchew.org; Fri, 05 May 2017 13:37:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8W-00011x-SD for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8V-0005Ih-Ri for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8V-0005ID-Il for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:23 -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 v45HXwkp123420 for ; Fri, 5 May 2017 13:35:22 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8k777faj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:22 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:19 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:17 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZGXA39059618; Fri, 5 May 2017 17:35:16 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 97EFFAE058; Fri, 5 May 2017 18:33:42 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A9F1AE04D; Fri, 5 May 2017 18:33:42 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:42 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:01 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0016-0000-0000-00000493B816 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0017-0000-0000-0000278A805A Message-Id: <20170505173507.74077-5-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 04/10] s390x/css: add vmstate macro for CcwDevice 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" As a preparation for switching to a vmstate based migration let us introduce a vmstate macro for CcwDevice. No changes in behavior, we just added some dead code -- which should rise to life soon. Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- hw/s390x/ccw-device.c | 10 ++++++++++ hw/s390x/ccw-device.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index fb8d640..f9bfa15 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -50,6 +50,16 @@ static void ccw_device_class_init(ObjectClass *klass, vo= id *data) dc->props =3D ccw_device_properties; } =20 +const VMStateDescription vmstate_ccw_dev =3D { + .name =3D "s390_ccw_dev", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT_POINTER(sch, CcwDevice, vmstate_subch_dev, SubchDev= ), + VMSTATE_END_OF_LIST() + } +}; + static const TypeInfo ccw_device_info =3D { .name =3D TYPE_CCW_DEVICE, .parent =3D TYPE_DEVICE, diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h index 89c8e5d..4e6af28 100644 --- a/hw/s390x/ccw-device.h +++ b/hw/s390x/ccw-device.h @@ -27,6 +27,10 @@ typedef struct CcwDevice { CssDevId subch_id; } CcwDevice; =20 +extern const VMStateDescription vmstate_ccw_dev; +#define VMSTATE_CCW_DEVICE(_field, _state) \ + VMSTATE_STRUCT(_field, _state, 1, vmstate_ccw_dev, CcwDevice) + typedef struct CCWDeviceClass { DeviceClass parent_class; void (*unplug)(HotplugHandler *, DeviceState *, Error **); --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494006127317107.06438586757554; Fri, 5 May 2017 10:42:07 -0700 (PDT) Received: from localhost ([::1]:48341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hEx-0006Fh-RY for importer@patchew.org; Fri, 05 May 2017 13:42:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8Y-00013B-P4 for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8V-0005IZ-Lq for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40182) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8V-0005IB-Ce for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:23 -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 v45HXmXa118290 for ; Fri, 5 May 2017 13:35:22 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8nedj76f-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:22 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:19 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:18 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZI0835913744; Fri, 5 May 2017 17:35:18 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0882AE053; Fri, 5 May 2017 18:33:43 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A28E3AE051; Fri, 5 May 2017 18:33:43 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:43 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:02 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0008-0000-0000-0000043DBF9A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0009-0000-0000-00001D8D49F8 Message-Id: <20170505173507.74077-6-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 05/10] virtio-ccw: add vmstate entities for VirtioCcwDevice 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" As a preparation for a transition to a vmstate based migration let us introduce vmstate entities for VirtioCcwDevice and its members. This patch does not take care of config_vector which is common VirtIO state but not migrated by common VirtiIO code. No changes in behavior, we just added some dead code -- which should rise to life soon. Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- Note: In this patch series the config_vector issue is handled by the patch "virtio-ccw: use vmstate way for config migration". Further details there. --- hw/intc/s390_flic.c | 48 ++++++++++++++++++++++++++++++++++++++++= ++++ hw/s390x/virtio-ccw.c | 38 +++++++++++++++++++++++++++++++++++ include/hw/s390x/s390_flic.h | 5 +++++ 3 files changed, 91 insertions(+) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 711c114..b889e74 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -18,6 +18,7 @@ #include "trace.h" #include "hw/qdev.h" #include "qapi/error.h" +#include "hw/s390x/s390-virtio-ccw.h" =20 S390FLICState *s390_get_flic(void) { @@ -137,3 +138,50 @@ static void qemu_s390_flic_register_types(void) } =20 type_init(qemu_s390_flic_register_types) + +static bool adapter_info_so_needed(void *opaque) +{ + return css_migration_enabled(); +} + +const VMStateDescription vmstate_adapter_info_so =3D { + .name =3D "s390_adapter_info/summary_offset", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D adapter_info_so_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(summary_offset, AdapterInfo), + VMSTATE_END_OF_LIST() + } +}; + +const VMStateDescription vmstate_adapter_info =3D { + .name =3D "s390_adapter_info", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64(ind_offset, AdapterInfo), + /* + * We do not have to migrate neither the id nor the addresses. + * The id is set by css_register_io_adapter and the addresses + * are set based on the IndAddr objects after those get mapped. + */ + VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * []) { + &vmstate_adapter_info_so, + NULL + } +}; + +const VMStateDescription vmstate_adapter_routes =3D { + + .name =3D "s390_adapter_routes", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT(adapter, AdapterRoutes, 1, vmstate_adapter_info, \ + AdapterInfo), + VMSTATE_END_OF_LIST() + } +}; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index e7167e3..c2badfe 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -34,9 +34,47 @@ #include "virtio-ccw.h" #include "trace.h" #include "hw/s390x/css-bridge.h" +#include "hw/s390x/s390-virtio-ccw.h" =20 #define NR_CLASSIC_INDICATOR_BITS 64 =20 +static int virtio_ccw_dev_post_load(void *opaque, int version_id) +{ + VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(opaque); + CcwDevice *ccw_dev =3D CCW_DEVICE(dev); + CCWDeviceClass *ck =3D CCW_DEVICE_GET_CLASS(ccw_dev); + + ccw_dev->sch->driver_data =3D dev; + if (CCW_DEVICE(dev)->sch->thinint_active) { + dev->routes.adapter.adapter_id =3D css_get_adapter_id( + CSS_IO_ADAPTER_VIRTIO, + dev->thinint_isc); + } + /* Re-fill subch_id after loading the subchannel states.*/ + if (ck->refill_ids) { + ck->refill_ids(ccw_dev); + } + return 0; +} + +const VMStateDescription vmstate_virtio_ccw_dev =3D { + .name =3D "s390_virtio_ccw_dev", + .version_id =3D 1, + .minimum_version_id =3D 1, + .post_load =3D virtio_ccw_dev_post_load, + .fields =3D (VMStateField[]) { + VMSTATE_CCW_DEVICE(parent_obj, VirtioCcwDevice), + VMSTATE_PTR_TO_IND_ADDR(indicators, VirtioCcwDevice), + VMSTATE_PTR_TO_IND_ADDR(indicators2, VirtioCcwDevice), + VMSTATE_PTR_TO_IND_ADDR(summary_indicator, VirtioCcwDevice), + VMSTATE_STRUCT(routes, VirtioCcwDevice, 1, vmstate_adapter_routes,= \ + AdapterRoutes), + VMSTATE_UINT8(thinint_isc, VirtioCcwDevice), + VMSTATE_INT32(revision, VirtioCcwDevice), + VMSTATE_END_OF_LIST() + } +}; + static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size, VirtioCcwDevice *dev); =20 diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index f9e6890..caa6fc6 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -31,6 +31,11 @@ typedef struct AdapterRoutes { int gsi[ADAPTER_ROUTES_MAX_GSI]; } AdapterRoutes; =20 +extern const VMStateDescription vmstate_adapter_routes; + +#define VMSTATE_ADAPTER_ROUTES(_f, _s) \ + VMSTATE_STRUCT(_f, _s, 1, vmstate_adapter_routes, AdapterRoutes) + #define TYPE_S390_FLIC_COMMON "s390-flic" #define S390_FLIC_COMMON(obj) \ OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON) --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494006214240653.8151338947818; Fri, 5 May 2017 10:43:34 -0700 (PDT) Received: from localhost ([::1]:48344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hGK-0007i1-Vt for importer@patchew.org; Fri, 05 May 2017 13:43:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8c-00016F-0O for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8Z-0005LA-5e for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56317) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8Y-0005Jo-Ss for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:27 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXxJZ063544 for ; Fri, 5 May 2017 13:35:25 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8vvtas8j-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:25 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:23 +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; Fri, 5 May 2017 18:35:19 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZJkR19333566; Fri, 5 May 2017 17:35:19 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 152F3AE055; Fri, 5 May 2017 18:33:45 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAB73AE045; Fri, 5 May 2017 18:33:44 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:44 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:03 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0012-0000-0000-00000522FABF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0013-0000-0000-000018594C3F Message-Id: <20170505173507.74077-7-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 06/10] virtio-ccw: use vmstate way for config migration 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" Let us use the freshly introduced vmstate migration helpers instead of saving/loading the config manually. To achieve this we need to hack the config_vector which is a common VirtIO state in the middle of the VirtioCcwDevice state representation. This somewhat ugly but we have no choice because the stream format needs to be preserved. Still no changes in behavior, but the dead code we added previously is finally awakening to life. Signed-off-by: Halil Pasic --- --- hw/s390x/virtio-ccw.c | 116 +++++++++++++++++++---------------------------= ---- 1 file changed, 44 insertions(+), 72 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index c2badfe..8ab655c 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -57,6 +57,32 @@ static int virtio_ccw_dev_post_load(void *opaque, int ve= rsion_id) return 0; } =20 +static int get_config_vector(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + VirtioCcwDevice *dev =3D pv; + VirtIODevice *vdev =3D virtio_bus_get_device(&dev->bus); + + qemu_get_be16s(f, &vdev->config_vector); + return 0; +} + +static int put_config_vector(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) +{ + VirtioCcwDevice *dev =3D pv; + VirtIODevice *vdev =3D virtio_bus_get_device(&dev->bus); + + qemu_put_be16(f, vdev->config_vector); + return 0; +} + +const VMStateInfo vmstate_info_config_vector =3D { + .name =3D "config_vector", + .get =3D get_config_vector, + .put =3D put_config_vector, +}; + const VMStateDescription vmstate_virtio_ccw_dev =3D { .name =3D "s390_virtio_ccw_dev", .version_id =3D 1, @@ -67,6 +93,14 @@ const VMStateDescription vmstate_virtio_ccw_dev =3D { VMSTATE_PTR_TO_IND_ADDR(indicators, VirtioCcwDevice), VMSTATE_PTR_TO_IND_ADDR(indicators2, VirtioCcwDevice), VMSTATE_PTR_TO_IND_ADDR(summary_indicator, VirtioCcwDevice), + { + /* + * Ugly hack because VirtIODevice does not migrate itself. + * This also makes legacy via vmstate_save_state possible. + */ + .name =3D "virtio/config_vector", + .info =3D &vmstate_info_config_vector, + }, VMSTATE_STRUCT(routes, VirtioCcwDevice, 1, vmstate_adapter_routes,= \ AdapterRoutes), VMSTATE_UINT8(thinint_isc, VirtioCcwDevice), @@ -1272,85 +1306,23 @@ static int virtio_ccw_load_queue(DeviceState *d, in= t n, QEMUFile *f) static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); - CcwDevice *ccw_dev =3D CCW_DEVICE(d); - SubchDev *s =3D ccw_dev->sch; - VirtIODevice *vdev =3D virtio_ccw_get_vdev(s); =20 - subch_device_save(s, f); - if (dev->indicators !=3D NULL) { - qemu_put_be32(f, dev->indicators->len); - qemu_put_be64(f, dev->indicators->addr); - } else { - qemu_put_be32(f, 0); - qemu_put_be64(f, 0UL); - } - if (dev->indicators2 !=3D NULL) { - qemu_put_be32(f, dev->indicators2->len); - qemu_put_be64(f, dev->indicators2->addr); - } else { - qemu_put_be32(f, 0); - qemu_put_be64(f, 0UL); - } - if (dev->summary_indicator !=3D NULL) { - qemu_put_be32(f, dev->summary_indicator->len); - qemu_put_be64(f, dev->summary_indicator->addr); - } else { - qemu_put_be32(f, 0); - qemu_put_be64(f, 0UL); - } - qemu_put_be16(f, vdev->config_vector); - qemu_put_be64(f, dev->routes.adapter.ind_offset); - qemu_put_byte(f, dev->thinint_isc); - qemu_put_be32(f, dev->revision); + /* + * We save in legacy mode. The components take care of their own + * compat. representation (based on css_migration_enabled). + */ + vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL); } =20 static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); - CcwDevice *ccw_dev =3D CCW_DEVICE(d); - CCWDeviceClass *ck =3D CCW_DEVICE_GET_CLASS(ccw_dev); - SubchDev *s =3D ccw_dev->sch; - VirtIODevice *vdev =3D virtio_ccw_get_vdev(s); - int len; - - s->driver_data =3D dev; - subch_device_load(s, f); - /* Re-fill subch_id after loading the subchannel states.*/ - if (ck->refill_ids) { - ck->refill_ids(ccw_dev); - } - len =3D qemu_get_be32(f); - if (len !=3D 0) { - dev->indicators =3D get_indicator(qemu_get_be64(f), len); - } else { - qemu_get_be64(f); - dev->indicators =3D NULL; - } - len =3D qemu_get_be32(f); - if (len !=3D 0) { - dev->indicators2 =3D get_indicator(qemu_get_be64(f), len); - } else { - qemu_get_be64(f); - dev->indicators2 =3D NULL; - } - len =3D qemu_get_be32(f); - if (len !=3D 0) { - dev->summary_indicator =3D get_indicator(qemu_get_be64(f), len); - } else { - qemu_get_be64(f); - dev->summary_indicator =3D NULL; - } - qemu_get_be16s(f, &vdev->config_vector); - dev->routes.adapter.ind_offset =3D qemu_get_be64(f); - dev->thinint_isc =3D qemu_get_byte(f); - dev->revision =3D qemu_get_be32(f); - if (s->thinint_active) { - dev->routes.adapter.adapter_id =3D css_get_adapter_id( - CSS_IO_ADAPTER_VIRTIO, - dev->thinint_isc); - } =20 - return 0; + /* + * We load in legacy mode. The components take take care to read + * only stuff which is actually there (based on css_migration_enabled). + */ + return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1); } =20 static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp) --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 149400584630899.18818757047802; Fri, 5 May 2017 10:37:26 -0700 (PDT) Received: from localhost ([::1]:48318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hAP-0002FI-P2 for importer@patchew.org; Fri, 05 May 2017 13:37:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8c-00016E-0E for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8Z-0005LN-Ca for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49320) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8Z-0005Ko-4g for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:27 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXnpb023806 for ; Fri, 5 May 2017 13:35:26 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8v0pw9m9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:25 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:23 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:20 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZKvj50069644; Fri, 5 May 2017 17:35:20 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D407AE04D; Fri, 5 May 2017 18:33:46 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1F210AE045; Fri, 5 May 2017 18:33:46 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:46 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:04 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0012-0000-0000-00000522FAC1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0013-0000-0000-000018594C44 Message-Id: <20170505173507.74077-8-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 07/10] s390x/css: remove unused subch_dev_(load|save) 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" Since the functions subch_dev_load and subch_dev save are not used any more let's remove them. Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- hw/s390x/css.c | 143 ---------------------------------------------= ---- include/hw/s390x/css.h | 2 - 2 files changed, 145 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 2bda7d0..94338b2 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -1914,149 +1914,6 @@ int css_enable_mss(void) return 0; } =20 -void subch_device_save(SubchDev *s, QEMUFile *f) -{ - int i; - - qemu_put_byte(f, s->cssid); - qemu_put_byte(f, s->ssid); - qemu_put_be16(f, s->schid); - qemu_put_be16(f, s->devno); - qemu_put_byte(f, s->thinint_active); - /* SCHIB */ - /* PMCW */ - qemu_put_be32(f, s->curr_status.pmcw.intparm); - qemu_put_be16(f, s->curr_status.pmcw.flags); - qemu_put_be16(f, s->curr_status.pmcw.devno); - qemu_put_byte(f, s->curr_status.pmcw.lpm); - qemu_put_byte(f, s->curr_status.pmcw.pnom); - qemu_put_byte(f, s->curr_status.pmcw.lpum); - qemu_put_byte(f, s->curr_status.pmcw.pim); - qemu_put_be16(f, s->curr_status.pmcw.mbi); - qemu_put_byte(f, s->curr_status.pmcw.pom); - qemu_put_byte(f, s->curr_status.pmcw.pam); - qemu_put_buffer(f, s->curr_status.pmcw.chpid, 8); - qemu_put_be32(f, s->curr_status.pmcw.chars); - /* SCSW */ - qemu_put_be16(f, s->curr_status.scsw.flags); - qemu_put_be16(f, s->curr_status.scsw.ctrl); - qemu_put_be32(f, s->curr_status.scsw.cpa); - qemu_put_byte(f, s->curr_status.scsw.dstat); - qemu_put_byte(f, s->curr_status.scsw.cstat); - qemu_put_be16(f, s->curr_status.scsw.count); - qemu_put_be64(f, s->curr_status.mba); - qemu_put_buffer(f, s->curr_status.mda, 4); - /* end SCHIB */ - qemu_put_buffer(f, s->sense_data, 32); - qemu_put_be64(f, s->channel_prog); - /* last cmd */ - qemu_put_byte(f, s->last_cmd.cmd_code); - qemu_put_byte(f, s->last_cmd.flags); - qemu_put_be16(f, s->last_cmd.count); - qemu_put_be32(f, s->last_cmd.cda); - qemu_put_byte(f, s->last_cmd_valid); - qemu_put_byte(f, s->id.reserved); - qemu_put_be16(f, s->id.cu_type); - qemu_put_byte(f, s->id.cu_model); - qemu_put_be16(f, s->id.dev_type); - qemu_put_byte(f, s->id.dev_model); - qemu_put_byte(f, s->id.unused); - for (i =3D 0; i < ARRAY_SIZE(s->id.ciw); i++) { - qemu_put_byte(f, s->id.ciw[i].type); - qemu_put_byte(f, s->id.ciw[i].command); - qemu_put_be16(f, s->id.ciw[i].count); - } - qemu_put_byte(f, s->ccw_fmt_1); - qemu_put_byte(f, s->ccw_no_data_cnt); -} - -int subch_device_load(SubchDev *s, QEMUFile *f) -{ - SubchDev *old_s; - uint16_t old_schid =3D s->schid; - int i; - - 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); - /* Re-assign subch. */ - if (old_schid !=3D s->schid) { - old_s =3D channel_subsys.css[s->cssid]->sch_set[s->ssid]->sch[old_= schid]; - /* - * (old_s !=3D s) means that some other device has its correct - * subchannel already assigned (in load). - */ - if (old_s =3D=3D s) { - css_subch_assign(s->cssid, s->ssid, old_schid, s->devno, NULL); - } - /* It's OK to re-assign without a prior de-assign. */ - css_subch_assign(s->cssid, s->ssid, s->schid, s->devno, s); - } - s->thinint_active =3D qemu_get_byte(f); - /* SCHIB */ - /* PMCW */ - s->curr_status.pmcw.intparm =3D qemu_get_be32(f); - s->curr_status.pmcw.flags =3D qemu_get_be16(f); - s->curr_status.pmcw.devno =3D qemu_get_be16(f); - s->curr_status.pmcw.lpm =3D qemu_get_byte(f); - s->curr_status.pmcw.pnom =3D qemu_get_byte(f); - s->curr_status.pmcw.lpum =3D qemu_get_byte(f); - s->curr_status.pmcw.pim =3D qemu_get_byte(f); - s->curr_status.pmcw.mbi =3D qemu_get_be16(f); - s->curr_status.pmcw.pom =3D qemu_get_byte(f); - s->curr_status.pmcw.pam =3D qemu_get_byte(f); - qemu_get_buffer(f, s->curr_status.pmcw.chpid, 8); - s->curr_status.pmcw.chars =3D qemu_get_be32(f); - /* SCSW */ - s->curr_status.scsw.flags =3D qemu_get_be16(f); - s->curr_status.scsw.ctrl =3D qemu_get_be16(f); - s->curr_status.scsw.cpa =3D qemu_get_be32(f); - s->curr_status.scsw.dstat =3D qemu_get_byte(f); - s->curr_status.scsw.cstat =3D qemu_get_byte(f); - s->curr_status.scsw.count =3D qemu_get_be16(f); - s->curr_status.mba =3D qemu_get_be64(f); - qemu_get_buffer(f, s->curr_status.mda, 4); - /* end SCHIB */ - qemu_get_buffer(f, s->sense_data, 32); - s->channel_prog =3D qemu_get_be64(f); - /* last cmd */ - s->last_cmd.cmd_code =3D qemu_get_byte(f); - s->last_cmd.flags =3D qemu_get_byte(f); - s->last_cmd.count =3D qemu_get_be16(f); - s->last_cmd.cda =3D qemu_get_be32(f); - s->last_cmd_valid =3D qemu_get_byte(f); - s->id.reserved =3D qemu_get_byte(f); - s->id.cu_type =3D qemu_get_be16(f); - s->id.cu_model =3D qemu_get_byte(f); - s->id.dev_type =3D qemu_get_be16(f); - s->id.dev_model =3D qemu_get_byte(f); - s->id.unused =3D qemu_get_byte(f); - for (i =3D 0; i < ARRAY_SIZE(s->id.ciw); i++) { - s->id.ciw[i].type =3D qemu_get_byte(f); - s->id.ciw[i].command =3D qemu_get_byte(f); - s->id.ciw[i].count =3D qemu_get_be16(f); - } - s->ccw_fmt_1 =3D qemu_get_byte(f); - s->ccw_no_data_cnt =3D qemu_get_byte(f); - /* - * Hack alert. We don't migrate the channel subsystem status (no - * device!), but we need to find out if the guest enabled mss/mcss-e. - * If the subchannel is enabled, it certainly was able to access it, - * so adjust the max_ssid/max_cssid values for relevant ssid/cssid - * values. This is not watertight, but better than nothing. - */ - if (s->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA) { - if (s->ssid) { - channel_subsys.max_ssid =3D MAX_SSID; - } - if (s->cssid !=3D channel_subsys.default_cssid) { - channel_subsys.max_cssid =3D MAX_CSSID; - } - } - return 0; -} - void css_reset_sch(SubchDev *sch) { PMCW *p =3D &sch->curr_status.pmcw; diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index 6a451b2..e67ac5c 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -116,8 +116,6 @@ int map_indicator(AdapterInfo *adapter, IndAddr *indica= tor); =20 typedef SubchDev *(*css_subch_cb_func)(uint8_t m, uint8_t cssid, uint8_t s= sid, uint16_t schid); -void subch_device_save(SubchDev *s, QEMUFile *f); -int subch_device_load(SubchDev *s, QEMUFile *f); int css_create_css_image(uint8_t cssid, bool default_image); bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno); void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid, --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494006274267804.808243006518; Fri, 5 May 2017 10:44:34 -0700 (PDT) Received: from localhost ([::1]:48346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hHK-0008Eu-M3 for importer@patchew.org; Fri, 05 May 2017 13:44:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8c-00016u-SF for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8Z-0005LU-Pw for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:30 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47904 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 1d6h8Z-0005LF-Jx for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:27 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXoxd126831 for ; Fri, 5 May 2017 13:35:27 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a8rx2fnnp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:26 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:25 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:22 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZLg239583964; Fri, 5 May 2017 17:35:21 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85540AE053; Fri, 5 May 2017 18:33:47 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 578C4AE051; Fri, 5 May 2017 18:33:47 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:47 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:05 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0016-0000-0000-00000493B818 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0017-0000-0000-0000278A8063 Message-Id: <20170505173507.74077-9-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 08/10] s390x/css: add ORB to SubchDev 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" Since we are going to need a migration compatibility breaking change to activate ChannelSubSys migration let us use the opportunity to introduce ORB to the SubchDev before that (otherwise we would need separate handling e.g. a compat property). The ORB will be useful for implementing IDA, or async handling of subchannel work. Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- hw/s390x/css.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/s390x/css.h | 1 + 2 files changed, 36 insertions(+) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 94338b2..d9a0fb9 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -163,6 +163,36 @@ static const VMStateDescription vmstate_sense_id =3D { } }; =20 +static const VMStateDescription vmstate_orb =3D { + .name =3D "s390_orb", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(intparm, ORB), + VMSTATE_UINT16(ctrl0, ORB), + VMSTATE_UINT8(lpm, ORB), + VMSTATE_UINT8(ctrl1, ORB), + VMSTATE_UINT32(cpa, ORB), + VMSTATE_END_OF_LIST() + } +}; + +static bool vmstate_schdev_orb_needed(void *opaque) +{ + return css_migration_enabled(); +} + +static const VMStateDescription vmstate_schdev_orb =3D { + .name =3D "s390_subch_dev/orb", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D vmstate_schdev_orb_needed, + .fields =3D (VMStateField[]) { + VMSTATE_STRUCT(orb, SubchDev, 1, vmstate_orb, ORB), + VMSTATE_END_OF_LIST() + } +}; + static int subch_dev_post_load(void *opaque, int version_id); static void subch_dev_pre_save(void *opaque); =20 @@ -187,6 +217,10 @@ const VMStateDescription vmstate_subch_dev =3D { VMSTATE_BOOL(ccw_fmt_1, SubchDev), VMSTATE_UINT8(ccw_no_data_cnt, SubchDev), VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * []) { + &vmstate_schdev_orb, + NULL } }; =20 @@ -1234,6 +1268,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb) if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } + sch->orb =3D *orb; sch->channel_prog =3D orb->cpa; /* Trigger the start function. */ s->ctrl |=3D (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND); diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index e67ac5c..dbe093e 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -88,6 +88,7 @@ struct SubchDev { bool thinint_active; uint8_t ccw_no_data_cnt; uint16_t migrated_schid; /* used for missmatch detection */ + ORB orb; /* transport-provided data: */ int (*ccw_cb) (SubchDev *, CCW1); void (*disable_cb)(SubchDev *); --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 1494006048886107.98697749215; Fri, 5 May 2017 10:40:48 -0700 (PDT) Received: from localhost ([::1]:48337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hDh-0005SC-Jl for importer@patchew.org; Fri, 05 May 2017 13:40:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8e-00017x-62 for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8b-0005M1-2v for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6h8a-0005Lk-QS for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:29 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v45HXl4o023687 for ; Fri, 5 May 2017 13:35:27 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a8v0pw9n5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:27 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:24 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 May 2017 18:35:23 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZNsD38600738; Fri, 5 May 2017 17:35:23 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD5BCAE056; Fri, 5 May 2017 18:33:48 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F7F6AE051; Fri, 5 May 2017 18:33:48 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:48 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:06 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0008-0000-0000-0000043DBF9B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0009-0000-0000-00001D8D49FD Message-Id: <20170505173507.74077-10-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 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 09/10] s390x/css: turn on channel subsystem migration 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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" Turn on migration for the channel subsystem and the new scheme for migrating virtio-ccw proxy devices (instead of letting the transport independent child device migrate it's proxy, use the usual DeviceClass.vmsd mechanism) for future machine versions. The vmstate based migration of the channel subsystem is not migration stream compatible with the method for handling migration of legacy machines. Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- hw/s390x/ccw-device.c | 1 + hw/s390x/css.c | 5 +++++ hw/s390x/s390-virtio-ccw.c | 9 ++++----- hw/s390x/virtio-ccw.c | 14 ++++++++++++++ include/hw/s390x/css.h | 4 ++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index f9bfa15..3b5df03 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -48,6 +48,7 @@ static void ccw_device_class_init(ObjectClass *klass, voi= d *data) k->realize =3D ccw_device_realize; k->refill_ids =3D ccw_device_refill_ids; dc->props =3D ccw_device_properties; + dc->vmsd =3D &vmstate_ccw_dev; } =20 const VMStateDescription vmstate_ccw_dev =3D { diff --git a/hw/s390x/css.c b/hw/s390x/css.c index d9a0fb9..b58832a 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -385,6 +385,11 @@ static int subch_dev_post_load(void *opaque, int versi= on_id) return 0; } =20 +void css_register_vmstate(void) +{ + vmstate_register(NULL, 0, &vmstate_css, &channel_subsys); +} + IndAddr *get_indicator(hwaddr ind_addr, int len) { IndAddr *indicator; diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 698e8fc..5307f59 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -196,7 +196,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) =20 s390mc->ri_allowed =3D true; s390mc->cpu_model_allowed =3D true; - s390mc->css_migration_enabled =3D false; /* TODO: set to true */ + s390mc->css_migration_enabled =3D true; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->hot_add_cpu =3D s390_hot_add_cpu; @@ -414,10 +414,9 @@ bool css_migration_enabled(void) =20 static void ccw_machine_2_10_instance_options(MachineState *machine) { - /* - * TODO Once preparations are done register vmstate for the css if - * css_migration_enabled(). - */ + if (css_migration_enabled()) { + css_register_vmstate(); + } } =20 static void ccw_machine_2_10_class_options(MachineClass *mc) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 8ab655c..c611b6f 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1307,6 +1307,10 @@ static void virtio_ccw_save_config(DeviceState *d, Q= EMUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); =20 + if (css_migration_enabled()) { + /* we migrate via DeviceClass.vmsd */ + return; + } /* * We save in legacy mode. The components take care of their own * compat. representation (based on css_migration_enabled). @@ -1318,6 +1322,10 @@ static int virtio_ccw_load_config(DeviceState *d, QE= MUFile *f) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); =20 + if (css_migration_enabled()) { + /* we migrate via DeviceClass.vmsd */ + return 0; + } /* * We load in legacy mode. The components take take care to read * only stuff which is actually there (based on css_migration_enabled). @@ -1365,6 +1373,11 @@ static void virtio_ccw_device_plugged(DeviceState *d= , Error **errp) sch->id.cu_model =3D virtio_bus_get_vdev_id(&dev->bus); =20 =20 + /* Avoid generating unknown section for legacy migration target. */ + if (!css_migration_enabled()) { + DEVICE_GET_CLASS(ccw_dev)->vmsd =3D NULL; + } + css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, d->hotplugged, 1); } @@ -1657,6 +1670,7 @@ static void virtio_ccw_device_class_init(ObjectClass = *klass, void *data) dc->realize =3D virtio_ccw_busdev_realize; dc->exit =3D virtio_ccw_busdev_exit; dc->bus_type =3D TYPE_VIRTUAL_CSS_BUS; + dc->vmsd =3D &vmstate_virtio_ccw_dev; } =20 static const TypeInfo virtio_ccw_device_info =3D { diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index dbe093e..be5eb81 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -207,4 +207,8 @@ extern PropertyInfo css_devid_ro_propinfo; * is responsible for unregistering and freeing it. */ SubchDev *css_create_virtual_sch(CssDevId bus_id, Error **errp); + +/** Turn on css migration */ +void css_register_vmstate(void); + #endif --=20 2.10.2 From nobody Wed May 1 09:14:50 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.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 149400589992041.8785289834243; Fri, 5 May 2017 10:38:19 -0700 (PDT) Received: from localhost ([::1]:48321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6hBH-0003H6-IT for importer@patchew.org; Fri, 05 May 2017 13:38:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6h8g-00019R-3U for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6h8d-0005Ma-3P for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54850 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 1d6h8c-0005MN-Tk for qemu-devel@nongnu.org; Fri, 05 May 2017 13:35:31 -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 v45HXlfi099553 for ; Fri, 5 May 2017 13:35:30 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a8wru8dn9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 May 2017 13:35:29 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 May 2017 18:35:27 +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; Fri, 5 May 2017 18:35:24 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v45HZOAw20840808; Fri, 5 May 2017 17:35:24 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED641AE051; Fri, 5 May 2017 18:33:49 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7AA4AE045; Fri, 5 May 2017 18:33:49 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 5 May 2017 18:33:49 +0100 (BST) From: Halil Pasic To: Cornelia Huck Date: Fri, 5 May 2017 19:35:07 +0200 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> References: <20170505173507.74077-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17050517-0008-0000-0000-0000043DBF9E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050517-0009-0000-0000-00001D8D4A00 Message-Id: <20170505173507.74077-11-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-05_14:, , 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-1705050172 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 10/10] s390x/css: use SubchDev.orb 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: qemu-devel@nongnu.org, Halil Pasic , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" 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 passing around a pointer to ORB let us simplify some functions signatures by using the previously introduced ORB saved at the subchannel (SubchDev). Signed-off-by: Halil Pasic Reviewed-by: Guenther Hutzl --- hw/s390x/css.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index b58832a..694365b 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -838,7 +838,7 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_= addr, return ret; } =20 -static void sch_handle_start_func(SubchDev *sch, ORB *orb) +static void sch_handle_start_func(SubchDev *sch) { =20 PMCW *p =3D &sch->curr_status.pmcw; @@ -852,10 +852,10 @@ static void sch_handle_start_func(SubchDev *sch, ORB = *orb) =20 if (!(s->ctrl & SCSW_ACTL_SUSP)) { /* Start Function triggered via ssch, i.e. we have an ORB */ + ORB *orb =3D &sch->orb; s->cstat =3D 0; s->dstat =3D 0; /* Look at the orb and try to execute the channel program. */ - assert(orb !=3D NULL); /* resume does not pass an orb */ p->intparm =3D orb->intparm; if (!(orb->lpm & path)) { /* Generate a deferred cc 3 condition. */ @@ -869,8 +869,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *o= rb) sch->ccw_no_data_cnt =3D 0; suspend_allowed =3D !!(orb->ctrl0 & ORB_CTRL0_MASK_SPND); } else { - /* Start Function resumed via rsch, i.e. we don't have an - * ORB */ + /* Start Function resumed via rsch */ s->ctrl &=3D ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); /* The channel program had been suspended before. */ suspend_allowed =3D true; @@ -943,7 +942,7 @@ static void sch_handle_start_func(SubchDev *sch, ORB *o= rb) * read/writes) asynchronous later on if we start supporting more than * our current very simple devices. */ -static void do_subchannel_work(SubchDev *sch, ORB *orb) +static void do_subchannel_work(SubchDev *sch) { =20 SCSW *s =3D &sch->curr_status.scsw; @@ -954,7 +953,7 @@ static void do_subchannel_work(SubchDev *sch, ORB *orb) sch_handle_halt_func(sch); } else if (s->ctrl & SCSW_FCTL_START_FUNC) { /* Triggered by both ssch and rsch. */ - sch_handle_start_func(sch, orb); + sch_handle_start_func(sch); } else { /* Cannot happen. */ return; @@ -1163,7 +1162,7 @@ int css_do_csch(SubchDev *sch) s->ctrl &=3D ~(SCSW_CTRL_MASK_FCTL | SCSW_CTRL_MASK_ACTL); s->ctrl |=3D SCSW_FCTL_CLEAR_FUNC | SCSW_ACTL_CLEAR_PEND; =20 - do_subchannel_work(sch, NULL); + do_subchannel_work(sch); ret =3D 0; =20 out: @@ -1204,7 +1203,7 @@ int css_do_hsch(SubchDev *sch) } s->ctrl |=3D SCSW_ACTL_HALT_PEND; =20 - do_subchannel_work(sch, NULL); + do_subchannel_work(sch); ret =3D 0; =20 out: @@ -1279,7 +1278,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb) s->ctrl |=3D (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND); s->flags &=3D ~SCSW_FLAGS_MASK_PNO; =20 - do_subchannel_work(sch, orb); + do_subchannel_work(sch); ret =3D 0; =20 out: @@ -1559,7 +1558,7 @@ int css_do_rsch(SubchDev *sch) } =20 s->ctrl |=3D SCSW_ACTL_RESUME_PEND; - do_subchannel_work(sch, NULL); + do_subchannel_work(sch); ret =3D 0; =20 out: --=20 2.10.2