From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 16/17] drm/xe/oa: Add MMIO trigger support
Date: Tue, 19 Dec 2023 20:35:21 -0800 [thread overview]
Message-ID: <ZYJvCTqZ4ZYC0vgF@unerlige-ril> (raw)
In-Reply-To: <20231208064329.2387604-17-ashutosh.dixit@intel.com>
On Thu, Dec 07, 2023 at 10:43:28PM -0800, Ashutosh Dixit wrote:
>Add MMIO trigger support and allow-list required registers for MMIO trigger
>use case. Registers are whitelisted for the lifetime of the driver but MMIO
>trigger is enabled only for the duration of the stream.
>
>Bspec: 45925, 60340, 61228
>
>Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
lgtm
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
> drivers/gpu/drm/xe/regs/xe_oa_regs.h | 7 ++++++
> drivers/gpu/drm/xe/xe_oa.c | 34 ++++++++++++++++++++++++++-
> drivers/gpu/drm/xe/xe_reg_whitelist.c | 23 ++++++++++++++++++
> include/uapi/drm/xe_drm.h | 3 +++
> 4 files changed, 66 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/regs/xe_oa_regs.h b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
>index b66cd95b795e7..1ce27a72079ad 100644
>--- a/drivers/gpu/drm/xe/regs/xe_oa_regs.h
>+++ b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
>@@ -64,16 +64,23 @@
> #define OA_OACONTROL_COUNTER_SIZE_MASK REG_GENMASK(8, 8)
>
> #define OAG_OA_DEBUG XE_REG(0xdaf8, XE_REG_OPTION_MASKED)
>+#define OAG_OA_DEBUG_DISABLE_MMIO_TRG REG_BIT(14)
>+#define OAG_OA_DEBUG_START_TRIGGER_SCOPE_CONTROL REG_BIT(13)
>+#define OAG_OA_DEBUG_DISABLE_START_TRG_2_COUNT_QUAL REG_BIT(8)
>+#define OAG_OA_DEBUG_DISABLE_START_TRG_1_COUNT_QUAL REG_BIT(7)
> #define OAG_OA_DEBUG_INCLUDE_CLK_RATIO REG_BIT(6)
> #define OAG_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS REG_BIT(5)
> #define OAG_OA_DEBUG_DISABLE_GO_1_0_REPORTS REG_BIT(2)
> #define OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS REG_BIT(1)
>
> #define OAG_OASTATUS XE_REG(0xdafc)
>+#define OAG_OASTATUS_MMIO_TRG_Q_FULL REG_BIT(6)
> #define OAG_OASTATUS_COUNTER_OVERFLOW REG_BIT(2)
> #define OAG_OASTATUS_BUFFER_OVERFLOW REG_BIT(1)
> #define OAG_OASTATUS_REPORT_LOST REG_BIT(0)
>
>+#define OAG_MMIOTRIGGER XE_REG(0xdb1c)
>+
> /* OAC unit */
> #define OAC_OACONTROL XE_REG(0x15114)
>
>diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
>index 97779cbb83ee8..13c6e516d9169 100644
>--- a/drivers/gpu/drm/xe/xe_oa.c
>+++ b/drivers/gpu/drm/xe/xe_oa.c
>@@ -525,6 +525,16 @@ static int __xe_oa_read(struct xe_oa_stream *stream, char __user *buf,
> oastatus = xe_mmio_read32(stream->gt, oastatus_reg);
> }
>
>+ if (oastatus & OAG_OASTATUS_MMIO_TRG_Q_FULL) {
>+ ret = xe_oa_append_status(stream, buf, count, offset,
>+ DRM_XE_OA_RECORD_OA_MMIO_TRG_Q_FULL);
>+ if (ret)
>+ return ret;
>+
>+ xe_mmio_rmw32(stream->gt, oastatus_reg,
>+ OAG_OASTATUS_MMIO_TRG_Q_FULL, 0);
>+ }
>+
> if (oastatus & OAG_OASTATUS_REPORT_LOST) {
> ret = xe_oa_append_status(stream, buf, count, offset,
> DRM_XE_OA_RECORD_OA_REPORT_LOST);
>@@ -835,6 +845,13 @@ static int xe_oa_configure_oa_context(struct xe_oa_stream *stream, bool enable)
>
> #define HAS_OA_BPC_REPORTING(xe) (GRAPHICS_VERx100(xe) >= 1255)
>
>+static u32 oag_configure_mmio_trigger(const struct xe_oa_stream *stream, bool enable)
>+{
>+ return _MASKED_FIELD(OAG_OA_DEBUG_DISABLE_MMIO_TRG,
>+ enable && stream && stream->sample ?
>+ 0 : OAG_OA_DEBUG_DISABLE_MMIO_TRG);
>+}
>+
> static void xe_oa_disable_metric_set(struct xe_oa_stream *stream)
> {
> u32 sqcnt1;
>@@ -850,6 +867,9 @@ static void xe_oa_disable_metric_set(struct xe_oa_stream *stream)
> _MASKED_BIT_DISABLE(DISABLE_DOP_GATING));
> }
>
>+ xe_mmio_write32(stream->gt, __oa_regs(stream)->oa_debug,
>+ oag_configure_mmio_trigger(stream, false));
>+
> /* disable the context save/restore or OAR counters */
> if (stream->exec_q)
> xe_oa_configure_oa_context(stream, false);
>@@ -1031,9 +1051,17 @@ static int xe_oa_enable_metric_set(struct xe_oa_stream *stream)
> oa_debug = OAG_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
> OAG_OA_DEBUG_INCLUDE_CLK_RATIO;
>
>+ if (GRAPHICS_VER(stream->oa->xe) >= 20)
>+ oa_debug |=
>+ /* The three bits below are needed to get PEC counters running */
>+ OAG_OA_DEBUG_START_TRIGGER_SCOPE_CONTROL |
>+ OAG_OA_DEBUG_DISABLE_START_TRG_2_COUNT_QUAL |
>+ OAG_OA_DEBUG_DISABLE_START_TRG_1_COUNT_QUAL;
>+
> xe_mmio_write32(stream->gt, __oa_regs(stream)->oa_debug,
> _MASKED_BIT_ENABLE(oa_debug) |
>- oag_report_ctx_switches(stream));
>+ oag_report_ctx_switches(stream) |
>+ oag_configure_mmio_trigger(stream, true));
>
> xe_mmio_write32(stream->gt, __oa_regs(stream)->oa_ctx_ctrl, stream->periodic ?
> (OAG_OAGLBCTXCTRL_COUNTER_RESUME |
>@@ -2259,6 +2287,10 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt)
> u->type = DRM_XE_OA_UNIT_TYPE_OAM;
> }
>
>+ /* Ensure MMIO triggers remain disabled till there is a stream */
>+ xe_mmio_write32(gt, u->regs.oa_debug,
>+ oag_configure_mmio_trigger(NULL, false));
>+
> /* Set oa_unit_ids now to ensure ids remain contiguous */
> u->oa_unit_id = gt_to_xe(gt)->oa.oa_unit_ids++;
> }
>diff --git a/drivers/gpu/drm/xe/xe_reg_whitelist.c b/drivers/gpu/drm/xe/xe_reg_whitelist.c
>index e66ae1bdaf9c0..267af6759332b 100644
>--- a/drivers/gpu/drm/xe/xe_reg_whitelist.c
>+++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c
>@@ -7,6 +7,7 @@
>
> #include "regs/xe_engine_regs.h"
> #include "regs/xe_gt_regs.h"
>+#include "regs/xe_oa_regs.h"
> #include "xe_gt_types.h"
> #include "xe_platform_types.h"
> #include "xe_rtp.h"
>@@ -56,6 +57,28 @@ static const struct xe_rtp_entry_sr register_whitelist[] = {
> RING_FORCE_TO_NONPRIV_DENY,
> XE_RTP_ACTION_FLAG(ENGINE_BASE)))
> },
>+ { XE_RTP_NAME("oa_reg_render"),
>+ XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, XE_RTP_END_VERSION_UNDEFINED),
>+ ENGINE_CLASS(RENDER)),
>+ XE_RTP_ACTIONS(WHITELIST(OAG_MMIOTRIGGER,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RW),
>+ WHITELIST(OAG_OASTATUS,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RD),
>+ WHITELIST(OAG_OAHEADPTR,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RD |
>+ RING_FORCE_TO_NONPRIV_RANGE_4))
>+ },
>+ { XE_RTP_NAME("oa_reg_compute"),
>+ XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, XE_RTP_END_VERSION_UNDEFINED),
>+ ENGINE_CLASS(COMPUTE)),
>+ XE_RTP_ACTIONS(WHITELIST(OAG_MMIOTRIGGER,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RW),
>+ WHITELIST(OAG_OASTATUS,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RD),
>+ WHITELIST(OAG_OAHEADPTR,
>+ RING_FORCE_TO_NONPRIV_ACCESS_RD |
>+ RING_FORCE_TO_NONPRIV_RANGE_4))
>+ },
> {}
> };
>
>diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
>index 5f41c5bfe5e0e..34cd7d5206834 100644
>--- a/include/uapi/drm/xe_drm.h
>+++ b/include/uapi/drm/xe_drm.h
>@@ -1357,6 +1357,9 @@ enum drm_xe_oa_record_type {
> */
> DRM_XE_OA_RECORD_OA_BUFFER_LOST = 3,
>
>+ /** @DRM_XE_OA_RECORD_OA_MMIO_TRG_Q_FULL: Status indicating MMIO trigger queue full */
>+ DRM_XE_OA_RECORD_OA_MMIO_TRG_Q_FULL = 4,
>+
> DRM_XE_OA_RECORD_MAX /* non-ABI */
> };
>
>--
>2.41.0
>
next prev parent reply other threads:[~2023-12-20 4:36 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 6:43 [PATCH v7 00/17] Add OA functionality to Xe Ashutosh Dixit
2023-12-08 6:43 ` [PATCH 01/17] drm/xe/perf/uapi: "Perf" layer to support multiple perf counter stream types Ashutosh Dixit
2023-12-08 6:43 ` [PATCH 02/17] drm/xe/perf/uapi: Add perf_stream_paranoid sysctl Ashutosh Dixit
2023-12-14 0:57 ` Umesh Nerlige Ramappa
2023-12-19 20:28 ` Dixit, Ashutosh
2024-01-20 2:35 ` Dixit, Ashutosh
2024-01-24 14:10 ` Joel Granados
2023-12-08 6:43 ` [PATCH 03/17] drm/xe/oa/uapi: Add oa_max_sample_rate sysctl Ashutosh Dixit
2023-12-14 0:58 ` Umesh Nerlige Ramappa
2024-01-20 2:36 ` Dixit, Ashutosh
2024-01-24 14:11 ` Joel Granados
2023-12-08 6:43 ` [PATCH 04/17] drm/xe/oa/uapi: Add OA data formats Ashutosh Dixit
2023-12-19 1:11 ` Umesh Nerlige Ramappa
2023-12-19 1:17 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 05/17] drm/xe/oa/uapi: Initialize OA units Ashutosh Dixit
2023-12-19 16:11 ` Umesh Nerlige Ramappa
2024-01-20 2:43 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 06/17] drm/xe/oa/uapi: Add/remove OA config perf ops Ashutosh Dixit
2023-12-19 19:10 ` Umesh Nerlige Ramappa
2024-01-20 2:44 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 07/17] drm/xe/oa/uapi: Define and parse OA stream properties Ashutosh Dixit
2023-12-09 22:53 ` Dixit, Ashutosh
2023-12-19 2:59 ` Dixit, Ashutosh
2023-12-19 16:26 ` Umesh Nerlige Ramappa
2023-12-19 16:29 ` Lionel Landwerlin
2023-12-19 16:40 ` Umesh Nerlige Ramappa
2023-12-19 17:48 ` Lionel Landwerlin
2023-12-19 23:23 ` Umesh Nerlige Ramappa
2024-01-20 2:48 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 08/17] drm/xe/oa: OA stream initialization (OAG) Ashutosh Dixit
2023-12-20 2:31 ` Umesh Nerlige Ramappa
2024-01-20 2:49 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 09/17] drm/xe/oa/uapi: Expose OA stream fd Ashutosh Dixit
2023-12-20 2:52 ` Umesh Nerlige Ramappa
2024-01-20 2:50 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 10/17] drm/xe/oa/uapi: Read file_operation Ashutosh Dixit
2023-12-20 3:01 ` Umesh Nerlige Ramappa
2024-01-20 2:51 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 11/17] drm/xe/oa: Disable overrun mode for Xe2+ OAG Ashutosh Dixit
2023-12-20 3:05 ` Umesh Nerlige Ramappa
2024-01-20 2:51 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 12/17] drm/xe/oa: Add OAR support Ashutosh Dixit
2023-12-20 4:37 ` Umesh Nerlige Ramappa
2023-12-08 6:43 ` [PATCH 13/17] drm/xe/oa: Add OAC support Ashutosh Dixit
2023-12-20 4:59 ` Umesh Nerlige Ramappa
2024-01-20 2:52 ` FIXME " Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 14/17] drm/xe/oa/uapi: Query OA unit properties Ashutosh Dixit
2023-12-23 0:40 ` Umesh Nerlige Ramappa
2024-01-20 3:10 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 15/17] drm/xe/oa/uapi: OA buffer mmap Ashutosh Dixit
2023-12-23 2:39 ` Umesh Nerlige Ramappa
2024-01-20 3:11 ` Dixit, Ashutosh
2024-02-06 23:51 ` Umesh Nerlige Ramappa
2024-01-02 11:16 ` Thomas Hellström
2024-01-08 19:50 ` Umesh Nerlige Ramappa
2024-01-09 5:14 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 16/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2023-12-20 4:35 ` Umesh Nerlige Ramappa [this message]
2023-12-08 6:43 ` [PATCH 17/17] drm/xe/oa: Override GuC RC with OA on PVC Ashutosh Dixit
2023-12-08 9:22 ` ✗ CI.Patch_applied: failure for Add OA functionality to Xe (rev7) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZYJvCTqZ4ZYC0vgF@unerlige-ril \
--to=umesh.nerlige.ramappa@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.