From patchwork Wed Jul 19 12:54:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 9851947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2A5C60392 for ; Wed, 19 Jul 2017 12:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A512628641 for ; Wed, 19 Jul 2017 12:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99FF02864F; Wed, 19 Jul 2017 12:55:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30F3628641 for ; Wed, 19 Jul 2017 12:55:49 +0000 (UTC) Received: from localhost ([::1]:33352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXoW4-00058g-C0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jul 2017 08:55:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXoUg-00057H-I2 for qemu-devel@nongnu.org; Wed, 19 Jul 2017 08:54:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXoUb-0003mF-ML for qemu-devel@nongnu.org; Wed, 19 Jul 2017 08:54:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXoUb-0003m6-Cx for qemu-devel@nongnu.org; Wed, 19 Jul 2017 08:54:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D2C14ACCB; Wed, 19 Jul 2017 12:54:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4D2C14ACCB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4D2C14ACCB Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C8B67D646; Wed, 19 Jul 2017 12:54:13 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Date: Wed, 19 Jul 2017 14:54:06 +0200 Message-Id: <1500468850-15571-2-git-send-email-thuth@redhat.com> In-Reply-To: <1500468850-15571-1-git-send-email-thuth@redhat.com> References: <1500468850-15571-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 19 Jul 2017 12:54:16 +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 1/5] target/s390x: Move program_interrupt() & trigger_pgm_exception() to interrupt.c 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: Christian Borntraeger , Cornelia Huck , Alexander Graf Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP misc_helper.c won't be compiled with --disable-tcg anymore, but we still need the program_interrupt() function in that case. Move it to interrupt.c instead, and refactor it a little bit to re-use the code from trigger_pgm_exception() here, too. Signed-off-by: Thomas Huth --- target/s390x/cpu.h | 5 +---- target/s390x/helper.c | 10 ---------- target/s390x/interrupt.c | 36 ++++++++++++++++++++++++++++++++++++ target/s390x/misc_helper.c | 26 -------------------------- 4 files changed, 37 insertions(+), 40 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7732d01..aec9aac 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -474,10 +474,6 @@ static inline bool get_per_in_range(CPUS390XState *env, uint64_t addr) } } -#ifndef CONFIG_USER_ONLY -void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen); -#endif - S390CPU *cpu_s390x_init(const char *cpu_model); S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp); S390CPU *cpu_s390x_create(const char *cpu_model, Error **errp); @@ -1146,6 +1142,7 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3); /* automatically detect the instruction length */ #define ILEN_AUTO 0xff void program_interrupt(CPUS390XState *env, uint32_t code, int ilen); +void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen); void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, uintptr_t retaddr); diff --git a/target/s390x/helper.c b/target/s390x/helper.c index aef09e1..2a89029 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -165,16 +165,6 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address, #else /* !CONFIG_USER_ONLY */ -/* Ensure to exit the TB after this call! */ -void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen) -{ - CPUState *cs = CPU(s390_env_get_cpu(env)); - - cs->exception_index = EXCP_PGM; - env->int_pgm_code = code; - env->int_pgm_ilen = ilen; -} - int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int rw, int mmu_idx) { diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 9edef96..b30c95c 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -8,10 +8,46 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "cpu.h" +#include "exec/exec-all.h" #include "sysemu/kvm.h" #include "hw/s390x/ioinst.h" +/* Ensure to exit the TB after this call! */ +void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen) +{ + CPUState *cs = CPU(s390_env_get_cpu(env)); + + cs->exception_index = EXCP_PGM; + env->int_pgm_code = code; + env->int_pgm_ilen = ilen; +} + +void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) +{ + S390CPU *cpu = s390_env_get_cpu(env); + + qemu_log_mask(CPU_LOG_INT, "program interrupt at %#" PRIx64 "\n", + env->psw.addr); + + if (kvm_enabled()) { +#ifdef CONFIG_KVM + struct kvm_s390_irq irq = { + .type = KVM_S390_PROGRAM_INT, + .u.pgm.code = code, + }; + + kvm_s390_vcpu_interrupt(cpu, &irq); +#endif + } else { + trigger_pgm_exception(env, code, ilen); +#ifdef CONFIG_TCG + cpu_loop_exit(CPU(cpu)); +#endif + } +} + #if !defined(CONFIG_USER_ONLY) void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param, uint64_t param64) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index b508101..3fd7070 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -75,32 +75,6 @@ void HELPER(exception)(CPUS390XState *env, uint32_t excp) cpu_loop_exit(cs); } -void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) -{ - S390CPU *cpu = s390_env_get_cpu(env); - - qemu_log_mask(CPU_LOG_INT, "program interrupt at %#" PRIx64 "\n", - env->psw.addr); - - if (kvm_enabled()) { -#ifdef CONFIG_KVM - struct kvm_s390_irq irq = { - .type = KVM_S390_PROGRAM_INT, - .u.pgm.code = code, - }; - - kvm_s390_vcpu_interrupt(cpu, &irq); -#endif - } else { - CPUState *cs = CPU(cpu); - - env->int_pgm_code = code; - env->int_pgm_ilen = ilen; - cs->exception_index = EXCP_PGM; - cpu_loop_exit(cs); - } -} - #ifndef CONFIG_USER_ONLY /* SCLP service call */