aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_perf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 20:48:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 20:48:47 -0500
commit4bf772b14675411a69b3c807f73006de0fe4b649 (patch)
treeb841e3ba0e3429695589cb0ab73871fa12f42c38 /drivers/gpu/drm/i915/i915_perf.c
parent3879ae653a3e98380fe2daf653338830b7ca0097 (diff)
parent24b8ef699e8221d2b7f813adaab13eec053e1507 (diff)
Merge tag 'drm-for-v4.16' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This seems to have been a comparatively quieter merge window, I assume due to holidays etc. The "biggest" change is AMD header cleanups, which merge/remove a bunch of them. The AMD gpu scheduler is now being made generic with the etnaviv driver wanting to reuse the code, hopefully other drivers can go in the same direction. Otherwise it's the usual lots of stuff in i915/amdgpu, not so much stuff elsewhere. Core: - Add .last_close and .output_poll_changed helpers to reduce driver footprints - Fix plane clipping - Improved debug printing support - Add panel orientation property - Update edid derived properties at edid setting - Reduction in fbdev driver footprint - Move amdgpu scheduler into core for other drivers to use. i915: - Selftest and IGT improvements - Fast boot prep work on IPS, pipe config - HW workarounds for Cannonlake, Geminilake - Cannonlake clock and HDMI2.0 fixes - GPU cache invalidation and context switch improvements - Display planes cleanup - New PMU interface for perf queries - New firmware support for KBL/SKL - Geminilake HW workaround for perforamce - Coffeelake stolen memory improvements - GPU reset robustness work - Cannonlake horizontal plane flipping - GVT work amdgpu/radeon: - RV and Vega header file cleanups (lots of lines gone!) - TTM operation context support - 48-bit GPUVM support for Vega/RV - ECC support for Vega - Resizeable BAR support - Multi-display sync support - Enable swapout for reserved BOs during allocation - S3 fixes on Raven - GPU reset cleanup and fixes - 2+1 level GPU page table amdkfd: - GFX7/8 SDMA user queues support - Hardware scheduling for multiple processes - dGPU prep work rcar: - Added R8A7743/5 support - System suspend/resume support sun4i: - Multi-plane support for YUV formats - A83T and LVDS support msm: - Devfreq support for GPU tegra: - Prep work for adding Tegra186 support - Tegra186 HDMI support - HDMI2.0 and zpos support by using generic helpers tilcdc: - Misc fixes omapdrm: - Support memory bandwidth limits - DSI command mode panel cleanups - DMM error handling exynos: - drop the old IPP subdriver. etnaviv: - Occlusion query fixes - Job handling fixes - Prep work for hooking in gpu scheduler armada: - Move closer to atomic modesetting - Allow disabling primary plane if overlay is full screen imx: - Format modifier support - Add tile prefetch to PRE - Runtime PM support for PRG ast: - fix LUT loading" * tag 'drm-for-v4.16' of git://people.freedesktop.org/~airlied/linux: (1471 commits) drm/ast: Load lut in crtc_commit drm: Check for lessee in DROP_MASTER ioctl drm: fix gpu scheduler link order drm/amd/display: Demote error print to debug print when ATOM impl missing dma-buf: fix reservation_object_wait_timeout_rcu once more v2 drm/amdgpu: Avoid leaking PM domain on driver unbind (v2) drm/amd/amdgpu: Add Polaris version check drm/amdgpu: Reenable manual GPU reset from sysfs drm/amdgpu: disable MMHUB power gating on raven drm/ttm: Don't unreserve swapped BOs that were previously reserved drm/ttm: Don't add swapped BOs to swap-LRU list drm/amdgpu: only check for ECC on Vega10 drm/amd/powerplay: Fix smu_table_entry.handle type drm/ttm: add VADDR_FLAG_UPDATED_COUNT to correctly update dma_page global count drm: Fix PANEL_ORIENTATION_QUIRKS breaking the Kconfig DRM menuconfig drm/radeon: fill in rb backend map on evergreen/ni. drm/amdgpu/gfx9: fix ngg enablement to clear gds reserved memory (v2) drm/ttm: only free pages rather than update global memory count together drm/amdgpu: fix CPU based VM updates drm/amdgpu: fix typo in amdgpu_vce_validate_bo ...
Diffstat (limited to 'drivers/gpu/drm/i915/i915_perf.c')
-rw-r--r--drivers/gpu/drm/i915/i915_perf.c153
1 files changed, 90 insertions, 63 deletions
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index d453756ca128..e42d9a4de322 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -207,6 +207,8 @@
207#include "i915_oa_kblgt3.h" 207#include "i915_oa_kblgt3.h"
208#include "i915_oa_glk.h" 208#include "i915_oa_glk.h"
209#include "i915_oa_cflgt2.h" 209#include "i915_oa_cflgt2.h"
210#include "i915_oa_cflgt3.h"
211#include "i915_oa_cnl.h"
210 212
211/* HW requires this to be a power of two, between 128k and 16M, though driver 213/* HW requires this to be a power of two, between 128k and 16M, though driver
212 * is currently generally designed assuming the largest 16M size is used such 214 * is currently generally designed assuming the largest 16M size is used such
@@ -1214,9 +1216,9 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
1214{ 1216{
1215 struct drm_i915_private *dev_priv = stream->dev_priv; 1217 struct drm_i915_private *dev_priv = stream->dev_priv;
1216 1218
1217 if (i915_modparams.enable_execlists) 1219 if (HAS_LOGICAL_RING_CONTEXTS(dev_priv)) {
1218 dev_priv->perf.oa.specific_ctx_id = stream->ctx->hw_id; 1220 dev_priv->perf.oa.specific_ctx_id = stream->ctx->hw_id;
1219 else { 1221 } else {
1220 struct intel_engine_cs *engine = dev_priv->engine[RCS]; 1222 struct intel_engine_cs *engine = dev_priv->engine[RCS];
1221 struct intel_ring *ring; 1223 struct intel_ring *ring;
1222 int ret; 1224 int ret;
@@ -1260,7 +1262,7 @@ static void oa_put_render_ctx_id(struct i915_perf_stream *stream)
1260{ 1262{
1261 struct drm_i915_private *dev_priv = stream->dev_priv; 1263 struct drm_i915_private *dev_priv = stream->dev_priv;
1262 1264
1263 if (i915_modparams.enable_execlists) { 1265 if (HAS_LOGICAL_RING_CONTEXTS(dev_priv)) {
1264 dev_priv->perf.oa.specific_ctx_id = INVALID_CTX_ID; 1266 dev_priv->perf.oa.specific_ctx_id = INVALID_CTX_ID;
1265 } else { 1267 } else {
1266 struct intel_engine_cs *engine = dev_priv->engine[RCS]; 1268 struct intel_engine_cs *engine = dev_priv->engine[RCS];
@@ -1724,10 +1726,9 @@ static int gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr
1724 GFP_KERNEL); 1726 GFP_KERNEL);
1725 } 1727 }
1726 1728
1727 ret = i915_switch_context(req);
1728 i915_add_request(req); 1729 i915_add_request(req);
1729 1730
1730 return ret; 1731 return 0;
1731} 1732}
1732 1733
1733/* 1734/*
@@ -1851,7 +1852,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
1851 * be read back from automatically triggered reports, as part of the 1852 * be read back from automatically triggered reports, as part of the
1852 * RPT_ID field. 1853 * RPT_ID field.
1853 */ 1854 */
1854 if (IS_GEN9(dev_priv)) { 1855 if (IS_GEN9(dev_priv) || IS_GEN10(dev_priv)) {
1855 I915_WRITE(GEN8_OA_DEBUG, 1856 I915_WRITE(GEN8_OA_DEBUG,
1856 _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS | 1857 _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
1857 GEN9_OA_DEBUG_INCLUDE_CLK_RATIO)); 1858 GEN9_OA_DEBUG_INCLUDE_CLK_RATIO));
@@ -1884,6 +1885,16 @@ static void gen8_disable_metric_set(struct drm_i915_private *dev_priv)
1884 1885
1885} 1886}
1886 1887
1888static void gen10_disable_metric_set(struct drm_i915_private *dev_priv)
1889{
1890 /* Reset all contexts' slices/subslices configurations. */
1891 gen8_configure_all_contexts(dev_priv, NULL, false);
1892
1893 /* Make sure we disable noa to save power. */
1894 I915_WRITE(RPM_CONFIG1,
1895 I915_READ(RPM_CONFIG1) & ~GEN10_GT_NOA_ENABLE);
1896}
1897
1887static void gen7_oa_enable(struct drm_i915_private *dev_priv) 1898static void gen7_oa_enable(struct drm_i915_private *dev_priv)
1888{ 1899{
1889 /* 1900 /*
@@ -2679,8 +2690,8 @@ err:
2679 2690
2680static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent) 2691static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent)
2681{ 2692{
2682 return div_u64(1000000000ULL * (2ULL << exponent), 2693 return div64_u64(1000000000ULL * (2ULL << exponent),
2683 dev_priv->perf.oa.timestamp_frequency); 2694 1000ULL * INTEL_INFO(dev_priv)->cs_timestamp_frequency_khz);
2684} 2695}
2685 2696
2686/** 2697/**
@@ -2934,6 +2945,10 @@ void i915_perf_register(struct drm_i915_private *dev_priv)
2934 } else if (IS_COFFEELAKE(dev_priv)) { 2945 } else if (IS_COFFEELAKE(dev_priv)) {
2935 if (IS_CFL_GT2(dev_priv)) 2946 if (IS_CFL_GT2(dev_priv))
2936 i915_perf_load_test_config_cflgt2(dev_priv); 2947 i915_perf_load_test_config_cflgt2(dev_priv);
2948 if (IS_CFL_GT3(dev_priv))
2949 i915_perf_load_test_config_cflgt3(dev_priv);
2950 } else if (IS_CANNONLAKE(dev_priv)) {
2951 i915_perf_load_test_config_cnl(dev_priv);
2937 } 2952 }
2938 2953
2939 if (dev_priv->perf.oa.test_config.id == 0) 2954 if (dev_priv->perf.oa.test_config.id == 0)
@@ -2991,7 +3006,7 @@ static bool gen8_is_valid_flex_addr(struct drm_i915_private *dev_priv, u32 addr)
2991 int i; 3006 int i;
2992 3007
2993 for (i = 0; i < ARRAY_SIZE(flex_eu_regs); i++) { 3008 for (i = 0; i < ARRAY_SIZE(flex_eu_regs); i++) {
2994 if (flex_eu_regs[i].reg == addr) 3009 if (i915_mmio_reg_offset(flex_eu_regs[i]) == addr)
2995 return true; 3010 return true;
2996 } 3011 }
2997 return false; 3012 return false;
@@ -2999,31 +3014,47 @@ static bool gen8_is_valid_flex_addr(struct drm_i915_private *dev_priv, u32 addr)
2999 3014
3000static bool gen7_is_valid_b_counter_addr(struct drm_i915_private *dev_priv, u32 addr) 3015static bool gen7_is_valid_b_counter_addr(struct drm_i915_private *dev_priv, u32 addr)
3001{ 3016{
3002 return (addr >= OASTARTTRIG1.reg && addr <= OASTARTTRIG8.reg) || 3017 return (addr >= i915_mmio_reg_offset(OASTARTTRIG1) &&
3003 (addr >= OAREPORTTRIG1.reg && addr <= OAREPORTTRIG8.reg) || 3018 addr <= i915_mmio_reg_offset(OASTARTTRIG8)) ||
3004 (addr >= OACEC0_0.reg && addr <= OACEC7_1.reg); 3019 (addr >= i915_mmio_reg_offset(OAREPORTTRIG1) &&
3020 addr <= i915_mmio_reg_offset(OAREPORTTRIG8)) ||
3021 (addr >= i915_mmio_reg_offset(OACEC0_0) &&
3022 addr <= i915_mmio_reg_offset(OACEC7_1));
3005} 3023}
3006 3024
3007static bool gen7_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr) 3025static bool gen7_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr)
3008{ 3026{
3009 return addr == HALF_SLICE_CHICKEN2.reg || 3027 return addr == i915_mmio_reg_offset(HALF_SLICE_CHICKEN2) ||
3010 (addr >= MICRO_BP0_0.reg && addr <= NOA_WRITE.reg) || 3028 (addr >= i915_mmio_reg_offset(MICRO_BP0_0) &&
3011 (addr >= OA_PERFCNT1_LO.reg && addr <= OA_PERFCNT2_HI.reg) || 3029 addr <= i915_mmio_reg_offset(NOA_WRITE)) ||
3012 (addr >= OA_PERFMATRIX_LO.reg && addr <= OA_PERFMATRIX_HI.reg); 3030 (addr >= i915_mmio_reg_offset(OA_PERFCNT1_LO) &&
3031 addr <= i915_mmio_reg_offset(OA_PERFCNT2_HI)) ||
3032 (addr >= i915_mmio_reg_offset(OA_PERFMATRIX_LO) &&
3033 addr <= i915_mmio_reg_offset(OA_PERFMATRIX_HI));
3013} 3034}
3014 3035
3015static bool gen8_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr) 3036static bool gen8_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr)
3016{ 3037{
3017 return gen7_is_valid_mux_addr(dev_priv, addr) || 3038 return gen7_is_valid_mux_addr(dev_priv, addr) ||
3018 addr == WAIT_FOR_RC6_EXIT.reg || 3039 addr == i915_mmio_reg_offset(WAIT_FOR_RC6_EXIT) ||
3019 (addr >= RPM_CONFIG0.reg && addr <= NOA_CONFIG(8).reg); 3040 (addr >= i915_mmio_reg_offset(RPM_CONFIG0) &&
3041 addr <= i915_mmio_reg_offset(NOA_CONFIG(8)));
3042}
3043
3044static bool gen10_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr)
3045{
3046 return gen8_is_valid_mux_addr(dev_priv, addr) ||
3047 (addr >= i915_mmio_reg_offset(OA_PERFCNT3_LO) &&
3048 addr <= i915_mmio_reg_offset(OA_PERFCNT4_HI));
3020} 3049}
3021 3050
3022static bool hsw_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr) 3051static bool hsw_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr)
3023{ 3052{
3024 return gen7_is_valid_mux_addr(dev_priv, addr) || 3053 return gen7_is_valid_mux_addr(dev_priv, addr) ||
3025 (addr >= 0x25100 && addr <= 0x2FF90) || 3054 (addr >= 0x25100 && addr <= 0x2FF90) ||
3026 addr == 0x9ec0; 3055 (addr >= i915_mmio_reg_offset(HSW_MBVID2_NOA0) &&
3056 addr <= i915_mmio_reg_offset(HSW_MBVID2_NOA9)) ||
3057 addr == i915_mmio_reg_offset(HSW_MBVID2_MISR0);
3027} 3058}
3028 3059
3029static bool chv_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr) 3060static bool chv_is_valid_mux_addr(struct drm_i915_private *dev_priv, u32 addr)
@@ -3038,14 +3069,14 @@ static uint32_t mask_reg_value(u32 reg, u32 val)
3038 * WaDisableSTUnitPowerOptimization workaround. Make sure the value 3069 * WaDisableSTUnitPowerOptimization workaround. Make sure the value
3039 * programmed by userspace doesn't change this. 3070 * programmed by userspace doesn't change this.
3040 */ 3071 */
3041 if (HALF_SLICE_CHICKEN2.reg == reg) 3072 if (i915_mmio_reg_offset(HALF_SLICE_CHICKEN2) == reg)
3042 val = val & ~_MASKED_BIT_ENABLE(GEN8_ST_PO_DISABLE); 3073 val = val & ~_MASKED_BIT_ENABLE(GEN8_ST_PO_DISABLE);
3043 3074
3044 /* WAIT_FOR_RC6_EXIT has only one bit fullfilling the function 3075 /* WAIT_FOR_RC6_EXIT has only one bit fullfilling the function
3045 * indicated by its name and a bunch of selection fields used by OA 3076 * indicated by its name and a bunch of selection fields used by OA
3046 * configs. 3077 * configs.
3047 */ 3078 */
3048 if (WAIT_FOR_RC6_EXIT.reg == reg) 3079 if (i915_mmio_reg_offset(WAIT_FOR_RC6_EXIT) == reg)
3049 val = val & ~_MASKED_BIT_ENABLE(HSW_WAIT_FOR_RC6_EXIT_ENABLE); 3080 val = val & ~_MASKED_BIT_ENABLE(HSW_WAIT_FOR_RC6_EXIT_ENABLE);
3050 3081
3051 return val; 3082 return val;
@@ -3392,8 +3423,6 @@ static struct ctl_table dev_root[] = {
3392 */ 3423 */
3393void i915_perf_init(struct drm_i915_private *dev_priv) 3424void i915_perf_init(struct drm_i915_private *dev_priv)
3394{ 3425{
3395 dev_priv->perf.oa.timestamp_frequency = 0;
3396
3397 if (IS_HASWELL(dev_priv)) { 3426 if (IS_HASWELL(dev_priv)) {
3398 dev_priv->perf.oa.ops.is_valid_b_counter_reg = 3427 dev_priv->perf.oa.ops.is_valid_b_counter_reg =
3399 gen7_is_valid_b_counter_addr; 3428 gen7_is_valid_b_counter_addr;
@@ -3409,70 +3438,68 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
3409 dev_priv->perf.oa.ops.oa_hw_tail_read = 3438 dev_priv->perf.oa.ops.oa_hw_tail_read =
3410 gen7_oa_hw_tail_read; 3439 gen7_oa_hw_tail_read;
3411 3440
3412 dev_priv->perf.oa.timestamp_frequency = 12500000;
3413
3414 dev_priv->perf.oa.oa_formats = hsw_oa_formats; 3441 dev_priv->perf.oa.oa_formats = hsw_oa_formats;
3415 } else if (i915_modparams.enable_execlists) { 3442 } else if (HAS_LOGICAL_RING_CONTEXTS(dev_priv)) {
3416 /* Note: that although we could theoretically also support the 3443 /* Note: that although we could theoretically also support the
3417 * legacy ringbuffer mode on BDW (and earlier iterations of 3444 * legacy ringbuffer mode on BDW (and earlier iterations of
3418 * this driver, before upstreaming did this) it didn't seem 3445 * this driver, before upstreaming did this) it didn't seem
3419 * worth the complexity to maintain now that BDW+ enable 3446 * worth the complexity to maintain now that BDW+ enable
3420 * execlist mode by default. 3447 * execlist mode by default.
3421 */ 3448 */
3422 dev_priv->perf.oa.ops.is_valid_b_counter_reg = 3449 dev_priv->perf.oa.oa_formats = gen8_plus_oa_formats;
3423 gen7_is_valid_b_counter_addr;
3424 dev_priv->perf.oa.ops.is_valid_mux_reg =
3425 gen8_is_valid_mux_addr;
3426 dev_priv->perf.oa.ops.is_valid_flex_reg =
3427 gen8_is_valid_flex_addr;
3428 3450
3429 dev_priv->perf.oa.ops.init_oa_buffer = gen8_init_oa_buffer; 3451 dev_priv->perf.oa.ops.init_oa_buffer = gen8_init_oa_buffer;
3430 dev_priv->perf.oa.ops.enable_metric_set = gen8_enable_metric_set;
3431 dev_priv->perf.oa.ops.disable_metric_set = gen8_disable_metric_set;
3432 dev_priv->perf.oa.ops.oa_enable = gen8_oa_enable; 3452 dev_priv->perf.oa.ops.oa_enable = gen8_oa_enable;
3433 dev_priv->perf.oa.ops.oa_disable = gen8_oa_disable; 3453 dev_priv->perf.oa.ops.oa_disable = gen8_oa_disable;
3434 dev_priv->perf.oa.ops.read = gen8_oa_read; 3454 dev_priv->perf.oa.ops.read = gen8_oa_read;
3435 dev_priv->perf.oa.ops.oa_hw_tail_read = gen8_oa_hw_tail_read; 3455 dev_priv->perf.oa.ops.oa_hw_tail_read = gen8_oa_hw_tail_read;
3436 3456
3437 dev_priv->perf.oa.oa_formats = gen8_plus_oa_formats; 3457 if (IS_GEN8(dev_priv) || IS_GEN9(dev_priv)) {
3438 3458 dev_priv->perf.oa.ops.is_valid_b_counter_reg =
3439 if (IS_GEN8(dev_priv)) { 3459 gen7_is_valid_b_counter_addr;
3440 dev_priv->perf.oa.ctx_oactxctrl_offset = 0x120; 3460 dev_priv->perf.oa.ops.is_valid_mux_reg =
3441 dev_priv->perf.oa.ctx_flexeu0_offset = 0x2ce; 3461 gen8_is_valid_mux_addr;
3442 3462 dev_priv->perf.oa.ops.is_valid_flex_reg =
3443 dev_priv->perf.oa.timestamp_frequency = 12500000; 3463 gen8_is_valid_flex_addr;
3444 3464
3445 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<25);
3446 if (IS_CHERRYVIEW(dev_priv)) { 3465 if (IS_CHERRYVIEW(dev_priv)) {
3447 dev_priv->perf.oa.ops.is_valid_mux_reg = 3466 dev_priv->perf.oa.ops.is_valid_mux_reg =
3448 chv_is_valid_mux_addr; 3467 chv_is_valid_mux_addr;
3449 } 3468 }
3450 } else if (IS_GEN9(dev_priv)) { 3469
3470 dev_priv->perf.oa.ops.enable_metric_set = gen8_enable_metric_set;
3471 dev_priv->perf.oa.ops.disable_metric_set = gen8_disable_metric_set;
3472
3473 if (IS_GEN8(dev_priv)) {
3474 dev_priv->perf.oa.ctx_oactxctrl_offset = 0x120;
3475 dev_priv->perf.oa.ctx_flexeu0_offset = 0x2ce;
3476
3477 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<25);
3478 } else {
3479 dev_priv->perf.oa.ctx_oactxctrl_offset = 0x128;
3480 dev_priv->perf.oa.ctx_flexeu0_offset = 0x3de;
3481
3482 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
3483 }
3484 } else if (IS_GEN10(dev_priv)) {
3485 dev_priv->perf.oa.ops.is_valid_b_counter_reg =
3486 gen7_is_valid_b_counter_addr;
3487 dev_priv->perf.oa.ops.is_valid_mux_reg =
3488 gen10_is_valid_mux_addr;
3489 dev_priv->perf.oa.ops.is_valid_flex_reg =
3490 gen8_is_valid_flex_addr;
3491
3492 dev_priv->perf.oa.ops.enable_metric_set = gen8_enable_metric_set;
3493 dev_priv->perf.oa.ops.disable_metric_set = gen10_disable_metric_set;
3494
3451 dev_priv->perf.oa.ctx_oactxctrl_offset = 0x128; 3495 dev_priv->perf.oa.ctx_oactxctrl_offset = 0x128;
3452 dev_priv->perf.oa.ctx_flexeu0_offset = 0x3de; 3496 dev_priv->perf.oa.ctx_flexeu0_offset = 0x3de;
3453 3497
3454 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16); 3498 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
3455
3456 switch (dev_priv->info.platform) {
3457 case INTEL_BROXTON:
3458 case INTEL_GEMINILAKE:
3459 dev_priv->perf.oa.timestamp_frequency = 19200000;
3460 break;
3461 case INTEL_SKYLAKE:
3462 case INTEL_KABYLAKE:
3463 case INTEL_COFFEELAKE:
3464 dev_priv->perf.oa.timestamp_frequency = 12000000;
3465 break;
3466 default:
3467 /* Leave timestamp_frequency to 0 so we can
3468 * detect unsupported platforms.
3469 */
3470 break;
3471 }
3472 } 3499 }
3473 } 3500 }
3474 3501
3475 if (dev_priv->perf.oa.timestamp_frequency) { 3502 if (dev_priv->perf.oa.ops.enable_metric_set) {
3476 hrtimer_init(&dev_priv->perf.oa.poll_check_timer, 3503 hrtimer_init(&dev_priv->perf.oa.poll_check_timer,
3477 CLOCK_MONOTONIC, HRTIMER_MODE_REL); 3504 CLOCK_MONOTONIC, HRTIMER_MODE_REL);
3478 dev_priv->perf.oa.poll_check_timer.function = oa_poll_check_timer_cb; 3505 dev_priv->perf.oa.poll_check_timer.function = oa_poll_check_timer_cb;
@@ -3482,8 +3509,8 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
3482 mutex_init(&dev_priv->perf.lock); 3509 mutex_init(&dev_priv->perf.lock);
3483 spin_lock_init(&dev_priv->perf.oa.oa_buffer.ptr_lock); 3510 spin_lock_init(&dev_priv->perf.oa.oa_buffer.ptr_lock);
3484 3511
3485 oa_sample_rate_hard_limit = 3512 oa_sample_rate_hard_limit = 1000 *
3486 dev_priv->perf.oa.timestamp_frequency / 2; 3513 (INTEL_INFO(dev_priv)->cs_timestamp_frequency_khz / 2);
3487 dev_priv->perf.sysctl_header = register_sysctl_table(dev_root); 3514 dev_priv->perf.sysctl_header = register_sysctl_table(dev_root);
3488 3515
3489 mutex_init(&dev_priv->perf.metrics_lock); 3516 mutex_init(&dev_priv->perf.metrics_lock);