FAILED: patch "[PATCH] drm/xe/rtp: Generalize whitelist_apply_to_hwe" 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 4fe2844b0f0c7cdc45ca4c4c62ca56b7f26c514c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072935-vicinity-override-18e2@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 4fe2844b0f0c7cdc45ca4c4c62ca56b7f26c514c Mon Sep 17 00:00:00 2001
From: Ashutosh Dixit <[email protected]>
Date: Mon, 15 Jun 2026 15:42:22 -0700
Subject: [PATCH] drm/xe/rtp: Generalize whitelist_apply_to_hwe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Generalize whitelist_apply_to_hwe to construct both non-OA and OA whitelist nonpriv registers.
drivers/gpu/drm/xe/xe_reg_whitelist.c +6 -5
@@ -161,9 +161,10 @@ static const struct xe_rtp_table_sr oa_whitelist = XE_RTP_TABLE_SR( }, ); -static int whitelist_apply_to_hwe (struct xe_hw_engine *hwe) +static int whitelist_apply_to_hwe (struct xe_hw_engine *hwe,struct xe_reg_sr *in, +struct xe_reg_sr *out,int first_slot) { -struct xe_reg_sr *sr = &hwe->reg_whitelist; +struct xe_reg_sr *sr = in;struct xe_reg_sr_entry *entry;struct drm_printer p;unsigned long reg;
@@ -172,7 +173,7 @@ static int whitelist_apply_to_hwe(struct xe_hw_engine *hwe)xe_gt_dbg (hwe->gt,"Add %s whitelist to engine\n" , sr->name); p =xe_gt_dbg_printer (hwe->gt); - slot =0 ; + slot = first_slot;xa_for_each (&sr->xa, reg, entry) {struct xe_reg_sr_entry hwe_entry = { .reg =RING_FORCE_TO_NONPRIV (hwe->mmio_base, slot),
@@ -189,7 +190,7 @@ static int whitelist_apply_to_hwe(struct xe_hw_engine *hwe) }xe_reg_whitelist_print_entry (&p,0 , reg, entry); -xe_reg_sr_add (&hwe->reg_sr, &hwe_entry, hwe->gt); +xe_reg_sr_add (out, &hwe_entry, hwe->gt); slot++; }
@@ -211,7 +212,7 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe)int first_oa_slot;xe_rtp_process_to_sr (&ctx, ®ister_whitelist, &hwe->reg_whitelist, false); - first_oa_slot =whitelist_apply_to_hwe (hwe); + first_oa_slot =whitelist_apply_to_hwe (hwe, &hwe->reg_whitelist, &hwe->reg_sr,0 );xe_rtp_process_to_sr (&ctx, &oa_whitelist, &hwe->oa_whitelist, false); }
Sasha Levin
maintainerPATCH 1/5 drm/xe/mcr: Extract reg_in_steering_type_ranges()
From: Gustavo Sousa <[email protected]>
[ Upstream commit cdf8489533f4dd9639fd0c266dd2ec8f7a543e34 ]
The logic to check if a register falls within one of the ranges for a steering type is already duplicated in xe_gt_mcr_get_nonterminated_steering(). We will also want to use that same logic in another upcoming function. Let's factor out that logic and put it into a function named reg_in_steering_type_ranges().
Stable-dep-of: 4fe2844b0f0c ("drm/xe/rtp: Generalize whitelist_apply_to_hwe")
--- drivers/gpu/drm/xe/xe_gt_mcr.c | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/xe_gt_mcr.c +20 -15
@@ -505,6 +505,20 @@ void xe_gt_mcr_set_implicit_defaults(struct xe_gt *gt) } } +static bool reg_in_steering_type_ranges (struct xe_gt *gt, +struct xe_reg reg, +int type) +{ +if (!gt->steering[type].ranges) +return false; + +for (int i =0 ; gt->steering[type].ranges[i].end >0 ; i++) +if (xe_mmio_in_range (gt, >->steering[type].ranges[i], reg)) +return true; + +return false; +} +/* * xe_gt_mcr_get_nonterminated_steering - find group/instance values that * will steer a register to a non-terminated instance
@@ -526,26 +540,17 @@ static bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt, u8 *group, u8 *instance) {const struct xe_reg reg =to_xe_reg (reg_mcr); -const struct xe_mmio_range *implicit_ranges;for (int type =0 ; type <IMPLICIT_STEERING ; type++) { -if (!gt->steering[type].ranges) -continue ; - -for (int i =0 ; gt->steering[type].ranges[i].end >0 ; i++) { -if (xe_mmio_in_range (gt, >->steering[type].ranges[i], reg)) { - *group = gt->steering[type].group_target; - *instance = gt->steering[type].instance_target; -return true; - } +if (reg_in_steering_type_ranges (gt, reg, type)) { + *group = gt->steering[type].group_target; + *instance = gt->steering[type].instance_target; +return true; } } - implicit_ranges = gt->steering[IMPLICIT_STEERING ].ranges; -if (implicit_ranges) -for (int i =0 ; implicit_ranges[i].end >0 ; i++) -if (xe_mmio_in_range (gt, &implicit_ranges[i], reg)) -return false; +if (reg_in_steering_type_ranges (gt, reg,IMPLICIT_STEERING )) +return false;/* * Not found in a steering table and not a register with implicit
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/5 drm/xe/reg_sr: Do sanity check for MCR vs non-MCR
From: Gustavo Sousa <[email protected]>
[ Upstream commit 058da4a2b164e477b02ca0562f01a9eb9e621cdd ]
The type struct xe_reg_mcr exists to ensure that the correct API is used when handling MCR registers. However, for the register save/restore functionality, the RTP processing always cast the register to a struct xe_reg and then apply_one_mmio() selects the MMIO API based on the "mcr" field of the register instance.
This allows the developer to commit mistakes like passing a MCR register for an RTP action for a GT where the respective register is not MCR; and vice-versa.
To capture such scenarios, do a sanity check in xe_reg_sr_add() that, upon an inconsistency:
- "fixes" the register type by favoring what we have in our MCR range tables instead of what the developer selected for the save/restore entry;
- raises a notice-level message to inform about the inconsistency.
Note: As a collateral of this change, we need to include MCR initialization in xe_wa_test.c, otherwise a bunch of test cases end up failing because xe_gt_mcr_check_reg() will always return false, meaning that will incorrectly say that a MCR register is not MCR.
v2:
- Downgrade messages to notice level so as not to block CI execution when inconsistencies are found. (Matt)
- Add missing EXPORT_SYMBOL_IF_KUNIT() calls. (Gustavo)
Stable-dep-of: 4fe2844b0f0c ("drm/xe/rtp: Generalize whitelist_apply_to_hwe")
--- drivers/gpu/drm/xe/tests/xe_rtp_test.c | 71 +++++++++++++++++++++++--- drivers/gpu/drm/xe/tests/xe_wa_test.c | 10 +++- drivers/gpu/drm/xe/xe_gt_mcr.c | 52 ++++++++++++++----- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 + drivers/gpu/drm/xe/xe_reg_sr.c | 36 +++++++++++++ 5 files changed, 151 insertions(+), 20 deletions(-)
drivers/gpu/drm/xe/tests/xe_rtp_test.c +64 -7
@@ -9,24 +9,30 @@#include <drm/drm_drv.h> #include <drm/drm_kunit_helpers.h> +#include <kunit/static_stub.h> #include <kunit/test.h> #include "regs/xe_gt_regs.h" #include "regs/xe_reg_defs.h" #include "xe_device.h" #include "xe_device_types.h" +#include "xe_gt_mcr.h" #include "xe_kunit_helpers.h" #include "xe_pci_test.h" #include "xe_reg_sr.h" #include "xe_rtp.h" -#define REGULAR_REG1 XE_REG(1) -#define REGULAR_REG2 XE_REG(2) -#define REGULAR_REG3 XE_REG(3) -#define MCR_REG1 XE_REG_MCR(1) -#define MCR_REG2 XE_REG_MCR(2) -#define MCR_REG3 XE_REG_MCR(3) -#define MASKED_REG1 XE_REG(1, XE_REG_OPTION_MASKED) +#define REGULAR_REG1 XE_REG(1) +#define REGULAR_REG2 XE_REG(2) +#define REGULAR_REG3 XE_REG(3) +#define REGULAR_REG4 XE_REG(4) +#define BAD_REGULAR_REG5 XE_REG(5) +#define MCR_REG1 XE_REG_MCR(1) +#define MCR_REG2 XE_REG_MCR(2) +#define MCR_REG3 XE_REG_MCR(3) +#define BAD_MCR_REG4 XE_REG_MCR(4) +#define MCR_REG5 XE_REG_MCR(5) +#define MASKED_REG1 XE_REG(1, XE_REG_OPTION_MASKED)#undef XE_REG_MCR#define XE_REG_MCR (...) XE_REG(__VA_ARGS__, .mcr = 1)
@@ -48,6 +54,23 @@ struct rtp_test_case {const struct xe_rtp_entry *entries; }; +static bool fake_xe_gt_mcr_check_reg (struct xe_gt *gt,struct xe_reg reg) +{ +/* +* All supported platforms in this imaginary setup will always have REG4 +* as a non-MCR register and REG5 as MCR, meaning that BAD_MCR_REG4 and +* BAD_REGULAR_REG5 represent programming errors to be captured by our +* tests. +*/ +if (reg.raw ==BAD_REGULAR_REG5 .raw) +return true; + +if (reg.raw ==BAD_MCR_REG4 .raw) +return false; + +return reg.mcr; +} +static bool match_yes (const struct xe_gt *gt,const struct xe_hw_engine *hwe) {return true;
@@ -302,6 +325,38 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { {} }, }, + { + .name = "bad-mcr-reg-forced-to-regular", + .expected_reg = REGULAR_REG4, + .expected_set_bits = REG_BIT(0), + .expected_clr_bits = REG_BIT(0), + .expected_active = BIT(0), + .expected_count_sr_entries = 1, + .expected_sr_errors = 1, + .entries = (const struct xe_rtp_entry_sr []) { + {XE_RTP_NAME ("bad-mcr-regular-reg" ), +XE_RTP_RULES (FUNC (match_yes)), +XE_RTP_ACTIONS (SET (BAD_MCR_REG4 ,REG_BIT (0 ))) + }, + {} + }, + }, + { + .name = "bad-regular-reg-forced-to-mcr", + .expected_reg = MCR_REG5, + .expected_set_bits = REG_BIT(0), + .expected_clr_bits = REG_BIT(0), + .expected_active = BIT(0), + .expected_count_sr_entries = 1, + .expected_sr_errors = 1, + .entries = (const struct xe_rtp_entry_sr []) { + {XE_RTP_NAME ("bad-regular-reg" ), +XE_RTP_RULES (FUNC (match_yes)), +XE_RTP_ACTIONS (SET (BAD_REGULAR_REG5 ,REG_BIT (0 ))) + }, + {} + }, + }, };static void xe_rtp_process_to_sr_tests (struct kunit *test)
@@ -520,6 +575,8 @@ static int xe_rtp_test_init(struct kunit *test) xe->drm.dev = dev; test->priv = xe; +kunit_activate_static_stub (test, xe_gt_mcr_check_reg, fake_xe_gt_mcr_check_reg); +return 0 ; }
drivers/gpu/drm/xe/tests/xe_wa_test.c +9 -1
@@ -9,6 +9,8 @@#include <kunit/test.h> #include "xe_device.h" +#include "xe_gt.h" +#include "xe_gt_mcr.h" #include "xe_kunit_helpers.h" #include "xe_pci_test.h" #include "xe_reg_sr.h"
@@ -95,8 +97,10 @@ static int xe_wa_test_init(struct kunit *test) .graphics_step = param->step.graphics, .media_step = param->step.media, }; -struct xe_device *xe;struct device *dev; +struct xe_device *xe; +struct xe_gt *gt; +int id;int ret; dev =drm_kunit_helper_alloc_device (test);
@@ -109,6 +113,10 @@ static int xe_wa_test_init(struct kunit *test) ret =xe_pci_fake_device_init (xe);KUNIT_ASSERT_EQ (test, ret,0 ); +/* Needed for sanitize_mcr(). */ +for_each_gt (gt, xe, id) +xe_gt_mcr_init_early (gt); +if (!param->graphics_verx100) xe->info.step = param->step;
drivers/gpu/drm/xe/xe_gt_mcr.c +40 -12
83 lines not on this page · raw message
drivers/gpu/drm/xe/xe_gt_mcr.h +2 -0
@@ -26,6 +26,8 @@ void xe_gt_mcr_unicast_write(struct xe_gt *gt, struct xe_reg_mcr mcr_reg,void xe_gt_mcr_multicast_write (struct xe_gt *gt,struct xe_reg_mcr mcr_reg,u32 value); +bool xe_gt_mcr_check_reg (struct xe_gt *gt,struct xe_reg reg); +void xe_gt_mcr_steering_dump (struct xe_gt *gt,struct drm_printer *p);void xe_gt_mcr_get_dss_steering (struct xe_gt *gt,unsigned int dss,u16 *group,u16 *instance);
drivers/gpu/drm/xe/xe_reg_sr.c +36 -0
@@ -72,14 +72,49 @@ static void reg_sr_inc_error(struct xe_reg_sr *sr)#endif } +static struct xe_reg sanitize_mcr (struct xe_reg_sr *sr, +const struct xe_reg_sr_entry *e, +struct xe_gt *gt) +{ +struct xe_reg reg = e->reg; +bool is_mcr; + +/* +* We need the gt structure to check MCR ranges. +*/ +if (!gt) +return reg; + + is_mcr =xe_gt_mcr_check_reg (gt, reg); + +if (is_mcr && !reg.mcr) { + reg.mcr =1 ; +xe_gt_notice (gt,"xe_reg_sr_entry using non-MCR register for address 0x%x, forcing MCR\n" , + reg.addr); +reg_sr_inc_error (sr); + } + +if (!is_mcr && reg.mcr) { + reg.mcr =0 ; +xe_gt_notice (gt,"xe_reg_sr_entry using MCR register for address 0x%x, forcing non-MCR\n" , + reg.addr); +reg_sr_inc_error (sr); + } + +return reg; +} +int xe_reg_sr_add (struct xe_reg_sr *sr,const struct xe_reg_sr_entry *e,struct xe_gt *gt) {unsigned long idx = e->reg.addr;struct xe_reg_sr_entry *pentry =xa_load (&sr->xa, idx); +struct xe_reg reg;int ret; + reg =sanitize_mcr (sr, e, gt); +if (pentry) {if (!compatible_entries (pentry, e)) { ret = -EINVAL ;
@@ -100,6 +135,7 @@ int xe_reg_sr_add(struct xe_reg_sr *sr, } *pentry = *e; + pentry->reg = reg; ret =xa_err (xa_store (&sr->xa, idx, pentry,GFP_KERNEL ));if (ret) goto fail_free;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/5 drm/xe/rtp: Drop rule matching cases from rtp_to_sr_cases and rtp_cases
In reply to Sasha LevinFrom: 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: 4fe2844b0f0c ("drm/xe/rtp: Generalize whitelist_apply_to_hwe")
--- 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
@@ -122,80 +122,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,
@@ -455,33 +381,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)), },
@@ -489,33 +397,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 4/5 drm/xe/rtp: Add struct types for RTP tables
In reply to Sasha LevinFrom: 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: 4fe2844b0f0c ("drm/xe/rtp: Generalize whitelist_apply_to_hwe")
--- drivers/gpu/drm/xe/tests/xe_rtp_test.c | 102 ++++++++++--------------- 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, 134 insertions(+), 141 deletions(-)
drivers/gpu/drm/xe/tests/xe_rtp_test.c +40 -62
@@ -45,13 +45,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 fake_xe_gt_mcr_check_reg (struct xe_gt *gt,struct xe_reg reg)
@@ -90,7 +90,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)))
@@ -99,8 +99,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",
@@ -110,7 +109,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)))
@@ -119,8 +118,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",
@@ -130,7 +128,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)))
@@ -139,8 +137,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",
@@ -150,7 +147,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)))
@@ -159,8 +156,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)
@@ -172,14 +168,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 },
@@ -191,7 +186,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)))
@@ -201,8 +196,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",
@@ -212,7 +206,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)))
@@ -222,8 +216,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",
@@ -233,7 +226,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)))
@@ -248,8 +241,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 ))) }, - {} - }, + ), }, { .name = "bad-mcr-reg-forced-to-regular",
@@ -259,13 +251,12 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0), .expected_count_sr_entries = 1, .expected_sr_errors = 1, - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("bad-mcr-regular-reg"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(BAD_MCR_REG4, REG_BIT(0))) }, - {} - }, + ), }, { .name = "bad-regular-reg-forced-to-mcr",
@@ -275,13 +266,12 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = { .expected_active = BIT(0), .expected_count_sr_entries = 1, .expected_sr_errors = 1, - .entries = (const struct xe_rtp_entry_sr []) { + .table = XE_RTP_TABLE_SR( { XE_RTP_NAME("bad-regular-reg"), XE_RTP_RULES(FUNC(match_yes)), XE_RTP_ACTIONS(SET(BAD_REGULAR_REG5, REG_BIT(0))) }, - {} - }, + ), }, };
@@ -293,15 +283,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)
@@ -334,56 +321,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)), },
@@ -393,13 +376,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)), },
@@ -409,8 +391,7 @@ static const struct rtp_test_case rtp_cases[] = { {XE_RTP_NAME ("r3" ), XE_RTP_RULES(FUNC(match_no)), }, - {} - }, + ), }, };
@@ -420,13 +401,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 5/5 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.
Stable-dep-of: 4fe2844b0f0c ("drm/xe/rtp: Generalize whitelist_apply_to_hwe")
--- 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