diff options
| author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2018-05-04 16:32:51 -0400 |
|---|---|---|
| committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2018-07-10 19:28:47 -0400 |
| commit | db0c8d8b031d2b5960f6407f7f2ca20e97e00605 (patch) | |
| tree | 81bea7313ceeb9c9199d9ccfbf87763d97d399a0 | |
| parent | 7ab87ede5078af1daccf26951096e16ac16e19cb (diff) | |
x86/gpu: reserve ICL's graphics stolen memory
ICL changes the registers and addresses to 64 bits.
I also briefly looked at implementing an u64 version of the PCI config
read functions, but I concluded this wouldn't be trivial, so it's not
worth doing it for a single user that can't have any racing problems
while reading the register in two separate operations.
v2:
- Scrub the development (non-public) changelog (Joonas).
- Remove the i915.ko bits so this can be easily backported in order
to properly avoid stolen memory even on machines without i915.ko
(Joonas).
- CC stable for the reasons above.
Issue: VIZ-9250
CC: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake definitions.")
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180504203252.28048-1-paulo.r.zanoni@intel.com
| -rw-r--r-- | arch/x86/kernel/early-quirks.c | 18 | ||||
| -rw-r--r-- | include/drm/i915_drm.h | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index bae0d32e327b..72c2cf961d44 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
| @@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func, | |||
| 340 | return bsm & INTEL_BSM_MASK; | 340 | return bsm & INTEL_BSM_MASK; |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | static resource_size_t __init gen11_stolen_base(int num, int slot, int func, | ||
| 344 | resource_size_t stolen_size) | ||
| 345 | { | ||
| 346 | u64 bsm; | ||
| 347 | |||
| 348 | bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0); | ||
| 349 | bsm &= INTEL_BSM_MASK; | ||
| 350 | bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32; | ||
| 351 | |||
| 352 | return bsm; | ||
| 353 | } | ||
| 354 | |||
| 343 | static resource_size_t __init i830_stolen_size(int num, int slot, int func) | 355 | static resource_size_t __init i830_stolen_size(int num, int slot, int func) |
| 344 | { | 356 | { |
| 345 | u16 gmch_ctrl; | 357 | u16 gmch_ctrl; |
| @@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = { | |||
| 500 | .stolen_size = chv_stolen_size, | 512 | .stolen_size = chv_stolen_size, |
| 501 | }; | 513 | }; |
| 502 | 514 | ||
| 515 | static const struct intel_early_ops gen11_early_ops __initconst = { | ||
| 516 | .stolen_base = gen11_stolen_base, | ||
| 517 | .stolen_size = gen9_stolen_size, | ||
| 518 | }; | ||
| 519 | |||
| 503 | static const struct pci_device_id intel_early_ids[] __initconst = { | 520 | static const struct pci_device_id intel_early_ids[] __initconst = { |
| 504 | INTEL_I830_IDS(&i830_early_ops), | 521 | INTEL_I830_IDS(&i830_early_ops), |
| 505 | INTEL_I845G_IDS(&i845_early_ops), | 522 | INTEL_I845G_IDS(&i845_early_ops), |
| @@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = { | |||
| 531 | INTEL_CFL_IDS(&gen9_early_ops), | 548 | INTEL_CFL_IDS(&gen9_early_ops), |
| 532 | INTEL_GLK_IDS(&gen9_early_ops), | 549 | INTEL_GLK_IDS(&gen9_early_ops), |
| 533 | INTEL_CNL_IDS(&gen9_early_ops), | 550 | INTEL_CNL_IDS(&gen9_early_ops), |
| 551 | INTEL_ICL_11_IDS(&gen11_early_ops), | ||
| 534 | }; | 552 | }; |
| 535 | 553 | ||
| 536 | struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0); | 554 | struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0); |
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index c9e5a6621b95..c44703f471b3 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
| @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res; | |||
| 95 | #define I845_TSEG_SIZE_512K (2 << 1) | 95 | #define I845_TSEG_SIZE_512K (2 << 1) |
| 96 | #define I845_TSEG_SIZE_1M (3 << 1) | 96 | #define I845_TSEG_SIZE_1M (3 << 1) |
| 97 | 97 | ||
| 98 | #define INTEL_BSM 0x5c | 98 | #define INTEL_BSM 0x5c |
| 99 | #define INTEL_GEN11_BSM_DW0 0xc0 | ||
| 100 | #define INTEL_GEN11_BSM_DW1 0xc4 | ||
| 99 | #define INTEL_BSM_MASK (-(1u << 20)) | 101 | #define INTEL_BSM_MASK (-(1u << 20)) |
| 100 | 102 | ||
| 101 | #endif /* _I915_DRM_H_ */ | 103 | #endif /* _I915_DRM_H_ */ |
