summaryrefslogtreecommitdiff
path: root/drivers/s390/cio/vfio_ccw_cp.h
diff options
context:
space:
mode:
authorEric Farman <farman@linux.ibm.com>2019-06-18 23:23:48 +0300
committerCornelia Huck <cohuck@redhat.com>2019-06-21 15:12:19 +0300
commit1d897e478da3db91593d86227854802102e2fcd3 (patch)
treefca71d80651b7f6a957737e09b1ed6649d248d18 /drivers/s390/cio/vfio_ccw_cp.h
parent01aa26c672c0eb771de4aaa2a8ccf6055778887b (diff)
downloadlinux-1d897e478da3db91593d86227854802102e2fcd3.tar.xz
vfio-ccw: Move guest_cp storage into common struct
Rather than allocating/freeing a piece of memory every time we try to figure out how long a CCW chain is, let's use a piece of memory allocated for each device. The io_mutex added with commit 4f76617378ee9 ("vfio-ccw: protect the I/O region") is held for the duration of the VFIO_CCW_EVENT_IO_REQ event that accesses/uses this space, so there should be no race concerns with another CPU attempting an (unexpected) SSCH for the same device. Suggested-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Eric Farman <farman@linux.ibm.com> Message-Id: <20190618202352.39702-2-farman@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'drivers/s390/cio/vfio_ccw_cp.h')
-rw-r--r--drivers/s390/cio/vfio_ccw_cp.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/s390/cio/vfio_ccw_cp.h b/drivers/s390/cio/vfio_ccw_cp.h
index 3c20cd208da5..7cdc38049033 100644
--- a/drivers/s390/cio/vfio_ccw_cp.h
+++ b/drivers/s390/cio/vfio_ccw_cp.h
@@ -16,6 +16,12 @@
#include "orb.h"
+/*
+ * Max length for ccw chain.
+ * XXX: Limit to 256, need to check more?
+ */
+#define CCWCHAIN_LEN_MAX 256
+
/**
* struct channel_program - manage information for channel program
* @ccwchain_list: list head of ccwchains
@@ -32,6 +38,7 @@ struct channel_program {
union orb orb;
struct device *mdev;
bool initialized;
+ struct ccw1 *guest_cp;
};
extern int cp_init(struct channel_program *cp, struct device *mdev,