FAILED: patch "[PATCH] drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists" 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 e70086a3a06d276b4a5d9a2c51c9330c6cf72780
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072902-purity-frenzy-fc0b@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e70086a3a06d276b4a5d9a2c51c9330c6cf72780 Mon Sep 17 00:00:00 2001
From: Ashutosh Dixit <[email protected]>
Date: Mon, 15 Jun 2026 15:42:19 -0700
Subject: [PATCH] drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Unconditionally whitelisting OA registers is a security violation. Set RING_FORCE_TO_NONPRIV_DENY bit in OA nonpriv slots, so that OA registers don't get whitelisted by default after probe, gt reset, resume and engine reset.
drivers/gpu/drm/xe/xe_reg_whitelist.c +5 -3
@@ -104,10 +104,12 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { RING_FORCE_TO_NONPRIV_ACCESS_RW)) }, +#define WHITELIST_DENY (r, f) WHITELIST(r, (f) | RING_FORCE_TO_NONPRIV_DENY) +#define WHITELIST_OA_MMIO_TRG (trg, status, head) \ - WHITELIST(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ - WHITELIST(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ - WHITELIST(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4) + WHITELIST_DENY(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ + WHITELIST_DENY(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ + WHITELIST_DENY(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)#define WHITELIST_OAG_MMIO_TRG \ WHITELIST_OA_MMIO_TRG(OAG_MMIOTRIGGER, OAG_OASTATUS, OAG_OAHEADPTR)
Sasha Levin
maintainerPATCH 1/8 drm/xe/reg_sr: Stop setting all whitelist slots
From: Lucas De Marchi <[email protected]>
[ Upstream commit c1151691b5e97b600a9ef3efd7c31a3abf568e41 ]
Currently xe_reg_sr_apply_whitelist() sets the unused values to a known used value for no good reason: it could just leave it with the HW default. The behavior is slightly different if there are no whitelist registers for the engine as the function returns early. This is not needed, so just drop the addition writes for the unused slots.
Later this will allow to reduce the amount of registers passed to GuC for save/restore.
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/xe_reg_sr.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/xe/xe_reg_sr.c +0 -7
@@ -230,13 +230,6 @@ void xe_reg_sr_apply_whitelist(struct xe_hw_engine *hwe) slot++; } -/* And clear the rest just in case of garbage */ -for (; slot <RING_MAX_NONPRIV_SLOTS ; slot++) { -u32 addr =RING_NOPID (mmio_base).addr; - -xe_mmio_write32 (gt,RING_FORCE_TO_NONPRIV (mmio_base, slot), addr); - } - err =xe_force_wake_put (gt_to_fw (gt),XE_FORCEWAKE_ALL );XE_WARN_ON (err);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/8 drm/xe: Apply whitelist to engine save-restore
From: Lucas De Marchi <[email protected]>
[ Upstream commit 3fcf68d7393fd622b96cd45124ccb1eddf77684c ]
Instead of handling the whitelist directly in the GuC ADS initialization, make it follow the same logic as other engine registers that are save-restored. Main benefit is that then the SW tracking then shows it in debugfs and there's no risk of an engine workaround to write to the same nopriv register that is being passed directly to GuC.
This means that xe_reg_whitelist_process_engine() only has to process the RTP and convert them to entries for the hwe. With that all the registers should be covered by xe_reg_sr_apply_mmio() to write to the HW and there's no special handling in GuC ADS to also add these registers to the list of registers that is passed to GuC.
Example for DG2:
# cat /sys/kernel/debug/dri/0000\:03\:00.0/gt0/register-save-restore ... Engine rcs0 ... REG[0x24d0] clr=0xffffffff set=0x1000dafc masked=no mcr=no REG[0x24d4] clr=0xffffffff set=0x1000db01 masked=no mcr=no REG[0x24d8] clr=0xffffffff set=0x0000db1c masked=no mcr=no ... Whitelist rcs0 REG[0xdafc-0xdaff]: allow read access REG[0xdb00-0xdb1f]: allow read access REG[0xdb1c-0xdb1f]: allow rw access
v2:
- Use ~0u for clr bits so it's just a write (Matt Roper)
- Simplify helpers now that unused slots are not written
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/xe_gt.c | 4 +-- drivers/gpu/drm/xe/xe_hw_engine.c | 1 - drivers/gpu/drm/xe/xe_reg_sr.c | 46 --------------------------- drivers/gpu/drm/xe/xe_reg_whitelist.c | 37 +++++++++++++++++++++ 4 files changed, 38 insertions(+), 50 deletions(-)
drivers/gpu/drm/xe/xe_gt.c +1 -3
@@ -722,10 +722,8 @@ static int do_gt_restart(struct xe_gt *gt)xe_mocs_init (gt); -for_each_hw_engine (hwe, gt, id) { +for_each_hw_engine (hwe, gt, id)xe_reg_sr_apply_mmio (&hwe->reg_sr, gt); -xe_reg_sr_apply_whitelist (hwe); - }/* Get CCS mode in sync between sw/hw */ xe_gt_apply_ccs_mode (gt);
drivers/gpu/drm/xe/xe_hw_engine.c +0 -1
@@ -546,7 +546,6 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,xe_gt_assert (gt, gt->info.engine_mask &BIT (id));xe_reg_sr_apply_mmio (&hwe->reg_sr, gt); -xe_reg_sr_apply_whitelist (hwe); hwe->hwsp = xe_managed_bo_create_pin_map(xe, tile, SZ_4K, XE_BO_FLAG_VRAM_IF_DGFX(tile) |
drivers/gpu/drm/xe/xe_reg_sr.c +0 -46
58 lines not on this page · raw message
drivers/gpu/drm/xe/xe_reg_whitelist.c +37 -0
@@ -10,7 +10,9 @@#include "regs/xe_oa_regs.h" #include "regs/xe_regs.h" #include "xe_gt_types.h" +#include "xe_gt_printk.h" #include "xe_platform_types.h" +#include "xe_reg_sr.h" #include "xe_rtp.h" #include "xe_step.h"
@@ -89,6 +91,40 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { {} }; +static void whitelist_apply_to_hwe (struct xe_hw_engine *hwe) +{ +struct xe_reg_sr *sr = &hwe->reg_whitelist; +struct xe_reg_sr_entry *entry; +struct drm_printer p; +unsigned long reg; +unsigned int slot; + +xe_gt_dbg (hwe->gt,"Add %s whitelist to engine\n" , sr->name); + p =drm_dbg_printer (>_to_xe (hwe->gt)->drm,DRM_UT_DRIVER ,NULL ); + + slot =0 ; +xa_for_each (&sr->xa, reg, entry) { +struct xe_reg_sr_entry hwe_entry = { + .reg =RING_FORCE_TO_NONPRIV (hwe->mmio_base, slot), + .set_bits = entry->reg.addr | entry->set_bits, + .clr_bits = ~0u , + .read_mask = entry->read_mask, + }; + +if (slot ==RING_MAX_NONPRIV_SLOTS ) { +xe_gt_err (hwe->gt, +"hwe %s: maximum register whitelist slots (%d) reached, refusing to add more\n" , + hwe->name,RING_MAX_NONPRIV_SLOTS ); +break ; + } + +xe_reg_whitelist_print_entry (&p,0 , reg, entry); +xe_reg_sr_add (&hwe->reg_sr, &hwe_entry, hwe->gt); + + slot++; + } +} +/** * xe_reg_whitelist_process_engine - process table of registers to whitelist * @hwe: engine instance to process whitelist for
@@ -102,6 +138,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); +whitelist_apply_to_hwe (hwe); }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/8 drm/xe/ptl: Apply Wa_14023061436
In reply to Sasha LevinFrom: Nirmoy Das <[email protected]>
[ Upstream commit 92029e0baa5313ba208103f90086f59070bbf93b ]
Enable WMTP for the BTD kernel to address Wa14023061436 by setting the proper TDL Chicken Bit.
v2: Apply it on engine_was[] as this register is not part of LRC(Matt)
Apply it for first_render_or_compute in case this gets extended to compute only platforms(Matt).
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/regs/xe_gt_regs.h | 3 +++ drivers/gpu/drm/xe/xe_wa.c | 5 +++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +3 -0
@@ -491,6 +491,9 @@#define LSC_L1_FLUSH_CTL_3D_DATAPORT_FLUSH_EVENTS_MASK REG_GENMASK(13, 11)#define DIS_ATOMIC_CHAINING_TYPED_WRITES REG_BIT(3) +#define TDL_CHICKEN XE_REG_MCR(0xe5f4, XE_REG_OPTION_MASKED) +#define QID_WAIT_FOR_THREAD_NOT_RUN_DISABLE REG_BIT(12) +#define LSC_CHICKEN_BIT_0 XE_REG_MCR(0xe7c8)#define DISABLE_D8_D16_COASLESCE REG_BIT(30)#define WR_REQ_CHAINING_DIS REG_BIT(26)
drivers/gpu/drm/xe/xe_wa.c +5 -0
@@ -595,6 +595,11 @@ static const struct xe_rtp_entry_sr engine_was[] = { XE_RTP_RULES(GRAPHICS_VERSION_RANGE(3000, 3001), FUNC(xe_rtp_match_first_render_or_compute)), XE_RTP_ACTIONS(SET(HALF_SLICE_CHICKEN7, CLEAR_OPTIMIZATION_DISABLE)) }, + {XE_RTP_NAME ("14023061436" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3001 ), +FUNC (xe_rtp_match_first_render_or_compute)), +XE_RTP_ACTIONS (SET (TDL_CHICKEN ,QID_WAIT_FOR_THREAD_NOT_RUN_DISABLE )) + }, {} };
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/8 drm/xe/xe3lpg: Add Wa_13012615864
In reply to Sasha LevinFrom: Tejas Upadhyay <[email protected]>
[ Upstream commit 2399bcc07c01189737858e0a88ac4ffdd1d4b03d ]
Wa_13012615864 applies to xe3lpg
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/regs/xe_gt_regs.h | 1 + drivers/gpu/drm/xe/xe_wa.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +1 -0
@@ -466,6 +466,7 @@#define TDL_TSL_CHICKEN XE_REG_MCR(0xe4c4, XE_REG_OPTION_MASKED)#define STK_ID_RESTRICT REG_BIT(12)#define SLM_WMTP_RESTORE REG_BIT(11) +#define RES_CHK_SPR_DIS REG_BIT(6)#define ROW_CHICKEN XE_REG_MCR(0xe4f0, XE_REG_OPTION_MASKED)#define UGM_BACKUP_MODE REG_BIT(13)
drivers/gpu/drm/xe/xe_wa.c +5 -0
@@ -600,6 +600,11 @@ static const struct xe_rtp_entry_sr engine_was[] = { FUNC(xe_rtp_match_first_render_or_compute)), XE_RTP_ACTIONS(SET(TDL_CHICKEN, QID_WAIT_FOR_THREAD_NOT_RUN_DISABLE)) }, + {XE_RTP_NAME ("13012615864" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3001 ), +FUNC (xe_rtp_match_first_render_or_compute)), +XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,RES_CHK_SPR_DIS )) + }, {} };
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/8 drm/xe/rtp: Drop sentinels from arg to xe_rtp_process_to_sr()
In reply to Sasha LevinFrom: Lucas De Marchi <[email protected]>
[ Upstream commit cedf23842d7433eb32cb782a637bb870fb096a3b ]
There's a mismatch on API: while xe_rtp_process_to_sr() processes entries until an entry without name, the active tracking with xe_rtp_process_ctx_enable_active_tracking() needs to use the number of elements. The number of elements is taken everywhere using ARRAY_SIZE(), but that will have one entry too many. This leads to the following warning, as reported by lkp:
drivers/gpu/drm/xe/xe_tuning.c: In function 'xe_tuning_dump':
Quoted 1 line
Quoted 1 line
include/drm/drm_print.h:228:31: warning: '%s' directive argument is null [-Wformat-overflow=]
228 | drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
| ^~~~~~
drivers/gpu/drm/xe/xe_tuning.c:226:17: note: in expansion of macro 'drm_printf_indent'
226 | drm_printf_indent(p, 1, "%s\n", engine_tunings[idx].name);
| ^~~~~~~~~~~~~~~~~That's because it will still process the last entry when tracking the active tunings. The same issue exists in the WAs. Change xe_rtp_process_to_sr() to also take the number of elements so the empty entry can be removed and the warning should go away. Fixing on the active-tracking side would more fragile as the it would need a - 1 everywhere and continue to use a different approach for number of elements.
Aside from the warning, it's a non-issue as there would always be enough bits allocated and the last entry would never be active since xe_rtp_process_to_sr() stops on the sentinel.
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/tests/xe_rtp_test.c | 2 +- drivers/gpu/drm/xe/xe_hw_engine.c | 6 ++---- drivers/gpu/drm/xe/xe_reg_whitelist.c | 4 ++-- drivers/gpu/drm/xe/xe_rtp.c | 6 +++++- drivers/gpu/drm/xe/xe_rtp.h | 2 +- drivers/gpu/drm/xe/xe_tuning.c | 12 ++++-------- drivers/gpu/drm/xe/xe_wa.c | 12 +++--------- 7 files changed, 18 insertions(+), 26 deletions(-)
drivers/gpu/drm/xe/tests/xe_rtp_test.c +1 -1
@@ -320,7 +320,7 @@ static void xe_rtp_process_to_sr_tests(struct kunit *test) 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_to_sr (&ctx, param->entries, count_rtp_entries, reg_sr);xa_for_each (®_sr->xa, idx, sre) {if (idx == param->expected_reg.addr)
drivers/gpu/drm/xe/xe_hw_engine.c +2 -4
@@ -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, ARRAY_SIZE(lrc_setup), &hwe->reg_lrc); } static void
@@ -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_entries,ARRAY_SIZE (engine_entries), &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 +2 -2
@@ -88,7 +88,6 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)) }, - {} };static void whitelist_apply_to_hwe (struct xe_hw_engine *hwe)
@@ -137,7 +136,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, register_whitelist, &hwe->reg_whitelist); +xe_rtp_process_to_sr (&ctx, register_whitelist,ARRAY_SIZE (register_whitelist), + &hwe->reg_whitelist);whitelist_apply_to_hwe (hwe); }
drivers/gpu/drm/xe/xe_rtp.c +5 -1
@@ -237,6 +237,7 @@ static void rtp_mark_active(struct xe_device *xe,* the save-restore argument. * @ctx: The context for processing the table, with one of device, gt or hwe * @entries: Table with RTP definitions +* @n_entries: Number of entries to process, usually ARRAY_SIZE(entries) * @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
@@ -247,6 +248,7 @@ static void rtp_mark_active(struct xe_device *xe,*/ void xe_rtp_process_to_sr (struct xe_rtp_process_ctx *ctx,const struct xe_rtp_entry_sr *entries, +size_t n_entries,struct xe_reg_sr *sr) {const struct xe_rtp_entry_sr *entry;
@@ -259,7 +261,9 @@ 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, entries); + +for (entry = entries; entry - entries < n_entries; entry++) {bool match = false;if (entry->flags &XE_RTP_ENTRY_FLAG_FOREACH_ENGINE ) {
drivers/gpu/drm/xe/xe_rtp.h +1 -1
@@ -430,7 +430,7 @@ void xe_rtp_process_ctx_enable_active_tracking(struct xe_rtp_process_ctx *ctx,void xe_rtp_process_to_sr (struct xe_rtp_process_ctx *ctx,const struct xe_rtp_entry_sr *entries, -struct xe_reg_sr *sr); +size_t n_entries,struct xe_reg_sr *sr);void xe_rtp_process (struct xe_rtp_process_ctx *ctx,const struct xe_rtp_entry *entries);
drivers/gpu/drm/xe/xe_tuning.c +4 -8
@@ -83,8 +83,6 @@ 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[] = {
@@ -93,7 +91,6 @@ static const struct xe_rtp_entry_sr engine_tunings[] = { ENGINE_CLASS(RENDER)),XE_RTP_ACTIONS (SET (SAMPLER_MODE ,INDIRECT_STATE_BASE_ADDR_OVERRIDE )) }, - {} };static const struct xe_rtp_entry_sr lrc_tunings[] = {
@@ -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, gt_tunings,ARRAY_SIZE (gt_tunings), >->reg_sr); }EXPORT_SYMBOL_IF_KUNIT (xe_tuning_process_gt);
@@ -147,7 +142,8 @@ 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,ARRAY_SIZE (engine_tunings), + &hwe->reg_sr); }EXPORT_SYMBOL_IF_KUNIT (xe_tuning_process_engine);
@@ -163,5 +159,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,ARRAY_SIZE (lrc_tunings), &hwe->reg_lrc); }
drivers/gpu/drm/xe/xe_wa.c +3 -9
@@ -278,8 +278,6 @@ static const struct xe_rtp_entry_sr gt_was[] = {XE_RTP_ACTIONS (SET (VDBOX_CGCTL3F10 (0 ),RAMDFTUNIT_CLKGATE_DIS )), XE_RTP_ENTRY_FLAG(FOREACH_ENGINE), }, - - {} }; static const struct xe_rtp_entry_sr engine_was[] = {
@@ -605,8 +603,6 @@ static const struct xe_rtp_entry_sr engine_was[] = { FUNC(xe_rtp_match_first_render_or_compute)),XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,RES_CHK_SPR_DIS )) }, - - {} };static const struct xe_rtp_entry_sr lrc_was[] = {
@@ -815,8 +811,6 @@ static const struct xe_rtp_entry_sr lrc_was[] = {DIS_PARTIAL_AUTOSTRIP | DIS_AUTOSTRIP)) }, - - {} }; static __maybe_unused const struct xe_rtp_entry oob_was[] = {
@@ -858,7 +852,7 @@ void xe_wa_process_gt(struct xe_gt *gt)xe_rtp_process_ctx_enable_active_tracking (&ctx, gt->wa_active.gt,ARRAY_SIZE (gt_was)); -xe_rtp_process_to_sr (&ctx, gt_was, >->reg_sr); +xe_rtp_process_to_sr (&ctx, gt_was,ARRAY_SIZE (gt_was), >->reg_sr); }EXPORT_SYMBOL_IF_KUNIT (xe_wa_process_gt);
@@ -876,7 +870,7 @@ void xe_wa_process_engine(struct xe_hw_engine *hwe)xe_rtp_process_ctx_enable_active_tracking (&ctx, hwe->gt->wa_active.engine,ARRAY_SIZE (engine_was)); -xe_rtp_process_to_sr (&ctx, engine_was, &hwe->reg_sr); +xe_rtp_process_to_sr (&ctx, engine_was,ARRAY_SIZE (engine_was), &hwe->reg_sr); }/**
@@ -893,7 +887,7 @@ void xe_wa_process_lrc(struct xe_hw_engine *hwe)xe_rtp_process_ctx_enable_active_tracking (&ctx, hwe->gt->wa_active.lrc,ARRAY_SIZE (lrc_was)); -xe_rtp_process_to_sr (&ctx, lrc_was, &hwe->reg_lrc); +xe_rtp_process_to_sr (&ctx, lrc_was,ARRAY_SIZE (lrc_was), &hwe->reg_lrc); }/**
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/8 drm/xe/xe3: Apply wa_14024997852
In reply to Sasha LevinFrom: Tapani Pälli <[email protected]>
[ Upstream commit d24f7d1f62e2ed1bce9664566c32ea13677958f4 ]
Whitelist registers needed for userspace to control autostrip on xe3.
v2: fix GRAPHICS_VERSION to match xe3 (Matt)
v3: use GRAPHICS_VERSION_RANGE to match all xe3 (Matt)
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/xe/xe_reg_whitelist.c +7 -0
@@ -88,6 +88,13 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)) }, + {XE_RTP_NAME ("14024997852" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3005 ),ENGINE_CLASS (RENDER )), +XE_RTP_ACTIONS (WHITELIST (FF_MODE , +RING_FORCE_TO_NONPRIV_ACCESS_RW ), +WHITELIST (VFLSKPD , +RING_FORCE_TO_NONPRIV_ACCESS_RW )) + }, };static void whitelist_apply_to_hwe (struct xe_hw_engine *hwe)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 7/8 drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting
In reply to Sasha LevinFrom: Ashutosh Dixit <[email protected]>
[ Upstream commit ed455775c5a68b75e5f6ad6c8e0e3e9c98fd3f64 ]
Minor refactor of OAG MMIO trigger register whitelisting for code reuse with OAM MMIO trigger register whitelisting.
Stable-dep-of: e70086a3a06d ("drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists")
--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 41 +++++++++++++-------------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/gpu/drm/xe/xe_reg_whitelist.c +19 -22
@@ -66,28 +66,6 @@ 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 )) - }, { XE_RTP_NAME("14024997852"),XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3005 ),ENGINE_CLASS (RENDER )), XE_RTP_ACTIONS(WHITELIST(FF_MODE,
@@ -95,6 +73,25 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { WHITELIST(VFLSKPD, RING_FORCE_TO_NONPRIV_ACCESS_RW)) }, + +#define WHITELIST_OA_MMIO_TRG (trg, status, head) \ + WHITELIST(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ + WHITELIST(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ + WHITELIST(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4) + +#define WHITELIST_OAG_MMIO_TRG \ + WHITELIST_OA_MMIO_TRG(OAG_MMIOTRIGGER, OAG_OASTATUS, OAG_OAHEADPTR) + + {XE_RTP_NAME ("oag_mmio_trg_rcs" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,XE_RTP_END_VERSION_UNDEFINED ), +ENGINE_CLASS (RENDER )), +XE_RTP_ACTIONS (WHITELIST_OAG_MMIO_TRG ) + }, + { XE_RTP_NAME("oag_mmio_trg_ccs"), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,XE_RTP_END_VERSION_UNDEFINED ), +ENGINE_CLASS (COMPUTE )), +XE_RTP_ACTIONS (WHITELIST_OAG_MMIO_TRG ) + }, };static void whitelist_apply_to_hwe (struct xe_hw_engine *hwe)
Signature · 1 line
2.53.0
Re: [PATCH 6.12.y 7/8] drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting
Quoted 1 line · Sasha Levin
Hi Sasha,
I have backported this entire series to linux-6.12.y here:
https://lore.kernel.org/stable/[email protected]/
Thanks.
--
Ashutosh
Quoted 78 lines
From: Ashutosh Dixit <[email protected]>
[ Upstream commit
ed455775c5a68b75e5f6ad6c8e0e3e9c98fd3f64]Minor refactor of OAG MMIO trigger register whitelisting for code reuse with OAM MMIO trigger register whitelisting.
Signed-off-by Ashutosh Dixit <[email protected]>Reviewed-by Umesh Nerlige Ramappa <[email protected]>Stable-dep-of:
e70086a3a06d("drm/xe/rtp: AddRING_FORCE_TO_NONPRIV_DENYto OA whitelists")Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 41 +++++++++++++-------------- 1 file changed, 19 insertions(+), 22 deletions(-)drivers/gpu/drm/xe/xe_reg_whitelist.c +19
-23@@ -66,28 +66,6 @@ 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 )) - }, { XE_RTP_NAME("14024997852"),XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3005 ),ENGINE_CLASS (RENDER )), XE_RTP_ACTIONS(WHITELIST(FF_MODE,@@ -95,6 +73,25 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { WHITELIST(VFLSKPD, RING_FORCE_TO_NONPRIV_ACCESS_RW)) }, + +#define WHITELIST_OA_MMIO_TRG (trg, status, head) \ + WHITELIST(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ + WHITELIST(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ + WHITELIST(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4) + +#define WHITELIST_OAG_MMIO_TRG \ + WHITELIST_OA_MMIO_TRG(OAG_MMIOTRIGGER, OAG_OASTATUS, OAG_OAHEADPTR) + + {XE_RTP_NAME ("oag_mmio_trg_rcs" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,XE_RTP_END_VERSION_UNDEFINED ), +ENGINE_CLASS (RENDER )), +XE_RTP_ACTIONS (WHITELIST_OAG_MMIO_TRG ) + }, + { XE_RTP_NAME("oag_mmio_trg_ccs"), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,XE_RTP_END_VERSION_UNDEFINED ), +ENGINE_CLASS (COMPUTE )), +XE_RTP_ACTIONS (WHITELIST_OAG_MMIO_TRG ) + }, };static void whitelist_apply_to_hwe (struct xe_hw_engine *hwe) --2.53.0
Re: [PATCH 6.12.y 7/8] drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting
Quoted 9 lines · Ashutosh
Quoted 1 line · Sasha Levin
Hi Sasha,
I have backported this entire series to linux-6.12.y here:
The new series with upstream commit sha's fixed is here:
https://lore.kernel.org/stable/[email protected]/
Thanks.
--
Ashutosh
Sasha Levin
maintainerPATCH 8/8 drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists
In reply to Sasha LevinFrom: Ashutosh Dixit <[email protected]>
[ Upstream commit e70086a3a06d276b4a5d9a2c51c9330c6cf72780 ]
Unconditionally whitelisting OA registers is a security violation. Set RING_FORCE_TO_NONPRIV_DENY bit in OA nonpriv slots, so that OA registers don't get whitelisted by default after probe, gt reset, resume and engine reset.
--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_reg_whitelist.c +5 -3
@@ -74,10 +74,12 @@ static const struct xe_rtp_entry_sr register_whitelist[] = { RING_FORCE_TO_NONPRIV_ACCESS_RW)) }, +#define WHITELIST_DENY (r, f) WHITELIST(r, (f) | RING_FORCE_TO_NONPRIV_DENY) +#define WHITELIST_OA_MMIO_TRG (trg, status, head) \ - WHITELIST(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ - WHITELIST(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ - WHITELIST(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4) + WHITELIST_DENY(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \ + WHITELIST_DENY(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \ + WHITELIST_DENY(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)#define WHITELIST_OAG_MMIO_TRG \ WHITELIST_OA_MMIO_TRG(OAG_MMIOTRIGGER, OAG_OASTATUS, OAG_OAHEADPTR)
Signature · 1 line
2.53.0