Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zhi Wang <zhi.a.wang@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org
Subject: [RFC 7/7] drm/i915/gvt: Translate virtual PPAT indexes
Date: Wed, 16 Aug 2017 05:31:15 +0800	[thread overview]
Message-ID: <1502832675-6123-8-git-send-email-zhi.a.wang@intel.com> (raw)
In-Reply-To: <1502832675-6123-1-git-send-email-zhi.a.wang@intel.com>

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@intel.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-08-15 21:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 21:31 [RFC 0/7] Introduce dynamic PPAT managment for GVT-g Zhi Wang
2017-08-15 13:51 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-15 21:31 ` [RFC 1/7] drm/i915: Introduce a bitmap to indicate available PPAT entries Zhi Wang
2017-08-15 21:31 ` [RFC 2/7] drm/i915/gvt: Introduce GEN8 private PAT ops Zhi Wang
2017-08-16  5:12   ` Zhenyu Wang
2017-08-16 13:46     ` Zhi Wang
2017-08-16  6:52   ` Zhenyu Wang
2017-08-15 21:31 ` [RFC 3/7] drm/i915: Introduce GEN8 {set, get} private PAT index ops Zhi Wang
2017-08-15 21:31 ` [RFC 4/7] drm/i915: Introduce dynamic private PAT management Zhi Wang
2017-08-15 21:31 ` [RFC 5/7] drm/i915/gvt: Introduce functions for retiring all shadow PPGTTs of a vGPU Zhi Wang
2017-08-15 21:31 ` [RFC 6/7] drm/i915/gvt: Introduce virtual private PAT support Zhi Wang
2017-08-16  5:18   ` Zhenyu Wang
2017-08-16 13:48     ` Zhi Wang
2017-08-16  6:13       ` Zhenyu Wang
2017-08-16  6:29         ` Wang, Zhi A
2017-08-15 21:31 ` Zhi Wang [this message]
2017-08-15 21:33 ` [RFC 0/7] Introduce dynamic PPAT managment for GVT-g Zhi Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502832675-6123-8-git-send-email-zhi.a.wang@intel.com \
    --to=zhi.a.wang@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox