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 6/6] s390x: css: testing clear and halt subchannel
Date: Thu, 18 Mar 2021 14:26:28 +0100 [thread overview]
Message-ID: <1616073988-10381-7-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1616073988-10381-1-git-send-email-pmorel@linux.ibm.com>
checking return values for CSCH and HSCH for various configurations.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
s390x/css.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 171 insertions(+), 1 deletion(-)
diff --git a/s390x/css.c b/s390x/css.c
index 1c891f8..ee02cdd 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -51,6 +51,175 @@ static void test_enable(void)
report(cc == 0, "Enable subchannel %08x", test_device_sid);
}
+static void dummy_irq(void)
+{
+}
+
+static int check_io_completion(int sid, uint32_t expected)
+{
+ struct irb irb;
+ int ret;
+
+ report_prefix_push("IRQ flags");
+
+ ret = tsch(sid, &irb);
+ if (ret)
+ goto end;
+
+ if (!expected)
+ goto end;
+
+ if (!(expected & irb.scsw.ctrl)) {
+ report_info("expect: %s got: %s",
+ dump_scsw_flags(expected),
+ dump_scsw_flags(irb.scsw.ctrl));
+ ret = -1;
+ }
+
+end:
+ report(!ret, "expectations");
+ report_prefix_pop();
+ return ret;
+}
+
+static void test_csch(void)
+{
+ struct orb orb = {
+ .intparm = test_device_sid,
+ .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT,
+ };
+ struct ccw1 *ccw;
+
+ senseid = alloc_io_mem(sizeof(*senseid), 0);
+ assert(senseid);
+ ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI);
+ assert(ccw);
+ orb.cpa = (uint64_t)ccw;
+
+ /* 1- Basic check for CSCH */
+ report_prefix_push("CSCH on a quiet subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ report(csch(test_device_sid) == 0, "subchannel clear");
+
+ /* now we check the flags */
+ report_prefix_push("IRQ flags");
+ report(wait_and_check_io_completion(test_device_sid, SCSW_FC_CLEAR) == 0, "expected");
+ report_prefix_pop();
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* For the following checks we need to execute tsch synchronously */
+ assert(unregister_io_int_func(css_irq_io) == 0);
+ assert(register_io_int_func(dummy_irq) == 0);
+
+ /* 2- We want to check if the IRQ flags of SSCH are erased by clear */
+ report_prefix_push("CSCH on SSCH status pending subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(ssch(test_device_sid, &orb) == 0);
+ report(csch(test_device_sid) == 0, "subchannel cleared");
+ check_io_completion(test_device_sid, SCSW_FC_CLEAR);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* 3- Checking CSCH after HSCH */
+ report_prefix_push("CSCH on a halted subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(hsch(test_device_sid) == 0);
+ report(csch(test_device_sid) == 0, "subchannel cleared");
+ check_io_completion(test_device_sid, SCSW_FC_CLEAR);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* 4- Checking CSCH after CSCH */
+ report_prefix_push("CSCH on a cleared subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(csch(test_device_sid) == 0);
+ report(csch(test_device_sid) == 0, "subchannel cleared");
+ check_io_completion(test_device_sid, SCSW_FC_CLEAR);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* Reset the IRQ handler */
+ assert(unregister_io_int_func(dummy_irq) == 0);
+ assert(register_io_int_func(css_irq_io) == 0);
+
+ free_io_mem(senseid, sizeof(*senseid));
+ free_io_mem(ccw, sizeof(*ccw));
+}
+
+static void test_hsch(void)
+{
+ struct orb orb = {
+ .intparm = test_device_sid,
+ .ctrl = ORB_CTRL_ISIC | ORB_CTRL_FMT | ORB_LPM_DFLT,
+ };
+ struct ccw1 *ccw;
+
+ senseid = alloc_io_mem(sizeof(*senseid), 0);
+ assert(senseid);
+ ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI);
+ assert(ccw);
+ orb.cpa = (uint64_t)ccw;
+
+ /* 1- Basic HSCH */
+ report_prefix_push("HSCH on a quiet subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ report(hsch(test_device_sid) == 0, "subchannel halted");
+
+ /* now we check the flags */
+ report_prefix_push("IRQ flags");
+ report(wait_and_check_io_completion(test_device_sid, SCSW_FC_HALT) == 0, "expected");
+ report_prefix_pop();
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* For the following checks we need to execute tsch synchronously */
+ assert(unregister_io_int_func(css_irq_io) == 0);
+ assert(register_io_int_func(dummy_irq) == 0);
+
+ /* 2- Check HSCH after SSCH */
+ report_prefix_push("HSCH on status pending subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(ssch(test_device_sid, &orb) == 0);
+ report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+ check_io_completion(test_device_sid, SCSW_FC_START);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* 3- Check HSCH after CSCH */
+ report_prefix_push("HSCH on busy on CSCH subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(csch(test_device_sid) == 0);
+ report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+ check_io_completion(test_device_sid, SCSW_FC_CLEAR);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* 4- Check HSCH after HSCH */
+ report_prefix_push("HSCH on busy on HSCH subchannel");
+ assert(css_enable(test_device_sid, IO_SCH_ISC) == 0);
+ assert(hsch(test_device_sid) == 0);
+ report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+ check_io_completion(test_device_sid, SCSW_FC_HALT);
+
+ assert(css_disable(test_device_sid) == 0);
+ report_prefix_pop();
+
+ /* Reset the IRQ handler */
+ assert(unregister_io_int_func(dummy_irq) == 0);
+ assert(register_io_int_func(css_irq_io) == 0);
+
+ free_io_mem(senseid, sizeof(*senseid));
+ free_io_mem(ccw, sizeof(*ccw));
+}
+
static void test_ssch(void)
{
struct orb orb = {
@@ -61,7 +230,6 @@ static void test_ssch(void)
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");
@@ -441,6 +609,8 @@ static struct {
{ "enumerate (stsch)", test_enumerate },
{ "enable (msch)", test_enable },
{ "start subchannel", test_ssch },
+ { "halt subchannel", test_hsch },
+ { "clear subchannel", test_csch },
{ "sense (ssch/tsch)", test_sense },
{ "measurement block (schm)", test_schm },
{ "measurement block format0", test_schm_fmt0 },
--
2.17.1
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 ` [kvm-unit-tests PATCH v1 5/6] s390x: css: testing ssch error response Pierre Morel
2021-03-19 9:18 ` Janosch Frank
2021-03-19 10:02 ` Pierre Morel
2021-03-18 13:26 ` Pierre Morel [this message]
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-7-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