Commit 1cc064dc authored by Umesh Nerlige Ramappa's avatar Umesh Nerlige Ramappa

drm/i915/perf: Add support for OA media units

MTL introduces additional OA units dedicated to media use cases. Add
support for programming these OA units by passing the media engine class
and instance parameters.

UMD specific changes for GPUvis support:
https://patchwork.freedesktop.org/patch/522827/?series=114023
https://patchwork.freedesktop.org/patch/522822/?series=114023
https://patchwork.freedesktop.org/patch/522826/?series=114023
https://patchwork.freedesktop.org/patch/522828/?series=114023
https://patchwork.freedesktop.org/patch/522816/?series=114023
https://patchwork.freedesktop.org/patch/522825/?series=114023

v2: (Ashutosh)
- check for IP_VER(12, 70) instead of MTL
- remove PERF_GROUP_OAG comment in mtl_oa_base
- remove oa_buffer.group
- use engine->oa_group->type in engine_supports_oa_format
- remove fw_domains and use FORCEWAKE_ALL
- remove MPES/MPEC comment
- s/xehp/mtl/ in b counter validation function name
- remove engine_supports_oa in __oa_engine_group
- remove warn_ON from __oam_engine_group
- refactor oa_init_groups and oa_init_regs
- assign g->type correctly
- use enum oa_type definition

v3: (Ashutosh)
- Drop oa_unit_functional as engine_supports_oa is enough

