Commit 62465902 authored by Eric Farman's avatar Eric Farman Committed by Cornelia Huck

vfio-ccw: Skip second copy of guest cp to host

We already pinned/copied/unpinned 2K (256 CCWs) of guest memory
to the host space anchored off vfio_ccw_private.  There's no need
to do that again once we have the length calculated, when we could
just copy the section we need to the "permanent" space for the I/O.
Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
Message-Id: <20190618202352.39702-3-farman@linux.ibm.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Reviewed-by: default avatarFarhan Ali <alifm@linux.ibm.com>
Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
parent 1d897e47
...@@ -444,7 +444,7 @@ static int ccwchain_loop_tic(struct ccwchain *chain, ...@@ -444,7 +444,7 @@ static int ccwchain_loop_tic(struct ccwchain *chain,
static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp) static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp)
{ {
struct ccwchain *chain; struct ccwchain *chain;
int len, ret; int len;
/* Copy the chain from cda to cp, and count the CCWs in it */ /* Copy the chain from cda to cp, and count the CCWs in it */
len = ccwchain_calc_length(cda, cp); len = ccwchain_calc_length(cda, cp);
...@@ -457,12 +457,8 @@ static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp) ...@@ -457,12 +457,8 @@ static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp)
return -ENOMEM; return -ENOMEM;
chain->ch_iova = cda; chain->ch_iova = cda;
/* Copy the new chain from user. */ /* Copy the actual CCWs into the new chain */
ret = copy_ccw_from_iova(cp, chain->ch_ccw, cda, len); memcpy(chain->ch_ccw, cp->guest_cp, len * sizeof(struct ccw1));
if (ret) {
ccwchain_free(chain);
return ret;
}
/* Loop for tics on this new chain. */ /* Loop for tics on this new chain. */
return ccwchain_loop_tic(chain, cp); return ccwchain_loop_tic(chain, cp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment