mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
drm/amd/amdgpu: Update RLC_SPM_MC_CNT by ring wreg in guest
Submit command of wreg in GFX and COMPUTE ring to update RLC_SPM_MC_CNT in guest machine during runtime. Signed-off-by: YuanShang <YuanShang.Mao@amd.com> Reviewed-by: Emily Deng <Emily.Deng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
b2f26f49e8
commit
b5387349ca
|
|
@ -169,7 +169,7 @@ struct amdgpu_rlc_funcs {
|
|||
void (*stop)(struct amdgpu_device *adev);
|
||||
void (*reset)(struct amdgpu_device *adev);
|
||||
void (*start)(struct amdgpu_device *adev);
|
||||
void (*update_spm_vmid)(struct amdgpu_device *adev, unsigned vmid);
|
||||
void (*update_spm_vmid)(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid);
|
||||
bool (*is_rlcg_access_range)(struct amdgpu_device *adev, uint32_t reg);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
|
|||
amdgpu_gmc_emit_pasid_mapping(ring, job->vmid, job->pasid);
|
||||
|
||||
if (spm_update_needed && adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, job->vmid);
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, ring, job->vmid);
|
||||
|
||||
if (!ring->is_mes_queue && ring->funcs->emit_gds_switch &&
|
||||
gds_switch_needed) {
|
||||
|
|
|
|||
|
|
@ -7949,7 +7949,7 @@ static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
|||
WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
}
|
||||
|
||||
static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned int vmid)
|
||||
static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned int vmid)
|
||||
{
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -749,7 +749,7 @@ static int gfx_v11_0_rlc_init(struct amdgpu_device *adev)
|
|||
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -5049,7 +5049,7 @@ static int gfx_v11_0_update_gfx_clock_gating(struct amdgpu_device *adev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid)
|
||||
{
|
||||
u32 data;
|
||||
|
||||
|
|
@ -5063,6 +5063,14 @@ static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
|||
WREG32_SOC15_NO_KIQ(GC, 0, regRLC_SPM_MC_CNTL, data);
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, true);
|
||||
|
||||
if (ring
|
||||
&& amdgpu_sriov_is_pp_one_vf(adev)
|
||||
&& ((ring->funcs->type == AMDGPU_RING_TYPE_GFX)
|
||||
|| (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE))) {
|
||||
uint32_t reg = SOC15_REG_OFFSET(GC, 0, regRLC_SPM_MC_CNTL);
|
||||
amdgpu_ring_emit_wreg(ring, reg, data);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct amdgpu_rlc_funcs gfx_v11_0_rlc_funcs = {
|
||||
|
|
@ -6126,7 +6134,8 @@ static const struct amdgpu_ring_funcs gfx_v11_0_ring_funcs_gfx = {
|
|||
.get_rptr = gfx_v11_0_ring_get_rptr_gfx,
|
||||
.get_wptr = gfx_v11_0_ring_get_wptr_gfx,
|
||||
.set_wptr = gfx_v11_0_ring_set_wptr_gfx,
|
||||
.emit_frame_size = /* totally 242 maximum if 16 IBs */
|
||||
.emit_frame_size = /* totally 247 maximum if 16 IBs */
|
||||
5 + /* update_spm_vmid */
|
||||
5 + /* COND_EXEC */
|
||||
9 + /* SET_Q_PREEMPTION_MODE */
|
||||
7 + /* PIPELINE_SYNC */
|
||||
|
|
@ -6176,6 +6185,7 @@ static const struct amdgpu_ring_funcs gfx_v11_0_ring_funcs_compute = {
|
|||
.get_wptr = gfx_v11_0_ring_get_wptr_compute,
|
||||
.set_wptr = gfx_v11_0_ring_set_wptr_compute,
|
||||
.emit_frame_size =
|
||||
5 + /* update_spm_vmid */
|
||||
20 + /* gfx_v11_0_ring_emit_gds_switch */
|
||||
7 + /* gfx_v11_0_ring_emit_hdp_flush */
|
||||
5 + /* hdp invalidate */
|
||||
|
|
|
|||
|
|
@ -3274,7 +3274,7 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)
|
|||
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3500,7 +3500,7 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_v7_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
static void gfx_v7_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid)
|
||||
{
|
||||
u32 data;
|
||||
|
||||
|
|
|
|||
|
|
@ -1288,7 +1288,7 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)
|
|||
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -5579,7 +5579,7 @@ static void gfx_v8_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id)
|
|||
}
|
||||
}
|
||||
|
||||
static void gfx_v8_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
static void gfx_v8_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid)
|
||||
{
|
||||
u32 data;
|
||||
|
||||
|
|
|
|||
|
|
@ -4894,7 +4894,7 @@ static void gfx_v9_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
|||
WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
}
|
||||
|
||||
static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned int vmid)
|
||||
static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned int vmid)
|
||||
{
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -1174,7 +1174,7 @@ static int gfx_v9_4_3_rlc_init(struct amdgpu_device *adev)
|
|||
{
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1385,7 +1385,7 @@ static int gfx_v9_4_3_rlc_resume(struct amdgpu_device *adev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_update_spm_vmid(struct amdgpu_device *adev,
|
||||
static void gfx_v9_4_3_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring,
|
||||
unsigned vmid)
|
||||
{
|
||||
u32 reg, data;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user