summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChuanxiao Dong <chuanxiao.dong@intel.com>2017-02-14 12:15:54 +0300
committerZhenyu Wang <zhenyuw@linux.intel.com>2017-02-14 12:35:39 +0300
commit4a0b3444da3ce1090d0f894f4e343756a94ab8c3 (patch)
tree7f8a303902da4c70155005da454dd7cb66629444 /drivers/gpu/drm
parentbc6a1c85795256cd7b44bc1dd264fe3144b8b6f8 (diff)
downloadlinux-4a0b3444da3ce1090d0f894f4e343756a94ab8c3.tar.xz
drm/i915/gvt: return error code if dma map iova failed
When doing dma map failed for a pfn, kvmgt should unpin the pfn and return error code to device module driver Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> Cc: xinda.zhao@intel.com Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/gvt/kvmgt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index c429ed033fc4..10c3a4b95a92 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1402,8 +1402,11 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn)
}
/* transfer to host iova for GFX to use DMA */
rc = gvt_dma_map_iova(info->vgpu, pfn, &iova);
- if (rc)
+ if (rc) {
gvt_err("gvt_dma_map_iova failed for gfn: 0x%lx\n", gfn);
+ vfio_unpin_pages(dev, &gfn, 1);
+ return INTEL_GVT_INVALID_ADDR;
+ }
gvt_cache_add(info->vgpu, gfn, iova);
return iova;