diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2021-06-06 07:50:49 +0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2021-06-07 10:59:48 +0300 |
commit | 651e7d48577ae28572b9aa1807a1331d1cd2b61f (patch) | |
tree | 0fe35ad60295113fd7d46015d267086410430d56 /drivers/gpu/drm/i915/i915_perf.c | |
parent | 07960a4cc44ff6f51eacd3a5c2935e73cebbceca (diff) | |
download | linux-651e7d48577ae28572b9aa1807a1331d1cd2b61f.tar.xz |
drm/i915: replace IS_GEN and friends with GRAPHICS_VER
This was done by the following semantic patch:
@@ expression i915; @@
- INTEL_GEN(i915)
+ GRAPHICS_VER(i915)
@@ expression i915; expression E; @@
- INTEL_GEN(i915) >= E
+ GRAPHICS_VER(i915) >= E
@@ expression dev_priv; expression E; @@
- !IS_GEN(dev_priv, E)
+ GRAPHICS_VER(dev_priv) != E
@@ expression dev_priv; expression E; @@
- IS_GEN(dev_priv, E)
+ GRAPHICS_VER(dev_priv) == E
@@
expression dev_priv;
expression from, until;
@@
- IS_GEN_RANGE(dev_priv, from, until)
+ IS_GRAPHICS_VER(dev_priv, from, until)
@def@
expression E;
identifier id =~ "^gen$";
@@
- id = GRAPHICS_VER(E)
+ ver = GRAPHICS_VER(E)
@@
identifier def.id;
@@
- id
+ ver
It also takes care of renaming the variable we assign to GRAPHICS_VER()
so to use "ver" rather than "gen".
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210606045050.103862-2-lucas.demarchi@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_perf.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_perf.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index de8ebc34af0f..6f79db3ef38c 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -719,7 +719,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, * it to userspace... */ reason = ((report32[0] >> OAREPORT_REASON_SHIFT) & - (IS_GEN(stream->perf->i915, 12) ? + (GRAPHICS_VER(stream->perf->i915) == 12 ? OAREPORT_REASON_MASK_EXTENDED : OAREPORT_REASON_MASK)); @@ -734,7 +734,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, * understand that the ID has been squashed by the kernel. */ if (!(report32[0] & stream->perf->gen8_valid_ctx_bit) && - INTEL_GEN(stream->perf->i915) <= 11) + GRAPHICS_VER(stream->perf->i915) <= 11) ctx_id = report32[2] = INVALID_CTX_ID; /* @@ -801,7 +801,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, if (start_offset != *offset) { i915_reg_t oaheadptr; - oaheadptr = IS_GEN(stream->perf->i915, 12) ? + oaheadptr = GRAPHICS_VER(stream->perf->i915) == 12 ? GEN12_OAG_OAHEADPTR : GEN8_OAHEADPTR; spin_lock_irqsave(&stream->oa_buffer.ptr_lock, flags); @@ -854,7 +854,7 @@ static int gen8_oa_read(struct i915_perf_stream *stream, if (drm_WARN_ON(&uncore->i915->drm, !stream->oa_buffer.vaddr)) return -EIO; - oastatus_reg = IS_GEN(stream->perf->i915, 12) ? + oastatus_reg = GRAPHICS_VER(stream->perf->i915) == 12 ? GEN12_OAG_OASTATUS : GEN8_OASTATUS; oastatus = intel_uncore_read(uncore, oastatus_reg); @@ -901,7 +901,7 @@ static int gen8_oa_read(struct i915_perf_stream *stream, intel_uncore_rmw(uncore, oastatus_reg, GEN8_OASTATUS_COUNTER_OVERFLOW | GEN8_OASTATUS_REPORT_LOST, - IS_GEN_RANGE(uncore->i915, 8, 11) ? + IS_GRAPHICS_VER(uncore->i915, 8, 11) ? (GEN8_OASTATUS_HEAD_POINTER_WRAP | GEN8_OASTATUS_TAIL_POINTER_WRAP) : 0); } @@ -1243,7 +1243,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) if (IS_ERR(ce)) return PTR_ERR(ce); - switch (INTEL_GEN(ce->engine->i915)) { + switch (GRAPHICS_VER(ce->engine->i915)) { case 7: { /* * On Haswell we don't do any post processing of the reports @@ -1297,7 +1297,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) } default: - MISSING_CASE(INTEL_GEN(ce->engine->i915)); + MISSING_CASE(GRAPHICS_VER(ce->engine->i915)); } ce->tag = stream->specific_ctx_id; @@ -1602,7 +1602,7 @@ static u32 *save_restore_register(struct i915_perf_stream *stream, u32 *cs, cmd = save ? MI_STORE_REGISTER_MEM : MI_LOAD_REGISTER_MEM; cmd |= MI_SRM_LRM_GLOBAL_GTT; - if (INTEL_GEN(stream->perf->i915) >= 8) + if (GRAPHICS_VER(stream->perf->i915) >= 8) cmd++; for (d = 0; d < dword_count; d++) { @@ -1731,7 +1731,7 @@ retry: *cs++ = i915_mmio_reg_offset(MI_PREDICATE_RESULT_1); /* Restart from the beginning if we had timestamps roll over. */ - *cs++ = (INTEL_GEN(i915) < 8 ? + *cs++ = (GRAPHICS_VER(i915) < 8 ? MI_BATCH_BUFFER_START : MI_BATCH_BUFFER_START_GEN8) | MI_BATCH_PREDICATE; @@ -1768,7 +1768,7 @@ retry: *cs++ = i915_mmio_reg_offset(MI_PREDICATE_RESULT_1); /* Predicate the jump. */ - *cs++ = (INTEL_GEN(i915) < 8 ? + *cs++ = (GRAPHICS_VER(i915) < 8 ? MI_BATCH_BUFFER_START : MI_BATCH_BUFFER_START_GEN8) | MI_BATCH_PREDICATE; @@ -1892,7 +1892,7 @@ retry: oa_config->flex_regs_len); /* Jump into the active wait. */ - *cs++ = (INTEL_GEN(stream->perf->i915) < 8 ? + *cs++ = (GRAPHICS_VER(stream->perf->i915) < 8 ? MI_BATCH_BUFFER_START : MI_BATCH_BUFFER_START_GEN8); *cs++ = i915_ggtt_offset(stream->noa_wait); @@ -2492,7 +2492,7 @@ gen8_enable_metric_set(struct i915_perf_stream *stream, * be read back from automatically triggered reports, as part of the * RPT_ID field. */ - if (IS_GEN_RANGE(stream->perf->i915, 9, 11)) { + if (IS_GRAPHICS_VER(stream->perf->i915, 9, 11)) { intel_uncore_write(uncore, GEN8_OA_DEBUG, _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS | GEN9_OA_DEBUG_INCLUDE_CLK_RATIO)); @@ -2797,7 +2797,7 @@ get_default_sseu_config(struct intel_sseu *out_sseu, *out_sseu = intel_sseu_from_device_info(devinfo_sseu); - if (IS_GEN(engine->i915, 11)) { + if (GRAPHICS_VER(engine->i915) == 11) { /* * We only need subslice count so it doesn't matter which ones * we select - just turn off low bits in the amount of half of @@ -2864,7 +2864,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, } if (!(props->sample_flags & SAMPLE_OA_REPORT) && - (INTEL_GEN(perf->i915) < 12 || !stream->ctx)) { + (GRAPHICS_VER(perf->i915) < 12 || !stream->ctx)) { DRM_DEBUG("Only OA report sampling supported\n"); return -EINVAL; } @@ -3006,7 +3006,7 @@ void i915_oa_init_reg_state(const struct intel_context *ce, /* perf.exclusive_stream serialised by lrc_configure_all_contexts() */ stream = READ_ONCE(engine->i915->perf.exclusive_stream); - if (stream && INTEL_GEN(stream->perf->i915) < 12) + if (stream && GRAPHICS_VER(stream->perf->i915) < 12) gen8_update_reg_state_unlocked(ce, stream); } @@ -3443,7 +3443,7 @@ i915_perf_open_ioctl_locked(struct i915_perf *perf, */ if (IS_HASWELL(perf->i915) && specific_ctx) privileged_op = false; - else if (IS_GEN(perf->i915, 12) && specific_ctx && + else if (GRAPHICS_VER(perf->i915) == 12 && specific_ctx && (props->sample_flags & SAMPLE_OA_REPORT) == 0) privileged_op = false; @@ -4119,7 +4119,7 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data, } oa_config->b_counter_regs = regs; - if (INTEL_GEN(perf->i915) < 8) { + if (GRAPHICS_VER(perf->i915) < 8) { if (args->n_flex_regs != 0) { err = -EINVAL; goto reg_err; @@ -4365,7 +4365,7 @@ void i915_perf_init(struct drm_i915_private *i915) */ perf->ops.read = gen8_oa_read; - if (IS_GEN_RANGE(i915, 8, 9)) { + if (IS_GRAPHICS_VER(i915, 8, 9)) { perf->ops.is_valid_b_counter_reg = gen7_is_valid_b_counter_addr; perf->ops.is_valid_mux_reg = @@ -4384,7 +4384,7 @@ void i915_perf_init(struct drm_i915_private *i915) perf->ops.disable_metric_set = gen8_disable_metric_set; perf->ops.oa_hw_tail_read = gen8_oa_hw_tail_read; - if (IS_GEN(i915, 8)) { + if (GRAPHICS_VER(i915) == 8) { perf->ctx_oactxctrl_offset = 0x120; perf->ctx_flexeu0_offset = 0x2ce; @@ -4395,7 +4395,7 @@ void i915_perf_init(struct drm_i915_private *i915) perf->gen8_valid_ctx_bit = BIT(16); } - } else if (IS_GEN_RANGE(i915, 10, 11)) { + } else if (IS_GRAPHICS_VER(i915, 10, 11)) { perf->ops.is_valid_b_counter_reg = gen7_is_valid_b_counter_addr; perf->ops.is_valid_mux_reg = @@ -4409,7 +4409,7 @@ void i915_perf_init(struct drm_i915_private *i915) perf->ops.disable_metric_set = gen10_disable_metric_set; perf->ops.oa_hw_tail_read = gen8_oa_hw_tail_read; - if (IS_GEN(i915, 10)) { + if (GRAPHICS_VER(i915) == 10) { perf->ctx_oactxctrl_offset = 0x128; perf->ctx_flexeu0_offset = 0x3de; } else { @@ -4417,7 +4417,7 @@ void i915_perf_init(struct drm_i915_private *i915) perf->ctx_flexeu0_offset = 0x78e; } perf->gen8_valid_ctx_bit = BIT(16); - } else if (IS_GEN(i915, 12)) { + } else if (GRAPHICS_VER(i915) == 12) { perf->ops.is_valid_b_counter_reg = gen12_is_valid_b_counter_addr; perf->ops.is_valid_mux_reg = |