All of lore.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 v3 15/16] s390x: css: testing halt subchannel
Date: Tue,  6 Apr 2021 09:40:52 +0200	[thread overview]
Message-ID: <1617694853-6881-16-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1617694853-6881-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         | 63 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)

diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 3eb6957..90c8e4b 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -92,6 +92,10 @@ struct scsw {
 #define SCSW_KEY		0xf0000000
 #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 12ef874..4c4506a 100644
--- a/lib/s390x/css_lib.c
+++ b/lib/s390x/css_lib.c
@@ -528,6 +528,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 52264f2..0f80a44 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -300,6 +300,68 @@ static void test_ssch(void)
 	css_enable(test_device_sid, 0);
 }
 
+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;
+
+	/* HSCH is a privilege operation */
+	report_prefix_push("Privilege");
+	enter_pstate();
+	expect_pgm_int();
+	hsch(test_device_sid);
+	check_pgm_int_code(PGM_INT_CODE_PRIVILEGED_OPERATION);
+	report_prefix_pop();
+
+	/* 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();
+
+	/* 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();
+
+	/* 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();
+
+	/* 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));
+}
+
 /*
  * test_sense
  * Pre-requisites:
@@ -569,6 +631,7 @@ static struct tests tests[] = {
 	/* The css_init test is needed to initialize the CSS Characteristics */
 	{ "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-04-06  7:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  7:40 [kvm-unit-tests PATCH v3 00/16] s390x: Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 01/16] s390x: lib: css: disabling a subchannel Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 02/16] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 03/16] s390x: css: simplify skipping tests on no device Pierre Morel
2021-04-06 12:44   ` Cornelia Huck
2021-04-07 10:53     ` Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 04/16] s390x: lib: css: separate wait for IRQ and check I/O completion Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 05/16] s390x: lib: css: add SCSW ctrl expectations to " Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 06/16] s390x: lib: css: checking I/O errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 07/16] s390x: css: testing ssch errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 08/16] s390x: css: ssch check for cpa zero Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 09/16] s390x: css: ssch with mis aligned ORB Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 10/16] s390x: css: ssch checking addressing errors Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 11/16] s390x: css: No support for MIDAW Pierre Morel
2021-04-06 15:58   ` Cornelia Huck
2021-04-07 10:06     ` Pierre Morel
2021-04-07 10:14       ` Cornelia Huck
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 12/16] s390x: css: Check ORB reserved bits Pierre Morel
2021-04-06 15:51   ` Cornelia Huck
2021-04-07 10:07     ` Pierre Morel
2021-04-07 10:15       ` Cornelia Huck
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 13/16] s390x: css: checking for CSS extensions Pierre Morel
2021-04-06 15:50   ` Cornelia Huck
2021-04-07 10:42     ` Pierre Morel
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 14/16] s390x: css: issuing SSCH when the channel is status pending Pierre Morel
2021-04-06 15:34   ` Cornelia Huck
2021-04-07 10:46     ` Pierre Morel
2021-04-06  7:40 ` Pierre Morel [this message]
2021-04-06  7:40 ` [kvm-unit-tests PATCH v3 16/16] s390x: css: testing clear subchannel Pierre Morel
2021-04-06 12:21 ` [kvm-unit-tests PATCH v3 00/16] s390x: Testing SSCH, CSCH and HSCH for errors 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=1617694853-6881-16-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 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.