From patchwork Wed Nov 8 16:54:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Halil Pasic X-Patchwork-Id: 10048821 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 45BE4603FF for ; Wed, 8 Nov 2017 16:57:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38D23204FB for ; Wed, 8 Nov 2017 16:57:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DA5B2A72D; Wed, 8 Nov 2017 16:57:42 +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 86CA92A786 for ; Wed, 8 Nov 2017 16:57:41 +0000 (UTC) Received: from localhost ([::1]:60822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCTfY-0004ba-FR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Nov 2017 11:57:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCTd2-0003aY-C3 for qemu-devel@nongnu.org; Wed, 08 Nov 2017 11:55:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCTcx-0000VO-RJ for qemu-devel@nongnu.org; Wed, 08 Nov 2017 11:55:04 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55984 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 1eCTcx-0000V7-LH for qemu-devel@nongnu.org; Wed, 08 Nov 2017 11:54:59 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA8GqEth128504 for ; Wed, 8 Nov 2017 11:54:52 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2e448sxem7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 08 Nov 2017 11:54:51 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 Nov 2017 16:54:50 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 8 Nov 2017 16:54:48 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA8GsmNo32178316; Wed, 8 Nov 2017 16:54:48 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB03052043; Wed, 8 Nov 2017 15:48:38 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 86A5252045; Wed, 8 Nov 2017 15:48:38 +0000 (GMT) From: Halil Pasic To: Cornelia Huck , "Dong Jia Shi" Date: Wed, 8 Nov 2017 17:54:22 +0100 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171108165422.46267-1-pasic@linux.vnet.ibm.com> References: <20171108165422.46267-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17110816-0040-0000-0000-000003EC0D83 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110816-0041-0000-0000-000025EEAD35 Message-Id: <20171108165422.46267-4-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-08_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711080223 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [RFC PATCH NOT QEMU v2 3/3] ccw-tester: add tic test 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: qemu-s390x@nongnu.org, Thomas Huth , 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 Let's add a test verifying that the channel subsystlem responds to a format 1 transfer in channel ccw with non-zero count properly -- with a channel program check. Signed-off-by: Halil Pasic --- ccw_tester.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/ccw_tester.c b/ccw_tester.c index b8e632b..6253ae7 100644 --- a/ccw_tester.c +++ b/ccw_tester.c @@ -347,8 +347,73 @@ static ssize_t w_fib_idal_store(struct device *dev, return ret ? ret : count; } +static void tic_setup(struct ccw_test_work *w) +{ + struct ccw_tester_device *tdev; + struct subchannel_id schid; + + tdev = container_of(w, struct ccw_tester_device, work); + ccw_device_get_schid(tdev->cdev, &schid); + w->ret = set_mode_diag(schid, OP_MODE_NOP); + if (w->ret) { + printk(KERN_WARNING "tic_setup ret = %d\n", w->ret); + w->ret = 0; + return; + } + w->private = kzalloc(sizeof(*w->ccw), GFP_DMA | GFP_KERNEL); + + w->ccw->count = 0x0666; /* we are evil */ + w->ccw->cmd_code = CCW_CMD_TIC; + /* hope this won't get used */ + w->ccw->cda = (__u32)(unsigned long) w->private; +} + +static void tic_teardown(struct ccw_test_work *w) +{ + if (w->private) { + idal_buffer_free(w->private); + w->private = NULL; + } + if (w->ret) + printk(KERN_WARNING "tic_teardown ret = %d\n", w->ret); +} + +static bool expect_pgm_chk(struct irb *irb) +{ + if (irb_is_error(irb) + && (scsw_cstat(&irb->scsw) & SCHN_STAT_PROG_CHECK) + && scsw_stctl(&irb->scsw) & SCSW_STCTL_ALERT_STATUS) + return true; + printk(KERN_NOTICE + "expected program check but got none (is_error == %d)\n", + irb_is_error(irb)); + return false; +} + +static void do_tic_test(struct ccw_test_work *w) +{ + /* we have one already set up, fire it */ + do_test_do_io(w); + /* TODO: check for pgm-check */ + ccw_test_assert(expect_pgm_chk(&w->irb), + "expected pgm check for tic with count != 0 fib"); +} + +static ssize_t w_tic_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int ret; + struct ccw_tester_device *tdev = to_mydev(to_ccwdev(dev)); + + ret = queue_ccw_test_work(tdev, + tic_setup, do_tic_test, tic_teardown); + return ret ? ret : count; +} + static DEVICE_ATTR_WO(w_fib); static DEVICE_ATTR_WO(w_fib_idal); +static DEVICE_ATTR_WO(w_tic); static void do_ccw_test_work(struct work_struct *work) { @@ -378,6 +443,7 @@ static int ccw_tester_offline(struct ccw_device *cdev) return 0; device_remove_file(&(cdev->dev), &dev_attr_w_fib); device_remove_file(&(cdev->dev), &dev_attr_w_fib_idal); + device_remove_file(&(cdev->dev), &dev_attr_w_tic); spin_lock(&tdev->lock); tdev->work_pending = true; spin_unlock(&tdev->lock); @@ -416,6 +482,9 @@ static int ccw_tester_online(struct ccw_device *cdev) ret = device_create_file(&(cdev->dev), &dev_attr_w_fib_idal); if (ret) goto out_free; + ret = device_create_file(&(cdev->dev), &dev_attr_w_tic); + if (ret) + goto out_free; return ret; out_free: ccw_tester_offline(cdev);