vfio-ccw: Move guest_cp storage into common struct
authorEric Farman <farman@linux.ibm.com>
Tue, 18 Jun 2019 20:23:48 +0000 (22:23 +0200)
committerCornelia Huck <cohuck@redhat.com>
Fri, 21 Jun 2019 12:12:19 +0000 (14:12 +0200)
commit1d897e478da3db91593d86227854802102e2fcd3
treefca71d80651b7f6a957737e09b1ed6649d248d18
parent01aa26c672c0eb771de4aaa2a8ccf6055778887b
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>
drivers/s390/cio/vfio_ccw_cp.c
drivers/s390/cio/vfio_ccw_cp.h
drivers/s390/cio/vfio_ccw_drv.c