Skip to content

Commit fba0f03

Browse files
unerligeashutoshx
authored andcommitted
xe/oa: Drop the unused logic to parse context image
Now that all register configurations are using MI_LOAD_REGISTER_IMM, drop the logic to parse context image for offset. v2: Remove unused lrc headers (Ashutosh) Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Reviewed-by: Jonathan Cavitt <[email protected]> Signed-off-by: Ashutosh Dixit <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5503983 commit fba0f03

File tree

2 files changed

+0
-91
lines changed

2 files changed

+0
-91
lines changed

drivers/gpu/drm/xe/xe_oa.c

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "instructions/xe_mi_commands.h"
1717
#include "regs/xe_engine_regs.h"
1818
#include "regs/xe_gt_regs.h"
19-
#include "regs/xe_lrc_layout.h"
2019
#include "regs/xe_oa_regs.h"
2120
#include "xe_assert.h"
2221
#include "xe_bb.h"
@@ -28,7 +27,6 @@
2827
#include "xe_gt_mcr.h"
2928
#include "xe_gt_printk.h"
3029
#include "xe_guc_pc.h"
31-
#include "xe_lrc.h"
3230
#include "xe_macros.h"
3331
#include "xe_mmio.h"
3432
#include "xe_oa.h"
@@ -1673,81 +1671,6 @@ static const struct file_operations xe_oa_fops = {
16731671
.mmap = xe_oa_mmap,
16741672
};
16751673

1676-
static bool engine_supports_mi_query(struct xe_hw_engine *hwe)
1677-
{
1678-
return hwe->class == XE_ENGINE_CLASS_RENDER ||
1679-
hwe->class == XE_ENGINE_CLASS_COMPUTE;
1680-
}
1681-
1682-
static bool xe_oa_find_reg_in_lri(u32 *state, u32 reg, u32 *offset, u32 end)
1683-
{
1684-
u32 idx = *offset;
1685-
u32 len = min(MI_LRI_LEN(state[idx]) + idx, end);
1686-
bool found = false;
1687-
1688-
idx++;
1689-
for (; idx < len; idx += 2) {
1690-
if (state[idx] == reg) {
1691-
found = true;
1692-
break;
1693-
}
1694-
}
1695-
1696-
*offset = idx;
1697-
return found;
1698-
}
1699-
1700-
#define IS_MI_LRI_CMD(x) (REG_FIELD_GET(MI_OPCODE, (x)) == \
1701-
REG_FIELD_GET(MI_OPCODE, MI_LOAD_REGISTER_IMM))
1702-
1703-
static u32 xe_oa_context_image_offset(struct xe_oa_stream *stream, u32 reg)
1704-
{
1705-
struct xe_lrc *lrc = stream->exec_q->lrc[0];
1706-
u32 len = (xe_gt_lrc_size(stream->gt, stream->hwe->class) +
1707-
lrc->ring.size) / sizeof(u32);
1708-
u32 offset = xe_lrc_regs_offset(lrc) / sizeof(u32);
1709-
u32 *state = (u32 *)lrc->bo->vmap.vaddr;
1710-
1711-
if (drm_WARN_ON(&stream->oa->xe->drm, !state))
1712-
return U32_MAX;
1713-
1714-
for (; offset < len; ) {
1715-
if (IS_MI_LRI_CMD(state[offset])) {
1716-
/*
1717-
* We expect reg-value pairs in MI_LRI command, so
1718-
* MI_LRI_LEN() should be even
1719-
*/
1720-
drm_WARN_ON(&stream->oa->xe->drm,
1721-
MI_LRI_LEN(state[offset]) & 0x1);
1722-
1723-
if (xe_oa_find_reg_in_lri(state, reg, &offset, len))
1724-
break;
1725-
} else {
1726-
offset++;
1727-
}
1728-
}
1729-
1730-
return offset < len ? offset : U32_MAX;
1731-
}
1732-
1733-
static int xe_oa_set_ctx_ctrl_offset(struct xe_oa_stream *stream)
1734-
{
1735-
struct xe_reg reg = OACTXCONTROL(stream->hwe->mmio_base);
1736-
u32 offset = stream->oa->ctx_oactxctrl_offset[stream->hwe->class];
1737-
1738-
/* Do this only once. Failure is stored as offset of U32_MAX */
1739-
if (offset)
1740-
goto exit;
1741-
1742-
offset = xe_oa_context_image_offset(stream, reg.addr);
1743-
stream->oa->ctx_oactxctrl_offset[stream->hwe->class] = offset;
1744-
1745-
drm_dbg(&stream->oa->xe->drm, "%s oa ctx control at 0x%08x dword offset\n",
1746-
stream->hwe->name, offset);
1747-
exit:
1748-
return offset && offset != U32_MAX ? 0 : -ENODEV;
1749-
}
1750-
17511674
static int xe_oa_stream_init(struct xe_oa_stream *stream,
17521675
struct xe_oa_open_param *param)
17531676
{
@@ -1785,17 +1708,6 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
17851708
else
17861709
stream->oa_buffer.circ_size = param->oa_buffer_size;
17871710

1788-
if (stream->exec_q && engine_supports_mi_query(stream->hwe)) {
1789-
/* If we don't find the context offset, just return error */
1790-
ret = xe_oa_set_ctx_ctrl_offset(stream);
1791-
if (ret) {
1792-
drm_err(&stream->oa->xe->drm,
1793-
"xe_oa_set_ctx_ctrl_offset failed for %s\n",
1794-
stream->hwe->name);
1795-
goto exit;
1796-
}
1797-
}
1798-
17991711
stream->oa_config = xe_oa_get_oa_config(stream->oa, param->metric_set);
18001712
if (!stream->oa_config) {
18011713
drm_dbg(&stream->oa->xe->drm, "Invalid OA config id=%i\n", param->metric_set);

drivers/gpu/drm/xe/xe_oa_types.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ struct xe_oa {
138138
/** @metrics_idr: List of dynamic configurations (struct xe_oa_config) */
139139
struct idr metrics_idr;
140140

141-
/** @ctx_oactxctrl_offset: offset of OACTXCONTROL register in context image */
142-
u32 ctx_oactxctrl_offset[XE_ENGINE_CLASS_MAX];
143-
144141
/** @oa_formats: tracks all OA formats across platforms */
145142
const struct xe_oa_format *oa_formats;
146143

0 commit comments

Comments
 (0)