]> git.proxmox.com Git - mirror_qemu.git/commitdiff
s390x/ioinst: Set condition code in ioinst_handle_tsch() handler
authorThomas Huth <thuth@linux.vnet.ibm.com>
Thu, 12 Feb 2015 17:09:36 +0000 (18:09 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 18 Feb 2015 08:37:15 +0000 (09:37 +0100)
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 <thuth@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
target-s390x/ioinst.c
target-s390x/ioinst.h
target-s390x/kvm.c

index 23c2fafb6540bb45b3c0f4d16b2e81ebc0639cff..8052886276ccc0acb5d097e22949632d716d1cd8 100644 (file)
@@ -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;
index 1efe16c3ae6cf697bb9d6ab2cdedcd4dfac0eb96..674616046d3cefb557ad788b69a92e04d55a8773 100644 (file)
@@ -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,
index f65a1d26a5f79193ff99a155b031d4cdac8c62fb..d7c57d9338bc27e2aa7610e441c8d9322fa9d31f 100644 (file)
@@ -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.