All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaolin Zhang <xiaolin.zhang@intel.com>
To: intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: zhenyu.z.wang@intel.com, hang.yuan@intel.com,
	joonas.lahtinen@intel.com, fei.jiang@intel.com,
	zhiyuan.lv@intel.com
Subject: [v1 05/10] drm/i915: ppgtt update pvmmio optimization
Date: Thu, 11 Oct 2018 14:14:07 +0800	[thread overview]
Message-ID: <1539238452-4389-5-git-send-email-xiaolin.zhang@intel.com> (raw)
In-Reply-To: <1539238452-4389-1-git-send-email-xiaolin.zhang@intel.com>

This patch extends g2v notification to notify host GVT-g of
ppgtt update from guest, including alloc_4lvl, clear_4lv4 and
insert_4lvl. It uses shared page to pass the additional params.
This patch also add one new pvmmio level to control ppgtt update.

Use PVMMIO_PPGTT_UPDATE to control this level of pvmmio optimization.

v1: rebase
v0: RFC

Signed-off-by: Xiaolin Zhang <xiaolin.zhang@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 36 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_pvinfo.h  |  3 +++
 drivers/gpu/drm/i915/i915_vgpu.c    |  3 ++-
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 29ca900..3e7cb35 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -941,6 +941,8 @@ static void gen8_ppgtt_clear_4lvl(struct i915_address_space *vm,
 	struct i915_pml4 *pml4 = &ppgtt->pml4;
 	struct i915_page_directory_pointer *pdp;
 	unsigned int pml4e;
+	u64 orig_start = start;
+	u64 orig_length = length;
 
 	GEM_BUG_ON(!use_4lvl(vm));
 
@@ -954,6 +956,16 @@ static void gen8_ppgtt_clear_4lvl(struct i915_address_space *vm,
 
 		free_pdp(vm, pdp);
 	}
+
+	if (PVMMIO_LEVEL_ENABLE(vm->i915, PVMMIO_PPGTT_UPDATE)) {
+		struct drm_i915_private *dev_priv = vm->i915;
+		struct pv_ppgtt_update *pv_ppgtt =
+				&dev_priv->vgpu.shared_page->pv_ppgtt;
+		pv_ppgtt->pdp = px_dma(pml4);
+		pv_ppgtt->start = orig_start;
+		pv_ppgtt->length = orig_length;
+		I915_WRITE(vgtif_reg(g2v_notify), VGT_G2V_PPGTT_L4_CLEAR);
+	}
 }
 
 static inline struct sgt_dma {
@@ -1195,6 +1207,18 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm,
 
 		vma->page_sizes.gtt = I915_GTT_PAGE_SIZE;
 	}
