Skip to contentSkip to conversation

vfio-ccw parent rework

PATCH Superseded Eric Farman 5 participants 26 messages Oct 19, 2022 – Nov 1, 2022

Subsystems (13)
DRM drivers KVM Intel i915 s390 +9 more subsystems

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Eric Farman

author maintainer
#0 lore raw

cover vfio-ccw parent rework

Hi all,

There have been discussions and attempts [1][2] to rework the vfio-ccw device lifecycle to better align with the needs/expectations of vfio and mdev. While those languished, commit cb9ff3f3b84c ("vfio: Add helpers for unifying vfio_device life cycle") implemented a couple of tricks that help vfio and the drivers that interact with it, while keeping vfio-ccw as-is. A handful of commits titled "vfio/xxx: Use the new device life cycle helpers" implemented those tricks for each of the drivers.

This series attempts to address the oddities/shortcomings of vfio-ccw, such that vfio-ccw can use the same helpers as everyone else, and the tricks that were implemented by the other drivers can be removed. It is built on 6.1-rc1, and thus includes the various changes [3][4] that have occurred in and around these parts.

Patches 1-5 rework the behavior of the vfio-ccw driver's private struct. In summary, the mdev pieces are split out of vfio_ccw_private and into a new vfio_ccw_parent struct that will continue to follow today's lifecycle. The remainder (bulk) of the private struct moves to follow the mdev probe/remove pair. There's opportunity for further separation of the things in the private struct, which would simplify some of the vfio-ccw code, but it got too hairy as I started that. Once vfio-ccw is no longer considered unique, those cleanups can happen at our leisure.

Patch 6 removes the trickery where vfio-ccw uses vfio_init_device instead of vfio_alloc_device, and thus removes vfio_init_device from the outside world.

Patch 7 removes vfio_free_device from vfio-ccw and the other drivers (hello, CC list!), letting it be handled by vfio_device_release directly.

Looking forward to the feedback.

Thanks,
Eric

[1] https://lore.kernel.org/kvm/[email protected]/
[2] https://lore.kernel.org/kvm/[email protected]/
[3] https://lore.kernel.org/kvm/[email protected]/
[4] https://lore.kernel.org/kvm/[email protected]/

Eric Farman (7):
vfio/ccw: create a parent struct vfio/ccw: remove private->sch
vfio/ccw: move private initialization to callback vfio/ccw: move private to mdev lifecycle vfio/ccw: remove release completion vfio/ccw: replace vfio_init_device with _alloc_
vfio: Remove vfio_free_device

 drivers/gpu/drm/i915/gvt/kvmgt.c      |   1 -
 drivers/s390/cio/vfio_ccw_chp.c       |   5 +-
 drivers/s390/cio/vfio_ccw_drv.c       | 182 ++++++++++----------------
 drivers/s390/cio/vfio_ccw_fsm.c       |  27 ++--
 drivers/s390/cio/vfio_ccw_ops.c       | 108 ++++++++++-----
 drivers/s390/cio/vfio_ccw_parent.h    |  28 ++++
 drivers/s390/cio/vfio_ccw_private.h   |  22 ++--
 drivers/s390/crypto/vfio_ap_ops.c     |   6 -
 drivers/vfio/fsl-mc/vfio_fsl_mc.c     |   1 -
 drivers/vfio/pci/vfio_pci_core.c      |   1 -
 drivers/vfio/platform/vfio_amba.c     |   1 -
 drivers/vfio/platform/vfio_platform.c |   1 -
 drivers/vfio/vfio_main.c              |  25 +---
 include/linux/vfio.h                  |   1 -
 samples/vfio-mdev/mbochs.c            |   1 -
 samples/vfio-mdev/mdpy.c              |   1 -
 samples/vfio-mdev/mtty.c              |   1 -
 17 files changed, 204 insertions(+), 208 deletions(-)
 create mode 100644 drivers/s390/cio/vfio_ccw_parent.h
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/7 vfio/ccw: create a parent struct

Move the stuff associated with the mdev parent (and thus the subchannel struct) into its own struct, and leave the rest in the existing private structure.

The subchannel will point to the parent, and the parent will point to the private, for the areas where one or both are needed. Further separation of these structs will follow.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 104 ++++++++++++++++++++--------
 drivers/s390/cio/vfio_ccw_ops.c     |   9 ++-
 drivers/s390/cio/vfio_ccw_parent.h  |  28 ++++++++
 drivers/s390/cio/vfio_ccw_private.h |   5 --
 4 files changed, 112 insertions(+), 34 deletions(-)
 create mode 100644 drivers/s390/cio/vfio_ccw_parent.h
drivers/s390/cio/vfio_ccw_drv.c +77 -27
index 7f5402fe857a..634760ca0dea 100644
@@ -20,6 +20,7 @@
 #include "chp.h"
 #include "ioasm.h"
 #include "css.h"
+#include "vfio_ccw_parent.h"
 #include "vfio_ccw_private.h"
 
 struct workqueue_struct *vfio_ccw_work_q;
@@ -36,7 +37,8 @@ debug_info_t *vfio_ccw_debug_trace_id;
  */
 int vfio_ccw_sch_quiesce(struct subchannel *sch)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 	DECLARE_COMPLETION_ONSTACK(completion);
 	int iretry, ret = 0;
 
@@ -51,19 +53,21 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)
 			break;
 		}
 
-		/*
-		 * Flush all I/O and wait for
-		 * cancel/halt/clear completion.
-		 */
-		private->completion = &completion;
-		spin_unlock_irq(sch->lock);
+		if (private) {
+			/*
+			 * Flush all I/O and wait for
+			 * cancel/halt/clear completion.
+			 */
+			private->completion = &completion;
+			spin_unlock_irq(sch->lock);
 
-		if (ret == -EBUSY)
-			wait_for_completion_timeout(&completion, 3*HZ);
+			if (ret == -EBUSY)
+				wait_for_completion_timeout(&completion, 3*HZ);
 
-		private->completion = NULL;
-		flush_workqueue(vfio_ccw_work_q);
-		spin_lock_irq(sch->lock);
+			private->completion = NULL;
+			flush_workqueue(vfio_ccw_work_q);
+			spin_lock_irq(sch->lock);
+		}
 		ret = cio_disable_subchannel(sch);
 	} while (ret == -EBUSY);
 
@@ -121,7 +125,22 @@ static void vfio_ccw_crw_todo(struct work_struct *work)
  */
 static void vfio_ccw_sch_irq(struct subchannel *sch)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
+
+	/*
+	 * The subchannel should still be disabled at this point,
+	 * so an interrupt would be quite surprising. As with an
+	 * interrupt while the FSM is closed, let's attempt to
+	 * disable the subchannel again.
+	 */
+	if (!private) {
+		VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: unexpected interrupt\n",
+			sch->schid.cssid, sch->schid.ssid, sch->schid.sch_no);
+
+		cio_disable_subchannel(sch);
+		return;
+	}
 
 	inc_irq_stat(IRQIO_CIO);
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT);
@@ -201,10 +220,19 @@ static void vfio_ccw_free_private(struct vfio_ccw_private *private)
 	mutex_destroy(&private->io_mutex);
 	kfree(private);
 }
+
+static void vfio_ccw_free_parent(struct device *dev)
+{
+	struct vfio_ccw_parent *parent = container_of(dev, struct vfio_ccw_parent, dev);
+
+	kfree(parent);
+}
+
 static int vfio_ccw_sch_probe(struct subchannel *sch)
 {
 	struct pmcw *pmcw = &sch->schib.pmcw;
 	struct vfio_ccw_private *private;
+	struct vfio_ccw_parent *parent;
 	int ret = -ENOMEM;
 
 	if (pmcw->qf) {
@@ -213,18 +241,28 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 		return -ENODEV;
 	}
 
+	parent = kzalloc(sizeof(*parent), GFP_KERNEL);
+	if (IS_ERR(parent))
+		return PTR_ERR(parent);
+
+	parent->dev.release = &vfio_ccw_free_parent;
+	device_initialize(&parent->dev);
+
 	private = vfio_ccw_alloc_private(sch);
-	if (IS_ERR(private))
+	if (IS_ERR(private)) {
+		put_device(&parent->dev);
 		return PTR_ERR(private);
+	}
 
-	dev_set_drvdata(&sch->dev, private);
+	dev_set_drvdata(&sch->dev, parent);
+	dev_set_drvdata(&parent->dev, private);
 
-	private->mdev_type.sysfs_name = "io";
-	private->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)";
-	private->mdev_types[0] = &private->mdev_type;
-	ret = mdev_register_parent(&private->parent, &sch->dev,
+	parent->mdev_type.sysfs_name = "io";
+	parent->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)";
+	parent->mdev_types[0] = &parent->mdev_type;
+	ret = mdev_register_parent(&parent->parent, &sch->dev,
 				   &vfio_ccw_mdev_driver,
-				   private->mdev_types, 1);
+				   parent->mdev_types, 1);
 	if (ret)
 		goto out_free;
 
@@ -234,20 +272,24 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 	return 0;
 
 out_free:
+	dev_set_drvdata(&parent->dev, NULL);
 	dev_set_drvdata(&sch->dev, NULL);
 	vfio_ccw_free_private(private);
+	put_device(&parent->dev);
 	return ret;
 }
 
 static void vfio_ccw_sch_remove(struct subchannel *sch)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 
-	mdev_unregister_parent(&private->parent);
+	mdev_unregister_parent(&parent->parent);
 
 	dev_set_drvdata(&sch->dev, NULL);
 
 	vfio_ccw_free_private(private);
+	put_device(&parent->dev);
 
 	VFIO_CCW_MSG_EVENT(4, "unbound from subchannel %x.%x.%04x\n",
 			   sch->schid.cssid, sch->schid.ssid,
@@ -256,7 +298,11 @@ static void vfio_ccw_sch_remove(struct subchannel *sch)
 
 static void vfio_ccw_sch_shutdown(struct subchannel *sch)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
+
+	if (WARN_ON(!private))
+		return;
 
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE);
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);
@@ -274,7 +320,8 @@ static void vfio_ccw_sch_shutdown(struct subchannel *sch)
  */
 static int vfio_ccw_sch_event(struct subchannel *sch, int process)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 	unsigned long flags;
 	int rc = -EAGAIN;
 
@@ -287,8 +334,10 @@ static int vfio_ccw_sch_event(struct subchannel *sch, int process)
 
 	rc = 0;
 
-	if (cio_update_schib(sch))
-		vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);
+	if (cio_update_schib(sch)) {
+		if (private)
+			vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);
+	}
 
 out_unlock:
 	spin_unlock_irqrestore(sch->lock, flags);
