drm/i915/gt: Pipelined page migration
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / i915_perf.c
index de8ebc3..9f94914 100644 (file)
@@ -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
@@ -1257,11 +1257,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
        case 8:
        case 9:
        case 10:
-               if (intel_engine_in_execlists_submission_mode(ce->engine)) {
-                       stream->specific_ctx_id_mask =
-                               (1U << GEN8_CTX_ID_WIDTH) - 1;
-                       stream->specific_ctx_id = stream->specific_ctx_id_mask;
-               } else {
+               if (intel_engine_uses_guc(ce->engine)) {
                        /*
                         * When using GuC, the context descriptor we write in
                         * i915 is read by GuC and rewritten before it's
@@ -1280,6 +1276,10 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
                         */
                        stream->specific_ctx_id_mask =
                                (1U << (GEN8_CTX_ID_WIDTH - 1)) - 1;
+               } else {
+                       stream->specific_ctx_id_mask =
+                               (1U << GEN8_CTX_ID_WIDTH) - 1;
+                       stream->specific_ctx_id = stream->specific_ctx_id_mask;
                }
                break;
 
@@ -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 =