public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: hch@lst.de
Cc: akrowiak@linux.ibm.com, alex.williamson@redhat.com,
	farman@linux.ibm.com, intel-gvt-dev@lists.freedesktop.org,
	jgg@nvidia.com, jjherne@linux.ibm.com, kvm@vger.kernel.org,
	kwankhede@nvidia.com, linux-s390@vger.kernel.org,
	mjrosato@linux.ibm.com, pasic@linux.ibm.com,
	vneethv@linux.ibm.com, zhenyuw@linux.intel.com,
	zhi.a.wang@intel.com
Subject: [RFC PATCH] vfio/ccw: Move mdev stuff out of struct subchannel
Date: Tue, 26 Jul 2022 17:37:25 +0200	[thread overview]
Message-ID: <20220726153725.2573294-1-farman@linux.ibm.com> (raw)
In-Reply-To: <20220720050629.GA6076@lst.de>

Here's my swipe at a cleanup patch that can be folded in
to this series, to get the mdev stuff in a more proper
location for vfio-ccw.

As previously described, the subchannel is a device-agnostic
structure that does/should not need to know about specific
nuances such as mediated devices. This is why things like
struct vfio_ccw_private exist, so move these details there.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 drivers/s390/cio/cio.h              |  3 ---
 drivers/s390/cio/vfio_ccw_drv.c     | 13 +++++++------
 drivers/s390/cio/vfio_ccw_private.h |  4 ++++
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h
index 1da45307a186..2ad8833653e9 100644
--- a/drivers/s390/cio/cio.h
+++ b/drivers/s390/cio/cio.h
@@ -109,9 +109,6 @@ struct subchannel {
 	 * frees it.  Use driver_set_override() to set or clear it.
 	 */
 	const char *driver_override;
-	struct mdev_parent parent;
-	struct mdev_type mdev_type;
-	struct mdev_type *mdev_types[1];
 } __attribute__ ((aligned(8)));
 
 DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb);
diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
index 6605b4239f88..bdf76805d175 100644
--- a/drivers/s390/cio/vfio_ccw_drv.c
+++ b/drivers/s390/cio/vfio_ccw_drv.c
@@ -142,6 +142,10 @@ static struct vfio_ccw_private *vfio_ccw_alloc_private(struct subchannel *sch)
 	INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
 	INIT_WORK(&private->crw_work, vfio_ccw_crw_todo);
 
+	private->mdev_type.sysfs_name = "io";
+	private->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)";
+	private->mdev_types[0] = &private->mdev_type;
+
 	private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
 				       GFP_KERNEL);
 	if (!private->cp.guest_cp)
@@ -219,12 +223,9 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
 
 	dev_set_drvdata(&sch->dev, private);
 
-	sch->mdev_type.sysfs_name = "io";
-	sch->mdev_type.pretty_name = "I/O subchannel (Non-QDIO)";
-	sch->mdev_types[0] = &sch->mdev_type;
-	ret = mdev_register_parent(&sch->parent, &sch->dev,
+	ret = mdev_register_parent(&private->parent, &sch->dev,
 				   &vfio_ccw_mdev_driver,
-				   sch->mdev_types, 1);
+				   private->mdev_types, 1);
 	if (ret)
 		goto out_free;
 
@@ -244,7 +245,7 @@ static void vfio_ccw_sch_remove(struct subchannel *sch)
 	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
 
 	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE);
-	mdev_unregister_parent(&sch->parent);
+	mdev_unregister_parent(&private->parent);
 
 	dev_set_drvdata(&sch->dev, NULL);
 
diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h
index 4aa806530974..358996897efc 100644
--- a/drivers/s390/cio/vfio_ccw_private.h
+++ b/drivers/s390/cio/vfio_ccw_private.h
@@ -111,6 +111,10 @@ struct vfio_ccw_private {
 	struct eventfd_ctx	*req_trigger;
 	struct work_struct	io_work;
 	struct work_struct	crw_work;
+
+	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);
-- 
2.31.1


  reply	other threads:[~2022-07-26 15:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  4:54 simplify the mdev interface v6 Christoph Hellwig
2022-07-09  4:54 ` [PATCH 01/14] drm/i915/gvt: fix a memory leak in intel_gvt_init_vgpu_types Christoph Hellwig
2022-07-09  4:54 ` [PATCH 02/14] drm/i915/gvt: simplify vgpu configuration management Christoph Hellwig
2022-07-09  4:54 ` [PATCH 03/14] vfio/mdev: make mdev.h standalone includable Christoph Hellwig
2022-07-19 17:03   ` Jason J. Herne
2022-07-09  4:54 ` [PATCH 04/14] vfio/mdev: embedd struct mdev_parent in the parent data structure Christoph Hellwig
2022-07-09  4:54 ` [PATCH 05/14] vfio/mdev: simplify mdev_type handling Christoph Hellwig
2022-07-20 20:47   ` Eric Farman
2022-07-09  4:54 ` [PATCH 06/14] vfio/mdev: remove mdev_from_dev Christoph Hellwig
2022-07-09  4:54 ` [PATCH 07/14] vfio/mdev: unexport mdev_bus_type Christoph Hellwig
2022-07-09  4:54 ` [PATCH 08/14] vfio/mdev: remove mdev_parent_dev Christoph Hellwig
2022-07-09  4:54 ` [PATCH 09/14] vfio/mdev: remove mtype_get_parent_dev Christoph Hellwig
2022-07-09  4:54 ` [PATCH 10/14] vfio/mdev: consolidate all the device_api sysfs into the core code Christoph Hellwig
2022-07-09  4:54 ` [PATCH 11/14] vfio/mdev: consolidate all the name " Christoph Hellwig
2022-07-09  4:54 ` [PATCH 12/14] vfio/mdev: consolidate all the available_instance " Christoph Hellwig
2022-07-09  4:54 ` [PATCH 13/14] vfio/mdev: consolidate all the description " Christoph Hellwig
2022-07-09  4:54 ` [PATCH 14/14] vfio/mdev: add mdev available instance checking to the core Christoph Hellwig
2022-07-19  2:00   ` Eric Farman
2022-07-19 14:48     ` Christoph Hellwig
2022-07-18  5:43 ` simplify the mdev interface v6 Christoph Hellwig
2022-07-18 21:33   ` Alex Williamson
2022-07-19  0:22     ` Zhenyu Wang
2022-07-19  2:01     ` Eric Farman
2022-07-19 14:49       ` Christoph Hellwig
2022-07-19 15:26         ` Alex Williamson
2022-07-19 17:49           ` Eric Farman
2022-07-20  2:41             ` Eric Farman
2022-07-20  5:06               ` Christoph Hellwig
2022-07-26 15:37                 ` Eric Farman [this message]
2022-07-26 17:48                   ` [RFC PATCH] vfio/ccw: Move mdev stuff out of struct subchannel Christoph Hellwig
2022-07-26 18:03                     ` Eric Farman
2022-08-18  6:53                   ` Tian, Kevin
2022-08-18 13:24                     ` Eric Farman
2022-08-27 10:08                       ` Tian, Kevin
2022-07-20 12:14               ` simplify the mdev interface v6 Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220726153725.2573294-1-farman@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=hch@lst.de \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=vneethv@linux.ibm.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox