From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 14/17] drm/xe/oa: Add MMIO trigger support
Date: Thu, 14 Mar 2024 18:35:15 -0700 [thread overview]
Message-ID: <20240315013518.2848986-15-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240315013518.2848986-1-ashutosh.dixit@intel.com>
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
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
drivers/gpu/drm/xe/regs/xe_oa_regs.h | 5 +++++
drivers/gpu/drm/xe/xe_oa.c | 24 +++++++++++++++++++++++-
drivers/gpu/drm/xe/xe_reg_whitelist.c | 24 +++++++++++++++++++++++-
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/regs/xe_oa_regs.h b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
index 6b682c0dda83..6ad3304c4d19 100644
--- a/drivers/gpu/drm/xe/regs/xe_oa_regs.h
+++ b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
@@ -63,11 +63,16 @@
#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_CTX_SWITCH_REPORTS REG_BIT(1)
#define OAG_OASTATUS XE_REG(0xdafc)
+#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 f59d08894cd3..8b62ce6265a8 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -728,6 +728,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;
@@ -743,6 +750,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);
@@ -894,9 +904,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 |
@@ -2113,6 +2131,10 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt)
u->type = DRM_XE_OA_UNIT_TYPE_OAM;
}
+ /* Ensure MMIO trigger remains 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 3fa2ece7d228..3996934974fa 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 "regs/xe_regs.h"
#include "xe_gt_types.h"
#include "xe_platform_types.h"
@@ -63,7 +64,28 @@ static const struct xe_rtp_entry_sr register_whitelist[] = {
ENGINE_CLASS(RENDER)),
XE_RTP_ACTIONS(WHITELIST(CSBE_DEBUG_STATUS(RENDER_RING_BASE), 0))
},
-
+ { 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))
+ },
{}
};
--
2.41.0
next prev parent reply other threads:[~2024-03-15 1:35 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 1:35 [PATCH 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 01/17] drm/xe/perf/uapi: "Perf" layer to support multiple perf counter stream types Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 02/17] drm/xe/perf/uapi: Add perf_stream_paranoid sysctl Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 03/17] drm/xe/oa/uapi: Add OA data formats Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 04/17] drm/xe/oa/uapi: Initialize OA units Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 05/17] drm/xe/oa/uapi: Add/remove OA config perf ops Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 06/17] drm/xe/oa/uapi: Define and parse OA stream properties Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 07/17] drm/xe/oa: OA stream initialization (OAG) Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 08/17] drm/xe/oa/uapi: Expose OA stream fd Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 09/17] drm/xe/oa/uapi: Read file_operation Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 10/17] drm/xe/oa: Add OAR support Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 11/17] drm/xe/oa: Add OAC support Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 12/17] drm/xe/oa/uapi: Query OA unit properties Ashutosh Dixit
2024-04-24 23:26 ` Dixit, Ashutosh
2024-04-25 13:10 ` Lucas De Marchi
2024-03-15 1:35 ` [PATCH 13/17] drm/xe/oa/uapi: OA buffer mmap Ashutosh Dixit
2024-03-15 1:35 ` Ashutosh Dixit [this message]
2024-03-15 1:35 ` [PATCH 15/17] drm/xe/oa: Override GuC RC with OA on PVC Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 17/17] drm/xe/oa: Enable Xe2+ overrun mode Ashutosh Dixit
2024-03-15 1:53 ` ✓ CI.Patch_applied: success for Add OA functionality to Xe (rev13) Patchwork
2024-03-15 1:53 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-15 1:54 ` ✓ CI.KUnit: success " Patchwork
2024-03-15 2:05 ` ✓ CI.Build: " Patchwork
2024-03-15 2:07 ` ✗ CI.Hooks: failure " Patchwork
2024-03-15 2:08 ` ✓ CI.checksparse: success " Patchwork
2024-03-15 2:34 ` ✓ CI.BAT: " Patchwork
2024-05-17 18:42 ` [PATCH 00/17] Add OA functionality to Xe Souza, Jose
2024-05-18 1:42 ` Dixit, Ashutosh
2024-05-21 14:43 ` Souza, Jose
2024-05-21 14:47 ` Souza, Jose
2024-05-21 16:10 ` Dixit, Ashutosh
2024-05-21 16:29 ` Souza, Jose
2024-05-21 16:43 ` Dixit, Ashutosh
2024-05-21 17:39 ` Souza, Jose
2024-05-21 18:02 ` Dixit, Ashutosh
2024-05-21 18:11 ` Dixit, Ashutosh
2024-05-21 19:01 ` Souza, Jose
2024-05-21 18:48 ` Souza, Jose
2024-05-21 20:24 ` Dixit, Ashutosh
2024-05-21 21:00 ` Souza, Jose
2024-05-22 2:28 ` Dixit, Ashutosh
2024-05-22 16:08 ` Souza, Jose
2024-05-22 4:42 ` Dixit, Ashutosh
2024-05-22 16:13 ` Souza, Jose
2024-05-22 18:50 ` Dixit, Ashutosh
2024-05-22 19:30 ` Souza, Jose
2024-05-25 1:16 ` Dixit, Ashutosh
2024-05-27 17:02 ` Souza, Jose
2024-05-21 19:58 ` Souza, Jose
-- strict thread matches above, loose matches on Subject: below --
2024-06-18 1:45 [PATCH v19 " Ashutosh Dixit
2024-06-18 1:46 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-06-17 22:36 [PATCH v18 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-06-12 2:05 [PATCH v17 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-12 2:05 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-06-07 20:43 [PATCH v16 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-07 20:43 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-05-27 1:43 [PATCH v15 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-05-27 1:43 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-05-24 19:01 [PATCH v14 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-05-24 19:01 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-03-12 3:38 [PATCH v12 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-03-12 3:39 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
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=20240315013518.2848986-15-ashutosh.dixit@intel.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox