[Intel-gfx] [RFC PATCH 132/162] drm/i915/dg1: Add lmem_size modparam

Matthew Auld matthew.auld at intel.com
Fri Nov 27 12:06:48 UTC 2020


From: CQ Tang <cq.tang at intel.com>

lmem_size is used to limit the amount of lmem_size. Default is to
use hardware available lmem size, when setting this modpraram
which is in MB unit.

Signed-off-by: CQ Tang <cq.tang at intel.com>
---
 drivers/gpu/drm/i915/i915_params.c       | 3 +++
 drivers/gpu/drm/i915/i915_params.h       | 1 +
 drivers/gpu/drm/i915/intel_region_lmem.c | 4 ++++
 3 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index bb1ebb6ece95..264de32f3d6a 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -200,6 +200,9 @@ i915_param_named_unsafe(fake_lmem_start, ulong, 0400,
 i915_param_named_unsafe(enable_eviction, bool, 0600,
 	"Enable memcpy based eviction which does not rely on DMA resv refactoring)");
 
+i915_param_named_unsafe(lmem_size, uint, 0400,
+	"Change lmem size for each region. (default: 0, all memory)");
+
 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 87df407d9afb..be6979e7feda 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -71,6 +71,7 @@ struct drm_printer;
 	param(int, enable_dpcd_backlight, -1, 0600) \
 	param(char *, force_probe, CONFIG_DRM_I915_FORCE_PROBE, 0400) \
 	param(unsigned long, fake_lmem_start, 0, 0400) \
+	param(unsigned int, lmem_size, 0, 0400) \
 	/* leave bools at the end to not create holes */ \
 	param(bool, enable_eviction, true, 0600) \
 	param(bool, enable_hangcheck, true, 0600) \
diff --git a/drivers/gpu/drm/i915/intel_region_lmem.c b/drivers/gpu/drm/i915/intel_region_lmem.c
index eafef7034680..1cdb6354b968 100644
--- a/drivers/gpu/drm/i915/intel_region_lmem.c
+++ b/drivers/gpu/drm/i915/intel_region_lmem.c
@@ -196,6 +196,10 @@ setup_lmem(struct drm_i915_private *dev_priv)
 
 	io_start = pci_resource_start(pdev, 2);
 
+	if (dev_priv->params.lmem_size > 0)
+		lmem_size = min_t(resource_size_t, lmem_size,
+				  mul_u32_u32(dev_priv->params.lmem_size, SZ_1M));
+
 	mem = intel_memory_region_create(dev_priv,
 					 0,
 					 lmem_size,
-- 
2.26.2



More information about the Intel-gfx mailing list