FAILED: patch "[PATCH] drm/xe/rtp: Maintain OA whitelists separately" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 31e2437561621b4867c08efc890bf629d017df03
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072914-overstep-liable-afcd@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 31e2437561621b4867c08efc890bf629d017df03 Mon Sep 17 00:00:00 2001
From: Ashutosh Dixit <[email protected]>
Date: Mon, 15 Jun 2026 15:42:20 -0700
Subject: [PATCH] drm/xe/rtp: Maintain OA whitelists separately
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
OA registers are dynamically whitelisted (and again dewhitelisted) on OA stream open/close. Maintaining OA whitelists separately from non-OA register whitlists simplifies this management of OA register whitelisting/dewhitelisting.
drivers/gpu/drm/xe/xe_gt_debugfs.c +3 -1
@@ -149,8 +149,10 @@ static int register_save_restore(struct xe_gt *gt, struct drm_printer *p)drm_printf (p,"\n" );drm_printf (p,"Whitelist\n" ); -for_each_hw_engine (hwe, gt, id) +for_each_hw_engine (hwe, gt, id) {xe_reg_whitelist_dump (&hwe->reg_whitelist, p); +xe_reg_whitelist_dump (&hwe->oa_whitelist, p); + }return 0 ; }
drivers/gpu/drm/xe/xe_hw_engine.c +2 -0
@@ -572,6 +572,8 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,hw_engine_setup_default_state (hwe);xe_reg_sr_init (&hwe->reg_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_sr, hwe->name,gt_to_xe (gt));xe_reg_whitelist_process_engine (hwe); }
drivers/gpu/drm/xe/xe_hw_engine_types.h +8 -0
@@ -130,6 +130,14 @@ struct xe_hw_engine {* @reg_whitelist: table with registers to be whitelisted */ struct xe_reg_sr reg_whitelist; +/** +* @oa_whitelist: oa registers to be whitelisted +*/ +struct xe_reg_sr oa_whitelist; +/** +* @oa_sr: oa nonpriv whitelist registers, changed on oa stream open/close +*/ +struct xe_reg_sr oa_sr;/** * @reg_lrc: LRC workaround registers */
drivers/gpu/drm/xe/xe_reg_whitelist.c +5 -0
@@ -103,6 +103,9 @@ static const struct xe_rtp_table_sr register_whitelist = XE_RTP_TABLE_SR(WHITELIST (VFLSKPD , RING_FORCE_TO_NONPRIV_ACCESS_RW)) }, +); + +static const struct xe_rtp_table_sr oa_whitelist =XE_RTP_TABLE_SR ( #define WHITELIST_DENY(r, f) WHITELIST(r, (f) | RING_FORCE_TO_NONPRIV_DENY)
@@ -206,6 +209,8 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe)xe_rtp_process_to_sr (&ctx, ®ister_whitelist, &hwe->reg_whitelist, false);whitelist_apply_to_hwe (hwe); + +xe_rtp_process_to_sr (&ctx, &oa_whitelist, &hwe->oa_whitelist, false); }/**
Sasha Levin
maintainerPATCH 1/3 drm/xe/rtp: Drop rule matching cases from rtp_to_sr_cases and rtp_cases
From: Gustavo Sousa <[email protected]>
[ Upstream commit ff7746336b2325087aa7958d40f327bcc50185f8 ]
The kunit test cases for the RTP framework are currently separated into three groups:
(1) rtp_rules_cases:
Those to verify rule matching logic.
(2) rtp_to_sr_cases:
Those to verify generation of save/restore tables from RTP tables.
(3) rtp_cases
Those to verify processing of RTP tables without save/restore action associated, which are used for OOB workarounds.
Today we have some cases in (2) and (3) that are actually meant to verify rule matching logic. Now that we have (1), let's cleanup (2) and (3) so that they become focused on their main objectives.
Stable-dep-of: 31e243756162 ("drm/xe/rtp: Maintain OA whitelists separately")
--- drivers/gpu/drm/xe/tests/xe_rtp_test.c | 122 ++----------------------- 1 file changed, 6 insertions(+), 116 deletions(-)
drivers/gpu/drm/xe/tests/xe_rtp_test.c +6 -116
@@ -99,80 +99,6 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { {} }, }, - { - .name = "match-or", - .expected_reg = REGULAR_REG1, - .expected_set_bits = REG_BIT(0) | REG_BIT(1) | REG_BIT(2), - .expected_clr_bits = REG_BIT(0) | REG_BIT(1) | REG_BIT(2), - .expected_active = BIT(0) | BIT(1) | BIT(2), - .expected_count_sr_entries = 1, - .entries = (const struct xe_rtp_entry_sr []) { - {XE_RTP_NAME ("first" ), -XE_RTP_RULES (FUNC (match_yes),OR ,FUNC (match_no)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (0 ))) - }, - {XE_RTP_NAME ("middle" ), -XE_RTP_RULES (FUNC (match_no),FUNC (match_no),OR , -FUNC (match_yes),OR , -FUNC (match_no)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (1 ))) - }, - {XE_RTP_NAME ("last" ), -XE_RTP_RULES (FUNC (match_no),OR ,FUNC (match_yes)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (2 ))) - }, - {XE_RTP_NAME ("no-match" ), -XE_RTP_RULES (FUNC (match_no),OR ,FUNC (match_no)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (3 ))) - }, - {} - }, - }, - { - .name = "match-or-xfail", - .expected_reg = REGULAR_REG1, - .expected_count_sr_entries = 0, - .entries = (const struct xe_rtp_entry_sr []) { - {XE_RTP_NAME ("leading-or" ), -XE_RTP_RULES (OR ,FUNC (match_yes)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (0 ))) - }, - {XE_RTP_NAME ("trailing-or" ), -/* -* First condition is match_no, otherwise the failure -* wouldn't really trigger as RTP stops processing as -* soon as it has a matching set of rules -*/ -XE_RTP_RULES (FUNC (match_no),OR ), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (1 ))) - }, - {XE_RTP_NAME ("no-or-or-yes" ), -XE_RTP_RULES (FUNC (match_no),OR ,OR ,FUNC (match_yes)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (2 ))) - }, - {} - }, - }, - { - .name = "no-match-no-add-multiple-rules", - .expected_reg = REGULAR_REG1, - .expected_set_bits = REG_BIT(0), - .expected_clr_bits = REG_BIT(0), - .expected_active = BIT(0), - .expected_count_sr_entries = 1, -/* Don't coalesce second entry due to one of the rules */ - .entries = (const struct xe_rtp_entry_sr []) { - {XE_RTP_NAME ("basic-1" ), -XE_RTP_RULES (FUNC (match_yes)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (0 ))) - }, - {XE_RTP_NAME ("basic-2" ), -XE_RTP_RULES (FUNC (match_yes),FUNC (match_no)), -XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (1 ))) - }, - {} - }, - }, { .name = "two-regs-two-entries", .expected_reg = REGULAR_REG1,
@@ -400,33 +326,15 @@ static const struct rtp_test_case rtp_cases[] = { }, }, { - .name = "inactive-1st_or_active-inactive", + .name = "inactive-active-inactive", .expected_active = BIT(1), .entries = (const struct xe_rtp_entry []) { {XE_RTP_NAME ("r1" ),XE_RTP_RULES (FUNC (match_no)), }, - {XE_RTP_NAME ("r2_or_conditions" ), -XE_RTP_RULES (FUNC (match_yes),OR , -FUNC (match_no),OR , -FUNC (match_no)) }, - {XE_RTP_NAME ("r3" ), -XE_RTP_RULES (FUNC (match_no)), - }, - {} - }, - }, - { - .name = "inactive-2nd_or_active-inactive", - .expected_active = BIT(1), - .entries = (const struct xe_rtp_entry []) { - {XE_RTP_NAME ("r1" ), -XE_RTP_RULES (FUNC (match_no)), + {XE_RTP_NAME ("r2" ), +XE_RTP_RULES (FUNC (match_yes)), }, - {XE_RTP_NAME ("r2_or_conditions" ), -XE_RTP_RULES (FUNC (match_no),OR , -FUNC (match_yes),OR , -FUNC (match_no)) }, {XE_RTP_NAME ("r3" ),XE_RTP_RULES (FUNC (match_no)), },
@@ -434,33 +342,15 @@ static const struct rtp_test_case rtp_cases[] = { }, }, { - .name = "inactive-last_or_active-inactive", - .expected_active = BIT(1), + .name = "inactive-inactive-inactive", + .expected_active = 0, .entries = (const struct xe_rtp_entry []) { {XE_RTP_NAME ("r1" ),XE_RTP_RULES (FUNC (match_no)), }, - {XE_RTP_NAME ("r2_or_conditions" ), -XE_RTP_RULES (FUNC (match_no),OR , -FUNC (match_no),OR , -FUNC (match_yes)) }, - {XE_RTP_NAME ("r3" ), -XE_RTP_RULES (FUNC (match_no)), - }, - {} - }, - }, - { - .name = "inactive-no_or_active-inactive", - .expected_active = 0, - .entries = (const struct xe_rtp_entry []) { - {XE_RTP_NAME ("r1" ), + {XE_RTP_NAME ("r2" ),XE_RTP_RULES (FUNC (match_no)), }, - {XE_RTP_NAME ("r2_or_conditions" ), -XE_RTP_RULES (FUNC (match_no),OR , -FUNC (match_no),OR , -FUNC (match_no)) }, {XE_RTP_NAME ("r3" ),XE_RTP_RULES (FUNC (match_no)), },
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 drm/xe/rtp: Add struct types for RTP tables
From: Gustavo Sousa <[email protected]>
[ Upstream commit e23fafb8594ea886ee03e005cc32dfda24f417cf ]
We currently have a mixture of styles for our RTP tables with respect of how we define the number of entries:
* xe_rtp_process_to_sr() expects to receive the number of entries as
arguments;
* xe_rtp_process() expects the array to have a sentinel at the end of
the array; * in xe_rtp_test.c, even though xe_rtp_process_to_sr() does not require a sentinel value, we need to rely on that technique to be able to count xe_rtp_entry_sr entries because simply using ARRAY_SIZE() is not possible.
The style used by xe_rtp_process_to_sr() makes it hard to share the tables with other compilation units (e.g. kunit tests), since the number of entries is calculated with ARRAY_SIZE(), which is done at compile time.
Since we use the size of the tables to create some bitmasks, using a sentinel style doesn't seem great either.
A way to reconcile things into a single style is to have a struct type that would hold the entries array and the number of entries. Since we have xe_rtp_entry and xe_rtp_entry_sr, we would have one type for each.
The advantage of the proposed approach is that now we have a nice way to share the tables directly to kunit tests with information about their size.
v6:
- Removed sentinels that are not needed
v5:
- Removed added code from conflict resolution issues
v4:
- Removed conflicts with main branch
v3:
- No changes
v2:
- Add compatibility with new xe_rtp_table_sr format for "bad-mcr-reg-forced-to-regular" and "bad-regular-reg-forced-to-mcr"
Stable-dep-of: 31e243756162 ("drm/xe/rtp: Maintain OA whitelists separately")
--- drivers/gpu/drm/xe/tests/xe_rtp_test.c | 92 ++++++++++---------------- drivers/gpu/drm/xe/xe_hw_engine.c | 14 ++-- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 +- drivers/gpu/drm/xe/xe_rtp.c | 35 +++++----- drivers/gpu/drm/xe/xe_rtp.h | 14 +++- drivers/gpu/drm/xe/xe_rtp_types.h | 10 +++ drivers/gpu/drm/xe/xe_tuning.c | 23 +++---- drivers/gpu/drm/xe/xe_wa.c | 70 ++++++++++---------- 8 files changed, 130 insertions(+), 135 deletions(-)
drivers/gpu/drm/xe/tests/xe_rtp_test.c +36 -56
@@ -39,13 +39,13 @@ struct rtp_to_sr_test_case {unsigned long expected_count_sr_entries;unsigned int expected_sr_errors;unsigned long expected_active; -const struct xe_rtp_entry_sr *entries; +const struct xe_rtp_table_sr table; };struct rtp_test_case {const char *name;unsigned long expected_active; -const struct xe_rtp_entry *entries; +const struct xe_rtp_table table; };static bool match_yes (const struct xe_gt *gt,const struct xe_hw_engine *hwe)
@@ -67,7 +67,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1), .expected_count_sr_entries = 1,/* Different bits on the same register: create a single entry */ - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -76,8 +76,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes)),XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (1 ))) }, - {} - }, + ), }, { .name = "no-match-no-add",
@@ -87,7 +86,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0), .expected_count_sr_entries = 1,/* Don't coalesce second entry since rules don't match */ - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -96,8 +95,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_no)),XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (1 ))) }, - {} - }, + ), }, { .name = "two-regs-two-entries",
@@ -107,7 +105,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1), .expected_count_sr_entries = 2,/* Same bits on different registers are not coalesced */ - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -116,8 +114,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes)),XE_RTP_ACTIONS (SET (REGULAR_REG2 ,REG_BIT (0 ))) }, - {} - }, + ), }, { .name = "clr-one-set-other",
@@ -127,7 +124,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1), .expected_count_sr_entries = 1,/* Check clr vs set actions on different bits */ - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -136,8 +133,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes)),XE_RTP_ACTIONS (CLR (REGULAR_REG1 ,REG_BIT (1 ))) }, - {} - }, + ), }, { #define TEMP_MASK REG_GENMASK(10, 8)
@@ -149,14 +145,13 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0), .expected_count_sr_entries = 1,/* Check FIELD_SET works */ - .entries = (const struct xe_rtp_entry_sr[]) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(FIELD_SET(REGULAR_REG1, TEMP_MASK, TEMP_FIELD)) }, - {} - }, + ), #undef TEMP_MASK #undef TEMP_FIELD },
@@ -168,7 +163,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1), .expected_count_sr_entries = 1, .expected_sr_errors = 1, - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -178,8 +173,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes)),XE_RTP_ACTIONS (SET (REGULAR_REG1 ,REG_BIT (0 ))) }, - {} - }, + ), }, { .name = "conflict-not-disjoint",
@@ -189,7 +183,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1), .expected_count_sr_entries = 1, .expected_sr_errors = 1, - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -199,8 +193,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes)),XE_RTP_ACTIONS (CLR (REGULAR_REG1 ,REG_GENMASK (1 ,0 ))) }, - {} - }, + ), }, { .name = "conflict-reg-type",
@@ -210,7 +203,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0) | BIT(1) | BIT(2), .expected_count_sr_entries = 1, .expected_sr_errors = 2, - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("basic-1"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
@@ -225,8 +218,7 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {XE_RTP_RULES (FUNC (match_yes )), XE_RTP_ACTIONS(SET(MASKED_REG1, REG_BIT(0))) }, - {} - }, + ), }, };
@@ -238,15 +230,12 @@ static void xe_rtp_process_to_sr_tests(struct kunit *test)struct xe_reg_sr *reg_sr = >->reg_sr;const struct xe_reg_sr_entry *sre, *sr_entry =NULL ;struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (gt); -unsigned long idx, count_sr_entries =0 , count_rtp_entries =0 , active =0 ; +unsigned long idx, count_sr_entries =0 , active =0 ;xe_reg_sr_init (reg_sr,"xe_rtp_to_sr_tests" , xe); -while (param->entries[count_rtp_entries].rules) - count_rtp_entries++; - -xe_rtp_process_ctx_enable_active_tracking (&ctx, &active, count_rtp_entries); -xe_rtp_process_to_sr (&ctx, param->entries, reg_sr); +xe_rtp_process_ctx_enable_active_tracking (&ctx, &active, param->table.n_entries); +xe_rtp_process_to_sr (&ctx, ¶m->table, reg_sr);xa_for_each (®_sr->xa, idx, sre) {if (idx == param->expected_reg.addr)
@@ -279,56 +268,52 @@ static const struct rtp_test_case rtp_cases[] = { { .name = "active1", .expected_active = BIT(0), - .entries = (const struct xe_rtp_entry[]) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_yes)), }, - {} - }, + ), }, { .name = "active2", .expected_active = BIT(0) | BIT(1), - .entries = (const struct xe_rtp_entry []) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_yes)), }, { XE_RTP_NAME("r2"), XE_RTP_RULES(FUNC(match_yes)), }, - {} - }, + ), }, { .name = "active-inactive", .expected_active = BIT(0), - .entries = (const struct xe_rtp_entry []) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_yes)), }, { XE_RTP_NAME("r2"), XE_RTP_RULES(FUNC(match_no)), }, - {} - }, + ), }, { .name = "inactive-active", .expected_active = BIT(1), - .entries = (const struct xe_rtp_entry []) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_no)), }, { XE_RTP_NAME("r2"), XE_RTP_RULES(FUNC(match_yes)), }, - {} - }, + ), }, { .name = "inactive-active-inactive", .expected_active = BIT(1), - .entries = (const struct xe_rtp_entry []) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_no)), },
@@ -338,13 +323,12 @@ static const struct rtp_test_case rtp_cases[] = { { XE_RTP_NAME("r3"), XE_RTP_RULES(FUNC(match_no)), }, - {} - }, + ), }, { .name = "inactive-inactive-inactive", .expected_active = 0, - .entries = (const struct xe_rtp_entry[]) { + .table = XE_RTP_TABLE( { XE_RTP_NAME("r1"), XE_RTP_RULES(FUNC(match_no)), },
@@ -354,8 +338,7 @@ static const struct rtp_test_case rtp_cases[] = { {XE_RTP_NAME ("r3" ), XE_RTP_RULES(FUNC(match_no)), }, - {} - }, + ), }, };
@@ -365,13 +348,10 @@ static void xe_rtp_process_tests(struct kunit *test)struct xe_device *xe = test->priv;struct xe_gt *gt =xe_device_get_root_tile (xe)->primary_gt;struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (gt); -unsigned long count_rtp_entries =0 , active =0 ; - -while (param->entries[count_rtp_entries].rules) - count_rtp_entries++; +unsigned long active =0 ; -xe_rtp_process_ctx_enable_active_tracking (&ctx, &active, count_rtp_entries); -xe_rtp_process (&ctx, param->entries); +xe_rtp_process_ctx_enable_active_tracking (&ctx, &active, param->table.n_entries); +xe_rtp_process (&ctx, ¶m->table);KUNIT_EXPECT_EQ (test, active, param->expected_active); }
drivers/gpu/drm/xe/xe_hw_engine.c +6 -8
@@ -366,7 +366,7 @@ xe_hw_engine_setup_default_lrc_state(struct xe_hw_engine *hwe)u32 blit_cctl_val =REG_FIELD_PREP (BLIT_CCTL_DST_MOCS_MASK , mocs_write_idx) |REG_FIELD_PREP (BLIT_CCTL_SRC_MOCS_MASK , mocs_read_idx);struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe); -const struct xe_rtp_entry_sr lrc_setup[] = { + const struct xe_rtp_table_sr lrc_setup = XE_RTP_TABLE_SR(/* * Some blitter commands do not have a field for MOCS, those * commands will use MOCS index pointed by BLIT_CCTL.
@@ -389,10 +389,9 @@ xe_hw_engine_setup_default_lrc_state(struct xe_hw_engine *hwe) PREEMPT_GPGPU_THREAD_GROUP_LEVEL)),XE_RTP_ENTRY_FLAG (FOREACH_ENGINE ) }, - {} - }; + ); - xe_rtp_process_to_sr(&ctx, lrc_setup, &hwe->reg_lrc); +xe_rtp_process_to_sr (&ctx, &lrc_setup, &hwe->reg_lrc); } static void
@@ -417,7 +416,7 @@ hw_engine_setup_default_state(struct xe_hw_engine *hwe)u32 ring_cmd_cctl_val =REG_FIELD_PREP (CMD_CCTL_WRITE_OVERRIDE_MASK , mocs_write_idx) |REG_FIELD_PREP (CMD_CCTL_READ_OVERRIDE_MASK , mocs_read_idx);struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe); -const struct xe_rtp_entry_sr engine_entries[] = { + const struct xe_rtp_table_sr engine_sr = XE_RTP_TABLE_SR( { XE_RTP_NAME("RING_CMD_CCTL_default_MOCS"), XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, XE_RTP_END_VERSION_UNDEFINED)), XE_RTP_ACTIONS(FIELD_SET(RING_CMD_CCTL(0),
@@ -454,10 +453,9 @@ hw_engine_setup_default_state(struct xe_hw_engine *hwe)XE_RTP_ACTIONS (FIELD_SET (RCU_MODE ,RCU_MODE_FIXED_SLICE_CCS_MODE ,RCU_MODE_FIXED_SLICE_CCS_MODE )) }, - {} - }; + ); -xe_rtp_process_to_sr (&ctx, engine_entries, &hwe->reg_sr); +xe_rtp_process_to_sr (&ctx, &engine_sr, &hwe->reg_sr); } static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,
drivers/gpu/drm/xe/xe_reg_whitelist.c +3 -4
@@ -23,7 +23,7 @@ static bool match_not_render(const struct xe_gt *gt,return hwe->class !=XE_ENGINE_CLASS_RENDER ; } -static const struct xe_rtp_entry_sr register_whitelist[] = { +static const struct xe_rtp_table_sr register_whitelist = XE_RTP_TABLE_SR( { XE_RTP_NAME("WaAllowPMDepthAndInvocationCountAccessFromUMD, 1408556865"), XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1210), ENGINE_CLASS(RENDER)), XE_RTP_ACTIONS(WHITELIST(PS_INVOCATION_COUNT,
@@ -86,8 +86,7 @@ static const struct xe_rtp_entry_sr register_whitelist[] = {RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)) }, - {} -}; +);/** * xe_reg_whitelist_process_engine - process table of registers to whitelist
@@ -101,7 +100,7 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe) {struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe); -xe_rtp_process_to_sr (&ctx, register_whitelist, &hwe->reg_whitelist); +xe_rtp_process_to_sr (&ctx, ®ister_whitelist, &hwe->reg_whitelist); }/**
drivers/gpu/drm/xe/xe_rtp.c +20 -15
@@ -236,20 +236,19 @@ static void rtp_mark_active(struct xe_device *xe,* xe_rtp_process_to_sr - Process all rtp @entries, adding the matching ones to * the save-restore argument. * @ctx: The context for processing the table, with one of device, gt or hwe -* @entries: Table with RTP definitions +* @table: Table with RTP definitions * @sr: Save-restore struct where matching rules execute the action. This can be * viewed as the "coalesced view" of multiple the tables. The bits for each * register set are expected not to collide with previously added entries * -* Walk the table pointed by @entries (with an empty sentinel) and add all -* entries with matching rules to @sr. If @hwe is not NULL, its mmio_base is -* used to calculate the right register offset +* Walk the table pointed by @table and add all entries with matching rules to +* @sr. If @hwe is not NULL, its mmio_base is used to calculate the right +* register offset */ void xe_rtp_process_to_sr (struct xe_rtp_process_ctx *ctx, -const struct xe_rtp_entry_sr *entries, +const struct xe_rtp_table_sr *table,struct xe_reg_sr *sr) { -const struct xe_rtp_entry_sr *entry;struct xe_hw_engine *hwe =NULL ;struct xe_gt *gt =NULL ;struct xe_device *xe =NULL ;
@@ -259,7 +258,10 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,if (IS_SRIOV_VF (xe))return ; -for (entry = entries; entry && entry->name; entry++) { +xe_assert (xe, table->entries); + +for (size_t i =0 ; i < table->n_entries; i++) { +const struct xe_rtp_entry_sr *entry = &table->entries[i];bool match = false;if (entry->flags &XE_RTP_ENTRY_FLAG_FOREACH_ENGINE ) {
@@ -274,37 +276,40 @@ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx, }if (match) -rtp_mark_active (xe, ctx, entry - entries); +rtp_mark_active (xe, ctx, i); } }EXPORT_SYMBOL_IF_KUNIT (xe_rtp_process_to_sr);/** -* xe_rtp_process - Process all rtp @entries, without running any action +* xe_rtp_process - Process all entries in rtp @table, without running any action * @ctx: The context for processing the table, with one of device, gt or hwe -* @entries: Table with RTP definitions +* @table: Table with RTP definitions * -* Walk the table pointed by @entries (with an empty sentinel), executing the +* Walk the table pointed by @table, executing the * rules. One difference from xe_rtp_process_to_sr(): there is no action * associated with each entry since this uses struct xe_rtp_entry. Its main use * is for marking active workarounds via * xe_rtp_process_ctx_enable_active_tracking(). */ void xe_rtp_process (struct xe_rtp_process_ctx *ctx, -const struct xe_rtp_entry *entries) +const struct xe_rtp_table *table) { -const struct xe_rtp_entry *entry;struct xe_hw_engine *hwe;struct xe_gt *gt;struct xe_device *xe;rtp_get_context (ctx, &hwe, >, &xe); -for (entry = entries; entry && entry->rules; entry++) { +xe_assert (xe, table->entries); + +for (size_t i =0 ; i < table->n_entries; i++) { +const struct xe_rtp_entry *entry = &table->entries[i]; +if (!rule_matches (xe, gt, hwe, entry->rules, entry->n_rules))continue ; -rtp_mark_active (xe, ctx, entry - entries); +rtp_mark_active (xe, ctx, i); } }EXPORT_SYMBOL_IF_KUNIT (xe_rtp_process);
drivers/gpu/drm/xe/xe_rtp.h +12 -2
@@ -420,6 +420,16 @@ struct xe_reg_sr; XE_RTP_PASTE_FOREACH(ACTION_, COMMA, (__VA_ARGS__)) \ } +#define XE_RTP_TABLE_SR (...) { \ + .entries = (const struct xe_rtp_entry_sr[]){__VA_ARGS__}, \ + .n_entries = ARRAY_SIZE(((const struct xe_rtp_entry_sr[]){__VA_ARGS__})), \ +} + +#define XE_RTP_TABLE (...) { \ + .entries = (const struct xe_rtp_entry[]){__VA_ARGS__}, \ + .n_entries = ARRAY_SIZE(((const struct xe_rtp_entry[]){__VA_ARGS__})), \ +} +#define XE_RTP_PROCESS_CTX_INITIALIZER (arg__) _Generic((arg__), \ struct xe_hw_engine * : (struct xe_rtp_process_ctx){ { (void *)(arg__) }, XE_RTP_PROCESS_TYPE_ENGINE }, \ struct xe_gt * : (struct xe_rtp_process_ctx){ { (void *)(arg__) }, XE_RTP_PROCESS_TYPE_GT })
@@ -429,11 +439,11 @@ void xe_rtp_process_ctx_enable_active_tracking(struct xe_rtp_process_ctx *ctx, size_t n_entries);void xe_rtp_process_to_sr (struct xe_rtp_process_ctx *ctx, -const struct xe_rtp_entry_sr *entries, +const struct xe_rtp_table_sr *table,struct xe_reg_sr *sr);void xe_rtp_process (struct xe_rtp_process_ctx *ctx, -const struct xe_rtp_entry *entries); +const struct xe_rtp_table *table);/* Match functions to be used with XE_RTP_MATCH_FUNC */
drivers/gpu/drm/xe/xe_rtp_types.h +10 -0
@@ -109,6 +109,16 @@ struct xe_rtp_entry {u8 n_rules; }; +struct xe_rtp_table_sr { +const struct xe_rtp_entry_sr *entries; +size_t n_entries; +}; + +struct xe_rtp_table { +const struct xe_rtp_entry *entries; +size_t n_entries; +}; +enum xe_rtp_process_type {XE_RTP_PROCESS_TYPE_GT ,XE_RTP_PROCESS_TYPE_ENGINE ,
drivers/gpu/drm/xe/xe_tuning.c +9 -14
@@ -15,7 +15,7 @@#undef XE_REG_MCR#define XE_REG_MCR (...) XE_REG(__VA_ARGS__, .mcr = 1) -static const struct xe_rtp_entry_sr gt_tunings[] = { +static const struct xe_rtp_table_sr gt_tunings = XE_RTP_TABLE_SR( { XE_RTP_NAME("Tuning: Blend Fill Caching Optimization Disable"), XE_RTP_RULES(PLATFORM(DG2)), XE_RTP_ACTIONS(SET(XEHP_L3SCQREG7, BLEND_FILL_CACHING_OPT_DIS))
@@ -83,20 +83,17 @@ static const struct xe_rtp_entry_sr gt_tunings[] = { XE_RTP_RULES(MEDIA_VERSION(2000)),XE_RTP_ACTIONS (SET (XE2LPM_SCRATCH3_LBCF ,RWFLUSHALLEN )) }, +); - {} -}; - -static const struct xe_rtp_entry_sr engine_tunings[] = { +static const struct xe_rtp_table_sr engine_tunings = XE_RTP_TABLE_SR( { XE_RTP_NAME("Tuning: Set Indirect State Override"), XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, 1274), ENGINE_CLASS(RENDER)), XE_RTP_ACTIONS(SET(SAMPLER_MODE, INDIRECT_STATE_BASE_ADDR_OVERRIDE)) }, - {} -}; +); -static const struct xe_rtp_entry_sr lrc_tunings[] = { +static const struct xe_rtp_table_sr lrc_tunings = XE_RTP_TABLE_SR( /* DG2 */ { XE_RTP_NAME("Tuning: L3 cache"),
@@ -131,15 +128,13 @@ static const struct xe_rtp_entry_sr lrc_tunings[] = {XE_RTP_ACTIONS (FIELD_SET (FF_MODE ,VS_HIT_MAX_VALUE_MASK ,REG_FIELD_PREP (VS_HIT_MAX_VALUE_MASK ,0x3f ))) }, - - {} -}; +);void xe_tuning_process_gt (struct xe_gt *gt) {struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (gt); -xe_rtp_process_to_sr (&ctx, gt_tunings, >->reg_sr); +xe_rtp_process_to_sr (&ctx, >_tunings, >->reg_sr); }EXPORT_SYMBOL_IF_KUNIT (xe_tuning_process_gt);
@@ -147,7 +142,7 @@ void xe_tuning_process_engine(struct xe_hw_engine *hwe) {struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe); -xe_rtp_process_to_sr (&ctx, engine_tunings, &hwe->reg_sr); +xe_rtp_process_to_sr (&ctx, &engine_tunings, &hwe->reg_sr); }EXPORT_SYMBOL_IF_KUNIT (xe_tuning_process_engine);
@@ -163,5 +158,5 @@ void xe_tuning_process_lrc(struct xe_hw_engine *hwe) {struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe); -xe_rtp_process_to_sr (&ctx, lrc_tunings, &hwe->reg_lrc); +xe_rtp_process_to_sr (&ctx, &lrc_tunings, &hwe->reg_lrc); }
drivers/gpu/drm/xe/xe_wa.c +34 -36
143 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 drm/xe/rtp: Maintain OA whitelists separately
In reply to Sasha LevinFrom: Ashutosh Dixit <[email protected]>
[ Upstream commit 31e2437561621b4867c08efc890bf629d017df03 ]
OA registers are dynamically whitelisted (and again dewhitelisted) on OA stream open/close. Maintaining OA whitelists separately from non-OA register whitlists simplifies this management of OA register whitelisting/dewhitelisting.
--- drivers/gpu/drm/xe/xe_gt_debugfs.c | 4 +++- drivers/gpu/drm/xe/xe_hw_engine.c | 2 ++ drivers/gpu/drm/xe/xe_hw_engine_types.h | 8 ++++++++ drivers/gpu/drm/xe/xe_reg_whitelist.c | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_debugfs.c +3 -1
@@ -191,8 +191,10 @@ static int register_save_restore(struct xe_gt *gt, struct drm_printer *p)drm_printf (p,"\n" );drm_printf (p,"Whitelist\n" ); -for_each_hw_engine (hwe, gt, id) +for_each_hw_engine (hwe, gt, id) {xe_reg_whitelist_dump (&hwe->reg_whitelist, p); +xe_reg_whitelist_dump (&hwe->oa_whitelist, p); + }xe_pm_runtime_put (gt_to_xe (gt));
drivers/gpu/drm/xe/xe_hw_engine.c +2 -0
@@ -530,6 +530,8 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,hw_engine_setup_default_state (hwe);xe_reg_sr_init (&hwe->reg_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_sr, hwe->name,gt_to_xe (gt));xe_reg_whitelist_process_engine (hwe); }
drivers/gpu/drm/xe/xe_hw_engine_types.h +8 -0
@@ -128,6 +128,14 @@ struct xe_hw_engine {* @reg_whitelist: table with registers to be whitelisted */ struct xe_reg_sr reg_whitelist; +/** +* @oa_whitelist: oa registers to be whitelisted +*/ +struct xe_reg_sr oa_whitelist; +/** +* @oa_sr: oa nonpriv whitelist registers, changed on oa stream open/close +*/ +struct xe_reg_sr oa_sr;/** * @reg_lrc: LRC workaround registers */
drivers/gpu/drm/xe/xe_reg_whitelist.c +5 -0
@@ -64,6 +64,9 @@ static const struct xe_rtp_table_sr register_whitelist = XE_RTP_TABLE_SR( ENGINE_CLASS(RENDER)),XE_RTP_ACTIONS (WHITELIST (CSBE_DEBUG_STATUS (RENDER_RING_BASE ),0 )) }, +); + +static const struct xe_rtp_table_sr oa_whitelist = XE_RTP_TABLE_SR( { XE_RTP_NAME("oa_reg_render"), XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, XE_RTP_END_VERSION_UNDEFINED), ENGINE_CLASS(RENDER)),
@@ -101,6 +104,8 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe)struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe);xe_rtp_process_to_sr (&ctx, ®ister_whitelist, &hwe->reg_whitelist); + +xe_rtp_process_to_sr (&ctx, &oa_whitelist, &hwe->oa_whitelist); }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/xe/rtp: Maintain OA whitelists separately
In reply to [email protected]From: Ashutosh Dixit <[email protected]>
[ Upstream commit 31e2437561621b4867c08efc890bf629d017df03 ]
OA registers are dynamically whitelisted (and again dewhitelisted) on OA stream open/close. Maintaining OA whitelists separately from non-OA register whitlists simplifies this management of OA register whitelisting/dewhitelisting.
--- drivers/gpu/drm/xe/xe_gt_debugfs.c | 4 +++- drivers/gpu/drm/xe/xe_hw_engine.c | 2 ++ drivers/gpu/drm/xe/xe_hw_engine_types.h | 8 ++++++++ drivers/gpu/drm/xe/xe_reg_whitelist.c | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_gt_debugfs.c +3 -1
@@ -191,8 +191,10 @@ static int register_save_restore(struct xe_gt *gt, struct drm_printer *p)drm_printf (p,"\n" );drm_printf (p,"Whitelist\n" ); -for_each_hw_engine (hwe, gt, id) +for_each_hw_engine (hwe, gt, id) {xe_reg_whitelist_dump (&hwe->reg_whitelist, p); +xe_reg_whitelist_dump (&hwe->oa_whitelist, p); + }xe_pm_runtime_put (gt_to_xe (gt));
drivers/gpu/drm/xe/xe_hw_engine.c +2 -0
@@ -532,6 +532,8 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe,hw_engine_setup_default_state (hwe);xe_reg_sr_init (&hwe->reg_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_whitelist, hwe->name,gt_to_xe (gt)); +xe_reg_sr_init (&hwe->oa_sr, hwe->name,gt_to_xe (gt));xe_reg_whitelist_process_engine (hwe); }
drivers/gpu/drm/xe/xe_hw_engine_types.h +8 -0
@@ -128,6 +128,14 @@ struct xe_hw_engine {* @reg_whitelist: table with registers to be whitelisted */ struct xe_reg_sr reg_whitelist; +/** +* @oa_whitelist: oa registers to be whitelisted +*/ +struct xe_reg_sr oa_whitelist; +/** +* @oa_sr: oa nonpriv whitelist registers, changed on oa stream open/close +*/ +struct xe_reg_sr oa_sr;/** * @reg_lrc: LRC workaround registers */
drivers/gpu/drm/xe/xe_reg_whitelist.c +5 -0
@@ -64,6 +64,10 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { ENGINE_CLASS(RENDER)), XE_RTP_ACTIONS(WHITELIST(CSBE_DEBUG_STATUS(RENDER_RING_BASE), 0)) }, + {} +}; + +static const struct xe_rtp_entry_sr oa_whitelist[] = { {XE_RTP_NAME ("oa_reg_render" ),XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,XE_RTP_END_VERSION_UNDEFINED ),ENGINE_CLASS (RENDER )),
@@ -102,6 +106,7 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe)struct xe_rtp_process_ctx ctx =XE_RTP_PROCESS_CTX_INITIALIZER (hwe);xe_rtp_process_to_sr (&ctx, register_whitelist, &hwe->reg_whitelist); +xe_rtp_process_to_sr (&ctx, oa_whitelist, &hwe->oa_whitelist); }/**
Signature · 1 line
2.53.0