s390x/css: revert SCSW ctrl/flag bits on error
authorPeter Jin <pjin@linux.ibm.com>
Thu, 27 Oct 2022 21:23:41 +0000 (23:23 +0200)
committerThomas Huth <thuth@redhat.com>
Sun, 6 Nov 2022 11:27:35 +0000 (12:27 +0100)
commitf53b033e4cd2e7706df3cca04f3bf3c5ffc6b08c
tree4508abdf82c2ce2d2155dbebd5eb72f5af345816
parent765de32d87db65abf443d6a5d7097d42fc6e48de
s390x/css: revert SCSW ctrl/flag bits on error

Revert the control and flag bits in the subchannel status word in case
the SSCH operation fails with non-zero CC (ditto for CSCH and HSCH).
According to POPS, the control and flag bits are only changed if SSCH,
CSCH, and HSCH return CC 0, and no other action should be taken otherwise.
In order to simulate that after the fact, the bits need to be reverted on
non-zero CC.

While the do_subchannel_work logic for virtual (virtio) devices will
return condition code 0, passthrough (vfio) devices may encounter
errors from either the host kernel or real hardware that need to be
accounted for after this point. This includes restoring the state of
the Subchannel Status Word to reflect the subchannel, as these bits
would not be set in the event of a non-zero condition code from the
affected instructions.

Experimentation has shown that a failure on a START SUBCHANNEL (SSCH)
to a passthrough device would leave the subchannel with the START
PENDING activity control bit set, thus blocking subsequent SSCH
operations in css_do_ssch() until some form of error recovery was
undertaken since no interrupt would be expected.

Signed-off-by: Peter Jin <pjin@linux.ibm.com>
Message-Id: <20221027212341.2904795-1-pjin@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
[thuth: Updated the commit description to Eric's suggestion]
Signed-off-by: Thomas Huth <thuth@redhat.com>
hw/s390x/css.c