On Tue, 6 Apr 2021 09:40:51 +0200 Pierre Morel <pmorel@xxxxxxxxxxxxx> wrote: > We await CC=1 when we issue a SSCH on a channel with status pending. > > Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> > --- > lib/s390x/css.h | 2 ++ > s390x/css.c | 10 ++++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/lib/s390x/css.h b/lib/s390x/css.h > index 08b2974..3eb6957 100644 > --- a/lib/s390x/css.h > +++ b/lib/s390x/css.h > @@ -90,6 +90,8 @@ struct scsw { > #define SCSW_ESW_FORMAT 0x04000000 > #define SCSW_SUSPEND_CTRL 0x08000000 > #define SCSW_KEY 0xf0000000 > +#define SCSW_SSCH_COMPLETED (SCSW_CCW_FORMAT | SCSW_FC_START | SCSW_SC_PENDING | SCSW_SC_SECONDARY | \ > + SCSW_SC_PRIMARY) > uint32_t ctrl; > uint32_t ccw_addr; > #define SCSW_DEVS_DEV_END 0x04 > diff --git a/s390x/css.c b/s390x/css.c > index f8c6688..52264f2 100644 > --- a/s390x/css.c > +++ b/s390x/css.c > @@ -258,6 +258,15 @@ static void ssch_orb_fcx(void) > orb->ctrl = tmp; > } > > +static void ssch_status_pending(void) > +{ > + assert(ssch(test_device_sid, orb) == 0); > + report(ssch(test_device_sid, orb) == 1, "CC = 1"); I don't think that's correct in the general case (although it will work for QEMU). The PoP has a note about some models discarding the status pending, if we have secondary status only (although I don't think that would happen with this sequence.) You might also end up with cc 2 here, I think. In theory, you could also get a cc 3 on real hardware, but that would be a real edge case, and subsequent tests would fail anyway. > + /* now we clear the status */ > + assert(tsch(test_device_sid, &irb) == 0); > + check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED); > +} > + > static struct tests ssh_tests[] = { > { "privilege", ssch_privilege }, > { "orb cpa zero", ssch_orb_cpa_zero }, > @@ -269,6 +278,7 @@ static struct tests ssh_tests[] = { > { "ORB reserved CTRL bits", ssch_orb_ctrl }, > { "ORB extensions", ssch_orb_extension}, > { "FC extensions", ssch_orb_fcx}, > + { "status pending before ssch", ssch_status_pending}, > { NULL, NULL } > }; >