Skip to content

Commit f4c41a7

Browse files
committed
Merge tag 'amd-drm-fixes-6.4-2023-05-03' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-fixes-6.4-2023-05-03: amdgpu: - GPU reset fixes - Doorbell fix when resizing BARs - Fix spurious warnings in gmc - Locking fix for AMDGPU_SCHED IOCTL - SR-IOV fix - DCN 3.1.4 fix - DCN 3.2 fix - Fix job cleanup when CS is aborted Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230504034018.7950-1-alexander.deucher@amd.com
2 parents fa0d9c0 + 1253685 commit f4c41a7

14 files changed

Lines changed: 78 additions & 53 deletions

File tree

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
12761276
r = drm_sched_job_add_dependency(&leader->base, fence);
12771277
if (r) {
12781278
dma_fence_put(fence);
1279-
goto error_cleanup;
1279+
return r;
12801280
}
12811281
}
12821282

@@ -1303,7 +1303,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
13031303
}
13041304
if (r) {
13051305
r = -EAGAIN;
1306-
goto error_unlock;
1306+
mutex_unlock(&p->adev->notifier_lock);
1307+
return r;
13071308
}
13081309

13091310
p->fence = dma_fence_get(&leader->base.s_fence->finished);
@@ -1350,14 +1351,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
13501351
mutex_unlock(&p->adev->notifier_lock);
13511352
mutex_unlock(&p->bo_list->bo_list_mutex);
13521353
return 0;
1353-
1354-
error_unlock:
1355-
mutex_unlock(&p->adev->notifier_lock);
1356-
1357-
error_cleanup:
1358-
for (i = 0; i < p->gang_size; ++i)
1359-
drm_sched_job_cleanup(&p->jobs[i]->base);
1360-
return r;
13611354
}
13621355

13631356
/* Cleanup the parser structure */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,6 +3578,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
35783578
int r, i;
35793579
bool px = false;
35803580
u32 max_MBps;
3581+
int tmp;
35813582

35823583
adev->shutdown = false;
35833584
adev->flags = flags;
@@ -3799,7 +3800,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
37993800
}
38003801
}
38013802
} else {
3803+
tmp = amdgpu_reset_method;
3804+
/* It should do a default reset when loading or reloading the driver,
3805+
* regardless of the module parameter reset_method.
3806+
*/
3807+
amdgpu_reset_method = AMD_RESET_METHOD_NONE;
38023808
r = amdgpu_asic_reset(adev);
3809+
amdgpu_reset_method = tmp;
38033810
if (r) {
38043811
dev_err(adev->dev, "asic reset on init failed\n");
38053812
goto failed;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
3838
{
3939
struct fd f = fdget(fd);
4040
struct amdgpu_fpriv *fpriv;
41+
struct amdgpu_ctx_mgr *mgr;
4142
struct amdgpu_ctx *ctx;
4243
uint32_t id;
4344
int r;
@@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
5152
return r;
5253
}
5354

54-
idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
55+
mgr = &fpriv->ctx_mgr;
56+
mutex_lock(&mgr->lock);
57+
idr_for_each_entry(&mgr->ctx_handles, ctx, id)
5558
amdgpu_ctx_priority_override(ctx, priority);
59+
mutex_unlock(&mgr->lock);
5660

5761
fdput(f);
5862
return 0;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,6 @@ static int gmc_v10_0_hw_fini(void *handle)
11431143
return 0;
11441144
}
11451145

1146-
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
11471146
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
11481147

11491148
return 0;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ static int gmc_v11_0_hw_fini(void *handle)
951951
return 0;
952952
}
953953

954-
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
955954
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
956955
gmc_v11_0_gart_disable(adev);
957956

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,6 @@ static int gmc_v9_0_hw_fini(void *handle)
19991999
if (adev->mmhub.funcs->update_power_gating)
20002000
adev->mmhub.funcs->update_power_gating(adev, false);
20012001

2002-
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
20032002
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
20042003

20052004
return 0;

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,6 @@ static void nv_program_aspm(struct amdgpu_device *adev)
531531

532532
}
533533

534-
static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
535-
bool enable)
536-
{
537-
adev->nbio.funcs->enable_doorbell_aperture(adev, enable);
538-
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);
539-
}
540-
541534
const struct amdgpu_ip_block_version nv_common_ip_block =
542535
{
543536
.type = AMD_IP_BLOCK_TYPE_COMMON,
@@ -999,6 +992,11 @@ static int nv_common_late_init(void *handle)
999992
}
1000993
}
1001994

995+
/* Enable selfring doorbell aperture late because doorbell BAR
996+
* aperture will change if resize BAR successfully in gmc sw_init.
997+
*/
998+
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, true);
999+
10021000
return 0;
10031001
}
10041002

