Skip to content

Commit 37f1107

Browse files
committed
drm/i915: Add OA unit support for Gen 8+
Enables access to OA unit metrics for BDW, CHV and SKL which all share the same OA unit design. Signed-off-by: Robert Bragg <robert@sixbynine.org>
1 parent f149aa0 commit 37f1107

File tree

7 files changed

+904
-58
lines changed

7 files changed

+904
-58
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,11 @@ struct i915_oa_ops {
20302030
*/
20312031
void (*oa_disable)(struct drm_i915_private *dev_priv);
20322032

2033+
/**
2034+
* @legacy_ctx_switch_unlocked: hook for MI_SET_CONTEXT switches
2035+
*/
2036+
void (*legacy_ctx_switch_unlocked)(struct drm_i915_gem_request *req);
2037+
20332038
/**
20342039
* @read: Copy data from the circular OA buffer into a given userspace
20352040
* buffer.
@@ -2397,6 +2402,7 @@ struct drm_i915_private {
23972402
struct {
23982403
struct i915_vma *vma;
23992404
u8 *vaddr;
2405+
u32 last_ctx_id;
24002406
int format;
24012407
int format_size;
24022408

@@ -2446,6 +2452,8 @@ struct drm_i915_private {
24462452
} oa_buffer;
24472453

24482454
u32 gen7_latched_oastatus1;
2455+
u32 ctx_oactxctrl_off;
2456+
u32 ctx_flexeu0_off;
24492457

24502458
struct i915_oa_ops ops;
24512459
const struct i915_oa_format *oa_formats;
@@ -3512,6 +3520,10 @@ i915_gem_context_lookup_timeline(struct i915_gem_context *ctx,
35123520

35133521
int i915_perf_open_ioctl(struct drm_device *dev, void *data,
35143522
struct drm_file *file);
3523+
void i915_oa_legacy_ctx_switch_notify(struct drm_i915_gem_request *req);
3524+
void i915_oa_update_reg_state(struct intel_engine_cs *engine,
3525+
struct i915_gem_context *ctx,
3526+
uint32_t *reg_state);
35153527

35163528
/* i915_gem_evict.c */
35173529
int __must_check i915_gem_evict_something(struct i915_address_space *vm,

drivers/gpu/drm/i915/i915_gem_context.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ static int do_rcs_switch(struct drm_i915_gem_request *req)
831831
to->engine[RCS].initialised = true;
832832
}
833833

834+
i915_oa_legacy_ctx_switch_notify(req);
835+
834836
return 0;
835837
}
836838

drivers/gpu/drm/i915/i915_gem_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ struct i915_gem_context {
153153
u64 lrc_desc;
154154
int pin_count;
155155
bool initialised;
156+
atomic_t oa_state_dirty;
156157
} engine[I915_NUM_ENGINES];
157158

158159
/** ring_size: size for allocating the per-engine ring buffer */

0 commit comments

Comments
 (0)