vfio_ccw_private.h 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * Private stuff for vfio_ccw driver
 *
 * Copyright IBM Corp. 2017
 *
 * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
 *            Xiao Feng Ren <renxiaof@linux.vnet.ibm.com>
 */

#ifndef _VFIO_CCW_PRIVATE_H_
#define _VFIO_CCW_PRIVATE_H_

13
#include <linux/completion.h>
14
#include <linux/eventfd.h>
15 16
#include <linux/vfio_ccw.h>

17
#include "css.h"
18
#include "vfio_ccw_cp.h"
19 20 21 22 23

/**
 * struct vfio_ccw_private
 * @sch: pointer to the subchannel
 * @completion: synchronization helper of the I/O completion
24 25 26
 * @avail: available for creating a mediated device
 * @mdev: pointer to the mediated device
 * @nb: notifier for vfio events
27
 * @io_region: MMIO region to input/output I/O arguments/results
28 29 30 31 32
 * @wait_q: wait for interrupt
 * @intparm: record current interrupt parameter, used for wait interrupt
 * @cp: channel program for the current I/O operation
 * @irb: irb info received from interrupt
 * @scsw: scsw info
33
 * @io_trigger: eventfd ctx for signaling userspace I/O results
34 35 36 37
 */
struct vfio_ccw_private {
	struct subchannel	*sch;
	struct completion	*completion;
38 39 40
	atomic_t		avail;
	struct mdev_device	*mdev;
	struct notifier_block	nb;
41
	struct ccw_io_region	io_region;
42 43 44 45 46 47

	wait_queue_head_t	wait_q;
	u32			intparm;
	struct channel_program	cp;
	struct irb		irb;
	union scsw		scsw;
48 49

	struct eventfd_ctx	*io_trigger;
50 51
} __aligned(8);

52 53 54 55
extern int vfio_ccw_mdev_reg(struct subchannel *sch);
extern void vfio_ccw_mdev_unreg(struct subchannel *sch);

extern int vfio_ccw_sch_quiesce(struct subchannel *sch);
56
extern int vfio_ccw_sch_cmd_request(struct vfio_ccw_private *private);
57

58
#endif