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
Subject: [kvm-unit-tests GIT PULL 3/9] s390x: css: simplifications of the tests
Date: Wed, 5 May 2021 10:42:55 +0200 [thread overview]
Message-ID: <20210505084301.17395-4-frankja@linux.ibm.com> (raw)
In-Reply-To: <20210505084301.17395-1-frankja@linux.ibm.com>
From: Pierre Morel <pmorel@linux.ibm.com>
In order to ease the writing of tests based on:
- interrupt
- enabling a subchannel
- using multiple I/O on a channel without disabling it
We do the following simplifications:
- the I/O interrupt handler is registered on CSS initialization
- We do not enable again a subchannel in senseid if it is already
enabled
- we add a css_enabled() function to test if a subchannel is enabled
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/kvm/1615545714-13747-3-git-send-email-pmorel@linux.ibm.com/
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/css.h | 1 +
lib/s390x/css_lib.c | 41 ++++++++++++++++++++++++++---------------
s390x/css.c | 15 +++++----------
3 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 3dc2f313..b9e4c08f 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -278,6 +278,7 @@ int css_enumerate(void);
#define IO_SCH_ISC 3
int css_enable(int schid, int isc);
+bool css_enabled(int schid);
/* Library functions */
int start_ccw1_chain(unsigned int sid, struct ccw1 *ccw);
diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
index 3c1acbfb..a97d61e7 100644
--- a/lib/s390x/css_lib.c
+++ b/lib/s390x/css_lib.c
@@ -161,6 +161,31 @@ out:
return schid;
}
+/*
+ * css_enabled: report if the subchannel is enabled
+ * @schid: Subchannel Identifier
+ * Return value:
+ * true if the subchannel is enabled
+ * false otherwise
+ */
+bool css_enabled(int schid)
+{
+ struct pmcw *pmcw = &schib.pmcw;
+ int cc;
+
+ cc = stsch(schid, &schib);
+ if (cc) {
+ report_info("stsch: updating sch %08x failed with cc=%d",
+ schid, cc);
+ return false;
+ }
+
+ if (!(pmcw->flags & PMCW_ENABLE)) {
+ report_info("stsch: sch %08x not enabled", schid);
+ return false;
+ }
+ return true;
+}
/*
* css_enable: enable the subchannel with the specified ISC
* @schid: Subchannel Identifier
@@ -210,18 +235,8 @@ retry:
/*
* Read the SCHIB again to verify the enablement
*/
- cc = stsch(schid, &schib);
- if (cc) {
- report_info("stsch: updating sch %08x failed with cc=%d",
- schid, cc);
- return cc;
- }
-
- if ((pmcw->flags & flags) == flags) {
- report_info("stsch: sch %08x successfully modified after %d retries",
- schid, retry_count);
+ if (css_enabled(schid))
return 0;
- }
if (retry_count++ < MAX_ENABLE_RETRIES) {
mdelay(10); /* the hardware was not ready, give it some time */
@@ -250,10 +265,6 @@ void css_irq_io(void)
lowcore_ptr->io_int_param, sid);
goto pop;
}
- report_info("subsys_id_word: %08x io_int_param %08x io_int_word %08x",
- lowcore_ptr->subsys_id_word,
- lowcore_ptr->io_int_param,
- lowcore_ptr->io_int_word);
report_prefix_pop();
report_prefix_push("tsch");
diff --git a/s390x/css.c b/s390x/css.c
index 12036b3b..a4778338 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -25,6 +25,7 @@ static unsigned long cu_type = DEFAULT_CU_TYPE;
static int test_device_sid;
static struct senseid *senseid;
+struct ccw1 *ccw;
static void test_enumerate(void)
{
@@ -58,7 +59,6 @@ static void test_enable(void)
*/
static void test_sense(void)
{
- struct ccw1 *ccw;
int ret;
int len;
@@ -74,18 +74,12 @@ static void test_sense(void)
return;
}
- ret = register_io_int_func(css_irq_io);
- if (ret) {
- report(0, "Could not register IRQ handler");
- return;
- }
-
lowcore_ptr->io_int_param = 0;
senseid = alloc_io_mem(sizeof(*senseid), 0);
if (!senseid) {
report(0, "Allocation of senseid");
- goto error_senseid;
+ return;
}
ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI);
@@ -137,12 +131,13 @@ error:
free_io_mem(ccw, sizeof(*ccw));
error_ccw:
free_io_mem(senseid, sizeof(*senseid));
-error_senseid:
- unregister_io_int_func(css_irq_io);
}
static void css_init(void)
{
+ assert(register_io_int_func(css_irq_io) == 0);
+ lowcore_ptr->io_int_param = 0;
+
report(get_chsc_scsc(), "Store Channel Characteristics");
}
--
2.30.2
next prev parent reply other threads:[~2021-05-05 8:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 8:42 [kvm-unit-tests GIT PULL 0/9] s390x update 2021-05-05 Janosch Frank
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 1/9] s390x: mvpg: add checks for op_acc_id Janosch Frank
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 2/9] s390x: css: Store CSS Characteristics Janosch Frank
2021-05-05 8:42 ` Janosch Frank [this message]
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 4/9] s390x: css: extending the subchannel modifying functions Janosch Frank
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 5/9] s390x: css: implementing Set CHannel Monitor Janosch Frank
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 6/9] s390x: css: testing measurement block format 0 Janosch Frank
2021-05-05 8:42 ` [kvm-unit-tests GIT PULL 7/9] s390x: css: testing measurement block format 1 Janosch Frank
2021-05-05 8:43 ` [kvm-unit-tests GIT PULL 8/9] MAINTAINERS: s390x: add myself as reviewer Janosch Frank
2021-05-05 8:43 ` [kvm-unit-tests GIT PULL 9/9] s390x: Fix vector stfle checks Janosch Frank
2021-05-05 9:40 ` [kvm-unit-tests GIT PULL 0/9] s390x update 2021-05-05 Paolo Bonzini
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=20210505084301.17395-4-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=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).