Skip to contentSkip to conversation

drm/i915: Enable guest i915 48bit full ppgtt functionality

PATCH Superseded Tina Zhang 3 participants 3 messages Jun 20, 2017 – Jun 21, 2017

Subsystems (2)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Tina Zhang

author
#0 lore raw

PATCH v6 1/1 drm/i915: Enable guest i915 48bit full ppgtt functionality

Enable the guest i915 48bit full ppgtt functionality when host can provide the capability. vgt_caps is introduced to guest i915 driver to get the vgpu capabilities from the device model. VGT_CAPS_FULL_PPGTT_48BIT is one of the capabilities type which let guest i915 dirver know that the guest 48bit i915 full ppgtt is supported by device model.

Notice that the minor version of pvinfo isn't bumped because of this vgt_caps introduction, due to older guest would be broken by simply increasing the pvinfo version. Although the pvinfo minor version doesn't increase, the compatibility won't be blocked. The compatibility is ensured by checking the value of caps field in pvinfo. Zero means no full ppgtt support and BIT(2) means this feature is provided.

Changes since v1:
- Use u32 instead of uint32_t (Joonas)
- Move VGT_CAPS_FULL_PPGTT introduction to this patch and use #define instead of enum (Joonas)
- Rewrite the vgpu full ppgtt capability checking logic. (Joonas)
- Some coding style refine. (Joonas)

Changes since v2:
- Divide the whole patch set into two separate patch series, with one patch in i915 side to check guest i915 full ppgtt capability and enable it when this capability is supported by the device model, and the other one in gvt side which fixs the blocking issue and enables the device model to provide the capability to guest. And this patch focuses on guest i915 side. (Joonas)
- Change the title from "introduce vgt_caps to pvinfo" to "Enable guest i915 full ppgtt functionality". (Tina)

Change since v3:
- Add some comments about pvinfo caps and version. (Joonas)

Change since v4:
- Tested by Tina Zhang.

Change since v5:
- Add limitation about supporting 32bit full ppgtt.

---
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++++++++++----
 drivers/gpu/drm/i915/i915_pvinfo.h  |  8 +++++++-
 drivers/gpu/drm/i915/i915_vgpu.c    |  7 +++++++
 drivers/gpu/drm/i915/i915_vgpu.h    |  3 +++
 5 files changed, 28 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index ecc5fe3..45a8bef 100644
