{"id":807703,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807703/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","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":""},"msgid":"<20170830163609.50260-3-pasic@linux.vnet.ibm.com>","date":"2017-08-30T16:36:02","name":"[2/9] s390x: fix invalid use of cc 1 for SSCH","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8927c785a66539788641a64498d38709d885244b","submitter":{"id":68297,"url":"http://patchwork.ozlabs.org/api/1.0/people/68297/?format=json","name":"Halil Pasic","email":"pasic@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830163609.50260-3-pasic@linux.vnet.ibm.com/mbox/","series":[{"id":648,"url":"http://patchwork.ozlabs.org/api/1.0/series/648/?format=json","date":"2017-08-30T16:36:02","name":"","version":1,"mbox":"http://patchwork.ozlabs.org/series/648/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807703/checks/","tags":{},"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 3xjB4C53wfz9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 02:37:14 +1000 (AEST)","from localhost ([::1]:51542 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 1dn5zM-0007GI-G5\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 12:37:12 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50134)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pasic@linux.vnet.ibm.com>) id 1dn5yh-0007Fk-8C\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:32 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pasic@linux.vnet.ibm.com>) id 1dn5ye-0006Gv-5F\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:31 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59494\n\thelo=mx0a-001b2d01.pphosted.com)\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 1dn5yd-0006Gn-VL\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:28 -0400","from pps.filterd (m0098414.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7UGWMlh123925\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 12:36:27 -0400","from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2cnx1vp5je-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:27 -0400","from localhost\n\tby e06smtp11.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:25 +0100","from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195)\n\tby e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted; \n\tWed, 30 Aug 2017 17:36:22 +0100","from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com\n\t[9.149.105.232])\n\tby b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v7UGaMQh19005628; Wed, 30 Aug 2017 16:36:22 GMT","from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 36B0052043;\n\tWed, 30 Aug 2017 16:31:49 +0100 (BST)","from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9])\n\tby d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 089A152041; \n\tWed, 30 Aug 2017 16:31:49 +0100 (BST)"],"From":"Halil Pasic <pasic@linux.vnet.ibm.com>","To":"Cornelia Huck <cohuck@redhat.com>","Date":"Wed, 30 Aug 2017 18:36:02 +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-0040-0000-0000-000003F46E7F","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17083016-0041-0000-0000-00002094D2E6","Message-Id":"<20170830163609.50260-3-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.158.5","Subject":"[Qemu-devel] [PATCH 2/9] s390x: fix invalid use of cc 1 for SSCH","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":"According to the POP a start subchannel instruction (SSCH) returning with\ncc 1 implies that the subchannel was status pending when SSCH executed.\n\nDue to a somewhat confusing error handling, where error codes are mapped\nto cc value, sane looking error codes result in non AR compliant\nbehavior.\n\nLet's fix this! Instead of cc 1 we use cc 3 which means device not\noperational, and is much closer to the truth in the given cases.\n\nSigned-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>\nAcked-by: Pierre Morel<pmorel@linux.vnet.ibm.com>\n---\n\nThis patch turned out quite controversial. We did not reach a consensus\nduring the internal review.\n\nThe most of the discussion revolved around the ORB flag which\narchitecturally must be supported, but are currently not supported by\nvfio-ccw (not yet, or can't be). The idea showing the most promise for\nconsensus was to handle this via device status (along the lines better a\nstrange acting device than a non-conform machine) but since it's a\nradical change we decided to first discuss upstream and then do whatever\nneeds to be done.\n---\n hw/s390x/css.c      | 15 ++++++---------\n hw/s390x/s390-ccw.c |  2 +-\n 2 files changed, 7 insertions(+), 10 deletions(-)","diff":"diff --git a/hw/s390x/css.c b/hw/s390x/css.c\nindex a50fb0727e..0822538cde 100644\n--- a/hw/s390x/css.c\n+++ b/hw/s390x/css.c\n@@ -1034,7 +1034,7 @@ 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 -EINVAL;\n+        return -ENODEV;\n     }\n \n     ret = s390_ccw_cmd_request(orb, s, sch->driver_data);\n@@ -1046,16 +1046,13 @@ static int sch_handle_start_func_passthrough(SubchDev *sch)\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-        ret = -ENODEV;\n-        break;\n     default:\n-       /*\n-        * All other return codes will trigger a program check,\n-        * or set cc to 1.\n-        */\n-       break;\n+        /* Let's make all other return codes map to cc 3.  */\n+        ret = -ENODEV;\n     };\n \n     return ret;\n@@ -1115,7 +1112,7 @@ static int do_subchannel_work(SubchDev *sch)\n     if (sch->do_subchannel_work) {\n         return sch->do_subchannel_work(sch);\n     } else {\n-        return -EINVAL;\n+        return -ENODEV;\n     }\n }\n \ndiff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c\nindex 8614dda6f8..2b0741741c 100644\n--- a/hw/s390x/s390-ccw.c\n+++ b/hw/s390x/s390-ccw.c\n@@ -25,7 +25,7 @@ int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data)\n     if (cdc->handle_request) {\n         return cdc->handle_request(orb, scsw, data);\n     } else {\n-        return -ENOSYS;\n+        return -ENODEV;\n     }\n }\n \n","prefixes":["2/9"]}