aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChangbin Du <changbin.du@intel.com>2018-01-30 06:19:43 -0500
committerZhenyu Wang <zhenyuw@linux.intel.com>2018-03-06 00:19:15 -0500
commitb0c766bf2911ad5d16affa0d34cf00c246a3c47a (patch)
tree33d5f4dcc7578522ee3d55d089ba57a49f9383fd
parent3aff35128025baa58c0676e501eb4597687ca80f (diff)
drm/i915/gvt: Refine ggtt_set_shadow_entry
Less code and use existed helper ggtt_set_host_entry. Signed-off-by: Changbin Du <changbin.du@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/gvt/gtt.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 862fac5345c3..82454fb1d566 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -2421,26 +2421,23 @@ void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu)
2421{ 2421{
2422 struct intel_gvt *gvt = vgpu->gvt; 2422 struct intel_gvt *gvt = vgpu->gvt;
2423 struct drm_i915_private *dev_priv = gvt->dev_priv; 2423 struct drm_i915_private *dev_priv = gvt->dev_priv;
2424 struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops; 2424 struct intel_gvt_gtt_pte_ops *pte_ops = vgpu->gvt->gtt.pte_ops;
2425 struct intel_gvt_gtt_entry entry = {.type = GTT_TYPE_GGTT_PTE};
2425 u32 index; 2426 u32 index;
2426 u32 offset;
2427 u32 num_entries; 2427 u32 num_entries;
2428 struct intel_gvt_gtt_entry e;
2429 2428
2430 memset(&e, 0, sizeof(struct intel_gvt_gtt_entry)); 2429 pte_ops->set_pfn(&entry, gvt->gtt.scratch_mfn);
2431 e.type = GTT_TYPE_GGTT_PTE; 2430 pte_ops->set_present(&entry);
2432 ops->set_pfn(&e, gvt->gtt.scratch_mfn);
2433 e.val64 |= _PAGE_PRESENT;
2434 2431
2435 index = vgpu_aperture_gmadr_base(vgpu) >> PAGE_SHIFT; 2432 index = vgpu_aperture_gmadr_base(vgpu) >> PAGE_SHIFT;
2436 num_entries = vgpu_aperture_sz(vgpu) >> PAGE_SHIFT; 2433 num_entries = vgpu_aperture_sz(vgpu) >> PAGE_SHIFT;
2437 for (offset = 0; offset < num_entries; offset++) 2434 while (num_entries--)
2438 ops->set_entry(NULL, &e, index + offset, false, 0, vgpu); 2435 ggtt_set_host_entry(vgpu->gtt.ggtt_mm, &entry, index++);
2439 2436
2440 index = vgpu_hidden_gmadr_base(vgpu) >> PAGE_SHIFT; 2437 index = vgpu_hidden_gmadr_base(vgpu) >> PAGE_SHIFT;
2441 num_entries = vgpu_hidden_sz(vgpu) >> PAGE_SHIFT; 2438 num_entries = vgpu_hidden_sz(vgpu) >> PAGE_SHIFT;
2442 for (offset = 0; offset < num_entries; offset++) 2439 while (num_entries--)
2443 ops->set_entry(NULL, &e, index + offset, false, 0, vgpu); 2440 ggtt_set_host_entry(vgpu->gtt.ggtt_mm, &entry, index++);
2444 2441
2445 gtt_invalidate(dev_priv); 2442 gtt_invalidate(dev_priv);
2446} 2443}