From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49978 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729705AbgC3NAY (ORCPT ); Mon, 30 Mar 2020 09:00:24 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02UCWVZe128904 for ; Mon, 30 Mar 2020 09:00:23 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 3021vtjmak-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Mar 2020 09:00:23 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Mar 2020 14:00:10 +0100 Subject: Re: [kvm-unit-tests PATCH] s390x: Add stsi 3.2.2 tests References: <20200330122035.19607-1-frankja@linux.ibm.com> <860a5575-226a-9b6e-4db0-b1b9dc72b3ed@redhat.com> From: Janosch Frank Date: Mon, 30 Mar 2020 15:00:15 +0200 MIME-Version: 1.0 In-Reply-To: <860a5575-226a-9b6e-4db0-b1b9dc72b3ed@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GcsqjnL6B1KjJNv95lqQOP89AkRTqP6T3" Message-Id: Sender: linux-s390-owner@vger.kernel.org List-ID: To: David Hildenbrand , kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, cohuck@redhat.com, borntraeger@de.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GcsqjnL6B1KjJNv95lqQOP89AkRTqP6T3 Content-Type: multipart/mixed; boundary="CVeTfAK8d2adN8uKCD2aOig2i7wZd0B6Z" --CVeTfAK8d2adN8uKCD2aOig2i7wZd0B6Z Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 3/30/20 2:51 PM, David Hildenbrand wrote: > On 30.03.20 14:20, Janosch Frank wrote: >> 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 total and configured cpu numbers against the smp >> reported numbers. >> >> Signed-off-by: Janosch Frank >> --- >> s390x/stsi.c | 62 ++++++++++++++++++++++++++++++++++++++++++++= + >> s390x/unittests.cfg | 1 + >> 2 files changed, 63 insertions(+) >> >> diff --git a/s390x/stsi.c b/s390x/stsi.c >> index e9206bca137d2edb..10e588a78cc05186 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_SIZ= E * 2))); >> =20 >> static void test_specs(void) >> @@ -76,11 +97,52 @@ 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" */ >> + uint8_t vm_name[] =3D { 0x92, 0xa5, 0x94, 0x60, 0xa4, 0x95, 0x89, 0x= a3 }; >> + uint8_t uuid[] =3D { 0x0f, 0xb8, 0x4a, 0x86, 0x72, 0x7c, >> + 0x11, 0xea, 0xbc, 0x55, 0x02, 0x42, 0xac, 0x13, >> + 0x00, 0x03 }; >> + /* EBCDIC for "KVM/" */ >> + 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; >> + >> + /* Is the function code available at all? */ >> + if (stsi_get_fc(pagebuf) < 3) >> + return; >> + >> + report_prefix_push("3.2.2"); >> + 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))) >> + goto out; >> + >> + report(data->vm[0].total_cpus =3D=3D smp_query_num_cpus(), "cpu # to= tal"); >> + report(data->vm[0].conf_cpus =3D=3D smp_query_num_cpus(), "cpu # con= figured"); >> + report(data->vm[0].standby_cpus =3D=3D 0, "cpu # standby"); >> + report(data->vm[0].reserved_cpus =3D=3D 0, "cpu # reserved"); >> + report(!memcmp(data->vm[0].name, vm_name, sizeof(data->vm[0].name)),= >> + "VM name =3D=3D kvm-unit-test"); >> + report(data->vm[0].ext_name_encoding =3D=3D 2, "ext name encoding UT= F-8"); >=20 > should you rather do >=20 > if (data->vm[0].ext_name_encoding =3D=3D 2) { > ... > } else { > report_skip(...); > } >=20 > to make this future-proof? >=20 Do you expect UTF-16 or EBCDIC in the future? :) --CVeTfAK8d2adN8uKCD2aOig2i7wZd0B6Z-- --GcsqjnL6B1KjJNv95lqQOP89AkRTqP6T3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEwGNS88vfc9+v45Yq41TmuOI4ufgFAl6B7V8ACgkQ41TmuOI4 ufhxlxAAn8rGm3Oo0C4N3oxopqHvXMTTR5AvW817gZeXnXIzhMFbKeS+7kEo5f5K gJ6hI3Jlb1FHVfts2NG8HWSsqvlZEFUWMQI8Zu4xhUQHchCsAeMN8TlnkokqztHb kM3wpVtfQx+akNnAW1IkMBHqO4Aft50bHgUxhKeRXJWBFicbInVqPDZnvjmbtF/f lWNhfK+GJEyiPPUmuVdfGJPTbjZA/f00hGjQFq9QKJC0V+8HY6u199+h3mFCfrPN 1tP+zk/rUNLU5N11tnW1rVlz34BDzJ198Ybr/0CM5I9MHlraiPjF8HKFXTm4i4rC SSURG3rRXv5owB2R/r851hbO0Yrwj0Fn+yH7mtFzkYw5DyhXEw72PHzs5fO9609t R+zNI9Eb2FExtEsFmTcNjIiYBN6j040At40sNQ0AsIgKMreIExUjON9DSyZmMi7X geMjpxkDzsazA3UxeRfd/IT4OxYXXDDejQN6ySKk2pZi5Vo9Sqh2q2IGRgbSmM36 v1zu49urn4QJyiUKSyiANp29ynYqWfI4Sdqsmni8+NExvNIPn0eDvOLvSzS12QGQ /sbGGENfaAZ5RonfYTmGCtEePBO0uK6mEFlxTeX/ZUxVXVErkAlrAss8M7qLYvp7 1uUulUauioQTygWL50zKuV+aq8mp8xCbnhX1EqKiryjWsQczVns= =uxLl -----END PGP SIGNATURE----- --GcsqjnL6B1KjJNv95lqQOP89AkRTqP6T3--