From patchwork Thu Feb 17 14: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: 12750283 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 2DFE6C433EF for ; Thu, 17 Feb 2022 14:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241920AbiBQOfg (ORCPT ); Thu, 17 Feb 2022 09:35:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbiBQOff (ORCPT ); Thu, 17 Feb 2022 09:35:35 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D94E2B1A82 for ; Thu, 17 Feb 2022 06:35:19 -0800 (PST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HEB9nX025344 for ; Thu, 17 Feb 2022 14:35:19 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=7P0KavX6jEFumYPIFUs82gOofNE3xLxF+5rmbycY1+k=; b=MTdXZz0CTcTifOewuC69enkwQcpbuTP1clkFImwwMM2mVdwj9FsDh4KRpnFg69mElok2 mvUYgf/cVbFiWyxjMG2Cl2uZZsDfJoSgSgXszLkWMUA4fnv1tgYWAcDqXj7/VW3tr2K4 JtSIW5es2WRT3wf2L6EKZ7WIk+B7RIg95oAlzkjuTlyK6oY6px2MUGL3eqzd5kw1ga3H zNEdg0oru7OMpwdNJFjhaxdnIhKXpy5XMRUZ5S0vkNAC4etq0ubSSx8moW8u+EB/0pFL i7IoMB0BPVxuU7rupbTfvJ4IB4rH/xQdSm/zKTmXF+IdNoAUxZp9dRfu61VL4/GLwt9Z KQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9q461e7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:19 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HELfCS030629 for ; Thu, 17 Feb 2022 14:35:18 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9q461e6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:18 +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 21HEXrPW014144; Thu, 17 Feb 2022 14:35:17 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 3e64ha12ex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:17 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZDu337552434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:13 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C38742041; Thu, 17 Feb 2022 14:35:13 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C4904204B; Thu, 17 Feb 2022 14:35:13 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:13 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Christian Borntraeger Subject: [kvm-unit-tests GIT PULL 1/9] s390x/cpumodel: give each test a unique output line Date: Thu, 17 Feb 2022 15:34:56 +0100 Message-Id: <20220217143504.232688-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ek-LvBqMMUh2u_RS-OKEiwiS5f4k91bJ X-Proofpoint-ORIG-GUID: uTODsTjxxMGjprwozF3yo-RB0EsCrjBF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxlogscore=711 spamscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Christian Borntraeger Until now we had multiple tests running under the same prefix. This can result in multiple identical lines like SKIP: cpumodel: dependency: facility 5 not present SKIP: cpumodel: dependency: facility 5 not present Make this unique by adding a proper prefix. Signed-off-by: Christian Borntraeger Reviewed-by: Thomas Huth Signed-off-by: Claudio Imbrenda --- s390x/cpumodel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c index 67bb6543..23ccf842 100644 --- a/s390x/cpumodel.c +++ b/s390x/cpumodel.c @@ -116,14 +116,15 @@ int main(void) report_prefix_push("dependency"); for (i = 0; i < ARRAY_SIZE(dep); i++) { + report_prefix_pushf("%d implies %d", dep[i].facility, dep[i].implied); if (test_facility(dep[i].facility)) { report_xfail(dep[i].expected_tcg_fail && vm_is_tcg(), test_facility(dep[i].implied), - "%d implies %d", - dep[i].facility, dep[i].implied); + "implication not correct"); } else { report_skip("facility %d not present", dep[i].facility); } + report_prefix_pop(); } report_prefix_pop(); From patchwork Thu Feb 17 14: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: 12750289 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 53400C433F5 for ; Thu, 17 Feb 2022 14:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241981AbiBQOf6 (ORCPT ); Thu, 17 Feb 2022 09:35:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241934AbiBQOfh (ORCPT ); Thu, 17 Feb 2022 09:35:37 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 834A12B1A8F for ; Thu, 17 Feb 2022 06:35:22 -0800 (PST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HEGak2005748 for ; Thu, 17 Feb 2022 14:35:22 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=k90ugeX7QRiIsoQ/yaN6nAGSe53R8dwCGA7dTRTyJPI=; b=ZgLELItgBGeoURmdLSBTNUhwlKU1oubTvGaNmLv/e+noHos5QUVNS/OBc0dYwQRig0vF AZFt41Poc5xis6sRryOQNh23IqO2tH/w/79gvd8/uaAWI/CmrQAuZ0qCz+MWvouKY16p abi9Q2z+3SDCrAKbMO3zJPhZ876dTCPApcg+NjtosZ+1pZGh6p/u5hDzQJXEXkv1qEq4 Rp85MT1kUOW+hPAt7ZfBjf7NhdKHrTnMC1kLmriHUgq2KIYAdPxtjQeMTJwt3loZDbAn 6ApmqjTRDExqr7wSeIm4wkf73wj2b/tLghkgZnTqvBulJdZngZOZy/I7aRPssyQ1gxJw 9g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9r008f2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:21 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HEVTBi017870 for ; Thu, 17 Feb 2022 14:35:21 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9r008f1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:21 +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 21HEXNEm032259; Thu, 17 Feb 2022 14:35:19 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 3e64hak97j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:19 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZEGS29819318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:14 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00D0142042; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B21154204B; Thu, 17 Feb 2022 14:35:13 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:13 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 2/9] s390x: uv: Fix UVC cmd prepare reset name Date: Thu, 17 Feb 2022 15:34:57 +0100 Message-Id: <20220217143504.232688-3-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: c0Euedgx3pWt_Vf2mtpjGLngaHLzpCeo X-Proofpoint-GUID: ScX28k-TCk_alkwY8QiM76VD3VcCrsxd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 clxscore=1015 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank The specification and the kernel use UVC_CMD_PREPARE_RESET so let's fix our naming up. The call bit is named correctly but is not the same as the name we use on KVM. So let's clear that up too. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/uv.h | 4 ++-- s390x/uv-guest.c | 2 +- s390x/uv-host.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 97c90e81..70bf65c4 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -39,7 +39,7 @@ #define UVC_CMD_VERIFY_IMG 0x0302 #define UVC_CMD_CPU_RESET 0x0310 #define UVC_CMD_CPU_RESET_INITIAL 0x0311 -#define UVC_CMD_PERF_CONF_CLEAR_RESET 0x0320 +#define UVC_CMD_PREPARE_RESET 0x0320 #define UVC_CMD_CPU_RESET_CLEAR 0x0321 #define UVC_CMD_CPU_SET_STATE 0x0330 #define UVC_CMD_SET_UNSHARED_ALL 0x0340 @@ -66,7 +66,7 @@ enum uv_cmds_inst { BIT_UVC_CMD_CPU_RESET = 15, BIT_UVC_CMD_CPU_RESET_INITIAL = 16, BIT_UVC_CMD_CPU_SET_STATE = 17, - BIT_UVC_CMD_PREPARE_CLEAR_RESET = 18, + BIT_UVC_CMD_PREPARE_RESET = 18, BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET = 19, BIT_UVC_CMD_UNSHARE_ALL = 20, BIT_UVC_CMD_PIN_PAGE_SHARED = 21, diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index 44ad2154..99120cae 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -142,7 +142,7 @@ static struct { { "verify", UVC_CMD_VERIFY_IMG, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_VERIFY_IMG }, { "cpu reset", UVC_CMD_CPU_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_RESET }, { "cpu initial reset", UVC_CMD_CPU_RESET_INITIAL, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_RESET_INITIAL }, - { "conf clear reset", UVC_CMD_PERF_CONF_CLEAR_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_PREPARE_CLEAR_RESET }, + { "prepare clear reset", UVC_CMD_PREPARE_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_PREPARE_RESET }, { "cpu clear reset", UVC_CMD_CPU_RESET_CLEAR, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET }, { "cpu set state", UVC_CMD_CPU_SET_STATE, sizeof(struct uv_cb_cpu_set_state), BIT_UVC_CMD_CPU_SET_STATE }, { "pin shared", UVC_CMD_PIN_PAGE_SHARED, sizeof(struct uv_cb_cfs), BIT_UVC_CMD_PIN_PAGE_SHARED }, diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 92a41069..de2e4850 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -55,7 +55,7 @@ static struct cmd_list cmds[] = { { "verify", UVC_CMD_VERIFY_IMG, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_VERIFY_IMG }, { "cpu reset", UVC_CMD_CPU_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_RESET }, { "cpu initial reset", UVC_CMD_CPU_RESET_INITIAL, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_RESET_INITIAL }, - { "conf clear reset", UVC_CMD_PERF_CONF_CLEAR_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_PREPARE_CLEAR_RESET }, + { "conf clear reset", UVC_CMD_PREPARE_RESET, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_PREPARE_RESET }, { "cpu clear reset", UVC_CMD_CPU_RESET_CLEAR, sizeof(struct uv_cb_nodata), BIT_UVC_CMD_CPU_PERFORM_CLEAR_RESET }, { "cpu set state", UVC_CMD_CPU_SET_STATE, sizeof(struct uv_cb_cpu_set_state), BIT_UVC_CMD_CPU_SET_STATE }, { "pin shared", UVC_CMD_PIN_PAGE_SHARED, sizeof(struct uv_cb_cfs), BIT_UVC_CMD_PIN_PAGE_SHARED }, From patchwork Thu Feb 17 14: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: 12750291 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 4163BC4332F for ; Thu, 17 Feb 2022 14:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241985AbiBQOgA (ORCPT ); Thu, 17 Feb 2022 09:36:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241930AbiBQOfh (ORCPT ); Thu, 17 Feb 2022 09:35:37 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F9E82B1A8D for ; Thu, 17 Feb 2022 06:35:20 -0800 (PST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HEI1l7019755 for ; Thu, 17 Feb 2022 14:35:20 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=dey7AaCvMS3bYKoSjeam+/u7FC4uH21CkdNym2mmgCk=; b=pBpfXmhMVphAy1RWb3+mrZ3v5jCQ42/KmsPYYYAHpvphonjd6zDvtAduVvwP5LA8fU77 /dVnVrOcG79KMfErpUR3DYrSwB4KRt7H8xNWG9iqcV3p4p046EGwI9EMTY28izKWT0Np Qk5LChxSY+fJBeFGqy4M9toJSywmH0N42tHpai46elyNru2mKlGzPHASow8cfBzAhhRc KyoxIDRmVjEV488sSGq8FKwFU+zRHIRJJxkAH4vF0HtmJ1WAi668J2gd37kSUECjBwaX vwotRiNoh7xAUUrLku4TOhMVrXzyxlWSgZpFcXitL8yhlcyTkZCMSsV5yLw9LECbyvKZ YQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9hdc0xkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:20 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HEYOwK010295 for ; Thu, 17 Feb 2022 14:35:19 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9hdc0xjv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:19 +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 21HEXs5p014165; Thu, 17 Feb 2022 14:35:18 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 3e64ha12f2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:17 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZEhG28049894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:14 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7BE344204F; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DFA542049; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, David Hildenbrand Subject: [kvm-unit-tests GIT PULL 3/9] s390x: firq: fix running in PV Date: Thu, 17 Feb 2022 15:34:58 +0100 Message-Id: <20220217143504.232688-4-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lq6Q9GhF5ssfhv4bUn9dhA6GZ0ASTOZ0 X-Proofpoint-ORIG-GUID: gQMqw-E7nEa1cGW5ElgOiKSNQrl4fTjC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If using the qemu CPU type, Protected Virtualization is not available, and the test will fail to start when run in PV. If specifying the host CPU type, the test will fail to start with TCG because the host CPU type requires KVM. In both cases the test will show up as failed. This patch adds a copy of the firq test definitions for KVM, using the host CPU type, and specifying that KVM is to be used. The existing firq tests are then fixed by specifying that TCG is to be used. When running the tests normally, both variants will be run. If an accelerator is specified explicitly when running the tests, only one variant will run and the other will be skipped (and not fail). Signed-off-by: Claudio Imbrenda Fixes: 8b98745d ("s390x: firq: floating interrupt test") Acked-by: David Hildenbrand Acked-by: Janosch Frank --- s390x/unittests.cfg | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 054560c2..1600e714 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -113,12 +113,26 @@ file = mvpg-sie.elf [spec_ex-sie] file = spec_ex-sie.elf -[firq-linear-cpu-ids] +[firq-linear-cpu-ids-kvm] +file = firq.elf +timeout = 20 +extra_params = -smp 1,maxcpus=3 -device host-s390x-cpu,core-id=1 -device host-s390x-cpu,core-id=2 +accel = kvm + +[firq-nonlinear-cpu-ids-kvm] +file = firq.elf +timeout = 20 +extra_params = -smp 1,maxcpus=3 -device host-s390x-cpu,core-id=2 -device host-s390x-cpu,core-id=1 +accel = kvm + +[firq-linear-cpu-ids-tcg] file = firq.elf timeout = 20 extra_params = -smp 1,maxcpus=3 -cpu qemu -device qemu-s390x-cpu,core-id=1 -device qemu-s390x-cpu,core-id=2 +accel = tcg -[firq-nonlinear-cpu-ids] +[firq-nonlinear-cpu-ids-tcg] file = firq.elf timeout = 20 extra_params = -smp 1,maxcpus=3 -cpu qemu -device qemu-s390x-cpu,core-id=2 -device qemu-s390x-cpu,core-id=1 +accel = tcg From patchwork Thu Feb 17 14: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: 12750284 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 57C13C433FE for ; Thu, 17 Feb 2022 14:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241937AbiBQOfi (ORCPT ); Thu, 17 Feb 2022 09:35:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241916AbiBQOff (ORCPT ); Thu, 17 Feb 2022 09:35:35 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694302B1671 for ; Thu, 17 Feb 2022 06:35:21 -0800 (PST) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HCbDCu024479 for ; Thu, 17 Feb 2022 14:35:20 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=tVzgnu0EO5plArQi+iY/t0/4mta2VDSmZVDpRCNMwCE=; b=N+b/BnEIdC3dwbXtfkcUebniN6zKIcxdPc5X5pbYzcUgwFYMWy77qS749xM0II0Vss/o NSOVDswx16B4UXGWDSDLUhGnYSEoXWdQ2tupKjgeEiJh5qoV54dd9cgeY0ca3cB2NjzT CnFDM5i0FK6YfMuyehe/HgMvJix7ZsVxnv29Rk2TPR7S2kCA4ciD95S4ktOAh0Z/l1li hXiq11MjbxZqvoo2GfKhGP0lSpbqJeJrueSSOg0EzBFurfsMp4/oijr64oTE0/wMqjk3 k8+3+N98E+CST92elr5+m0ozm/h34YDv1PccsbN3dUBSOglvBORQDJP4lek6QZ38Tr// aQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9m1ypay0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:20 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HDEHOW035228 for ; Thu, 17 Feb 2022 14:35:20 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9m1ypax2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:20 +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 21HEXQH4006417; Thu, 17 Feb 2022 14:35:18 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 3e645kbdrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:18 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZFl945678878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF50D42047; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F8264204D; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Nico Boehr , Steffen Eiden Subject: [kvm-unit-tests GIT PULL 4/9] lib: s390x: smp: guarantee that boot CPU has index 0 Date: Thu, 17 Feb 2022 15:34:59 +0100 Message-Id: <20220217143504.232688-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XW5czm3a-3_PuguRmrQyqmskCjdn6UK5 X-Proofpoint-ORIG-GUID: Cdni1qFd1yrRFFF41M6anagCXtMAqdZo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxscore=0 clxscore=1015 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Guarantee that the boot CPU has index 0. This simplifies the implementation of tests that require multiple CPUs. Also fix a small bug in the allocation of the cpus array. Signed-off-by: Claudio Imbrenda Fixes: f77c0515 ("s390x: Add initial smp code") Fixes: 52076a63 ("s390x: Consolidate sclp read info") Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- lib/s390x/smp.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index b753eab5..eae742d2 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -25,7 +25,6 @@ #include "sclp.h" static struct cpu *cpus; -static struct cpu *cpu0; static struct spinlock lock; extern void smp_cpu_setup_state(void); @@ -69,7 +68,7 @@ static int smp_cpu_stop_nolock(uint16_t addr, bool store) uint8_t order = store ? SIGP_STOP_AND_STORE_STATUS : SIGP_STOP; cpu = smp_cpu_from_addr(addr); - if (!cpu || cpu == cpu0) + if (!cpu || addr == cpus[0].addr) return -1; if (sigp_retry(addr, order, 0, NULL)) @@ -193,7 +192,7 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) sigp_retry(cpu->addr, SIGP_SET_PREFIX, (unsigned long )lc, NULL); /* Copy all exception psws. */ - memcpy(lc, cpu0->lowcore, 512); + memcpy(lc, cpus[0].lowcore, 512); /* Setup stack */ cpu->stack = (uint64_t *)alloc_pages(2); @@ -251,15 +250,27 @@ void smp_setup(void) if (num > 1) printf("SMP: Initializing, found %d cpus\n", num); - cpus = calloc(num, sizeof(cpus)); + cpus = calloc(num, sizeof(*cpus)); for (i = 0; i < num; i++) { cpus[i].addr = entry[i].address; cpus[i].active = false; + /* + * Fill in the boot CPU. If the boot CPU is not at index 0, + * swap it with the one at index 0. This guarantees that the + * boot CPU will always have index 0. If the boot CPU was + * already at index 0, a few extra useless assignments are + * performed, but everything will work ok. + * Notice that there is no guarantee that the list of CPUs + * returned by the Read SCP Info command is in any + * particular order, or that its order will stay consistent + * across multiple invocations. + */ if (entry[i].address == cpu0_addr) { - cpu0 = &cpus[i]; - cpu0->stack = stackptr; - cpu0->lowcore = (void *)0; - cpu0->active = true; + cpus[i].addr = cpus[0].addr; + cpus[0].addr = cpu0_addr; + cpus[0].stack = stackptr; + cpus[0].lowcore = (void *)0; + cpus[0].active = true; } } spin_unlock(&lock); From patchwork Thu Feb 17 14: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: 12750292 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 B7589C433EF for ; Thu, 17 Feb 2022 14:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241991AbiBQOgB (ORCPT ); Thu, 17 Feb 2022 09:36:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbiBQOfh (ORCPT ); Thu, 17 Feb 2022 09:35:37 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30B7C2B1A82 for ; Thu, 17 Feb 2022 06:35:22 -0800 (PST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HE4hYj019669 for ; Thu, 17 Feb 2022 14:35:21 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=+Me/4xcwyCa8P0pwx7Kk1otN55O1fwO5EyuRyYW7rTQ=; b=cdTzWRn43H7vqgNupYxnhtXZAJdpdPF2I+/bjpDtPRpJhg5iDoWXMAIoVn2b82wx298v Wg1OA1/Of5NRE2VUs+CAl7IkYyp5xFVrSQIL8Jj8moOYIb1Pv7BT2klVT87QtflErgP1 r8KwmyXF/1cZdjvgJIKWPzha/Q8wiRPY34A8N166Hg7pnXzuYwTRa0aFSmRVv+UMe9k+ 5w40J4xLnjHDbg4N6OuK906Vy0BF7MbTm3TtzKMGs22LD/yCBCa7Ej30Gpb2phWU7E+S xSLYF5Wql1EhGIF/dveDTWluHC9sTfX5PnLdSTiyvYD2nz9rgXpkgKGVtHm7fhO88ICy yA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9hdc0xm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:21 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HEL5kV027704 for ; Thu, 17 Feb 2022 14:35:20 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9hdc0xk9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:20 +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 21HEW3fh003073; Thu, 17 Feb 2022 14:35:18 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma05fra.de.ibm.com with ESMTP id 3e64ha94jv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:18 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZFpo44761408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 67CE242052; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0ECCC4204C; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:14 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Steffen Eiden , Nico Boehr Subject: [kvm-unit-tests GIT PULL 5/9] lib: s390x: smp: refactor smp functions to accept indexes Date: Thu, 17 Feb 2022 15:35:00 +0100 Message-Id: <20220217143504.232688-6-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: m4UtfEbDQpa0B6LJPLfJ4fZzIET7kfO8 X-Proofpoint-ORIG-GUID: Vpk3WUPaAYfLGLEQ62ZWWj7CgXaJGbyf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Refactor all the smp_* functions to accept CPU indexes instead of CPU addresses. Add SIGP wrappers to use indexes instead of addresses. Raw SIGP calls using addresses are still possible. Some of the reworked functions also use the new wrappers internally, for clarity, even though that will cause unnecessary redundant checks on the validity of the CPU index. Add a few other useful functions to deal with CPU indexes. Signed-off-by: Claudio Imbrenda Reviewed-by: Steffen Eiden Reviewed-by: Nico Boehr --- lib/s390x/smp.h | 20 ++++--- lib/s390x/smp.c | 148 ++++++++++++++++++++++++++++-------------------- 2 files changed, 99 insertions(+), 69 deletions(-) diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index a2609f11..1e69a7de 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -37,15 +37,19 @@ struct cpu_status { int smp_query_num_cpus(void); struct cpu *smp_cpu_from_addr(uint16_t addr); -bool smp_cpu_stopped(uint16_t addr); -bool smp_sense_running_status(uint16_t addr); -int smp_cpu_restart(uint16_t addr); -int smp_cpu_start(uint16_t addr, struct psw psw); -int smp_cpu_stop(uint16_t addr); -int smp_cpu_stop_store_status(uint16_t addr); -int smp_cpu_destroy(uint16_t addr); -int smp_cpu_setup(uint16_t addr, struct psw psw); +struct cpu *smp_cpu_from_idx(uint16_t idx); +uint16_t smp_cpu_addr(uint16_t idx); +bool smp_cpu_stopped(uint16_t idx); +bool smp_sense_running_status(uint16_t idx); +int smp_cpu_restart(uint16_t idx); +int smp_cpu_start(uint16_t idx, struct psw psw); +int smp_cpu_stop(uint16_t idx); +int smp_cpu_stop_store_status(uint16_t idx); +int smp_cpu_destroy(uint16_t idx); +int smp_cpu_setup(uint16_t idx, struct psw psw); void smp_teardown(void); void smp_setup(void); +int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status); +int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status); #endif diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index eae742d2..46e1b022 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -29,11 +29,28 @@ static struct spinlock lock; extern void smp_cpu_setup_state(void); +static void check_idx(uint16_t idx) +{ + assert(idx < smp_query_num_cpus()); +} + int smp_query_num_cpus(void) { return sclp_get_cpu_num(); } +int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status) +{ + check_idx(idx); + return sigp(cpus[idx].addr, order, parm, status); +} + +int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status) +{ + check_idx(idx); + return sigp_retry(cpus[idx].addr, order, parm, status); +} + struct cpu *smp_cpu_from_addr(uint16_t addr) { int i, num = smp_query_num_cpus(); @@ -45,174 +62,183 @@ struct cpu *smp_cpu_from_addr(uint16_t addr) return NULL; } -bool smp_cpu_stopped(uint16_t addr) +struct cpu *smp_cpu_from_idx(uint16_t idx) +{ + check_idx(idx); + return &cpus[idx]; +} + +uint16_t smp_cpu_addr(uint16_t idx) +{ + check_idx(idx); + return cpus[idx].addr; +} + +bool smp_cpu_stopped(uint16_t idx) { uint32_t status; - if (sigp(addr, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) + if (smp_sigp(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) return false; return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED)); } -bool smp_sense_running_status(uint16_t addr) +bool smp_sense_running_status(uint16_t idx) { - if (sigp(addr, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) + if (smp_sigp(idx, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) return true; /* Status stored condition code is equivalent to cpu not running. */ return false; } -static int smp_cpu_stop_nolock(uint16_t addr, bool store) +static int smp_cpu_stop_nolock(uint16_t idx, bool store) { - struct cpu *cpu; uint8_t order = store ? SIGP_STOP_AND_STORE_STATUS : SIGP_STOP; - cpu = smp_cpu_from_addr(addr); - if (!cpu || addr == cpus[0].addr) + /* refuse to work on the boot CPU */ + if (idx == 0) return -1; - if (sigp_retry(addr, order, 0, NULL)) + if (smp_sigp_retry(idx, order, 0, NULL)) return -1; - while (!smp_cpu_stopped(addr)) + while (!smp_cpu_stopped(idx)) mb(); - cpu->active = false; + /* idx has been already checked by the smp_* functions called above */ + cpus[idx].active = false; return 0; } -int smp_cpu_stop(uint16_t addr) +int smp_cpu_stop(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, false); + rc = smp_cpu_stop_nolock(idx, false); spin_unlock(&lock); return rc; } -int smp_cpu_stop_store_status(uint16_t addr) +int smp_cpu_stop_store_status(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, true); + rc = smp_cpu_stop_nolock(idx, true); spin_unlock(&lock); return rc; } -static int smp_cpu_restart_nolock(uint16_t addr, struct psw *psw) +static int smp_cpu_restart_nolock(uint16_t idx, struct psw *psw) { int rc; - struct cpu *cpu = smp_cpu_from_addr(addr); - if (!cpu) - return -1; + check_idx(idx); if (psw) { - cpu->lowcore->restart_new_psw.mask = psw->mask; - cpu->lowcore->restart_new_psw.addr = psw->addr; + cpus[idx].lowcore->restart_new_psw.mask = psw->mask; + cpus[idx].lowcore->restart_new_psw.addr = psw->addr; } /* * Stop the cpu, so we don't have a race between a running cpu * and the restart in the test that checks if the cpu is * running after the restart. */ - smp_cpu_stop_nolock(addr, false); - rc = sigp(addr, SIGP_RESTART, 0, NULL); + smp_cpu_stop_nolock(idx, false); + rc = smp_sigp(idx, SIGP_RESTART, 0, NULL); if (rc) return rc; /* * The order has been accepted, but the actual restart may not * have been performed yet, so wait until the cpu is running. */ - while (smp_cpu_stopped(addr)) + while (smp_cpu_stopped(idx)) mb(); - cpu->active = true; + cpus[idx].active = true; return 0; } -int smp_cpu_restart(uint16_t addr) +int smp_cpu_restart(uint16_t idx) { int rc; spin_lock(&lock); - rc = smp_cpu_restart_nolock(addr, NULL); + rc = smp_cpu_restart_nolock(idx, NULL); spin_unlock(&lock); return rc; } -int smp_cpu_start(uint16_t addr, struct psw psw) +int smp_cpu_start(uint16_t idx, struct psw psw) { int rc; spin_lock(&lock); - rc = smp_cpu_restart_nolock(addr, &psw); + rc = smp_cpu_restart_nolock(idx, &psw); spin_unlock(&lock); return rc; } -int smp_cpu_destroy(uint16_t addr) +int smp_cpu_destroy(uint16_t idx) { - struct cpu *cpu; int rc; spin_lock(&lock); - rc = smp_cpu_stop_nolock(addr, false); + rc = smp_cpu_stop_nolock(idx, false); if (!rc) { - cpu = smp_cpu_from_addr(addr); - free_pages(cpu->lowcore); - free_pages(cpu->stack); - cpu->lowcore = (void *)-1UL; - cpu->stack = (void *)-1UL; + free_pages(cpus[idx].lowcore); + free_pages(cpus[idx].stack); + cpus[idx].lowcore = (void *)-1UL; + cpus[idx].stack = (void *)-1UL; } spin_unlock(&lock); return rc; } -int smp_cpu_setup(uint16_t addr, struct psw psw) +static int smp_cpu_setup_nolock(uint16_t idx, struct psw psw) { struct lowcore *lc; - struct cpu *cpu; - int rc = -1; - - spin_lock(&lock); - - if (!cpus) - goto out; - cpu = smp_cpu_from_addr(addr); - - if (!cpu || cpu->active) - goto out; + if (cpus[idx].active) + return -1; - sigp_retry(cpu->addr, SIGP_INITIAL_CPU_RESET, 0, NULL); + smp_sigp_retry(idx, SIGP_INITIAL_CPU_RESET, 0, NULL); lc = alloc_pages_flags(1, AREA_DMA31); - cpu->lowcore = lc; - memset(lc, 0, PAGE_SIZE * 2); - sigp_retry(cpu->addr, SIGP_SET_PREFIX, (unsigned long )lc, NULL); + cpus[idx].lowcore = lc; + smp_sigp_retry(idx, SIGP_SET_PREFIX, (unsigned long )lc, NULL); /* Copy all exception psws. */ memcpy(lc, cpus[0].lowcore, 512); /* Setup stack */ - cpu->stack = (uint64_t *)alloc_pages(2); + cpus[idx].stack = (uint64_t *)alloc_pages(2); /* Start without DAT and any other mask bits. */ - cpu->lowcore->sw_int_psw.mask = psw.mask; - cpu->lowcore->sw_int_psw.addr = psw.addr; - cpu->lowcore->sw_int_grs[14] = psw.addr; - cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4); + lc->sw_int_psw.mask = psw.mask; + lc->sw_int_psw.addr = psw.addr; + lc->sw_int_grs[14] = psw.addr; + lc->sw_int_grs[15] = (uint64_t)cpus[idx].stack + (PAGE_SIZE * 4); lc->restart_new_psw.mask = PSW_MASK_64; lc->restart_new_psw.addr = (uint64_t)smp_cpu_setup_state; lc->sw_int_crs[0] = BIT_ULL(CTL0_AFP); /* Start processing */ - smp_cpu_restart_nolock(addr, NULL); + smp_cpu_restart_nolock(idx, NULL); /* Wait until the cpu has finished setup and started the provided psw */ while (lc->restart_new_psw.addr != psw.addr) mb(); - rc = 0; -out: + + return 0; +} + +int smp_cpu_setup(uint16_t idx, struct psw psw) +{ + int rc = -1; + + spin_lock(&lock); + if (cpus) { + check_idx(idx); + rc = smp_cpu_setup_nolock(idx, psw); + } spin_unlock(&lock); return rc; } From patchwork Thu Feb 17 14: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: 12750286 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 11EB1C433EF for ; Thu, 17 Feb 2022 14:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241946AbiBQOfy (ORCPT ); Thu, 17 Feb 2022 09:35:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241933AbiBQOfh (ORCPT ); Thu, 17 Feb 2022 09:35:37 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578BE2B1A8E for ; Thu, 17 Feb 2022 06:35:22 -0800 (PST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HEGaRt023473 for ; Thu, 17 Feb 2022 14:35:22 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=D0kLpwppa585ALDXUGSt2aReOSPp4bJ8eiaWAl5R0Mk=; b=fgh+PZh2KTBVxcOi5j40BMfFNOoK0Za09BFGPXYY/qk4BfWUJaI03u6qt6wbnaStpu6f PCnS4CLBOkVCbNry05uyNwN7fCtEa6whSTnX4p8EiFVh6dDfW99Q9c7HTbLxyuBG4ov2 C6wVhggra8WR2zQdVyVkidHiB4huOqn1G/CooicEVCS1VyY/qVmZMGRN2uCP9bp+NB0J rhNxJuSFRRvSveI3ME3B5xhJbC58CiR35n6EC4uL0i+0dzDJrxBb+0Oi+sTDNr1wW/GI gdojYoeXIA1K8v1vdyIg/v681BnBszUfAlGaG9xY8VPVAf72GiNE/eh4NHptzxEmj3/g Pg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9r00gev6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:21 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HEHJJd025451 for ; Thu, 17 Feb 2022 14:35:21 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9r00geu7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:21 +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 21HEXIGU022246; Thu, 17 Feb 2022 14:35:19 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3e64hah58e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:19 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZGFI45351324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:16 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6DD74204B; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8592D4204C; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Nico Boehr , Steffen Eiden Subject: [kvm-unit-tests GIT PULL 6/9] s390x: smp: use CPU indexes instead of addresses Date: Thu, 17 Feb 2022 15:35:01 +0100 Message-Id: <20220217143504.232688-7-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ML1CxLd4YlITojv8GYhxZlyrO3cnHGae X-Proofpoint-ORIG-GUID: hqAcyEoFmOhNtRxJK4F2LPG2WIoHulai X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/smp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index 1bbe4c31..068ac74d 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -56,7 +56,7 @@ static void test_start(void) */ static void test_restart(void) { - struct cpu *cpu = smp_cpu_from_addr(1); + struct cpu *cpu = smp_cpu_from_idx(1); struct lowcore *lc = cpu->lowcore; lc->restart_new_psw.mask = extract_psw_mask(); @@ -92,7 +92,7 @@ static void test_stop(void) static void test_stop_store_status(void) { - struct cpu *cpu = smp_cpu_from_addr(1); + struct cpu *cpu = smp_cpu_from_idx(1); struct lowcore *lc = (void *)0x0; report_prefix_push("stop store status"); @@ -129,7 +129,7 @@ static void test_store_status(void) report_prefix_push("running"); smp_cpu_restart(1); - sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, &r); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, &r); report(r == SIGP_STATUS_INCORRECT_STATE, "incorrect state"); report(!memcmp(status, (void *)status + PAGE_SIZE, PAGE_SIZE), "status not written"); @@ -138,7 +138,7 @@ static void test_store_status(void) memset(status, 0, PAGE_SIZE); report_prefix_push("stopped"); smp_cpu_stop(1); - sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); while (!status->prefix) { mb(); } report_pass("status written"); free_pages(status); @@ -176,7 +176,7 @@ static void test_ecall(void) smp_cpu_start(1, psw); wait_for_flag(); set_flag(0); - sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); @@ -210,7 +210,7 @@ static void test_emcall(void) smp_cpu_start(1, psw); wait_for_flag(); set_flag(0); - sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); + smp_sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); @@ -253,8 +253,8 @@ static void test_reset_initial(void) smp_cpu_start(1, psw); wait_for_flag(); - sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL); - sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); + smp_sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL); + smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL); report_prefix_push("clear"); report(!status->psw.mask && !status->psw.addr, "psw"); @@ -299,11 +299,11 @@ static void test_reset(void) psw.addr = (unsigned long)test_func; report_prefix_push("cpu reset"); - sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); - sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + smp_sigp(1, SIGP_EMERGENCY_SIGNAL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); smp_cpu_start(1, psw); - sigp_retry(1, SIGP_CPU_RESET, 0, NULL); + smp_sigp_retry(1, SIGP_CPU_RESET, 0, NULL); report(smp_cpu_stopped(1), "cpu stopped"); set_flag(0); From patchwork Thu Feb 17 14: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: 12750285 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 10A0DC433F5 for ; Thu, 17 Feb 2022 14:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238733AbiBQOfw (ORCPT ); Thu, 17 Feb 2022 09:35:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241935AbiBQOfi (ORCPT ); Thu, 17 Feb 2022 09:35:38 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52BB92B1671 for ; Thu, 17 Feb 2022 06:35:23 -0800 (PST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HEBAgT025383 for ; Thu, 17 Feb 2022 14:35:22 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=AQpdSmeOKjloa5NphmrQWcqW+/4CJ+GNJ7vmctFzMec=; b=X+mq8lv8mgY1mbNvGvt40KcREJKgPbSUAqflxGaXjR/BjZyxyV7WvCyryrd5tN4DRAwR Bgu/7ucSjTzJYQ+uoPWOayY0BF09Zvfx/FDW7x6WApQQ7YohnDgBvHQED2oooor+euwr 63lJOQNF9kiTkQjODGOgTiZz4LDN3cplYlCCsqOM/z/Jw/Kc/X0Ji4AOypin3dwMlF4u FWAeGI+5px+Q5RpFS4YE1260RKY4hTuMsGOosL1nODdqrvSxH1ZPnBhHPMU+MvMXz/do E/nRWS+BsS4n/1VFvjDgS9sO/ilkBZVwNwUH1r4+UnAVn3nVY02EoS4dteCN43ymMTmi 5g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9q461e9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:22 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HECD94031532 for ; Thu, 17 Feb 2022 14:35:21 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e9q461e8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:21 +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 21HEXpgb028138; Thu, 17 Feb 2022 14:35:20 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 3e64hah483-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:19 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZGPE37880126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:16 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 658404204F; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00C2D4203F; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:15 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Nico Boehr , Steffen Eiden Subject: [kvm-unit-tests GIT PULL 7/9] s390x: firq: use CPU indexes instead of addresses Date: Thu, 17 Feb 2022 15:35:02 +0100 Message-Id: <20220217143504.232688-8-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: T6CtX7BYsSjNtriZc8Y7mukU80v1FZiS X-Proofpoint-ORIG-GUID: W29on4i72v7sdrmaTng6nl8y8iQd_Xio X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxlogscore=896 spamscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. replace the checks with asserts, the 3 CPUs are guaranteed to be there. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/firq.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/s390x/firq.c b/s390x/firq.c index fb9a2906..b4b3542e 100644 --- a/s390x/firq.c +++ b/s390x/firq.c @@ -44,24 +44,13 @@ static void test_wait_state_delivery(void) goto out; } - if (stap()) { - report_skip("need to start on CPU #0"); - goto out; - } - - /* - * We want CPU #2 to be stopped. This should be the case at this - * point, however, we want to sense if it even exists as well. - */ + /* Stop CPU #2. It must succeed because we have at least 3 CPUs */ ret = smp_cpu_stop(2); - if (ret) { - report_skip("CPU #2 not found"); - goto out; - } + assert(!ret); /* - * We're going to perform an SCLP service call but expect - * the interrupt on CPU #1 while it is in the wait state. + * We're going to perform an SCLP service call but expect the + * interrupt on CPU #1 while it is in the wait state. */ sclp_mark_busy(); @@ -69,11 +58,8 @@ static void test_wait_state_delivery(void) psw.mask = extract_psw_mask(); psw.addr = (unsigned long)wait_for_sclp_int; ret = smp_cpu_setup(1, psw); - if (ret) { - sclp_clear_busy(); - report_skip("cpu #1 not found"); - goto out; - } + /* This must not fail because we have at least 3 CPUs */ + assert(!ret); /* * We'd have to jump trough some hoops to sense e.g., via SIGP From patchwork Thu Feb 17 14: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: 12750287 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 7CE3FC433F5 for ; Thu, 17 Feb 2022 14:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241955AbiBQOfy (ORCPT ); Thu, 17 Feb 2022 09:35:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241943AbiBQOfm (ORCPT ); Thu, 17 Feb 2022 09:35:42 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18ADB2B1A93 for ; Thu, 17 Feb 2022 06:35:26 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HDcfWw011645 for ; Thu, 17 Feb 2022 14:35:25 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=BmXeoe+uH1HMgRC9yAA/cQHXPqRQdkSHiCAErU+CdQw=; b=ivbt8v2pKxrCbpMDVD50HgD75Gi99Ef9zyuDPxnQA3nX8BV1gl171Kt4hfwLuYkzSwW2 o3IPm38Wy+7Th5lLTHoZFFTH9gTdSELRG0SDi90RscYFVsZ6FiWPyUmUXUJf3KTnCmh8 UvvPNmn2fUke9/YJTkD320oAboMOYomNf7FfJgwmtjgf7RO+iz1QC/wIbpFrrmbxBGae NZyC6F7dVC04d86RfVC/hoTeNwcYFuPx0Tj9rgNnF+2d1JEMBPsuTuuLHwV2383TDZCM SMF2PyJuqyNER7EYYmWjFWqJUrEp+vPE30MG/Ug3nKu4AhosLzVRVsJRfLxY8sbUtFqp Lw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9p59k66x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:25 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HDf7DP024047 for ; Thu, 17 Feb 2022 14:35:25 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9p59k65x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:25 +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 21HEXOTT032271; Thu, 17 Feb 2022 14:35:22 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 3e64hak97w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:22 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZHjK16122198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:17 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E20CD42041; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A2284203F; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Nico Boehr , Steffen Eiden Subject: [kvm-unit-tests GIT PULL 8/9] s390x: skrf: use CPU indexes instead of addresses Date: Thu, 17 Feb 2022 15:35:03 +0100 Message-Id: <20220217143504.232688-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wu-ZEGyPNqZTuvNKQAIJGiFglr4wt5Cp X-Proofpoint-ORIG-GUID: a38bvgG8Meaj9Ux6eCDM8-OPoBtx4zq2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=964 phishscore=0 spamscore=0 malwarescore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Adapt the test to the new semantics of the smp_* functions, and use CPU indexes instead of addresses. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/skrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/skrf.c b/s390x/skrf.c index ca4efbf1..b9a2e902 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -176,7 +176,7 @@ static void test_exception_ext_new(void) wait_for_flag(); set_flag(0); - sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); wait_for_flag(); smp_cpu_stop(1); report_prefix_pop(); From patchwork Thu Feb 17 14: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: 12750288 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 B6C29C433FE for ; Thu, 17 Feb 2022 14:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241978AbiBQOf4 (ORCPT ); Thu, 17 Feb 2022 09:35:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241940AbiBQOfl (ORCPT ); Thu, 17 Feb 2022 09:35:41 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 022CA2B1A90 for ; Thu, 17 Feb 2022 06:35:23 -0800 (PST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21HE7TR8010158 for ; Thu, 17 Feb 2022 14:35:23 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=RTBZaDYxeAD5VWqLKKDRMxuu2kUA4TkH2/89S7Yu9eg=; b=i+WhT3saLpquXJzEULVXV6J9o76qIk1ilpIUeenyGf79cPdectRp9doMlSlGFCG+5Jka ZjJWXc0fAecBzQDBZ5BQsDJUgaefUQW6pzbGEu/P/9oydWN1T4WltnOwvYkGAU+geF5S fN13jgA58ZNk2ElYvQLUsj+eJj1RXnwTNigRtUXNDcBlnJ3RomGPEoywp5d2RGQcaYoz PXY5TAJKaahJo9+ucZy9A8OZFHWobVIRuBtUSvONSeJpmQr/2fwOIJBblZM3kZVpUwvm C7QrKmynkV3z1iu+e7R0cuu6yhdzKD+zG5qTpSy1JacP3pB39gzt3dwsu+At5+hDfrax 6A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9p7xtpq2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Feb 2022 14:35:22 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21HEGnGM013063 for ; Thu, 17 Feb 2022 14:35:22 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e9p7xtppd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:22 +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 21HEXN3Y032225; Thu, 17 Feb 2022 14:35:20 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma02fra.de.ibm.com with ESMTP id 3e64ha93wx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Feb 2022 14:35:20 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21HEZHBN44958032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Feb 2022 14:35:17 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B18B4203F; Thu, 17 Feb 2022 14:35:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 024F84204B; Thu, 17 Feb 2022 14:35:17 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.54]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 17 Feb 2022 14:35:16 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, Pierre Morel Subject: [kvm-unit-tests GIT PULL 9/9] s390x: stsi: Define vm_is_kvm to be used in different tests Date: Thu, 17 Feb 2022 15:35:04 +0100 Message-Id: <20220217143504.232688-10-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217143504.232688-1-imbrenda@linux.ibm.com> References: <20220217143504.232688-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QTH1JDd5WQwcwtLwgoyTagHy57fRxl1z X-Proofpoint-ORIG-GUID: Trm-cL_VgUTRpF6-74lJcTONNf4S0JKw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-17_05,2022-02-17_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxlogscore=839 clxscore=1015 suspectscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202170066 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Pierre Morel Several tests are in need of a way to check on which hypervisor and virtualization level they are running on to be able to fence certain tests. This patch adds functions that return true if a vm is running under KVM, LPAR or generally as a level 2 guest. To check if we're running under KVM we use the STSI 3.2.2 instruction, let's define it's response structure in a central header. Signed-off-by: Pierre Morel Reviewed-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- lib/s390x/stsi.h | 32 ++++++++++++++++++++++++++++++ lib/s390x/vm.h | 2 ++ lib/s390x/vm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-- s390x/stsi.c | 23 ++-------------------- 4 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 lib/s390x/stsi.h diff --git a/lib/s390x/stsi.h b/lib/s390x/stsi.h new file mode 100644 index 00000000..bebc492d --- /dev/null +++ b/lib/s390x/stsi.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Structures used to Store System Information + * + * Copyright IBM Corp. 2022 + */ + +#ifndef _S390X_STSI_H_ +#define _S390X_STSI_H_ + +struct sysinfo_3_2_2 { + uint8_t reserved[31]; + uint8_t count; + struct { + uint8_t reserved2[4]; + uint16_t total_cpus; + uint16_t conf_cpus; + uint16_t standby_cpus; + uint16_t reserved_cpus; + uint8_t name[8]; + uint32_t caf; + uint8_t cpi[16]; + uint8_t reserved5[3]; + uint8_t ext_name_encoding; + uint32_t reserved3; + uint8_t uuid[16]; + } vm[8]; + uint8_t reserved4[1504]; + uint8_t ext_names[8][256]; +}; + +#endif /* _S390X_STSI_H_ */ diff --git a/lib/s390x/vm.h b/lib/s390x/vm.h index 7abba0cc..4456b48c 100644 --- a/lib/s390x/vm.h +++ b/lib/s390x/vm.h @@ -9,5 +9,7 @@ #define _S390X_VM_H_ bool vm_is_tcg(void); +bool vm_is_kvm(void); +bool vm_is_lpar(void); #endif /* _S390X_VM_H_ */ diff --git a/lib/s390x/vm.c b/lib/s390x/vm.c index a5b92863..33fb1c45 100644 --- a/lib/s390x/vm.c +++ b/lib/s390x/vm.c @@ -12,6 +12,7 @@ #include #include #include "vm.h" +#include "stsi.h" /** * Detect whether we are running with TCG (instead of KVM) @@ -26,9 +27,13 @@ bool vm_is_tcg(void) if (initialized) return is_tcg; + if (stsi_get_fc() != 3) { + initialized = true; + return is_tcg; + } + buf = alloc_page(); - if (!buf) - return false; + assert(buf); if (stsi(buf, 1, 1, 1)) goto out; @@ -43,3 +48,45 @@ out: free_page(buf); return is_tcg; } + +/** + * Detect whether we are running with KVM + */ +bool vm_is_kvm(void) +{ + /* EBCDIC for "KVM/" */ + const uint8_t kvm_ebcdic[] = { 0xd2, 0xe5, 0xd4, 0x61 }; + static bool initialized; + static bool is_kvm; + struct sysinfo_3_2_2 *stsi_322; + + if (initialized) + return is_kvm; + + if (stsi_get_fc() != 3 || vm_is_tcg()) { + initialized = true; + return is_kvm; + } + + stsi_322 = alloc_page(); + assert(stsi_322); + + if (stsi(stsi_322, 3, 2, 2)) + goto out; + + /* + * If the manufacturer string is "KVM/" in EBCDIC, then we + * are on KVM. + */ + is_kvm = !memcmp(&stsi_322->vm[0].cpi, kvm_ebcdic, sizeof(kvm_ebcdic)); + initialized = true; +out: + free_page(stsi_322); + return is_kvm; +} + +bool vm_is_lpar(void) +{ + return stsi_get_fc() == 2; +} + diff --git a/s390x/stsi.c b/s390x/stsi.c index 391f8849..dccc53e7 100644 --- a/s390x/stsi.c +++ b/s390x/stsi.c @@ -13,27 +13,8 @@ #include #include #include +#include -struct stsi_322 { - uint8_t reserved[31]; - uint8_t count; - struct { - uint8_t reserved2[4]; - uint16_t total_cpus; - uint16_t conf_cpus; - uint16_t standby_cpus; - uint16_t reserved_cpus; - uint8_t name[8]; - uint32_t caf; - uint8_t cpi[16]; - uint8_t reserved5[3]; - uint8_t ext_name_encoding; - uint32_t reserved3; - uint8_t uuid[16]; - } vm[8]; - uint8_t reserved4[1504]; - uint8_t ext_names[8][256]; -}; static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2))); static void test_specs(void) @@ -91,7 +72,7 @@ static void test_3_2_2(void) /* EBCDIC for "KVM/" */ const uint8_t cpi_kvm[] = { 0xd2, 0xe5, 0xd4, 0x61 }; const char vm_name_ext[] = "kvm-unit-test"; - struct stsi_322 *data = (void *)pagebuf; + struct sysinfo_3_2_2 *data = (void *)pagebuf; report_prefix_push("3.2.2");