From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532571159757.3538438636103; Thu, 8 Mar 2018 10:09:31 -0800 (PST) Received: from localhost ([::1]:40685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzys-0000gO-Cw for importer@patchew.org; Thu, 08 Mar 2018 13:09:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuF-0005NG-Vk for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuC-0005xV-Ro for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:43 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55816 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuC-0005x3-MF; Thu, 08 Mar 2018 13:04:40 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 065DF4023BB3; Thu, 8 Mar 2018 18:04:36 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC1DA202322A; Thu, 8 Mar 2018 18:04:35 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:13 +0100 Message-Id: <20180308180423.941-2-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:36 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 01/11] hw/s390x/ipl: Bail out if the network bootloader can not be found 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Thomas Huth If QEMU fails to load 's390-netboot.img', the guest firmware currently loops forever and just floods the console with "Network boot device detected" messages. The code in ipl.c apparently already tried to stop the VM with vm_stop() in this case, but this is in vain since the run state is later reset due to a call to vm_start() from vl.c again. To avoid the ugly firmware loop, let's simply exit QEMU directly instead since it just does not make sense to continue if the required firmware image can not be loaded. While we're at it, also add the file name of the netboot binary to the error message, so that the user has a better hint about what is missing. Signed-off-by: Thomas Huth Message-Id: <1519725913-24852-1-git-send-email-thuth@redhat.com> Reviewed-by: David Hildenbrand Reviewed-by: Farhan Ali Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 798e99aadf..8512aaacf7 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -380,7 +380,8 @@ static int load_netboot_image(Error **errp) =20 netboot_filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->netboot_= fw); if (netboot_filename =3D=3D NULL) { - error_setg(errp, "Could not find network bootloader"); + error_setg(errp, "Could not find network bootloader '%s'", + ipl->netboot_fw); goto unref_mr; } =20 @@ -489,7 +490,7 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) if (ipl->netboot) { if (load_netboot_image(&err) < 0) { error_report_err(err); - vm_stop(RUN_STATE_INTERNAL_ERROR); + exit(1); } ipl->qipl.netboot_start_addr =3D cpu_to_be64(ipl->start_addr); } --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532417491786.8075324236643; Thu, 8 Mar 2018 10:06:57 -0800 (PST) Received: from localhost ([::1]:40671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzwK-0006kr-J9 for importer@patchew.org; Thu, 08 Mar 2018 13:06:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuF-0005NH-W2 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuC-0005xN-OL for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:43 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40738 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuC-0005x2-Jm; Thu, 08 Mar 2018 13:04:40 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A222DD1446; Thu, 8 Mar 2018 18:04:39 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50A7D10A85AE; Thu, 8 Mar 2018 18:04:37 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:14 +0100 Message-Id: <20180308180423.941-3-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Mar 2018 18:04:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Mar 2018 18:04:39 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/11] s390/ipl: only print boot menu error if -boot menu=on was specified 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, "Collin L. Walling" , rth@twiddle.net 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" From: "Collin L. Walling" It is possible that certain QEMU configurations may not create an IPLB (such as when -kernel is provided). In this case, a misleading error message will be printed stating that the "boot menu is not supported for this device type". To amend this, only print this message iff boot menu=3Don was provided on the commandline. Otherwise, return silently. While we're at it, remove trailing periods from error messages. Signed-off-by: Collin L. Walling Message-Id: <1519760121-24594-1-git-send-email-walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/ipl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 8512aaacf7..fdeaec3a58 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -234,7 +234,7 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) if (!get_boot_device(0)) { if (boot_menu) { error_report("boot menu requires a bootindex to be specified f= or " - "the IPL device."); + "the IPL device"); } return; } @@ -250,7 +250,9 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) case S390_IPL_TYPE_QEMU_SCSI: break; default: - error_report("boot menu is not supported for this device type."); + if (boot_menu) { + error_report("boot menu is not supported for this device type"= ); + } return; } =20 @@ -263,13 +265,13 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) tmp =3D qemu_opt_get(opts, "splash-time"); =20 if (tmp && qemu_strtoul(tmp, NULL, 10, &splash_time)) { - error_report("splash-time is invalid, forcing it to 0."); + error_report("splash-time is invalid, forcing it to 0"); *timeout =3D 0; return; } =20 if (splash_time > 0xffffffff) { - error_report("splash-time is too large, forcing it to max value."); + error_report("splash-time is too large, forcing it to max value"); *timeout =3D 0xffffffff; return; } --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532419576117.85791176645307; Thu, 8 Mar 2018 10:06:59 -0800 (PST) Received: from localhost ([::1]:40674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzwQ-0006p2-K1 for importer@patchew.org; Thu, 08 Mar 2018 13:06:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuG-0005NL-JQ for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuE-0005yg-6z for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:44 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37394 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuE-0005yQ-07; Thu, 08 Mar 2018 13:04:42 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A96F4129340; Thu, 8 Mar 2018 18:04:41 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB614215CDA7; Thu, 8 Mar 2018 18:04:40 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:15 +0100 Message-Id: <20180308180423.941-4-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 08 Mar 2018 18:04:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 08 Mar 2018 18:04:41 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 03/11] target/s390x: Remove leading underscores from #defines 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Thomas Huth We should not use leading underscores followed by a capital letter in #defines since such identifiers are reserved by the C standard. For ASCE_ORIGIN, REGION_ENTRY_ORIGIN and SEGMENT_ENTRY_ORIGIN I also added parentheses around the value to silence an error message from checkpatch.pl. Signed-off-by: Thomas Huth Message-Id: <1520227018-4061-1-git-send-email-thuth@redhat.com> Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target/s390x/cpu.h | 66 +++++++++++++++++++++++--------------------= ---- target/s390x/mem_helper.c | 20 +++++++------- target/s390x/mmu_helper.c | 54 +++++++++++++++++++------------------- 3 files changed, 70 insertions(+), 70 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index c5ef930876..5f357a4e2d 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -538,39 +538,39 @@ typedef union SysIB { QEMU_BUILD_BUG_ON(sizeof(SysIB) !=3D 4096); =20 /* MMU defines */ -#define _ASCE_ORIGIN ~0xfffULL /* segment table origin = */ -#define _ASCE_SUBSPACE 0x200 /* subspace group control = */ -#define _ASCE_PRIVATE_SPACE 0x100 /* private space control = */ -#define _ASCE_ALT_EVENT 0x80 /* storage alteration event cont= rol */ -#define _ASCE_SPACE_SWITCH 0x40 /* space switch event = */ -#define _ASCE_REAL_SPACE 0x20 /* real space control = */ -#define _ASCE_TYPE_MASK 0x0c /* asce table type mask = */ -#define _ASCE_TYPE_REGION1 0x0c /* region first table type = */ -#define _ASCE_TYPE_REGION2 0x08 /* region second table type = */ -#define _ASCE_TYPE_REGION3 0x04 /* region third table type = */ -#define _ASCE_TYPE_SEGMENT 0x00 /* segment table type = */ -#define _ASCE_TABLE_LENGTH 0x03 /* region table length = */ - -#define _REGION_ENTRY_ORIGIN ~0xfffULL /* region/segment table origin = */ -#define _REGION_ENTRY_RO 0x200 /* region/segment protection bit= */ -#define _REGION_ENTRY_TF 0xc0 /* region/segment table offset = */ -#define _REGION_ENTRY_INV 0x20 /* invalid region table entry = */ -#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mas= k */ -#define _REGION_ENTRY_TYPE_R1 0x0c /* region first table type = */ -#define _REGION_ENTRY_TYPE_R2 0x08 /* region second table type = */ -#define _REGION_ENTRY_TYPE_R3 0x04 /* region third table type = */ -#define _REGION_ENTRY_LENGTH 0x03 /* region third length = */ - -#define _SEGMENT_ENTRY_ORIGIN ~0x7ffULL /* segment table origin = */ -#define _SEGMENT_ENTRY_FC 0x400 /* format control = */ -#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit = */ -#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry = */ - -#define VADDR_PX 0xff000 /* page index bits = */ - -#define _PAGE_RO 0x200 /* HW read-only bit */ -#define _PAGE_INVALID 0x400 /* HW invalid bit */ -#define _PAGE_RES0 0x800 /* bit must be zero */ +#define ASCE_ORIGIN (~0xfffULL) /* segment table origin = */ +#define ASCE_SUBSPACE 0x200 /* subspace group control = */ +#define ASCE_PRIVATE_SPACE 0x100 /* private space control = */ +#define ASCE_ALT_EVENT 0x80 /* storage alteration event cont= rol */ +#define ASCE_SPACE_SWITCH 0x40 /* space switch event = */ +#define ASCE_REAL_SPACE 0x20 /* real space control = */ +#define ASCE_TYPE_MASK 0x0c /* asce table type mask = */ +#define ASCE_TYPE_REGION1 0x0c /* region first table type = */ +#define ASCE_TYPE_REGION2 0x08 /* region second table type = */ +#define ASCE_TYPE_REGION3 0x04 /* region third table type = */ +#define ASCE_TYPE_SEGMENT 0x00 /* segment table type = */ +#define ASCE_TABLE_LENGTH 0x03 /* region table length = */ + +#define REGION_ENTRY_ORIGIN (~0xfffULL) /* region/segment table origin = */ +#define REGION_ENTRY_RO 0x200 /* region/segment protection bit= */ +#define REGION_ENTRY_TF 0xc0 /* region/segment table offset = */ +#define REGION_ENTRY_INV 0x20 /* invalid region table entry = */ +#define REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mas= k */ +#define REGION_ENTRY_TYPE_R1 0x0c /* region first table type = */ +#define REGION_ENTRY_TYPE_R2 0x08 /* region second table type = */ +#define REGION_ENTRY_TYPE_R3 0x04 /* region third table type = */ +#define REGION_ENTRY_LENGTH 0x03 /* region third length = */ + +#define SEGMENT_ENTRY_ORIGIN (~0x7ffULL) /* segment table origin */ +#define SEGMENT_ENTRY_FC 0x400 /* format control */ +#define SEGMENT_ENTRY_RO 0x200 /* page protection bit */ +#define SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */ + +#define VADDR_PX 0xff000 /* page index bits */ + +#define PAGE_RO 0x200 /* HW read-only bit */ +#define PAGE_INVALID 0x400 /* HW invalid bit */ +#define PAGE_RES0 0x800 /* bit must be zero */ =20 #define SK_C (0x1 << 1) #define SK_R (0x1 << 2) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index d5291b246e..a0e28bd124 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1924,20 +1924,20 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, = uint64_t r2, uint32_t m4) =20 if (!(r2 & 0x800)) { /* invalidation-and-clearing operation */ - table =3D r1 & _ASCE_ORIGIN; + table =3D r1 & ASCE_ORIGIN; entries =3D (r2 & 0x7ff) + 1; =20 - switch (r1 & _ASCE_TYPE_MASK) { - case _ASCE_TYPE_REGION1: + switch (r1 & ASCE_TYPE_MASK) { + case ASCE_TYPE_REGION1: index =3D (r2 >> 53) & 0x7ff; break; - case _ASCE_TYPE_REGION2: + case ASCE_TYPE_REGION2: index =3D (r2 >> 42) & 0x7ff; break; - case _ASCE_TYPE_REGION3: + case ASCE_TYPE_REGION3: index =3D (r2 >> 31) & 0x7ff; break; - case _ASCE_TYPE_SEGMENT: + case ASCE_TYPE_SEGMENT: index =3D (r2 >> 20) & 0x7ff; break; } @@ -1945,9 +1945,9 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, ui= nt64_t r2, uint32_t m4) /* addresses are not wrapped in 24/31bit mode but table index = is */ raddr =3D table + ((index + i) & 0x7ff) * sizeof(entry); entry =3D cpu_ldq_real_ra(env, raddr, ra); - if (!(entry & _REGION_ENTRY_INV)) { + if (!(entry & REGION_ENTRY_INV)) { /* we are allowed to not store if already invalid */ - entry |=3D _REGION_ENTRY_INV; + entry |=3D REGION_ENTRY_INV; cpu_stq_real_ra(env, raddr, entry, ra); } } @@ -1971,12 +1971,12 @@ void HELPER(ipte)(CPUS390XState *env, uint64_t pto,= uint64_t vaddr, uint64_t pte_addr, pte; =20 /* Compute the page table entry address */ - pte_addr =3D (pto & _SEGMENT_ENTRY_ORIGIN); + pte_addr =3D (pto & SEGMENT_ENTRY_ORIGIN); pte_addr +=3D (vaddr & VADDR_PX) >> 9; =20 /* Mark the page table entry as invalid */ pte =3D cpu_ldq_real_ra(env, pte_addr, ra); - pte |=3D _PAGE_INVALID; + pte |=3D PAGE_INVALID; cpu_stq_real_ra(env, pte_addr, pte, ra); =20 /* XXX we exploit the fact that Linux passes the exact virtual diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 23fb2e7501..1deeb6e6e4 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -128,11 +128,11 @@ static bool lowprot_enabled(const CPUS390XState *env,= uint64_t asc) /* Check the private-space control bit */ switch (asc) { case PSW_ASC_PRIMARY: - return !(env->cregs[1] & _ASCE_PRIVATE_SPACE); + return !(env->cregs[1] & ASCE_PRIVATE_SPACE); case PSW_ASC_SECONDARY: - return !(env->cregs[7] & _ASCE_PRIVATE_SPACE); + return !(env->cregs[7] & ASCE_PRIVATE_SPACE); case PSW_ASC_HOME: - return !(env->cregs[13] & _ASCE_PRIVATE_SPACE); + return !(env->cregs[13] & ASCE_PRIVATE_SPACE); default: /* We don't support access register mode */ error_report("unsupported addressing mode"); @@ -159,20 +159,20 @@ static int mmu_translate_pte(CPUS390XState *env, targ= et_ulong vaddr, uint64_t asc, uint64_t pt_entry, target_ulong *raddr, int *flags, int rw, bool= exc) { - if (pt_entry & _PAGE_INVALID) { + if (pt_entry & PAGE_INVALID) { DPRINTF("%s: PTE=3D0x%" PRIx64 " invalid\n", __func__, pt_entry); trigger_page_fault(env, vaddr, PGM_PAGE_TRANS, asc, rw, exc); return -1; } - if (pt_entry & _PAGE_RES0) { + if (pt_entry & PAGE_RES0) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } - if (pt_entry & _PAGE_RO) { + if (pt_entry & PAGE_RO) { *flags &=3D ~PAGE_WRITE; } =20 - *raddr =3D pt_entry & _ASCE_ORIGIN; + *raddr =3D pt_entry & ASCE_ORIGIN; =20 PTE_DPRINTF("%s: PTE=3D0x%" PRIx64 "\n", __func__, pt_entry); =20 @@ -188,11 +188,11 @@ static int mmu_translate_segment(CPUS390XState *env, = target_ulong vaddr, CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint64_t origin, offs, pt_entry; =20 - if (st_entry & _SEGMENT_ENTRY_RO) { + if (st_entry & SEGMENT_ENTRY_RO) { *flags &=3D ~PAGE_WRITE; } =20 - if ((st_entry & _SEGMENT_ENTRY_FC) && (env->cregs[0] & CR0_EDAT)) { + if ((st_entry & SEGMENT_ENTRY_FC) && (env->cregs[0] & CR0_EDAT)) { /* Decode EDAT1 segment frame absolute address (1MB page) */ *raddr =3D (st_entry & 0xfffffffffff00000ULL) | (vaddr & 0xfffff); PTE_DPRINTF("%s: SEG=3D0x%" PRIx64 "\n", __func__, st_entry); @@ -200,7 +200,7 @@ static int mmu_translate_segment(CPUS390XState *env, ta= rget_ulong vaddr, } =20 /* Look up 4KB page entry */ - origin =3D st_entry & _SEGMENT_ENTRY_ORIGIN; + origin =3D st_entry & SEGMENT_ENTRY_ORIGIN; offs =3D (vaddr & VADDR_PX) >> 9; pt_entry =3D ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " =3D> 0x%016" PRIx64 "\n= ", @@ -223,39 +223,39 @@ static int mmu_translate_region(CPUS390XState *env, t= arget_ulong vaddr, =20 PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, entry); =20 - origin =3D entry & _REGION_ENTRY_ORIGIN; + origin =3D entry & REGION_ENTRY_ORIGIN; offs =3D (vaddr >> (17 + 11 * level / 4)) & 0x3ff8; =20 new_entry =3D ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " =3D> 0x%016" PRIx64 "\n= ", __func__, origin, offs, new_entry); =20 - if ((new_entry & _REGION_ENTRY_INV) !=3D 0) { + if ((new_entry & REGION_ENTRY_INV) !=3D 0) { DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(env, vaddr, pchks[level / 4], asc, rw, exc); return -1; } =20 - if ((new_entry & _REGION_ENTRY_TYPE_MASK) !=3D level) { + if ((new_entry & REGION_ENTRY_TYPE_MASK) !=3D level) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } =20 - if (level =3D=3D _ASCE_TYPE_SEGMENT) { + if (level =3D=3D ASCE_TYPE_SEGMENT) { return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, fl= ags, rw, exc); } =20 /* Check region table offset and length */ offs =3D (vaddr >> (28 + 11 * (level - 4) / 4)) & 3; - if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) - || offs > (new_entry & _REGION_ENTRY_LENGTH)) { + if (offs < ((new_entry & REGION_ENTRY_TF) >> 6) + || offs > (new_entry & REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(env, vaddr, pchks[level / 4 - 1], asc, rw, exc); return -1; } =20 - if ((env->cregs[0] & CR0_EDAT) && (new_entry & _REGION_ENTRY_RO)) { + if ((env->cregs[0] & CR0_EDAT) && (new_entry & REGION_ENTRY_RO)) { *flags &=3D ~PAGE_WRITE; } =20 @@ -271,52 +271,52 @@ static int mmu_translate_asce(CPUS390XState *env, tar= get_ulong vaddr, int level; int r; =20 - if (asce & _ASCE_REAL_SPACE) { + if (asce & ASCE_REAL_SPACE) { /* direct mapping */ *raddr =3D vaddr; return 0; } =20 - level =3D asce & _ASCE_TYPE_MASK; + level =3D asce & ASCE_TYPE_MASK; switch (level) { - case _ASCE_TYPE_REGION1: - if ((vaddr >> 62) > (asce & _ASCE_TABLE_LENGTH)) { + case ASCE_TYPE_REGION1: + if ((vaddr >> 62) > (asce & ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_FIRST_TRANS, asc, rw, e= xc); return -1; } break; - case _ASCE_TYPE_REGION2: + case ASCE_TYPE_REGION2: if (vaddr & 0xffe0000000000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xffe0000000000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_ASCE_TYPE, asc, rw, exc); return -1; } - if ((vaddr >> 51 & 3) > (asce & _ASCE_TABLE_LENGTH)) { + if ((vaddr >> 51 & 3) > (asce & ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_SEC_TRANS, asc, rw, exc= ); return -1; } break; - case _ASCE_TYPE_REGION3: + case ASCE_TYPE_REGION3: if (vaddr & 0xfffffc0000000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xfffffc0000000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_ASCE_TYPE, asc, rw, exc); return -1; } - if ((vaddr >> 40 & 3) > (asce & _ASCE_TABLE_LENGTH)) { + if ((vaddr >> 40 & 3) > (asce & ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_THIRD_TRANS, asc, rw, e= xc); return -1; } break; - case _ASCE_TYPE_SEGMENT: + case ASCE_TYPE_SEGMENT: if (vaddr & 0xffffffff80000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xffffffff80000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_ASCE_TYPE, asc, rw, exc); return -1; } - if ((vaddr >> 29 & 3) > (asce & _ASCE_TABLE_LENGTH)) { + if ((vaddr >> 29 & 3) > (asce & ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw, exc= ); return -1; } --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532422674470.5905087759486; Thu, 8 Mar 2018 10:07:02 -0800 (PST) Received: from localhost ([::1]:40672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzwM-0006mL-Ka for importer@patchew.org; Thu, 08 Mar 2018 13:06:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuG-0005NK-G8 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuF-00060E-Mb for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:44 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37412 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuF-0005zk-IF; Thu, 08 Mar 2018 13:04:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C071412934A; Thu, 8 Mar 2018 18:04:43 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5B6C50332; Thu, 8 Mar 2018 18:04:42 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:16 +0100 Message-Id: <20180308180423.941-5-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 08 Mar 2018 18:04:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 08 Mar 2018 18:04:43 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/11] hw/s390x: Add the possibility to specify the netboot image on the command line 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Thomas Huth The file name of the netboot binary is currently hard-coded to "s390-netboot.img", without a possibility for the user to select an alternative firmware image here. That's unfortunate, especially since the basics are already there: The filename is a property of the s390-ipl device. So we just have to add a check whether the user already provided the property and only set the default if the string is still empty. Now it is possible to select a different firmware image with "-global s390-ipl.netboot_fw=3D/path/to/s390-netboot.img". Signed-off-by: Thomas Huth Message-Id: <1519731154-3127-1-git-send-email-thuth@redhat.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 4d0c3deba6..8726b4c281 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -254,8 +254,10 @@ static void s390_init_ipl_dev(const char *kernel_filen= ame, } qdev_prop_set_string(dev, "cmdline", kernel_cmdline); qdev_prop_set_string(dev, "firmware", firmware); - qdev_prop_set_string(dev, "netboot_fw", netboot_fw); qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); + if (!strlen(object_property_get_str(new, "netboot_fw", &error_abort)))= { + qdev_prop_set_string(dev, "netboot_fw", netboot_fw); + } object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, new, NULL); object_unref(new); --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532576934476.1478646131509; Thu, 8 Mar 2018 10:09:36 -0800 (PST) Received: from localhost ([::1]:40687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzyx-0000kk-5b for importer@patchew.org; Thu, 08 Mar 2018 13:09:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuI-0005O3-GM for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuH-00061p-A2 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:46 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55822 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuH-00061M-6C; Thu, 08 Mar 2018 13:04:45 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A32F74023BB3; Thu, 8 Mar 2018 18:04:44 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57912202322A; Thu, 8 Mar 2018 18:04:44 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:17 +0100 Message-Id: <20180308180423.941-6-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:44 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 05/11] numa: we don't implement NUMA for s390x 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: David Hildenbrand Right now it is possible to crash QEMU for s390x by providing e.g. -numa node,nodeid=3D0,cpus=3D0-1 Problem is, that numa.c uses mc->cpu_index_to_instance_props as an indicator whether NUMA is supported by a machine type. We don't implement NUMA for s390x ("topology") yet. However we need mc->cpu_index_to_instance_props for query-cpus. So let's fix this case by also checking for mc->get_default_cpu_node_id, which will be needed by machine_set_cpu_numa_node(). qemu-system-s390x: -numa node,nodeid=3D0,cpus=3D0-1: NUMA is not supported = by this machine-type While at it, make s390_cpu_index_to_props() look like on other architectures. Signed-off-by: David Hildenbrand Message-Id: <20180227110255.20999-1-david@redhat.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 8 +++++--- numa.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 8726b4c281..f82270401b 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -390,12 +390,14 @@ static void s390_machine_device_unplug_request(Hotplu= gHandler *hotplug_dev, } } =20 -static CpuInstanceProperties s390_cpu_index_to_props(MachineState *machine, +static CpuInstanceProperties s390_cpu_index_to_props(MachineState *ms, unsigned cpu_index) { - g_assert(machine->possible_cpus && cpu_index < machine->possible_cpus-= >len); + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(ms); =20 - return machine->possible_cpus->cpus[cpu_index].props; + assert(cpu_index < possible_cpus->len); + return possible_cpus->cpus[cpu_index].props; } =20 static const CPUArchIdList *s390_possible_cpu_arch_ids(MachineState *ms) diff --git a/numa.c b/numa.c index 5d7529c1d9..398e2c9a85 100644 --- a/numa.c +++ b/numa.c @@ -80,7 +80,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOpt= ions *node, return; } =20 - if (!mc->cpu_index_to_instance_props) { + if (!mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id) { error_report("NUMA is not supported by this machine-type"); exit(1); } --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532576994191.24059104697596; Thu, 8 Mar 2018 10:09:36 -0800 (PST) Received: from localhost ([::1]:40686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzyt-0000hQ-1r for importer@patchew.org; Thu, 08 Mar 2018 13:09:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuK-0005QL-0n for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuJ-00063P-1k for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:48 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47412 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuI-00062q-RI; Thu, 08 Mar 2018 13:04:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47898EBFE9; Thu, 8 Mar 2018 18:04:46 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFDDA11701C0; Thu, 8 Mar 2018 18:04:45 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:18 +0100 Message-Id: <20180308180423.941-7-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:46 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/11] s390x/sclpconsole: Remove dead code - remove exit handlers 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Nia Alarie , rth@twiddle.net 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" From: Nia Alarie The other event handlers (quiesce and cpu) do not define these handlers, and this one does nothing, so it can be removed. Signed-off-by: Nia Alarie Reviewed-by: Christian Borntraeger Message-Id: <20180306100721.19419-1-nia.alarie@gmail.com> Signed-off-by: Cornelia Huck --- hw/char/sclpconsole-lm.c | 6 ------ hw/char/sclpconsole.c | 6 ------ hw/s390x/event-facility.c | 14 -------------- include/hw/s390x/event-facility.h | 1 - 4 files changed, 27 deletions(-) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index c500bdaf29..84efd8df73 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -318,11 +318,6 @@ static int console_init(SCLPEvent *event) return 0; } =20 -static int console_exit(SCLPEvent *event) -{ - return 0; -} - static void console_reset(DeviceState *dev) { SCLPEvent *event =3D SCLP_EVENT(dev); @@ -349,7 +344,6 @@ static void console_class_init(ObjectClass *klass, void= *data) dc->reset =3D console_reset; dc->vmsd =3D &vmstate_sclplmconsole; ec->init =3D console_init; - ec->exit =3D console_exit; ec->get_send_mask =3D send_mask; ec->get_receive_mask =3D receive_mask; ec->can_handle_event =3D can_handle_event; diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index d0265dfa7a..e6ba0a46bd 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -246,11 +246,6 @@ static void console_reset(DeviceState *dev) scon->notify =3D false; } =20 -static int console_exit(SCLPEvent *event) -{ - return 0; -} - static Property console_properties[] =3D { DEFINE_PROP_CHR("chardev", SCLPConsole, chr), DEFINE_PROP_END_OF_LIST(), @@ -265,7 +260,6 @@ static void console_class_init(ObjectClass *klass, void= *data) dc->reset =3D console_reset; dc->vmsd =3D &vmstate_sclpconsole; ec->init =3D console_init; - ec->exit =3D console_exit; ec->get_send_mask =3D send_mask; ec->get_receive_mask =3D receive_mask; ec->can_handle_event =3D can_handle_event; diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 155a69467b..79de3c738f 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -431,26 +431,12 @@ static void event_realize(DeviceState *qdev, Error **= errp) } } =20 -static void event_unrealize(DeviceState *qdev, Error **errp) -{ - SCLPEvent *event =3D SCLP_EVENT(qdev); - SCLPEventClass *child =3D SCLP_EVENT_GET_CLASS(event); - if (child->exit) { - int rc =3D child->exit(event); - if (rc < 0) { - error_setg(errp, "SCLP event exit failed."); - return; - } - } -} - static void event_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->bus_type =3D TYPE_SCLP_EVENTS_BUS; dc->realize =3D event_realize; - dc->unrealize =3D event_unrealize; } =20 static const TypeInfo sclp_event_type_info =3D { diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-fac= ility.h index 5119b9b7f0..b913f85edc 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -174,7 +174,6 @@ typedef struct SCLPEvent { typedef struct SCLPEventClass { DeviceClass parent_class; int (*init)(SCLPEvent *event); - int (*exit)(SCLPEvent *event); =20 /* get SCLP's send mask */ unsigned int (*get_send_mask)(void); --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532712220843.3163578233776; Thu, 8 Mar 2018 10:11:52 -0800 (PST) Received: from localhost ([::1]:40709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu019-0002ic-Cn for importer@patchew.org; Thu, 08 Mar 2018 13:11:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuL-0005Sx-BY for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuK-00065y-IT for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:49 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47420 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuK-00065E-Dv; Thu, 08 Mar 2018 13:04:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE7BBEBFEC; Thu, 8 Mar 2018 18:04:47 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93794202322A; Thu, 8 Mar 2018 18:04:47 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:19 +0100 Message-Id: <20180308180423.941-8-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:47 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 07/11] vfio-ccw: license text should indicate GPL v2 or later 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , Pierre Morel , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Xiao Feng Ren , Dong Jia Shi , rth@twiddle.net 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" The license text currently specifies "any version" of the GPL. It is unlikely that GPL v1 was ever intended; change this to the standard "or any later version" text. Cc: Dong Jia Shi Cc: Xiao Feng Ren Cc: Pierre Morel Acked-by: Christian Borntraeger Reviewed-by: Dong Jia Shi Acked-by: Pierre Morel Signed-off-by: Cornelia Huck --- hw/vfio/ccw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 16713f2c52..4e5855741a 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -6,8 +6,8 @@ * Xiao Feng Ren * Pierre Morel * - * This work is licensed under the terms of the GNU GPL, version 2 or(at - * your option) any version. See the COPYING file in the top-level + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level * directory. */ =20 --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152053286329648.696934413881195; Thu, 8 Mar 2018 10:14:23 -0800 (PST) Received: from localhost ([::1]:40722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu03a-00051A-EL for importer@patchew.org; Thu, 08 Mar 2018 13:14:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuO-0005XJ-Fc for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuM-00067o-Cx for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:52 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47432 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuM-00067L-6E; Thu, 08 Mar 2018 13:04:50 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FA3BEC000; Thu, 8 Mar 2018 18:04:49 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34BE510AF9C9; Thu, 8 Mar 2018 18:04:49 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:20 +0100 Message-Id: <20180308180423.941-9-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 08 Mar 2018 18:04:49 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/11] s390x/sclp: proper support of larger send and receive masks 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Claudio Imbrenda , rth@twiddle.net 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" From: Claudio Imbrenda Until 67915de9f0383ccf4a ("s390x/event-facility: variable-length event mask= s") we only supported sclp event masks with a size of exactly 4 bytes, even though the architecture allows the guests to set up sclp event masks from 1 to 1021 bytes in length. After that patch, the behaviour was almost compliant, but some issues were still remaining, in particular regarding the handling of selective reads and migration. When setting the sclp event mask, a mask size is also specified. Until now we only considered the size in order to decide which bits to save in the internal state. On the other hand, when a guest performs a selective read, it sends a mask, but it does not specify a size; the implied size is the size of the last mask that has been set. Specifying bits in the mask of selective read that are not available in the internal mask should return an error, and bits past the end of the mask should obviously be ignored. This can only be achieved by keeping track of the lenght of the mask. The mask length is thus now part of the internal state that needs to be migrated. This patch fixes the handling of selective reads, whose size will now match the length of the event mask, as per architecture. While the default behaviour is to be compliant with the architecture, when using older machine models the old broken behaviour is selected (allowing only masks of size exactly 4), in order to be able to migrate toward older versions. Fixes: 67915de9f0383ccf4a ("s390x/event-facility: variable-length event mas= ks") Signed-off-by: Claudio Imbrenda Message-Id: <1519407778-23095-2-git-send-email-imbrenda@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/s390x/event-facility.c | 81 ++++++++++++++++++++++++++++++++++++++----= ---- hw/s390x/s390-virtio-ccw.c | 8 ++++- 2 files changed, 75 insertions(+), 14 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 79de3c738f..feef6f788c 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -31,6 +31,15 @@ struct SCLPEventFacility { SCLPEventsBus sbus; /* guest' receive mask */ unsigned int receive_mask; + /* + * when false, we keep the same broken, backwards compatible behaviour= as + * before, allowing only masks of size exactly 4; when true, we implem= ent + * the architecture correctly, allowing all valid mask sizes. Needed f= or + * migration toward older versions. + */ + bool allow_all_mask_sizes; + /* length of the receive mask */ + uint16_t mask_length; }; =20 /* return true if any child has event pending set */ @@ -220,6 +229,17 @@ static uint16_t handle_sccb_read_events(SCLPEventFacil= ity *ef, SCCB *sccb, return rc; } =20 +/* copy up to src_len bytes and fill the rest of dst with zeroes */ +static void copy_mask(uint8_t *dst, uint8_t *src, uint16_t dst_len, + uint16_t src_len) +{ + int i; + + for (i =3D 0; i < dst_len; i++) { + dst[i] =3D i < src_len ? src[i] : 0; + } +} + static void read_event_data(SCLPEventFacility *ef, SCCB *sccb) { unsigned int sclp_active_selection_mask; @@ -240,7 +260,9 @@ static void read_event_data(SCLPEventFacility *ef, SCCB= *sccb) sclp_active_selection_mask =3D sclp_cp_receive_mask; break; case SCLP_SELECTIVE_READ: - sclp_active_selection_mask =3D be32_to_cpu(red->mask); + copy_mask((uint8_t *)&sclp_active_selection_mask, (uint8_t *)&red-= >mask, + sizeof(sclp_active_selection_mask), ef->mask_length); + sclp_active_selection_mask =3D be32_to_cpu(sclp_active_selection_m= ask); if (!sclp_cp_receive_mask || (sclp_active_selection_mask & ~sclp_cp_receive_mask)) { sccb->h.response_code =3D @@ -259,24 +281,14 @@ out: return; } =20 -/* copy up to dst_len bytes and fill the rest of dst with zeroes */ -static void copy_mask(uint8_t *dst, uint8_t *src, uint16_t dst_len, - uint16_t src_len) -{ - int i; - - for (i =3D 0; i < dst_len; i++) { - dst[i] =3D i < src_len ? src[i] : 0; - } -} - static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb) { WriteEventMask *we_mask =3D (WriteEventMask *) sccb; uint16_t mask_length =3D be16_to_cpu(we_mask->mask_length); uint32_t tmp_mask; =20 - if (!mask_length || (mask_length > SCLP_EVENT_MASK_LEN_MAX)) { + if (!mask_length || (mask_length > SCLP_EVENT_MASK_LEN_MAX) || + ((mask_length !=3D 4) && !ef->allow_all_mask_sizes)) { sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_MASK_LENGTH); goto out; } @@ -301,6 +313,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCC= B *sccb) mask_length, sizeof(tmp_mask)); =20 sccb->h.response_code =3D cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); + ef->mask_length =3D mask_length; =20 out: return; @@ -356,6 +369,24 @@ static void command_handler(SCLPEventFacility *ef, SCC= B *sccb, uint64_t code) } } =20 +static bool vmstate_event_facility_mask_length_needed(void *opaque) +{ + SCLPEventFacility *ef =3D opaque; + + return ef->allow_all_mask_sizes; +} + +static const VMStateDescription vmstate_event_facility_mask_length =3D { + .name =3D "vmstate-event-facility/mask_length", + .version_id =3D 0, + .minimum_version_id =3D 0, + .needed =3D vmstate_event_facility_mask_length_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT16(mask_length, SCLPEventFacility), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_event_facility =3D { .name =3D "vmstate-event-facility", .version_id =3D 0, @@ -363,15 +394,39 @@ static const VMStateDescription vmstate_event_facilit= y =3D { .fields =3D (VMStateField[]) { VMSTATE_UINT32(receive_mask, SCLPEventFacility), VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * []) { + &vmstate_event_facility_mask_length, + NULL } }; =20 +static void sclp_event_set_allow_all_mask_sizes(Object *obj, bool value, + Error **errp) +{ + SCLPEventFacility *ef =3D (SCLPEventFacility *)obj; + + ef->allow_all_mask_sizes =3D value; +} + +static bool sclp_event_get_allow_all_mask_sizes(Object *obj, Error **e) +{ + SCLPEventFacility *ef =3D (SCLPEventFacility *)obj; + + return ef->allow_all_mask_sizes; +} + static void init_event_facility(Object *obj) { SCLPEventFacility *event_facility =3D EVENT_FACILITY(obj); DeviceState *sdev =3D DEVICE(obj); Object *new; =20 + event_facility->mask_length =3D 4; + event_facility->allow_all_mask_sizes =3D true; + object_property_add_bool(obj, "allow_all_mask_sizes", + sclp_event_get_allow_all_mask_sizes, + sclp_event_set_allow_all_mask_sizes, NULL); /* Spawn a new bus for SCLP events */ qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus= ), TYPE_SCLP_EVENTS_BUS, sdev, NULL); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index f82270401b..864145a7c6 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -27,6 +27,7 @@ #include "s390-pci-bus.h" #include "hw/s390x/storage-keys.h" #include "hw/s390x/storage-attributes.h" +#include "hw/s390x/event-facility.h" #include "hw/compat.h" #include "ipl.h" #include "hw/s390x/s390-virtio-ccw.h" @@ -668,7 +669,12 @@ bool css_migration_enabled(void) type_init(ccw_machine_register_##suffix) =20 #define CCW_COMPAT_2_11 \ - HW_COMPAT_2_11 + HW_COMPAT_2_11 \ + {\ + .driver =3D TYPE_SCLP_EVENT_FACILITY,\ + .property =3D "allow_all_mask_sizes",\ + .value =3D "off",\ + }, =20 #define CCW_COMPAT_2_10 \ HW_COMPAT_2_10 --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532708340580.3706006566529; Thu, 8 Mar 2018 10:11:48 -0800 (PST) Received: from localhost ([::1]:40708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu015-0002e1-Fq for importer@patchew.org; Thu, 08 Mar 2018 13:11:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuP-0005Yg-FD for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuO-00068y-3x for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:53 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55832 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuN-00068V-Tz; Thu, 08 Mar 2018 13:04:52 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61A82406E8B9; Thu, 8 Mar 2018 18:04:51 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9C05215CDA7; Thu, 8 Mar 2018 18:04:50 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:21 +0100 Message-Id: <20180308180423.941-10-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:51 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/11] s390x/sclp: clean up sclp masks 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Claudio Imbrenda , rth@twiddle.net 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" From: Claudio Imbrenda Introduce an sccb_mask_t to be used for SCLP event masks instead of just unsigned int or uint32_t. This will allow later to extend the mask with more ease. Signed-off-by: Claudio Imbrenda Message-Id: <1519407778-23095-3-git-send-email-imbrenda@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- hw/char/sclpconsole-lm.c | 4 ++-- hw/char/sclpconsole.c | 4 ++-- hw/s390x/event-facility.c | 20 ++++++++++---------- hw/s390x/sclpcpu.c | 4 ++-- hw/s390x/sclpquiesce.c | 4 ++-- include/hw/s390x/event-facility.h | 22 +++++++++++++--------- 6 files changed, 31 insertions(+), 27 deletions(-) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 84efd8df73..dbc91a1e5b 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -102,12 +102,12 @@ static bool can_handle_event(uint8_t type) return type =3D=3D SCLP_EVENT_MESSAGE || type =3D=3D SCLP_EVENT_PMSGCM= D; } =20 -static unsigned int send_mask(void) +static sccb_mask_t send_mask(void) { return SCLP_EVENT_MASK_OP_CMD | SCLP_EVENT_MASK_PMSGCMD; } =20 -static unsigned int receive_mask(void) +static sccb_mask_t receive_mask(void) { return SCLP_EVENT_MASK_MSG | SCLP_EVENT_MASK_PMSGCMD; } diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index e6ba0a46bd..1fa16e9055 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -83,12 +83,12 @@ static bool can_handle_event(uint8_t type) return type =3D=3D SCLP_EVENT_ASCII_CONSOLE_DATA; } =20 -static unsigned int send_mask(void) +static sccb_mask_t send_mask(void) { return SCLP_EVENT_MASK_MSG_ASCII; } =20 -static unsigned int receive_mask(void) +static sccb_mask_t receive_mask(void) { return SCLP_EVENT_MASK_MSG_ASCII; } diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index feef6f788c..9c24bc6f7c 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -29,8 +29,8 @@ typedef struct SCLPEventsBus { struct SCLPEventFacility { SysBusDevice parent_obj; SCLPEventsBus sbus; - /* guest' receive mask */ - unsigned int receive_mask; + /* guest's receive mask */ + sccb_mask_t receive_mask; /* * when false, we keep the same broken, backwards compatible behaviour= as * before, allowing only masks of size exactly 4; when true, we implem= ent @@ -61,9 +61,9 @@ static bool event_pending(SCLPEventFacility *ef) return false; } =20 -static unsigned int get_host_send_mask(SCLPEventFacility *ef) +static sccb_mask_t get_host_send_mask(SCLPEventFacility *ef) { - unsigned int mask; + sccb_mask_t mask; BusChild *kid; SCLPEventClass *child; =20 @@ -77,9 +77,9 @@ static unsigned int get_host_send_mask(SCLPEventFacility = *ef) return mask; } =20 -static unsigned int get_host_receive_mask(SCLPEventFacility *ef) +static sccb_mask_t get_host_receive_mask(SCLPEventFacility *ef) { - unsigned int mask; + sccb_mask_t mask; BusChild *kid; SCLPEventClass *child; =20 @@ -189,7 +189,7 @@ out: } =20 static uint16_t handle_sccb_read_events(SCLPEventFacility *ef, SCCB *sccb, - unsigned int mask) + sccb_mask_t mask) { uint16_t rc; int slen; @@ -242,8 +242,8 @@ static void copy_mask(uint8_t *dst, uint8_t *src, uint1= 6_t dst_len, =20 static void read_event_data(SCLPEventFacility *ef, SCCB *sccb) { - unsigned int sclp_active_selection_mask; - unsigned int sclp_cp_receive_mask; + sccb_mask_t sclp_active_selection_mask; + sccb_mask_t sclp_cp_receive_mask; =20 ReadEventData *red =3D (ReadEventData *) sccb; =20 @@ -285,7 +285,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCC= B *sccb) { WriteEventMask *we_mask =3D (WriteEventMask *) sccb; uint16_t mask_length =3D be16_to_cpu(we_mask->mask_length); - uint32_t tmp_mask; + sccb_mask_t tmp_mask; =20 if (!mask_length || (mask_length > SCLP_EVENT_MASK_LEN_MAX) || ((mask_length !=3D 4) && !ef->allow_all_mask_sizes)) { diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 3ee890b392..50c021b9c2 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -37,12 +37,12 @@ void raise_irq_cpu_hotplug(void) sclp_service_interrupt(0); } =20 -static unsigned int send_mask(void) +static sccb_mask_t send_mask(void) { return SCLP_EVENT_MASK_CONFIG_MGT_DATA; } =20 -static unsigned int receive_mask(void) +static sccb_mask_t receive_mask(void) { return 0; } diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index 02416435a1..1c8f5c9393 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -28,12 +28,12 @@ static bool can_handle_event(uint8_t type) return type =3D=3D SCLP_EVENT_SIGNAL_QUIESCE; } =20 -static unsigned int send_mask(void) +static sccb_mask_t send_mask(void) { return SCLP_EVENT_MASK_SIGNAL_QUIESCE; } =20 -static unsigned int receive_mask(void) +static sccb_mask_t receive_mask(void) { return 0; } diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-fac= ility.h index b913f85edc..5698e5e96c 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -28,12 +28,14 @@ #define SCLP_EVENT_SIGNAL_QUIESCE 0x1d =20 /* SCLP event masks */ -#define SCLP_EVENT_MASK_SIGNAL_QUIESCE 0x00000008 -#define SCLP_EVENT_MASK_MSG_ASCII 0x00000040 -#define SCLP_EVENT_MASK_CONFIG_MGT_DATA 0x10000000 -#define SCLP_EVENT_MASK_OP_CMD 0x80000000 -#define SCLP_EVENT_MASK_MSG 0x40000000 -#define SCLP_EVENT_MASK_PMSGCMD 0x00800000 +#define SCLP_EVMASK(T) (1ULL << (sizeof(sccb_mask_t) * 8 - (T))) + +#define SCLP_EVENT_MASK_OP_CMD SCLP_EVMASK(SCLP_EVENT_OPRTNS_COMM= AND) +#define SCLP_EVENT_MASK_MSG SCLP_EVMASK(SCLP_EVENT_MESSAGE) +#define SCLP_EVENT_MASK_CONFIG_MGT_DATA SCLP_EVMASK(SCLP_EVENT_CONFIG_MGT_= DATA) +#define SCLP_EVENT_MASK_PMSGCMD SCLP_EVMASK(SCLP_EVENT_PMSGCMD) +#define SCLP_EVENT_MASK_MSG_ASCII SCLP_EVMASK(SCLP_EVENT_ASCII_CONSO= LE_DATA) +#define SCLP_EVENT_MASK_SIGNAL_QUIESCE SCLP_EVMASK(SCLP_EVENT_SIGNAL_QUIE= SCE) =20 #define SCLP_UNCONDITIONAL_READ 0x00 #define SCLP_SELECTIVE_READ 0x01 @@ -71,6 +73,8 @@ typedef struct WriteEventMask { #define WEM_RECEIVE_MASK(wem, mask_len) ((wem)->masks + 2 * (mask_len)) #define WEM_SEND_MASK(wem, mask_len) ((wem)->masks + 3 * (mask_len)) =20 +typedef uint32_t sccb_mask_t; + typedef struct EventBufferHeader { uint16_t length; uint8_t type; @@ -160,7 +164,7 @@ typedef struct WriteEventData { typedef struct ReadEventData { SCCBHeader h; union { - uint32_t mask; + sccb_mask_t mask; EventBufferHeader ebh; }; } QEMU_PACKED ReadEventData; @@ -176,10 +180,10 @@ typedef struct SCLPEventClass { int (*init)(SCLPEvent *event); =20 /* get SCLP's send mask */ - unsigned int (*get_send_mask)(void); + sccb_mask_t (*get_send_mask)(void); =20 /* get SCLP's receive mask */ - unsigned int (*get_receive_mask)(void); + sccb_mask_t (*get_receive_mask)(void); =20 int (*read_event_data)(SCLPEvent *event, EventBufferHeader *evt_buf_hd= r, int *slen); --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532854939855.5017753272497; Thu, 8 Mar 2018 10:14:14 -0800 (PST) Received: from localhost ([::1]:40721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu03S-0004ud-6h for importer@patchew.org; Thu, 08 Mar 2018 13:14:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuS-0005a5-Sv for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuR-0006BW-Rs for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:56 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40740 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuR-0006BJ-M1; Thu, 08 Mar 2018 13:04:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25EA8D144E; Thu, 8 Mar 2018 18:04:55 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD11B6352A; Thu, 8 Mar 2018 18:04:52 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:22 +0100 Message-Id: <20180308180423.941-11-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Mar 2018 18:04:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 08 Mar 2018 18:04:55 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 10/11] pc-bios/s390-ccw: Move string arrays from bootmap header to .c file 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net 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" From: Thomas Huth bootmap.h can currently only be included once - otherwise the linker complains about multiple definitions of the "magic" strings. It's a bad style to define string arrays in header files, so let's better move these to the bootmap.c file instead where they are used. Signed-off-by: Thomas Huth Message-Id: <1520317081-5341-1-git-send-email-thuth@redhat.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- pc-bios/s390-ccw/bootmap.c | 20 ++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 19 ------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 29bfd8c875..fc2a9fe33b 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -37,6 +37,26 @@ typedef struct ResetInfo { =20 static ResetInfo save; =20 +const uint8_t el_torito_magic[] =3D "EL TORITO SPECIFICATION" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + +/* + * Match two CCWs located after PSW and eight filler bytes. + * From libmagic and arch/s390/kernel/head.S. + */ +const uint8_t linux_s390_magic[] =3D "\x02\x00\x00\x18\x60\x00\x00\x50\x02= \x00" + "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x= 40" + "\x40\x40\x40\x40"; + +static inline bool is_iso_vd_valid(IsoVolDesc *vd) +{ + const uint8_t vol_desc_magic[] =3D "CD001"; + + return !memcmp(&vd->ident[0], vol_desc_magic, 5) && + vd->version =3D=3D 0x1 && + vd->type <=3D VOL_DESC_TYPE_PARTITION; +} + static void jump_to_IPL_2(void) { ResetInfo *current =3D 0; diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index c636626f1a..07eb600b00 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -375,9 +375,6 @@ static inline void read_iso_boot_image(uint32_t block_o= ffset, void *load_addr, "Failed to read boot image!"); } =20 -const uint8_t el_torito_magic[] =3D "EL TORITO SPECIFICATION" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - #define ISO9660_MAX_DIR_DEPTH 8 =20 typedef struct IsoDirHdr { @@ -430,20 +427,12 @@ typedef struct IsoVolDesc { } vd; } __attribute__((packed)) IsoVolDesc; =20 -const uint8_t vol_desc_magic[] =3D "CD001"; #define VOL_DESC_TYPE_BOOT 0 #define VOL_DESC_TYPE_PRIMARY 1 #define VOL_DESC_TYPE_SUPPLEMENT 2 #define VOL_DESC_TYPE_PARTITION 3 #define VOL_DESC_TERMINATOR 255 =20 -static inline bool is_iso_vd_valid(IsoVolDesc *vd) -{ - return !memcmp(&vd->ident[0], vol_desc_magic, 5) && - vd->version =3D=3D 0x1 && - vd->type <=3D VOL_DESC_TYPE_PARTITION; -} - typedef struct IsoBcValid { uint8_t platform_id; uint16_t reserved; @@ -468,14 +457,6 @@ typedef struct IsoBcHdr { uint8_t id[28]; } __attribute__((packed)) IsoBcHdr; =20 -/* - * Match two CCWs located after PSW and eight filler bytes. - * From libmagic and arch/s390/kernel/head.S. - */ -const uint8_t linux_s390_magic[] =3D "\x02\x00\x00\x18\x60\x00\x00\x50\x02= \x00" - "\x00\x68\x60\x00\x00\x50\x40\x40\x40\x= 40" - "\x40\x40\x40\x40"; - typedef struct IsoBcEntry { uint8_t id; union { --=20 2.13.6 From nobody Sun Apr 28 07:52:21 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520532995794341.661651735473; Thu, 8 Mar 2018 10:16:35 -0800 (PST) Received: from localhost ([::1]:40753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu05i-0006nQ-VD for importer@patchew.org; Thu, 08 Mar 2018 13:16:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etzuU-0005c8-Ov for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:05:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etzuT-0006Cj-K6 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 13:04:58 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55846 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1etzuT-0006CP-Dm; Thu, 08 Mar 2018 13:04:57 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE97A4023BB3; Thu, 8 Mar 2018 18:04:56 +0000 (UTC) Received: from localhost (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 724C5215CDA7; Thu, 8 Mar 2018 18:04:56 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Thu, 8 Mar 2018 19:04:23 +0100 Message-Id: <20180308180423.941-12-cohuck@redhat.com> In-Reply-To: <20180308180423.941-1-cohuck@redhat.com> References: <20180308180423.941-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 08 Mar 2018 18:04:56 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/11] s390x/virtio: Convert virtio-ccw from *_exit to *_unrealize 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: thuth@redhat.com, david@redhat.com, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, Nia Alarie , rth@twiddle.net 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" From: Nia Alarie Signed-off-by: Nia Alarie Message-Id: <20180307162958.11232-1-nia.alarie@gmail.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 34 +++++++++++++++++----------------- hw/s390x/virtio-ccw.h | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 8f7fbc2ab7..e51fbefd23 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -752,7 +752,7 @@ out_err: g_free(sch); } =20 -static int virtio_ccw_exit(VirtioCcwDevice *dev) +static void virtio_ccw_unrealize(VirtioCcwDevice *dev, Error **errp) { CcwDevice *ccw_dev =3D CCW_DEVICE(dev); SubchDev *sch =3D ccw_dev->sch; @@ -760,12 +760,12 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev) if (sch) { css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NU= LL); g_free(sch); + ccw_dev->sch =3D NULL; } if (dev->indicators) { release_indicator(&dev->routes.adapter, dev->indicators); dev->indicators =3D NULL; } - return 0; } =20 static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) @@ -1344,7 +1344,7 @@ static void virtio_ccw_net_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_net_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_net_properties; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); @@ -1372,7 +1372,7 @@ static void virtio_ccw_blk_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_blk_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_blk_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); @@ -1400,7 +1400,7 @@ static void virtio_ccw_serial_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_serial_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_serial_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); @@ -1428,7 +1428,7 @@ static void virtio_ccw_balloon_class_init(ObjectClass= *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_balloon_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_balloon_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); @@ -1456,7 +1456,7 @@ static void virtio_ccw_scsi_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_scsi_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); @@ -1483,7 +1483,7 @@ static void vhost_ccw_scsi_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_ccw_scsi_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D vhost_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); @@ -1520,7 +1520,7 @@ static void virtio_ccw_rng_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_rng_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_rng_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); @@ -1558,7 +1558,7 @@ static void virtio_ccw_crypto_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_crypto_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_crypto_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); @@ -1596,7 +1596,7 @@ static void virtio_ccw_gpu_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_gpu_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_gpu_properties; dc->hotpluggable =3D false; @@ -1625,7 +1625,7 @@ static void virtio_ccw_input_class_init(ObjectClass *= klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_input_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_input_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); @@ -1705,12 +1705,12 @@ static void virtio_ccw_busdev_realize(DeviceState *= dev, Error **errp) virtio_ccw_device_realize(_dev, errp); } =20 -static int virtio_ccw_busdev_exit(DeviceState *dev) +static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp) { VirtioCcwDevice *_dev =3D (VirtioCcwDevice *)dev; VirtIOCCWDeviceClass *_info =3D VIRTIO_CCW_DEVICE_GET_CLASS(dev); =20 - return _info->exit(_dev); + _info->unrealize(_dev, errp); } =20 static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, @@ -1728,7 +1728,7 @@ static void virtio_ccw_device_class_init(ObjectClass = *klass, void *data) =20 k->unplug =3D virtio_ccw_busdev_unplug; dc->realize =3D virtio_ccw_busdev_realize; - dc->exit =3D virtio_ccw_busdev_exit; + dc->unrealize =3D virtio_ccw_busdev_unrealize; dc->bus_type =3D TYPE_VIRTUAL_CSS_BUS; } =20 @@ -1804,7 +1804,7 @@ static void virtio_ccw_9p_class_init(ObjectClass *kla= ss, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; k->realize =3D virtio_ccw_9p_realize; dc->reset =3D virtio_ccw_reset; dc->props =3D virtio_ccw_9p_properties; @@ -1853,7 +1853,7 @@ static void vhost_vsock_ccw_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_vsock_ccw_realize; - k->exit =3D virtio_ccw_exit; + k->unrealize =3D virtio_ccw_unrealize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props =3D vhost_vsock_ccw_properties; dc->reset =3D virtio_ccw_reset; diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 3905f3a3d6..2fc513001e 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -76,7 +76,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice; typedef struct VirtIOCCWDeviceClass { CCWDeviceClass parent_class; void (*realize)(VirtioCcwDevice *dev, Error **errp); - int (*exit)(VirtioCcwDevice *dev); + void (*unrealize)(VirtioCcwDevice *dev, Error **errp); } VirtIOCCWDeviceClass; =20 /* Performance improves when virtqueue kick processing is decoupled from t= he --=20 2.13.6