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 5/7] drm/i915/gvt: Introduce functions for retiring all shadow PPGTTs of a vGPU
Date: Wed, 16 Aug 2017 05:31:13 +0800	[thread overview]
Message-ID: <1502832675-6123-6-git-send-email-zhi.a.wang@intel.com> (raw)
In-Reply-To: <1502832675-6123-1-git-send-email-zhi.a.wang@intel.com>

Introduce a new function to retiring all shadow PPGTTs of a vGPU.

The shadow PPPGTs of a vGPU need to be invalidated if a guest modifies the
virtual private PPAT since the mapping between the virtual PPAT indexes
and the shadow PPAT indexes will be re-built after a guest writes a new
virtual PPAT configruation.

Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
---
 drivers/gpu/drm/i915/gvt/gtt.c | 23 +++++++++++++++++++++++
 drivers/gpu/drm/i915/gvt/gtt.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 6e19d7a..1d7077d 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -1745,6 +1745,11 @@ void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm)
 		return;
 
 	atomic_dec(&mm->pincount);
+
+	if (mm->need_rebuild) {
+		invalidate_mm(mm);
+		mm->need_rebuild = false;
+	}
 }
 
 /**
@@ -1798,6 +1803,24 @@ static int reclaim_one_mm(struct intel_gvt *gvt)
 	return 0;
 }
 
+static void retire_vgpu_ppgtt_mm(struct intel_vgpu *vgpu)
+{
+	struct intel_vgpu_mm *mm;
+	struct list_head *pos;
+
+	list_for_each(pos, &vgpu->gtt.mm_list_head) {
+		mm = container_of(pos, struct intel_vgpu_mm, list);
+
+		if (mm->type != INTEL_GVT_MM_PPGTT)
+			continue;
+		if (atomic_read(&mm->pincount)) {
+			mm->need_rebuild = true;
+			continue;
+		}
+		invalidate_mm(mm);
+	}
+}
+
 /*
  * GMA translation APIs.
  */
diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h
index 6cd4fc7..a83d1f0 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.h
+++ b/drivers/gpu/drm/i915/gvt/gtt.h
@@ -147,6 +147,7 @@ struct intel_vgpu_mm {
 	int type;
 	bool initialized;
 	bool shadowed;
+	bool need_rebuild;
 
 	int page_table_entry_type;
 	u32 page_table_entry_size;
-- 
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 ` Zhi Wang [this message]
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 ` [RFC 7/7] drm/i915/gvt: Translate virtual PPAT indexes Zhi Wang
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-6-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