drm/i915/gvt: do not let pin count of shadow mm go negative
authorYan Zhao <yan.y.zhao@intel.com>
Wed, 27 Mar 2019 04:55:45 +0000 (00:55 -0400)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 29 Mar 2019 02:27:42 +0000 (10:27 +0800)
commit663a50ceac75c2208d2ad95365bc8382fd42f44d
treeacf9b544b07b6fd2d9142ba146e9286aea27cf63
parentdade58ed5af6365ac50ff4259c2a0bf31219e285
drm/i915/gvt: do not let pin count of shadow mm go negative

shadow mm's pin count got increased in workload preparation phase, which
is after workload scanning.
it will get decreased in complete_current_workload() anyway after
workload completion.
Sometimes, if a workload meets a scanning error, its shadow mm pin count
will not get increased but will get decreased in the end.
This patch lets shadow mm's pin count not go below 0.

Fixes: 2707e4446688 ("drm/i915/gvt: vGPU graphics memory virtualization")
Cc: zhenyuw@linux.intel.com
Cc: stable@vger.kernel.org #4.14+
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/gtt.c