From: Pierre Morel <pmorel@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com,
cohuck@redhat.com, imbrenda@linux.ibm.com
Subject: [kvm-unit-tests PATCH v1 5/6] s390x: css: testing ssch error response
Date: Thu, 18 Mar 2021 14:26:27 +0100 [thread overview]
Message-ID: <1616073988-10381-6-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1616073988-10381-1-git-send-email-pmorel@linux.ibm.com>
Checking error response on various eroneous SSCH instructions:
- ORB alignment
- ORB above 2G
- CCW above 2G
- bad ORB flags
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
s390x/css.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git a/s390x/css.c b/s390x/css.c
index a6a9773..1c891f8 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -51,6 +51,107 @@ static void test_enable(void)
report(cc == 0, "Enable subchannel %08x", test_device_sid);
}
+static void test_ssch(void)
+{
+ struct orb orb = {
+ .intparm = test_device_sid,
+ .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT,
+ };
+ int i;
+ phys_addr_t base, top;
+
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(register_io_int_func(css_irq_io) == 0);
+
+ /* ORB address should be aligned on 32 bits */
+ report_prefix_push("ORB alignment");
+ expect_pgm_int();
+ ssch(test_device_sid, (void *)0x110002);
+ check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+ report_prefix_pop();
+
+ /* ORB address should be lower than 2G */
+ report_prefix_push("ORB Address above 2G");
+ expect_pgm_int();
+ ssch(test_device_sid, (void *)0x80000000);
+ check_pgm_int_code(PGM_INT_CODE_ADDRESSING);
+ report_prefix_pop();
+
+ phys_alloc_get_unused(&base, &top);
+ report_info("base %08lx, top %08lx", base, top);
+
+ /* ORB address should be available we check 1G*/
+ report_prefix_push("ORB Address must be available");
+ if (top < 0x40000000) {
+ expect_pgm_int();
+ ssch(test_device_sid, (void *)0x40000000);
+ check_pgm_int_code(PGM_INT_CODE_ADDRESSING);
+ } else {
+ report_skip("guest started with more than 1G memory");
+ }
+ report_prefix_pop();
+
+ report_prefix_push("CCW address above 2G");
+ orb.cpa = 0x80000000;
+ expect_pgm_int();
+ ssch(test_device_sid, &orb);
+ check_pgm_int_code(PGM_INT_CODE_OPERAND);
+ report_prefix_pop();
+
+ senseid = alloc_io_mem(sizeof(*senseid), 0);
+ assert(senseid);
+ orb.cpa = (uint64_t)ccw_alloc(CCW_CMD_SENSE_ID, senseid,
+ sizeof(*senseid), CCW_F_SLI);
+ assert(orb.cpa);
+
+ report_prefix_push("Disabled subchannel");
+ assert(css_disable(test_device_sid) == 0);
+ report(ssch(test_device_sid, &orb) == 3, "CC = 3");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ report_prefix_pop();
+
+ /*
+ * Check sending a second SSCH before clearing the status with TSCH
+ * the subchannel is left disabled.
+ */
+ report_prefix_push("SSCH on channel with status pending");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(ssch(test_device_sid, &orb) == 0);
+ report(ssch(test_device_sid, &orb) == 1, "CC = 1");
+ /* now we clear the status */
+ assert(wait_and_check_io_completion(test_device_sid, SCSW_FC_START) == 0);
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ report_prefix_push("ORB MIDAW unsupported");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ orb.ctrl |= ORB_CTRL_MIDAW;
+ expect_pgm_int();
+ ssch(test_device_sid, &orb);
+ check_pgm_int_code(PGM_INT_CODE_OPERAND);
+ report_prefix_pop();
+ orb.ctrl = 0;
+
+ for (i = 0; i < 5; i++) {
+ char buffer[30];
+
+ orb.ctrl = (0x02 << i);
+ snprintf(buffer, 30, "ORB reserved ctrl flags %02x", orb.ctrl);
+ report_prefix_push(buffer);
+ expect_pgm_int();
+ ssch(test_device_sid, &orb);
+ check_pgm_int_code(PGM_INT_CODE_OPERAND);
+ report_prefix_pop();
+ }
+
+ report_prefix_push("ORB wrong ctrl flags");
+ orb.ctrl |= 0x040000;
+ expect_pgm_int();
+ ssch(test_device_sid, &orb);
+ check_pgm_int_code(PGM_INT_CODE_OPERAND);
+ report_prefix_pop();
+}
+
/*
* test_sense
* Pre-requisites:
@@ -339,6 +440,7 @@ static struct {
{ "initialize CSS (chsc)", css_init },
{ "enumerate (stsch)", test_enumerate },
{ "enable (msch)", test_enable },
+ { "start subchannel", test_ssch },
{ "sense (ssch/tsch)", test_sense },
{ "measurement block (schm)", test_schm },
{ "measurement block format0", test_schm_fmt0 },
--
2.17.1
next prev parent reply other threads:[~2021-03-18 13:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 13:26 [kvm-unit-tests PATCH v1 0/6] Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 1/6] s390x: lib: css: disabling a subchannel Pierre Morel
2021-03-19 9:02 ` Janosch Frank
2021-03-19 9:11 ` Pierre Morel
2021-03-19 10:03 ` Cornelia Huck
2021-03-19 10:11 ` Pierre Morel
2021-03-19 15:29 ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 2/6] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-03-19 10:16 ` Cornelia Huck
2021-03-19 15:30 ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 3/6] s390x: lib: css: upgrading IRQ handling Pierre Morel
2021-03-18 14:22 ` Pierre Morel
2021-03-19 11:01 ` Cornelia Huck
2021-03-19 15:55 ` Pierre Morel
2021-03-19 16:09 ` Cornelia Huck
2021-03-19 16:34 ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 4/6] s390x: lib: css: add expectations to wait for interrupt Pierre Morel
2021-03-19 9:09 ` Janosch Frank
2021-03-19 9:50 ` Pierre Morel
2021-03-19 11:23 ` Cornelia Huck
2021-03-19 16:18 ` Pierre Morel
2021-03-18 13:26 ` Pierre Morel [this message]
2021-03-19 9:18 ` [kvm-unit-tests PATCH v1 5/6] s390x: css: testing ssch error response Janosch Frank
2021-03-19 10:02 ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 6/6] s390x: css: testing clear and halt subchannel Pierre Morel
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=1616073988-10381-6-git-send-email-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--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).