public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Yu Zhang <yu.c.zhang@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 8/8] drm/i915: Support alias ppgtt in VM if ppgtt is enabled
Date: Fri, 17 Oct 2014 13:37:19 +0800	[thread overview]
Message-ID: <1413524239-8614-9-git-send-email-yu.c.zhang@linux.intel.com> (raw)
In-Reply-To: <1413524239-8614-1-git-send-email-yu.c.zhang@linux.intel.com>

The current XenGT only supports alias ppgtt. And the emulation
is done in XenGT host by first trapping PP_DIR_BASE mmio
accesses. Updating PP_DIR_BASE by using instructions such as
MI_LOAD_REGISTER_IMM are hard to detect and are not supported
in current XenGT. Therefore this patch also added a new callback
routine - vgpu_mm_switch() to set the PP_DIR_BASE by mmio writes.

v2: 
take Chris' comments:
        - move the code into sanitize_enable_ppgtt()

Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 90757ab..a731896 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -197,6 +197,9 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
 	if (IS_GEN8(dev))
 		has_full_ppgtt = false; /* XXX why? */
 
+	if (intel_vgpu_active(dev))
+		has_full_ppgtt = false; /* emulation is too hard */
+
 	if (enable_ppgtt == 0 || !has_aliasing_ppgtt)
 		return 0;
 
@@ -886,6 +889,16 @@ static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt,
 	return 0;
 }
 
+static int vgpu_mm_switch(struct i915_hw_ppgtt *ppgtt,
+			 struct intel_engine_cs *ring)
+{
+	struct drm_i915_private *dev_priv = to_i915(ppgtt->base.dev);
+
+	I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G);
+	I915_WRITE(RING_PP_DIR_BASE(ring), get_pd_offset(ppgtt));
+	return 0;
+}
+
 static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt,
 			  struct intel_engine_cs *ring)
 {
@@ -1212,6 +1225,9 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
 	} else
 		BUG();
 
+	if (intel_vgpu_active(dev))
+		ppgtt->switch_mm = vgpu_mm_switch;
+
 	ret = gen6_ppgtt_alloc(ppgtt);
 	if (ret)
 		return ret;
-- 
1.9.1

  parent reply	other threads:[~2014-10-17  6:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  5:37 [PATCH v2 0/8] Add enlightenments for vGPU Yu Zhang
2014-10-17  5:37 ` [PATCH v2 1/8] drm/i915: Introduce a PV INFO page structure for Intel GVT-g Yu Zhang
2014-10-17  5:37 ` [PATCH v2 2/8] drm/i915: Adds graphic address space ballooning logic Yu Zhang
2014-10-17  5:37 ` [PATCH v2 3/8] drm/i915: Partition the fence registers for vgpu in i915 driver Yu Zhang
2014-10-17  5:37 ` [PATCH v2 4/8] drm/i915: Disable framebuffer compression for i915 driver in VM Yu Zhang
2014-10-17  5:37 ` [PATCH v2 5/8] drm/i915: Add the display switch logic for vgpu in i915 driver Yu Zhang
2014-10-17  5:37 ` [PATCH v2 6/8] drm/i915: Disable power management for i915 driver in VM Yu Zhang
2014-10-17  5:37 ` [PATCH v2 7/8] drm/i915: Create vgpu specific write MMIO to reduce traps Yu Zhang
2014-10-17  5:37 ` Yu Zhang [this message]
2014-10-21 16:16 ` [PATCH v2 0/8] Add enlightenments for vGPU Daniel Vetter
2014-10-21 16:51   ` Daniel Vetter
2014-10-22  7:03     ` Yu, Zhang
2014-10-22 10:27       ` Daniel Vetter
2014-10-22  6:56   ` Yu, Zhang
  -- strict thread matches above, loose matches on Subject: below --
2014-10-16  6:24 Yu Zhang
2014-10-16  6:24 ` [PATCH v2 8/8] drm/i915: Support alias ppgtt in VM if ppgtt is enabled Yu Zhang

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=1413524239-8614-9-git-send-email-yu.c.zhang@linux.intel.com \
    --to=yu.c.zhang@linux.intel.com \
    --cc=intel-gfx@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