aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2018-03-26 09:39:48 -0400
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>2018-03-29 08:25:30 -0400
commit1de401c08fa805f3ac34604af1d43f48aeb17eb4 (patch)
treebaab1ea435a5fd6cf03f8e4f34fc1efdc8be4551
parente770276079fd6e1088a255dee182a3c09a2d7aa9 (diff)
drm/i915/perf: enable perf support on ICL
No significant changes from either context offsets, nor report formats, nor register whitelist. v2: Also drop slice/unslice clock ratio changes (Matt) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180326133949.12469-3-lionel.g.landwerlin@intel.com
-rw-r--r--drivers/gpu/drm/i915/Makefile3
-rw-r--r--drivers/gpu/drm/i915/i915_oa_icl.c118
-rw-r--r--drivers/gpu/drm/i915/i915_oa_icl.h34
-rw-r--r--drivers/gpu/drm/i915/i915_perf.c7
4 files changed, 159 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 552e43e9663f..0c79c19223af 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -172,7 +172,8 @@ i915-y += i915_perf.o \
172 i915_oa_glk.o \ 172 i915_oa_glk.o \
173 i915_oa_cflgt2.o \ 173 i915_oa_cflgt2.o \
174 i915_oa_cflgt3.o \ 174 i915_oa_cflgt3.o \
175 i915_oa_cnl.o 175 i915_oa_cnl.o \
176 i915_oa_icl.o
176 177
177ifeq ($(CONFIG_DRM_I915_GVT),y) 178ifeq ($(CONFIG_DRM_I915_GVT),y)
178i915-y += intel_gvt.o 179i915-y += intel_gvt.o
diff --git a/drivers/gpu/drm/i915/i915_oa_icl.c b/drivers/gpu/drm/i915/i915_oa_icl.c
new file mode 100644
index 000000000000..a5667926e3de
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_oa_icl.c
@@ -0,0 +1,118 @@
1/*
2 * Autogenerated file by GPU Top : https://github.com/rib/gputop
3 * DO NOT EDIT manually!
4 *
5 *
6 * Copyright (c) 2015 Intel Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * IN THE SOFTWARE.
26 *
27 */
28
29#include <linux/sysfs.h>
30
31#include "i915_drv.h"
32#include "i915_oa_icl.h"
33
34static const struct i915_oa_reg b_counter_config_test_oa[] = {
35 { _MMIO(0x2740), 0x00000000 },
36 { _MMIO(0x2710), 0x00000000 },
37 { _MMIO(0x2714), 0xf0800000 },
38 { _MMIO(0x2720), 0x00000000 },
39 { _MMIO(0x2724), 0xf0800000 },
40 { _MMIO(0x2770), 0x00000004 },
41 { _MMIO(0x2774), 0x0000ffff },
42 { _MMIO(0x2778), 0x00000003 },
43 { _MMIO(0x277c), 0x0000ffff },
44 { _MMIO(0x2780), 0x00000007 },
45 { _MMIO(0x2784), 0x0000ffff },
46 { _MMIO(0x2788), 0x00100002 },
47 { _MMIO(0x278c), 0x0000fff7 },
48 { _MMIO(0x2790), 0x00100002 },
49 { _MMIO(0x2794), 0x0000ffcf },
50 { _MMIO(0x2798), 0x00100082 },
51 { _MMIO(0x279c), 0x0000ffef },
52 { _MMIO(0x27a0), 0x001000c2 },
53 { _MMIO(0x27a4), 0x0000ffe7 },
54 { _MMIO(0x27a8), 0x00100001 },
55 { _MMIO(0x27ac), 0x0000ffe7 },
56};
57
58static const struct i915_oa_reg flex_eu_config_test_oa[] = {
59};
60
61static const struct i915_oa_reg mux_config_test_oa[] = {
62 { _MMIO(0xd04), 0x00000200 },
63 { _MMIO(0x9840), 0x00000000 },
64 { _MMIO(0x9884), 0x00000000 },
65 { _MMIO(0x9888), 0x10060000 },
66 { _MMIO(0x9888), 0x22060000 },
67 { _MMIO(0x9888), 0x16060000 },
68 { _MMIO(0x9888), 0x24060000 },
69 { _MMIO(0x9888), 0x18060000 },
70 { _MMIO(0x9888), 0x1a060000 },
71 { _MMIO(0x9888), 0x12060000 },
72 { _MMIO(0x9888), 0x14060000 },
73 { _MMIO(0x9888), 0x10060000 },
74 { _MMIO(0x9888), 0x22060000 },
75 { _MMIO(0x9884), 0x00000003 },
76 { _MMIO(0x9888), 0x16130000 },
77 { _MMIO(0x9888), 0x24000001 },
78 { _MMIO(0x9888), 0x0e130056 },
79 { _MMIO(0x9888), 0x10130000 },
80 { _MMIO(0x9888), 0x1a130000 },
81 { _MMIO(0x9888), 0x541f0001 },
82 { _MMIO(0x9888), 0x181f0000 },
83 { _MMIO(0x9888), 0x4c1f0000 },
84 { _MMIO(0x9888), 0x301f0000 },
85};
86
87static ssize_t
88show_test_oa_id(struct device *kdev, struct device_attribute *attr, char *buf)
89{
90 return sprintf(buf, "1\n");
91}
92
93void
94i915_perf_load_test_config_icl(struct drm_i915_private *dev_priv)
95{
96 strlcpy(dev_priv->perf.oa.test_config.uuid,
97 "a291665e-244b-4b76-9b9a-01de9d3c8068",
98 sizeof(dev_priv->perf.oa.test_config.uuid));
99 dev_priv->perf.oa.test_config.id = 1;
100
101 dev_priv->perf.oa.test_config.mux_regs = mux_config_test_oa;
102 dev_priv->perf.oa.test_config.mux_regs_len = ARRAY_SIZE(mux_config_test_oa);
103
104 dev_priv->perf.oa.test_config.b_counter_regs = b_counter_config_test_oa;
105 dev_priv->perf.oa.test_config.b_counter_regs_len = ARRAY_SIZE(b_counter_config_test_oa);
106
107 dev_priv->perf.oa.test_config.flex_regs = flex_eu_config_test_oa;
108 dev_priv->perf.oa.test_config.flex_regs_len = ARRAY_SIZE(flex_eu_config_test_oa);
109
110 dev_priv->perf.oa.test_config.sysfs_metric.name = "a291665e-244b-4b76-9b9a-01de9d3c8068";
111 dev_priv->perf.oa.test_config.sysfs_metric.attrs = dev_priv->perf.oa.test_config.attrs;
112
113 dev_priv->perf.oa.test_config.attrs[0] = &dev_priv->perf.oa.test_config.sysfs_metric_id.attr;
114
115 dev_priv->perf.oa.test_config.sysfs_metric_id.attr.name = "id";
116 dev_priv->perf.oa.test_config.sysfs_metric_id.attr.mode = 0444;
117 dev_priv->perf.oa.test_config.sysfs_metric_id.show = show_test_oa_id;
118}
diff --git a/drivers/gpu/drm/i915/i915_oa_icl.h b/drivers/gpu/drm/i915/i915_oa_icl.h
new file mode 100644
index 000000000000..ae1c24aafe4f
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_oa_icl.h
@@ -0,0 +1,34 @@
1/*
2 * Autogenerated file by GPU Top : https://github.com/rib/gputop
3 * DO NOT EDIT manually!
4 *
5 *
6 * Copyright (c) 2015 Intel Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * IN THE SOFTWARE.
26 *
27 */
28
29#ifndef __I915_OA_ICL_H__
30#define __I915_OA_ICL_H__
31
32extern void i915_perf_load_test_config_icl(struct drm_i915_private *dev_priv);
33
34#endif
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index abaca6edeb71..30444bb3aaa1 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -209,6 +209,7 @@
209#include "i915_oa_cflgt2.h" 209#include "i915_oa_cflgt2.h"
210#include "i915_oa_cflgt3.h" 210#include "i915_oa_cflgt3.h"
211#include "i915_oa_cnl.h" 211#include "i915_oa_cnl.h"
212#include "i915_oa_icl.h"
212 213
213/* HW requires this to be a power of two, between 128k and 16M, though driver 214/* HW requires this to be a power of two, between 128k and 16M, though driver
214 * is currently generally designed assuming the largest 16M size is used such 215 * is currently generally designed assuming the largest 16M size is used such
@@ -1840,7 +1841,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
1840 * be read back from automatically triggered reports, as part of the 1841 * be read back from automatically triggered reports, as part of the
1841 * RPT_ID field. 1842 * RPT_ID field.
1842 */ 1843 */
1843 if (IS_GEN9(dev_priv) || IS_GEN10(dev_priv)) { 1844 if (IS_GEN(dev_priv, 9, 11)) {
1844 I915_WRITE(GEN8_OA_DEBUG, 1845 I915_WRITE(GEN8_OA_DEBUG,
1845 _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS | 1846 _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
1846 GEN9_OA_DEBUG_INCLUDE_CLK_RATIO)); 1847 GEN9_OA_DEBUG_INCLUDE_CLK_RATIO));
@@ -2935,6 +2936,8 @@ void i915_perf_register(struct drm_i915_private *dev_priv)
2935 i915_perf_load_test_config_cflgt3(dev_priv); 2936 i915_perf_load_test_config_cflgt3(dev_priv);
2936 } else if (IS_CANNONLAKE(dev_priv)) { 2937 } else if (IS_CANNONLAKE(dev_priv)) {
2937 i915_perf_load_test_config_cnl(dev_priv); 2938 i915_perf_load_test_config_cnl(dev_priv);
2939 } else if (IS_ICELAKE(dev_priv)) {
2940 i915_perf_load_test_config_icl(dev_priv);
2938 } 2941 }
2939 2942
2940 if (dev_priv->perf.oa.test_config.id == 0) 2943 if (dev_priv->perf.oa.test_config.id == 0)
@@ -3467,7 +3470,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
3467 3470
3468 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16); 3471 dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
3469 } 3472 }
3470 } else if (IS_GEN10(dev_priv)) { 3473 } else if (IS_GEN(dev_priv, 10, 11)) {
3471 dev_priv->perf.oa.ops.is_valid_b_counter_reg = 3474 dev_priv->perf.oa.ops.is_valid_b_counter_reg =
3472 gen7_is_valid_b_counter_addr; 3475 gen7_is_valid_b_counter_addr;
3473 dev_priv->perf.oa.ops.is_valid_mux_reg = 3476 dev_priv->perf.oa.ops.is_valid_mux_reg =