Commit bfec266c authored by Eric Farman's avatar Eric Farman Committed by Alex Williamson

vfio/ccw: Refactor vfio_ccw_mdev_reset

Use both the FSM Close and Open events when resetting an mdev,
rather than making a separate call to cio_enable_subchannel().
Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Link: https://lore.kernel.org/r/20220707135737.720765-11-farman@linux.ibm.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent f4b4ed44
...@@ -21,25 +21,21 @@ static const struct vfio_device_ops vfio_ccw_dev_ops; ...@@ -21,25 +21,21 @@ static const struct vfio_device_ops vfio_ccw_dev_ops;
static int vfio_ccw_mdev_reset(struct vfio_ccw_private *private) static int vfio_ccw_mdev_reset(struct vfio_ccw_private *private)
{ {
struct subchannel *sch;
int ret;
sch = private->sch;
/* /*
* TODO: * If the FSM state is seen as Not Operational after closing
* In the cureent stage, some things like "no I/O running" and "no * and re-opening the mdev, return an error.
* interrupt pending" are clear, but we are not sure what other state *
* we need to care about. * Otherwise, change the FSM from STANDBY to IDLE which is
* There are still a lot more instructions need to be handled. We * normally done by vfio_ccw_mdev_probe() in current lifecycle.
* should come back here later.
*/ */
vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE);
vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_OPEN);
if (private->state == VFIO_CCW_STATE_NOT_OPER)
return -EINVAL;
ret = cio_enable_subchannel(sch, (u32)(unsigned long)sch); private->state = VFIO_CCW_STATE_IDLE;
if (!ret)
private->state = VFIO_CCW_STATE_IDLE;
return ret; return 0;
} }
static int vfio_ccw_mdev_notifier(struct notifier_block *nb, static int vfio_ccw_mdev_notifier(struct notifier_block *nb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment