clear-pkgs-linux-iot-lts2018/0590-drm-i915-gvt-Add-vgt-i...

96 lines
3.4 KiB
Diff
Raw Permalink Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-10-11 02:06:46 +08:00
From: Mitul Chokshi <mitul.chokshi@intel.com>
Date: Fri, 14 Sep 2018 16:10:18 +0800
Subject: [PATCH] drm/i915/gvt: Add vgt-id in context id
2018-10-11 02:06:46 +08:00
Context id is reported to OABUFFER along with performance statistics
counter. So when performance monitoring code gets the Context id, it
can extract vm-id to identify which VM submitted given context.
v2: define SIZE_CONTEXT_HW_ID even when CONFIG_DRM_I915_GVT is not set,
which fixes RTC defect 192523.
Change-Id: I7e8ed7f741e2f41e2e9da4b7bdd463dfd3e2fe12
Signed-off-by: Mitul Chokshi <mitul.chokshi@intel.com>
Signed-off-by: Daniel van der Wath <danielx.j.van.der.wath@intel.com>
Reviewed-by: Singh, Satyeshwar <satyeshwar.singh@intel.com>
Reviewed-by: Adebisi, YetundeX <yetundex.adebisi@intel.com>
Verified-by: Van Der Wath, Daniel J <danielx.j.van.der.wath@intel.com>
(cherry picked from commit 3e52d8f679eb93c2c1eb7e0f69de34c7d78260d2)
(cherry picked from commit 74c64f2595b70a2079c28bbda960fff7d3e99289)
Reviewed-on:
2018-10-11 02:06:46 +08:00
Reviewed-by: Jiang, Fei <fei.jiang@intel.com>
Reviewed-by: He, Min <min.he@intel.com>
Reviewed-by: Dong, Eddie <eddie.dong@intel.com>
Tested-by: Dong, Eddie <eddie.dong@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 4 ++++
drivers/gpu/drm/i915/i915_gem_context.c | 16 +++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
2020-11-08 15:52:49 +08:00
index 37c80cfecd09..ab2599624db7 100644
2018-10-11 02:06:46 +08:00
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
2020-11-08 15:52:49 +08:00
@@ -1840,6 +1840,10 @@ struct drm_i915_private {
2018-10-11 02:06:46 +08:00
* This is limited in execlists to 21 bits.
*/
struct ida hw_ida;
+
+ /* In case of virtualization, 3-bits of vgt-id will be added to hw_id */
+#define SIZE_CONTEXT_HW_ID_GVT (18)
+#define MAX_CONTEXT_HW_ID_GVT (1<<SIZE_CONTEXT_HW_ID_GVT)
#define MAX_CONTEXT_HW_ID (1<<21) /* exclusive */
#define MAX_GUC_CONTEXT_HW_ID (1 << 20) /* exclusive */
#define GEN11_MAX_CONTEXT_HW_ID (1<<11) /* exclusive */
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
2020-10-27 02:14:06 +08:00
index ef383fd42988..74917976d99e 100644
2018-10-11 02:06:46 +08:00
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -91,6 +91,7 @@
#include "i915_drv.h"
#include "i915_trace.h"
#include "intel_workarounds.h"
+#include "i915_vgpu.h"
#define ALL_L3_SLICES(dev) (1 << NUM_L3_SLICES(dev)) - 1
@@ -138,7 +139,12 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)
2018-10-11 02:06:46 +08:00
list_del(&ctx->link);
- ida_simple_remove(&ctx->i915->contexts.hw_ida, ctx->hw_id);
+ if (intel_vgpu_active(ctx->i915))
+ ida_simple_remove(&ctx->i915->contexts.hw_ida, ctx->hw_id &
+ ~(0x7 << SIZE_CONTEXT_HW_ID_GVT));
+ else
+ ida_simple_remove(&ctx->i915->contexts.hw_ida, ctx->hw_id);
+
kfree_rcu(ctx, rcu);
}
@@ -219,6 +225,8 @@ static int assign_hw_id(struct drm_i915_private *dev_priv, unsigned *out)
2018-10-11 02:06:46 +08:00
*/
if (USES_GUC_SUBMISSION(dev_priv))
max = MAX_GUC_CONTEXT_HW_ID;
+ else if (intel_vgpu_active(dev_priv) || intel_gvt_active(dev_priv))
+ max = MAX_CONTEXT_HW_ID_GVT;
else
max = MAX_CONTEXT_HW_ID;
}
@@ -238,6 +246,12 @@ static int assign_hw_id(struct drm_i915_private *dev_priv, unsigned *out)
2018-10-11 02:06:46 +08:00
return ret;
}
+ if (intel_vgpu_active(dev_priv)) {
+ /* add vgpu_id to context hw_id */
+ ret = ret | (I915_READ(vgtif_reg(vgt_id))
+ << SIZE_CONTEXT_HW_ID_GVT);
+ }
+
*out = ret;
return 0;
}
--
https://clearlinux.org
2018-10-11 02:06:46 +08:00