From patchwork Wed Aug 30 16:36:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Halil Pasic X-Patchwork-Id: 9930177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8D71603B5 for ; Wed, 30 Aug 2017 16:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 993AD285AE for ; Wed, 30 Aug 2017 16:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E32228714; Wed, 30 Aug 2017 16:38:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 660B52872B for ; Wed, 30 Aug 2017 16:38:26 +0000 (UTC) Received: from localhost ([::1]:51542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn5zt-0007GI-Th for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Aug 2017 12:37:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn5yh-0007Fk-8C for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn5ye-0006Gv-5F for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59494 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn5yd-0006Gn-VL for qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:36:28 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7UGWMlh123925 for ; Wed, 30 Aug 2017 12:36:27 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2cnx1vp5je-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 30 Aug 2017 12:36:27 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 Aug 2017 17:36:25 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 30 Aug 2017 17:36:22 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7UGaMQh19005628; Wed, 30 Aug 2017 16:36:22 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36B0052043; Wed, 30 Aug 2017 16:31:49 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 089A152041; Wed, 30 Aug 2017 16:31:49 +0100 (BST) From: Halil Pasic To: Cornelia Huck 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:, , definitions=2017-08-30_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dong Jia Shi , Halil Pasic , Pierre Morel , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP According to the POP a start subchannel instruction (SSCH) returning with cc 1 implies that the subchannel was status pending when SSCH executed. Due to a somewhat confusing error handling, where error codes are mapped to cc value, sane looking error codes result in non AR compliant behavior. Let's fix this! Instead of cc 1 we use cc 3 which means device not operational, and is much closer to the truth in the given cases. Signed-off-by: Halil Pasic Acked-by: Pierre Morel --- This patch turned out quite controversial. We did not reach a consensus during the internal review. The most of the discussion revolved around the ORB flag which architecturally must be supported, but are currently not supported by vfio-ccw (not yet, or can't be). The idea showing the most promise for consensus was to handle this via device status (along the lines better a strange acting device than a non-conform machine) but since it's a radical change we decided to first discuss upstream and then do whatever needs to be done. --- hw/s390x/css.c | 15 ++++++--------- hw/s390x/s390-ccw.c | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index a50fb0727e..0822538cde 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -1034,7 +1034,7 @@ static int sch_handle_start_func_passthrough(SubchDev *sch) */ if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) || !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) { - return -EINVAL; + return -ENODEV; } ret = s390_ccw_cmd_request(orb, s, sch->driver_data); @@ -1046,16 +1046,13 @@ static int sch_handle_start_func_passthrough(SubchDev *sch) break; case -ENODEV: break; + case -EFAULT: + break; case -EACCES: /* Let's reflect an inaccessible host device by cc 3. */ - ret = -ENODEV; - break; default: - /* - * All other return codes will trigger a program check, - * or set cc to 1. - */ - break; + /* Let's make all other return codes map to cc 3. */ + ret = -ENODEV; }; return ret; @@ -1115,7 +1112,7 @@ static int do_subchannel_work(SubchDev *sch) if (sch->do_subchannel_work) { return sch->do_subchannel_work(sch); } else { - return -EINVAL; + return -ENODEV; } } diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c index 8614dda6f8..2b0741741c 100644 --- a/hw/s390x/s390-ccw.c +++ b/hw/s390x/s390-ccw.c @@ -25,7 +25,7 @@ int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data) if (cdc->handle_request) { return cdc->handle_request(orb, scsw, data); } else { - return -ENOSYS; + return -ENODEV; } }