From nobody Thu May 2 07:02:30 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 1518168468253183.107418996584; Fri, 9 Feb 2018 01:27:48 -0800 (PST) Received: from localhost ([::1]:52924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4yB-0003G2-E3 for importer@patchew.org; Fri, 09 Feb 2018 04:27:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4w9-0001rN-Jv for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4w4-0005rV-JA for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:41 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38376 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 1ek4w4-0005qd-EV; Fri, 09 Feb 2018 04:25:36 -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 A70F6EAE87; Fri, 9 Feb 2018 09:25:33 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D49612166BAE; Fri, 9 Feb 2018 09:25:32 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:24:56 +0100 Message-Id: <20180209092524.31348-2-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.1]); Fri, 09 Feb 2018 09:25:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 09 Feb 2018 09:25:33 +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 01/29] Fix configure for s390 qemu on alpine and other busybox environments 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: Alice Frosi , 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: Alice Frosi In alpine docker image the qemu-system-s390x build is broken and it throws this error: qemu-system-s390x: Initialization of device s390-ipl failed: could not load bootloader 's390-ccw.img' The grep command of busybox uses regex. This fails on binary data (e.g. stops on every \0), so it does not identify the string BiGeNdIaN in the test case big/little. Therefore, it assumes that the architecture is little endian. This fix solves the grep problem by printing the content of TMPO with strings Signed-off-by: Alice Frosi Signed-off-by: Christian Borntraeger [some changes to patch description, add -a option to strings] Message-Id: <20180130133828.77336-2-borntraeger@de.ibm.com> Reviewed-by: Eric Blake Signed-off-by: Cornelia Huck --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 831ebf248f..1be413a004 100755 --- a/configure +++ b/configure @@ -1933,9 +1933,9 @@ int main(int argc, char *argv[]) { EOF =20 if compile_object ; then - if grep -q BiGeNdIaN $TMPO ; then + if strings -a $TMPO | grep -q BiGeNdIaN ; then bigendian=3D"yes" - elif grep -q LiTtLeEnDiAn $TMPO ; then + elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then bigendian=3D"no" else echo big/little test failed --=20 2.13.6 From nobody Thu May 2 07:02:30 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 151816846579471.8248982164497; Fri, 9 Feb 2018 01:27:45 -0800 (PST) Received: from localhost ([::1]:52923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4y8-0003Cr-OH for importer@patchew.org; Fri, 09 Feb 2018 04:27:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4w9-0001rP-Lu for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4w4-0005ra-Kl for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:41 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55762 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 1ek4w4-0005qg-ET; Fri, 09 Feb 2018 04:25:36 -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 1EF658182D2A; Fri, 9 Feb 2018 09:25:35 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFCF42024CA2; Fri, 9 Feb 2018 09:25:34 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:24:57 +0100 Message-Id: <20180209092524.31348-3-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:25:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:25:35 +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 02/29] s390x/tcg: deliver multiple interrupts in a row 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 We have to consider all deliverable interrupts. We now have to take care of the special scenario, where we first inject an interrupt with a WAIT PSW, followed by a !WAIT PSW. (very unlikely but possible) Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-2-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/excp_helper.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index e8f7a40c2b..97caa7f418 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -433,10 +433,12 @@ void s390_cpu_do_interrupt(CPUState *cs) { S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; + bool stopped =3D false; =20 qemu_log_mask(CPU_LOG_INT, "%s: %d at pc=3D%" PRIx64 "\n", __func__, cs->exception_index, env->psw.addr); =20 +try_deliver: /* handle machine checks */ if (cs->exception_index =3D=3D -1 && s390_cpu_has_mcck_int(cpu)) { cs->exception_index =3D EXCP_MCHK; @@ -479,13 +481,14 @@ void s390_cpu_do_interrupt(CPUState *cs) break; case EXCP_STOP: do_stop_interrupt(env); + stopped =3D true; break; } =20 - /* WAIT PSW during interrupt injection or STOP interrupt */ - if (cs->exception_index =3D=3D EXCP_HLT) { - /* don't trigger a cpu_loop_exit(), use an interrupt instead */ - cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); + if (cs->exception_index !=3D -1 && !stopped) { + /* check if there are more pending interrupts to deliver */ + cs->exception_index =3D -1; + goto try_deliver; } cs->exception_index =3D -1; =20 @@ -493,6 +496,15 @@ void s390_cpu_do_interrupt(CPUState *cs) if (!env->pending_int) { cs->interrupt_request &=3D ~CPU_INTERRUPT_HARD; } + + /* WAIT PSW during interrupt injection or STOP interrupt */ + if ((env->psw.mask & PSW_MASK_WAIT) || stopped) { + /* don't trigger a cpu_loop_exit(), use an interrupt instead */ + cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); + } else if (cs->halted) { + /* unhalt if we had a WAIT PSW somehwere in our injection chain */ + s390_cpu_unhalt(cpu); + } } =20 bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168649944917.7076933236085; Fri, 9 Feb 2018 01:30:49 -0800 (PST) Received: from localhost ([::1]:52950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek517-0006Hv-4F for importer@patchew.org; Fri, 09 Feb 2018 04:30:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4w9-0001rO-LH for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4w7-0005tf-Qo for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:41 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33048 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 1ek4w7-0005tJ-L1; Fri, 09 Feb 2018 04:25:39 -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 3C4467D679; Fri, 9 Feb 2018 09:25:39 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D1D810083A8; Fri, 9 Feb 2018 09:25:36 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:24:58 +0100 Message-Id: <20180209092524.31348-4-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25: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 03/29] s390x/flic: simplify flic initialization 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 This makes it clearer, which device is used for which accelerator. Reviewed-by: Christian Borntraeger Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-3-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 7 +++++-- hw/intc/s390_flic_kvm.c | 12 ------------ include/hw/s390x/s390_flic.h | 9 --------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 6eaf178d79..fc244fe775 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -40,8 +40,11 @@ void s390_flic_init(void) { DeviceState *dev; =20 - dev =3D s390_flic_kvm_create(); - if (!dev) { + if (kvm_enabled()) { + dev =3D qdev_create(NULL, TYPE_KVM_S390_FLIC); + object_property_add_child(qdev_get_machine(), TYPE_KVM_S390_FLIC, + OBJECT(dev), NULL); + } else { dev =3D qdev_create(NULL, TYPE_QEMU_S390_FLIC); object_property_add_child(qdev_get_machine(), TYPE_QEMU_S390_FLIC, OBJECT(dev), NULL); diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index d208cb81c4..0cb5feab0c 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -35,18 +35,6 @@ typedef struct KVMS390FLICState { bool clear_io_supported; } KVMS390FLICState; =20 -DeviceState *s390_flic_kvm_create(void) -{ - DeviceState *dev =3D NULL; - - if (kvm_enabled()) { - dev =3D qdev_create(NULL, TYPE_KVM_S390_FLIC); - object_property_add_child(qdev_get_machine(), TYPE_KVM_S390_FLIC, - OBJECT(dev), NULL); - } - return dev; -} - /** * flic_get_all_irqs - store all pending irqs in buffer * @buf: pointer to buffer which is passed to kernel diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 7aab6ef7f0..5b00e936fa 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -91,13 +91,4 @@ void s390_flic_init(void); S390FLICState *s390_get_flic(void); bool ais_needed(void *opaque); =20 -#ifdef CONFIG_KVM -DeviceState *s390_flic_kvm_create(void); -#else -static inline DeviceState *s390_flic_kvm_create(void) -{ - return NULL; -} -#endif - #endif /* HW_S390_FLIC_H */ --=20 2.13.6 From nobody Thu May 2 07:02:30 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; 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 1518168844960136.27949726322618; Fri, 9 Feb 2018 01:34:04 -0800 (PST) Received: from localhost ([::1]:52967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek54G-0000ma-1f for importer@patchew.org; Fri, 09 Feb 2018 04:34:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wC-0001rq-5X for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wB-0005w8-Cm for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:44 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33058 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 1ek4wB-0005vt-81; Fri, 09 Feb 2018 04:25: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 C9BFA7D824; Fri, 9 Feb 2018 09:25:42 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65D76F41B0; Fri, 9 Feb 2018 09:25:40 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:24:59 +0100 Message-Id: <20180209092524.31348-5-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:42 +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/29] s390x/tcg: simplify lookup of flic 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand We can simply search for an object of our common type. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-4-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index fc244fe775..ba1aa40eba 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -27,11 +27,9 @@ S390FLICState *s390_get_flic(void) static S390FLICState *fs; =20 if (!fs) { - fs =3D S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NU= LL)); - if (!fs) { - fs =3D S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLI= C, - NULL)); - } + fs =3D S390_FLIC_COMMON(object_resolve_path_type("", + TYPE_S390_FLIC_COMM= ON, + NULL)); } return fs; } --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168656888569.385898783308; Fri, 9 Feb 2018 01:30:56 -0800 (PST) Received: from localhost ([::1]:52951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek51C-0006Pb-0y for importer@patchew.org; Fri, 09 Feb 2018 04:30:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wE-0001td-8k for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wC-0005xI-Sv for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:46 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33068 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 1ek4wC-0005x4-O0; Fri, 09 Feb 2018 04:25:44 -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 4AD947D845; Fri, 9 Feb 2018 09:25:44 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1BFDF41AC; Fri, 9 Feb 2018 09:25:43 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:00 +0100 Message-Id: <20180209092524.31348-6-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:44 +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 05/29] s390x/tcg: simplify machine check handling 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 We currently only support CRW machine checks. This is a preparation for real floating interrupt support. Get rid of the queue and handle it via the bit INTERRUPT_MCHK. We don't rename it for now, as it will be soon gone (when moving crw machine checks into the flic). Please note that this is the same way also KVM handles it: only one instance of a machine check can be pending at a time. So no need for a queue. While at it, make sure we try to deliver only if env->cregs[14] actually indicates that CRWs are accepted. Drop two unused defines on the way (we already have PSW_MASK_...). Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-5-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.c | 2 -- target/s390x/cpu.h | 10 ---------- target/s390x/excp_helper.c | 29 +++++------------------------ target/s390x/interrupt.c | 18 +++++++----------- 4 files changed, 12 insertions(+), 47 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 979469dc3c..243804fbfc 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -119,7 +119,6 @@ static void s390_cpu_initial_reset(CPUState *s) for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] =3D -1; } - env->mchk_index =3D -1; =20 /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, @@ -156,7 +155,6 @@ static void s390_cpu_full_reset(CPUState *s) for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] =3D -1; } - env->mchk_index =3D -1; =20 /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index a1123ad621..f32a5ad6c9 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -54,10 +54,6 @@ #define MMU_USER_IDX 0 =20 #define MAX_IO_QUEUE 16 -#define MAX_MCHK_QUEUE 16 - -#define PSW_MCHK_MASK 0x0004000000000000 -#define PSW_IO_MASK 0x0200000000000000 =20 #define S390_MAX_CPUS 248 =20 @@ -73,10 +69,6 @@ typedef struct IOIntQueue { uint32_t word; } IOIntQueue; =20 -typedef struct MchkQueue { - uint16_t type; -} MchkQueue; - struct CPUS390XState { uint64_t regs[16]; /* GP registers */ /* @@ -123,14 +115,12 @@ struct CPUS390XState { uint64_t cregs[16]; /* control registers */ =20 IOIntQueue io_queue[MAX_IO_QUEUE][8]; - MchkQueue mchk_queue[MAX_MCHK_QUEUE]; =20 int pending_int; uint32_t service_param; uint16_t external_call_addr; DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); int io_index[8]; - int mchk_index; =20 uint64_t ckc; uint64_t cputm; diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 97caa7f418..0cbc4051d1 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -368,30 +368,16 @@ static void do_io_interrupt(CPUS390XState *env) =20 static void do_mchk_interrupt(CPUS390XState *env) { - S390CPU *cpu =3D s390_env_get_cpu(env); uint64_t mask, addr; LowCore *lowcore; - MchkQueue *q; int i; =20 - if (!(env->psw.mask & PSW_MASK_MCHECK)) { - cpu_abort(CPU(cpu), "Machine check w/o mchk mask\n"); - } + /* for now we only support channel report machine checks (floating) */ + g_assert(env->psw.mask & PSW_MASK_MCHECK); + g_assert(env->cregs[14] & CR14_CHANNEL_REPORT_SC); =20 - if (env->mchk_index < 0 || env->mchk_index >=3D MAX_MCHK_QUEUE) { - cpu_abort(CPU(cpu), "Mchk queue overrun: %d\n", env->mchk_index); - } - - q =3D &env->mchk_queue[env->mchk_index]; - - if (q->type !=3D 1) { - /* Don't know how to handle this... */ - cpu_abort(CPU(cpu), "Unknown machine check type %d\n", q->type); - } - if (!(env->cregs[14] & (1 << 28))) { - /* CRW machine checks disabled */ - return; - } + g_assert(env->pending_int & INTERRUPT_MCHK); + env->pending_int &=3D ~INTERRUPT_MCHK; =20 lowcore =3D cpu_map_lowcore(env); =20 @@ -418,11 +404,6 @@ static void do_mchk_interrupt(CPUS390XState *env) =20 cpu_unmap_lowcore(lowcore); =20 - env->mchk_index--; - if (env->mchk_index =3D=3D -1) { - env->pending_int &=3D ~INTERRUPT_MCHK; - } - DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__, env->psw.mask, env->psw.addr); =20 diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 39c026b8b5..380222b394 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -162,16 +162,6 @@ static void cpu_inject_crw_mchk(S390CPU *cpu) { CPUS390XState *env =3D &cpu->env; =20 - if (env->mchk_index =3D=3D MAX_MCHK_QUEUE - 1) { - /* ugh - can't queue anymore. Let's drop. */ - return; - } - - env->mchk_index++; - assert(env->mchk_index < MAX_MCHK_QUEUE); - - env->mchk_queue[env->mchk_index].type =3D 1; - env->pending_int |=3D INTERRUPT_MCHK; cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } @@ -225,7 +215,13 @@ bool s390_cpu_has_mcck_int(S390CPU *cpu) return false; } =20 - return env->pending_int & INTERRUPT_MCHK; + /* for now we only support channel report machine checks (floating) */ + if ((env->pending_int & INTERRUPT_MCHK) && + (env->cregs[14] & CR14_CHANNEL_REPORT_SC)) { + return true; + } + + return false; } =20 bool s390_cpu_has_ext_int(S390CPU *cpu) --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168855926919.4068880850864; Fri, 9 Feb 2018 01:34:15 -0800 (PST) Received: from localhost ([::1]:52968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek54R-0000sb-1I for importer@patchew.org; Fri, 09 Feb 2018 04:34:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wG-0001wH-Qw for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wE-0005yw-Is for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:48 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33078 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 1ek4wE-0005yZ-CE; Fri, 09 Feb 2018 04:25: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 EFC647D824; Fri, 9 Feb 2018 09:25:45 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7228C1010408; Fri, 9 Feb 2018 09:25:45 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:01 +0100 Message-Id: <20180209092524.31348-7-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25: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/29] s390x/flic: factor out injection of floating interrupts 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 Let the flic device handle it internally. This will allow us to later on store floating interrupts in the flic for the TCG case. This now also simplifies kvm.c. All that's left is the fallback interface for floating interrupts, which is now triggered directly via the flic in case anything goes wrong. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-6-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 31 ++++++++++++++++++++ hw/intc/s390_flic_kvm.c | 63 ++++++++++++++++++++++++++++++++++++---- include/hw/s390x/s390_flic.h | 5 ++++ target/s390x/cpu.h | 7 ++++- target/s390x/interrupt.c | 42 +++++++++++---------------- target/s390x/kvm-stub.c | 13 --------- target/s390x/kvm.c | 68 ++++------------------------------------= ---- target/s390x/kvm_s390x.h | 10 +------ 8 files changed, 123 insertions(+), 116 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index ba1aa40eba..bdc8ec7607 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -127,6 +127,34 @@ static int qemu_s390_inject_airq(S390FLICState *fs, ui= nt8_t type, return 0; } =20 +static void qemu_s390_inject_service(S390FLICState *fs, uint32_t parm) +{ + + S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + + /* FIXME: don't inject into dummy CPU */ + cpu_inject_service(dummy_cpu, parm); +} + +static void qemu_s390_inject_io(S390FLICState *fs, uint16_t subchannel_id, + uint16_t subchannel_nr, uint32_t io_int_pa= rm, + uint32_t io_int_word) +{ + S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + + /* FIXME: don't inject into dummy CPU */ + cpu_inject_io(dummy_cpu, subchannel_id, subchannel_nr, io_int_parm, + io_int_word); +} + +static void qemu_s390_inject_crw_mchk(S390FLICState *fs) +{ + S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + + /* FIXME: don't inject into dummy CPU */ + cpu_inject_crw_mchk(dummy_cpu); +} + static void qemu_s390_flic_reset(DeviceState *dev) { QEMUS390FLICState *flic =3D QEMU_S390_FLIC(dev); @@ -168,6 +196,9 @@ static void qemu_s390_flic_class_init(ObjectClass *oc, = void *data) fsc->clear_io_irq =3D qemu_s390_clear_io_flic; fsc->modify_ais_mode =3D qemu_s390_modify_ais_mode; fsc->inject_airq =3D qemu_s390_inject_airq; + fsc->inject_service =3D qemu_s390_inject_service; + fsc->inject_io =3D qemu_s390_inject_io; + fsc->inject_crw_mchk =3D qemu_s390_inject_crw_mchk; } =20 static Property s390_flic_common_properties[] =3D { diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 0cb5feab0c..d277ffdd2e 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -111,14 +111,64 @@ static int flic_enqueue_irqs(void *buf, uint64_t len, return rc ? -errno : 0; } =20 -int kvm_s390_inject_flic(struct kvm_s390_irq *irq) +static void kvm_s390_inject_flic(S390FLICState *fs, struct kvm_s390_irq *i= rq) { - static KVMS390FLICState *flic; + static bool use_flic =3D true; + int r; + + if (use_flic) { + r =3D flic_enqueue_irqs(irq, sizeof(*irq), KVM_S390_FLIC(fs)); + if (r =3D=3D -ENOSYS) { + use_flic =3D false; + } + if (!r) { + return; + } + } + /* fallback to legacy KVM IOCTL in case FLIC fails */ + kvm_s390_floating_interrupt_legacy(irq); +} + +static void kvm_s390_inject_service(S390FLICState *fs, uint32_t parm) +{ + struct kvm_s390_irq irq =3D { + .type =3D KVM_S390_INT_SERVICE, + .u.ext.ext_params =3D parm, + }; + + kvm_s390_inject_flic(fs, &irq); +} =20 - if (unlikely(!flic)) { - flic =3D KVM_S390_FLIC(s390_get_flic()); +static void kvm_s390_inject_io(S390FLICState *fs, uint16_t subchannel_id, + uint16_t subchannel_nr, uint32_t io_int_par= m, + uint32_t io_int_word) +{ + struct kvm_s390_irq irq =3D { + .u.io.subchannel_id =3D subchannel_id, + .u.io.subchannel_nr =3D subchannel_nr, + .u.io.io_int_parm =3D io_int_parm, + .u.io.io_int_word =3D io_int_word, + }; + + if (io_int_word & IO_INT_WORD_AI) { + irq.type =3D KVM_S390_INT_IO(1, 0, 0, 0); + } else { + irq.type =3D KVM_S390_INT_IO(0, (subchannel_id & 0xff00) >> 8, + (subchannel_id & 0x0006), + subchannel_nr); } - return flic_enqueue_irqs(irq, sizeof(*irq), flic); + kvm_s390_inject_flic(fs, &irq); +} + +static void kvm_s390_inject_crw_mchk(S390FLICState *fs) +{ + struct kvm_s390_irq irq =3D { + .type =3D KVM_S390_MCHK, + .u.mchk.cr14 =3D CR14_CHANNEL_REPORT_SC, + .u.mchk.mcic =3D s390_build_validity_mcic() | MCIC_SC_CP, + }; + + kvm_s390_inject_flic(fs, &irq); } =20 static int kvm_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_i= d, @@ -602,6 +652,9 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, v= oid *data) fsc->clear_io_irq =3D kvm_s390_clear_io_flic; fsc->modify_ais_mode =3D kvm_s390_modify_ais_mode; fsc->inject_airq =3D kvm_s390_inject_airq; + fsc->inject_service =3D kvm_s390_inject_service; + fsc->inject_io =3D kvm_s390_inject_io; + fsc->inject_crw_mchk =3D kvm_s390_inject_crw_mchk; } =20 static const TypeInfo kvm_s390_flic_info =3D { diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 5b00e936fa..d0538134b7 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -66,6 +66,11 @@ typedef struct S390FLICStateClass { int (*modify_ais_mode)(S390FLICState *fs, uint8_t isc, uint16_t mode); int (*inject_airq)(S390FLICState *fs, uint8_t type, uint8_t isc, uint8_t flags); + void (*inject_service)(S390FLICState *fs, uint32_t parm); + void (*inject_io)(S390FLICState *fs, uint16_t subchannel_id, + uint16_t subchannel_nr, uint32_t io_int_parm, + uint32_t io_int_word); + void (*inject_crw_mchk)(S390FLICState *fs); } S390FLICStateClass; =20 #define TYPE_KVM_S390_FLIC "s390-flic-kvm" diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index f32a5ad6c9..9d3aa05a47 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -741,7 +741,12 @@ void s390_program_interrupt(CPUS390XState *env, uint32= _t code, int ilen, uintptr_t ra); /* service interrupts are floating therefore we must not pass an cpustate = */ void s390_sclp_extint(uint32_t parm); - +/* FIXME: remove once we have proper floating interrupts in TCG */ +void cpu_inject_service(S390CPU *cpu, uint32_t param); +void cpu_inject_crw_mchk(S390CPU *cpu); +void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, + uint16_t subchannel_number, uint32_t io_int_parm, + uint32_t io_int_word); =20 /* mmu_helper.c */ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *host= buf, diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 380222b394..8229572f7d 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -15,6 +15,9 @@ #include "exec/exec-all.h" #include "sysemu/kvm.h" #include "hw/s390x/ioinst.h" +#if !defined(CONFIG_USER_ONLY) +#include "hw/s390x/s390_flic.h" +#endif =20 /* Ensure to exit the TB after this call! */ void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ile= n) @@ -55,7 +58,7 @@ void s390_program_interrupt(CPUS390XState *env, uint32_t = code, int ilen, } =20 #if !defined(CONFIG_USER_ONLY) -static void cpu_inject_service(S390CPU *cpu, uint32_t param) +void cpu_inject_service(S390CPU *cpu, uint32_t param) { CPUS390XState *env =3D &cpu->env; =20 @@ -134,9 +137,9 @@ void cpu_inject_stop(S390CPU *cpu) cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } =20 -static void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, - uint16_t subchannel_number, - uint32_t io_int_parm, uint32_t io_int_word) +void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, + uint16_t subchannel_number, uint32_t io_int_parm, + uint32_t io_int_word) { CPUS390XState *env =3D &cpu->env; int isc =3D IO_INT_WORD_ISC(io_int_word); @@ -158,7 +161,7 @@ static void cpu_inject_io(S390CPU *cpu, uint16_t subcha= nnel_id, cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } =20 -static void cpu_inject_crw_mchk(S390CPU *cpu) +void cpu_inject_crw_mchk(S390CPU *cpu) { CPUS390XState *env =3D &cpu->env; =20 @@ -173,38 +176,27 @@ static void cpu_inject_crw_mchk(S390CPU *cpu) */ void s390_sclp_extint(uint32_t parm) { - if (kvm_enabled()) { - kvm_s390_service_interrupt(parm); - } else { - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + S390FLICState *fs =3D s390_get_flic(); + S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); =20 - cpu_inject_service(dummy_cpu, parm); - } + fsc->inject_service(fs, parm); } =20 void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) { - if (kvm_enabled()) { - kvm_s390_io_interrupt(subchannel_id, subchannel_nr, io_int_parm, - io_int_word); - } else { - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + S390FLICState *fs =3D s390_get_flic(); + S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); =20 - cpu_inject_io(dummy_cpu, subchannel_id, subchannel_nr, io_int_parm, - io_int_word); - } + fsc->inject_io(fs, subchannel_id, subchannel_nr, io_int_parm, io_int_w= ord); } =20 void s390_crw_mchk(void) { - if (kvm_enabled()) { - kvm_s390_crw_mchk(); - } else { - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + S390FLICState *fs =3D s390_get_flic(); + S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); =20 - cpu_inject_crw_mchk(dummy_cpu); - } + fsc->inject_crw_mchk(fs); } =20 bool s390_cpu_has_mcck_int(S390CPU *cpu) diff --git a/target/s390x/kvm-stub.c b/target/s390x/kvm-stub.c index 6bae3e99d3..8cdcf83845 100644 --- a/target/s390x/kvm-stub.c +++ b/target/s390x/kvm-stub.c @@ -12,10 +12,6 @@ #include "cpu.h" #include "kvm_s390x.h" =20 -void kvm_s390_service_interrupt(uint32_t parm) -{ -} - void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_co= de) { } @@ -30,15 +26,6 @@ void kvm_s390_program_interrupt(S390CPU *cpu, uint16_t c= ode) { } =20 -void kvm_s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, - uint32_t io_int_parm, uint32_t io_int_word) -{ -} - -void kvm_s390_crw_mchk(void) -{ -} - int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state) { return -ENOSYS; diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 8736001156..db5fe084ff 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1034,7 +1034,7 @@ void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm= _s390_irq *irq) inject_vcpu_irq_legacy(cs, irq); } =20 -static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) +void kvm_s390_floating_interrupt_legacy(struct kvm_s390_irq *irq) { struct kvm_s390_interrupt kvmint =3D {}; int r; @@ -1052,33 +1052,6 @@ static void __kvm_s390_floating_interrupt(struct kvm= _s390_irq *irq) } } =20 -void kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) -{ - static bool use_flic =3D true; - int r; - - if (use_flic) { - r =3D kvm_s390_inject_flic(irq); - if (r =3D=3D -ENOSYS) { - use_flic =3D false; - } - if (!r) { - return; - } - } - __kvm_s390_floating_interrupt(irq); -} - -void kvm_s390_service_interrupt(uint32_t parm) -{ - struct kvm_s390_irq irq =3D { - .type =3D KVM_S390_INT_SERVICE, - .u.ext.ext_params =3D parm, - }; - - kvm_s390_floating_interrupt(&irq); -} - void kvm_s390_program_interrupt(S390CPU *cpu, uint16_t code) { struct kvm_s390_irq irq =3D { @@ -1690,10 +1663,10 @@ static int handle_tsch(S390CPU *cpu) * If an I/O interrupt had been dequeued, we have to reinject it. */ if (run->s390_tsch.dequeued) { - kvm_s390_io_interrupt(run->s390_tsch.subchannel_id, - run->s390_tsch.subchannel_nr, - run->s390_tsch.io_int_parm, - run->s390_tsch.io_int_word); + s390_io_interrupt(run->s390_tsch.subchannel_id, + run->s390_tsch.subchannel_nr, + run->s390_tsch.io_int_parm, + run->s390_tsch.io_int_word); } ret =3D 0; } @@ -1840,37 +1813,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu) return true; } =20 -void kvm_s390_io_interrupt(uint16_t subchannel_id, - uint16_t subchannel_nr, uint32_t io_int_parm, - uint32_t io_int_word) -{ - struct kvm_s390_irq irq =3D { - .u.io.subchannel_id =3D subchannel_id, - .u.io.subchannel_nr =3D subchannel_nr, - .u.io.io_int_parm =3D io_int_parm, - .u.io.io_int_word =3D io_int_word, - }; - - if (io_int_word & IO_INT_WORD_AI) { - irq.type =3D KVM_S390_INT_IO(1, 0, 0, 0); - } else { - irq.type =3D KVM_S390_INT_IO(0, (subchannel_id & 0xff00) >> 8, - (subchannel_id & 0x0006), - subchannel_nr); - } - kvm_s390_floating_interrupt(&irq); -} - -void kvm_s390_crw_mchk(void) -{ - struct kvm_s390_irq irq =3D { - .type =3D KVM_S390_MCHK, - .u.mchk.cr14 =3D CR14_CHANNEL_REPORT_SC, - .u.mchk.mcic =3D s390_build_validity_mcic() | MCIC_SC_CP, - }; - kvm_s390_floating_interrupt(&irq); -} - void kvm_s390_enable_css_support(S390CPU *cpu) { int r; diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h index 79b35946f3..7a3b862eea 100644 --- a/target/s390x/kvm_s390x.h +++ b/target/s390x/kvm_s390x.h @@ -12,17 +12,12 @@ =20 struct kvm_s390_irq; =20 -void kvm_s390_floating_interrupt(struct kvm_s390_irq *irq); -void kvm_s390_service_interrupt(uint32_t parm); +void kvm_s390_floating_interrupt_legacy(struct kvm_s390_irq *irq); void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq); void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_co= de); int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf, int len, bool is_write); void kvm_s390_program_interrupt(S390CPU *cpu, uint16_t code); -void kvm_s390_io_interrupt(uint16_t subchannel_id, - uint16_t subchannel_nr, uint32_t io_int_parm, - uint32_t io_int_word); -void kvm_s390_crw_mchk(void); int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state); void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu); int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu); @@ -44,7 +39,4 @@ void kvm_s390_crypto_reset(void); void kvm_s390_restart_interrupt(S390CPU *cpu); void kvm_s390_stop_interrupt(S390CPU *cpu); =20 -/* implemented outside of target/s390x/ */ -int kvm_s390_inject_flic(struct kvm_s390_irq *irq); - #endif /* KVM_S390X_H */ --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168550002497.87626957200337; Fri, 9 Feb 2018 01:29:10 -0800 (PST) Received: from localhost ([::1]:52927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4zV-0004W8-3A for importer@patchew.org; Fri, 09 Feb 2018 04:29:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wK-0001zd-K3 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wF-0005zx-V5 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:52 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33088 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 1ek4wF-0005zk-Qi; Fri, 09 Feb 2018 04:25:47 -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 6D9367D845; Fri, 9 Feb 2018 09:25:47 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 251012026DFD; Fri, 9 Feb 2018 09:25:47 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:02 +0100 Message-Id: <20180209092524.31348-8-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.2]); Fri, 09 Feb 2018 09:25:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25: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/29] s390x/flic: no need to call s390_io_interrupt() from flic 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 We can directly call the right function. Suggested-by: Cornelia Huck Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-7-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index bdc8ec7607..d6ed1d7380 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -108,6 +108,7 @@ static int qemu_s390_inject_airq(S390FLICState *fs, uin= t8_t type, uint8_t isc, uint8_t flags) { QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); bool flag =3D flags & S390_ADAPTER_SUPPRESSIBLE; uint32_t io_int_word =3D (isc << 27) | IO_INT_WORD_AI; =20 @@ -116,7 +117,7 @@ static int qemu_s390_inject_airq(S390FLICState *fs, uin= t8_t type, return 0; } =20 - s390_io_interrupt(0, 0, 0, io_int_word); + fsc->inject_io(fs, 0, 0, 0, io_int_word); =20 if (flag && (flic->simm & AIS_MODE_MASK(isc))) { flic->nimm |=3D AIS_MODE_MASK(isc); --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169058466957.1368434160205; Fri, 9 Feb 2018 01:37:38 -0800 (PST) Received: from localhost ([::1]:52997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek57f-0003gW-Fn for importer@patchew.org; Fri, 09 Feb 2018 04:37:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wK-0001ze-Kq for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wH-000615-Ek for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:52 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53010 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 1ek4wH-00060k-A6; Fri, 09 Feb 2018 04:25:49 -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 DF96A40265F6; Fri, 9 Feb 2018 09:25:48 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99145B350D; Fri, 9 Feb 2018 09:25:48 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:03 +0100 Message-Id: <20180209092524.31348-9-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 09 Feb 2018 09:25:48 +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 08/29] s390x/tcg: tolerate wrong wakeups due to floating interrupts 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 This is a preparation for floating interrupt support and only applies to MTTCG, single threaded TCG works just fine. If a floating interrupt wakes up a VCPU and the CPU thinks it can run (clearing cs->halted), at the point where the interrupt would be delivered, already another VCPU might have picked up the interrupt, resulting in a wakeup without an interrupt (executing wrong code). It is wrong to let the VCPU continue to execute (the WAIT PSW). Instead, we have to put the VCPU back to sleep. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-8-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/excp_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 0cbc4051d1..23447af942 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -503,6 +503,11 @@ bool s390_cpu_exec_interrupt(CPUState *cs, int interru= pt_request) s390_cpu_do_interrupt(cs); return true; } + if (env->psw.mask & PSW_MASK_WAIT) { + /* Woken up because of a floating interrupt but it has already + * been delivered. Go back to sleep. */ + cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); + } } return false; } --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168942818944.7255406330232; Fri, 9 Feb 2018 01:35:42 -0800 (PST) Received: from localhost ([::1]:52970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek55p-0002AM-T1 for importer@patchew.org; Fri, 09 Feb 2018 04:35:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wQ-00026D-Ku for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wJ-000622-8d for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:58 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33098 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 1ek4wJ-00061l-1e; Fri, 09 Feb 2018 04:25:51 -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 982E37CBDB; Fri, 9 Feb 2018 09:25:50 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16B5B2166BAE; Fri, 9 Feb 2018 09:25:49 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:04 +0100 Message-Id: <20180209092524.31348-10-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.2]); Fri, 09 Feb 2018 09:25:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:50 +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/29] s390x/flic: make floating interrupts on TCG actually floating 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 Move floating interrupt handling into the flic. Floating interrupts will now be considered by all CPUs, not just CPU #0. While at it, convert I/O interrupts to use a list and make sure we properly consider I/O sub-classes in s390_cpu_has_io_int(). Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-9-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 144 +++++++++++++++++++++++++++++++++++++++= +--- include/hw/s390x/s390_flic.h | 41 ++++++++++++ target/s390x/cpu.c | 8 --- target/s390x/cpu.h | 22 ------- target/s390x/excp_helper.c | 97 ++++++++++------------------- target/s390x/interrupt.c | 52 ++-------------- 6 files changed, 212 insertions(+), 152 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index d6ed1d7380..928bdc3037 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -128,40 +128,153 @@ static int qemu_s390_inject_airq(S390FLICState *fs, = uint8_t type, return 0; } =20 +static void qemu_s390_flic_notify(uint32_t type) +{ + CPUState *cs; + + /* + * We have to make all CPUs see CPU_INTERRUPT_HARD, so they might + * consider it. TODO: don't kick/wakeup all VCPUs but try to be + * smarter (using the interrupt type). + */ + CPU_FOREACH(cs) { + cpu_interrupt(cs, CPU_INTERRUPT_HARD); + } +} + +uint32_t qemu_s390_flic_dequeue_service(QEMUS390FLICState *flic) +{ + uint32_t tmp; + + g_assert(qemu_mutex_iothread_locked()); + g_assert(flic->pending & FLIC_PENDING_SERVICE); + tmp =3D flic->service_param; + flic->service_param =3D 0; + flic->pending &=3D ~FLIC_PENDING_SERVICE; + + return tmp; +} + +/* caller has to free the returned object */ +QEMUS390FlicIO *qemu_s390_flic_dequeue_io(QEMUS390FLICState *flic, uint64_= t cr6) +{ + QEMUS390FlicIO *io; + uint8_t isc; + + g_assert(qemu_mutex_iothread_locked()); + if (!(flic->pending & CR6_TO_PENDING_IO(cr6))) { + return NULL; + } + + for (isc =3D 0; isc < 8; isc++) { + if (QLIST_EMPTY(&flic->io[isc]) || !(cr6 & ISC_TO_ISC_BITS(isc))) { + continue; + } + io =3D QLIST_FIRST(&flic->io[isc]); + QLIST_REMOVE(io, next); + + /* update our indicator bit */ + if (QLIST_EMPTY(&flic->io[isc])) { + flic->pending &=3D ~ISC_TO_PENDING_IO(isc); + } + return io; + } + + return NULL; +} + +void qemu_s390_flic_dequeue_crw_mchk(QEMUS390FLICState *flic) +{ + g_assert(qemu_mutex_iothread_locked()); + g_assert(flic->pending & FLIC_PENDING_MCHK_CR); + flic->pending &=3D ~FLIC_PENDING_MCHK_CR; +} + static void qemu_s390_inject_service(S390FLICState *fs, uint32_t parm) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); =20 - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + g_assert(qemu_mutex_iothread_locked()); + /* multiplexing is good enough for sclp - kvm does it internally as we= ll */ + flic->service_param |=3D parm; + flic->pending |=3D FLIC_PENDING_SERVICE; =20 - /* FIXME: don't inject into dummy CPU */ - cpu_inject_service(dummy_cpu, parm); + qemu_s390_flic_notify(FLIC_PENDING_SERVICE); } =20 static void qemu_s390_inject_io(S390FLICState *fs, uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_pa= rm, uint32_t io_int_word) { - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + const uint8_t isc =3D IO_INT_WORD_ISC(io_int_word); + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FlicIO *io; =20 - /* FIXME: don't inject into dummy CPU */ - cpu_inject_io(dummy_cpu, subchannel_id, subchannel_nr, io_int_parm, - io_int_word); + g_assert(qemu_mutex_iothread_locked()); + io =3D g_new0(QEMUS390FlicIO, 1); + io->id =3D subchannel_id; + io->nr =3D subchannel_nr; + io->parm =3D io_int_parm; + io->word =3D io_int_word; + + QLIST_INSERT_HEAD(&flic->io[isc], io, next); + flic->pending |=3D ISC_TO_PENDING_IO(isc); + + qemu_s390_flic_notify(ISC_TO_PENDING_IO(isc)); } =20 static void qemu_s390_inject_crw_mchk(S390FLICState *fs) { - S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + + g_assert(qemu_mutex_iothread_locked()); + flic->pending |=3D FLIC_PENDING_MCHK_CR; + + qemu_s390_flic_notify(FLIC_PENDING_MCHK_CR); +} + +bool qemu_s390_flic_has_service(QEMUS390FLICState *flic) +{ + /* called without lock via cc->has_work, will be validated under lock = */ + return !!(flic->pending & FLIC_PENDING_SERVICE); +} + +bool qemu_s390_flic_has_io(QEMUS390FLICState *flic, uint64_t cr6) +{ + /* called without lock via cc->has_work, will be validated under lock = */ + return !!(flic->pending & CR6_TO_PENDING_IO(cr6)); +} + +bool qemu_s390_flic_has_crw_mchk(QEMUS390FLICState *flic) +{ + /* called without lock via cc->has_work, will be validated under lock = */ + return !!(flic->pending & FLIC_PENDING_MCHK_CR); +} =20 - /* FIXME: don't inject into dummy CPU */ - cpu_inject_crw_mchk(dummy_cpu); +bool qemu_s390_flic_has_any(QEMUS390FLICState *flic) +{ + g_assert(qemu_mutex_iothread_locked()); + return !!flic->pending; } =20 static void qemu_s390_flic_reset(DeviceState *dev) { QEMUS390FLICState *flic =3D QEMU_S390_FLIC(dev); + QEMUS390FlicIO *cur, *next; + int isc; =20 + g_assert(qemu_mutex_iothread_locked()); flic->simm =3D 0; flic->nimm =3D 0; + flic->pending =3D 0; + + /* remove all pending io interrupts */ + for (isc =3D 0; isc < 8; isc++) { + QLIST_FOREACH_SAFE(cur, &flic->io[isc], next, next) { + QLIST_REMOVE(cur, next); + g_free(cur); + } + } } =20 bool ais_needed(void *opaque) @@ -183,6 +296,16 @@ static const VMStateDescription qemu_s390_flic_vmstate= =3D { } }; =20 +static void qemu_s390_flic_instance_init(Object *obj) +{ + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(obj); + int isc; + + for (isc =3D 0; isc < 8; isc++) { + QLIST_INIT(&flic->io[isc]); + } +} + static void qemu_s390_flic_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -234,6 +357,7 @@ static const TypeInfo qemu_s390_flic_info =3D { .name =3D TYPE_QEMU_S390_FLIC, .parent =3D TYPE_S390_FLIC_COMMON, .instance_size =3D sizeof(QEMUS390FLICState), + .instance_init =3D qemu_s390_flic_instance_init, .class_init =3D qemu_s390_flic_class_init, }; =20 diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index d0538134b7..566d153371 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -16,6 +16,7 @@ #include "hw/sysbus.h" #include "hw/s390x/adapter.h" #include "hw/virtio/virtio.h" +#include "qemu/queue.h" =20 /* * Reserve enough gsis to accommodate all virtio devices. @@ -85,12 +86,52 @@ typedef struct S390FLICStateClass { #define SIC_IRQ_MODE_SINGLE 1 #define AIS_MODE_MASK(isc) (0x80 >> isc) =20 +#define ISC_TO_PENDING_IO(_isc) (0x80 >> (_isc)) +#define CR6_TO_PENDING_IO(_cr6) (((_cr6) >> 24) & 0xff) + +/* organize the ISC bits so that the macros above work */ +#define FLIC_PENDING_IO_ISC7 (1 << 0) +#define FLIC_PENDING_IO_ISC6 (1 << 1) +#define FLIC_PENDING_IO_ISC5 (1 << 2) +#define FLIC_PENDING_IO_ISC4 (1 << 3) +#define FLIC_PENDING_IO_ISC3 (1 << 4) +#define FLIC_PENDING_IO_ISC2 (1 << 5) +#define FLIC_PENDING_IO_ISC1 (1 << 6) +#define FLIC_PENDING_IO_ISC0 (1 << 7) +#define FLIC_PENDING_SERVICE (1 << 8) +#define FLIC_PENDING_MCHK_CR (1 << 9) + +#define FLIC_PENDING_IO (FLIC_PENDING_IO_ISC0 | FLIC_PENDING_IO_ISC1 | \ + FLIC_PENDING_IO_ISC2 | FLIC_PENDING_IO_ISC3 | \ + FLIC_PENDING_IO_ISC4 | FLIC_PENDING_IO_ISC5 | \ + FLIC_PENDING_IO_ISC6 | FLIC_PENDING_IO_ISC7) + +typedef struct QEMUS390FlicIO { + uint16_t id; + uint16_t nr; + uint32_t parm; + uint32_t word; + QLIST_ENTRY(QEMUS390FlicIO) next; +} QEMUS390FlicIO; + typedef struct QEMUS390FLICState { S390FLICState parent_obj; + uint32_t pending; + uint32_t service_param; uint8_t simm; uint8_t nimm; + QLIST_HEAD(, QEMUS390FlicIO) io[8]; } QEMUS390FLICState; =20 +uint32_t qemu_s390_flic_dequeue_service(QEMUS390FLICState *flic); +QEMUS390FlicIO *qemu_s390_flic_dequeue_io(QEMUS390FLICState *flic, + uint64_t cr6); +void qemu_s390_flic_dequeue_crw_mchk(QEMUS390FLICState *flic); +bool qemu_s390_flic_has_service(QEMUS390FLICState *flic); +bool qemu_s390_flic_has_io(QEMUS390FLICState *fs, uint64_t cr6); +bool qemu_s390_flic_has_crw_mchk(QEMUS390FLICState *flic); +bool qemu_s390_flic_has_any(QEMUS390FLICState *flic); + void s390_flic_init(void); =20 S390FLICState *s390_get_flic(void); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 243804fbfc..da7cb9c278 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -100,7 +100,6 @@ static void s390_cpu_initial_reset(CPUState *s) { S390CPU *cpu =3D S390_CPU(s); CPUS390XState *env =3D &cpu->env; - int i; =20 s390_cpu_reset(s); /* initial reset does not clear everything! */ @@ -116,9 +115,6 @@ static void s390_cpu_initial_reset(CPUState *s) env->gbea =3D 1; =20 env->pfault_token =3D -1UL; - for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { - env->io_index[i] =3D -1; - } =20 /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, @@ -136,7 +132,6 @@ static void s390_cpu_full_reset(CPUState *s) S390CPU *cpu =3D S390_CPU(s); S390CPUClass *scc =3D S390_CPU_GET_CLASS(cpu); CPUS390XState *env =3D &cpu->env; - int i; =20 scc->parent_reset(s); cpu->env.sigp_order =3D 0; @@ -152,9 +147,6 @@ static void s390_cpu_full_reset(CPUState *s) env->gbea =3D 1; =20 env->pfault_token =3D -1UL; - for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { - env->io_index[i] =3D -1; - } =20 /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 9d3aa05a47..ba6cf0cda5 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -53,8 +53,6 @@ =20 #define MMU_USER_IDX 0 =20 -#define MAX_IO_QUEUE 16 - #define S390_MAX_CPUS 248 =20 typedef struct PSW { @@ -62,13 +60,6 @@ typedef struct PSW { uint64_t addr; } PSW; =20 -typedef struct IOIntQueue { - uint16_t id; - uint16_t nr; - uint32_t parm; - uint32_t word; -} IOIntQueue; - struct CPUS390XState { uint64_t regs[16]; /* GP registers */ /* @@ -114,13 +105,9 @@ struct CPUS390XState { =20 uint64_t cregs[16]; /* control registers */ =20 - IOIntQueue io_queue[MAX_IO_QUEUE][8]; - int pending_int; - uint32_t service_param; uint16_t external_call_addr; DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); - int io_index[8]; =20 uint64_t ckc; uint64_t cputm; @@ -399,9 +386,6 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* = env, target_ulong *pc, #define EXCP_IO 7 /* I/O interrupt */ #define EXCP_MCHK 8 /* machine check */ =20 -#define INTERRUPT_IO (1 << 0) -#define INTERRUPT_MCHK (1 << 1) -#define INTERRUPT_EXT_SERVICE (1 << 2) #define INTERRUPT_EXT_CPU_TIMER (1 << 3) #define INTERRUPT_EXT_CLOCK_COMPARATOR (1 << 4) #define INTERRUPT_EXTERNAL_CALL (1 << 5) @@ -741,12 +725,6 @@ void s390_program_interrupt(CPUS390XState *env, uint32= _t code, int ilen, uintptr_t ra); /* service interrupts are floating therefore we must not pass an cpustate = */ void s390_sclp_extint(uint32_t parm); -/* FIXME: remove once we have proper floating interrupts in TCG */ -void cpu_inject_service(S390CPU *cpu, uint32_t param); -void cpu_inject_crw_mchk(S390CPU *cpu); -void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, - uint16_t subchannel_number, uint32_t io_int_parm, - uint32_t io_int_word); =20 /* mmu_helper.c */ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *host= buf, diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 23447af942..86ec9e63f0 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -29,6 +29,7 @@ #include "exec/address-spaces.h" #ifndef CONFIG_USER_ONLY #include "sysemu/sysemu.h" +#include "hw/s390x/s390_flic.h" #endif =20 /* #define DEBUG_S390 */ @@ -237,6 +238,7 @@ static void do_svc_interrupt(CPUS390XState *env) =20 static void do_ext_interrupt(CPUS390XState *env) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); S390CPU *cpu =3D s390_env_get_cpu(env); uint64_t mask, addr; uint16_t cpu_addr; @@ -273,17 +275,14 @@ static void do_ext_interrupt(CPUS390XState *env) lowcore->ext_int_code =3D cpu_to_be16(EXT_CPU_TIMER); lowcore->cpu_addr =3D 0; env->pending_int &=3D ~INTERRUPT_EXT_CPU_TIMER; - } else if ((env->pending_int & INTERRUPT_EXT_SERVICE) && + } else if (qemu_s390_flic_has_service(flic) && (env->cregs[0] & CR0_SERVICE_SC)) { - /* - * FIXME: floating IRQs should be considered by all CPUs and - * shuld not get cleared by CPU reset. - */ + uint32_t param; + + param =3D qemu_s390_flic_dequeue_service(flic); lowcore->ext_int_code =3D cpu_to_be16(EXT_SERVICE); - lowcore->ext_params =3D cpu_to_be32(env->service_param); + lowcore->ext_params =3D cpu_to_be32(param); lowcore->cpu_addr =3D 0; - env->service_param =3D 0; - env->pending_int &=3D ~INTERRUPT_EXT_SERVICE; } else { g_assert_not_reached(); } @@ -303,71 +302,37 @@ static void do_ext_interrupt(CPUS390XState *env) =20 static void do_io_interrupt(CPUS390XState *env) { - S390CPU *cpu =3D s390_env_get_cpu(env); + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + uint64_t mask, addr; + QEMUS390FlicIO *io; LowCore *lowcore; - IOIntQueue *q; - uint8_t isc; - int disable =3D 1; - int found =3D 0; - - if (!(env->psw.mask & PSW_MASK_IO)) { - cpu_abort(CPU(cpu), "I/O int w/o I/O mask\n"); - } - - for (isc =3D 0; isc < ARRAY_SIZE(env->io_index); isc++) { - uint64_t isc_bits; - - if (env->io_index[isc] < 0) { - continue; - } - if (env->io_index[isc] >=3D MAX_IO_QUEUE) { - cpu_abort(CPU(cpu), "I/O queue overrun for isc %d: %d\n", - isc, env->io_index[isc]); - } - - q =3D &env->io_queue[env->io_index[isc]][isc]; - isc_bits =3D ISC_TO_ISC_BITS(IO_INT_WORD_ISC(q->word)); - if (!(env->cregs[6] & isc_bits)) { - disable =3D 0; - continue; - } - if (!found) { - uint64_t mask, addr; =20 - found =3D 1; - lowcore =3D cpu_map_lowcore(env); + g_assert(env->psw.mask & PSW_MASK_IO); + io =3D qemu_s390_flic_dequeue_io(flic, env->cregs[6]); + g_assert(io); =20 - lowcore->subchannel_id =3D cpu_to_be16(q->id); - lowcore->subchannel_nr =3D cpu_to_be16(q->nr); - lowcore->io_int_parm =3D cpu_to_be32(q->parm); - lowcore->io_int_word =3D cpu_to_be32(q->word); - lowcore->io_old_psw.mask =3D cpu_to_be64(get_psw_mask(env)); - lowcore->io_old_psw.addr =3D cpu_to_be64(env->psw.addr); - mask =3D be64_to_cpu(lowcore->io_new_psw.mask); - addr =3D be64_to_cpu(lowcore->io_new_psw.addr); - - cpu_unmap_lowcore(lowcore); - - env->io_index[isc]--; + lowcore =3D cpu_map_lowcore(env); =20 - DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__, - env->psw.mask, env->psw.addr); - load_psw(env, mask, addr); - } - if (env->io_index[isc] >=3D 0) { - disable =3D 0; - } - continue; - } + lowcore->subchannel_id =3D cpu_to_be16(io->id); + lowcore->subchannel_nr =3D cpu_to_be16(io->nr); + lowcore->io_int_parm =3D cpu_to_be32(io->parm); + lowcore->io_int_word =3D cpu_to_be32(io->word); + lowcore->io_old_psw.mask =3D cpu_to_be64(get_psw_mask(env)); + lowcore->io_old_psw.addr =3D cpu_to_be64(env->psw.addr); + mask =3D be64_to_cpu(lowcore->io_new_psw.mask); + addr =3D be64_to_cpu(lowcore->io_new_psw.addr); =20 - if (disable) { - env->pending_int &=3D ~INTERRUPT_IO; - } + cpu_unmap_lowcore(lowcore); + g_free(io); =20 + DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__, env->psw.mask, + env->psw.addr); + load_psw(env, mask, addr); } =20 static void do_mchk_interrupt(CPUS390XState *env) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); uint64_t mask, addr; LowCore *lowcore; int i; @@ -376,8 +341,7 @@ static void do_mchk_interrupt(CPUS390XState *env) g_assert(env->psw.mask & PSW_MASK_MCHECK); g_assert(env->cregs[14] & CR14_CHANNEL_REPORT_SC); =20 - g_assert(env->pending_int & INTERRUPT_MCHK); - env->pending_int &=3D ~INTERRUPT_MCHK; + qemu_s390_flic_dequeue_crw_mchk(flic); =20 lowcore =3D cpu_map_lowcore(env); =20 @@ -412,6 +376,7 @@ static void do_mchk_interrupt(CPUS390XState *env) =20 void s390_cpu_do_interrupt(CPUState *cs) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; bool stopped =3D false; @@ -474,7 +439,7 @@ try_deliver: cs->exception_index =3D -1; =20 /* we might still have pending interrupts, but not deliverable */ - if (!env->pending_int) { + if (!env->pending_int && !qemu_s390_flic_has_any(flic)) { cs->interrupt_request &=3D ~CPU_INTERRUPT_HARD; } =20 diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 8229572f7d..61691aa3a4 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -58,17 +58,6 @@ void s390_program_interrupt(CPUS390XState *env, uint32_t= code, int ilen, } =20 #if !defined(CONFIG_USER_ONLY) -void cpu_inject_service(S390CPU *cpu, uint32_t param) -{ - CPUS390XState *env =3D &cpu->env; - - /* multiplexing is good enough for sclp - kvm does it internally as we= ll*/ - env->service_param |=3D param; - - env->pending_int |=3D INTERRUPT_EXT_SERVICE; - cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); -} - void cpu_inject_clock_comparator(S390CPU *cpu) { CPUS390XState *env =3D &cpu->env; @@ -137,38 +126,6 @@ void cpu_inject_stop(S390CPU *cpu) cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } =20 -void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, - uint16_t subchannel_number, uint32_t io_int_parm, - uint32_t io_int_word) -{ - CPUS390XState *env =3D &cpu->env; - int isc =3D IO_INT_WORD_ISC(io_int_word); - - if (env->io_index[isc] =3D=3D MAX_IO_QUEUE - 1) { - /* ugh - can't queue anymore. Let's drop. */ - return; - } - - env->io_index[isc]++; - assert(env->io_index[isc] < MAX_IO_QUEUE); - - env->io_queue[env->io_index[isc]][isc].id =3D subchannel_id; - env->io_queue[env->io_index[isc]][isc].nr =3D subchannel_number; - env->io_queue[env->io_index[isc]][isc].parm =3D io_int_parm; - env->io_queue[env->io_index[isc]][isc].word =3D io_int_word; - - env->pending_int |=3D INTERRUPT_IO; - cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); -} - -void cpu_inject_crw_mchk(S390CPU *cpu) -{ - CPUS390XState *env =3D &cpu->env; - - env->pending_int |=3D INTERRUPT_MCHK; - cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); -} - /* * All of the following interrupts are floating, i.e. not per-vcpu. * We just need a dummy cpustate in order to be able to inject in the @@ -201,6 +158,7 @@ void s390_crw_mchk(void) =20 bool s390_cpu_has_mcck_int(S390CPU *cpu) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_MCHECK)) { @@ -208,7 +166,7 @@ bool s390_cpu_has_mcck_int(S390CPU *cpu) } =20 /* for now we only support channel report machine checks (floating) */ - if ((env->pending_int & INTERRUPT_MCHK) && + if (qemu_s390_flic_has_crw_mchk(flic) && (env->cregs[14] & CR14_CHANNEL_REPORT_SC)) { return true; } @@ -218,6 +176,7 @@ bool s390_cpu_has_mcck_int(S390CPU *cpu) =20 bool s390_cpu_has_ext_int(S390CPU *cpu) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_EXT)) { @@ -249,7 +208,7 @@ bool s390_cpu_has_ext_int(S390CPU *cpu) return true; } =20 - if ((env->pending_int & INTERRUPT_EXT_SERVICE) && + if (qemu_s390_flic_has_service(flic) && (env->cregs[0] & CR0_SERVICE_SC)) { return true; } @@ -259,13 +218,14 @@ bool s390_cpu_has_ext_int(S390CPU *cpu) =20 bool s390_cpu_has_io_int(S390CPU *cpu) { + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_IO)) { return false; } =20 - return env->pending_int & INTERRUPT_IO; + return qemu_s390_flic_has_io(flic, env->cregs[6]); } =20 bool s390_cpu_has_restart_int(S390CPU *cpu) --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169238882637.0508698881422; Fri, 9 Feb 2018 01:40:38 -0800 (PST) Received: from localhost ([::1]:53021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5AW-0006EH-3i for importer@patchew.org; Fri, 09 Feb 2018 04:40:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wM-00020t-1x for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wK-00062w-Jl for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:53 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33108 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 1ek4wK-00062b-Em; Fri, 09 Feb 2018 04:25:52 -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 10A0E7D85D; Fri, 9 Feb 2018 09:25:52 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1E812024CA2; Fri, 9 Feb 2018 09:25:51 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:05 +0100 Message-Id: <20180209092524.31348-11-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.2]); Fri, 09 Feb 2018 09:25:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:52 +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 10/29] s390x/tcg: implement TEST PENDING INTERRUPTION 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 Use s390_cpu_virt_mem_write() so we can actually revert what we did (re-inject the dequeued IO interrupt). Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-10-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/helper.h | 1 + target/s390x/insn-data.def | 1 + target/s390x/misc_helper.c | 54 ++++++++++++++++++++++++++++++++++++++++++= ++++ target/s390x/translate.c | 8 +++++++ 4 files changed, 64 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 59a1d9869b..05d52ff309 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -170,6 +170,7 @@ DEF_HELPER_4(schm, void, env, i64, i64, i64) DEF_HELPER_3(ssch, void, env, i64, i64) DEF_HELPER_2(stcrw, void, env, i64) DEF_HELPER_3(stsch, void, env, i64, i64) +DEF_HELPER_2(tpi, i32, env, i64) DEF_HELPER_3(tsch, void, env, i64, i64) DEF_HELPER_2(chsc, void, env, i64) #endif diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 11ee43dcbc..c06c3884c0 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1063,6 +1063,7 @@ C(0xb233, SSCH, S, Z, 0, insn, 0, 0, ssch, 0) C(0xb239, STCRW, S, Z, 0, insn, 0, 0, stcrw, 0) C(0xb234, STSCH, S, Z, 0, insn, 0, 0, stsch, 0) + C(0xb236, TPI , S, Z, la2, 0, 0, 0, tpi, 0) C(0xb235, TSCH, S, Z, 0, insn, 0, 0, tsch, 0) /* ??? Not listed in PoO ninth edition, but there's a linux driver that uses it: "A CHSC subchannel is usually present on LPAR only." */ diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 86da6aab7e..6ee7e8a64a 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -36,6 +36,7 @@ #include "hw/s390x/ebcdic.h" #include "hw/s390x/s390-virtio-hcall.h" #include "hw/s390x/sclp.h" +#include "hw/s390x/s390_flic.h" #endif =20 /* #define DEBUG_HELPER */ @@ -429,6 +430,59 @@ void HELPER(stsch)(CPUS390XState *env, uint64_t r1, ui= nt64_t inst) qemu_mutex_unlock_iothread(); } =20 +uint32_t HELPER(tpi)(CPUS390XState *env, uint64_t addr) +{ + const uintptr_t ra =3D GETPC(); + S390CPU *cpu =3D s390_env_get_cpu(env); + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + QEMUS390FlicIO *io =3D NULL; + LowCore *lowcore; + + if (addr & 0x3) { + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); + } + + qemu_mutex_lock_iothread(); + io =3D qemu_s390_flic_dequeue_io(flic, env->cregs[6]); + if (!io) { + qemu_mutex_unlock_iothread(); + return 0; + } + + if (addr) { + struct { + uint16_t id; + uint16_t nr; + uint32_t parm; + } intc =3D { + .id =3D cpu_to_be16(io->id), + .nr =3D cpu_to_be16(io->nr), + .parm =3D cpu_to_be32(io->parm), + }; + + if (s390_cpu_virt_mem_write(cpu, addr, 0, &intc, sizeof(intc))) { + /* writing failed, reinject and properly clean up */ + s390_io_interrupt(io->id, io->nr, io->parm, io->word); + qemu_mutex_unlock_iothread(); + g_free(io); + s390_cpu_virt_mem_handle_exc(cpu, ra); + return 0; + } + } else { + /* no protection applies */ + lowcore =3D cpu_map_lowcore(env); + lowcore->subchannel_id =3D cpu_to_be16(io->id); + lowcore->subchannel_nr =3D cpu_to_be16(io->nr); + lowcore->io_int_parm =3D cpu_to_be32(io->parm); + lowcore->io_int_word =3D cpu_to_be32(io->word); + cpu_unmap_lowcore(lowcore); + } + + g_free(io); + qemu_mutex_unlock_iothread(); + return 1; +} + void HELPER(tsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu =3D s390_env_get_cpu(env); diff --git a/target/s390x/translate.c b/target/s390x/translate.c index df0b41606d..81abe40673 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4199,6 +4199,14 @@ static ExitStatus op_stcrw(DisasContext *s, DisasOps= *o) return NO_EXIT; } =20 +static ExitStatus op_tpi(DisasContext *s, DisasOps *o) +{ + check_privileged(s); + gen_helper_tpi(cc_op, cpu_env, o->addr1); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_tsch(DisasContext *s, DisasOps *o) { check_privileged(s); --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169247377851.045393193971; Fri, 9 Feb 2018 01:40:47 -0800 (PST) Received: from localhost ([::1]:53029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Ah-0006PI-6P for importer@patchew.org; Fri, 09 Feb 2018 04:40:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wN-00021J-0o for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wM-00064H-4n for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:55 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38378 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 1ek4wL-00063k-VS; Fri, 09 Feb 2018 04:25:54 -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 88E47EAE87; Fri, 9 Feb 2018 09:25:53 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4064210083A8; Fri, 9 Feb 2018 09:25:53 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:06 +0100 Message-Id: <20180209092524.31348-12-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 09 Feb 2018 09:25:53 +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 11/29] s390x/flic: implement qemu_s390_clear_io_flic() 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 Now that we have access to the io interrupts, we can implement clear_io_irq() for TCG. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-11-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 928bdc3037..cb216de9ba 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -79,8 +79,35 @@ static void qemu_s390_release_adapter_routes(S390FLICSta= te *fs, static int qemu_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_= id, uint16_t subchannel_nr) { - /* Fixme TCG */ - return -ENOSYS; + QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FlicIO *cur, *next; + uint8_t isc; + + g_assert(qemu_mutex_iothread_locked()); + if (!(flic->pending & FLIC_PENDING_IO)) { + return 0; + } + + /* check all iscs */ + for (isc =3D 0; isc < 8; isc++) { + if (QLIST_EMPTY(&flic->io[isc])) { + continue; + } + + /* search and delete any matching one */ + QLIST_FOREACH_SAFE(cur, &flic->io[isc], next, next) { + if (cur->id =3D=3D subchannel_id && cur->nr =3D=3D subchannel_= nr) { + QLIST_REMOVE(cur, next); + g_free(cur); + } + } + + /* update our indicator bit */ + if (QLIST_EMPTY(&flic->io[isc])) { + flic->pending &=3D ~ISC_TO_PENDING_IO(isc); + } + } + return 0; } =20 static int qemu_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc, --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168747566616.6594732451435; Fri, 9 Feb 2018 01:32:27 -0800 (PST) Received: from localhost ([::1]:52953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek52b-0007li-T4 for importer@patchew.org; Fri, 09 Feb 2018 04:32:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wO-00023S-KV for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wN-00065b-JV for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:56 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33118 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 1ek4wN-00065D-DL; Fri, 09 Feb 2018 04:25:55 -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 03AF77D824; Fri, 9 Feb 2018 09:25:55 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B06512024CA2; Fri, 9 Feb 2018 09:25:54 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:07 +0100 Message-Id: <20180209092524.31348-13-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.2]); Fri, 09 Feb 2018 09:25:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:55 +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 12/29] s390x/flic: optimize CPU wakeup for TCG 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 Kicking all CPUs on every floating interrupt is far from efficient. Let's optimize it at least a little bit. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-12-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 31 +++++++++++++++++++++++++++++-- target/s390x/cpu.h | 4 ++++ target/s390x/internal.h | 5 ----- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index cb216de9ba..5febde2d65 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -161,10 +161,37 @@ static void qemu_s390_flic_notify(uint32_t type) =20 /* * We have to make all CPUs see CPU_INTERRUPT_HARD, so they might - * consider it. TODO: don't kick/wakeup all VCPUs but try to be - * smarter (using the interrupt type). + * consider it. We will kick all running CPUs and only relevant + * sleeping ones. */ CPU_FOREACH(cs) { + S390CPU *cpu =3D S390_CPU(cs); + + cs->interrupt_request |=3D CPU_INTERRUPT_HARD; + + /* ignore CPUs that are not sleeping */ + if (s390_cpu_get_state(cpu) !=3D CPU_STATE_OPERATING && + s390_cpu_get_state(cpu) !=3D CPU_STATE_LOAD) { + continue; + } + + /* we always kick running CPUs for now, this is tricky */ + if (cs->halted) { + /* don't check for subclasses, CPUs double check when waking u= p */ + if (type & FLIC_PENDING_SERVICE) { + if (!(cpu->env.psw.mask & PSW_MASK_EXT)) { + continue; + } + } else if (type & FLIC_PENDING_IO) { + if (!(cpu->env.psw.mask & PSW_MASK_IO)) { + continue; + } + } else if (type & FLIC_PENDING_MCHK_CR) { + if (!(cpu->env.psw.mask & PSW_MASK_MCHECK)) { + continue; + } + } + } cpu_interrupt(cs, CPU_INTERRUPT_HARD); } } diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index ba6cf0cda5..76c31d970f 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -692,6 +692,10 @@ static inline unsigned int s390_cpu_set_state(uint8_t = cpu_state, S390CPU *cpu) return 0; } #endif /* CONFIG_USER_ONLY */ +static inline uint8_t s390_cpu_get_state(S390CPU *cpu) +{ + return cpu->env.cpu_state; +} =20 =20 /* cpu_models.c */ diff --git a/target/s390x/internal.h b/target/s390x/internal.h index fea165ffe4..d911e84958 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -278,11 +278,6 @@ static inline void s390_do_cpu_full_reset(CPUState *cs= , run_on_cpu_data arg) cpu_reset(cs); } =20 -static inline uint8_t s390_cpu_get_state(S390CPU *cpu) -{ - return cpu->env.cpu_state; -} - =20 /* arch_dump.c */ int s390_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168494782446.43688363887986; Fri, 9 Feb 2018 01:28:14 -0800 (PST) Received: from localhost ([::1]:52926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4yb-0003c9-S8 for importer@patchew.org; Fri, 09 Feb 2018 04:28:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wQ-00025s-C7 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wP-00066Y-1p for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:25:58 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33128 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 1ek4wO-00066D-SF; Fri, 09 Feb 2018 04:25:56 -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 74FC27D845; Fri, 9 Feb 2018 09:25:56 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C936B350D; Fri, 9 Feb 2018 09:25:56 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:08 +0100 Message-Id: <20180209092524.31348-14-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:56 +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 13/29] s390x: fix size + content of STSI blocks 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 All blocks are 4k in size, which is only true for two of them right now. Also some reserved fields were wrong, fix it and convert all reserved fields to u8. This also fixes the LPAR part output in /proc/sysinfo under TCG. (for now, everything was indicated as 0) While at it, introduce typedefs for these structs and use them in TCG/KVM code. Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-13-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.h | 46 ++++++++++++++++++++++++++----------------= ---- target/s390x/kvm.c | 2 +- target/s390x/misc_helper.c | 12 ++++++------ 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 76c31d970f..1475d705a4 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -437,29 +437,31 @@ static inline void setcc(S390CPU *cpu, uint64_t cc) #define STSI_R1_SEL2_MASK 0x000000000000ffffULL =20 /* Basic Machine Configuration */ -struct sysib_111 { - uint32_t res1[8]; +typedef struct SysIB_111 { + uint8_t res1[32]; uint8_t manuf[16]; uint8_t type[4]; uint8_t res2[12]; uint8_t model[16]; uint8_t sequence[16]; uint8_t plant[4]; - uint8_t res3[156]; -}; + uint8_t res3[3996]; +} SysIB_111; +QEMU_BUILD_BUG_ON(sizeof(SysIB_111) !=3D 4096); =20 /* Basic Machine CPU */ -struct sysib_121 { - uint32_t res1[80]; +typedef struct SysIB_121 { + uint8_t res1[80]; uint8_t sequence[16]; uint8_t plant[4]; uint8_t res2[2]; uint16_t cpu_addr; - uint8_t res3[152]; -}; + uint8_t res3[3992]; +} SysIB_121; +QEMU_BUILD_BUG_ON(sizeof(SysIB_121) !=3D 4096); =20 /* Basic Machine CPUs */ -struct sysib_122 { +typedef struct SysIB_122 { uint8_t res1[32]; uint32_t capability; uint16_t total_cpus; @@ -467,21 +469,23 @@ struct sysib_122 { uint16_t standby_cpus; uint16_t reserved_cpus; uint16_t adjustments[2026]; -}; +} SysIB_122; +QEMU_BUILD_BUG_ON(sizeof(SysIB_122) !=3D 4096); =20 /* LPAR CPU */ -struct sysib_221 { - uint32_t res1[80]; +typedef struct SysIB_221 { + uint8_t res1[80]; uint8_t sequence[16]; uint8_t plant[4]; uint16_t cpu_id; uint16_t cpu_addr; - uint8_t res3[152]; -}; + uint8_t res3[3992]; +} SysIB_221; +QEMU_BUILD_BUG_ON(sizeof(SysIB_221) !=3D 4096); =20 /* LPAR CPUs */ -struct sysib_222 { - uint32_t res1[32]; +typedef struct SysIB_222 { + uint8_t res1[32]; uint16_t lpar_num; uint8_t res2; uint8_t lcpuc; @@ -494,11 +498,12 @@ struct sysib_222 { uint8_t res3[16]; uint16_t dedicated_cpus; uint16_t shared_cpus; - uint8_t res4[180]; -}; + uint8_t res4[4020]; +} SysIB_222; +QEMU_BUILD_BUG_ON(sizeof(SysIB_222) !=3D 4096); =20 /* VM CPUs */ -struct sysib_322 { +typedef struct SysIB_322 { uint8_t res1[31]; uint8_t count; struct { @@ -517,7 +522,8 @@ struct sysib_322 { } vm[8]; uint8_t res4[1504]; uint8_t ext_names[8][256]; -}; +} SysIB_322; +QEMU_BUILD_BUG_ON(sizeof(SysIB_322) !=3D 4096); =20 /* MMU defines */ #define _ASCE_ORIGIN ~0xfffULL /* segment table origin = */ diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index db5fe084ff..bfd14723f1 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1675,7 +1675,7 @@ static int handle_tsch(S390CPU *cpu) =20 static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar) { - struct sysib_322 sysib; + SysIB_322 sysib; int del; =20 if (s390_cpu_virt_mem_read(cpu, addr, ar, &sysib, sizeof(sysib))) { diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 6ee7e8a64a..466231de0b 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -217,7 +217,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, case STSI_LEVEL_1: if ((sel1 =3D=3D 1) && (sel2 =3D=3D 1)) { /* Basic Machine Configuration */ - struct sysib_111 sysib; + SysIB_111 sysib; char type[5] =3D {}; =20 memset(&sysib, 0, sizeof(sysib)); @@ -232,7 +232,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 1)) { /* Basic Machine CPU */ - struct sysib_121 sysib; + SysIB_121 sysib; =20 memset(&sysib, 0, sizeof(sysib)); /* XXX make different for different CPUs? */ @@ -242,7 +242,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* Basic Machine CPUs */ - struct sysib_122 sysib; + SysIB_122 sysib; =20 memset(&sysib, 0, sizeof(sysib)); stl_p(&sysib.capability, 0x443afc29); @@ -260,7 +260,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, { if ((sel1 =3D=3D 2) && (sel2 =3D=3D 1)) { /* LPAR CPU */ - struct sysib_221 sysib; + SysIB_221 sysib; =20 memset(&sysib, 0, sizeof(sysib)); /* XXX make different for different CPUs? */ @@ -271,7 +271,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* LPAR CPUs */ - struct sysib_222 sysib; + SysIB_222 sysib; =20 memset(&sysib, 0, sizeof(sysib)); stw_p(&sysib.lpar_num, 0); @@ -295,7 +295,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, { if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* VM CPUs */ - struct sysib_322 sysib; + SysIB_322 sysib; =20 memset(&sysib, 0, sizeof(sysib)); sysib.count =3D 1; --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169449271275.64099412769724; Fri, 9 Feb 2018 01:44:09 -0800 (PST) Received: from localhost ([::1]:53091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Dw-0000p9-Rf for importer@patchew.org; Fri, 09 Feb 2018 04:44:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wV-0002CY-4W for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wQ-00067l-L8 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:03 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33136 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 1ek4wQ-00067K-Er; Fri, 09 Feb 2018 04:25:58 -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 0FC1484221; Fri, 9 Feb 2018 09:25:58 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E293F41B0; Fri, 9 Feb 2018 09:25:57 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:09 +0100 Message-Id: <20180209092524.31348-15-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:25:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:25:58 +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 14/29] s390x/tcg: STSI overhaul 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 Current STSI implementation is a mess, so let's rewrite it. Problems fixed by this patch: 1) The order of exceptions/when recognized is wrong. 2) We have to store to virtual address space, not absolute. 3) Alignment check of the block is missing. 3) The SMP information is not indicated. While at it: a) Make the code look nicer - get rid of nesting levels - use struct initialization instead of initializing to zero - rename a misspelled field and rename function code defines - use a union and have only one write statement - use cpu_to_beX() b) Indicate the VM name/extended name + UUID just like KVM does c) Indicate that all LPAR CPUs we fake are dedicated d) Add a comment why we fake being a KVM guest e) Give our guest as default the name "TCGguest" f) Fake the same CPU information we have in our Guest for all layers While at it, get rid of "potential_page_fault()" by forwarding the retaddr properly. The result is best verified by looking at "/proc/sysinfo" in the guest when specifying on the qemu command line -uuid "74738ff5-5367-5958-9aee-98fffdcd1876" \ -name "extra long guest name" Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-14-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.h | 22 +++-- target/s390x/misc_helper.c | 212 ++++++++++++++++++++++++-----------------= ---- 2 files changed, 131 insertions(+), 103 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 1475d705a4..21ce40d5b6 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -426,11 +426,11 @@ static inline void setcc(S390CPU *cpu, uint64_t cc) } =20 /* STSI */ -#define STSI_LEVEL_MASK 0x00000000f0000000ULL -#define STSI_LEVEL_CURRENT 0x0000000000000000ULL -#define STSI_LEVEL_1 0x0000000010000000ULL -#define STSI_LEVEL_2 0x0000000020000000ULL -#define STSI_LEVEL_3 0x0000000030000000ULL +#define STSI_R0_FC_MASK 0x00000000f0000000ULL +#define STSI_R0_FC_CURRENT 0x0000000000000000ULL +#define STSI_R0_FC_LEVEL_1 0x0000000010000000ULL +#define STSI_R0_FC_LEVEL_2 0x0000000020000000ULL +#define STSI_R0_FC_LEVEL_3 0x0000000030000000ULL #define STSI_R0_RESERVED_MASK 0x000000000fffff00ULL #define STSI_R0_SEL1_MASK 0x00000000000000ffULL #define STSI_R1_RESERVED_MASK 0x00000000ffff0000ULL @@ -465,7 +465,7 @@ typedef struct SysIB_122 { uint8_t res1[32]; uint32_t capability; uint16_t total_cpus; - uint16_t active_cpus; + uint16_t conf_cpus; uint16_t standby_cpus; uint16_t reserved_cpus; uint16_t adjustments[2026]; @@ -525,6 +525,16 @@ typedef struct SysIB_322 { } SysIB_322; QEMU_BUILD_BUG_ON(sizeof(SysIB_322) !=3D 4096); =20 +typedef union SysIB { + SysIB_111 sysib_111; + SysIB_121 sysib_121; + SysIB_122 sysib_122; + SysIB_221 sysib_221; + SysIB_222 sysib_222; + SysIB_322 sysib_322; +} SysIB; +QEMU_BUILD_BUG_ON(sizeof(SysIB) !=3D 4096); + /* MMU defines */ #define _ASCE_ORIGIN ~0xfffULL /* segment table origin = */ #define _ASCE_SUBSPACE 0x200 /* subspace group control = */ diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 466231de0b..c1ff152571 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -37,6 +37,8 @@ #include "hw/s390x/s390-virtio-hcall.h" #include "hw/s390x/sclp.h" #include "hw/s390x/s390_flic.h" +#include "hw/s390x/ioinst.h" +#include "hw/boards.h" #endif =20 /* #define DEBUG_HELPER */ @@ -195,132 +197,148 @@ void HELPER(spt)(CPUS390XState *env, uint64_t time) } =20 /* Store System Information */ -uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, - uint64_t r0, uint64_t r1) +uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64= _t r1) { + const uintptr_t ra =3D GETPC(); + const uint32_t sel1 =3D r0 & STSI_R0_SEL1_MASK; + const uint32_t sel2 =3D r1 & STSI_R1_SEL2_MASK; + const MachineState *ms =3D MACHINE(qdev_get_machine()); + uint16_t total_cpus =3D 0, conf_cpus =3D 0, reserved_cpus =3D 0; S390CPU *cpu =3D s390_env_get_cpu(env); - int cc =3D 0; - int sel1, sel2; + SysIB sysib =3D { 0 }; + int i, cc =3D 0; + + if ((r0 & STSI_R0_FC_MASK) > STSI_R0_FC_LEVEL_3) { + /* invalid function code: no other checks are performed */ + return 3; + } =20 - if ((r0 & STSI_LEVEL_MASK) <=3D STSI_LEVEL_3 && - ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK))) { - /* valid function code, invalid reserved bits */ - s390_program_interrupt(env, PGM_SPECIFICATION, 4, GETPC()); + if ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK)) { + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); } =20 - sel1 =3D r0 & STSI_R0_SEL1_MASK; - sel2 =3D r1 & STSI_R1_SEL2_MASK; + if ((r0 & STSI_R0_FC_MASK) =3D=3D STSI_R0_FC_CURRENT) { + /* query the current level: no further checks are performed */ + env->regs[0] =3D STSI_R0_FC_LEVEL_3; + return 0; + } =20 - /* XXX: spec exception if sysib is not 4k-aligned */ + if (a0 & ~TARGET_PAGE_MASK) { + s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); + } =20 - switch (r0 & STSI_LEVEL_MASK) { - case STSI_LEVEL_1: + /* count the cpus and split them into configured and reserved ones */ + for (i =3D 0; i < ms->possible_cpus->len; i++) { + total_cpus++; + if (ms->possible_cpus->cpus[i].cpu) { + conf_cpus++; + } else { + reserved_cpus++; + } + } + + /* + * In theory, we could report Level 1 / Level 2 as current. However, + * the Linux kernel will detect this as running under LPAR and assume + * that we have a sclp linemode console (which is always present on + * LPAR, but not the default for QEMU), therefore not displaying boot + * messages and making booting a Linux kernel under TCG harder. + * + * For now we fake the same SMP configuration on all levels. + * + * TODO: We could later make the level configurable via the machine + * and change defaults (linemode console) based on machine type + * and accelerator. + */ + switch (r0 & STSI_R0_FC_MASK) { + case STSI_R0_FC_LEVEL_1: if ((sel1 =3D=3D 1) && (sel2 =3D=3D 1)) { /* Basic Machine Configuration */ - SysIB_111 sysib; char type[5] =3D {}; =20 - memset(&sysib, 0, sizeof(sysib)); - ebcdic_put(sysib.manuf, "QEMU ", 16); + ebcdic_put(sysib.sysib_111.manuf, "QEMU ", 16); /* same as machine type number in STORE CPU ID, but in EBCDIC = */ snprintf(type, ARRAY_SIZE(type), "%X", cpu->model->def->type); - ebcdic_put(sysib.type, type, 4); + ebcdic_put(sysib.sysib_111.type, type, 4); /* model number (not stored in STORE CPU ID for z/Architecure)= */ - ebcdic_put(sysib.model, "QEMU ", 16); - ebcdic_put(sysib.sequence, "QEMU ", 16); - ebcdic_put(sysib.plant, "QEMU", 4); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); + ebcdic_put(sysib.sysib_111.model, "QEMU ", 16); + ebcdic_put(sysib.sysib_111.sequence, "QEMU ", 16); + ebcdic_put(sysib.sysib_111.plant, "QEMU", 4); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 1)) { /* Basic Machine CPU */ - SysIB_121 sysib; - - memset(&sysib, 0, sizeof(sysib)); - /* XXX make different for different CPUs? */ - ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16); - ebcdic_put(sysib.plant, "QEMU", 4); - stw_p(&sysib.cpu_addr, env->core_id); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); + ebcdic_put(sysib.sysib_121.sequence, "QEMUQEMUQEMUQEMU", 16); + ebcdic_put(sysib.sysib_121.plant, "QEMU", 4); + sysib.sysib_121.cpu_addr =3D cpu_to_be16(env->core_id); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* Basic Machine CPUs */ - SysIB_122 sysib; - - memset(&sysib, 0, sizeof(sysib)); - stl_p(&sysib.capability, 0x443afc29); - /* XXX change when SMP comes */ - stw_p(&sysib.total_cpus, 1); - stw_p(&sysib.active_cpus, 1); - stw_p(&sysib.standby_cpus, 0); - stw_p(&sysib.reserved_cpus, 0); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); + sysib.sysib_122.capability =3D cpu_to_be32(0x443afc29); + sysib.sysib_122.total_cpus =3D cpu_to_be16(total_cpus); + sysib.sysib_122.conf_cpus =3D cpu_to_be16(conf_cpus); + sysib.sysib_122.reserved_cpus =3D cpu_to_be16(reserved_cpus); } else { cc =3D 3; } break; - case STSI_LEVEL_2: - { - if ((sel1 =3D=3D 2) && (sel2 =3D=3D 1)) { - /* LPAR CPU */ - SysIB_221 sysib; - - memset(&sysib, 0, sizeof(sysib)); - /* XXX make different for different CPUs? */ - ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16); - ebcdic_put(sysib.plant, "QEMU", 4); - stw_p(&sysib.cpu_addr, env->core_id); - stw_p(&sysib.cpu_id, 0); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); - } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { - /* LPAR CPUs */ - SysIB_222 sysib; - - memset(&sysib, 0, sizeof(sysib)); - stw_p(&sysib.lpar_num, 0); - sysib.lcpuc =3D 0; - /* XXX change when SMP comes */ - stw_p(&sysib.total_cpus, 1); - stw_p(&sysib.conf_cpus, 1); - stw_p(&sysib.standby_cpus, 0); - stw_p(&sysib.reserved_cpus, 0); - ebcdic_put(sysib.name, "QEMU ", 8); - stl_p(&sysib.caf, 1000); - stw_p(&sysib.dedicated_cpus, 0); - stw_p(&sysib.shared_cpus, 0); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); - } else { - cc =3D 3; - } - break; + case STSI_R0_FC_LEVEL_2: + if ((sel1 =3D=3D 2) && (sel2 =3D=3D 1)) { + /* LPAR CPU */ + ebcdic_put(sysib.sysib_221.sequence, "QEMUQEMUQEMUQEMU", 16); + ebcdic_put(sysib.sysib_221.plant, "QEMU", 4); + sysib.sysib_221.cpu_addr =3D cpu_to_be16(env->core_id); + } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { + /* LPAR CPUs */ + sysib.sysib_222.lcpuc =3D 0x80; /* dedicated */ + sysib.sysib_222.total_cpus =3D cpu_to_be16(total_cpus); + sysib.sysib_222.conf_cpus =3D cpu_to_be16(conf_cpus); + sysib.sysib_222.reserved_cpus =3D cpu_to_be16(reserved_cpus); + ebcdic_put(sysib.sysib_222.name, "QEMU ", 8); + sysib.sysib_222.caf =3D cpu_to_be32(1000); + sysib.sysib_222.dedicated_cpus =3D cpu_to_be16(conf_cpus); + } else { + cc =3D 3; } - case STSI_LEVEL_3: - { - if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { - /* VM CPUs */ - SysIB_322 sysib; - - memset(&sysib, 0, sizeof(sysib)); - sysib.count =3D 1; - /* XXX change when SMP comes */ - stw_p(&sysib.vm[0].total_cpus, 1); - stw_p(&sysib.vm[0].conf_cpus, 1); - stw_p(&sysib.vm[0].standby_cpus, 0); - stw_p(&sysib.vm[0].reserved_cpus, 0); - ebcdic_put(sysib.vm[0].name, "KVMguest", 8); - stl_p(&sysib.vm[0].caf, 1000); - ebcdic_put(sysib.vm[0].cpi, "KVM/Linux ", 16); - cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); + break; + case STSI_R0_FC_LEVEL_3: + if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { + /* VM CPUs */ + sysib.sysib_322.count =3D 1; + sysib.sysib_322.vm[0].total_cpus =3D cpu_to_be16(total_cpus); + sysib.sysib_322.vm[0].conf_cpus =3D cpu_to_be16(conf_cpus); + sysib.sysib_322.vm[0].reserved_cpus =3D cpu_to_be16(reserved_c= pus); + sysib.sysib_322.vm[0].caf =3D cpu_to_be32(1000); + /* Linux kernel uses this to distinguish us from z/VM */ + ebcdic_put(sysib.sysib_322.vm[0].cpi, "KVM/Linux ", 16); + sysib.sysib_322.vm[0].ext_name_encoding =3D 2; /* UTF-8 */ + + /* If our VM has a name, use the real name */ + if (qemu_name) { + memset(sysib.sysib_322.vm[0].name, 0x40, + sizeof(sysib.sysib_322.vm[0].name)); + ebcdic_put(sysib.sysib_322.vm[0].name, qemu_name, + MIN(sizeof(sysib.sysib_322.vm[0].name), + strlen(qemu_name))); + strncpy((char *)sysib.sysib_322.ext_names[0], qemu_name, + sizeof(sysib.sysib_322.ext_names[0])); } else { - cc =3D 3; + ebcdic_put(sysib.sysib_322.vm[0].name, "TCGguest", 8); + strcpy((char *)sysib.sysib_322.ext_names[0], "TCGguest"); } - break; + + /* add the uuid */ + memcpy(sysib.sysib_322.vm[0].uuid, &qemu_uuid, + sizeof(sysib.sysib_322.vm[0].uuid)); + } else { + cc =3D 3; } - case STSI_LEVEL_CURRENT: - env->regs[0] =3D STSI_LEVEL_3; - break; - default: - cc =3D 3; break; } =20 + if (cc =3D=3D 0) { + if (s390_cpu_virt_mem_write(cpu, a0, 0, &sysib, sizeof(sysib))) { + s390_cpu_virt_mem_handle_exc(cpu, ra); + } + } + return cc; } =20 --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169141343532.895256519823; Fri, 9 Feb 2018 01:39:01 -0800 (PST) Received: from localhost ([::1]:53003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek592-0004uv-Is for importer@patchew.org; Fri, 09 Feb 2018 04:39:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wZ-0002Hu-NM for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wU-00069S-6o for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:07 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55778 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 1ek4wU-00069B-0p; Fri, 09 Feb 2018 04:26:02 -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 7AE138185351; Fri, 9 Feb 2018 09:26:01 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3823E10083A8; Fri, 9 Feb 2018 09:25:59 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:10 +0100 Message-Id: <20180209092524.31348-16-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:26:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:26:01 +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 15/29] s390x/tcg: remove SMP warning 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 We should be pretty good in shape now. Floating interrupts are working and atomic instructions should be atomic. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-15-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 3807dcb097..2af3b3d112 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -78,10 +78,6 @@ static void s390_init_cpus(MachineState *machine) MachineClass *mc =3D MACHINE_GET_CLASS(machine); int i; =20 - if (tcg_enabled() && max_cpus > 1) { - error_report("WARNING: SMP support on s390x is experimental!"); - } - /* initialize possible_cpus */ mc->possible_cpu_arch_ids(machine); =20 --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169077434396.5625786681678; Fri, 9 Feb 2018 01:37:57 -0800 (PST) Received: from localhost ([::1]:52998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek580-00041q-Jw for importer@patchew.org; Fri, 09 Feb 2018 04:37:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wb-0002Jg-A8 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wV-0006Ac-Fk for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33150 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 1ek4wV-0006A2-Bu; Fri, 09 Feb 2018 04:26:03 -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 E6EE784222; Fri, 9 Feb 2018 09:26:02 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A394D10083A8; Fri, 9 Feb 2018 09:26:02 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:11 +0100 Message-Id: <20180209092524.31348-17-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:26:02 +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 16/29] configure: s390x supports mttcg now 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 s390x is ready. Most likely we are missing some pieces, but it should already be in pretty good shape now. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-16-david@redhat.com> Signed-off-by: Cornelia Huck --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1be413a004..2cf383549c 100755 --- a/configure +++ b/configure @@ -6731,6 +6731,7 @@ case "$target_name" in echo "TARGET_ABI32=3Dy" >> $config_target_mak ;; s390x) + mttcg=3Dyes gdb_xml_files=3D"s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xm= l s390-cr.xml s390-virt.xml s390-gs.xml" ;; tilegx) --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169630746986.6094545685402; Fri, 9 Feb 2018 01:47:10 -0800 (PST) Received: from localhost ([::1]:53586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Gv-0003pB-QK for importer@patchew.org; Fri, 09 Feb 2018 04:47:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wY-0002GD-4Q for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wW-0006BU-W0 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:06 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42584 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 1ek4wW-0006B7-Qh; Fri, 09 Feb 2018 04:26:04 -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 6208740FB62F; Fri, 9 Feb 2018 09:26:04 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C6382166BAE; Fri, 9 Feb 2018 09:26:03 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:12 +0100 Message-Id: <20180209092524.31348-18-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 09:26:04 +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 17/29] s390x/tcg: cache the qemu flic in a central function 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 This avoids tons of conversions when handling interrupts. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-17-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 23 +++++++++++++++++------ include/hw/s390x/s390_flic.h | 1 + target/s390x/interrupt.c | 6 +++--- target/s390x/misc_helper.c | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 5febde2d65..b46c0f1bb4 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -22,6 +22,17 @@ #include "qapi/error.h" #include "hw/s390x/s390-virtio-ccw.h" =20 +QEMUS390FLICState *s390_get_qemu_flic(S390FLICState *fs) +{ + static QEMUS390FLICState *flic; + + if (!flic) { + /* we only have one flic device, so this is fine to cache */ + flic =3D QEMU_S390_FLIC(fs); + } + return flic; +} + S390FLICState *s390_get_flic(void) { static S390FLICState *fs; @@ -79,7 +90,7 @@ static void qemu_s390_release_adapter_routes(S390FLICStat= e *fs, static int qemu_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_= id, uint16_t subchannel_nr) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); QEMUS390FlicIO *cur, *next; uint8_t isc; =20 @@ -113,7 +124,7 @@ static int qemu_s390_clear_io_flic(S390FLICState *fs, u= int16_t subchannel_id, static int qemu_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc, uint16_t mode) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); =20 switch (mode) { case SIC_IRQ_MODE_ALL: @@ -134,7 +145,7 @@ static int qemu_s390_modify_ais_mode(S390FLICState *fs,= uint8_t isc, static int qemu_s390_inject_airq(S390FLICState *fs, uint8_t type, uint8_t isc, uint8_t flags) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); bool flag =3D flags & S390_ADAPTER_SUPPRESSIBLE; uint32_t io_int_word =3D (isc << 27) | IO_INT_WORD_AI; @@ -246,7 +257,7 @@ void qemu_s390_flic_dequeue_crw_mchk(QEMUS390FLICState = *flic) =20 static void qemu_s390_inject_service(S390FLICState *fs, uint32_t parm) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); =20 g_assert(qemu_mutex_iothread_locked()); /* multiplexing is good enough for sclp - kvm does it internally as we= ll */ @@ -261,7 +272,7 @@ static void qemu_s390_inject_io(S390FLICState *fs, uint= 16_t subchannel_id, uint32_t io_int_word) { const uint8_t isc =3D IO_INT_WORD_ISC(io_int_word); - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); QEMUS390FlicIO *io; =20 g_assert(qemu_mutex_iothread_locked()); @@ -279,7 +290,7 @@ static void qemu_s390_inject_io(S390FLICState *fs, uint= 16_t subchannel_id, =20 static void qemu_s390_inject_crw_mchk(S390FLICState *fs) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(fs); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); =20 g_assert(qemu_mutex_iothread_locked()); flic->pending |=3D FLIC_PENDING_MCHK_CR; diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 566d153371..a636afce42 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -135,6 +135,7 @@ bool qemu_s390_flic_has_any(QEMUS390FLICState *flic); void s390_flic_init(void); =20 S390FLICState *s390_get_flic(void); +QEMUS390FLICState *s390_get_qemu_flic(S390FLICState *fs); bool ais_needed(void *opaque); =20 #endif /* HW_S390_FLIC_H */ diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 61691aa3a4..1947012b25 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -158,7 +158,7 @@ void s390_crw_mchk(void) =20 bool s390_cpu_has_mcck_int(S390CPU *cpu) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_MCHECK)) { @@ -176,7 +176,7 @@ bool s390_cpu_has_mcck_int(S390CPU *cpu) =20 bool s390_cpu_has_ext_int(S390CPU *cpu) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_EXT)) { @@ -218,7 +218,7 @@ bool s390_cpu_has_ext_int(S390CPU *cpu) =20 bool s390_cpu_has_io_int(S390CPU *cpu) { - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(s390_get_flic()); CPUS390XState *env =3D &cpu->env; =20 if (!(env->psw.mask & PSW_MASK_IO)) { diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index c1ff152571..45cab8c463 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -452,7 +452,7 @@ uint32_t HELPER(tpi)(CPUS390XState *env, uint64_t addr) { const uintptr_t ra =3D GETPC(); S390CPU *cpu =3D s390_env_get_cpu(env); - QEMUS390FLICState *flic =3D QEMU_S390_FLIC(s390_get_flic()); + QEMUS390FLICState *flic =3D s390_get_qemu_flic(s390_get_flic()); QEMUS390FlicIO *io =3D NULL; LowCore *lowcore; =20 --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168684229197.72358471057896; Fri, 9 Feb 2018 01:31:24 -0800 (PST) Received: from localhost ([::1]:52952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek51f-0006pb-Br for importer@patchew.org; Fri, 09 Feb 2018 04:31:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wZ-0002He-Fe for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wY-0006D0-FN for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:07 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53020 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 1ek4wY-0006CW-9f; Fri, 09 Feb 2018 04:26:06 -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 D31C340265F6; Fri, 9 Feb 2018 09:26:05 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89D8F2026DFD; Fri, 9 Feb 2018 09:26:05 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:13 +0100 Message-Id: <20180209092524.31348-19-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.6]); Fri, 09 Feb 2018 09:26:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 09 Feb 2018 09:26:05 +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 18/29] s390x/kvm: cache the kvm flic in a central function 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 This avoids tons of conversions when handling interrupts. Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-18-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic_kvm.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index d277ffdd2e..3f804ad52e 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -35,6 +35,17 @@ typedef struct KVMS390FLICState { bool clear_io_supported; } KVMS390FLICState; =20 +static KVMS390FLICState *s390_get_kvm_flic(S390FLICState *fs) +{ + static KVMS390FLICState *flic; + + if (!flic) { + /* we only have one flic device, so this is fine to cache */ + flic =3D KVM_S390_FLIC(fs); + } + return flic; +} + /** * flic_get_all_irqs - store all pending irqs in buffer * @buf: pointer to buffer which is passed to kernel @@ -117,7 +128,7 @@ static void kvm_s390_inject_flic(S390FLICState *fs, str= uct kvm_s390_irq *irq) int r; =20 if (use_flic) { - r =3D flic_enqueue_irqs(irq, sizeof(*irq), KVM_S390_FLIC(fs)); + r =3D flic_enqueue_irqs(irq, sizeof(*irq), s390_get_kvm_flic(fs)); if (r =3D=3D -ENOSYS) { use_flic =3D false; } @@ -174,7 +185,7 @@ static void kvm_s390_inject_crw_mchk(S390FLICState *fs) static int kvm_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_i= d, uint16_t subchannel_nr) { - KVMS390FLICState *flic =3D KVM_S390_FLIC(fs); + KVMS390FLICState *flic =3D s390_get_kvm_flic(fs); int rc; uint32_t sid =3D subchannel_id << 16 | subchannel_nr; struct kvm_device_attr attr =3D { @@ -192,7 +203,7 @@ static int kvm_s390_clear_io_flic(S390FLICState *fs, ui= nt16_t subchannel_id, static int kvm_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc, uint16_t mode) { - KVMS390FLICState *flic =3D KVM_S390_FLIC(fs); + KVMS390FLICState *flic =3D s390_get_kvm_flic(fs); struct kvm_s390_ais_req req =3D { .isc =3D isc, .mode =3D mode, @@ -212,7 +223,7 @@ static int kvm_s390_modify_ais_mode(S390FLICState *fs, = uint8_t isc, static int kvm_s390_inject_airq(S390FLICState *fs, uint8_t type, uint8_t isc, uint8_t flags) { - KVMS390FLICState *flic =3D KVM_S390_FLIC(fs); + KVMS390FLICState *flic =3D s390_get_kvm_flic(fs); uint32_t id =3D css_get_adapter_id(type, isc); struct kvm_device_attr attr =3D { .group =3D KVM_DEV_FLIC_AIRQ_INJECT, @@ -301,7 +312,7 @@ static int kvm_s390_io_adapter_map(S390FLICState *fs, u= int32_t id, .group =3D KVM_DEV_FLIC_ADAPTER_MODIFY, .addr =3D (uint64_t)&req, }; - KVMS390FLICState *flic =3D KVM_S390_FLIC(fs); + KVMS390FLICState *flic =3D s390_get_kvm_flic(fs); int r; =20 if (!kvm_gsi_routing_enabled()) { --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169459480677.4246121980224; Fri, 9 Feb 2018 01:44:19 -0800 (PST) Received: from localhost ([::1]:53135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5EA-00013V-FJ for importer@patchew.org; Fri, 09 Feb 2018 04:44:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wg-0002Mc-9D for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wb-0006Hm-Uo for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:14 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55790 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 1ek4wb-0006HB-PH; Fri, 09 Feb 2018 04:26:09 -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 640D68182D2A; Fri, 9 Feb 2018 09:26:09 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 063E6B350D; Fri, 9 Feb 2018 09:26:06 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:14 +0100 Message-Id: <20180209092524.31348-20-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:26:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:26:09 +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 19/29] s390x/flic: cache the common flic class in a central function 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 This avoids tons of conversions when handling interrupts. Signed-off-by: David Hildenbrand Message-Id: <20180129125623.21729-19-david@redhat.com> Signed-off-by: Cornelia Huck --- hw/intc/s390_flic.c | 13 ++++++++++++- hw/s390x/css.c | 10 +++++----- hw/s390x/virtio-ccw.c | 4 ++-- include/hw/s390x/s390_flic.h | 1 + target/s390x/interrupt.c | 6 +++--- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index b46c0f1bb4..a85a149c6d 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -22,6 +22,17 @@ #include "qapi/error.h" #include "hw/s390x/s390-virtio-ccw.h" =20 +S390FLICStateClass *s390_get_flic_class(S390FLICState *fs) +{ + static S390FLICStateClass *class; + + if (!class) { + /* we only have one flic device, so this is fine to cache */ + class =3D S390_FLIC_COMMON_GET_CLASS(fs); + } + return class; +} + QEMUS390FLICState *s390_get_qemu_flic(S390FLICState *fs) { static QEMUS390FLICState *flic; @@ -146,7 +157,7 @@ static int qemu_s390_inject_airq(S390FLICState *fs, uin= t8_t type, uint8_t isc, uint8_t flags) { QEMUS390FLICState *flic =3D s390_get_qemu_flic(fs); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); bool flag =3D flags & S390_ADAPTER_SUPPRESSIBLE; uint32_t io_int_word =3D (isc << 27) | IO_INT_WORD_AI; =20 diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 1c526fd7e2..301bf1772f 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -439,7 +439,7 @@ static int s390_io_adapter_map(AdapterInfo *adapter, ui= nt64_t map_addr, bool do_map) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 return fsc->io_adapter_map(fs, adapter->adapter_id, map_addr, do_map); } @@ -520,7 +520,7 @@ void css_register_io_adapters(CssIoAdapterType type, bo= ol swap, bool maskable, int ret, isc; IoAdapter *adapter; S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 /* * Disallow multiple registrations for the same device type. @@ -566,7 +566,7 @@ static void css_clear_io_interrupt(uint16_t subchannel_= id, Error *err =3D NULL; static bool no_clear_irq; S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); int r; =20 if (unlikely(no_clear_irq)) { @@ -640,7 +640,7 @@ void css_conditional_io_interrupt(SubchDev *sch) int css_do_sic(CPUS390XState *env, uint8_t isc, uint16_t mode) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); int r; =20 if (env->psw.mask & PSW_MASK_PSTATE) { @@ -666,7 +666,7 @@ out: void css_adapter_interrupt(CssIoAdapterType type, uint8_t isc) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); uint32_t io_int_word =3D (isc << 27) | IO_INT_WORD_AI; IoAdapter *adapter =3D channel_subsys.io_adapters[type][isc]; =20 diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 3d8f26949b..8f7fbc2ab7 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1111,7 +1111,7 @@ static int virtio_ccw_setup_irqroutes(VirtioCcwDevice= *dev, int nvqs) VirtIODevice *vdev =3D virtio_bus_get_device(&dev->bus); int ret; S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 ret =3D virtio_ccw_get_mappings(dev); if (ret) { @@ -1129,7 +1129,7 @@ static int virtio_ccw_setup_irqroutes(VirtioCcwDevice= *dev, int nvqs) static void virtio_ccw_release_irqroutes(VirtioCcwDevice *dev, int nvqs) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 fsc->release_adapter_routes(fs, &dev->routes); } diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index a636afce42..4687ecfe83 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -136,6 +136,7 @@ void s390_flic_init(void); =20 S390FLICState *s390_get_flic(void); QEMUS390FLICState *s390_get_qemu_flic(S390FLICState *fs); +S390FLICStateClass *s390_get_flic_class(S390FLICState *fs); bool ais_needed(void *opaque); =20 #endif /* HW_S390_FLIC_H */ diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 1947012b25..25cfb3eef8 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -134,7 +134,7 @@ void cpu_inject_stop(S390CPU *cpu) void s390_sclp_extint(uint32_t parm) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 fsc->inject_service(fs, parm); } @@ -143,7 +143,7 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t= subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 fsc->inject_io(fs, subchannel_id, subchannel_nr, io_int_parm, io_int_w= ord); } @@ -151,7 +151,7 @@ void s390_io_interrupt(uint16_t subchannel_id, uint16_t= subchannel_nr, void s390_crw_mchk(void) { S390FLICState *fs =3D s390_get_flic(); - S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + S390FLICStateClass *fsc =3D s390_get_flic_class(fs); =20 fsc->inject_crw_mchk(fs); } --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518168883221580.0015743614606; Fri, 9 Feb 2018 01:34:43 -0800 (PST) Received: from localhost ([::1]:52969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek54s-0001Ig-C2 for importer@patchew.org; Fri, 09 Feb 2018 04:34:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wg-0002Mb-97 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wd-0006JV-CL for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:14 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42590 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 1ek4wd-0006Iz-8t; Fri, 09 Feb 2018 04:26:11 -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 CF41A407604F; Fri, 9 Feb 2018 09:26:10 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AD952024CA2; Fri, 9 Feb 2018 09:26:10 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:15 +0100 Message-Id: <20180209092524.31348-21-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 09:26:10 +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 20/29] s390x/sclp: fix event mask handling 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, qemu-stable@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, "Jason J . Herne" , 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: Christian Borntraeger commit 67915de9f038 ("s390x/event-facility: variable-length event masks") switched the sclp receive/send mask. This broke the sclp lm console. Signed-off-by: Christian Borntraeger Fixes: commit 67915de9f038 ("s390x/event-facility: variable-length event ma= sks") Cc: Cornelia Huck Cc: Jason J. Herne Cc: qemu-stable@nongnu.org Message-Id: <20180202094241.59537-1-borntraeger@de.ibm.com> Reviewed-by: Claudio Imbrenda Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/event-facility.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index b0f71f4554..155a69467b 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -293,10 +293,10 @@ static void write_event_mask(SCLPEventFacility *ef, S= CCB *sccb) ef->receive_mask =3D be32_to_cpu(tmp_mask); =20 /* return the SCLP's capability masks to the guest */ - tmp_mask =3D cpu_to_be32(get_host_send_mask(ef)); + tmp_mask =3D cpu_to_be32(get_host_receive_mask(ef)); copy_mask(WEM_RECEIVE_MASK(we_mask, mask_length), (uint8_t *)&tmp_mask, mask_length, sizeof(tmp_mask)); - tmp_mask =3D cpu_to_be32(get_host_receive_mask(ef)); + tmp_mask =3D cpu_to_be32(get_host_send_mask(ef)); copy_mask(WEM_SEND_MASK(we_mask, mask_length), (uint8_t *)&tmp_mask, mask_length, sizeof(tmp_mask)); =20 --=20 2.13.6 From nobody Thu May 2 07:02:30 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 15181692616111008.9299341079674; Fri, 9 Feb 2018 01:41:01 -0800 (PST) Received: from localhost ([::1]:53031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Ay-0006hk-JK for importer@patchew.org; Fri, 09 Feb 2018 04:41:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wg-0002Me-KW for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wf-0006L0-0p for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:14 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55800 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 1ek4we-0006KV-RO; Fri, 09 Feb 2018 04:26:12 -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 68A09818AAF5; Fri, 9 Feb 2018 09:26:12 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0431810083A8; Fri, 9 Feb 2018 09:26:11 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:16 +0100 Message-Id: <20180209092524.31348-22-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:26:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:26:12 +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 21/29] s390x/tcg: wire up pci instructions 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" On s390x, pci support is implemented via a set of instructions (no mmio). Unfortunately, none of them are documented in the PoP; the code is based upon the existing implementation for KVM and the Linux zpci driver. Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target/s390x/helper.h | 9 ++++ target/s390x/insn-data.def | 13 ++++++ target/s390x/misc_helper.c | 89 +++++++++++++++++++++++++++++++++++++++ target/s390x/translate.c | 102 +++++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 213 insertions(+) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 05d52ff309..59cba86a27 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -173,4 +173,13 @@ DEF_HELPER_3(stsch, void, env, i64, i64) DEF_HELPER_2(tpi, i32, env, i64) DEF_HELPER_3(tsch, void, env, i64, i64) DEF_HELPER_2(chsc, void, env, i64) + +DEF_HELPER_2(clp, void, env, i32) +DEF_HELPER_3(pcilg, void, env, i32, i32) +DEF_HELPER_3(pcistg, void, env, i32, i32) +DEF_HELPER_4(stpcifc, void, env, i32, i64, i32) +DEF_HELPER_3(sic, void, env, i64, i64) +DEF_HELPER_3(rpcit, void, env, i32, i32) +DEF_HELPER_5(pcistb, void, env, i32, i32, i64, i32) +DEF_HELPER_4(mpcifc, void, env, i32, i64, i32) #endif diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index c06c3884c0..621e10d615 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1068,4 +1068,17 @@ /* ??? Not listed in PoO ninth edition, but there's a linux driver that uses it: "A CHSC subchannel is usually present on LPAR only." */ C(0xb25f, CHSC, RRE, Z, 0, insn, 0, 0, chsc, 0) + +/* zPCI Instructions */ + /* None of these instructions are documented in the PoP, so this is all + based upon target/s390x/kvm.c and Linux code and likely incomplete = */ + C(0xebd0, PCISTB, RSY_a, PCI, la2, 0, 0, 0, pcistb, 0) + C(0xebd1, SIC, RSY_a, AIS, r1, r3, 0, 0, sic, 0) + C(0xb9a0, CLP, RRF_c, PCI, 0, 0, 0, 0, clp, 0) + C(0xb9d0, PCISTG, RRE, PCI, 0, 0, 0, 0, pcistg, 0) + C(0xb9d2, PCILG, RRE, PCI, 0, 0, 0, 0, pcilg, 0) + C(0xb9d3, RPCIT, RRE, PCI, 0, 0, 0, 0, rpcit, 0) + C(0xe3d0, MPCIFC, RXY_a, PCI, la2, 0, 0, 0, mpcifc, 0) + C(0xe3d4, STPCIFC, RXY_a, PCI, la2, 0, 0, 0, stpcifc, 0) + #endif /* CONFIG_USER_ONLY */ diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 45cab8c463..e0b23c1fd1 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -38,6 +38,7 @@ #include "hw/s390x/sclp.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/ioinst.h" +#include "hw/s390x/s390-pci-inst.h" #include "hw/boards.h" #endif =20 @@ -632,3 +633,91 @@ uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t ad= dr) env->regs[0] =3D deposit64(env->regs[0], 0, 8, (max_bytes / 8) - 1); return count_bytes >=3D max_bytes ? 0 : 3; } + +#ifndef CONFIG_USER_ONLY +/* + * Note: we ignore any return code of the functions called for the pci + * instructions, as the only time they return !0 is when the stub is + * called, and in that case we didn't even offer the zpci facility. + * The only exception is SIC, where program checks need to be handled + * by the caller. + */ +void HELPER(clp)(CPUS390XState *env, uint32_t r2) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + clp_service_call(cpu, r2, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(pcilg)(CPUS390XState *env, uint32_t r1, uint32_t r2) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + pcilg_service_call(cpu, r1, r2, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(pcistg)(CPUS390XState *env, uint32_t r1, uint32_t r2) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + pcistg_service_call(cpu, r1, r2, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(stpcifc)(CPUS390XState *env, uint32_t r1, uint64_t fiba, + uint32_t ar) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + stpcifc_service_call(cpu, r1, fiba, ar, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(sic)(CPUS390XState *env, uint64_t r1, uint64_t r3) +{ + int r; + + qemu_mutex_lock_iothread(); + r =3D css_do_sic(env, (r3 >> 27) & 0x7, r1 & 0xffff); + qemu_mutex_unlock_iothread(); + /* css_do_sic() may actually return a PGM_xxx value to inject */ + if (r) { + s390_program_interrupt(env, -r, 4, GETPC()); + } +} + +void HELPER(rpcit)(CPUS390XState *env, uint32_t r1, uint32_t r2) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + rpcit_service_call(cpu, r1, r2, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(pcistb)(CPUS390XState *env, uint32_t r1, uint32_t r3, + uint64_t gaddr, uint32_t ar) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + pcistb_service_call(cpu, r1, r3, gaddr, ar, GETPC()); + qemu_mutex_unlock_iothread(); +} + +void HELPER(mpcifc)(CPUS390XState *env, uint32_t r1, uint64_t fiba, + uint32_t ar) +{ + S390CPU *cpu =3D s390_env_get_cpu(env); + + qemu_mutex_lock_iothread(); + mpcifc_service_call(cpu, r1, fiba, ar, GETPC()); + qemu_mutex_unlock_iothread(); +} +#endif diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 81abe40673..b470d691d3 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4785,6 +4785,106 @@ static ExitStatus op_zero2(DisasContext *s, DisasOp= s *o) return NO_EXIT; } =20 +#ifndef CONFIG_USER_ONLY +static ExitStatus op_clp(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + + check_privileged(s); + gen_helper_clp(cpu_env, r2); + tcg_temp_free_i32(r2); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_pcilg(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + + check_privileged(s); + gen_helper_pcilg(cpu_env, r1, r2); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r2); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_pcistg(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + + check_privileged(s); + gen_helper_pcistg(cpu_env, r1, r2); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r2); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_stpcifc(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 ar =3D tcg_const_i32(get_field(s->fields, b2)); + + check_privileged(s); + gen_helper_stpcifc(cpu_env, r1, o->addr1, ar); + tcg_temp_free_i32(ar); + tcg_temp_free_i32(r1); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_sic(DisasContext *s, DisasOps *o) +{ + check_privileged(s); + gen_helper_sic(cpu_env, o->in1, o->in2); + return NO_EXIT; +} + +static ExitStatus op_rpcit(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r2 =3D tcg_const_i32(get_field(s->fields, r2)); + + check_privileged(s); + gen_helper_rpcit(cpu_env, r1, r2); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r2); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_pcistb(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 r3 =3D tcg_const_i32(get_field(s->fields, r3)); + TCGv_i32 ar =3D tcg_const_i32(get_field(s->fields, b2)); + + check_privileged(s); + gen_helper_pcistb(cpu_env, r1, r3, o->addr1, ar); + tcg_temp_free_i32(ar); + tcg_temp_free_i32(r1); + tcg_temp_free_i32(r3); + set_cc_static(s); + return NO_EXIT; +} + +static ExitStatus op_mpcifc(DisasContext *s, DisasOps *o) +{ + TCGv_i32 r1 =3D tcg_const_i32(get_field(s->fields, r1)); + TCGv_i32 ar =3D tcg_const_i32(get_field(s->fields, b2)); + + check_privileged(s); + gen_helper_mpcifc(cpu_env, r1, o->addr1, ar); + tcg_temp_free_i32(ar); + tcg_temp_free_i32(r1); + set_cc_static(s); + return NO_EXIT; +} +#endif + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* The "Cc OUTput" generators. Given the generated output (and in some ca= ses the original inputs), update the various cc data structures in order to @@ -5716,6 +5816,8 @@ enum DisasInsnEnum { #define FAC_MSA4 S390_FEAT_MSA_EXT_4 /* msa-extension-4 facility */ #define FAC_MSA5 S390_FEAT_MSA_EXT_5 /* msa-extension-5 facility */ #define FAC_ECT S390_FEAT_EXTRACT_CPU_TIME +#define FAC_PCI S390_FEAT_ZPCI /* z/PCI facility */ +#define FAC_AIS S390_FEAT_ADAPTER_INT_SUPPRESSION =20 static const DisasInsn insn_info[] =3D { #include "insn-data.def" --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169427796671.9458484651589; Fri, 9 Feb 2018 01:43:47 -0800 (PST) Received: from localhost ([::1]:53066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5De-0000cS-P2 for importer@patchew.org; Fri, 09 Feb 2018 04:43:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wh-0002NP-FZ for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wg-0006MS-FV for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:15 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52200 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 1ek4wg-0006Lx-B6; Fri, 09 Feb 2018 04:26:14 -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 D9A444085014; Fri, 9 Feb 2018 09:26:13 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92B7C1010408; Fri, 9 Feb 2018 09:26:13 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:17 +0100 Message-Id: <20180209092524.31348-23-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.5]); Fri, 09 Feb 2018 09:26:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 09 Feb 2018 09:26:13 +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 22/29] s390x/cpumodel: allow zpci features in qemu model 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" AEN and AIS can be provided unconditionally, ZPCI should be turned on manually. With -cpu qemu,zpci=3Don, the guest kernel can now successfully detect virtio-pci devices under tcg. Also fixup the order of the MSA_EXT_{3,4} flags while at it. Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target/s390x/cpu_models.c | 6 ++++++ target/s390x/gen-features.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 212a5f0697..250d931d7e 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -23,6 +23,7 @@ #include "qapi/qmp/qbool.h" #ifndef CONFIG_USER_ONLY #include "sysemu/arch_init.h" +#include "hw/pci/pci.h" #endif =20 #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \ @@ -1271,6 +1272,11 @@ static void register_types(void) =20 /* init all bitmaps from gnerated data initially */ s390_init_feat_bitmap(qemu_max_cpu_feat_init, qemu_max_cpu_feat); +#ifndef CONFIG_USER_ONLY + if (!pci_available) { + clear_bit(S390_FEAT_ZPCI, qemu_max_cpu_feat); + } +#endif for (i =3D 0; i < ARRAY_SIZE(s390_cpu_defs); i++) { s390_init_feat_bitmap(s390_cpu_defs[i].base_init, s390_cpu_defs[i].base_feat); diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 0570f597ec..89a140c9a7 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -572,8 +572,10 @@ static uint16_t qemu_LATEST[] =3D { S390_FEAT_STFLE_49, S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_INTERLOCKED_ACCESS_2, - S390_FEAT_MSA_EXT_4, + S390_FEAT_ADAPTER_EVENT_NOTIFICATION, + S390_FEAT_ADAPTER_INT_SUPPRESSION, S390_FEAT_MSA_EXT_3, + S390_FEAT_MSA_EXT_4, }; =20 /* add all new definitions before this point */ @@ -582,6 +584,8 @@ static uint16_t qemu_MAX[] =3D { S390_FEAT_STFLE_53, /* generates a dependency warning, leave it out for now */ S390_FEAT_MSA_EXT_5, + /* only with CONFIG_PCI */ + S390_FEAT_ZPCI, }; =20 /****** END FEATURE DEFS ******/ --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169621117621.4382254805186; Fri, 9 Feb 2018 01:47:01 -0800 (PST) Received: from localhost ([::1]:53581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Gk-0003hN-4V for importer@patchew.org; Fri, 09 Feb 2018 04:46:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wj-0002Pt-Ev for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wh-0006OW-Ub for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:17 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33168 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 1ek4wh-0006NZ-Oy; Fri, 09 Feb 2018 04:26:15 -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 5619B84250; Fri, 9 Feb 2018 09:26:15 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CF0DF41AC; Fri, 9 Feb 2018 09:26:14 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:18 +0100 Message-Id: <20180209092524.31348-24-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:26:15 +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 23/29] s390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility 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 For now, the kernel does not properly indicate configured CPU subfunctions to the guest, but simply uses the host values (as support in KVM is still missing). That's why we missed to model the PTFF subfunctions that come with Multiple-epoch facility. Let's properly add these, along with a new feature group. Signed-off-by: David Hildenbrand Message-Id: <20180205102935.14736-1-david@redhat.com> Tested-by: Christian Borntraeger Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- target/s390x/cpu_features.c | 5 +++++ target/s390x/cpu_features_def.h | 4 ++++ target/s390x/gen-features.c | 11 +++++++++++ target/s390x/kvm.c | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index 85d10b5710..a5619f2893 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -156,8 +156,12 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("ptff-qpc", S390_FEAT_TYPE_PTFF, 3, "PTFF Query Physical Clo= ck"), FEAT_INIT("ptff-qui", S390_FEAT_TYPE_PTFF, 4, "PTFF Query UTC Informat= ion"), FEAT_INIT("ptff-qtou", S390_FEAT_TYPE_PTFF, 5, "PTFF Query TOD Offset = User"), + FEAT_INIT("ptff-qsie", S390_FEAT_TYPE_PTFF, 10, "PTFF Query Steering I= nformation Extended"), + FEAT_INIT("ptff-qtoue", S390_FEAT_TYPE_PTFF, 13, "PTFF Query TOD Offse= t User Extended"), FEAT_INIT("ptff-sto", S390_FEAT_TYPE_PTFF, 65, "PTFF Set TOD Offset"), FEAT_INIT("ptff-stou", S390_FEAT_TYPE_PTFF, 69, "PTFF Set TOD Offset U= ser"), + FEAT_INIT("ptff-stoe", S390_FEAT_TYPE_PTFF, 73, "PTFF Set TOD Offset E= xtended"), + FEAT_INIT("ptff-stoue", S390_FEAT_TYPE_PTFF, 77, "PTFF Set TOD Offset = User Extended"), =20 FEAT_INIT("kmac-dea", S390_FEAT_TYPE_KMAC, 1, "KMAC DEA"), FEAT_INIT("kmac-tdea-128", S390_FEAT_TYPE_KMAC, 2, "KMAC TDEA-128"), @@ -445,6 +449,7 @@ static S390FeatGroupDef s390_feature_groups[] =3D { FEAT_GROUP_INIT("plo", PLO, "Perform-locked-operation facility"), FEAT_GROUP_INIT("tods", TOD_CLOCK_STEERING, "Tod-clock-steering facili= ty"), FEAT_GROUP_INIT("gen13ptff", GEN13_PTFF, "PTFF enhancements introduced= with z13"), + FEAT_GROUP_INIT("mepochptff", MULTIPLE_EPOCH_PTFF, "PTFF enhancements = introduced with Multiple-epoch facility"), FEAT_GROUP_INIT("msa", MSA, "Message-security-assist facility"), FEAT_GROUP_INIT("msa1", MSA_EXT_1, "Message-security-assist-extension = 1 facility"), FEAT_GROUP_INIT("msa2", MSA_EXT_2, "Message-security-assist-extension = 2 facility"), diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_de= f.h index 4d930871b4..7c5915c7b2 100644 --- a/target/s390x/cpu_features_def.h +++ b/target/s390x/cpu_features_def.h @@ -151,8 +151,12 @@ typedef enum { S390_FEAT_PTFF_QPT, S390_FEAT_PTFF_QUI, S390_FEAT_PTFF_QTOU, + S390_FEAT_PTFF_QSIE, + S390_FEAT_PTFF_QTOUE, S390_FEAT_PTFF_STO, S390_FEAT_PTFF_STOU, + S390_FEAT_PTFF_STOE, + S390_FEAT_PTFF_STOUE, =20 /* KMAC */ S390_FEAT_KMAC_DEA, diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 89a140c9a7..f6211b4e6b 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -59,6 +59,12 @@ S390_FEAT_PTFF_QTOU, \ S390_FEAT_PTFF_STOU =20 +#define S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF \ + S390_FEAT_PTFF_QSIE, \ + S390_FEAT_PTFF_QTOUE, \ + S390_FEAT_PTFF_STOE, \ + S390_FEAT_PTFF_STOUE + #define S390_FEAT_GROUP_MSA \ S390_FEAT_MSA, \ S390_FEAT_KMAC_DEA, \ @@ -219,6 +225,9 @@ static uint16_t group_TOD_CLOCK_STEERING[] =3D { static uint16_t group_GEN13_PTFF[] =3D { S390_FEAT_GROUP_GEN13_PTFF, }; +static uint16_t group_MULTIPLE_EPOCH_PTFF[] =3D { + S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF, +}; static uint16_t group_MSA[] =3D { S390_FEAT_GROUP_MSA, }; @@ -466,6 +475,7 @@ static uint16_t full_GEN14_GA1[] =3D { S390_FEAT_CMM_NT, S390_FEAT_HPMA2, S390_FEAT_SIE_KSS, + S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF, }; =20 /* Default features (in order of release) @@ -668,6 +678,7 @@ static FeatGroupDefSpec FeatGroupDef[] =3D { FEAT_GROUP_INITIALIZER(PLO), FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING), FEAT_GROUP_INITIALIZER(GEN13_PTFF), + FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF), FEAT_GROUP_INITIALIZER(MSA), FEAT_GROUP_INITIALIZER(MSA_EXT_1), FEAT_GROUP_INITIALIZER(MSA_EXT_2), diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index bfd14723f1..deb870921b 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2221,6 +2221,14 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model= , Error **errp) return; } =20 + /* PTFF subfunctions might be indicated although kernel support missin= g */ + if (!test_bit(S390_FEAT_MULTIPLE_EPOCH, model->features)) { + clear_bit(S390_FEAT_PTFF_QSIE, model->features); + clear_bit(S390_FEAT_PTFF_QTOUE, model->features); + clear_bit(S390_FEAT_PTFF_STOE, model->features); + clear_bit(S390_FEAT_PTFF_STOUE, model->features); + } + /* with cpu model support, CMM is only indicated if really available */ if (kvm_s390_cmma_available()) { set_bit(S390_FEAT_CMM, model->features); --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169332518834.897405248323; Fri, 9 Feb 2018 01:42:12 -0800 (PST) Received: from localhost ([::1]:53048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5C7-0007pc-HX for importer@patchew.org; Fri, 09 Feb 2018 04:42:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wl-0002TG-N2 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wj-0006Qv-Lr for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:19 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55812 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 1ek4wj-0006QH-Go; Fri, 09 Feb 2018 04:26:17 -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 0F66F8185352; Fri, 9 Feb 2018 09:26:17 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81A57F41AC; Fri, 9 Feb 2018 09:26:16 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:19 +0100 Message-Id: <20180209092524.31348-25-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:26:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:26:17 +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 24/29] s390x/pci: fixup the code walking IOMMU tables 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, Yi Min Zhao , 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: Yi Min Zhao Current s390x PCI IOMMU code is lack of flags' checking, including: 1) protection bit 2) table length 3) table offset 4) intermediate tables' invalid bit 5) format control bit This patch introduces a new struct named S390IOTLBEntry, and makes up these missed checkings. At the same time, inform the guest with the corresponding error number when the check fails. Finally, in order to get the error number, we export s390_guest_io_table_walk(). Reviewed-by: Pierre Morel Signed-off-by: Yi Min Zhao Message-Id: <20180205072258.5968-2-zyimin@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-bus.c | 223 ++++++++++++++++++++++++++++++++++++++-----= ---- hw/s390x/s390-pci-bus.h | 16 ++++ hw/s390x/s390-pci-inst.c | 64 ++++++-------- 3 files changed, 225 insertions(+), 78 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 7d9c65e719..e7ef7d28d9 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -309,49 +309,186 @@ static uint64_t get_st_pto(uint64_t entry) : 0; } =20 -static uint64_t s390_guest_io_table_walk(uint64_t guest_iota, - uint64_t guest_dma_address) +static bool rt_entry_isvalid(uint64_t entry) { - uint64_t sto_a, pto_a, px_a; - uint64_t sto, pto, pte; - uint32_t rtx, sx, px; - - rtx =3D calc_rtx(guest_dma_address); - sx =3D calc_sx(guest_dma_address); - px =3D calc_px(guest_dma_address); - - sto_a =3D guest_iota + rtx * sizeof(uint64_t); - sto =3D address_space_ldq(&address_space_memory, sto_a, - MEMTXATTRS_UNSPECIFIED, NULL); - sto =3D get_rt_sto(sto); - if (!sto) { - pte =3D 0; + return (entry & ZPCI_TABLE_VALID_MASK) =3D=3D ZPCI_TABLE_VALID; +} + +static bool pt_entry_isvalid(uint64_t entry) +{ + return (entry & ZPCI_PTE_VALID_MASK) =3D=3D ZPCI_PTE_VALID; +} + +static bool entry_isprotected(uint64_t entry) +{ + return (entry & ZPCI_TABLE_PROT_MASK) =3D=3D ZPCI_TABLE_PROTECTED; +} + +/* ett is expected table type, -1 page table, 0 segment table, 1 region ta= ble */ +static uint64_t get_table_index(uint64_t iova, int8_t ett) +{ + switch (ett) { + case ZPCI_ETT_PT: + return calc_px(iova); + case ZPCI_ETT_ST: + return calc_sx(iova); + case ZPCI_ETT_RT: + return calc_rtx(iova); + } + + return -1; +} + +static bool entry_isvalid(uint64_t entry, int8_t ett) +{ + switch (ett) { + case ZPCI_ETT_PT: + return pt_entry_isvalid(entry); + case ZPCI_ETT_ST: + case ZPCI_ETT_RT: + return rt_entry_isvalid(entry); + } + + return false; +} + +/* Return true if address translation is done */ +static bool translate_iscomplete(uint64_t entry, int8_t ett) +{ + switch (ett) { + case 0: + return (entry & ZPCI_TABLE_FC) ? true : false; + case 1: + return false; + } + + return true; +} + +static uint64_t get_frame_size(int8_t ett) +{ + switch (ett) { + case ZPCI_ETT_PT: + return 1ULL << 12; + case ZPCI_ETT_ST: + return 1ULL << 20; + case ZPCI_ETT_RT: + return 1ULL << 31; + } + + return 0; +} + +static uint64_t get_next_table_origin(uint64_t entry, int8_t ett) +{ + switch (ett) { + case ZPCI_ETT_PT: + return entry & ZPCI_PTE_ADDR_MASK; + case ZPCI_ETT_ST: + return get_st_pto(entry); + case ZPCI_ETT_RT: + return get_rt_sto(entry); + } + + return 0; +} + +/** + * table_translate: do translation within one table and return the followi= ng + * table origin + * + * @entry: the entry being translated, the result is stored in this. + * @to: the address of table origin. + * @ett: expected table type, 1 region table, 0 segment table and -1 page = table. + * @error: error code + */ +static uint64_t table_translate(S390IOTLBEntry *entry, uint64_t to, int8_t= ett, + uint16_t *error) +{ + uint64_t tx, te, nto =3D 0; + uint16_t err =3D 0; + + tx =3D get_table_index(entry->iova, ett); + te =3D address_space_ldq(&address_space_memory, to + tx * sizeof(uint6= 4_t), + MEMTXATTRS_UNSPECIFIED, NULL); + + if (!te) { + err =3D ERR_EVENT_INVALTE; goto out; } =20 - pto_a =3D sto + sx * sizeof(uint64_t); - pto =3D address_space_ldq(&address_space_memory, pto_a, - MEMTXATTRS_UNSPECIFIED, NULL); - pto =3D get_st_pto(pto); - if (!pto) { - pte =3D 0; + if (!entry_isvalid(te, ett)) { + entry->perm &=3D IOMMU_NONE; goto out; } =20 - px_a =3D pto + px * sizeof(uint64_t); - pte =3D address_space_ldq(&address_space_memory, px_a, - MEMTXATTRS_UNSPECIFIED, NULL); + if (ett =3D=3D ZPCI_ETT_RT && ((te & ZPCI_TABLE_LEN_RTX) !=3D ZPCI_TAB= LE_LEN_RTX + || te & ZPCI_TABLE_OFFSET_MASK)) { + err =3D ERR_EVENT_INVALTL; + goto out; + } =20 + nto =3D get_next_table_origin(te, ett); + if (!nto) { + err =3D ERR_EVENT_TT; + goto out; + } + + if (entry_isprotected(te)) { + entry->perm &=3D IOMMU_RO; + } else { + entry->perm &=3D IOMMU_RW; + } + + if (translate_iscomplete(te, ett)) { + switch (ett) { + case ZPCI_ETT_PT: + entry->translated_addr =3D te & ZPCI_PTE_ADDR_MASK; + break; + case ZPCI_ETT_ST: + entry->translated_addr =3D (te & ZPCI_SFAA_MASK) | + (entry->iova & ~ZPCI_SFAA_MASK); + break; + } + nto =3D 0; + } out: - return pte; + if (err) { + entry->perm =3D IOMMU_NONE; + *error =3D err; + } + entry->len =3D get_frame_size(ett); + return nto; +} + +uint16_t s390_guest_io_table_walk(uint64_t g_iota, hwaddr addr, + S390IOTLBEntry *entry) +{ + uint64_t to =3D s390_pci_get_table_origin(g_iota); + int8_t ett =3D 1; + uint16_t error =3D 0; + + entry->iova =3D addr & PAGE_MASK; + entry->translated_addr =3D 0; + entry->perm =3D IOMMU_RW; + + if (entry_isprotected(g_iota)) { + entry->perm &=3D IOMMU_RO; + } + + while (to) { + to =3D table_translate(entry, to, ett--, &error); + } + + return error; } =20 static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr ad= dr, IOMMUAccessFlags flag) { - uint64_t pte; - uint32_t flags; S390PCIIOMMU *iommu =3D container_of(mr, S390PCIIOMMU, iommu_mr); + S390IOTLBEntry entry; + uint16_t error =3D 0; IOMMUTLBEntry ret =3D { .target_as =3D &address_space_memory, .iova =3D 0, @@ -374,26 +511,26 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemory= Region *mr, hwaddr addr, DPRINTF("iommu trans addr 0x%" PRIx64 "\n", addr); =20 if (addr < iommu->pba || addr > iommu->pal) { - return ret; + error =3D ERR_EVENT_OORANGE; + goto err; } =20 - pte =3D s390_guest_io_table_walk(s390_pci_get_table_origin(iommu->g_io= ta), - addr); - if (!pte) { - return ret; - } + error =3D s390_guest_io_table_walk(iommu->g_iota, addr, &entry); =20 - flags =3D pte & ZPCI_PTE_FLAG_MASK; - ret.iova =3D addr; - ret.translated_addr =3D pte & ZPCI_PTE_ADDR_MASK; - ret.addr_mask =3D 0xfff; + ret.iova =3D entry.iova; + ret.translated_addr =3D entry.translated_addr; + ret.addr_mask =3D entry.len - 1; + ret.perm =3D entry.perm; =20 - if (flags & ZPCI_PTE_INVALID) { - ret.perm =3D IOMMU_NONE; - } else { - ret.perm =3D IOMMU_RW; + if (flag !=3D IOMMU_NONE && !(flag & ret.perm)) { + error =3D ERR_EVENT_TPROTE; + } +err: + if (error) { + iommu->pbdev->state =3D ZPCI_FS_ERROR; + s390_pci_generate_error_event(error, iommu->pbdev->fh, + iommu->pbdev->fid, addr, 0); } - return ret; } =20 diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h index 2993f0ddef..7ed577c806 100644 --- a/hw/s390x/s390-pci-bus.h +++ b/hw/s390x/s390-pci-bus.h @@ -148,6 +148,8 @@ enum ZpciIoatDtype { #define ZPCI_STE_FLAG_MASK 0x7ffULL #define ZPCI_STE_ADDR_MASK (~ZPCI_STE_FLAG_MASK) =20 +#define ZPCI_SFAA_MASK (~((1ULL << 20) - 1)) + /* I/O Page tables */ #define ZPCI_PTE_VALID_MASK 0x400 #define ZPCI_PTE_INVALID 0x400 @@ -165,10 +167,15 @@ enum ZpciIoatDtype { #define ZPCI_TABLE_INVALID 0x20 #define ZPCI_TABLE_PROTECTED 0x200 #define ZPCI_TABLE_UNPROTECTED 0x000 +#define ZPCI_TABLE_FC 0x400 =20 #define ZPCI_TABLE_VALID_MASK 0x20 #define ZPCI_TABLE_PROT_MASK 0x200 =20 +#define ZPCI_ETT_RT 1 +#define ZPCI_ETT_ST 0 +#define ZPCI_ETT_PT -1 + /* PCI Function States * * reserved: default; device has just been plugged or is in progress of be= ing @@ -253,6 +260,13 @@ typedef struct S390MsixInfo { uint32_t pba_offset; } S390MsixInfo; =20 +typedef struct S390IOTLBEntry { + uint64_t iova; + uint64_t translated_addr; + uint64_t len; + uint64_t perm; +} S390IOTLBEntry; + typedef struct S390PCIBusDevice S390PCIBusDevice; typedef struct S390PCIIOMMU { Object parent_obj; @@ -320,6 +334,8 @@ void s390_pci_iommu_enable(S390PCIIOMMU *iommu); void s390_pci_iommu_disable(S390PCIIOMMU *iommu); void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid, uint64_t faddr, uint32_t e); +uint16_t s390_guest_io_table_walk(uint64_t g_iota, hwaddr addr, + S390IOTLBEntry *entry); S390PCIBusDevice *s390_pci_find_dev_by_idx(S390pciState *s, uint32_t idx); S390PCIBusDevice *s390_pci_find_dev_by_fh(S390pciState *s, uint32_t fh); S390PCIBusDevice *s390_pci_find_dev_by_fid(S390pciState *s, uint32_t fid); diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index be449210d9..1d33a89351 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -575,23 +575,23 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; uint32_t fh; + uint16_t error =3D 0; S390PCIBusDevice *pbdev; S390PCIIOMMU *iommu; + S390IOTLBEntry entry; hwaddr start, end; - IOMMUTLBEntry entry; - IOMMUMemoryRegion *iommu_mr; - IOMMUMemoryRegionClass *imrc; + IOMMUTLBEntry notify; =20 cpu_synchronize_state(CPU(cpu)); =20 if (env->psw.mask & PSW_MASK_PSTATE) { s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); - goto out; + return 0; } =20 if (r2 & 0x1) { s390_program_interrupt(env, PGM_SPECIFICATION, 4, ra); - goto out; + return 0; } =20 fh =3D env->regs[r1] >> 32; @@ -602,7 +602,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) if (!pbdev) { DPRINTF("rpcit no pci dev\n"); setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE); - goto out; + return 0; } =20 switch (pbdev->state) { @@ -622,44 +622,38 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2, uintptr_t ra) =20 iommu =3D pbdev->iommu; if (!iommu->g_iota) { - pbdev->state =3D ZPCI_FS_ERROR; - setcc(cpu, ZPCI_PCI_LS_ERR); - s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES); - s390_pci_generate_error_event(ERR_EVENT_INVALAS, pbdev->fh, pbdev-= >fid, - start, 0); - goto out; + error =3D ERR_EVENT_INVALAS; + goto err; } =20 if (end < iommu->pba || start > iommu->pal) { - pbdev->state =3D ZPCI_FS_ERROR; - setcc(cpu, ZPCI_PCI_LS_ERR); - s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES); - s390_pci_generate_error_event(ERR_EVENT_OORANGE, pbdev->fh, pbdev-= >fid, - start, 0); - goto out; + error =3D ERR_EVENT_OORANGE; + goto err; } =20 - iommu_mr =3D &iommu->iommu_mr; - imrc =3D IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr); - while (start < end) { - entry =3D imrc->translate(iommu_mr, start, IOMMU_NONE); - - if (!entry.translated_addr) { - pbdev->state =3D ZPCI_FS_ERROR; - setcc(cpu, ZPCI_PCI_LS_ERR); - s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES); - s390_pci_generate_error_event(ERR_EVENT_SERR, pbdev->fh, pbdev= ->fid, - start, ERR_EVENT_Q_BIT); - goto out; + error =3D s390_guest_io_table_walk(iommu->g_iota, start, &entry); + if (error) { + break; } - - memory_region_notify_iommu(iommu_mr, entry); - start +=3D entry.addr_mask + 1; + notify.target_as =3D &address_space_memory; + notify.iova =3D entry.iova; + notify.translated_addr =3D entry.translated_addr; + notify.addr_mask =3D entry.len - 1; + notify.perm =3D entry.perm; + memory_region_notify_iommu(&iommu->iommu_mr, notify); + start +=3D entry.len; } =20 - setcc(cpu, ZPCI_PCI_LS_OK); -out: +err: + if (error) { + pbdev->state =3D ZPCI_FS_ERROR; + setcc(cpu, ZPCI_PCI_LS_ERR); + s390_set_status_code(env, r1, ZPCI_PCI_ST_FUNC_IN_ERR); + s390_pci_generate_error_event(error, pbdev->fh, pbdev->fid, start,= 0); + } else { + setcc(cpu, ZPCI_PCI_LS_OK); + } return 0; } =20 --=20 2.13.6 From nobody Thu May 2 07:02:30 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 151816982813241.36432211886586; Fri, 9 Feb 2018 01:50:28 -0800 (PST) Received: from localhost ([::1]:53767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5K1-0006LE-5R for importer@patchew.org; Fri, 09 Feb 2018 04:50:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wm-0002U4-D5 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wl-0006SX-1w for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:20 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55824 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 1ek4wk-0006S2-UA; Fri, 09 Feb 2018 04:26:19 -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 7EEE2818AB0B; Fri, 9 Feb 2018 09:26:18 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 360652166BAE; Fri, 9 Feb 2018 09:26:18 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:20 +0100 Message-Id: <20180209092524.31348-26-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.8]); Fri, 09 Feb 2018 09:26:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 09 Feb 2018 09:26:18 +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 25/29] s390x/pci: fixup global refresh 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, Yi Min Zhao , 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: Yi Min Zhao The VFIO common code doesn't provide the possibility to modify a previous mapping entry in another way than unmapping and mapping again with new properties. To avoid -EEXIST DMA mapping error, we introduce a GHashTable to store S390IOTLBEntry instances in order to cache the mapped entries. When intercepting rpcit instruction, ignore the identical mapped entries to avoid doing map operations multiple times and do unmap and re-map operations for the case of updating the valid entries. Acked-by: Pierre Morel Signed-off-by: Yi Min Zhao Message-Id: <20180205072258.5968-3-zyimin@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-bus.c | 24 +++++++++++++++------- hw/s390x/s390-pci-bus.h | 1 + hw/s390x/s390-pci-inst.c | 53 ++++++++++++++++++++++++++++++++++++++++----= ---- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index e7ef7d28d9..77a50cab36 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -487,7 +487,8 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRe= gion *mr, hwaddr addr, IOMMUAccessFlags flag) { S390PCIIOMMU *iommu =3D container_of(mr, S390PCIIOMMU, iommu_mr); - S390IOTLBEntry entry; + S390IOTLBEntry *entry; + uint64_t iova =3D addr & PAGE_MASK; uint16_t error =3D 0; IOMMUTLBEntry ret =3D { .target_as =3D &address_space_memory, @@ -515,12 +516,17 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemory= Region *mr, hwaddr addr, goto err; } =20 - error =3D s390_guest_io_table_walk(iommu->g_iota, addr, &entry); - - ret.iova =3D entry.iova; - ret.translated_addr =3D entry.translated_addr; - ret.addr_mask =3D entry.len - 1; - ret.perm =3D entry.perm; + entry =3D g_hash_table_lookup(iommu->iotlb, &iova); + if (entry) { + ret.iova =3D entry->iova; + ret.translated_addr =3D entry->translated_addr; + ret.addr_mask =3D entry->len - 1; + ret.perm =3D entry->perm; + } else { + ret.iova =3D iova; + ret.addr_mask =3D ~PAGE_MASK; + ret.perm =3D IOMMU_NONE; + } =20 if (flag !=3D IOMMU_NONE && !(flag & ret.perm)) { error =3D ERR_EVENT_TPROTE; @@ -572,6 +578,8 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s= , PCIBus *bus, PCI_FUNC(devfn)); memory_region_init(&iommu->mr, OBJECT(iommu), mr_name, UINT64_MAX); address_space_init(&iommu->as, &iommu->mr, as_name); + iommu->iotlb =3D g_hash_table_new_full(g_int64_hash, g_int64_equal, + NULL, g_free); table->iommu[PCI_SLOT(devfn)] =3D iommu; =20 g_free(mr_name); @@ -661,6 +669,7 @@ void s390_pci_iommu_enable(S390PCIIOMMU *iommu) void s390_pci_iommu_disable(S390PCIIOMMU *iommu) { iommu->enabled =3D false; + g_hash_table_remove_all(iommu->iotlb); memory_region_del_subregion(&iommu->mr, MEMORY_REGION(&iommu->iommu_mr= )); object_unparent(OBJECT(&iommu->iommu_mr)); } @@ -676,6 +685,7 @@ static void s390_pci_iommu_free(S390pciState *s, PCIBus= *bus, int32_t devfn) } =20 table->iommu[PCI_SLOT(devfn)] =3D NULL; + g_hash_table_destroy(iommu->iotlb); address_space_destroy(&iommu->as); object_unparent(OBJECT(&iommu->mr)); object_unparent(OBJECT(iommu)); diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h index 7ed577c806..1f7f9b5814 100644 --- a/hw/s390x/s390-pci-bus.h +++ b/hw/s390x/s390-pci-bus.h @@ -278,6 +278,7 @@ typedef struct S390PCIIOMMU { uint64_t g_iota; uint64_t pba; uint64_t pal; + GHashTable *iotlb; } S390PCIIOMMU; =20 typedef struct S390PCIIOMMUTable { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 1d33a89351..997a9cc2e9 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -571,6 +571,45 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2, uintptr_t ra) return 0; } =20 +static void s390_pci_update_iotlb(S390PCIIOMMU *iommu, S390IOTLBEntry *ent= ry) +{ + S390IOTLBEntry *cache =3D g_hash_table_lookup(iommu->iotlb, &entry->io= va); + IOMMUTLBEntry notify =3D { + .target_as =3D &address_space_memory, + .iova =3D entry->iova, + .translated_addr =3D entry->translated_addr, + .perm =3D entry->perm, + .addr_mask =3D ~PAGE_MASK, + }; + + if (entry->perm =3D=3D IOMMU_NONE) { + if (!cache) { + return; + } + g_hash_table_remove(iommu->iotlb, &entry->iova); + } else { + if (cache) { + if (cache->perm =3D=3D entry->perm && + cache->translated_addr =3D=3D entry->translated_addr) { + return; + } + + notify.perm =3D IOMMU_NONE; + memory_region_notify_iommu(&iommu->iommu_mr, notify); + notify.perm =3D entry->perm; + } + + cache =3D g_new(S390IOTLBEntry, 1); + cache->iova =3D entry->iova; + cache->translated_addr =3D entry->translated_addr; + cache->len =3D PAGE_SIZE; + cache->perm =3D entry->perm; + g_hash_table_replace(iommu->iotlb, &cache->iova, cache); + } + + memory_region_notify_iommu(&iommu->iommu_mr, notify); +} + int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) { CPUS390XState *env =3D &cpu->env; @@ -580,7 +619,6 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_= t r2, uintptr_t ra) S390PCIIOMMU *iommu; S390IOTLBEntry entry; hwaddr start, end; - IOMMUTLBEntry notify; =20 cpu_synchronize_state(CPU(cpu)); =20 @@ -636,15 +674,14 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint= 8_t r2, uintptr_t ra) if (error) { break; } - notify.target_as =3D &address_space_memory; - notify.iova =3D entry.iova; - notify.translated_addr =3D entry.translated_addr; - notify.addr_mask =3D entry.len - 1; - notify.perm =3D entry.perm; - memory_region_notify_iommu(&iommu->iommu_mr, notify); + start +=3D entry.len; + while (entry.iova < start && entry.iova < end) { + s390_pci_update_iotlb(iommu, &entry); + entry.iova +=3D PAGE_SIZE; + entry.translated_addr +=3D PAGE_SIZE; + } } - err: if (error) { pbdev->state =3D ZPCI_FS_ERROR; --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518170006911719.3241969574735; Fri, 9 Feb 2018 01:53:26 -0800 (PST) Received: from localhost ([::1]:54550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Mu-0000h4-T8 for importer@patchew.org; Fri, 09 Feb 2018 04:53:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wr-0002XP-C0 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wm-0006UF-Hj for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:25 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42606 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 1ek4wm-0006Ta-D5; Fri, 09 Feb 2018 04:26:20 -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 ECC3540FB62F; Fri, 9 Feb 2018 09:26:19 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A84A72024CA2; Fri, 9 Feb 2018 09:26:19 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:21 +0100 Message-Id: <20180209092524.31348-27-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 09:26:20 +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 26/29] s390x/pci: use the right pal and pba in reg_ioat() 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, Yi Min Zhao , 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: Yi Min Zhao When registering ioat, pba should be comprised of leftmost 52 bits and rightmost 12 binary zeros, and pal should be comprised of leftmost 52 bits and right most 12 binary ones. The lower 12 bits of words 5 and 7 of the FIB are ignored by the facility. Let's fixup this. Reviewed-by: Pierre Morel Signed-off-by: Yi Min Zhao Message-Id: <20180205072258.5968-4-zyimin@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-inst.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 997a9cc2e9..3fcc330fe3 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -865,6 +865,8 @@ static int reg_ioat(CPUS390XState *env, S390PCIIOMMU *i= ommu, ZpciFib fib, uint8_t dt =3D (g_iota >> 2) & 0x7; uint8_t t =3D (g_iota >> 11) & 0x1; =20 + pba &=3D ~0xfff; + pal |=3D 0xfff; if (pba > pal || pba < ZPCI_SDMA_ADDR || pal > ZPCI_EDMA_ADDR) { s390_program_interrupt(env, PGM_OPERAND, 6, ra); return -EINVAL; --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518169710142711.9290739579486; Fri, 9 Feb 2018 01:48:30 -0800 (PST) Received: from localhost ([::1]:53631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5ID-0004li-9G for importer@patchew.org; Fri, 09 Feb 2018 04:48:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wr-0002XO-C3 for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wp-0006X0-RX for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:25 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33180 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 1ek4wp-0006WZ-Mi; Fri, 09 Feb 2018 04:26:23 -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 4982E7D85D; Fri, 9 Feb 2018 09:26:23 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2420C10083A8; Fri, 9 Feb 2018 09:26:21 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:22 +0100 Message-Id: <20180209092524.31348-28-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-1-cohuck@redhat.com> MIME-Version: 1.0 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]); Fri, 09 Feb 2018 09:26:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Feb 2018 09:26:23 +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:'' Content-Transfer-Encoding: quoted-printable 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 27/29] MAINTAINERS: add myself as overall s390x maintainer 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-Type: text/plain; charset="utf-8" All your mainframes are belong to me. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- MAINTAINERS | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 301b6996e1..6c675f2a7e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -76,6 +76,29 @@ K: ^Subject:.*(?i)trivial T: git git://git.corpit.ru/qemu.git trivial-patches T: git git://github.com/vivier/qemu.git trivial-patches =20 +Architecture support +-------------------- +S390 +M: Cornelia Huck +S: Supported +F: default-configs/s390x-softmmu.mak +F: gdb-xml/s390*.xml +F: hw/char/sclp*.[hc] +F: hw/char/terminal3270.c +F: hw/intc/s390_flic.c +F: hw/intc/s390_flic_kvm.c +F: hw/s390x/ +F: hw/vfio/ccw.c +F: hw/watchdog/wdt_diag288.c +F: include/hw/s390x/ +F: include/hw/watchdog/wdt_diag288.h +F: pc-bios/s390-ccw/ +F: pc-bios/s390-ccw.img +F: target/s390x/ +K: ^Subject:.*(?i)s390x? +T: git git://github.com/cohuck/qemu.git s390-next +L: qemu-s390x@nongnu.org + Guest CPU cores (TCG): ---------------------- Overall --=20 2.13.6 From nobody Thu May 2 07:02:30 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 15181698187751023.0191623126141; Fri, 9 Feb 2018 01:50:18 -0800 (PST) Received: from localhost ([::1]:53739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Jt-0006G9-Uf for importer@patchew.org; Fri, 09 Feb 2018 04:50:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4ws-0002YQ-7k for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4wr-0006YY-FE for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:26 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42618 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 1ek4wr-0006Y6-8Q; Fri, 09 Feb 2018 04:26:25 -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 C49CB40FB635; Fri, 9 Feb 2018 09:26:24 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79133202699C; Fri, 9 Feb 2018 09:26:24 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:23 +0100 Message-Id: <20180209092524.31348-29-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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]); Fri, 09 Feb 2018 09:26:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 09:26:24 +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 28/29] MAINTAINERS: reorganize s390-ccw bios maintainership 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" Split it out from the s390-ccw-virtio machine, add Thomas as a maintainer in addition to Christian. Acked-by: Christian Borntraeger Acked-by: Thomas Huth Signed-off-by: Cornelia Huck --- MAINTAINERS | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6c675f2a7e..e3e0b1d2f4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -855,15 +855,22 @@ F: hw/char/sclp*.[hc] F: hw/char/terminal3270.c F: hw/s390x/ F: include/hw/s390x/ -F: pc-bios/s390-ccw/ F: hw/watchdog/wdt_diag288.c F: include/hw/watchdog/wdt_diag288.h -F: pc-bios/s390-ccw.img F: default-configs/s390x-softmmu.mak T: git git://github.com/cohuck/qemu.git s390-next T: git git://github.com/borntraeger/qemu.git s390-next L: qemu-s390x@nongnu.org =20 +S390-ccw Bios +M: Christian Borntraeger +M: Thomas Huth +S: Supported +F: pc-bios/s390-ccw/ +F: pc-bios/s390-ccw.img +T: git git://github.com/borntraeger/qemu.git s390-next +L: qemu-s390x@nongnu.org + UniCore32 Machines ------------- PKUnity-3 SoC initramfs-with-busybox --=20 2.13.6 From nobody Thu May 2 07:02:30 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 1518170178382382.85362276062074; Fri, 9 Feb 2018 01:56:18 -0800 (PST) Received: from localhost ([::1]:54909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek5Pl-0003VO-GN for importer@patchew.org; Fri, 09 Feb 2018 04:56:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek4wt-0002ZY-Fo for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek4ws-0006aA-PQ for qemu-devel@nongnu.org; Fri, 09 Feb 2018 04:26:27 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53036 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 1ek4ws-0006Za-Ly; Fri, 09 Feb 2018 04:26:26 -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 3F74440265FD; Fri, 9 Feb 2018 09:26:26 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB53410083A8; Fri, 9 Feb 2018 09:26:25 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Fri, 9 Feb 2018 10:25:24 +0100 Message-Id: <20180209092524.31348-30-cohuck@redhat.com> In-Reply-To: <20180209092524.31348-1-cohuck@redhat.com> References: <20180209092524.31348-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.6]); Fri, 09 Feb 2018 09:26:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 09 Feb 2018 09:26:26 +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 29/29] MAINTAINERS: add David as additional tcg/s390 maintainer 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" Acked-by: David Hildenbrand Signed-off-by: Cornelia Huck --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index e3e0b1d2f4..54feb95646 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -236,6 +236,7 @@ F: disas/ppc.c S390 M: Richard Henderson M: Alexander Graf +M: David Hildenbrand S: Maintained F: target/s390x/ F: hw/s390x/ --=20 2.13.6