From patchwork Thu Mar 31 16:04: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: 12797436 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 7916AC4332F for ; Thu, 31 Mar 2022 16:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239597AbiCaQGY (ORCPT ); Thu, 31 Mar 2022 12:06:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237963AbiCaQGW (ORCPT ); Thu, 31 Mar 2022 12:06:22 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E46522E7; Thu, 31 Mar 2022 09:04:35 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22VFC6Cs027164; Thu, 31 Mar 2022 16:04: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=c5SFzfQf7kPWAzQreYEcrFgHzA3W7E8LW8DsMlnJOXU=; b=pFkh2Xs8HrN6gbfzowWTuiEYAEj0Xm91xzRl/E7pJKfeE/vD9IA0LY827zW5b6idXrB6 6TxMNGKvYOBqbOqBzN8yuOhrMfQYr93MKRNskX2VgnVdomL15ZDxb3uU2Q2bnpKKHTmQ WlqWD7DdCpiJ9ydUs9cVYwCDYbyFIN6IKCSnl/FqS3KtvVkCNwrqlG3adenjN/DUkNhG Ev+sc3y4duk5fni2T62ds2IZMQ3zp8cDexEyY3raVnZLR72Ja7GnvKlfAU9eljVTjWBI iXNCNolu/la2qZa1LpSJHpoCs4mx7wLfRyRUIrTh7jcQJXbUfcK2VoVBKl4eR2Is5WSR Vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f54epq312-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:35 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22VFmO5q004796; Thu, 31 Mar 2022 16:04:34 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 3f54epq304-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:34 +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 22VG1kB3028736; Thu, 31 Mar 2022 16:04:32 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3f1tf91ebh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:32 +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 22VG4TdQ16318836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Mar 2022 16:04:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFAFF11C04C; Thu, 31 Mar 2022 16:04:28 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3281111C04A; Thu, 31 Mar 2022 16:04:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Mar 2022 16:04:28 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com, scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com, david@redhat.com Subject: [kvm-unit-tests PATCH v2 1/5] s390x: remove spurious includes Date: Thu, 31 Mar 2022 18:04:15 +0200 Message-Id: <20220331160419.333157-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com> References: <20220331160419.333157-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 6D6LL3HtHYIZsFOQgbxqFwwwGJkKjGkm X-Proofpoint-ORIG-GUID: ilnfwGiBEtTM2qcPgy4rbE_5FHlRYZT8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-31_05,2022-03-31_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 suspectscore=0 clxscore=1015 mlxlogscore=894 lowpriorityscore=0 spamscore=0 impostorscore=0 priorityscore=1501 phishscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203310089 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Remove unused includes of vm.h Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- s390x/mvpg-sie.c | 1 - s390x/pv-diags.c | 1 - s390x/spec_ex-sie.c | 1 - 3 files changed, 3 deletions(-) diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c index 8ae9a52a..46a2edb6 100644 --- a/s390x/mvpg-sie.c +++ b/s390x/mvpg-sie.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c index 110547ad..6899b859 100644 --- a/s390x/pv-diags.c +++ b/s390x/pv-diags.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c index 5dea4115..d8e25e75 100644 --- a/s390x/spec_ex-sie.c +++ b/s390x/spec_ex-sie.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include From patchwork Thu Mar 31 16:04: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: 12797438 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 E0698C433F5 for ; Thu, 31 Mar 2022 16:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239603AbiCaQGZ (ORCPT ); Thu, 31 Mar 2022 12:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236954AbiCaQGX (ORCPT ); Thu, 31 Mar 2022 12:06:23 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3A13B879; Thu, 31 Mar 2022 09:04:35 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22VFENf7016699; Thu, 31 Mar 2022 16:04: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=MddiOPWhgpVDu/wZoAjOydjdF2Xsvvpw/2vdvVBApbQ=; b=Kfgbna1cKyiOT45Q6GfHard9iTTVVcGJUHolIWSWnosKRyTpszI9EAb6uguaz0RnrJp6 Q9qBkfYH397dVdbspcXZacD5d09JDX0cTF4l1vKAZuDl1lhMs5/qBpl6sSwPZo1wE5/1 KApXTnpZ8sQ7qESj0KHrIYxK4rsQEl83A0t8joB8/oKI9j4SFjL6uUJXZvflqTRfsdkm MzoDEtjWVTvTxh8t33+yfZERpHyta1l7bdNWOzA8RH4LufLWE2uWZbwj1eFle+FwGwl5 PNP0jPk9wZ/Mz+V9LnxgPXU4FZwp1IgZ0pwcfyrTWJAxllawAglNKBOUW8ADd/FdJRlP 5w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f57rmu9tx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:35 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22VEkSuO005706; Thu, 31 Mar 2022 16:04:35 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f57rmu9t4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:35 +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 22VG1FoP003948; Thu, 31 Mar 2022 16:04:32 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 3f1tf8ses5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:32 +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 22VG4TTZ34472428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Mar 2022 16:04:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A64B11C04C; Thu, 31 Mar 2022 16:04:29 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E01911C050; Thu, 31 Mar 2022 16:04:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Mar 2022 16:04:28 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com, scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com, david@redhat.com Subject: [kvm-unit-tests PATCH v2 2/5] s390x: skey: remove check for old z/VM version Date: Thu, 31 Mar 2022 18:04:16 +0200 Message-Id: <20220331160419.333157-3-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com> References: <20220331160419.333157-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Z66LNtjqUFZ2IetjVhgEh0xDDl6qrLyR X-Proofpoint-ORIG-GUID: ydiBU9mexjt3RaYubQQPzFy9rx7K9dKr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-31_05,2022-03-31_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203310089 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Remove the check for z/VM 6.x, since it is not needed anymore. Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- s390x/skey.c | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/s390x/skey.c b/s390x/skey.c index 58a55436..edad53e9 100644 --- a/s390x/skey.c +++ b/s390x/skey.c @@ -65,33 +65,9 @@ static void test_set(void) "set key test"); } -/* Returns true if we are running under z/VM 6.x */ -static bool check_for_zvm6(void) -{ - int dcbt; /* Descriptor block count */ - int nr; - static const unsigned char zvm6[] = { - /* This is "z/VM 6" in EBCDIC */ - 0xa9, 0x61, 0xe5, 0xd4, 0x40, 0x40, 0x40, 0x40, 0xf6 - }; - - if (stsi(pagebuf, 3, 2, 2)) - return false; - - dcbt = pagebuf[31] & 0xf; - - for (nr = 0; nr < dcbt; nr++) { - if (!memcmp(&pagebuf[32 + nr * 64 + 24], zvm6, sizeof(zvm6))) - return true; - } - - return false; -} - static void test_priv(void) { union skey skey; - bool is_zvm6 = check_for_zvm6(); memset(pagebuf, 0, PAGE_SIZE * 2); report_prefix_push("privileged"); @@ -106,15 +82,10 @@ static void test_priv(void) report(skey.str.acc != 3, "skey did not change on exception"); report_prefix_push("iske"); - if (is_zvm6) { - /* There is a known bug with z/VM 6, so skip the test there */ - report_skip("not working on z/VM 6"); - } else { - expect_pgm_int(); - enter_pstate(); - get_storage_key(pagebuf); - check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); - } + expect_pgm_int(); + enter_pstate(); + get_storage_key(pagebuf); + check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION); report_prefix_pop(); report_prefix_pop(); From patchwork Thu Mar 31 16:04: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: 12797439 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 75B9AC4332F for ; Thu, 31 Mar 2022 16:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239612AbiCaQG0 (ORCPT ); Thu, 31 Mar 2022 12:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239598AbiCaQGY (ORCPT ); Thu, 31 Mar 2022 12:06:24 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E5D2522E7; Thu, 31 Mar 2022 09:04:37 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22VFahOM016016; Thu, 31 Mar 2022 16:04: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=rLVE9VtZ0lAKGc3RPIIxPATf7KxinhW7F4dIGiR+imI=; b=oxtMAui833Y7Y+YDwDko1vrnLnYEyx5sF0/m3RSQ2GkydRhjbAiVISeV3rHZ699b5Yw/ OWmDW7QlgpCIolTdbJRCgntb5jWf3K+sowcEMuXOtim0hM83Og0ytADjBmd/4K/tJNa2 y9evB4eqQgpjWAUUqFyNjUqoel8wtJPomn52XPTmoXl4IcG87LLiWXqgpt/IQ4dFyKp9 xEv1GPlLqzS2wCEHS2WBuPTuCIplfsKzCcQImmKwCCnAoalaUbQsE4F4yXezlFO3AIu7 xjI0ThpvW9ZMpyaQogo7+jctprsjZ7jKISBmQPkrI3T5qyJFiQqKY595cHmuOXNXlgjb xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f57rmu9ua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:36 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22VFxA1T023891; Thu, 31 Mar 2022 16:04:36 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 3f57rmu9te-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:36 +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 22VG19ek004830; Thu, 31 Mar 2022 16:04:33 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 3f1tf91fe6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04: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 22VG4afh40370478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Mar 2022 16:04:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2279111C052; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D31411C050; Thu, 31 Mar 2022 16:04:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Mar 2022 16:04:29 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com, scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com, david@redhat.com Subject: [kvm-unit-tests PATCH v2 3/5] lib: s390: rename and refactor vm.[ch] Date: Thu, 31 Mar 2022 18:04:17 +0200 Message-Id: <20220331160419.333157-4-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com> References: <20220331160419.333157-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TTNUo2oYEqp5qQo389_7-p5jAWYaYq6Q X-Proofpoint-ORIG-GUID: k39CQbGENUMLsdIhHeDgSA01ZEdwwo1i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-31_05,2022-03-31_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203310089 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Refactor and rename vm.[ch] to hardware.[ch] * Rename vm.[ch] to hardware.[ch] * Consolidate all detection functions into detect_host, which returns what host system the test is running on * Rename vm_is_* functions to host_is_*, which are then just wrappers around detect_host Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- s390x/Makefile | 2 +- lib/s390x/hardware.h | 40 +++++++++++++++++++ lib/s390x/vm.h | 15 -------- lib/s390x/hardware.c | 69 +++++++++++++++++++++++++++++++++ lib/s390x/vm.c | 92 -------------------------------------------- s390x/cpumodel.c | 4 +- s390x/mvpg.c | 4 +- 7 files changed, 114 insertions(+), 112 deletions(-) create mode 100644 lib/s390x/hardware.h delete mode 100644 lib/s390x/vm.h create mode 100644 lib/s390x/hardware.c delete mode 100644 lib/s390x/vm.c diff --git a/s390x/Makefile b/s390x/Makefile index 53b0fe04..9d3a1fd7 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -78,7 +78,7 @@ cflatobjs += lib/s390x/sclp-console.o cflatobjs += lib/s390x/interrupt.o cflatobjs += lib/s390x/mmu.o cflatobjs += lib/s390x/smp.o -cflatobjs += lib/s390x/vm.o +cflatobjs += lib/s390x/hardware.o cflatobjs += lib/s390x/css_dump.o cflatobjs += lib/s390x/css_lib.o cflatobjs += lib/s390x/malloc_io.o diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h new file mode 100644 index 00000000..e5910ea5 --- /dev/null +++ b/lib/s390x/hardware.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Functions to retrieve information about the host system. + * + * Copyright (c) 2020 Red Hat Inc + * Copyright 2022 IBM Corp. + * + * Authors: + * Claudio Imbrenda + */ + +#ifndef _S390X_HARDWARE_H_ +#define _S390X_HARDWARE_H_ +#include + +enum s390_host { + HOST_IS_UNKNOWN, + HOST_IS_LPAR, + HOST_IS_KVM, + HOST_IS_TCG +}; + +enum s390_host detect_host(void); + +static inline bool host_is_tcg(void) +{ + return detect_host() == HOST_IS_TCG; +} + +static inline bool host_is_kvm(void) +{ + return detect_host() == HOST_IS_KVM; +} + +static inline bool host_is_lpar(void) +{ + return detect_host() == HOST_IS_LPAR; +} + +#endif /* _S390X_HARDWARE_H_ */ diff --git a/lib/s390x/vm.h b/lib/s390x/vm.h deleted file mode 100644 index 4456b48c..00000000 --- a/lib/s390x/vm.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Functions to retrieve VM-specific information - * - * Copyright (c) 2020 Red Hat Inc - */ - -#ifndef _S390X_VM_H_ -#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/hardware.c b/lib/s390x/hardware.c new file mode 100644 index 00000000..2bcf9c4c --- /dev/null +++ b/lib/s390x/hardware.c @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Functions to retrieve information about the host system. + * + * Copyright (c) 2020 Red Hat Inc + * Copyright 2022 IBM Corp. + * + * Authors: + * Thomas Huth + * Claudio Imbrenda + */ + +#include +#include +#include +#include "hardware.h" +#include "stsi.h" + +/* The string "QEMU" in EBCDIC */ +static const uint8_t qemu_ebcdic[] = { 0xd8, 0xc5, 0xd4, 0xe4 }; +/* The string "KVM/" in EBCDIC */ +static const uint8_t kvm_ebcdic[] = { 0xd2, 0xe5, 0xd4, 0x61 }; + +static enum s390_host do_detect_host(void *buf) +{ + struct sysinfo_3_2_2 *stsi_322 = buf; + + if (stsi_get_fc() == 2) + return HOST_IS_LPAR; + + if (stsi_get_fc() != 3) + return HOST_IS_UNKNOWN; + + if (!stsi(buf, 1, 1, 1)) { + /* + * If the manufacturer string is "QEMU" in EBCDIC, then we + * are on TCG (otherwise the string is "IBM" in EBCDIC) + */ + if (!memcmp((char *)buf + 32, qemu_ebcdic, sizeof(qemu_ebcdic))) + return HOST_IS_TCG; + } + + if (!stsi(buf, 3, 2, 2)) { + /* + * If the manufacturer string is "KVM/" in EBCDIC, then we + * are on KVM. + */ + if (!memcmp(&stsi_322->vm[0].cpi, kvm_ebcdic, sizeof(kvm_ebcdic))) + return HOST_IS_KVM; + } + + return HOST_IS_UNKNOWN; +} + +enum s390_host detect_host(void) +{ + static enum s390_host host = HOST_IS_UNKNOWN; + static bool initialized = false; + void *buf; + + if (initialized) + return host; + + buf = alloc_page(); + host = do_detect_host(buf); + free_page(buf); + initialized = true; + return host; +} diff --git a/lib/s390x/vm.c b/lib/s390x/vm.c deleted file mode 100644 index 33fb1c45..00000000 --- a/lib/s390x/vm.c +++ /dev/null @@ -1,92 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Functions to retrieve VM-specific information - * - * Copyright (c) 2020 Red Hat Inc - * - * Authors: - * Thomas Huth - */ - -#include -#include -#include -#include "vm.h" -#include "stsi.h" - -/** - * Detect whether we are running with TCG (instead of KVM) - */ -bool vm_is_tcg(void) -{ - const char qemu_ebcdic[] = { 0xd8, 0xc5, 0xd4, 0xe4 }; - static bool initialized = false; - static bool is_tcg = false; - uint8_t *buf; - - if (initialized) - return is_tcg; - - if (stsi_get_fc() != 3) { - initialized = true; - return is_tcg; - } - - buf = alloc_page(); - assert(buf); - - if (stsi(buf, 1, 1, 1)) - goto out; - - /* - * If the manufacturer string is "QEMU" in EBCDIC, then we - * are on TCG (otherwise the string is "IBM" in EBCDIC) - */ - is_tcg = !memcmp(&buf[32], qemu_ebcdic, sizeof(qemu_ebcdic)); - initialized = true; -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/cpumodel.c b/s390x/cpumodel.c index 23ccf842..5c0b73e0 100644 --- a/s390x/cpumodel.c +++ b/s390x/cpumodel.c @@ -10,7 +10,7 @@ */ #include -#include +#include #include #include #include @@ -118,7 +118,7 @@ int main(void) 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(), + report_xfail(dep[i].expected_tcg_fail && host_is_tcg(), test_facility(dep[i].implied), "implication not correct"); } else { diff --git a/s390x/mvpg.c b/s390x/mvpg.c index 2b7c6cc9..62f0fc5a 100644 --- a/s390x/mvpg.c +++ b/s390x/mvpg.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include /* Used to build the appropriate test values for register 0 */ #define KFC(x) ((x) << 10) @@ -251,7 +251,7 @@ static void test_mmu_prot(void) fresh += PAGE_SIZE; /* Known issue in TCG: CCO flag is not honoured */ - if (vm_is_tcg()) { + if (host_is_tcg()) { report_prefix_push("TCG"); report_skip("destination invalid"); report_skip("source invalid"); From patchwork Thu Mar 31 16:04: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: 12797440 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 3F8D1C433F5 for ; Thu, 31 Mar 2022 16:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239615AbiCaQG2 (ORCPT ); Thu, 31 Mar 2022 12:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239600AbiCaQGY (ORCPT ); Thu, 31 Mar 2022 12:06:24 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6975652E55; Thu, 31 Mar 2022 09:04:37 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22VDlGJg020310; Thu, 31 Mar 2022 16:04: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=kmH7ixRu74e22eetf7O9MPwUExbGy9jewecSi9Btqw4=; b=WcDh5c3rRf9LZ0YygKCluRv0VOyCZGGc28SOVWXiRFmhHCZrUCuTTCrva/jVPUeSbtTk nJ7IkJrNjELEG0ipjGk9SrbSgTLW99RP6HPxNAhn6tlN2Ve5GCTc4dzdtFBRybI2iIX4 WnsSebhMeF0x5dmj69gSy11lt6AlGkAnEjrmRm9ZGisliLA74GX7vyYz5rxUVtlHhvic NX7akj8HqrEWLvBsAcr9Y7mItnvxUg2ryxHWiiKeLk/T9egc/rri4gikrGLENjwgnaN7 QJzinm7JvGKhjh9cccTwTh6podJkvIlrnP5wBeE8o997bv0Zh6LYM/1RBPg+3pwAkc3N YA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f52nsrj8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:36 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22VFc0LB007998; Thu, 31 Mar 2022 16:04:36 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f52nsrj83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:36 +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 22VFwcKw000418; Thu, 31 Mar 2022 16:04:34 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 3f1t3j1gs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04: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 22VG4aZf46203374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Mar 2022 16:04:36 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC4A411C052; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3763811C050; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com, scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com, david@redhat.com Subject: [kvm-unit-tests PATCH v2 4/5] lib: s390x: functions for machine models Date: Thu, 31 Mar 2022 18:04:18 +0200 Message-Id: <20220331160419.333157-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com> References: <20220331160419.333157-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: JFBA11ref_F_2ElK7k-i5N2iljMzNf_s X-Proofpoint-ORIG-GUID: CwYYJqYkOqBWuoff-JscbSM5vh6YrTTp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-31_05,2022-03-31_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxlogscore=656 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203310089 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org * move existing macros for machine models to hardware.h * add machine_is_* functions Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 3 --- lib/s390x/hardware.h | 10 ++++++++++ s390x/uv-host.c | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 40626d72..8d860ccf 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -219,9 +219,6 @@ static inline unsigned short stap(void) return cpu_address; } -#define MACHINE_Z15A 0x8561 -#define MACHINE_Z15B 0x8562 - static inline uint16_t get_machine_id(void) { uint64_t cpuid; diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h index e5910ea5..af20be18 100644 --- a/lib/s390x/hardware.h +++ b/lib/s390x/hardware.h @@ -13,6 +13,9 @@ #define _S390X_HARDWARE_H_ #include +#define MACHINE_Z15 0x8561 +#define MACHINE_Z15T02 0x8562 + enum s390_host { HOST_IS_UNKNOWN, HOST_IS_LPAR, @@ -37,4 +40,11 @@ static inline bool host_is_lpar(void) return detect_host() == HOST_IS_LPAR; } +static inline bool machine_is_z15(void) +{ + uint16_t machine = get_machine_id(); + + return machine == MACHINE_Z15 || machine == MACHINE_Z15T02; +} + #endif /* _S390X_HARDWARE_H_ */ diff --git a/s390x/uv-host.c b/s390x/uv-host.c index de2e4850..d3018e3c 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -111,7 +112,6 @@ static void test_config_destroy(void) static void test_cpu_destroy(void) { int rc; - uint16_t machineid = get_machine_id(); struct uv_cb_nodata uvcb = { .header.len = sizeof(uvcb), .header.cmd = UVC_CMD_DESTROY_SEC_CPU, @@ -126,7 +126,7 @@ static void test_cpu_destroy(void) "hdr invalid length"); uvcb.header.len += 8; - if (machineid != MACHINE_Z15A && machineid != MACHINE_Z15B) { + if (!machine_is_z15()) { uvcb.handle += 1; rc = uv_call(0, (uint64_t)&uvcb); report(rc == 1 && uvcb.header.rc == UVC_RC_INV_CHANDLE, "invalid handle"); From patchwork Thu Mar 31 16:04: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: 12797441 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 9CB1EC433FE for ; Thu, 31 Mar 2022 16:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235086AbiCaQG3 (ORCPT ); Thu, 31 Mar 2022 12:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239608AbiCaQGZ (ORCPT ); Thu, 31 Mar 2022 12:06:25 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42BAB879; Thu, 31 Mar 2022 09:04:37 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22VEDdRS020596; Thu, 31 Mar 2022 16:04: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=xldSF39mUuRll1043UB57opeZCqbLkGfiTZQPtI7n9g=; b=kr1HHF2msGlfbqpGIBz9KALFJ/y6AmZsmtD/Tew9mjGaX5OVoUAPO1sajwotXeunZoeQ LGmx29FhTNHDd7NEW61vil8rz8IvKAQ0OavVu2E2vwmH9moCXFWwnEA/R9d1yZRL1a9+ ZWTM/hZIUSvBkzSuFodCUaXfSN1MKy3j4F3k5VUu6uSVfeC/zS8GvnxAzZA0bugTCwZq yOJBvz8fZB81Jrnc3HKQVf+e8jRN9fc36pYzyX6j7xhBX+5XCEW5Irvih1OfWOvZSqww ADDmVDYpUe3nG3Ki901prsXJ9d6PcW70vGD92UCEBAkLb/8sHOax241LfJXVoWm5UCF3 +Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f562rw8n7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:37 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22VFt5bD013549; Thu, 31 Mar 2022 16:04:36 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 3f562rw8me-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:36 +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 22VFxT3v013363; Thu, 31 Mar 2022 16:04:34 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 3f3rs3p4p9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 31 Mar 2022 16:04:34 +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 22VFqTxO21037438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Mar 2022 15:52:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4985411C05B; Thu, 31 Mar 2022 16:04:31 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA03111C04C; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Mar 2022 16:04:30 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com, scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com, pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com, david@redhat.com Subject: [kvm-unit-tests PATCH v2 5/5] lib: s390x: stidp wrapper and move get_machine_id Date: Thu, 31 Mar 2022 18:04:19 +0200 Message-Id: <20220331160419.333157-6-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com> References: <20220331160419.333157-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: zmH4QL2vNgXxSx_GdALXBVKCqdrqkDE6 X-Proofpoint-ORIG-GUID: g0hgtXhG54UzULEbXIMq2mT4zsFnuvme X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-31_05,2022-03-31_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 mlxlogscore=997 impostorscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203310089 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Refactor get_machine_id in arch_def.h into a simple wrapper around stidp, add back get_machine_id in hardware.h using the stidp wrapper. Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 4 +--- lib/s390x/hardware.h | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 8d860ccf..bab3c374 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -219,13 +219,11 @@ static inline unsigned short stap(void) return cpu_address; } -static inline uint16_t get_machine_id(void) +static inline uint64_t stidp(void) { uint64_t cpuid; asm volatile("stidp %0" : "=Q" (cpuid)); - cpuid = cpuid >> 16; - cpuid &= 0xffff; return cpuid; } diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h index af20be18..01eeb261 100644 --- a/lib/s390x/hardware.h +++ b/lib/s390x/hardware.h @@ -25,6 +25,11 @@ enum s390_host { enum s390_host detect_host(void); +static inline uint16_t get_machine_id(void) +{ + return stidp() >> 16; +} + static inline bool host_is_tcg(void) { return detect_host() == HOST_IS_TCG;