On 3/29/21 10:27 AM, Thomas Huth wrote:
On 25/03/2021 10.39, Pierre Morel wrote:
When checking for an I/O completion may need to check the cause of
the interrupt depending on the test case.
Let's provide the tests the possibility to check if the last
valid IRQ received is for the function expected after executing
an instruction or sequence of instructions and if all ctrl flags
of the SCSW are set as expected.
Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
---
lib/s390x/css.h | 4 ++--
lib/s390x/css_lib.c | 21 ++++++++++++++++-----
s390x/css.c | 4 ++--
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 5d1e1f0..1603781 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -316,8 +316,8 @@ void css_irq_io(void);
int css_residual_count(unsigned int schid);
void enable_io_isc(uint8_t isc);
-int wait_and_check_io_completion(int schid);
-int check_io_completion(int schid);
+int wait_and_check_io_completion(int schid, uint32_t ctrl);
+int check_io_completion(int schid, uint32_t ctrl);
/*
* CHSC definitions
diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
index 1e5c409..55e70e6 100644
--- a/lib/s390x/css_lib.c
+++ b/lib/s390x/css_lib.c
@@ -488,21 +488,25 @@ struct ccw1 *ccw_alloc(int code, void *data, int
count, unsigned char flags)
/* wait_and_check_io_completion:
* @schid: the subchannel ID
+ * @ctrl : expected SCSW control flags
*/
-int wait_and_check_io_completion(int schid)
+int wait_and_check_io_completion(int schid, uint32_t ctrl)
{
wait_for_interrupt(PSW_MASK_IO);
- return check_io_completion(schid);
+ return check_io_completion(schid, ctrl);
}
/* check_io_completion:
* @schid: the subchannel ID
+ * @ctrl : expected SCSW control flags
*
- * Makes the most common check to validate a successful I/O
- * completion.
+ * If the ctrl parameter is not null check the IRB SCSW ctrl
+ * against the ctrl parameter.
+ * Otherwise, makes the most common check to validate a successful
+ * I/O completion.
* Only report failures.
*/
-int check_io_completion(int schid)
+int check_io_completion(int schid, uint32_t ctrl)
{
int ret = 0;
@@ -515,6 +519,13 @@ int check_io_completion(int schid)
goto end;
}
+ if (ctrl && (ctrl ^ irb.scsw.ctrl)) {
With the xor, you can only check for enabled bits ... do we also want to
check for disabled bits, or is this always out of scope?
Acked-by: Thomas Huth <thuth@xxxxxxxxxx>
Thanks,
Pierre
--
Pierre Morel
IBM Lab Boeblingen