Skip to content

Commit 7e11e01

Browse files
committed
Merge tag 'amd-drm-next-6.17-2025-07-11' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.17-2025-07-11: amdgpu: - Clean up function signatures - GC 10 KGQ reset fix - SDMA reset cleanups - Misc fixes - LVDS fixes - UserQ fix amdkfd: - Reset fix Signed-off-by: Simona Vetter <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 3a252ff + a886d26 commit 7e11e01

26 files changed

+270
-239
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,16 +1562,16 @@ void amdgpu_device_program_register_sequence(struct amdgpu_device *adev,
15621562

15631563
int amdgpu_device_mode1_reset(struct amdgpu_device *adev);
15641564
int amdgpu_device_link_reset(struct amdgpu_device *adev);
1565-
bool amdgpu_device_supports_atpx(struct drm_device *dev);
1566-
bool amdgpu_device_supports_px(struct drm_device *dev);
1567-
bool amdgpu_device_supports_boco(struct drm_device *dev);
1568-
bool amdgpu_device_supports_smart_shift(struct drm_device *dev);
1569-
int amdgpu_device_supports_baco(struct drm_device *dev);
1565+
bool amdgpu_device_supports_atpx(struct amdgpu_device *adev);
1566+
bool amdgpu_device_supports_px(struct amdgpu_device *adev);
1567+
bool amdgpu_device_supports_boco(struct amdgpu_device *adev);
1568+
bool amdgpu_device_supports_smart_shift(struct amdgpu_device *adev);
1569+
int amdgpu_device_supports_baco(struct amdgpu_device *adev);
15701570
void amdgpu_device_detect_runtime_pm_mode(struct amdgpu_device *adev);
15711571
bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
15721572
struct amdgpu_device *peer_adev);
1573-
int amdgpu_device_baco_enter(struct drm_device *dev);
1574-
int amdgpu_device_baco_exit(struct drm_device *dev);
1573+
int amdgpu_device_baco_enter(struct amdgpu_device *adev);
1574+
int amdgpu_device_baco_exit(struct amdgpu_device *adev);
15751575

