kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	david@redhat.com, thuth@redhat.com, nrb@linux.ibm.com,
	seiden@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v3] s390x: diag308: Only test subcode 2 under QEMU
Date: Thu, 7 Apr 2022 15:11:26 +0200	[thread overview]
Message-ID: <20220407151126.284f4e73@p-imbrenda> (raw)
In-Reply-To: <20220407130252.15603-1-frankja@linux.ibm.com>

On Thu,  7 Apr 2022 13:02:52 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> Other hypervisors might implement it and therefore not send a
> specification exception.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  s390x/diag308.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/s390x/diag308.c b/s390x/diag308.c
> index c9d6c499..ea41b455 100644
> --- a/s390x/diag308.c
> +++ b/s390x/diag308.c
> @@ -8,6 +8,7 @@
>  #include <libcflat.h>
>  #include <asm/asm-offsets.h>
>  #include <asm/interrupt.h>
> +#include <hardware.h>
>  
>  /* The diagnose calls should be blocked in problem state */
>  static void test_priv(void)
> @@ -75,7 +76,7 @@ static void test_subcode6(void)
>  /* Unsupported subcodes should generate a specification exception */
>  static void test_unsupported_subcode(void)
>  {
> -	int subcodes[] = { 2, 0x101, 0xffff, 0x10001, -1 };
> +	int subcodes[] = { 0x101, 0xffff, 0x10001, -1 };
>  	int idx;
>  
>  	for (idx = 0; idx < ARRAY_SIZE(subcodes); idx++) {
> @@ -85,6 +86,21 @@ static void test_unsupported_subcode(void)
>  		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
>  		report_prefix_pop();
>  	}
> +
> +	/*
> +	 * Subcode 2 is not available under QEMU but might be on other
> +	 * hypervisors so we only check for the specification
> +	 * exception on QEMU.
> +	 */
> +	report_prefix_pushf("0x%04x", 2);
> +	if (host_is_qemu()) {
> +		expect_pgm_int();
> +		asm volatile ("diag %0,%1,0x308" :: "d"(0), "d"(2));
> +		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
> +	} else {
> +		report_skip("subcode is supported");
> +	}
> +	report_prefix_pop();
>  }
>  
>  static struct {


  reply	other threads:[~2022-04-07 13:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  8:44 [kvm-unit-tests PATCH v2 0/9] s390x: Cleanup and maintenance 4 Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 1/9] lib: s390x: hardware: Add host_is_qemu() function Janosch Frank
2022-04-07  9:39   ` Claudio Imbrenda
2022-04-11 11:46   ` Nico Boehr
2022-04-11 13:30     ` Thomas Huth
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 2/9] s390x: css: Skip if we're not run by qemu Janosch Frank
2022-04-07  9:40   ` Claudio Imbrenda
2022-04-11 11:45   ` Nico Boehr
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 3/9] s390x: diag308: Only test subcode 2 under QEMU Janosch Frank
2022-04-07  9:42   ` Claudio Imbrenda
2022-04-07 13:02     ` [kvm-unit-tests PATCH v3] " Janosch Frank
2022-04-07 13:11       ` Claudio Imbrenda [this message]
2022-04-11 11:46       ` Nico Boehr
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 4/9] s390x: pfmf: Initialize pfmf_r1 union on declaration Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 5/9] s390x: snippets: asm: Add license and copyright headers Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 6/9] s390x: pv-diags: Cleanup includes Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 7/9] s390x: css: " Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 8/9] s390x: iep: " Janosch Frank
2022-04-07  8:44 ` [kvm-unit-tests PATCH v2 9/9] s390x: mvpg: " 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=20220407151126.284f4e73@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=seiden@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;
as well as URLs for NNTP newsgroup(s).