From patchwork Thu May 12 09:34:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847436 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 4A47CC433EF for ; Thu, 12 May 2022 09:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352077AbiELJfq (ORCPT ); Thu, 12 May 2022 05:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352023AbiELJfg (ORCPT ); Thu, 12 May 2022 05:35:36 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 649CF69B76 for ; Thu, 12 May 2022 02:35:35 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Psj9010031 for ; Thu, 12 May 2022 09:35:35 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 : mime-version : content-transfer-encoding; s=pp1; bh=MgPjSiU4NR1DHDB7eQFp+haFZTPfZLuFDntuV/lZB+4=; b=Bvu8ZNsZm1N2qshsiIMACb+prtWtKLY7U7tW/wFtjiLUn0Mp5gydIyuAcTgIuvsQTzrp ufnOtx0aUSHHOMcPhs3a1+C3Cw+BF8v1url0MHvT3s9vXXK82K/EYzbDRIjxQSp/PySF Xl1uu4blbWULfryouqWuUMcpi9QiLjbYr5UwQ3pr80qAcAEnh/KTqvw3Gby73uryxu5B oMQGcWSdsFwjfWtDMoSSuJdcpurJssnXvA/IWSeD5Kjd1d1wUX3o4fnVax4tlRdnvSYM Ex9qEqF6D8k/2VhBCCeQTLYvWH2pw21xwvheUY7zhthL3hkppo9X27MAoiVxFA1VnUCi kw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0ykpr5n0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:34 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9RSQX013270 for ; Thu, 12 May 2022 09:35:34 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0ykpr5kt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XLW2009710; Thu, 12 May 2022 09:35:32 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06fra.de.ibm.com with ESMTP id 3fwg1hw8yj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:32 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9LoJX53936506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:21:50 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1BFB11C052; Thu, 12 May 2022 09:35:28 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B74511C050; Thu, 12 May 2022 09:35:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:28 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 01/28] s390x: gs: move to new header file Date: Thu, 12 May 2022 11:34:56 +0200 Message-Id: <20220512093523.36132-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: GcFAwM_QnnP2LXVxuSw2OQY406MgZMwX X-Proofpoint-ORIG-GUID: tFpM9KQSjbGG8Q5W2LQMxDd4xIa20O5p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=761 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Move the guarded-storage related structs and instructions to a new header file because we will also need them for the SIGP store additional status tests. Signed-off-by: Nico Boehr Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- lib/s390x/gs.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ s390x/gs.c | 54 +-------------------------------------- 2 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 lib/s390x/gs.h diff --git a/lib/s390x/gs.h b/lib/s390x/gs.h new file mode 100644 index 00000000..9c94e580 --- /dev/null +++ b/lib/s390x/gs.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Guarded storage related definitions + * + * Copyright 2018 IBM Corp. + * + * Authors: + * Martin Schwidefsky + * Janosch Frank + */ +#include + +#ifndef _S390X_GS_H_ +#define _S390X_GS_H_ + +struct gs_cb { + uint64_t reserved; + uint64_t gsd; + uint64_t gssm; + uint64_t gs_epl_a; +}; + +struct gs_epl { + uint8_t pad1; + union { + uint8_t gs_eam; + struct { + uint8_t : 6; + uint8_t e : 1; + uint8_t b : 1; + }; + }; + union { + uint8_t gs_eci; + struct { + uint8_t tx : 1; + uint8_t cx : 1; + uint8_t : 5; + uint8_t in : 1; + }; + }; + union { + uint8_t gs_eai; + struct { + uint8_t : 1; + uint8_t t : 1; + uint8_t as : 2; + uint8_t ar : 4; + }; + }; + uint32_t pad2; + uint64_t gs_eha; + uint64_t gs_eia; + uint64_t gs_eoa; + uint64_t gs_eir; + uint64_t gs_era; +}; + +static inline void load_gs_cb(struct gs_cb *gs_cb) +{ + asm volatile(".insn rxy,0xe3000000004d,0,%0" : : "Q" (*gs_cb)); +} + +static inline void store_gs_cb(struct gs_cb *gs_cb) +{ + asm volatile(".insn rxy,0xe30000000049,0,%0" : : "Q" (*gs_cb)); +} + +#endif diff --git a/s390x/gs.c b/s390x/gs.c index 7567bb78..4993eb8f 100644 --- a/s390x/gs.c +++ b/s390x/gs.c @@ -13,49 +13,7 @@ #include #include #include - -struct gs_cb { - uint64_t reserved; - uint64_t gsd; - uint64_t gssm; - uint64_t gs_epl_a; -}; - -struct gs_epl { - uint8_t pad1; - union { - uint8_t gs_eam; - struct { - uint8_t : 6; - uint8_t e : 1; - uint8_t b : 1; - }; - }; - union { - uint8_t gs_eci; - struct { - uint8_t tx : 1; - uint8_t cx : 1; - uint8_t : 5; - uint8_t in : 1; - }; - }; - union { - uint8_t gs_eai; - struct { - uint8_t : 1; - uint8_t t : 1; - uint8_t as : 2; - uint8_t ar : 4; - }; - }; - uint32_t pad2; - uint64_t gs_eha; - uint64_t gs_eia; - uint64_t gs_eoa; - uint64_t gs_eir; - uint64_t gs_era; -}; +#include static volatile int guarded = 0; static struct gs_cb gs_cb; @@ -64,16 +22,6 @@ static unsigned long gs_area = 0x2000000; void gs_handler(struct gs_cb *this_cb); -static inline void load_gs_cb(struct gs_cb *gs_cb) -{ - asm volatile(".insn rxy,0xe3000000004d,0,%0" : : "Q" (*gs_cb)); -} - -static inline void store_gs_cb(struct gs_cb *gs_cb) -{ - asm volatile(".insn rxy,0xe30000000049,0,%0" : : "Q" (*gs_cb)); -} - static inline unsigned long load_guarded(unsigned long *p) { unsigned long v; From patchwork Thu May 12 09:34:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847439 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 B4A1BC433F5 for ; Thu, 12 May 2022 09:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352042AbiELJfx (ORCPT ); Thu, 12 May 2022 05:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352026AbiELJfh (ORCPT ); Thu, 12 May 2022 05:35:37 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD8D69B79 for ; Thu, 12 May 2022 02:35:36 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9CN0W019274 for ; Thu, 12 May 2022 09:35:35 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 : mime-version : content-transfer-encoding; s=pp1; bh=y2y9id58Z1PTUjdRrulPrSYmT1ksF1bCZGfBzsC5k4s=; b=DiS6s/EDsod1Pxtv+3EmLxur5J0gecWWMD5wW0bdJSwnvUtXAZrlTiDGQURPyWjwT2D3 w8d6fRylK9m0j8G4MYwGjLvqNpHTNDuNL3U7AxAM4NOZuXMZjGTpEkClcNmSkwY73Gc2 pO5Ty2r2x/F79wAGHhX1/lZbrrPDhgO31/TP6DjnbGQGCEhCfTfkEGObVWBDfWnu6CL7 7sqSFn7OLTOIuOTl3pnZ0ALpOitxxV70dYn3HSDUA9iddy88pXtEyrG9ej6zgw2wSCIl o5oXZhGxYYyn3DgGvixVeGkLlQV7z5oQ9dumMm78+a5BF/7TU40LidRZnTvd6V+Gbd2h 1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd48e0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:35 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9OHir000646 for ; Thu, 12 May 2022 09:35:35 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd48dyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XN5d008155; Thu, 12 May 2022 09:35:32 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 3fwgd8w9yt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:32 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZTgk31981892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D4CC11C04A; Thu, 12 May 2022 09:35:29 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F350411C054; Thu, 12 May 2022 09:35:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:28 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 02/28] s390x: add test for SIGP STORE_ADTL_STATUS order Date: Thu, 12 May 2022 11:34:57 +0200 Message-Id: <20220512093523.36132-3-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 85bE1C2zrUkSOO5u6mCgll0-E5znxHEp X-Proofpoint-GUID: iRhVDdbpGqiiahb0hcu3ToiYRHZ8iuxs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Add a test for SIGP STORE_ADDITIONAL_STATUS order. There are several cases to cover: - when neither vector nor guarded-storage facility is available, check the order is rejected. - when one of the facilities is there, test the order is rejected and adtl_status is not touched when the target CPU is running or when an invalid CPU address is specified. Also check the order is rejected in case of invalid alignment. - when the vector facility is there, write some data to the CPU's vector registers and check we get the right contents. - when the guarded-storage facility is there, populate the CPU's guarded-storage registers with some data and again check we get the right contents. To make sure we cover all these cases, adjust unittests.cfg to run the test with both guarded-storage and vector facility off and on. In TCG, we don't have guarded-storage support, so we just run with vector facility off and on. Signed-off-by: Nico Boehr Signed-off-by: Claudio Imbrenda --- s390x/Makefile | 1 + lib/s390x/asm/vector.h | 16 ++ s390x/adtl-status.c | 408 +++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 25 +++ 4 files changed, 450 insertions(+) create mode 100644 lib/s390x/asm/vector.h create mode 100644 s390x/adtl-status.c diff --git a/s390x/Makefile b/s390x/Makefile index 8ff84db5..c11f6efb 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -29,6 +29,7 @@ tests += $(TEST_DIR)/mvpg-sie.elf tests += $(TEST_DIR)/spec_ex-sie.elf tests += $(TEST_DIR)/firq.elf tests += $(TEST_DIR)/epsw.elf +tests += $(TEST_DIR)/adtl-status.elf pv-tests += $(TEST_DIR)/pv-diags.elf diff --git a/lib/s390x/asm/vector.h b/lib/s390x/asm/vector.h new file mode 100644 index 00000000..ee48bfa6 --- /dev/null +++ b/lib/s390x/asm/vector.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Vector facility related defines and functions + * + * Copyright IBM Corp. 2022 + * + * Authors: + * Nico Boehr + */ +#ifndef _ASMS390X_VECTOR_H_ +#define _ASMS390X_VECTOR_H_ + +#define VEC_REGISTER_NUM 32 +#define VEC_REGISTER_SIZE 16 + +#endif diff --git a/s390x/adtl-status.c b/s390x/adtl-status.c new file mode 100644 index 00000000..9fb76319 --- /dev/null +++ b/s390x/adtl-status.c @@ -0,0 +1,408 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Tests sigp store additional status order + * + * Copyright IBM Corp. 2022 + * + * Authors: + * Nico Boehr + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static int testflag = 0; + +#define INVALID_CPU_ADDRESS -4711 + +struct mcesa_lc12 { + uint8_t vregs[0x200]; /* 0x000 */ + uint8_t reserved200[0x400 - 0x200]; /* 0x200 */ + struct gs_cb gs_cb; /* 0x400 */ + uint8_t reserved420[0x800 - 0x420]; /* 0x420 */ + uint8_t reserved800[0x1000 - 0x800]; /* 0x800 */ +}; + +static struct mcesa_lc12 adtl_status __attribute__((aligned(4096))); + +static uint8_t expected_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE]; + +static struct gs_cb gs_cb; +static struct gs_epl gs_epl; + +static bool memisset(void *s, int c, size_t n) +{ + uint8_t *p = s; + size_t i; + + for (i = 0; i < n; i++) { + if (p[i] != c) + return false; + } + + return true; +} + +static void wait_for_flag(void) +{ + while (!testflag) + mb(); +} + +static void set_flag(int val) +{ + mb(); + testflag = val; + mb(); +} + +static void test_func(void) +{ + set_flag(1); +} + +static bool have_adtl_status(void) +{ + return test_facility(133) || test_facility(129); +} + +static void test_store_adtl_status(void) +{ + uint32_t status = -1; + int cc; + + report_prefix_push("store additional status"); + + if (!have_adtl_status()) { + report_skip("no guarded-storage or vector facility installed"); + goto out; + } + + memset(&adtl_status, 0xff, sizeof(adtl_status)); + + report_prefix_push("running"); + smp_cpu_restart(1); + + cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status, &status); + + report(cc == 1, "CC = 1"); + report(status == SIGP_STATUS_INCORRECT_STATE, "status = INCORRECT_STATE"); + report(memisset(&adtl_status, 0xff, sizeof(adtl_status)), + "additional status not touched"); + + report_prefix_pop(); + + report_prefix_push("invalid CPU address"); + + cc = sigp(INVALID_CPU_ADDRESS, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status, &status); + report(cc == 3, "CC = 3"); + report(memisset(&adtl_status, 0xff, sizeof(adtl_status)), + "additional status not touched"); + + report_prefix_pop(); + + report_prefix_push("unaligned"); + smp_cpu_stop(1); + + cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status + 256, &status); + report(cc == 1, "CC = 1"); + report(status == SIGP_STATUS_INVALID_PARAMETER, "status = INVALID_PARAMETER"); + report(memisset(&adtl_status, 0xff, sizeof(adtl_status)), + "additional status not touched"); + + report_prefix_pop(); + +out: + report_prefix_pop(); +} + +static void test_store_adtl_status_unavail(void) +{ + uint32_t status = 0; + int cc; + + report_prefix_push("store additional status unavailable"); + + if (have_adtl_status()) { + report_skip("guarded-storage or vector facility installed"); + goto out; + } + + report_prefix_push("not accepted"); + smp_cpu_stop(1); + + memset(&adtl_status, 0xff, sizeof(adtl_status)); + + cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status, &status); + + report(cc == 1, "CC = 1"); + report(status == SIGP_STATUS_INVALID_ORDER, + "status = INVALID_ORDER"); + report(memisset(&adtl_status, 0xff, sizeof(adtl_status)), + "additional status not touched"); + + report_prefix_pop(); + +out: + report_prefix_pop(); +} + +static void restart_write_vector(void) +{ + uint8_t *vec_reg; + /* vlm handles at most 16 registers at a time */ + uint8_t *vec_reg_16_31 = &expected_vec_contents[16][0]; + uint64_t cr0, cr0_mask = ~BIT_ULL(CTL0_VECTOR); + int i; + + for (i = 0; i < VEC_REGISTER_NUM; i++) { + vec_reg = &expected_vec_contents[i][0]; + /* i+1 to avoid zero content */ + memset(vec_reg, i + 1, VEC_REGISTER_SIZE); + } + + ctl_set_bit(0, CTL0_VECTOR); + + asm volatile ( + " .machine z13\n" + /* load vector registers */ + " vlm 0,15, %[vec_reg_0_15]\n" + " vlm 16,31, %[vec_reg_16_31]\n" + /* turn off vector instructions */ + " stctg 0,0, %[cr0]\n" + " ng %[cr0_mask], %[cr0]\n" + " stg %[cr0_mask], %[cr0]\n" + " lctlg 0,0, %[cr0]\n" + /* inform CPU 0 we are done by setting testflag to 1 */ + " mvhi %[testflag], 1\n" + /* + * infinite loop. function epilogue will restore floating point + * registers and hence destroy vector register contents + */ + "0: j 0\n" + : [cr0_mask] "+&d"(cr0_mask) + : [vec_reg_0_15] "Q"(expected_vec_contents), + [vec_reg_16_31] "Q"(*vec_reg_16_31), + [cr0] "Q"(cr0), + [testflag] "T"(testflag) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", + "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", + "v28", "v29", "v30", "v31", "cc", "memory" + ); +} + +static void cpu_write_magic_to_vector_regs(uint16_t cpu_idx) +{ + struct psw new_psw; + + smp_cpu_stop(cpu_idx); + + new_psw.mask = extract_psw_mask(); + new_psw.addr = (unsigned long)restart_write_vector; + + set_flag(0); + + smp_cpu_start(cpu_idx, new_psw); + + wait_for_flag(); +} + +static int adtl_status_check_unmodified_fields_for_lc(unsigned long lc) +{ + assert (!lc || (lc >= 10 && lc <= 12)); + + if (lc <= 10 && !memisset(&adtl_status.gs_cb, 0xff, sizeof(adtl_status.gs_cb))) + return false; + + if (!memisset(adtl_status.reserved200, 0xff, sizeof(adtl_status.reserved200))) + return false; + + if (!memisset(adtl_status.reserved420, 0xff, sizeof(adtl_status.reserved420))) + return false; + + if (!memisset(adtl_status.reserved800, 0xff, sizeof(adtl_status.reserved800))) + return false; + + return true; +} + +static void __store_adtl_status_vector_lc(unsigned long lc) +{ + uint32_t status = -1; + struct psw psw; + int cc; + + report_prefix_pushf("LC %lu", lc); + + if (!test_facility(133) && lc) { + report_skip("not supported, no guarded-storage facility"); + goto out; + } + + cpu_write_magic_to_vector_regs(1); + smp_cpu_stop(1); + + memset(&adtl_status, 0xff, sizeof(adtl_status)); + + cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status | lc, &status); + report(!cc, "CC = 0"); + + report(!memcmp(adtl_status.vregs, + expected_vec_contents, sizeof(expected_vec_contents)), + "additional status contents match"); + + report(adtl_status_check_unmodified_fields_for_lc(lc), + "no write outside expected fields"); + + /* + * To avoid the floating point/vector registers being cleaned up, we + * stopped CPU1 right in the middle of a function. Hence the cleanup of + * the function didn't run yet and the stackpointer is messed up. + * Destroy and re-initalize the CPU to fix that. + */ + smp_cpu_destroy(1); + psw.mask = extract_psw_mask(); + psw.addr = (unsigned long)test_func; + smp_cpu_setup(1, psw); + +out: + report_prefix_pop(); +} + +static void test_store_adtl_status_vector(void) +{ + report_prefix_push("store additional status vector"); + + if (!test_facility(129)) { + report_skip("vector facility not installed"); + goto out; + } + + __store_adtl_status_vector_lc(0); + __store_adtl_status_vector_lc(10); + __store_adtl_status_vector_lc(11); + __store_adtl_status_vector_lc(12); + +out: + report_prefix_pop(); +} + +static void restart_write_gs_regs(void) +{ + const unsigned long gs_area = 0x2000000; + const unsigned long gsc = 25; /* align = 32 M, section size = 512K */ + + ctl_set_bit(2, CTL2_GUARDED_STORAGE); + + gs_cb.gsd = gs_area | gsc; + gs_cb.gssm = 0xfeedc0ffe; + gs_cb.gs_epl_a = (uint64_t) &gs_epl; + + load_gs_cb(&gs_cb); + + set_flag(1); + + ctl_clear_bit(2, CTL2_GUARDED_STORAGE); + + /* + * Safe to return here. r14 will point to the endless loop in + * smp_cpu_setup_state. + */ +} + +static void cpu_write_to_gs_regs(uint16_t cpu_idx) +{ + struct psw new_psw; + + smp_cpu_stop(cpu_idx); + + new_psw.mask = extract_psw_mask(); + new_psw.addr = (unsigned long)restart_write_gs_regs; + + set_flag(0); + + smp_cpu_start(cpu_idx, new_psw); + + wait_for_flag(); +} + +static void __store_adtl_status_gs(unsigned long lc) +{ + uint32_t status = 0; + int cc; + + report_prefix_pushf("LC %lu", lc); + + cpu_write_to_gs_regs(1); + smp_cpu_stop(1); + + memset(&adtl_status, 0xff, sizeof(adtl_status)); + + cc = smp_sigp(1, SIGP_STORE_ADDITIONAL_STATUS, + (unsigned long)&adtl_status | lc, &status); + report(!cc, "CC = 0"); + + report(!memcmp(&adtl_status.gs_cb, &gs_cb, sizeof(gs_cb)), + "additional status contents match"); + + report(adtl_status_check_unmodified_fields_for_lc(lc), + "no write outside expected fields"); + + report_prefix_pop(); +} + +static void test_store_adtl_status_gs(void) +{ + report_prefix_push("store additional status guarded-storage"); + + if (!test_facility(133)) { + report_skip("guarded-storage facility not installed"); + goto out; + } + + __store_adtl_status_gs(11); + __store_adtl_status_gs(12); + +out: + report_prefix_pop(); +} + +int main(void) +{ + struct psw psw; + report_prefix_push("adtl_status"); + + if (smp_query_num_cpus() == 1) { + report_skip("need at least 2 cpus for this test"); + goto done; + } + + /* Setting up the cpu to give it a stack and lowcore */ + psw.mask = extract_psw_mask(); + psw.addr = (unsigned long)test_func; + smp_cpu_setup(1, psw); + smp_cpu_stop(1); + + test_store_adtl_status_unavail(); + test_store_adtl_status_vector(); + test_store_adtl_status_gs(); + test_store_adtl_status(); + smp_cpu_destroy(1); + +done: + report_prefix_pop(); + return report_summary(); +} diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 743013b2..256c7169 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -146,3 +146,28 @@ extra_params = -device virtio-net-ccw [tprot] file = tprot.elf + +[adtl-status-kvm] +file = adtl-status.elf +smp = 2 +accel = kvm +extra_params = -cpu host,gs=on,vx=on + +[adtl-status-no-vec-no-gs-kvm] +file = adtl-status.elf +smp = 2 +accel = kvm +extra_params = -cpu host,gs=off,vx=off + +[adtl-status-tcg] +file = adtl-status.elf +smp = 2 +accel = tcg +# no guarded-storage support in tcg +extra_params = -cpu qemu,vx=on + +[adtl-status-no-vec-no-gs-tcg] +file = adtl-status.elf +smp = 2 +accel = tcg +extra_params = -cpu qemu,gs=off,vx=off From patchwork Thu May 12 09:34:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847435 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 71EC1C433EF for ; Thu, 12 May 2022 09:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352038AbiELJfj (ORCPT ); Thu, 12 May 2022 05:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352022AbiELJfg (ORCPT ); Thu, 12 May 2022 05:35:36 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4987A69B6B for ; Thu, 12 May 2022 02:35:36 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9COaH026688 for ; Thu, 12 May 2022 09:35:36 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 : mime-version : content-transfer-encoding; s=pp1; bh=abxldnYww3B0DNMwBpdDTac8ezRaALrnES7naUKLALU=; b=XTrR2t+viu6IwlJ61j7qhLk4XwjJlXFVAjiFymmVKRoEUGHiL/MtgvaZYYSEyVHZ1Hxr 9O/Gni05m8GVKrimuWlawGwaW+70TdLiAGN3tbKbSuaoZfG/PLAB+G4Uc8auJYOyXrbd VycpDcDyrAqPGs3BjIfqtgdqcyaFif+izvYMQraVxkN2vohCa/hgFmVBteQmVCSHrjk/ AsSEZeP4ROCgkv+9PsGfL5sbW5fVxuOM8FyMbBOlYgC7V+/b0j3ouXSFDP6D+IpVe3hx DH8hNbmo8fhTQ6Z+GwpceMp+WhFhsVcIrvbi8ui3DDUnZb083C+27n64McPZ5nZqjvEg 4g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd50dy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:35 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9NJpm031534 for ; Thu, 12 May 2022 09:35:35 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd50dx9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:35 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9WfYo020396; Thu, 12 May 2022 09:35:33 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd8xs93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:32 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZTVs50069958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB5A311C04C; Thu, 12 May 2022 09:35:29 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6128011C052; Thu, 12 May 2022 09:35:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:29 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr , Eric Farman Subject: [kvm-unit-tests GIT PULL 03/28] s390x: epsw: fix report_pop_prefix() when running under non-QEMU Date: Thu, 12 May 2022 11:34:58 +0200 Message-Id: <20220512093523.36132-4-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Sp0SeoQcnEUUBPhwhbTE2EdSP4grtftG X-Proofpoint-ORIG-GUID: XJ0N62nAgvu-Y6nuE0eGBXVqh6LqHVDt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr When we don't run in QEMU, we didn't push a prefix, hence pop won't work. Fix this by pushing the prefix before the QEMU check. Signed-off-by: Nico Boehr Reviewed-by: Thomas Huth Reviewed-by: Eric Farman Signed-off-by: Claudio Imbrenda --- s390x/epsw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/s390x/epsw.c b/s390x/epsw.c index 5b73f4b3..d8090d95 100644 --- a/s390x/epsw.c +++ b/s390x/epsw.c @@ -97,13 +97,13 @@ static void test_epsw(void) int main(int argc, char **argv) { + report_prefix_push("epsw"); + if (!host_is_kvm() && !host_is_tcg()) { report_skip("Not running under QEMU"); goto done; } - report_prefix_push("epsw"); - test_epsw(); done: From patchwork Thu May 12 09:34:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847438 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 192C5C433F5 for ; Thu, 12 May 2022 09:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352090AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232425AbiELJfh (ORCPT ); Thu, 12 May 2022 05:35:37 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A824E69B7A for ; Thu, 12 May 2022 02:35:36 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9COVC019290 for ; Thu, 12 May 2022 09:35:36 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 : mime-version : content-transfer-encoding; s=pp1; bh=+XjsGcreYHAoQunk5UD8XN35bgu+5Ig8I4kxeZX3Qo0=; b=mjp6S86/PgOmfqzlQvTQIQb3guQQIVFJiPS62CINsjZkCo2+OsIUows0ouBRHbtKRiex 5SMwAIFK8cUzOPaXrQNqZm1ZNErl0RCVO9W3Z2t7mhIIgaqF1SB7AyOyBRoYYBOVcBxy eDcGRuWfEyIYGqfWY6/0ybHgd/AtQQDPRQLOVHHEmYRXchu4BTsgAtKlPAzw5QmEe0Lk aahWwe3FKzfF5r+U/ELXadPX5ZDxDT3KWRTmcPWydvzdwEr8aqbP/cJSYxA6uEBHPkzA FWUBh6vchSx1Qjt+2vuyA5tnl8YFtpwL8URmVw5f3EaIGLH6vxXFoVuwOrE8Cw4KNW4D bA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd48e0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:36 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9DB2p020564 for ; Thu, 12 May 2022 09:35:35 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd48e03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:35 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XIiC027312; Thu, 12 May 2022 09:35:33 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 3g0kn78ndy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:33 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9Z9xI33292774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:09 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E78211C054; Thu, 12 May 2022 09:35:30 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D14EE11C050; Thu, 12 May 2022 09:35:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:29 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 04/28] s390x: tprot: use lib include for mmu.h Date: Thu, 12 May 2022 11:34:59 +0200 Message-Id: <20220512093523.36132-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hZWG0WH996QiKhPzQyccWVCqmzxsavDX X-Proofpoint-GUID: yzAsQqcmuHx4RKTV-wPay1RY-iv5Pzng X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=812 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr mmu.h should come from the library includes Signed-off-by: Nico Boehr Reviewed-by: Thomas Huth Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/tprot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/tprot.c b/s390x/tprot.c index 460a0db7..760e7ecd 100644 --- a/s390x/tprot.c +++ b/s390x/tprot.c @@ -12,7 +12,7 @@ #include #include #include -#include "mmu.h" +#include #include #include From patchwork Thu May 12 09:35:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847437 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 20054C433EF for ; Thu, 12 May 2022 09:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352097AbiELJfu (ORCPT ); Thu, 12 May 2022 05:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352009AbiELJfh (ORCPT ); Thu, 12 May 2022 05:35:37 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE4969B78 for ; Thu, 12 May 2022 02:35:36 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Ewwp019286 for ; Thu, 12 May 2022 09:35:36 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 : mime-version : content-transfer-encoding; s=pp1; bh=WClAnKcrn3d9d4fNcMf0WsY5mZnNyZUO+NwFG1dz9Bg=; b=pPK0wBstY2WcpFkNtbwp4o/Ok1wYbR+W+D69B0FpdcWtFYbeC/r1xUYQfKhUpG5ti93W A5z8fHHQ5eGnpiG507xni56n9J+DgO5il3rpOQJ2d69dwx3mbhVzxphiyVnYF16opB4V heP6h3p5QdNvYB7HpHr5rAlK5/VXGRx0WI3/PCmEY9Z0VRlJkHaO+M5uZtAWfy61JNOW nM00RxUG61og8LxyClJxh7LPUw/jN1OTSkQeG6QE/C5LEp+r59ZbbSA4mbJyAdEUzZwe dgW0fH0Rgc9Lii5kR3rUPpXj8rQPomzOI4bAvvk9JwbLAh+Zt5X0xNUrfA7asSKrLqPz pg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbbn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:36 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9K63a015248 for ; Thu, 12 May 2022 09:35:35 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:35 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XU3i023800; Thu, 12 May 2022 09:35:33 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3fwgd8xrxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:33 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9Z9O433292778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:09 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9497711C054; Thu, 12 May 2022 09:35:30 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4405011C050; Thu, 12 May 2022 09:35:30 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:30 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 05/28] s390x: smp: make stop stopped cpu look the same as the running case Date: Thu, 12 May 2022 11:35:00 +0200 Message-Id: <20220512093523.36132-6-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: vPrCsc2hJs-grc9Mw031P111bFmlN9W4 X-Proofpoint-GUID: EWbtKAArgypp1Sp1dzulSOHdyNLbXL-Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=896 adultscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Adjust the stop stopped CPU case such that it looks the same as the stop running CPU case: use the nowait variant, handle the error code in the same way and make the report messages look the same. Signed-off-by: Nico Boehr Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index 5257852c..de3aba71 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -144,8 +144,9 @@ static void test_stop(void) report(smp_cpu_stopped(1), "cpu stopped"); report_prefix_push("stop stopped CPU"); - report(!smp_cpu_stop(1), "STOP succeeds"); - report(smp_cpu_stopped(1), "CPU is stopped"); + rc = smp_cpu_stop_nowait(1); + report(!rc, "return code"); + report(smp_cpu_stopped(1), "cpu stopped"); report_prefix_pop(); report_prefix_pop(); From patchwork Thu May 12 09:35:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847440 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 B5CC2C433FE for ; Thu, 12 May 2022 09:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352134AbiELJgD (ORCPT ); Thu, 12 May 2022 05:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352021AbiELJfi (ORCPT ); Thu, 12 May 2022 05:35:38 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B15F69B6F for ; Thu, 12 May 2022 02:35:37 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9ExM2019410 for ; Thu, 12 May 2022 09:35:37 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 : mime-version : content-transfer-encoding; s=pp1; bh=xVJIVy3QaU4L3MX6L22atdB87JuPOHgA71UqFhj3OwQ=; b=tQ4y6TW+CX0NWBPBxgQzkbJ3DH5fS58VoL5cgUhGVUsROYBrKOsKoLX8I+XdRQMGa8Oj mQaHwCXyvTxjmqSknX1wbxnJaVwQT3dea4+Pj8he1TIDjGQP+XXCpjCsYkofm2ZyidA9 9va9RDZw88UvS9kC5Tl3+DlM/2hA0/kvm5bDWs1WZgnNUybCOPCBwDpB6yCTMba6CZrb lh0IpDKaPzYTe1EqCAfITsryKXb6SF+ssw6pGv3x0KeJk2bEIdJf/GVXFlwDQrfFxvmg r5/sh4LgdW4aMJY6EQki8Ce3zGNTuLgPDcewuYWMKeghUY4zocKFThWeLsu5CXxmWdJy 7Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:36 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9GUK1027531 for ; Thu, 12 May 2022 09:35:36 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbb5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9Xd5V007560; Thu, 12 May 2022 09:35:34 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma01fra.de.ibm.com with ESMTP id 3fwgd8n98e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZVqY38994298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:31 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04A8511C04C; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9E0911C058; Thu, 12 May 2022 09:35:30 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:30 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 06/28] lib: s390x: hardware: Add host_is_qemu() function Date: Thu, 12 May 2022 11:35:01 +0200 Message-Id: <20220512093523.36132-7-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: kGNiYYWJS30Ul11aTNDkqn6tdk2z28UH X-Proofpoint-GUID: XhBwPH2_Y54PtnwM0zAqTt7L-Ub2WCh6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank In the future we'll likely need to check if we're hosted on QEMU so let's make this as easy as possible by providing a dedicated function. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Nico Boehr Signed-off-by: Claudio Imbrenda --- lib/s390x/hardware.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h index 01eeb261..86fe873c 100644 --- a/lib/s390x/hardware.h +++ b/lib/s390x/hardware.h @@ -45,6 +45,11 @@ static inline bool host_is_lpar(void) return detect_host() == HOST_IS_LPAR; } +static inline bool host_is_qemu(void) +{ + return host_is_tcg() || host_is_kvm(); +} + static inline bool machine_is_z15(void) { uint16_t machine = get_machine_id(); From patchwork Thu May 12 09:35:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847441 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 942F1C433EF for ; Thu, 12 May 2022 09:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352114AbiELJf6 (ORCPT ); Thu, 12 May 2022 05:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352033AbiELJfi (ORCPT ); Thu, 12 May 2022 05:35:38 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B301B69B6B for ; Thu, 12 May 2022 02:35:37 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9F2KI019795 for ; Thu, 12 May 2022 09:35:37 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 : mime-version : content-transfer-encoding; s=pp1; bh=8GQGZKGi2PDG6U8D8O87WfWDQLL0dH1qvMo2T9sjxYY=; b=GKF0FxDMetHogxsrqKkE+IkVoOlTCTyOQv6YWx0niN2fHigkSyfgji4PVGFqq8nWQgS6 OMZdHdBkwh0YY14Vh548qaZtChaAewNP0/svdIyXkPE94+HSVef7fj7y81BzjnX2P/2s tGiYqKsltuV7PtiCtpbJ8uq9YV/4uwfzcu9BDQgv9PcTMx2EexknoC0HAdOfsg7QKUZF rjPSRnuy3vGvRlpxh2s0Kxk6Qw5I7tw3yeaTflIX7ajOH7bVXsOEKzwDS8RZp/Iv71Gy PvITCkE9gnh7bzUCImyfJCeP04TjpVx73q0O+z318anWW53QvUh5KiAHLHosbFHmFk8U 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:37 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9VvjR032151 for ; Thu, 12 May 2022 09:35:37 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XPBm008182; Thu, 12 May 2022 09:35:34 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 3fwgd8wa00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZVQE58327408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:31 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6597A11C04A; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15CA111C050; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:31 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 07/28] s390x: css: Skip if we're not run by qemu Date: Thu, 12 May 2022 11:35:02 +0200 Message-Id: <20220512093523.36132-8-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: v0iWtfmDNCcCGyS9SQ3C0MeMs-8kso9Z X-Proofpoint-GUID: ZHnsAdLw95Cw1UHfdKjsTvfVIv7Mk1hD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=844 adultscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank There's no guarantee that we even find a device at the address we're testing for if we're not running under QEMU. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Nico Boehr Signed-off-by: Claudio Imbrenda --- s390x/css.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/s390x/css.c b/s390x/css.c index a333e55a..13a1509f 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -642,13 +643,21 @@ int main(int argc, char *argv[]) int i; report_prefix_push("Channel Subsystem"); + + /* There's no guarantee where our devices are without qemu */ + if (!host_is_qemu()) { + report_skip("Not running under QEMU"); + goto done; + } + enable_io_isc(0x80 >> IO_SCH_ISC); for (i = 0; tests[i].name; i++) { report_prefix_push(tests[i].name); tests[i].func(); report_prefix_pop(); } - report_prefix_pop(); +done: + report_prefix_pop(); return report_summary(); } From patchwork Thu May 12 09:35:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847454 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 AAACEC433F5 for ; Thu, 12 May 2022 09:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352026AbiELJgU (ORCPT ); Thu, 12 May 2022 05:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352035AbiELJfj (ORCPT ); Thu, 12 May 2022 05:35:39 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD1669CCD for ; Thu, 12 May 2022 02:35:38 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9QH22003855 for ; Thu, 12 May 2022 09:35:37 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 : mime-version : content-transfer-encoding; s=pp1; bh=x7UAgnubq7udDhgozSkpHFzno3S31UUOupMm1qxBOno=; b=md84tON4+od+aeysPKA0vldr4opc/nHpAj+No3QjUwzZGH1eZ5QvAk22wRjX6dNVQeLY 7v5F2PfT27OR9GArQ1bjPWHv3ZFb+/oMi1dZ9Sa5jl0bviD/5Gvav7ROH1GoV/gT+SNP H+c5m4/7WPIfj/nHyVr6KFe+bulBnuT2s36VTAvcY3RO1Dr/0tjEwRTsFNuWKSjs+BBr Rj7nLwlkIbdYerd2o5Pwf4R723Mog0fU8b60gx1cxgtd6emVwiX8x7+afk7RZGGsWKdI 0ojm7vl8ze+t/xqWrj/tBWQut/j1rh1i2SU+idlVyDCI3BhzAXSrzJM8J16KaC61iMbK mA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4ty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:37 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9QEps003786 for ; Thu, 12 May 2022 09:35:36 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XYDs023821; Thu, 12 May 2022 09:35:34 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 3fwgd8xrxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZVlJ49676784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:31 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1A3711C04A; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7969611C04C; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:31 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 08/28] s390x: diag308: Only test subcode 2 under QEMU Date: Thu, 12 May 2022 11:35:03 +0200 Message-Id: <20220512093523.36132-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yTRtEPXgAn6cruWau4ICNZIY2xARJ0HB X-Proofpoint-GUID: r6R5dOILVnkolVz5gPmMecbz-31LFdxA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Other hypervisors might implement it and therefore not send a specification exception. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Nico Boehr Signed-off-by: Claudio Imbrenda --- s390x/diag308.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/s390x/diag308.c b/s390x/diag308.c index c9d6c499..ea41b455 100644 --- a/s390x/diag308.c +++ b/s390x/diag308.c @@ -8,6 +8,7 @@ #include #include #include +#include /* The diagnose calls should be blocked in problem state */ static void test_priv(void) @@ -75,7 +76,7 @@ static void test_subcode6(void) /* Unsupported subcodes should generate a specification exception */ static void test_unsupported_subcode(void) { - int subcodes[] = { 2, 0x101, 0xffff, 0x10001, -1 }; + int subcodes[] = { 0x101, 0xffff, 0x10001, -1 }; int idx; for (idx = 0; idx < ARRAY_SIZE(subcodes); idx++) { @@ -85,6 +86,21 @@ static void test_unsupported_subcode(void) check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); report_prefix_pop(); } + + /* + * Subcode 2 is not available under QEMU but might be on other + * hypervisors so we only check for the specification + * exception on QEMU. + */ + report_prefix_pushf("0x%04x", 2); + if (host_is_qemu()) { + expect_pgm_int(); + asm volatile ("diag %0,%1,0x308" :: "d"(0), "d"(2)); + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + } else { + report_skip("subcode is supported"); + } + report_prefix_pop(); } static struct { From patchwork Thu May 12 09:35:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847443 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 C48D0C433F5 for ; Thu, 12 May 2022 09:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352153AbiELJgK (ORCPT ); Thu, 12 May 2022 05:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352045AbiELJfo (ORCPT ); Thu, 12 May 2022 05:35:44 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BBC669B74 for ; Thu, 12 May 2022 02:35:37 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Q1Sl003575 for ; Thu, 12 May 2022 09:35:36 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 : mime-version : content-transfer-encoding; s=pp1; bh=i1WW5GhsZLzjZFOF3JAsrTKYm9wHeMUcvAeTidZn+zQ=; b=Nl2aM2a8HgQoQopz9fIJzBSvffJX89rwl1RIsit8CPKoA4VloJVNAKskAUxIY+w7M0Cr jpXobk1AWXwXzJ7V/D732YrJEehOR7rDHaCWG3GyhaaNExgZBgsgUNnlRnEB/nJH6qve thj+D5cMCfLGYOt3OdbyH+w1VqBPVitlsp0uYRypFVGq26cfE+ArROw5Rkj6yEblZOBd Fj7WHLL0K5p1+5q2pATlgV/5nxnoIRBsc8DrW8rSXyoIniPA2fhKSLGKxLlnLml0wXJ0 Kt4LIgWznsnnN2Oo7k5MrqBAhPq3k7zQ3YNyAGvbv6wIp2mb9u6sDZWpkPrdcbZ8nHEz MA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4ts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:36 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9Za31003820 for ; Thu, 12 May 2022 09:35:36 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XbsJ023831; Thu, 12 May 2022 09:35:34 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 3fwgd8xrxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZWxb44630408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2239A11C04A; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4F3711C04C; Thu, 12 May 2022 09:35:31 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:31 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 09/28] s390x: pfmf: Initialize pfmf_r1 union on declaration Date: Thu, 12 May 2022 11:35:04 +0200 Message-Id: <20220512093523.36132-10-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hxoSsPbsK-d_bEglvuotcYYVlikzek54 X-Proofpoint-GUID: njI6lMFvEkvTPcTYzpDG7y4XXMLoAUgU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Let's make this test look a bit nicer. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- s390x/pfmf.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/s390x/pfmf.c b/s390x/pfmf.c index aa130529..178abb5a 100644 --- a/s390x/pfmf.c +++ b/s390x/pfmf.c @@ -28,7 +28,11 @@ static void test_priv(void) static void test_4k_key(void) { - union pfmf_r1 r1; + union pfmf_r1 r1 = { + .reg.sk = 1, + .reg.fsc = PFMF_FSC_4K, + .reg.key = 0x30, + }; union skey skey; report_prefix_push("4K"); @@ -36,10 +40,6 @@ static void test_4k_key(void) report_skip("storage key removal facility is active"); goto out; } - r1.val = 0; - r1.reg.sk = 1; - r1.reg.fsc = PFMF_FSC_4K; - r1.reg.key = 0x30; pfmf(r1.val, pagebuf); skey.val = get_storage_key(pagebuf); skey.val &= SKEY_ACC | SKEY_FP; @@ -52,18 +52,19 @@ static void test_1m_key(void) { int i; bool rp = true; - union pfmf_r1 r1; union skey skey; + union pfmf_r1 r1 = { + .reg.fsc = PFMF_FSC_1M, + .reg.key = 0x30, + .reg.sk = 1, + }; report_prefix_push("1M"); if (test_facility(169)) { report_skip("storage key removal facility is active"); goto out; } - r1.val = 0; - r1.reg.sk = 1; - r1.reg.fsc = PFMF_FSC_1M; - r1.reg.key = 0x30; + pfmf(r1.val, pagebuf); for (i = 0; i < 256; i++) { skey.val = get_storage_key(pagebuf + i * PAGE_SIZE); @@ -80,11 +81,10 @@ out: static void test_4k_clear(void) { - union pfmf_r1 r1; - - r1.val = 0; - r1.reg.cf = 1; - r1.reg.fsc = PFMF_FSC_4K; + union pfmf_r1 r1 = { + .reg.cf = 1, + .reg.fsc = PFMF_FSC_4K, + }; report_prefix_push("4K"); memset(pagebuf, 42, PAGE_SIZE); @@ -97,13 +97,12 @@ static void test_4k_clear(void) static void test_1m_clear(void) { int i; - union pfmf_r1 r1; + union pfmf_r1 r1 = { + .reg.cf = 1, + .reg.fsc = PFMF_FSC_1M, + }; unsigned long sum = 0; - r1.val = 0; - r1.reg.cf = 1; - r1.reg.fsc = PFMF_FSC_1M; - report_prefix_push("1M"); memset(pagebuf, 42, PAGE_SIZE * 256); pfmf(r1.val, pagebuf); From patchwork Thu May 12 09:35:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847455 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 757CFC433EF for ; Thu, 12 May 2022 09:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352052AbiELJgW (ORCPT ); Thu, 12 May 2022 05:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352036AbiELJfj (ORCPT ); Thu, 12 May 2022 05:35:39 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27BD469B7C for ; Thu, 12 May 2022 02:35:38 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9FM7J021301 for ; Thu, 12 May 2022 09:35:37 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 : mime-version : content-transfer-encoding; s=pp1; bh=Yfj2xwdUzOmOiVT5LK5MFFrMVuZrd91sSVqc1+lKy70=; b=f9+ZUfg8QcRC03jGmH87GjkHLgVfJ21UlJ8p03HgpkV3Hwt5M2eGEeLfLAL5kkN7mJpY xj4jyouvcPo6NADEd8lT+Y9uH4g9GU9bn9VAbP6/HD29RuDRYIHEyP2Ixc7W70KrMZel CwfJnQaDAl7phLhZzESZq+MZUslqdliVWw2kamD9Pv6lOZ+ZnnsJeE1m37pkEtDj5kmD pyy4yDzCcv+qC7+ajsk/j3n+a+VzL6ojz0pzGiALVQvHRTHJqO7vkTTLWkyJ0rBKETUC 1NGp9m74eeLbgUgLSjY0Ff2Z1u0Q7Ck17GojwIxNRrSAs16FICyeCB1sTcgHaj2IaBIo 9Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbca-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:37 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9VvjT032151 for ; Thu, 12 May 2022 09:35:37 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbbf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:37 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XWCc008194; Thu, 12 May 2022 09:35:34 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3fwgd8wa01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:34 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZWcK44630412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7572C11C04A; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 354D111C04C; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:32 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 10/28] s390x: snippets: asm: Add license and copyright headers Date: Thu, 12 May 2022 11:35:05 +0200 Message-Id: <20220512093523.36132-11-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: EOdj_8y4dHo5raWxEjdmTW5q2xWAdvkA X-Proofpoint-GUID: SOBT3oYCneIwRE5e8unJIaRFlEOKVMbS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Time for some cleanup of the snippets to make them look like any other test file. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/snippets/asm/snippet-pv-diag-288.S | 9 +++++++++ s390x/snippets/asm/snippet-pv-diag-500.S | 9 +++++++++ s390x/snippets/asm/snippet-pv-diag-yield.S | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/s390x/snippets/asm/snippet-pv-diag-288.S b/s390x/snippets/asm/snippet-pv-diag-288.S index e3e63121..aaee3cd1 100644 --- a/s390x/snippets/asm/snippet-pv-diag-288.S +++ b/s390x/snippets/asm/snippet-pv-diag-288.S @@ -1,3 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Diagnose 0x288 snippet used for PV interception testing. + * + * Copyright (c) 2021 IBM Corp + * + * Authors: + * Janosch Frank + */ #include .section .text diff --git a/s390x/snippets/asm/snippet-pv-diag-500.S b/s390x/snippets/asm/snippet-pv-diag-500.S index 50c06779..8dd66bd9 100644 --- a/s390x/snippets/asm/snippet-pv-diag-500.S +++ b/s390x/snippets/asm/snippet-pv-diag-500.S @@ -1,3 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Diagnose 0x500 snippet used for PV interception tests + * + * Copyright (c) 2021 IBM Corp + * + * Authors: + * Janosch Frank + */ #include .section .text diff --git a/s390x/snippets/asm/snippet-pv-diag-yield.S b/s390x/snippets/asm/snippet-pv-diag-yield.S index 5795cf0f..78a5b07a 100644 --- a/s390x/snippets/asm/snippet-pv-diag-yield.S +++ b/s390x/snippets/asm/snippet-pv-diag-yield.S @@ -1,3 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Diagnose 0x44 and 0x9c snippet used for PV interception tests + * + * Copyright (c) 2021 IBM Corp + * + * Authors: + * Janosch Frank + */ .section .text xgr %r0, %r0 From patchwork Thu May 12 09:35:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847445 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 39646C433F5 for ; Thu, 12 May 2022 09:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352115AbiELJgR (ORCPT ); Thu, 12 May 2022 05:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352041AbiELJfk (ORCPT ); Thu, 12 May 2022 05:35:40 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97D8869CD9 for ; Thu, 12 May 2022 02:35:38 -0700 (PDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C8t4SX011337 for ; Thu, 12 May 2022 09:35:37 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 : mime-version : content-transfer-encoding; s=pp1; bh=TyqXc33YrXcA4m6DBtjWhIbzUE9MR+2F9y09WNSx87k=; b=R+6KBOY9mM+x5OnBIUVdujp5E2kgsOI/tREFO4qYWIiDzGWO/7bD2TFcLbAOka/iQI8M 10f/GoX0qc1toZrWqmMB8D5Ji++Ln9CPTVV9YITJeZarSfzpHf4P7fGKdAo0/HD/2iBl qzG9jjDMNAhtI+74flBWelIjfUtKgPQTfxAmvrh32WIm1F7J5MXrqv3Pn2TKbd27WM5p 1PUCCKvPw8jJGbT3LqHAP7tgWhGIrXgJYi2MQnLiUwd7/T1lUNP7hYyixbV71YuZpXCO 04nkMgrZHMgwBh9aQ5eFKv4QfPdrVpdfOAO7cWvUOT1G8ndaPaO1XQtk7ig3qCpbI1lA ZA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538wy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:37 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C8uZkD022723 for ; Thu, 12 May 2022 09:35:37 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538wx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:37 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XHuv027307; Thu, 12 May 2022 09:35:35 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 3g0kn78ne2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:35 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZWch33816958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D42F411C04A; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 895FF11C050; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:32 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 11/28] s390x: pv-diags: Cleanup includes Date: Thu, 12 May 2022 11:35:06 +0200 Message-Id: <20220512093523.36132-12-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: qP-wij4jMyJclkL50hNM2wFGfaFz4B3n X-Proofpoint-ORIG-GUID: qwdu38nkIUgpzTTevxAQTadN2U4t08nz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxlogscore=862 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 clxscore=1015 mlxscore=0 adultscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank This file has way too much includes. Time to remove some. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- s390x/pv-diags.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c index 6899b859..9ced68c7 100644 --- a/s390x/pv-diags.c +++ b/s390x/pv-diags.c @@ -8,23 +8,10 @@ * Janosch Frank */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include +#include +#include static struct vm vm; From patchwork Thu May 12 09:35:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847444 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 014C1C433FE for ; Thu, 12 May 2022 09:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352098AbiELJgP (ORCPT ); Thu, 12 May 2022 05:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352022AbiELJfn (ORCPT ); Thu, 12 May 2022 05:35:43 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF56C69CDC for ; Thu, 12 May 2022 02:35:38 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9BuLD012831 for ; Thu, 12 May 2022 09:35:38 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 : mime-version : content-transfer-encoding; s=pp1; bh=KTevLoHcs1AqBpW02odPnDHC0fejpSjKufbbTfTsw28=; b=o2POjDi/PehykDxCboEtXy5xOa0nS3D/KO8Z2UUUQ+ExPjlsvcntLFICWUUXJSWKv8r0 dc21Ar1Wpa9ditCGRASdkEk9ZSr/8ywXy78MQ5TeJnEWGWfMw2D5CEQBjstUfYkAHmpH TGw+/hVDeIqa15mzpN5bDOKP/3LeV+SgC0x5mEWu/NnPcvGFhbWAdOJi1lX+5zaOUYNX 8gIuQmmmtTHlzUyB9dbZHm6Wa1ve5by2IAgM2GpKknzP3dEhTEMS4FIA0lfMJiCrOXBp mVZL64B7mxtINpOHWYoFBC75ev30RJey5rd9bLTDNZ2zsmas283vIMvCIpPB6wYXYLdi pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd1re5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:38 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9CGhd013883 for ; Thu, 12 May 2022 09:35:37 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 3g0yd1re4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:37 +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 24C9XKoo011752; Thu, 12 May 2022 09:35:35 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 3fyrkk2n8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:35 +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 24C9ZX8H23265548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:33 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B95811C054; Thu, 12 May 2022 09:35:33 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E76AF11C04C; Thu, 12 May 2022 09:35:32 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:32 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 12/28] s390x: css: Cleanup includes Date: Thu, 12 May 2022 11:35:07 +0200 Message-Id: <20220512093523.36132-13-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hLz32uIARqO2GrXlvKMcwMn620-9h68i X-Proofpoint-GUID: Z3toenGe_nG6sTBXyoa1gcjh3ITnk9LH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 mlxlogscore=846 lowpriorityscore=0 impostorscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Most includes were related to allocation but that's done in the io allocation library so having them in the test doesn't make sense. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/css.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/s390x/css.c b/s390x/css.c index 13a1509f..fabe5237 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -9,17 +9,14 @@ */ #include -#include -#include -#include #include -#include -#include #include +#include +#include + #include #include -#include #define DEFAULT_CU_TYPE 0x3832 /* virtio-ccw */ static unsigned long cu_type = DEFAULT_CU_TYPE; From patchwork Thu May 12 09:35:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847442 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 D3C93C4332F for ; Thu, 12 May 2022 09:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352178AbiELJgN (ORCPT ); Thu, 12 May 2022 05:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352047AbiELJfo (ORCPT ); Thu, 12 May 2022 05:35:44 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6A22BD for ; Thu, 12 May 2022 02:35:39 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C98ZpQ001344 for ; Thu, 12 May 2022 09:35:38 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 : mime-version : content-transfer-encoding; s=pp1; bh=V8NzF3GK4W3SmfiVsizIYHdUGMa3FwTwQTDEz3/a/aY=; b=PPQO5v0zTKLxqG8hdNL0Ze54BhK4UjDAIYOWbtDB2ugW87sYYOTDOZGBUjqOlrTJSJ+7 xlCePAUNAOFxWslgL1gbQxWEYHNbU01CKitC8aqnZFHAITWPN4+8kDJTP9QbNgHE08IG z1dETe9zA0LE+px75XOPS0O/bo2AOdkFc4hBF5IAlTC4GWQWAu0Sz3hpqRHL0t+Rw4Oy JNsAzgK1H+S9UX7e09oWbmBFQAhVK9E2d5yIUitrFruYEJmyz5LAqUFIOCxdvV+HvVum SzCbFg/uaICCjeHK32GvtUowsaCKpu4rNEPsKVxCMXlzG4IiKihhn94f7NFLXyv2SMGu ew== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y7n0juk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:38 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9ZbiO009723 for ; Thu, 12 May 2022 09:35:37 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y7n0jtp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:37 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9Wisc001647; Thu, 12 May 2022 09:35:36 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 3fwgd8w8x7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +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 24C9ZXSa48562600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:33 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B0A811C05B; Thu, 12 May 2022 09:35:33 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F73E11C04C; Thu, 12 May 2022 09:35:33 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:33 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 13/28] s390x: iep: Cleanup includes Date: Thu, 12 May 2022 11:35:08 +0200 Message-Id: <20220512093523.36132-14-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uaSBDb5kD0q6j9xyn_CPnke77oKAk-a3 X-Proofpoint-GUID: 6BONleMFzap5_pqMRXairQCexyEVJoYa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 mlxscore=0 phishscore=0 impostorscore=0 mlxlogscore=753 bulkscore=0 clxscore=1015 spamscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank We don't use barriers so let's remove the include. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/iep.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/s390x/iep.c b/s390x/iep.c index 8d5e044b..4b3e09a7 100644 --- a/s390x/iep.c +++ b/s390x/iep.c @@ -9,11 +9,10 @@ */ #include #include +#include #include #include -#include #include -#include static void test_iep(void) { From patchwork Thu May 12 09:35:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847446 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 1E392C433EF for ; Thu, 12 May 2022 09:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352123AbiELJgS (ORCPT ); Thu, 12 May 2022 05:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352051AbiELJfo (ORCPT ); Thu, 12 May 2022 05:35:44 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D21A316 for ; Thu, 12 May 2022 02:35:40 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9CLIA026334 for ; Thu, 12 May 2022 09:35:39 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 : mime-version : content-transfer-encoding; s=pp1; bh=Q34mjb+B6KvNisQvKbGLZ41+ubKpv7kFDZukJ5Km2LA=; b=e1iPttiyOj79HahmZ6hQ2l3IopYx9W8tJjSEQDN+MemYVTNbBt2Pv7MlWbzUc++zWLNg 8qQoP1/nfmSkRgZGuqmYUKlY5v8J7+Z1KyxET7pKdG3i6W5hBUwc8+3FQP55bHMi5Wfu GsmboIw03HBpT9fwmpyr+brha83FiyuxDAaY4/EBZaF6dxFpgHDSvvNcSxg/F8Wdu4Fk Z1a3Rs3ITFXN0cYrqf8cBb8gtMiXK/fTSTejxL7jpQ3gT2WtJtLhW/vYDYwEiLd2DT7u TR/rTzVgKERHz6no/u/7sLUpPC+D8/E3RuZjr3xu10tAuSSn1wIJkXu9UtviLL3RR/JP Ag== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd50e0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:39 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9E9Ll006966 for ; Thu, 12 May 2022 09:35:39 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd50dyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:38 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XZEj007509; Thu, 12 May 2022 09:35:36 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 3fwgd8n98m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:36 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZYlL21299540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00C4911C052; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD66711C050; Thu, 12 May 2022 09:35:33 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:33 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 14/28] s390x: mvpg: Cleanup includes Date: Thu, 12 May 2022 11:35:09 +0200 Message-Id: <20220512093523.36132-15-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Lbz8ktEz1nObBG3EQ101JvIudMcrz6Ot X-Proofpoint-ORIG-GUID: 9JpmQRhPV_KYsXMwGYosScLMMSDU5PcQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxlogscore=664 mlxscore=0 spamscore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Time to remove unneeded includes. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/mvpg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/s390x/mvpg.c b/s390x/mvpg.c index 62f0fc5a..04e5218f 100644 --- a/s390x/mvpg.c +++ b/s390x/mvpg.c @@ -9,15 +9,12 @@ */ #include #include -#include #include #include #include #include #include #include -#include -#include #include #include #include From patchwork Thu May 12 09:35:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847456 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 B331BC433F5 for ; Thu, 12 May 2022 09:36:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352118AbiELJgY (ORCPT ); Thu, 12 May 2022 05:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352044AbiELJfq (ORCPT ); Thu, 12 May 2022 05:35:46 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D209BBE27 for ; Thu, 12 May 2022 02:35:41 -0700 (PDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C8t3Ls011307 for ; Thu, 12 May 2022 09:35:40 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 : mime-version : content-transfer-encoding; s=pp1; bh=90DiMYBnDTMjO3aonwxceUe/pbzCd9buffgC2GEUm2A=; b=jkydCRJEeZ8ZgKm4qsVD+D96p5C/4q1TETFAuVt4A2/DIZxNZgQe4nHVYTjlVge3MFX4 gn1Ua1mGXniLx+tZw6OMMIq6Xg6aIULlky4wXN/pvlTvo9h8diqckpZ8LP3a323a9usr shT+dn7zgeENZMn306/xrSGRN9b2zZF+2pKD1j4Aww/NM1O8okqY4llVRJxVXwyTvySh p3Paz+XjQvwuAf+coQINylmbwlD1IBDYX6n85G4tN/dHObj0h6hWyXOsovnk57lRiAQM zQeLTx+/GY32z9kqGe7USEfgT9igvxSPYaRTeM/+Opf6rlOmMa421a1e2t0K12hFSVCO 3Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538x0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:40 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C8utRA023976 for ; Thu, 12 May 2022 09:35:40 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538wyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9Wgw9020399; Thu, 12 May 2022 09:35:38 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd8xs9b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:37 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZY6Z42205534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6434811C052; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13DB811C054; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:34 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 15/28] s390x: uv-host: Fix pgm tests Date: Thu, 12 May 2022 11:35:10 +0200 Message-Id: <20220512093523.36132-16-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: umKNzYZCQiUxb48rKzORfGEX16Ggz03H X-Proofpoint-ORIG-GUID: JG4voitw3xP_6W-LABk24i_w92IXpLpN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 clxscore=1015 mlxscore=0 adultscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank We don't want to re-enter the UV call on a cc > 1 for this test. Signed-off-by: Janosch Frank Reviewed-by: Nico Boehr Signed-off-by: Claudio Imbrenda --- s390x/uv-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index d3018e3c..5ac8a32c 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -76,7 +76,7 @@ static void test_priv(void) uvcb.cmd = cmds[i].cmd; uvcb.len = cmds[i].len; enter_pstate(); - uv_call(0, (uint64_t)&uvcb); + uv_call_once(0, (uint64_t)&uvcb); pgm = clear_pgm_int(); report(pgm == PGM_INT_CODE_PRIVILEGED_OPERATION, "%s", cmds[i].name); } From patchwork Thu May 12 09:35:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847461 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 BF5E7C433EF for ; Thu, 12 May 2022 09:36:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352124AbiELJgg (ORCPT ); Thu, 12 May 2022 05:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352085AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A4517AB9 for ; Thu, 12 May 2022 02:35:42 -0700 (PDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9EGGY021281 for ; Thu, 12 May 2022 09:35:41 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 : mime-version : content-transfer-encoding; s=pp1; bh=5/3WX2D41W/xLfqnorsHMfmxmTckXuLHYMuJLkJII/o=; b=HA7AEQux9CxyvCR95lFww4+If1wd4UKY+phvm0/K9oFz4BEIsb7d9LCBC5CjmPDZvpgH KvyaycrEMS6Bdi0Xv4Wc06hqy7Ab0kOqaijwsilgDCGTqvbNqmE3wMzyFH2itTTgwsPz tCTauCep4kgkxLYl7RP0HiT4BNd8bjuj+uDlPkOqyP2z5TPPuWdSpyPYyUZS7HfisLpr 5+5yz8+dHt54r6EVBZbW6KUXC3fMrT1zqJePyGL49gl9vmNC7NQhk9tQLjpU1Jt4O5sG Ru/mDhcjf95vMmJ9AGHlEWkB/oMxKDiMpA25O+o5fykcmx5Hj3FIt7ysUuP09r7b9jcW Kw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0ye28cx6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:40 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9SYDd013089 for ; Thu, 12 May 2022 09:35:40 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0ye28cwd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:40 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XUIE009769; Thu, 12 May 2022 09:35:38 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 3fwg1hw8yq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:38 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZYvG42205540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1DF711C04A; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7876411C05C; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:34 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 16/28] lib: s390x: add support for SCLP console read Date: Thu, 12 May 2022 11:35:11 +0200 Message-Id: <20220512093523.36132-17-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: YmNj9jzA_wmaILav5Dc_Df-12pfoqbr5 X-Proofpoint-GUID: hBtdgvxghYLjsA1uBI2fQHuXnpUMRKAy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 mlxscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Add a basic implementation for reading from the SCLP ASCII console. The goal of this is to support migration tests on s390x. To know when the migration has been finished, we need to listen for a newline on our console. Hence, this implementation is focused on the SCLP ASCII console of QEMU and currently won't work under e.g. LPAR. Signed-off-by: Nico Boehr Reviewed-by: Thomas Huth Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/Makefile | 1 + lib/s390x/sclp.h | 8 ++++ lib/s390x/sclp-console.c | 79 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 82 insertions(+), 6 deletions(-) diff --git a/s390x/Makefile b/s390x/Makefile index c11f6efb..f38f442b 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -75,6 +75,7 @@ cflatobjs += lib/alloc_phys.o cflatobjs += lib/alloc_page.o cflatobjs += lib/vmalloc.o cflatobjs += lib/alloc_phys.o +cflatobjs += lib/getchar.o cflatobjs += lib/s390x/io.o cflatobjs += lib/s390x/stack.o cflatobjs += lib/s390x/sclp.o diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h index fead007a..e48a5a3d 100644 --- a/lib/s390x/sclp.h +++ b/lib/s390x/sclp.h @@ -313,6 +313,14 @@ typedef struct ReadEventData { uint32_t mask; } __attribute__((packed)) ReadEventData; +#define SCLP_EVENT_ASCII_TYPE_DATA_STREAM_FOLLOWS 0 +typedef struct ReadEventDataAsciiConsole { + SCCBHeader h; + EventBufferHeader ebh; + uint8_t type; + char data[]; +} __attribute__((packed)) ReadEventDataAsciiConsole; + extern char _sccb[]; void sclp_setup_int(void); void sclp_handle_ext(void); diff --git a/lib/s390x/sclp-console.c b/lib/s390x/sclp-console.c index fa36a6a4..19c74e46 100644 --- a/lib/s390x/sclp-console.c +++ b/lib/s390x/sclp-console.c @@ -89,6 +89,10 @@ static char lm_buff[120]; static unsigned char lm_buff_off; static struct spinlock lm_buff_lock; +static char read_buf[4096]; +static int read_index = sizeof(read_buf) - 1; +static int read_buf_length = 0; + static void sclp_print_ascii(const char *str) { int len = strlen(str); @@ -185,7 +189,7 @@ static void sclp_print_lm(const char *str) * indicating which messages the control program (we) want(s) to * send/receive. */ -static void sclp_set_write_mask(void) +static void sclp_write_event_mask(int receive_mask, int send_mask) { WriteEventMask *sccb = (void *)_sccb; @@ -195,18 +199,27 @@ static void sclp_set_write_mask(void) sccb->h.function_code = SCLP_FC_NORMAL_WRITE; sccb->mask_length = sizeof(sccb_mask_t); - /* For now we don't process sclp input. */ - sccb->cp_receive_mask = 0; - /* We send ASCII and line mode. */ - sccb->cp_send_mask = SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG; + sccb->cp_receive_mask = receive_mask; + sccb->cp_send_mask = send_mask; sclp_service_call(SCLP_CMD_WRITE_EVENT_MASK, sccb); assert(sccb->h.response_code == SCLP_RC_NORMAL_COMPLETION); } +static void sclp_console_enable_read(void) +{ + sclp_write_event_mask(SCLP_EVENT_MASK_MSG_ASCII, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG); +} + +static void sclp_console_disable_read(void) +{ + sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG); +} + void sclp_console_setup(void) { - sclp_set_write_mask(); + /* We send ASCII and line mode. */ + sclp_write_event_mask(0, SCLP_EVENT_MASK_MSG_ASCII | SCLP_EVENT_MASK_MSG); } void sclp_print(const char *str) @@ -227,3 +240,57 @@ void sclp_print(const char *str) sclp_print_ascii(str); sclp_print_lm(str); } + +static int console_refill_read_buffer(void) +{ + const int max_event_buffer_len = SCCB_SIZE - offsetof(ReadEventDataAsciiConsole, ebh); + ReadEventDataAsciiConsole *sccb = (void *)_sccb; + const int event_buffer_ascii_recv_header_len = sizeof(sccb->ebh) + sizeof(sccb->type); + int ret = -1; + + sclp_console_enable_read(); + + sclp_mark_busy(); + memset(sccb, 0, SCCB_SIZE); + sccb->h.length = PAGE_SIZE; + sccb->h.function_code = SCLP_UNCONDITIONAL_READ; + sccb->h.control_mask[2] = SCLP_CM2_VARIABLE_LENGTH_RESPONSE; + + sclp_service_call(SCLP_CMD_READ_EVENT_DATA, sccb); + + if (sccb->h.response_code == SCLP_RC_NO_EVENT_BUFFERS_STORED || + sccb->ebh.type != SCLP_EVENT_ASCII_CONSOLE_DATA || + sccb->type != SCLP_EVENT_ASCII_TYPE_DATA_STREAM_FOLLOWS) { + ret = -1; + goto out; + } + + assert(sccb->ebh.length <= max_event_buffer_len); + assert(sccb->ebh.length > event_buffer_ascii_recv_header_len); + + read_buf_length = sccb->ebh.length - event_buffer_ascii_recv_header_len; + + assert(read_buf_length <= sizeof(read_buf)); + memcpy(read_buf, sccb->data, read_buf_length); + + read_index = 0; + ret = 0; + +out: + sclp_console_disable_read(); + + return ret; +} + +int __getchar(void) +{ + int ret; + + if (read_index >= read_buf_length) { + ret = console_refill_read_buffer(); + if (ret < 0) + return ret; + } + + return read_buf[read_index++]; +} From patchwork Thu May 12 09:35:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847457 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 6CEF0C433FE for ; Thu, 12 May 2022 09:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352107AbiELJg0 (ORCPT ); Thu, 12 May 2022 05:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352083AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1D41CFEE for ; Thu, 12 May 2022 02:35:42 -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 24C9LO59008325 for ; Thu, 12 May 2022 09:35:41 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 : mime-version : content-transfer-encoding; s=pp1; bh=hWDhDe5h0HzkCk3klfCR1lFAZ07m8kpKVuIJJjysHIU=; b=YhxH1EcEgPet7jqIIvuTNtppVMNoIu5732dqeY9k3k33M3avU71MU5EjWYO09NlbsrNG rmh8V9ZkWikuUgL1AGNgYQTRZXpe2/uGguGNEZeNHWJturmTxqKG6PbbjVM70MQURWEQ q5TXDCpnnQISqOyyau+I63WAN2kNCcHrJ4/n5SPFTpc/OI7GtLxDyWLaxlWk2ruyEYAA FUXWjfazaaOQZ4NfSBRStW6RKJh2DcIqUwVUvIAW4t51Q+I3WxHWQRo8KLTqvMJvnCqd 9Eplx42E38ufsHglJcMOz3tevA5Li9aL9jIpOO9HD5PEoM4jpZIidOIl+w7Re9DNCvUm 8g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yhh87xe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:41 +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 24C9ZefT019536 for ; Thu, 12 May 2022 09:35:40 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 3g0yhh87wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:40 +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 24C9XMrl011803; Thu, 12 May 2022 09:35:39 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 3fyrkk2n8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9Lvdl49414522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:21:57 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32CE611C052; Thu, 12 May 2022 09:35:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D5AFC11C04C; Thu, 12 May 2022 09:35:34 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:34 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 17/28] s390x: add support for migration tests Date: Thu, 12 May 2022 11:35:12 +0200 Message-Id: <20220512093523.36132-18-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: G_k2qzHAOKHEwBzUeQSA3R6ZjAuXeKsh X-Proofpoint-ORIG-GUID: A6vqJX6b_lskiGuVxTl-qJXMsblliXSr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Now that we have SCLP console read support, run our tests with migration_cmd, so we can get migration support on s390x. Signed-off-by: Nico Boehr Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- s390x/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/run b/s390x/run index 064ecd1b..2bcdabba 100755 --- a/s390x/run +++ b/s390x/run @@ -25,7 +25,7 @@ M+=",accel=$ACCEL" command="$qemu -nodefaults -nographic $M" command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0" command+=" -kernel" -command="$(timeout_cmd) $command" +command="$(migration_cmd) $(timeout_cmd) $command" # We return the exit code via stdout, not via the QEMU return code run_qemu_status $command "$@" From patchwork Thu May 12 09:35:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847459 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 C6E5AC433F5 for ; Thu, 12 May 2022 09:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352131AbiELJg1 (ORCPT ); Thu, 12 May 2022 05:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352092AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C94821260 for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C8pT1H030577 for ; Thu, 12 May 2022 09:35:42 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 : mime-version : content-transfer-encoding; s=pp1; bh=s5OOIJLPaqiWzPJBzXiF04VKqQzACmsxIroRAPG62Po=; b=LTyq6Qf5lTMNq6hsd1ann7ZRmv8Xeuc1CDiej7p6xpulO+iRdpt0T0aCFG9EnwgMGHHM M7xVwibyKXXzpX+KAu2NUp0fyV8SAnAu+bPXlME8bKsZFFYnlFrs8rP7bQS5WVmpi+pp l38os9SOBFjnRNZyQ271Hd/VKtlsriJfhqQIcBbVchE1z4yAViJZtfZq9DPMSss46FJV CbGCkLMXQ9irRt1RFN3ziy+6+oPgfDaNDWXEnQErw6qwi7qhdv++O7oUlZOZEIJc2SmY 6Xm9o1QkiAMafBgLt2+ZzGgBFUfCsv1yuM56lw43OuWc8KkiW62cT9yhtQ3fIAZ8fLM/ GQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y3kh0d8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:42 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C8re9M037384 for ; Thu, 12 May 2022 09:35:42 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y3kh0ck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9WeD2001628; Thu, 12 May 2022 09:35:39 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma02fra.de.ibm.com with ESMTP id 3fwgd8w8xd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9LvT453936532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:21:57 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C69711C05B; Thu, 12 May 2022 09:35:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 452DE11C04A; Thu, 12 May 2022 09:35:35 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:35 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 18/28] s390x: don't run migration tests under PV Date: Thu, 12 May 2022 11:35:13 +0200 Message-Id: <20220512093523.36132-19-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: TAQQwnQTjBdZtfAD15zNjaYnqzvtUbFm X-Proofpoint-GUID: LrJXhI023hWOLUFKQFqJoXBmrrFDwzri X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 adultscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr PV doesn't support migration, so don't run the migration tests there. Signed-off-by: Nico Boehr Reviewed-by: Claudio Imbrenda Acked-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- scripts/s390x/func.bash | 2 +- s390x/run | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash index bf799a56..2a941bbb 100644 --- a/scripts/s390x/func.bash +++ b/scripts/s390x/func.bash @@ -21,7 +21,7 @@ function arch_cmd_s390x() "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" # run PV test case - if [ "$ACCEL" = 'tcg' ]; then + if [ "$ACCEL" = 'tcg' ] || find_word "migration" "$groups"; then return fi kernel=${kernel%.elf}.pv.bin diff --git a/s390x/run b/s390x/run index 2bcdabba..24138f68 100755 --- a/s390x/run +++ b/s390x/run @@ -20,6 +20,11 @@ if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$ACCEL" = " exit 2 fi +if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$MIGRATION" = "yes" ]; then + echo "Migration isn't supported under Protected Virtualization" + exit 2 +fi + M='-machine s390-ccw-virtio' M+=",accel=$ACCEL" command="$qemu -nodefaults -nographic $M" From patchwork Thu May 12 09:35:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847460 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 61EC7C433EF for ; Thu, 12 May 2022 09:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352137AbiELJgb (ORCPT ); Thu, 12 May 2022 05:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352089AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C8D620F7F for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Q1uc003590 for ; Thu, 12 May 2022 09:35:41 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 : mime-version : content-transfer-encoding; s=pp1; bh=UOAUyO6Fp+ud5jJs5iSlFWhAzLz+nk2drL57xkZK6CE=; b=NK4TaLNepHcuPtr6JoDGgXTr04PcAg0kmBSiEd7P94I1va77g8Ut1qoKCCKOBl7+F/2C RmZQ4hfl62CTnG2bJofDGximNQ54P83EisrPBdU/FBl8XWcAkkAD82vFXSyMhEaL9Lbk gEiP4vcLyTFDF2eGiWt8kR6ddiRyhCl36YnpCakSBLqXoyyETq+GNxr8LUcBUPScNKCl G9cAHVR48eMWqtuQ5JKfvJooipsLzQcPrxIwO26QeAnLMz2Jfqperm79ZPgRoEd87XtC ORKAJmCsPz9UXY/x9SNFEJCuJi8ZEp57loVxESnJE2sqpp9VFdlUdYXVvXS2oC7W2LiE Dg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4vy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:41 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9RuvJ011345 for ; Thu, 12 May 2022 09:35:41 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4vd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XluQ010058; Thu, 12 May 2022 09:35:39 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 3g0ma1gm36-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZamQ50266550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EDD4B11C052; Thu, 12 May 2022 09:35:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0F6911C04C; Thu, 12 May 2022 09:35:35 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:35 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Nico Boehr Subject: [kvm-unit-tests GIT PULL 19/28] s390x: add basic migration test Date: Thu, 12 May 2022 11:35:14 +0200 Message-Id: <20220512093523.36132-20-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: E_leKoe7CocQPWPBdVqzjKZDnO8_Ul-Y X-Proofpoint-GUID: 5UITgBdITlJK25YwTLXObir7p9hS8hvD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nico Boehr Add a basic migration test for s390x. This tests the guarded-storage registers and vector registers are preserved on migration. Check for the respective facilities. Since it is possible neither guarded-storage nor vector are there, add an additional report_pass() such that least one PASS is reported. Signed-off-by: Nico Boehr Reviewed-by: Thomas Huth Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/Makefile | 1 + s390x/migration.c | 198 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 5 ++ 3 files changed, 204 insertions(+) create mode 100644 s390x/migration.c diff --git a/s390x/Makefile b/s390x/Makefile index f38f442b..5336ed8a 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -30,6 +30,7 @@ tests += $(TEST_DIR)/spec_ex-sie.elf tests += $(TEST_DIR)/firq.elf tests += $(TEST_DIR)/epsw.elf tests += $(TEST_DIR)/adtl-status.elf +tests += $(TEST_DIR)/migration.elf pv-tests += $(TEST_DIR)/pv-diags.elf diff --git a/s390x/migration.c b/s390x/migration.c new file mode 100644 index 00000000..a4529637 --- /dev/null +++ b/s390x/migration.c @@ -0,0 +1,198 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Migration Test for s390x + * + * Copyright IBM Corp. 2022 + * + * Authors: + * Nico Boehr + */ +#include +#include +#include +#include +#include +#include +#include +#include + +static struct gs_cb gs_cb; +static struct gs_epl gs_epl; + +/* set by CPU1 to signal it has completed */ +static int flag_thread_complete; +/* set by CPU0 to signal migration has completed */ +static int flag_migration_complete; + +static void write_gs_regs(void) +{ + const unsigned long gs_area = 0x2000000; + const unsigned long gsc = 25; /* align = 32 M, section size = 512K */ + + gs_cb.gsd = gs_area | gsc; + gs_cb.gssm = 0xfeedc0ffe; + gs_cb.gs_epl_a = (uint64_t) &gs_epl; + + load_gs_cb(&gs_cb); +} + +static void check_gs_regs(void) +{ + struct gs_cb gs_cb_after_migration; + + store_gs_cb(&gs_cb_after_migration); + + report_prefix_push("guarded-storage registers"); + + report(gs_cb_after_migration.gsd == gs_cb.gsd, "gsd matches"); + report(gs_cb_after_migration.gssm == gs_cb.gssm, "gssm matches"); + report(gs_cb_after_migration.gs_epl_a == gs_cb.gs_epl_a, "gs_epl_a matches"); + + report_prefix_pop(); +} + +static bool have_vector_facility(void) +{ + return test_facility(129); +} + +static bool have_guarded_storage_facility(void) +{ + return test_facility(133); +} + +static void test_func(void) +{ + uint8_t expected_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE]; + uint8_t actual_vec_contents[VEC_REGISTER_NUM][VEC_REGISTER_SIZE]; + uint8_t *vec_reg; + int i; + int vec_result = 0; + + if (have_guarded_storage_facility()) { + ctl_set_bit(2, CTL2_GUARDED_STORAGE); + + write_gs_regs(); + } + + if (have_vector_facility()) { + for (i = 0; i < VEC_REGISTER_NUM; i++) { + vec_reg = &expected_vec_contents[i][0]; + /* i+1 to avoid zero content */ + memset(vec_reg, i + 1, VEC_REGISTER_SIZE); + } + + ctl_set_bit(0, CTL0_VECTOR); + + /* + * It is important loading the vector/floating point registers and + * comparing their contents occurs in the same inline assembly block. + * Otherwise, the compiler is allowed to re-use the registers for + * something else in between. + * For this very reason, this also runs on a second CPU, so all the + * complex console stuff can be done in C on the first CPU and here we + * just need to wait for it to set the flag. + */ + asm inline( + " .machine z13\n" + /* load vector registers: vlm handles at most 16 registers at a time */ + " vlm 0,15, 0(%[expected_vec_reg])\n" + " vlm 16,31, 256(%[expected_vec_reg])\n" + /* inform CPU0 we are done, it will request migration */ + " mvhi %[flag_thread_complete], 1\n" + /* wait for migration to finish */ + "0: clfhsi %[flag_migration_complete], 1\n" + " jnz 0b\n" + /* + * store vector register contents in actual_vec_reg: vstm + * handles at most 16 registers at a time + */ + " vstm 0,15, 0(%[actual_vec_reg])\n" + " vstm 16,31, 256(%[actual_vec_reg])\n" + /* + * compare the contents in expected_vec_reg with actual_vec_reg: + * clc handles at most 256 bytes at a time + */ + " clc 0(256, %[expected_vec_reg]), 0(%[actual_vec_reg])\n" + " jnz 1f\n" + " clc 256(256, %[expected_vec_reg]), 256(%[actual_vec_reg])\n" + " jnz 1f\n" + /* success */ + " mvhi %[vec_result], 1\n" + "1:" + : + : [expected_vec_reg] "a"(expected_vec_contents), + [actual_vec_reg] "a"(actual_vec_contents), + [flag_thread_complete] "Q"(flag_thread_complete), + [flag_migration_complete] "Q"(flag_migration_complete), + [vec_result] "Q"(vec_result) + : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", + "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", + "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", + "v28", "v29", "v30", "v31", "cc", "memory" + ); + + report(vec_result, "vector contents match"); + + report(stctg(0) & BIT(CTL0_VECTOR), "ctl0 vector bit set"); + + ctl_clear_bit(0, CTL0_VECTOR); + } else { + flag_thread_complete = 1; + while(!flag_migration_complete) + mb(); + } + + report_pass("Migrated"); + + if (have_guarded_storage_facility()) { + check_gs_regs(); + + report(stctg(2) & BIT(CTL2_GUARDED_STORAGE), "ctl2 guarded-storage bit set"); + + ctl_clear_bit(2, CTL2_GUARDED_STORAGE); + } + + flag_thread_complete = 1; +} + +int main(void) +{ + struct psw psw; + + /* don't say migrate here otherwise we will migrate right away */ + report_prefix_push("migration"); + + if (smp_query_num_cpus() == 1) { + report_skip("need at least 2 cpus for this test"); + goto done; + } + + /* Second CPU does the actual tests */ + psw.mask = extract_psw_mask(); + psw.addr = (unsigned long)test_func; + smp_cpu_setup(1, psw); + + /* wait for thread setup */ + while(!flag_thread_complete) + mb(); + flag_thread_complete = 0; + + /* ask migrate_cmd to migrate (it listens for 'migrate') */ + puts("Please migrate me, then press return\n"); + + /* wait for migration to finish, we will read a newline */ + (void)getchar(); + + flag_migration_complete = 1; + + /* wait for thread to complete assertions */ + while(!flag_thread_complete) + mb(); + + smp_cpu_destroy(1); + +done: + report_prefix_pop(); + return report_summary(); +} diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 256c7169..b456b288 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -171,3 +171,8 @@ file = adtl-status.elf smp = 2 accel = tcg extra_params = -cpu qemu,gs=off,vx=off + +[migration] +file = migration.elf +groups = migration +smp = 2 From patchwork Thu May 12 09:35:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847458 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 95957C433EF for ; Thu, 12 May 2022 09:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352116AbiELJg0 (ORCPT ); Thu, 12 May 2022 05:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352086AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C4EF20F53 for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C930X8004634 for ; Thu, 12 May 2022 09:35:42 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 : mime-version : content-transfer-encoding; s=pp1; bh=v7CyvJgnd0MBYj/pjGJOC02zQHoblzJhg+iuDhsXeow=; b=J9mrPcl0OHir1k4F/55gido1fhqEIzlGVwqk+GLzxeotZ3RuIaM7ErCdNWASWk50m2S3 XtQy7FtDANHVnWJAItgbrPg8PA2HprWCGvDvThLqxNmBPAAyFFKz9YNS+Sj5x1jw+4sS G2H6d0hZ9DXJHM3+QGwBU4zFBxhfSQ067fJZGvw0xDJp1Y7AcXykuKidVovt1ljlIi/9 jawMYGMWyyJEOJh9+s2vNn3CDojup4Do/WPENGfaKPvCgbmJO2PfYM8oVW2mmHhBvJwZ pyFRnf9USrug2+N99ZMrzF5dYrjSBAZ3pAy9XlPh7IMIEdUkKcjqkTCAWhR4Y1G5VVk/ yA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y908pe1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:41 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9MKF9029011 for ; Thu, 12 May 2022 09:35:41 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y908pd9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9Wkv0001653; Thu, 12 May 2022 09:35:39 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma02fra.de.ibm.com with ESMTP id 3fwgd8w8xe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZamX50266552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54DC411C04C; Thu, 12 May 2022 09:35:36 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B8B211C04A; Thu, 12 May 2022 09:35:36 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:35 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Janis Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL 20/28] s390x: Give name to return value of tprot() Date: Thu, 12 May 2022 11:35:15 +0200 Message-Id: <20220512093523.36132-21-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QXq5jDTQK55XDKpmVYYBezZtVkBBYBH4 X-Proofpoint-ORIG-GUID: w6okSWAyYZsvZ-hXiXerhQE1VTAK9h9e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 mlxlogscore=602 bulkscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janis Schoetterl-Glausch Improve readability by making the return value of tprot() an enum. No functional change intended. Signed-off-by: Janis Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/arch_def.h | 11 +++++++++-- lib/s390x/sclp.c | 6 +++--- s390x/tprot.c | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index bab3c374..46c370e6 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -228,7 +228,14 @@ static inline uint64_t stidp(void) return cpuid; } -static inline int tprot(unsigned long addr, char access_key) +enum tprot_permission { + TPROT_READ_WRITE = 0, + TPROT_READ = 1, + TPROT_RW_PROTECTED = 2, + TPROT_TRANSL_UNAVAIL = 3, +}; + +static inline enum tprot_permission tprot(unsigned long addr, char access_key) { int cc; @@ -237,7 +244,7 @@ static inline int tprot(unsigned long addr, char access_key) " ipm %0\n" " srl %0,28\n" : "=d" (cc) : "a" (addr), "a" (access_key << 4) : "cc"); - return cc; + return (enum tprot_permission)cc; } static inline void lctlg(int cr, uint64_t value) diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 33985eb4..b8204c5f 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -198,7 +198,7 @@ int sclp_service_call(unsigned int command, void *sccb) void sclp_memory_setup(void) { uint64_t rnmax, rnsize; - int cc; + enum tprot_permission permission; assert(read_info); @@ -222,9 +222,9 @@ void sclp_memory_setup(void) /* probe for r/w memory up to max memory size */ while (ram_size < max_ram_size) { expect_pgm_int(); - cc = tprot(ram_size + storage_increment_size - 1, 0); + permission = tprot(ram_size + storage_increment_size - 1, 0); /* stop once we receive an exception or have protected memory */ - if (clear_pgm_int() || cc != 0) + if (clear_pgm_int() || permission != TPROT_READ_WRITE) break; ram_size += storage_increment_size; } diff --git a/s390x/tprot.c b/s390x/tprot.c index 760e7ecd..a4281abb 100644 --- a/s390x/tprot.c +++ b/s390x/tprot.c @@ -20,26 +20,26 @@ static uint8_t pagebuf[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); static void test_tprot_rw(void) { - int cc; + enum tprot_permission permission; report_prefix_push("Page read/writeable"); - cc = tprot((unsigned long)pagebuf, 0); - report(cc == 0, "CC = 0"); + permission = tprot((unsigned long)pagebuf, 0); + report(permission == TPROT_READ_WRITE, "CC = 0"); report_prefix_pop(); } static void test_tprot_ro(void) { - int cc; + enum tprot_permission permission; report_prefix_push("Page readonly"); protect_dat_entry(pagebuf, PAGE_ENTRY_P, 5); - cc = tprot((unsigned long)pagebuf, 0); - report(cc == 1, "CC = 1"); + permission = tprot((unsigned long)pagebuf, 0); + report(permission == TPROT_READ, "CC = 1"); unprotect_dat_entry(pagebuf, PAGE_ENTRY_P, 5); @@ -48,28 +48,28 @@ static void test_tprot_ro(void) static void test_tprot_low_addr_prot(void) { - int cc; + enum tprot_permission permission; report_prefix_push("low-address protection"); low_prot_enable(); - cc = tprot(0, 0); + permission = tprot(0, 0); low_prot_disable(); - report(cc == 1, "CC = 1"); + report(permission == TPROT_READ, "CC = 1"); report_prefix_pop(); } static void test_tprot_transl_unavail(void) { - int cc; + enum tprot_permission permission; report_prefix_push("Page translation unavailable"); protect_dat_entry(pagebuf, PAGE_ENTRY_I, 5); - cc = tprot((unsigned long)pagebuf, 0); - report(cc == 3, "CC = 3"); + permission = tprot((unsigned long)pagebuf, 0); + report(permission == TPROT_TRANSL_UNAVAIL, "CC = 3"); unprotect_dat_entry(pagebuf, PAGE_ENTRY_I, 5); From patchwork Thu May 12 09:35:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847469 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 4153BC433EF for ; Thu, 12 May 2022 09:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352157AbiELJhL (ORCPT ); Thu, 12 May 2022 05:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352099AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E97CF28 for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C8t5Co011345 for ; Thu, 12 May 2022 09:35:42 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 : mime-version : content-transfer-encoding; s=pp1; bh=fSuDyBw/OIzDmDjtCbO6lqYN2+/uhXlKfKqSGwAY2yg=; b=ceBbXltkdwKfvzmlycr8jbmk6C4/YDYepGe+LiuwmWxMnte5fnJgtScVy9YgL/QbMD9y 0vBUPKYecc5LOHhkPraoLzTafkABkAnRwWYVM+y0o4VNnJAIwvw0HRcsOHHR1cOdObaP eTJ688JZJ/9G4NK7MZtZUkur0j0/a8hhWbZXAoJRi2ZybJbeTn+z3esmvZ310uduAboJ uLDB/hLqBgEK8xxojW4W8P25hXyRsnNmryvkg5lYju01zLzNfXey2WeSknIa8ZnOy5eR 5QctDzdNqg/UUzbmVKgo/yKFbeppQN2nJHpnGo4Ey4Ra+DIneyh459sSrCelw9l4IjFl 4w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538x16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:42 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C8tcEc012759 for ; Thu, 12 May 2022 09:35:41 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538x0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XbuR010181; Thu, 12 May 2022 09:35:40 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06fra.de.ibm.com with ESMTP id 3fwg1hw8yu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:39 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9Zae119399118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B52C111C04C; Thu, 12 May 2022 09:35:36 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 68CB811C052; Thu, 12 May 2022 09:35:36 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:36 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Janis Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL 21/28] s390x: Test effect of storage keys on some instructions Date: Thu, 12 May 2022 11:35:16 +0200 Message-Id: <20220512093523.36132-22-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: H66Ycl00dm1rGt9q4ddYJEV1NA-F-9Hx X-Proofpoint-ORIG-GUID: ToHTIbRhFkM5QQ_MO0Cl4-izY9zPvcMt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxlogscore=844 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 clxscore=1015 mlxscore=0 adultscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janis Schoetterl-Glausch Some instructions are emulated by KVM. Test that KVM correctly emulates storage key checking for two of those instructions (STORE CPU ADDRESS, SET PREFIX). Test success and error conditions, including coverage of storage and fetch protection override. Also add test for TEST PROTECTION, even if that instruction will not be emulated by KVM under normal conditions. Signed-off-by: Janis Schoetterl-Glausch Acked-by: Thomas Huth Acked-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/arch_def.h | 20 ++-- s390x/skey.c | 249 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+), 9 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 46c370e6..72553819 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -55,15 +55,17 @@ struct psw { #define PSW_MASK_BA 0x0000000080000000UL #define PSW_MASK_64 (PSW_MASK_BA | PSW_MASK_EA) -#define CTL0_LOW_ADDR_PROT (63 - 35) -#define CTL0_EDAT (63 - 40) -#define CTL0_IEP (63 - 43) -#define CTL0_AFP (63 - 45) -#define CTL0_VECTOR (63 - 46) -#define CTL0_EMERGENCY_SIGNAL (63 - 49) -#define CTL0_EXTERNAL_CALL (63 - 50) -#define CTL0_CLOCK_COMPARATOR (63 - 52) -#define CTL0_SERVICE_SIGNAL (63 - 54) +#define CTL0_LOW_ADDR_PROT (63 - 35) +#define CTL0_EDAT (63 - 40) +#define CTL0_FETCH_PROTECTION_OVERRIDE (63 - 38) +#define CTL0_STORAGE_PROTECTION_OVERRIDE (63 - 39) +#define CTL0_IEP (63 - 43) +#define CTL0_AFP (63 - 45) +#define CTL0_VECTOR (63 - 46) +#define CTL0_EMERGENCY_SIGNAL (63 - 49) +#define CTL0_EXTERNAL_CALL (63 - 50) +#define CTL0_CLOCK_COMPARATOR (63 - 52) +#define CTL0_SERVICE_SIGNAL (63 - 54) #define CR0_EXTM_MASK 0x0000000000006200UL /* Combined external masks */ #define CTL2_GUARDED_STORAGE (63 - 59) diff --git a/s390x/skey.c b/s390x/skey.c index edad53e9..32bf1070 100644 --- a/s390x/skey.c +++ b/s390x/skey.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -118,6 +119,249 @@ static void test_invalid_address(void) report_prefix_pop(); } +static void test_test_protection(void) +{ + unsigned long addr = (unsigned long)pagebuf; + + report_prefix_push("TPROT"); + + set_storage_key(pagebuf, 0x10, 0); + report(tprot(addr, 0) == TPROT_READ_WRITE, "zero key: no protection"); + report(tprot(addr, 1) == TPROT_READ_WRITE, "matching key: no protection"); + + report_prefix_push("mismatching key"); + + report(tprot(addr, 2) == TPROT_READ, "no fetch protection: store protection"); + + set_storage_key(pagebuf, 0x18, 0); + report(tprot(addr, 2) == TPROT_RW_PROTECTED, + "fetch protection: fetch & store protection"); + + report_prefix_push("fetch-protection override"); + set_storage_key(0, 0x18, 0); + report(tprot(0, 2) == TPROT_RW_PROTECTED, "disabled: fetch & store protection"); + ctl_set_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE); + report(tprot(0, 2) == TPROT_READ, "enabled: store protection"); + report(tprot(2048, 2) == TPROT_RW_PROTECTED, "invalid: fetch & store protection"); + ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE); + set_storage_key(0, 0x00, 0); + report_prefix_pop(); + + ctl_set_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE); + set_storage_key(pagebuf, 0x90, 0); + report(tprot(addr, 2) == TPROT_READ_WRITE, + "storage-protection override: no protection"); + ctl_clear_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE); + + report_prefix_pop(); + set_storage_key(pagebuf, 0x00, 0); + report_prefix_pop(); +} + +/* + * Perform STORE CPU ADDRESS (STAP) instruction while temporarily executing + * with access key 1. + */ +static void store_cpu_address_key_1(uint16_t *out) +{ + asm volatile ( + "spka 0x10\n\t" + "stap %0\n\t" + "spka 0\n" + : "+Q" (*out) /* exception: old value remains in out -> + constraint */ + ); +} + +static void test_store_cpu_address(void) +{ + uint16_t *out = (uint16_t *)pagebuf; + uint16_t cpu_addr; + + report_prefix_push("STORE CPU ADDRESS"); + asm ("stap %0" : "=Q" (cpu_addr)); + + report_prefix_push("zero key"); + set_storage_key(pagebuf, 0x20, 0); + WRITE_ONCE(*out, 0xbeef); + asm ("stap %0" : "=Q" (*out)); + report(*out == cpu_addr, "store occurred"); + report_prefix_pop(); + + report_prefix_push("matching key"); + set_storage_key(pagebuf, 0x10, 0); + *out = 0xbeef; + store_cpu_address_key_1(out); + report(*out == cpu_addr, "store occurred"); + report_prefix_pop(); + + report_prefix_push("mismatching key"); + set_storage_key(pagebuf, 0x20, 0); + expect_pgm_int(); + *out = 0xbeef; + store_cpu_address_key_1(out); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(*out == 0xbeef, "no store occurred"); + report_prefix_pop(); + + ctl_set_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE); + + report_prefix_push("storage-protection override, invalid key"); + set_storage_key(pagebuf, 0x20, 0); + expect_pgm_int(); + *out = 0xbeef; + store_cpu_address_key_1(out); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(*out == 0xbeef, "no store occurred"); + report_prefix_pop(); + + report_prefix_push("storage-protection override, override key"); + set_storage_key(pagebuf, 0x90, 0); + *out = 0xbeef; + store_cpu_address_key_1(out); + report(*out == cpu_addr, "override occurred"); + report_prefix_pop(); + + ctl_clear_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE); + + report_prefix_push("storage-protection override disabled, override key"); + set_storage_key(pagebuf, 0x90, 0); + expect_pgm_int(); + *out = 0xbeef; + store_cpu_address_key_1(out); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(*out == 0xbeef, "no store occurred"); + report_prefix_pop(); + + set_storage_key(pagebuf, 0x00, 0); + report_prefix_pop(); +} + +/* + * Perform SET PREFIX (SPX) instruction while temporarily executing + * with access key 1. + */ +static void set_prefix_key_1(uint32_t *prefix_ptr) +{ + asm volatile ( + "spka 0x10\n\t" + "spx %0\n\t" + "spka 0\n" + :: "Q" (*prefix_ptr) + ); +} + +/* + * We remapped page 0, making the lowcore inaccessible, which breaks the normal + * handler and breaks skipping the faulting instruction. + * Just disable dynamic address translation to make things work. + */ +static void dat_fixup_pgm_int(void) +{ + uint64_t psw_mask = extract_psw_mask(); + + psw_mask &= ~PSW_MASK_DAT; + load_psw_mask(psw_mask); +} + +#define PREFIX_AREA_SIZE (PAGE_SIZE * 2) +static char lowcore_tmp[PREFIX_AREA_SIZE] __attribute__((aligned(PREFIX_AREA_SIZE))); + +/* + * Test accessibility of the operand to SET PREFIX given different configurations + * with regards to storage keys. That is, check the accessibility of the location + * holding the new prefix, not that of the new prefix area. The new prefix area + * is a valid lowcore, so that the test does not crash on failure. + */ +static void test_set_prefix(void) +{ + uint32_t *prefix_ptr = (uint32_t *)pagebuf; + uint32_t *no_override_prefix_ptr; + uint32_t old_prefix; + pgd_t *root; + + report_prefix_push("SET PREFIX"); + root = (pgd_t *)(stctg(1) & PAGE_MASK); + old_prefix = get_prefix(); + memcpy(lowcore_tmp, 0, sizeof(lowcore_tmp)); + assert(((uint64_t)&lowcore_tmp >> 31) == 0); + *prefix_ptr = (uint32_t)(uint64_t)&lowcore_tmp; + + report_prefix_push("zero key"); + set_prefix(old_prefix); + set_storage_key(prefix_ptr, 0x20, 0); + set_prefix(*prefix_ptr); + report(get_prefix() == *prefix_ptr, "set prefix"); + report_prefix_pop(); + + report_prefix_push("matching key"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x10, 0); + set_prefix_key_1(prefix_ptr); + report(get_prefix() == *prefix_ptr, "set prefix"); + report_prefix_pop(); + + report_prefix_push("mismatching key"); + + report_prefix_push("no fetch protection"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x20, 0); + set_prefix_key_1(prefix_ptr); + report(get_prefix() == *prefix_ptr, "set prefix"); + report_prefix_pop(); + + report_prefix_push("fetch protection"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x28, 0); + expect_pgm_int(); + set_prefix_key_1(prefix_ptr); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(get_prefix() == old_prefix, "did not set prefix"); + report_prefix_pop(); + + register_pgm_cleanup_func(dat_fixup_pgm_int); + + report_prefix_push("remapped page, fetch protection"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x28, 0); + expect_pgm_int(); + install_page(root, virt_to_pte_phys(root, pagebuf), 0); + set_prefix_key_1((uint32_t *)0); + install_page(root, 0, 0); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(get_prefix() == old_prefix, "did not set prefix"); + report_prefix_pop(); + + ctl_set_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE); + + report_prefix_push("fetch protection override applies"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x28, 0); + install_page(root, virt_to_pte_phys(root, pagebuf), 0); + set_prefix_key_1((uint32_t *)0); + install_page(root, 0, 0); + report(get_prefix() == *prefix_ptr, "set prefix"); + report_prefix_pop(); + + no_override_prefix_ptr = (uint32_t *)(pagebuf + 2048); + WRITE_ONCE(*no_override_prefix_ptr, (uint32_t)(uint64_t)&lowcore_tmp); + report_prefix_push("fetch protection override does not apply"); + set_prefix(old_prefix); + set_storage_key(pagebuf, 0x28, 0); + expect_pgm_int(); + install_page(root, virt_to_pte_phys(root, pagebuf), 0); + set_prefix_key_1((uint32_t *)2048); + install_page(root, 0, 0); + check_pgm_int_code(PGM_INT_CODE_PROTECTION); + report(get_prefix() == old_prefix, "did not set prefix"); + report_prefix_pop(); + + ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE); + register_pgm_cleanup_func(NULL); + report_prefix_pop(); + set_storage_key(pagebuf, 0x00, 0); + report_prefix_pop(); +} + int main(void) { report_prefix_push("skey"); @@ -130,6 +374,11 @@ int main(void) test_set(); test_set_mb(); test_chg(); + test_test_protection(); + test_store_cpu_address(); + + setup_vm(); + test_set_prefix(); done: report_prefix_pop(); return report_summary(); From patchwork Thu May 12 09:35:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847464 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 1D761C433EF for ; Thu, 12 May 2022 09:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352127AbiELJgm (ORCPT ); Thu, 12 May 2022 05:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352095AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D2A32610 for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Q56e003645 for ; Thu, 12 May 2022 09:35:42 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 : mime-version : content-transfer-encoding; s=pp1; bh=/RRh+aA1VKcHIPtc5jOUGws4RW7BysNBSPr7Z3OXyGY=; b=sHnUPv5WbdXuwxEZrfpsVWu7IEyFNn5kf8lthgznZ93jxkiLxcUHlwf2n7ItnIMpw6SW 9eXv/5PRCXEHg5gfO8vtpUmZOWXA8lrf1oDUJNf971tBpBLBrDGKoSF1sfNsTNS42Ahi 3SeGQIXjw35aE74QNBUUi3IRZwcHZRJ40E6Y7LGpho8Up/lMLjDuQ539I5EgYDfOYnK8 8TkFvRiNjwTlqEcCJYULT1N0K/XJLetu6e92zWRmNzaDNT/9kMEb0IxorcPBEMx9odI4 IiicV7aboRD6MdlhSU6njsgNIXUFt0JcERJThR9iotYsRrETCP7B4aJxNFEbCnH9QhyN 1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:42 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9T4Mj014061 for ; Thu, 12 May 2022 09:35:42 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4vs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:42 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XJqA008149; Thu, 12 May 2022 09:35:40 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 3fwgd8wa0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:40 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZGAf30474520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:16 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41C4211C04A; Thu, 12 May 2022 09:35:37 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E514611C050; Thu, 12 May 2022 09:35:36 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:36 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Janis Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL 22/28] Disable s390x skey test in GitLab CI Date: Thu, 12 May 2022 11:35:17 +0200 Message-Id: <20220512093523.36132-23-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: tJaw9njFlDBPntMTKg6PfDWN8QvSb0Rd X-Proofpoint-GUID: aQNx8-r_8N0qx9pScGg0YtwSfoOyj5Al X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janis Schoetterl-Glausch The test cases newly added to skey.c require kernel 5.18. Signed-off-by: Janis Schoetterl-Glausch Reviewed-by: Thomas Huth Acked-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f3049d8..e5768f1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -166,7 +166,7 @@ s390x-kvm: - ./configure --arch=s390x - make -j$(nproc) - ACCEL=kvm ./run_tests.sh - selftest-setup intercept emulator sieve sthyi skey diag10 diag308 pfmf + selftest-setup intercept emulator sieve sthyi diag10 diag308 pfmf cmm vector gs iep cpumodel diag288 stsi sclp-1g sclp-3g css skrf sie | tee results.txt - grep -q PASS results.txt && ! grep -q FAIL results.txt From patchwork Thu May 12 09:35:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847462 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 E1E35C433F5 for ; Thu, 12 May 2022 09:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352089AbiELJgj (ORCPT ); Thu, 12 May 2022 05:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352100AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07C0C60 for ; Thu, 12 May 2022 02:35:43 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9COaK026688 for ; Thu, 12 May 2022 09:35:43 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 : mime-version : content-transfer-encoding; s=pp1; bh=LRAqqkfxC1apTSnK2L39W+gNMqjYoZpKqzfOhuZwfmQ=; b=SF9ocpODReFmjhbCGArlAFVcKQqY4A5cmPLXN46KmCK/q2OLbItYz34DALKuZcTPmAxD 94M3jRltZaoKgNGpLiPAUuW7g4nI8yETtQN9jHO0RnD8ZS2tMDHhZOmIetloWl+8rFW2 ccYEW2Vi0xk8H7aUXd5IMZZs0obDpqPhP4PzfGx3jey03qqM738OXHqJotdTBrTd6ToU IQ3z4hlpBuB1Ry0jXSbiV1sztdnBKBJ0KkHeJKhaSFpbB35nCS1WsEFKICJ3NPl1L6oJ 1nlJK7Qy/MoYk6rIrJ31hLE8WQmeBFCJw0MiZOCBllwfD63JiVB+HrEC8+R4qW3oP3vn 3Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd50e21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:43 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9ESYV008762 for ; Thu, 12 May 2022 09:35:42 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 3g0yd50e1c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:42 +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 24C9Xqnx011898; Thu, 12 May 2022 09:35:40 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 3fyrkk2n92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:40 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZGvn33816844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:16 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D3CC11C054; Thu, 12 May 2022 09:35:37 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55FD211C04C; Thu, 12 May 2022 09:35:37 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:37 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 23/28] s390x: uv-host: Add invalid command attestation check Date: Thu, 12 May 2022 11:35:18 +0200 Message-Id: <20220512093523.36132-24-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VV5CG6-0BoksFkeL7B3CfpHTbBBNmVYj X-Proofpoint-ORIG-GUID: -GdUqO1zrmiQhF3j7OJPv4j8dDhikxYh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=0 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden Adds an invalid command test for attestation in the uv-host. Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/uv.h | 23 ++++++++++++++++++++++- s390x/uv-host.c | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 70bf65c4..7c8c399d 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -1,7 +1,7 @@ /* * s390x Ultravisor related definitions * - * Copyright (c) 2020 IBM Corp + * Copyright IBM Corp. 2020, 2022 * * Authors: * Janosch Frank @@ -47,6 +47,7 @@ #define UVC_CMD_UNPIN_PAGE_SHARED 0x0342 #define UVC_CMD_SET_SHARED_ACCESS 0x1000 #define UVC_CMD_REMOVE_SHARED_ACCESS 0x1001 +#define UVC_CMD_ATTESTATION 0x1020 /* Bits in installed uv calls */ enum uv_cmds_inst { @@ -71,6 +72,7 @@ enum uv_cmds_inst { BIT_UVC_CMD_UNSHARE_ALL = 20, BIT_UVC_CMD_PIN_PAGE_SHARED = 21, BIT_UVC_CMD_UNPIN_PAGE_SHARED = 22, + BIT_UVC_CMD_ATTESTATION = 28, }; struct uv_cb_header { @@ -178,6 +180,25 @@ struct uv_cb_cfs { u64 paddr; } __attribute__((packed)) __attribute__((aligned(8))); +/* Retrieve Attestation Measurement */ +struct uv_cb_attest { + struct uv_cb_header header; /* 0x0000 */ + uint64_t reserved08[2]; /* 0x0008 */ + uint64_t arcb_addr; /* 0x0018 */ + uint64_t continuation_token; /* 0x0020 */ + uint8_t reserved28[6]; /* 0x0028 */ + uint16_t user_data_length; /* 0x002e */ + uint8_t user_data[256]; /* 0x0030 */ + uint32_t reserved130[3]; /* 0x0130 */ + uint32_t measurement_length; /* 0x013c */ + uint64_t measurement_address; /* 0x0140 */ + uint8_t config_uid[16]; /* 0x0148 */ + uint32_t reserved158; /* 0x0158 */ + uint32_t add_data_length; /* 0x015c */ + uint64_t add_data_address; /* 0x0160 */ + uint64_t reserved168[4]; /* 0x0168 */ +} __attribute__((packed)) __attribute__((aligned(8))); + /* Set Secure Config Parameter */ struct uv_cb_ssc { struct uv_cb_header header; diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 5ac8a32c..a1a6d120 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -418,6 +418,7 @@ static struct cmd_list invalid_cmds[] = { { "bogus", 0x4242, sizeof(struct uv_cb_header), -1}, { "share", UVC_CMD_SET_SHARED_ACCESS, sizeof(struct uv_cb_share), BIT_UVC_CMD_SET_SHARED_ACCESS }, { "unshare", UVC_CMD_REMOVE_SHARED_ACCESS, sizeof(struct uv_cb_share), BIT_UVC_CMD_REMOVE_SHARED_ACCESS }, + { "attest", UVC_CMD_ATTESTATION, sizeof(struct uv_cb_attest), BIT_UVC_CMD_ATTESTATION }, { NULL, 0, 0 }, }; From patchwork Thu May 12 09:35:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847463 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 7C459C433EF for ; Thu, 12 May 2022 09:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352125AbiELJgk (ORCPT ); Thu, 12 May 2022 05:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352102AbiELJfr (ORCPT ); Thu, 12 May 2022 05:35:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E512DEC for ; Thu, 12 May 2022 02:35:44 -0700 (PDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C8t6vw011396 for ; Thu, 12 May 2022 09:35:43 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 : mime-version : content-transfer-encoding; s=pp1; bh=AKgchuLfCIXfXyA4lTgJ/MjAITJ3JJa5gcGkJVfRQzk=; b=QvcGE9EDJJJdgIjiUs6iBshjRm7C8PcpcOKWFyI9xyqnESwsdJ/s0wRLjZwXJYCr47N7 P8874Z52lin8Tf1pj2+TwNpu/KcIKAD2NCBQIo1qXsZUKqa+4jZFxOsVTPMSoSi8c5OO OKl9DlDWFbiuy+3ZNBBb5SL/xwIPAWX44NUeqx4+9gjTEJ9G8X0LOfiu1uoDJvEnPftK pl9WoBqFYQwmZYbiQ/OYsWzkEqZK7pamXWnNXeCfi6T5gXJsWmd6XQfJUwp+rnVH8o4S fgtsNyDV+6FOgj9PkZPLoyW1+UHEgBytLD9HL1S8wYNerZNVXsfcul2kbbQZYUP4fQ30 wg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538x1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:43 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9WYwp025948 for ; Thu, 12 May 2022 09:35:43 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y538x15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:43 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XIvH027311; Thu, 12 May 2022 09:35:41 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3g0kn78nea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9Zc7S38994304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:38 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFD6111C04A; Thu, 12 May 2022 09:35:37 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B094711C04C; Thu, 12 May 2022 09:35:37 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:37 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 24/28] s390x: lib: Add QUI getter Date: Thu, 12 May 2022 11:35:19 +0200 Message-Id: <20220512093523.36132-25-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: j4BQDTDCADARwBUqv2cvLBsHJwTL8Bh0 X-Proofpoint-ORIG-GUID: BDHyKclxcliJj2oN9K46PxUvyTgXYEoR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 clxscore=1015 mlxscore=0 adultscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden Some tests need the information provided by the QUI UVC and lib/s390x/uv.c already has cached the qui result. Let's add a function to avoid unnecessary QUI UVCs. Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- lib/s390x/uv.h | 1 + lib/s390x/uv.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h index 8175d9c6..44264861 100644 --- a/lib/s390x/uv.h +++ b/lib/s390x/uv.h @@ -8,6 +8,7 @@ bool uv_os_is_guest(void); bool uv_os_is_host(void); bool uv_query_test_call(unsigned int nr); +const struct uv_cb_qui *uv_get_query_data(void); void uv_init(void); int uv_setup(void); void uv_create_guest(struct vm *vm); diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c index 6fe11dff..3b4cafa9 100644 --- a/lib/s390x/uv.c +++ b/lib/s390x/uv.c @@ -47,6 +47,14 @@ bool uv_query_test_call(unsigned int nr) return test_bit_inv(nr, uvcb_qui.inst_calls_list); } +const struct uv_cb_qui *uv_get_query_data(void) +{ + /* Query needs to be called first */ + assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); + + return &uvcb_qui; +} + int uv_setup(void) { if (!test_facility(158)) From patchwork Thu May 12 09:35:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847468 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 D7638C433F5 for ; Thu, 12 May 2022 09:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352182AbiELJhF (ORCPT ); Thu, 12 May 2022 05:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352105AbiELJfs (ORCPT ); Thu, 12 May 2022 05:35:48 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA9965A6 for ; Thu, 12 May 2022 02:35:45 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Q1Sq003575 for ; Thu, 12 May 2022 09:35:44 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 : mime-version : content-transfer-encoding; s=pp1; bh=pP+eXHGM9BFfaHppJw1IhEgoz2TFEK1SsArXXExDYvE=; b=mhn1mFal2j1Qm+E1OtlJiK7C+IigN2SO21Zecn1QBvOK5UmTreldCBisjygU3ypGLG9b 6hRbKcCWDt7Pw82DEcMwDZSLEIZYjTICH4x85VQ1Xw4gjmEEMU1rJRtD9uVErJxNSMYP 5GIhS/IIi93eM3WouJGxQQVDy6lCC++xi/UQS1moq95SfYAykBMGmBIF4/jL7QbTfXLZ MKyzfJrdW7/90gyKHZ5HnIHO83/feZM+M1fyf/8vGNrSTZbDqr5WP2No9LS+OWVvVcLk 71/PlQVkUkFq6h1s347hRcLfWo6PdEMyARB/R2EFNDtMfY9MvuwKEUEQOorjXV0laBCk rQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4wr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:44 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9RuvL011345 for ; Thu, 12 May 2022 09:35:43 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yksg4w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:43 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9WqRv020421; Thu, 12 May 2022 09:35:41 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 3fwgd8xs9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZcTO57409964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:38 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5731311C04A; Thu, 12 May 2022 09:35:38 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F75F11C04C; Thu, 12 May 2022 09:35:38 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:37 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 25/28] s390x: uv-guest: remove duplicated checks Date: Thu, 12 May 2022 11:35:20 +0200 Message-Id: <20220512093523.36132-26-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yBX_vx9DS5m1xh_q-gBr4lirHhqhke9f X-Proofpoint-GUID: Y-7od5ThuQcguZSYF3_lsOXSsVbLjVe8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden Removing some tests which are done at other points in the code implicitly. In lib/s390x/uc.c#setup_uv(void) the rc of the qui result is verified using asserts. The whole test is fenced by lib/s390x/uc.c#uv_os_is_guest(void) that checks if SET and REMOVE SHARED is present. Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/uv-guest.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index 99120cae..728c60aa 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -69,23 +69,15 @@ static void test_query(void) cc = uv_call(0, (u64)&uvcb); report(cc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, "length"); - uvcb.header.len = sizeof(uvcb); - cc = uv_call(0, (u64)&uvcb); - report((!cc && uvcb.header.rc == UVC_RC_EXECUTED) || - (cc == 1 && uvcb.header.rc == 0x100), - "successful query"); - /* - * These bits have been introduced with the very first - * Ultravisor version and are expected to always be available - * because they are basic building blocks. + * BIT_UVC_CMD_QUI, BIT_UVC_CMD_SET_SHARED_ACCESS and + * BIT_UVC_CMD_REMOVE_SHARED_ACCESS are always present as they + * have been introduced with the first Ultravisor version. + * However, we only need to check for QUI as + * SET/REMOVE SHARED are used to fence this test to be only + * executed by protected guests. */ - report(test_bit_inv(BIT_UVC_CMD_QUI, &uvcb.inst_calls_list[0]), - "query indicated"); - report(test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, &uvcb.inst_calls_list[0]), - "share indicated"); - report(test_bit_inv(BIT_UVC_CMD_REMOVE_SHARED_ACCESS, &uvcb.inst_calls_list[0]), - "unshare indicated"); + report(uv_query_test_call(BIT_UVC_CMD_QUI), "query indicated"); report_prefix_pop(); } From patchwork Thu May 12 09:35:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847467 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 08EC6C433EF for ; Thu, 12 May 2022 09:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352177AbiELJhA (ORCPT ); Thu, 12 May 2022 05:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352104AbiELJfs (ORCPT ); Thu, 12 May 2022 05:35:48 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA04625B for ; Thu, 12 May 2022 02:35:45 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9FMTv021308 for ; Thu, 12 May 2022 09:35:44 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 : mime-version : content-transfer-encoding; s=pp1; bh=kWXBR0czXeMGNOjQwe7x7dejSgIQuD3w4ONNM/DqNVk=; b=N3O0v1NQo+YdxEyLxBTbhEYxk8GFLNe/U93Bp5nj1UcCRBCnXchm3C7daYTU48RKqXnz iXuJt4dzQXz99RSGTLeZvXLDxmprhffPHUQlLhWp+iBVw5J7Q7/zAzIldoQ1S7RIXnUZ FZ+4zkaRdDenvXoyReNiV14PUkVhjvByHGFM7ATMIBSNj9WO+6b5lRY5zIWt+mOa2gqW T9I1/zD7UIRjGYpmLcNOeUyHLRpNFENnm88cfjjuqgNMf0uzLs6F9QNt6ykrMwThqXpa rt8zkXRjZH5G9j8lORSCD1AI2qjS3auqevXODnLw2FAppU/flsZeL5bLfQ2yjq3XY5Tb GQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbfb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:44 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9H6nU001916 for ; Thu, 12 May 2022 09:35:44 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yefrbed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:44 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9XTQC023792; Thu, 12 May 2022 09:35:42 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 3fwgd8xrya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:41 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZcRf57409966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:38 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BBCAA11C052; Thu, 12 May 2022 09:35:38 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6AFE611C04C; Thu, 12 May 2022 09:35:38 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:38 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 26/28] s390x: uv-guest: Remove double report_prefix_pop Date: Thu, 12 May 2022 11:35:21 +0200 Message-Id: <20220512093523.36132-27-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uliENXFaHWhQGaVKb5jCFT1fbRUfkzrc X-Proofpoint-GUID: 35OYH5gVKcZQghKjvUWdYn8M_cTCZ2WZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/uv-guest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index 728c60aa..fd2cfef1 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -111,8 +111,6 @@ static void test_sharing(void) cc = uv_call(0, (u64)&uvcb); report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "unshare"); report_prefix_pop(); - - report_prefix_pop(); } static struct { From patchwork Thu May 12 09:35:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847466 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 699E5C433F5 for ; Thu, 12 May 2022 09:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352148AbiELJgx (ORCPT ); Thu, 12 May 2022 05:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232425AbiELJfs (ORCPT ); Thu, 12 May 2022 05:35:48 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCE87644 for ; Thu, 12 May 2022 02:35:45 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C9Bnbm012664 for ; Thu, 12 May 2022 09:35:45 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 : mime-version : content-transfer-encoding; s=pp1; bh=AmsOr2KPmHm5lThGjLKlb97+I5u6tDD6OTXf8SScSao=; b=U9ZFBQTa/yvm4gasOcnCmXJueywrUpC0v5rpDzuD0jO4iz5pw69h3bejbiG2PZe9IeCw Wa0keYteg+NgarjNNd1hUh0awSsdoeOYKE1GlCxu03FrNOgxeZNkxCBpZKr/PF0dSOFO 9WqPShfI9E0YSvvDebiid+T8ZwJf9aWKFAuSupzen/Yc13S2/DdG1cxsKPkwqNI3eNOX DbmVvQPOO6GVfjT6Lqxz8SMaBkeT5s/JwVQE/uzLHOULfkbo7KlWb2VybK5EjHQb4yd+ 7tOu/DmHdA+XzVJ2fsY72Z8N2SWDbJWZBmp1BccFuMrhFC8v+uOCvunPii7nI5goeqWc rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0yd1re8j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:45 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9PDCr026232 for ; Thu, 12 May 2022 09:35:44 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 3g0yd1re7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:44 +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 24C9XMwN011806; Thu, 12 May 2022 09:35:42 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06ams.nl.ibm.com with ESMTP id 3fyrkk2n94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:42 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZdZx32768430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:39 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C3AD11C05B; Thu, 12 May 2022 09:35:39 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF1EE11C054; Thu, 12 May 2022 09:35:38 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:38 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 27/28] s390x: uv-guest: add share bit test Date: Thu, 12 May 2022 11:35:22 +0200 Message-Id: <20220512093523.36132-28-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xBXa1JCMysuRAkTTP2b145iQ0vEdLmrc X-Proofpoint-GUID: 0boQC2D6IWKWxGWIPY83VDoDuQlZKXv9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden The UV facility bits shared/unshared must both be set or none. Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/uv-guest.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index fd2cfef1..152ad807 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -157,6 +157,16 @@ static void test_invalid(void) report_prefix_pop(); } +static void test_share_bits(void) +{ + bool unshare = uv_query_test_call(BIT_UVC_CMD_REMOVE_SHARED_ACCESS); + bool share = uv_query_test_call(BIT_UVC_CMD_SET_SHARED_ACCESS); + + report_prefix_push("query"); + report(!(share ^ unshare), "share bits are identical"); + report_prefix_pop(); +} + int main(void) { bool has_uvc = test_facility(158); @@ -167,6 +177,12 @@ int main(void) goto done; } + /* + * Needs to be done before the guest-fence, + * as the fence tests if both shared bits are present + */ + test_share_bits(); + if (!uv_os_is_guest()) { report_skip("Not a protected guest"); goto done; From patchwork Thu May 12 09:35:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12847465 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 07BD0C433F5 for ; Thu, 12 May 2022 09:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352135AbiELJgr (ORCPT ); Thu, 12 May 2022 05:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352048AbiELJfs (ORCPT ); Thu, 12 May 2022 05:35:48 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BDEE9FC6 for ; Thu, 12 May 2022 02:35:46 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24C92w9e004523 for ; Thu, 12 May 2022 09:35:45 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 : mime-version : content-transfer-encoding; s=pp1; bh=R8biMneDqdnQw/hgcun9tQ6R4jazssc4Ti1gQC15Xjo=; b=YZ+9suVfNsUPXos6zWW/vUXQ3DBER8nx3ykvvpid2OsviovD8HSxq8wddUhp/Yp3ui/g 8XYFLQmJeLJVUlRBjxjlUAqLWB70OVahtKif1ws5pSG6tgpwczxOyrY7VQ7nSVIm7eBs V3ZnK5GRBXIkx1p55VzJk4PMxZTLM1xLqPFyYDJ4COrz7UbqNlvBIs8Z7PcKfxpNWG4Q WGTugGPsBiuKYRpXnMKSVIhl7kifrZOnVOPRymJCqHm2IUpM5ur22CdO0Ecx7WNPBQpU Z8/ZbCXK87f/DrLYfwNWuuu8BJmeIM63Yd8H4Et8oUevAAx9EqKqQ6PaYw0AmL0YlWKo fw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y908pfa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 May 2022 09:35:45 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24C9X2ip010005 for ; Thu, 12 May 2022 09:35:44 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g0y908pes-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:44 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24C9YBNX010451; Thu, 12 May 2022 09:35:43 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 3g0ma1gm39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 09:35:42 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24C9ZdEi44368242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 09:35:39 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90CB911C04C; Thu, 12 May 2022 09:35:39 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41C4811C050; Thu, 12 May 2022 09:35:39 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.145]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 09:35:39 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 28/28] s390x: Add attestation tests Date: Thu, 12 May 2022 11:35:23 +0200 Message-Id: <20220512093523.36132-29-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220512093523.36132-1-imbrenda@linux.ibm.com> References: <20220512093523.36132-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: jIADtyyWXeJ_MFicZ9n4x4rw-54Pw5xH X-Proofpoint-ORIG-GUID: 7S50mHRObf_CdYilwiu3zB9YtwsLo0qz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_02,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Steffen Eiden Adds several tests to verify correct error paths of attestation. Signed-off-by: Steffen Eiden Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/Makefile | 1 + lib/s390x/asm/uv.h | 5 +- s390x/pv-attest.c | 225 +++++++++++++++++++++++++++++++++++++++++++++ s390x/uv-guest.c | 11 ++- 4 files changed, 240 insertions(+), 2 deletions(-) create mode 100644 s390x/pv-attest.c diff --git a/s390x/Makefile b/s390x/Makefile index 5336ed8a..a8e04aa6 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -31,6 +31,7 @@ tests += $(TEST_DIR)/firq.elf tests += $(TEST_DIR)/epsw.elf tests += $(TEST_DIR)/adtl-status.elf tests += $(TEST_DIR)/migration.elf +tests += $(TEST_DIR)/pv-attest.elf pv-tests += $(TEST_DIR)/pv-diags.elf diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 7c8c399d..38920461 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -108,7 +108,10 @@ struct uv_cb_qui { u8 reserved88[158 - 136]; /* 0x0088 */ uint16_t max_guest_cpus; /* 0x009e */ u64 uv_feature_indications; /* 0x00a0 */ - u8 reserveda8[200 - 168]; /* 0x00a8 */ + uint8_t reserveda8[224 - 168]; /* 0x00a8 */ + uint64_t supp_att_hdr_ver; /* 0x00e0 */ + uint64_t supp_paf; /* 0x00e8 */ + uint8_t reservedf0[256 - 240]; /* 0x00f0 */ } __attribute__((packed)) __attribute__((aligned(8))); struct uv_cb_cgc { diff --git a/s390x/pv-attest.c b/s390x/pv-attest.c new file mode 100644 index 00000000..7a3dac75 --- /dev/null +++ b/s390x/pv-attest.c @@ -0,0 +1,225 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Retrieve Attestation Measurement Utravisor Call tests + * + * Copyright IBM Corp. 2022 + * + * Authors: + * Steffen Eiden + */ + +#include +#include +#include +#include +#include +#include +#include + +#define ARCB_VERSION_NONE 0 +#define ARCB_VERSION_1 0x100 +#define ARCB_MEAS_NONE 0 +#define ARCB_MEAS_HMAC_SHA512 1 +#define MEASUREMENT_SIZE_HMAC_SHA512 64 +#define PAF_PHKH_ATT (1ULL << 61) +#define ADDITIONAL_SIZE_PAF_PHKH_ATT 32 +/* arcb with one key slot and no nonce */ +struct uv_arcb_v1 { + uint64_t reserved0; /* 0x0000 */ + uint32_t req_ver; /* 0x0008 */ + uint32_t req_len; /* 0x000c */ + uint8_t iv[12]; /* 0x0010 */ + uint32_t reserved1c; /* 0x001c */ + uint8_t reserved20[7]; /* 0x0020 */ + uint8_t nks; /* 0x0027 */ + int32_t reserved28; /* 0x0028 */ + uint32_t sea; /* 0x002c */ + uint64_t plaint_att_flags; /* 0x0030 */ + uint32_t meas_alg_id; /* 0x0038 */ + uint32_t reserved3c; /* 0x003c */ + uint8_t cpk[160]; /* 0x0040 */ + uint8_t key_slot[80]; /* 0x00e0 */ + uint8_t meas_key[64]; /* 0x0130 */ + uint8_t tag[16]; /* 0x0170 */ +} __attribute__((packed)); + +struct attest_request_v1 { + struct uv_arcb_v1 arcb; + uint8_t measurement[MEASUREMENT_SIZE_HMAC_SHA512]; + uint8_t additional[ADDITIONAL_SIZE_PAF_PHKH_ATT]; +}; + +static void test_attest_v1(uint64_t page) +{ + struct uv_cb_attest uvcb = { + .header.cmd = UVC_CMD_ATTESTATION, + .header.len = sizeof(uvcb), + }; + const struct uv_cb_qui *uvcb_qui = uv_get_query_data(); + struct attest_request_v1 *attest_req = (void *)page; + struct uv_arcb_v1 *arcb = &attest_req->arcb; + int cc; + + report_prefix_push("v1"); + if (!test_bit_inv(0, &uvcb_qui->supp_att_hdr_ver)) { + report_skip("Attestation version 1 not supported"); + goto done; + } + + memset((void *)page, 0, PAGE_SIZE); + + /* + * Create a minimal arcb/uvcb such that FW has everything to start + * unsealing the request. However, this unsealing will fail as the + * kvm-unit-test framework provides no cryptography functions that + * would be needed to seal such requests. + */ + arcb->req_ver = ARCB_VERSION_1; + arcb->req_len = sizeof(*arcb); + arcb->nks = 1; + arcb->sea = sizeof(arcb->meas_key); + arcb->plaint_att_flags = PAF_PHKH_ATT; + arcb->meas_alg_id = ARCB_MEAS_HMAC_SHA512; + uvcb.arcb_addr = (uint64_t)&attest_req->arcb; + uvcb.measurement_address = (uint64_t)attest_req->measurement; + uvcb.measurement_length = sizeof(attest_req->measurement); + uvcb.add_data_address = (uint64_t)attest_req->additional; + uvcb.add_data_length = sizeof(attest_req->additional); + + uvcb.continuation_token = 0xff; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x101, "invalid continuation token"); + uvcb.continuation_token = 0; + + uvcb.user_data_length = sizeof(uvcb.user_data) + 1; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x102, "invalid user data size"); + uvcb.user_data_length = 0; + + uvcb.arcb_addr = get_ram_size() + PAGE_SIZE; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x103, "invalid address arcb"); + uvcb.arcb_addr = page; + + /* 0x104 - 0x105 need an unseal-able request */ + + arcb->req_ver = ARCB_VERSION_NONE; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x106, "unsupported version"); + arcb->req_ver = ARCB_VERSION_1; + + arcb->req_len += 1; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x107, "arcb too big"); + arcb->req_len -= 1; + + /* + * The arcb needs to grow as well if number of key slots (nks) + * is increased. However, this is not the case and there is no explicit + * 'too many/less nks for that arcb size' error code -> expect 0x107 + */ + arcb->nks = 2; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x107, "too many nks for arcb"); + arcb->nks = 1; + + arcb->nks = 0; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x108, "invalid num key slots"); + arcb->nks = 1; + + /* + * Possible valid size (when using nonce). + * However, req_len too small to host a nonce + */ + arcb->sea = 80; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x109, "encrypted size too big"); + arcb->sea = 17; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x109, "encrypted size too small"); + arcb->sea = 64; + + arcb->plaint_att_flags = uvcb_qui->supp_paf ^ GENMASK_ULL(63, 0); + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x10a, "invalid flag"); + arcb->plaint_att_flags = PAF_PHKH_ATT; + + arcb->meas_alg_id = ARCB_MEAS_NONE; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x10b, "invalid measurement algorithm"); + arcb->meas_alg_id = ARCB_MEAS_HMAC_SHA512; + + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x10c, "unable unseal"); + + uvcb.measurement_length = 0; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x10d, "invalid measurement size"); + uvcb.measurement_length = sizeof(attest_req->measurement); + + uvcb.add_data_length = 0; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc == 1 && uvcb.header.rc == 0x10e, "invalid additional size"); + uvcb.add_data_length = sizeof(attest_req->additional); + +done: + report_prefix_pop(); +} + +static void test_attest(uint64_t page) +{ + struct uv_cb_attest uvcb = { + .header.cmd = UVC_CMD_ATTESTATION, + .header.len = sizeof(uvcb), + }; + const struct uv_cb_qui *uvcb_qui = uv_get_query_data(); + int cc; + + /* Verify that the UV supports at least one header version */ + report(uvcb_qui->supp_att_hdr_ver, "has hdr support"); + + memset((void *)page, 0, PAGE_SIZE); + + uvcb.header.len -= 1; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc && uvcb.header.rc == UVC_RC_INV_LEN, "uvcb too small"); + uvcb.header.len += 1; + + uvcb.header.len += 1; + cc = uv_call(0, (uint64_t)&uvcb); + report(cc && uvcb.header.rc == UVC_RC_INV_LEN, "uvcb too large"); + uvcb.header.len -= 1; +} + +int main(void) +{ + bool has_uvc = test_facility(158); + uint64_t page; + + + report_prefix_push("attestation"); + if (!has_uvc) { + report_skip("Ultravisor call facility is not available"); + goto done; + } + + if (!uv_os_is_guest()) { + report_skip("Not a protected guest"); + goto done; + } + + if (!uv_query_test_call(BIT_UVC_CMD_ATTESTATION)) { + report_skip("Attestation not supported."); + goto done; + } + + page = (uint64_t)alloc_page(); + /* The privilege check is done in uv-guest.c */ + test_attest(page); + test_attest_v1(page); + free_page((void *)page); +done: + report_prefix_pop(); + return report_summary(); +} diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index 152ad807..c16f19d4 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -2,7 +2,7 @@ /* * Guest Ultravisor Call tests * - * Copyright (c) 2020 IBM Corp + * Copyright IBM Corp. 2020, 2022 * * Authors: * Janosch Frank @@ -53,6 +53,15 @@ static void test_priv(void) check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); report_prefix_pop(); + report_prefix_push("attest"); + uvcb.cmd = UVC_CMD_ATTESTATION; + uvcb.len = sizeof(struct uv_cb_attest); + expect_pgm_int(); + enter_pstate(); + uv_call_once(0, (uint64_t)&uvcb); + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); + report_prefix_pop(); + report_prefix_pop(); }