diff mbox

[v2] drm/i915: Fix GVT-g PVINFO version compatibility check

Message ID 20170608065824.3060-1-zhenyuw@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhenyu Wang June 8, 2017, 6:58 a.m. UTC
Current it's strictly checked if PVINFO version matches 1.0
for GVT-g i915 guest which doesn't help for compatibility at
all and forces GVT-g host can't extend PVINFO easily with version
bump for real compatibility check.

This fixes that to check minimal required PVINFO version instead.

v2:
- drop unneeded version macro
- use only major version for sanity check

Cc: Chuanxiao Dong <chuanxiao.dong@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: stable@vger.kernel.org # v4.10+
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_pvinfo.h | 4 ----
 drivers/gpu/drm/i915/i915_vgpu.c   | 9 ++++-----
 2 files changed, 4 insertions(+), 9 deletions(-)

Comments

Joonas Lahtinen June 8, 2017, 9:17 a.m. UTC | #1
On to, 2017-06-08 at 14:58 +0800, Zhenyu Wang wrote:
> Current it's strictly checked if PVINFO version matches 1.0
> for GVT-g i915 guest which doesn't help for compatibility at
> all and forces GVT-g host can't extend PVINFO easily with version
> bump for real compatibility check.
> 
> This fixes that to check minimal required PVINFO version instead.
> 
> v2:
> - drop unneeded version macro
> - use only major version for sanity check
> 
> Cc: Chuanxiao Dong <chuanxiao.dong@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: stable@vger.kernel.org # v4.10+
> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>

<SNIP>

> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -61,7 +61,7 @@
>  void i915_check_vgpu(struct drm_i915_private *dev_priv)
>  {
>  	uint64_t magic;
> -	uint32_t version;
> +	uint32_t version_major;

Just a final tune, change these types into u64 and u32 respectively.

>  
>  	BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE);
>  
> @@ -69,10 +69,9 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv)
>  	if (magic != VGT_MAGIC)
>  		return;
>  
> -	version = INTEL_VGT_IF_VERSION_ENCODE(
> -		__raw_i915_read16(dev_priv, vgtif_reg(version_major)),
> -		__raw_i915_read16(dev_priv, vgtif_reg(version_minor)));
> -	if (version != INTEL_VGT_IF_VERSION) {
> +	version_major = __raw_i915_read16(dev_priv,
> +					  vgtif_reg(version_major));

This assignment fits a single line now.

Then this is;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h
index c0cb2974caac..928f600c875a 100644
--- a/drivers/gpu/drm/i915/i915_pvinfo.h
+++ b/drivers/gpu/drm/i915/i915_pvinfo.h
@@ -36,10 +36,6 @@ 
 #define VGT_VERSION_MAJOR 1
 #define VGT_VERSION_MINOR 0
 
-#define INTEL_VGT_IF_VERSION_ENCODE(major, minor) ((major) << 16 | (minor))
-#define INTEL_VGT_IF_VERSION \
-	INTEL_VGT_IF_VERSION_ENCODE(VGT_VERSION_MAJOR, VGT_VERSION_MINOR)
-
 /*
  * notifications from guest to vgpu device model
  */
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 3791e9c9392f..25f2a76f17e9 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -61,7 +61,7 @@ 
 void i915_check_vgpu(struct drm_i915_private *dev_priv)
 {
 	uint64_t magic;
-	uint32_t version;
+	uint32_t version_major;
 
 	BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE);
 
@@ -69,10 +69,9 @@  void i915_check_vgpu(struct drm_i915_private *dev_priv)
 	if (magic != VGT_MAGIC)
 		return;
 
-	version = INTEL_VGT_IF_VERSION_ENCODE(
-		__raw_i915_read16(dev_priv, vgtif_reg(version_major)),
-		__raw_i915_read16(dev_priv, vgtif_reg(version_minor)));
-	if (version != INTEL_VGT_IF_VERSION) {
+	version_major = __raw_i915_read16(dev_priv,
+					  vgtif_reg(version_major));
+	if (version_major < VGT_VERSION_MAJOR) {
 		DRM_INFO("VGT interface version mismatch!\n");
 		return;
 	}