All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nico Boehr <nrb@linux.ibm.com>
To: kvm@vger.kernel.org, linux-s390@vger.kernel.org
Cc: frankja@linux.ibm.com, imbrenda@linux.ibm.com, thuth@redhat.com,
	scgl@linux.ibm.com
Subject: [kvm-unit-tests PATCH v1 1/2] lib: s390x: introduce check_pgm_int_code_xfail()
Date: Thu, 12 May 2022 16:01:06 +0200	[thread overview]
Message-ID: <20220512140107.1432019-2-nrb@linux.ibm.com> (raw)
In-Reply-To: <20220512140107.1432019-1-nrb@linux.ibm.com>

Right now, it is not very convenient to have expected failures when checking for
program interrupts. Let's introduce check_pgm_int_code_xfail() with an API
similar to report_xfail() to make the programmer's life easier.

With this, we can express check_pgm_int_code() as a special case of
check_pgm_int_code_xfail() with xfail = false.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 lib/s390x/asm/interrupt.h | 1 +
 lib/s390x/interrupt.c     | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index d9ab0bd781c9..88731da9e341 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -46,6 +46,7 @@ void handle_svc_int(void);
 void expect_pgm_int(void);
 void expect_ext_int(void);
 uint16_t clear_pgm_int(void);
+void check_pgm_int_code_xfail(bool xfail, uint16_t code);
 void check_pgm_int_code(uint16_t code);
 
 /* Activate low-address protection */
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 27d3b767210f..b61f7d588550 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -47,14 +47,19 @@ uint16_t clear_pgm_int(void)
 	return code;
 }
 
-void check_pgm_int_code(uint16_t code)
+void check_pgm_int_code_xfail(bool xfail, uint16_t code)
 {
 	mb();
-	report(code == lc->pgm_int_code,
+	report_xfail(xfail, code == lc->pgm_int_code,
 	       "Program interrupt: expected(%d) == received(%d)", code,
 	       lc->pgm_int_code);
 }
 
+void check_pgm_int_code(uint16_t code)
+{
+	check_pgm_int_code_xfail(false, code);
+}
+
 void register_pgm_cleanup_func(void (*f)(void))
 {
 	pgm_cleanup_func = f;
-- 
2.31.1


  reply	other threads:[~2022-05-12 14:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 14:01 [kvm-unit-tests PATCH v1 0/2] s390x: add migration test for storage keys Nico Boehr
2022-05-12 14:01 ` Nico Boehr [this message]
2022-05-12 15:23   ` [kvm-unit-tests PATCH v1 1/2] lib: s390x: introduce check_pgm_int_code_xfail() Claudio Imbrenda
2022-05-12 14:01 ` [kvm-unit-tests PATCH v1 2/2] s390x: add migration test for storage keys Nico Boehr
2022-05-12 14:43   ` Janosch Frank
2022-05-12 15:41   ` Claudio Imbrenda
2022-05-13 12:15     ` Nico Boehr
2022-05-13 11:04   ` Janis Schoetterl-Glausch
2022-05-13 12:33     ` Claudio Imbrenda
2022-05-13 12:46       ` Janis Schoetterl-Glausch
2022-05-13 13:04         ` Claudio Imbrenda
2022-05-16  8:45           ` Nico Boehr
2022-05-13 13:02     ` Nico Boehr

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=20220512140107.1432019-2-nrb@linux.ibm.com \
    --to=nrb@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=scgl@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.