Commit be658e70 authored by CQ Tang's avatar CQ Tang Committed by Matthew Auld

drm/i915: add lmem_size modparam

lmem_size is used to limit the amount of lmem for testing purposes.
Default is to use hardware available lmem size.
Signed-off-by: default avatarCQ Tang <cq.tang@intel.com>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
Reviewed-by: default avatarNirmoy Das <nirmoy.das@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220324143123.348590-2-matthew.auld@intel.com
parent c0c73850
...@@ -123,6 +123,10 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) ...@@ -123,6 +123,10 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
lmem_size = intel_uncore_read64(&i915->uncore, GEN12_GSMBASE); lmem_size = intel_uncore_read64(&i915->uncore, GEN12_GSMBASE);
} }
if (i915->params.lmem_size > 0) {
lmem_size = min_t(resource_size_t, lmem_size,
mul_u32_u32(i915->params.lmem_size, SZ_1M));
}
io_start = pci_resource_start(pdev, 2); io_start = pci_resource_start(pdev, 2);
io_size = min(pci_resource_len(pdev, 2), lmem_size); io_size = min(pci_resource_len(pdev, 2), lmem_size);
......
...@@ -200,6 +200,9 @@ i915_param_named_unsafe(request_timeout_ms, uint, 0600, ...@@ -200,6 +200,9 @@ i915_param_named_unsafe(request_timeout_ms, uint, 0600,
"Default request/fence/batch buffer expiration timeout."); "Default request/fence/batch buffer expiration timeout.");
#endif #endif
i915_param_named_unsafe(lmem_size, uint, 0400,
"Set the lmem size(in MiB) for each region. (default: 0, all memory)");
static __always_inline void _print_param(struct drm_printer *p, static __always_inline void _print_param(struct drm_printer *p,
const char *name, const char *name,
const char *type, const char *type,
......
...@@ -73,6 +73,7 @@ struct drm_printer; ...@@ -73,6 +73,7 @@ struct drm_printer;
param(int, enable_dpcd_backlight, -1, 0600) \ param(int, enable_dpcd_backlight, -1, 0600) \
param(char *, force_probe, CONFIG_DRM_I915_FORCE_PROBE, 0400) \ param(char *, force_probe, CONFIG_DRM_I915_FORCE_PROBE, 0400) \
param(unsigned int, request_timeout_ms, CONFIG_DRM_I915_REQUEST_TIMEOUT, CONFIG_DRM_I915_REQUEST_TIMEOUT ? 0600 : 0) \ param(unsigned int, request_timeout_ms, CONFIG_DRM_I915_REQUEST_TIMEOUT, CONFIG_DRM_I915_REQUEST_TIMEOUT ? 0600 : 0) \
param(unsigned int, lmem_size, 0, 0400) \
/* leave bools at the end to not create holes */ \ /* leave bools at the end to not create holes */ \
param(bool, enable_hangcheck, true, 0600) \ param(bool, enable_hangcheck, true, 0600) \
param(bool, load_detect_test, false, 0600) \ param(bool, load_detect_test, false, 0600) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment