Lines Matching full:perf

29  * DOC: i915 Perf Overview
35 * This i915 perf interface enables userspace to configure and open a file
51 * DOC: i915 Perf History and Comparison with Core Perf
53 * The interface was initially inspired by the core Perf infrastructure but
56 * i915 perf file descriptors represent a "stream" instead of an "event"; where
57 * a perf event primarily corresponds to a single 64bit value, while a stream
61 * of related counters. Samples for an i915 perf stream capturing OA metrics
64 * selected by the user opening the stream. Perf has support for grouping
68 * i915 perf stream configurations are provided as an array of u64 (key,value)
72 * i915 perf doesn't support exposing metrics via an mmap'd circular buffer.
82 * Issues hit with first prototype based on Core Perf
85 * The first prototype of this driver was based on the core perf
87 * perf, we found we were breaking or working around too many assumptions baked
88 * into perf's currently cpu centric design.
90 * In the end we didn't see a clear benefit to making perf's implementation and
92 * wouldn't be able to use any existing perf based userspace tools.
95 * how userspace will sometimes need to combine i915 perf OA metrics with
99 * a standard vendor/architecture agnostic interface by not using perf.
102 * For posterity, in case we might re-visit trying to adapt core perf to be
106 * - The perf based OA PMU driver broke some significant design assumptions:
108 * Existing perf pmus are used for profiling work on a cpu and we were
111 * registers) to fit with perf's current design, and adding _DEVICE records
118 * buffer to perf's buffer, those bursts of sample writes looked to perf like
121 * Perf supports groups of counters and allows those to be read via
128 * set while perf generally expects counter configurations to be orthogonal.
133 * GPU context to filter metrics on). We avoided using perf's grouping
134 * feature and forwarded OA reports to userspace via perf's 'raw' sample
142 * - As a side note on perf's grouping feature; there was also some concern
156 * event scheduling is a central design idea within perf for allowing
178 * - It felt like our perf based PMU was making some technical compromises
179 * just for the sake of using perf:
185 * cpu id, perf ensures pmu methods will be invoked via an inter process
187 * perf events for a specific cpu. This was workable but it meant the
293 * The default threshold of 100000Hz is based on perf's similar
394 i915_perf_get_oa_config(struct i915_perf *perf, int metrics_set) in i915_perf_get_oa_config() argument
399 oa_config = idr_find(&perf->metrics_idr, metrics_set); in i915_perf_get_oa_config()
476 hw_tail = stream->perf->ops.oa_hw_tail_read(stream); in oa_buffer_check_unlocked()
526 __ratelimit(&stream->perf->tail_pointer_race)) in oa_buffer_check_unlocked()
546 * @stream: An i915-perf stream opened for OA metrics
580 * @stream: An i915-perf stream opened for OA metrics
626 * @stream: An i915-perf stream opened for OA metrics
726 (IS_GEN(stream->perf->i915, 12) ? in gen8_append_oa_reports()
730 if (__ratelimit(&stream->perf->spurious_report_rs)) in gen8_append_oa_reports()
745 if (!(report32[0] & stream->perf->gen8_valid_ctx_bit) && in gen8_append_oa_reports()
746 INTEL_GEN(stream->perf->i915) <= 11) in gen8_append_oa_reports()
780 if (!stream->perf->exclusive_stream->ctx || in gen8_append_oa_reports()
789 if (stream->perf->exclusive_stream->ctx && in gen8_append_oa_reports()
813 oaheadptr = IS_GEN(stream->perf->i915, 12) ? in gen8_append_oa_reports()
835 * @stream: An i915-perf stream opened for OA metrics
866 oastatus_reg = IS_GEN(stream->perf->i915, 12) ? in gen8_oa_read()
894 stream->perf->ops.oa_disable(stream); in gen8_oa_read()
895 stream->perf->ops.oa_enable(stream); in gen8_oa_read()
923 * @stream: An i915-perf stream opened for OA metrics
1015 if (__ratelimit(&stream->perf->spurious_report_rs)) in gen7_append_oa_reports()
1052 * @stream: An i915-perf stream opened for OA metrics
1085 oastatus1 &= ~stream->perf->gen7_latched_oastatus1; in gen7_oa_read()
1116 stream->perf->ops.oa_disable(stream); in gen7_oa_read()
1117 stream->perf->ops.oa_enable(stream); in gen7_oa_read()
1127 stream->perf->gen7_latched_oastatus1 |= in gen7_oa_read()
1136 * @stream: An i915-perf stream opened for OA metrics
1160 * @stream: An i915-perf stream opened for OA metrics
1161 * @file: An i915 perf stream file
1164 * For handling userspace polling on an i915 perf stream opened for OA metrics,
1177 * @stream: An i915-perf stream opened for OA metrics
1192 return stream->perf->ops.read(stream, buf, count, offset); in i915_oa_read()
1238 * @stream: An i915-perf stream opened for OA metrics
1313 drm_dbg(&stream->perf->i915->drm, in oa_get_render_ctx_id()
1323 * @stream: An i915-perf stream opened for OA metrics
1369 struct i915_perf *perf = stream->perf; in i915_oa_stream_destroy() local
1371 BUG_ON(stream != perf->exclusive_stream); in i915_oa_stream_destroy()
1379 WRITE_ONCE(perf->exclusive_stream, NULL); in i915_oa_stream_destroy()
1380 perf->ops.disable_metric_set(stream); in i915_oa_stream_destroy()
1393 if (perf->spurious_report_rs.missed) { in i915_oa_stream_destroy()
1395 perf->spurious_report_rs.missed); in i915_oa_stream_destroy()
1429 stream->perf->gen7_latched_oastatus1 = 0; in gen7_init_oa_buffer()
1556 struct drm_i915_private *i915 = stream->perf->i915; in alloc_oa_buffer()
1567 bo = i915_gem_object_create_shmem(stream->perf->i915, OA_BUFFER_SIZE); in alloc_oa_buffer()
1613 if (INTEL_GEN(stream->perf->i915) >= 8) in save_restore_register()
1629 struct drm_i915_private *i915 = stream->perf->i915; in alloc_noa_wait()
1633 i915_cs_timestamp_ns_to_ticks(i915, atomic64_read(&stream->perf->noa_programming_delay)); in alloc_noa_wait()
1657 * needs to be fixed during the lifetime of the i915/perf stream. in alloc_noa_wait()
1858 obj = i915_gem_object_create_shmem(stream->perf->i915, config_length); in alloc_oa_config_buffer()
1881 *cs++ = (INTEL_GEN(stream->perf->i915) < 8 ? in alloc_oa_config_buffer()
2083 u32 ctx_oactxctrl = stream->perf->ctx_oactxctrl_offset; in gen8_update_reg_state_unlocked()
2084 u32 ctx_flexeu0 = stream->perf->ctx_flexeu0_offset; in gen8_update_reg_state_unlocked()
2250 stream->perf->ctx_oactxctrl_offset + 1, in gen12_configure_oar_context()
2320 struct drm_i915_private *i915 = stream->perf->i915; in oa_configure_all_contexts()
2325 lockdep_assert_held(&stream->perf->lock); in oa_configure_all_contexts()
2406 const u32 ctx_flexeu0 = stream->perf->ctx_flexeu0_offset; in lrc_configure_all_contexts()
2415 stream->perf->ctx_oactxctrl_offset + 1, in lrc_configure_all_contexts()
2472 if (IS_GEN_RANGE(stream->perf->i915, 9, 11)) { in gen8_enable_metric_set()
2663 * @stream: An i915 perf stream opened for OA metrics
2674 stream->perf->ops.oa_enable(stream); in i915_oa_stream_enable()
2690 drm_err(&stream->perf->i915->drm, in gen7_oa_disable()
2702 drm_err(&stream->perf->i915->drm, in gen8_oa_disable()
2715 drm_err(&stream->perf->i915->drm, in gen12_oa_disable()
2723 drm_err(&stream->perf->i915->drm, in gen12_oa_disable()
2729 * @stream: An i915 perf stream opened for OA metrics
2737 stream->perf->ops.oa_disable(stream); in i915_oa_stream_disable()
2761 err = stream->perf->ops.enable_metric_set(stream, active); in i915_perf_stream_enable_sync()
2803 * @stream: An i915 perf stream
2823 struct drm_i915_private *i915 = stream->perf->i915; in i915_oa_stream_init()
2824 struct i915_perf *perf = stream->perf; in i915_oa_stream_init() local
2838 if (!perf->metrics_kobj) { in i915_oa_stream_init()
2844 (INTEL_GEN(perf->i915) < 12 || !stream->ctx)) { in i915_oa_stream_init()
2849 if (!perf->ops.enable_metric_set) { in i915_oa_stream_init()
2859 if (perf->exclusive_stream) { in i915_oa_stream_init()
2874 format_size = perf->oa_formats[props->oa_format].size; in i915_oa_stream_init()
2886 perf->oa_formats[props->oa_format].format; in i915_oa_stream_init()
2906 stream->oa_config = i915_perf_get_oa_config(perf, props->metrics_set); in i915_oa_stream_init()
2934 perf->sseu = props->sseu; in i915_oa_stream_init()
2935 WRITE_ONCE(perf->exclusive_stream, stream); in i915_oa_stream_init()
2955 WRITE_ONCE(perf->exclusive_stream, NULL); in i915_oa_stream_init()
2956 perf->ops.disable_metric_set(stream); in i915_oa_stream_init()
2984 /* perf.exclusive_stream serialised by lrc_configure_all_contexts() */ in i915_oa_init_reg_state()
2985 stream = READ_ONCE(engine->i915->perf.exclusive_stream); in i915_oa_init_reg_state()
2986 if (stream && INTEL_GEN(stream->perf->i915) < 12) in i915_oa_init_reg_state()
2991 * i915_perf_read - handles read() FOP for i915 perf stream FDs
2992 * @file: An i915 perf stream file
3014 struct i915_perf *perf = stream->perf; in i915_perf_read() local
3038 mutex_lock(&perf->lock); in i915_perf_read()
3040 mutex_unlock(&perf->lock); in i915_perf_read()
3043 mutex_lock(&perf->lock); in i915_perf_read()
3045 mutex_unlock(&perf->lock); in i915_perf_read()
3084 * @stream: An i915 perf stream
3085 * @file: An i915 perf stream file
3088 * For handling userspace polling on an i915 perf stream, this calls through to
3092 * Note: The &perf->lock mutex has been taken to serialize
3119 * @file: An i915 perf stream file
3122 * For handling userspace polling on an i915 perf stream, this ensures
3133 struct i915_perf *perf = stream->perf; in i915_perf_poll() local
3136 mutex_lock(&perf->lock); in i915_perf_poll()
3138 mutex_unlock(&perf->lock); in i915_perf_poll()
3145 * @stream: A disabled i915 perf stream
3170 * @stream: An enabled i915 perf stream
3203 config = i915_perf_get_oa_config(stream->perf, metrics_set); in i915_perf_config_locked()
3232 * i915_perf_ioctl - support ioctl() usage with i915 perf stream FDs
3233 * @stream: An i915 perf stream
3237 * Note: The &perf->lock mutex has been taken to serialize
3262 * i915_perf_ioctl - support ioctl() usage with i915 perf stream FDs
3263 * @file: An i915 perf stream file
3277 struct i915_perf *perf = stream->perf; in i915_perf_ioctl() local
3280 mutex_lock(&perf->lock); in i915_perf_ioctl()
3282 mutex_unlock(&perf->lock); in i915_perf_ioctl()
3288 * i915_perf_destroy_locked - destroy an i915 perf stream
3289 * @stream: An i915 perf stream
3291 * Frees all resources associated with the given i915 perf @stream, disabling
3294 * Note: The &perf->lock mutex has been taken to serialize
3314 * @file: An i915 perf stream file
3316 * Cleans up any resources associated with an open i915 perf stream file.
3325 struct i915_perf *perf = stream->perf; in i915_perf_release() local
3327 mutex_lock(&perf->lock); in i915_perf_release()
3329 mutex_unlock(&perf->lock); in i915_perf_release()
3331 /* Release the reference the perf stream kept on the driver. */ in i915_perf_release()
3332 drm_dev_put(&perf->i915->drm); in i915_perf_release()
3354 * @perf: i915 perf instance
3362 * behalf of i915_perf_open_ioctl() with the &perf->lock mutex
3377 i915_perf_open_ioctl_locked(struct i915_perf *perf, in i915_perf_open_ioctl_locked() argument
3395 DRM_DEBUG("Failed to look up context with ID %u for opening perf stream\n", in i915_perf_open_ioctl_locked()
3421 if (IS_HASWELL(perf->i915) && specific_ctx) in i915_perf_open_ioctl_locked()
3423 else if (IS_GEN(perf->i915, 12) && specific_ctx && in i915_perf_open_ioctl_locked()
3444 /* Similar to perf's kernel.perf_paranoid_cpu sysctl option in i915_perf_open_ioctl_locked()
3451 DRM_DEBUG("Insufficient privileges to open i915 perf stream\n"); in i915_perf_open_ioctl_locked()
3462 stream->perf = perf; in i915_perf_open_ioctl_locked()
3496 drm_dev_get(&perf->i915->drm); in i915_perf_open_ioctl_locked()
3512 static u64 oa_exponent_to_ns(struct i915_perf *perf, int exponent) in oa_exponent_to_ns() argument
3514 return i915_cs_timestamp_ticks_to_ns(perf->i915, 2ULL << exponent); in oa_exponent_to_ns()
3519 * @perf: i915 perf instance
3532 static int read_properties_unlocked(struct i915_perf *perf, in read_properties_unlocked() argument
3545 DRM_DEBUG("No i915 perf properties given\n"); in read_properties_unlocked()
3549 /* At the moment we only support using i915-perf on the RCS. */ in read_properties_unlocked()
3550 props->engine = intel_engine_lookup_user(perf->i915, in read_properties_unlocked()
3565 DRM_DEBUG("More i915 perf properties specified than exist\n"); in read_properties_unlocked()
3582 DRM_DEBUG("Unknown i915 perf property ID\n"); in read_properties_unlocked()
3608 if (!perf->oa_formats[value].size) { in read_properties_unlocked()
3629 oa_period = oa_exponent_to_ns(perf, value); in read_properties_unlocked()
3704 * i915-perf stream is expected to be a suitable interface for other forms of
3707 * Note we copy the properties from userspace outside of the i915 perf
3711 * i915_perf_open_ioctl_locked() after taking the &perf->lock
3714 * Return: A newly opened i915 Perf stream file descriptor or negative
3720 struct i915_perf *perf = &to_i915(dev)->perf; in i915_perf_open_ioctl() local
3726 if (!perf->i915) { in i915_perf_open_ioctl()
3727 DRM_DEBUG("i915 perf interface not available for this system\n"); in i915_perf_open_ioctl()
3739 ret = read_properties_unlocked(perf, in i915_perf_open_ioctl()
3746 mutex_lock(&perf->lock); in i915_perf_open_ioctl()
3747 ret = i915_perf_open_ioctl_locked(perf, param, &props, file); in i915_perf_open_ioctl()
3748 mutex_unlock(&perf->lock); in i915_perf_open_ioctl()
3754 * i915_perf_register - exposes i915-perf to userspace
3759 * used to open an i915-perf stream.
3763 struct i915_perf *perf = &i915->perf; in i915_perf_register() local
3765 if (!perf->i915) in i915_perf_register()
3772 mutex_lock(&perf->lock); in i915_perf_register()
3774 perf->metrics_kobj = in i915_perf_register()
3778 mutex_unlock(&perf->lock); in i915_perf_register()
3782 * i915_perf_unregister - hide i915-perf from userspace
3785 * i915-perf state cleanup is split up into an 'unregister' and
3792 struct i915_perf *perf = &i915->perf; in i915_perf_unregister() local
3794 if (!perf->metrics_kobj) in i915_perf_unregister()
3797 kobject_put(perf->metrics_kobj); in i915_perf_unregister()
3798 perf->metrics_kobj = NULL; in i915_perf_unregister()
3801 static bool gen8_is_valid_flex_addr(struct i915_perf *perf, u32 addr) in gen8_is_valid_flex_addr() argument
3832 static bool gen7_is_valid_b_counter_addr(struct i915_perf *perf, u32 addr) in gen7_is_valid_b_counter_addr() argument
3839 static bool gen7_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in gen7_is_valid_mux_addr() argument
3847 static bool gen8_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in gen8_is_valid_mux_addr() argument
3849 return gen7_is_valid_mux_addr(perf, addr) || in gen8_is_valid_mux_addr()
3854 static bool gen10_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in gen10_is_valid_mux_addr() argument
3856 return gen8_is_valid_mux_addr(perf, addr) || in gen10_is_valid_mux_addr()
3861 static bool hsw_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in hsw_is_valid_mux_addr() argument
3863 return gen7_is_valid_mux_addr(perf, addr) || in hsw_is_valid_mux_addr()
3869 static bool chv_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in chv_is_valid_mux_addr() argument
3871 return gen7_is_valid_mux_addr(perf, addr) || in chv_is_valid_mux_addr()
3875 static bool gen12_is_valid_b_counter_addr(struct i915_perf *perf, u32 addr) in gen12_is_valid_b_counter_addr() argument
3886 static bool gen12_is_valid_mux_addr(struct i915_perf *perf, u32 addr) in gen12_is_valid_mux_addr() argument
3916 static struct i915_oa_reg *alloc_oa_regs(struct i915_perf *perf, in alloc_oa_regs() argument
3917 bool (*is_valid)(struct i915_perf *perf, u32 addr), in alloc_oa_regs() argument
3944 if (!is_valid(perf, addr)) { in alloc_oa_regs()
3977 static int create_dynamic_oa_sysfs_entry(struct i915_perf *perf, in create_dynamic_oa_sysfs_entry() argument
3992 return sysfs_create_group(perf->metrics_kobj, in create_dynamic_oa_sysfs_entry()
4006 * Returns: A new allocated config number to be used with the perf open ioctl
4012 struct i915_perf *perf = &to_i915(dev)->perf; in i915_perf_add_config_ioctl() local
4018 if (!perf->i915) { in i915_perf_add_config_ioctl()
4019 DRM_DEBUG("i915 perf interface not available for this system\n"); in i915_perf_add_config_ioctl()
4023 if (!perf->metrics_kobj) { in i915_perf_add_config_ioctl()
4046 oa_config->perf = perf; in i915_perf_add_config_ioctl()
4061 regs = alloc_oa_regs(perf, in i915_perf_add_config_ioctl()
4062 perf->ops.is_valid_mux_reg, in i915_perf_add_config_ioctl()
4074 regs = alloc_oa_regs(perf, in i915_perf_add_config_ioctl()
4075 perf->ops.is_valid_b_counter_reg, in i915_perf_add_config_ioctl()
4086 if (INTEL_GEN(perf->i915) < 8) { in i915_perf_add_config_ioctl()
4093 regs = alloc_oa_regs(perf, in i915_perf_add_config_ioctl()
4094 perf->ops.is_valid_flex_reg, in i915_perf_add_config_ioctl()
4106 err = mutex_lock_interruptible(&perf->metrics_lock); in i915_perf_add_config_ioctl()
4113 idr_for_each_entry(&perf->metrics_idr, tmp, id) { in i915_perf_add_config_ioctl()
4121 err = create_dynamic_oa_sysfs_entry(perf, oa_config); in i915_perf_add_config_ioctl()
4128 oa_config->id = idr_alloc(&perf->metrics_idr, in i915_perf_add_config_ioctl()
4137 mutex_unlock(&perf->metrics_lock); in i915_perf_add_config_ioctl()
4144 mutex_unlock(&perf->metrics_lock); in i915_perf_add_config_ioctl()
4165 struct i915_perf *perf = &to_i915(dev)->perf; in i915_perf_remove_config_ioctl() local
4170 if (!perf->i915) { in i915_perf_remove_config_ioctl()
4171 DRM_DEBUG("i915 perf interface not available for this system\n"); in i915_perf_remove_config_ioctl()
4180 ret = mutex_lock_interruptible(&perf->metrics_lock); in i915_perf_remove_config_ioctl()
4184 oa_config = idr_find(&perf->metrics_idr, *arg); in i915_perf_remove_config_ioctl()
4193 sysfs_remove_group(perf->metrics_kobj, &oa_config->sysfs_metric); in i915_perf_remove_config_ioctl()
4195 idr_remove(&perf->metrics_idr, *arg); in i915_perf_remove_config_ioctl()
4197 mutex_unlock(&perf->metrics_lock); in i915_perf_remove_config_ioctl()
4206 mutex_unlock(&perf->metrics_lock); in i915_perf_remove_config_ioctl()
4253 * i915_perf_init - initialize i915-perf state on module bind
4256 * Initializes i915-perf state without exposing anything to userspace.
4258 * Note: i915-perf initialization is split into an 'init' and 'register'
4263 struct i915_perf *perf = &i915->perf; in i915_perf_init() local
4268 perf->ops.is_valid_b_counter_reg = gen7_is_valid_b_counter_addr; in i915_perf_init()
4269 perf->ops.is_valid_mux_reg = hsw_is_valid_mux_addr; in i915_perf_init()
4270 perf->ops.is_valid_flex_reg = NULL; in i915_perf_init()
4271 perf->ops.enable_metric_set = hsw_enable_metric_set; in i915_perf_init()
4272 perf->ops.disable_metric_set = hsw_disable_metric_set; in i915_perf_init()
4273 perf->ops.oa_enable = gen7_oa_enable; in i915_perf_init()
4274 perf->ops.oa_disable = gen7_oa_disable; in i915_perf_init()
4275 perf->ops.read = gen7_oa_read; in i915_perf_init()
4276 perf->ops.oa_hw_tail_read = gen7_oa_hw_tail_read; in i915_perf_init()
4278 perf->oa_formats = hsw_oa_formats; in i915_perf_init()
4286 perf->ops.read = gen8_oa_read; in i915_perf_init()
4289 perf->oa_formats = gen8_plus_oa_formats; in i915_perf_init()
4291 perf->ops.is_valid_b_counter_reg = in i915_perf_init()
4293 perf->ops.is_valid_mux_reg = in i915_perf_init()
4295 perf->ops.is_valid_flex_reg = in i915_perf_init()
4299 perf->ops.is_valid_mux_reg = in i915_perf_init()
4303 perf->ops.oa_enable = gen8_oa_enable; in i915_perf_init()
4304 perf->ops.oa_disable = gen8_oa_disable; in i915_perf_init()
4305 perf->ops.enable_metric_set = gen8_enable_metric_set; in i915_perf_init()
4306 perf->ops.disable_metric_set = gen8_disable_metric_set; in i915_perf_init()
4307 perf->ops.oa_hw_tail_read = gen8_oa_hw_tail_read; in i915_perf_init()
4310 perf->ctx_oactxctrl_offset = 0x120; in i915_perf_init()
4311 perf->ctx_flexeu0_offset = 0x2ce; in i915_perf_init()
4313 perf->gen8_valid_ctx_bit = BIT(25); in i915_perf_init()
4315 perf->ctx_oactxctrl_offset = 0x128; in i915_perf_init()
4316 perf->ctx_flexeu0_offset = 0x3de; in i915_perf_init()
4318 perf->gen8_valid_ctx_bit = BIT(16); in i915_perf_init()
4321 perf->oa_formats = gen8_plus_oa_formats; in i915_perf_init()
4323 perf->ops.is_valid_b_counter_reg = in i915_perf_init()
4325 perf->ops.is_valid_mux_reg = in i915_perf_init()
4327 perf->ops.is_valid_flex_reg = in i915_perf_init()
4330 perf->ops.oa_enable = gen8_oa_enable; in i915_perf_init()
4331 perf->ops.oa_disable = gen8_oa_disable; in i915_perf_init()
4332 perf->ops.enable_metric_set = gen8_enable_metric_set; in i915_perf_init()
4333 perf->ops.disable_metric_set = gen10_disable_metric_set; in i915_perf_init()
4334 perf->ops.oa_hw_tail_read = gen8_oa_hw_tail_read; in i915_perf_init()
4337 perf->ctx_oactxctrl_offset = 0x128; in i915_perf_init()
4338 perf->ctx_flexeu0_offset = 0x3de; in i915_perf_init()
4340 perf->ctx_oactxctrl_offset = 0x124; in i915_perf_init()
4341 perf->ctx_flexeu0_offset = 0x78e; in i915_perf_init()
4343 perf->gen8_valid_ctx_bit = BIT(16); in i915_perf_init()
4345 perf->oa_formats = gen12_oa_formats; in i915_perf_init()
4347 perf->ops.is_valid_b_counter_reg = in i915_perf_init()
4349 perf->ops.is_valid_mux_reg = in i915_perf_init()
4351 perf->ops.is_valid_flex_reg = in i915_perf_init()
4354 perf->ops.oa_enable = gen12_oa_enable; in i915_perf_init()
4355 perf->ops.oa_disable = gen12_oa_disable; in i915_perf_init()
4356 perf->ops.enable_metric_set = gen12_enable_metric_set; in i915_perf_init()
4357 perf->ops.disable_metric_set = gen12_disable_metric_set; in i915_perf_init()
4358 perf->ops.oa_hw_tail_read = gen12_oa_hw_tail_read; in i915_perf_init()
4360 perf->ctx_flexeu0_offset = 0; in i915_perf_init()
4361 perf->ctx_oactxctrl_offset = 0x144; in i915_perf_init()
4365 if (perf->ops.enable_metric_set) { in i915_perf_init()
4366 mutex_init(&perf->lock); in i915_perf_init()
4371 mutex_init(&perf->metrics_lock); in i915_perf_init()
4372 idr_init(&perf->metrics_idr); in i915_perf_init()
4384 ratelimit_state_init(&perf->spurious_report_rs, 5 * HZ, 10); in i915_perf_init()
4389 ratelimit_set_flags(&perf->spurious_report_rs, in i915_perf_init()
4392 ratelimit_state_init(&perf->tail_pointer_race, in i915_perf_init()
4394 ratelimit_set_flags(&perf->tail_pointer_race, in i915_perf_init()
4397 atomic64_set(&perf->noa_programming_delay, in i915_perf_init()
4400 perf->i915 = i915; in i915_perf_init()
4426 struct i915_perf *perf = &i915->perf; in i915_perf_fini() local
4428 if (!perf->i915) in i915_perf_fini()
4431 idr_for_each(&perf->metrics_idr, destroy_config, perf); in i915_perf_fini()
4432 idr_destroy(&perf->metrics_idr); in i915_perf_fini()
4434 memset(&perf->ops, 0, sizeof(perf->ops)); in i915_perf_fini()
4435 perf->i915 = NULL; in i915_perf_fini()
4439 * i915_perf_ioctl_version - Version of the i915-perf subsystem