From: Janosch Frank <frankja@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, thuth@redhat.com, nrb@linux.ibm.com,
linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 2/5] s390x: Add guest 2 AP test
Date: Fri, 31 Mar 2023 10:52:32 +0200 [thread overview]
Message-ID: <5a768b62-0552-1174-2040-a9ee04fbc49a@linux.ibm.com> (raw)
In-Reply-To: <20230330183431.3003b391@p-imbrenda>
On 3/30/23 18:34, Claudio Imbrenda wrote:
> On Thu, 30 Mar 2023 11:42:41 +0000
> Janosch Frank <frankja@linux.ibm.com> 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>
>> ---
>
> [...]
>
>> +
>> +static void test_pgms_pqap(void)
>> +{
>> + 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;
>
> maybe make a macro out of it, both to avoid magic numbers and to change
> it easily if code 42 will ever become defined in the future.
I don't really see a benefit to that.
>
>> + expect_pgm_int();
>> + pqap(grs);
>> + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
>> + memset(grs, 0, sizeof(grs));
>> + report_prefix_pop();
>> +
>> + report_prefix_push("invalid gr0 bits");
>> + for (i = 42; i < 6; i++) {
>
> 42 is not < 6, this whole thing will be skipped?
Right, I've fixed this.
[...]
>> +
>> +static void test_pgms_nqap(void)
>> +{
>> + uint8_t gr0_zeroes_bits[] = {
>> + 32, 34, 35, 40
>> + };
>> + uint64_t gr0;
>> + bool fail;
>> + int i;
>> +
>> + report_prefix_push("nqap");
>> +
>> + /* Registers 0 and 1 are always used, the others are
>> even/odd pairs */
>> + report_prefix_push("spec");
>> + report_prefix_push("r1");
>> + expect_pgm_int();
>> + asm volatile (
>> + ".insn rre,0xb2ad0000,3,6\n"
>> + : : : "cc", "memory", "0", "1", "2", "3");
>
> I would say
> "0", "1", "2", "3", "4", "6", "7"
>
> since there are two ways of doing it wrong when it comes to even-odd
> register pairs (r and r+1, r&~1 and r&~1+1)
R1 & R1 + 1 should never change, same goes for R2.
GR0, GR1, R2 + 1 could potentially change.
But the more interesting question is: Does it make sense to clobber
anything other than cc (if at all) for the PGM checks? If the PGM fails
we're in uncharted territory. Seems like I need to look up what the
other tests do.
next prev parent reply other threads:[~2023-03-31 8:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 11:42 [kvm-unit-tests PATCH 0/5] s390x: Add base AP support Janosch Frank
2023-03-30 11:42 ` [kvm-unit-tests PATCH 1/5] lib: s390x: Add ap library Janosch Frank
2023-03-30 16:09 ` Claudio Imbrenda
2023-03-31 7:32 ` Janosch Frank
2023-03-30 11:42 ` [kvm-unit-tests PATCH 2/5] s390x: Add guest 2 AP test Janosch Frank
2023-03-30 16:34 ` Claudio Imbrenda
2023-03-31 8:52 ` Janosch Frank [this message]
2023-03-30 11:42 ` [kvm-unit-tests PATCH 3/5] lib: s390x: ap: Add ap_setup Janosch Frank
2023-03-30 16:40 ` Claudio Imbrenda
2023-03-30 11:42 ` [kvm-unit-tests PATCH 4/5] s390x: ap: Add pqap aqic tests Janosch Frank
2023-03-30 16:44 ` Claudio Imbrenda
2023-03-30 11:42 ` [kvm-unit-tests PATCH 5/5] s390x: ap: Add reset tests Janosch Frank
2023-03-30 16:48 ` Claudio Imbrenda
2023-04-03 14:57 ` Pierre Morel
2023-04-04 11:40 ` Janosch Frank
2023-04-04 15:23 ` Pierre Morel
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=5a768b62-0552-1174-2040-a9ee04fbc49a@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@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