xe2: Add PAT programming
Subsystems (2)
cover xe2: Add PAT programming
Add the PAT table and allow PTEs to be encoded with the additional bit.
This also adds a new debug capability: allow to dump the PAT table via debugfs and to dump it automatically when the driver fails to bind to the device. A wrong PAT table may be related with GuC failing to initialize or other failures that go away with additional debug messages. At least dumping the table allows one to quickly check if the values programmed are the expected ones.
Lucas De Marchi (6):
drm/xe/vm: Prefer xe_assert() over XE_WARN_ON() drm/xe/xe2: Follow XeHPC for TLB invalidation drm/xe/xe2: Add one more bit to encode PAT to ppgtt entries fixup! drm/xe/pat: Prefer the arch/IP names drm/xe/pat: Add debugfs node to dump PAT drm/xe/gt: Dump PAT table when failing to initialize
Matt Roper (1):
drm/xe/xe2: Program PAT tables
drivers/gpu/drm/xe/xe_bo.h | 1 + drivers/gpu/drm/xe/xe_ggtt.c | 2 +- drivers/gpu/drm/xe/xe_gt.c | 12 ++ drivers/gpu/drm/xe/xe_gt_debugfs.c | 12 ++ drivers/gpu/drm/xe/xe_pat.c | 190 ++++++++++++++++++++++++++++- drivers/gpu/drm/xe/xe_pat.h | 8 ++ drivers/gpu/drm/xe/xe_vm.c | 6 +- 7 files changed, 227 insertions(+), 4 deletions(-)
Signature · 1 line
2.40.1
PATCH 1/7 drm/xe/xe2: Program PAT tables
From: Matt Roper <[email protected]>
The PAT tables become significantly more complicated on Xe2 platforms. They now control L3, L4, and coherency settings, as well as additional characteristics such as compression.
Aside from the main PAT table, there's an additional register that also needs to be programmed with PAT settings for PCI Address Translation Services.
Bspec: 71582
--- drivers/gpu/drm/xe/xe_pat.c | 92 ++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pat.c +91 -1
@@ -10,10 +10,18 @@#include "xe_gt_mcr.h" #include "xe_mmio.h" +#define _PAT_ATS 0x47fc#define _PAT_INDEX (index) _PICK_EVEN_2RANGES(index, 8, \ 0x4800, 0x4804, \ 0x4848, 0x484c) +#define XE2_NO_PROMOTE REG_BIT(10) +#define XE2_COMP_EN REG_BIT(9) +#define XE2_L3_CLOS REG_GENMASK(7, 6) +#define XE2_L3_POLICY REG_GENMASK(5, 4) +#define XE2_L4_POLICY REG_GENMASK(3, 2) +#define XE2_COH_MODE REG_GENMASK(1, 0) +#define XELPG_L4_POLICY_MASK REG_GENMASK(3, 2)#define XELPG_PAT_3_UC REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 3)#define XELPG_PAT_1_WT REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 1)
@@ -67,6 +75,64 @@ static const u32 xelpg_pat_table[] = { [4] = XELPG_PAT_0_WB | XELPG_3_COH_2W, }; +/* +* The Xe2 table is getting large/complicated so it's easier to review if +* provided in a form that exactly matches the bspec's formatting. The meaning +* of the fields here are: +* - no_promote: 0=promotable, 1=no promote +* - comp_en: 0=disable, 1=enable +* - l3clos: L3 class of service (0-3) +* - l3_policy: 0=WB, 1=XD ("WB - Transient Display"), 3=UC +* - l4_policy: 0=WB, 1=WT, 3=UC +* - coh_mode: 0=no snoop, 2=1-way coherent, 3=2-way coherent +* +* Reserved entries should be programmed with the maximum caching, minimum +* coherency (which matches an all-0's encoding), so we can just omit them +* in the table. +*/ +#define XE2_PAT (no_promote, comp_en, l3clos, l3_policy, l4_policy, coh_mode) \ + (no_promote ? XE2_NO_PROMOTE : 0) | \ + (comp_en ? XE2_COMP_EN : 0) | \ + REG_FIELD_PREP(XE2_L3_CLOS, l3clos) | \ + REG_FIELD_PREP(XE2_L3_POLICY, l3_policy) | \ + REG_FIELD_PREP(XE2_L4_POLICY, l4_policy) | \ + REG_FIELD_PREP(XE2_COH_MODE, coh_mode) + +static const u32 xe2_pat_table[] = { + [0 ] =XE2_PAT (0 ,0 ,0 ,0 ,3 ,0 ), + [1 ] =XE2_PAT (0 ,0 ,0 ,0 ,3 ,2 ), + [2 ] =XE2_PAT (0 ,0 ,0 ,0 ,3 ,3 ), + [3 ] =XE2_PAT (0 ,0 ,0 ,3 ,3 ,0 ), + [4 ] =XE2_PAT (0 ,0 ,0 ,3 ,0 ,2 ), + [5 ] =XE2_PAT (0 ,0 ,0 ,3 ,3 ,2 ), + [6 ] =XE2_PAT (1 ,0 ,0 ,1 ,3 ,0 ), + [7 ] =XE2_PAT (0 ,0 ,0 ,3 ,0 ,3 ), + [8 ] =XE2_PAT (0 ,0 ,0 ,3 ,0 ,0 ), + [9 ] =XE2_PAT (0 ,1 ,0 ,0 ,3 ,0 ), + [10 ] =XE2_PAT (0 ,1 ,0 ,3 ,0 ,0 ), + [11 ] =XE2_PAT (1 ,1 ,0 ,1 ,3 ,0 ), + [12 ] =XE2_PAT (0 ,1 ,0 ,3 ,3 ,0 ), + [13 ] =XE2_PAT (0 ,0 ,0 ,0 ,0 ,0 ), + [14 ] =XE2_PAT (0 ,1 ,0 ,0 ,0 ,0 ), + [15 ] =XE2_PAT (1 ,1 ,0 ,1 ,1 ,0 ), +/* 16..19 are reserved; leave set to all 0's */ + [20 ] =XE2_PAT (0 ,0 ,1 ,0 ,3 ,0 ), + [21 ] =XE2_PAT (0 ,1 ,1 ,0 ,3 ,0 ), + [22 ] =XE2_PAT (0 ,0 ,1 ,0 ,3 ,2 ), + [23 ] =XE2_PAT (0 ,0 ,1 ,0 ,3 ,3 ), + [24 ] =XE2_PAT (0 ,0 ,2 ,0 ,3 ,0 ), + [25 ] =XE2_PAT (0 ,1 ,2 ,0 ,3 ,0 ), + [26 ] =XE2_PAT (0 ,0 ,2 ,0 ,3 ,2 ), + [27 ] =XE2_PAT (0 ,0 ,2 ,0 ,3 ,3 ), + [28 ] =XE2_PAT (0 ,0 ,3 ,0 ,3 ,0 ), + [29 ] =XE2_PAT (0 ,1 ,3 ,0 ,3 ,0 ), + [30 ] =XE2_PAT (0 ,0 ,3 ,0 ,3 ,2 ), + [31 ] =XE2_PAT (0 ,0 ,3 ,0 ,3 ,3 ), +}; + +/* Special PAT values programmed outside the main table */ +#define XE2_PAT_ATS XE2_PAT( 0, 0, 0, 0, 3, 3 ) +static void program_pat (struct xe_gt *gt,const u32 table[],int n_entries) {for (int i =0 ; i < n_entries; i++) {
@@ -102,9 +168,33 @@ static const struct xe_pat_ops xelpg_pat_ops = { .program_media = program_pat_mcr, }; +static void xe2lpg_program_pat (struct xe_gt *gt,const u32 table[],int n_entries) +{ +program_pat_mcr (gt, table, n_entries); +xe_gt_mcr_multicast_write (gt,XE_REG_MCR (_PAT_ATS),XE2_PAT_ATS ); +} + +static void xe2lpm_program_pat (struct xe_gt *gt,const u32 table[],int n_entries) +{ +program_pat (gt, table, n_entries); +xe_mmio_write32 (gt,XE_REG (_PAT_ATS),XE2_PAT_ATS ); +} + +static const struct xe_pat_ops xe2_pat_ops = { + .program_graphics = xe2lpg_program_pat, + .program_media = xe2lpm_program_pat, +}; +void xe_pat_init_early (struct xe_device *xe) { -if (xe->info.platform ==XE_METEORLAKE ) { +if (GRAPHICS_VER (xe) ==20 ) { + xe->pat.ops = &xe2_pat_ops; + xe->pat.table = xe2_pat_table; + xe->pat.n_entries =ARRAY_SIZE (xe2_pat_table); + xe->pat.idx[XE_CACHE_NONE ] =3 ; + xe->pat.idx[XE_CACHE_WT ] =15 ; + xe->pat.idx[XE_CACHE_WB ] =2 ; + }else if (xe->info.platform ==XE_METEORLAKE ) { xe->pat.ops = &xelpg_pat_ops; xe->pat.table = xelpg_pat_table; xe->pat.n_entries =ARRAY_SIZE (xelpg_pat_table);
Signature · 1 line
2.40.1
PATCH 2/7 drm/xe/vm: Prefer xe_assert() over XE_WARN_ON()
In reply to Lucas De MarchiWhen xelp_pte_encode_addr() was added in commit 99a8844441ba ("drm/xe/migrate: Do not hand-encode pte"), there was no xe pointer for using xe_assert(). This is not the case anymore, so prefer it over XE_WARN_ON().
--- drivers/gpu/drm/xe/xe_vm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_vm.c +2 -1
@@ -17,6 +17,7 @@#include <linux/mm.h> #include <linux/swap.h> +#include "xe_assert.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_drm_client.h"
@@ -1293,7 +1294,7 @@ static u64 xelp_pte_encode_addr(struct xe_device *xe, u64 addr,u64 pte;/* Avoid passing random bits directly as flags */ -XE_WARN_ON (flags & ~XE_PTE_PS64 ); +xe_assert (xe, !(flags & ~XE_PTE_PS64 )); pte = addr; pte |=XE_PAGE_PRESENT |XE_PAGE_RW ;
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 2/7] drm/xe/vm: Prefer xe_assert() over XE_WARN_ON()
Quoted 6 lines · Lucas De Marchi
When
xelp_pte_encode_addr()was added in commit99a8844441ba("drm/xe/migrate: Do not hand-encode pte"), there was no xe pointer for usingxe_assert(). This is not the case anymore, so prefer it overXE_WARN_ON().Signed-off-by Lucas De Marchi <[email protected]>
Quoted 28 lines
--- drivers/gpu/drm/xe/xe_vm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/xe/xe_vm.c +2
-1@@ -17,6 +17,7 @@#include <linux/mm.h> #include <linux/swap.h> +#include "xe_assert.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_drm_client.h" @@ -1293,7 +1294,7 @@ static u64 xelp_pte_encode_addr(struct xe_device *xe, u64 addr,u64 pte;/* Avoid passing random bits directly as flags */ -XE_WARN_ON (flags & ~XE_PTE_PS64 ); +xe_assert (xe, !(flags & ~XE_PTE_PS64 )); pte = addr; pte |=XE_PAGE_PRESENT |XE_PAGE_RW ;Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 3/7 drm/xe/xe2: Follow XeHPC for TLB invalidation
In reply to Lucas De MarchiRegister GUC_TLB_INV_CR is gone in xe2. When GuC submission is not yet enabled, make sure to follow the same path as XeHPC.
--- drivers/gpu/drm/xe/xe_ggtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_ggtt.c +1 -1
@@ -263,7 +263,7 @@ static void ggtt_invalidate_gt_tlb(struct xe_gt *gt) }else if (xe_device_uc_enabled (gt_to_xe (gt))) {struct xe_device *xe =gt_to_xe (gt); -if (xe->info.platform ==XE_PVC ) { +if (xe->info.platform ==XE_PVC ||GRAPHICS_VER (xe) >=20 ) {xe_mmio_write32 (gt,PVC_GUC_TLB_INV_DESC1 ,PVC_GUC_TLB_INV_DESC1_INVALIDATE ); xe_mmio_write32(gt, PVC_GUC_TLB_INV_DESC0,
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 3/7] drm/xe/xe2: Follow XeHPC for TLB invalidation
Quoted 4 lines · Lucas De Marchi
Register
GUC_TLB_INV_CRis gone in xe2. When GuC submission is not yet enabled, make sure to follow the same path as XeHPC.Signed-off-by Lucas De Marchi <[email protected]>
Matches the invalidation descriptor structure from bspec 59311.
Although I am uncertain that the general invalidation code here is entirely correct, even for PVC. Since completion only gets delivered to the GuC (which isn't up and running yet at the point we're using this), we should probably be checking that the 'valid' bit has returned to 0 from the previous request before trying to submit another invalidation request. But assuming that's needed, it would be a change for a different patch.
Matt
Quoted 20 lines
--- drivers/gpu/drm/xe/xe_ggtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/xe_ggtt.c +1
-1@@ -263,7 +263,7 @@ static void ggtt_invalidate_gt_tlb(struct xe_gt *gt) }else if (xe_device_uc_enabled (gt_to_xe (gt))) {struct xe_device *xe =gt_to_xe (gt); -if (xe->info.platform ==XE_PVC ) { +if (xe->info.platform ==XE_PVC ||GRAPHICS_VER (xe) >=20 ) {xe_mmio_write32 (gt,PVC_GUC_TLB_INV_DESC1 ,PVC_GUC_TLB_INV_DESC1_INVALIDATE ); xe_mmio_write32(gt, PVC_GUC_TLB_INV_DESC0,Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 3/7] drm/xe/xe2: Follow XeHPC for TLB invalidation
Quoted 6 lines · Matt Roper
Quoted 4 lines · Lucas De Marchi
Register
GUC_TLB_INV_CRis gone in xe2. When GuC submission is not yet enabled, make sure to follow the same path as XeHPC.Signed-off-by Lucas De Marchi <[email protected]>
Quoted 7 lines
Matches the invalidation descriptor structure from bspec 59311.
Reviewed-by Matt Roper <[email protected]>Although I am uncertain that the general invalidation code here is entirely correct, even for PVC. Since completion only gets delivered to the GuC (which isn't up and running yet at the point we're using this),
I think the point here is not about it being up and running yet, but rather having submission working. These are 2 different things.
Lucas De Marchi
Quoted 34 lines
we should probably be checking that the 'valid' bit has returned to 0 from the previous request before trying to submit another invalidation request. But assuming that's needed, it would be a change for a different patch.
Matt
Quoted 20 lines
--- drivers/gpu/drm/xe/xe_ggtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/xe_ggtt.c +1
-2@@ -263,7 +263,7 @@ static void ggtt_invalidate_gt_tlb(struct xe_gt *gt) }else if (xe_device_uc_enabled (gt_to_xe (gt))) {struct xe_device *xe =gt_to_xe (gt); -if (xe->info.platform ==XE_PVC ) { +if (xe->info.platform ==XE_PVC ||GRAPHICS_VER (xe) >=20 ) {xe_mmio_write32 (gt,PVC_GUC_TLB_INV_DESC1 ,PVC_GUC_TLB_INV_DESC1_INVALIDATE ); xe_mmio_write32(gt, PVC_GUC_TLB_INV_DESC0, --2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 4/7 drm/xe/xe2: Add one more bit to encode PAT to ppgtt entries
In reply to Lucas De MarchiXe2 adds one more bit to cover all the possible 32 entries. Although those entries are not used by internal kernel code paths, it's expected that userspace will make use of it.
Bspec: 59510
--- drivers/gpu/drm/xe/xe_bo.h | 1 + drivers/gpu/drm/xe/xe_vm.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/xe/xe_bo.h +1 -0
@@ -40,6 +40,7 @@#define XE_BO_INTERNAL_64K BIT(31)#define XELPG_PPGTT_PTE_PAT3 BIT_ULL(62) +#define XE2_PPGTT_PTE_PAT4 BIT_ULL(61)#define XE_PPGTT_PTE_PAT2 BIT_ULL(7)#define XE_PPGTT_PTE_PAT1 BIT_ULL(4)#define XE_PPGTT_PTE_PAT0 BIT_ULL(3)
drivers/gpu/drm/xe/xe_vm.c +3 -0
@@ -1223,6 +1223,9 @@ static u64 pte_encode_cache(struct xe_device *xe, enum xe_cache_level cache)if (pat_index &BIT (3 )) pte |=XELPG_PPGTT_PTE_PAT3 ; +if (pat_index & (BIT (4 ))) + pte |=XE2_PPGTT_PTE_PAT4 ; +return pte; }
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 4/7] drm/xe/xe2: Add one more bit to encode PAT to ppgtt entries
Quoted 40 lines
-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Lucas De Marchi
Sent: Thursday, September 28, 2023 10:03 PM
To: [email protected]
Cc: De Marchi, Lucas <[email protected]>
Subject: [Intel-xe] [PATCH 4/7] drm/xe/xe2: Add one more bit to encode PAT to ppgtt entriesXe2 adds one more bit to cover all the possible 32 entries. Although those entries are not used by internal kernel code paths, it's expected that userspace will make use of it.
Bspec: 59510
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_bo.h | 1 + drivers/gpu/drm/xe/xe_vm.c | 3 +++ 2 files changed, 4 insertions(+)drivers/gpu/drm/xe/xe_bo.h index renamed from drivers/gpu/drm/xe/xe_bo.h +0
-0
5090bdd1e462..7ffc26446d2e100644drivers/gpu/drm/xe/xe_bo.h +1
-0@@ -40,6 +40,7 @@#define XE_BO_INTERNAL_64K BIT(31)#define XELPG_PPGTT_PTE_PAT3 BIT_ULL(62) +#define XE2_PPGTT_PTE_PAT4 BIT_ULL(61)#define XE_PPGTT_PTE_PAT2 BIT_ULL(7)#define XE_PPGTT_PTE_PAT1 BIT_ULL(4)#define XE_PPGTT_PTE_PAT0 BIT_ULL(3)drivers/gpu/drm/xe/xe_vm.c index renamed from drivers/gpu/drm/xe/xe_vm.c +0
-0
140a70d91d76..7e5f4bbea451100644
drivers/gpu/drm/xe/xe_vm.c static u64 pte_encode_cache(struct xe_device *xe, · line 1231
Quoted 9 lines
drivers/gpu/drm/xe/xe_vm.c +3
-0@@ -1223,6 +1223,9 @@ static u64 pte_encode_cache(struct xe_device *xe, enum xe_cache_level cache)if (pat_index &BIT (3 )) pte |=XELPG_PPGTT_PTE_PAT3 ; +if (pat_index & (BIT (4 ))) + pte |=XE2_PPGTT_PTE_PAT4 ; +return pte; }
Quoted 2 lines
--
2.40.1
Re: [Intel-xe] [PATCH 4/7] drm/xe/xe2: Add one more bit to encode PAT to ppgtt entries
In reply to Lucas De MarchiQuoted 6 lines · Lucas De Marchi
Xe2 adds one more bit to cover all the possible 32 entries. Although those entries are not used by internal kernel code paths, it's expected that userspace will make use of it.
Bspec: 59510
Signed-off-by Lucas De Marchi <[email protected]>
The same information is also available on Bspec 67095 too.
Quoted 34 lines
--- drivers/gpu/drm/xe/xe_bo.h | 1 + drivers/gpu/drm/xe/xe_vm.c | 3 +++ 2 files changed, 4 insertions(+)drivers/gpu/drm/xe/xe_bo.h +1
-0@@ -40,6 +40,7 @@#define XE_BO_INTERNAL_64K BIT(31)#define XELPG_PPGTT_PTE_PAT3 BIT_ULL(62) +#define XE2_PPGTT_PTE_PAT4 BIT_ULL(61)#define XE_PPGTT_PTE_PAT2 BIT_ULL(7)#define XE_PPGTT_PTE_PAT1 BIT_ULL(4)#define XE_PPGTT_PTE_PAT0 BIT_ULL(3)drivers/gpu/drm/xe/xe_vm.c +3
-0@@ -1223,6 +1223,9 @@ static u64 pte_encode_cache(struct xe_device *xe, enum xe_cache_level cache)if (pat_index &BIT (3 )) pte |=XELPG_PPGTT_PTE_PAT3 ; +if (pat_index & (BIT (4 ))) + pte |=XE2_PPGTT_PTE_PAT4 ; +return pte; }Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 5/7 fixup! drm/xe/pat: Prefer the arch/IP names
In reply to Lucas De MarchiFix alignment
--- drivers/gpu/drm/xe/xe_pat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pat.c +1 -1
@@ -26,7 +26,7 @@#define XELPG_PAT_3_UC REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 3)#define XELPG_PAT_1_WT REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 1)#define XELPG_PAT_0_WB REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 0) -#define XELPG_INDEX_COH_MODE_MASK REG_GENMASK(1, 0) +#define XELPG_INDEX_COH_MODE_MASK REG_GENMASK(1, 0)#define XELPG_3_COH_2W REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 3)#define XELPG_2_COH_1W REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 2)#define XELPG_0_COH_NON REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 0)
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 5/7] fixup! drm/xe/pat: Prefer the arch/IP names
Quoted 3 lines · Lucas De Marchi
Fix alignment
Signed-off-by Lucas De Marchi <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/xe/xe_pat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/xe_pat.c +1
-1@@ -26,7 +26,7 @@#define XELPG_PAT_3_UC REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 3)#define XELPG_PAT_1_WT REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 1)#define XELPG_PAT_0_WB REG_FIELD_PREP(XELPG_L4_POLICY_MASK, 0) -#define XELPG_INDEX_COH_MODE_MASK REG_GENMASK(1, 0) +#define XELPG_INDEX_COH_MODE_MASK REG_GENMASK(1, 0)#define XELPG_3_COH_2W REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 3)#define XELPG_2_COH_1W REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 2)#define XELPG_0_COH_NON REG_FIELD_PREP(XELPG_INDEX_COH_MODE_MASK, 0)Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 6/7 drm/xe/pat: Add debugfs node to dump PAT
In reply to Lucas De MarchiThis is useful to debug cache issues, to double check if the PAT indexes match what they were supposed to be set to from spec.
--- drivers/gpu/drm/xe/xe_gt_debugfs.c | 12 ++++ drivers/gpu/drm/xe/xe_pat.c | 96 ++++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_pat.h | 8 +++ 3 files changed, 116 insertions(+)
drivers/gpu/drm/xe/xe_gt_debugfs.c +12 -0
@@ -16,6 +16,7 @@#include "xe_gt_topology.h" #include "xe_hw_engine.h" #include "xe_macros.h" +#include "xe_pat.h" #include "xe_reg_sr.h" #include "xe_reg_whitelist.h" #include "xe_uc_debugfs.h"
@@ -138,6 +139,16 @@ static int workarounds(struct seq_file *m, void *data)return 0 ; } +static int pat (struct seq_file *m,void *data) +{ +struct xe_gt *gt =node_to_gt (m->private); +struct drm_printer p =drm_seq_file_printer (m); + +xe_pat_dump (gt, &p); + +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },
@@ -147,6 +158,7 @@ static const struct drm_info_list debugfs_list[] = { {"ggtt", ggtt, 0}, {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, + {"pat", pat, 0}, };void xe_gt_debugfs_register (struct xe_gt *gt)
drivers/gpu/drm/xe/xe_pat.c +96 -0
144 lines not on this page · raw message
drivers/gpu/drm/xe/xe_pat.h +8 -0
@@ -6,6 +6,7 @@#ifndef _XE_PAT_H_#define _XE_PAT_H_ +struct drm_printer ;struct xe_gt ;struct xe_device ;
@@ -21,4 +22,11 @@ void xe_pat_init_early(struct xe_device *xe);*/ void xe_pat_init (struct xe_gt *gt); +/** +* xe_pat_dump - Dump PAT table +* @gt: GT structure +* @p: Printer to dump info to +*/ +void xe_pat_dump (struct xe_gt *gt,struct drm_printer *p); +#endif
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 6/7] drm/xe/pat: Add debugfs node to dump PAT
Quoted 102 lines · Lucas De Marchi
This is useful to debug cache issues, to double check if the PAT indexes match what they were supposed to be set to from spec.
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_gt_debugfs.c | 12 ++++ drivers/gpu/drm/xe/xe_pat.c | 96 ++++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_pat.h | 8 +++ 3 files changed, 116 insertions(+)drivers/gpu/drm/xe/xe_gt_debugfs.c +12
-0@@ -16,6 +16,7 @@#include "xe_gt_topology.h" #include "xe_hw_engine.h" #include "xe_macros.h" +#include "xe_pat.h" #include "xe_reg_sr.h" #include "xe_reg_whitelist.h" #include "xe_uc_debugfs.h" @@ -138,6 +139,16 @@ static int workarounds(struct seq_file *m, void *data)return 0 ; } +static int pat (struct seq_file *m,void *data) +{ +struct xe_gt *gt =node_to_gt (m->private); +struct drm_printer p =drm_seq_file_printer (m); + +xe_pat_dump (gt, &p); + +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },@@ -147,6 +158,7 @@ static const struct drm_info_list debugfs_list[] = { {"ggtt", ggtt, 0}, {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, + {"pat", pat, 0}, };void xe_gt_debugfs_register (struct xe_gt *gt)drivers/gpu/drm/xe/xe_pat.c +26
-0@@ -6,6 +6,8 @@#include "xe_pat.h" #include "regs/xe_reg_defs.h" +#include "xe_assert.h" +#include "xe_device.h" #include "xe_gt.h" #include "xe_gt_mcr.h" #include "xe_mmio.h" @@ -14,6 +16,7 @@#define _PAT_INDEX (index) _PICK_EVEN_2RANGES(index, 8, \ 0x4800, 0x4804, \ 0x4848, 0x484c) +#define _PAT_PTA 0x4820#define XE2_NO_PROMOTE REG_BIT(10)#define XE2_COMP_EN REG_BIT(9)@@ -43,6 +46,7 @@struct xe_pat_ops {void (*program_graphics)(struct xe_gt *gt,const u32 table[],int n_entries);void (*program_media)(struct xe_gt *gt,const u32 table[],int n_entries); +void (*dump)(struct xe_gt *gt,struct drm_printer *p); };static const u32 xelp_pat_table[] = {@@ -151,12 +155,38 @@ static void program_pat_mcr(struct xe_gt *gt, const u32 table[], int n_entries) } } +void xelp_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); +int i, err; + +xe_device_mem_access_get (xe); + err =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (err) + goto err_fw; + +drm_printf (p,"PAT table:\n" ); + +for (i =0 ; i < xe->pat.n_entries; i++) { +u32 pat =xe_mmio_read32 (gt,XE_REG (_PAT_INDEX (i))); + +drm_printf (p,"PAT[%2d] = %#8x\n" , i, pat); + } + + err =xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); +err_fw: +xe_assert (xe, !err); +xe_device_mem_access_put (xe);
drivers/gpu/drm/xe/xe_pat.c static void program_pat_mcr(struct xe_gt *gt, const u32 table[], int n_entries) · line 189
Quoted 10 lines
drivers/gpu/drm/xe/xe_pat.c +4
-0+} +static const struct xe_pat_ops xelp_pat_ops = { .program_graphics = program_pat, + .dump = xelp_dump, };static const struct xe_pat_ops xehp_pat_ops = { .program_graphics = program_pat_mcr, + .dump = xelp_dump,
If we use the unicast xelp dumper, some of our reads might happen while another thread is steering us to a group/instance that corresponds to a fused-off mslice, resulting in 0's instead of the correct values. We probably need an xehp-specific variant that does MCR reads.
It might also be nice to have an xehpc-specific dumping function that does field-based printout ( CLOS, MEM_TYPE ).
drivers/gpu/drm/xe/xe_pat.c static const struct xe_pat_ops xehp_pat_ops = { · line 199
Quoted 8 lines
drivers/gpu/drm/xe/xe_pat.c +1
-0};/* @@ -166,6 +196,7 @@ static const struct xe_pat_ops xehp_pat_ops = {static const struct xe_pat_ops xelpg_pat_ops = { .program_graphics = program_pat, .program_media = program_pat_mcr, + .dump = xelp_dump,
Xe_LPG / Xe_LPM+ need to choose MCR vs non-MCR based on GT type as you've done with Xe2 below. It would also be nice to have field-based dump output that presents ( L4_POLICY, COH_MODE ) separately.
Matt
Quoted 109 lines
drivers/gpu/drm/xe/xe_pat.c +65
-0};static void xe2lpg_program_pat (struct xe_gt *gt,const u32 table[],int n_entries)@@ -180,9 +211,64 @@ static void xe2lpm_program_pat(struct xe_gt *gt, const u32 table[], int n_entriexe_mmio_write32 (gt,XE_REG (_PAT_ATS),XE2_PAT_ATS ); } +void xe2_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); +int i, err; +u32 pat; + +xe_device_mem_access_get (xe); + err =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (err) + goto err_fw; + +drm_printf (p,"PAT table:\n" ); + +for (i =0 ; i < xe->pat.n_entries; i++) { +if (xe_gt_is_media_type (gt)) + pat =xe_mmio_read32 (gt,XE_REG (_PAT_INDEX (i))); +else + pat =xe_gt_mcr_unicast_read_any (gt,XE_REG_MCR (_PAT_INDEX (i))); + +drm_printf (p,"PAT[%2d] = [ %u, %u, %u, %u, %u, %u ] (%#8x)\n" , i, + !!(pat &XE2_NO_PROMOTE ), + !!(pat &XE2_COMP_EN ), +REG_FIELD_GET (XE2_L3_CLOS , pat), +REG_FIELD_GET (XE2_L3_POLICY , pat), +REG_FIELD_GET (XE2_L4_POLICY , pat), +REG_FIELD_GET (XE2_COH_MODE , pat), + pat); + } + +/* +* Also print PTA_MODE, which describes how the hardware accesses +* PPGTT entries. +*/ +if (xe_gt_is_media_type (gt)) + pat =xe_mmio_read32 (gt,XE_REG (_PAT_PTA)); +else + pat =xe_gt_mcr_unicast_read_any (gt,XE_REG_MCR (_PAT_PTA)); + +drm_printf (p,"Page Table Access:\n" ); +drm_printf (p,"PTA_MODE= [ %u, %u, %u, %u, %u, %u ] (%#8x)\n" , + !!(pat &XE2_NO_PROMOTE ), + !!(pat &XE2_COMP_EN ), +REG_FIELD_GET (XE2_L3_CLOS , pat), +REG_FIELD_GET (XE2_L3_POLICY , pat), +REG_FIELD_GET (XE2_L4_POLICY , pat), +REG_FIELD_GET (XE2_COH_MODE , pat), + pat); + + err =xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); +err_fw: +xe_assert (xe, !err); +xe_device_mem_access_put (xe); +} +static const struct xe_pat_ops xe2_pat_ops = { .program_graphics = xe2lpg_program_pat, .program_media = xe2lpm_program_pat, + .dump = xe2_dump, };void xe_pat_init_early (struct xe_device *xe)@@ -252,3 +338,13 @@ void xe_pat_init(struct xe_gt *gt)else xe->pat.ops->program_graphics (gt, xe->pat.table, xe->pat.n_entries); } + +void xe_pat_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); + +if (!xe->pat.ops->dump) +return ; + + xe->pat.ops->dump (gt, p); +}drivers/gpu/drm/xe/xe_pat.h +8
-0@@ -6,6 +6,7 @@#ifndef _XE_PAT_H_#define _XE_PAT_H_ +struct drm_printer ;struct xe_gt ;struct xe_device ;@@ -21,4 +22,11 @@ void xe_pat_init_early(struct xe_device *xe);*/ void xe_pat_init (struct xe_gt *gt); +/** +* xe_pat_dump - Dump PAT table +* @gt: GT structure +* @p: Printer to dump info to +*/ +void xe_pat_dump (struct xe_gt *gt,struct drm_printer *p); +#endif Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 6/7] drm/xe/pat: Add debugfs node to dump PAT
Quoted 110 lines · Matt Roper
Quoted 109 lines · Lucas De Marchi
This is useful to debug cache issues, to double check if the PAT indexes match what they were supposed to be set to from spec.
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_gt_debugfs.c | 12 ++++ drivers/gpu/drm/xe/xe_pat.c | 96 ++++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_pat.h | 8 +++ 3 files changed, 116 insertions(+)drivers/gpu/drm/xe/xe_gt_debugfs.c +12
-0@@ -16,6 +16,7 @@#include "xe_gt_topology.h" #include "xe_hw_engine.h" #include "xe_macros.h" +#include "xe_pat.h" #include "xe_reg_sr.h" #include "xe_reg_whitelist.h" #include "xe_uc_debugfs.h" @@ -138,6 +139,16 @@ static int workarounds(struct seq_file *m, void *data)return 0 ; } +static int pat (struct seq_file *m,void *data) +{ +struct xe_gt *gt =node_to_gt (m->private); +struct drm_printer p =drm_seq_file_printer (m); + +xe_pat_dump (gt, &p); + +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },@@ -147,6 +158,7 @@ static const struct drm_info_list debugfs_list[] = { {"ggtt", ggtt, 0}, {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, + {"pat", pat, 0}, };void xe_gt_debugfs_register (struct xe_gt *gt)drivers/gpu/drm/xe/xe_pat.c +29
-0@@ -6,6 +6,8 @@#include "xe_pat.h" #include "regs/xe_reg_defs.h" +#include "xe_assert.h" +#include "xe_device.h" #include "xe_gt.h" #include "xe_gt_mcr.h" #include "xe_mmio.h" @@ -14,6 +16,7 @@#define _PAT_INDEX (index) _PICK_EVEN_2RANGES(index, 8, \ 0x4800, 0x4804, \ 0x4848, 0x484c) +#define _PAT_PTA 0x4820#define XE2_NO_PROMOTE REG_BIT(10)#define XE2_COMP_EN REG_BIT(9)@@ -43,6 +46,7 @@struct xe_pat_ops {void (*program_graphics)(struct xe_gt *gt,const u32 table[],int n_entries);void (*program_media)(struct xe_gt *gt,const u32 table[],int n_entries); +void (*dump)(struct xe_gt *gt,struct drm_printer *p); };static const u32 xelp_pat_table[] = {@@ -151,12 +155,38 @@ static void program_pat_mcr(struct xe_gt *gt, const u32 table[], int n_entries) } } +void xelp_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); +int i, err; + +xe_device_mem_access_get (xe); + err =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (err) + goto err_fw; + +drm_printf (p,"PAT table:\n" ); + +for (i =0 ; i < xe->pat.n_entries; i++) { +u32 pat =xe_mmio_read32 (gt,XE_REG (_PAT_INDEX (i))); + +drm_printf (p,"PAT[%2d] = %#8x\n" , i, pat); + } + + err =xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); +err_fw: +xe_assert (xe, !err); +xe_device_mem_access_put (xe); +} +static const struct xe_pat_ops xelp_pat_ops = { .program_graphics = program_pat, + .dump = xelp_dump, };
Quoted 8 lines
drivers/gpu/drm/xe/xe_pat.c static void program_pat_mcr(struct xe_gt *gt, const u32 table[], int n_entries) · line 189
Quoted 3 lines
drivers/gpu/drm/xe/xe_pat.c +1
-0static const struct xe_pat_ops xehp_pat_ops = { .program_graphics = program_pat_mcr, + .dump = xelp_dump,If we use the unicast xelp dumper, some of our reads might happen while another thread is steering us to a group/instance that corresponds to a fused-off mslice, resulting in 0's instead of the correct values. We probably need an xehp-specific variant that does MCR reads.
ugh... I added the additional dump function while coding this, but decided to remove since I thought it was the media gt that did the MCR read. Since we don't have a separate media GT in PVC and DG2 then we wouldn't need the check. I will add that back
Quoted 3 lines
It might also be nice to have an xehpc-specific dumping function that does field-based printout ( CLOS,
MEM_TYPE).
ok
Quoted 12 lines
drivers/gpu/drm/xe/xe_pat.c static const struct xe_pat_ops xehp_pat_ops = { · line 199
Quoted 8 lines
drivers/gpu/drm/xe/xe_pat.c +1
-0};/* @@ -166,6 +196,7 @@ static const struct xe_pat_ops xehp_pat_ops = {static const struct xe_pat_ops xelpg_pat_ops = { .program_graphics = program_pat, .program_media = program_pat_mcr, + .dump = xelp_dump,
Xe_LPG/ Xe_LPM+ need to choose MCR vs non-MCR based on GT type as you've done with Xe2 below. It would also be nice to have field-based dump output that presents (L4_POLICY,COH_MODE) separately.
ok
thanks
Lucas De Marchi
Quoted 119 lines
Matt
Quoted 109 lines
drivers/gpu/drm/xe/xe_pat.c +65
-0};static void xe2lpg_program_pat (struct xe_gt *gt,const u32 table[],int n_entries)@@ -180,9 +211,64 @@ static void xe2lpm_program_pat(struct xe_gt *gt, const u32 table[], int n_entriexe_mmio_write32 (gt,XE_REG (_PAT_ATS),XE2_PAT_ATS ); } +void xe2_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); +int i, err; +u32 pat; + +xe_device_mem_access_get (xe); + err =xe_force_wake_get (gt_to_fw (gt),XE_FW_GT ); +if (err) + goto err_fw; + +drm_printf (p,"PAT table:\n" ); + +for (i =0 ; i < xe->pat.n_entries; i++) { +if (xe_gt_is_media_type (gt)) + pat =xe_mmio_read32 (gt,XE_REG (_PAT_INDEX (i))); +else + pat =xe_gt_mcr_unicast_read_any (gt,XE_REG_MCR (_PAT_INDEX (i))); + +drm_printf (p,"PAT[%2d] = [ %u, %u, %u, %u, %u, %u ] (%#8x)\n" , i, + !!(pat &XE2_NO_PROMOTE ), + !!(pat &XE2_COMP_EN ), +REG_FIELD_GET (XE2_L3_CLOS , pat), +REG_FIELD_GET (XE2_L3_POLICY , pat), +REG_FIELD_GET (XE2_L4_POLICY , pat), +REG_FIELD_GET (XE2_COH_MODE , pat), + pat); + } + +/* +* Also print PTA_MODE, which describes how the hardware accesses +* PPGTT entries. +*/ +if (xe_gt_is_media_type (gt)) + pat =xe_mmio_read32 (gt,XE_REG (_PAT_PTA)); +else + pat =xe_gt_mcr_unicast_read_any (gt,XE_REG_MCR (_PAT_PTA)); + +drm_printf (p,"Page Table Access:\n" ); +drm_printf (p,"PTA_MODE= [ %u, %u, %u, %u, %u, %u ] (%#8x)\n" , + !!(pat &XE2_NO_PROMOTE ), + !!(pat &XE2_COMP_EN ), +REG_FIELD_GET (XE2_L3_CLOS , pat), +REG_FIELD_GET (XE2_L3_POLICY , pat), +REG_FIELD_GET (XE2_L4_POLICY , pat), +REG_FIELD_GET (XE2_COH_MODE , pat), + pat); + + err =xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); +err_fw: +xe_assert (xe, !err); +xe_device_mem_access_put (xe); +} +static const struct xe_pat_ops xe2_pat_ops = { .program_graphics = xe2lpg_program_pat, .program_media = xe2lpm_program_pat, + .dump = xe2_dump, };void xe_pat_init_early (struct xe_device *xe)@@ -252,3 +338,13 @@ void xe_pat_init(struct xe_gt *gt)else xe->pat.ops->program_graphics (gt, xe->pat.table, xe->pat.n_entries); } + +void xe_pat_dump (struct xe_gt *gt,struct drm_printer *p) +{ +struct xe_device *xe =gt_to_xe (gt); + +if (!xe->pat.ops->dump) +return ; + + xe->pat.ops->dump (gt, p); +}drivers/gpu/drm/xe/xe_pat.h +8
-1@@ -6,6 +6,7 @@#ifndef _XE_PAT_H_#define _XE_PAT_H_ +struct drm_printer ;struct xe_gt ;struct xe_device ;@@ -21,4 +22,11 @@ void xe_pat_init_early(struct xe_device *xe);*/ void xe_pat_init (struct xe_gt *gt); +/** +* xe_pat_dump - Dump PAT table +* @gt: GT structure +* @p: Printer to dump info to +*/ +void xe_pat_dump (struct xe_gt *gt,struct drm_printer *p); +#endif --2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 7/7 drm/xe/gt: Dump PAT table when failing to initialize
In reply to Lucas De MarchiWhen failing on early initialization, one cause may be that the PAT configuration is not correct. Dump it for ease of debugging.
--- drivers/gpu/drm/xe/xe_gt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +12 -0
@@ -307,6 +307,17 @@ int xe_gt_init_early(struct xe_gt *gt)return 0 ; } +static void dump_pat_on_error (struct xe_gt *gt) +{ +struct drm_printer p; +char prefix[32 ]; + +snprintf (prefix,sizeof (prefix),"[GT%u Error]" , gt->info.id); + p =drm_debug_printer (prefix); + +xe_pat_dump (gt, &p); +} +static int gt_fw_domain_init (struct xe_gt *gt) {int err, i;
@@ -360,6 +371,7 @@ static int gt_fw_domain_init(struct xe_gt *gt)return 0 ; err_force_wake: +dump_pat_on_error (gt);xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); err_hw_fence_irq:for (i =0 ; i <XE_ENGINE_CLASS_MAX ; ++i)
Signature · 1 line
2.40.1
Re: [Intel-xe] [PATCH 7/7] drm/xe/gt: Dump PAT table when failing to initialize
Quoted 13 lines · Lucas De Marchi
When failing on early initialization, one cause may be that the PAT configuration is not correct. Dump it for ease of debugging.
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_gt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/gpu/drm/xe/xe_gt.c +0
-0
drivers/gpu/drm/xe/xe_gt.c int xe_gt_init_early(struct xe_gt *gt) · line 315
Quoted 9 lines
drivers/gpu/drm/xe/xe_gt.c +6
-0@@ -307,6 +307,17 @@ int xe_gt_init_early(struct xe_gt *gt)return 0 ; } +static void dump_pat_on_error (struct xe_gt *gt) +{ +struct drm_printer p; +char prefix[32 ]; + +snprintf (prefix,sizeof (prefix),"[GT%u Error]" , gt->info.id);
Should we put 'PAT' somewhere in the string here so it's clear what all the numbers getting dumped are supposed to be? Or else add a drm_printf() to add a "title" before calling the dump command below?
Up to you.
Quoted 19 lines
drivers/gpu/drm/xe/xe_gt.c +6
-0+ p =drm_debug_printer (prefix); + +xe_pat_dump (gt, &p); +} +static int gt_fw_domain_init (struct xe_gt *gt) {int err, i;@@ -360,6 +371,7 @@ static int gt_fw_domain_init(struct xe_gt *gt)return 0 ; err_force_wake: +dump_pat_on_error (gt);xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); err_hw_fence_irq:for (i =0 ; i <XE_ENGINE_CLASS_MAX ; ++i)Signature · 1 line
2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 7/7] drm/xe/gt: Dump PAT table when failing to initialize
Quoted 17 lines · Matt Roper
Quoted 16 lines · Lucas De Marchi
When failing on early initialization, one cause may be that the PAT configuration is not correct. Dump it for ease of debugging.
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_gt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/gpu/drm/xe/xe_gt.c +0
-0@@ -307,6 +307,17 @@ int xe_gt_init_early(struct xe_gt *gt)return 0 ; }
Quoted 8 lines
drivers/gpu/drm/xe/xe_gt.c int xe_gt_init_early(struct xe_gt *gt) · line 315
Quoted 6 lines
drivers/gpu/drm/xe/xe_gt.c +6
-0+static void dump_pat_on_error (struct xe_gt *gt) +{ +struct drm_printer p; +char prefix[32 ]; + +snprintf (prefix,sizeof (prefix),"[GT%u Error]" , gt->info.id);Should we put 'PAT' somewhere in the string here so it's clear what all
the number are being printed with:
drm_printf(p, "PAT table:\n");
...
drm_printf(p, "PAT[%2d] = [ %u, %u, %u, %u, %u, %u ] (%#8x)\n", i,
!!(pat & XE2_NO_PROMOTE),
!!(pat & XE2_COMP_EN),
REG_FIELD_GET(XE2_L3_CLOS, pat),
REG_FIELD_GET(XE2_L3_POLICY, pat),
REG_FIELD_GET(XE2_L4_POLICY, pat),
REG_FIELD_GET(XE2_COH_MODE, pat),
pat);So, I don't think we should add another PAT string.
Lucas De Marchi
Quoted 32 lines
the numbers getting dumped are supposed to be? Or else add a
drm_printf()to add a "title" before calling the dump command below?Up to you.
Reviewed-by Matt Roper <[email protected]>Quoted 19 lines
drivers/gpu/drm/xe/xe_gt.c +6
-1+ p =drm_debug_printer (prefix); + +xe_pat_dump (gt, &p); +} +static int gt_fw_domain_init (struct xe_gt *gt) {int err, i;@@ -360,6 +371,7 @@ static int gt_fw_domain_init(struct xe_gt *gt)return 0 ; err_force_wake: +dump_pat_on_error (gt);xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); err_hw_fence_irq:for (i =0 ; i <XE_ENGINE_CLASS_MAX ; ++i) --2.40.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for xe2: Add PAT programming
In reply to Lucas De Marchi== Series Details ==
== Series Details ==
Series: xe2: Add PAT programming
URL : https://patchwork.freedesktop.org/series/124430/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 9a795b4f0 drm/xe: timeout needs to be a signed value === git am output follows ===
Applying: drm/xe/xe2: Program PAT tables
Applying: drm/xe/vm: Prefer xe_assert() over XE_WARN_ON()
Applying: drm/xe/xe2: Follow XeHPC for TLB invalidation
Applying: drm/xe/xe2: Add one more bit to encode PAT to ppgtt entries
Applying: fixup! drm/xe/pat: Prefer the arch/IP names
Applying: drm/xe/pat: Add debugfs node to dump PAT
Applying: drm/xe/gt: Dump PAT table when failing to initialize