@@ -1864,6 +1864,7 @@ struct i915_workarounds {
 
 struct i915_virtual_gpu {
 	bool active;
+	u32 caps;
 };
 
 /* used in computing the new watermarks state */
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -4
index 4ff854e..d777405 100644
@@ -141,14 +141,20 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 
 	has_aliasing_ppgtt = dev_priv->info.has_aliasing_ppgtt;
 	has_full_ppgtt = dev_priv->info.has_full_ppgtt;
-	has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt;
 
 	if (intel_vgpu_active(dev_priv)) {
-		/* emulation is too hard */
-		has_full_ppgtt = false;
-		has_full_48bit_ppgtt = false;
+		has_full_ppgtt = intel_vgpu_has_full_ppgtt(dev_priv);
+		/*
+		 * FIXME: There is a limition of vgpu supporting 32bit full
+		 * ppgtt.
+		 */
+		if (enable_ppgtt == 2)
+			enable_ppgtt = 1;
 	}
 
+	has_full_48bit_ppgtt = has_full_ppgtt &&
+		dev_priv->info.has_full_48bit_ppgtt;
+
 	if (!has_aliasing_ppgtt)
 		return 0;
 
drivers/gpu/drm/i915/i915_pvinfo.h +7 -1
index 2cfe96d3..7e958d7 100644
@@ -49,12 +49,18 @@ enum vgt_g2v_type {
 	VGT_G2V_MAX,
 };
 
+/*
+ * VGT capabilities type
+ */
+#define VGT_CAPS_FULL_PPGTT_48BIT	BIT(2)
+
 struct vgt_if {
 	u64 magic;		/* VGT_MAGIC */
 	u16 version_major;
 	u16 version_minor;
 	u32 vgt_id;		/* ID of vGT instance */
-	u32 rsv1[12];		/* pad to offset 0x40 */
+	u32 vgt_caps;		/* VGT capabilities */
+	u32 rsv1[11];		/* pad to offset 0x40 */
 	/*
 	 *  Data structure to describe the balooning info of resources.
 	 *  Each VM can only have one portion of continuous area for now.
drivers/gpu/drm/i915/i915_vgpu.c +7 -0
index cf7a958..e85e27c 100644
@@ -75,10 +75,17 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv)
 		return;
 	}
 
+	dev_priv->vgpu.caps = __raw_i915_read32(dev_priv, vgtif_reg(vgt_caps));
+
 	dev_priv->vgpu.active = true;
 	DRM_INFO("Virtual GPU for Intel GVT-g detected.\n");
 }
 
+bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv)
+{
+	return dev_priv->vgpu.caps & VGT_CAPS_FULL_PPGTT_48BIT;
+}
+
 struct _balloon_info_ {
 	/*
 	 * There are up to 2 regions per mappable/unmappable graphic
drivers/gpu/drm/i915/i915_vgpu.h +3 -0
index 3c3b2d2..b4e04eb 100644
@@ -27,6 +27,9 @@
 #include "i915_pvinfo.h"
 
 void i915_check_vgpu(struct drm_i915_private *dev_priv);
+
+bool intel_vgpu_has_full_ppgtt(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);
 
Signature · 6 lines
2.7.4

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

✗ Fi.CI.BAT: warning for drm/i915: Enable guest i915 48bit full ppgtt functionality

== Series Details ==

== Series Details ==

Series: drm/i915: Enable guest i915 48bit full ppgtt functionality
URL : https://patchwork.freedesktop.org/series/26048/
State : warning

== Summary ==

Series 26048v1 drm/i915: Enable guest i915 48bit full ppgtt functionality
https://patchwork.freedesktop.org/api/1.0/series/26048/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-7560u) fdo#100125
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900) fdo#101516
Test prime_self_import:
        Subgroup basic-llseek-bad:
                pass       -> DMESG-WARN (fi-skl-6700hq)
        Subgroup basic-llseek-size:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#101515
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-skl-6700hq)

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#101516 https://bugs.freedesktop.org/show_bug.cgi?id=101516
fdo#101515 https://bugs.freedesktop.org/show_bug.cgi?id=101515

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:443s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:429s
fi-bsw-n3050     total:278  pass:241  dwarn:1   dfail:0   fail:0   skip:36  time:526s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:503s
fi-byt-j1900     total:278  pass:252  dwarn:2   dfail:0   fail:0   skip:24  time:486s
fi-byt-n2820     total:278  pass:248  dwarn:2   dfail:0   fail:0   skip:28  time:483s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:585s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:436s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:414s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:491s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:474s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:469s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:569s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:586s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:470s
fi-skl-6700hq    total:278  pass:220  dwarn:3   dfail:0   fail:30  skip:24  time:341s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:463s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:483s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:434s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:542s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:406s

3e0add868ae0aa06f3203e3862ea74ab94cab013 drm-tip: 2017y-06m-20d-11h-42m-47s UTC integration manifest eda1ca4 drm/i915: Enable guest i915 48bit full ppgtt functionality

== Logs ==

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

#2 lore raw
In reply to Tina Zhang
Quoted 16 lines · Tina Zhang
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -4
index 4ff854e..d777405 100644
@@ -141,14 +141,20 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 
 	has_aliasing_ppgtt = dev_priv->info.has_aliasing_ppgtt;
 	has_full_ppgtt = dev_priv->info.has_full_ppgtt;
-	has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt;
 
 	if (intel_vgpu_active(dev_priv)) {
-		/* emulation is too hard */
-		has_full_ppgtt = false;
-		has_full_48bit_ppgtt = false;
+		has_full_ppgtt = intel_vgpu_has_full_ppgtt(dev_priv);
+		/*

drivers/gpu/drm/i915/i915_gem_gtt.c int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, · line 157

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -0
+		 * FIXME: There is a limition of vgpu supporting 32bit full
+		 * ppgtt.
+		 */
+		if (enable_ppgtt == 2)
+			enable_ppgtt = 1;
 	}
 
+	has_full_48bit_ppgtt = has_full_ppgtt &&
+		dev_priv->info.has_full_48bit_ppgtt;
+

Does has_full_ppgtt indicate for generic full ppgtt hw feature or just mean for legacy 32bit ppgtt? If later, then has_full_48bit_ppgtt is not requiring has_full_ppgtt, for vgpu they'll be all indicated by caps bits, so we just need to adjust later code like below?

@@ -180,8 +180,8 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
return 0;
}

- if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt)
- return has_full_48bit_ppgtt ? 3 : 2;
+ if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists)
+ return has_full_48bit_ppgtt ? 3 : (has_full_ppgtt ? 2 : 1);
else
return has_aliasing_ppgtt ? 1 : 0;
}

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

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