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 4 participants 6 messages Oct 12, 2017 – Oct 13, 2017

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Weinan Li

author
#0 lore raw

PATCH v4 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

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pvinfo.h     | 1 +
 drivers/gpu/drm/i915/i915_vgpu.c       | 5 +++++
 drivers/gpu/drm/i915/i915_vgpu.h       | 1 +
 drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++----
 drivers/gpu/drm/i915/intel_lrc.c       | 1 -
 5 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.c +5 -0
index 5fe9f3f..6f713c5 100644
@@ -86,6 +86,11 @@ bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv)
 	return dev_priv->vgpu.caps & VGT_CAPS_FULL_48BIT_PPGTT;
 }
 
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
+{
+	return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
+}
+
 struct _balloon_info_ {
 	/*
 	 * There are up to 2 regions per mappable/unmappable graphic
drivers/gpu/drm/i915/i915_vgpu.h +1 -0
index b72bd29..cec0ec1 100644
@@ -29,6 +29,7 @@
 void i915_check_vgpu(struct drm_i915_private *dev_priv);
 
 bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv);
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv);
 
 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

== Series Details ==

== Series Details ==

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

== Summary ==

Series 31789v1 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/1/mbox/

Test gem_close_race:

        Subgroup basic-threads:
                dmesg-warn -> PASS       (fi-snb-2520m)
Test gem_ringfill:
        Subgroup basic-default-hang:
                incomplete -> DMESG-WARN (fi-blb-e6850) fdo#101600
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                incomplete -> PASS       (fi-kbl-7567u) fdo#102846
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

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:467s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:390s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:572s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:287s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:517s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:518s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:529s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:514s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:555s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:435s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:272s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:594s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:437s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:458s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:513s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:505s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:580s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:489s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:590s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:475s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:656s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:531s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:515s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:476s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:581s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:428s

fi-pnv-d510 failed to connect after reboot

6a96415ec560527f41089b246c06e7fd75991791 drm-tip: 2017y-10m-11d-19h-08m-29s UTC integration manifest cbaeb7f04c57 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_6003/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Weinan Li

Quoting Weinan Li (2017-10-12 07:50:08)

Quoted 35 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

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_pvinfo.h     | 1 +
 drivers/gpu/drm/i915/i915_vgpu.c       | 5 +++++
 drivers/gpu/drm/i915/i915_vgpu.h       | 1 +
 drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++----
 drivers/gpu/drm/i915/intel_lrc.c       | 1 -
 5 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.c +0 -0
index 5fe9f3f..6f713c5 100644

drivers/gpu/drm/i915/i915_vgpu.c bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv) · line 92

Quoted 7 lines
drivers/gpu/drm/i915/i915_vgpu.c +4 -0
@@ -86,6 +86,11 @@ bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv)
        return dev_priv->vgpu.caps & VGT_CAPS_FULL_48BIT_PPGTT;
 }
 
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
+{
+       return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
+}

Why is this not inline? The function call is going to be more instructions than the bit test.

Quoted 39 lines
drivers/gpu/drm/i915/i915_vgpu.c +0 -0
 struct _balloon_info_ {
        /*
         * There are up to 2 regions per mappable/unmappable graphic
drivers/gpu/drm/i915/i915_vgpu.h +1 -0
index b72bd29..cec0ec1 100644
@@ -29,6 +29,7 @@
 void i915_check_vgpu(struct drm_i915_private *dev_priv);
 
 bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv);
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv);
 
 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 396

Quoted 2 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;

/* Older GVT emulation depends upon intercepting CSB mmio */

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

Quoted 3 lines
drivers/gpu/drm/i915/intel_engine_cs.c +3 -0
+       if (intel_vgpu_active(i915) && !intel_vgpu_has_hwsp_emulation(i915))
+               return true;
+

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

#3 lore raw
Quoted 39 lines · Chris Wilson

Quoting Weinan Li (2017-10-12 07:50:08)

Quoted 38 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

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
---
  drivers/gpu/drm/i915/i915_pvinfo.h     | 1 +
  drivers/gpu/drm/i915/i915_vgpu.c       | 5 +++++
  drivers/gpu/drm/i915/i915_vgpu.h       | 1 +
  drivers/gpu/drm/i915/intel_engine_cs.c | 8 ++++----
  drivers/gpu/drm/i915/intel_lrc.c       | 1 -
  5 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.c +0 -0
index 5fe9f3f..6f713c5 100644
@@ -86,6 +86,11 @@ bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv)
         return dev_priv->vgpu.caps & VGT_CAPS_FULL_48BIT_PPGTT;
  }
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_vgpu.c bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv) · line 92

Quoted 4 lines
drivers/gpu/drm/i915/i915_vgpu.c +4 -0
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv)
+{
+       return dev_priv->vgpu.caps & VGT_CAPS_HWSP_EMULATION;
+}

Why is this not inline? The function call is going to be more instructions than the bit test.

it is just called in init process, but yes, inline is more reasonable.

Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/i915_vgpu.c +0 -0
  struct _balloon_info_ {
         /*
          * There are up to 2 regions per mappable/unmappable graphic
drivers/gpu/drm/i915/i915_vgpu.h +1 -0
index b72bd29..cec0ec1 100644
@@ -29,6 +29,7 @@
  void i915_check_vgpu(struct drm_i915_private *dev_priv);
 
  bool intel_vgpu_has_full_48bit_ppgtt(struct drm_i915_private *dev_priv);
+bool intel_vgpu_has_hwsp_emulation(struct drm_i915_private *dev_priv);
 
  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 -0
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)
 
Quoted 17 lines

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

Quoted 12 lines
drivers/gpu/drm/i915/intel_engine_cs.c +0 -4
  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;

/* Older GVT emulation depends upon intercepting CSB mmio */

Quoted 3 lines
drivers/gpu/drm/i915/intel_engine_cs.c +3 -0
+       if (intel_vgpu_active(i915) && !intel_vgpu_has_hwsp_emulation(i915))
+               return true;
+

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

maintainer
#4 lore raw
Quoted 2 lines · Weinan Z
Quoted 1 line · Chris Wilson

Quoting Weinan Li (2017-10-12 07:50:08)

<SNIP>

Quoted 9 lines
Quoted 9 lines

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

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;

/* Older GVT emulation depends upon intercepting CSB mmio */

Quoted 3 lines
drivers/gpu/drm/i915/intel_engine_cs.c +3 -0
+       if (intel_vgpu_active(i915) && !intel_vgpu_has_hwsp_emulation(i915))
+               return true;
+

You missed the request to move the comment here.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

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

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
URL : https://patchwork.freedesktop.org/series/31789/
State : success

== Summary ==

Test kms_setmode:

        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test kms_flip:
        Subgroup flip-vs-rmfb:
                dmesg-warn -> PASS       (shard-hsw) fdo#102614

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

shard-hsw total:2501 pass:1410 dwarn:0 dfail:0 fail:9 skip:1082 time:9524s

== Logs ==

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