public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
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 v2 7/8] s390x: css: testing halt subchannel
Date: Thu, 25 Mar 2021 10:39:06 +0100	[thread overview]
Message-ID: <1616665147-32084-8-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1616665147-32084-1-git-send-email-pmorel@linux.ibm.com>

checking return values for HSCH for various configurations.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/css.h     |  4 ++++
 lib/s390x/css_lib.c |  4 ++++
 s390x/css.c         | 57 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)

diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index e1e9264..cf48abc 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -93,6 +93,10 @@ struct scsw {
 #define SCSW_SSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_START | \
 				 SCSW_SC_PENDING | SCSW_SC_SECONDARY | \
 				 SCSW_SC_PRIMARY)
+#define SCSW_HSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_HALT | \
+				 SCSW_SC_PENDING)
+#define SCSW_CSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_CLEAR | \
+				 SCSW_SC_PENDING)
 	uint32_t ctrl;
 	uint32_t ccw_addr;
 #define SCSW_DEVS_DEV_END	0x04
diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
index 7c93e94..d9ed2c3 100644
--- a/lib/s390x/css_lib.c
+++ b/lib/s390x/css_lib.c
@@ -533,6 +533,10 @@ int check_io_completion(int schid, uint32_t ctrl)
 		goto end;
 	}
 
+	/* We do not need more check for HSCH or CSCH */
+	if (irb.scsw.ctrl & (SCSW_FC_HALT | SCSW_FC_CLEAR))
+		goto end;
+
 	if (!(irb.scsw.ctrl & (SCSW_SC_SECONDARY | SCSW_SC_PRIMARY))) {
 		report(0, "Primary or secondary status missing. Subch Ctrl: %08x",
 		       irb.scsw.ctrl);
diff --git a/s390x/css.c b/s390x/css.c
index f6890f2..ffc067e 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -56,6 +56,62 @@ static void test_enable(void)
 	report(cc == 0, "Enable subchannel %08x", test_device_sid);
 }
 
+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;
+
+	NODEV_SKIP(test_device_sid);
+
+	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, 0) == 0);
+	report(hsch(test_device_sid) == 0, "subchannel halted");
+	report_prefix_pop();
+
+	/* now we check the flags */
+	report_prefix_push("Ctrl flags");
+	assert(tsch(test_device_sid, &irb) == 0);
+	report(check_io_completion(test_device_sid, SCSW_HSCH_COMPLETED) == 0, "expected");
+	report_prefix_pop();
+
+	/* 2- Check HSCH after SSCH */
+	report_prefix_push("HSCH on status pending subchannel");
+	assert(ssch(test_device_sid, &orb) == 0);
+	report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+	assert(tsch(test_device_sid, &irb) == 0);
+	check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED);
+	report_prefix_pop();
+
+	/* 3- Check HSCH after CSCH */
+	report_prefix_push("HSCH on busy on CSCH subchannel");
+	assert(csch(test_device_sid) == 0);
+	report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+	assert(tsch(test_device_sid, &irb) == 0);
+	check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED);
+	report_prefix_pop();
+
+	/* 4- Check HSCH after HSCH */
+	report_prefix_push("HSCH on busy on HSCH subchannel");
+	assert(hsch(test_device_sid) == 0);
+	report(hsch(test_device_sid) == 1, "Halt subchannel should fail with CC 1");
+	assert(tsch(test_device_sid, &irb) == 0);
+	check_io_completion(test_device_sid, SCSW_HSCH_COMPLETED);
+	report_prefix_pop();
+
+	free_io_mem(senseid, sizeof(*senseid));
+	free_io_mem(ccw, sizeof(*ccw));
+}
+
 static void test_ssch(void)
 {
 	struct orb orb = {
@@ -439,6 +495,7 @@ static struct {
 	{ "enumerate (stsch)", test_enumerate },
 	{ "enable (msch)", test_enable },
 	{ "start subchannel", test_ssch },
+	{ "halt subchannel", test_hsch },
 	{ "sense (ssch/tsch)", test_sense },
 	{ "measurement block (schm)", test_schm },
 	{ "measurement block format0", test_schm_fmt0 },
-- 
2.17.1


  parent reply	other threads:[~2021-03-25  9:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  9:38 [kvm-unit-tests PATCH v2 0/8] Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 1/8] s390x: lib: css: disabling a subchannel Pierre Morel
2021-03-25 14:52   ` Claudio Imbrenda
2021-03-25 16:10     ` Pierre Morel
2021-03-26  8:26   ` Janosch Frank
2021-03-26  9:02     ` Pierre Morel
2021-03-29  8:00   ` Thomas Huth
2021-03-29 12:33     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 2/8] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-03-25 15:00   ` Claudio Imbrenda
2021-03-25 16:13     ` Pierre Morel
2021-03-29  8:09   ` Thomas Huth
2021-03-29 12:25     ` Pierre Morel
2021-03-30 11:49   ` Cornelia Huck
2021-03-30 12:59     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 3/8] s390x: css: simplify skipping tests on no device Pierre Morel
2021-03-25 15:21   ` Claudio Imbrenda
2021-03-25 16:21     ` Pierre Morel
2021-03-26  8:41   ` Janosch Frank
2021-03-26  9:04     ` Pierre Morel
2021-03-29  8:19   ` Thomas Huth
2021-03-29 12:39     ` Pierre Morel
2021-03-29 12:50     ` Pierre Morel
2021-03-30 11:52       ` Cornelia Huck
2021-03-30 12:58         ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 4/8] s390x: lib: css: separate wait for IRQ and check I/O completion Pierre Morel
2021-03-25 15:24   ` Claudio Imbrenda
2021-03-25 16:23     ` Pierre Morel
2021-03-29  8:21   ` Thomas Huth
2021-03-29 11:00     ` Pierre Morel
2021-03-30 11:57   ` Cornelia Huck
2021-03-30 12:57     ` Pierre Morel
2021-04-01  8:24   ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 5/8] s390x: lib: css: add SCSW ctrl expectations to " Pierre Morel
2021-03-25 15:40   ` Claudio Imbrenda
2021-03-29  8:27   ` Thomas Huth
2021-03-29  8:32     ` Thomas Huth
2021-03-29 11:01       ` Pierre Morel
2021-03-29 11:02     ` Pierre Morel
2021-03-30 12:10   ` Cornelia Huck
2021-03-30 12:54     ` Pierre Morel
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 6/8] s390x: css: testing ssch error response Pierre Morel
2021-03-25 16:02   ` Claudio Imbrenda
2021-03-25 17:23     ` Pierre Morel
2021-03-26 10:41     ` Pierre Morel
2021-03-26 10:58       ` Claudio Imbrenda
2021-03-29  7:42         ` Pierre Morel
2021-03-30 13:01           ` Pierre Morel
2021-03-29  9:40   ` Pierre Morel
2021-03-25  9:39 ` Pierre Morel [this message]
2021-03-25  9:39 ` [kvm-unit-tests PATCH v2 8/8] s390x: css: testing clear 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=1616665147-32084-8-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