From: Janosch Frank <frankja@linux.ibm.com>
To: Anthony Krowiak <akrowiak@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com,
nrb@linux.ibm.com, jjherne@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v4 2/7] s390x: Add guest 2 AP test
Date: Wed, 21 Feb 2024 08:57:28 +0100 [thread overview]
Message-ID: <e1d9aa94-c63b-4214-a091-b2aee0cd21f9@linux.ibm.com> (raw)
In-Reply-To: <f05c83a9-bcc6-4963-98f4-72159673ba3a@linux.ibm.com>
On 2/20/24 17:38, Anthony Krowiak wrote:
> I made a couple of function name change suggestions, but those are not
> critical:
>
> Acked-by: Anthony Krowiak <akrowiak@linux.ibm.com>
>
> On 2/2/24 9:59 AM, Janosch Frank wrote:
>> Add a test that checks the exceptions for the PQAP, NQAP and DQAP
>> adjunct processor (AP) crypto instructions.
>>
>> Since triggering the exceptions doesn't require actual AP hardware,
>> this test can run without complicated setup.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>> s390x/Makefile | 1 +
>> s390x/ap.c | 309 ++++++++++++++++++++++++++++++++++++++++++++
>> s390x/unittests.cfg | 3 +
>> 3 files changed, 313 insertions(+)
>> create mode 100644 s390x/ap.c
>>
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index 4f6c627d..6d28a5bf 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -42,6 +42,7 @@ tests += $(TEST_DIR)/exittime.elf
>> tests += $(TEST_DIR)/ex.elf
>> tests += $(TEST_DIR)/topology.elf
>> tests += $(TEST_DIR)/sie-dat.elf
>> +tests += $(TEST_DIR)/ap.elf
>>
>> pv-tests += $(TEST_DIR)/pv-diags.elf
>> pv-tests += $(TEST_DIR)/pv-icptcode.elf
>> diff --git a/s390x/ap.c b/s390x/ap.c
>> new file mode 100644
>> index 00000000..b3cee37a
>> --- /dev/null
>> +++ b/s390x/ap.c
>> @@ -0,0 +1,309 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * AP instruction G2 tests
>> + *
>> + * Copyright (c) 2024 IBM Corp
>> + *
>> + * Authors:
>> + * Janosch Frank <frankja@linux.ibm.com>
>> + */
>> +
>> +#include <libcflat.h>
>> +#include <interrupt.h>
>> +#include <bitops.h>
>> +#include <alloc_page.h>
>> +#include <asm/facility.h>
>> +#include <asm/time.h>
>> +#include <ap.h>
>> +
>> +/* For PQAP PGM checks where we need full control over the input */
>> +static void pqap(unsigned long grs[3])
>> +{
>> + asm volatile(
>> + " lgr 0,%[r0]\n"
>> + " lgr 1,%[r1]\n"
>> + " lgr 2,%[r2]\n"
>> + " .insn rre,0xb2af0000,0,0\n" /* PQAP */
>> + :: [r0] "d" (grs[0]), [r1] "d" (grs[1]), [r2] "d" (grs[2])
>> + : "cc", "memory", "0", "1", "2");
>> +}
>> +
>> +static void test_pgms_pqap(void)
>
>
> If I saw this function name without having read the patch description, I
> wouldn't have any idea what is being tested.
>
> Maybe test_pqap_pgm_chk?
If I'm not mistaken, then it should be consistent with the pgm checks
for other instructions but I don't mind renaming it.
>
>
>> +{
>> + unsigned long grs[3] = {};
>> + struct pqap_r0 *r0 = (struct pqap_r0 *)grs;
>> + uint8_t *data = alloc_page();
>> + uint16_t pgm;
>> + int fails = 0;
>> + int i;
>> +
>> + report_prefix_push("pqap");
>> +
>> + /* Wrong FC code */
>> + report_prefix_push("invalid fc");
>> + r0->fc = 42;
>
>
> Just out of curiosity, why 42? Why not some ridiculous number that will
> never be used for a function code, like 4294967295?
No particular reason.
Increasing the number would increase the buffer zone of invalid values
but there's currently only a hand full of values defined anyway.
I might add a couple of 0s to this for the next version and call it a day.
next prev parent reply other threads:[~2024-02-21 7:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 14:59 [kvm-unit-tests PATCH v4 0/7] s390x: Add base AP support Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 1/7] lib: s390x: Add ap library Janosch Frank
2024-02-05 18:15 ` Anthony Krowiak
2024-02-06 8:48 ` Harald Freudenberger
2024-02-06 15:45 ` Anthony Krowiak
2024-02-06 13:42 ` Janosch Frank
2024-02-06 15:55 ` Anthony Krowiak
2024-02-07 8:06 ` Harald Freudenberger
2024-02-07 14:30 ` Anthony Krowiak
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 2/7] s390x: Add guest 2 AP test Janosch Frank
2024-02-20 16:38 ` Anthony Krowiak
2024-02-21 7:57 ` Janosch Frank [this message]
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 3/7] lib: s390x: ap: Add proper ap setup code Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 4/7] s390x: ap: Add pqap aqic tests Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 5/7] s390x: ap: Add reset tests Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 6/7] lib: s390x: ap: Add tapq test facility bit Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 7/7] s390x: ap: Add nq/dq len test Janosch Frank
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1d9aa94-c63b-4214-a091-b2aee0cd21f9@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox