[Intel-gfx] [PATCH 2/2] drm/i915: Add ring_mask module parameter

Stuart Summers stuart.summers at intel.com
Tue Aug 27 23:14:35 UTC 2019


Add a new module parameter, ring_mask, to allow for disabling
engines during i915 load. This mask follows the intel_engine_id
enum and can be used to hide specified engines from i915 and
from userspace.

Signed-off-by: Stuart Summers <stuart.summers at intel.com>
---
 drivers/gpu/drm/i915/i915_params.c       | 3 +++
 drivers/gpu/drm/i915/i915_params.h       | 3 ++-
 drivers/gpu/drm/i915/intel_device_info.c | 6 ++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 296452f9efe4..6a17fe6ea3a2 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -178,6 +178,9 @@ i915_param_named(enable_gvt, bool, 0400,
 	"Enable support for Intel GVT-g graphics virtualization host support(default:false)");
 #endif
 
+i915_param_named_unsafe(ring_mask, uint, 0400,
+	"Mask of engine rings to enable. (default: all supported engines enabled)");
+
 static __always_inline void _print_param(struct drm_printer *p,
 					 const char *name,
 					 const char *type,
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index d29ade3b7de6..d803bf5faac4 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -77,7 +77,8 @@ struct drm_printer;
 	param(bool, verbose_state_checks, true) \
 	param(bool, nuclear_pageflip, false) \
 	param(bool, enable_dp_mst, true) \
-	param(bool, enable_gvt, false)
+	param(bool, enable_gvt, false) \
+	param(unsigned int, ring_mask, (unsigned int)-1)
 
 #define MEMBER(T, member, ...) T member;
 struct i915_params {
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index caef01b1da23..f833280f2ef6 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -993,10 +993,16 @@ void intel_device_info_init_mmio(struct drm_i915_private *dev_priv)
 	u32 media_fuse;
 	u16 vdbox_mask;
 	u16 vebox_mask;
+	u32 orig_engine_mask = info->engine_mask;
 
 	if (INTEL_GEN(dev_priv) < 11)
 		return;
 
+	info->engine_mask &= i915_modparams.ring_mask;
+	if (info->engine_mask != orig_engine_mask)
+		DRM_WARN("loading with reduced engine mask 0x%x\n",
+			 info->engine_mask);
+
 	media_fuse = ~I915_READ(GEN11_GT_VEBOX_VDBOX_DISABLE);
 
 	vdbox_mask = media_fuse & GEN11_GT_VDBOX_DISABLE_MASK;
-- 
2.22.0



More information about the Intel-gfx mailing list