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

drm/i915: Remove i915.enable_ppgtt override

Now that we are confident in providing full-ppgtt where supported,
remove the ability to override the context isolation.

v2: Remove faked aliasing-ppgtt for testing as it no longer is accepted.
v3: s/USES/HAS/ to match usage and reject attempts to load the module on
old GVT-g setups that do not provide support for full-ppgtt.
v4: Insulate ABI ppGTT values from our internal enum (later plans
involve moving ppGTT depth out of the enum, thus potentially breaking
ABI unless we document the current values).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Zhi Wang <zhi.a.wang@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180926201222.5643-1-chris@chris-wilson.co.uk

+71 -197
+10 -12
drivers/gpu/drm/i915/i915_drv.c
··· 345 345 value = HAS_WT(dev_priv); 346 346 break; 347 347 case I915_PARAM_HAS_ALIASING_PPGTT: 348 - value = USES_PPGTT(dev_priv); 348 + value = min_t(int, INTEL_PPGTT(dev_priv), I915_GEM_PPGTT_FULL); 349 349 break; 350 350 case I915_PARAM_HAS_SEMAPHORES: 351 351 value = HAS_LEGACY_SEMAPHORES(dev_priv); ··· 1049 1049 1050 1050 static void intel_sanitize_options(struct drm_i915_private *dev_priv) 1051 1051 { 1052 - /* 1053 - * i915.enable_ppgtt is read-only, so do an early pass to validate the 1054 - * user's requested state against the hardware/driver capabilities. We 1055 - * do this now so that we can print out any log messages once rather 1056 - * than every time we check intel_enable_ppgtt(). 1057 - */ 1058 - i915_modparams.enable_ppgtt = 1059 - intel_sanitize_enable_ppgtt(dev_priv, 1060 - i915_modparams.enable_ppgtt); 1061 - DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915_modparams.enable_ppgtt); 1062 - 1063 1052 intel_gvt_sanitize_options(dev_priv); 1064 1053 } 1065 1054 ··· 1362 1373 return -ENODEV; 1363 1374 1364 1375 intel_device_info_runtime_init(mkwrite_device_info(dev_priv)); 1376 + 1377 + if (HAS_PPGTT(dev_priv)) { 1378 + if (intel_vgpu_active(dev_priv) && 1379 + !intel_vgpu_has_full_48bit_ppgtt(dev_priv)) { 1380 + i915_report_error(dev_priv, 1381 + "incompatible vGPU found, support for isolated ppGTT required\n"); 1382 + return -ENXIO; 1383 + } 1384 + } 1365 1385 1366 1386 intel_sanitize_options(dev_priv); 1367 1387
+8 -6
drivers/gpu/drm/i915/i915_drv.h
··· 2597 2597 2598 2598 #define HAS_EXECLISTS(dev_priv) HAS_LOGICAL_RING_CONTEXTS(dev_priv) 2599 2599 2600 - #define USES_PPGTT(dev_priv) (i915_modparams.enable_ppgtt) 2601 - #define USES_FULL_PPGTT(dev_priv) (i915_modparams.enable_ppgtt >= 2) 2602 - #define USES_FULL_48BIT_PPGTT(dev_priv) (i915_modparams.enable_ppgtt == 3) 2600 + #define INTEL_PPGTT(dev_priv) (INTEL_INFO(dev_priv)->ppgtt) 2601 + #define HAS_PPGTT(dev_priv) \ 2602 + (INTEL_PPGTT(dev_priv) != INTEL_PPGTT_NONE) 2603 + #define HAS_FULL_PPGTT(dev_priv) \ 2604 + (INTEL_PPGTT(dev_priv) >= INTEL_PPGTT_FULL) 2605 + #define HAS_FULL_48BIT_PPGTT(dev_priv) \ 2606 + (INTEL_PPGTT(dev_priv) >= INTEL_PPGTT_FULL_4LVL) 2607 + 2603 2608 #define HAS_PAGE_SIZES(dev_priv, sizes) ({ \ 2604 2609 GEM_BUG_ON((sizes) == 0); \ 2605 2610 ((sizes) & ~(dev_priv)->info.page_sizes) == 0; \ ··· 2751 2746 { 2752 2747 return IS_BROXTON(dev_priv) && intel_vtd_active(); 2753 2748 } 2754 - 2755 - int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, 2756 - int enable_ppgtt); 2757 2749 2758 2750 /* i915_drv.c */ 2759 2751 void __printf(3, 4)
+1 -1
drivers/gpu/drm/i915/i915_gem_context.c
··· 414 414 if (IS_ERR(ctx)) 415 415 return ctx; 416 416 417 - if (USES_FULL_PPGTT(dev_priv)) { 417 + if (HAS_FULL_PPGTT(dev_priv)) { 418 418 struct i915_hw_ppgtt *ppgtt; 419 419 420 420 ppgtt = i915_ppgtt_create(dev_priv, file_priv);
+7 -81
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 133 133 i915->ggtt.invalidate(i915); 134 134 } 135 135 136 - int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, 137 - int enable_ppgtt) 138 - { 139 - bool has_full_ppgtt; 140 - bool has_full_48bit_ppgtt; 141 - 142 - if (!dev_priv->info.has_aliasing_ppgtt) 143 - return 0; 144 - 145 - has_full_ppgtt = dev_priv->info.has_full_ppgtt; 146 - has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt; 147 - 148 - if (intel_vgpu_active(dev_priv)) { 149 - /* GVT-g has no support for 32bit ppgtt */ 150 - has_full_ppgtt = false; 151 - has_full_48bit_ppgtt = intel_vgpu_has_full_48bit_ppgtt(dev_priv); 152 - } 153 - 154 - /* 155 - * We don't allow disabling PPGTT for gen8+ as it's a requirement for 156 - * execlists, the sole mechanism available to submit work. 157 - */ 158 - if (enable_ppgtt == 0 && !HAS_EXECLISTS(dev_priv)) 159 - return 0; 160 - 161 - if (enable_ppgtt == 1) 162 - return 1; 163 - 164 - if (enable_ppgtt == 2 && has_full_ppgtt) 165 - return 2; 166 - 167 - if (enable_ppgtt == 3 && has_full_48bit_ppgtt) 168 - return 3; 169 - 170 - /* Disable ppgtt on SNB if VT-d is on. */ 171 - if (IS_GEN6(dev_priv) && intel_vtd_active()) { 172 - DRM_INFO("Disabling PPGTT because VT-d is on\n"); 173 - return 0; 174 - } 175 - 176 - if (has_full_48bit_ppgtt) 177 - return 3; 178 - 179 - if (has_full_ppgtt) 180 - return 2; 181 - 182 - return 1; 183 - } 184 - 185 136 static int ppgtt_bind_vma(struct i915_vma *vma, 186 137 enum i915_cache_level cache_level, 187 138 u32 unused) ··· 1598 1647 ppgtt->vm.i915 = i915; 1599 1648 ppgtt->vm.dma = &i915->drm.pdev->dev; 1600 1649 1601 - ppgtt->vm.total = USES_FULL_48BIT_PPGTT(i915) ? 1650 + ppgtt->vm.total = HAS_FULL_48BIT_PPGTT(i915) ? 1602 1651 1ULL << 48 : 1603 1652 1ULL << 32; 1604 1653 ··· 1733 1782 ppgtt->pd_addr + pde); 1734 1783 } 1735 1784 1736 - static void gen8_ppgtt_enable(struct drm_i915_private *dev_priv) 1737 - { 1738 - struct intel_engine_cs *engine; 1739 - enum intel_engine_id id; 1740 - 1741 - for_each_engine(engine, dev_priv, id) { 1742 - u32 four_level = USES_FULL_48BIT_PPGTT(dev_priv) ? 1743 - GEN8_GFX_PPGTT_48B : 0; 1744 - I915_WRITE(RING_MODE_GEN7(engine), 1745 - _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE | four_level)); 1746 - } 1747 - } 1748 - 1749 1785 static void gen7_ppgtt_enable(struct drm_i915_private *dev_priv) 1750 1786 { 1751 1787 struct intel_engine_cs *engine; ··· 1772 1834 ecochk = I915_READ(GAM_ECOCHK); 1773 1835 I915_WRITE(GAM_ECOCHK, ecochk | ECOCHK_SNB_BIT | ECOCHK_PPGTT_CACHE64B); 1774 1836 1775 - I915_WRITE(GFX_MODE, _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)); 1837 + if (HAS_PPGTT(dev_priv)) /* may be disabled for VT-d */ 1838 + I915_WRITE(GFX_MODE, _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)); 1776 1839 } 1777 1840 1778 1841 /* PPGTT support for Sandybdrige/Gen6 and later */ ··· 2176 2237 { 2177 2238 gtt_write_workarounds(dev_priv); 2178 2239 2179 - /* In the case of execlists, PPGTT is enabled by the context descriptor 2180 - * and the PDPs are contained within the context itself. We don't 2181 - * need to do anything here. */ 2182 - if (HAS_LOGICAL_RING_CONTEXTS(dev_priv)) 2183 - return 0; 2184 - 2185 - if (!USES_PPGTT(dev_priv)) 2186 - return 0; 2187 - 2188 2240 if (IS_GEN6(dev_priv)) 2189 2241 gen6_ppgtt_enable(dev_priv); 2190 2242 else if (IS_GEN7(dev_priv)) 2191 2243 gen7_ppgtt_enable(dev_priv); 2192 - else if (INTEL_GEN(dev_priv) >= 8) 2193 - gen8_ppgtt_enable(dev_priv); 2194 - else 2195 - MISSING_CASE(INTEL_GEN(dev_priv)); 2196 2244 2197 2245 return 0; 2198 2246 } ··· 2878 2952 /* And finally clear the reserved guard page */ 2879 2953 ggtt->vm.clear_range(&ggtt->vm, ggtt->vm.total - PAGE_SIZE, PAGE_SIZE); 2880 2954 2881 - if (USES_PPGTT(dev_priv) && !USES_FULL_PPGTT(dev_priv)) { 2955 + if (INTEL_PPGTT(dev_priv) == INTEL_PPGTT_ALIASING) { 2882 2956 ret = i915_gem_init_aliasing_ppgtt(dev_priv); 2883 2957 if (ret) 2884 2958 goto err; ··· 3201 3275 ppat->match = bdw_private_pat_match; 3202 3276 ppat->clear_value = GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3); 3203 3277 3204 - if (!USES_PPGTT(ppat->i915)) { 3278 + if (!HAS_PPGTT(ppat->i915)) { 3205 3279 /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry, 3206 3280 * so RTL will always use the value corresponding to 3207 3281 * pat_sel = 000". ··· 3328 3402 ggtt->vm.cleanup = gen6_gmch_remove; 3329 3403 ggtt->vm.insert_page = gen8_ggtt_insert_page; 3330 3404 ggtt->vm.clear_range = nop_clear_range; 3331 - if (!USES_FULL_PPGTT(dev_priv) || intel_scanout_needs_vtd_wa(dev_priv)) 3405 + if (intel_scanout_needs_vtd_wa(dev_priv)) 3332 3406 ggtt->vm.clear_range = gen8_ggtt_clear_range; 3333 3407 3334 3408 ggtt->vm.insert_entries = gen8_ggtt_insert_entries; ··· 3535 3609 /* Only VLV supports read-only GGTT mappings */ 3536 3610 ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv); 3537 3611 3538 - if (!HAS_LLC(dev_priv) && !USES_PPGTT(dev_priv)) 3612 + if (!HAS_LLC(dev_priv) && !HAS_PPGTT(dev_priv)) 3539 3613 ggtt->vm.mm.color_adjust = i915_gtt_color_adjust; 3540 3614 mutex_unlock(&dev_priv->drm.struct_mutex); 3541 3615
+2 -2
drivers/gpu/drm/i915/i915_gpu_error.c
··· 474 474 err_printf(m, " SYNC_2: 0x%08x\n", 475 475 ee->semaphore_mboxes[2]); 476 476 } 477 - if (USES_PPGTT(m->i915)) { 477 + if (HAS_PPGTT(m->i915)) { 478 478 err_printf(m, " GFX_MODE: 0x%08x\n", ee->vm_info.gfx_mode); 479 479 480 480 if (INTEL_GEN(m->i915) >= 8) { ··· 1230 1230 ee->reset_count = i915_reset_engine_count(&dev_priv->gpu_error, 1231 1231 engine); 1232 1232 1233 - if (USES_PPGTT(dev_priv)) { 1233 + if (HAS_PPGTT(dev_priv)) { 1234 1234 int i; 1235 1235 1236 1236 ee->vm_info.gfx_mode = I915_READ(RING_MODE_GEN7(engine));
-4
drivers/gpu/drm/i915/i915_params.c
··· 82 82 "WARNING: Disabling this can cause system wide hangs. " 83 83 "(default: true)"); 84 84 85 - i915_param_named_unsafe(enable_ppgtt, int, 0400, 86 - "Override PPGTT usage. " 87 - "(-1=auto [default], 0=disabled, 1=aliasing, 2=full, 3=full with extended address space)"); 88 - 89 85 i915_param_named_unsafe(enable_psr, int, 0600, 90 86 "Enable PSR " 91 87 "(0=disabled, 1=enabled) "
-1
drivers/gpu/drm/i915/i915_params.h
··· 41 41 param(int, vbt_sdvo_panel_type, -1) \ 42 42 param(int, enable_dc, -1) \ 43 43 param(int, enable_fbc, -1) \ 44 - param(int, enable_ppgtt, -1) \ 45 44 param(int, enable_psr, -1) \ 46 45 param(int, disable_power_well, -1) \ 47 46 param(int, enable_ips, 1) \
+6 -11
drivers/gpu/drm/i915/i915_pci.c
··· 252 252 .has_llc = 1, \ 253 253 .has_rc6 = 1, \ 254 254 .has_rc6p = 1, \ 255 - .has_aliasing_ppgtt = 1, \ 255 + .ppgtt = INTEL_PPGTT_ALIASING, \ 256 256 GEN_DEFAULT_PIPEOFFSETS, \ 257 257 GEN_DEFAULT_PAGE_SIZES, \ 258 258 CURSOR_OFFSETS ··· 297 297 .has_llc = 1, \ 298 298 .has_rc6 = 1, \ 299 299 .has_rc6p = 1, \ 300 - .has_aliasing_ppgtt = 1, \ 301 - .has_full_ppgtt = 1, \ 300 + .ppgtt = INTEL_PPGTT_FULL, \ 302 301 GEN_DEFAULT_PIPEOFFSETS, \ 303 302 GEN_DEFAULT_PAGE_SIZES, \ 304 303 IVB_CURSOR_OFFSETS ··· 350 351 .has_rc6 = 1, 351 352 .has_gmch_display = 1, 352 353 .has_hotplug = 1, 353 - .has_aliasing_ppgtt = 1, 354 - .has_full_ppgtt = 1, 354 + .ppgtt = INTEL_PPGTT_FULL, 355 355 .has_snoop = true, 356 356 .has_coherent_ggtt = false, 357 357 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, ··· 397 399 .page_sizes = I915_GTT_PAGE_SIZE_4K | \ 398 400 I915_GTT_PAGE_SIZE_2M, \ 399 401 .has_logical_ring_contexts = 1, \ 400 - .has_full_48bit_ppgtt = 1, \ 402 + .ppgtt = INTEL_PPGTT_FULL_4LVL, \ 401 403 .has_64bit_reloc = 1, \ 402 404 .has_reset_engine = 1 403 405 ··· 441 443 .has_rc6 = 1, 442 444 .has_logical_ring_contexts = 1, 443 445 .has_gmch_display = 1, 444 - .has_aliasing_ppgtt = 1, 445 - .has_full_ppgtt = 1, 446 + .ppgtt = INTEL_PPGTT_FULL, 446 447 .has_reset_engine = 1, 447 448 .has_snoop = true, 448 449 .has_coherent_ggtt = false, ··· 517 520 .has_logical_ring_contexts = 1, \ 518 521 .has_logical_ring_preemption = 1, \ 519 522 .has_guc = 1, \ 520 - .has_aliasing_ppgtt = 1, \ 521 - .has_full_ppgtt = 1, \ 522 - .has_full_48bit_ppgtt = 1, \ 523 + .ppgtt = INTEL_PPGTT_FULL_4LVL, \ 523 524 .has_reset_engine = 1, \ 524 525 .has_snoop = true, \ 525 526 .has_coherent_ggtt = false, \
+5
drivers/gpu/drm/i915/intel_device_info.c
··· 850 850 else if (INTEL_GEN(dev_priv) >= 11) 851 851 gen11_sseu_info_init(dev_priv); 852 852 853 + if (IS_GEN6(dev_priv) && intel_vtd_active()) { 854 + DRM_INFO("Disabling ppGTT for VT-d support\n"); 855 + info->ppgtt = INTEL_PPGTT_NONE; 856 + } 857 + 853 858 /* Initialize command stream timestamp frequency */ 854 859 info->cs_timestamp_frequency_khz = read_timestamp_frequency(dev_priv); 855 860 }
+10 -3
drivers/gpu/drm/i915/intel_device_info.h
··· 25 25 #ifndef _INTEL_DEVICE_INFO_H_ 26 26 #define _INTEL_DEVICE_INFO_H_ 27 27 28 + #include <uapi/drm/i915_drm.h> 29 + 28 30 #include "intel_display.h" 29 31 30 32 struct drm_printer; ··· 76 74 INTEL_MAX_PLATFORMS 77 75 }; 78 76 77 + enum intel_ppgtt { 78 + INTEL_PPGTT_NONE = I915_GEM_PPGTT_NONE, 79 + INTEL_PPGTT_ALIASING = I915_GEM_PPGTT_ALIASING, 80 + INTEL_PPGTT_FULL = I915_GEM_PPGTT_FULL, 81 + INTEL_PPGTT_FULL_4LVL, 82 + }; 83 + 79 84 #define DEV_INFO_FOR_EACH_FLAG(func) \ 80 85 func(is_mobile); \ 81 86 func(is_lp); \ 82 87 func(is_alpha_support); \ 83 88 /* Keep has_* in alphabetical order */ \ 84 89 func(has_64bit_reloc); \ 85 - func(has_aliasing_ppgtt); \ 86 90 func(has_csr); \ 87 91 func(has_ddi); \ 88 92 func(has_dp_mst); \ 89 93 func(has_reset_engine); \ 90 94 func(has_fbc); \ 91 95 func(has_fpga_dbg); \ 92 - func(has_full_ppgtt); \ 93 - func(has_full_48bit_ppgtt); \ 94 96 func(has_gmch_display); \ 95 97 func(has_guc); \ 96 98 func(has_guc_ct); \ ··· 160 154 enum intel_platform platform; 161 155 u32 platform_mask; 162 156 157 + enum intel_ppgtt ppgtt; 163 158 unsigned int page_sizes; /* page sizes supported by the HW */ 164 159 165 160 u32 display_mmio_offset;
+5 -8
drivers/gpu/drm/i915/intel_lrc.c
··· 418 418 419 419 static u64 execlists_update_context(struct i915_request *rq) 420 420 { 421 + struct i915_hw_ppgtt *ppgtt = rq->gem_context->ppgtt; 421 422 struct intel_context *ce = rq->hw_context; 422 - struct i915_hw_ppgtt *ppgtt = 423 - rq->gem_context->ppgtt ?: rq->i915->mm.aliasing_ppgtt; 424 423 u32 *reg_state = ce->lrc_reg_state; 425 424 426 425 reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); ··· 1375 1376 struct intel_context *ce = to_intel_context(ctx, engine); 1376 1377 1377 1378 lockdep_assert_held(&ctx->i915->drm.struct_mutex); 1378 - GEM_BUG_ON(!(ctx->ppgtt ?: ctx->i915->mm.aliasing_ppgtt)); 1379 + GEM_BUG_ON(!ctx->ppgtt); 1379 1380 1380 1381 if (likely(ce->pin_count++)) 1381 1382 return ce; ··· 2030 2031 * it is unsafe in case of lite-restore (because the ctx is 2031 2032 * not idle). PML4 is allocated during ppgtt init so this is 2032 2033 * not needed in 48-bit.*/ 2033 - if (rq->gem_context->ppgtt && 2034 - (intel_engine_flag(rq->engine) & rq->gem_context->ppgtt->pd_dirty_rings) && 2034 + if ((intel_engine_flag(rq->engine) & rq->gem_context->ppgtt->pd_dirty_rings) && 2035 2035 !i915_vm_is_48bit(&rq->gem_context->ppgtt->vm) && 2036 2036 !intel_vgpu_active(rq->i915)) { 2037 2037 ret = intel_logical_ring_emit_pdps(rq); ··· 2632 2634 struct intel_ring *ring) 2633 2635 { 2634 2636 struct drm_i915_private *dev_priv = engine->i915; 2635 - struct i915_hw_ppgtt *ppgtt = ctx->ppgtt ?: dev_priv->mm.aliasing_ppgtt; 2636 2637 u32 base = engine->mmio_base; 2637 2638 bool rcs = engine->class == RENDER_CLASS; 2638 2639 ··· 2703 2706 CTX_REG(regs, CTX_PDP0_UDW, GEN8_RING_PDP_UDW(engine, 0), 0); 2704 2707 CTX_REG(regs, CTX_PDP0_LDW, GEN8_RING_PDP_LDW(engine, 0), 0); 2705 2708 2706 - if (i915_vm_is_48bit(&ppgtt->vm)) { 2709 + if (i915_vm_is_48bit(&ctx->ppgtt->vm)) { 2707 2710 /* 64b PPGTT (48bit canonical) 2708 2711 * PDP0_DESCRIPTOR contains the base address to PML4 and 2709 2712 * other PDP Descriptors are ignored. 2710 2713 */ 2711 - ASSIGN_CTX_PML4(ppgtt, regs); 2714 + ASSIGN_CTX_PML4(ctx->ppgtt, regs); 2712 2715 } 2713 2716 2714 2717 if (rcs) {
+4 -8
drivers/gpu/drm/i915/selftests/huge_pages.c
··· 1436 1436 * huge-gtt-pages. 1437 1437 */ 1438 1438 1439 - if (!USES_FULL_48BIT_PPGTT(dev_priv)) { 1439 + if (!HAS_FULL_48BIT_PPGTT(dev_priv)) { 1440 1440 pr_info("48b PPGTT not supported, skipping\n"); 1441 1441 return 0; 1442 1442 } ··· 1687 1687 SUBTEST(igt_mock_ppgtt_huge_fill), 1688 1688 SUBTEST(igt_mock_ppgtt_64K), 1689 1689 }; 1690 - int saved_ppgtt = i915_modparams.enable_ppgtt; 1691 1690 struct drm_i915_private *dev_priv; 1692 - struct pci_dev *pdev; 1693 1691 struct i915_hw_ppgtt *ppgtt; 1692 + struct pci_dev *pdev; 1694 1693 int err; 1695 1694 1696 1695 dev_priv = mock_gem_device(); ··· 1697 1698 return -ENOMEM; 1698 1699 1699 1700 /* Pretend to be a device which supports the 48b PPGTT */ 1700 - i915_modparams.enable_ppgtt = 3; 1701 + mkwrite_device_info(dev_priv)->ppgtt = INTEL_PPGTT_FULL_4LVL; 1701 1702 1702 1703 pdev = dev_priv->drm.pdev; 1703 1704 dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(39)); ··· 1730 1731 1731 1732 out_unlock: 1732 1733 mutex_unlock(&dev_priv->drm.struct_mutex); 1733 - 1734 - i915_modparams.enable_ppgtt = saved_ppgtt; 1735 - 1736 1734 drm_dev_put(&dev_priv->drm); 1737 1735 1738 1736 return err; ··· 1749 1753 struct i915_gem_context *ctx; 1750 1754 int err; 1751 1755 1752 - if (!USES_PPGTT(dev_priv)) { 1756 + if (!HAS_PPGTT(dev_priv)) { 1753 1757 pr_info("PPGTT not supported, skipping live-selftests\n"); 1754 1758 return 0; 1755 1759 }
+2 -57
drivers/gpu/drm/i915/selftests/i915_gem_context.c
··· 535 535 IGT_TIMEOUT(end_time); 536 536 LIST_HEAD(objects); 537 537 unsigned long ncontexts, ndwords, dw; 538 - bool first_shared_gtt = true; 539 538 int err = -ENODEV; 540 539 541 540 /* ··· 560 561 struct i915_gem_context *ctx; 561 562 unsigned int id; 562 563 563 - if (first_shared_gtt) { 564 - ctx = __create_hw_context(i915, file->driver_priv); 565 - first_shared_gtt = false; 566 - } else { 567 - ctx = i915_gem_create_context(i915, file->driver_priv); 568 - } 564 + ctx = i915_gem_create_context(i915, file->driver_priv); 569 565 if (IS_ERR(ctx)) { 570 566 err = PTR_ERR(ctx); 571 567 goto out_unlock; ··· 859 865 return err; 860 866 } 861 867 862 - static int fake_aliasing_ppgtt_enable(struct drm_i915_private *i915) 863 - { 864 - struct drm_i915_gem_object *obj; 865 - int err; 866 - 867 - err = i915_gem_init_aliasing_ppgtt(i915); 868 - if (err) 869 - return err; 870 - 871 - list_for_each_entry(obj, &i915->mm.bound_list, mm.link) { 872 - struct i915_vma *vma; 873 - 874 - vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL); 875 - if (IS_ERR(vma)) 876 - continue; 877 - 878 - vma->flags &= ~I915_VMA_LOCAL_BIND; 879 - } 880 - 881 - return 0; 882 - } 883 - 884 - static void fake_aliasing_ppgtt_disable(struct drm_i915_private *i915) 885 - { 886 - i915_gem_fini_aliasing_ppgtt(i915); 887 - } 888 - 889 868 int i915_gem_context_mock_selftests(void) 890 869 { 891 870 static const struct i915_subtest tests[] = { ··· 885 918 SUBTEST(igt_ctx_exec), 886 919 SUBTEST(igt_ctx_readonly), 887 920 }; 888 - bool fake_alias = false; 889 - int err; 890 921 891 922 if (i915_terminally_wedged(&dev_priv->gpu_error)) 892 923 return 0; 893 924 894 - /* Install a fake aliasing gtt for exercise */ 895 - if (USES_PPGTT(dev_priv) && !dev_priv->mm.aliasing_ppgtt) { 896 - mutex_lock(&dev_priv->drm.struct_mutex); 897 - err = fake_aliasing_ppgtt_enable(dev_priv); 898 - mutex_unlock(&dev_priv->drm.struct_mutex); 899 - if (err) 900 - return err; 901 - 902 - GEM_BUG_ON(!dev_priv->mm.aliasing_ppgtt); 903 - fake_alias = true; 904 - } 905 - 906 - err = i915_subtests(tests, dev_priv); 907 - 908 - if (fake_alias) { 909 - mutex_lock(&dev_priv->drm.struct_mutex); 910 - fake_aliasing_ppgtt_disable(dev_priv); 911 - mutex_unlock(&dev_priv->drm.struct_mutex); 912 - } 913 - 914 - return err; 925 + return i915_subtests(tests, dev_priv); 915 926 }
+1 -1
drivers/gpu/drm/i915/selftests/i915_gem_evict.c
··· 351 351 * where the GTT space of the request is separate from the GGTT 352 352 * allocation required to build the request. 353 353 */ 354 - if (!USES_FULL_PPGTT(i915)) 354 + if (!HAS_FULL_PPGTT(i915)) 355 355 return 0; 356 356 357 357 mutex_lock(&i915->drm.struct_mutex);
+2 -2
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
··· 153 153 154 154 /* Allocate a ppggt and try to fill the entire range */ 155 155 156 - if (!USES_PPGTT(dev_priv)) 156 + if (!HAS_PPGTT(dev_priv)) 157 157 return 0; 158 158 159 159 ppgtt = __hw_ppgtt_create(dev_priv); ··· 1001 1001 IGT_TIMEOUT(end_time); 1002 1002 int err; 1003 1003 1004 - if (!USES_FULL_PPGTT(dev_priv)) 1004 + if (!HAS_FULL_PPGTT(dev_priv)) 1005 1005 return 0; 1006 1006 1007 1007 file = mock_file(dev_priv);
+8
include/uapi/drm/i915_drm.h
··· 412 412 int irq_seq; 413 413 } drm_i915_irq_wait_t; 414 414 415 + /* 416 + * Different modes of per-process Graphics Translation Table, 417 + * see I915_PARAM_HAS_ALIASING_PPGTT 418 + */ 419 + #define I915_GEM_PPGTT_NONE 0 420 + #define I915_GEM_PPGTT_ALIASING 1 421 + #define I915_GEM_PPGTT_FULL 2 422 + 415 423 /* Ioctl to query kernel params: 416 424 */ 417 425 #define I915_PARAM_IRQ_ACTIVE 1