Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807706/?format=api
{ "id": 807706, "url": "http://patchwork.ozlabs.org/api/patches/807706/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830163609.50260-5-pasic@linux.vnet.ibm.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170830163609.50260-5-pasic@linux.vnet.ibm.com>", "list_archive_url": null, "date": "2017-08-30T16:36:04", "name": "[4/9] s390x: refactor error handling for SSCH and RSCH", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "cc707a51950d637098bdf6ee59281c4e783a3af7", "submitter": { "id": 68297, "url": "http://patchwork.ozlabs.org/api/people/68297/?format=api", "name": "Halil Pasic", "email": "pasic@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830163609.50260-5-pasic@linux.vnet.ibm.com/mbox/", "series": [ { "id": 648, "url": "http://patchwork.ozlabs.org/api/series/648/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=648", "date": "2017-08-30T16:36:02", "name": "", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/648/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807706/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807706/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjB6s4BC0z9sNn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 02:39:33 +1000 (AEST)", "from localhost ([::1]:51548 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dn61b-0000Tk-9m\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 12:39:31 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:50183)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pasic@linux.vnet.ibm.com>) id 1dn5yl-0007Hz-7Y\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:37 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pasic@linux.vnet.ibm.com>) id 1dn5yi-0006J5-P3\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:35 -0400", "from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50007)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <pasic@linux.vnet.ibm.com>)\n\tid 1dn5yi-0006Ij-H5\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:32 -0400", "from pps.filterd (m0098393.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7UGa36d083450\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 12:36:29 -0400", "from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cnur1hj5k-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 12:36:29 -0400", "from localhost\n\tby e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <qemu-devel@nongnu.org> from <pasic@linux.vnet.ibm.com>;\n\tWed, 30 Aug 2017 17:36:26 +0100", "from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197)\n\tby e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted; \n\tWed, 30 Aug 2017 17:36:25 +0100", "from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com\n\t[9.149.105.232])\n\tby b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v7UGaOAh22413364; Wed, 30 Aug 2017 16:36:24 GMT", "from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 9CDF252049;\n\tWed, 30 Aug 2017 16:31:51 +0100 (BST)", "from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9])\n\tby d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 6582452043; \n\tWed, 30 Aug 2017 16:31:51 +0100 (BST)" ], "From": "Halil Pasic <pasic@linux.vnet.ibm.com>", "To": "Cornelia Huck <cohuck@redhat.com>", "Date": "Wed, 30 Aug 2017 18:36:04 +0200", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170830163609.50260-1-pasic@linux.vnet.ibm.com>", "References": "<20170830163609.50260-1-pasic@linux.vnet.ibm.com>", "X-TM-AS-GCONF": "00", "x-cbid": "17083016-0008-0000-0000-000004917045", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "17083016-0009-0000-0000-00001E21C2D6", "Message-Id": "<20170830163609.50260-5-pasic@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-30_07:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708300251", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]", "X-Received-From": "148.163.156.1", "Subject": "[Qemu-devel] [PATCH 4/9] s390x: refactor error handling for SSCH\n\tand RSCH", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>,\n\tHalil Pasic <pasic@linux.vnet.ibm.com>,\n\tPierre Morel <pmorel@linux.vnet.ibm.com>, qemu-devel@nongnu.org", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "Simplify the error handling of the SSCH and RSCH handler avoiding\narbitrary and cryptic error codes being mapped to what a subchannel is\nsupposed to do. Let the code detecting the condition tell how it's to be\nhandled in a less ambiguous way. It's best to handle SSCH and RSCH in\none go as the emulation of the two shares a lot of code.\n\nSigned-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>\nAcked-by: Pierre Morel<pmorel@linux.vnet.ibm.com>\n\n---\nNotes:\nFunny, we had a different swich-case for SSCH and RSCH. For\nvirtual it did not matter, but for passtrough it could. In practice\n-EINVAL from the kernel would have been mapped to cc 2 in case of\nRSCH and to cc 1 in case of SSHC which is absurd. Same goes for\n-EBUSY from kernel which is correctly mapped to cc 2 in case of\nSSCH, but for RSCH it gets mapped to cc 1 which is also absurd.\n---\n hw/s390x/css.c | 86 ++++++++++++++-------------------------------\n hw/s390x/s390-ccw.c | 8 ++---\n hw/vfio/ccw.c | 32 +++++++++++++----\n include/hw/s390x/css.h | 30 ++++++++++++----\n include/hw/s390x/s390-ccw.h | 2 +-\n target/s390x/ioinst.c | 61 +++++++++-----------------------\n 6 files changed, 97 insertions(+), 122 deletions(-)", "diff": "diff --git a/hw/s390x/css.c b/hw/s390x/css.c\nindex bc47bf5b20..1102642c10 100644\n--- a/hw/s390x/css.c\n+++ b/hw/s390x/css.c\n@@ -1015,12 +1015,11 @@ static void sch_handle_start_func_virtual(SubchDev *sch)\n \n }\n \n-static int sch_handle_start_func_passthrough(SubchDev *sch)\n+static void sch_handle_start_func_passthrough(SubchDev *sch)\n {\n \n PMCW *p = &sch->curr_status.pmcw;\n SCSW *s = &sch->curr_status.scsw;\n- int ret;\n \n ORB *orb = &sch->orb;\n if (!(s->ctrl & SCSW_ACTL_SUSP)) {\n@@ -1034,28 +1033,10 @@ static int sch_handle_start_func_passthrough(SubchDev *sch)\n */\n if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) ||\n !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) {\n- return -ENODEV;\n+ sch->iret.cc = 3;\n }\n \n- ret = s390_ccw_cmd_request(orb, s, sch->driver_data);\n- switch (ret) {\n- /* Currently we don't update control block and just return the cc code. */\n- case 0:\n- break;\n- case -EBUSY:\n- break;\n- case -ENODEV:\n- break;\n- case -EFAULT:\n- break;\n- case -EACCES:\n- /* Let's reflect an inaccessible host device by cc 3. */\n- default:\n- /* Let's make all other return codes map to cc 3. */\n- ret = -ENODEV;\n- };\n-\n- return ret;\n+ s390_ccw_cmd_request(sch);\n }\n \n /*\n@@ -1064,7 +1045,7 @@ static int sch_handle_start_func_passthrough(SubchDev *sch)\n * read/writes) asynchronous later on if we start supporting more than\n * our current very simple devices.\n */\n-int do_subchannel_work_virtual(SubchDev *sch)\n+void do_subchannel_work_virtual(SubchDev *sch)\n {\n \n SCSW *s = &sch->curr_status.scsw;\n@@ -1078,41 +1059,35 @@ int do_subchannel_work_virtual(SubchDev *sch)\n sch_handle_start_func_virtual(sch);\n } else {\n /* Cannot happen. */\n- return -ENODEV;\n+ sch->iret.cc = 3;\n }\n css_inject_io_interrupt(sch);\n- return 0;\n }\n \n-int do_subchannel_work_passthrough(SubchDev *sch)\n+void do_subchannel_work_passthrough(SubchDev *sch)\n {\n- int ret;\n SCSW *s = &sch->curr_status.scsw;\n \n if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {\n /* TODO: Clear handling */\n sch_handle_clear_func(sch);\n- ret = 0;\n } else if (s->ctrl & SCSW_FCTL_HALT_FUNC) {\n /* TODO: Halt handling */\n sch_handle_halt_func(sch);\n- ret = 0;\n } else if (s->ctrl & SCSW_FCTL_START_FUNC) {\n- ret = sch_handle_start_func_passthrough(sch);\n+ sch_handle_start_func_passthrough(sch);\n } else {\n /* Cannot happen. */\n- return -ENODEV;\n+ sch->iret.cc = 3;\n }\n-\n- return ret;\n }\n \n-static int do_subchannel_work(SubchDev *sch)\n+static void do_subchannel_work(SubchDev *sch)\n {\n if (sch->do_subchannel_work) {\n- return sch->do_subchannel_work(sch);\n+ sch->do_subchannel_work(sch);\n } else {\n- return -ENODEV;\n+ sch->iret.cc = 3;\n }\n }\n \n@@ -1400,27 +1375,26 @@ static void css_update_chnmon(SubchDev *sch)\n }\n }\n \n-int css_do_ssch(SubchDev *sch, ORB *orb)\n+void css_do_ssch(SubchDev *sch, ORB *orb)\n {\n SCSW *s = &sch->curr_status.scsw;\n PMCW *p = &sch->curr_status.pmcw;\n- int ret;\n \n if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {\n- ret = -ENODEV;\n- goto out;\n+ sch->iret.cc = 3;\n+ return;\n }\n \n if (s->ctrl & SCSW_STCTL_STATUS_PEND) {\n- ret = -EINPROGRESS;\n- goto out;\n+ sch->iret.cc = 1;\n+ return;\n }\n \n if (s->ctrl & (SCSW_FCTL_START_FUNC |\n SCSW_FCTL_HALT_FUNC |\n SCSW_FCTL_CLEAR_FUNC)) {\n- ret = -EBUSY;\n- goto out;\n+ sch->iret.cc = 2;\n+ return;\n }\n \n /* If monitoring is active, update counter. */\n@@ -1433,10 +1407,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb)\n s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND);\n s->flags &= ~SCSW_FLAGS_MASK_PNO;\n \n- ret = do_subchannel_work(sch);\n-\n-out:\n- return ret;\n+ do_subchannel_work(sch);\n }\n \n static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw,\n@@ -1683,27 +1654,26 @@ void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo)\n }\n }\n \n-int css_do_rsch(SubchDev *sch)\n+void css_do_rsch(SubchDev *sch)\n {\n SCSW *s = &sch->curr_status.scsw;\n PMCW *p = &sch->curr_status.pmcw;\n- int ret;\n \n if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {\n- ret = -ENODEV;\n- goto out;\n+ sch->iret.cc = 3;\n+ return;\n }\n \n if (s->ctrl & SCSW_STCTL_STATUS_PEND) {\n- ret = -EINPROGRESS;\n- goto out;\n+ sch->iret.cc = 1;\n+ return;\n }\n \n if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) ||\n (s->ctrl & SCSW_ACTL_RESUME_PEND) ||\n (!(s->ctrl & SCSW_ACTL_SUSP))) {\n- ret = -EINVAL;\n- goto out;\n+ sch->iret.cc = 2;\n+ return;\n }\n \n /* If monitoring is active, update counter. */\n@@ -1713,10 +1683,6 @@ int css_do_rsch(SubchDev *sch)\n \n s->ctrl |= SCSW_ACTL_RESUME_PEND;\n do_subchannel_work(sch);\n- ret = 0;\n-\n-out:\n- return ret;\n }\n \n int css_do_rchp(uint8_t cssid, uint8_t chpid)\ndiff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c\nindex 2b0741741c..fa0947894d 100644\n--- a/hw/s390x/s390-ccw.c\n+++ b/hw/s390x/s390-ccw.c\n@@ -18,14 +18,14 @@\n #include \"hw/s390x/css-bridge.h\"\n #include \"hw/s390x/s390-ccw.h\"\n \n-int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data)\n+void s390_ccw_cmd_request(SubchDev *sch)\n {\n- S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(data);\n+ S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(sch->driver_data);\n \n if (cdc->handle_request) {\n- return cdc->handle_request(orb, scsw, data);\n+ cdc->handle_request(sch);\n } else {\n- return -ENODEV;\n+ sch->iret.cc = 3;\n }\n }\n \ndiff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c\nindex a8baadf57a..b2827ce987 100644\n--- a/hw/vfio/ccw.c\n+++ b/hw/vfio/ccw.c\n@@ -23,6 +23,7 @@\n #include \"hw/s390x/s390-ccw.h\"\n #include \"hw/s390x/ccw-device.h\"\n #include \"qemu/error-report.h\"\n+#include \"cpu.h\"\n \n #define TYPE_VFIO_CCW \"vfio-ccw\"\n typedef struct VFIOCCWDevice {\n@@ -47,9 +48,9 @@ struct VFIODeviceOps vfio_ccw_ops = {\n .vfio_compute_needs_reset = vfio_ccw_compute_needs_reset,\n };\n \n-static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)\n+static void vfio_ccw_handle_request(SubchDev *sch)\n {\n- S390CCWDevice *cdev = data;\n+ S390CCWDevice *cdev = sch->driver_data;\n VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);\n struct ccw_io_region *region = vcdev->io_region;\n int ret;\n@@ -60,8 +61,8 @@ static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)\n \n memset(region, 0, sizeof(*region));\n \n- memcpy(region->orb_area, orb, sizeof(ORB));\n- memcpy(region->scsw_area, scsw, sizeof(SCSW));\n+ memcpy(region->orb_area, &sch->orb, sizeof(ORB));\n+ memcpy(region->scsw_area, &sch->curr_status.scsw, sizeof(SCSW));\n \n again:\n ret = pwrite(vcdev->vdev.fd, region,\n@@ -71,10 +72,27 @@ again:\n goto again;\n }\n error_report(\"vfio-ccw: wirte I/O region failed with errno=%d\", errno);\n- return -errno;\n+ ret = -errno;\n+ } else {\n+ ret = region->ret_code;\n+ }\n+ switch (-ret) {\n+ /* Currently we don't update control block and just return the cc code. */\n+ case 0:\n+ sch->iret.cc = 0;\n+ break;\n+ case EBUSY:\n+ sch->iret.cc = 2;\n+ break;\n+ case EFAULT:\n+ sch->iret.pgm_chk = true;\n+ sch->iret.irq_code = PGM_ADDRESSING;\n+ break;\n+ case ENODEV:\n+ case EACCES:\n+ default:\n+ sch->iret.cc = 3;\n }\n-\n- return region->ret_code;\n }\n \n static void vfio_ccw_reset(DeviceState *dev)\ndiff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h\nindex 5c5fe6b202..d093181a9e 100644\n--- a/include/hw/s390x/css.h\n+++ b/include/hw/s390x/css.h\n@@ -94,13 +94,31 @@ struct SubchDev {\n /* transport-provided data: */\n int (*ccw_cb) (SubchDev *, CCW1);\n void (*disable_cb)(SubchDev *);\n- int (*do_subchannel_work) (SubchDev *);\n+ void (*do_subchannel_work) (SubchDev *);\n SenseId id;\n void *driver_data;\n+ /* io instructions conclude according to iret */\n+ struct {\n+ /*\n+ * General semantic of cc codes of IO instructions is (brief):\n+ * 0 -- produced expected result\n+ * 1 -- produced alternate result\n+ * 2 -- ineffective, because busy with previously initiated function\n+ * 3 -- ineffective, not operational\n+ */\n+ uint32_t cc:4;\n+ bool pgm_chk:1;\n+ uint32_t irq_code;\n+ } iret;\n };\n \n extern const VMStateDescription vmstate_subch_dev;\n \n+static inline void css_subch_clear_iret(SubchDev *sch)\n+{\n+ memset(&sch->iret, 0, sizeof(sch->iret));\n+}\n+\n /*\n * Identify a device within the channel subsystem.\n * Note that this can be used to identify either the subchannel or\n@@ -156,9 +174,9 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,\n void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);\n void css_generate_css_crws(uint8_t cssid);\n void css_clear_sei_pending(void);\n-int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data);\n-int do_subchannel_work_virtual(SubchDev *sub);\n-int do_subchannel_work_passthrough(SubchDev *sub);\n+void s390_ccw_cmd_request(SubchDev *sch);\n+void do_subchannel_work_virtual(SubchDev *sub);\n+void do_subchannel_work_passthrough(SubchDev *sub);\n \n typedef enum {\n CSS_IO_ADAPTER_VIRTIO = 0,\n@@ -189,7 +207,7 @@ int css_do_msch(SubchDev *sch, const SCHIB *schib);\n int css_do_xsch(SubchDev *sch);\n int css_do_csch(SubchDev *sch);\n int css_do_hsch(SubchDev *sch);\n-int css_do_ssch(SubchDev *sch, ORB *orb);\n+void css_do_ssch(SubchDev *sch, ORB *orb);\n int css_do_tsch_get_irb(SubchDev *sch, IRB *irb, int *irb_len);\n void css_do_tsch_update_subch(SubchDev *sch);\n int css_do_stcrw(CRW *crw);\n@@ -200,7 +218,7 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,\n void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo);\n int css_enable_mcsse(void);\n int css_enable_mss(void);\n-int css_do_rsch(SubchDev *sch);\n+void css_do_rsch(SubchDev *sch);\n int css_do_rchp(uint8_t cssid, uint8_t chpid);\n bool css_present(uint8_t cssid);\n #endif\ndiff --git a/include/hw/s390x/s390-ccw.h b/include/hw/s390x/s390-ccw.h\nindex 9f45cf1347..d2159c9ed7 100644\n--- a/include/hw/s390x/s390-ccw.h\n+++ b/include/hw/s390x/s390-ccw.h\n@@ -33,7 +33,7 @@ typedef struct S390CCWDeviceClass {\n CCWDeviceClass parent_class;\n void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);\n void (*unrealize)(S390CCWDevice *dev, Error **errp);\n- int (*handle_request) (ORB *, SCSW *, void *);\n+ void (*handle_request) (SubchDev *sch);\n } S390CCWDeviceClass;\n \n #endif\ndiff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c\nindex 51fbea620d..e8044068c2 100644\n--- a/target/s390x/ioinst.c\n+++ b/target/s390x/ioinst.c\n@@ -217,8 +217,6 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb)\n SubchDev *sch;\n ORB orig_orb, orb;\n uint64_t addr;\n- int ret = -ENODEV;\n- int cc;\n CPUS390XState *env = &cpu->env;\n uint8_t ar;\n \n@@ -238,33 +236,17 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb)\n }\n trace_ioinst_sch_id(\"ssch\", cssid, ssid, schid);\n sch = css_find_subch(m, cssid, ssid, schid);\n- if (sch && css_subch_visible(sch)) {\n- ret = css_do_ssch(sch, &orb);\n+ if (!sch || !css_subch_visible(sch)) {\n+ setcc(cpu, 3);\n+ return;\n }\n- switch (ret) {\n- case -ENODEV:\n- cc = 3;\n- break;\n- case -EBUSY:\n- cc = 2;\n- break;\n- case -EFAULT:\n- /*\n- * TODO:\n- * I'm wondering whether there is something better\n- * to do for us here (like setting some device or\n- * subchannel status).\n- */\n- program_interrupt(env, PGM_ADDRESSING, 4);\n+ css_subch_clear_iret(sch);\n+ css_do_ssch(sch, &orb);\n+ if (sch->iret.pgm_chk) {\n+ program_interrupt(env, sch->iret.irq_code, 4);\n return;\n- case 0:\n- cc = 0;\n- break;\n- default:\n- cc = 1;\n- break;\n }\n- setcc(cpu, cc);\n+ setcc(cpu, sch->iret.cc);\n }\n \n void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb)\n@@ -767,8 +749,6 @@ void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1)\n {\n int cssid, ssid, schid, m;\n SubchDev *sch;\n- int ret = -ENODEV;\n- int cc;\n \n if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {\n program_interrupt(&cpu->env, PGM_OPERAND, 4);\n@@ -776,24 +756,17 @@ void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1)\n }\n trace_ioinst_sch_id(\"rsch\", cssid, ssid, schid);\n sch = css_find_subch(m, cssid, ssid, schid);\n- if (sch && css_subch_visible(sch)) {\n- ret = css_do_rsch(sch);\n+ if (!sch || !css_subch_visible(sch)) {\n+ setcc(cpu, 3);\n+ return;\n }\n- switch (ret) {\n- case -ENODEV:\n- cc = 3;\n- break;\n- case -EINVAL:\n- cc = 2;\n- break;\n- case 0:\n- cc = 0;\n- break;\n- default:\n- cc = 1;\n- break;\n+ css_subch_clear_iret(sch);\n+ css_do_rsch(sch);\n+ if (sch->iret.pgm_chk) {\n+ program_interrupt(&cpu->env, sch->iret.irq_code, 4);\n+ return;\n }\n- setcc(cpu, cc);\n+ setcc(cpu, sch->iret.cc);\n }\n \n #define RCHP_REG1_RES(_reg) (_reg & 0x00000000ff00ff00)\n", "prefixes": [ "4/9" ] }