15761576
void amdgpu_device_flush_hdp(struct amdgpu_device *adev,
15771577
struct amdgpu_ring *ring);
@@ -1674,7 +1674,8 @@ int amdgpu_acpi_pcie_performance_request(struct amdgpu_device *adev,
16741674
u8 perf_req, bool advertise);
16751675
int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
16761676
u8 dev_state, bool drv_state);
1677-
int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_state);
1677+
int amdgpu_acpi_smart_shift_update(struct amdgpu_device *adev,
1678+
enum amdgpu_ss ss_state);
16781679
int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
16791680
int amdgpu_acpi_get_tmr_info(struct amdgpu_device *adev, u64 *tmr_offset,
16801681
u64 *tmr_size);
@@ -1705,8 +1706,11 @@ static inline void amdgpu_acpi_release(void) { }
17051706
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
17061707
static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
17071708
u8 dev_state, bool drv_state) { return 0; }
1708-
static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
1709-
enum amdgpu_ss ss_state) { return 0; }
1709+
static inline int amdgpu_acpi_smart_shift_update(struct amdgpu_device *adev,
1710+
enum amdgpu_ss ss_state)
1711+
{
1712+
return 0;
1713+
}
17101714
static inline void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps) { }
17111715
#endif
17121716

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,18 +811,18 @@ int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
811811
/**
812812
* amdgpu_acpi_smart_shift_update - update dGPU device state to SBIOS
813813
*
814-
* @dev: drm_device pointer
814+
* @adev: amdgpu device pointer
815815
* @ss_state: current smart shift event
816816
*
817817
* returns 0 on success,
818818
* otherwise return error number.
819819
*/
820-
int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_state)
820+
int amdgpu_acpi_smart_shift_update(struct amdgpu_device *adev,
821+
enum amdgpu_ss ss_state)
821822
{
822-
struct amdgpu_device *adev = drm_to_adev(dev);
823823
int r;
824824

825-
if (!amdgpu_device_supports_smart_shift(dev))
825+
if (!amdgpu_device_supports_smart_shift(adev))
826826
return 0;
827827

828828
switch (ss_state) {

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

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,16 @@ static const struct attribute_group amdgpu_board_attrs_group = {
411411

412412
static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
413413

414-
415414
/**
416415
* amdgpu_device_supports_px - Is the device a dGPU with ATPX power control
417416
*
418-
* @dev: drm_device pointer
417+
* @adev: amdgpu device pointer
419418
*
420419
* Returns true if the device is a dGPU with ATPX power control,
421420
* otherwise return false.
422421
*/
423-
bool amdgpu_device_supports_px(struct drm_device *dev)
422+
bool amdgpu_device_supports_px(struct amdgpu_device *adev)
424423
{
425-
struct amdgpu_device *adev = drm_to_adev(dev);
426-
427424
if ((adev->flags & AMD_IS_PX) && !amdgpu_is_atpx_hybrid())
428425
return true;
429426
return false;
@@ -432,15 +429,13 @@ bool amdgpu_device_supports_px(struct drm_device *dev)
432429
/**
433430
* amdgpu_device_supports_boco - Is the device a dGPU with ACPI power resources
434431
*
435-
* @dev: drm_device pointer
432+
* @adev: amdgpu device pointer
436433
*
437434
* Returns true if the device is a dGPU with ACPI power control,
438435
* otherwise return false.
439436
*/
440-
bool amdgpu_device_supports_boco(struct drm_device *dev)
437+
bool amdgpu_device_supports_boco(struct amdgpu_device *adev)
441438
{
442-
struct amdgpu_device *adev = drm_to_adev(dev);
443-
444439
if (!IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
445440
return false;
446441

@@ -453,29 +448,24 @@ bool amdgpu_device_supports_boco(struct drm_device *dev)
453448
/**
454449
* amdgpu_device_supports_baco - Does the device support BACO
455450
*
456-
* @dev: drm_device pointer
451+
* @adev: amdgpu device pointer
457452
*
458453
* Return:
459454
* 1 if the device supports BACO;
460455
* 3 if the device supports MACO (only works if BACO is supported)
461456
* otherwise return 0.
462457
*/
463-
int amdgpu_device_supports_baco(struct drm_device *dev)
458+
int amdgpu_device_supports_baco(struct amdgpu_device *adev)
464459
{
465-
struct amdgpu_device *adev = drm_to_adev(dev);
466-
467460
return amdgpu_asic_supports_baco(adev);
468461
}
469462

470463
void amdgpu_device_detect_runtime_pm_mode(struct amdgpu_device *adev)
471464
{
472-
struct drm_device *dev;
473465
int bamaco_support;
474466

475-
dev = adev_to_drm(adev);
476-
477467
adev->pm.rpm_mode = AMDGPU_RUNPM_NONE;
478-
bamaco_support = amdgpu_device_supports_baco(dev);
468+
bamaco_support = amdgpu_device_supports_baco(adev);
479469

480470
switch (amdgpu_runtime_pm) {
481471
case 2:
@@ -495,10 +485,12 @@ void amdgpu_device_detect_runtime_pm_mode(struct amdgpu_device *adev)
495485
break;
496486
case -1:
497487
case -2:
498-
if (amdgpu_device_supports_px(dev)) { /* enable PX as runtime mode */
488+
if (amdgpu_device_supports_px(adev)) {
489+
/* enable PX as runtime mode */
499490
adev->pm.rpm_mode = AMDGPU_RUNPM_PX;
500491
dev_info(adev->dev, "Using ATPX for runtime pm\n");
501-
} else if (amdgpu_device_supports_boco(dev)) { /* enable boco as runtime mode */
492+
} else if (amdgpu_device_supports_boco(adev)) {
493+
/* enable boco as runtime mode */
502494
adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
503495
dev_info(adev->dev, "Using BOCO for runtime pm\n");
504496
} else {
@@ -547,14 +539,14 @@ void amdgpu_device_detect_runtime_pm_mode(struct amdgpu_device *adev)
547539
* amdgpu_device_supports_smart_shift - Is the device dGPU with
548540
* smart shift support
549541
*
550-
* @dev: drm_device pointer
542+
* @adev: amdgpu device pointer
551543
*
552544
* Returns true if the device is a dGPU with Smart Shift support,
553545
* otherwise returns false.
554546
*/
555-
bool amdgpu_device_supports_smart_shift(struct drm_device *dev)
547+
bool amdgpu_device_supports_smart_shift(struct amdgpu_device *adev)
556548
{
557-
return (amdgpu_device_supports_boco(dev) &&
549+
return (amdgpu_device_supports_boco(adev) &&
558550
amdgpu_acpi_is_power_shift_control_supported());
559551
}
560552

@@ -2200,7 +2192,8 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev,
22002192
struct drm_device *dev = pci_get_drvdata(pdev);
22012193
int r;
22022194

2203-
if (amdgpu_device_supports_px(dev) && state == VGA_SWITCHEROO_OFF)
2195+
if (amdgpu_device_supports_px(drm_to_adev(dev)) &&
2196+
state == VGA_SWITCHEROO_OFF)
22042197
return;
22052198

22062199
if (state == VGA_SWITCHEROO_ON) {
@@ -4192,13 +4185,13 @@ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
41924185
if (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
41934186

41944187
task_barrier_enter(&hive->tb);
4195-
adev->asic_reset_res = amdgpu_device_baco_enter(adev_to_drm(adev));
4188+
adev->asic_reset_res = amdgpu_device_baco_enter(adev);
41964189

41974190
if (adev->asic_reset_res)
41984191
goto fail;
41994192

42004193
task_barrier_exit(&hive->tb);
4201-
adev->asic_reset_res = amdgpu_device_baco_exit(adev_to_drm(adev));
4194+
adev->asic_reset_res = amdgpu_device_baco_exit(adev);
42024195

42034196
if (adev->asic_reset_res)
42044197
goto fail;
@@ -4353,7 +4346,6 @@ static void amdgpu_device_set_mcbp(struct amdgpu_device *adev)
43534346
int amdgpu_device_init(struct amdgpu_device *adev,
43544347
uint32_t flags)
43554348
{
4356-
struct drm_device *ddev = adev_to_drm(adev);
43574349
struct pci_dev *pdev = adev->pdev;
43584350
int r, i;
43594351
bool px = false;
@@ -4814,7 +4806,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
48144806
if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
48154807
vga_client_register(adev->pdev, amdgpu_device_vga_set_decode);
48164808

4817-
px = amdgpu_device_supports_px(ddev);
4809+
px = amdgpu_device_supports_px(adev);
48184810

48194811
if (px || (!dev_is_removable(&adev->pdev->dev) &&
48204812
apple_gmux_detect(NULL, NULL)))
@@ -4980,7 +4972,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
49804972
kfree(adev->xcp_mgr);
49814973
adev->xcp_mgr = NULL;
49824974

4983-
px = amdgpu_device_supports_px(adev_to_drm(adev));
4975+
px = amdgpu_device_supports_px(adev);
49844976

49854977
if (px || (!dev_is_removable(&adev->pdev->dev) &&
49864978
apple_gmux_detect(NULL, NULL)))
@@ -5152,7 +5144,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
51525144
return r;
51535145
}
51545146

5155-
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D3))
5147+
if (amdgpu_acpi_smart_shift_update(adev, AMDGPU_SS_DEV_D3))
51565148
dev_warn(adev->dev, "smart shift update failed\n");
51575149

51585150
if (notify_clients)
@@ -5321,7 +5313,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)
53215313
}
53225314
adev->in_suspend = false;
53235315

5324-
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D0))
5316+
if (amdgpu_acpi_smart_shift_update(adev, AMDGPU_SS_DEV_D0))
53255317
dev_warn(adev->dev, "smart shift update failed\n");
53265318

53275319
return 0;
@@ -6365,7 +6357,8 @@ static int amdgpu_device_sched_resume(struct list_head *device_list,
63656357
amdgpu_vf_error_put(tmp_adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
63666358
} else {
63676359
dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter));
6368-
if (amdgpu_acpi_smart_shift_update(adev_to_drm(tmp_adev), AMDGPU_SS_DEV_D0))
6360+
if (amdgpu_acpi_smart_shift_update(tmp_adev,
6361+
AMDGPU_SS_DEV_D0))
63696362
dev_warn(tmp_adev->dev,
63706363
"smart shift update failed\n");
63716364
}
@@ -6839,12 +6832,11 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
68396832
#endif
68406833
}
68416834

6842-
int amdgpu_device_baco_enter(struct drm_device *dev)
6835+
int amdgpu_device_baco_enter(struct amdgpu_device *adev)
68436836
{
6844-
struct amdgpu_device *adev = drm_to_adev(dev);
68456837
struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
68466838

6847-
if (!amdgpu_device_supports_baco(dev))
6839+
if (!amdgpu_device_supports_baco(adev))
68486840
return -ENOTSUPP;
68496841

68506842
if (ras && adev->ras_enabled &&
@@ -6854,13 +6846,12 @@ int amdgpu_device_baco_enter(struct drm_device *dev)
68546846
return amdgpu_dpm_baco_enter(adev);
68556847
}
68566848

6857-
int amdgpu_device_baco_exit(struct drm_device *dev)
6849+
int amdgpu_device_baco_exit(struct amdgpu_device *adev)
68586850
{
6859-
struct amdgpu_device *adev = drm_to_adev(dev);
68606851
struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
68616852
int ret = 0;
68626853

6863-
if (!amdgpu_device_supports_baco(dev))
6854+
if (!amdgpu_device_supports_baco(adev))
68646855
return -ENOTSUPP;
68656856

68666857
ret = amdgpu_dpm_baco_exit(adev);

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,10 +2457,10 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
24572457

24582458
if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
24592459
/* only need to skip on ATPX */
2460-
if (amdgpu_device_supports_px(ddev))
2460+
if (amdgpu_device_supports_px(adev))
24612461
dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
24622462
/* we want direct complete for BOCO */
2463-
if (amdgpu_device_supports_boco(ddev))
2463+
if (amdgpu_device_supports_boco(adev))
24642464
dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
24652465
DPM_FLAG_SMART_SUSPEND |
24662466
DPM_FLAG_MAY_SKIP_RESUME);
@@ -2493,9 +2493,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
24932493
* into D0 state. Then there will be a PMFW-aware D-state
24942494
* transition(D0->D3) on runpm suspend.
24952495
*/
2496-
if (amdgpu_device_supports_baco(ddev) &&
2496+
if (amdgpu_device_supports_baco(adev) &&
24972497
!(adev->flags & AMD_IS_APU) &&
2498-
(adev->asic_type >= CHIP_NAVI10))
2498+
adev->asic_type >= CHIP_NAVI10)
24992499
amdgpu_get_secondary_funcs(adev);
25002500
}
25012501

@@ -2560,8 +2560,7 @@ static int amdgpu_pmops_prepare(struct device *dev)
25602560
/* Return a positive number here so
25612561
* DPM_FLAG_SMART_SUSPEND works properly
25622562
*/
2563-
if (amdgpu_device_supports_boco(drm_dev) &&
2564-
pm_runtime_suspended(dev))
2563+
if (amdgpu_device_supports_boco(adev) && pm_runtime_suspended(dev))
25652564
return 1;
25662565

25672566
/* if we will not support s3 or s2i for the device
@@ -2834,7 +2833,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
28342833
/* nothing to do */
28352834
} else if ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
28362835
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)) {
2837-
amdgpu_device_baco_enter(drm_dev);
2836+
amdgpu_device_baco_enter(adev);
28382837
}
28392838

28402839
dev_dbg(&pdev->dev, "asic/device is runtime suspended\n");
@@ -2875,7 +2874,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
28752874
pci_set_master(pdev);
28762875
} else if ((adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) ||
28772876
(adev->pm.rpm_mode == AMDGPU_RUNPM_BAMACO)) {
2878-
amdgpu_device_baco_exit(drm_dev);
2877+
amdgpu_device_baco_exit(adev);
28792878
}
28802879
ret = amdgpu_device_resume(drm_dev, false);
28812880
if (ret) {
@@ -2912,6 +2911,20 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)
29122911
return ret;
29132912
}
29142913

2914+
static int amdgpu_drm_release(struct inode *inode, struct file *filp)
2915+
{
2916+
struct drm_file *file_priv = filp->private_data;
2917+
struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
2918+
2919+
if (fpriv) {
2920+
fpriv->evf_mgr.fd_closing = true;
2921+
amdgpu_eviction_fence_destroy(&fpriv->evf_mgr);
2922+
amdgpu_userq_mgr_fini(&fpriv->userq_mgr);
2923+
}
2924+
2925+
return drm_release(inode, filp);
2926+
}
2927+
29152928
long amdgpu_drm_ioctl(struct file *filp,
29162929
unsigned int cmd, unsigned long arg)
29172930
{
@@ -2963,7 +2976,7 @@ static const struct file_operations amdgpu_driver_kms_fops = {
29632976
.owner = THIS_MODULE,
29642977
.open = drm_open,
29652978
.flush = amdgpu_flush,
2966-
.release = drm_release,
2979+
.release = amdgpu_drm_release,
29672980
.unlocked_ioctl = amdgpu_drm_ioctl,
29682981
.mmap = drm_gem_mmap,
29692982
.poll = drm_poll,

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
9191
if (adev->rmmio == NULL)
9292
return;
9393

94-
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_UNLOAD))
94+
if (amdgpu_acpi_smart_shift_update(adev, AMDGPU_SS_DRV_UNLOAD))
9595
DRM_WARN("smart shift update failed\n");
9696

9797
amdgpu_acpi_fini(adev);
@@ -161,7 +161,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
161161
if (acpi_status)
162162
dev_dbg(dev->dev, "Error during ACPI methods call\n");
163163

164-
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_LOAD))
164+
if (amdgpu_acpi_smart_shift_update(adev, AMDGPU_SS_DRV_LOAD))
165165
DRM_WARN("smart shift update failed\n");
166166

167167
out:
@@ -1503,9 +1503,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
15031503
amdgpu_vm_bo_del(adev, fpriv->prt_va);
15041504
amdgpu_bo_unreserve(pd);
15051505
}
1506-
fpriv->evf_mgr.fd_closing = true;
1507-
amdgpu_eviction_fence_destroy(&fpriv->evf_mgr);
1508-
amdgpu_userq_mgr_fini(&fpriv->userq_mgr);
15091506

15101507
amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr);
15111508
amdgpu_vm_fini(adev, &fpriv->vm);

0 commit comments

Comments
 (0)