Assorted MOCS updates
Subsystems (2)
v2 cover Assorted MOCS updates
The Xe MOCS code is heavily modelled after the equivalent i915 code, but there are a few items that are not appropriate for the Xe driver. Philippe's patch to add the MTL-specific table is also included.
As a follow-up, I'd like to rework Xe's MOCS to just use the xe_reg_sr framework. But that's a bit more invasive, so I'll save that for a future series.
v2:
- Add a sanity check for uninitialized info->unused_entries_index
- Tweak some commit messages
- Don't overallocate GuC regset for platforms that don't need Wa_1607983814.
- For platforms that do need Wa_1607983814, only add the LNCF MOCS registers to the render engine's save/restore list.
- Drop HAS_RENDER_L3CC flag.
Matt Roper (6):
drm/xe/mocs: Drop unwanted TGL table
drm/xe/mocs: Add missing RKL handling
drm/xe/mocs: Drop xe_mocs_info_index
drm/xe/mocs: Drop duplicate assignment of uc_index drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP drm/xe/mocs: Drop HAS_RENDER_L3CC flag
Philippe Lecluse (1):
drm/xe/mocs: add MTL mocs
drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 20 +++- drivers/gpu/drm/xe/xe_guc_submit.c | 1 - drivers/gpu/drm/xe/xe_mocs.c | 178 +++++++++++++---------------- drivers/gpu/drm/xe/xe_mocs.h | 1 - 5 files changed, 99 insertions(+), 103 deletions(-)
Signature · 1 line
2.39.1
PATCH v2 1/7 drm/xe/mocs: Drop unwanted TGL table
TGL/RKL/ADLS/ADLP are all supposed to use the same MOCS table, with values defined in the bspec. Any entries listed in the bspec as reserved/error/undefined should always be initialized to the most cached and least coherent setting possible so that any userspace accidentally referencing those undefined entries will only experience an increase in coherency if spec updates down the road start defining real values.
The TGL and gen12 table entries defined in the driver today are identical except that the TGL includes one additional (incorrect) setting for table index 1. Furthermore, the TGL-specific initialization does not define a dedicated value for info->unused_entries_index, so this incorrect table entry 1 also gets used to populate the MOCS registers for all reserved/unused table entries. This incorrect behavior is a holdover from i915 where the platform was enabled with an incorrect setting and by the time we noticed, it was too late to fix the table without breaking ABI compatibility (and on TGL we did indeed have some buggy userspace that was referencing the 'reserved' entry 1). Since the Xe driver starts fresh with a clean slate on ABI, there's no need to repeat the mistakes of i915 here.
v2:
- Reword/clarify commit message. (Lucas)
Bspec: 45101
--- drivers/gpu/drm/xe/xe_mocs.c | 46 ------------------------------------ 1 file changed, 46 deletions(-)
drivers/gpu/drm/xe/xe_mocs.c +0 -46
@@ -247,47 +247,6 @@ struct xe_mocs_info { LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), \ L3_1_UC) -static const struct xe_mocs_entry tgl_mocs_desc[] = { -/* -* NOTE: -* Reserved and unspecified MOCS indices have been set to (L3 + LCC). -* These reserved entries should never be used, they may be changed -* to low performant variants with better coherency in the future if -* more entries are needed. We are programming index XE_MOCS_PTE(1) -* only, __init_mocs_table() take care to program unused index with -* this entry. -*/ -MOCS_ENTRY (XE_MOCS_PTE , -LE_0_PAGETABLE |LE_TC_0_PAGETABLE , -L3_1_UC ), -GEN11_MOCS_ENTRIES , - -/* Implicitly enable L1 - HDC:L1 + L3 + LLC */ -MOCS_ENTRY (48 , -LE_3_WB |LE_TC_1_LLC |LE_LRUM (3 ), -L3_3_WB ), -/* Implicitly enable L1 - HDC:L1 + L3 */ -MOCS_ENTRY (49 , -LE_1_UC |LE_TC_1_LLC , -L3_3_WB ), -/* Implicitly enable L1 - HDC:L1 + LLC */ -MOCS_ENTRY (50 , -LE_3_WB |LE_TC_1_LLC |LE_LRUM (3 ), -L3_1_UC ), -/* Implicitly enable L1 - HDC:L1 */ -MOCS_ENTRY (51 , -LE_1_UC |LE_TC_1_LLC , -L3_1_UC ), -/* HW Special Case (CCS) */ -MOCS_ENTRY (60 , -LE_3_WB |LE_TC_1_LLC |LE_LRUM (3 ), -L3_1_UC ), -/* HW Special Case (Displayable) */ -MOCS_ENTRY (61 , -LE_1_UC |LE_TC_1_LLC , -L3_3_WB ), -}; -static const struct xe_mocs_entry dg1_mocs_desc[] = {/* UC */ MOCS_ENTRY (1 ,0 ,L3_1_UC ),
@@ -422,11 +381,6 @@ static unsigned int get_mocs_settings(struct xe_device *xe, info->unused_entries_index =5 ;break ;case XE_TIGERLAKE : - info->size =ARRAY_SIZE (tgl_mocs_desc); - info->table = tgl_mocs_desc; - info->n_entries =GEN9_NUM_MOCS_ENTRIES ; - info->uc_index =3 ; -break ;case XE_ALDERLAKE_S :case XE_ALDERLAKE_P : info->size =ARRAY_SIZE (gen12_mocs_desc);
Signature · 1 line
2.39.1
PATCH v2 2/7 drm/xe/mocs: Add missing RKL handling
In reply to Matt RoperRKL should use the same "gen12" MOCS handling as TGL/ADL-S/ADL-P.
Bspec: 45101
--- drivers/gpu/drm/xe/xe_mocs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/xe_mocs.c +1 -0
@@ -381,6 +381,7 @@ static unsigned int get_mocs_settings(struct xe_device *xe, info->unused_entries_index =5 ;break ;case XE_TIGERLAKE : +case XE_ROCKETLAKE :case XE_ALDERLAKE_S :case XE_ALDERLAKE_P : info->size =ARRAY_SIZE (gen12_mocs_desc);
Signature · 1 line
2.39.1
PATCH v2 3/7 drm/xe/mocs: Drop xe_mocs_info_index
In reply to Matt RoperThe values in the xe_mocs_info_index enum only match old pre-gen12 hardware not supported by the Xe driver.
The only usage of this enum was to set a default value for info->unused_entries_index, but this is unnecessary since every platform in the subsequent switch statement sets a proper platform-specific value (and the XE_MOCS_PTE default doesn't even make sense since the hardware dropped the "use PAT settings" capability in gen12).
v2:
- Add a check that unusued_entries_index is non-zero; even for platforms where this is a valid table entry, it's never the one we want this value assigned to. (Lucas)
--- drivers/gpu/drm/xe/xe_mocs.c | 40 +++++++++++------------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
drivers/gpu/drm/xe/xe_mocs.c +12 -28
@@ -23,30 +23,6 @@ static inline void mocs_dbg(const struct drm_device *dev, {/* noop */ }#endif -/* -* MOCS indexes used for GPU surfaces, defining the cacheability of the -* surface data and the coherency for this data wrt. CPU vs. GPU accesses. -*/ -enum xe_mocs_info_index { -/* -* Not cached anywhere, coherency between CPU and GPU accesses is -* guaranteed. -*/ -XE_MOCS_UNCACHED , -/* -* Cacheability and coherency controlled by the kernel automatically -* based on the xxxx IOCTL setting and the current -* usage of the surface (used for display scanout or not). -*/ -XE_MOCS_PTE , -/* -* Cached in all GPU caches available on the platform. -* Coherency between CPU and GPU accesses to the surface is not -* guaranteed without extra synchronization. -*/ -XE_MOCS_CACHED , -}; -enum {HAS_GLOBAL_MOCS =BIT (0 ),HAS_RENDER_L3CC =BIT (1 ),
@@ -341,7 +317,6 @@ static unsigned int get_mocs_settings(struct xe_device *xe,memset (info,0 ,sizeof (struct xe_mocs_info )); - info->unused_entries_index =XE_MOCS_PTE ;switch (xe->info.platform) {case XE_PVC : info->size =ARRAY_SIZE (pvc_mocs_desc);
@@ -395,6 +370,16 @@ static unsigned int get_mocs_settings(struct xe_device *xe,return 0 ; } +/* +* Index 0 is a reserved/unused table entry on most platforms, but +* even on those where it does represent a legitimate MOCS entry, it +* never represents the "most cached, least coherent" behavior we want +* to populate undefined table rows with. So if unused_entries_index +* is still 0 at this point, we'll assume that it was omitted by +* mistake in the switch statement above. +*/ +XE_WARN_ON (info->unused_entries_index ==0 ); +if (XE_WARN_ON (info->size > info->n_entries))return 0 ;
@@ -406,9 +391,8 @@ static unsigned int get_mocs_settings(struct xe_device *xe, }/* -* Get control_value from MOCS entry taking into account when it's not used -* then if unused_entries_index is non-zero then its value will be returned -* otherwise XE_MOCS_PTE's value is returned in this case. +* Get control_value from MOCS entry. If the table entry is not defined, the +* settings from unused_entries_index will be returned. */ static u32 get_entry_control (const struct xe_mocs_info *info,unsigned int index)
Signature · 1 line
2.39.1
PATCH v2 4/7 drm/xe/mocs: Drop duplicate assignment of uc_index
In reply to Matt RoperThe DG1 branch needlessly assigns uc_index twice. Drop the second instance.
--- drivers/gpu/drm/xe/xe_mocs.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/xe/xe_mocs.c +0 -1
@@ -352,7 +352,6 @@ static unsigned int get_mocs_settings(struct xe_device *xe, info->table = dg1_mocs_desc; info->uc_index =1 ; info->n_entries =GEN9_NUM_MOCS_ENTRIES ; - info->uc_index =1 ; info->unused_entries_index =5 ;break ;case XE_TIGERLAKE :
Signature · 1 line
2.39.1
PATCH v2 5/7 drm/xe/mocs: add MTL mocs
In reply to Matt RoperFrom: Philippe Lecluse <[email protected]>
It was incorrectly using dg2_mocs for now.
v2 (MattR):
- Use REG_GENMASK/REG_FIELD_PREP for bitfields
- Add bspec references
Bspec: 45101, 45410, 63882
--- drivers/gpu/drm/xe/xe_mocs.c | 69 +++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_mocs.c +65 -4
@@ -62,6 +62,10 @@ struct xe_mocs_info {#define L3_GLBGO (value) ((value) << 6)#define L3_LKUP (value) ((value) << 7) +/* Defines for the tables (GLOB_MOCS_0 - GLOB_MOCS_16) */ +#define _L4_CACHEABILITY REG_GENMASK(3, 2) +#define IG_PAT REG_BIT(8) +/* Helper defines */ #define GEN9_NUM_MOCS_ENTRIES 64/* 63-64 are reserved, but configured. */ #define PVC_NUM_MOCS_ENTRIES 3
@@ -89,6 +93,12 @@ struct xe_mocs_info {#define L3_2_RESERVED _L3_CACHEABILITY(2)#define L3_3_WB _L3_CACHEABILITY(3) +/* L4 caching options */ +#define L4_0_WB REG_FIELD_PREP(_L4_CACHEABILITY, 0) +#define L4_1_WT REG_FIELD_PREP(_L4_CACHEABILITY, 1) +#define L4_2_RESERVED REG_FIELD_PREP(_L4_CACHEABILITY, 2) +#define L4_3_UC REG_FIELD_PREP(_L4_CACHEABILITY, 3) +#define MOCS_ENTRY (__idx, __control_value, __l3cc_value) \ [__idx] = { \ .control_value = __control_value, \
@@ -310,6 +320,57 @@ static const struct xe_mocs_entry pvc_mocs_desc[] = { MOCS_ENTRY(2, 0, L3_3_WB), }; +static const struct xe_mocs_entry mtl_mocs_desc[] = { +/* Error - Reserved for Non-Use */ +MOCS_ENTRY (0 , +0 , +L3_LKUP (1 ) |L3_3_WB ), +/* Cached - L3 + L4 */ +MOCS_ENTRY (1 , +IG_PAT , +L3_LKUP (1 ) |L3_3_WB ), +/* L4 - GO:L3 */ +MOCS_ENTRY (2 , +IG_PAT , +L3_LKUP (1 ) |L3_1_UC ), +/* Uncached - GO:L3 */ +MOCS_ENTRY (3 , +IG_PAT |L4_3_UC , +L3_LKUP (1 ) |L3_1_UC ), +/* L4 - GO:Mem */ +MOCS_ENTRY (4 , +IG_PAT , +L3_LKUP (1 ) |L3_GLBGO (1 ) |L3_1_UC ), +/* Uncached - GO:Mem */ +MOCS_ENTRY (5 , +IG_PAT |L4_3_UC , +L3_LKUP (1 ) |L3_GLBGO (1 ) |L3_1_UC ), +/* L4 - L3:NoLKUP; GO:L3 */ +MOCS_ENTRY (6 , +IG_PAT , +L3_1_UC ), +/* Uncached - L3:NoLKUP; GO:L3 */ +MOCS_ENTRY (7 , +IG_PAT |L4_3_UC , +L3_1_UC ), +/* L4 - L3:NoLKUP; GO:Mem */ +MOCS_ENTRY (8 , +IG_PAT , +L3_GLBGO (1 ) |L3_1_UC ), +/* Uncached - L3:NoLKUP; GO:Mem */ +MOCS_ENTRY (9 , +IG_PAT |L4_3_UC , +L3_GLBGO (1 ) |L3_1_UC ), +/* Display - L3; L4:WT */ +MOCS_ENTRY (14 , +IG_PAT |L4_1_WT , +L3_LKUP (1 ) |L3_3_WB ), +/* CCS - Non-Displayable */ +MOCS_ENTRY (15 , +IG_PAT , +L3_GLBGO (1 ) |L3_1_UC ), +}; +static unsigned int get_mocs_settings (struct xe_device *xe,struct xe_mocs_info *info) {
@@ -327,11 +388,11 @@ static unsigned int get_mocs_settings(struct xe_device *xe, info->unused_entries_index =2 ;break ;case XE_METEORLAKE : - info->size =ARRAY_SIZE (dg2_mocs_desc); - info->table = dg2_mocs_desc; + info->size =ARRAY_SIZE (mtl_mocs_desc); + info->table = mtl_mocs_desc; info->n_entries =MTL_NUM_MOCS_ENTRIES ; - info->uc_index =1 ; - info->unused_entries_index =3 ; + info->uc_index =9 ; + info->unused_entries_index =1 ;break ;case XE_DG2 : if (xe->info.subplatform == XE_SUBPLATFORM_DG2_G10 &&
Signature · 1 line
2.39.1
PATCH v2 6/7 drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
In reply to Matt RoperReprogramming the LNCF MOCS registers on render domain reset is not intended to be regular driver programming, but rather the implementation of a specific workaround (Wa_1607983814). This workaround no longer applies on Xe_HP any beyond, so we can expect that these registers, like the rest of the LNCF/LBCF registers, will maintain their values through all engine resets. We should only add these registers to the GuC's save/restore list on platforms that need the workaround.
Furthermore, xe_mocs_init_engine() appears to be another attempt to satisfy this same workaround. This is unnecessary on the Xe driver since even on platforms where the workaround is necessary, all single-engine resets are initiated by the GuC and thus the GuC will take care of saving/restoring these registers. The only host-initiated resets we have in Xe are full GT resets which will already (re)initialize these registers as part of the regular xe_mocs_init() flow.
v2:
- Add needs_wa_1607983814() so that calculate_regset_size() doesn't overallocate regset space when the workaround isn't needed. (Lucas)
- On platforms affected by Wa_1607983814, only add the LNCF MOCS registers to the render engine's GuC save/restore list; resets of other engines don't need to save/restore these.
--- drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 20 ++++++++++++++++---- drivers/gpu/drm/xe/xe_guc_submit.c | 1 - drivers/gpu/drm/xe/xe_mocs.c | 13 ------------- drivers/gpu/drm/xe/xe_mocs.h | 1 - 5 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/xe/xe_execlist.c +1 -1
@@ -462,7 +462,7 @@ static void execlist_engine_suspend_wait(struct xe_engine *e)static void execlist_engine_resume (struct xe_engine *e) { -xe_mocs_init_engine (e); +/* NIY */ }static const struct xe_engine_ops execlist_engine_ops = {
drivers/gpu/drm/xe/xe_guc_ads.c +16 -4
@@ -206,6 +206,11 @@ static void guc_ads_fini(struct drm_device *drm, void *arg)xe_bo_unpin_map_no_vm (ads->bo); } +static bool needs_wa_1607983814 (struct xe_device *xe) +{ +return GRAPHICS_VERx100 (xe) <1250 ; +} +static size_t calculate_regset_size (struct xe_gt *gt) {struct xe_reg_sr_entry *sr_entry;
@@ -218,7 +223,10 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ; + count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; + +if (needs_wa_1607983814 (gt_to_xe (gt))) + count +=LNCFCMOCS_REG_COUNT ;return count *sizeof (struct guc_mmio_reg ); }
@@ -430,6 +438,7 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads,struct iosys_map *regset_map, struct xe_hw_engine *hwe) { + struct xe_device *xe = ads_to_xe(ads);struct xe_hw_engine *hwe_rcs_reset_domain =xe_gt_any_hw_engine_by_reset_domain (hwe->gt,XE_ENGINE_CLASS_RENDER );struct xe_reg_sr_entry *entry;
@@ -464,9 +473,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++); } -for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { -guc_mmio_regset_write_one (ads, regset_map, -GEN9_LNCFCMOCS (i).reg,0 , count++); +/* Wa_1607983814 */ +if (needs_wa_1607983814 (xe) && hwe->class ==XE_ENGINE_CLASS_RENDER ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++); + } }XE_BUG_ON (ads->regset_size < (count *sizeof (struct guc_mmio_reg )));
drivers/gpu/drm/xe/xe_guc_submit.c +0 -1
@@ -1267,7 +1267,6 @@ static void guc_engine_resume(struct xe_engine *e)XE_BUG_ON (e->guc->suspend_pending); -xe_mocs_init_engine (e);guc_engine_add_msg (e, msg,RESUME ); }
drivers/gpu/drm/xe/xe_mocs.c +0 -13
@@ -517,19 +517,6 @@ static void init_l3cc_table(struct xe_gt *gt, } } -void xe_mocs_init_engine (const struct xe_engine *engine) -{ -struct xe_mocs_info table; -unsigned int flags; - - flags =get_mocs_settings (engine->gt->xe, &table); -if (!flags) -return ; - -if (flags &HAS_RENDER_L3CC && engine->class ==XE_ENGINE_CLASS_RENDER ) -init_l3cc_table (engine->gt, &table); -} -void xe_mocs_init (struct xe_gt *gt) {struct xe_mocs_info table;
drivers/gpu/drm/xe/xe_mocs.h +0 -1
@@ -11,7 +11,6 @@struct xe_engine ;struct xe_gt ; -void xe_mocs_init_engine (const struct xe_engine *engine);void xe_mocs_init (struct xe_gt *gt);/**
Signature · 1 line
2.39.1
Re: [Intel-xe] [PATCH v2 6/7] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
Quoted 24 lines · Matt Roper
Reprogramming the LNCF MOCS registers on render domain reset is not intended to be regular driver programming, but rather the implementation of a specific workaround (
Wa_1607983814). This workaround no longer applies onXe_HPany beyond, so we can expect that these registers, like the rest of the LNCF/LBCF registers, will maintain their values through all engine resets. We should only add these registers to the GuC's save/restore list on platforms that need the workaround.Furthermore,
xe_mocs_init_engine()appears to be another attempt to satisfy this same workaround. This is unnecessary on the Xe driver since even on platforms where the workaround is necessary, all single-engine resets are initiated by the GuC and thus the GuC will take care of saving/restoring these registers. The only host-initiated resets we have in Xe are full GT resets which will already (re)initialize these registers as part of the regularxe_mocs_init()flow.v2:
- Addneeds_wa_1607983814()so thatcalculate_regset_size()doesn't overallocate regset space when the workaround isn't needed. (Lucas)
- On platforms affected byWa_1607983814, only add the LNCF MOCS registers to the render engine's GuC save/restore list; resets of other engines don't need to save/restore these.
Quoted 2 lines
Cc Lucas De Marchi <[email protected]>Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Thomas Hellström
maintainerRe: [Intel-xe] [PATCH v2 6/7] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
In reply to Matt RoperHi!
After this commit I see the following on DG1, and attempting to run anything after that won't work.
Thomas
10.306993] ------------[ cut here ]------------
[ 10.307040] WARNING: CPU: 2 PID: 447 at drivers/gpu/drm/xe/xe_hw_fence.c:91 xe_hw_fence_irq_finish+0x36/0x120 [xe]
[ 10.307327] Modules linked in: xe(+) drm_ttm_helper ttm i2c_algo_bit drm_suballoc_helper kunit drm_buddy gpu_sched drm_display_helper drm_kms_helper drm crct10dif_pclmul crc32_pclmul crc32c_intel nvme e1000e nvme_core drm_panel_orientation_quirks ghash_clmulni_intel video wmi pinctrl_tigerlake usb_storage ip6_tables ip_tables fuse [ 10.307656] CPU: 2 PID: 447 Comm: systemd-udevd Tainted: G U 6.1.0+ #120
[ 10.307719] Hardware name: ASUS System Product Name/PRIME B560M-A AC, BIOS 0403 01/26/2021
[ 10.307779] RIP: 0010:xe_hw_fence_irq_finish+0x36/0x120 [xe]
[ 10.307980] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 48 89 fd <0f> 0b e8 33 84 13 e2 48 89 ef 88 44 24 07 e8 c7 44 5e e2 48 8b 55
[ 10.308103] RSP: 0018:ffffb917c12d7b90 EFLAGS: 00010216
[ 10.308149] RAX: ffff8b189b6d85d8 RBX: 00000000ffffffc2 RCX: ffffb917c12d7aec
[ 10.308201] RDX: 0000000000000000 RSI: ffffffffa356dc2b RDI: ffff8b189ee84c60
[ 10.308253] RBP: ffff8b189ee84c60 R08: 0000000000000001 R09: ffff8b189ee82278
[ 10.308304] R10: 0000000000000000 R11: 00000000d3ea3544 R12: ffff8b189ee84cc0
[ 10.308356] R13: ffff8b189ee84cd8 R14: ffff8b189ee83e00 R15: ffffffffc08dda87
[ 10.308407] FS: 00007f8a847cb0c0(0000) GS:ffff8b1af3280000(0000) knlGS:0000000000000000
[ 10.308466] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 10.308511] CR2: 00007f69c6ba5298 CR3: 0000000114d8e003 CR4: 0000000000770ee0
[ 10.308564] PKRU: 55555554
[ 10.308614] Call Trace:
[ 10.308640] <TASK>
[ 10.308679] xe_gt_init+0x336/0x380 [xe]
[ 10.308886] xe_device_probe+0x234/0x2a0 [xe]
[ 10.309084] xe_pci_probe+0x418/0x540 [xe]
[ 10.309294] local_pci_probe+0x3e/0x80
[ 10.309342] pci_device_probe+0xb3/0x210
[ 10.309392] really_probe+0xdb/0x380
[ 10.309427] ? pm_runtime_barrier+0x50/0x90
[ 10.309473] __driver_probe_device+0x78/0x170
[ 10.309519] driver_probe_device+0x1f/0x90
[ 10.309564] __driver_attach+0xd5/0x1d0
[ 10.309632] ? __device_attach_driver+0x110/0x110
[ 10.309675] bus_for_each_dev+0x62/0x90
[ 10.309719] bus_add_driver+0x1b1/0x200
[ 10.309767] driver_register+0x89/0xe0
[ 10.309804] ? xe_hw_fence_module_init+0x35/0x35 [xe]
[ 10.310034] do_one_initcall+0x5a/0x300
[ 10.310080] ? rcu_read_lock_sched_held+0x3f/0x80
[ 10.310122] ? trace_kmalloc+0x33/0xe0
[ 10.310160] ? kmalloc_trace+0x46/0x60
[ 10.310203] do_init_module+0x4a/0x200
[ 10.310247] __do_sys_finit_module+0x93/0xf0
[ 10.310331] do_syscall_64+0x37/0x90
[ 10.310369] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 10.310417] RIP: 0033:0x7f8a8522892d
[ 10.310452] Code: 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d d3 e4 0c 00 f7 d8 64 89 01 48
[ 10.310576] RSP: 002b:00007ffdafa93138 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 10.310671] RAX: ffffffffffffffda RBX: 0000562a45dc7f50 RCX: 00007f8a8522892d
[ 10.310725] RDX: 0000000000000000 RSI: 0000562a45dc6100 RDI: 0000000000000016
[ 10.310777] RBP: 0000562a45dc6100 R08: 0000000000000000 R09: 00007ffdafa93260
[ 10.310827] R10: 0000000000000016 R11: 0000000000000246 R12: 0000000000020000
[ 10.310878] R13: 0000562a45dbf440 R14: 0000000000000000 R15: 0000562a45dbfbb0
[ 10.310967] </TASK>
[ 10.310989] irq event stamp: 141793
[ 10.311018] hardirqs last enabled at (141801): [<ffffffffa217660e>] __up_console_sem+0x5e/0x70
[ 10.311086] hardirqs last disabled at (141808): [<ffffffffa21765f3>] __up_console_sem+0x43/0x70
[ 10.311149] softirqs last enabled at (141740): [<ffffffffa20f026d>] __irq_exit_rcu+0xed/0x160
[ 10.311215] softirqs last disabled at (141735): [<ffffffffa20f026d>] __irq_exit_rcu+0xed/0x160
[ 10.311279] ---[ end trace 0000000000000000 ]---
[ 10.312424] xe: probe of 0000:08:00.0 failed with error -62
[ 10.321694] xe 0000:08:00.0: [drm] *ERROR* GuC PC Shutdown failed
[ 10.321789] ------------[ cut here ]------------
[ 10.321825] WARNING: CPU: 2 PID: 447 at drivers/gpu/drm/xe/xe_guc_pc.c:879 pc_fini+0xd0/0xf0 [xe]
Quoted 147 lines · Matt Roper
Reprogramming the LNCF MOCS registers on render domain reset is not intended to be regular driver programming, but rather the implementation of a specific workaround (
Wa_1607983814). This workaround no longer applies onXe_HPany beyond, so we can expect that these registers, like the rest of the LNCF/LBCF registers, will maintain their values through all engine resets. We should only add these registers to the GuC's save/restore list on platforms that need the workaround.Furthermore,
xe_mocs_init_engine()appears to be another attempt to satisfy this same workaround. This is unnecessary on the Xe driver since even on platforms where the workaround is necessary, all single-engine resets are initiated by the GuC and thus the GuC will take care of saving/restoring these registers. The only host-initiated resets we have in Xe are full GT resets which will already (re)initialize these registers as part of the regularxe_mocs_init()flow.v2:
- Addneeds_wa_1607983814()so thatcalculate_regset_size()doesn't overallocate regset space when the workaround isn't needed. (Lucas)
- On platforms affected byWa_1607983814, only add the LNCF MOCS registers to the render engine's GuC save/restore list; resets of other engines don't need to save/restore these.Cc Lucas De Marchi <[email protected]>Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 20 ++++++++++++++++---- drivers/gpu/drm/xe/xe_guc_submit.c | 1 - drivers/gpu/drm/xe/xe_mocs.c | 13 ------------- drivers/gpu/drm/xe/xe_mocs.h | 1 - 5 files changed, 17 insertions(+), 20 deletions(-)drivers/gpu/drm/xe/xe_execlist.c +1
-1@@ -462,7 +462,7 @@ static void execlist_engine_suspend_wait(struct xe_engine *e)static void execlist_engine_resume (struct xe_engine *e) { -xe_mocs_init_engine (e); +/* NIY */ }static const struct xe_engine_ops execlist_engine_ops = {drivers/gpu/drm/xe/xe_guc_ads.c +16
-4@@ -206,6 +206,11 @@ static void guc_ads_fini(struct drm_device *drm, void *arg)xe_bo_unpin_map_no_vm (ads->bo); } +static bool needs_wa_1607983814 (struct xe_device *xe) +{ +return GRAPHICS_VERx100 (xe) <1250 ; +} +static size_t calculate_regset_size (struct xe_gt *gt) {struct xe_reg_sr_entry *sr_entry;@@ -218,7 +223,10 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ; + count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; + +if (needs_wa_1607983814 (gt_to_xe (gt))) + count +=LNCFCMOCS_REG_COUNT ;return count *sizeof (struct guc_mmio_reg ); }@@ -430,6 +438,7 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads,struct iosys_map *regset_map, struct xe_hw_engine *hwe) { + struct xe_device *xe = ads_to_xe(ads);struct xe_hw_engine *hwe_rcs_reset_domain =xe_gt_any_hw_engine_by_reset_domain (hwe->gt,XE_ENGINE_CLASS_RENDER );struct xe_reg_sr_entry *entry;@@ -464,9 +473,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++); } -for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { -guc_mmio_regset_write_one (ads, regset_map, -GEN9_LNCFCMOCS (i).reg,0 , count++); +/* Wa_1607983814 */ +if (needs_wa_1607983814 (xe) && hwe->class ==XE_ENGINE_CLASS_RENDER ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++); + } }XE_BUG_ON (ads->regset_size < (count *sizeof (struct guc_mmio_reg )));drivers/gpu/drm/xe/xe_guc_submit.c +0
-1@@ -1267,7 +1267,6 @@ static void guc_engine_resume(struct xe_engine *e)XE_BUG_ON (e->guc->suspend_pending); -xe_mocs_init_engine (e);guc_engine_add_msg (e, msg,RESUME ); }drivers/gpu/drm/xe/xe_mocs.c +0
-13@@ -517,19 +517,6 @@ static void init_l3cc_table(struct xe_gt *gt, } } -void xe_mocs_init_engine (const struct xe_engine *engine) -{ -struct xe_mocs_info table; -unsigned int flags; - - flags =get_mocs_settings (engine->gt->xe, &table); -if (!flags) -return ; - -if (flags &HAS_RENDER_L3CC && engine->class ==XE_ENGINE_CLASS_RENDER ) -init_l3cc_table (engine->gt, &table); -} -void xe_mocs_init (struct xe_gt *gt) {struct xe_mocs_info table;drivers/gpu/drm/xe/xe_mocs.h +0
-1@@ -11,7 +11,6 @@struct xe_engine ;struct xe_gt ; -void xe_mocs_init_engine (const struct xe_engine *engine);void xe_mocs_init (struct xe_gt *gt);/**
Re: [Intel-xe] [PATCH v2 6/7] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
Hmm. It seems that most of that patch is fine, but the regression is caused by my attempt to tighten up the GuC's regset space allocated for these registers. The condition in guc_mmio_regset_write() only adds the LNCFMOCS registers to the GuC regset for RCS0 (they don't need to be saved/restored for the other engines), so I thought increasing the regset size by a total of just LNCFCMOCS_REG_COUNT (rather than LNCFCMOCS_REG_COUNT*XE_NUM_HW_ENGINES) would be sufficient, but it seems there's something I'm overlooking in the GuC regset code and we do still need to allocate the extra space for every possible engine, even the ones that don't need to save/restore it.
So I believe the following patch solves the problem; I just haven't figured out the details on exactly why yet.
drivers/gpu/drm/xe/xe_guc_ads.c +1 -4
@@ -224,10 +224,7 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; - -if (needs_wa_1607983814 (gt_to_xe (gt))) - count +=LNCFCMOCS_REG_COUNT ; + count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ;return count *sizeof (struct guc_mmio_reg ); }
Quoted 234 lines · Thomas Hellström
Hi!
After this commit I see the following on DG1, and attempting to run anything after that won't work.
Thomas
10.306993] ------------[ cut here ]------------
[ 10.307040] WARNING: CPU: 2 PID: 447 atdrivers/gpu/drm/xe/xe_hw_fence.c:91xe_hw_fence_irq_finish+0x36/0x120[xe] [ 10.307327] Modules linked in: xe(+)drm_ttm_helperttmi2c_algo_bitdrm_suballoc_helperkunitdrm_buddygpu_scheddrm_display_helperdrm_kms_helperdrmcrct10dif_pclmulcrc32_pclmulcrc32c_intelnvme e1000envme_coredrm_panel_orientation_quirksghash_clmulni_intelvideo wmipinctrl_tigerlakeusb_storageip6_tablesip_tablesfuse
[ 10.307656] CPU: 2 PID: 447 Comm: systemd-udevd Tainted: G U 6.1.0+ #120
[ 10.307719] Hardware name: ASUS System Product Name/PRIME B560M-A AC, BIOS 0403 01/26/2021
[ 10.307779] RIP: 0010:xe_hw_fence_irq_finish+0x36/0x120 [xe] [ 10.307980] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 48 89 fd <0f> 0b e8 33 84 13 e2 48 89 ef 88 44 24 07 e8 c7 44 5e e2 48 8b 55
[ 10.308103] RSP: 0018:ffffb917c12d7b90 EFLAGS: 00010216
[ 10.308149] RAX:ffff8b189b6d85d8RBX:00000000ffffffc2RCX:ffffb917c12d7aec
[ 10.308201] RDX: 0000000000000000 RSI:ffffffffa356dc2bRDI:ffff8b189ee84c60
[ 10.308253] RBP:ffff8b189ee84c60R08: 0000000000000001 R09:ffff8b189ee82278
[ 10.308304] R10: 0000000000000000 R11:00000000d3ea3544R12:ffff8b189ee84cc0
[ 10.308356] R13:ffff8b189ee84cd8R14:ffff8b189ee83e00R15:ffffffffc08dda87
[ 10.308407] FS: 00007f8a847cb0c0(0000) GS:ffff8b1af3280000(0000) knlGS:0000000000000000
[ 10.308466] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 10.308511] CR2:00007f69c6ba5298CR3:0000000114d8e003CR4:0000000000770ee0
[ 10.308564] PKRU: 55555554
[ 10.308614] Call Trace:
[ 10.308640] <TASK>
[ 10.308679]xe_gt_init+0x336/0x380[xe]
[ 10.308886]xe_device_probe+0x234/0x2a0[xe]
[ 10.309084]xe_pci_probe+0x418/0x540[xe]
[ 10.309294]local_pci_probe+0x3e/0x80
[ 10.309342]pci_device_probe+0xb3/0x210
[ 10.309392]really_probe+0xdb/0x380
[ 10.309427] ?pm_runtime_barrier+0x50/0x90
[ 10.309473]__driver_probe_device+0x78/0x170
[ 10.309519]driver_probe_device+0x1f/0x90
[ 10.309564]__driver_attach+0xd5/0x1d0
[ 10.309632] ?__device_attach_driver+0x110/0x110
[ 10.309675]bus_for_each_dev+0x62/0x90
[ 10.309719]bus_add_driver+0x1b1/0x200
[ 10.309767]driver_register+0x89/0xe0
[ 10.309804] ?xe_hw_fence_module_init+0x35/0x35[xe]
[ 10.310034]do_one_initcall+0x5a/0x300
[ 10.310080] ?rcu_read_lock_sched_held+0x3f/0x80
[ 10.310122] ?trace_kmalloc+0x33/0xe0
[ 10.310160] ?kmalloc_trace+0x46/0x60
[ 10.310203]do_init_module+0x4a/0x200
[ 10.310247]__do_sys_finit_module+0x93/0xf0
[ 10.310331]do_syscall_64+0x37/0x90
[ 10.310369]entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 10.310417] RIP: 0033:0x7f8a8522892d
[ 10.310452] Code: 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d d3 e4 0c 00 f7 d8 64 89 01 48
[ 10.310576] RSP: 002b:00007ffdafa93138 EFLAGS: 00000246ORIG_RAX:
0000000000000139
[ 10.310671] RAX: ffffffffffffffda RBX:0000562a45dc7f50RCX:00007f8a8522892d
[ 10.310725] RDX: 0000000000000000 RSI:0000562a45dc6100RDI:
0000000000000016
[ 10.310777] RBP:0000562a45dc6100R08: 0000000000000000 R09:00007ffdafa93260
[ 10.310827] R10: 0000000000000016 R11: 0000000000000246 R12:
0000000000020000
[ 10.310878] R13:0000562a45dbf440R14: 0000000000000000 R15:0000562a45dbfbb0
[ 10.310967] </TASK>
[ 10.310989] irq event stamp: 141793
[ 10.311018] hardirqs last enabled at (141801): [<ffffffffa217660e>]__up_console_sem+0x5e/0x70
[ 10.311086] hardirqs last disabled at (141808): [<ffffffffa21765f3>]__up_console_sem+0x43/0x70
[ 10.311149] softirqs last enabled at (141740): [<ffffffffa20f026d>]__irq_exit_rcu+0xed/0x160
[ 10.311215] softirqs last disabled at (141735): [<ffffffffa20f026d>]__irq_exit_rcu+0xed/0x160
[ 10.311279] ---[ end trace 0000000000000000 ]---
[ 10.312424] xe: probe of 0000:08:00.0 failed with error -62
[ 10.321694] xe 0000:08:00.0: [drm] *ERROR* GuC PC Shutdown failed [ 10.321789] ------------[ cut here ]------------
[ 10.321825] WARNING: CPU: 2 PID: 447 atdrivers/gpu/drm/xe/xe_guc_pc.c:879pc_fini+0xd0/0xf0[xe]Quoted 134 lines · Matt Roper
Reprogramming the LNCF MOCS registers on render domain reset is not intended to be regular driver programming, but rather the implementation of a specific workaround (
Wa_1607983814). This workaround no longer applies onXe_HPany beyond, so we can expect that these registers, like the rest of the LNCF/LBCF registers, will maintain their values through all engine resets. We should only add these registers to the GuC's save/restore list on platforms that need the workaround.Furthermore,
xe_mocs_init_engine()appears to be another attempt to satisfy this same workaround. This is unnecessary on the Xe driver since even on platforms where the workaround is necessary, all single-engine resets are initiated by the GuC and thus the GuC will take care of saving/restoring these registers. The only host-initiated resets we have in Xe are full GT resets which will already (re)initialize these registers as part of the regularxe_mocs_init()flow.v2:
- Addneeds_wa_1607983814()so thatcalculate_regset_size()doesn't overallocate regset space when the workaround isn't needed. (Lucas)
- On platforms affected byWa_1607983814, only add the LNCF MOCS registers to the render engine's GuC save/restore list; resets of other engines don't need to save/restore these.Cc Lucas De Marchi <[email protected]>Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 20 ++++++++++++++++---- drivers/gpu/drm/xe/xe_guc_submit.c | 1 - drivers/gpu/drm/xe/xe_mocs.c | 13 ------------- drivers/gpu/drm/xe/xe_mocs.h | 1 - 5 files changed, 17 insertions(+), 20 deletions(-)drivers/gpu/drm/xe/xe_execlist.c +1
-1@@ -462,7 +462,7 @@ static void execlist_engine_suspend_wait(struct xe_engine *e)static void execlist_engine_resume (struct xe_engine *e) { -xe_mocs_init_engine (e); +/* NIY */ }static const struct xe_engine_ops execlist_engine_ops = {drivers/gpu/drm/xe/xe_guc_ads.c +16
-4@@ -206,6 +206,11 @@ static void guc_ads_fini(struct drm_device *drm, void *arg)xe_bo_unpin_map_no_vm (ads->bo); } +static bool needs_wa_1607983814 (struct xe_device *xe) +{ +return GRAPHICS_VERx100 (xe) <1250 ; +} +static size_t calculate_regset_size (struct xe_gt *gt) {struct xe_reg_sr_entry *sr_entry;@@ -218,7 +223,10 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ; + count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; + +if (needs_wa_1607983814 (gt_to_xe (gt))) + count +=LNCFCMOCS_REG_COUNT ;return count *sizeof (struct guc_mmio_reg ); }@@ -430,6 +438,7 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads,struct iosys_map *regset_map, struct xe_hw_engine *hwe) { + struct xe_device *xe = ads_to_xe(ads);struct xe_hw_engine *hwe_rcs_reset_domain =xe_gt_any_hw_engine_by_reset_domain (hwe->gt,XE_ENGINE_CLASS_RENDER );struct xe_reg_sr_entry *entry;@@ -464,9 +473,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++); } -for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { -guc_mmio_regset_write_one (ads, regset_map, -GEN9_LNCFCMOCS (i).reg,0 , count++); +/* Wa_1607983814 */ +if (needs_wa_1607983814 (xe) && hwe->class ==XE_ENGINE_CLASS_RENDER ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++); + } }XE_BUG_ON (ads->regset_size < (count *sizeof (struct guc_mmio_reg )));drivers/gpu/drm/xe/xe_guc_submit.c +0
-1@@ -1267,7 +1267,6 @@ static void guc_engine_resume(struct xe_engine *e)XE_BUG_ON (e->guc->suspend_pending); -xe_mocs_init_engine (e);guc_engine_add_msg (e, msg,RESUME ); }drivers/gpu/drm/xe/xe_mocs.c +0
-13@@ -517,19 +517,6 @@ static void init_l3cc_table(struct xe_gt *gt, } } -void xe_mocs_init_engine (const struct xe_engine *engine) -{ -struct xe_mocs_info table; -unsigned int flags; - - flags =get_mocs_settings (engine->gt->xe, &table); -if (!flags) -return ; - -if (flags &HAS_RENDER_L3CC && engine->class ==XE_ENGINE_CLASS_RENDER ) -init_l3cc_table (engine->gt, &table); -} -void xe_mocs_init (struct xe_gt *gt) {struct xe_mocs_info table;drivers/gpu/drm/xe/xe_mocs.h +0
-1@@ -11,7 +11,6 @@struct xe_engine ;struct xe_gt ; -void xe_mocs_init_engine (const struct xe_engine *engine);void xe_mocs_init (struct xe_gt *gt);/**
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH v2 7/7 drm/xe/mocs: Drop HAS_RENDER_L3CC flag
In reply to Matt RoperThe HAS_RENDER_L3CC is set unconditionally so there's no need to keep it as a dedicated flag. For error checking purposes, we can just make sure the 'table' field is initialized properly.
--- drivers/gpu/drm/xe/xe_mocs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_mocs.c +4 -4
@@ -25,7 +25,6 @@ static inline void mocs_dbg(const struct drm_device *dev,enum {HAS_GLOBAL_MOCS =BIT (0 ), -HAS_RENDER_L3CC =BIT (1 ), };struct xe_mocs_entry {
@@ -440,10 +439,11 @@ static unsigned int get_mocs_settings(struct xe_device *xe,*/ XE_WARN_ON (info->unused_entries_index ==0 ); -if (XE_WARN_ON (info->size > info->n_entries)) +if (XE_WARN_ON (info->size > info->n_entries)) { + info->table =NULL ;return 0 ; + } - flags =HAS_RENDER_L3CC ;if (!IS_DGFX (xe)) flags |=HAS_GLOBAL_MOCS ;
@@ -538,6 +538,6 @@ void xe_mocs_init(struct xe_gt *gt)* sure the LNCFCMOCSx registers are programmed for the subsequent * memory transactions including guc transactions */ -if (flags &HAS_RENDER_L3CC ) +if (table.table)init_l3cc_table (gt, &table); }
Signature · 1 line
2.39.1
Re: [Intel-xe] [PATCH v2 7/7] drm/xe/mocs: Drop HAS_RENDER_L3CC flag
Quoted 7 lines · Matt Roper
The
HAS_RENDER_L3CCis set unconditionally so there's no need to keep it as a dedicated flag. For error checking purposes, we can just make sure the 'table' field is initialized properly.Cc Lucas De Marchi <[email protected]>Suggested-by Lucas De Marchi <[email protected]>Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 41 lines
---
drivers/gpu/drm/xe/xe_mocs.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/xe/xe_mocs.c +4
-4@@ -25,7 +25,6 @@ static inline void mocs_dbg(const struct drm_device *dev,enum {HAS_GLOBAL_MOCS =BIT (0 ), -HAS_RENDER_L3CC =BIT (1 ), };struct xe_mocs_entry {@@ -440,10 +439,11 @@ static unsigned int get_mocs_settings(struct xe_device *xe,*/ XE_WARN_ON (info->unused_entries_index ==0 ); -if (XE_WARN_ON (info->size > info->n_entries)) +if (XE_WARN_ON (info->size > info->n_entries)) { + info->table =NULL ;return 0 ; + } - flags =HAS_RENDER_L3CC ;if (!IS_DGFX (xe)) flags |=HAS_GLOBAL_MOCS ;@@ -538,6 +538,6 @@ void xe_mocs_init(struct xe_gt *gt)* sure the LNCFCMOCSx registers are programmed for the subsequent * memory transactions including guc transactions */ -if (flags &HAS_RENDER_L3CC ) +if (table.table)init_l3cc_table (gt, &table); }Signature · 1 line
2.39.1
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for Assorted MOCS updates (rev3)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: Assorted MOCS updates (rev3)
URL : https://patchwork.freedesktop.org/series/114121/
State : failure
== Summary ==
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:247
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:381
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:23
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:352
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:62
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_guc_ads.c:224
error: drivers/gpu/drm/xe/xe_guc_ads.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_mocs.c:25
error: drivers/gpu/drm/xe/xe_mocs.c: patch does not apply