All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: david@redhat.com, thuth@redhat.com, frankja@linux.ibm.com,
	cohuck@redhat.com, pmorel@linux.ibm.com, borntraeger@de.ibm.com
Subject: [kvm-unit-tests PATCH v1 2/3] s390x: check for specific program interrupt
Date: Tue,  9 Feb 2021 19:51:53 +0100	[thread overview]
Message-ID: <20210209185154.1037852-3-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20210209185154.1037852-1-imbrenda@linux.ibm.com>

We already have check_pgm_int_code to check and report if a specific
program interrupt has occourred, but this approach has some issues.

In order to specify which test is being run, it was needed to push and
pop a prefix for each test, which is not nice to read both in the code
and in the output.

Another issue is that sometimes the condition to test for might require
other checks in addition to the interrupt.

The simple function added in this patch tests if the program intteruupt
received is the one expected.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/interrupt.h | 1 +
 lib/s390x/interrupt.c     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index 1a2e2cd8..a33437b1 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -23,6 +23,7 @@ void expect_pgm_int(void);
 void expect_ext_int(void);
 uint16_t clear_pgm_int(void);
 void check_pgm_int_code(uint16_t code);
+int is_pgm(int expected);
 
 /* Activate low-address protection */
 static inline void low_prot_enable(void)
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 59e01b1a..6f660285 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -51,6 +51,12 @@ void check_pgm_int_code(uint16_t code)
 	       lc->pgm_int_code);
 }
 
+int is_pgm(int expected)
+{
+	mb();
+	return expected == lc->pgm_int_code;
+}
+
 void register_pgm_cleanup_func(void (*f)(void))
 {
 	pgm_cleanup_func = f;
-- 
2.26.2


  parent reply	other threads:[~2021-02-09 19:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 18:51 [kvm-unit-tests PATCH v1 0/3] s390x: mvpg test Claudio Imbrenda
2021-02-09 18:51 ` [kvm-unit-tests PATCH v1 1/3] s390x: introduce leave_pstate to leave userspace Claudio Imbrenda
2021-02-10 11:16   ` Cornelia Huck
2021-02-10 11:32   ` Janosch Frank
2021-02-11 10:52   ` David Hildenbrand
2021-02-09 18:51 ` Claudio Imbrenda [this message]
2021-02-10 11:23   ` [kvm-unit-tests PATCH v1 2/3] s390x: check for specific program interrupt Cornelia Huck
2021-02-10 11:43     ` Janosch Frank
2021-02-09 18:51 ` [kvm-unit-tests PATCH v1 3/3] s390x: mvpg: simple test Claudio Imbrenda
2021-02-11  9:25   ` 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=20210209185154.1037852-3-imbrenda@linux.ibm.com \
    --to=imbrenda@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pmorel@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.