On Fri, 24 Apr 2020 12:45:48 +0200 Pierre Morel <pmorel@xxxxxxxxxxxxx> wrote: > First step for testing the channel subsystem is to enumerate the css and > retrieve the css devices. > > This tests the success of STSCH I/O instruction, we do not test the s/of/of the/ > reaction of the VM for an instruction with wrong parameters. > > Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> > --- > lib/s390x/css.h | 1 + > s390x/Makefile | 2 + > s390x/css.c | 92 +++++++++++++++++++++++++++++++++++++++++++++ > s390x/unittests.cfg | 4 ++ > 4 files changed, 99 insertions(+) > create mode 100644 s390x/css.c > (...) > +static void test_enumerate(void) > +{ > + struct pmcw *pmcw = &schib.pmcw; > + int cc; > + int scn; > + int scn_found = 0; > + int dev_found = 0; > + > + for (scn = 0; scn < 0xffff; scn++) { > + cc = stsch(scn|SID_ONE, &schib); > + switch (cc) { > + case 0: /* 0 means SCHIB stored */ > + break; > + case 3: /* 3 means no more channels */ > + goto out; > + default: /* 1 or 2 should never happened for STSCH */ s/happened/happen/ > + report(0, "Unexpected cc=%d on subchannel number 0x%x", > + cc, scn); > + return; > + }