Checking return values for CSCH for various configurations. Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> --- s390x/css.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/s390x/css.c b/s390x/css.c index ffc067e..d5b7b00 100644 --- a/s390x/css.c +++ b/s390x/css.c @@ -56,6 +56,63 @@ static void test_enable(void) report(cc == 0, "Enable subchannel %08x", test_device_sid); } +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; + + 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 check for CSCH */ + report_prefix_push("CSCH on a quiet subchannel"); + assert(css_enable(test_device_sid, 0) == 0); + report(csch(test_device_sid) == 0, "subchannel clear"); + report_prefix_pop(); + + /* now we check the flags */ + report_prefix_push("IRQ flags"); + assert(tsch(test_device_sid, &irb) == 0); + report(check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED) == 0, "expected"); + report_prefix_pop(); + + /* 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(ssch(test_device_sid, &orb) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED | + SCSW_SC_SECONDARY | SCSW_SC_PRIMARY); + report_prefix_pop(); + + /* 3- Checking CSCH after HSCH */ + report_prefix_push("CSCH on a halted subchannel"); + assert(hsch(test_device_sid) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED); + report_prefix_pop(); + + /* 4- Checking CSCH after CSCH */ + report_prefix_push("CSCH on a cleared subchannel"); + assert(csch(test_device_sid) == 0); + report(csch(test_device_sid) == 0, "subchannel cleared"); + assert(tsch(test_device_sid, &irb) == 0); + check_io_completion(test_device_sid, SCSW_CSCH_COMPLETED); + report_prefix_pop(); + + free_io_mem(senseid, sizeof(*senseid)); + free_io_mem(ccw, sizeof(*ccw)); +} + static void test_hsch(void) { struct orb orb = { @@ -496,6 +553,7 @@ static struct { { "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