From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com,
borntraeger@de.ibm.com, cohuck@redhat.com,
linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
thuth@redhat.com, Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Subject: [kvm-unit-tests GIT PULL 09/11] s390x: Add strict mode to specification exception interpretation test
Date: Tue, 20 Sep 2022 07:30:33 +0000 [thread overview]
Message-ID: <20220920073035.29201-10-frankja@linux.ibm.com> (raw)
In-Reply-To: <20220920073035.29201-1-frankja@linux.ibm.com>
From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
While specification exception interpretation is not required to occur,
it can be useful for automatic regression testing to fail the test if it
does not occur.
Add a `--strict` argument to enable this.
`--strict` takes a list of machine types (as reported by STIDP)
for which to enable strict mode, for example
`--strict 3931,8562,8561,3907,3906,2965,2964`
will enable it for models z16 - z13.
Alternatively, strict mode can be enabled for all but the listed machine
types by prefixing the list with a `!`, for example
`--strict !1090,1091,2064,2066,2084,2086,2094,2096,2097,2098,2817,2818,2827,2828`
will enable it for z/Architecture models except those older than z13.
`--strict !` will enable it always.
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Link: https://lore.kernel.org/r/20220825112047.2206929-1-scgl@linux.ibm.com
Message-Id: <20220825112047.2206929-1-scgl@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
s390x/spec_ex-sie.c | 53 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c
index d8e25e75..5fa135b8 100644
--- a/s390x/spec_ex-sie.c
+++ b/s390x/spec_ex-sie.c
@@ -7,16 +7,19 @@
* specification exception interpretation is off/on.
*/
#include <libcflat.h>
+#include <stdlib.h>
#include <sclp.h>
#include <asm/page.h>
#include <asm/arch_def.h>
#include <alloc_page.h>
#include <sie.h>
#include <snippet.h>
+#include <hardware.h>
static struct vm vm;
extern const char SNIPPET_NAME_START(c, spec_ex)[];
extern const char SNIPPET_NAME_END(c, spec_ex)[];
+static bool strict;
static void setup_guest(void)
{
@@ -37,6 +40,8 @@ static void reset_guest(void)
static void test_spec_ex_sie(void)
{
+ const char *msg;
+
setup_guest();
report_prefix_push("SIE spec ex interpretation");
@@ -60,16 +65,60 @@ static void test_spec_ex_sie(void)
report(vm.sblk->icptcode == ICPT_PROGI
&& vm.sblk->iprcc == PGM_INT_CODE_SPECIFICATION,
"Received specification exception intercept");
- if (vm.sblk->gpsw.addr == 0xdeadbeee)
- report_info("Interpreted initial exception, intercepted invalid program new PSW exception");
+ msg = "Interpreted initial exception, intercepted invalid program new PSW exception";
+ if (strict)
+ report(vm.sblk->gpsw.addr == 0xdeadbeee, "%s", msg);
+ else if (vm.sblk->gpsw.addr == 0xdeadbeee)
+ report_info("%s", msg);
else
report_info("Did not interpret initial exception");
report_prefix_pop();
report_prefix_pop();
}
+static bool parse_strict(int argc, char **argv)
+{
+ uint16_t machine_id;
+ char *list;
+ bool ret;
+
+ if (argc < 1)
+ return false;
+ if (strcmp("--strict", argv[0]))
+ return false;
+
+ machine_id = get_machine_id();
+ if (argc < 2) {
+ printf("No argument to --strict, ignoring\n");
+ return false;
+ }
+ list = argv[1];
+ if (list[0] == '!') {
+ ret = true;
+ list++;
+ } else {
+ ret = false;
+ }
+ while (true) {
+ long input = 0;
+
+ if (strlen(list) == 0)
+ return ret;
+ input = strtol(list, &list, 16);
+ if (*list == ',')
+ list++;
+ else if (*list != '\0')
+ break;
+ if (input == machine_id)
+ return !ret;
+ }
+ printf("Invalid --strict argument \"%s\", ignoring\n", list);
+ return ret;
+}
+
int main(int argc, char **argv)
{
+ strict = parse_strict(argc - 1, argv + 1);
if (!sclp_facilities.has_sief2) {
report_skip("SIEF2 facility unavailable");
goto out;
--
2.34.1
next prev parent reply other threads:[~2022-09-20 7:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 7:30 [kvm-unit-tests GIT PULL 00/11] s390x: LPAR boot fix and additional tests Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 01/11] s390x: smp: move sigp calls with invalid cpu address to array Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 02/11] s390x: smp: use an array for sigp calls Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 03/11] s390x: smp: add tests for calls in wait state Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 04/11] lib/s390x: fix SMP setup bug Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 05/11] runtime: add support for panic tests Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 06/11] lib/s390x: add CPU timer related defines and functions Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 07/11] s390x: add extint loop test Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 08/11] s390x: add pgm spec interrupt " Janosch Frank
2022-09-20 7:30 ` Janosch Frank [this message]
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 10/11] s390x: factor out common args for genprotimg Janosch Frank
2022-09-20 7:30 ` [kvm-unit-tests GIT PULL 11/11] s390x: create persistent comm-key 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=20220920073035.29201-10-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--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 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).