@@ -326,7 +375,8 @@ static void vfio_ccw_queue_crw(struct vfio_ccw_private *private,
 static int vfio_ccw_chp_event(struct subchannel *sch,
 			      struct chp_link *link, int event)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 	int mask = chp_ssd_get_mask(&sch->ssd_info, link);
 	int retry = 255;
 
drivers/s390/cio/vfio_ccw_ops.c +7 -2
index 6ae4d012d800..b1cd89d900ab 100644
@@ -14,6 +14,7 @@
 #include <linux/nospec.h>
 #include <linux/slab.h>
 
+#include "vfio_ccw_parent.h"
 #include "vfio_ccw_private.h"
 
 static const struct vfio_device_ops vfio_ccw_dev_ops;
@@ -55,7 +56,9 @@ static int vfio_ccw_mdev_init_dev(struct vfio_device *vdev)
 
 static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(mdev->dev.parent);
+	struct subchannel *sch = to_subchannel(mdev->dev.parent);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 	int ret;
 
 	if (private->state == VFIO_CCW_STATE_NOT_OPER)
@@ -100,7 +103,9 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
 
 static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(mdev->dev.parent);
+	struct subchannel *sch = to_subchannel(mdev->dev.parent);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: remove\n",
 			   private->sch->schid.cssid,
drivers/s390/cio/vfio_ccw_parent.h new file +28 -0
new file mode 100644
index 000000000000..834c00077802
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * MDEV Parent contents for vfio_ccw driver
+ *
+ * Copyright IBM Corp. 2022
+ */
+
+#ifndef _VFIO_CCW_PARENT_H_
+#define _VFIO_CCW_PARENT_H_
+
+#include <linux/mdev.h>
+
+/**
+ * struct vfio_ccw_parent
+ *
+ * @dev: embedded device struct
+ * @parent: parent data structures for mdevs created
+ * @mdev_type(s): identifying information for mdevs created
+ */
+struct vfio_ccw_parent {
+	struct device		dev;
+
+	struct mdev_parent	parent;
+	struct mdev_type	mdev_type;
+	struct mdev_type	*mdev_types[1];
+};
+
+#endif
drivers/s390/cio/vfio_ccw_private.h +0 -5
index bd5fb81456af..673e9a81a172 100644
@@ -89,7 +89,6 @@ struct vfio_ccw_crw {
  * @io_work: work for deferral process of I/O handling
  * @crw_work: work for deferral process of CRW handling
  * @release_comp: synchronization helper for vfio device release
- * @parent: parent data structures for mdevs created
  */
 struct vfio_ccw_private {
 	struct vfio_device vdev;
@@ -116,10 +115,6 @@ struct vfio_ccw_private {
 	struct work_struct	crw_work;
 
 	struct completion	release_comp;
-
-	struct mdev_parent	parent;
-	struct mdev_type	mdev_type;
-	struct mdev_type	*mdev_types[1];
 } __aligned(8);
 
 int vfio_ccw_sch_quiesce(struct subchannel *sch);
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

Re: [PATCH v1 1/7] vfio/ccw: create a parent struct

Quoted 23 lines · Eric Farman

Move the stuff associated with the mdev parent (and thus the subchannel struct) into its own struct, and leave the rest in the existing private structure.

The subchannel will point to the parent, and the parent will point to the private, for the areas where one or both are needed. Further separation of these structs will follow.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 104 ++++++++++++++++++++------ --
 drivers/s390/cio/vfio_ccw_ops.c     |   9 ++- drivers/s390/cio/vfio_ccw_parent.h  |  28 ++++++++ drivers/s390/cio/vfio_ccw_private.h |   5 --

 4 files changed, 112 insertions(+), 34 deletions(-)

 create mode 100644 drivers/s390/cio/vfio_ccw_parent.h

drivers/s390/cio/vfio_ccw_drv.c +0 -0
index 7f5402fe857a..634760ca0dea 100644

...snip...

drivers/s390/cio/vfio_ccw_drv.c static int vfio_ccw_sch_probe(struct subchannel *sch) · line 250

Quoted 12 lines
drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -213,18 +241,28 @@ static int vfio_ccw_sch_probe(struct subchannel
 *sch)
                 return -ENODEV;
         }


+       parent = kzalloc(sizeof(*parent), GFP_KERNEL); +       if (IS_ERR(parent))
+               return PTR_ERR(parent);

drivers/s390/cio/vfio_ccw_drv.c +4 -0
+
+       parent->dev.release = &vfio_ccw_free_parent;
+       device_initialize(&parent->dev);
+

Oops. This should either be device_register, or I needed a device_add somewhere along the way. There's no need to separate them, so the former is probably better, but I still need some additional logic to link this back to the css driver.

Quoted 212 lines

        private = vfio_ccw_alloc_private(sch);
-       if (IS_ERR(private))
+       if (IS_ERR(private)) {
+               put_device(&parent->dev);
                return PTR_ERR(private);
+       }

-       dev_set_drvdata(&sch->dev, private);
+       dev_set_drvdata(&sch->dev, parent);
+       dev_set_drvdata(&parent->dev, private);

-       private->mdev_type.sysfs_name = "io";
-       private->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)"; -       private->mdev_types[0] = &private->mdev_type;
-       ret = mdev_register_parent(&private->parent, &sch->dev, +       parent->mdev_type.sysfs_name = "io";
+       parent->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)"; +       parent->mdev_types[0] = &parent->mdev_type;
+       ret = mdev_register_parent(&parent->parent, &sch->dev, &vfio_ccw_mdev_driver, -                                  private->mdev_types, 1); +                                  parent->mdev_types, 1); if (ret)
                goto out_free;

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -234,20 +272,24 @@ static int vfio_ccw_sch_probe(struct subchannel
 *sch)
         return 0;


 out_free:
+       dev_set_drvdata(&parent->dev, NULL); dev_set_drvdata(&sch->dev, NULL); vfio_ccw_free_private(private);
+       put_device(&parent->dev);
        return ret;
 }

 static void vfio_ccw_sch_remove(struct subchannel *sch) {
-       struct vfio_ccw_private *private = dev_get_drvdata(&sch-

Quoted 1 line

dev);

+       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev); +       struct vfio_ccw_private *private = dev_get_drvdata(&parent-

Quoted 1 line

dev);


-       mdev_unregister_parent(&private->parent);
+       mdev_unregister_parent(&parent->parent);

        dev_set_drvdata(&sch->dev, NULL);

        vfio_ccw_free_private(private);
+       put_device(&parent->dev);

        VFIO_CCW_MSG_EVENT(4, "unbound from subchannel %x.%x.%04x\n", sch->schid.cssid, sch->schid.ssid,

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -256,7 +298,11 @@ static void vfio_ccw_sch_remove(struct
 subchannel *sch)


 static void vfio_ccw_sch_shutdown(struct subchannel *sch) {
-       struct vfio_ccw_private *private = dev_get_drvdata(&sch-

Quoted 1 line

dev);

+       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev); +       struct vfio_ccw_private *private = dev_get_drvdata(&parent-

Quoted 1 line

dev);

+
+       if (WARN_ON(!private))
+               return;

        vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);

drivers/s390/cio/vfio_ccw_drv.c +2 -1
@@ -274,7 +320,8 @@ static void vfio_ccw_sch_shutdown(struct
 subchannel *sch)
   */
  static int vfio_ccw_sch_event(struct subchannel *sch, int process)
  {
-       struct vfio_ccw_private *private = dev_get_drvdata(&sch-
 >dev);
+       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+       struct vfio_ccw_private *private = dev_get_drvdata(&parent-
 >dev);

        unsigned long flags;
        int rc = -EAGAIN;

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -287,8 +334,10 @@ static int vfio_ccw_sch_event(struct subchannel
 *sch, int process)


        rc = 0;

-       if (cio_update_schib(sch))
-               vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER); +       if (cio_update_schib(sch)) {
+               if (private)
+                       vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);
+       }

 out_unlock:
        spin_unlock_irqrestore(sch->lock, flags);

