Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: use the ICL stolen memory

Now that our stolen memory is already reserved by the x86 subsystem
(since commit "x86/gpu: reserve ICL's graphics stolen memory"), make
use of it.

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: x86@kernel.org
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180504203252.28048-2-paulo.r.zanoni@intel.com

authored by

Paulo Zanoni and committed by
Rodrigo Vivi
185441e0 db0c8d8b

+38 -1
+37 -1
drivers/gpu/drm/i915/i915_gem_stolen.c
··· 344 344 *size = stolen_top - *base; 345 345 } 346 346 347 + static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv, 348 + resource_size_t *base, 349 + resource_size_t *size) 350 + { 351 + u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED); 352 + 353 + DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val); 354 + 355 + *base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK; 356 + 357 + switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) { 358 + case GEN8_STOLEN_RESERVED_1M: 359 + *size = 1024 * 1024; 360 + break; 361 + case GEN8_STOLEN_RESERVED_2M: 362 + *size = 2 * 1024 * 1024; 363 + break; 364 + case GEN8_STOLEN_RESERVED_4M: 365 + *size = 4 * 1024 * 1024; 366 + break; 367 + case GEN8_STOLEN_RESERVED_8M: 368 + *size = 8 * 1024 * 1024; 369 + break; 370 + default: 371 + *size = 8 * 1024 * 1024; 372 + MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK); 373 + } 374 + } 375 + 347 376 int i915_gem_init_stolen(struct drm_i915_private *dev_priv) 348 377 { 349 378 resource_size_t reserved_base, stolen_top; ··· 429 400 gen7_get_stolen_reserved(dev_priv, 430 401 &reserved_base, &reserved_size); 431 402 break; 432 - default: 403 + case 8: 404 + case 9: 405 + case 10: 433 406 if (IS_LP(dev_priv)) 434 407 chv_get_stolen_reserved(dev_priv, 435 408 &reserved_base, &reserved_size); 436 409 else 437 410 bdw_get_stolen_reserved(dev_priv, 438 411 &reserved_base, &reserved_size); 412 + break; 413 + case 11: 414 + default: 415 + icl_get_stolen_reserved(dev_priv, &reserved_base, 416 + &reserved_size); 439 417 break; 440 418 } 441 419
+1
drivers/gpu/drm/i915/i915_reg.h
··· 412 412 #define GEN8_STOLEN_RESERVED_4M (2 << 7) 413 413 #define GEN8_STOLEN_RESERVED_8M (3 << 7) 414 414 #define GEN6_STOLEN_RESERVED_ENABLE (1 << 0) 415 + #define GEN11_STOLEN_RESERVED_ADDR_MASK (0xFFFFFFFFFFFULL << 20) 415 416 416 417 /* VGA stuff */ 417 418