Assorted MOCS updates
Subsystems (2)
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.
Matt Roper (5):
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
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 | 10 +- drivers/gpu/drm/xe/xe_guc_submit.c | 1 - drivers/gpu/drm/xe/xe_mocs.c | 160 ++++++++++++----------------- drivers/gpu/drm/xe/xe_mocs.h | 1 - 5 files changed, 76 insertions(+), 98 deletions(-)
Signature · 1 line
2.39.1
PATCH 1/6 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 tables that exist in the driver today are identical except that the TGL includes one additional (incorrect) setting for PAT index 1. This 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.
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
Re: [Intel-xe] [PATCH 1/6] drm/xe/mocs: Drop unwanted TGL table
Quoted 75 lines · Matt Roper
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 tables that exist in the driver today are identical except that the TGL includes one additional (incorrect) setting for PAT index 1. This 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.
Bspec: 45101
Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/xe_mocs.c| 46 ------------------------------------1 file changed, 46 deletions(-)drivers/gpu/drm/xe/xe_mocs.c +0
-41@@ -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 ),
drivers/gpu/drm/xe/xe_mocs.c static unsigned int get_mocs_settings(struct xe_device *xe, · line 428
Quoted 7 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-4@@ -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 ;
there is another difference here: it's not only the index 1 that is different, but any uninitialized entry.
that unused entries would be programmed to XE_MOCS_PTE (1):LE_0_PAGETABLE | LE_TC_0_PAGETABLE | L3_1_UC. After this patch they are programmed to
to index 3: LE_1_UC | LE_TC_1_LLC | L3_1_UC
From the commit message I was understanding you said it was only 1 entry with wrong value, which as per above is not the case. Maybe reword the commit message a little bit?
Lucas De Marchi
Quoted 7 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-1-break ;case XE_ALDERLAKE_S :case XE_ALDERLAKE_P : info->size =ARRAY_SIZE (gen12_mocs_desc);Signature · 1 line
2.39.1
Re: [Intel-xe] [PATCH 1/6] drm/xe/mocs: Drop unwanted TGL table
In reply to Matt RoperQuoted 16 lines · Matt Roper
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 tables that exist in the driver today are identical except that the TGL includes one additional (incorrect) setting for PAT index 1. This 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.
Quoted 2 lines
Bspec: 45101
Signed-off-by Matt Roper <[email protected]>
Regards,
Bala
Quoted 71 lines
--- 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 2/6 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
Re: [Intel-xe] [PATCH 2/6] drm/xe/mocs: Add missing RKL handling
Quoted 4 lines · Matt Roper
RKL should use the same "gen12" MOCS handling as TGL/ADL-S/ADL-P.
Bspec: 45101
Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 19 lines
---
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 3/6 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).
--- drivers/gpu/drm/xe/xe_mocs.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-)
drivers/gpu/drm/xe/xe_mocs.c +2 -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);
@@ -406,9 +381,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
Re: [Intel-xe] [PATCH 3/6] drm/xe/mocs: Drop xe_mocs_info_index
Quoted 50 lines · Matt Roper
The values in the
xe_mocs_info_indexenum 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 theXE_MOCS_PTEdefault doesn't even make sense since the hardware dropped the "use PAT settings" capability in gen12).Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/xe_mocs.c| 30 ++----------------------------1 file changed, 2 insertions(+), 28 deletions(-)drivers/gpu/drm/xe/xe_mocs.c +0
-24@@ -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 ),
drivers/gpu/drm/xe/xe_mocs.c static unsigned int get_mocs_settings(struct xe_device *xe, · line 344
Quoted 4 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-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 ;
since leaving this as 0 should never be valid, maybe add a warning after the switch for the cases someoneone forgot to set it appropriately?
with that,
thanks
Lucas De Marchi
Quoted 18 lines
drivers/gpu/drm/xe/xe_mocs.c +2
-3switch (xe->info.platform) {case XE_PVC : info->size =ARRAY_SIZE (pvc_mocs_desc);@@ -406,9 +381,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
Re: [Intel-xe] [PATCH 3/6] drm/xe/mocs: Drop xe_mocs_info_index
In reply to Matt RoperQuoted 9 lines · Matt Roper
The values in the
xe_mocs_info_indexenum 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 theXE_MOCS_PTEdefault doesn't even make sense since the hardware dropped the "use PAT settings" capability in gen12).
Quoted 4 lines
Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/xe/xe_mocs.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-)
Quoted 59 lines
drivers/gpu/drm/xe/xe_mocs.c +2
-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);@@ -406,9 +381,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 4/6 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
Re: [Intel-xe] [PATCH 4/6] drm/xe/mocs: Drop duplicate assignment of uc_index
Quoted 4 lines · Matt Roper
The DG1 branch needlessly assigns
uc_indextwice. Drop the second instance.Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 19 lines
---
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 5/6 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
Re: [Intel-xe] [PATCH 5/6] drm/xe/mocs: add MTL mocs
Quoted 11 lines · Matt Roper
From: Philippe Lecluse <[email protected]>
It was incorrectly using
dg2_mocsfor now.v2 (MattR):
- Use REG_GENMASK/REG_FIELD_PREP for bitfields
- Add bspec referencesBspec: 45101, 45410, 63882
Signed-off-by Philippe Lecluse <[email protected]>Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 109 lines
---
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 6/6 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.
--- drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 10 +++++++--- 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, 8 insertions(+), 19 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 +7 -3
@@ -430,6 +430,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 +465,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 (GRAPHICS_VER (xe) ==12 &&GRAPHICS_VERx100 (xe) <1250 ) { +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
@@ -507,19 +507,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 6/6] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
Quoted 31 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.Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 10 +++++++--- 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, 8 insertions(+), 19 deletions(-)drivers/gpu/drm/xe/xe_execlist.c +0
-0
drivers/gpu/drm/xe/xe_execlist.c static void execlist_engine_suspend_wait(struct xe_engine *e) · line 465
Quoted 5 lines
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 */
what does NIY mean? maybe "nop" is more common? And... what about the execlist backend staying without this? Yep, execlist right now is not very functioal, but should we be intentionally breaking it?
Quoted 17 lines
drivers/gpu/drm/xe/xe_execlist.c +0
-0}static const struct xe_engine_ops execlist_engine_ops = {drivers/gpu/drm/xe/xe_guc_ads.c +1
-0@@ -430,6 +430,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 +465,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++);
drivers/gpu/drm/xe/xe_guc_ads.c static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, · line 472
Quoted 10 lines
drivers/gpu/drm/xe/xe_guc_ads.c +5
-3} -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 (GRAPHICS_VER (xe) ==12 &&GRAPHICS_VERx100 (xe) <1250 ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++);
calculate_regset_size() unconditionally accounts for LNCFCMOCS_REG_COUNT. Although this is just a "max", maybe we could remove it from there by moving the if condition to a function bool needs_wa_1607983814() { ... }
Another idea would be maybe to extend xe_rtp to allow a FUNC() not only in the match but also in the action. We'd also need to extend it to allow that function to apply the actions. Humn... if we need it more than in just one place we can do that in future. For now this does the job.
Quoted 24 lines
drivers/gpu/drm/xe/xe_guc_ads.c +1
-0+ } }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
-0@@ -507,19 +507,6 @@ static void init_l3cc_table(struct xe_gt *gt, } }
drivers/gpu/drm/xe/xe_mocs.c static void init_l3cc_table(struct xe_gt *gt, · line 519
Quoted 10 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-10-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 )
do we have any other plans for HAS_RENDER_L3CC? It seems it's not used. For any error handling part we could check size, table or unused_entries_index
Lucas De Marchi
Quoted 21 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-3-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 6/6] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
Quoted 33 lines · Lucas De Marchi
Quoted 32 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.Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 10 +++++++--- 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, 8 insertions(+), 19 deletions(-)drivers/gpu/drm/xe/xe_execlist.c +0
-0@@ -462,7 +462,7 @@ static void execlist_engine_suspend_wait(struct xe_engine *e)
Quoted 8 lines
drivers/gpu/drm/xe/xe_execlist.c static void execlist_engine_suspend_wait(struct xe_engine *e) · line 465
Quoted 4 lines
drivers/gpu/drm/xe/xe_execlist.c +1
-1static void execlist_engine_resume (struct xe_engine *e) { -xe_mocs_init_engine (e); +/* NIY */ what does NIY mean? maybe "nop" is more common? And... what about the execlist backend staying without this? Yep, execlist right now is not very functioal, but should we be intentionally breaking it?
I assume "NIY" means "not in yet." That comment is what was used for several other unimplemented stubs in this same file, so I just did the same here for consistency.
Removing this shouldn't have any detrimental impact on the current execlist implementation. The programming here is only necessary to restore after a single-engine reset, but it's not possible to ever have an engine reset today because that was never implemented in Xe (and as far as I know, never will be).
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/xe/xe_execlist.c +0
-0}static const struct xe_engine_ops execlist_engine_ops = {drivers/gpu/drm/xe/xe_guc_ads.c +1
-0@@ -430,6 +430,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 +465,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++); }
Quoted 13 lines
drivers/gpu/drm/xe/xe_guc_ads.c static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, · line 472
Quoted 8 lines
drivers/gpu/drm/xe/xe_guc_ads.c +5
-3-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 (GRAPHICS_VER (xe) ==12 &&GRAPHICS_VERx100 (xe) <1250 ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++);
calculate_regset_size()unconditionally accounts forLNCFCMOCS_REG_COUNT. Although this is just a "max", maybe we could remove it from there by moving the if condition to a function boolneeds_wa_1607983814(){ ... }
Yeah, good point; I'll update that.
Matt
Quoted 71 lines
Another idea would be maybe to extend
xe_rtpto allow aFUNC()not only in the match but also in the action. We'd also need to extend it to allow that function to apply the actions. Humn... if we need it more than in just one place we can do that in future. For now this does the job.Quoted 24 lines
drivers/gpu/drm/xe/xe_guc_ads.c +1
-0+ } }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
-0@@ -507,19 +507,6 @@ static void init_l3cc_table(struct xe_gt *gt, } }drivers/gpu/drm/xe/xe_mocs.c static void init_l3cc_table(struct xe_gt *gt, · line 519
Quoted 10 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-10-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 )do we have any other plans for
HAS_RENDER_L3CC? It seems it's not used. For any error handling part we could check size, table orunused_entries_indexLucas De Marchi
Quoted 21 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-3-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
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 6/6] drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP
Quoted 43 lines · Matt Roper
Quoted 33 lines · Lucas De Marchi
Quoted 32 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.Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_guc_ads.c | 10 +++++++--- 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, 8 insertions(+), 19 deletions(-)drivers/gpu/drm/xe/xe_execlist.c +0
-0@@ -462,7 +462,7 @@ static void execlist_engine_suspend_wait(struct xe_engine *e)Quoted 8 lines
drivers/gpu/drm/xe/xe_execlist.c static void execlist_engine_suspend_wait(struct xe_engine *e) · line 465
Quoted 4 lines
drivers/gpu/drm/xe/xe_execlist.c +1
-1static void execlist_engine_resume (struct xe_engine *e) { -xe_mocs_init_engine (e); +/* NIY */ what does NIY mean? maybe "nop" is more common? And... what about the execlist backend staying without this? Yep, execlist right now is not very functioal, but should we be intentionally breaking it?
Quoted 3 lines
I assume "NIY" means "not in yet." That comment is what was used for several other unimplemented stubs in this same file, so I just did the same here for consistency.
oh... I think this is "not implemented yet". Ok, so it's not a nop, it's more a "TODO" if this is ever really done.
Quoted 6 lines
Removing this shouldn't have any detrimental impact on the current execlist implementation. The programming here is only necessary to restore after a single-engine reset, but it's not possible to ever have an engine reset today because that was never implemented in Xe (and as far as I know, never will be).
ok
thanks
Lucas De Marchi
Quoted 117 lines
Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/xe/xe_execlist.c +0
-0}static const struct xe_engine_ops execlist_engine_ops = {drivers/gpu/drm/xe/xe_guc_ads.c +1
-0@@ -430,6 +430,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 +465,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, e->reg, e->flags, count++); }Quoted 13 lines
drivers/gpu/drm/xe/xe_guc_ads.c static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, · line 472
Quoted 8 lines
drivers/gpu/drm/xe/xe_guc_ads.c +5
-3-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 (GRAPHICS_VER (xe) ==12 &&GRAPHICS_VERx100 (xe) <1250 ) { +for (i =0 ; i <LNCFCMOCS_REG_COUNT ; i++) { +guc_mmio_regset_write_one (ads, regset_map, +GEN9_LNCFCMOCS (i).reg,0 , count++);
calculate_regset_size()unconditionally accounts forLNCFCMOCS_REG_COUNT. Although this is just a "max", maybe we could remove it from there by moving the if condition to a function boolneeds_wa_1607983814(){ ... }Yeah, good point; I'll update that.
Matt
Quoted 71 lines
Another idea would be maybe to extend
xe_rtpto allow aFUNC()not only in the match but also in the action. We'd also need to extend it to allow that function to apply the actions. Humn... if we need it more than in just one place we can do that in future. For now this does the job.Quoted 24 lines
drivers/gpu/drm/xe/xe_guc_ads.c +1
-0+ } }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
-0@@ -507,19 +507,6 @@ static void init_l3cc_table(struct xe_gt *gt, } }drivers/gpu/drm/xe/xe_mocs.c static void init_l3cc_table(struct xe_gt *gt, · line 519
Quoted 10 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-10-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 )do we have any other plans for
HAS_RENDER_L3CC? It seems it's not used. For any error handling part we could check size, table orunused_entries_indexLucas De Marchi
Quoted 21 lines
drivers/gpu/drm/xe/xe_mocs.c +0
-3-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
-2@@ -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);/** -- 2.39.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation