Commit 5037c22c authored by Martin Schwidefsky's avatar Martin Schwidefsky

Merge tag 'vfio-ccw-20170413' of...

Merge tag 'vfio-ccw-20170413' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw into features

Pull vfio-ccw fixes from Cornelia Huck:

Two fixes for the new vfio-ccw support.
parents e525f8a6 129cc19a
...@@ -161,12 +161,8 @@ static void fsm_io_request(struct vfio_ccw_private *private, ...@@ -161,12 +161,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
static void fsm_irq(struct vfio_ccw_private *private, static void fsm_irq(struct vfio_ccw_private *private,
enum vfio_ccw_event event) enum vfio_ccw_event event)
{ {
struct irb *irb; struct irb *irb = this_cpu_ptr(&cio_irb);
if (!private)
return;
irb = this_cpu_ptr(&cio_irb);
memcpy(&private->irb, irb, sizeof(*irb)); memcpy(&private->irb, irb, sizeof(*irb));
queue_work(vfio_ccw_work_q, &private->io_work); queue_work(vfio_ccw_work_q, &private->io_work);
......
...@@ -19,9 +19,6 @@ static int vfio_ccw_mdev_reset(struct mdev_device *mdev) ...@@ -19,9 +19,6 @@ static int vfio_ccw_mdev_reset(struct mdev_device *mdev)
int ret; int ret;
private = dev_get_drvdata(mdev_parent_dev(mdev)); private = dev_get_drvdata(mdev_parent_dev(mdev));
if (!private)
return -ENODEV;
sch = private->sch; sch = private->sch;
/* /*
* TODO: * TODO:
...@@ -49,9 +46,6 @@ static int vfio_ccw_mdev_notifier(struct notifier_block *nb, ...@@ -49,9 +46,6 @@ static int vfio_ccw_mdev_notifier(struct notifier_block *nb,
struct vfio_ccw_private *private = struct vfio_ccw_private *private =
container_of(nb, struct vfio_ccw_private, nb); container_of(nb, struct vfio_ccw_private, nb);
if (!private)
return NOTIFY_STOP;
/* /*
* Vendor drivers MUST unpin pages in response to an * Vendor drivers MUST unpin pages in response to an
* invalidation. * invalidation.
...@@ -132,22 +126,14 @@ static int vfio_ccw_mdev_remove(struct mdev_device *mdev) ...@@ -132,22 +126,14 @@ static int vfio_ccw_mdev_remove(struct mdev_device *mdev)
{ {
struct vfio_ccw_private *private = struct vfio_ccw_private *private =
dev_get_drvdata(mdev_parent_dev(mdev)); dev_get_drvdata(mdev_parent_dev(mdev));
int ret;
if (!private) if ((private->state != VFIO_CCW_STATE_NOT_OPER) &&
goto out; (private->state != VFIO_CCW_STATE_STANDBY)) {
if (!vfio_ccw_mdev_reset(mdev))
if ((private->state == VFIO_CCW_STATE_NOT_OPER) || private->state = VFIO_CCW_STATE_STANDBY;
(private->state == VFIO_CCW_STATE_STANDBY)) /* The state will be NOT_OPER on error. */
goto out; }
ret = vfio_ccw_mdev_reset(mdev);
if (ret)
return ret;
private->state = VFIO_CCW_STATE_STANDBY;
out:
private->mdev = NULL; private->mdev = NULL;
atomic_inc(&private->avail); atomic_inc(&private->avail);
...@@ -187,9 +173,6 @@ static ssize_t vfio_ccw_mdev_read(struct mdev_device *mdev, ...@@ -187,9 +173,6 @@ static ssize_t vfio_ccw_mdev_read(struct mdev_device *mdev,
return -EINVAL; return -EINVAL;
private = dev_get_drvdata(mdev_parent_dev(mdev)); private = dev_get_drvdata(mdev_parent_dev(mdev));
if (!private)
return -ENODEV;
region = &private->io_region; region = &private->io_region;
if (copy_to_user(buf, (void *)region + *ppos, count)) if (copy_to_user(buf, (void *)region + *ppos, count))
return -EFAULT; return -EFAULT;
...@@ -209,8 +192,6 @@ static ssize_t vfio_ccw_mdev_write(struct mdev_device *mdev, ...@@ -209,8 +192,6 @@ static ssize_t vfio_ccw_mdev_write(struct mdev_device *mdev,
return -EINVAL; return -EINVAL;
private = dev_get_drvdata(mdev_parent_dev(mdev)); private = dev_get_drvdata(mdev_parent_dev(mdev));
if (!private)
return -ENODEV;
if (private->state != VFIO_CCW_STATE_IDLE) if (private->state != VFIO_CCW_STATE_IDLE)
return -EACCES; return -EACCES;
...@@ -274,9 +255,6 @@ static int vfio_ccw_mdev_set_irqs(struct mdev_device *mdev, ...@@ -274,9 +255,6 @@ static int vfio_ccw_mdev_set_irqs(struct mdev_device *mdev,
return -EINVAL; return -EINVAL;
private = dev_get_drvdata(mdev_parent_dev(mdev)); private = dev_get_drvdata(mdev_parent_dev(mdev));
if (!private)
return -ENODEV;
ctx = &private->io_trigger; ctx = &private->io_trigger;
switch (flags & VFIO_IRQ_SET_DATA_TYPE_MASK) { switch (flags & VFIO_IRQ_SET_DATA_TYPE_MASK) {
......
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