drivers/s390/cio/vfio_ccw_drv.c +2 -1
@@ -326,7 +375,8 @@ static void vfio_ccw_queue_crw(struct
 vfio_ccw_private *private,
  static int vfio_ccw_chp_event(struct subchannel *sch,
                               struct chp_link *link, int event)
  {
-       struct vfio_ccw_private *private = dev_get_drvdata(&sch-
 >dev);
+       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+       struct vfio_ccw_private *private = dev_get_drvdata(&parent-
 >dev);

        int mask = chp_ssd_get_mask(&sch->ssd_info, link); int retry = 255;

drivers/s390/cio/vfio_ccw_ops.c +0 -0
index 6ae4d012d800..b1cd89d900ab 100644
@@ -14,6 +14,7 @@
  #include <linux/nospec.h>
  #include <linux/slab.h>


+#include "vfio_ccw_parent.h"
 #include "vfio_ccw_private.h"

 static const struct vfio_device_ops vfio_ccw_dev_ops;

drivers/s390/cio/vfio_ccw_ops.c +0 -0
@@ -55,7 +56,9 @@ static int vfio_ccw_mdev_init_dev(struct
 vfio_device *vdev)


 static int vfio_ccw_mdev_probe(struct mdev_device *mdev) {
-       struct vfio_ccw_private *private = dev_get_drvdata(mdev-

Quoted 1 line

dev.parent);

+       struct subchannel *sch = to_subchannel(mdev->dev.parent); +       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev); +       struct vfio_ccw_private *private = dev_get_drvdata(&parent-

Quoted 1 line

dev);

        int ret;

        if (private->state == VFIO_CCW_STATE_NOT_OPER)

drivers/s390/cio/vfio_ccw_ops.c +0 -0
@@ -100,7 +103,9 @@ static void vfio_ccw_mdev_release_dev(struct
 vfio_device *vdev)


 static void vfio_ccw_mdev_remove(struct mdev_device *mdev) {
-       struct vfio_ccw_private *private = dev_get_drvdata(mdev-

Quoted 1 line

dev.parent);

+       struct subchannel *sch = to_subchannel(mdev->dev.parent); +       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev); +       struct vfio_ccw_private *private = dev_get_drvdata(&parent-

Quoted 1 line

dev);


        VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: remove\n", private->sch->schid.cssid,

drivers/s390/cio/vfio_ccw_parent.h new file +28 -0
new file mode 100644
index 000000000000..834c00077802
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * MDEV Parent contents for vfio_ccw driver
+ *
+ * Copyright IBM Corp. 2022
+ */
+
+#ifndef _VFIO_CCW_PARENT_H_
+#define _VFIO_CCW_PARENT_H_
+
+#include <linux/mdev.h>
+
+/**
+ * struct vfio_ccw_parent
+ *
+ * @dev: embedded device struct
+ * @parent: parent data structures for mdevs created
+ * @mdev_type(s): identifying information for mdevs created
+ */
+struct vfio_ccw_parent {
+       struct device           dev;
+
+       struct mdev_parent      parent;
+       struct mdev_type        mdev_type;
+       struct mdev_type        *mdev_types[1];
+};
+
+#endif
drivers/s390/cio/vfio_ccw_private.h +0 -1
index bd5fb81456af..673e9a81a172 100644
@@ -89,7 +89,6 @@ struct vfio_ccw_crw {
   * @io_work: work for deferral process of I/O handling
   * @crw_work: work for deferral process of CRW handling
   * @release_comp: synchronization helper for vfio device release
- * @parent: parent data structures for mdevs created
   */
  struct vfio_ccw_private {
         struct vfio_device vdev;
@@ -116,10 +115,6 @@ struct vfio_ccw_private {
         struct work_struct      crw_work;


        struct completion       release_comp; -
-       struct mdev_parent      parent;
-       struct mdev_type        mdev_type; -       struct mdev_type        *mdev_types[1]; } __aligned(8);

 int vfio_ccw_sch_quiesce(struct subchannel *sch);

maintainer
#3 lore raw

Re: [PATCH v1 1/7] vfio/ccw: create a parent struct

In reply to Eric Farman
Quoted 40 lines · Eric Farman

Move the stuff associated with the mdev parent (and thus the subchannel struct) into its own struct, and leave the rest in the existing private structure.

The subchannel will point to the parent, and the parent will point to the private, for the areas where one or both are needed. Further separation of these structs will follow.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 104 ++++++++++++++++++++--------
 drivers/s390/cio/vfio_ccw_ops.c     |   9 ++-
 drivers/s390/cio/vfio_ccw_parent.h  |  28 ++++++++
 drivers/s390/cio/vfio_ccw_private.h |   5 --
 4 files changed, 112 insertions(+), 34 deletions(-)
 create mode 100644 drivers/s390/cio/vfio_ccw_parent.h
drivers/s390/cio/vfio_ccw_drv.c +3 -1
index 7f5402fe857a..634760ca0dea 100644
@@ -20,6 +20,7 @@
 #include "chp.h"
 #include "ioasm.h"
 #include "css.h"
+#include "vfio_ccw_parent.h"
 #include "vfio_ccw_private.h"
 
 struct workqueue_struct *vfio_ccw_work_q;
@@ -36,7 +37,8 @@ debug_info_t *vfio_ccw_debug_trace_id;
  */
 int vfio_ccw_sch_quiesce(struct subchannel *sch)
 {
-	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
+	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 	DECLARE_COMPLETION_ONSTACK(completion);
 	int iretry, ret = 0;
 

drivers/s390/cio/vfio_ccw_drv.c int vfio_ccw_sch_quiesce(struct subchannel *sch) · line 56

Quoted 10 lines
drivers/s390/cio/vfio_ccw_drv.c +1 -6
@@ -51,19 +53,21 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)
 			break;
 		}
 
-		/*
-		 * Flush all I/O and wait for
-		 * cancel/halt/clear completion.
-		 */
-		private->completion = &completion;
-		spin_unlock_irq(sch->lock);
+		if (private) {

Is it valid to ever reach this code with private == NULL? If no, then this should probably be a WARN_ON upfront?

Quoted 22 lines
drivers/s390/cio/vfio_ccw_drv.c +12 -5
+			/*
+			 * Flush all I/O and wait for
+			 * cancel/halt/clear completion.
+			 */
+			private->completion = &completion;
+			spin_unlock_irq(sch->lock);
 
-		if (ret == -EBUSY)
-			wait_for_completion_timeout(&completion, 3*HZ);
+			if (ret == -EBUSY)
+				wait_for_completion_timeout(&completion, 3*HZ);
 
-		private->completion = NULL;
-		flush_workqueue(vfio_ccw_work_q);
-		spin_lock_irq(sch->lock);
+			private->completion = NULL;
+			flush_workqueue(vfio_ccw_work_q);
+			spin_lock_irq(sch->lock);
+		}
 		ret = cio_disable_subchannel(sch);
 	} while (ret == -EBUSY);
 

.. snip ..

Quoted 22 lines
drivers/s390/cio/vfio_ccw_parent.h new file +16 -0
new file mode 100644
index 000000000000..834c00077802
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * MDEV Parent contents for vfio_ccw driver
+ *
+ * Copyright IBM Corp. 2022
+ */
+
+#ifndef _VFIO_CCW_PARENT_H_
+#define _VFIO_CCW_PARENT_H_
+
+#include <linux/mdev.h>
+
+/**
+ * struct vfio_ccw_parent
+ *
+ * @dev: embedded device struct

drivers/s390/cio/vfio_ccw_parent.h line 26

Quoted 10 lines
drivers/s390/cio/vfio_ccw_parent.h new file +10 -0
+ * @parent: parent data structures for mdevs created
+ * @mdev_type(s): identifying information for mdevs created
+ */
+struct vfio_ccw_parent {
+	struct device		dev;
+
+	struct mdev_parent	parent;
+	struct mdev_type	mdev_type;
+	struct mdev_type	*mdev_types[1];
+};

Structure itself seems fine, but any reason we need a new file for it?

author maintainer
#4 lore raw

Re: [PATCH v1 1/7] vfio/ccw: create a parent struct

Quoted 52 lines · Matthew Rosato
Quoted 51 lines · Eric Farman

Move the stuff associated with the mdev parent (and thus the subchannel struct) into its own struct, and leave the rest in the existing private structure.

The subchannel will point to the parent, and the parent will point to the private, for the areas where one or both are needed. Further separation of these structs will follow.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 104 ++++++++++++++++++++----
----
 drivers/s390/cio/vfio_ccw_ops.c     |   9 ++- drivers/s390/cio/vfio_ccw_parent.h  |  28 ++++++++ drivers/s390/cio/vfio_ccw_private.h |   5 --

 4 files changed, 112 insertions(+), 34 deletions(-)

 create mode 100644 drivers/s390/cio/vfio_ccw_parent.h

drivers/s390/cio/vfio_ccw_drv.c +1 -0
index 7f5402fe857a..634760ca0dea 100644
@@ -20,6 +20,7 @@
  #include "chp.h"
  #include "ioasm.h"
  #include "css.h"
+#include "vfio_ccw_parent.h"
  #include "vfio_ccw_private.h"


 struct workqueue_struct *vfio_ccw_work_q;

drivers/s390/cio/vfio_ccw_drv.c +2 -1
@@ -36,7 +37,8 @@ debug_info_t *vfio_ccw_debug_trace_id;
   */
  int vfio_ccw_sch_quiesce(struct subchannel *sch)
  {
-       struct vfio_ccw_private *private = dev_get_drvdata(&sch-
 >dev);
+       struct vfio_ccw_parent *parent = dev_get_drvdata(&sch-
 >dev);
+       struct vfio_ccw_private *private = dev_get_drvdata(&parent-
 >dev);

        DECLARE_COMPLETION_ONSTACK(completion);
        int iretry, ret = 0;

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -51,19 +53,21 @@ int vfio_ccw_sch_quiesce(struct subchannel
 *sch)
                         break;
                 }


-               /*
-                * Flush all I/O and wait for

Quoted 8 lines
Quoted 5 lines

-                * cancel/halt/clear completion. -                */
-               private->completion = &completion; -               spin_unlock_irq(sch->lock); +               if (private) {

Is it valid to ever reach this code with private == NULL?  If no, then this should probably be a WARN_ON upfront?

Hrm, the caller jumps from private -> subchannel, so it would be weird if we couldn't then go back the other way. Probably impossible, I'll unwind these whitespace changes and put the WARN_ON on top. Thanks for the tip.

Quoted 56 lines
Quoted 25 lines

+                       /*
+                        * Flush all I/O and wait for
+                        * cancel/halt/clear completion. +                        */
+                       private->completion = &completion; +                       spin_unlock_irq(sch->lock);

-               if (ret == -EBUSY)
-                       wait_for_completion_timeout(&completion, 3*HZ);
+                       if (ret == -EBUSY)
+                               wait_for_completion_timeout(&comple tion, 3*HZ);

-               private->completion = NULL;
-               flush_workqueue(vfio_ccw_work_q);
-               spin_lock_irq(sch->lock);
+                       private->completion = NULL;
+                       flush_workqueue(vfio_ccw_work_q); +                       spin_lock_irq(sch->lock);
+               }
                ret = cio_disable_subchannel(sch);
        } while (ret == -EBUSY);

.. snip ..

Quoted 28 lines
drivers/s390/cio/vfio_ccw_parent.h new file +21 -0
new file mode 100644
index 000000000000..834c00077802
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * MDEV Parent contents for vfio_ccw driver
+ *
+ * Copyright IBM Corp. 2022
+ */
+
+#ifndef _VFIO_CCW_PARENT_H_
+#define _VFIO_CCW_PARENT_H_
+
+#include <linux/mdev.h>
+
+/**
+ * struct vfio_ccw_parent
+ *
+ * @dev: embedded device struct
+ * @parent: parent data structures for mdevs created
+ * @mdev_type(s): identifying information for mdevs created
+ */
+struct vfio_ccw_parent {
+       struct device           dev;
Quoted 9 lines

drivers/s390/cio/vfio_ccw_parent.h line 26

Quoted 5 lines
drivers/s390/cio/vfio_ccw_parent.h new file +5 -0
+
+       struct mdev_parent      parent;
+       struct mdev_type        mdev_type;
+       struct mdev_type        *mdev_types[1];
+};

Structure itself seems fine, but any reason we need a new file for it?

Not really. I could leave it in _private.h, but that file is just a dumping ground for everything so I thought this would be a good opportunity to start to cleaning that up. But it wouldn't bother me to leave that whole process to another day too.

author maintainer
#5 lore raw

PATCH 2/7 vfio/ccw: remove private->sch

In reply to Eric Farman

These places all rely on the ability to jump from a private struct back to the subchannel struct. Rather than keeping a copy in our back pocket, let's use the relationship provided by the vfio_device embedded within the private.

---
 drivers/s390/cio/vfio_ccw_chp.c     |  5 +++--
 drivers/s390/cio/vfio_ccw_drv.c     |  3 +--
 drivers/s390/cio/vfio_ccw_fsm.c     | 27 ++++++++++++---------------
 drivers/s390/cio/vfio_ccw_ops.c     | 12 ++++++------
 drivers/s390/cio/vfio_ccw_private.h |  7 ++++---
 5 files changed, 26 insertions(+), 28 deletions(-)
drivers/s390/cio/vfio_ccw_chp.c +3 -2
index 13b26a1c7988..d3f3a611f95b 100644
@@ -16,6 +16,7 @@ static ssize_t vfio_ccw_schib_region_read(struct vfio_ccw_private *private,
 					  char __user *buf, size_t count,
 					  loff_t *ppos)
 {
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	unsigned int i = VFIO_CCW_OFFSET_TO_INDEX(*ppos) - VFIO_CCW_NUM_REGIONS;
 	loff_t pos = *ppos & VFIO_CCW_OFFSET_MASK;
 	struct ccw_schib_region *region;
@@ -27,12 +28,12 @@ static ssize_t vfio_ccw_schib_region_read(struct vfio_ccw_private *private,
 	mutex_lock(&private->io_mutex);
 	region = private->region[i].data;
 
-	if (cio_update_schib(private->sch)) {
+	if (cio_update_schib(sch)) {
 		ret = -ENODEV;
 		goto out;
 	}
 
-	memcpy(region, &private->sch->schib, sizeof(*region));
+	memcpy(region, &sch->schib, sizeof(*region));
 
 	if (copy_to_user(buf, (void *)region + pos, count)) {
 		ret = -EFAULT;
drivers/s390/cio/vfio_ccw_drv.c +1 -2
index 634760ca0dea..4ee953c8ae39 100644
@@ -154,7 +154,6 @@ static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 	if (!private)
 		return ERR_PTR(-ENOMEM);
 
-	private->sch = sch;
 	mutex_init(&private->io_mutex);
 	private->state = VFIO_CCW_STATE_STANDBY;
 	INIT_LIST_HEAD(&private->crw);
@@ -383,7 +382,7 @@ static int vfio_ccw_chp_event(struct subchannel *sch,
 	if (!private || !mask)
 		return 0;
 
-	trace_vfio_ccw_chp_event(private->sch->schid, mask, event);
+	trace_vfio_ccw_chp_event(sch->schid, mask, event);
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: mask=0x%x event=%d\n",
 			   sch->schid.cssid,
 			   sch->schid.ssid, sch->schid.sch_no,
drivers/s390/cio/vfio_ccw_fsm.c +12 -15
index a59c758869f8..e67fad897af3 100644
@@ -18,15 +18,13 @@
 
 static int fsm_io_helper(struct vfio_ccw_private *private)
 {
-	struct subchannel *sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	union orb *orb;
 	int ccode;
 	__u8 lpm;
 	unsigned long flags;
 	int ret;
 
-	sch = private->sch;
-
 	spin_lock_irqsave(sch->lock, flags);
 
 	orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm);
@@ -80,13 +78,11 @@ static int fsm_io_helper(struct vfio_ccw_private *private)
 
 static int fsm_do_halt(struct vfio_ccw_private *private)
 {
-	struct subchannel *sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	unsigned long flags;
 	int ccode;
 	int ret;
 
-	sch = private->sch;
-
 	spin_lock_irqsave(sch->lock, flags);
 
 	VFIO_CCW_TRACE_EVENT(2, "haltIO");
@@ -121,13 +117,11 @@ static int fsm_do_halt(struct vfio_ccw_private *private)
 
 static int fsm_do_clear(struct vfio_ccw_private *private)
 {
-	struct subchannel *sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	unsigned long flags;
 	int ccode;
 	int ret;
 
-	sch = private->sch;
-
 	spin_lock_irqsave(sch->lock, flags);
 
 	VFIO_CCW_TRACE_EVENT(2, "clearIO");
@@ -160,7 +154,7 @@ static int fsm_do_clear(struct vfio_ccw_private *private)
 static void fsm_notoper(struct vfio_ccw_private *private,
 			enum vfio_ccw_event event)
 {
-	struct subchannel *sch = private->sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: notoper event %x state %x\n",
 			   sch->schid.cssid,
@@ -228,7 +222,7 @@ static void fsm_async_retry(struct vfio_ccw_private *private,
 static void fsm_disabled_irq(struct vfio_ccw_private *private,
 			     enum vfio_ccw_event event)
 {
-	struct subchannel *sch = private->sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 
 	/*
 	 * An interrupt in a disabled state means a previous disable was not
@@ -238,7 +232,9 @@ static void fsm_disabled_irq(struct vfio_ccw_private *private,
 }
 inline struct subchannel_id get_schid(struct vfio_ccw_private *p)
 {
-	return p->sch->schid;
+	struct subchannel *sch = to_subchannel(p->vdev.dev->parent);
+
+	return sch->schid;
 }
 
 /*
@@ -360,10 +356,11 @@ static void fsm_async_request(struct vfio_ccw_private *private,
 static void fsm_irq(struct vfio_ccw_private *private,
 		    enum vfio_ccw_event event)
 {
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	struct irb *irb = this_cpu_ptr(&cio_irb);
 
 	VFIO_CCW_TRACE_EVENT(6, "IRQ");
-	VFIO_CCW_TRACE_EVENT(6, dev_name(&private->sch->dev));
+	VFIO_CCW_TRACE_EVENT(6, dev_name(&sch->dev));
 
 	memcpy(&private->irb, irb, sizeof(*irb));
 
@@ -376,7 +373,7 @@ static void fsm_irq(struct vfio_ccw_private *private,
 static void fsm_open(struct vfio_ccw_private *private,
 		     enum vfio_ccw_event event)
 {
-	struct subchannel *sch = private->sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	int ret;
 
 	spin_lock_irq(sch->lock);
@@ -397,7 +394,7 @@ static void fsm_open(struct vfio_ccw_private *private,
 static void fsm_close(struct vfio_ccw_private *private,
 		      enum vfio_ccw_event event)
 {
-	struct subchannel *sch = private->sch;
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
 	int ret;
 
 	spin_lock_irq(sch->lock);
drivers/s390/cio/vfio_ccw_ops.c +6 -6
index b1cd89d900ab..cf383c729d53 100644
@@ -69,9 +69,9 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 		return ret;
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
-			   private->sch->schid.cssid,
-			   private->sch->schid.ssid,
-			   private->sch->schid.sch_no);
+			   sch->schid.cssid,
+			   sch->schid.ssid,
+			   sch->schid.sch_no);
 
 	ret = vfio_register_emulated_iommu_dev(&private->vdev);
 	if (ret)
@@ -108,9 +108,9 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: remove\n",
-			   private->sch->schid.cssid,
-			   private->sch->schid.ssid,
-			   private->sch->schid.sch_no);
+			   sch->schid.cssid,
+			   sch->schid.ssid,
+			   sch->schid.sch_no);
 
 	vfio_unregister_group_dev(&private->vdev);
 
drivers/s390/cio/vfio_ccw_private.h +4 -3
index 673e9a81a172..0fdff1435230 100644
@@ -70,7 +70,6 @@ struct vfio_ccw_crw {
 /**
  * struct vfio_ccw_private
  * @vdev: Embedded VFIO device
- * @sch: pointer to the subchannel
  * @state: internal state of the device
  * @completion: synchronization helper of the I/O completion
  * @io_region: MMIO region to input/output I/O arguments/results
@@ -92,7 +91,6 @@ struct vfio_ccw_crw {
  */
 struct vfio_ccw_private {
 	struct vfio_device vdev;
-	struct subchannel	*sch;
 	int			state;
 	struct completion	*completion;
 	struct ccw_io_region	*io_region;
@@ -157,7 +155,10 @@ extern fsm_func_t *vfio_ccw_jumptable[NR_VFIO_CCW_STATES][NR_VFIO_CCW_EVENTS];
 static inline void vfio_ccw_fsm_event(struct vfio_ccw_private *private,
 				      enum vfio_ccw_event event)
 {
-	trace_vfio_ccw_fsm_event(private->sch->schid, private->state, event);
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);
+
+	if (sch)
+		trace_vfio_ccw_fsm_event(sch->schid, private->state, event);
 	vfio_ccw_jumptable[private->state][event](private, event);
 }
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 2/7
#6 lore raw

Re: [PATCH v1 2/7] vfio/ccw: remove private->sch

Quoted 19 lines · Eric Farman

These places all rely on the ability to jump from a private struct back to the subchannel struct. Rather than keeping a copy in our back pocket, let's use the relationship provided by the vfio_device embedded within the private.

---
 drivers/s390/cio/vfio_ccw_chp.c     |  5 +++--
 drivers/s390/cio/vfio_ccw_drv.c     |  3 +--
 drivers/s390/cio/vfio_ccw_fsm.c     | 27 ++++++++++++---------------
 drivers/s390/cio/vfio_ccw_ops.c     | 12 ++++++------
 drivers/s390/cio/vfio_ccw_private.h |  7 ++++---
 5 files changed, 26 insertions(+), 28 deletions(-)
drivers/s390/cio/vfio_ccw_chp.c +0 -0
index 13b26a1c7988..d3f3a611f95b 100644

drivers/s390/cio/vfio_ccw_chp.c static ssize_t vfio_ccw_schib_region_read(struct vfio_ccw_private *private, · line 19

Quoted 4 lines
drivers/s390/cio/vfio_ccw_chp.c +1 -0
@@ -16,6 +16,7 @@ static ssize_t vfio_ccw_schib_region_read(struct vfio_ccw_private *private,
 					  char __user *buf, size_t count,
 					  loff_t *ppos)
 {
+	struct subchannel *sch = to_subchannel(private->vdev.dev->parent);

I'm not a big fan of the amount of indirection there, but I prefer this over back-pocketing the subchannel in vfio_ccw_private anyway

author maintainer
#7 lore raw

PATCH 3/7 vfio/ccw: move private initialization to callback

In reply to Eric Farman

There's already a device initialization callback that is used to initialize the release completion workaround.

Move the other elements of the vfio_ccw_private struct that require distinct initialization over to that routine.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 57 +++--------------------------
 drivers/s390/cio/vfio_ccw_ops.c     | 43 ++++++++++++++++++++++
 drivers/s390/cio/vfio_ccw_private.h |  7 +++-
 3 files changed, 55 insertions(+), 52 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +6 -51
index 4ee953c8ae39..cc9ed2fd970f 100644
@@ -24,10 +24,10 @@
 #include "vfio_ccw_private.h"
 
 struct workqueue_struct *vfio_ccw_work_q;
-static struct kmem_cache *vfio_ccw_io_region;
-static struct kmem_cache *vfio_ccw_cmd_region;
-static struct kmem_cache *vfio_ccw_schib_region;
-static struct kmem_cache *vfio_ccw_crw_region;
+struct kmem_cache *vfio_ccw_io_region;
+struct kmem_cache *vfio_ccw_cmd_region;
+struct kmem_cache *vfio_ccw_schib_region;
+struct kmem_cache *vfio_ccw_crw_region;
 
 debug_info_t *vfio_ccw_debug_msg_id;
 debug_info_t *vfio_ccw_debug_trace_id;
@@ -74,7 +74,7 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)
 	return ret;
 }
 
-static void vfio_ccw_sch_io_todo(struct work_struct *work)
+void vfio_ccw_sch_io_todo(struct work_struct *work)
 {
 	struct vfio_ccw_private *private;
 	struct irb *irb;
@@ -110,7 +110,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
 		eventfd_signal(private->io_trigger, 1);
 }
 
-static void vfio_ccw_crw_todo(struct work_struct *work)
+void vfio_ccw_crw_todo(struct work_struct *work)
 {
 	struct vfio_ccw_private *private;
 
@@ -154,52 +154,7 @@ static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 	if (!private)
 		return ERR_PTR(-ENOMEM);
 
-	mutex_init(&private->io_mutex);
-	private->state = VFIO_CCW_STATE_STANDBY;
-	INIT_LIST_HEAD(&private->crw);
-	INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
-	INIT_WORK(&private->crw_work, vfio_ccw_crw_todo);
-
-	private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
-				       GFP_KERNEL);
-	if (!private->cp.guest_cp)
-		goto out_free_private;
-
-	private->io_region = kmem_cache_zalloc(vfio_ccw_io_region,
-					       GFP_KERNEL | GFP_DMA);
-	if (!private->io_region)
-		goto out_free_cp;
-
-	private->cmd_region = kmem_cache_zalloc(vfio_ccw_cmd_region,
-						GFP_KERNEL | GFP_DMA);
-	if (!private->cmd_region)
-		goto out_free_io;
-
-	private->schib_region = kmem_cache_zalloc(vfio_ccw_schib_region,
-						  GFP_KERNEL | GFP_DMA);
-
-	if (!private->schib_region)
-		goto out_free_cmd;
-
-	private->crw_region = kmem_cache_zalloc(vfio_ccw_crw_region,
-						GFP_KERNEL | GFP_DMA);
-
-	if (!private->crw_region)
-		goto out_free_schib;
 	return private;
-
-out_free_schib:
-	kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
-out_free_cmd:
-	kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
-out_free_io:
-	kmem_cache_free(vfio_ccw_io_region, private->io_region);
-out_free_cp:
-	kfree(private->cp.guest_cp);
-out_free_private:
-	mutex_destroy(&private->io_mutex);
-	kfree(private);
-	return ERR_PTR(-ENOMEM);
 }
 
 static void vfio_ccw_free_private(struct vfio_ccw_private *private)
drivers/s390/cio/vfio_ccw_ops.c +43 -0

51 lines not on this page · raw message

drivers/s390/cio/vfio_ccw_private.h +6 -1
index 0fdff1435230..b35940057073 100644
@@ -116,6 +116,8 @@ struct vfio_ccw_private {
 } __aligned(8);
 
 int vfio_ccw_sch_quiesce(struct subchannel *sch);
+void vfio_ccw_sch_io_todo(struct work_struct *work);
+void vfio_ccw_crw_todo(struct work_struct *work);
 
 extern struct mdev_driver vfio_ccw_mdev_driver;
 
@@ -163,7 +165,10 @@ static inline void vfio_ccw_fsm_event(struct vfio_ccw_private *private,
 }
 
 extern struct workqueue_struct *vfio_ccw_work_q;
-
+extern struct kmem_cache *vfio_ccw_io_region;
+extern struct kmem_cache *vfio_ccw_cmd_region;
+extern struct kmem_cache *vfio_ccw_schib_region;
+extern struct kmem_cache *vfio_ccw_crw_region;
 
 /* s390 debug feature, similar to base cio */
 extern debug_info_t *vfio_ccw_debug_msg_id;
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 3/7
#8 lore raw

Re: [PATCH v1 3/7] vfio/ccw: move private initialization to callback

Quoted 2 lines · Eric Farman

There's already a device initialization callback that is used to initialize the release completion workaround.

As discussed off-list, maybe clarify what callback you're talking about here and/or reference the commit that added it.

Quoted 49 lines

Move the other elements of the vfio_ccw_private struct that require distinct initialization over to that routine.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 57 +++--------------------------
 drivers/s390/cio/vfio_ccw_ops.c     | 43 ++++++++++++++++++++++
 drivers/s390/cio/vfio_ccw_private.h |  7 +++-
 3 files changed, 55 insertions(+), 52 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +6 -6
index 4ee953c8ae39..cc9ed2fd970f 100644
@@ -24,10 +24,10 @@
 #include "vfio_ccw_private.h"
 
 struct workqueue_struct *vfio_ccw_work_q;
-static struct kmem_cache *vfio_ccw_io_region;
-static struct kmem_cache *vfio_ccw_cmd_region;
-static struct kmem_cache *vfio_ccw_schib_region;
-static struct kmem_cache *vfio_ccw_crw_region;
+struct kmem_cache *vfio_ccw_io_region;
+struct kmem_cache *vfio_ccw_cmd_region;
+struct kmem_cache *vfio_ccw_schib_region;
+struct kmem_cache *vfio_ccw_crw_region;
 
 debug_info_t *vfio_ccw_debug_msg_id;
 debug_info_t *vfio_ccw_debug_trace_id;
@@ -74,7 +74,7 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)
 	return ret;
 }
 
-static void vfio_ccw_sch_io_todo(struct work_struct *work)
+void vfio_ccw_sch_io_todo(struct work_struct *work)
 {
 	struct vfio_ccw_private *private;
 	struct irb *irb;
@@ -110,7 +110,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
 		eventfd_signal(private->io_trigger, 1);
 }
 
-static void vfio_ccw_crw_todo(struct work_struct *work)
+void vfio_ccw_crw_todo(struct work_struct *work)
 {
 	struct vfio_ccw_private *private;
 

drivers/s390/cio/vfio_ccw_drv.c static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch) · line 155

Quoted 2 lines
drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -154,52 +154,7 @@ static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 	if (!private)
 		return ERR_PTR(-ENOMEM);

Not sure we really still need vfio_ccw_alloc_private() now or whether you can just kzalloc() inline right in vfio_ccw_sch_probe()

Either way:

Quoted 131 lines
drivers/s390/cio/vfio_ccw_drv.c +0 -45
-	mutex_init(&private->io_mutex);
-	private->state = VFIO_CCW_STATE_STANDBY;
-	INIT_LIST_HEAD(&private->crw);
-	INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
-	INIT_WORK(&private->crw_work, vfio_ccw_crw_todo);
-
-	private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
-				       GFP_KERNEL);
-	if (!private->cp.guest_cp)
-		goto out_free_private;
-
-	private->io_region = kmem_cache_zalloc(vfio_ccw_io_region,
-					       GFP_KERNEL | GFP_DMA);
-	if (!private->io_region)
-		goto out_free_cp;
-
-	private->cmd_region = kmem_cache_zalloc(vfio_ccw_cmd_region,
-						GFP_KERNEL | GFP_DMA);
-	if (!private->cmd_region)
-		goto out_free_io;
-
-	private->schib_region = kmem_cache_zalloc(vfio_ccw_schib_region,
-						  GFP_KERNEL | GFP_DMA);
-
-	if (!private->schib_region)
-		goto out_free_cmd;
-
-	private->crw_region = kmem_cache_zalloc(vfio_ccw_crw_region,
-						GFP_KERNEL | GFP_DMA);
-
-	if (!private->crw_region)
-		goto out_free_schib;
 	return private;
-
-out_free_schib:
-	kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
-out_free_cmd:
-	kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
-out_free_io:
-	kmem_cache_free(vfio_ccw_io_region, private->io_region);
-out_free_cp:
-	kfree(private->cp.guest_cp);
-out_free_private:
-	mutex_destroy(&private->io_mutex);
-	kfree(private);
-	return ERR_PTR(-ENOMEM);
 }
 
 static void vfio_ccw_free_private(struct vfio_ccw_private *private)
drivers/s390/cio/vfio_ccw_ops.c +43 -0
index cf383c729d53..626b8eb3507b 100644
@@ -50,8 +50,51 @@ static int vfio_ccw_mdev_init_dev(struct vfio_device *vdev)
 	struct vfio_ccw_private *private =
 		container_of(vdev, struct vfio_ccw_private, vdev);
 
+	mutex_init(&private->io_mutex);
+	private->state = VFIO_CCW_STATE_STANDBY;
+	INIT_LIST_HEAD(&private->crw);
+	INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
+	INIT_WORK(&private->crw_work, vfio_ccw_crw_todo);
 	init_completion(&private->release_comp);
+
+	private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
+				       GFP_KERNEL);
+	if (!private->cp.guest_cp)
+		goto out_free_private;
+
+	private->io_region = kmem_cache_zalloc(vfio_ccw_io_region,
+					       GFP_KERNEL | GFP_DMA);
+	if (!private->io_region)
+		goto out_free_cp;
+
+	private->cmd_region = kmem_cache_zalloc(vfio_ccw_cmd_region,
+						GFP_KERNEL | GFP_DMA);
+	if (!private->cmd_region)
+		goto out_free_io;
+
+	private->schib_region = kmem_cache_zalloc(vfio_ccw_schib_region,
+						  GFP_KERNEL | GFP_DMA);
+	if (!private->schib_region)
+		goto out_free_cmd;
+
+	private->crw_region = kmem_cache_zalloc(vfio_ccw_crw_region,
+						GFP_KERNEL | GFP_DMA);
+	if (!private->crw_region)
+		goto out_free_schib;
+
 	return 0;
+
+out_free_schib:
+	kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
+out_free_cmd:
+	kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
+out_free_io:
+	kmem_cache_free(vfio_ccw_io_region, private->io_region);
+out_free_cp:
+	kfree(private->cp.guest_cp);
+out_free_private:
+	mutex_destroy(&private->io_mutex);
+	return -ENOMEM;
 }
 
 static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
drivers/s390/cio/vfio_ccw_private.h +6 -1
index 0fdff1435230..b35940057073 100644
@@ -116,6 +116,8 @@ struct vfio_ccw_private {
 } __aligned(8);
 
 int vfio_ccw_sch_quiesce(struct subchannel *sch);
+void vfio_ccw_sch_io_todo(struct work_struct *work);
+void vfio_ccw_crw_todo(struct work_struct *work);
 
 extern struct mdev_driver vfio_ccw_mdev_driver;
 
@@ -163,7 +165,10 @@ static inline void vfio_ccw_fsm_event(struct vfio_ccw_private *private,
 }
 
 extern struct workqueue_struct *vfio_ccw_work_q;
-
+extern struct kmem_cache *vfio_ccw_io_region;
+extern struct kmem_cache *vfio_ccw_cmd_region;
+extern struct kmem_cache *vfio_ccw_schib_region;
+extern struct kmem_cache *vfio_ccw_crw_region;
 
 /* s390 debug feature, similar to base cio */
 extern debug_info_t *vfio_ccw_debug_msg_id;
author maintainer
#9 lore raw

Re: [PATCH v1 3/7] vfio/ccw: move private initialization to callback

Quoted 6 lines · Matthew Rosato
Quoted 2 lines · Eric Farman

There's already a device initialization callback that is used to initialize the release completion workaround.

As discussed off-list, maybe clarify what callback you're talking about here and/or reference the commit that added it.

Agreed. Will point out that it's private->release_comp, introduced with commit ebb72b765fb49 ("vfio/ccw: Use the new device life cycle helpers")

Quoted 51 lines
Quoted 51 lines

Move the other elements of the vfio_ccw_private struct that require distinct initialization over to that routine.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 57 +++----------------------
----
 drivers/s390/cio/vfio_ccw_ops.c     | 43 ++++++++++++++++++++++ drivers/s390/cio/vfio_ccw_private.h |  7 +++-

 3 files changed, 55 insertions(+), 52 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +0 -0
index 4ee953c8ae39..cc9ed2fd970f 100644
@@ -24,10 +24,10 @@
  #include "vfio_ccw_private.h"


 struct workqueue_struct *vfio_ccw_work_q;

drivers/s390/cio/vfio_ccw_drv.c +4 -4
-static struct kmem_cache *vfio_ccw_io_region;
-static struct kmem_cache *vfio_ccw_cmd_region;
-static struct kmem_cache *vfio_ccw_schib_region;
-static struct kmem_cache *vfio_ccw_crw_region;
+struct kmem_cache *vfio_ccw_io_region;
+struct kmem_cache *vfio_ccw_cmd_region;
+struct kmem_cache *vfio_ccw_schib_region;
+struct kmem_cache *vfio_ccw_crw_region;


 debug_info_t *vfio_ccw_debug_msg_id;
 debug_info_t *vfio_ccw_debug_trace_id;

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -74,7 +74,7 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch)
         return ret;
  }

drivers/s390/cio/vfio_ccw_drv.c +1 -1
-static void vfio_ccw_sch_io_todo(struct work_struct *work)
+void vfio_ccw_sch_io_todo(struct work_struct *work)

 {
        struct vfio_ccw_private *private;
        struct irb *irb;

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -110,7 +110,7 @@ static void vfio_ccw_sch_io_todo(struct
 work_struct *work)
                 eventfd_signal(private->io_trigger, 1);
  }

drivers/s390/cio/vfio_ccw_drv.c +1 -1
-static void vfio_ccw_crw_todo(struct work_struct *work)
+void vfio_ccw_crw_todo(struct work_struct *work)

 {
        struct vfio_ccw_private *private;

Quoted 8 lines

drivers/s390/cio/vfio_ccw_drv.c static struct vfio_ccw_private · line 156

Quoted 5 lines

drivers/s390/cio/vfio_ccw_drv.c +0 -0
@@ -154,52 +154,7 @@ static struct vfio_ccw_private
 *vfio_ccw_alloc_private(struct subchannel *sch)
         if (!private)
                 return ERR_PTR(-ENOMEM);

Not sure we really still need vfio_ccw_alloc_private() now or whether you can just kzalloc() inline right in vfio_ccw_sch_probe()

Fair. It ends up ends up getting scrapped in patch 6 anyway, but that might clean things up just a smidge more. Will give it a whirl.

Quoted 3 lines

Either way:

Thanks!

Quoted 157 lines
Quoted 156 lines


-       mutex_init(&private->io_mutex);
-       private->state = VFIO_CCW_STATE_STANDBY;
-       INIT_LIST_HEAD(&private->crw);
-       INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo); -       INIT_WORK(&private->crw_work, vfio_ccw_crw_todo); -
-       private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
-                                      GFP_KERNEL);
-       if (!private->cp.guest_cp)
-               goto out_free_private;
-
-       private->io_region = kmem_cache_zalloc(vfio_ccw_io_region, -                                              GFP_KERNEL | GFP_DMA);
-       if (!private->io_region)
-               goto out_free_cp;
-
-       private->cmd_region = kmem_cache_zalloc(vfio_ccw_cmd_region,
-                                               GFP_KERNEL | GFP_DMA);
-       if (!private->cmd_region)
-               goto out_free_io;
-
-       private->schib_region = kmem_cache_zalloc(vfio_ccw_schib_region,
-                                                 GFP_KERNEL | GFP_DMA);

drivers/s390/cio/vfio_ccw_drv.c +0 -5
-
-       if (!private->schib_region)
-               goto out_free_cmd;
-
-       private->crw_region =

kmem_cache_zalloc(vfio_ccw_crw_region,
-                                               GFP_KERNEL | GFP_DMA);
-
-       if (!private->crw_region)
-               goto out_free_schib;
        return private;

drivers/s390/cio/vfio_ccw_drv.c +0 -3
-
-out_free_schib:
-       kmem_cache_free(vfio_ccw_schib_region, private-
Quoted 1 line

schib_region);

drivers/s390/cio/vfio_ccw_drv.c +0 -10
-out_free_cmd:
-       kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
-out_free_io:
-       kmem_cache_free(vfio_ccw_io_region, private->io_region);
-out_free_cp:
-       kfree(private->cp.guest_cp);
-out_free_private:
-       mutex_destroy(&private->io_mutex);
-       kfree(private);
-       return ERR_PTR(-ENOMEM);

 }

 static void vfio_ccw_free_private(struct vfio_ccw_private *private)

