diff options
author | Halil Pasic <pasic@linux.vnet.ibm.com> | 2017-10-17 16:04:53 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2017-10-20 13:32:10 +0200 |
commit | 6bb6f19473e2f28334bed14740d64afb6cb6a4e5 (patch) | |
tree | fa85fa9f1c1508ff7e635faba36290fcfce9a2a5 /target/s390x | |
parent | ae9f1be3bd99cbc5b029082c5e52a24222b4fb66 (diff) | |
download | qemu-6bb6f19473e2f28334bed14740d64afb6cb6a4e5.zip qemu-6bb6f19473e2f28334bed14740d64afb6cb6a4e5.tar.gz qemu-6bb6f19473e2f28334bed14740d64afb6cb6a4e5.tar.bz2 |
s390x: refactor error handling for MSCH handler
Simplify the error handling of the MSCH. Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-8-pasic@linux.vnet.ibm.com>
[CH: fix return code for fctl != 0]
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x')
-rw-r--r-- | target/s390x/ioinst.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 8e4daca..23962fb 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -111,8 +111,6 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) SubchDev *sch; SCHIB schib; uint64_t addr; - int ret = -ENODEV; - int cc; CPUS390XState *env = &cpu->env; uint8_t ar; @@ -131,24 +129,11 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) } trace_ioinst_sch_id("msch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); - if (sch && css_subch_visible(sch)) { - ret = css_do_msch(sch, &schib); - } - switch (ret) { - case -ENODEV: - cc = 3; - break; - case -EBUSY: - cc = 2; - break; - case 0: - cc = 0; - break; - default: - cc = 1; - break; + if (!sch || !css_subch_visible(sch)) { + setcc(cpu, 3); + return; } - setcc(cpu, cc); + setcc(cpu, css_do_msch(sch, &schib)); } static void copy_orb_from_guest(ORB *dest, const ORB *src) |