Aldebaran support
Subsystems (6)
Alex Deucher
maintainerPATCH 129/159 drm/amdgpu: Modify comments of vram_start/end
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
Modify the comment to reflect the fact that, if use GART for vram address translation for vmid0, [vram_start, vram_end] will be placed inside SYSVM aperture, together with GART.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +7 -4
@@ -190,10 +190,13 @@ struct amdgpu_gmc {u64 gart_end;/* Frame buffer aperture of this GPU device. Different from * fb_start (see below), this only covers the local GPU device. -* Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios) -* and calculate vram_start of this local device by adding an -* offset inside the XGMI hive. -* Under VMID0, logical address == MC address +* If use FB aperture to access FB, driver get fb_start from +* MC_VM_FB_LOCATION_BASE (set by vbios) and calculate vram_start +* of this local device by adding an offset inside the XGMI hive. +* If use GART table for VMID0 FB access, driver finds a hole in +* VMID0's virtual address space to place the SYSVM aperture inside +* which the first part is vram and the second part is gart (covering +* sram) */ u64 vram_start;u64 vram_end;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 130/159 drm/amdgpu: Placement of gart and vram in sysvm aperture
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
If use GART for FB translation, place both vram and gart to sysvm aperture. AGP aperture is not set up in this case because it is not used
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 34 ++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 +++++--- 3 files changed, 41 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +33 -1
@@ -162,6 +162,39 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, mc->vram_end, mc->real_vram_size >> 20); } +/** amdgpu_gmc_sysvm_location - place vram and gart in sysvm aperture +* +* @adev: amdgpu device structure holding all necessary information +* @mc: memory controller structure holding memory information +* +* This function is only used if use GART for FB translation. In such +* case, we use sysvm aperture (vmid0 page tables) for both vram +* and gart (aka system memory) access. +* +* GPUVM (and our organization of vmid0 page tables) require sysvm +* aperture to be placed at a location aligned with 8 times of native +* page size. For example, if vm_context0_cntl.page_table_block_size +* is 12, then native page size is 8G (2M*2^12), sysvm should start +* with a 64G aligned address. For simplicity, we just put sysvm at +* address 0. So vram start at address 0 and gart is right after vram. +*/ +void amdgpu_gmc_sysvm_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc) +{ +u64 hive_vram_start =0 ; +u64 hive_vram_end = mc->xgmi.node_segment_size * mc->xgmi.num_physical_nodes -1 ; + mc->vram_start = mc->xgmi.node_segment_size * mc->xgmi.physical_node_id; + mc->vram_end = mc->vram_start + mc->xgmi.node_segment_size -1 ; + mc->gart_start = hive_vram_end +1 ; + mc->gart_end = mc->gart_start + mc->gart_size -1 ; + mc->fb_start = hive_vram_start; + mc->fb_end = hive_vram_end; +dev_info (adev->dev,"VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n" , + mc->mc_vram_size >>20 , mc->vram_start, + mc->vram_end, mc->real_vram_size >>20 ); +dev_info (adev->dev,"GART: %lluM 0x%016llX - 0x%016llX\n" , + mc->gart_size >>20 , mc->gart_start, mc->gart_end); +} +/** * amdgpu_gmc_gart_location - try to find GART location *
@@ -169,7 +202,6 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,* @mc: memory controller structure holding memory information * * Function will place try to place GART before or after VRAM. -* * If GART size is bigger than space left then we ajust GART size. * Thus function will never fails. */
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -292,6 +292,7 @@ int amdgpu_gmc_set_pte_pde(struct amdgpu_device *adev, void *cpu_pt_addr, uint64_t flags);uint64_t amdgpu_gmc_pd_addr (struct amdgpu_bo *bo);uint64_t amdgpu_gmc_agp_addr (struct ttm_buffer_object *bo); +void amdgpu_gmc_sysvm_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc);void amdgpu_gmc_vram_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc,u64 base); void amdgpu_gmc_gart_location(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -3
@@ -1257,9 +1257,13 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,/* add the xgmi offset of the physical node */ base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -amdgpu_gmc_vram_location (adev, mc, base); -amdgpu_gmc_gart_location (adev, mc); -amdgpu_gmc_agp_location (adev, mc); +if (adev->gmc.xgmi.connected_to_cpu) { +amdgpu_gmc_sysvm_location (adev, mc); + }else { +amdgpu_gmc_vram_location (adev, mc, base); +amdgpu_gmc_gart_location (adev, mc); +amdgpu_gmc_agp_location (adev, mc); + }/* base offset of vram pages */ adev->vm_manager.vram_base_offset = adev->gfxhub.funcs->get_mc_fb_offset (adev);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 131/159 drm/amdgpu: Use different gart table parameters for 2-level gart table
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
If use gart for FB translation, we will squeeze vram into sysvm aperture. This requires 2 level gart table. Add page table depth and page table block size parameters to gmc. This is prepare work to 2-level gart table construction
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 3 +++ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c | 5 ++++- 4 files changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +3 -0
@@ -244,6 +244,9 @@ struct amdgpu_gmc {struct amdgpu_xgmi xgmi;struct amdgpu_irq_src ecc_irq;int noretry; + +uint32_t vmid0_page_table_block_size; +uint32_t vmid0_page_table_depth; };#define amdgpu_gmc_flush_gpu_tlb (adev, vmid, vmhub, type) ((adev)->gmc.gmc_funcs->flush_gpu_tlb((adev), (vmid), (vmhub), (type)))
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +4 -1
@@ -189,7 +189,10 @@ static void gfxhub_v1_0_enable_system_domain(struct amdgpu_device *adev) tmp =RREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_CNTL); tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,ENABLE_CONTEXT ,1 ); - tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_DEPTH ,0 ); + tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_DEPTH , + adev->gmc.vmid0_page_table_depth); + tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_BLOCK_SIZE , + adev->gmc.vmid0_page_table_block_size); tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,RETRY_PERMISSION_OR_INVALID_PAGE_FAULT ,0 );WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_CNTL, tmp);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +9 -0
@@ -1363,6 +1363,15 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)WARN (1 ,"VEGA10 PCIE GART already initialized\n" );return 0 ; } + +if (adev->gmc.xgmi.connected_to_cpu) { + adev->gmc.vmid0_page_table_depth =1 ; + adev->gmc.vmid0_page_table_block_size =12 ; + }else { + adev->gmc.vmid0_page_table_depth =0 ; + adev->gmc.vmid0_page_table_block_size =0 ; + } +/* Initialize common gart structure */ r =amdgpu_gart_init (adev);if (r)
drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c +4 -1
@@ -198,7 +198,10 @@ static void mmhub_v1_7_enable_system_domain(struct amdgpu_device *adev) tmp =RREG32_SOC15 (MMHUB ,0 , regVM_CONTEXT0_CNTL); tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,ENABLE_CONTEXT ,1 ); - tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_DEPTH ,0 ); + tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_DEPTH , + adev->gmc.vmid0_page_table_depth); + tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,PAGE_TABLE_BLOCK_SIZE , + adev->gmc.vmid0_page_table_block_size); tmp =REG_SET_FIELD (tmp,VM_CONTEXT0_CNTL ,RETRY_PERMISSION_OR_INVALID_PAGE_FAULT ,0 );WREG32_SOC15 (MMHUB ,0 , regVM_CONTEXT0_CNTL, tmp);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 132/159 drm/amdgpu: Add function to allocate and fill PDB0
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
Add functions to allocate PDB0, map it for CPU access, and fill it.
Those functions are only used for 2-level vmid0 page table construction
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 103 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 5 ++ 2 files changed, 108 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +103 -0
@@ -31,6 +31,57 @@#include "amdgpu_ras.h" #include "amdgpu_xgmi.h" +/** +* amdgpu_gmc_pdb0_alloc - allocate vram for pdb0 +* +* @adev: amdgpu_device pointer +* +* Allocate video memory for pdb0 and map it for CPU access +* Returns 0 for success, error for failure. +*/ +int amdgpu_gmc_pdb0_alloc (struct amdgpu_device *adev) +{ +int r; +struct amdgpu_bo_param bp; +u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes; +uint32_t pde0_page_shift = adev->gmc.vmid0_page_table_block_size +21 ; +uint32_t npdes = (vram_size + (1ULL << pde0_page_shift) -1 ) >> pde0_page_shift; + +memset (&bp,0 ,sizeof (bp)); + bp.size =PAGE_ALIGN ((npdes +1 ) *8 ); + bp.byte_align =PAGE_SIZE ; + bp.domain =AMDGPU_GEM_DOMAIN_VRAM ; + bp.flags =AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | +AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS ; + bp.type = ttm_bo_type_kernel; + bp.resv =NULL ; + r =amdgpu_bo_create (adev, &bp, &adev->gmc.pdb0_bo); +if (r) +return r; + + r =amdgpu_bo_reserve (adev->gmc.pdb0_bo, false); +if (unlikely (r !=0 )) + goto bo_reserve_failure; + + r =amdgpu_bo_pin (adev->gmc.pdb0_bo,AMDGPU_GEM_DOMAIN_VRAM ); +if (r) + goto bo_pin_failure; + r =amdgpu_bo_kmap (adev->gmc.pdb0_bo, &adev->gmc.ptr_pdb0); +if (r) + goto bo_kmap_failure; + +amdgpu_bo_unreserve (adev->gmc.pdb0_bo); +return 0 ; + +bo_kmap_failure: +amdgpu_bo_unpin (adev->gmc.pdb0_bo); +bo_pin_failure: +amdgpu_bo_unreserve (adev->gmc.pdb0_bo); +bo_reserve_failure: +amdgpu_bo_unref (&adev->gmc.pdb0_bo); +return r; +} +/** * amdgpu_gmc_get_pde_for_bo - get the PDE for a BO *
@@ -552,3 +603,55 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) adev->mman.stolen_extended_size =0 ; } } + +/** +* amdgpu_gmc_init_pdb0 - initialize PDB0 +* +* @adev: amdgpu_device pointer +* +* This function is only used when GART page table is used +* for FB address translatioin. In such a case, we construct +* a 2-level system VM page table: PDB0->PTB, to cover both +* VRAM of the hive and system memory. +* +* PDB0 is static, initialized once on driver initialization. +* The first n entries of PDB0 are used as PTE by setting +* P bit to 1, pointing to VRAM. The n+1'th entry points +* to a big PTB covering system memory. +* +*/ +void amdgpu_gmc_init_pdb0 (struct amdgpu_device *adev) +{ +int i; +uint64_t flags = adev->gart.gart_pte_flags;//TODO it is UC. explore NC/RW? +/* Each PDE0 (used as PTE) covers (2^vmid0_page_table_block_size)*2M +*/ +u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes; +u64 pde0_page_size = (1ULL <<adev->gmc.vmid0_page_table_block_size)<<21 ; +u64 vram_addr = adev->vm_manager.vram_base_offset - + adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; +u64 vram_end = vram_addr + vram_size; +u64 gart_ptb_gpu_pa =amdgpu_bo_gpu_offset (adev->gart.bo) + + adev->vm_manager.vram_base_offset - adev->gmc.vram_start; + + flags |=AMDGPU_PTE_VALID |AMDGPU_PTE_READABLE ; + flags |=AMDGPU_PTE_WRITEABLE ; + flags |=AMDGPU_PTE_SNOOPED ; + flags |=AMDGPU_PTE_FRAG ((adev->gmc.vmid0_page_table_block_size +9 *1 )); + flags |=AMDGPU_PDE_PTE ; + +/* The first n PDE0 entries are used as PTE, +* pointing to vram +*/ +for (i =0 ; vram_addr < vram_end; i++, vram_addr += pde0_page_size) +amdgpu_gmc_set_pte_pde (adev, adev->gmc.ptr_pdb0, i, vram_addr, flags); + +/* The n+1'th PDE0 entry points to a huge +* PTB who has more than 512 entries each +* pointing to a 4K system page +*/ + flags =AMDGPU_PTE_VALID |AMDGPU_PTE_SYSTEM ; + flags |=AMDGPU_PDE_BFS (0 ) |AMDGPU_PTE_SNOOPED ; +/* Requires gart_ptb_gpu_pa to be 4K aligned */ +amdgpu_gmc_set_pte_pde (adev, adev->gmc.ptr_pdb0, i, gart_ptb_gpu_pa, flags); +}
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
@@ -247,6 +247,9 @@ struct amdgpu_gmc {uint32_t vmid0_page_table_block_size;uint32_t vmid0_page_table_depth; +struct amdgpu_bo *pdb0_bo; +/* CPU kmapped address of pdb0*/ +void *ptr_pdb0; };#define amdgpu_gmc_flush_gpu_tlb (adev, vmid, vmhub, type) ((adev)->gmc.gmc_funcs->flush_gpu_tlb((adev), (vmid), (vmhub), (type)))
@@ -288,6 +291,7 @@ static inline uint64_t amdgpu_gmc_sign_extend(uint64_t addr)return addr; } +int amdgpu_gmc_pdb0_alloc (struct amdgpu_device *adev);void amdgpu_gmc_get_pde_for_bo (struct amdgpu_bo *bo,int level,uint64_t *addr,uint64_t *flags); int amdgpu_gmc_set_pte_pde(struct amdgpu_device *adev, void *cpu_pt_addr,
@@ -317,4 +321,5 @@ amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type,void amdgpu_gmc_get_vbios_allocations (struct amdgpu_device *adev); +void amdgpu_gmc_init_pdb0 (struct amdgpu_device *adev);#endif
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 133/159 drm/amdgpu: Set up vmid0 PDB0
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
If use gart for FB translation, allocate and fill PDB0.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 28 +++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +24 -4
@@ -1379,7 +1379,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev) adev->gart.table_size = adev->gart.num_gpu_pages *8 ; adev->gart.gart_pte_flags =AMDGPU_PTE_MTYPE_VG10 (MTYPE_UC ) |AMDGPU_PTE_EXECUTABLE ; -return amdgpu_gart_table_vram_alloc (adev); + + r =amdgpu_gart_table_vram_alloc (adev); +if (r) +return r; + +if (adev->gmc.xgmi.connected_to_cpu) { + r =amdgpu_gmc_pdb0_alloc (adev); + } + +return r; }/**
@@ -1566,6 +1575,8 @@ static int gmc_v9_0_sw_fini(void *handle)amdgpu_gart_table_vram_free (adev);amdgpu_bo_fini (adev);amdgpu_gart_fini (adev); +if (adev->gmc.pdb0_bo) +amdgpu_bo_unref (&adev->gmc.pdb0_bo);return 0 ; }
@@ -1624,10 +1635,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) {int r; +if (adev->gmc.xgmi.connected_to_cpu) +amdgpu_gmc_init_pdb0 (adev); +if (adev->gart.bo ==NULL ) {dev_err (adev->dev,"No VRAM object for PCIE GART.\n" );return -EINVAL ; } + r =amdgpu_gart_table_vram_pin (adev);if (r)return r;
@@ -1640,9 +1655,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)if (r)return r; -DRM_INFO ("PCIE GART of %uM enabled (table at 0x%016llX).\n" , - (unsigned )(adev->gmc.gart_size >>20 ), - (unsigned long long )amdgpu_bo_gpu_offset (adev->gart.bo)); +DRM_INFO ("PCIE GART of %uM enabled.\n" , + (unsigned )(adev->gmc.gart_size >>20 )); +if (adev->gmc.pdb0_bo) +DRM_INFO ("PDB0 located at 0x%016llX\n" , + (unsigned long long )amdgpu_bo_gpu_offset (adev->gmc.pdb0_bo)); +DRM_INFO ("PTB located at 0x%016llX\n" , + (unsigned long long )amdgpu_bo_gpu_offset (adev->gart.bo)); + adev->gart.ready = true;return 0 ; }
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 134/159 drm/amdgpu: HW setup of 2-level vmid0 page table
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
Set up HW for 2-level vmid0 page table: 1. Set up PAGE_TABLE_START/END registers. Currently only plan to do 2-level page table for ALDEBARAN, so only gfxhub1.0 and mmhub1.7 is changed. 2. Set page table base register. For 2-level page table, the page table base should point to PDB0. 3. Disable AGP and FB aperture as they are not used.
--- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 52 +++++++++++++++++++----- drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c | 50 +++++++++++++++++++---- 2 files changed, 83 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +42 -10
@@ -53,19 +53,39 @@ static void gfxhub_v1_0_setup_vm_pt_regs(struct amdgpu_device *adev,static void gfxhub_v1_0_init_gart_aperture_regs (struct amdgpu_device *adev) { -uint64_t pt_base =amdgpu_gmc_pd_addr (adev->gart.bo); +uint64_t pt_base; -gfxhub_v1_0_setup_vm_pt_regs (adev,0 , pt_base); +if (adev->gmc.pdb0_bo) + pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo); +else + pt_base =amdgpu_gmc_pd_addr (adev->gart.bo); -WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.gart_start >>12 )); -WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.gart_start >>44 )); +gfxhub_v1_0_setup_vm_pt_regs (adev,0 , pt_base); -WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, - (u32)(adev->gmc.gart_end >>12 )); -WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, - (u32)(adev->gmc.gart_end >>44 )); +/* If use GART for FB translation, vmid0 page table covers both +* vram and system memory (gart) +*/ +if (adev->gmc.pdb0_bo) { +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, + (u32)(adev->gmc.fb_start >>12 )); +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, + (u32)(adev->gmc.fb_start >>44 )); + +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, + (u32)(adev->gmc.gart_end >>12 )); +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, + (u32)(adev->gmc.gart_end >>44 )); + }else { +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, + (u32)(adev->gmc.gart_start >>12 )); +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, + (u32)(adev->gmc.gart_start >>44 )); + +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, + (u32)(adev->gmc.gart_end >>12 )); +WREG32_SOC15 (GC ,0 , mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, + (u32)(adev->gmc.gart_end >>44 )); + } }static void gfxhub_v1_0_init_system_aperture_regs (struct amdgpu_device *adev)
@@ -116,6 +136,18 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)WREG32_FIELD15 (GC ,0 ,VM_L2_PROTECTION_FAULT_CNTL2 ,ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY ,1 ); } + +/* In the case squeezing vram into GART aperture, we don't use +* FB aperture and AGP aperture. Disable them. +*/ +if (adev->gmc.pdb0_bo) { +WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_TOP,0 ); +WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_BASE,0x00FFFFFF ); +WREG32_SOC15 (GC ,0 , mmMC_VM_AGP_TOP,0 ); +WREG32_SOC15 (GC ,0 , mmMC_VM_AGP_BOT,0xFFFFFF ); +WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,0x3FFFFFFF ); +WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,0 ); + } }static void gfxhub_v1_0_init_tlb_regs (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c +41 -9
66 lines not on this page · raw message
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 135/159 drm/amdgpu: workaround the TMR MC address issue
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
With the 2-level gart page table, vram is squeezed into gart aperture and FB aperture is disabled. Therefore all VRAM virtual addresses are
in the GART aperture. However currently PSP requires TMR addresses
in FB aperture. So we need some design change at PSP FW level to support this 2-level gart table driver change. Right now this PSP FW support doesn't exist. To workaround this issue temporarily, FB aperture is added back and the gart aperture address is converted back to FB aperture for this PSP TMR address.
Will revert it after we get a fix from PSP FW.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c | 10 ++++++---- 4 files changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +9 -0
@@ -208,6 +208,15 @@ struct amdgpu_gmc {*/ u64 fb_start;u64 fb_end; +/* In the case of use GART table for vmid0 FB access, [fb_start, fb_end] +* will be squeezed to GART aperture. But we have a PSP FW issue to fix +* for now. To temporarily workaround the PSP FW issue, added below two +* variables to remember the original fb_start/end to re-enable FB +* aperture to workaround the PSP FW issue. Will delete it after we +* get a proper PSP FW fix. +*/ +u64 fb_start_original; +u64 fb_end_original;unsigned vram_width;u64 real_vram_size;int vram_mtrr;
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +8 -0
@@ -407,6 +407,14 @@ static int psp_tmr_init(struct psp_context *psp)AMDGPU_GEM_DOMAIN_VRAM , &psp->tmr_bo, &psp->tmr_mc_addr, pptr); +/* workaround the tmr_mc_addr: +* PSP requires an address in FB aperture. Right now driver produce +* tmr_mc_addr in the GART aperture. Convert it back to FB aperture +* for PSP. Will revert it after we get a fix from PSP FW. +*/ + psp->tmr_mc_addr -= psp->adev->gmc.fb_start; + psp->tmr_mc_addr += psp->adev->gmc.fb_start_original; +return ret; }
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +4 -4
@@ -141,12 +141,12 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)* FB aperture and AGP aperture. Disable them. */ if (adev->gmc.pdb0_bo) { -WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_TOP,0 ); -WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_BASE,0x00FFFFFF ); +WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_TOP, adev->gmc.fb_end_original >>24 ); +WREG32_SOC15 (GC ,0 , mmMC_VM_FB_LOCATION_BASE, adev->gmc.fb_start_original >>24 );WREG32_SOC15 (GC ,0 , mmMC_VM_AGP_TOP,0 );WREG32_SOC15 (GC ,0 , mmMC_VM_AGP_BOT,0xFFFFFF ); -WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,0x3FFFFFFF ); -WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,0 ); +WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.fb_start_original >>18 ); +WREG32_SOC15 (GC ,0 , mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR, adev->gmc.fb_end_original >>18 ); } }
drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c +6 -4
@@ -47,6 +47,8 @@ static u64 mmhub_v1_7_get_fb_location(struct amdgpu_device *adev) adev->gmc.fb_start = base; adev->gmc.fb_end = top; + adev->gmc.fb_start_original = base; + adev->gmc.fb_end_original = top;return base; }
@@ -124,10 +126,10 @@ static void mmhub_v1_7_init_system_aperture_regs(struct amdgpu_device *adev)if (adev->gmc.pdb0_bo) {WREG32_SOC15 (MMHUB ,0 , regMC_VM_AGP_BOT,0xFFFFFF );WREG32_SOC15 (MMHUB ,0 , regMC_VM_AGP_TOP,0 ); -WREG32_SOC15 (MMHUB ,0 , regMC_VM_FB_LOCATION_TOP,0 ); -WREG32_SOC15 (MMHUB ,0 , regMC_VM_FB_LOCATION_BASE,0x00FFFFFF ); -WREG32_SOC15 (MMHUB ,0 , regMC_VM_SYSTEM_APERTURE_LOW_ADDR,0x3FFFFFFF ); -WREG32_SOC15 (MMHUB ,0 , regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,0 ); +WREG32_SOC15 (MMHUB ,0 , regMC_VM_FB_LOCATION_TOP, adev->gmc.fb_end_original >>24 ); +WREG32_SOC15 (MMHUB ,0 , regMC_VM_FB_LOCATION_BASE, adev->gmc.fb_start_original >>24 ); +WREG32_SOC15 (MMHUB ,0 , regMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.fb_start_original >>18 ); +WREG32_SOC15 (MMHUB ,0 , regMC_VM_SYSTEM_APERTURE_HIGH_ADDR, adev->gmc.fb_end_original >>18 ); }if (amdgpu_sriov_vf (adev))return ;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 136/159 drm/amdgpu: enable sram initialization for aldebaran
In reply to Alex DeucherFrom: Dennis Li <[email protected]>
Aldebaran can share the same initializing shader code witn arcturus.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -4516,7 +4516,8 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)if (!ring->sched.ready)return 0 ; -if (adev->asic_type ==CHIP_ARCTURUS ) { +if (adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_ALDEBARAN ) { vgpr_init_shader_ptr = vgpr_init_compute_shader_arcturus; vgpr_init_shader_size =sizeof (vgpr_init_compute_shader_arcturus); vgpr_init_regs_ptr = vgpr_init_regs_arcturus;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 137/159 drm/amdgpu: update mmhub client ids for Aldebaran
In reply to Alex DeucherFrom: Alex Sierra <[email protected]>
update mmhub client id table for Aldebaran.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +16 -13
@@ -283,39 +283,42 @@ static const char *mmhub_client_ids_arcturus[][2] = {static const char *mmhub_client_ids_aldebaran[][2 ] = { [2 ][0 ] ="MP1" , [3 ][0 ] ="MP0" , - [15 ][0 ] ="SDMA0" , - [32 +0 ][0 ] ="UTCL2" , + [32 +1 ][0 ] ="DBGU_IO0" , + [32 +2 ][0 ] ="DBGU_IO2" , [32 +4 ][0 ] ="MPIO" , - [32 +13 ][0 ] ="OSS" , - [32 +15 ][0 ] ="SDMA1" , - [64 +15 ][0 ] ="SDMA2" , [96 +11 ][0 ] ="JPEG0" , [96 +12 ][0 ] ="VCN0" , [96 +13 ][0 ] ="VCNU0" , - [96 +15 ][0 ] ="SDMA3" , [128 +11 ][0 ] ="JPEG1" , [128 +12 ][0 ] ="VCN1" , [128 +13 ][0 ] ="VCNU1" , - [128 +15 ][0 ] ="SDMA4" , + [160 +1 ][0 ] ="XDP" , [160 +14 ][0 ] ="HDP" , + [256 +0 ][0 ] ="SDMA0" , + [256 +1 ][0 ] ="SDMA1" , + [256 +2 ][0 ] ="SDMA2" , + [256 +3 ][0 ] ="SDMA3" , + [256 +4 ][0 ] ="SDMA4" , + [384 +0 ][0 ] ="OSS" , [2 ][1 ] ="MP1" , [3 ][1 ] ="MP0" , - [15 ][1 ] ="SDMA0" , [32 +1 ][1 ] ="DBGU_IO0" , [32 +2 ][1 ] ="DBGU_IO2" , [32 +4 ][1 ] ="MPIO" , - [32 +13 ][1 ] ="OSS" , - [32 +15 ][1 ] ="SDMA1" , - [64 +15 ][1 ] ="SDMA2" , [96 +11 ][1 ] ="JPEG0" , [96 +12 ][1 ] ="VCN0" , [96 +13 ][1 ] ="VCNU0" , - [96 +15 ][1 ] ="SDMA3" , [128 +11 ][1 ] ="JPEG1" , [128 +12 ][1 ] ="VCN1" , [128 +13 ][1 ] ="VCNU1" , - [128 +15 ][1 ] ="SDMA4" , + [160 +1 ][1 ] ="XDP" , [160 +14 ][1 ] ="HDP" , + [256 +0 ][1 ] ="SDMA0" , + [256 +1 ][1 ] ="SDMA1" , + [256 +2 ][1 ] ="SDMA2" , + [256 +3 ][1 ] ="SDMA3" , + [256 +4 ][1 ] ="SDMA4" , + [384 +0 ][1 ] ="OSS" , }; static const struct soc15_reg_golden golden_settings_mmhub_1_0_0[] =
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 138/159 amdgpu: Fix GART page table s-bit
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
For the new 2-level GART table, the last PDE0 points to PTB. Since PTB is in vram and right now we are runing under s=0 mode (vram is treated as FB carveout), so the s bit of this PDE0 should be set to 0.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 -1
@@ -650,7 +650,7 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev)* PTB who has more than 512 entries each * pointing to a 4K system page */ - flags =AMDGPU_PTE_VALID |AMDGPU_PTE_SYSTEM ; + flags =AMDGPU_PTE_VALID ; flags |=AMDGPU_PDE_BFS (0 ) |AMDGPU_PTE_SNOOPED ;/* Requires gart_ptb_gpu_pa to be 4K aligned */ amdgpu_gmc_set_pte_pde (adev, adev->gmc.ptr_pdb0, i, gart_ptb_gpu_pa, flags);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 139/159 drm/amdgpu: Fix the comment in amdgpu_gmc.h
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
More accurate words are used to address a
code review feedback
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +3 -3
@@ -190,13 +190,13 @@ struct amdgpu_gmc {u64 gart_end;/* Frame buffer aperture of this GPU device. Different from * fb_start (see below), this only covers the local GPU device. -* If use FB aperture to access FB, driver get fb_start from +* If driver uses FB aperture to access FB, driver get fb_start from * MC_VM_FB_LOCATION_BASE (set by vbios) and calculate vram_start * of this local device by adding an offset inside the XGMI hive. -* If use GART table for VMID0 FB access, driver finds a hole in +* If driver uses GART table for VMID0 FB access, driver finds a hole in * VMID0's virtual address space to place the SYSVM aperture inside * which the first part is vram and the second part is gart (covering -* sram) +* system ram). */ u64 vram_start;u64 vram_end;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 140/159 drm/amdgpu: use pd addr based on gart level page table
In reply to Alex DeucherFrom: Alex Sierra <[email protected]>
With a recent gart page table re-construction, the gart page table is now 2-level for some ASICs: PDB0->PTB.
In the case of 2-level gart page table, the page_table_base of vmid0 should point to PDB0 instead of PTB.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -1
@@ -2122,7 +2122,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,return r;if (vm_needs_flush) { - job->vm_pd_addr =amdgpu_gmc_pd_addr (adev->gart.bo); + job->vm_pd_addr =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo ? + adev->gmc.pdb0_bo : adev->gart.bo); job->vm_needs_flush = true; }if (resv) {
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 141/159 drm/amd/pm: remove aldebaran serial number support
In reply to Alex DeucherFrom: Kevin Wang <[email protected]>
the following message is not supported.
PPSMC_MSG_ReadSerialNumTop32PPSMC_MSG_ReadSerialNumBottom32
--- .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 19 ------------------- 1 file changed, 19 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -19
@@ -1183,24 +1183,6 @@ static bool aldebaran_is_dpm_running(struct smu_context *smu)return !!(feature_enabled &SMC_DPM_FEATURE ); } -static void aldebaran_get_unique_id (struct smu_context *smu) -{ -struct amdgpu_device *adev = smu->adev; -uint32_t top32 =0 , bottom32 =0 ; -uint64_t id; - -/* Get the SN to turn into a Unique ID */ -smu_cmn_send_smc_msg (smu, SMU_MSG_ReadSerialNumTop32, &top32); -smu_cmn_send_smc_msg (smu, SMU_MSG_ReadSerialNumBottom32, &bottom32); - - id = ((uint64_t )bottom32 <<32 ) | top32; - adev->unique_id = id; -/* For aldebaran-and-later, unique_id == serial_number, so convert it to a -* 16-digit HEX string for convenience and backwards-compatibility -*/ -sprintf (adev->serial,"%llx" , id); -} -static bool aldebaran_is_baco_supported (struct smu_context *smu) {/* aldebaran is not support baco */
@@ -1373,7 +1355,6 @@ static const struct pptable_funcs aldebaran_ppt_funcs = { .set_performance_level = aldebaran_set_performance_level, .get_power_limit = aldebaran_get_power_limit, .is_dpm_running = aldebaran_is_dpm_running, - .get_unique_id = aldebaran_get_unique_id, .init_microcode = smu_v13_0_init_microcode, .load_microcode = smu_v13_0_load_microcode, .fini_microcode = smu_v13_0_fini_microcode,
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 142/159 drm/amd/pm: Enable user min/max gfxclk on aldebaran
In reply to Alex DeucherFrom: Lijo Lazar <[email protected]>
Aldebaran has fine grained DPM for GFXCLK. Instead of a discrete level, user can specify a min/max range of GFXCLK for any profiling/tuning purpose.This option is available only in manual performance level mode. Select "manual" as power_dpm_force_performance_level and specify the min/max range using pp_dpm_sclk sysfs node. User cannot specify a min/max range outside of the default min/max range of the ASIC. If specified outside the range, values will be bound by the default min/max range.
Ex: To use gfxclk min = 600MHz and max = 900MHz
echo manual > /sys/bus/pci/devices/.../power_dpm_force_performance_level echo min 600 max 900 > /sys/bus/pci/devices/.../pp_dpm_sclk
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +8 -1
@@ -1143,9 +1143,16 @@ static int aldebaran_set_soft_freq_limited_range(struct smu_context *smu,if (clk_type !=SMU_GFXCLK && clk_type !=SMU_SCLK )return -EINVAL ; -if (smu_dpm->dpm_level !=AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ) +if ((smu_dpm->dpm_level !=AMD_DPM_FORCED_LEVEL_MANUAL ) + && (smu_dpm->dpm_level !=AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ))return -EINVAL ; +if (smu_dpm->dpm_level ==AMD_DPM_FORCED_LEVEL_MANUAL ) { + min_clk =max (min, dpm_context->dpm_tables.gfx_table.min); + max_clk =min (max, dpm_context->dpm_tables.gfx_table.max); +return smu_v13_0_set_soft_freq_limited_range (smu,SMU_GFXCLK , min_clk, max_clk); + } +if (smu_dpm->dpm_level ==AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ) {if (!max || (max < dpm_context->dpm_tables.gfx_table.min) || (max > dpm_context->dpm_tables.gfx_table.max)) {
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 143/159 drm/amdgpu: allow use psp to load firmware (v2)
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Match existing asics.
v2: rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -2
@@ -402,12 +402,11 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)case CHIP_NAVY_FLOUNDER :case CHIP_VANGOGH :case CHIP_DIMGREY_CAVEFISH : +case CHIP_ALDEBARAN :if (!load_type)return AMDGPU_FW_LOAD_DIRECT ;else return AMDGPU_FW_LOAD_PSP ; -case CHIP_ALDEBARAN : -return AMDGPU_FW_LOAD_DIRECT ;default :DRM_ERROR ("Unknown firmware load type\n" ); }
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 144/159 drm/amdkfd: Add kernel parameter to stop queue eviction on vm fault
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
This is to keep wavefront context for debug purpose
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +++++++ drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c | 5 +++-- drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c | 5 +++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +7 -0
@@ -748,6 +748,13 @@ bool no_system_mem_limit;module_param (no_system_mem_limit, bool,0644 );MODULE_PARM_DESC (no_system_mem_limit,"disable system memory limit (false = default)" ); +/** +* DOC: no_queue_eviction_on_vm_fault (int) +* If set, process queues will not be evicted on gpuvm fault. This is to keep the wavefront context for debugging (0 = queue eviction, 1 = no queue eviction). The default is 0 (queue eviction). +*/ +int amdgpu_no_queue_eviction_on_vm_fault =0 ; +MODULE_PARM_DESC (no_queue_eviction_on_vm_fault,"No queue eviction on VM fault (0 = queue eviction, 1 = no queue eviction)" ); +module_param_named (no_queue_eviction_on_vm_fault, amdgpu_no_queue_eviction_on_vm_fault, int,0444 );#endif /**
drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c +3 -2
@@ -80,8 +80,9 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev, ihre->source_id ==CIK_INTSRC_SDMA_TRAP || ihre->source_id ==CIK_INTSRC_SQ_INTERRUPT_MSG || ihre->source_id ==CIK_INTSRC_CP_BAD_OPCODE || - ihre->source_id ==CIK_INTSRC_GFX_PAGE_INV_FAULT || - ihre->source_id ==CIK_INTSRC_GFX_MEM_PROT_FAULT ; + ((ihre->source_id ==CIK_INTSRC_GFX_PAGE_INV_FAULT || + ihre->source_id ==CIK_INTSRC_GFX_MEM_PROT_FAULT ) && + !amdgpu_no_queue_eviction_on_vm_fault); } static void cik_event_interrupt_wq(struct kfd_dev *dev,
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +3 -2
@@ -98,9 +98,10 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev, source_id ==SOC15_INTSRC_SDMA_TRAP || source_id ==SOC15_INTSRC_SQ_INTERRUPT_MSG || source_id ==SOC15_INTSRC_CP_BAD_OPCODE || - client_id ==SOC15_IH_CLIENTID_VMC || + ((client_id ==SOC15_IH_CLIENTID_VMC || client_id ==SOC15_IH_CLIENTID_VMC1 || - client_id ==SOC15_IH_CLIENTID_UTCL2 ; + client_id ==SOC15_IH_CLIENTID_UTCL2 ) && + !amdgpu_no_queue_eviction_on_vm_fault); } static void event_interrupt_wq_v9(struct kfd_dev *dev,
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +5 -0
@@ -169,6 +169,11 @@ extern bool hws_gws_support;/* Queue preemption timeout in ms */ extern int queue_preemption_timeout_ms; +/* +* Don't evict process queues on vm fault +*/ +extern int amdgpu_no_queue_eviction_on_vm_fault; +/* Enable eviction debug messages */ extern bool debug_evictions;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 145/159 drm/amdkfd: Check HIQ's MQD for queue preemption status
In reply to Alex DeucherFrom: Oak Zeng <[email protected]>
MEC firmware can silently fail the queue preemption request without time out. In this case, HIQ's MQD's queue_doorbell_id will be set. Check this field to see whether last queue preemption was successful or not.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 17 ++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h | 1 + .../gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 8 +++++ .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 8 +++++ .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 8 +++++ .../gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c | 8 +++++ drivers/gpu/drm/amd/include/vi_structs.h | 32 +++++++++---------- 7 files changed, 66 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +17 -0
@@ -1393,6 +1393,7 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, uint32_t filter_param) {int retval =0 ; +struct mqd_manager *mqd_mgr;if (!dqm->sched_running)return 0 ;
@@ -1424,6 +1425,22 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm,return retval; } +/* In the current MEC firmware implementation, if compute queue +* doesn't response to the preemption request in time, HIQ will +* abandon the unmap request without returning any timeout error +* to driver. Instead, MEC firmware will log the doorbell of the +* unresponding compute queue to HIQ.MQD.queue_doorbell_id fields. +* To make sure the queue unmap was successful, driver need to +* check those fields +*/ + mqd_mgr = dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ ]; +if (mqd_mgr->read_doorbell_id (dqm->packets.priv_queue->queue->mqd)) { +pr_err ("HIQ MQD's queue_doorbell_id0 is not 0, Queue preemption time out\n" ); +while (halt_if_hws_hang) +schedule (); +return -ETIME ; + } +pm_release_ib (&dqm->packets); dqm->active_runlist = false;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +1 -0
@@ -101,6 +101,7 @@ struct mqd_manager {#if defined(CONFIG_DEBUG_FS )int (*debugfs_show_mqd)(struct seq_file *m,void *data);#endif +uint32_t (*read_doorbell_id)(void *mqd);struct mutex mqd_mutex;struct kfd_dev *dev;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +8 -0
@@ -226,6 +226,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,__update_mqd (mm, mqd, q,1 ); } +static uint32_t read_doorbell_id (void *mqd) +{ +struct cik_mqd *m = (struct cik_mqd *)mqd; + +return m->queue_doorbell_id0; +} +static void update_mqd_hawaii (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {
@@ -398,6 +405,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;#endif + mqd->read_doorbell_id = read_doorbell_id;break ;case KFD_MQD_TYPE_DIQ : mqd->allocate_mqd = allocate_mqd;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +8 -0
@@ -224,6 +224,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, q->is_active =QUEUE_IS_ACTIVE (*q); } +static uint32_t read_doorbell_id (void *mqd) +{ +struct v10_compute_mqd *m = (struct v10_compute_mqd *)mqd; + +return m->queue_doorbell_id0; +} + static int destroy_mqd(struct mqd_manager *mm, void *mqd, enum kfd_preempt_type type, unsigned int timeout, uint32_t pipe_id,
@@ -425,6 +432,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;#endif + mqd->read_doorbell_id = read_doorbell_id;pr_debug ("%s@%i\n" , __func__, __LINE__);break ;case KFD_MQD_TYPE_DIQ :
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +8 -0
@@ -276,6 +276,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, } +static uint32_t read_doorbell_id (void *mqd) +{ +struct v9_mqd *m = (struct v9_mqd *)mqd; + +return m->queue_doorbell_id0; +} + static int destroy_mqd(struct mqd_manager *mm, void *mqd, enum kfd_preempt_type type, unsigned int timeout, uint32_t pipe_id,
@@ -477,6 +484,7 @@ struct mqd_manager *mqd_manager_init_v9(enum KFD_MQD_TYPE type,#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;#endif + mqd->read_doorbell_id = read_doorbell_id;break ;case KFD_MQD_TYPE_DIQ : mqd->allocate_mqd = allocate_mqd;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +8 -0
@@ -243,6 +243,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,__update_mqd (mm, mqd, q,MTYPE_CC ,1 ); } +static uint32_t read_doorbell_id (void *mqd) +{ +struct vi_mqd *m = (struct vi_mqd *)mqd; + +return m->queue_doorbell_id0; +} +static void update_mqd_tonga (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {
@@ -446,6 +453,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,#if defined(CONFIG_DEBUG_FS ) mqd->debugfs_show_mqd = debugfs_show_mqd;#endif + mqd->read_doorbell_id = read_doorbell_id;break ;case KFD_MQD_TYPE_DIQ : mqd->allocate_mqd = allocate_mqd;
drivers/gpu/drm/amd/include/vi_structs.h +16 -16
@@ -397,22 +397,22 @@ struct vi_mqd {uint32_t reserved60;uint32_t reserved61;uint32_t reserved62; -uint32_t reserved63; -uint32_t reserved64; -uint32_t reserved65; -uint32_t reserved66; -uint32_t reserved67; -uint32_t reserved68; -uint32_t reserved69; -uint32_t reserved70; -uint32_t reserved71; -uint32_t reserved72; -uint32_t reserved73; -uint32_t reserved74; -uint32_t reserved75; -uint32_t reserved76; -uint32_t reserved77; -uint32_t reserved78; +uint32_t queue_doorbell_id0; +uint32_t queue_doorbell_id1; +uint32_t queue_doorbell_id2; +uint32_t queue_doorbell_id3; +uint32_t queue_doorbell_id4; +uint32_t queue_doorbell_id5; +uint32_t queue_doorbell_id6; +uint32_t queue_doorbell_id7; +uint32_t queue_doorbell_id8; +uint32_t queue_doorbell_id9; +uint32_t queue_doorbell_id10; +uint32_t queue_doorbell_id11; +uint32_t queue_doorbell_id12; +uint32_t queue_doorbell_id13; +uint32_t queue_doorbell_id14; +uint32_t queue_doorbell_id15;uint32_t reserved_t[256 ]; };
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 146/159 drm/amdkfd: add aldebaran kfd2kgd callbacks to kfd device (v2)
In reply to Alex DeucherFrom: Jonathan Kim <[email protected]>
Create dedicated Aldebaran kfd2kgd callbacks to prepare for new per-vmid register instructions for debug trap setting functions and sending host traps.
v2: rebase (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 1 + .../drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c | 47 +++++++++++++++++++ .../drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 17 ++++--- .../drm/amd/amdgpu/amdgpu_amdkfd_arcturus.h | 30 ++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 +- 5 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -0
@@ -191,6 +191,7 @@ amdgpu-y += \ amdgpu_amdkfd_gfx_v8.o \ amdgpu_amdkfd_gfx_v9.o \ amdgpu_amdkfd_arcturus.o \ + amdgpu_amdkfd_aldebaran.o \ amdgpu_amdkfd_gfx_v10.o \ amdgpu_amdkfd_gfx_v10_3.o
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +8 -9
@@ -47,7 +47,6 @@#include "amdgpu_amdkfd_gfx_v9.h" #include "gfxhub_v1_0.h" #include "mmhub_v9_4.h" -#include "mmhub_v1_7.h" #define HQD_N_REGS 56#define DUMP_REG (addr) do { \
@@ -123,7 +122,7 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,return sdma_rlc_reg_offset; } -static int kgd_hqd_sdma_load (struct kgd_dev *kgd,void *mqd, +int kgd_arcturus_hqd_sdma_load (struct kgd_dev *kgd,void *mqd,uint32_t __user *wptr,struct mm_struct *mm) {struct amdgpu_device *adev =get_amdgpu_device (kgd);
@@ -193,7 +192,7 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,return 0 ; } -static int kgd_hqd_sdma_dump (struct kgd_dev *kgd, +int kgd_arcturus_hqd_sdma_dump (struct kgd_dev *kgd,uint32_t engine_id,uint32_t queue_id,uint32_t (**dump)[2 ],uint32_t *n_regs) {
@@ -225,7 +224,7 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,return 0 ; } -static bool kgd_hqd_sdma_is_occupied (struct kgd_dev *kgd,void *mqd) +bool kgd_arcturus_hqd_sdma_is_occupied (struct kgd_dev *kgd,void *mqd) {struct amdgpu_device *adev =get_amdgpu_device (kgd);struct v9_sdma_mqd *m;
@@ -244,7 +243,7 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)return false; } -static int kgd_hqd_sdma_destroy (struct kgd_dev *kgd,void *mqd, +int kgd_arcturus_hqd_sdma_destroy (struct kgd_dev *kgd,void *mqd,unsigned int utimeout) {struct amdgpu_device *adev =get_amdgpu_device (kgd);
@@ -290,13 +289,13 @@ const struct kfd2kgd_calls arcturus_kfd2kgd = { .init_interrupts = kgd_gfx_v9_init_interrupts, .hqd_load = kgd_gfx_v9_hqd_load, .hiq_mqd_load = kgd_gfx_v9_hiq_mqd_load, - .hqd_sdma_load = kgd_hqd_sdma_load, + .hqd_sdma_load = kgd_arcturus_hqd_sdma_load, .hqd_dump = kgd_gfx_v9_hqd_dump, - .hqd_sdma_dump = kgd_hqd_sdma_dump, + .hqd_sdma_dump = kgd_arcturus_hqd_sdma_dump, .hqd_is_occupied = kgd_gfx_v9_hqd_is_occupied, - .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied, + .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied, .hqd_destroy = kgd_gfx_v9_hqd_destroy, - .hqd_sdma_destroy = kgd_hqd_sdma_destroy, + .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy, .address_watch_disable = kgd_gfx_v9_address_watch_disable, .address_watch_execute = kgd_gfx_v9_address_watch_execute, .wave_control_execute = kgd_gfx_v9_wave_control_execute,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +int kgd_arcturus_hqd_sdma_load (struct kgd_dev *kgd,void *mqd, +uint32_t __user *wptr,struct mm_struct *mm); +int kgd_arcturus_hqd_sdma_dump (struct kgd_dev *kgd, +uint32_t engine_id,uint32_t queue_id, +uint32_t (**dump)[2 ],uint32_t *n_regs); +bool kgd_arcturus_hqd_sdma_is_occupied (struct kgd_dev *kgd,void *mqd); +int kgd_arcturus_hqd_sdma_destroy (struct kgd_dev *kgd,void *mqd, +unsigned int utimeout);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -1
@@ -46,6 +46,7 @@ extern const struct kfd2kgd_calls gfx_v7_kfd2kgd;extern const struct kfd2kgd_calls gfx_v8_kfd2kgd;extern const struct kfd2kgd_calls gfx_v9_kfd2kgd;extern const struct kfd2kgd_calls arcturus_kfd2kgd; +extern const struct kfd2kgd_calls aldebaran_kfd2kgd;extern const struct kfd2kgd_calls gfx_v10_kfd2kgd;extern const struct kfd2kgd_calls gfx_v10_3_kfd2kgd;
@@ -71,7 +72,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = { [CHIP_VEGA20] = &gfx_v9_kfd2kgd, [CHIP_RENOIR] = &gfx_v9_kfd2kgd, [CHIP_ARCTURUS] = &arcturus_kfd2kgd, - [CHIP_ALDEBARAN] = &arcturus_kfd2kgd, + [CHIP_ALDEBARAN] = &aldebaran_kfd2kgd, [CHIP_NAVI10] = &gfx_v10_kfd2kgd, [CHIP_NAVI12] = &gfx_v10_kfd2kgd, [CHIP_NAVI14] = &gfx_v10_kfd2kgd,
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 147/159 drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
In reply to Alex DeucherFrom: Jonathan Kim <[email protected]>
Initialization of TRAP_DATA0/1 is still required for the debugger to detect new waves on Aldebaran. Also, per-vmid global trap enablement may be required outside of debugger scope so move to init phase.
v2: just add the gfx 9.4.2 changes (Alex)
--- drivers/gpu/drm/amd/amdgpu/Makefile | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 50 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 30 +++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c create mode 100644 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -0
@@ -123,6 +123,7 @@ amdgpu-y += \ gfx_v8_0.o \ gfx_v9_0.o \ gfx_v9_4.o \ + gfx_v9_4_2.o \ gfx_v10_0.o # add async DMA block
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
@@ -49,6 +49,7 @@#include "gfx_v9_4.h" #include "gfx_v9_0.h" +#include "gfx_v9_4_2.h" #include "asic_reg/pwr/pwr_10_0_offset.h" #include "asic_reg/pwr/pwr_10_0_sh_mask.h"
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __GFX_V9_4_2_H__ +#define __GFX_V9_4_2_H__ + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, +uint32_t first_vmid,uint32_t last_vmid); + +#endif /* __GFX_V9_4_2_H__ */
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
maintainerRe: [PATCH 147/159] drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
This patch is for the debugger functionality that's not on amd-staging-drm-next yet. You can probably drop this patch for now.
Regards,
Felix
Quoted 126 lines · Alex Deucher
From: Jonathan Kim <[email protected]>
Initialization of TRAP_DATA0/1 is still required for the debugger to detect new waves on Aldebaran. Also, per-vmid global trap enablement may be required outside of debugger scope so move to init phase.
v2: just add the gfx 9.4.2 changes (Alex)
Signed-off-by Jonathan Kim <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/Makefile | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 50 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 30 +++++++++++++++ 4 files changed, 82 insertions(+)create mode 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.ccreate mode 100644drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.hdrivers/gpu/drm/amd/amdgpu/Makefile +1
-0@@ -123,6 +123,7 @@ amdgpu-y += \ gfx_v8_0.o \ gfx_v9_0.o \ gfx_v9_4.o \ + gfx_v9_4_2.o \ gfx_v10_0.o # add async DMA blockdrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -49,6 +49,7 @@#include "gfx_v9_4.h" #include "gfx_v9_0.h" +#include "gfx_v9_4_2.h" #include "asic_reg/pwr/pwr_10_0_offset.h" #include "asic_reg/pwr/pwr_10_0_sh_mask.h" drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +50
-0@@ -0,0 +1,50 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#include "amdgpu.h" +#include "soc15.h" + +#include "gc/gc_9_4_2_offset.h" +#include "gc/gc_9_4_2_sh_mask.h" + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, +uint32_t first_vmid, +uint32_t last_vmid) +{ +uint32_t data; +int i; + +mutex_lock (&adev->srbm_mutex); + +for (i = first_vmid; i < last_vmid; i++) { + data =0 ; +soc15_grbm_select (adev,0 ,0 ,0 , i); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,TRAP_EN ,1 ); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,EXCP_EN ,0 ); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,EXCP_REPLACE , +0 ); +WREG32 (SOC15_REG_OFFSET (GC ,0 , regSPI_GDBG_PER_VMID_CNTL), data); + } + +soc15_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +}drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +20
-0@@ -0,0 +1,30 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE.
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 30
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +10
-0+* +*/ + +#ifndef __GFX_V9_4_2_H__ +#define __GFX_V9_4_2_H__ + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, +uint32_t first_vmid,uint32_t last_vmid); + +#endif /* __GFX_V9_4_2_H__ */
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainerRe: [PATCH 147/159] drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
[AMD Official Use Only - Internal Distribution Only]
I dropped the KFD debugger hunks and just added the gfx 9.4.2 changes since these were required for a bunch of later patches that build on that file that are not dependent on debugger. I can rework the commit message if you'd like.
Alex
________________________________
From: Kuehling, Felix <[email protected]>
Sent: Wednesday, February 24, 2021 10:22 PM
To: Deucher, Alexander <[email protected]>; [email protected] <[email protected]>
Cc: Kim, Jonathan <[email protected]>
Subject: Re: [PATCH 147/159] drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
This patch is for the debugger functionality that's not on amd-staging-drm-next yet. You can probably drop this patch for now.
Regards,
Felix
Quoted 126 lines · Alex Deucher
From: Jonathan Kim <[email protected]>
Initialization of TRAP_DATA0/1 is still required for the debugger to detect new waves on Aldebaran. Also, per-vmid global trap enablement may be required outside of debugger scope so move to init phase.
v2: just add the gfx 9.4.2 changes (Alex)
Signed-off-by Jonathan Kim <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/Makefile | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 50 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 30 +++++++++++++++ 4 files changed, 82 insertions(+)create mode 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.ccreate mode 100644drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.hdrivers/gpu/drm/amd/amdgpu/Makefile +1
-0@@ -123,6 +123,7 @@ amdgpu-y += \ gfx_v8_0.o \ gfx_v9_0.o \ gfx_v9_4.o \ + gfx_v9_4_2.o \ gfx_v10_0.o # add async DMA blockdrivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -49,6 +49,7 @@#include "gfx_v9_4.h" #include "gfx_v9_0.h" +#include "gfx_v9_4_2.h" #include "asic_reg/pwr/pwr_10_0_offset.h" #include "asic_reg/pwr/pwr_10_0_sh_mask.h" drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +50
-0@@ -0,0 +1,50 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#include "amdgpu.h" +#include "soc15.h" + +#include "gc/gc_9_4_2_offset.h" +#include "gc/gc_9_4_2_sh_mask.h" + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, +uint32_t first_vmid, +uint32_t last_vmid) +{ +uint32_t data; +int i; + +mutex_lock (&adev->srbm_mutex); + +for (i = first_vmid; i < last_vmid; i++) { + data =0 ; +soc15_grbm_select (adev,0 ,0 ,0 , i); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,TRAP_EN ,1 ); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,EXCP_EN ,0 ); + data =REG_SET_FIELD (data,SPI_GDBG_PER_VMID_CNTL ,EXCP_REPLACE , +0 ); +WREG32 (SOC15_REG_OFFSET (GC ,0 , regSPI_GDBG_PER_VMID_CNTL), data); + } + +soc15_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +}drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +20
-0@@ -0,0 +1,30 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE.
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 30
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +10
-0+* +*/ + +#ifndef __GFX_V9_4_2_H__ +#define __GFX_V9_4_2_H__ + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, +uint32_t first_vmid,uint32_t last_vmid); + +#endif /* __GFX_V9_4_2_H__ */
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
maintainerRe: [PATCH 147/159] drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
Am 2021-02-25 um 1:32 p.m. schrieb Deucher, Alexander:
Quoted 7 lines
[AMD Official Use Only - Internal Distribution Only]
I dropped the KFD debugger hunks and just added the gfx 9.4.2 changes since these were required for a bunch of later patches that build on that file that are not dependent on debugger.
I see.
Quoted 1 line
I can rework the commit message if you'd like.
No, that's fine. I'd prefer to keep the original message to correlate it with the remaining change on the DKMS branch.
Thanks,
Felix
Quoted 177 lines
Alex
------------------------------------------------------------------------
*From:* Kuehling, Felix <[email protected]>
*Sent:* Wednesday, February 24, 2021 10:22 PM
*To:* Deucher, Alexander <[email protected]>; [email protected] <[email protected]> *Cc:* Kim, Jonathan <[email protected]>
*Subject:* Re: [PATCH 147/159] drm/amdgpu: restore aldebaran save ttmp and trap config on init (v2)
This patch is for the debugger functionality that's not on amd-staging-drm-next yet. You can probably drop this patch for now.Regards,
FelixQuoted 3 lines · Alex Deucher
From: Jonathan Kim <[email protected]>
Initialization of TRAP_DATA0/1 is still required for the debugger to
detect
Quoted 13 lines
new waves on Aldebaran. Also, per-vmid global trap enablement may be required outside of debugger scope so move to init phase.
v2: just add the gfx 9.4.2 changes (Alex)
Signed-off-by Jonathan Kim <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Alex Deucher <[email protected]>---
drivers/gpu/drm/amd/amdgpu/Makefile | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 +drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c| 50 +++++++++++++++++++++++++drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h| 30 +++++++++++++++Review
Quoted 5 lines
4 files changed, 82 insertions(+)create mode 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.ccreate mode 100644drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h(quoted diff) +0
-0b/drivers/gpu/drm/amd/amdgpu/Makefile
Quoted 10 lines
index
c5ec926bc6d5..741b68874e53100644drivers/gpu/drm/amd/amdgpu/Makefile +1
-0@@ -123,6 +123,7 @@ amdgpu-y += \ gfx_v8_0.o \ gfx_v9_0.o \ gfx_v9_4.o \ + gfx_v9_4_2.o \gfx_v10_0.o
Review
Quoted 2 lines
# add async DMA block(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.cQuoted 11 lines
index
5bac5659e707..78bb4e28c27c100644drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -49,6 +49,7 @@
#include "gfx_v9_4.h"
#include "gfx_v9_0.h"
+#include "gfx_v9_4_2.h"
#include "asic_reg/pwr/pwr_10_0_offset.h"
#include "asic_reg/pwr/pwr_10_0_sh_mask.h"Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.cdrivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 4
Quoted 9 lines
new file mode 100644
index 000000000000..0c2ccbe327abdrivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +4
-0@@ -0,0 +1,50 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 5
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* copy of this software and associated documentation files (the "Software"),
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 6
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* to deal in the Software without restriction, including without limitation
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 7
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 8
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* and/or sell copies of the Software, and to permit persons to whom the
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +3
-0+* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +3
-0+* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 15
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 16
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 17
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 18
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 19
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +12
-0+* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#include "amdgpu.h" +#include "soc15.h" + +#include "gc/gc_9_4_2_offset.h" +#include "gc/gc_9_4_2_sh_mask.h" + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, + uint32_t first_vmid, + uint32_t last_vmid)drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +10
-0+{ + uint32_t data; + int i; + + mutex_lock(&adev->srbm_mutex); + + for (i = first_vmid; i < last_vmid; i++) { + data = 0; + soc15_grbm_select(adev, 0, 0, 0, i); + data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL,
TRAP_EN, 1);drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 42
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+ data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL,
EXCP_EN, 0);drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 43
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +1
-0+ data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL,
EXCP_REPLACE,drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c line 45
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +2
-0+ 0); + WREG32(SOC15_REG_OFFSET(GC, 0,
regSPI_GDBG_PER_VMID_CNTL), data);Review
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c new file +5
-0+ } + + soc15_grbm_select(adev, 0, 0, 0, 0); + mutex_unlock(&adev->srbm_mutex); +}(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.hdrivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 4
Quoted 9 lines
new file mode 100644
index 000000000000..5b175c10de23drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +4
-0@@ -0,0 +1,30 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 5
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* copy of this software and associated documentation files (the "Software"),
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 6
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* to deal in the Software without restriction, including without limitation
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 7
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 8
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* and/or sell copies of the Software, and to permit persons to whom the
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 11
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +3
-0+* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 14
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +3
-0+* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 15
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 16
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 17
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 18
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 19
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +1
-0+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h line 30
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h new file +11
-0+* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __GFX_V9_4_2_H__ +#define __GFX_V9_4_2_H__ + +void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev, + uint32_t first_vmid, uint32_t last_vmid); + +#endif /* __GFX_V9_4_2_H__ */
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 148/159 drm/amdgpu: apply gc v9_4_2 golden settings for aldebaran
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Those registers should be programmed as one-time initialization
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 51 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 3 +- 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -0
@@ -984,6 +984,10 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev) golden_settings_gc_9_1_rn, ARRAY_SIZE(golden_settings_gc_9_1_rn));return ;/* for renoir, don't need common goldensetting */ +case CHIP_ALDEBARAN : +gfx_v9_4_2_init_golden_registers (adev, + adev->smuio.funcs->get_die_id (adev)); +break ;default :break ; }
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +51 -0
57 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h +2 -1
@@ -26,5 +26,6 @@void gfx_v9_4_2_debug_trap_config_init (struct amdgpu_device *adev,uint32_t first_vmid,uint32_t last_vmid); - +void gfx_v9_4_2_init_golden_registers (struct amdgpu_device *adev, +uint32_t die_id);#endif /* __GFX_V9_4_2_H__ */
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 149/159 drm/amdgpu: add common gc golden settings for aldebaran
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
golden settings that should be applied
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +6 -3
@@ -37,15 +37,18 @@ static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_0[] = {static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_1[] = {SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_0,0x3fffffff ,0x2591aa38 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_1,0x3fffffff ,0xac9688B ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_2,0x3fffffff ,0x2bc3369B ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_1,0x3fffffff ,0xac9688b ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_2,0x3fffffff ,0x2bc3369b ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_3,0x3fffffff ,0xfb74ee ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_4,0x3fffffff ,0x21f0a2fe ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_5,0x3ff ,0x49 ), };static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde[] = { -SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_UTCL1_CNTL1,0x30000000 ,0x30000000 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regGB_ADDR_CONFIG,0xffff77ff ,0x2a114042 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTA_CNTL_AUX,0xfffffeef ,0x10b0000 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_UTCL1_CNTL1,0xffffffff ,0x30800400 ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCI_CNTL_3,0xff ,0x20 ), }; void gfx_v9_4_2_init_golden_registers(struct amdgpu_device *adev,
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 150/159 drm/amdgpu: update TCP_CHAN_STEER_1 golden value for aldebaran
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
The golden setting was changed recently. update to the latest one
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +1 -1
@@ -37,7 +37,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_0[] = {static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_1[] = {SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_0,0x3fffffff ,0x2591aa38 ), -SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_1,0x3fffffff ,0xac9688b ), +SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_1,0x3fffffff ,0xac9e88b ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_2,0x3fffffff ,0x2bc3369b ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_3,0x3fffffff ,0xfb74ee ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_4,0x3fffffff ,0x21f0a2fe ),
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 151/159 drm/amdgpu: add gc powerbrake support (v2)
In reply to Alex DeucherFrom: Kevin Wang <[email protected]>
add GC power brake feature support for Aldebaran.
v2: squash in fixes (Alex)
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 26 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 1 + 3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
@@ -3948,6 +3948,9 @@ static int gfx_v9_0_hw_init(void *handle)if (r)return r; +if (adev->asic_type ==CHIP_ALDEBARAN ) +gfx_v9_4_2_set_power_brake_sequence (adev); +return r; }
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +26 -0
@@ -25,6 +25,7 @@#include "gc/gc_9_4_2_offset.h" #include "gc/gc_9_4_2_sh_mask.h" +#include "gfx_v9_0.h" static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_0[] = {SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_0,0x3fffffff ,0x141dc920 ),
@@ -102,3 +103,28 @@ void gfx_v9_4_2_debug_trap_config_init(struct amdgpu_device *adev,soc15_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex); } + +void gfx_v9_4_2_set_power_brake_sequence (struct amdgpu_device *adev) +{ +u32 tmp; + +gfx_v9_0_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff ); + + tmp =0 ; + tmp =REG_SET_FIELD (tmp,GC_THROTTLE_CTRL ,PATTERN_MODE ,1 ); +WREG32_SOC15 (GC ,0 , regGC_THROTTLE_CTRL, tmp); + + tmp =0 ; + tmp =REG_SET_FIELD (tmp,GC_THROTTLE_CTRL1 ,PWRBRK_STALL_EN ,1 ); +WREG32_SOC15 (GC ,0 , regGC_THROTTLE_CTRL1, tmp); + +WREG32_SOC15 (GC ,0 , regDIDT_IND_INDEX, ixDIDT_SQ_THROTTLE_CTRL); + tmp =0 ; + tmp =REG_SET_FIELD (tmp,DIDT_SQ_THROTTLE_CTRL ,PWRBRK_STALL_EN ,1 ); +WREG32_SOC15 (GC ,0 , regDIDT_IND_DATA, tmp); + +WREG32_SOC15 (GC ,0 , regGC_CAC_IND_INDEX, ixPWRBRK_STALL_PATTERN_CTRL); + tmp =0 ; + tmp =REG_SET_FIELD (tmp,PWRBRK_STALL_PATTERN_CTRL ,PWRBRK_END_STEP ,0x12 ); +WREG32_SOC15 (GC ,0 , regGC_CAC_IND_DATA, tmp); +}
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h +1 -0
@@ -28,4 +28,5 @@ void gfx_v9_4_2_debug_trap_config_init(struct amdgpu_device *adev, uint32_t first_vmid, uint32_t last_vmid);void gfx_v9_4_2_init_golden_registers (struct amdgpu_device *adev,uint32_t die_id); +void gfx_v9_4_2_set_power_brake_sequence (struct amdgpu_device *adev);#endif /* __GFX_V9_4_2_H__ */
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 152/159 drm/amdgpu: add ras support for gfx of aldebaran
In reply to Alex DeucherFrom: Dennis Li <[email protected]>
add edc counter/status reset and query functions for gfx block of aldebaran.
v2: change to clear edc counter explicitly
aldebaran hardware will not clear edc counter after driver reading them, so driver should clear them explicitly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 14 + drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 1078 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 6 + drivers/gpu/drm/amd/amdgpu/soc15.h | 11 + drivers/gpu/drm/amd/amdgpu/soc15_common.h | 18 + 6 files changed, 1128 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -0
@@ -30,6 +30,7 @@#include "clearstate_defs.h" #include "amdgpu_ring.h" #include "amdgpu_rlc.h" +#include "soc15.h" /* GFX current status */ #define AMDGPU_GFX_NORMAL_MODE 0x00000000L
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +14 -0
@@ -2110,6 +2110,19 @@ static const struct amdgpu_gfx_funcs gfx_v9_4_gfx_funcs = { .query_ras_error_status = &gfx_v9_4_query_ras_error_status, }; +static const struct amdgpu_gfx_funcs gfx_v9_4_2_gfx_funcs = { + .get_gpu_clock_counter = &gfx_v9_0_get_gpu_clock_counter, + .select_se_sh = &gfx_v9_0_select_se_sh, + .read_wave_data = &gfx_v9_0_read_wave_data, + .read_wave_sgprs = &gfx_v9_0_read_wave_sgprs, + .read_wave_vgprs = &gfx_v9_0_read_wave_vgprs, + .select_me_pipe_q = &gfx_v9_0_select_me_pipe_q, + .ras_error_inject = &gfx_v9_4_2_ras_error_inject, + .query_ras_error_count = &gfx_v9_4_2_query_ras_error_count, + .reset_ras_error_count = &gfx_v9_4_2_reset_ras_error_count, + .query_ras_error_status = &gfx_v9_4_2_query_ras_error_status, +}; +static int gfx_v9_0_gpu_early_init (struct amdgpu_device *adev) {u32 gb_addr_config;
@@ -2182,6 +2195,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) gb_addr_config |=0x22010042 ;break ;case CHIP_ALDEBARAN : + adev->gfx.funcs = &gfx_v9_4_2_gfx_funcs; adev->gfx.config.max_hw_contexts =8 ; adev->gfx.config.sc_prim_fifo_size_frontend =0x20 ; adev->gfx.config.sc_prim_fifo_size_backend =0x100 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +1078 -0
1,087 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h +6 -0
@@ -29,4 +29,10 @@ void gfx_v9_4_2_debug_trap_config_init(struct amdgpu_device *adev,void gfx_v9_4_2_init_golden_registers (struct amdgpu_device *adev,uint32_t die_id);void gfx_v9_4_2_set_power_brake_sequence (struct amdgpu_device *adev); + +void gfx_v9_4_2_reset_ras_error_count (struct amdgpu_device *adev); +int gfx_v9_4_2_ras_error_inject (struct amdgpu_device *adev,void *inject_if); +void gfx_v9_4_2_query_ras_error_status (struct amdgpu_device *adev); +int gfx_v9_4_2_query_ras_error_count (struct amdgpu_device *adev, +void *ras_error_status);#endif /* __GFX_V9_4_2_H__ */
drivers/gpu/drm/amd/amdgpu/soc15.h +11 -0
@@ -49,6 +49,13 @@ struct soc15_reg_rlcg {u32 reg; }; +struct soc15_reg { +uint32_t hwip; +uint32_t inst; +uint32_t seg; +uint32_t reg_offset; +}; +struct soc15_reg_entry {uint32_t hwip;uint32_t inst;
@@ -88,6 +95,10 @@ struct soc15_ras_field_entry {#define SOC15_REG_FIELD (reg, field) reg##__##field##_MASK, reg##__##field##__SHIFT +#define SOC15_REG_FIELD_VAL (val, mask, shift) (((val) & mask) >> shift) + +#define SOC15_RAS_REG_FIELD_VAL (val, entry, field) SOC15_REG_FIELD_VAL(val, entry.field##_count_mask, entry.field##_count_shift) +void soc15_grbm_select (struct amdgpu_device *adev,u32 me,u32 pipe,u32 queue,u32 vmid);void soc15_set_virt_ops (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/soc15_common.h +18 -0
@@ -118,6 +118,24 @@ } \ } while (0) +#define WREG32_SOC15_RLC_SHADOW_EX (prefix, ip, inst, reg, value) \ + do { \ + uint32_t target_reg = adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg;\ + if (amdgpu_sriov_fullaccess(adev)) { \ + uint32_t r2 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG2; \ + uint32_t r3 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG3; \ + uint32_t grbm_cntl = adev->reg_offset[GC_HWIP][0][prefix##GRBM_GFX_CNTL_BASE_IDX] + prefix##GRBM_GFX_CNTL; \ + uint32_t grbm_idx = adev->reg_offset[GC_HWIP][0][prefix##GRBM_GFX_INDEX_BASE_IDX] + prefix##GRBM_GFX_INDEX; \ + if (target_reg == grbm_cntl) \ + WREG32(r2, value); \ + else if (target_reg == grbm_idx) \ + WREG32(r3, value); \ + WREG32(target_reg, value); \ + } else { \ + WREG32(target_reg, value); \ + } \ + } while (0) +#define WREG32_SOC15_RLC (ip, inst, reg, value) \ do { \ uint32_t target_reg = adev->reg_offset[GC_HWIP][0][reg##_BASE_IDX] + reg;\
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 153/159 drm/amdgpu: refine ras codes for GC utc of aldebaran
In reply to Alex DeucherFrom: Dennis Li <[email protected]>
The bank number of both VML2 and ATCL2 are changed to 8, so refine related codes to avoid defining long name arrays.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 269 +++++++++--------------- drivers/gpu/drm/amd/amdgpu/soc15.h | 2 +- 2 files changed, 97 insertions(+), 174 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +96 -173
@@ -40,8 +40,11 @@ enum gfx_v9_4_2_utc_type {ATC_L2_CACHE_4K }; -struct gfx_v9_4_2_utc_reg { +struct gfx_v9_4_2_utc_block {enum gfx_v9_4_2_utc_type type; +uint32_t num_banks; +uint32_t num_ways; +uint32_t num_mem_blocks;struct soc15_reg idx_reg;struct soc15_reg data_reg;uint32_t sec_count_mask;
@@ -51,12 +54,6 @@ struct gfx_v9_4_2_utc_reg {uint32_t clear; }; -struct gfx_v9_4_2_utc_info_map { -enum gfx_v9_4_2_utc_type type; -const char *name; -uint32_t index; -}; -static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_0[] = {SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_0,0x3fffffff ,0x141dc920 ),SOC15_REG_GOLDEN_VALUE (GC ,0 , regTCP_CHAN_STEER_1,0x3fffffff ,0x3b458b93 ),
@@ -756,38 +753,51 @@ static const struct soc15_ras_field_entry gfx_v9_4_2_ras_fields[] = { SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_AFMEM_DED_COUNT) }, }; -static struct gfx_v9_4_2_utc_reg gfx_v9_4_2_utc_regs[] = { - {VML2_MEM , +static const char *const vml2_walker_mems[] = { +"UTC_VML2_CACHE_PDE0_MEM0" , +"UTC_VML2_CACHE_PDE0_MEM1" , +"UTC_VML2_CACHE_PDE1_MEM0" , +"UTC_VML2_CACHE_PDE1_MEM1" , +"UTC_VML2_CACHE_PDE2_MEM0" , +"UTC_VML2_CACHE_PDE2_MEM1" , +"UTC_VML2_RDIF_ARADDRS" , +"UTC_VML2_RDIF_LOG_FIFO" , +"UTC_VML2_QUEUE_REQ" , +"UTC_VML2_QUEUE_RET" , +}; + +static struct gfx_v9_4_2_utc_block gfx_v9_4_2_utc_blocks[] = { + {VML2_MEM ,8 ,2 ,2 , {SOC15_REG_ENTRY (GC ,0 , regVML2_MEM_ECC_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regVML2_MEM_ECC_CNTL) },SOC15_REG_FIELD (VML2_MEM_ECC_CNTL ,SEC_COUNT ),SOC15_REG_FIELD (VML2_MEM_ECC_CNTL ,DED_COUNT ),REG_SET_FIELD (0 ,VML2_MEM_ECC_CNTL ,WRITE_COUNTERS ,1 ) }, - {VML2_WALKER_MEM , + {VML2_WALKER_MEM ,ARRAY_SIZE (vml2_walker_mems),1 ,1 , {SOC15_REG_ENTRY (GC ,0 , regVML2_WALKER_MEM_ECC_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regVML2_WALKER_MEM_ECC_CNTL) },SOC15_REG_FIELD (VML2_WALKER_MEM_ECC_CNTL ,SEC_COUNT ),SOC15_REG_FIELD (VML2_WALKER_MEM_ECC_CNTL ,DED_COUNT ),REG_SET_FIELD (0 ,VML2_WALKER_MEM_ECC_CNTL ,WRITE_COUNTERS ,1 ) }, - {UTCL2_MEM , + {UTCL2_MEM ,18 ,1 ,2 , {SOC15_REG_ENTRY (GC ,0 , regUTCL2_MEM_ECC_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regUTCL2_MEM_ECC_CNTL) },SOC15_REG_FIELD (UTCL2_MEM_ECC_CNTL ,SEC_COUNT ),SOC15_REG_FIELD (UTCL2_MEM_ECC_CNTL ,DED_COUNT ),REG_SET_FIELD (0 ,UTCL2_MEM_ECC_CNTL ,WRITE_COUNTERS ,1 ) }, - {ATC_L2_CACHE_2M , + {ATC_L2_CACHE_2M ,8 ,2 ,1 , {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_2M_DSM_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_2M_DSM_CNTL) },SOC15_REG_FIELD (ATC_L2_CACHE_2M_DSM_CNTL ,SEC_COUNT ),SOC15_REG_FIELD (ATC_L2_CACHE_2M_DSM_CNTL ,DED_COUNT ),REG_SET_FIELD (0 ,ATC_L2_CACHE_2M_DSM_CNTL ,WRITE_COUNTERS ,1 ) }, - {ATC_L2_CACHE_32K , + {ATC_L2_CACHE_32K ,8 ,2 ,2 , {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_32K_DSM_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_32K_DSM_CNTL) },SOC15_REG_FIELD (ATC_L2_CACHE_32K_DSM_CNTL ,SEC_COUNT ),SOC15_REG_FIELD (ATC_L2_CACHE_32K_DSM_CNTL ,DED_COUNT ),REG_SET_FIELD (0 ,ATC_L2_CACHE_32K_DSM_CNTL ,WRITE_COUNTERS ,1 ) }, - {ATC_L2_CACHE_4K , + {ATC_L2_CACHE_4K ,8 ,2 ,8 , {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_4K_DSM_INDEX) }, {SOC15_REG_ENTRY (GC ,0 , regATC_L2_CACHE_4K_DSM_CNTL) },SOC15_REG_FIELD (ATC_L2_CACHE_4K_DSM_CNTL ,SEC_COUNT ),
@@ -795,132 +805,6 @@ static struct gfx_v9_4_2_utc_reg gfx_v9_4_2_utc_regs[] = { REG_SET_FIELD(0, ATC_L2_CACHE_4K_DSM_CNTL, WRITE_COUNTERS, 1) }, }; -static const struct gfx_v9_4_2_utc_info_map gfx_v9_4_2_utc_map[] = { -/* GPU VM */ - {VML2_MEM ,"UTC_VML2_BANK_CACHE_0_BIGK_MEM0" ,0 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_0_BIGK_MEM1" ,1 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_0_4K_MEM0" ,2 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_0_4K_MEM1" ,3 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_1_BIGK_MEM0" ,4 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_1_BIGK_MEM1" ,5 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_1_4K_MEM0" ,6 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_1_4K_MEM1" ,7 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_2_BIGK_MEM0" ,8 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_2_BIGK_MEM1" ,9 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_2_4K_MEM0" ,10 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_2_4K_MEM1" ,11 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_3_BIGK_MEM0" ,12 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_3_BIGK_MEM1" ,13 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_3_4K_MEM0" ,14 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_3_4K_MEM1" ,15 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_4_BIGK_MEM0" ,16 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_4_BIGK_MEM1" ,17 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_4_4K_MEM0" ,18 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_4_4K_MEM1" ,19 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_5_BIGK_MEM0" ,20 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_5_BIGK_MEM1" ,21 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_5_4K_MEM0" ,22 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_5_4K_MEM1" ,23 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_6_BIGK_MEM0" ,24 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_6_BIGK_MEM1" ,25 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_6_4K_MEM0" ,26 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_6_4K_MEM1" ,27 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_7_BIGK_MEM0" ,28 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_7_BIGK_MEM1" ,29 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_7_4K_MEM0" ,30 }, - {VML2_MEM ,"UTC_VML2_BANK_CACHE_7_4K_MEM1" ,31 }, - -/* WALER */ - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE0_MEM0" ,0 }, - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE0_MEM1" ,1 }, - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE1_MEM0" ,2 }, - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE1_MEM1" ,3 }, - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE2_MEM0" ,4 }, - {VML2_WALKER_MEM ,"UTC_VML2_CACHE_PDE2_MEM1" ,5 }, - {VML2_WALKER_MEM ,"UTC_VML2_RDIF_ARADDRS" ,6 }, - {VML2_WALKER_MEM ,"UTC_VML2_RDIF_LOG_FIFO" ,7 }, - {VML2_WALKER_MEM ,"UTC_VML2_QUEUE_REQ" ,8 }, - {VML2_WALKER_MEM ,"UTC_VML2_QUEUE_RET" ,9 }, - -/* SRAM_BLOCK_ROUTER */ - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP0_VMC" ,0 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP0_APT" ,1 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP1_VMC" ,2 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP1_APT" ,3 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP2_VMC" ,4 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP2_APT" ,5 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP3_VMC" ,6 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP3_APT" ,7 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP4_VMC" ,8 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP4_APT" ,9 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP5_VMC" ,10 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP5_APT" ,11 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP6_VMC" ,12 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP6_APT" ,13 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP7_VMC" ,14 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP7_APT" ,15 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP8_VMC" ,16 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP8_APT" ,17 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP9_VMC" ,18 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP9_APT" ,19 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP10_VMC" ,20 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP10_APT" ,21 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP11_VMC" ,22 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP11_APT" ,23 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP12_VMC" ,24 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP12_APT" ,25 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP13_VMC" ,26 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP13_APT" ,27 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP14_VMC" ,28 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP14_APT" ,29 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP15_VMC" ,30 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP15_APT" ,31 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP16_VMC" ,32 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP16_APT" ,33 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP17_VMC" ,34 }, - {UTCL2_MEM ,"UTCL2_ROUTER_IFIFO_GROUP17_APT" ,35 }, - -/* ATCL2-2m */ - {ATC_L2_CACHE_2M ,"UTC_ATCL2_CACHE_2M_BANK0_WAY0_MEM" ,0 }, - {ATC_L2_CACHE_2M ,"UTC_ATCL2_CACHE_2M_BANK0_WAY1_MEM" ,1 }, - {ATC_L2_CACHE_2M ,"UTC_ATCL2_CACHE_2M_BANK1_WAY0_MEM" ,2 }, - {ATC_L2_CACHE_2M ,"UTC_ATCL2_CACHE_2M_BANK1_WAY1_MEM" ,3 }, - -/* ATCL2-4k */ - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM0" ,0 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM1" ,1 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM2" ,2 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM3" ,3 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM4" ,4 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM5" ,5 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM6" ,6 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY0_MEM7" ,7 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM0" ,8 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM1" ,9 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM2" ,10 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM3" ,11 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM4" ,12 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM5" ,13 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM6" ,14 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK0_WAY1_MEM7" ,15 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM0" ,16 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM1" ,17 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM2" ,18 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM3" ,19 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM4" ,20 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM5" ,21 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM6" ,22 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY0_MEM7" ,23 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM0" ,24 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM1" ,25 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM2" ,26 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM3" ,27 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM4" ,28 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM5" ,29 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM6" ,30 }, - {ATC_L2_CACHE_4K ,"UTC_ATCL2_CACHE_4K_BANK1_WAY1_MEM7" ,31 }, -}; -static const struct soc15_reg_entry gfx_v9_4_2_rdrsp_status_regs = {SOC15_REG_ENTRY (GC ,0 , regGCEA_ERR_STATUS),0 ,1 ,16 };
@@ -1017,62 +901,101 @@ static int gfx_v9_4_2_query_sram_edc_count(struct amdgpu_device *adev,return 0 ; } +static void gfx_v9_4_2_log_utc_edc_count (struct amdgpu_device *adev, +struct gfx_v9_4_2_utc_block *blk, +uint32_t instance,uint32_t sec_cnt, +uint32_t ded_cnt) +{ +uint32_t bank, way, mem; +static const char *vml2_way_str[] = {"BIGK" ,"4K" }; +static const char *utcl2_rounter_str[] = {"VMC" ,"APT" }; + + mem = instance % blk->num_mem_blocks; + way = (instance / blk->num_mem_blocks) % blk->num_ways; + bank = instance / (blk->num_mem_blocks * blk->num_ways); + +switch (blk->type) { +case VML2_MEM : +dev_info ( + adev->dev, +"GFX SubBlock UTC_VML2_BANK_CACHE_%d_%s_MEM%d, SED %d, DED %d\n" , + bank, vml2_way_str[way], mem, sec_cnt, ded_cnt); +break ; +case VML2_WALKER_MEM : +dev_info (adev->dev,"GFX SubBlock %s, SED %d, DED %d\n" , + vml2_walker_mems[bank], sec_cnt, ded_cnt); +break ; +case UTCL2_MEM : +dev_info ( + adev->dev, +"GFX SubBlock UTCL2_ROUTER_IFIF%d_GROUP0_%s, SED %d, DED %d\n" , + bank, utcl2_rounter_str[mem], sec_cnt, ded_cnt); +break ; +case ATC_L2_CACHE_2M : +dev_info ( + adev->dev, +"GFX SubBlock UTC_ATCL2_CACHE_2M_BANK%d_WAY%d_MEM, SED %d, DED %d\n" , + bank, way, sec_cnt, ded_cnt); +break ; +case ATC_L2_CACHE_32K : +dev_info ( + adev->dev, +"GFX SubBlock UTC_ATCL2_CACHE_32K_BANK%d_WAY%d_MEM%d, SED %d, DED %d\n" , + bank, way, mem, sec_cnt, ded_cnt); +break ; +case ATC_L2_CACHE_4K : +dev_info ( + adev->dev, +"GFX SubBlock UTC_ATCL2_CACHE_4K_BANK%d_WAY%d_MEM%d, SED %d, DED %d\n" , + bank, way, mem, sec_cnt, ded_cnt); +break ; + } +} +static int gfx_v9_4_2_query_utc_edc_count (struct amdgpu_device *adev,uint32_t *sec_count,uint32_t *ded_count) {uint32_t i, j, data;uint32_t sec_cnt, ded_cnt; +uint32_t num_instances; +struct gfx_v9_4_2_utc_block *blk;if (sec_count && ded_count) { *sec_count =0 ; *ded_count =0 ; } -for (i =0 ; i <ARRAY_SIZE (gfx_v9_4_2_utc_regs); i++) { -for (j =0 ; j <ARRAY_SIZE (gfx_v9_4_2_utc_map); j++) { -if (gfx_v9_4_2_utc_regs[i].type != - gfx_v9_4_2_utc_map[j].type) -continue ; - -WREG32 (SOC15_REG_ENTRY_OFFSET ( - gfx_v9_4_2_utc_regs[i].idx_reg), - gfx_v9_4_2_utc_map[j].index); +for (i =0 ; i <ARRAY_SIZE (gfx_v9_4_2_utc_blocks); i++) { + blk = &gfx_v9_4_2_utc_blocks[i]; + num_instances = + blk->num_banks * blk->num_ways * blk->num_mem_blocks; +for (j =0 ; j < num_instances; j++) { +WREG32 (SOC15_REG_ENTRY_OFFSET (blk->idx_reg), j);/* if sec/ded_count is NULL, just clear counter */ if (!sec_count || !ded_count) { -WREG32 (SOC15_REG_ENTRY_OFFSET ( - gfx_v9_4_2_utc_regs[i].data_reg), - gfx_v9_4_2_utc_regs[i].clear); +WREG32 (SOC15_REG_ENTRY_OFFSET (blk->data_reg), + blk->clear);continue ; } - data =RREG32 (SOC15_REG_ENTRY_OFFSET ( - gfx_v9_4_2_utc_regs[i].data_reg)); - + data =RREG32 (SOC15_REG_ENTRY_OFFSET (blk->data_reg));if (!data)continue ; - sec_cnt =SOC15_RAS_REG_FIELD_VAL ( - data, gfx_v9_4_2_utc_regs[i], sec); -if (sec_cnt) { -dev_info (adev->dev,"GFX SubBlock %s, SEC %d\n" , - gfx_v9_4_2_utc_map[j].name, sec_cnt); - *sec_count += sec_cnt; - } - - ded_cnt =SOC15_RAS_REG_FIELD_VAL ( - data, gfx_v9_4_2_utc_regs[i], ded); -if (ded_cnt) { -dev_info (adev->dev,"GFX SubBlock %s, DED %d\n" , - gfx_v9_4_2_utc_map[j].name, ded_cnt); - *ded_count += ded_cnt; - } + sec_cnt =SOC15_RAS_REG_FIELD_VAL (data, *blk, sec); + *sec_count += sec_cnt; + ded_cnt =SOC15_RAS_REG_FIELD_VAL (data, *blk, ded); + *ded_count += ded_cnt;/* clear counter after read */ -WREG32 (SOC15_REG_ENTRY_OFFSET ( - gfx_v9_4_2_utc_regs[i].data_reg), - gfx_v9_4_2_utc_regs[i].clear); +WREG32 (SOC15_REG_ENTRY_OFFSET (blk->data_reg), + blk->clear); + +/* print the edc count */ +gfx_v9_4_2_log_utc_edc_count (adev, blk, j, sec_cnt, + ded_cnt); } }
drivers/gpu/drm/amd/amdgpu/soc15.h +1 -1
@@ -97,7 +97,7 @@ struct soc15_ras_field_entry {#define SOC15_REG_FIELD_VAL (val, mask, shift) (((val) & mask) >> shift) -#define SOC15_RAS_REG_FIELD_VAL (val, entry, field) SOC15_REG_FIELD_VAL(val, entry.field##_count_mask, entry.field##_count_shift) +#define SOC15_RAS_REG_FIELD_VAL (val, entry, field) SOC15_REG_FIELD_VAL((val), (entry).field##_count_mask, (entry).field##_count_shift)void soc15_grbm_select (struct amdgpu_device *adev,u32 me,u32 pipe,u32 queue,u32 vmid);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 154/159 drm/amdgpu: enable watchdog feature for SQ of aldebaran
In reply to Alex DeucherFrom: Dennis Li <[email protected]>
SQ's watchdog timer monitors forward progress, a mask of which waves caused the watchdog timeout is recorded into ras status registers and then trigger a system fatal error event.
v2:
1. change *query_timeout_status to *query_sq_timeout_status.
2. move query_sq_timeout_status into amdgpu_ras_do_recovery.
3. add module parameters to enable/disable fatal error event and modify the watchdog timer.
v3:
1. remove unused parameters of *enable_watchdog_timer
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 18 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 + drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c | 106 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h | 3 + drivers/gpu/drm/amd/amdgpu/soc15_common.h | 30 ++++++ 8 files changed, 174 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +7 -0
@@ -127,6 +127,12 @@ struct amdgpu_mgpu_infouint32_t num_apu; }; +struct amdgpu_watchdog_timer +{ +bool timeout_fatal_disable; +uint32_t period;/* maxCycles = (1 << period), the number of cycles before a timeout */ +}; +#define AMDGPU_MAX_TIMEOUT_PARAM_LENGTH 256/*
@@ -186,6 +192,7 @@ extern struct amdgpu_mgpu_info mgpu_info;extern int amdgpu_ras_enable;extern uint amdgpu_ras_mask;extern int amdgpu_bad_page_threshold; +extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;extern int amdgpu_async_gfx_ring;extern int amdgpu_mcbp;extern int amdgpu_discovery;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +18 -0
@@ -172,6 +172,10 @@ struct amdgpu_mgpu_info mgpu_info = {int amdgpu_ras_enable =-1 ;uint amdgpu_ras_mask =0xffffffff ;int amdgpu_bad_page_threshold =100 ; +struct amdgpu_watchdog_timer amdgpu_watchdog_timer = { + .timeout_fatal_disable = false, + .period =0x3f ,/* about 8s */ +};/** * DOC: vramlimit (int)
@@ -527,6 +531,20 @@ module_param_named(ras_enable, amdgpu_ras_enable, int, 0444);MODULE_PARM_DESC (ras_mask,"Mask of RAS features to enable (default 0xffffffff), only valid when ras_enable == 1" );module_param_named (ras_mask, amdgpu_ras_mask, uint,0444 ); +/** +* DOC: timeout_fatal_disable (bool) +* Disable Watchdog timeout fatal error event +*/ +MODULE_PARM_DESC (timeout_fatal_disable,"disable watchdog timeout fatal error (false = default)" ); +module_param_named (timeout_fatal_disable, amdgpu_watchdog_timer.timeout_fatal_disable, bool,0644 ); + +/** +* DOC: timeout_period (uint) +* Modify the watchdog timeout max_cycles as (1 << period) +*/ +MODULE_PARM_DESC (timeout_period,"watchdog timeout period (0x1F = default), timeout maxCycles = (1 << period)" ); +module_param_named (timeout_period, amdgpu_watchdog_timer.period, uint,0644 ); +/** * DOC: si_support (int) * Set SI support driver. This parameter works after set config CONFIG_DRM_AMDGPU_SI. For SI asic, when radeon driver is enabled,
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
@@ -226,6 +226,8 @@ struct amdgpu_gfx_funcs {void (*init_spm_golden)(struct amdgpu_device *adev);void (*query_ras_error_status) (struct amdgpu_device *adev);void (*update_perfmon_mgcg)(struct amdgpu_device *adev,bool enable); +void (*enable_watchdog_timer)(struct amdgpu_device *adev); +void (*query_sq_timeout_status)(struct amdgpu_device *adev); };struct sq_work {
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -0
@@ -1467,6 +1467,9 @@ static void amdgpu_ras_error_status_query(struct amdgpu_device *adev,case AMDGPU_RAS_BLOCK__GFX :if (adev->gfx.funcs->query_ras_error_status) adev->gfx.funcs->query_ras_error_status (adev); + +if (adev->gfx.funcs->query_sq_timeout_status) + adev->gfx.funcs->query_sq_timeout_status (adev);break ;case AMDGPU_RAS_BLOCK__MMHUB :if (adev->mmhub.funcs->query_ras_error_status)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -0
@@ -2121,6 +2121,8 @@ static const struct amdgpu_gfx_funcs gfx_v9_4_2_gfx_funcs = { .query_ras_error_count = &gfx_v9_4_2_query_ras_error_count, .reset_ras_error_count = &gfx_v9_4_2_reset_ras_error_count, .query_ras_error_status = &gfx_v9_4_2_query_ras_error_status, + .enable_watchdog_timer = &gfx_v9_4_2_enable_watchdog_timer, + .query_sq_timeout_status = &gfx_v9_4_2_query_sq_timeout_status, };static int gfx_v9_0_gpu_early_init (struct amdgpu_device *adev)
@@ -3965,6 +3967,9 @@ static int gfx_v9_0_hw_init(void *handle)if (adev->asic_type ==CHIP_ALDEBARAN )gfx_v9_4_2_set_power_brake_sequence (adev); +if (adev->gfx.funcs->enable_watchdog_timer) + adev->gfx.funcs->enable_watchdog_timer (adev); +return r; }
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.c +106 -0
110 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_2.h +3 -0
@@ -35,4 +35,7 @@ int gfx_v9_4_2_ras_error_inject(struct amdgpu_device *adev, void *inject_if);void gfx_v9_4_2_query_ras_error_status (struct amdgpu_device *adev);int gfx_v9_4_2_query_ras_error_count (struct amdgpu_device *adev,void *ras_error_status); + +void gfx_v9_4_2_enable_watchdog_timer (struct amdgpu_device *adev); +void gfx_v9_4_2_query_sq_timeout_status (struct amdgpu_device *adev);#endif /* __GFX_V9_4_2_H__ */
drivers/gpu/drm/amd/amdgpu/soc15_common.h +30 -0
@@ -100,6 +100,30 @@ } \ } while (0) +#define WREG32_RLC_EX (prefix, reg, value) \ + do { \ + if (amdgpu_sriov_fullaccess(adev)) { \ + uint32_t i = 0; \ + uint32_t retries = 50000; \ + uint32_t r0 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG0_BASE_IDX] + prefix##SCRATCH_REG0; \ + uint32_t r1 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG1; \ + uint32_t spare_int = adev->reg_offset[GC_HWIP][0][prefix##RLC_SPARE_INT_BASE_IDX] + prefix##RLC_SPARE_INT; \ + WREG32(r0, value); \ + WREG32(r1, (reg | 0x80000000)); \ + WREG32(spare_int, 0x1); \ + for (i = 0; i < retries; i++) { \ + u32 tmp = RREG32(r1); \ + if (!(tmp & 0x80000000)) \ + break; \ + udelay(10); \ + } \ + if (i >= retries) \ + pr_err("timeout: rlcg program reg:0x%05x failed !\n", reg); \ + } else { \ + WREG32(reg, value); \ + } \ + } while (0) +#define WREG32_SOC15_RLC_SHADOW (ip, inst, reg, value) \ do { \ uint32_t target_reg = adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg;\
@@ -142,6 +166,12 @@WREG32_RLC (target_reg, value); \ } while (0) +#define WREG32_SOC15_RLC_EX (prefix, ip, inst, reg, value) \ + do { \ + uint32_t target_reg = adev->reg_offset[GC_HWIP][0][reg##_BASE_IDX] + reg;\ + WREG32_RLC_EX(prefix, target_reg, value); \ + } while (0) +#define WREG32_FIELD15_RLC (ip, idx, reg, field, val) \ WREG32_RLC((adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg), \ (RREG32(adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg) \
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 155/159 drm/amdgpu: Let KFD use more VMIDs on Aldebaran
In reply to Alex DeucherFrom: Felix Kuehling <[email protected]>
When there is no graphics support, KFD can use more of the VMIDs. Graphics VMIDs are only used for video decoding/encoding and post processing. With two VCE engines, there is no reason to reserve more than 2 VMIDs for that.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
@@ -1559,7 +1559,8 @@ static int gmc_v9_0_sw_init(void *handle)* for video processing. */ adev->vm_manager.first_kfd_vmid = - adev->asic_type ==CHIP_ARCTURUS ?3 :8 ; + (adev->asic_type ==CHIP_ARCTURUS || + adev->asic_type ==CHIP_ALDEBARAN ) ?3 :8 ;amdgpu_vm_manager_init (adev);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 156/159 drm/amd/pm: add aldebaran serial number support
In reply to Alex DeucherFrom: Kevin Wang <[email protected]>
add aldebaran serial number support.
(serial number from metrics table)
--- .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +23 -0
@@ -1190,6 +1190,28 @@ static bool aldebaran_is_dpm_running(struct smu_context *smu)return !!(feature_enabled &SMC_DPM_FEATURE ); } +static void aldebaran_get_unique_id (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; +SmuMetrics_t *metrics = smu->smu_table.metrics_table; +uint32_t upper32 =0 , lower32 =0 ; +int ret; + +mutex_lock (&smu->metrics_lock); + ret =smu_cmn_get_metrics_table_locked (smu,NULL , false); +if (ret) + goto out_unlock; + + upper32 = metrics->PublicSerialNumUpper32; + lower32 = metrics->PublicSerialNumLower32; + +out_unlock: +mutex_unlock (&smu->metrics_lock); + + adev->unique_id = ((uint64_t )upper32 <<32 ) | lower32; +sprintf (adev->serial,"%016llx" , adev->unique_id); +} +static bool aldebaran_is_baco_supported (struct smu_context *smu) {/* aldebaran is not support baco */
@@ -1362,6 +1384,7 @@ static const struct pptable_funcs aldebaran_ppt_funcs = { .set_performance_level = aldebaran_set_performance_level, .get_power_limit = aldebaran_get_power_limit, .is_dpm_running = aldebaran_is_dpm_running, + .get_unique_id = aldebaran_get_unique_id, .init_microcode = smu_v13_0_init_microcode, .load_microcode = smu_v13_0_load_microcode, .fini_microcode = smu_v13_0_fini_microcode,
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 157/159 drm/amdgpu: change psp_rap_invoke() function return value
In reply to Alex DeucherFrom: Kevin Wang <[email protected]>
RAP TA is an optional firmware. if it doesn’t exist, the driver should bypass psp_rap_invoke() function.
1. bypass psp_rap_invoke() when RAP TA is not loaded.
2. add new parameter (status) to query RAP TA status. (the status value is different with psp_ta_invoke(),
3. fix the 'rap_status' MThread critical problem. (used without lock)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 29 +++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 7 +++--- 3 files changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +17 -12
@@ -1595,6 +1595,7 @@ static int psp_rap_unload(struct psp_context *psp)static int psp_rap_initialize (struct psp_context *psp) {int ret; +enum ta_rap_status status =TA_RAP_STATUS__SUCCESS ;/* * TODO: bypass the initialize in sriov for now
@@ -1618,8 +1619,8 @@ static int psp_rap_initialize(struct psp_context *psp)if (ret)return ret; - ret =psp_rap_invoke (psp,TA_CMD_RAP__INITIALIZE ); -if (ret !=TA_RAP_STATUS__SUCCESS ) { + ret =psp_rap_invoke (psp,TA_CMD_RAP__INITIALIZE , &status); +if (ret || status !=TA_RAP_STATUS__SUCCESS ) {psp_rap_unload (psp); amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo,
@@ -1628,8 +1629,10 @@ static int psp_rap_initialize(struct psp_context *psp) psp->rap_context.rap_initialized = false; -dev_warn (psp->adev->dev,"RAP TA initialize fail.\n" ); -return -EINVAL ; +dev_warn (psp->adev->dev,"RAP TA initialize fail (%d) status %d.\n" , + ret, status); + +return ret; }return 0 ;
@@ -1654,13 +1657,13 @@ static int psp_rap_terminate(struct psp_context *psp)return ret; } -int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id) +int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id,enum ta_rap_status *status) {struct ta_rap_shared_memory *rap_cmd; -int ret; +int ret =0 ;if (!psp->rap_context.rap_initialized) -return -EINVAL ; +return 0 ;if (ta_cmd_id !=TA_CMD_RAP__INITIALIZE && ta_cmd_id !=TA_CMD_RAP__VALIDATE_L0 )
@@ -1676,14 +1679,16 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id) rap_cmd->validation_method_id =METHOD_A ; ret =psp_ta_invoke (psp, rap_cmd->cmd_id, psp->rap_context.session_id); -if (ret) { -mutex_unlock (&psp->rap_context.mutex); -return ret; - } +if (ret) + goto out_unlock; + +if (status) + *status = rap_cmd->rap_status; +out_unlock:mutex_unlock (&psp->rap_context.mutex); -return rap_cmd->rap_status; +return ret; }// RAP end
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 -1
@@ -399,7 +399,7 @@ int psp_ras_trigger_error(struct psp_context *psp,int psp_hdcp_invoke (struct psp_context *psp,uint32_t ta_cmd_id);int psp_dtm_invoke (struct psp_context *psp,uint32_t ta_cmd_id); -int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id); +int psp_rap_invoke (struct psp_context *psp,uint32_t ta_cmd_id,enum ta_rap_status *status);int psp_securedisplay_invoke (struct psp_context *psp,uint32_t ta_cmd_id);int psp_rlc_autoload_start (struct psp_context *psp);
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c +4 -3
@@ -48,6 +48,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf,struct ta_rap_cmd_output_data *rap_cmd_output;struct drm_device *dev =adev_to_drm (adev);uint32_t op; +enum ta_rap_status status;int ret;if (*pos || size !=2 )
@@ -70,9 +71,8 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf,switch (op) {case 2 : - ret =psp_rap_invoke (&adev->psp, op); - -if (ret ==TA_RAP_STATUS__SUCCESS ) { + ret =psp_rap_invoke (&adev->psp, op, &status); +if (!ret && status ==TA_RAP_STATUS__SUCCESS ) {dev_info (adev->dev,"RAP L0 validate test success.\n" ); }else { rap_shared_mem = (struct ta_rap_shared_memory *)
@@ -97,6 +97,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf,default :dev_info (adev->dev,"Unsupported op id: %d, " , op);dev_info (adev->dev,"Only support op 2(L0 validate test).\n" ); +break ; }amdgpu_gfx_off_ctrl (adev, true);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 158/159 drm/amdgpu: add psp RAP L0 check support
In reply to Alex DeucherFrom: Kevin Wang <[email protected]>
add PSP RAP L0 check when RAP TA is loaded.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +9 -1
@@ -2363,6 +2363,7 @@ static int psp_hw_init(void *handle) {int ret;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +enum ta_rap_status status =TA_RAP_STATUS__SUCCESS ;mutex_lock (&adev->firmware.mutex);/*
@@ -2380,7 +2381,14 @@ static int psp_hw_init(void *handle) }mutex_unlock (&adev->firmware.mutex); -return 0 ; + + ret =psp_rap_invoke (&adev->psp,TA_CMD_RAP__VALIDATE_L0 , &status); +if (ret || status !=TA_RAP_STATUS__SUCCESS ) { +dev_err (adev->dev,"RAP: (%d) Failed to Invoke Validate L0, status %d\n" , + ret, status); + } + +return ret; failed: adev->firmware.load_type =AMDGPU_FW_LOAD_DIRECT ;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
maintainerPATCH 159/159 drm/amd/pm: add new data in metrics table
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
Export new data in the metrics table for gfx and memory utilization counter, and each hbm temperature as well.
v2:
change the metrics table version to v1.1
v3:
fix the coding style
--- .../gpu/drm/amd/include/kgd_pp_interface.h | 11 ++++ drivers/gpu/drm/amd/pm/inc/smu_v13_0.h | 2 + .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 55 +++++++++++-------- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 12 ++++ 4 files changed, 56 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +11 -0
@@ -227,6 +227,8 @@ enum pp_df_cstate {#define XGMI_MODE_PSTATE_D3 0#define XGMI_MODE_PSTATE_D0 1 +#define NUM_HBM_INSTANCES 4 +struct seq_file ;enum amd_pp_clock_type ;struct amd_pp_simple_clock_info ;
@@ -389,6 +391,15 @@ struct gpu_metrics_v1_0 {uint8_t pcie_link_speed;// in 0.1 GT/s }; +struct gpu_metrics_v1_1 { +struct gpu_metrics_v1_0 v1_0; + +uint32_t gfx_activity_acc; +uint32_t mem_activity_acc; + +uint16_t temperature_hbm[NUM_HBM_INSTANCES ]; +}; +struct gpu_metrics_v2_0 {struct metrics_table_header common_header;
drivers/gpu/drm/amd/pm/inc/smu_v13_0.h +2 -0
@@ -267,6 +267,8 @@ int smu_v13_0_get_current_pcie_link_speed(struct smu_context *smu);void smu_v13_0_init_gpu_metrics_v1_0 (struct gpu_metrics_v1_0 *gpu_metrics); +void smu_v13_0_init_gpu_metrics_v1_1 (struct gpu_metrics_v1_1 *gpu_metrics); +int smu_v13_0_gfx_ulv_control (struct smu_context *smu,bool enablement);
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +31 -24
81 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +12 -0
@@ -1820,3 +1820,15 @@ void smu_v13_0_init_gpu_metrics_v1_0(struct gpu_metrics_v1_0 *gpu_metrics) gpu_metrics->system_clock_counter =ktime_get_boottime_ns (); } + +void smu_v13_0_init_gpu_metrics_v1_1 (struct gpu_metrics_v1_1 *gpu_metrics) +{ +memset (gpu_metrics,0xFF ,sizeof (struct gpu_metrics_v1_1 )); + + gpu_metrics->v1_0.common_header.structure_size = +sizeof (struct gpu_metrics_v1_1 ); + gpu_metrics->v1_0.common_header.format_revision =1 ; + gpu_metrics->v1_0.common_header.content_revision =1 ; + + gpu_metrics->v1_0.system_clock_counter =ktime_get_boottime_ns (); +}
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx