Skip to contentSkip to conversation

drm/i915: Enable guest i915 full ppgtt functionality

PATCH Superseded Tina Zhang 4 participants 6 messages May 22, 2017 – Jun 2, 2017

Subsystems (2)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Tina Zhang

author
#0 lore raw

PATCH v3 1/1 drm/i915: Enable guest i915 full ppgtt functionality

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

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)

drivers/gpu/drm/i915/i915_drv.h +1 -0
index 17883a8..a630e5e 100644
@@ -1860,6 +1860,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 +5 -6
index a9d78eb..10629d9 100644
@@ -141,13 +141,12 @@ 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;
-	}
+	if (intel_vgpu_active(dev_priv))
+		has_full_ppgtt = intel_vgpu_has_full_ppgtt(dev_priv);
+
+	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 c0cb297..8dc0664 100644
@@ -53,12 +53,18 @@ enum vgt_g2v_type {
 	VGT_G2V_MAX,
 };
 
+/*
+ * VGT capabilities type
+ */
+#define VGT_CAPS_FULL_PPGTT	BIT(2)
+
 struct vgt_if {
 	u64 magic;		/* VGT_MAGIC */
 	uint16_t version_major;
 	uint16_t 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 4ab8a97..adc4eda 100644
@@ -77,10 +77,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;
+}
+
 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: success for drm/i915: Enable guest i915 full ppgtt functionality

== Series Details ==

== Series Details ==

Series: drm/i915: Enable guest i915 full ppgtt functionality
URL : https://patchwork.freedesktop.org/series/24774/
State : success

== Summary ==

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

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:431s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:590s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:514s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:489s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:422s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:424s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:495s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:466s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:461s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:458s
fi-skl-6700hq    total:278  pass:260  dwarn:1   dfail:0   fail:0   skip:17  time:570s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:462s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:502s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:440s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:532s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:411s

721575dc73081f09673be35c8a7aa82224446cd1 drm-tip: 2017y-05m-22d-06h-50m-56s UTC integration manifest e864a66 drm/i915: Enable guest i915 full ppgtt functionality

== Logs ==

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

maintainer
#2 lore raw
In reply to Tina Zhang
Quoted 23 lines · Tina Zhang

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

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)

Quoted 2 lines

I just noticed there is INTEL_VGT_IF_VERSION when I was looking to make sure that vgt_if is zeroed. Neither the version is incremented nor do I see VGT_PVINFO_PAGE getting zeroed.

What measures are in place to make sure running a new i915 under older DOM0 won't result in corruption?

The dependencies between i915 and gvt are rather tricky, so we'd need INTEL_VGT_IF_VERSION minor increment and also a one line change (zeroing of the new caps register) from gvt code to the same patch, otherwise bisecting will break.

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
#3 lore raw
Quoted 35 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Tuesday, May 30, 2017 4:38 PM
To: Zhang, Tina <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v3] drm/i915: Enable guest i915 full ppgtt functionality

Quoted 26 lines · Tina Zhang

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

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)

Quoted 6 lines
Quoted 2 lines

I just noticed there is INTEL_VGT_IF_VERSION when I was looking to make sure that vgt_if is zeroed. Neither the version is incremented nor do I see VGT_PVINFO_PAGE getting zeroed.

Vgt_if gets its initial values populated by device model through reading hardware registers, named "SW Virtualization Reserved MMIO rang". These registers are always zeros when reading by device model. So, we use this way to initialize the vgt_if with zeros. About the INTEL_VGT_IF_VERSION, agree that we need to doc a Spec to describe it in detail, I guess. But for this vgt_cap register definition, I'm afraid we don't need to bump the version. Because, actually, this register is already defined in the version 1.0, and we just didn't use it before.

Quoted 3 lines

What measures are in place to make sure running a new i915 under older DOM0 won't result in corruption?

This won't be a problem, I guess, as we have already considered this situation. (Thanks for Zhenyu's comments about this problem, before)
I915 with this new patch, will check whether the cap is enabled by device model. As the device model is old, this cap should not be enabled and the i915 in the guest will get value zero, which means device model cannot support the full ppgtt feature. So, in this way, the guest i915 can only use the aliasing ppgtt which is also the only choice for guest i915 before this patch.

Quoted 11 lines

The dependencies between i915 and gvt are rather tricky, so we'd need INTEL_VGT_IF_VERSION minor increment and also a one line change (zeroing of the new caps register) from gvt code to the same patch, otherwise bisecting will break.

Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

#4 lore raw
In reply to Joonas Lahtinen
Quoted 31 lines · Joonas Lahtinen
Quoted 23 lines · Tina Zhang

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

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)

Quoted 2 lines

I just noticed there is INTEL_VGT_IF_VERSION when I was looking to make sure that vgt_if is zeroed. Neither the version is incremented nor do I see VGT_PVINFO_PAGE getting zeroed.

Quoted 8 lines

What measures are in place to make sure running a new i915 under older DOM0 won't result in corruption?

The dependencies between i915 and gvt are rather tricky, so we'd need INTEL_VGT_IF_VERSION minor increment and also a one line change (zeroing of the new caps register) from gvt code to the same patch, otherwise bisecting will break.

That's unfortunate...We can't increment minor now as it would break older guest, need to fix guest pvinfo version compat check, and new caps field is kept as zero if not used, so now depend on that for compatibility.

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

maintainer
#5 lore raw
Quoted 15 lines · Zhenyu Wang
Quoted 5 lines · Joonas Lahtinen

I just noticed there is INTEL_VGT_IF_VERSION when I was looking to make sure that vgt_if is zeroed. Neither the version is incremented nor do I see VGT_PVINFO_PAGE getting zeroed.

Quoted 8 lines

What measures are in place to make sure running a new i915 under older DOM0 won't result in corruption?

The dependencies between i915 and gvt are rather tricky, so we'd need INTEL_VGT_IF_VERSION minor increment and also a one line change (zeroing of the new caps register) from gvt code to the same patch, otherwise bisecting will break.

Quoted 3 lines

That's unfortunate...We can't increment minor now as it would break older guest, need to fix guest pvinfo version compat check, and new caps field is kept as zero if not used, so now depend on that for compatibility.

Point of minor versions is to indicate no breaking, but to detect new features.

But the damage has already been done, so it'd be worthwhile to document this via a comment.

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