This is the v2 of my infamous nameless series (archive link: https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06076.html).
Abstract ======= The basic idea is: tell how to handle an unusual condition where it's identified, instead of mapping it to an errno (more or less arbitrarily), then possibly mapping these errnos around, to finally (mentally) map the errno back to the condition and take appropriate action. According to Dong Jia the patch-set also has a functional value: for ccw pass-through, he is planing to pass-through the instruction completion information (cc or interruption condition) from the kernel, and this patch set can pretty much be seen as a preparation for that. Changelog ========= There was a fair amount of discussion regarding during the review of v1. For certain issues we have decided to address them differently (e.g. use unit-exception for VFIO if extra constraints are not respected, get rid of the addressing check, assert if do_subchannel_work called without improperly) and for some we decided to not address them for now (e.g. use if callbacks are null). Although this was not part of the v1 discussion, I have also decided to go back to return values (opposed to adding new state to SubchDev). There are multiple reasons for doing so: * Most of, but not all IO instructions operate on a subchannel, thus having the instruction ending control in SubchDev is a bit weird. * Get both the compiler and the good habits on ours side (e.g. non-void control reaches end of non-void function warning (-Wreturn-type), no overwrites possible, instead of having to check a certain member of a certain struct after a function call just don't ignore return values). v1 -> v2: * use assert if do_subchannel_work without any functions being accepted * generate unit-exception if ccw-vfio can't handle an otherwise good channel program (due to extra limitations) * keep using return values opposed to recording into SubchDev * split out 'add infrastructure' from 'refactor first handler' * reworded some commit messanges and comments * rebased on top of current master * dropped r-b's and acks because of the magnitude of the changes Testing ======= Regarding vfio-ccw Dong Jia did some quick testing with an equivalent version. Regarding virtual ccw I did only some rudimentary testing. Should the series be deemed promising more testing would make sense. Halil Pasic (8): s390x/css: be more consistent if broken beyond repair s390x/css: IO instr handler ending control s390x: improve error handling for SSCH and RSCH s390x: refactor error handling for XSCH handler s390x: refactor error handling for CSCH handler s390x: refactor error handling for HSCH handler s390x: refactor error handling for MSCH handler s390x: factor out common ioinst handler logic hw/s390x/css.c | 162 ++++++++++++------------------------------ hw/s390x/s390-ccw.c | 11 ++- hw/vfio/ccw.c | 30 ++++++-- include/hw/s390x/css.h | 44 +++++++++--- include/hw/s390x/s390-ccw.h | 2 +- target/s390x/ioinst.c | 169 +++++++------------------------------------- 6 files changed, 131 insertions(+), 287 deletions(-) -- 2.13.5