v4:
- s/DRM_DEBUG/drm_dbg/
Signed-off-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323225901.3743681-10-umesh.nerlige.ramappa@intel.com
parent c61d04c9
......@@ -905,6 +905,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
(INTEL_INFO(dev_priv)->has_oa_bpc_reporting)
#define HAS_OA_SLICE_CONTRIB_LIMITS(dev_priv) \
(INTEL_INFO(dev_priv)->has_oa_slice_contrib_limits)
#define HAS_OAM(dev_priv) \
(INTEL_INFO(dev_priv)->has_oam)
/*
* Set this flag, when platform requires 64K GTT page sizes or larger for
......
......@@ -1027,6 +1027,7 @@ static const struct intel_device_info adl_p_info = {
.has_mslice_steering = 1, \
.has_oa_bpc_reporting = 1, \
.has_oa_slice_contrib_limits = 1, \
.has_oam = 1, \
.has_rc6 = 1, \
.has_reset_engine = 1, \
.has_rps = 1, \
......
This diff is collapsed.
......@@ -138,4 +138,82 @@
#define GEN12_SQCNT1_PMON_ENABLE REG_BIT(30)
#define GEN12_SQCNT1_OABPC REG_BIT(29)
/* Gen12 OAM unit */
#define GEN12_OAM_HEAD_POINTER_OFFSET (0x1a0)
#define GEN12_OAM_HEAD_POINTER_MASK 0xffffffc0
#define GEN12_OAM_TAIL_POINTER_OFFSET (0x1a4)
#define GEN12_OAM_TAIL_POINTER_MASK 0xffffffc0
#define GEN12_OAM_BUFFER_OFFSET (0x1a8)
#define GEN12_OAM_BUFFER_SIZE_MASK (0x7)
#define GEN12_OAM_BUFFER_SIZE_SHIFT (3)
#define GEN12_OAM_BUFFER_MEMORY_SELECT REG_BIT(0) /* 0: PPGTT, 1: GGTT */
#define GEN12_OAM_CONTEXT_CONTROL_OFFSET (0x1bc)
#define GEN12_OAM_CONTEXT_CONTROL_TIMER_PERIOD_SHIFT 2
#define GEN12_OAM_CONTEXT_CONTROL_TIMER_ENABLE REG_BIT(1)
#define GEN12_OAM_CONTEXT_CONTROL_COUNTER_RESUME REG_BIT(0)
#define GEN12_OAM_CONTROL_OFFSET (0x194)
#define GEN12_OAM_CONTROL_COUNTER_FORMAT_SHIFT 1
#define GEN12_OAM_CONTROL_COUNTER_ENABLE REG_BIT(0)
#define GEN12_OAM_DEBUG_OFFSET (0x198)
#define GEN12_OAM_DEBUG_BUFFER_SIZE_SELECT REG_BIT(12)
#define GEN12_OAM_DEBUG_INCLUDE_CLK_RATIO REG_BIT(6)
#define GEN12_OAM_DEBUG_DISABLE_CLK_RATIO_REPORTS REG_BIT(5)
#define GEN12_OAM_DEBUG_DISABLE_GO_1_0_REPORTS REG_BIT(2)
#define GEN12_OAM_DEBUG_DISABLE_CTX_SWITCH_REPORTS REG_BIT(1)
#define GEN12_OAM_STATUS_OFFSET (0x19c)
#define GEN12_OAM_STATUS_COUNTER_OVERFLOW REG_BIT(2)
#define GEN12_OAM_STATUS_BUFFER_OVERFLOW REG_BIT(1)
#define GEN12_OAM_STATUS_REPORT_LOST REG_BIT(0)
#define GEN12_OAM_MMIO_TRG_OFFSET (0x1d0)
#define GEN12_OAM_MMIO_TRG(base) \
_MMIO((base) + GEN12_OAM_MMIO_TRG_OFFSET)
#define GEN12_OAM_HEAD_POINTER(base) \
_MMIO((base) + GEN12_OAM_HEAD_POINTER_OFFSET)
#define GEN12_OAM_TAIL_POINTER(base) \
_MMIO((base) + GEN12_OAM_TAIL_POINTER_OFFSET)
#define GEN12_OAM_BUFFER(base) \
_MMIO((base) + GEN12_OAM_BUFFER_OFFSET)
#define GEN12_OAM_CONTEXT_CONTROL(base) \
_MMIO((base) + GEN12_OAM_CONTEXT_CONTROL_OFFSET)
#define GEN12_OAM_CONTROL(base) \
_MMIO((base) + GEN12_OAM_CONTROL_OFFSET)
#define GEN12_OAM_DEBUG(base) \
_MMIO((base) + GEN12_OAM_DEBUG_OFFSET)
#define GEN12_OAM_STATUS(base) \
_MMIO((base) + GEN12_OAM_STATUS_OFFSET)
#define GEN12_OAM_CEC0_0_OFFSET (0x40)
#define GEN12_OAM_CEC7_1_OFFSET (0x7c)
#define GEN12_OAM_CEC0_0(base) \
_MMIO((base) + GEN12_OAM_CEC0_0_OFFSET)
#define GEN12_OAM_CEC7_1(base) \
_MMIO((base) + GEN12_OAM_CEC7_1_OFFSET)
#define GEN12_OAM_STARTTRIG1_OFFSET (0x00)
#define GEN12_OAM_STARTTRIG8_OFFSET (0x1c)
#define GEN12_OAM_STARTTRIG1(base) \
_MMIO((base) + GEN12_OAM_STARTTRIG1_OFFSET)
#define GEN12_OAM_STARTTRIG8(base) \
_MMIO((base) + GEN12_OAM_STARTTRIG8_OFFSET)
#define GEN12_OAM_REPORTTRIG1_OFFSET (0x20)
#define GEN12_OAM_REPORTTRIG8_OFFSET (0x3c)
#define GEN12_OAM_REPORTTRIG1(base) \
_MMIO((base) + GEN12_OAM_REPORTTRIG1_OFFSET)
#define GEN12_OAM_REPORTTRIG8(base) \
_MMIO((base) + GEN12_OAM_REPORTTRIG8_OFFSET)
#define GEN12_OAM_PERF_COUNTER_B0_OFFSET (0x84)
#define GEN12_OAM_PERF_COUNTER_B(base, idx) \
_MMIO((base) + GEN12_OAM_PERF_COUNTER_B0_OFFSET + 4 * (idx))
#endif /* __INTEL_PERF_OA_REGS__ */
......@@ -20,6 +20,7 @@
#include "gt/intel_engine_types.h"
#include "gt/intel_sseu.h"
#include "i915_reg_defs.h"
#include "intel_uncore.h"
#include "intel_wakeref.h"
struct drm_i915_private;
......@@ -33,6 +34,7 @@ struct intel_engine_cs;
enum {
PERF_GROUP_OAG = 0,
PERF_GROUP_OAM_SAMEDIA_0 = 0,
PERF_GROUP_MAX,
PERF_GROUP_INVALID = U32_MAX,
......@@ -43,9 +45,27 @@ enum report_header {
HDR_64_BIT,
};
struct i915_perf_regs {
u32 base;
i915_reg_t oa_head_ptr;
i915_reg_t oa_tail_ptr;
i915_reg_t oa_buffer;
i915_reg_t oa_ctx_ctrl;
i915_reg_t oa_ctrl;
i915_reg_t oa_debug;
i915_reg_t oa_status;
u32 oa_ctrl_counter_format_shift;
};
enum oa_type {
TYPE_OAG,
TYPE_OAM,
};
struct i915_oa_format {
u32 format;
int size;
int type;
enum report_header header;
};
......@@ -416,6 +436,16 @@ struct i915_perf_group {
* @num_engines: The number of engines using this OA unit.
*/
u32 num_engines;
/*
* @regs: OA buffer register group for programming the OA unit.
*/
struct i915_perf_regs regs;
/*
* @type: Type of OA unit - OAM, OAG etc.
*/
enum oa_type type;
};
struct i915_perf_gt {
......
......@@ -166,6 +166,7 @@ enum intel_ppgtt_type {
func(has_mslice_steering); \
func(has_oa_bpc_reporting); \
func(has_oa_slice_contrib_limits); \
func(has_oam); \
func(has_one_eu_per_fuse_bit); \
func(has_pxp); \
func(has_rc6); \
......
......@@ -2676,6 +2676,10 @@ enum drm_i915_oa_format {
I915_OAR_FORMAT_A32u40_A4u32_B8_C8,
I915_OA_FORMAT_A24u40_A14u32_B8_C8,
/* MTL OAM */
I915_OAM_FORMAT_MPEC8u64_B8_C8,
I915_OAM_FORMAT_MPEC8u32_B8_C8,
I915_OA_FORMAT_MAX /* non-ABI */
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment