Skip to contentSkip to conversation

drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM

PATCH Superseded Weinan Li 3 participants 4 messages Oct 13, 2017

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Weinan Li

author
#0 lore raw

PATCH v5 1/1 drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM

Let GVT-g VM read the CSB and CSB write pointer from virtual HWSP, not all the host support this feature, need to check the BIT(3) of caps in PVINFO.

v3 : Remove unnecessary comments.
v4 : Separate VM enable patch with GVT-g implementation patch due to code dependency.
v5 : Use inline for GVT virtual HWSP caps check function.

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pvinfo.h     | 1 +
 drivers/gpu/drm/i915/i915_vgpu.h       | 6 ++++++
 drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++----
 drivers/gpu/drm/i915/intel_lrc.c       | 1 -
 4 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_pvinfo.h +1 -0
index 0679a58..195203f 100644
@@ -53,6 +53,7 @@ enum vgt_g2v_type {
  * VGT capabilities type
  */
 #define VGT_CAPS_FULL_48BIT_PPGTT	BIT(2)
+#define VGT_CAPS_HWSP_EMULATION		BIT(3)
 
 struct vgt_if {
 	u64 magic;		/* VGT_MAGIC */
drivers/gpu/drm/i915/i915_vgpu.h +6 -0
index b72bd29..bb83384 100644
@@ -30,6 +30,12 @@
 
 bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv);
 
+static inline bool
+intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
+{
+	return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
+}
+
 int intel_vgt_balloon(struct drm_i915_private *dev_priv);
 void intel_vgt_deballoon(struct drm_i915_private *dev_priv);
 
drivers/gpu/drm/i915/intel_engine_cs.c +4 -4
index a59b2a3..457ebe0 100644
@@ -25,6 +25,7 @@
 #include <drm/drm_print.h>
 
 #include "i915_drv.h"
+#include "i915_vgpu.h"
 #include "intel_ringbuffer.h"
 #include "intel_lrc.h"
 
@@ -386,10 +387,6 @@ static void intel_engine_init_timeline(struct intel_engine_cs *engine)
 
 static bool csb_force_mmio(struct drm_i915_private *i915)
 {
-	/* GVT emulation depends upon intercepting CSB mmio */
-	if (intel_vgpu_active(i915))
-		return true;
-
 	/*
 	 * IOMMU adds unpredictable latency causing the CSB write (from the
 	 * GPU into the HWSP) to only be visible some time after the interrupt
@@ -398,6 +395,9 @@ static bool csb_force_mmio(struct drm_i915_private *i915)
 	if (intel_vtd_active())
 		return true;
 
+	if (intel_vgpu_active(i915) && !intel_vgpu_has_hwsp_emulation(i915))
+		return true;
+
 	return false;
 }
 
drivers/gpu/drm/i915/intel_lrc.c +0 -1
index fbfcf88..766552f 100644
@@ -793,7 +793,6 @@ static void intel_lrc_irq_handler(unsigned long data)
 			&engine->status_page.page_addr[I915_HWS_CSB_BUF0_INDEX];
 		unsigned int head, tail;
 
-		/* However GVT emulation depends upon intercepting CSB mmio */
 		if (unlikely(execlists->csb_use_mmio)) {
 			buf = (u32 * __force)
 				(dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_BUF_LO(engine, 0)));
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM (rev2)
URL : https://patchwork.freedesktop.org/series/31789/
State : success

== Summary ==

Series 31789v2 drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM
https://patchwork.freedesktop.org/api/1.0/series/31789/revisions/2/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:458s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:474s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:576s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:286s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:526s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:538s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:545s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:529s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:562s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:430s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:271s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:611s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:463s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:507s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:478s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:507s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:490s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:596s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:664s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:665s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:539s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:518s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:477s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:591s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:435s

490bd134d63554815d2ea6ff56e6d32fd50ff472 drm-tip: 2017y-10m-12d-20h-08m-10s UTC integration manifest 47f515dacf13 drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6018/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM (rev2)

In reply to Weinan Li
== Series Details ==

== Series Details ==

Series: drm/i915: enable to read CSB and CSB write pointer from HWSP in GVT-g VM (rev2)
URL : https://patchwork.freedesktop.org/series/31789/
State : success

== Summary ==

shard-hsw total:2501 pass:1413 dwarn:0 dfail:0 fail:9 skip:1079 time:9529s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6018/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v5 1/1
#3 lore raw
In reply to Weinan Li

Quoting Weinan Li (2017-10-13 02:46:16)

Quoted 71 lines

Let GVT-g VM read the CSB and CSB write pointer from virtual HWSP, not all the host support this feature, need to check the BIT(3) of caps in PVINFO.

v3 : Remove unnecessary comments.
v4 : Separate VM enable patch with GVT-g implementation patch due to code dependency.
v5 : Use inline for GVT virtual HWSP caps check function.

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pvinfo.h     | 1 +
 drivers/gpu/drm/i915/i915_vgpu.h       | 6 ++++++
 drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++----
 drivers/gpu/drm/i915/intel_lrc.c       | 1 -
 4 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_pvinfo.h +1 -0
index 0679a58..195203f 100644
@@ -53,6 +53,7 @@ enum vgt_g2v_type {
  * VGT capabilities type
  */
 #define VGT_CAPS_FULL_48BIT_PPGTT      BIT(2)
+#define VGT_CAPS_HWSP_EMULATION                BIT(3)
 
 struct vgt_if {
        u64 magic;              /* VGT_MAGIC */
drivers/gpu/drm/i915/i915_vgpu.h +6 -0
index b72bd29..bb83384 100644
@@ -30,6 +30,12 @@
 
 bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv);
 
+static inline bool
+intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
+{
+       return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
+}
+
 int intel_vgt_balloon(struct drm_i915_private *dev_priv);
 void intel_vgt_deballoon(struct drm_i915_private *dev_priv);
 
drivers/gpu/drm/i915/intel_engine_cs.c +1 -4
index a59b2a3..457ebe0 100644
@@ -25,6 +25,7 @@
 #include <drm/drm_print.h>
 
 #include "i915_drv.h"
+#include "i915_vgpu.h"
 #include "intel_ringbuffer.h"
 #include "intel_lrc.h"
 
@@ -386,10 +387,6 @@ static void intel_engine_init_timeline(struct intel_engine_cs *engine)
 
 static bool csb_force_mmio(struct drm_i915_private *i915)
 {
-       /* GVT emulation depends upon intercepting CSB mmio */
-       if (intel_vgpu_active(i915))
-               return true;
-
        /*
         * IOMMU adds unpredictable latency causing the CSB write (from the
         * GPU into the HWSP) to only be visible some time after the interrupt

drivers/gpu/drm/i915/intel_engine_cs.c static bool csb_force_mmio(struct drm_i915_private *i915) · line 397

Quoted 3 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0 -0
@@ -398,6 +395,9 @@ static bool csb_force_mmio(struct drm_i915_private *i915)
        if (intel_vtd_active())
                return true;
 

The comment is still interesting:
/* Older GVT emulation depends upon intercepting CSB mmio */ as it explains why we need the mmio path ere.

With that,

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx