From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3nzi-0005iw-3z for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3nzW-00039r-My for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:00:14 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:52210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3nzW-00035i-F0 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 10:00:02 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jul 2013 14:57:14 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B8EC1219005F for ; Mon, 29 Jul 2013 15:04:12 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6TDxkWS66781386 for ; Mon, 29 Jul 2013 13:59:46 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r6TDxv2P021003 for ; Mon, 29 Jul 2013 07:59:57 -0600 From: Christian Borntraeger Date: Mon, 29 Jul 2013 16:00:16 +0200 Message-Id: <1375106418-22828-7-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1375106418-22828-1-git-send-email-borntraeger@de.ibm.com> References: <1375092324-23943-1-git-send-email-agraf@suse.de> <1375106418-22828-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 6/8] s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Developers Cc: aliguori@us.ibm.com, Thomas Huth , Alexander Graf , Christian Borntraeger , Jens Freimann , cornelia.huck@de.ibm.com From: Thomas Huth Consolidated the setting of the condition code in kvm_handle_css_inst(). For the (unhandled) instructions EQBS and SQBS, we have to return an operation exception instead of cc3. Also removed the is_ioinst() function to avoid decoding the opcode twice. Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- target-s390x/kvm.c | 59 ++++++++++-------------------------------------------- 1 file changed, 11 insertions(+), 48 deletions(-) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 85f0112..a7b845d 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -528,50 +528,19 @@ static int kvm_handle_css_inst(S390CPU *cpu, struct kvm_run *run, no_cc = 1; r = ioinst_handle_sal(env, env->regs[1]); break; - default: - r = -1; + case PRIV_SIGA: + /* Not provided, set CC = 3 for subchannel not operational */ + r = 3; break; + default: + return -1; } - if (r >= 0) { - if (!no_cc) { - setcc(cpu, r); - } - r = 0; - } else if (r < -1) { - r = 0; - } - return r; -} - -static int is_ioinst(uint8_t ipa0, uint8_t ipa1, uint8_t ipb) -{ - int ret = 0; - uint16_t ipa = (ipa0 << 8) | ipa1; - - switch (ipa) { - case IPA0_B2 | PRIV_CSCH: - case IPA0_B2 | PRIV_HSCH: - case IPA0_B2 | PRIV_MSCH: - case IPA0_B2 | PRIV_SSCH: - case IPA0_B2 | PRIV_STSCH: - case IPA0_B2 | PRIV_TPI: - case IPA0_B2 | PRIV_SAL: - case IPA0_B2 | PRIV_RSCH: - case IPA0_B2 | PRIV_STCRW: - case IPA0_B2 | PRIV_STCPS: - case IPA0_B2 | PRIV_RCHP: - case IPA0_B2 | PRIV_SCHM: - case IPA0_B2 | PRIV_CHSC: - case IPA0_B2 | PRIV_SIGA: - case IPA0_B2 | PRIV_XSCH: - case IPA0_B9 | PRIV_EQBS: - case IPA0_EB | PRIV_SQBS: - ret = 1; - break; + if (r >= 0 && !no_cc) { + setcc(cpu, r); } - return ret; + return 0; } static int handle_priv(S390CPU *cpu, struct kvm_run *run, @@ -587,15 +556,9 @@ static int handle_priv(S390CPU *cpu, struct kvm_run *run, r = kvm_sclp_service_call(cpu, run, ipbh0); break; default: - if (is_ioinst(ipa0, ipa1, ipb)) { - r = kvm_handle_css_inst(cpu, run, ipa0, ipa1, ipb); - if (r == -1) { - setcc(cpu, 3); - r = 0; - } - } else { - dprintf("KVM: unknown PRIV: 0x%x\n", ipa1); - r = -1; + r = kvm_handle_css_inst(cpu, run, ipa0, ipa1, ipb); + if (r == -1) { + dprintf("KVM: unhandled PRIV: 0x%x\n", ipa1); } break; } -- 1.8.3.1