Commit 9de31912 authored by Vasily Gorbik's avatar Vasily Gorbik

Merge tag 'vfio-ccw-20190621' of...

Merge tag 'vfio-ccw-20190621' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw into features

Refactoring of the vfio-ccw cp handling, simplifying the
code and avoiding unneeded allocating/copying.

* tag 'vfio-ccw-20190621' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw:
  vfio-ccw: Remove copy_ccw_from_iova()
  vfio-ccw: Factor out the ccw0-to-ccw1 transition
  vfio-ccw: Copy CCW data outside length calculation
  vfio-ccw: Skip second copy of guest cp to host
  vfio-ccw: Move guest_cp storage into common struct
  s390/cio: Combine direct and indirect CCW paths
  vfio-ccw: Rearrange IDAL allocation in direct CCW
  vfio-ccw: Remove pfn_array_table
  vfio-ccw: Adjust the first IDAW outside of the nested loops
  vfio-ccw: Rearrange pfn_array and pfn_array_table arrays
  s390/cio: Use generalized CCW handler in cp_init()
  s390/cio: Generalize the TIC handler
  s390/cio: Refactor the routine that handles TIC CCWs
  s390/cio: Squash cp_free() and cp_unpin_free()
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parents 96e5aaf9 5223bee8
This diff is collapsed.
......@@ -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,
......
......@@ -129,6 +129,11 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
if (!private)
return -ENOMEM;
private->cp.guest_cp = kcalloc(CCWCHAIN_LEN_MAX, sizeof(struct ccw1),
GFP_KERNEL);
if (!private->cp.guest_cp)
goto out_free;
private->io_region = kmem_cache_zalloc(vfio_ccw_io_region,
GFP_KERNEL | GFP_DMA);
if (!private->io_region)
......@@ -169,6 +174,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
if (private->io_region)
kmem_cache_free(vfio_ccw_io_region, private->io_region);
kfree(private->cp.guest_cp);
kfree(private);
return ret;
}
......@@ -185,6 +191,7 @@ static int vfio_ccw_sch_remove(struct subchannel *sch)
kmem_cache_free(vfio_ccw_cmd_region, private->cmd_region);
kmem_cache_free(vfio_ccw_io_region, private->io_region);
kfree(private->cp.guest_cp);
kfree(private);
return 0;
......
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