Lines Matching refs:oa_config
89 struct xe_oa_config *oa_config; member
131 struct xe_oa_config *oa_config = in xe_oa_config_release() local
132 container_of(ref, typeof(*oa_config), ref); in xe_oa_config_release()
134 kfree(oa_config->regs); in xe_oa_config_release()
136 kfree_rcu(oa_config, rcu); in xe_oa_config_release()
139 static void xe_oa_config_put(struct xe_oa_config *oa_config) in xe_oa_config_put() argument
141 if (!oa_config) in xe_oa_config_put()
144 kref_put(&oa_config->ref, xe_oa_config_release); in xe_oa_config_put()
147 static struct xe_oa_config *xe_oa_config_get(struct xe_oa_config *oa_config) in xe_oa_config_get() argument
149 return kref_get_unless_zero(&oa_config->ref) ? oa_config : NULL; in xe_oa_config_get()
154 struct xe_oa_config *oa_config; in xe_oa_get_oa_config() local
157 oa_config = idr_find(&oa->metrics_idr, metrics_set); in xe_oa_get_oa_config()
158 if (oa_config) in xe_oa_get_oa_config()
159 oa_config = xe_oa_config_get(oa_config); in xe_oa_get_oa_config()
162 return oa_config; in xe_oa_get_oa_config()
167 xe_oa_config_put(oa_bo->oa_config); in free_oa_config_bo()
637 xe_oa_config_put(stream->oa_config); in xe_oa_free_configs()
866 __xe_oa_alloc_config_buffer(struct xe_oa_stream *stream, struct xe_oa_config *oa_config) in __xe_oa_alloc_config_buffer() argument
876 config_length = num_lri_dwords(oa_config->regs_len); in __xe_oa_alloc_config_buffer()
883 write_cs_mi_lri(bb, oa_config->regs, oa_config->regs_len); in __xe_oa_alloc_config_buffer()
886 oa_bo->oa_config = xe_oa_config_get(oa_config); in __xe_oa_alloc_config_buffer()
896 xe_oa_alloc_config_buffer(struct xe_oa_stream *stream, struct xe_oa_config *oa_config) in xe_oa_alloc_config_buffer() argument
902 if (oa_bo->oa_config == oa_config && in xe_oa_alloc_config_buffer()
903 memcmp(oa_bo->oa_config->uuid, oa_config->uuid, in xe_oa_alloc_config_buffer()
904 sizeof(oa_config->uuid)) == 0) in xe_oa_alloc_config_buffer()
908 oa_bo = __xe_oa_alloc_config_buffer(stream, oa_config); in xe_oa_alloc_config_buffer()
997 return xe_oa_emit_oa_config(stream, stream->oa_config); in xe_oa_enable_metric_set()
1094 long ret = stream->oa_config->id; in xe_oa_config_locked()
1112 if (config != stream->oa_config) { in xe_oa_config_locked()
1115 config = xchg(&stream->oa_config, config); in xe_oa_config_locked()
1388 stream->oa_config = xe_oa_get_oa_config(stream->oa, param->metric_set); in xe_oa_stream_init()
1389 if (!stream->oa_config) { in xe_oa_stream_init()
1435 stream->oa_config->uuid); in xe_oa_stream_init()
2052 struct xe_oa_config *oa_config = in show_dynamic_id() local
2053 container_of(attr, typeof(*oa_config), sysfs_metric_id); in show_dynamic_id()
2055 return sysfs_emit(buf, "%d\n", oa_config->id); in show_dynamic_id()
2059 struct xe_oa_config *oa_config) in create_dynamic_oa_sysfs_entry() argument
2061 sysfs_attr_init(&oa_config->sysfs_metric_id.attr); in create_dynamic_oa_sysfs_entry()
2062 oa_config->sysfs_metric_id.attr.name = "id"; in create_dynamic_oa_sysfs_entry()
2063 oa_config->sysfs_metric_id.attr.mode = 0444; in create_dynamic_oa_sysfs_entry()
2064 oa_config->sysfs_metric_id.show = show_dynamic_id; in create_dynamic_oa_sysfs_entry()
2065 oa_config->sysfs_metric_id.store = NULL; in create_dynamic_oa_sysfs_entry()
2067 oa_config->attrs[0] = &oa_config->sysfs_metric_id.attr; in create_dynamic_oa_sysfs_entry()
2068 oa_config->attrs[1] = NULL; in create_dynamic_oa_sysfs_entry()
2070 oa_config->sysfs_metric.name = oa_config->uuid; in create_dynamic_oa_sysfs_entry()
2071 oa_config->sysfs_metric.attrs = oa_config->attrs; in create_dynamic_oa_sysfs_entry()
2073 return sysfs_create_group(oa->metrics_kobj, &oa_config->sysfs_metric); in create_dynamic_oa_sysfs_entry()
2092 struct xe_oa_config *oa_config, *tmp; in xe_oa_add_config_ioctl() local
2115 oa_config = kzalloc(sizeof(*oa_config), GFP_KERNEL); in xe_oa_add_config_ioctl()
2116 if (!oa_config) in xe_oa_add_config_ioctl()
2119 oa_config->oa = oa; in xe_oa_add_config_ioctl()
2120 kref_init(&oa_config->ref); in xe_oa_add_config_ioctl()
2129 memcpy(oa_config->uuid, arg->uuid, sizeof(arg->uuid)); in xe_oa_add_config_ioctl()
2131 oa_config->regs_len = arg->n_regs; in xe_oa_add_config_ioctl()
2140 oa_config->regs = regs; in xe_oa_add_config_ioctl()
2148 if (!strcmp(tmp->uuid, oa_config->uuid)) { in xe_oa_add_config_ioctl()
2155 err = create_dynamic_oa_sysfs_entry(oa, oa_config); in xe_oa_add_config_ioctl()
2161 oa_config->id = idr_alloc(&oa->metrics_idr, oa_config, 1, 0, GFP_KERNEL); in xe_oa_add_config_ioctl()
2162 if (oa_config->id < 0) { in xe_oa_add_config_ioctl()
2164 err = oa_config->id; in xe_oa_add_config_ioctl()
2170 drm_dbg(&oa->xe->drm, "Added config %s id=%i\n", oa_config->uuid, oa_config->id); in xe_oa_add_config_ioctl()
2172 return oa_config->id; in xe_oa_add_config_ioctl()
2177 xe_oa_config_put(oa_config); in xe_oa_add_config_ioctl()
2192 struct xe_oa_config *oa_config; in xe_oa_remove_config_ioctl() local
2214 oa_config = idr_find(&oa->metrics_idr, arg); in xe_oa_remove_config_ioctl()
2215 if (!oa_config) { in xe_oa_remove_config_ioctl()
2221 WARN_ON(arg != oa_config->id); in xe_oa_remove_config_ioctl()
2223 sysfs_remove_group(oa->metrics_kobj, &oa_config->sysfs_metric); in xe_oa_remove_config_ioctl()
2228 drm_dbg(&oa->xe->drm, "Removed config %s id=%i\n", oa_config->uuid, oa_config->id); in xe_oa_remove_config_ioctl()
2230 xe_oa_config_put(oa_config); in xe_oa_remove_config_ioctl()