+
+	if (PVMMIO_LEVEL_ENABLE(vm->i915, PVMMIO_PPGTT_UPDATE)) {
+		struct drm_i915_private *dev_priv = vm->i915;
+		struct pv_ppgtt_update *pv_ppgtt =
+				&dev_priv->vgpu.shared_page->pv_ppgtt;
+		pv_ppgtt->pdp = px_dma(&ppgtt->pml4);
+		pv_ppgtt->start = vma->node.start;
+		pv_ppgtt->length = vma->node.size;
+		pv_ppgtt->cache_level = cache_level;
+		I915_WRITE(vgtif_reg(g2v_notify), VGT_G2V_PPGTT_L4_INSERT);
+	}
+
 }
 
 static void gen8_free_page_tables(struct i915_address_space *vm,
@@ -1438,6 +1462,8 @@ static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm,
 	u64 from = start;
 	u32 pml4e;
 	int ret;
+	u64 orig_start = start;
+	u64 orig_length = length;
 
 	gen8_for_each_pml4e(pdp, pml4, start, length, pml4e) {
 		if (pml4->pdps[pml4e] == vm->scratch_pdp) {
@@ -1454,6 +1480,16 @@ static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm,
 			goto unwind_pdp;
 	}
 
+	if (PVMMIO_LEVEL_ENABLE(vm->i915, PVMMIO_PPGTT_UPDATE)) {
+		struct drm_i915_private *dev_priv = vm->i915;
+		struct pv_ppgtt_update *pv_ppgtt =
+				&dev_priv->vgpu.shared_page->pv_ppgtt;
+		pv_ppgtt->pdp = px_dma(pml4);
+		pv_ppgtt->start = orig_start;
+		pv_ppgtt->length = orig_length;
+		I915_WRITE(vgtif_reg(g2v_notify), VGT_G2V_PPGTT_L4_ALLOC);
+	}
+
 	return 0;
 
 unwind_pdp:
diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h
index 1e24c45..790db50 100644
--- a/drivers/gpu/drm/i915/i915_pvinfo.h
+++ b/drivers/gpu/drm/i915/i915_pvinfo.h
@@ -46,6 +46,9 @@ enum vgt_g2v_type {
 	VGT_G2V_PPGTT_L4_PAGE_TABLE_DESTROY,
 	VGT_G2V_EXECLIST_CONTEXT_CREATE,
 	VGT_G2V_EXECLIST_CONTEXT_DESTROY,
+	VGT_G2V_PPGTT_L4_ALLOC,
+	VGT_G2V_PPGTT_L4_CLEAR,
+	VGT_G2V_PPGTT_L4_INSERT,
 	VGT_G2V_MAX,
 };
 
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 6471574..ee81b62 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -66,7 +66,8 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv)
 
 	BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE);
 
-	dev_priv->vgpu.pv_caps = PVMMIO_ELSP_SUBMIT | PVMMIO_MASTER_IRQ;
+	dev_priv->vgpu.pv_caps = PVMMIO_ELSP_SUBMIT
+			| PVMMIO_MASTER_IRQ | PVMMIO_PPGTT_UPDATE;
 
 	magic = __raw_i915_read64(dev_priv, vgtif_reg(magic));
 	if (magic != VGT_MAGIC)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-10-11  6:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  6:14 [v1 01/10] drm/i915: introduced pv capability for vgpu Xiaolin Zhang
2018-10-11  6:14 ` [v1 02/10] drm/i915: get ready of memory for pvmmio Xiaolin Zhang
2018-10-11  6:14 ` [v1 03/10] drm/i915: context submission pvmmio optimization Xiaolin Zhang
2018-10-11  9:12   ` Chris Wilson
2018-10-15  2:35     ` Zhang, Xiaolin
2018-10-11  6:14 ` [v1 04/10] drm/i915: master irq " Xiaolin Zhang
2018-10-11  6:14 ` Xiaolin Zhang [this message]
2018-10-11  6:14 ` [v1 06/10] drm/i915/gvt: GVTg handle enable_pvmmio PVINFO register Xiaolin Zhang
2018-10-11  6:14 ` [v1 07/10] drm/i915/gvt: GVTg read_shared_page implementation Xiaolin Zhang
2018-10-11  6:14 ` [v1 08/10] drm/i915/gvt: GVTg support context submission pvmmio optimization Xiaolin Zhang
2018-10-11  6:14 ` [v1 09/10] drm/i915/gvt: GVTg support master irq " Xiaolin Zhang
2018-10-11  6:14 ` [v1 10/10] drm/i915/gvt: GVTg support ppgtt " Xiaolin Zhang
2018-10-11  8:06   ` Zhao, Yakui
2018-10-15  2:38     ` Zhang, Xiaolin
2018-10-11  6:32 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v1,01/10] drm/i915: introduced pv capability for vgpu Patchwork
2018-10-11  6:35 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-11  6:47 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-11 13:07 ` ✓ Fi.CI.IGT: " Patchwork

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=1539238452-4389-5-git-send-email-xiaolin.zhang@intel.com \
    --to=xiaolin.zhang@intel.com \
    --cc=fei.jiang@intel.com \
    --cc=hang.yuan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=joonas.lahtinen@intel.com \
    --cc=zhenyu.z.wang@intel.com \
    --cc=zhiyuan.lv@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.