From patchwork Tue Jun 6 18:29:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 9769597 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 C0CD16035D for ; Tue, 6 Jun 2017 18:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8DC9283BE for ; Tue, 6 Jun 2017 18:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACD8328415; Tue, 6 Jun 2017 18:33:30 +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 34AD1283BE for ; Tue, 6 Jun 2017 18:33:29 +0000 (UTC) Received: from localhost ([::1]:39677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJIH-0000Dh-2u for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 14:33:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIJEQ-0006Mz-Cy for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIJEL-00033N-Pk for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:30 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34042 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 1dIJEL-00032x-J8 for qemu-devel@nongnu.org; Tue, 06 Jun 2017 14:29:25 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v56IT4ZC049019 for ; Tue, 6 Jun 2017 14:29:24 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ax0374nqc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 06 Jun 2017 14:29:23 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Jun 2017 19:29:21 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Jun 2017 19:29:18 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v56ITI667274880; Tue, 6 Jun 2017 18:29:18 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D5F911C04C; Tue, 6 Jun 2017 19:27:27 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CB5D11C04A; Tue, 6 Jun 2017 19:27:27 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 6 Jun 2017 19:27:27 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 0CAAB20F677; Tue, 6 Jun 2017 20:29:18 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Tue, 6 Jun 2017 20:29:12 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496773755-53343-1-git-send-email-borntraeger@de.ibm.com> References: <1496773755-53343-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060618-0012-0000-0000-000005461D79 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060618-0013-0000-0000-000018B4FB7F Message-Id: <1496773755-53343-3-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-06_13:, , 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-1703280000 definitions=main-1706060316 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/5] s390x/css: fence off MIDA 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: Cornelia Huck , Christian Borntraeger , Richard Henderson , qemu-devel , Alexander Graf Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cornelia Huck MIDA (modified indirect data addressing) is an optional facility, and we (currently) don't support it. Let's post an operand exception if the guest tries to set it in the orb and a channel program check if it is set in a ccw, as specified in the Principles of Operation. Reviewed-by: Claudio Imbrenda Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- hw/s390x/css.c | 5 +++++ include/hw/s390x/ioinst.h | 1 + target/s390x/ioinst.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index cc76c53..599805d 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -433,6 +433,11 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr, return -EINVAL; } + /* We don't support MIDA. */ + if (ccw.flags & CCW_FLAG_MIDA) { + return -EINVAL; + } + if (ccw.flags & CCW_FLAG_SUSPEND) { return suspend_allowed ? -EINPROGRESS : -EINVAL; } diff --git a/include/hw/s390x/ioinst.h b/include/hw/s390x/ioinst.h index c559f53..92d1565 100644 --- a/include/hw/s390x/ioinst.h +++ b/include/hw/s390x/ioinst.h @@ -182,6 +182,7 @@ typedef struct CCW1 { #define CCW_FLAG_PCI 0x08 #define CCW_FLAG_IDA 0x04 #define CCW_FLAG_SUSPEND 0x02 +#define CCW_FLAG_MIDA 0x01 #define CCW_CMD_NOOP 0x03 #define CCW_CMD_BASIC_SENSE 0x04 diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 62a7771..d5e6b80 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -201,6 +201,10 @@ static int ioinst_orb_valid(ORB *orb) (orb->ctrl1 & ORB_CTRL1_MASK_INVALID)) { return 0; } + /* We don't support MIDA. */ + if (orb->ctrl1 & ORB_CTRL1_MASK_MIDAW) { + return 0; + } if ((orb->cpa & HIGH_ORDER_BIT) != 0) { return 0; }