drivers/s390/cio/vfio_ccw_ops.c +0 -0
index cf383c729d53..626b8eb3507b 100644
@@ -50,8 +50,51 @@ static int vfio_ccw_mdev_init_dev(struct
 vfio_device *vdev)

        struct vfio_ccw_private *private = container_of(vdev, struct vfio_ccw_private, vdev);
+       mutex_init(&private->io_mutex);
+       private->state = VFIO_CCW_STATE_STANDBY;
+       INIT_LIST_HEAD(&private->crw);
+       INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo); +       INIT_WORK(&private->crw_work, vfio_ccw_crw_todo); init_completion(&private->release_comp);
+
+       private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
+                                      GFP_KERNEL);
+       if (!private->cp.guest_cp)
+               goto out_free_private;
+
+       private->io_region = kmem_cache_zalloc(vfio_ccw_io_region, +                                              GFP_KERNEL | GFP_DMA);
+       if (!private->io_region)
+               goto out_free_cp;
+
+       private->cmd_region = kmem_cache_zalloc(vfio_ccw_cmd_region,
+                                               GFP_KERNEL | GFP_DMA);
+       if (!private->cmd_region)
+               goto out_free_io;
+
+       private->schib_region = kmem_cache_zalloc(vfio_ccw_schib_region,
+                                                 GFP_KERNEL | GFP_DMA);
+       if (!private->schib_region)
+               goto out_free_cmd;
+
+       private->crw_region = kmem_cache_zalloc(vfio_ccw_crw_region,
+                                               GFP_KERNEL | GFP_DMA);
+       if (!private->crw_region)
+               goto out_free_schib;
+
        return 0;

