Skip to content

vfio: ccw: Refactoring the VFIO CCW state machine

Pierre Morel kvm linux-s390 lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 15 repliesIn review
  2. v110 patches 37 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10vfio: ccw: Moving state change out of IRQ contextdrivers/s390/cio/vfio_ccw_drv.c drivers/s390/cio/vfio_ccw_fsm.c+15 -194 replies
2/10vfio: ccw: Transform FSM functions to return statedrivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_private.h+17 -110 replies
3/10vfio: ccw: new SCH_EVENT eventdrivers/s390/cio/vfio_ccw_drv.c drivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_private.h+38 -210 replies
4/10vfio: ccw: replace IO_REQ event with SSCH_REQ eventdrivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_ops.c drivers/s390/cio/vfio_ccw_private.h+31 -540 replies
5/10vfio: ccw: Suppress unused event parameterdrivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_private.h+10 -190 replies
6/10vfio: ccw: Make FSM functions atomicdrivers/s390/cio/vfio_ccw_drv.c drivers/s390/cio/vfio_ccw_private.h+4 -25 replies
7/10vfio: ccw: FSM and mediated device initializationdrivers/s390/cio/vfio_ccw_drv.c drivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_ops.c +1 more+43 -300 replies
8/10vfio: ccw: Handling reset and shutdown with statesdrivers/s390/cio/vfio_ccw_drv.c drivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_ops.c +1 more+82 -554 replies
9/10vfio: ccw: Suppressing the BOXED statedrivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_private.h+0 -120 replies
10/10vfio: ccw: Let user wait when busy on IOdrivers/s390/cio/vfio_ccw_fsm.c drivers/s390/cio/vfio_ccw_ops.c drivers/s390/cio/vfio_ccw_private.h+11 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/10] vfio: ccw: Refactoring the VFIO CCW state machine

The goal of the patch serie is to enhance the state machine by:
- centralizing all state changes inside the state machine wrapper
- make the state change atomic using mutexes
- change user busy waiting for a passive wait on completion
- refactoring the initialization to avoid using a subchannel without a guest

This series introduces new states and events and suppressed others.
- VFIO_CCW_STATE_NOT_OPER : when the Sub-Channel is KO

- VFIO_CCW_STATE_STANDBY  : when it is offline
- VFIO_CCW_STATE_IDLE     : when it is ready for I/O
- VFIO_CCW_STATE_BUSY     : when it is busy doing I/O

- VFIO_CCW_STATE_QUIESCING: when it is busy going offline

- VFIO_CCW_EVENT_INIT : the channel setup (admin)
- VFIO_CCW_EVENT_NOT_OPER : something really wrong happened
- VFIO_CCW_EVENT_SSCH_REQ : Starting an I/O request (UAPI)
- VFIO_CCW_EVENT_INTERRUPT: Receiving an interrupt (callback)
- VFIO_CCW_EVENT_SCHIB_CHANGED: Receiving a channel event (callback)
- VFIO_CCW_EVENT_ONLINE : Channel is set online (admin)
- VFIO_CCW_EVENT_OFFLINE : Channel is set offline (admin)

The ABI did not change a lot beside letting the user sleep when the driver is busy doing a SSCH, so a standard QEMU devel branch can be used.

Pierre Morel (10):
vfio: ccw: Moving state change out of IRQ context
vfio: ccw: Transform FSM functions to return state
vfio: ccw: new SCH_EVENT event
vfio: ccw: replace IO_REQ event with SSCH_REQ event
vfio: ccw: Suppress unused event parameter
vfio: ccw: Make FSM functions atomic
vfio: ccw: FSM and mediated device initialization
vfio: ccw: Handling reset and shutdown with states
vfio: ccw: Suppressing the BOXED state
vfio: ccw: Let user wait when busy on IO

 drivers/s390/cio/vfio_ccw_drv.c     | 112 +++++-------------
 drivers/s390/cio/vfio_ccw_fsm.c     | 218 ++++++++++++++++++++++++------------
 drivers/s390/cio/vfio_ccw_ops.c     |  62 +++++-----
 drivers/s390/cio/vfio_ccw_private.h |  18 ++-
 4 files changed, 219 insertions(+), 191 deletions(-)
Signature · 11 lines
2.7.4

Changelog:
- rebased on current Linux branch
- change the name of VFIO_CCW_EVENT_SCH_EVENT to
  VFIO_CCW_EVENT_SCHIB_CHANGED
- refactoring the initialization (mdev create/open
  and driver probe)
- return -EAGAIN to let the low level retry the
  sending of events
- make wait_for_completion interruptible