From patchwork Wed Aug 15 15:47:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 177711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D19682C009F for ; Thu, 16 Aug 2012 01:47:56 +1000 (EST) Received: from localhost ([::1]:59150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1fp5-0004HA-0N for incoming@patchwork.ozlabs.org; Wed, 15 Aug 2012 11:47:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1foa-0002pO-7V for qemu-devel@nongnu.org; Wed, 15 Aug 2012 11:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1foY-0004Gl-PT for qemu-devel@nongnu.org; Wed, 15 Aug 2012 11:47:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57245 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1foY-0004Gb-FK for qemu-devel@nongnu.org; Wed, 15 Aug 2012 11:47:22 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E5F22A4664; Wed, 15 Aug 2012 17:47:21 +0200 (CEST) From: Alexander Graf To: qemu-devel qemu-devel Date: Wed, 15 Aug 2012 17:47:17 +0200 Message-Id: <1345045637-20589-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1345045637-20589-1-git-send-email-agraf@suse.de> References: <1345045637-20589-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Blue Swirl , Christian Borntraeger , Aurelien Jarno Subject: [Qemu-devel] [PATCH 2/2] s390: provide interface for service interrupt/introduce interrupt.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Christian Borntraeger This patch creates interrupt.c. The first user is a callback for hw/* code to trigger an service interrupt for a given sccb value. Several interrupt types for s390 are floating (can be delivered to all CPUs). so this code does not belong to a specific CPU. Other interrupts (like the virtio one) are also floating and can be moved here later on. Signed-off-by: Christian Borntraeger Signed-off-by: Alexander Graf --- target-s390x/Makefile.objs | 2 +- target-s390x/cpu.h | 3 +++ target-s390x/interrupt.c | 29 +++++++++++++++++++++++++++++ target-s390x/op_helper.c | 16 +--------------- 4 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 target-s390x/interrupt.c diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs index 262747f..80be3bb 100644 --- a/target-s390x/Makefile.objs +++ b/target-s390x/Makefile.objs @@ -1,4 +1,4 @@ -obj-y += translate.o op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o interrupt.o obj-$(CONFIG_SOFTMMU) += machine.o obj-$(CONFIG_KVM) += kvm.o diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index c30ac3a..18ac6e3 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -320,6 +320,9 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); void s390_add_running_cpu(CPUS390XState *env); unsigned s390_del_running_cpu(CPUS390XState *env); +/* service interrupts are floating therefore we must not pass an cpustate */ +void s390_sclp_extint(uint32_t parm); + /* from s390-virtio-bus */ extern const target_phys_addr_t virtio_size; diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c new file mode 100644 index 0000000..c1b034f --- /dev/null +++ b/target-s390x/interrupt.c @@ -0,0 +1,29 @@ +/* + * QEMU S/390 Interrupt support + * + * Copyright IBM, Corp. 2012 + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at your + * option) any later version. See the COPYING file in the top-level directory. + */ + +#include "cpu.h" +#include "kvm.h" + +#if !defined(CONFIG_USER_ONLY) +/* service interrupts are floating therefore we must not pass an cpustate */ +void s390_sclp_extint(uint32_t parm) +{ + S390CPU *dummy_cpu = s390_cpu_addr2state(0); + CPUS390XState *env = &dummy_cpu->env; + + if (kvm_enabled()) { +#ifdef CONFIG_KVM + kvm_s390_interrupt_internal(env, KVM_S390_INT_SERVICE, parm, 0, 1); +#endif + } else { + env->psw.addr += 4; + cpu_inject_ext(env, EXT_SERVICE, parm, 0); + } +} +#endif diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c index 91dd8dc..abc35dd 100644 --- a/target-s390x/op_helper.c +++ b/target-s390x/op_helper.c @@ -2362,12 +2362,6 @@ static void program_interrupt(CPUS390XState *env, uint32_t code, int ilc) } } -static void ext_interrupt(CPUS390XState *env, int type, uint32_t param, - uint64_t param64) -{ - cpu_inject_ext(env, type, param, param64); -} - /* * ret < 0 indicates program check, ret = 0,1,2,3 -> cc */ @@ -2398,15 +2392,7 @@ int sclp_service_call(CPUS390XState *env, uint32_t sccb, uint64_t code) stb_phys(sccb + SCP_INCREMENT, 1 << shift); stw_phys(sccb + SCP_RESPONSE_CODE, 0x10); - if (kvm_enabled()) { -#ifdef CONFIG_KVM - kvm_s390_interrupt_internal(env, KVM_S390_INT_SERVICE, - sccb & ~3, 0, 1); -#endif - } else { - env->psw.addr += 4; - ext_interrupt(env, EXT_SERVICE, sccb & ~3, 0); - } + s390_sclp_extint(sccb & ~3); break; default: #ifdef DEBUG_HELPER