From patchwork Wed Feb 18 20:22:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 441117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6029114007F for ; Thu, 19 Feb 2015 07:28:03 +1100 (AEDT) Received: from localhost ([::1]:52780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOBE1-0003k7-AS for incoming@patchwork.ozlabs.org; Wed, 18 Feb 2015 15:28:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOB8W-0001Dr-Fl for qemu-devel@nongnu.org; Wed, 18 Feb 2015 15:22:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOB8R-0001ww-8J for qemu-devel@nongnu.org; Wed, 18 Feb 2015 15:22:20 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:46444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOB8Q-0001uK-WA for qemu-devel@nongnu.org; Wed, 18 Feb 2015 15:22:15 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Feb 2015 20:22:14 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Feb 2015 20:22:11 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id DFD921B08067 for ; Wed, 18 Feb 2015 20:22:23 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1IKMBfr23855214 for ; Wed, 18 Feb 2015 20:22:11 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1IKMABO026875 for ; Wed, 18 Feb 2015 15:22:11 -0500 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1IKMA8R026859; Wed, 18 Feb 2015 15:22:10 -0500 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 6E4FE1224458; Wed, 18 Feb 2015 21:22:10 +0100 (CET) From: Christian Borntraeger To: Peter Maydell Date: Wed, 18 Feb 2015 21:22:17 +0100 Message-Id: <1424290943-22480-24-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1424290943-22480-1-git-send-email-borntraeger@de.ibm.com> References: <1424290943-22480-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15021820-0041-0000-0000-0000034C0D3B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.106 Cc: Thomas Huth , qemu-devel , Alexander Graf , Christian Borntraeger , Jens Freimann , Cornelia Huck , Richard Henderson Subject: [Qemu-devel] [PULL 23/29] s390x/ioinst: Set condition code in ioinst_handle_tsch() handler 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: Thomas Huth Move the setting of the condition code from kvm.c into the handler function in ioinst.c itself, just like it has been done with the other handlers already (TSCH has just not been changed yet since it is called from a different dispatcher in kvm.c). Signed-off-by: Thomas Huth Signed-off-by: Jens Freimann Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Signed-off-by: Christian Borntraeger --- target-s390x/ioinst.c | 8 ++++---- target-s390x/ioinst.h | 2 +- target-s390x/kvm.c | 9 ++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index 23c2faf..8052886 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -336,13 +336,13 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) setcc(cpu, cc); } -int ioinst_handle_tsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb) +int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) { + CPUS390XState *env = &cpu->env; int cssid, ssid, schid, m; SubchDev *sch; IRB *irb; uint64_t addr; - int ret = -ENODEV; int cc; hwaddr len = sizeof(*irb); @@ -364,12 +364,12 @@ int ioinst_handle_tsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb) } sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { - ret = css_do_tsch(sch, irb); + cc = css_do_tsch(sch, irb); /* 0 - status pending, 1 - not status pending */ - cc = ret; } else { cc = 3; } + setcc(cpu, cc); out: s390_cpu_physical_memory_unmap(env, irb, sizeof(*irb), 1); return cc; diff --git a/target-s390x/ioinst.h b/target-s390x/ioinst.h index 1efe16c..6746160 100644 --- a/target-s390x/ioinst.h +++ b/target-s390x/ioinst.h @@ -234,7 +234,7 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb); void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); -int ioinst_handle_tsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb); +int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1, uint32_t ipb); void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb); int ioinst_handle_tpi(CPUS390XState *env, uint32_t ipb); void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2, diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index f65a1d2..d7c57d9 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -1338,19 +1338,14 @@ static int handle_intercept(S390CPU *cpu) static int handle_tsch(S390CPU *cpu) { - CPUS390XState *env = &cpu->env; CPUState *cs = CPU(cpu); struct kvm_run *run = cs->kvm_run; int ret; cpu_synchronize_state(cs); - ret = ioinst_handle_tsch(env, env->regs[1], run->s390_tsch.ipb); - if (ret >= 0) { - /* Success; set condition code. */ - setcc(cpu, ret); - ret = 0; - } else if (ret < -1) { + ret = ioinst_handle_tsch(cpu, cpu->env.regs[1], run->s390_tsch.ipb); + if (ret < 0) { /* * Failure. * If an I/O interrupt had been dequeued, we have to reinject it.