Skip to content

Commit 91462af

Browse files
committed
Merge tag 'amd-drm-fixes-6.0-2022-09-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.0-2022-09-29: amdgpu: - GC 11.x fixes - SMU 13.x fixes - DCN 3.1.4 fixes - DCN 3.2.x fixes - GC 9.x fix - Fence fix - SR-IOV supend/resume fix - PSR regression fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 153a97b + 83ca5fb commit 91462af

23 files changed

+283
-86
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,10 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
10501050
{
10511051
if (adev->flags & AMD_IS_APU)
10521052
return false;
1053+
1054+
if (amdgpu_sriov_vf(adev))
1055+
return false;
1056+
10531057
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
10541058
}
10551059

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3152,7 +3152,8 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
31523152
continue;
31533153
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
31543154
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
3155-
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH) {
3155+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH ||
3156+
(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP && amdgpu_sriov_vf(adev))) {
31563157

31573158
r = adev->ip_blocks[i].version->funcs->resume(adev);
31583159
if (r) {
@@ -4064,12 +4065,20 @@ static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
40644065
int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
40654066
{
40664067
struct amdgpu_device *adev = drm_to_adev(dev);
4068+
int r = 0;
40674069

40684070
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
40694071
return 0;
40704072

40714073
adev->in_suspend = true;
40724074

4075+
if (amdgpu_sriov_vf(adev)) {
4076+
amdgpu_virt_fini_data_exchange(adev);
4077+
r = amdgpu_virt_request_full_gpu(adev, false);
4078+
if (r)
4079+
return r;
4080+
}
4081+
40734082
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D3))
40744083
DRM_WARN("smart shift update failed\n");
40754084

@@ -4093,6 +4102,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
40934102

40944103
amdgpu_device_ip_suspend_phase2(adev);
40954104

4105+
if (amdgpu_sriov_vf(adev))
4106+
amdgpu_virt_release_full_gpu(adev, false);
4107+
40964108
return 0;
40974109
}
40984110

@@ -4111,6 +4123,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41114123
struct amdgpu_device *adev = drm_to_adev(dev);
41124124
int r = 0;
41134125

4126+
if (amdgpu_sriov_vf(adev)) {
4127+
r = amdgpu_virt_request_full_gpu(adev, true);
4128+
if (r)
4129+
return r;
4130+
}
4131+
41144132
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
41154133
return 0;
41164134

@@ -4125,6 +4143,13 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41254143
}
41264144

41274145
r = amdgpu_device_ip_resume(adev);
4146+
4147+
/* no matter what r is, always need to properly release full GPU */
4148+
if (amdgpu_sriov_vf(adev)) {
4149+
amdgpu_virt_init_data_exchange(adev);
4150+
amdgpu_virt_release_full_gpu(adev, true);
4151+
}
4152+
41284153
if (r) {
41294154
dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);
41304155
return r;

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring)
400400
/* We are not protected by ring lock when reading the last sequence
401401
* but it's ok to report slightly wrong fence count here.
402402
*/
403-
amdgpu_fence_process(ring);
404403
emitted = 0x100000000ull;
405404
emitted -= atomic_read(&ring->fence_drv.last_seq);
406405
emitted += READ_ONCE(ring->fence_drv.sync_seq);

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ struct mes_add_queue_input {
222222
uint64_t tba_addr;
223223
uint64_t tma_addr;
224224
uint32_t is_kfd_process;
225+
uint32_t is_aql_queue;
226+
uint32_t queue_size;
225227
};
226228

