From patchwork Tue Sep 20 07:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12981483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2720ECAAD8 for ; Tue, 20 Sep 2022 07:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiITHcf (ORCPT ); Tue, 20 Sep 2022 03:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbiITHc2 (ORCPT ); Tue, 20 Sep 2022 03:32:28 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54CFA60504; Tue, 20 Sep 2022 00:32:25 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28K7KrC7034474; Tue, 20 Sep 2022 07:32:24 GMT 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 : content-transfer-encoding : mime-version; s=pp1; bh=ofRcp07j1PJPDGnm6mBkIo8oVlkmag0fdOyvEJUZv1o=; b=qnQnGB16P8698ElqhRR4AdXE3vPBYfuc+G76SaXu/qOhxC+8k9lJnBT2LGbVDKRZrtRP dT0m9YldpOEpbZ2VJ/Tg/nc7E3fsm0eCNYQA5BSd+0AJKl/P/WhSOvs+JeMATnKTrHmK /3/9qTlssCN/WJWyfsjCOblK98dgkEIDmk3zTQPXX9qHAM8CRgtijpIbJZ0afvRziK6a QznmXzSAcAPmO5e99JxhD38acY7YUZihbQRqvL51Il6LyuXd6RTAe0ZMQCOCBxWiNVUe vbUlMTflnxusVicBIKSlNkVXOQqifhvztjuHuGmPWfb7bb5d3+6+NwzO9z4903eTGN60 WA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jq924r9w1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 07:32:24 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28K7L4a4035411; Tue, 20 Sep 2022 07:32:23 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jq924r9sb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 07:32:23 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28K7L90q031193; Tue, 20 Sep 2022 07:32:13 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 3jn5gj3fqy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 07:32:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28K7W8mJ49873214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Sep 2022 07:32:08 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76EF211C050; Tue, 20 Sep 2022 07:32:08 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6902111C04C; Tue, 20 Sep 2022 07:32:07 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 20 Sep 2022 07:32:07 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, Nico Boehr , Janosch Frank Subject: [kvm-unit-tests GIT PULL 08/11] s390x: add pgm spec interrupt loop test Date: Tue, 20 Sep 2022 07:30:32 +0000 Message-Id: <20220920073035.29201-9-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920073035.29201-1-frankja@linux.ibm.com> References: <20220920073035.29201-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 5dG9CsBNnoe2y6giKXLy8Fg7VJTHKdq_ X-Proofpoint-ORIG-GUID: EksnxkBSx6YkwJVWgBMt-Dp_hI6Zr9fS X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-20_02,2022-09-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209200045 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr An invalid PSW causes a program interrupt. When an invalid PSW is introduced in the pgm_new_psw, an interrupt loop occurs as soon as a program interrupt is caused. QEMU should detect that and panic the guest, hence add a test for it. Signed-off-by: Nico Boehr Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Reviewed-by: Thomas Huth Link: https://lore.kernel.org/r/20220823103833.156942-5-nrb@linux.ibm.com Message-Id: <20220823103833.156942-5-nrb@linux.ibm.com> Signed-off-by: Janosch Frank --- s390x/Makefile | 1 + s390x/panic-loop-pgm.c | 38 ++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 6 ++++++ 3 files changed, 45 insertions(+) create mode 100644 s390x/panic-loop-pgm.c diff --git a/s390x/Makefile b/s390x/Makefile index e4649da5..66415d0b 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -35,6 +35,7 @@ tests += $(TEST_DIR)/pv-attest.elf tests += $(TEST_DIR)/migration-cmm.elf tests += $(TEST_DIR)/migration-skey.elf tests += $(TEST_DIR)/panic-loop-extint.elf +tests += $(TEST_DIR)/panic-loop-pgm.elf pv-tests += $(TEST_DIR)/pv-diags.elf diff --git a/s390x/panic-loop-pgm.c b/s390x/panic-loop-pgm.c new file mode 100644 index 00000000..23e97347 --- /dev/null +++ b/s390x/panic-loop-pgm.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Program interrupt loop test + * + * Copyright IBM Corp. 2022 + * + * Authors: + * Nico Boehr + */ +#include +#include +#include +#include +#include + +int main(void) +{ + report_prefix_push("panic-loop-pgm"); + + if (!host_is_qemu() || host_is_tcg()) { + report_skip("QEMU-KVM-only test"); + goto out; + } + + expect_pgm_int(); + /* bit 12 set is invalid */ + lowcore.pgm_new_psw.mask = extract_psw_mask() | BIT(63 - 12); + mb(); + + /* cause a pgm int */ + psw_mask_set_bits(BIT(63 - 12)); + + report_fail("survived pgm int loop"); + +out: + report_prefix_pop(); + return report_summary(); +} diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index b1b25f11..f9f102ab 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -191,3 +191,9 @@ file = panic-loop-extint.elf groups = panic accel = kvm timeout = 5 + +[panic-loop-pgm] +file = panic-loop-pgm.elf +groups = panic +accel = kvm +timeout = 5