public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: David Hildenbrand <david@redhat.com>, kvm@vger.kernel.org
Cc: Janosch Frank <frankja@linux.ibm.com>
Subject: Re: [kvm-unit-tests v2 PATCH] s390x: Add a test for the diagnose 0x308 hypercall
Date: Tue, 16 Apr 2019 14:32:45 +0200	[thread overview]
Message-ID: <6fb51c31-e5fc-b7c2-8c2c-61cb680f6431@redhat.com> (raw)
In-Reply-To: <ed976365-341d-46fc-7555-e3ce54571530@redhat.com>

On 16/04/2019 13.57, David Hildenbrand wrote:
> On 15.04.19 14:12, Thomas Huth wrote:
>> The original idea for this test is to have an easy way to check for a
>> problem that has been fixed in QEMU recently: QEMU simply aborted if this
>> diagnose call was called with an unsupported subcode (e.g. 2). The problem
>> has been fixed in QEMU commit 37dbd1f4d4805edcd18d94eb202bb3461b3cd52d
>> ("Return specification exception for unimplemented diag 308 subcodes"),
>> and this test now should make sure that we do not regress here again.
>> While we're at it, also check whether LOAD NORMAL via subcode 1 works
>> correctly, whether the diagnose call is blocked correctly in problem state
>> and whether subcodes 5 and 6 are generating specification exceptions for
>> illegal parameters as expected.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  v2: Use "epsw" in test_subcode1() to get the right upper bits of the PSW
>>
>>  s390x/Makefile      |   1 +
>>  s390x/diag308.c     | 130 ++++++++++++++++++++++++++++++++++++++++++++
>>  s390x/unittests.cfg |   3 +
>>  3 files changed, 134 insertions(+)
>>  create mode 100644 s390x/diag308.c
>>
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index af40fd4..1f21ddb 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -5,6 +5,7 @@ tests += $(TEST_DIR)/sieve.elf
>>  tests += $(TEST_DIR)/sthyi.elf
>>  tests += $(TEST_DIR)/skey.elf
>>  tests += $(TEST_DIR)/diag10.elf
>> +tests += $(TEST_DIR)/diag308.elf
>>  tests += $(TEST_DIR)/pfmf.elf
>>  tests += $(TEST_DIR)/cmm.elf
>>  tests += $(TEST_DIR)/vector.elf
>> diff --git a/s390x/diag308.c b/s390x/diag308.c
>> new file mode 100644
>> index 0000000..70a3b1e
>> --- /dev/null
>> +++ b/s390x/diag308.c
>> @@ -0,0 +1,130 @@
>> +/*
>> + * Diagnose 0x308 hypercall tests
>> + *
>> + * Copyright (c) 2019 Thomas Huth, Red Hat Inc.
>> + *
>> + * This code is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2, or (at
>> + * your option) any later version.
>> + */
>> +
>> +#include <libcflat.h>
>> +#include <asm/asm-offsets.h>
>> +#include <asm/interrupt.h>
>> +
>> +/* The diagnose calls should be blocked in problem state */
>> +static void test_priv(void)
>> +{
>> +	expect_pgm_int();
>> +	enter_pstate();
>> +	asm volatile ("diag %0,%1,0x308" :: "a"(0), "a"(3));
>> +	check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
>> +}
[...]
> 
> You might want to use "g" instead of "a", as we are not dealing with
> address registers (base/index). Apart from that, nothing major jumped at me.
> 

Copy-n-past "bug" from diag10.c ;-)

I'll switch it to "d" which is should be the right thing on s390x.

 Thanks,
  Thomas

      reply	other threads:[~2019-04-16 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 12:12 [kvm-unit-tests v2 PATCH] s390x: Add a test for the diagnose 0x308 hypercall Thomas Huth
2019-04-16 11:16 ` Christian Borntraeger
2019-04-16 11:57 ` David Hildenbrand
2019-04-16 12:32   ` Thomas Huth [this message]

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=6fb51c31-e5fc-b7c2-8c2c-61cb680f6431@redhat.com \
    --to=thuth@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    /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