From nobody Fri May 3 06:46:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1585638956; cv=none; d=zohomail.com; s=zohoarc; b=XR7nuMZmpHlwLsZpLoPcX54Xzb5nvAnRq/5092NFbNw2ZUl7QV2QlqpBRwWXjdH0nm230xOPtekMm9vscQvZkeeG0Vx4OfBGgndOf3xtMdLaeyhT5qpeHE1FmyH2xCAcfYR5pbXfAWQVzkOMxo7uIwRFrq2IRyNt1cZEh8d3R8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585638956; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CTI6u818habCUX9rX4RPwYTilTV3x4JkM+I9yZuyyQw=; b=l8AH712OkFJ0tVZT+hJFdFs3snaobGC5YGWwC1qexzL+cky95hRrToLvHk0FVyg02ej9OvefHr28XghDhITEquSp0mupQ4qSSmh8HUnzc7sgPvrzEYPlVP2EbMw3dKA7NRbgMLv09Mn/bfnX65GlhFFoimVPtHJ9ibhvXcN28Ss= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585638956884685.5232440021799; Tue, 31 Mar 2020 00:15:56 -0700 (PDT) Received: from localhost ([::1]:33144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJB7p-0005U1-VU for importer@patchew.org; Tue, 31 Mar 2020 03:15:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49804) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJB76-0004rb-VP for qemu-devel@nongnu.org; Tue, 31 Mar 2020 03:15:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJB75-00031g-PP for qemu-devel@nongnu.org; Tue, 31 Mar 2020 03:15:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51192) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJB75-000312-IK for qemu-devel@nongnu.org; Tue, 31 Mar 2020 03:15:07 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02V73eOO022428 for ; Tue, 31 Mar 2020 03:15:06 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3023382rcs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 31 Mar 2020 03:15:06 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 31 Mar 2020 08:14:57 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 31 Mar 2020 08:14:55 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02V7F0vP55705774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 31 Mar 2020 07:15:00 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D94652059; Tue, 31 Mar 2020 07:15:00 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.158.226]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 189A15204E; Tue, 31 Mar 2020 07:14:58 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [kvm-unit-tests PATCH v3] s390x: Add stsi 3.2.2 tests Date: Tue, 31 Mar 2020 03:14:56 -0400 X-Mailer: git-send-email 2.25.1 In-Reply-To: <2ebc49ff-479a-351d-36f9-cb79fe4b9804@redhat.com> References: <2ebc49ff-479a-351d-36f9-cb79fe4b9804@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 20033107-0012-0000-0000-0000039B7160 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20033107-0013-0000-0000-000021D87C54 Message-Id: <20200331071456.3302-1-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-03-31_02:2020-03-30, 2020-03-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 impostorscore=0 mlxscore=0 malwarescore=0 clxscore=1015 adultscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003310062 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: borntraeger@de.ibm.com, qemu-s390x@nongnu.org, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Subcode 3.2.2 is handled by KVM/QEMU and should therefore be tested a bit more thorough. In this test we set a custom name and uuid through the QEMU command line. Both parameters will be passed to the guest on a stsi subcode 3.2.2 call and will then be checked. We also compare the configured cpu numbers against the smp reported numbers and if the reserved + configured add up to the total number reported. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck --- * Tabify on struct * Moved prefix_push up a bit * Replaced returns with goto out to pop prefix --- s390x/stsi.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 1 + 2 files changed, 74 insertions(+) diff --git a/s390x/stsi.c b/s390x/stsi.c index e9206bca137d2edb..17ad33eefb9c948a 100644 --- a/s390x/stsi.c +++ b/s390x/stsi.c @@ -14,7 +14,28 @@ #include #include #include +#include =20 +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= ))); =20 static void test_specs(void) @@ -76,11 +97,63 @@ static void test_fc(void) report(stsi_get_fc(pagebuf) >=3D 2, "query fc >=3D 2"); } =20 +static void test_3_2_2(void) +{ + int rc; + /* EBCDIC for "kvm-unit" */ + const uint8_t vm_name[] =3D { 0x92, 0xa5, 0x94, 0x60, 0xa4, 0x95, 0x89, + 0xa3 }; + const uint8_t uuid[] =3D { 0x0f, 0xb8, 0x4a, 0x86, 0x72, 0x7c, + 0x11, 0xea, 0xbc, 0x55, 0x02, 0x42, 0xac, 0x13, + 0x00, 0x03 }; + /* EBCDIC for "KVM/" */ + const uint8_t cpi_kvm[] =3D { 0xd2, 0xe5, 0xd4, 0x61 }; + const char *vm_name_ext =3D "kvm-unit-test"; + struct stsi_322 *data =3D (void *)pagebuf; + + report_prefix_push("3.2.2"); + + /* Is the function code available at all? */ + if (stsi_get_fc(pagebuf) < 3) { + report_skip("Running under lpar, no level 3 to test."); + goto out; + } + + rc =3D stsi(pagebuf, 3, 2, 2); + report(!rc, "call"); + + /* For now we concentrate on KVM/QEMU */ + if (memcmp(&data->vm[0].cpi, cpi_kvm, sizeof(cpi_kvm))) { + report_skip("Not running under KVM/QEMU."); + goto out; + } + + report(!memcmp(data->vm[0].uuid, uuid, sizeof(uuid)), "uuid"); + report(data->vm[0].conf_cpus =3D=3D smp_query_num_cpus(), "cpu # configur= ed"); + report(data->vm[0].total_cpus =3D=3D + data->vm[0].reserved_cpus + data->vm[0].conf_cpus, + "cpu # total =3D=3D conf + reserved"); + report(data->vm[0].standby_cpus =3D=3D 0, "cpu # standby"); + report(!memcmp(data->vm[0].name, vm_name, sizeof(data->vm[0].name)), + "VM name =3D=3D kvm-unit-test"); + + if (data->vm[0].ext_name_encoding !=3D 2) { + report_skip("Extended VM names are not UTF-8."); + goto out; + } + report(!memcmp(data->ext_names[0], vm_name_ext, sizeof(vm_name_ext)), + "ext VM name =3D=3D kvm-unit-test"); + +out: + report_prefix_pop(); +} + int main(void) { report_prefix_push("stsi"); test_priv(); test_specs(); test_fc(); + test_3_2_2(); return report_summary(); } diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 12d46c5b402328bb..06e556836c102a14 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -71,6 +71,7 @@ extra_params=3D-device diag288,id=3Dwatchdog0 --watchdog-= action inject-nmi =20 [stsi] file =3D stsi.elf +extra_params=3D-name kvm-unit-test --uuid 0fb84a86-727c-11ea-bc55-0242ac13= 0003 -smp 1,maxcpus=3D8 =20 [smp] file =3D smp.elf --=20 2.25.1