drivers/s390/cio/vfio_ccw_ops.c +3 -0
+
+out_free_schib:
+       kmem_cache_free(vfio_ccw_schib_region, private-
Quoted 1 line

schib_region);

drivers/s390/cio/vfio_ccw_ops.c +9 -0
+out_free_cmd:
+       kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
+out_free_io:
+       kmem_cache_free(vfio_ccw_io_region, private->io_region);
+out_free_cp:
+       kfree(private->cp.guest_cp);
+out_free_private:
+       mutex_destroy(&private->io_mutex);
+       return -ENOMEM;

 }

 static int vfio_ccw_mdev_probe(struct mdev_device *mdev)

drivers/s390/cio/vfio_ccw_private.h +0 -0
index 0fdff1435230..b35940057073 100644
@@ -116,6 +116,8 @@ struct vfio_ccw_private {
  } __aligned(8);


 int vfio_ccw_sch_quiesce(struct subchannel *sch);

drivers/s390/cio/vfio_ccw_private.h +2 -0
+void vfio_ccw_sch_io_todo(struct work_struct *work);
+void vfio_ccw_crw_todo(struct work_struct *work);


 extern struct mdev_driver vfio_ccw_mdev_driver;

drivers/s390/cio/vfio_ccw_private.h +0 -0
@@ -163,7 +165,10 @@ static inline void vfio_ccw_fsm_event(struct
 vfio_ccw_private *private,
  }


 extern struct workqueue_struct *vfio_ccw_work_q;

drivers/s390/cio/vfio_ccw_private.h +4 -1
-
+extern struct kmem_cache *vfio_ccw_io_region;
+extern struct kmem_cache *vfio_ccw_cmd_region;
+extern struct kmem_cache *vfio_ccw_schib_region;
+extern struct kmem_cache *vfio_ccw_crw_region;


 /* s390 debug feature, similar to base cio */
 extern debug_info_t *vfio_ccw_debug_msg_id;

author maintainer
#10 lore raw

PATCH 4/7 vfio/ccw: move private to mdev lifecycle

In reply to Eric Farman

Now that the mdev parent data is split out into its own struct, it is safe to move the remaining private data to follow the mdev probe/remove lifecycle. The mdev parent data will remain where it is, and follow the subchannel and the css driver interfaces.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 17 ++---------------
 drivers/s390/cio/vfio_ccw_ops.c     | 26 +++++++++++++-------------
 drivers/s390/cio/vfio_ccw_private.h |  3 +++
 3 files changed, 18 insertions(+), 28 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +2 -15
