From patchwork Tue Apr 6 07:40:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184395 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 936A2C433B4 for ; Tue, 6 Apr 2021 07:41:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5412061241 for ; Tue, 6 Apr 2021 07:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236431AbhDFHlK (ORCPT ); Tue, 6 Apr 2021 03:41:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59216 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235371AbhDFHlI (ORCPT ); Tue, 6 Apr 2021 03:41:08 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367Xn7T060651 for ; Tue, 6 Apr 2021 03:41:01 -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=F/E0Lol3oE0vyXaaKVcHWp+H0qjNkRNBGzpkt+iBzmA=; b=AGMMOCJiRwa0lCaWSYt53l2ykXnqzMi1wA6pCyw/7DtVNfHICLsfOh/cYljAyi3mBghF BJLsT6cuInJM+b/uKZ2uc3a0gsYyxf6Ap843Xgfq0BlmoZQeiIKbW00Ea6l5N7NLDt40 hgpFKG5ZXlPcHkAf9S2IB+EzqLSTZqI5PoUXQGzKgS2n4A5DlOt9QN0A6YQ2YqmrcM+l JAzWmD924luUlnjdTs37eJZ90Pit/DB/16jymq7yCpbsUjwgLckcCJGgeBJNFML3LuZZ NvCGN6XVePLy0AyowcibCBQHBXtroU8CLLdtmGm1Yj9KfTe1v9OAlcmdB1t6t7aU3YBz bA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5bys1m1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:01 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367euK6086779 for ; Tue, 6 Apr 2021 03:41:00 -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 37q5bys1kb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:00 -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 1367Wm3x026067; Tue, 6 Apr 2021 07:40:58 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 37q2q5hwxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:40:58 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367etMQ32964958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:55 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 575904C040; Tue, 6 Apr 2021 07:40:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B2C74C044; Tue, 6 Apr 2021 07:40:55 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:54 +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 v3 01/16] s390x: lib: css: disabling a subchannel Date: Tue, 6 Apr 2021 09:40:38 +0200 Message-Id: <1617694853-6881-2-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Zv0kPxqqPypSp-oIKEzkFN0NONL3C7Gv X-Proofpoint-ORIG-GUID: l-UEWGU4iqbkeSrLg28CJWoa9UQnh2vF X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 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 | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 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..9711b0b 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -186,6 +186,69 @@ 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 retries = 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; + } + + for (retries = 0; retries < MAX_ENABLE_RETRIES; retries++) { + /* 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 disablement */ + 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 (retries) + report_info("stsch: sch %08x successfully disabled after %d retries", schid, retries); + return 0; + } + + /* the hardware was not ready, give it some time */ + mdelay(10); + } + + report_info("msch: modifying sch %08x failed after %d retries. pmcw flags: %04x", + schid, retries, pmcw->flags); + return -1; +} /* * css_enable: enable the subchannel with the specified ISC * @schid: Subchannel Identifier From patchwork Tue Apr 6 07:40:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184407 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 B7294C433B4 for ; Tue, 6 Apr 2021 07:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E2FC613BE for ; Tue, 6 Apr 2021 07:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244348AbhDFHlS (ORCPT ); Tue, 6 Apr 2021 03:41:18 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32436 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235757AbhDFHlK (ORCPT ); Tue, 6 Apr 2021 03:41:10 -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 1367YAH0068691 for ; Tue, 6 Apr 2021 03:41:02 -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=mG3ygt0DNjAl2DIIWNoi6pGHQtTpEjZYTGyQpnVFPJs=; b=SWYRdol44bg/zlV71ziI8o6frm+2/GQWNiWqQGp97mwtXgZTfkPhtE0EwCSa1Ktq13h3 njcXId8AK8H7Ju6qJHxMhsB6x+Pvttf1okN1nXf5VwZfDEN40s4pmiPTBLhGnvd7zqa6 PuzYtc72NB873LkF0mJqzoMjZyPTadl3ryhJhv6lTxbOEvNkmPk1yE133qRMgo6peTva vgiUEm+AJzfD0MBpmn7Km15bW/tQ47aTMjEfg7ZT3+Vj2KGa+5Zxyii6ZNFoE2I4+Vle gtvYorACiuBVmQhnnYQMEQcwnbFt5V+PUv1PTlTTwqdkX+DqvXhnvlm4Wro4wU+qTGZc HQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:02 -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 1367Z6Au071076 for ; Tue, 6 Apr 2021 03:41:02 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:02 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367WTED011497; Tue, 6 Apr 2021 07:40:58 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 37q3cf10dw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:40:58 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367eteR32964960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:55 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6A644C052; Tue, 6 Apr 2021 07:40:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 647C94C050; Tue, 6 Apr 2021 07:40:55 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:55 +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 v3 02/16] s390x: lib: css: SCSW bit definitions Date: Tue, 6 Apr 2021 09:40:39 +0200 Message-Id: <1617694853-6881-3-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MN-L7lk_1suBOvjDAULKYq8OtXnwXrcL X-Proofpoint-ORIG-GUID: dJExRxzLDXIWB8HQ8FOB2A70qF5Q8UzW X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 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 Tue Apr 6 07:40:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184397 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 B9A1EC433ED for ; Tue, 6 Apr 2021 07:41:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72CE6613CA for ; Tue, 6 Apr 2021 07:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237067AbhDFHlM (ORCPT ); Tue, 6 Apr 2021 03:41:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:62312 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235408AbhDFHlJ (ORCPT ); Tue, 6 Apr 2021 03:41:09 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367XWCb127191 for ; Tue, 6 Apr 2021 03:41:01 -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=aGuzAiyr/LBA8+BZbKu3X4j4AYBMPrecChu0VN0AH20=; b=WIEO7YD2ddWGaNayfwUDOIoENPbdXvre3/dlzlyW0Y7vI1kUskE/Db279NMAltTrFG8T wUrP1euBxxvAw6REdI/WbNdng1xbaHxtksPk+EhMXlx0UmwxvJSeyC2egnFmP2Ct30/4 Uu/R7vLIc+EaEDaxniRy8kZzLuADoGPmw/p3AsaV1FHRGYmcvFPS5fc3N7GHhoTHDBGC k3ADhTNuUur5pMD3Igcem8xChzvcZ7wqK84BWosxD5pYnCeBIm6qoA4TZ7LEsRwqD4Yk 2XYq01SF+JNcjgQAih07NU7a7WPt/POIGejBQ/FD4yzvRqw5ug6BXHxVvDMI3Yj3N3df 9A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5exarq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:01 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367ZCK4132851 for ; Tue, 6 Apr 2021 03:41:01 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5exarpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:01 -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 1367X6NE030906; Tue, 6 Apr 2021 07:40:59 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 37q2nm10t2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:40:58 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367euWM47513876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:56 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B8D64C040; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3EC34C04E; Tue, 6 Apr 2021 07:40:55 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:55 +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 v3 03/16] s390x: css: simplify skipping tests on no device Date: Tue, 6 Apr 2021 09:40:40 +0200 Message-Id: <1617694853-6881-4-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ijXqJOTIjeltbevAphaMFb5tSGO8PuUI X-Proofpoint-ORIG-GUID: eJFliOcR1GrHVufkLzwkycemIxIgA1F5 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 suspectscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We will have to test if a device is present for every tests in the future. Let's provide separate the first tests from the test loop and skip the remaining tests if no device is present. Signed-off-by: Pierre Morel --- s390x/css.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/s390x/css.c b/s390x/css.c index c340c53..17a6e1d 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -41,11 +41,6 @@ static void test_enable(void) { int cc; - if (!test_device_sid) { - report_skip("No device"); - return; - } - cc = css_enable(test_device_sid, IO_SCH_ISC); report(cc == 0, "Enable subchannel %08x", test_device_sid); @@ -62,11 +57,6 @@ static void test_sense(void) int ret; int len; - if (!test_device_sid) { - report_skip("No device"); - return; - } - ret = css_enable(test_device_sid, IO_SCH_ISC); if (ret) { report(0, "Could not enable the subchannel: %08x", @@ -218,11 +208,6 @@ 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; - } - /* Allocate zeroed Measurement block */ mb0 = alloc_io_mem(shared_mb_size, 0); if (!mb0) { @@ -289,11 +274,6 @@ static void test_schm_fmt1(void) { struct measurement_block_format1 *mb1; - if (!test_device_sid) { - report_skip("No device"); - return; - } - if (!css_test_general_feature(CSSC_EXTENDED_MEASUREMENT_BLOCK)) { report_skip("Extended measurement block not available"); return; @@ -336,8 +316,6 @@ static struct { void (*func)(void); } tests[] = { /* The css_init test is needed to initialize the CSS Characteristics */ - { "initialize CSS (chsc)", css_init }, - { "enumerate (stsch)", test_enumerate }, { "enable (msch)", test_enable }, { "sense (ssch/tsch)", test_sense }, { "measurement block (schm)", test_schm }, @@ -352,11 +330,25 @@ int main(int argc, char *argv[]) report_prefix_push("Channel Subsystem"); enable_io_isc(0x80 >> IO_SCH_ISC); + + report_prefix_push("initialize CSS (chsc)"); + css_init(); + report_prefix_pop(); + + report_prefix_push("enumerate (stsch)"); + test_enumerate(); + report_prefix_pop(); + + if (!test_device_sid) + goto end; + for (i = 0; tests[i].name; i++) { report_prefix_push(tests[i].name); tests[i].func(); report_prefix_pop(); } + +end: report_prefix_pop(); return report_summary(); From patchwork Tue Apr 6 07:40:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184399 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 E94B2C43461 for ; Tue, 6 Apr 2021 07:41:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B27F9613C2 for ; Tue, 6 Apr 2021 07:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244253AbhDFHlN (ORCPT ); Tue, 6 Apr 2021 03:41:13 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5234 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235460AbhDFHlJ (ORCPT ); Tue, 6 Apr 2021 03:41:09 -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 1367X5tj109940 for ; Tue, 6 Apr 2021 03:41:01 -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=A31o2qkHum34StJxpHRf4hap1h7uEdlTdnwok4STApk=; b=bqAQ+pJFqjla2hp+jIcKSupVioAkPcoorrg1O+NGtMgNId23zAFgS8dMXM5rm75fuzTw H5AgxcYynRmlH4mXbD1gj/RKwzHyONG2+x/DrIx1Rc9I9c27VrAYR5PYGlc5dZyX+nCs ZXbqwHyQ+99g5P00QjarwuqwtU7IIjwNWsFJzRdzRE9HDEjwsc7ZJjCOSFZ+dBs2oeSt LTCBQijbjye+fcQ8xPxsjHnz9x03xDSeBdyO2qeMS+riZad6jiinjAvdXNFdCbx+OcHl wIXhFqMzVvs6aAPnbtdDaw0+wzaM4XmNNSwMWROYdwMuSPM+J08NSZD5/jDCL27jEAC6 ZQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5kxjr2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:01 -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 1367XJVl110830 for ; Tue, 6 Apr 2021 03:41:01 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5kxjr2c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:01 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367Wqkt026270; Tue, 6 Apr 2021 07:40:59 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 37q2y9hwt9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:40:59 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367euJo47513880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:56 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6689F4C059; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1997B4C044; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:56 +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 v3 04/16] s390x: lib: css: separate wait for IRQ and check I/O completion Date: Tue, 6 Apr 2021 09:40:41 +0200 Message-Id: <1617694853-6881-5-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0SO1GbDwzuqksqHnFKa6guHt5U5uDwKi X-Proofpoint-GUID: kQWgSocgsQzakn3_AwWutIar-DjHFl54 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 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 completion check. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 1 + lib/s390x/css_lib.c | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 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 9711b0b..e81076a 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -483,55 +483,59 @@ 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); + + if (lowcore_ptr->io_int_param != schid) { + report(0, "interrupt parameter: expected %08x got %08x", schid, lowcore_ptr->io_int_param); + return -1; + } + + 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); + int ret = -1; report_prefix_push("check I/O completion"); - if (lowcore_ptr->io_int_param != schid) { - report(0, "interrupt parameter: expected %08x got %08x", - schid, lowcore_ptr->io_int_param); - 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", irb.scsw.ctrl); - ret = -1; 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); - ret = -1; goto end; } if (!(irb.scsw.dev_stat & (SCSW_DEVS_DEV_END | SCSW_DEVS_SCH_END))) { report(0, "No device end or sch end. Dev. status: %02x", irb.scsw.dev_stat); - ret = -1; goto end; } if (irb.scsw.sch_stat & ~SCSW_SCHS_IL) { report_info("Unexpected Subch. status %02x", irb.scsw.sch_stat); - ret = -1; goto end; } + ret = 0; + end: report_prefix_pop(); return ret; From patchwork Tue Apr 6 07:40:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184401 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 54413C433B4 for ; Tue, 6 Apr 2021 07:41:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1510A613C2 for ; Tue, 6 Apr 2021 07:41:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244334AbhDFHlP (ORCPT ); Tue, 6 Apr 2021 03:41:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39994 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235517AbhDFHlJ (ORCPT ); Tue, 6 Apr 2021 03:41:09 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367X288151535 for ; Tue, 6 Apr 2021 03:41:02 -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=F/nj73HjbAAQP2hHV+V3UI3ZsmlODRhE3m+MXZPHefI=; b=lgPW7UHM/LI8doL2nBSXlZ55MBnK5cLXjVbFGp9LO/SuvuCqdAkSTfz4bqmY5Lr8Ys48 rOFPzSQsHTXfWTThG9bjZ0cH6awHrhtEu7Ws3/0AT31V4LJLXLIwrzue6a0GT3dmegBv odtcLSvSWzr6PoHuyTSXzErhEO4Zg1FxEnmLC452Us2fzVl+2J+wv0NQVY5dFq/oJ2mQ aKfmXNzW9vVVyiv/UeqN4E9YwKLuAhmUCKCe9+HblbZkksTmzdRIraOMM9oFV4KaZ52g mpvWDsL9MUaxqi4pcKdXcs2/F7ef7OW6BTbbpAjPjeyTiDkidQrQ6wekcclymVJwM2Ra XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q595kg9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:02 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367YU2O158779 for ; Tue, 6 Apr 2021 03:41:02 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q595kg8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:02 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367XF8e024813; Tue, 6 Apr 2021 07:40:59 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 37q2nr90q3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:40:59 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367euFj46530926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C148D4C04A; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7450C4C058; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:56 +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 v3 05/16] s390x: lib: css: add SCSW ctrl expectations to check I/O completion Date: Tue, 6 Apr 2021 09:40:42 +0200 Message-Id: <1617694853-6881-6-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8TX5Sf_HoOiWwCxFZ_2ovBs1tywS7hdV X-Proofpoint-ORIG-GUID: 7mT_A6jpsoB0TfxqIquVj3T239y-b2ys X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 suspectscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When we check for the completion of an I/O, we may need to check the cause of the interrupt depending on the test case. Let's make it possible for the tests to check whether the last valid IRB received indicates the expected functions 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 --- 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 e81076a..97bf032 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -484,8 +484,9 @@ 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); @@ -494,22 +495,32 @@ int wait_and_check_io_completion(int schid) return -1; } - 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. + * Perform some standard checks to validate a successful I/O completion. + * If the ctrl parameter is not zero, additionally verify that the + * specified bits are indicated in the IRB SCSW ctrl flags. * Only report failures. */ -int check_io_completion(int schid) +int check_io_completion(int schid, uint32_t ctrl) { int ret = -1; report_prefix_push("check I/O completion"); + if (ctrl) { + if (ctrl == irb.scsw.ctrl) + ret = 0; + else + report_info("extected %s != %s", dump_scsw_flags(irb.scsw.ctrl), dump_scsw_flags(ctrl)); + 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 17a6e1d..f4b7af1 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -84,7 +84,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 */ @@ -127,7 +127,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 Tue Apr 6 07:40:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184405 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 0FC46C43460 for ; Tue, 6 Apr 2021 07:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6292613C0 for ; Tue, 6 Apr 2021 07:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244343AbhDFHlR (ORCPT ); Tue, 6 Apr 2021 03:41:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52976 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbhDFHlK (ORCPT ); Tue, 6 Apr 2021 03:41:10 -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 1367X7vR110012 for ; Tue, 6 Apr 2021 03:41:02 -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=VFoUUrvFXfI2LyAPUOKNzCd6iTo7zXv/QMVgpAYKuy4=; b=Zcvoyk0aKuFqXEZvfB8i5OaPz/gWSzEGB5rnDBX/Ndih7U07NN8yBlVasvUTuGJ3gssJ 4hMDz8dCvoLRiaP0UrwQ6v/7DLR3+YiIC65inH2YCbyKTXhI51XgcTS9XKDp1+bP/2fu 3omyd30RYMJ0Lt82tST0/9O9ALOcUx1HsHcDpjgZyFnpksNsEdcvl7AFK1zl06dY5ad1 hVc2xT+vhpsBAVFfhQUZq4FF546BV88IDTToKk14nUb45/J+LK+Xr040ksxSd6WhmDJ2 ndk4laVo4ubqQqkS4P1pmEAs/Sm6dchAqV7qRItGO5DOR6XJR3aEUtVSZeUhDfSkOPGN JA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5kxjr35-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:02 -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 1367YaPm116928 for ; Tue, 6 Apr 2021 03:41:01 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5kxjr2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:01 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367Wocd026267; Tue, 6 Apr 2021 07:41:00 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 37q2y9hwta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367evH445679022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 262A04C04A; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEA784C05E; Tue, 6 Apr 2021 07:40:56 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:56 +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 v3 06/16] s390x: lib: css: checking I/O errors Date: Tue, 6 Apr 2021 09:40:43 +0200 Message-Id: <1617694853-6881-7-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: cc7eogare2kaHRTsuQACXaYKUkIzzcIc X-Proofpoint-GUID: jJ3bPw-PErGiacrzFBN-CR0csp7HEW2a X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When testing I/O transaction with bad addresses we need to check the result of the error when the I/O completed with an alert status. The resulting status is reported in the subchannel and device status of the IRB SCSW. Let's provide the tests the possibility to check if the device and the subchannel status of the IRB SCSW are set as expected. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 6 ++++-- lib/s390x/css_lib.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 1603781..a5a8427 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -95,8 +95,9 @@ struct scsw { #define SCSW_DEVS_DEV_END 0x04 #define SCSW_DEVS_SCH_END 0x08 uint8_t dev_stat; -#define SCSW_SCHS_PCI 0x80 -#define SCSW_SCHS_IL 0x40 +#define SCSW_SCHS_PCI 0x80 +#define SCSW_SCHS_IL 0x40 +#define SCSW_SCHS_PRG_CHK 0x20 uint8_t sch_stat; uint16_t count; }; @@ -318,6 +319,7 @@ int css_residual_count(unsigned int schid); void enable_io_isc(uint8_t isc); int wait_and_check_io_completion(int schid, uint32_t ctrl); int check_io_completion(int schid, uint32_t ctrl); +bool check_io_errors(int schid, uint8_t dev_stat, uint8_t sch_stat); /* * CHSC definitions diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c index 97bf032..65159aa 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -552,6 +552,30 @@ end: return ret; } +/* check_io_errors: + * @schid: the subchannel ID + * @dev_stat : expected device stat flags + * @sch_stat : expected subchannel stat flags + * + * This routine must be called when an error occurs on CSS I/O + * Only report failures information and returns if we found + * the expected status flags. + */ +bool check_io_errors(int schid, uint8_t dev_stat, uint8_t sch_stat) +{ + if (!(irb.scsw.ctrl & SCSW_SC_ALERT)) { + report_info("No alert in SCSW Ctrl: %s", dump_scsw_flags(irb.scsw.ctrl)); + report_info("schid %08x : dev_stat: %02x sch_stat: %02x", schid, irb.scsw.dev_stat, irb.scsw.sch_stat); + return false; + } + + if ((dev_stat != irb.scsw.dev_stat) || (sch_stat != irb.scsw.sch_stat)) { + report_info("schid %08x : dev_stat: %02x sch_stat: %02x", schid, irb.scsw.dev_stat, irb.scsw.sch_stat); + return false; + } + return true; +} + /* * css_residual_count * Return the residual count, if it is valid. From patchwork Tue Apr 6 07:40:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184403 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 5787DC433ED for ; Tue, 6 Apr 2021 07:41:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 18664613C2 for ; Tue, 6 Apr 2021 07:41:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244337AbhDFHlQ (ORCPT ); Tue, 6 Apr 2021 03:41:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53456 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235602AbhDFHlK (ORCPT ); Tue, 6 Apr 2021 03:41:10 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367WwOA119631 for ; Tue, 6 Apr 2021 03:41:02 -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=FGDjWN/APoDnty6WtU4PBFFFAnSYz0v2lTF67eNDGEg=; b=CRqrwH/dK8PTpcE/1FibMDcgiV479e0YVb2qB04iSzttaAFB+go/WicOKFUHzTQ2Vv9G sOMMG3dbi8KY6orIuw4Zqs6GdfOXZS7kRKPdkrdELXzjRh/w8aiUS7KjRJphAE+FejAf vDrMWUTu7ToOLzuSg3f441ndscRdSHDQoc/4akutrgeAgR6fqAsOW3a+bT7itL3Qbxde ejUCz2u283zd1RDXXNSvbpHgUmAuXPvbdPRFN9n2feykUpm95bvByVIjCE++UASwb0W4 KTU3ECxI3YKgSOPFWFYKYsHmQRkFsW0ldV1R+xyCzT0Oqza30QwdmBxgdNtdvNZETcFq Pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5x8kp1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:02 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367XE0C121862 for ; Tue, 6 Apr 2021 03:41:02 -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 37q5x8kp13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:02 -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 1367WvnC016052; Tue, 6 Apr 2021 07:41:00 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 37q2n2sx81-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367evRr40108414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F0304C052; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33E314C059; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:57 +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 v3 07/16] s390x: css: testing ssch errors Date: Tue, 6 Apr 2021 09:40:44 +0200 Message-Id: <1617694853-6881-8-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: k_CEZxC8iBKTUWHbRaUsYCI3gZ1pF616 X-Proofpoint-GUID: aMUkPbCwBC2pM8yLsgJWkjgj9DFCjb96 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 adultscore=0 clxscore=1015 mlxlogscore=919 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Setup testing environment and check privilege. Signed-off-by: Pierre Morel --- s390x/css.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/s390x/css.c b/s390x/css.c index f4b7af1..da21ccc 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -15,17 +15,24 @@ #include #include #include +#include #include #include #include +struct tests { + const char *name; + void (*func)(void); +}; + #define DEFAULT_CU_TYPE 0x3832 /* virtio-ccw */ static unsigned long cu_type = DEFAULT_CU_TYPE; static int test_device_sid; static struct senseid *senseid; struct ccw1 *ccw; +struct orb *orb; static void test_enumerate(void) { @@ -46,6 +53,65 @@ static void test_enable(void) report(cc == 0, "Enable subchannel %08x", test_device_sid); } +/* orb_alloc + * + * We allocate and initialize for all tests: + * - the ORB on a global pointer without memory restrictions. + * - A CCW and the senseid structures in I/O memory. + * Every subtest is responsible to have them modified for their purpose. + */ +static void orb_alloc(void) +{ + 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 = malloc(sizeof(*orb)); + assert(orb); + + orb->intparm = test_device_sid; + orb->ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT; + orb->cpa = (long)ccw; +} + +static void orb_free(void) +{ + free_io_mem(senseid, sizeof(*senseid)); + free_io_mem(ccw, sizeof(struct ccw1)); + free(orb); +} + +static void ssch_privilege(void) +{ + enter_pstate(); + expect_pgm_int(); + ssch(test_device_sid, orb); + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); +} + +static struct tests ssh_tests[] = { + { "privilege", ssch_privilege }, + { NULL, NULL } +}; + +static void test_ssch(void) +{ + int i; + + orb_alloc(); + assert(css_enable(test_device_sid, 0) == 0); + + for (i = 0; ssh_tests[i].name; i++) { + report_prefix_push(ssh_tests[i].name); + ssh_tests[i].func(); + report_prefix_pop(); + } + + orb_free(); +} + /* * test_sense * Pre-requisites: @@ -311,12 +377,10 @@ static void test_schm_fmt1(void) free_io_mem(mb1, sizeof(struct measurement_block_format1)); } -static struct { - const char *name; - void (*func)(void); -} tests[] = { +static struct tests tests[] = { /* The css_init test is needed to initialize the CSS Characteristics */ { "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 Tue Apr 6 07:40:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184409 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 44931C433ED for ; Tue, 6 Apr 2021 07:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1532A613BE for ; Tue, 6 Apr 2021 07:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244352AbhDFHlU (ORCPT ); Tue, 6 Apr 2021 03:41:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36300 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236561AbhDFHlL (ORCPT ); Tue, 6 Apr 2021 03:41:11 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367YBFc028858 for ; Tue, 6 Apr 2021 03:41:03 -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=WjrrTIv/QfOA+yz4xZEeaOP+msvP1mk2ykPbr1OgJ+Q=; b=Yraa1HeiPGFWIDB6ssGIySUIHtpNaInd9H7valctraEs71pEuME2fTuBjmvdlRVe3hGF AQ5yqobu39nx3CnynCdedra/Vlpfny2l+BaTZxG4iCHYJxbW/943u8JoKzhouj1LxUXH WffwUpABd6hD+55TcChb71IoCTpSqtYd7QgB0Vzn0jVsAZk2LGZw+YjZnKg17MUOg/S8 dCrAEFDeINgvUOV03Txf9ktqjysMRyooCEGwYfODi6VnSilX98cAGKY0xTbwNiWWyxSg gHkY1PB5pR9vxpCc2+u9uA80U/qepHIl6SktL5U29BNeeUrG3Y3EQ37ceFt1tUqsYDB2 WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5tyk6kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:03 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367ZgRM032986 for ; Tue, 6 Apr 2021 03:41:03 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5tyk6jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:03 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367YOm6025878; Tue, 6 Apr 2021 07:41:00 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 37q3a8h0g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367evsu12779860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE1254C052; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C1064C05C; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:57 +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 v3 08/16] s390x: css: ssch check for cpa zero Date: Tue, 6 Apr 2021 09:40:45 +0200 Message-Id: <1617694853-6881-9-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: tP_v1estgEqnjz2eRilQZQOy1Ee6Jy0d X-Proofpoint-GUID: bF76xEMnnQWVNHCv5Uu4NzItK4QtFCkM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We expect a CSS program check if the CPA of the ORB is null and access to the IRB to check it. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 1 + lib/s390x/css_lib.c | 4 ++-- s390x/css.c | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index a5a8427..d824e34 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -139,6 +139,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 65159aa..12ef874 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -21,6 +21,8 @@ struct schib schib; struct chsc_scsc *chsc_scsc; +struct irb irb; + static const char * const chsc_rsp_description[] = { "CHSC unknown error", @@ -411,8 +413,6 @@ bool css_disable_mb(int schid) return retry_count > 0; } -static struct irb irb; - void css_irq_io(void) { int ret = 0; diff --git a/s390x/css.c b/s390x/css.c index da21ccc..d248cac 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -91,8 +91,21 @@ static void ssch_privilege(void) check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); } +static void ssch_orb_cpa_zero(void) +{ + uint32_t cpa = orb->cpa; + + orb->cpa = 0; + ssch(test_device_sid, orb); + tsch(test_device_sid, &irb); + report(check_io_errors(test_device_sid, 0, SCSW_SCHS_PRG_CHK), "expecting Program check"); + + orb->cpa = cpa; +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, + { "orb cpa zero", ssch_orb_cpa_zero }, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184411 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 5F70DC433B4 for ; Tue, 6 Apr 2021 07:41:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29845613C0 for ; Tue, 6 Apr 2021 07:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237006AbhDFHlV (ORCPT ); Tue, 6 Apr 2021 03:41:21 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:8366 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236586AbhDFHlL (ORCPT ); Tue, 6 Apr 2021 03:41:11 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367YA6t028832 for ; Tue, 6 Apr 2021 03:41:03 -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=EfL/kDE6fuF7vdMI66aibmN5UZf0hrOEvp3yuYUkV7M=; b=ra1MyQeN9QUhd8ZghAFaCqvzUAGGetXZokZiHSDTbGPPD9BJ38AzNeDSEreTPUuaCl3b 3lluat2gFirvum3+XAw1cJQ6NGy96qiwpUPLvRP0Uf33r/pBShBHdjr9symeX/yA6V0+ +gzGRxijuFCQkZjlhM+VrpxmKPVdiW2SVcHIwIoC992ouyVGhlk62LslqZTdBtXxdyO6 Br8lZdJ6TcxFagbaYSbzHOluIeaQvffwydPEUqxkwopJ97gmxBzIuplr3xahGYCARgbE yWUrmrZb1vb46GC3Z/aAXzaamtr0gme0UpUbmYmmTvcn43Rk+ciZ9PJj13wIqV32CJIv Xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5tyk6kq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:03 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367YPIj029500 for ; Tue, 6 Apr 2021 03:41:03 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5tyk6js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:03 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367WscD026282; Tue, 6 Apr 2021 07:41:01 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 37q2y9hwtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:01 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367ewqE52429228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 283374C04E; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAE7F4C059; Tue, 6 Apr 2021 07:40:57 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:57 +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 v3 09/16] s390x: css: ssch with mis aligned ORB Date: Tue, 6 Apr 2021 09:40:46 +0200 Message-Id: <1617694853-6881-10-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: _CYlXvYCxJr2sUQv7wn9BVl3rrdIlMFC X-Proofpoint-GUID: hJQ18OhwKh167TZUQPkxGmQjz_DPBlim X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 mlxlogscore=850 priorityscore=1501 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We expect a specification exception for a misaligned ORB. Signed-off-by: Pierre Morel --- s390x/css.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index d248cac..47452ba 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -103,9 +103,30 @@ static void ssch_orb_cpa_zero(void) orb->cpa = cpa; } +static void ssch_orb_alignment(void) +{ + void *p; + + /* Prepare a Valid orb on a misaligned address*/ + p = alloc_pages_flags(0, AREA_DMA31); + assert(p); + p += 2; + + ((struct orb *)p)->intparm = test_device_sid; + ((struct orb *)p)->ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT; + ((struct orb *)p)->cpa = (long)ccw; + + expect_pgm_int(); + ssch(test_device_sid, p); + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + + free_pages(p - 2); +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, + { "orb alignment", ssch_orb_alignment }, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184423 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 63884C43461 for ; Tue, 6 Apr 2021 07:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28066613C0 for ; Tue, 6 Apr 2021 07:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244408AbhDFHlg (ORCPT ); Tue, 6 Apr 2021 03:41:36 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37618 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235371AbhDFHlP (ORCPT ); Tue, 6 Apr 2021 03:41:15 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367YMKL109519 for ; Tue, 6 Apr 2021 03:41:08 -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=nHCdLQSjVfiBBy3gLhZEK4tFGLwM0PebniyjDJlU2os=; b=tJwOzKJNjxCW48tfAc3sLxN+5FA0ROqQjM0x2MOfOYGwFG92sa0SX+fiQTDqUkPqg9Qt fVr7PNcu7/R/0zKwd+BdKIwrS+zS4sE7aMg1vEULzwIwl7kp9Uj5P59bdJ+1nas+hfmy Y44lDhKHCGr/WmuEWQ6qnbGvTSi0USORXijkqXBbU/l9CHBYxst2LIIILsfGQj/rH8Jr i42yi6dgGJfqAa8aFh4zbgSPBWe78j3586S5/vF8Q5q6Xwez/JadIGV7zpN0UPMOAAhU pSUScj/dqkCDAVi+YaMzK76dFxtMrEGKAqgbBNI3HzXyF4Qgtvvwae/DywMdArJV+jov PA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q60521ud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:07 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367YUd8110188 for ; Tue, 6 Apr 2021 03:41:04 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q60521tn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:04 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367Wngb026263; Tue, 6 Apr 2021 07:41:02 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 37q2y9hwtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367ex1p52625738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:41:00 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7865C4C040; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35E9D4C052; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:58 +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 v3 10/16] s390x: css: ssch checking addressing errors Date: Tue, 6 Apr 2021 09:40:47 +0200 Message-Id: <1617694853-6881-11-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: EiOc456LpBeH7tgDJV73ZvcwQAsukCvF X-Proofpoint-GUID: 9fppu50rsJGLGcBJrHHOs1C_yTtPslmj X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=898 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We check ORB CPA and CCW address for being inside limits and existing. Signed-off-by: Pierre Morel --- s390x/css.c | 79 +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 8 +++-- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/s390x/css.c b/s390x/css.c index 47452ba..f8f91cf 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -34,6 +35,12 @@ static struct senseid *senseid; struct ccw1 *ccw; struct orb *orb; +phys_addr_t ram_size; +#define ADDR_1G 0x40000000 +#define ADDR_1_5G 0x60000000 +#define ADDR_3G 0xc0000000 + + static void test_enumerate(void) { test_device_sid = css_enumerate(); @@ -123,10 +130,80 @@ static void ssch_orb_alignment(void) free_pages(p - 2); } +static void ssch_data_access(void) +{ + uint32_t tmp; + + if (ram_size > ADDR_1G) { + report_skip("Test with more than 1G available memory"); + return; + } + + tmp = ccw->data_address; + ccw->data_address = ADDR_1_5G; + + ssch(test_device_sid, orb); + tsch(test_device_sid, &irb); + report(check_io_errors(test_device_sid, 0, SCSW_SCHS_PRG_CHK), "expecting Program check"); + + ccw->data_address = tmp; +} + +static void ssch_ccw_access(void) +{ + uint32_t tmp; + + if (ram_size > ADDR_1G) { + report_skip("Test with more than 1G available memory"); + return; + } + + tmp = orb->cpa; + orb->cpa = ADDR_1_5G; + + ssch(test_device_sid, orb); + tsch(test_device_sid, &irb); + report(check_io_errors(test_device_sid, 0, SCSW_SCHS_PRG_CHK), "expecting Program check"); + + orb->cpa = tmp; +} + +static void ssch_ccw_dma31(void) +{ + uint32_t tmp; + struct ccw1 *ccw_high; + + if (ram_size < ADDR_3G) { + report_skip("Test with less than 3G available memory"); + return; + } + + ccw_high = alloc_pages_flags(0, AREA_NORMAL); + assert(ccw_high); + ccw_high->code = CCW_CMD_SENSE_ID; + ccw_high->flags = CCW_F_SLI; + ccw_high->count = sizeof(*senseid); + ccw_high->data_address = (long)senseid; + + tmp = orb->cpa; + report_info("ccw_high: %p", ccw_high); + orb->cpa = (long)ccw_high; + + expect_pgm_int(); + ssch(test_device_sid, orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + + orb->cpa = tmp; + free_pages(ccw_high); +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, { "orb alignment", ssch_orb_alignment }, + { "data access", ssch_data_access }, + { "CCW access", ssch_ccw_access }, + { "CCW in DMA31", ssch_ccw_dma31 }, { NULL, NULL } }; @@ -136,6 +213,7 @@ static void test_ssch(void) orb_alloc(); assert(css_enable(test_device_sid, 0) == 0); + ram_size = get_ram_size(); for (i = 0; ssh_tests[i].name; i++) { report_prefix_push(ssh_tests[i].name); @@ -144,6 +222,7 @@ static void test_ssch(void) } orb_free(); + css_enable(test_device_sid, 0); } /* diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 9f81a60..45569dc 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -86,9 +86,13 @@ extra_params = -m 1G file = sclp.elf extra_params = -m 3G -[css] +[css-1g] file = css.elf -extra_params = -device virtio-net-ccw +extra_params = -m 1G -device virtio-net-ccw + +[css-3g] +file = css.elf +extra_params = -m 3G -device virtio-net-ccw [skrf] file = skrf.elf From patchwork Tue Apr 6 07:40:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184415 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 AC836C433ED for ; Tue, 6 Apr 2021 07:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 761D5613C0 for ; Tue, 6 Apr 2021 07:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244342AbhDFHlX (ORCPT ); Tue, 6 Apr 2021 03:41:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:65144 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235491AbhDFHlM (ORCPT ); Tue, 6 Apr 2021 03:41:12 -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 1367YAH5068691 for ; Tue, 6 Apr 2021 03:41:05 -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=Z9ypbj+UeivAzjmDgCPVYWQufBUsOBXwfTgtlzp+LRM=; b=AaAlLQ13CLbzvyR7ror06xkcLj3M8zAn5GCqSeXsmJbedrz/3/shibR9Lvf9ON19fhso EUKBh+0ZsKLAklrriUk9d4AJJg3Abs0sBTnVin0eV+agBY5hJCfo/zKMCpfcGdXlTkv6 yTeoKHxLlZb5+wNgW0Ta9+iUtMbjAV+MDYC5JX3JEUpsdxZHZUyW84AZPOjpBHFH7ndW 5bfrlc44McShbXzwz2smCtDuOnxvgSK2S8kx4FXwRTIjjYzgMBhdF7EWJ4nNzYVvPvvI Tt1kgyAQTNDpo9TbNhQ4TOI3wjKMCGq3qvwl6u4XpFE3CbGk9DufP1Y0xneCMwSnOTkv jw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:04 -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 1367Y8Ww068551 for ; Tue, 6 Apr 2021 03:41:04 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcpb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:04 -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 1367WdQI026032; Tue, 6 Apr 2021 07:41:02 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 37q2q5hwxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367exrf25166106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:41:00 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEB964C06D; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85F3B4C04E; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:58 +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 v3 11/16] s390x: css: No support for MIDAW Date: Tue, 6 Apr 2021 09:40:48 +0200 Message-Id: <1617694853-6881-12-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QJ-2BnH2I_PqK4bgYasuv-X4Pq4NDnhV X-Proofpoint-ORIG-GUID: ZR3T2dfx6ZQvmmlgXOO4LFnTa_rc-t77 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=923 clxscore=1015 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Verify that using MIDAW triggers a operand exception. Signed-off-by: Pierre Morel --- s390x/css.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index f8f91cf..56adc16 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -197,6 +197,18 @@ static void ssch_ccw_dma31(void) free_pages(ccw_high); } +static void ssch_orb_midaw(void) +{ + uint32_t tmp = orb->ctrl; + + orb->ctrl |= ORB_CTRL_MIDAW; + expect_pgm_int(); + ssch(test_device_sid, orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + + orb->ctrl = tmp; +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, @@ -204,6 +216,7 @@ static struct tests ssh_tests[] = { { "data access", ssch_data_access }, { "CCW access", ssch_ccw_access }, { "CCW in DMA31", ssch_ccw_dma31 }, + { "ORB MIDAW unsupported", ssch_orb_midaw }, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184413 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 89992C43460 for ; Tue, 6 Apr 2021 07:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AFBD613C2 for ; Tue, 6 Apr 2021 07:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244361AbhDFHlW (ORCPT ); Tue, 6 Apr 2021 03:41:22 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64520 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237025AbhDFHlM (ORCPT ); Tue, 6 Apr 2021 03:41:12 -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 1367YA9l068718 for ; Tue, 6 Apr 2021 03:41:04 -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=PDvzVSLV3tmrkcFM0KBW8ORAUDODkbz4J8Att9R5QDE=; b=cj11lcDwsKIu/Thq1ieIWC2ESCUdh6UKJBK+Wj23TI/mp+NfNva3x3sLa98RJS1PGl4L rrwycsJfjtxoVWe3/0v6i+oOkj65CmKAn55R35xdF4aBR0mQTtza2tfgnd2b05K3/xhf bAtr4aX9rCxgPq9wRs7GtXqD3igiCIV8S1lmWti2Hoexh2EbYd9ctl80HKhP16Htmqdq yK/Tslbj75F0v1c+TytcWh/RGOTI6yG/+Q8/T/8MMvqbXxcbh7+nYv+H3c9OcXDgmZu+ fglAVc8n7ubs5td1QVszQh4uEL0PmJJzm0tGWhKJijqRcngr0poY9izF1lHl/Ba8jkyS Rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcpt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:04 -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 1367Z42f070983 for ; Tue, 6 Apr 2021 03:41:03 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5eatcnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:03 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367Wp27023881; Tue, 6 Apr 2021 07:41:02 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 37q2nkh0n0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:01 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367exBo40632804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19CE74C066; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5BCB4C070; Tue, 6 Apr 2021 07:40:58 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:58 +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 v3 12/16] s390x: css: Check ORB reserved bits Date: Tue, 6 Apr 2021 09:40:49 +0200 Message-Id: <1617694853-6881-13-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TAHeBZWSoQ3IoZD2tuEDJhhM2u-kvmAS X-Proofpoint-ORIG-GUID: 3L0EW-t4PfFbldcIRxl_IKsn-Mgafd7W X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Several bits of the ORB are reserved and must be zero. Their use will trigger a operand exception. Signed-off-by: Pierre Morel --- s390x/css.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index 56adc16..26f5da6 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -209,6 +209,26 @@ static void ssch_orb_midaw(void) orb->ctrl = tmp; } +static void ssch_orb_ctrl(void) +{ + uint32_t tmp = orb->ctrl; + char buffer[80]; + int i; + + /* Check the reserved bits of the ORB CTRL field */ + for (i = 26; i <= 30; i++) { + orb->ctrl |= (0x01 << (31 - i)); + snprintf(buffer, 80, " %d", i); + report_prefix_push(buffer); + expect_pgm_int(); + ssch(test_device_sid, orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + + orb->ctrl = tmp; + } +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, @@ -217,6 +237,7 @@ static struct tests ssh_tests[] = { { "CCW access", ssch_ccw_access }, { "CCW in DMA31", ssch_ccw_dma31 }, { "ORB MIDAW unsupported", ssch_orb_midaw }, + { "ORB reserved CTRL bits", ssch_orb_ctrl }, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184417 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 208E9C433ED for ; Tue, 6 Apr 2021 07:41:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2C18613BE for ; Tue, 6 Apr 2021 07:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244353AbhDFHlY (ORCPT ); Tue, 6 Apr 2021 03:41:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:9110 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235408AbhDFHlM (ORCPT ); Tue, 6 Apr 2021 03:41:12 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367X0oQ147229 for ; Tue, 6 Apr 2021 03:41:05 -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=sRc4CUmq3qBPPb7nJvUtuxHqfxFAdzHMTDhyhe8zaOM=; b=VxD6ckBJAgHyLgeBlmoau3b69fhPc3XEEjZwQjhUeZ2VW4Gk+NJAy8/GTIE1ynG7WcIj FVbDpFZAGL1uu0w/b5vBaLTI1qTP1HP/f5n6lynlGx2iamshZjrduxjWfUH7C14Dx3jZ QowBYcBdheqR6G+rre4h3rylB3nCGtI3isuOzqKG5LX6Fl1Pr7xcXDyt6H0lAaNme3g7 biVXfNTvY7wJW7NmQi8/vuNvVKF+vumwn1aboBm/sA3oGlUCIntT8IaE2jrN/CI7C48I lhnMX4cZgTymZLxJMapbT3jNi8yhGmDdpCYWaCjNj7Sa+y9hDdyLgsLy3ut1iI6o4yfu Iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5easpw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:05 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367X961001093 for ; Tue, 6 Apr 2021 03:41:05 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5easpux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:04 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1367XF8f024813; Tue, 6 Apr 2021 07:41:02 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma05fra.de.ibm.com with ESMTP id 37q2nr90q4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367exOK31785404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 724B24C050; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 313954C04E; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:59 +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 v3 13/16] s390x: css: checking for CSS extensions Date: Tue, 6 Apr 2021 09:40:50 +0200 Message-Id: <1617694853-6881-14-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _DfYdWem8jWDmdBkSCZM1k4e_shhBUqZ X-Proofpoint-ORIG-GUID: b16zBZ6nwB_lPKaAMeq8Sc3pYZmx7dTn X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We verify that these extensions are not install before running simple tests. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 2 ++ s390x/css.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index d824e34..08b2974 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -338,7 +338,9 @@ struct chsc_scsc { uint8_t reserved[9]; struct chsc_header res; uint32_t res_fmt; +#define CSSC_ORB_EXTENSIONS 0 #define CSSC_EXTENDED_MEASUREMENT_BLOCK 48 +#define CSSC_FC_EXTENSIONS 88 uint64_t general_char[255]; uint64_t chsc_char[254]; }; diff --git a/s390x/css.c b/s390x/css.c index 26f5da6..f8c6688 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -229,6 +229,35 @@ static void ssch_orb_ctrl(void) } } +static void ssch_orb_extension(void) +{ + if (!css_test_general_feature(CSSC_ORB_EXTENSIONS)) { + report_skip("ORB extensions not installed"); + return; + } + /* Place holder for checking ORB extensions */ + report_info("ORB extensions installed but not tested"); +} + +static void ssch_orb_fcx(void) +{ + uint32_t tmp = orb->ctrl; + + if (!css_test_general_feature(CSSC_FC_EXTENSIONS)) { + report_skip("Fibre-channel extensions not installed"); + return; + } + + report_prefix_push("Channel-Program Type Control"); + orb->ctrl |= ORB_CTRL_CPTC; + expect_pgm_int(); + ssch(test_device_sid, orb); + check_pgm_int_code(PGM_INT_CODE_OPERAND); + report_prefix_pop(); + + orb->ctrl = tmp; +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, @@ -238,6 +267,8 @@ static struct tests ssh_tests[] = { { "CCW in DMA31", ssch_ccw_dma31 }, { "ORB MIDAW unsupported", ssch_orb_midaw }, { "ORB reserved CTRL bits", ssch_orb_ctrl }, + { "ORB extensions", ssch_orb_extension}, + { "FC extensions", ssch_orb_fcx}, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184425 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 11645C43460 for ; Tue, 6 Apr 2021 07:41:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D35EE613C0 for ; Tue, 6 Apr 2021 07:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244357AbhDFHle (ORCPT ); Tue, 6 Apr 2021 03:41:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:22070 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244308AbhDFHlO (ORCPT ); Tue, 6 Apr 2021 03:41:14 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367Y9wQ028762 for ; Tue, 6 Apr 2021 03:41:06 -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=xLMPfE7cfoLUNXkFz/SqLWlrCO9SFJ5H5vrh+Osrskw=; b=bwJMUurPekxAfuVSmtkE7Rpxoyi09+EVi9RjbFlsikV/EwINPRtayjdPxg5+dLqQq9Ap ohmpTWTx60AOv4H55afbNPZBjAOK2cWn9HubuvvaKQ1NKY7gmp9M9xXWtKSLi4Hpb+ec gYPai/YBSxe3N5nZhMeZDeTRVr79X/8oeOFa9FKXVU/8ZQ8vedfiHLNaWVuUmq8PUMzX qHMFyn7salomm3lWyNIDtD1eua6Cj30zvFUgq8hYeLApEw5/qxyHGX/vjGTcjb67XibP /kjcGawzc4tdpsRoMMztP9nyh5HSRbkaQ9xaCj3KYfuQc04aezlxQN+HME9oQjwFcj6G MA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37q5tyk6nm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:06 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367YTWv029677 for ; Tue, 6 Apr 2021 03:41:05 -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 37q5tyk6ma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:05 -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 1367Wvog016107; Tue, 6 Apr 2021 07:41:03 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 37q2n2sx82-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:03 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367f0Wp24903966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:41:00 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8B6B4C050; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FD744C059; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:59 +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 v3 14/16] s390x: css: issuing SSCH when the channel is status pending Date: Tue, 6 Apr 2021 09:40:51 +0200 Message-Id: <1617694853-6881-15-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: SNdbYtPO5USPXWWLy-C-jGRSTkYTrarx X-Proofpoint-GUID: e2b5k5xn9YUZwziPftV30eXzA8lSGNI9 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 mlxlogscore=974 priorityscore=1501 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We await CC=1 when we issue a SSCH on a channel with status pending. Signed-off-by: Pierre Morel --- lib/s390x/css.h | 2 ++ s390x/css.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 08b2974..3eb6957 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -90,6 +90,8 @@ 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 diff --git a/s390x/css.c b/s390x/css.c index f8c6688..52264f2 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -258,6 +258,15 @@ static void ssch_orb_fcx(void) orb->ctrl = tmp; } +static void ssch_status_pending(void) +{ + 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); + check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED); +} + static struct tests ssh_tests[] = { { "privilege", ssch_privilege }, { "orb cpa zero", ssch_orb_cpa_zero }, @@ -269,6 +278,7 @@ static struct tests ssh_tests[] = { { "ORB reserved CTRL bits", ssch_orb_ctrl }, { "ORB extensions", ssch_orb_extension}, { "FC extensions", ssch_orb_fcx}, + { "status pending before ssch", ssch_status_pending}, { NULL, NULL } }; From patchwork Tue Apr 6 07:40:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184421 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 A002EC433ED for ; Tue, 6 Apr 2021 07:41:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 662E4613C0 for ; Tue, 6 Apr 2021 07:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244356AbhDFHld (ORCPT ); Tue, 6 Apr 2021 03:41:33 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:13990 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244330AbhDFHlN (ORCPT ); Tue, 6 Apr 2021 03:41:13 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1367WwPO147137 for ; Tue, 6 Apr 2021 03:41:06 -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=8MMexk60fhIRx1sOtOe/Tx1z3iCi8tOje3LG7LbYMzw=; b=jDMr4RuchdFAFhfApc8lhSsOWa2ge6a9XHGIRr6Tt8UDyMgdoJFQ3OtRDnD54V4NL+mO STxdiakl6H5phPw+7AnDsaEgl+FYW5wC6liT2QBFi4YZzCLsY1Hu0i3fB8aJJEZXuMaN weEZ+9qUMdRigl+VckHEKFe54BF0MhmdVnS7KLsedaWDrrJbplBwEruT9hwhFdfZubfL z9oTmPfpuQYohGveQObcedWdOYigSGNMoccqqlFAqg7hJ6GdVBaVEULz2mf30NMjlJ7y ASqhtfb7MBMYzq4vnLWdPv9ltvVuNMhKoBTzGPReQxa/aGIwYLv5YiZw54ckN8HJP1FD aA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5easpwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:06 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1367X4B8000802 for ; Tue, 6 Apr 2021 03:41:05 -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 37q5easpvf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:05 -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 1367WWbF003701; Tue, 6 Apr 2021 07:41:03 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03fra.de.ibm.com with ESMTP id 37q2nm90r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:03 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367edHb33292604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:39 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14A5A4C04E; Tue, 6 Apr 2021 07:41:00 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D09C84C062; Tue, 6 Apr 2021 07:40:59 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:40:59 +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 v3 15/16] s390x: css: testing halt subchannel Date: Tue, 6 Apr 2021 09:40:52 +0200 Message-Id: <1617694853-6881-16-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: bLHCOjedswXrOM6srkf5NEalkBqMzYQr X-Proofpoint-ORIG-GUID: vriQTZ3EVXwl3XojbS-8v7CRd-sKaDEA X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 mlxlogscore=855 adultscore=0 mlxscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 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 | 63 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index 3eb6957..90c8e4b 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -92,6 +92,10 @@ struct scsw { #define SCSW_KEY 0xf0000000 #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 12ef874..4c4506a 100644 --- a/lib/s390x/css_lib.c +++ b/lib/s390x/css_lib.c @@ -528,6 +528,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 52264f2..0f80a44 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -300,6 +300,68 @@ static void test_ssch(void) css_enable(test_device_sid, 0); } +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; + + 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; + + /* HSCH is a privilege operation */ + report_prefix_push("Privilege"); + enter_pstate(); + expect_pgm_int(); + hsch(test_device_sid); + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); + + /* 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(); + + /* 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(); + + /* 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(); + + /* 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)); +} + /* * test_sense * Pre-requisites: @@ -569,6 +631,7 @@ static struct tests tests[] = { /* The css_init test is needed to initialize the CSS Characteristics */ { "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 Tue Apr 6 07:40:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 12184419 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 BDA9EC433B4 for ; Tue, 6 Apr 2021 07:41:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E86861241 for ; Tue, 6 Apr 2021 07:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244391AbhDFHl3 (ORCPT ); Tue, 6 Apr 2021 03:41:29 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:14150 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244331AbhDFHlN (ORCPT ); Tue, 6 Apr 2021 03:41:13 -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 1367ZHt4089677 for ; Tue, 6 Apr 2021 03:41:06 -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=z+xqMqKNP2p9v0rJES1t+Iyu6AiUcYSv1H1e2GO0GkI=; b=BqCPpIEsKQI7/QXw/C9H82gq0s2ZEHU7vEWNvkL1Law+1MJyD4NxxPTEnbiHvq3PzlCR eRbN0u+YQX2r/d8iCDz/p6KmwPdXdnS50/ywMp9tU0TgL3Wkp70SaOB/cpAdwOUzNxQS 1HEIspZRQZCC9nuw5oCK76JJqgOMmy3V9d3l3MmKHIaqNkZc3EFFXP2/AjDgiEbL1gVy ahMBLHoWnOd4XqGl4H9wa+sAwzse6fs4WVbrmpSYAiMdylai02pqnYlQIzKe3q17ubNn WgxvG02AE/zvAalZlcgtcxQkFosUU85To6i/RISQnyxFnDEEIMLPGlqYNzjS+2ZZaxw+ mA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37q5dv1qu8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Apr 2021 03:41:06 -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 1367aHVM093526 for ; Tue, 6 Apr 2021 03:41:05 -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 37q5dv1qsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 03:41:05 -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 1367XJcH026916; Tue, 6 Apr 2021 07:41:03 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 37q2q5hwxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Apr 2021 07:41:03 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1367eeV835782974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Apr 2021 07:40:40 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 795984C05E; Tue, 6 Apr 2021 07:41:00 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C9C54C040; Tue, 6 Apr 2021 07:41:00 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.42.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 6 Apr 2021 07:41:00 +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 v3 16/16] s390x: css: testing clear subchannel Date: Tue, 6 Apr 2021 09:40:53 +0200 Message-Id: <1617694853-6881-17-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> References: <1617694853-6881-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ntor66Bfk_hU-4nrnr2k5738V4j0e6FB X-Proofpoint-ORIG-GUID: KxBllOLbq0CWc9elqMcYBrUB_Lv9LfCA X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-04-06_01:2021-04-01,2021-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 mlxlogscore=880 spamscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 impostorscore=0 suspectscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104030000 definitions=main-2104060050 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 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index 0f80a44..00c77c7 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -362,6 +362,69 @@ static void test_hsch(void) free_io_mem(ccw, sizeof(*ccw)); } +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; + + 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; + + /* CSCH is a privilege operation */ + report_prefix_push("Privilege"); + enter_pstate(); + expect_pgm_int(); + csch(test_device_sid); + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); + + /* 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(); + + /* 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(); + + /* 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(); + + /* 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)); +} + /* * test_sense * Pre-requisites: @@ -632,6 +695,7 @@ static struct tests tests[] = { { "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 },