diff mbox series

[v1,05/18] vfio/ccw: Remove private->mdev

Message ID 20220602171948.2790690-6-farman@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series VFIO ccw/mdev rework | expand

Commit Message

Eric Farman June 2, 2022, 5:19 p.m. UTC
The only remaining user of private->mdev gets the struct device in
order to copy channel program data. The same pointer is available
from private->vdev, which is managed by vfio_(un)init_group_dev().

It doesn't make sense to carry multiple pointers to the same thing,
and risk them getting out of sync. So convert that user, and then
private->mdev can be removed entirely.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 drivers/s390/cio/vfio_ccw_async.c   | 1 -
 drivers/s390/cio/vfio_ccw_fsm.c     | 4 +---
 drivers/s390/cio/vfio_ccw_ops.c     | 3 ---
 drivers/s390/cio/vfio_ccw_private.h | 2 --
 4 files changed, 1 insertion(+), 9 deletions(-)

Comments

Jason Gunthorpe June 2, 2022, 7:02 p.m. UTC | #1
On Thu, Jun 02, 2022 at 07:19:35PM +0200, Eric Farman wrote:
> @@ -262,7 +260,7 @@ static void fsm_io_request(struct vfio_ccw_private *private,
>  			errstr = "transport mode";
>  			goto err_out;
>  		}
> -		io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
> +		io_region->ret_code = cp_init(&private->cp, private->vdev.dev,
>  					      orb);

You'll need to rebase this series, I already did this hunk in v5.19:

commit 0a58795647cd4300470788ffdbff6b29b5f00632
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date:   Wed May 11 13:12:59 2022 -0600

    vfio/ccw: Remove mdev from struct channel_program

Jason
Eric Farman June 2, 2022, 7:13 p.m. UTC | #2
On Thu, 2022-06-02 at 16:02 -0300, Jason Gunthorpe wrote:
> On Thu, Jun 02, 2022 at 07:19:35PM +0200, Eric Farman wrote:
> > @@ -262,7 +260,7 @@ static void fsm_io_request(struct
> > vfio_ccw_private *private,
> >  			errstr = "transport mode";
> >  			goto err_out;
> >  		}
> > -		io_region->ret_code = cp_init(&private->cp,
> > mdev_dev(mdev),
> > +		io_region->ret_code = cp_init(&private->cp, private-
> > >vdev.dev,
> >  					      orb);
> 
> You'll need to rebase this series, I already did this hunk in v5.19:
> 
> commit 0a58795647cd4300470788ffdbff6b29b5f00632
> Author: Jason Gunthorpe <jgg@ziepe.ca>
> Date:   Wed May 11 13:12:59 2022 -0600
> 
>     vfio/ccw: Remove mdev from struct channel_program

Ah, yes. I hadn't gotten this sent out before the vfio pull request
landed yesterday, so a rebase is of course warranted. Thanks!

Eric

> 
> Jason
diff mbox series

Patch

diff --git a/drivers/s390/cio/vfio_ccw_async.c b/drivers/s390/cio/vfio_ccw_async.c
index 7a838e3d7c0f..420d89ba7f83 100644
--- a/drivers/s390/cio/vfio_ccw_async.c
+++ b/drivers/s390/cio/vfio_ccw_async.c
@@ -8,7 +8,6 @@ 
  */
 
 #include <linux/vfio.h>
-#include <linux/mdev.h>
 
 #include "vfio_ccw_private.h"
 
diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
index 86b23732d899..3e1d7744c292 100644
--- a/drivers/s390/cio/vfio_ccw_fsm.c
+++ b/drivers/s390/cio/vfio_ccw_fsm.c
@@ -10,7 +10,6 @@ 
  */
 
 #include <linux/vfio.h>
-#include <linux/mdev.h>
 
 #include "ioasm.h"
 #include "vfio_ccw_private.h"
@@ -242,7 +241,6 @@  static void fsm_io_request(struct vfio_ccw_private *private,
 	union orb *orb;
 	union scsw *scsw = &private->scsw;
 	struct ccw_io_region *io_region = private->io_region;
-	struct mdev_device *mdev = private->mdev;
 	char *errstr = "request";
 	struct subchannel_id schid = get_schid(private);
 
@@ -262,7 +260,7 @@  static void fsm_io_request(struct vfio_ccw_private *private,
 			errstr = "transport mode";
 			goto err_out;
 		}
-		io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
+		io_region->ret_code = cp_init(&private->cp, private->vdev.dev,
 					      orb);
 		if (io_region->ret_code) {
 			VFIO_CCW_MSG_EVENT(2,
diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index a0a3200b0b04..4a64c176facb 100644
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -128,7 +128,6 @@  static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 	vfio_init_group_dev(&private->vdev, &mdev->dev,
 			    &vfio_ccw_dev_ops);
 
-	private->mdev = mdev;
 	private->state = VFIO_CCW_STATE_IDLE;
 
 	VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
@@ -145,7 +144,6 @@  static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
 err_atomic:
 	vfio_uninit_group_dev(&private->vdev);
 	atomic_inc(&private->avail);
-	private->mdev = NULL;
 	private->state = VFIO_CCW_STATE_STANDBY;
 	return ret;
 }
@@ -171,7 +169,6 @@  static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 
 	vfio_uninit_group_dev(&private->vdev);
 	cp_free(&private->cp);
-	private->mdev = NULL;
 	atomic_inc(&private->avail);
 }
 
diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h
index 7272eb788612..12b5537d478f 100644
--- a/drivers/s390/cio/vfio_ccw_private.h
+++ b/drivers/s390/cio/vfio_ccw_private.h
@@ -73,7 +73,6 @@  struct vfio_ccw_crw {
  * @state: internal state of the device
  * @completion: synchronization helper of the I/O completion
  * @avail: available for creating a mediated device
- * @mdev: pointer to the mediated device
  * @nb: notifier for vfio events
  * @io_region: MMIO region to input/output I/O arguments/results
  * @io_mutex: protect against concurrent update of I/O regions
@@ -97,7 +96,6 @@  struct vfio_ccw_private {
 	int			state;
 	struct completion	*completion;
 	atomic_t		avail;
-	struct mdev_device	*mdev;
 	struct notifier_block	nb;
 	struct ccw_io_region	*io_region;
 	struct mutex		io_mutex;