@@ -1038,7 +1036,7 @@ static int nv_common_hw_init(void *handle)
10381036
if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev))
10391037
adev->nbio.funcs->remap_hdp_registers(adev);
10401038
/* enable the doorbell aperture */
1041-
nv_enable_doorbell_aperture(adev, true);
1039+
adev->nbio.funcs->enable_doorbell_aperture(adev, true);
10421040

10431041
return 0;
10441042
}
@@ -1047,8 +1045,13 @@ static int nv_common_hw_fini(void *handle)
10471045
{
10481046
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
10491047

1050-
/* disable the doorbell aperture */
1051-
nv_enable_doorbell_aperture(adev, false);
1048+
/* Disable the doorbell aperture and selfring doorbell aperture
1049+
* separately in hw_fini because nv_enable_doorbell_aperture
1050+
* has been removed and there is no need to delay disabling
1051+
* selfring doorbell.
1052+
*/
1053+
adev->nbio.funcs->enable_doorbell_aperture(adev, false);
1054+
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, false);
10521055

10531056
return 0;
10541057
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,7 @@ static int sdma_v6_0_gfx_resume(struct amdgpu_device *adev)
510510
lower_32_bits(ring->rptr_gpu_addr) & 0xFFFFFFFC);
511511

512512
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_QUEUE0_RB_CNTL, RPTR_WRITEBACK_ENABLE, 1);
513-
if (amdgpu_sriov_vf(adev))
514-
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_QUEUE0_RB_CNTL, WPTR_POLL_ENABLE, 1);
515-
else
516-
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_QUEUE0_RB_CNTL, WPTR_POLL_ENABLE, 0);
513+
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_QUEUE0_RB_CNTL, WPTR_POLL_ENABLE, 0);
517514
rb_cntl = REG_SET_FIELD(rb_cntl, SDMA0_QUEUE0_RB_CNTL, F32_WPTR_POLL_ENABLE, 1);
518515

519516
WREG32_SOC15_IP(GC, sdma_v6_0_get_reg_offset(adev, i, regSDMA0_QUEUE0_RB_BASE), ring->gpu_addr >> 8);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static bool sienna_cichlid_is_mode2_default(struct amdgpu_reset_control *reset_c
4040
adev->pm.fw_version >= 0x3a5500 && !amdgpu_sriov_vf(adev))
4141
return true;
4242
#endif
43-
return false;
43+
return amdgpu_reset_method == AMD_RESET_METHOD_MODE2;
4444
}
4545

4646
static struct amdgpu_reset_handler *

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,6 @@ static void soc15_program_aspm(struct amdgpu_device *adev)
619619
adev->nbio.funcs->program_aspm(adev);
620620
}
621621

622-
static void soc15_enable_doorbell_aperture(struct amdgpu_device *adev,
623-
bool enable)
624-
{
625-
adev->nbio.funcs->enable_doorbell_aperture(adev, enable);
626-
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);
627-
}
628-
629622
const struct amdgpu_ip_block_version vega10_common_ip_block =
630623
{
631624
.type = AMD_IP_BLOCK_TYPE_COMMON,
@@ -1125,6 +1118,11 @@ static int soc15_common_late_init(void *handle)
11251118
if (amdgpu_sriov_vf(adev))
11261119
xgpu_ai_mailbox_get_irq(adev);
11271120

1121+
/* Enable selfring doorbell aperture late because doorbell BAR
1122+
* aperture will change if resize BAR successfully in gmc sw_init.
1123+
*/
1124+
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, true);
1125+
11281126
return 0;
11291127
}
11301128

@@ -1182,7 +1180,8 @@ static int soc15_common_hw_init(void *handle)
11821180
adev->nbio.funcs->remap_hdp_registers(adev);
11831181

11841182
/* enable the doorbell aperture */
1185-
soc15_enable_doorbell_aperture(adev, true);
1183+
adev->nbio.funcs->enable_doorbell_aperture(adev, true);
1184+
11861185
/* HW doorbell routing policy: doorbell writing not
11871186
* in SDMA/IH/MM/ACV range will be routed to CP. So
11881187
* we need to init SDMA doorbell range prior
@@ -1198,8 +1197,14 @@ static int soc15_common_hw_fini(void *handle)
11981197
{
11991198
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
12001199

1201-
/* disable the doorbell aperture */
1202-
soc15_enable_doorbell_aperture(adev, false);
1200+
/* Disable the doorbell aperture and selfring doorbell aperture
1201+
* separately in hw_fini because soc15_enable_doorbell_aperture
1202+
* has been removed and there is no need to delay disabling
1203+
* selfring doorbell.
1204+
*/
1205+
adev->nbio.funcs->enable_doorbell_aperture(adev, false);
1206+
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, false);
1207+
12031208
if (amdgpu_sriov_vf(adev))
12041209
xgpu_ai_mailbox_put_irq(adev);
12051210

0 commit comments

Comments
 (0)