drm/amdgpu: update cp cmd pkt for gfx v12_1
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: update cp cmd pkt for gfx v12_1
From: Likun Gao <[email protected]>
Update CP command package for gfx v12.1.
v2: squash in update (Alex)
Signed-off-by Likun Gao <[email protected]>
Reviewed-by Hawking Zhang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 34 +- drivers/gpu/drm/amd/amdgpu/gfx_v12_1_pkt.h | 347 +++++++++++++++------ 2 files changed, 273 insertions(+), 108 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +17 -17
@@ -243,9 +243,9 @@ static void gfx_v12_1_wait_reg_mem(struct amdgpu_ring *ring, int eng_sel,amdgpu_ring_write (ring,PACKET3 (PACKET3_WAIT_REG_MEM ,5 ));amdgpu_ring_write (ring,/* memory (1) or register (0) */ - (WAIT_REG_MEM_MEM_SPACE (mem_space) | -WAIT_REG_MEM_OPERATION (opt) |/* wait */ -WAIT_REG_MEM_FUNCTION (3 )));/* equal */ + (PACKET3_WAIT_REG_MEM__MEM_SPACE (mem_space) | +PACKET3_WAIT_REG_MEM__OPERATION (opt) |/* wait */ +PACKET3_WAIT_REG_MEM__FUNCTION (3 )));/* equal */ if (mem_space)BUG_ON (addr0 &0x3 );/* Dword align */
@@ -335,7 +335,7 @@ static int gfx_v12_1_ring_test_ib(struct amdgpu_ring *ring, long timeout) } ib.ptr[0 ] =PACKET3 (PACKET3_WRITE_DATA ,3 ); - ib.ptr[1 ] =WRITE_DATA_DST_SEL (5 ) |WR_CONFIRM ; + ib.ptr[1 ] =PACKET3_WRITE_DATA__DST_SEL (5 ) |PACKET3_WRITE_DATA__WR_CONFIRM (1 ); ib.ptr[2 ] =lower_32_bits (gpu_addr); ib.ptr[3 ] =upper_32_bits (gpu_addr); ib.ptr[4 ] =0xDEADBEEF ;
@@ -3366,7 +3366,7 @@ static void gfx_v12_1_ring_emit_ib_compute(struct amdgpu_ring *ring, uint32_t flags) {unsigned vmid =AMDGPU_JOB_GET_VMID (job); -u32 control =INDIRECT_BUFFER_VALID | ib->length_dw | (vmid <<24 ); +u32 control =PACKET3_INDIRECT_BUFFER__VALID (1 ) | ib->length_dw | (vmid <<24 );/* Currently, there is a high possibility to get wave ID mismatch * between ME and GDS, leading to a hw deadlock, because ME generates
@@ -3402,15 +3402,15 @@ static void gfx_v12_1_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,/* RELEASE_MEM - flush caches, send int */ amdgpu_ring_write (ring,PACKET3 (PACKET3_RELEASE_MEM ,6 )); -amdgpu_ring_write (ring, (PACKET3_RELEASE_MEM_GCR_SEQ (1 ) | -PACKET3_RELEASE_MEM_GCR_GLV_WB | -PACKET3_RELEASE_MEM_GCR_GL2_WB | -PACKET3_RELEASE_MEM_GCR_GL2_SCOPE (2 ) | -PACKET3_RELEASE_MEM_TEMPORAL (3 ) | -PACKET3_RELEASE_MEM_EVENT_TYPE (CACHE_FLUSH_AND_INV_TS_EVENT ) | -PACKET3_RELEASE_MEM_EVENT_INDEX (5 ))); -amdgpu_ring_write (ring, (PACKET3_RELEASE_MEM_DATA_SEL (write64bit ?2 :1 ) | -PACKET3_RELEASE_MEM_INT_SEL (int_sel ?2 :0 ))); +amdgpu_ring_write (ring, (PACKET3_RELEASE_MEM__GCR_SEQ (1 ) | +PACKET3_RELEASE_MEM__GCR_GLV_WB | +PACKET3_RELEASE_MEM__GCR_GL2_WB | +PACKET3_RELEASE_MEM__GCR_GL2_SCOPE (2 ) | +PACKET3_RELEASE_MEM__TEMPORAL (3 ) | +PACKET3_RELEASE_MEM__EVENT_TYPE (CACHE_FLUSH_AND_INV_TS_EVENT ) | +PACKET3_RELEASE_MEM__EVENT_INDEX (5 ))); +amdgpu_ring_write (ring, (PACKET3_RELEASE_MEM__DATA_SEL (write64bit ?2 :1 ) | +PACKET3_RELEASE_MEM__INT_SEL (int_sel ?2 :0 )));/* * the address should be Qword aligned if 64bit write, Dword
@@ -3471,7 +3471,7 @@ static void gfx_v12_1_ring_emit_fence_kiq(struct amdgpu_ring *ring, u64 addr,/* write fence seq to the "addr" */ amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA ,3 )); -amdgpu_ring_write (ring, (WRITE_DATA_DST_SEL (5 ) |WR_CONFIRM )); +amdgpu_ring_write (ring, (PACKET3_WRITE_DATA__DST_SEL (5 ) |PACKET3_WRITE_DATA__WR_CONFIRM (1 )));amdgpu_ring_write (ring,lower_32_bits (addr));amdgpu_ring_write (ring,upper_32_bits (addr));amdgpu_ring_write (ring,lower_32_bits (seq));
@@ -3479,7 +3479,7 @@ static void gfx_v12_1_ring_emit_fence_kiq(struct amdgpu_ring *ring, u64 addr,if (flags &AMDGPU_FENCE_FLAG_INT ) {/* set register to trigger INT */ amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA ,3 )); -amdgpu_ring_write (ring, (WRITE_DATA_DST_SEL (0 ) |WR_CONFIRM )); +amdgpu_ring_write (ring, (PACKET3_WRITE_DATA__DST_SEL (0 ) |PACKET3_WRITE_DATA__WR_CONFIRM (1 )));amdgpu_ring_write (ring,SOC15_REG_OFFSET (GC ,GET_INST (GC ,0 ), regCPC_INT_STATUS));amdgpu_ring_write (ring,0 );amdgpu_ring_write (ring,0x20000000 );/* src_id is 178 */
@@ -3518,7 +3518,7 @@ static void gfx_v12_1_ring_emit_wreg(struct amdgpu_ring *ring, cmd = (1 <<16 );/* no inc addr */ break ;default : - cmd =WR_CONFIRM ; + cmd =PACKET3_WRITE_DATA__WR_CONFIRM (1 );break ; }amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA ,3 ));
drivers/gpu/drm/amd/amdgpu/gfx_v12_1_pkt.h +256 -91
424 lines not on this page · raw message
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: In GFX12.1 CU is same as WGP
From: Harish Kasiviswanathan <[email protected]>
Fix this for current ip discovery table.
v2: Move the change to gfx12 file
v3: Change only for the current version of ip discovery table
v4: Squash in build fixes
Signed-off-by Harish Kasiviswanathan <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 25 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 10 ++++++++ 3 files changed, 37 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +25 -0
@@ -3423,3 +3423,28 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)return 0 ; } +int amdgpu_discovery_get_gc_major_minor_version (struct amdgpu_device *adev, +uint16_t *major,uint16_t *minor) +{ +uint8_t *discovery_bin = adev->discovery.bin; +struct table_info *info; +union gc_info *gc_info; +u16 offset; + +if (!discovery_bin) +return -EINVAL ; +if (amdgpu_discovery_get_table_info (adev, &info,GC )) +return -EINVAL ; + + offset =le16_to_cpu (info->offset); +if (!offset) +return -EINVAL ; + + gc_info = (union gc_info *)(discovery_bin + offset); + +if (major) + *major =le16_to_cpu (gc_info->v1.header.version_major); +if (minor) + *minor =le16_to_cpu (gc_info->v1.header.version_minor); +return 0 ; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h +2 -0
@@ -48,6 +48,8 @@ int amdgpu_discovery_get_nps_info(struct amdgpu_device *adev,uint32_t *nps_type, struct amdgpu_gmc_memrange *ranges, int *range_cnt, bool refresh); +int amdgpu_discovery_get_gc_major_minor_version (struct amdgpu_device *adev, +uint16_t *major,uint16_t *minor);void amdgpu_discovery_dump (struct amdgpu_device *adev,struct drm_printer *p);
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +10 -0
@@ -1142,6 +1142,7 @@ static int gfx_v12_1_rlc_backdoor_autoload_enable(struct amdgpu_device *adev)static int gfx_v12_1_sw_init (struct amdgpu_ip_block *ip_block) { +uint16_t major_ver, minor_ver;int i, j, k, r, ring_id =0 ;unsigned num_compute_rings;int xcc_id, num_xcc;
@@ -1152,6 +1153,15 @@ static int gfx_v12_1_sw_init(struct amdgpu_ip_block *ip_block) adev->gfx.mec.num_mec =1 ; adev->gfx.mec.num_pipe_per_mec =4 ; adev->gfx.mec.num_queue_per_pipe =8 ; + +if (!amdgpu_discovery_get_gc_major_minor_version ( + adev, &major_ver, &minor_ver)) { +if (major_ver ==1 && minor_ver ==3 ) { + adev->gfx.config.max_cu_per_sh /=2 ; +dev_dbg (adev->dev,"Halving max_cu_per_sh for GC Discovery table v1:3 %d\n" , + adev->gfx.config.max_cu_per_sh); + } + }break ;default : adev->gfx.mec.num_mec =2 ;
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: Switch to gfx_v12_1_get_xccs_per_xcp
In reply to Alex DeucherFrom: Hawking Zhang <[email protected]>
Use gfx v12_1 callback to query the numbers of xccs per xcp
Signed-off-by Hawking Zhang <[email protected]>
Reviewed-by Le Ma <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +11 -2
@@ -718,10 +718,19 @@ static void gfx_v12_1_select_me_pipe_q(struct amdgpu_device *adev,soc_v1_0_grbm_select (adev, me, pipe, q, vm,GET_INST (GC , xcc_id)); } +#define regGFX_IMU_PARTITION_SWITCH 0x5f8c +#define regGFX_IMU_PARTITION_SWITCH_BASE_IDX 1 +#define GFX_IMU_PARTITION_SWITCH__TOTAL_XCCS_IN_XCP__SHIFT 0x2 +#define GFX_IMU_PARTITION_SWITCH__TOTAL_XCCS_IN_XCP_MASK 0x0000003CL +static int gfx_v12_1_get_xccs_per_xcp (struct amdgpu_device *adev) { -/* Fill this in when the interface is ready */ -return 1 ; +u32 reg_data; + +/* the register data is expected to be the same on all instances */ + reg_data =RREG32_SOC15 (GC ,GET_INST (GC ,0 ), regGFX_IMU_PARTITION_SWITCH); + +return REG_GET_FIELD (reg_data,GFX_IMU_PARTITION_SWITCH ,TOTAL_XCCS_IN_XCP ); }static int gfx_v12_1_ih_to_xcc_inst (struct amdgpu_device *adev,int ih_node)
Signature · 1 line
2.53.0