227229
struct mes_remove_queue_input {

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5260,6 +5260,8 @@ static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
52605260
{
52615261
u32 reg, data;
52625262

5263+
amdgpu_gfx_off_ctrl(adev, false);
5264+
52635265
reg = SOC15_REG_OFFSET(GC, 0, regRLC_SPM_MC_CNTL);
52645266
if (amdgpu_sriov_is_pp_one_vf(adev))
52655267
data = RREG32_NO_KIQ(reg);
@@ -5273,6 +5275,8 @@ static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
52735275
WREG32_SOC15_NO_KIQ(GC, 0, regRLC_SPM_MC_CNTL, data);
52745276
else
52755277
WREG32_SOC15(GC, 0, regRLC_SPM_MC_CNTL, data);
5278+
5279+
amdgpu_gfx_off_ctrl(adev, true);
52765280
}
52775281

52785282
static const struct amdgpu_rlc_funcs gfx_v11_0_rlc_funcs = {

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5597,7 +5597,7 @@ static void gfx_v9_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigne
55975597
BUG_ON(offset > ring->buf_mask);
55985598
BUG_ON(ring->ring[offset] != 0x55aa55aa);
55995599

5600-
cur = (ring->wptr & ring->buf_mask) - 1;
5600+
cur = (ring->wptr - 1) & ring->buf_mask;
56015601
if (likely(cur > offset))
56025602
ring->ring[offset] = cur - offset;
56035603
else

drivers/gpu/drm/amd/amdgpu/mes_v11_0.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ static int mes_v11_0_add_hw_queue(struct amdgpu_mes *mes,
185185
mes_add_queue_pkt.is_kfd_process = input->is_kfd_process;
186186
mes_add_queue_pkt.trap_en = 1;
187187

188+
/* For KFD, gds_size is re-used for queue size (needed in MES for AQL queues) */
189+
mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;
190+
mes_add_queue_pkt.gds_size = input->queue_size;
191+
188192
return mes_v11_0_submit_pkt_and_poll_completion(mes,
189193
&mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
190194
offsetof(union MESAPI__ADD_QUEUE, api_status));

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
205205
}
206206

207207
queue_input.is_kfd_process = 1;
208+
queue_input.is_aql_queue = (q->properties.format == KFD_QUEUE_FORMAT_AQL);
209+
queue_input.queue_size = q->properties.queue_size >> 2;
208210

209211
queue_input.paging = false;
210212
queue_input.tba_addr = qpd->tba_addr;

drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ static void event_interrupt_wq_v11(struct kfd_dev *dev,
350350
print_sq_intr_info_inst(context_id0, context_id1);
351351
sq_int_priv = REG_GET_FIELD(context_id0,
352352
SQ_INTERRUPT_WORD_WAVE_CTXID0, PRIV);
353-
if (sq_int_priv /*&& (kfd_set_dbg_ev_from_interrupt(dev, pasid,
353+
/*if (sq_int_priv && (kfd_set_dbg_ev_from_interrupt(dev, pasid,
354354
KFD_CTXID0_DOORBELL_ID(context_id0),
355355
KFD_CTXID0_TRAP_CODE(context_id0),
356-
NULL, 0))*/)
357-
return;
356+
NULL, 0)))
357+
return;*/
358358
break;
359359
case SQ_INTERRUPT_WORD_ENCODING_ERROR:
360360
print_sq_intr_info_error(context_id0, context_id1);

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ static void init_mqd(struct mqd_manager *mm, void **mqd,
126126
m->compute_static_thread_mgmt_se1 = 0xFFFFFFFF;
127127
m->compute_static_thread_mgmt_se2 = 0xFFFFFFFF;
128128
m->compute_static_thread_mgmt_se3 = 0xFFFFFFFF;
129+
m->compute_static_thread_mgmt_se4 = 0xFFFFFFFF;
130+
m->compute_static_thread_mgmt_se5 = 0xFFFFFFFF;
131+
m->compute_static_thread_mgmt_se6 = 0xFFFFFFFF;
132+
m->compute_static_thread_mgmt_se7 = 0xFFFFFFFF;
129133

130134
m->cp_hqd_persistent_state = CP_HQD_PERSISTENT_STATE__PRELOAD_REQ_MASK |
131135
0x55 << CP_HQD_PERSISTENT_STATE__PRELOAD_SIZE__SHIFT;

0 commit comments

Comments
 (0)