index cc9ed2fd970f..686a9b9f6731 100644
@@ -146,7 +146,7 @@ static void vfio_ccw_sch_irq(struct subchannel *sch)
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT);
 }
 
-static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
+struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 {
 	struct vfio_ccw_private *private;
 
@@ -157,7 +157,7 @@ static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 	return private;
 }
 
-static void vfio_ccw_free_private(struct vfio_ccw_private *private)
+void vfio_ccw_free_private(struct vfio_ccw_private *private)
 {
 	struct vfio_ccw_crw *crw, *temp;
 
@@ -185,7 +185,6 @@ static void vfio_ccw_free_parent(struct device *dev)
 static int vfio_ccw_sch_probe(struct subchannel *sch)
 {
 	struct pmcw *pmcw = &sch->schib.pmcw;
-	struct vfio_ccw_private *private;
 	struct vfio_ccw_parent *parent;
 	int ret = -ENOMEM;
 
@@ -202,14 +201,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 	parent->dev.release = &vfio_ccw_free_parent;
 	device_initialize(&parent->dev);
 
-	private = vfio_ccw_alloc_private(sch);
-	if (IS_ERR(private)) {
-		put_device(&parent->dev);
-		return PTR_ERR(private);
-	}
-
 	dev_set_drvdata(&sch->dev, parent);
-	dev_set_drvdata(&parent->dev, private);
 
 	parent->mdev_type.sysfs_name = "io";
 	parent->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)";
@@ -226,9 +218,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 	return 0;
 
 out_free:
-	dev_set_drvdata(&parent->dev, NULL);
 	dev_set_drvdata(&sch->dev, NULL);
-	vfio_ccw_free_private(private);
 	put_device(&parent->dev);
 	return ret;
 }
@@ -236,13 +226,10 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 static void vfio_ccw_sch_remove(struct subchannel *sch)
 {
 	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
-	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
 
 	mdev_unregister_parent(&parent->parent);
 
 	dev_set_drvdata(&sch->dev, NULL);
-
-	vfio_ccw_free_private(private);
 	put_device(&parent->dev);
 
 	VFIO_CCW_MSG_EVENT(4, "unbound from subchannel %x.%x.%04x\n",
drivers/s390/cio/vfio_ccw_ops.c +13 -13
index 626b8eb3507b..3e627b236241 100644
@@ -101,15 +101,20 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 {
 	struct subchannel *sch = to_subchannel(mdev->dev.parent);
 	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
-	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
+	struct vfio_ccw_private *private;
 	int ret;
 
-	if (private->state == VFIO_CCW_STATE_NOT_OPER)
-		return -ENODEV;
+	private = vfio_ccw_alloc_private(sch);
+	if (!private)
+		return -ENOMEM;
 
 	ret = vfio_init_device(&private->vdev, &mdev->dev, &vfio_ccw_dev_ops);
-	if (ret)
+	if (ret) {
+		kfree(private);
 		return ret;
+	}
+
+	dev_set_drvdata(&parent->dev, private);
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
 			   sch->schid.cssid,
@@ -123,6 +128,7 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 	return 0;
 
 err_put_vdev:
+	dev_set_drvdata(&parent->dev, NULL);
 	vfio_put_device(&private->vdev);
 	return ret;
 }
@@ -132,15 +138,6 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
 	struct vfio_ccw_private *private =
 		container_of(vdev, struct vfio_ccw_private, vdev);
 
-	/*
-	 * We cannot free vfio_ccw_private here because it includes
-	 * parent info which must be free'ed by css driver.
-	 *
-	 * Use a workaround by memset'ing the core device part and
-	 * then notifying the remove path that all active references
-	 * to this device have been released.
-	 */
-	memset(vdev, 0, sizeof(*vdev));
 	complete(&private->release_comp);
 }
 
@@ -157,6 +154,7 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 
 	vfio_unregister_group_dev(&private->vdev);
 
+	dev_set_drvdata(&parent->dev, NULL);
 	vfio_put_device(&private->vdev);
 	/*
 	 * Wait for all active references on mdev are released so it
@@ -167,6 +165,8 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 	 * cycle.
 	 */
 	wait_for_completion(&private->release_comp);
+
+	vfio_ccw_free_private(private);
 }
 
 static int vfio_ccw_mdev_open_device(struct vfio_device *vdev)
drivers/s390/cio/vfio_ccw_private.h +3 -0
index b35940057073..c1959b8bfe86 100644
@@ -119,6 +119,9 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch);
 void vfio_ccw_sch_io_todo(struct work_struct *work);
 void vfio_ccw_crw_todo(struct work_struct *work);
 
+struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch);
+void vfio_ccw_free_private(struct vfio_ccw_private *private);
+
 extern struct mdev_driver vfio_ccw_mdev_driver;
 
 /*
Signature · 1 line
2.34.1
#11 lore raw

RE: [PATCH v1 4/7] vfio/ccw: move private to mdev lifecycle

Quoted 4 lines

From: Eric Farman <[email protected]>
Sent: Thursday, October 20, 2022 12:22 AM

drivers/s390/cio/vfio_ccw_ops.c static int vfio_ccw_mdev_probe(struct · line 109

Quoted 10 lines
drivers/s390/cio/vfio_ccw_ops.c +1 -3
@@ -101,15 +101,20 @@ static int vfio_ccw_mdev_probe(struct
 mdev_device *mdev)
 {
 	struct subchannel *sch = to_subchannel(mdev->dev.parent);
 	struct vfio_ccw_parent *parent = dev_get_drvdata(&sch->dev);
-	struct vfio_ccw_private *private = dev_get_drvdata(&parent->dev);
+	struct vfio_ccw_private *private;
 	int ret;
 
-	if (private->state == VFIO_CCW_STATE_NOT_OPER)
-		return -ENODEV;

Not familiar with ccw but just want to double confirm this removal is intentional w/o side-effect?

Quoted 17 lines
drivers/s390/cio/vfio_ccw_ops.c +8 -1
+	private = vfio_ccw_alloc_private(sch);
+	if (!private)
+		return -ENOMEM;
 
 	ret = vfio_init_device(&private->vdev, &mdev->dev,
 &vfio_ccw_dev_ops);
-	if (ret)
+	if (ret) {
+		kfree(private);
 		return ret;
+	}
+
+	dev_set_drvdata(&parent->dev, private);
 
drivers/s390/cio/vfio_ccw_ops.c +0 -0
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
 			   sch->schid.cssid,

drivers/s390/cio/vfio_ccw_ops.c static int vfio_ccw_mdev_probe(struct mdev_device · line 132

Quoted 5 lines
drivers/s390/cio/vfio_ccw_ops.c +1 -0
@@ -123,6 +128,7 @@ static int vfio_ccw_mdev_probe(struct mdev_device
 *mdev)
 	return 0;
 
 err_put_vdev:
+	dev_set_drvdata(&parent->dev, NULL);

No need to set drvdata to NULL, iiuc

author maintainer
#12 lore raw

Re: [PATCH v1 4/7] vfio/ccw: move private to mdev lifecycle

Quoted 11 lines · Kevin
Quoted 11 lines

From: Eric Farman <[email protected]>
Sent: Thursday, October 20, 2022 12:22 AM

drivers/s390/cio/vfio_ccw_ops.c +0 -0
@@ -101,15 +101,20 @@ static int vfio_ccw_mdev_probe(struct
 mdev_device *mdev)
  {
         struct subchannel *sch = to_subchannel(mdev->dev.parent);

        struct vfio_ccw_parent *parent = dev_get_drvdata(&sch-

Quoted 1 line

dev);

-       struct vfio_ccw_private *private = dev_get_drvdata(&parent-

Quoted 1 line

dev);

Quoted 8 lines
Quoted 5 lines

+       struct vfio_ccw_private *private;
        int ret;

-       if (private->state == VFIO_CCW_STATE_NOT_OPER) -               return -ENODEV;

Not familiar with ccw but just want to double confirm this removal is intentional w/o side-effect?

Right, it's intentional and fine. The concern previously was re-probing the mdev when a device had gone into a non-recoverable state and the private data was left hanging around. With the private now being cleaned up in mdev_remove instead of the subchannel side, that's no longer an issue.

Quoted 22 lines
Quoted 22 lines

+       private = vfio_ccw_alloc_private(sch);
+       if (!private)
+               return -ENOMEM;

        ret = vfio_init_device(&private->vdev, &mdev->dev, &vfio_ccw_dev_ops);
-       if (ret)
+       if (ret) {
+               kfree(private);
                return ret;
+       }
+
+       dev_set_drvdata(&parent->dev, private);

        VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n", sch->schid.cssid,

(quoted diff) +0 -0
@@ -123,6 +128,7 @@ static int vfio_ccw_mdev_probe(struct

mdev_device
*mdev)
        return 0;

Quoted 4 lines
Quoted 2 lines

 err_put_vdev:
+       dev_set_drvdata(&parent->dev, NULL);

No need to set drvdata to NULL, iiuc

Fair.

author maintainer
#13 lore raw

PATCH 5/7 vfio/ccw: remove release completion

In reply to Eric Farman

There's enough separation between the parent and private structs now, that it is fine to remove the release completion hack.

---
 drivers/s390/cio/vfio_ccw_ops.c     | 14 +-------------
 drivers/s390/cio/vfio_ccw_private.h |  3 ---
 2 files changed, 1 insertion(+), 16 deletions(-)
drivers/s390/cio/vfio_ccw_ops.c +1 -13
index 3e627b236241..261cb8150abb 100644
@@ -55,7 +55,6 @@ static int vfio_ccw_mdev_init_dev(struct vfio_device *vdev)
 	INIT_LIST_HEAD(&private->crw);
 	INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
 	INIT_WORK(&private->crw_work, vfio_ccw_crw_todo);
-	init_completion(&private->release_comp);
 
 	private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
 				       GFP_KERNEL);
@@ -138,7 +137,7 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
 	struct vfio_ccw_private *private =
 		container_of(vdev, struct vfio_ccw_private, vdev);
 
-	complete(&private->release_comp);
+	vfio_ccw_free_private(private);
 }
 
 static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
@@ -156,17 +155,6 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 
 	dev_set_drvdata(&parent->dev, NULL);
 	vfio_put_device(&private->vdev);
-	/*
-	 * Wait for all active references on mdev are released so it
-	 * is safe to defer kfree() to a later point.
-	 *
-	 * TODO: the clean fix is to split parent/mdev info from ccw
-	 * private structure so each can be managed in its own life
-	 * cycle.
-	 */
-	wait_for_completion(&private->release_comp);
-
-	vfio_ccw_free_private(private);
 }
 
 static int vfio_ccw_mdev_open_device(struct vfio_device *vdev)
drivers/s390/cio/vfio_ccw_private.h +0 -3
index c1959b8bfe86..ddaf6846022d 100644
@@ -87,7 +87,6 @@ struct vfio_ccw_crw {
  * @req_trigger: eventfd ctx for signaling userspace to return device
  * @io_work: work for deferral process of I/O handling
  * @crw_work: work for deferral process of CRW handling
- * @release_comp: synchronization helper for vfio device release
  */
 struct vfio_ccw_private {
 	struct vfio_device vdev;
@@ -111,8 +110,6 @@ struct vfio_ccw_private {
 	struct eventfd_ctx	*req_trigger;
 	struct work_struct	io_work;
 	struct work_struct	crw_work;
-
-	struct completion	release_comp;
 } __aligned(8);
 
 int vfio_ccw_sch_quiesce(struct subchannel *sch);
Signature · 1 line
2.34.1
author maintainer
#15 lore raw

PATCH 6/7 vfio/ccw: replace vfio_init_device with _alloc_

In reply to Eric Farman

Now that we have a reasonable separation of structs that follow the subchannel and mdev lifecycles, there's no reason we can't call the official vfio_alloc_device routine for our private data, and behave like everyone else.

---
 drivers/s390/cio/vfio_ccw_drv.c     | 29 -----------------------------
 drivers/s390/cio/vfio_ccw_ops.c     | 28 ++++++++++++++++++----------
 drivers/s390/cio/vfio_ccw_private.h |  3 ---
 drivers/vfio/vfio_main.c            |  3 ---
 4 files changed, 18 insertions(+), 45 deletions(-)
drivers/s390/cio/vfio_ccw_drv.c +0 -29
index 686a9b9f6731..9bbf41315aca 100644
@@ -146,35 +146,6 @@ static void vfio_ccw_sch_irq(struct subchannel *sch)
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT);
 }
 
-struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
-{
-	struct vfio_ccw_private *private;
-
-	private = kzalloc(sizeof(*private), GFP_KERNEL);
-	if (!private)
-		return ERR_PTR(-ENOMEM);
-
-	return private;
-}
-
-void vfio_ccw_free_private(struct vfio_ccw_private *private)
-{
-	struct vfio_ccw_crw *crw, *temp;
-
-	list_for_each_entry_safe(crw, temp, &private->crw, next) {
-		list_del(&crw->next);
-		kfree(crw);
-	}
-
-	kmem_cache_free(vfio_ccw_crw_region, private->crw_region);
-	kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
-	kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
-	kmem_cache_free(vfio_ccw_io_region, private->io_region);
-	kfree(private->cp.guest_cp);
-	mutex_destroy(&private->io_mutex);
-	kfree(private);
-}
-
 static void vfio_ccw_free_parent(struct device *dev)
 {
 	struct vfio_ccw_parent *parent = container_of(dev, struct vfio_ccw_parent, dev);
drivers/s390/cio/vfio_ccw_ops.c +18 -10
index 261cb8150abb..9619dc35080f 100644
@@ -103,15 +103,10 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 	struct vfio_ccw_private *private;
 	int ret;
 
-	private = vfio_ccw_alloc_private(sch);
-	if (!private)
-		return -ENOMEM;
-
-	ret = vfio_init_device(&private->vdev, &mdev->dev, &vfio_ccw_dev_ops);
-	if (ret) {
-		kfree(private);
-		return ret;
-	}
+	private = vfio_alloc_device(vfio_ccw_private, vdev, &mdev->dev,
+				    &vfio_ccw_dev_ops);
+	if (IS_ERR(private))
+		return PTR_ERR(private);
 
 	dev_set_drvdata(&parent->dev, private);
 
@@ -136,8 +131,21 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
 {
 	struct vfio_ccw_private *private =
 		container_of(vdev, struct vfio_ccw_private, vdev);
+	struct vfio_ccw_crw *crw, *temp;
+
+	list_for_each_entry_safe(crw, temp, &private->crw, next) {
+		list_del(&crw->next);
+		kfree(crw);
+	}
+
+	kmem_cache_free(vfio_ccw_crw_region, private->crw_region);
+	kmem_cache_free(vfio_ccw_schib_region, private->schib_region);
+	kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
+	kmem_cache_free(vfio_ccw_io_region, private->io_region);
+	kfree(private->cp.guest_cp);
+	mutex_destroy(&private->io_mutex);
 
-	vfio_ccw_free_private(private);
+	vfio_free_device(vdev);
 }
 
 static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
drivers/s390/cio/vfio_ccw_private.h +0 -3
index ddaf6846022d..2ca408881659 100644
@@ -116,9 +116,6 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch);
 void vfio_ccw_sch_io_todo(struct work_struct *work);
 void vfio_ccw_crw_todo(struct work_struct *work);
 
-struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch);
-void vfio_ccw_free_private(struct vfio_ccw_private *private);
-
 extern struct mdev_driver vfio_ccw_mdev_driver;
 
 /*
drivers/vfio/vfio_main.c +0 -3
index 2d168793d4e1..28f36c6d9d3f 100644
@@ -386,8 +386,6 @@ EXPORT_SYMBOL_GPL(_vfio_alloc_device);
 
 /*
  * Initialize a vfio_device so it can be registered to vfio core.
- *
- * Only vfio-ccw driver should call this interface.
  */
 int vfio_init_device(struct vfio_device *device, struct device *dev,
 		     const struct vfio_device_ops *ops)
@@ -422,7 +420,6 @@ int vfio_init_device(struct vfio_device *device, struct device *dev,
 	ida_free(&vfio.device_ida, device->index);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(vfio_init_device);
 
 /*
  * The helper called by driver @release callback to free the device
Signature · 1 line
2.34.1
#16 lore raw

Re: [PATCH v1 6/7] vfio/ccw: replace vfio_init_device with _alloc_

drivers/vfio/vfio_main.c int vfio_init_device(struct vfio_device *device, struct device *dev, · line 425

Quoted 12 lines · Eric Farman

/*
* Initialize a vfio_device so it can be registered to vfio core.
- *
- * Only vfio-ccw driver should call this interface.
*/
int vfio_init_device(struct vfio_device *device, struct device *dev,

drivers/vfio/vfio_main.c +0 -1
 		     const struct vfio_device_ops *ops)
@@ -422,7 +420,6 @@ int vfio_init_device(struct vfio_device *device, struct device *dev,
 	ida_free(&vfio.device_ida, device->index);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(vfio_init_device);

Should be made static as well

Jason

author maintainer
#17 lore raw

Re: [PATCH v1 6/7] vfio/ccw: replace vfio_init_device with _alloc_

Quoted 18 lines · Jason Gunthorpe
Quoted 9 lines · Eric Farman

 /*
  * Initialize a vfio_device so it can be registered to vfio core.
- *
- * Only vfio-ccw driver should call this interface.
  */
 int vfio_init_device(struct vfio_device *device, struct device *dev,
                     const struct vfio_device_ops *ops)

drivers/vfio/vfio_main.c int vfio_init_device(struct vfio_device · line 426

Quoted 5 lines
drivers/vfio/vfio_main.c +0 -1
@@ -422,7 +420,6 @@ int vfio_init_device(struct vfio_device
 *device, struct device *dev,
         ida_free(&vfio.device_ida, device->index);
         return ret;
  }
-EXPORT_SYMBOL_GPL(vfio_init_device);

Should be made static as well

Agreed. Only reason I didn't was there's a prototype in include/linux/vfio.h to satisfy the call to vfio_init_device from _vfio_alloc_device, and I didn't want to get into moving things around if I didn't need to. I can do that on top, if you'd like.

Eric

#18 lore raw

Re: [PATCH v1 6/7] vfio/ccw: replace vfio_init_device with _alloc_

Quoted 20 lines · Eric Farman
Quoted 18 lines · Jason Gunthorpe
Quoted 9 lines · Eric Farman

 /*
  * Initialize a vfio_device so it can be registered to vfio core.
- *
- * Only vfio-ccw driver should call this interface.
  */
 int vfio_init_device(struct vfio_device *device, struct device *dev,
                     const struct vfio_device_ops *ops)

drivers/vfio/vfio_main.c int vfio_init_device(struct vfio_device · line 426

Quoted 5 lines
drivers/vfio/vfio_main.c +0 -1
@@ -422,7 +420,6 @@ int vfio_init_device(struct vfio_device
 *device, struct device *dev,
         ida_free(&vfio.device_ida, device->index);
         return ret;
  }
-EXPORT_SYMBOL_GPL(vfio_init_device);

Should be made static as well

Quoted 4 lines

Agreed. Only reason I didn't was there's a prototype in include/linux/vfio.h to satisfy the call to vfio_init_device from _vfio_alloc_device, and I didn't want to get into moving things around if I didn't need to. I can do that on top, if you'd like.

You can just add a one line forward static declaration at the top of the file in this patch.

Jason

Reviewed-by on v1 6/7
#19 lore raw

RE: [PATCH v1 6/7] vfio/ccw: replace vfio_init_device with _alloc_

In reply to Eric Farman
Quoted 9 lines

From: Eric Farman
Sent: Thursday, October 20, 2022 12:22 AM

Now that we have a reasonable separation of structs that follow the subchannel and mdev lifecycles, there's no reason we can't call the official vfio_alloc_device routine for our private data, and behave like everyone else.

This looks good to me. With Jason's suggestion handled,

author maintainer
#20 lore raw

PATCH 7/7 vfio: Remove vfio_free_device

In reply to Eric Farman

With the "mess" sorted out, we should be able to inline the vfio_free_device call introduced by commit cb9ff3f3b84c ("vfio: Add helpers for unifying vfio_device life cycle") and remove them from driver release callbacks.

---
 drivers/gpu/drm/i915/gvt/kvmgt.c      |  1 -
 drivers/s390/cio/vfio_ccw_ops.c       |  2 --
 drivers/s390/crypto/vfio_ap_ops.c     |  6 ------
 drivers/vfio/fsl-mc/vfio_fsl_mc.c     |  1 -
 drivers/vfio/pci/vfio_pci_core.c      |  1 -
 drivers/vfio/platform/vfio_amba.c     |  1 -
 drivers/vfio/platform/vfio_platform.c |  1 -
 drivers/vfio/vfio_main.c              | 22 ++++------------------
 include/linux/vfio.h                  |  1 -
 samples/vfio-mdev/mbochs.c            |  1 -
 samples/vfio-mdev/mdpy.c              |  1 -
 samples/vfio-mdev/mtty.c              |  1 -
 12 files changed, 4 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -1
index 7a45e5360caf..eee6805e67de 100644
@@ -1461,7 +1461,6 @@ static void intel_vgpu_release_dev(struct vfio_device *vfio_dev)
 	struct intel_vgpu *vgpu = vfio_dev_to_vgpu(vfio_dev);
 
 	intel_gvt_destroy_vgpu(vgpu);
-	vfio_free_device(vfio_dev);
 }
 
 static const struct vfio_device_ops intel_vgpu_dev_ops = {
drivers/s390/cio/vfio_ccw_ops.c +0 -2
index 9619dc35080f..cfb2e5c8e717 100644
@@ -144,8 +144,6 @@ static void vfio_ccw_mdev_release_dev(struct vfio_device *vdev)
 	kmem_cache_free(vfio_ccw_io_region, private->io_region);
 	kfree(private->cp.guest_cp);
 	mutex_destroy(&private->io_mutex);
-
-	vfio_free_device(vdev);
 }
 
 static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
drivers/s390/crypto/vfio_ap_ops.c +0 -6
index 0b4cc8c597ae..f108c0f14712 100644
@@ -765,11 +765,6 @@ static void vfio_ap_mdev_unlink_fr_queues(struct ap_matrix_mdev *matrix_mdev)
 	}
 }
 
-static void vfio_ap_mdev_release_dev(struct vfio_device *vdev)
-{
-	vfio_free_device(vdev);
-}
-
 static void vfio_ap_mdev_remove(struct mdev_device *mdev)
 {
 	struct ap_matrix_mdev *matrix_mdev = dev_get_drvdata(&mdev->dev);
@@ -1784,7 +1779,6 @@ static const struct attribute_group vfio_queue_attr_group = {
 
 static const struct vfio_device_ops vfio_ap_matrix_dev_ops = {
 	.init = vfio_ap_mdev_init_dev,
-	.release = vfio_ap_mdev_release_dev,
 	.open_device = vfio_ap_mdev_open_device,
 	.close_device = vfio_ap_mdev_close_device,
 	.ioctl = vfio_ap_mdev_ioctl,
drivers/vfio/fsl-mc/vfio_fsl_mc.c +0 -1
index b16874e913e4..7b8889f55007 100644
@@ -568,7 +568,6 @@ static void vfio_fsl_mc_release_dev(struct vfio_device *core_vdev)
 
 	vfio_fsl_uninit_device(vdev);
 	mutex_destroy(&vdev->igate);
-	vfio_free_device(core_vdev);
 }
 
 static int vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev)
drivers/vfio/pci/vfio_pci_core.c +0 -1
index badc9d828cac..9be2d5be5d95 100644
@@ -2109,7 +2109,6 @@ void vfio_pci_core_release_dev(struct vfio_device *core_vdev)
 	mutex_destroy(&vdev->vma_lock);
 	kfree(vdev->region);
 	kfree(vdev->pm_save);
-	vfio_free_device(core_vdev);
 }
 EXPORT_SYMBOL_GPL(vfio_pci_core_release_dev);
 
drivers/vfio/platform/vfio_amba.c +0 -1
index eaea63e5294c..18faf2678b99 100644
@@ -95,7 +95,6 @@ static void vfio_amba_release_dev(struct vfio_device *core_vdev)
 
 	vfio_platform_release_common(vdev);
 	kfree(vdev->name);
-	vfio_free_device(core_vdev);
 }
 
 static void vfio_amba_remove(struct amba_device *adev)
drivers/vfio/platform/vfio_platform.c +0 -1
index 82cedcebfd90..9910451dc341 100644
@@ -83,7 +83,6 @@ static void vfio_platform_release_dev(struct vfio_device *core_vdev)
 		container_of(core_vdev, struct vfio_platform_device, vdev);
 
 	vfio_platform_release_common(vdev);
-	vfio_free_device(core_vdev);
 }
 
 static int vfio_platform_remove(struct platform_device *pdev)
drivers/vfio/vfio_main.c +4 -18
index 28f36c6d9d3f..8a1d83cbb05a 100644
@@ -339,13 +339,10 @@ static void vfio_device_release(struct device *dev)
 	vfio_release_device_set(device);
 	ida_free(&vfio.device_ida, device->index);
 
