drm/amdgpu: Add xcc instance parameter to *REG32_SOC15_IP_NO_KIQ
Subsystems (2)
PATCH 1/3 drm/amdgpu: Add xcc instance parameter to *REG32_SOC15_IP_NO_KIQ
The WREG32/RREG32_SOC15_IP_NO_KIQ call is using XCC0's RLCG interface when programming other XCCs.
Add inst parameter to them.
Signed-off-by Victor Lu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 16 ++++++++-------- drivers/gpu/drm/amd/amdgpu/soc15_common.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -8
@@ -870,9 +870,9 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,for (j =0 ; j < adev->usec_timeout; j++) {/* a read return value of 1 means semaphore acquire */ if (vmhub >=AMDGPU_MMHUB0 (0 )) - tmp =RREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_sem + hub->eng_distance * eng); + tmp =RREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_sem + hub->eng_distance * eng, vmhub -AMDGPU_MMHUB0 (0 ));else - tmp =RREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_sem + hub->eng_distance * eng); + tmp =RREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_sem + hub->eng_distance * eng, vmhub);if (tmp &0x1 )break ;udelay (1 );
@@ -884,9 +884,9 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, do { if (vmhub >= AMDGPU_MMHUB0(0)) - WREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req); + WREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req, vmhub - AMDGPU_MMHUB0(0)); else - WREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req); + WREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req, vmhub); /* * Issue a dummy read to wait for the ACK register to
@@ -900,9 +900,9 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,for (j =0 ; j < adev->usec_timeout; j++) {if (vmhub >=AMDGPU_MMHUB0 (0 )) - tmp =RREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_ack + hub->eng_distance * eng); + tmp =RREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_ack + hub->eng_distance * eng, vmhub -AMDGPU_MMHUB0 (0 ));else - tmp =RREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_ack + hub->eng_distance * eng); + tmp =RREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_ack + hub->eng_distance * eng, vmhub);if (tmp & (1 << vmid))break ;udelay (1 );
@@ -919,9 +919,9 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,* write with 0 means semaphore release */ if (vmhub >=AMDGPU_MMHUB0 (0 )) -WREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_sem + hub->eng_distance * eng,0 ); +WREG32_SOC15_IP_NO_KIQ (MMHUB , hub->vm_inv_eng0_sem + hub->eng_distance * eng,0 , vmhub -AMDGPU_MMHUB0 (0 ));else -WREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_sem + hub->eng_distance * eng,0 ); +WREG32_SOC15_IP_NO_KIQ (GC , hub->vm_inv_eng0_sem + hub->eng_distance * eng,0 , vmhub); }spin_unlock (&adev->gmc.invalidate_lock);
drivers/gpu/drm/amd/amdgpu/soc15_common.h +3 -3
@@ -69,7 +69,7 @@#define RREG32_SOC15_IP (ip, reg) __RREG32_SOC15_RLC__(reg, 0, ip##_HWIP, 0) -#define RREG32_SOC15_IP_NO_KIQ (ip, reg) __RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ, ip##_HWIP, 0) +#define RREG32_SOC15_IP_NO_KIQ (ip, reg, inst) __RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ, ip##_HWIP, inst)#define RREG32_SOC15_NO_KIQ (ip, inst, reg) \ __RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
@@ -86,8 +86,8 @@#define WREG32_SOC15_IP (ip, reg, value) \ __WREG32_SOC15_RLC__(reg, value, 0, ip##_HWIP, 0) -#define WREG32_SOC15_IP_NO_KIQ (ip, reg, value) \ - __WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ, ip##_HWIP, 0) +#define WREG32_SOC15_IP_NO_KIQ (ip, reg, value, inst) \ + __WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ, ip##_HWIP, inst)#define WREG32_SOC15_NO_KIQ (ip, inst, reg, value) \ __WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
Signature · 1 line
2.34.1
PATCH 2/3 drm/amdgpu: Add xcc_inst param to amdgpu_virt_kiq_reg_write_reg_wait
amdgpu_virt_kiq_reg_write_reg_wait is hardcoded to use MEC engine 0. Add xcc_inst as a parameter to allow it to use different MEC engines.
Signed-off-by Victor Lu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 5 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 3 ++- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 +++++++--- 5 files changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -2
@@ -73,9 +73,10 @@ void amdgpu_virt_init_setting(struct amdgpu_device *adev)void amdgpu_virt_kiq_reg_write_reg_wait (struct amdgpu_device *adev,uint32_t reg0,uint32_t reg1, -uint32_t ref,uint32_t mask) +uint32_t ref,uint32_t mask, +uint32_t xcc_inst) { -struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ]; +struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_inst];struct amdgpu_ring *ring = &kiq->ring;signed long r, cnt =0 ;unsigned long flags;
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -1
@@ -330,7 +330,8 @@ bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev);void amdgpu_virt_init_setting (struct amdgpu_device *adev);void amdgpu_virt_kiq_reg_write_reg_wait (struct amdgpu_device *adev,uint32_t reg0,uint32_t rreg1, -uint32_t ref,uint32_t mask); +uint32_t ref,uint32_t mask, +uint32_t xcc_id);int amdgpu_virt_request_full_gpu (struct amdgpu_device *adev,bool init);int amdgpu_virt_release_full_gpu (struct amdgpu_device *adev,bool init);int amdgpu_virt_reset_gpu (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -1
@@ -346,7 +346,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,u32 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;amdgpu_virt_kiq_reg_write_reg_wait (adev, req, ack, inv_req, -1 << vmid); +1 << vmid,0 );up_read (&adev->reset_domain->sem);return ;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +1 -1
@@ -303,7 +303,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,u32 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;amdgpu_virt_kiq_reg_write_reg_wait (adev, req, ack, inv_req, -1 << vmid); +1 << vmid,0 );return ; }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -3
@@ -815,7 +815,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, {bool use_semaphore =gmc_v9_0_use_invalidate_semaphore (adev, vmhub);const unsigned int eng =17 ; -u32 j, inv_req, inv_req2, tmp; +u32 j, inv_req, inv_req2, tmp, inst;struct amdgpu_vmhub *hub;BUG_ON (vmhub >=AMDGPU_MAX_VMHUBS );
@@ -844,14 +844,18 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,/* This is necessary for a HW workaround under SRIOV as well * as GFXOFF under bare metal */ -if (adev->gfx.kiq[0 ].ring.sched.ready && +if (vmhub >=AMDGPU_MMHUB0 (0 )) + inst = vmhub -AMDGPU_MMHUB0 (0 ); +else + inst = vmhub; +if (adev->gfx.kiq[inst].ring.sched.ready && (amdgpu_sriov_runtime (adev) || !amdgpu_sriov_vf (adev)) &&down_read_trylock (&adev->reset_domain->sem)) {uint32_t req = hub->vm_inv_eng0_req + hub->eng_distance * eng;uint32_t ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;amdgpu_virt_kiq_reg_write_reg_wait (adev, req, ack, inv_req, -1 << vmid); +1 << vmid, inst);up_read (&adev->reset_domain->sem);return ; }
Signature · 1 line
2.34.1
PATCH 3/3 drm/amdgpu: Add flag to enable indirect RLCG access for gfx v9.4.3
In reply to Victor LuThe "rlcg_reg_access_supported" flag is missing. Add it back in.
Signed-off-by Victor Lu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +1 -0
@@ -1096,6 +1096,7 @@ static void gfx_v9_4_3_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev) reg_access_ctrl->grbm_idx =SOC15_REG_OFFSET (GC ,GET_INST (GC , xcc_id), regGRBM_GFX_INDEX); reg_access_ctrl->spare_int =SOC15_REG_OFFSET (GC ,GET_INST (GC , xcc_id), regRLC_SPARE_INT); } + adev->gfx.rlc.rlcg_reg_access_supported = true; }static int gfx_v9_4_3_rlc_init (struct amdgpu_device *adev)
Signature · 1 line
2.34.1