[Intel-xe] [PATCH 07/21] drm/xe/oa: OA stream initialization

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Oct 4 15:22:36 UTC 2023


On Tue, 19 Sep 2023 09:10:35 -0700, Ashutosh Dixit wrote:
>
> +static int xe_oa_configure_oar_context(struct xe_oa_stream *stream, bool enable)
> +{
> +	int err;
> +	u32 format = stream->oa_buffer.format->format;
> +	u32 offset = stream->oa->ctx_oactxctrl_offset;
> +	struct flex regs_context[] = {
> +		{
> +			GEN8_OACTXCONTROL,
> +			offset + 1,
> +			enable ? GEN8_OA_COUNTER_RESUME : 0,
> +		},
> +	};
> +#define	GEN12_CTX_CTRL_OAR_CONTEXT_ENABLE BIT(8)
> +#define GEN12_OAR_OACONTROL_OFFSET 0x5B0
> +	/* Offsets in regs_lri are not used since this configuration is applied using LRI */
> +	struct flex regs_lri[] = {
> +		{
> +			GEN12_OAR_OACONTROL,
> +			GEN12_OAR_OACONTROL_OFFSET + 1,
> +			(format << GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT) |
> +			(enable ? GEN12_OAR_OACONTROL_COUNTER_ENABLE : 0)
> +		},
> +		{
> +			RING_CONTEXT_CONTROL(stream->hwe->mmio_base),
> +			CTX_CONTEXT_CONTROL,
> +			_MASKED_FIELD(GEN12_CTX_CTRL_OAR_CONTEXT_ENABLE,
> +				      enable ?
> +				      GEN12_CTX_CTRL_OAR_CONTEXT_ENABLE :
> +				      0)
> +		},
> +	};
> +
> +	/* Modify stream hwe context image with regs_context */
> +	err = xe_oa_modify_context(stream, &stream->exec_q->lrc[0],
> +				   regs_context, ARRAY_SIZE(regs_context));
> +	if (err)
> +		return err;
> +
> +	/* Apply regs_lri using LRI */
> +	return xe_oa_modify_self(stream, regs_lri, ARRAY_SIZE(regs_lri));

This function is incorrect. Please don't review this. Hopefully I have
fixed it here (at least "gen12-unprivileged-single-ctx-counters" IGT passes
with this patch):

https://gitlab.freedesktop.org/adixit/kernel/-/commit/eb47df203caf259d2b0a3fc7cb9b557a78f76b8b

The above patch will be included in the next rev of the series.

Thanks.
--
Ashutosh


More information about the Intel-xe mailing list