-	/*
-	 * kvfree() cannot be done here due to a life cycle mess in
-	 * vfio-ccw. Before the ccw part is fixed all drivers are
-	 * required to support @release and call vfio_free_device()
-	 * from there.
-	 */
-	device->ops->release(device);
+	if (device->ops->release)
+		device->ops->release(device);
+
+	kvfree(device);
 }
 
 /*
@@ -421,17 +418,6 @@ int vfio_init_device(struct vfio_device *device, struct device *dev,
 	return ret;
 }
 
-/*
- * The helper called by driver @release callback to free the device
- * structure. Drivers which don't have private data to clean can
- * simply use this helper as its @release.
- */
-void vfio_free_device(struct vfio_device *device)
-{
-	kvfree(device);
-}
-EXPORT_SYMBOL_GPL(vfio_free_device);
-
 static struct vfio_group *vfio_noiommu_group_alloc(struct device *dev,
 		enum vfio_group_type type)
 {
include/linux/vfio.h +0 -1
index e7cebeb875dd..47d33d5af467 100644
@@ -178,7 +178,6 @@ struct vfio_device *_vfio_alloc_device(size_t size, struct device *dev,
 
 int vfio_init_device(struct vfio_device *device, struct device *dev,
 		     const struct vfio_device_ops *ops);
-void vfio_free_device(struct vfio_device *device);
 static inline void vfio_put_device(struct vfio_device *device)
 {
 	put_device(&device->device);
samples/vfio-mdev/mbochs.c +0 -1
index 117a8d799f71..8b5a3a778a25 100644
@@ -594,7 +594,6 @@ static void mbochs_release_dev(struct vfio_device *vdev)
 	atomic_add(mdev_state->type->mbytes, &mbochs_avail_mbytes);
 	kfree(mdev_state->pages);
 	kfree(mdev_state->vconfig);
-	vfio_free_device(vdev);
 }
 
 static void mbochs_remove(struct mdev_device *mdev)
samples/vfio-mdev/mdpy.c +0 -1
index 946e8cfde6fd..721fb06c6413 100644
@@ -283,7 +283,6 @@ static void mdpy_release_dev(struct vfio_device *vdev)
 
 	vfree(mdev_state->memblk);
 	kfree(mdev_state->vconfig);
-	vfio_free_device(vdev);
 }
 
 static void mdpy_remove(struct mdev_device *mdev)
samples/vfio-mdev/mtty.c +0 -1
index e72085fc1376..3c2a421b9b69 100644
@@ -784,7 +784,6 @@ static void mtty_release_dev(struct vfio_device *vdev)
 
 	atomic_add(mdev_state->nr_ports, &mdev_avail_ports);
 	kfree(mdev_state->vconfig);
-	vfio_free_device(vdev);
 }
 
 static void mtty_remove(struct mdev_device *mdev)
Signature · 1 line
2.34.1
Reviewed-by on v1 7/7
#21 lore raw

Re: [PATCH v1 7/7] vfio: Remove vfio_free_device

Quoted 6 lines · Eric Farman

With the "mess" sorted out, we should be able to inline the vfio_free_device call introduced by commit cb9ff3f3b84c ("vfio: Add helpers for unifying vfio_device life cycle") and remove them from driver release callbacks.

Jason

Reviewed-by on v1 7/7
#22 lore raw

RE: [PATCH v1 7/7] vfio: Remove vfio_free_device

In reply to Eric Farman
Quoted 9 lines

From: Eric Farman <[email protected]>
Sent: Thursday, October 20, 2022 12:22 AM

With the "mess" sorted out, we should be able to inline the vfio_free_device call introduced by commit cb9ff3f3b84c ("vfio: Add helpers for unifying vfio_device life cycle") and remove them from driver release callbacks.

#23 lore raw
In reply to Eric Farman
Quoted 5 lines · Eric Farman

This series attempts to address the oddities/shortcomings of vfio-ccw, such that vfio-ccw can use the same helpers as everyone else, and the tricks that were implemented by the other drivers can be removed. It is built on 6.1-rc1, and thus includes the various changes [3][4] that have occurred in and around these parts.

It looks good to me if you are happy with the ccw part

Thanks,
Jason

#24 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for vfio-ccw parent rework

In reply to Eric Farman
== Series Details ==

== Series Details ==

Series: vfio-ccw parent rework
URL : https://patchwork.freedesktop.org/series/109899/
State : warning

== Summary ==

Error: dim checkpatch failed
730a07d272cf vfio/ccw: create a parent struct
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:59: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #59: FILE: drivers/s390/cio/vfio_ccw_drv.c:65:
+ wait_for_completion_timeout(&completion, 3*HZ);
^

-:87: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #87: FILE: drivers/s390/cio/vfio_ccw_drv.c:139:
+ VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: unexpected interrupt\n",
+ sch->schid.cssid, sch->schid.ssid, sch->schid.sch_no);

-:259: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #259:
new file mode 100644

total: 0 errors, 1 warnings, 2 checks, 265 lines checked f951372969d9 vfio/ccw: remove private->sch c4a9ed65c50e vfio/ccw: move private initialization to callback bc05fc00f2e5 vfio/ccw: move private to mdev lifecycle 94391c96f5d0 vfio/ccw: remove release completion 1a529004cdac vfio/ccw: replace vfio_init_device with _alloc_ d144255a82db vfio: Remove vfio_free_device

#25 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for vfio-ccw parent rework

In reply to Eric Farman
== Series Details ==

== Series Details ==

Series: vfio-ccw parent rework
URL : https://patchwork.freedesktop.org/series/109899/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12261 -> Patchwork_109899v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_109899v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_109899v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/index.html

Participating hosts (42 -> 42)
------------------------------

Additional (2): fi-rkl-11600 fi-icl-u2
Missing (2): fi-kbl-soraka fi-cml-u2

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_109899v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@migrate:
- bat-adlp-4: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-adlp-4/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-adlp-4/igt@i915_selftest@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@gem_contexts:
- {bat-adln-1}: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-adln-1/igt@i915_selftest@live@gem_contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-adln-1/igt@i915_selftest@live@gem_contexts.html

Known issues
------------

Here are the changes found in Patchwork_109899v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_huc_copy@huc-copy:
- fi-icl-u2: NOTRUN -> [SKIP][5] ([i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][6] ([i915#2190])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-rkl-11600: NOTRUN -> [SKIP][7] ([i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@gem_lmem_swapping@random-engines:
- fi-icl-u2: NOTRUN -> [SKIP][8] ([i915#4613]) +3 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]

* igt@gem_tiled_pread_basic:
- fi-rkl-11600: NOTRUN -> [SKIP][9] ([i915#3282])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@gem_tiled_pread_basic.html

* igt@i915_pm_backlight@basic-brightness:
- fi-rkl-11600: NOTRUN -> [SKIP][10] ([i915#3012])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- fi-rkl-11600: NOTRUN -> [INCOMPLETE][11] ([i915#5982])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-ivb-3770: NOTRUN -> [SKIP][12] ([fdo#109271] / [fdo#111827])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-ivb-3770/igt@[email protected]
- fi-bdw-5557u: NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-bdw-5557u/igt@[email protected]

* igt@kms_chamelium@hdmi-edid-read:
- fi-rkl-11600: NOTRUN -> [SKIP][14] ([fdo#111827]) +7 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: NOTRUN -> [SKIP][15] ([fdo#111827]) +8 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- fi-rkl-11600: NOTRUN -> [SKIP][16] ([i915#4103])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][17] ([i915#4103])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-rkl-11600: NOTRUN -> [SKIP][18] ([fdo#109285] / [i915#4098])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][19] ([fdo#109285])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-rkl-11600: NOTRUN -> [SKIP][20] ([i915#1072]) +3 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@kms_psr@primary_page_flip.html

* igt@kms_setmode@basic-clone-single-crtc:
- fi-rkl-11600: NOTRUN -> [SKIP][21] ([i915#3555] / [i915#4098])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][22] ([i915#3555])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]

* igt@prime_vgem@basic-read:
- fi-rkl-11600: NOTRUN -> [SKIP][23] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- fi-icl-u2: NOTRUN -> [SKIP][24] ([fdo#109295] / [i915#3301])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-icl-u2/igt@[email protected]
- fi-rkl-11600: NOTRUN -> [SKIP][25] ([fdo#109295] / [i915#3301] / [i915#3708])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-rkl-11600/igt@[email protected]

* igt@runner@aborted:
- bat-adlp-4: NOTRUN -> [FAIL][26] ([i915#4312])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-adlp-4/igt@[email protected]

#### Possible fixes ####

* igt@fbdev@read:
- {bat-rpls-2}: [SKIP][27] ([i915#2582]) -> [PASS][28] +4 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-rpls-2/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-rpls-2/igt@[email protected]

* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [SKIP][29] ([fdo#109271]) -> [PASS][30] +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-pnv-d510/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-pnv-d510/igt@[email protected]

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-adlm-1}: [DMESG-WARN][31] ([i915#2867]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-adlm-1/igt@gem_exec_suspend@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-adlm-1/igt@gem_exec_suspend@[email protected]

* igt@gem_huc_copy@huc-copy:
- {bat-dg2-8}: [FAIL][33] ([i915#7029]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-dg2-8/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-dg2-8/igt@[email protected]

* igt@i915_pm_rpm@basic-rte:
- {bat-rplp-1}: [DMESG-WARN][35] -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-rplp-1/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-rplp-1/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- {bat-rpls-2}: [DMESG-WARN][37] ([i915#5537]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-rpls-2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-rpls-2/igt@[email protected]

* igt@i915_selftest@live@gem_contexts:
- fi-glk-j4005: [DMESG-FAIL][39] ([i915#7270]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-glk-j4005/igt@i915_selftest@live@gem_contexts.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-glk-j4005/igt@i915_selftest@live@gem_contexts.html
- fi-skl-guc: [DMESG-FAIL][41] ([i915#7270]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-skl-guc/igt@i915_selftest@live@gem_contexts.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-skl-guc/igt@i915_selftest@live@gem_contexts.html
- {fi-jsl-1}: [DMESG-FAIL][43] ([i915#7270]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-jsl-1/igt@i915_selftest@live@gem_contexts.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-jsl-1/igt@i915_selftest@live@gem_contexts.html

* igt@i915_selftest@live@gt_heartbeat:
- {bat-jsl-1}: [DMESG-FAIL][45] -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-jsl-1/igt@i915_selftest@live@gt_heartbeat.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-jsl-1/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@hangcheck:
- fi-ivb-3770: [INCOMPLETE][47] ([i915#3303] / [i915#7122]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-ivb-3770/igt@i915_selftest@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-ivb-3770/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@hugepages:
- {bat-rpls-1}: [DMESG-WARN][49] ([i915#5278]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/bat-rpls-1/igt@i915_selftest@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- fi-bdw-5557u: [INCOMPLETE][51] ([i915#146] / [i915#6712]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12261/fi-bdw-5557u/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/fi-bdw-5557u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5278]: https://gitlab.freedesktop.org/drm/intel/issues/5278
[i915#5537]: https://gitlab.freedesktop.org/drm/intel/issues/5537
[i915#5828]: https://gitlab.freedesktop.org/drm/intel/issues/5828
[i915#5982]: https://gitlab.freedesktop.org/drm/intel/issues/5982
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#6712]: https://gitlab.freedesktop.org/drm/intel/issues/6712
[i915#7029]: https://gitlab.freedesktop.org/drm/intel/issues/7029
[i915#7122]: https://gitlab.freedesktop.org/drm/intel/issues/7122
[i915#7269]: https://gitlab.freedesktop.org/drm/intel/issues/7269
[i915#7270]: https://gitlab.freedesktop.org/drm/intel/issues/7270

Build changes
-------------

* Linux: CI_DRM_12261 -> Patchwork_109899v1

CI-20190529: 20190529
CI_DRM_12261: 41447224fdfbfbfd1e9ffa5fabc9d277f9c02f8a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7019: fdbafce2b74e84739bb1d81223ae6f01fb442980 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_109899v1: 41447224fdfbfbfd1e9ffa5fabc9d277f9c02f8a @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

50f2975053e9 vfio: Remove vfio_free_device f66d2962aa12 vfio/ccw: replace vfio_init_device with _alloc_ f820a9b31786 vfio/ccw: remove release completion 092bc3eb5683 vfio/ccw: move private to mdev lifecycle 7b08a25e80e2 vfio/ccw: move private initialization to callback bf41b7448e9f vfio/ccw: remove private->sch e9135f0c6cd4 vfio/ccw: create a parent struct

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109899v1/index.html