From nobody Mon Feb 9 01:20:41 2026 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@gnu.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@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506631168004917.1386020106709; Thu, 28 Sep 2017 13:39:28 -0700 (PDT) Received: from localhost ([::1]:60775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxfaU-0004kr-FQ for importer@patchew.org; Thu, 28 Sep 2017 16:39:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxfYe-0003Ye-89 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 16:37:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxfYd-00030y-16 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 16:37:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxfYc-00030Z-Oy for qemu-devel@nongnu.org; Thu, 28 Sep 2017 16:37:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8E24C04AC45; Thu, 28 Sep 2017 20:37:17 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C8A818C57; Thu, 28 Sep 2017 20:37:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8E24C04AC45 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 28 Sep 2017 22:36:40 +0200 Message-Id: <20170928203708.9376-3-david@redhat.com> In-Reply-To: <20170928203708.9376-1-david@redhat.com> References: <20170928203708.9376-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 28 Sep 2017 20:37:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 02/30] s390x/tcg: cleanup service interrupt injection X-BeenThere: qemu-devel@gnu.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 Hildenbrand , cohuck@redhat.com, Richard Henderson , Alexander Graf , Christian Borntraeger Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.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" There are still some leftovers from old virtio interrupts in there. Most importantly, we don't have to queue service interrupts anymore. Just like KVM, we can simply multiplex the SCLP service interrupts and avoid the queue. Also, now only valid parametes/cpu_addr will be stored on service interrupts. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/cpu.c | 2 -- target/s390x/cpu.h | 10 +--------- target/s390x/excp_helper.c | 16 +++++----------- target/s390x/internal.h | 2 -- target/s390x/interrupt.c | 18 ++++-------------- 5 files changed, 10 insertions(+), 38 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index f42e28ea25..e240d99fe6 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -107,7 +107,6 @@ static void s390_cpu_initial_reset(CPUState *s) env->gbea =3D 1; =20 env->pfault_token =3D -1UL; - env->ext_index =3D -1; for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] =3D -1; } @@ -144,7 +143,6 @@ static void s390_cpu_full_reset(CPUState *s) env->gbea =3D 1; =20 env->pfault_token =3D -1UL; - env->ext_index =3D -1; for (i =3D 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] =3D -1; } diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index e32f87a2f1..7bea97a2d7 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -53,7 +53,6 @@ =20 #define MMU_USER_IDX 0 =20 -#define MAX_EXT_QUEUE 16 #define MAX_IO_QUEUE 16 #define MAX_MCHK_QUEUE 16 =20 @@ -67,12 +66,6 @@ typedef struct PSW { uint64_t addr; } PSW; =20 -typedef struct ExtQueue { - uint32_t code; - uint32_t param; - uint32_t param64; -} ExtQueue; - typedef struct IOIntQueue { uint16_t id; uint16_t nr; @@ -128,12 +121,11 @@ struct CPUS390XState { =20 uint64_t cregs[16]; /* control registers */ =20 - ExtQueue ext_queue[MAX_EXT_QUEUE]; IOIntQueue io_queue[MAX_IO_QUEUE][8]; MchkQueue mchk_queue[MAX_MCHK_QUEUE]; =20 int pending_int; - int ext_index; + uint32_t service_param; int io_index[8]; int mchk_index; =20 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 8521043bf2..8228104a49 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -240,7 +240,6 @@ static void do_ext_interrupt(CPUS390XState *env) S390CPU *cpu =3D s390_env_get_cpu(env); uint64_t mask, addr; LowCore *lowcore; - ExtQueue *q; =20 if (!(env->psw.mask & PSW_MASK_EXT)) { cpu_abort(CPU(cpu), "Ext int w/o ext mask\n"); @@ -257,20 +256,15 @@ static void do_ext_interrupt(CPUS390XState *env) lowcore->cpu_addr =3D 0; env->pending_int &=3D ~INTERRUPT_EXT_CPU_TIMER; } else if (env->pending_int & INTERRUPT_EXT_SERVICE) { - g_assert(env->ext_index >=3D 0); /* * FIXME: floating IRQs should be considered by all CPUs and * shuld not get cleared by CPU reset. */ - q =3D &env->ext_queue[env->ext_index]; - lowcore->ext_int_code =3D cpu_to_be16(q->code); - lowcore->ext_params =3D cpu_to_be32(q->param); - lowcore->ext_params2 =3D cpu_to_be64(q->param64); - lowcore->cpu_addr =3D cpu_to_be16(env->core_id | VIRTIO_SUBCODE_64= ); - env->ext_index--; - if (env->ext_index =3D=3D -1) { - env->pending_int &=3D ~INTERRUPT_EXT_SERVICE; - } + lowcore->ext_int_code =3D cpu_to_be16(EXT_SERVICE); + lowcore->ext_params =3D cpu_to_be32(env->service_param); + lowcore->cpu_addr =3D 0; + env->service_param =3D 0; + env->pending_int &=3D ~INTERRUPT_EXT_SERVICE; } else { g_assert_not_reached(); } diff --git a/target/s390x/internal.h b/target/s390x/internal.h index 4dda5cf2f1..eaa071a183 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -360,8 +360,6 @@ void cpu_unmap_lowcore(LowCore *lowcore); =20 /* interrupt.c */ void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ile= n); -void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param, - uint64_t param64); void cpu_inject_clock_comparator(S390CPU *cpu); void cpu_inject_cpu_timer(S390CPU *cpu); =20 diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index b9c30f86d7..cbc7b7696d 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -54,22 +54,12 @@ void program_interrupt(CPUS390XState *env, uint32_t cod= e, int ilen) } =20 #if !defined(CONFIG_USER_ONLY) -void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param, - uint64_t param64) +static void cpu_inject_service(S390CPU *cpu, uint32_t param) { CPUS390XState *env =3D &cpu->env; =20 - if (env->ext_index =3D=3D MAX_EXT_QUEUE - 1) { - /* ugh - can't queue anymore. Let's drop. */ - return; - } - - env->ext_index++; - assert(env->ext_index < MAX_EXT_QUEUE); - - env->ext_queue[env->ext_index].code =3D code; - env->ext_queue[env->ext_index].param =3D param; - env->ext_queue[env->ext_index].param64 =3D param64; + /* multiplexing is good enough for sclp - also kvm does that internall= y */ + env->service_param |=3D param; =20 env->pending_int |=3D INTERRUPT_EXT_SERVICE; cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); @@ -145,7 +135,7 @@ void s390_sclp_extint(uint32_t parm) } else { S390CPU *dummy_cpu =3D s390_cpu_addr2state(0); =20 - cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0); + cpu_inject_service(dummy_cpu, parm); } } =20 --=20 2.13.5