Some improvements in data handling for vfio-ccw.
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJZ5H6IAAoJEN7Pa5PG8C+vkIMP/jOw1YDx0307QoL4m5fLfu2P sxHbNGiOmoIWdCl1muHUoYzyORAUVOS9q1UPlPXQ2M9EBba12ZXGabzQU3bhWhwO CFRIlnNK7+D7JswImjwm24AgU/QiSE/XJDtHC8iuzTbDvihFdJG131bVg0bSb6Or BrpySjNOHDIWe7ySnJlHdoC4noPtst4l33xkzNlY6plhVpT0OQvm2A/UFYV1CRaX PrTGIw20Uf9Z1IlFwf0yuP/u0r/iRJCi06ym89XqUAUdtzcWpAiwMpydop1uIsmR A15SYC6dvBYN0n3snqjI6EK+/+XHLlUbmaX/ughUnG3rXx5J4KGJRAeP6qPO7GMV mYvavLe6FrlRvL5uk9zqAaPRYo3iWKhm43Q7923RFNzr5PLUSKDnN9EFsP22Ppi6 i1lv8khBHh4jx5ST/WjhGb77k6OZ6WbCdB6txOmV7I/VQIoF6XuVmlgpJAR0ZivA 1FtS7H62o+jTUyPV3a4sCjqfMg2PPJ2CKCVtYN1R33IWDjiovqNZsHRaIX7T7AIl 8AJLJOpUoWACplwilFpsIkJ0sjjAvGoTpAAfxiJEtLSYjqPMYyQMqpLPIMMQhFCi KSNbuHpIpLujrSTCoSpgF5VWy5QgBQy9J3QN8nF/i2PE5izlPUoql3K1sb9dOzZQ It83jpoK4vFl6a1Ra4SJ =7y/+ -----END PGP SIGNATURE----- Merge tag 'vfio-ccw-20171016' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw into features Pull vfio-ccw update from Cornelia Huck: "Some improvements in data handling for vfio-ccw."
This commit is contained in:
commit
7f581d03bd
|
@ -105,7 +105,10 @@ static int pfn_array_alloc_pin(struct pfn_array *pa, struct device *mdev,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!len || pa->pa_nr)
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
if (pa->pa_nr)
|
||||
return -EINVAL;
|
||||
|
||||
pa->pa_iova = iova;
|
||||
|
@ -501,6 +504,16 @@ static int ccwchain_fetch_direct(struct ccwchain *chain,
|
|||
|
||||
ccw = chain->ch_ccw + idx;
|
||||
|
||||
if (!ccw->count) {
|
||||
/*
|
||||
* We just want the translation result of any direct ccw
|
||||
* to be an IDA ccw, so let's add the IDA flag for it.
|
||||
* Although the flag will be ignored by firmware.
|
||||
*/
|
||||
ccw->flags |= CCW_FLAG_IDA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pin data page(s) in memory.
|
||||
* The number of pages actually is the count of the idaws which will be
|
||||
|
@ -541,6 +554,9 @@ static int ccwchain_fetch_idal(struct ccwchain *chain,
|
|||
|
||||
ccw = chain->ch_ccw + idx;
|
||||
|
||||
if (!ccw->count)
|
||||
return 0;
|
||||
|
||||
/* Calculate size of idaws. */
|
||||
ret = copy_from_iova(cp->mdev, &idaw_iova, ccw->cda, sizeof(idaw_iova));
|
||||
if (ret)
|
||||
|
@ -569,10 +585,6 @@ static int ccwchain_fetch_idal(struct ccwchain *chain,
|
|||
|
||||
for (i = 0; i < idaw_nr; i++) {
|
||||
idaw_iova = *(idaws + i);
|
||||
if (IS_ERR_VALUE(idaw_iova)) {
|
||||
ret = -EFAULT;
|
||||
goto out_free_idaws;
|
||||
}
|
||||
|
||||
ret = pfn_array_alloc_pin(pat->pat_pa + i, cp->mdev,
|
||||
idaw_iova, 1);
|
||||
|
|
Loading…
Reference in New Issue