drm/i915/gvt: fix error return check for copy_gma_to_hva()
authorZhenyu Wang <zhenyuw@linux.intel.com>
Wed, 29 Mar 2017 03:07:53 +0000 (11:07 +0800)
committerDave Airlie <airlied@redhat.com>
Wed, 29 Mar 2017 03:38:01 +0000 (13:38 +1000)
From commit 73dec95e6ba3 ("drm/i915: Emit to ringbuffer directly"),
copy_gma_to_hva() now returns copied data length instead of 0, so
need to change error return check for that.

Note: Looks this is caused by backmerge conflict resolving, so
4.11-rc4 is not impacted as commit 73dec95e6ba3 ("drm/i915: Emit to
ringbuffer directly") is not in 4.11. But need to fix this before I
can apply 4.12 stuff against drm-intel-next correctly.

Fixes: e5c1ff14757a ("Backmerge tag 'v4.11-rc4' into drm-next")
Cc: Dave Airlie <airlied@redhat.com>
Cc: Tina Zhang <tina.zhang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/gvt/cmd_parser.c

index b3c9a478c6560fdb8aa97e2353a4a54fdce2dfd3..6f972afbdbc3a3dec61ea68ad9425d5b76ed3044 100644 (file)
@@ -1673,7 +1673,7 @@ static int perform_bb_shadow(struct parser_exec_state *s)
        ret = copy_gma_to_hva(s->vgpu, s->vgpu->gtt.ggtt_mm,
                              gma, gma + bb_size,
                              dst);
-       if (ret) {
+       if (ret < 0) {
                gvt_vgpu_err("fail to copy guest ring buffer\n");
                goto unmap_src;
        }
@@ -2666,7 +2666,7 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload)
        if (gma_head > gma_tail) {
                ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm,
                                      gma_head, gma_top, cs);
-               if (ret) {
+               if (ret < 0) {
                        gvt_vgpu_err("fail to copy guest ring buffer\n");
                        return ret;
                }
@@ -2676,7 +2676,7 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload)
 
        /* copy head or start <-> tail */
        ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, cs);
-       if (ret) {
+       if (ret < 0) {
                gvt_vgpu_err("fail to copy guest ring buffer\n");
                return ret;
        }
@@ -2737,7 +2737,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx)
                                wa_ctx->workload->vgpu->gtt.ggtt_mm,
                                guest_gma, guest_gma + ctx_size,
                                map);
-       if (ret) {
+       if (ret < 0) {
                gvt_vgpu_err("fail to copy guest indirect ctx\n");
                goto unmap_src;
        }