Translate virtual PPAT indexes into physical PPAT indexes, according to the mapping between virtual PPAT indexes and physical PPAT indexes during building a PPGTT shadow page table. Signed-off-by: Zhi Wang <zhi.a.wang@xxxxxxxxx> --- drivers/gpu/drm/i915/gvt/gtt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index 6ec2a03..5487375 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -539,6 +539,24 @@ static struct intel_gvt_gtt_pat_ops gen8_pat_ops = { .match_pat_value = gen8_pat_match_value, }; +static inline void translate_ppat(struct intel_vgpu *vgpu, + struct intel_gvt_gtt_entry *ge, + struct intel_gvt_gtt_entry *se) +{ + struct intel_gvt *gvt = vgpu->gvt; + struct intel_gvt_gtt_pte_ops *ops = gvt->gtt.pte_ops; + + unsigned int virtual_ppat_index; + + if (!gvt->gtt.has_ppat) + return; + + WARN_ON(!vgpu->gtt.ppat_configured); + + virtual_ppat_index = ops->get_pat_index(ge); + ops->set_pat_index(se, vgpu->gtt.ppat_index[virtual_ppat_index]); +} + static int gtt_entry_p2m(struct intel_vgpu *vgpu, struct intel_gvt_gtt_entry *p, struct intel_gvt_gtt_entry *m) { @@ -559,6 +577,8 @@ static int gtt_entry_p2m(struct intel_vgpu *vgpu, struct intel_gvt_gtt_entry *p, } ops->set_pfn(m, mfn); + + translate_ppat(vgpu, p, m); return 0; } @@ -1051,6 +1071,7 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_shadow_page_by_guest_entry( return ERR_PTR(ret); } + static inline void ppgtt_generate_shadow_entry(struct intel_gvt_gtt_entry *se, struct intel_vgpu_ppgtt_spt *s, struct intel_gvt_gtt_entry *ge) { @@ -1060,6 +1081,8 @@ static inline void ppgtt_generate_shadow_entry(struct intel_gvt_gtt_entry *se, se->val64 = ge->val64; ops->set_pfn(se, s->shadow_page.mfn); + + translate_ppat(s->vgpu, ge, se); } static int ppgtt_populate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx