From patchwork Thu Mar 25 09:39:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BE68C433E4 for ; Thu, 25 Mar 2021 09:40:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D89BC61934 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbhCYJjz (ORCPT ); Thu, 25 Mar 2021 05:39:55 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46970 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229461AbhCYJjO (ORCPT ); Thu, 25 Mar 2021 05:39:14 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9Xp49051000 for ; Thu, 25 Mar 2021 05:39:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=ZpyJi2Gq+gX3DUflwv+yFRHfQtDPzyYMP7ZyBf1wSPo=; b=IztsAevd6hb0QWtHKCyiNm/ujDr0teiX3+ACMQsqce/9qPNQ8jhCnNvhlkKpOpfuUCiv W5nI2FGCYrrUpEaM/8ACUitZL15IXZhG/7NIpD9oavHnV47FDodIwMNwxyI1cQAy7MFM Y+w59VqlNfKazZcVkguAg6Z4ZaeSCTEaeEcFTnoKFw6B0V0bXtMUzg6i/5VP4yebwjdA i/fT+X0PxLQFUPVbkj33vGnEobV+6HA2sK1JXCRGYDQyzKDupT0sBHpAw8YiznuViGAb asupvEyrO4z8T1yRcdTSIbh+FbYKGdN8xV6tdPg470G6aXj4wz367M68DCz3i39a1RjZ tQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:14 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9XsWL051328 for ; Thu, 25 Mar 2021 05:39:13 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:13 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9R9ml007119; Thu, 25 Mar 2021 09:39:12 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rd6y1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9d9h935979544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:09 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D2AF11C054; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFF9611C05B; Thu, 25 Mar 2021 09:39:08 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:08 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 1/8] s390x: lib: css: disabling a subchannel Date: Thu, 25 Mar 2021 10:39:00 +0100 Message-Id: <1616665147-32084-2-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Some tests require to disable a subchannel. Let's implement the css_disable() function. Signed-off-by: Pierre Morel Reviewed-by: Cornelia Huck Acked-by: Janosch Frank --- lib/s390x/css.h | 1 + lib/s390x/css_lib.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 7e3d261..b0de3a3 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -284,6 +284,7 @@ int css_enumerate(void); #define IO_SCH_ISC 3 int css_enable(int schid, int isc); bool css_enabled(int schid); +int css_disable(int schid); /* Library functions */ int start_ccw1_chain(unsigned int sid, struct ccw1 *ccw); diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index efc7057..f5c4f37 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -186,6 +186,73 @@ bool css_enabled(int schid) } return true; } + +/* + * css_disable: disable the subchannel + * @schid: Subchannel Identifier + * Return value: + * On success: 0 + * On error the CC of the faulty instruction + * or -1 if the retry count is exceeded. + */ +int css_disable(int schid) +{ + struct pmcw *pmcw = &schib.pmcw; + int retry_count = 0; + int cc; + + /* Read the SCHIB for this subchannel */ + cc = stsch(schid, &schib); + if (cc) { + report_info("stsch: sch %08x failed with cc=%d", schid, cc); + return cc; + } + + if (!(pmcw->flags & PMCW_ENABLE)) { + report_info("stsch: sch %08x already disabled", schid); + return 0; + } + +retry: + /* Update the SCHIB to disable the subchannel */ + pmcw->flags &= ~PMCW_ENABLE; + + /* Tell the CSS we want to modify the subchannel */ + cc = msch(schid, &schib); + /* + * If the subchannel is status pending or if a function is in progress, + * we consider both cases as errors. + */ + if (cc) { + report_info("msch: sch %08x failed with cc=%d", schid, cc); + return cc; + } + + /* Read the SCHIB again to verify the enablement */ + cc = stsch(schid, &schib); + if (cc) { + report_info("stsch: updating sch %08x failed with cc=%d", + schid, cc); + return cc; + } + + if (!(pmcw->flags & PMCW_ENABLE)) { + if (retry_count) + report_info("stsch: sch %08x successfully disabled after %d retries", + schid, retry_count); + return 0; + } + + if (retry_count++ < MAX_ENABLE_RETRIES) { + /* the hardware was not ready, give it some time */ + mdelay(10); + goto retry; + } + + report_info("msch: modifying sch %08x failed after %d retries. pmcw flags: %04x", + schid, retry_count, pmcw->flags); + return -1; +} /* * css_enable: enable the subchannel with the specified ISC * @schid: Subchannel Identifier From patchwork Thu Mar 25 09:39:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2DA6C433E3 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 895A061A1E for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbhCYJjx (ORCPT ); Thu, 25 Mar 2021 05:39:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52184 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbhCYJjP (ORCPT ); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9XJmv056091 for ; Thu, 25 Mar 2021 05:39:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=HfqYEgg5r52ECmTPxfHKDqbw+r9wAcFmm3Eq6ZowKH4=; b=H6o+hmqgtzbwWt/dMH6gj26kmq6bqSFuUWbQ+matd19ZzvrBn+CwWJ6GVW7OnlX+DRGt Wxaf2tT2ot3sclY/0odXGolK1+nAf5J/+Q83Vk9oPrYWzNabQbHvlG/PBNt5xY3i4sGH 9EPYhR7Z47dlbmpEvCAmo48FGB7eT255a6xwbOGWBrcAlEp9X98kr8ywrbDoomQQ30le lPbjKiZ8OquxY6hr/PO6kT2ErMHKyNZr62pYCEWo+fik+RVvIDgyUmQz8EaXbv39J7wM gIONf18b63uIJFgfbn1srLibrM8IEmJlmTbU9bAJVtOewb4r+W9nhhzj+/Jph7iQVGSc hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gaaabfwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:14 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9Z8TB065604 for ; Thu, 25 Mar 2021 05:39:14 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gaaabfw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:14 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9RXxi017333; Thu, 25 Mar 2021 09:39:12 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06ams.nl.ibm.com with ESMTP id 37d9bmn72e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9d98O36831602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:09 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C38411C050; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49AE111C05C; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 2/8] s390x: lib: css: SCSW bit definitions Date: Thu, 25 Mar 2021 10:39:01 +0100 Message-Id: <1616665147-32084-3-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 clxscore=1015 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We need the SCSW definitions to test clear and halt subchannel. Signed-off-by: Pierre Morel Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck --- lib/s390x/css.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index b0de3a3..0058355 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -67,6 +67,29 @@ struct scsw { #define SCSW_SC_PRIMARY 0x00000004 #define SCSW_SC_INTERMEDIATE 0x00000008 #define SCSW_SC_ALERT 0x00000010 +#define SCSW_AC_SUSPENDED 0x00000020 +#define SCSW_AC_DEVICE_ACTIVE 0x00000040 +#define SCSW_AC_SUBCH_ACTIVE 0x00000080 +#define SCSW_AC_CLEAR_PEND 0x00000100 +#define SCSW_AC_HALT_PEND 0x00000200 +#define SCSW_AC_START_PEND 0x00000400 +#define SCSW_AC_RESUME_PEND 0x00000800 +#define SCSW_FC_CLEAR 0x00001000 +#define SCSW_FC_HALT 0x00002000 +#define SCSW_FC_START 0x00004000 +#define SCSW_QDIO_RESERVED 0x00008000 +#define SCSW_PATH_NON_OP 0x00010000 +#define SCSW_EXTENDED_CTRL 0x00020000 +#define SCSW_ZERO_COND 0x00040000 +#define SCSW_SUPPRESS_SUSP_INT 0x00080000 +#define SCSW_IRB_FMT_CTRL 0x00100000 +#define SCSW_INITIAL_IRQ_STATUS 0x00200000 +#define SCSW_PREFETCH 0x00400000 +#define SCSW_CCW_FORMAT 0x00800000 +#define SCSW_DEFERED_CC 0x03000000 +#define SCSW_ESW_FORMAT 0x04000000 +#define SCSW_SUSPEND_CTRL 0x08000000 +#define SCSW_KEY 0xf0000000 uint32_t ctrl; uint32_t ccw_addr; #define SCSW_DEVS_DEV_END 0x04 From patchwork Thu Mar 25 09:39:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF721C433E2 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B4E061A14 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbhCYJjv (ORCPT ); Thu, 25 Mar 2021 05:39:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33656 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230027AbhCYJjP (ORCPT ); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9YWU3170279 for ; Thu, 25 Mar 2021 05:39:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=LXK1Ch4+n4MVLy2WjHfkqHhqm2qzla2HNEBZVif90zY=; b=BTTQjMW+uvT4JLaKSybr6ioKwjD5kHBA7R+px9BAVZO1K2z5kwz5itWKlnWOiRLozyPZ yg1dwgPKO8CPcpdRDY8+r068oWSBNOYP8ztj086DU+wX5nyj5rlve2/r3GQhdPAyVaTV coLC51UasuSgGHwoc6ebfJ3cXi69isibdEPiTZma8/XUosRkWktkT+qVbarHDxR4wcFh /Fuj1fuOy/u4/VZ8GpZSyAdN/4syfECq5lhlStnYUWkbGXFVblIBU9v2r3yc8jf/gCCt 6ysaZ2CkyT1FJSaH6SXbVGCQ4WBY3iitbqrbVyLkmzD0/6kv4nbOoZ9B4lvnd86GEzF2 ag== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gq159w75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9a8Ad175508 for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gq159w6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9RVPS019569; Thu, 25 Mar 2021 09:39:13 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 37d9bptr3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9d98W38011294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9C1411C064; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9971D11C058; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 3/8] s390x: css: simplify skipping tests on no device Date: Thu, 25 Mar 2021 10:39:02 +0100 Message-Id: <1616665147-32084-4-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We will lhave to test if a device is present for every tests in the future. Let's provide a macro to check if the device is present and to skip the tests if it is not. Signed-off-by: Pierre Morel Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- s390x/css.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/s390x/css.c b/s390x/css.c index c340c53..16723f6 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -27,6 +27,13 @@ static int test_device_sid; static struct senseid *senseid; struct ccw1 *ccw; +#define NODEV_SKIP(dev) do { \ + if (!(dev)) { \ + report_skip("No device"); \ + return; \ + } \ + } while (0) + static void test_enumerate(void) { test_device_sid = css_enumerate(); @@ -41,10 +48,7 @@ static void test_enable(void) { int cc; - if (!test_device_sid) { - report_skip("No device"); - return; - } + NODEV_SKIP(test_device_sid); cc = css_enable(test_device_sid, IO_SCH_ISC); @@ -62,10 +66,7 @@ static void test_sense(void) int ret; int len; - if (!test_device_sid) { - report_skip("No device"); - return; - } + NODEV_SKIP(test_device_sid); ret = css_enable(test_device_sid, IO_SCH_ISC); if (ret) { @@ -218,10 +219,7 @@ static void test_schm_fmt0(void) struct measurement_block_format0 *mb0; int shared_mb_size = 2 * sizeof(struct measurement_block_format0); - if (!test_device_sid) { - report_skip("No device"); - return; - } + NODEV_SKIP(test_device_sid); /* Allocate zeroed Measurement block */ mb0 = alloc_io_mem(shared_mb_size, 0); @@ -289,10 +287,7 @@ static void test_schm_fmt1(void) { struct measurement_block_format1 *mb1; - if (!test_device_sid) { - report_skip("No device"); - return; - } + NODEV_SKIP(test_device_sid); if (!css_test_general_feature(CSSC_EXTENDED_MEASUREMENT_BLOCK)) { report_skip("Extended measurement block not available"); From patchwork Thu Mar 25 09:39:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E46DEC433E5 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5F6461A38 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbhCYJjy (ORCPT ); Thu, 25 Mar 2021 05:39:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55456 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230026AbhCYJjP (ORCPT ); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9XpkA051013 for ; Thu, 25 Mar 2021 05:39:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=CZF861RXjsVXrCg27TvhsmfP2F4NqDUO4eb/vn9K6bE=; b=LmoW4Vr8LCC1MHyWfwzUyQUdYTcF/gJJRa1Euqponxbc90g0BdONLVQNtrW6v3eNyxMB yG3Q518w65GB1ToP4a5zNhGF1Ii3kCHB9u+sRK1OkWBwUhG5QEYzuaefdvWA1pnRg5fk DJejpfOiLwp/hhUSuIgDDZlxA3sFZEP3yffTBxrx735dowlgXS0vXnv/pyIyiGUqCiRw pkpkhZkazCX9YFs1ct3IgBuBOvohT9tbHlhTQJvG/sfFdfCjTi5I+cHeO4jbsi++q+DN E1ftw9EOwTE3SvgNrjZ1ulvDGo+0I+XVCRunzyloCWGtWl60W6oNxRqzHhNpUYC/E2Ad zQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v68-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9XtVV051416 for ; Thu, 25 Mar 2021 05:39:14 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:14 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9R6NU007114; Thu, 25 Mar 2021 09:39:13 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rd6y2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:13 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9dAPp37421462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35F9511C04C; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E6E8511C058; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:09 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 4/8] s390x: lib: css: separate wait for IRQ and check I/O completion Date: Thu, 25 Mar 2021 10:39:03 +0100 Message-Id: <1616665147-32084-5-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=973 phishscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We will may want to check the result of an I/O without waiting for an interrupt. For example because we do not handle interrupt. Let's separate waiting for interrupt and the I/O complretion check. Signed-off-by: Pierre Morel Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck --- lib/s390x/css.h | 1 + lib/s390x/css_lib.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 0058355..5d1e1f0 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid); void enable_io_isc(uint8_t isc); int wait_and_check_io_completion(int schid); +int check_io_completion(int schid); /* * CHSC definitions diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index f5c4f37..1e5c409 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -487,18 +487,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags) } /* wait_and_check_io_completion: + * @schid: the subchannel ID + */ +int wait_and_check_io_completion(int schid) +{ + wait_for_interrupt(PSW_MASK_IO); + return check_io_completion(schid); +} + +/* check_io_completion: * @schid: the subchannel ID * * Makes the most common check to validate a successful I/O * completion. * Only report failures. */ -int wait_and_check_io_completion(int schid) +int check_io_completion(int schid) { int ret = 0; - wait_for_interrupt(PSW_MASK_IO); - report_prefix_push("check I/O completion"); if (lowcore_ptr->io_int_param != schid) { From patchwork Thu Mar 25 09:39:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50FE3C433E1 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04D2F61A27 for ; Thu, 25 Mar 2021 09:40:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbhCYJjs (ORCPT ); Thu, 25 Mar 2021 05:39:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7190 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230081AbhCYJjQ (ORCPT ); Thu, 25 Mar 2021 05:39:16 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9YAiv025490 for ; Thu, 25 Mar 2021 05:39:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=GAxdfBBTTceM+FvbXUdMfoaRMOi218R96kJZ81Hknug=; b=Jy8meh/oZbJWYR6+bBdLe2/svRJ1uXF77bx31hT9Gq3EmQiPozZFJOu4m1lsROIgBKUi PorwzbZgd7zwh5s8vY0GtdUFbbhLZ7RUOy0Bv3OJxDm5CW7tOB7Uhs6mHDHjHmkJeaHA LWUMEjkUbF+BUeD+kn6AnHFfC/6A2FCU0LxhYE3JjlbYfqnWm+ZmJ0szB5XzdMZfBX6v zATwEx909A7OFPTv9WH1JkK3Xvl33KD2+QQ2aTx40GlUSmAAFDpfteEj+ewOGucFfQg2 7HmajatpUmVkpbuKVupYUwkForVYbRNefyUxffbdicIJdE/Gg7N7ilDkP4rpBGFU3kLz CQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gpjv2gm4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9bciI039094 for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gpjv2gke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9RO24018323; Thu, 25 Mar 2021 09:39:13 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 37d9d8tqqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:13 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9dAEk62914974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D70B11C050; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42E4511C058; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 5/8] s390x: lib: css: add SCSW ctrl expectations to check I/O completion Date: Thu, 25 Mar 2021 10:39:04 +0100 Message-Id: <1616665147-32084-6-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When checking for an I/O completion may need to check the cause of the interrupt depending on the test case. Let's provide the tests the possibility to check if the last valid IRQ received is for the function expected after executing an instruction or sequence of instructions and if all ctrl flags of the SCSW are set as expected. Signed-off-by: Pierre Morel Reviewed-by: Claudio Imbrenda Acked-by: Thomas Huth Reviewed-by: Cornelia Huck --- lib/s390x/css.h | 4 ++-- lib/s390x/css_lib.c | 21 ++++++++++++++++----- s390x/css.c | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 5d1e1f0..1603781 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -316,8 +316,8 @@ void css_irq_io(void); int css_residual_count(unsigned int schid); void enable_io_isc(uint8_t isc); -int wait_and_check_io_completion(int schid); -int check_io_completion(int schid); +int wait_and_check_io_completion(int schid, uint32_t ctrl); +int check_io_completion(int schid, uint32_t ctrl); /* * CHSC definitions diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index 1e5c409..55e70e6 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -488,21 +488,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags) /* wait_and_check_io_completion: * @schid: the subchannel ID + * @ctrl : expected SCSW control flags */ -int wait_and_check_io_completion(int schid) +int wait_and_check_io_completion(int schid, uint32_t ctrl) { wait_for_interrupt(PSW_MASK_IO); - return check_io_completion(schid); + return check_io_completion(schid, ctrl); } /* check_io_completion: * @schid: the subchannel ID + * @ctrl : expected SCSW control flags * - * Makes the most common check to validate a successful I/O - * completion. + * If the ctrl parameter is not null check the IRB SCSW ctrl + * against the ctrl parameter. + * Otherwise, makes the most common check to validate a successful + * I/O completion. * Only report failures. */ -int check_io_completion(int schid) +int check_io_completion(int schid, uint32_t ctrl) { int ret = 0; @@ -515,6 +519,13 @@ int check_io_completion(int schid) goto end; } + if (ctrl && (ctrl ^ irb.scsw.ctrl)) { + report_info("%08x : %s", schid, dump_scsw_flags(irb.scsw.ctrl)); + report_info("expected : %s", dump_scsw_flags(ctrl)); + ret = -1; + goto end; + } + /* Verify that device status is valid */ if (!(irb.scsw.ctrl & SCSW_SC_PENDING)) { report(0, "No status pending after interrupt. Subch Ctrl: %08x", diff --git a/s390x/css.c b/s390x/css.c index 16723f6..57dc340 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -95,7 +95,7 @@ static void test_sense(void) goto error; } - if (wait_and_check_io_completion(test_device_sid) < 0) + if (wait_and_check_io_completion(test_device_sid, 0) < 0) goto error; /* Test transfer completion */ @@ -138,7 +138,7 @@ static void sense_id(void) { assert(!start_ccw1_chain(test_device_sid, ccw)); - assert(wait_and_check_io_completion(test_device_sid) >= 0); + assert(wait_and_check_io_completion(test_device_sid, 0) >= 0); } static void css_init(void) From patchwork Thu Mar 25 09:39:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24680C433E0 for ; Thu, 25 Mar 2021 09:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CABC061A14 for ; Thu, 25 Mar 2021 09:40:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbhCYJjq (ORCPT ); Thu, 25 Mar 2021 05:39:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56866 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230083AbhCYJjQ (ORCPT ); Thu, 25 Mar 2021 05:39:16 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9YM5U168540 for ; Thu, 25 Mar 2021 05:39:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=3gpsTnhSQt+q0HeFQ3pfbFeYdxMAVV/odsAZVVtJ5mw=; b=VNWflpdNpv3/uVKu4k1HjgcWPoJgrLhU4SKrPVF/HyXyR7i3FXQo+uklxgodYHq/RuQP JdRueGAChlz6tnFEIFHtlYeksZ46i/P1lIoYBExjfV5NnRuOuKxyJv7UGKv3IbNvXnAK /irmjrMRkrKNMTn6odJisc0NX7O9nWirOz79xSwnoENRHOp5rphE9jjTSWJWUFWqEHER X4SLNZXMchm2bcfiFTXduFiHuSW18/Lk3jMtNSmrDpQLesVpyJ2tRaCoCIQqF5NIfZfR X/IImTimpuzsPo4eCQyy3Ewqnp0OFXcu3Vo0k1l9wVhKAtcnj7lxQzlfBsnHu3Lwy4Em 2A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37ghp0s2d4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9YVIV169714 for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 37ghp0s2cg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9RRpf007188; Thu, 25 Mar 2021 09:39:13 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rd6y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:13 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9dBx262914980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E47A611C04C; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A6C811C04A; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 6/8] s390x: css: testing ssch error response Date: Thu, 25 Mar 2021 10:39:05 +0100 Message-Id: <1616665147-32084-7-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Checking error response on various eroneous SSCH instructions: - ORB alignment - ORB above 2G - CCW above 2G - bad ORB flags Signed-off-by: Pierre Morel --- lib/s390x/css.h | 4 ++ lib/s390x/css_lib.c | 5 +-- s390x/css.c | 105 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 3 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 1603781..e1e9264 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -90,6 +90,9 @@ struct scsw { #define SCSW_ESW_FORMAT 0x04000000 #define SCSW_SUSPEND_CTRL 0x08000000 #define SCSW_KEY 0xf0000000 +#define SCSW_SSCH_COMPLETED (SCSW_CCW_FORMAT | SCSW_FC_START | \ + SCSW_SC_PENDING | SCSW_SC_SECONDARY | \ + SCSW_SC_PRIMARY) uint32_t ctrl; uint32_t ccw_addr; #define SCSW_DEVS_DEV_END 0x04 @@ -138,6 +141,7 @@ struct irb { uint32_t ecw[8]; uint32_t emw[8]; } __attribute__ ((aligned(4))); +extern struct irb irb; #define CCW_CMD_SENSE_ID 0xe4 #define CSS_SENSEID_COMMON_LEN 8 diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index 55e70e6..7c93e94 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -21,6 +21,7 @@ struct schib schib; struct chsc_scsc *chsc_scsc; +struct irb irb; static const char * const chsc_rsp_description[] = { "CHSC unknown error", @@ -415,8 +416,6 @@ bool css_disable_mb(int schid) return retry_count > 0; } -static struct irb irb; - void css_irq_io(void) { int ret = 0; @@ -512,7 +511,7 @@ int check_io_completion(int schid, uint32_t ctrl) report_prefix_push("check I/O completion"); - if (lowcore_ptr->io_int_param != schid) { + if (!ctrl && lowcore_ptr->io_int_param != schid) { report(0, "interrupt parameter: expected %08x got %08x", schid, lowcore_ptr->io_int_param); ret = -1; diff --git a/s390x/css.c b/s390x/css.c index 57dc340..f6890f2 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,109 @@ static void test_enable(void) report(cc == 0, "Enable subchannel %08x", test_device_sid); } +static void test_ssch(void) +{ + struct orb orb = { + .intparm = test_device_sid, + .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT, + }; + int i; + phys_addr_t top; + + NODEV_SKIP(test_device_sid); + + assert(css_enable(test_device_sid, 0) == 0); + + /* 1- ORB address should be aligned on 32 bits */ + report_prefix_push("ORB alignment"); + expect_pgm_int(); + ssch(test_device_sid, (void *)0x110002); + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + + /* 2- ORB address should be lower than 2G */ + report_prefix_push("ORB Address above 2G"); + expect_pgm_int(); + ssch(test_device_sid, (void *)0x80000000); + check_pgm_int_code(PGM_INT_CODE_ADDRESSING); + report_prefix_pop(); + + /* 3- ORB address should be available we check 1G*/ + top = get_ram_size(); + report_prefix_push("ORB Address must be available"); + if (top < 0x40000000) { + expect_pgm_int(); + ssch(test_device_sid, (void *)0x40000000); + check_pgm_int_code(PGM_INT_CODE_ADDRESSING); + } else { + report_skip("guest started with more than 1G memory"); + } + report_prefix_pop(); + + /* 3- ORB address should not be equal or above 2G */ + report_prefix_push("CCW address above 2G"); + orb.cpa = 0x80000000; + expect_pgm_int(); + ssch(test_device_sid, &orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + + senseid = alloc_io_mem(sizeof(*senseid), 0); + assert(senseid); + orb.cpa = (uint64_t)ccw_alloc(CCW_CMD_SENSE_ID, senseid, + sizeof(*senseid), CCW_F_SLI); + assert(orb.cpa); + + /* 4- Start on a disabled subchannel */ + report_prefix_push("Disabled subchannel"); + assert(css_disable(test_device_sid) == 0); + report(ssch(test_device_sid, &orb) == 3, "CC = 3"); + report_prefix_pop(); + + /* 5- MIDAW is not supported by the firmware */ + report_prefix_push("ORB MIDAW unsupported"); + assert(css_enable(test_device_sid, 0) == 0); + orb.ctrl |= ORB_CTRL_MIDAW; + expect_pgm_int(); + ssch(test_device_sid, &orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + orb.ctrl = 0; + + /* 6-12- Check the reserved bits of the ORB CTRL field */ + for (i = 0; i < 5; i++) { + char buffer[30]; + + orb.ctrl = (0x02 << i); + snprintf(buffer, 30, "ORB reserved ctrl flags %02x", orb.ctrl); + report_prefix_push(buffer); + expect_pgm_int(); + ssch(test_device_sid, &orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + } + + /* 13- check the reserved bits of the ORB flags */ + report_prefix_push("ORB wrong ctrl flags"); + orb.ctrl |= 0x040000; + expect_pgm_int(); + ssch(test_device_sid, &orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + + /* 14- Check sending a second SSCH before clearing the status. */ + orb.ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT; + report_prefix_push("SSCH on channel with status pending"); + assert(css_enable(test_device_sid, 0) == 0); + assert(ssch(test_device_sid, &orb) == 0); + report(ssch(test_device_sid, &orb) == 1, "CC = 1"); + /* now we clear the status */ + assert(tsch(test_device_sid, &irb) == 0); + assert(check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED) == 0); + assert(css_disable(test_device_sid) == 0); + report_prefix_pop(); +} + /* * test_sense * Pre-requisites: @@ -334,6 +438,7 @@ static struct { { "initialize CSS (chsc)", css_init }, { "enumerate (stsch)", test_enumerate }, { "enable (msch)", test_enable }, + { "start subchannel", test_ssch }, { "sense (ssch/tsch)", test_sense }, { "measurement block (schm)", test_schm }, { "measurement block format0", test_schm_fmt0 }, From patchwork Thu Mar 25 09:39:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3F55C433E6 for ; Thu, 25 Mar 2021 09:40:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7456C61A2E for ; Thu, 25 Mar 2021 09:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbhCYJj7 (ORCPT ); Thu, 25 Mar 2021 05:39:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60090 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230095AbhCYJjQ (ORCPT ); Thu, 25 Mar 2021 05:39:16 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9XqZJ051072 for ; Thu, 25 Mar 2021 05:39:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=ADsoEua9Tz+ORrO6hrA0iCPun3X2ZppWNbCpldeATDs=; b=oPAThf2/Ply2ck5AkFozGMMJsEArrq7TBDhe5KF74LG2ecfpDcewPLlNFsW4QNMUY3fL wWPufgp+EIasEAGScAw1jpeDu5CjMEdjv10Lq1OV4zNhzVXr3/C+BNycItqsmgrLv/cw i2be7/CcXW4/OVMWH5fPStklmKdM1MUl4xfjuCp8cL0rR5/xvXrwxTEtmNS8qgWKj7Ou 9JxZ2ONABDFxsj6bmLqYSYaGh3ffd3u2jqBWJ3UExo1oLIFVzgefTVLTIEKN1IiyttjC wwPWkZqz59LXZ7oD+cTl460bNFOCMsNJDwgwx19cgpTCpFXN/sZNKg/91TyOoLwtqKiK tQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:16 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9Xs5e051331 for ; Thu, 25 Mar 2021 05:39:15 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 37gq0b1v62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9RLQJ018318; Thu, 25 Mar 2021 09:39:14 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma02fra.de.ibm.com with ESMTP id 37d9d8tqqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:14 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9dBQY19202334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4047B11C04C; Thu, 25 Mar 2021 09:39:11 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F28A311C05B; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:10 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 7/8] s390x: css: testing halt subchannel Date: Thu, 25 Mar 2021 10:39:06 +0100 Message-Id: <1616665147-32084-8-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=816 phishscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org checking return values for HSCH for various configurations. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 4 ++++ lib/s390x/css_lib.c | 4 ++++ s390x/css.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index e1e9264..cf48abc 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -93,6 +93,10 @@ struct scsw { #define SCSW_SSCH_COMPLETED (SCSW_CCW_FORMAT | SCSW_FC_START | \ SCSW_SC_PENDING | SCSW_SC_SECONDARY | \ SCSW_SC_PRIMARY) +#define SCSW_HSCH_COMPLETED (SCSW_CCW_FORMAT | SCSW_FC_HALT | \ + SCSW_SC_PENDING) +#define SCSW_CSCH_COMPLETED (SCSW_CCW_FORMAT | SCSW_FC_CLEAR | \ + SCSW_SC_PENDING) uint32_t ctrl; uint32_t ccw_addr; #define SCSW_DEVS_DEV_END 0x04 diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index 7c93e94..d9ed2c3 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -533,6 +533,10 @@ int check_io_completion(int schid, uint32_t ctrl) goto end; } + /* We do not need more check for HSCH or CSCH */ + if (irb.scsw.ctrl & (SCSW_FC_HALT | SCSW_FC_CLEAR)) + goto end; + if (!(irb.scsw.ctrl & (SCSW_SC_SECONDARY | SCSW_SC_PRIMARY))) { report(0, "Primary or secondary status missing. Subch Ctrl: %08x", irb.scsw.ctrl); diff --git a/s390x/css.c b/s390x/css.c index f6890f2..ffc067e 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -56,6 +56,62 @@ static void test_enable(void) report(cc == 0, "Enable subchannel %08x", test_device_sid); } +static void test_hsch(void) +{ + struct orb orb = { + .intparm = test_device_sid, + .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT, + }; + struct ccw1 *ccw; + + NODEV_SKIP(test_device_sid); + + senseid = alloc_io_mem(sizeof(*senseid), 0); + assert(senseid); + ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI); + assert(ccw); + orb.cpa = (uint64_t)ccw; + + /* 1- Basic HSCH */ + report_prefix_push("HSCH on a quiet subchannel"); + assert(css_enable(test_device_sid, 0) == 0); + report(hsch(test_device_sid) == 0, "subchannel halted"); + report_prefix_pop(); + + /* now we check the flags */ + report_prefix_push("Ctrl flags"); + assert(tsch(test_device_sid, &irb) == 0); + report(check_io_completion(test_device_sid, SCSW_HSCH_COMPLETED) == 0, "expected"); + report_prefix_pop(); + + /* 2- Check HSCH after SSCH */ + report_prefix_push("HSCH on status pending subchannel"); + assert(ssch(test_device_sid, &orb) == 0); + report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED); + report_prefix_pop(); + + /* 3- Check HSCH after CSCH */ + report_prefix_push("HSCH on busy on CSCH subchannel"); + assert(csch(test_device_sid) == 0); + report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED); + report_prefix_pop(); + + /* 4- Check HSCH after HSCH */ + report_prefix_push("HSCH on busy on HSCH subchannel"); + assert(hsch(test_device_sid) == 0); + report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_HSCH_COMPLETED); + report_prefix_pop(); + + free_io_mem(senseid, sizeof(*senseid)); + free_io_mem(ccw, sizeof(*ccw)); +} + static void test_ssch(void) { struct orb orb = { @@ -439,6 +495,7 @@ static struct { { "enumerate (stsch)", test_enumerate }, { "enable (msch)", test_enable }, { "start subchannel", test_ssch }, + { "halt subchannel", test_hsch }, { "sense (ssch/tsch)", test_sense }, { "measurement block (schm)", test_schm }, { "measurement block format0", test_schm_fmt0 }, From patchwork Thu Mar 25 09:39:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12163647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98E41C433E9 for ; Thu, 25 Mar 2021 09:40:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4930961A2D for ; Thu, 25 Mar 2021 09:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbhCYJj6 (ORCPT ); Thu, 25 Mar 2021 05:39:58 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:62880 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbhCYJjR (ORCPT ); Thu, 25 Mar 2021 05:39:17 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12P9XBSL039240 for ; Thu, 25 Mar 2021 05:39:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=YToj26Tr9Ph1F33MdkZzPV8n691lmmoU3nN7BSeoZk4=; b=Xqr+hEGJ92wRqzDcBEFbGX4UnwvzEpnKXtvYwk++frczRfkiLSMO74vIWWaoRUFFoo8H GqwA+65sjIIy2e93GLrwEpJ3Ox5m1eIZRQqKjepA3lUVETjNQgzp41klz3T+zoR2cfYr R4yJnvNccw94R+G1KO0seX6nBDxH129hNXn1keHwrS3V+hrSmkC8fDbdGKGLb2nHa1r4 6EL7O7tOO5FkIFUKGEBYssP7ZF9BcoMNVDqvm1hyvCGoyBEKbnIVPtGVb1TPZKiNksXA bMTbMWxrVrbv8VN0xuIDZBhQYs6lfdgaUbFf/QIaY850KPM18qRrEmwSp6B34eG+vM9i 8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gka6q7v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Mar 2021 05:39:16 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12P9Xf2n041411 for ; Thu, 25 Mar 2021 05:39:16 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 37gka6q7ut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 05:39:15 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12P9R52A007111; Thu, 25 Mar 2021 09:39:14 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 37d99rd6y5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Mar 2021 09:39:14 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12P9dBfP18481446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Mar 2021 09:39:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9830811C054; Thu, 25 Mar 2021 09:39:11 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D83A11C050; Thu, 25 Mar 2021 09:39:11 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.41.31]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Mar 2021 09:39:11 +0000 (GMT) From: Pierre Morel To: kvm@vger.kernel.org Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 8/8] s390x: css: testing clear subchannel Date: Thu, 25 Mar 2021 10:39:07 +0100 Message-Id: <1616665147-32084-9-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> References: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-25_02:2021-03-24,2021-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=907 lowpriorityscore=0 clxscore=1015 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103250072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Checking return values for CSCH for various configurations. Signed-off-by: Pierre Morel --- s390x/css.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index ffc067e..d5b7b00 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -56,6 +56,63 @@ static void test_enable(void) report(cc == 0, "Enable subchannel %08x", test_device_sid); } +static void test_csch(void) +{ + struct orb orb = { + .intparm = test_device_sid, + .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT, + }; + struct ccw1 *ccw; + + NODEV_SKIP(test_device_sid); + + senseid = alloc_io_mem(sizeof(*senseid), 0); + assert(senseid); + ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI); + assert(ccw); + orb.cpa = (uint64_t)ccw; + + /* 1- Basic check for CSCH */ + report_prefix_push("CSCH on a quiet subchannel"); + assert(css_enable(test_device_sid, 0) == 0); + report(csch(test_device_sid) == 0, "subchannel clear"); + report_prefix_pop(); + + /* now we check the flags */ + report_prefix_push("IRQ flags"); + assert(tsch(test_device_sid, &irb) == 0); + report(check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED) == 0, "expected"); + report_prefix_pop(); + + /* 2- We want to check if the IRQ flags of SSCH are erased by clear */ + report_prefix_push("CSCH on SSCH status pending subchannel"); + assert(ssch(test_device_sid, &orb) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED | + SCSW_SC_SECONDARY | SCSW_SC_PRIMARY); + report_prefix_pop(); + + /* 3- Checking CSCH after HSCH */ + report_prefix_push("CSCH on a halted subchannel"); + assert(hsch(test_device_sid) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED); + report_prefix_pop(); + + /* 4- Checking CSCH after CSCH */ + report_prefix_push("CSCH on a cleared subchannel"); + assert(csch(test_device_sid) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED); + report_prefix_pop(); + + free_io_mem(senseid, sizeof(*senseid)); + free_io_mem(ccw, sizeof(*ccw)); +} + static void test_hsch(void) { struct orb orb = { @@ -496,6 +553,7 @@ static struct { { "enable (msch)", test_enable }, { "start subchannel", test_ssch }, { "halt subchannel", test_hsch }, + { "clear subchannel", test_csch }, { "sense (ssch/tsch)", test_sense }, { "measurement block (schm)", test_schm }, { "measurement block format0", test_schm_fmt0 },