Skip to content

Commit c925e99

Browse files
committed
Merge tag 'amd-drm-fixes-6.15-2025-04-16' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.15-2025-04-16: amdgpu: - Cleaner shader sysfs fix - Suspend fix - Fix doorbell free ordering - Video caps fix - DML2 memory allocation optimization - HDP fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents 8ffd015 + c235a71 commit c925e99

File tree

17 files changed

+66
-35
lines changed

17 files changed

+66
-35
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ struct amdgpu_device {
11231123
bool in_s3;
11241124
bool in_s4;
11251125
bool in_s0ix;
1126+
suspend_state_t last_suspend_state;
11261127

11271128
enum pp_mp1_state mp1_state;
11281129
struct amdgpu_doorbell_index doorbell_index;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3510,6 +3510,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
35103510
amdgpu_device_mem_scratch_fini(adev);
35113511
amdgpu_ib_pool_fini(adev);
35123512
amdgpu_seq64_fini(adev);
3513+
amdgpu_doorbell_fini(adev);
35133514
}
35143515
if (adev->ip_blocks[i].version->funcs->sw_fini) {
35153516
r = adev->ip_blocks[i].version->funcs->sw_fini(&adev->ip_blocks[i]);
@@ -4858,7 +4859,6 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
48584859

48594860
iounmap(adev->rmmio);
48604861
adev->rmmio = NULL;
4861-
amdgpu_doorbell_fini(adev);
48624862
drm_dev_exit(idx);
48634863
}
48644864

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2548,8 +2548,20 @@ static int amdgpu_pmops_suspend(struct device *dev)
25482548
adev->in_s0ix = true;
25492549
else if (amdgpu_acpi_is_s3_active(adev))
25502550
adev->in_s3 = true;
2551-
if (!adev->in_s0ix && !adev->in_s3)
2551+
if (!adev->in_s0ix && !adev->in_s3) {
2552+
/* don't allow going deep first time followed by s2idle the next time */
2553+
if (adev->last_suspend_state != PM_SUSPEND_ON &&
2554+
adev->last_suspend_state != pm_suspend_target_state) {
2555+
drm_err_once(drm_dev, "Unsupported suspend state %d\n",
2556+
pm_suspend_target_state);
2557+
return -EINVAL;
2558+
}
25522559
return 0;
2560+
}
2561+
2562+
/* cache the state last used for suspend */
2563+
adev->last_suspend_state = pm_suspend_target_state;
2564+
25532565
return amdgpu_device_suspend(drm_dev, true);
25542566
}
25552567

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,11 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
14381438
struct amdgpu_device *adev = ring->adev;
14391439
struct drm_gpu_scheduler *sched = &ring->sched;
14401440
struct drm_sched_entity entity;
1441+
static atomic_t counter;
14411442
struct dma_fence *f;
14421443
struct amdgpu_job *job;
14431444
struct amdgpu_ib *ib;
1445+
void *owner;
14441446
int i, r;
14451447

14461448
/* Initialize the scheduler entity */
@@ -1451,9 +1453,15 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
14511453
goto err;
14521454
}
14531455

1454-
r = amdgpu_job_alloc_with_ib(ring->adev, &entity, NULL,
1455-
64, 0,
1456-
&job);
1456+
/*
1457+
* Use some unique dummy value as the owner to make sure we execute
1458+
* the cleaner shader on each submission. The value just need to change
1459+
* for each submission and is otherwise meaningless.
1460+
*/
1461+
owner = (void *)(unsigned long)atomic_inc_return(&counter);
1462+
1463+
r = amdgpu_job_alloc_with_ib(ring->adev, &entity, owner,
1464+
64, 0, &job);
14571465
if (r)
14581466
goto err;
14591467

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6114,7 +6114,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev)
61146114
}
61156115

61166116
if (amdgpu_emu_mode == 1)
6117-
adev->hdp.funcs->flush_hdp(adev, NULL);
6117+
amdgpu_device_flush_hdp(adev, NULL);
61186118

61196119
tmp = RREG32_SOC15(GC, 0, mmCP_PFP_IC_BASE_CNTL);
61206120
tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0);
@@ -6192,7 +6192,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev)
61926192
}
61936193

61946194
if (amdgpu_emu_mode == 1)
6195-
adev->hdp.funcs->flush_hdp(adev, NULL);
6195+
amdgpu_device_flush_hdp(adev, NULL);
61966196

61976197
tmp = RREG32_SOC15(GC, 0, mmCP_CE_IC_BASE_CNTL);
61986198
tmp = REG_SET_FIELD(tmp, CP_CE_IC_BASE_CNTL, VMID, 0);
@@ -6269,7 +6269,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev)
62696269
}
62706270

62716271
if (amdgpu_emu_mode == 1)
6272-
adev->hdp.funcs->flush_hdp(adev, NULL);
6272+
amdgpu_device_flush_hdp(adev, NULL);
62736273

62746274
tmp = RREG32_SOC15(GC, 0, mmCP_ME_IC_BASE_CNTL);
62756275
tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0);
@@ -6644,7 +6644,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev)
66446644
}
66456645

66466646
if (amdgpu_emu_mode == 1)
6647-
adev->hdp.funcs->flush_hdp(adev, NULL);
6647+
amdgpu_device_flush_hdp(adev, NULL);
66486648

66496649
tmp = RREG32_SOC15(GC, 0, mmCP_CPC_IC_BASE_CNTL);
66506650
tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,7 +2428,7 @@ static int gfx_v11_0_config_me_cache(struct amdgpu_device *adev, uint64_t addr)
24282428
}
24292429

24302430
if (amdgpu_emu_mode == 1)
2431-
adev->hdp.funcs->flush_hdp(adev, NULL);
2431+
amdgpu_device_flush_hdp(adev, NULL);
24322432

24332433
tmp = RREG32_SOC15(GC, 0, regCP_ME_IC_BASE_CNTL);
24342434
tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0);
@@ -2472,7 +2472,7 @@ static int gfx_v11_0_config_pfp_cache(struct amdgpu_device *adev, uint64_t addr)
24722472
}
24732473

24742474
if (amdgpu_emu_mode == 1)
2475-
adev->hdp.funcs->flush_hdp(adev, NULL);
2475+
amdgpu_device_flush_hdp(adev, NULL);
24762476

24772477
tmp = RREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_CNTL);
24782478
tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0);
@@ -2517,7 +2517,7 @@ static int gfx_v11_0_config_mec_cache(struct amdgpu_device *adev, uint64_t addr)
25172517
}
25182518

25192519
if (amdgpu_emu_mode == 1)
2520-
adev->hdp.funcs->flush_hdp(adev, NULL);
2520+
amdgpu_device_flush_hdp(adev, NULL);
25212521

25222522
tmp = RREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_CNTL);
25232523
tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0);
@@ -3153,7 +3153,7 @@ static int gfx_v11_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)
31533153
amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj);
31543154

31553155
if (amdgpu_emu_mode == 1)
3156-
adev->hdp.funcs->flush_hdp(adev, NULL);
3156+
amdgpu_device_flush_hdp(adev, NULL);
31573157

31583158
WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO,
31593159
lower_32_bits(adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -3371,7 +3371,7 @@ static int gfx_v11_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)
33713371
amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj);
33723372

33733373
if (amdgpu_emu_mode == 1)
3374-
adev->hdp.funcs->flush_hdp(adev, NULL);
3374+
amdgpu_device_flush_hdp(adev, NULL);
33753375

33763376
WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO,
33773377
lower_32_bits(adev->gfx.me.me_fw_gpu_addr));
@@ -4541,7 +4541,7 @@ static int gfx_v11_0_gfxhub_enable(struct amdgpu_device *adev)
45414541
if (r)
45424542
return r;
45434543

4544-
adev->hdp.funcs->flush_hdp(adev, NULL);
4544+
amdgpu_device_flush_hdp(adev, NULL);
45454545

45464546
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
45474547
false : true;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,7 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)
23242324
amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj);
23252325

23262326
if (amdgpu_emu_mode == 1)
2327-
adev->hdp.funcs->flush_hdp(adev, NULL);
2327+
amdgpu_device_flush_hdp(adev, NULL);
23282328

23292329
WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO,
23302330
lower_32_bits(adev->gfx.pfp.pfp_fw_gpu_addr));
@@ -2468,7 +2468,7 @@ static int gfx_v12_0_cp_gfx_load_me_microcode_rs64(struct amdgpu_device *adev)
24682468
amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj);
24692469

24702470
if (amdgpu_emu_mode == 1)
2471-
adev->hdp.funcs->flush_hdp(adev, NULL);
2471+
amdgpu_device_flush_hdp(adev, NULL);
24722472

24732473
WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO,
24742474
lower_32_bits(adev->gfx.me.me_fw_gpu_addr));
@@ -3426,7 +3426,7 @@ static int gfx_v12_0_gfxhub_enable(struct amdgpu_device *adev)
34263426
if (r)
34273427
return r;
34283428

3429-
adev->hdp.funcs->flush_hdp(adev, NULL);
3429+
amdgpu_device_flush_hdp(adev, NULL);
34303430

34313431
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
34323432
false : true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
268268
ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
269269

270270
/* flush hdp cache */
271-
adev->hdp.funcs->flush_hdp(adev, NULL);
271+
amdgpu_device_flush_hdp(adev, NULL);
272272

273273
/* This is necessary for SRIOV as well as for GFXOFF to function
274274
* properly under bare metal
@@ -969,7 +969,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
969969
adev->hdp.funcs->init_registers(adev);
970970

971971
/* Flush HDP after it is initialized */
972-
adev->hdp.funcs->flush_hdp(adev, NULL);
972+
amdgpu_device_flush_hdp(adev, NULL);
973973

974974
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
975975
false : true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
229229
ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
230230

231231
/* flush hdp cache */
232-
adev->hdp.funcs->flush_hdp(adev, NULL);
232+
amdgpu_device_flush_hdp(adev, NULL);
233233

234234
/* This is necessary for SRIOV as well as for GFXOFF to function
235235
* properly under bare metal
@@ -899,7 +899,7 @@ static int gmc_v11_0_gart_enable(struct amdgpu_device *adev)
899899
return r;
900900

901901
/* Flush HDP after it is initialized */
902-
adev->hdp.funcs->flush_hdp(adev, NULL);
902+
amdgpu_device_flush_hdp(adev, NULL);
903903

904904
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
905905
false : true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
297297
return;
298298

299299
/* flush hdp cache */
300-
adev->hdp.funcs->flush_hdp(adev, NULL);
300+
amdgpu_device_flush_hdp(adev, NULL);
301301

302302
/* This is necessary for SRIOV as well as for GFXOFF to function
303303
* properly under bare metal
@@ -881,7 +881,7 @@ static int gmc_v12_0_gart_enable(struct amdgpu_device *adev)
881881
return r;
882882

883883
/* Flush HDP after it is initialized */
884-
adev->hdp.funcs->flush_hdp(adev, NULL);
884+
amdgpu_device_flush_hdp(adev, NULL);
885885

886886
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
887887
false : true;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ static int gmc_v9_0_hw_init(struct amdgpu_ip_block *ip_block)
24352435
adev->hdp.funcs->init_registers(adev);
24362436

24372437
/* After HDP is initialized, flush HDP.*/
2438-
adev->hdp.funcs->flush_hdp(adev, NULL);
2438+
amdgpu_device_flush_hdp(adev, NULL);
24392439

24402440
if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS)
24412441
value = false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops)
533533
}
534534

535535
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
536-
adev->hdp.funcs->flush_hdp(adev, NULL);
536+
amdgpu_device_flush_hdp(adev, NULL);
537537
vfree(buf);
538538
drm_dev_exit(idx);
539539
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static int psp_v13_0_memory_training(struct psp_context *psp, uint32_t ops)
610610
}
611611

612612
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
613-
adev->hdp.funcs->flush_hdp(adev, NULL);
613+
amdgpu_device_flush_hdp(adev, NULL);
614614
vfree(buf);
615615
drm_dev_exit(idx);
616616
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ static int psp_v14_0_memory_training(struct psp_context *psp, uint32_t ops)
498498
}
499499

500500
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
501-
adev->hdp.funcs->flush_hdp(adev, NULL);
501+
amdgpu_device_flush_hdp(adev, NULL);
502502
vfree(buf);
503503
drm_dev_exit(idx);
504504
} else {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ static const struct amdgpu_video_codec_info cz_video_codecs_decode_array[] =
239239
.max_pixels_per_frame = 4096 * 4096,
240240
.max_level = 186,
241241
},
242+
{
243+
.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG,
244+
.max_width = 4096,
245+
.max_height = 4096,
246+
.max_pixels_per_frame = 4096 * 4096,
247+
.max_level = 0,
248+
},
242249
};
243250

244251
static const struct amdgpu_video_codecs cz_video_codecs_decode =

drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//
33
// Copyright 2024 Advanced Micro Devices, Inc.
44

5+
#include <linux/vmalloc.h>
56

67
#include "dml2_internal_types.h"
78
#include "dml_top.h"
@@ -13,11 +14,11 @@
1314

1415
static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
1516
{
16-
*dml_ctx = kzalloc(sizeof(struct dml2_context), GFP_KERNEL);
17+
*dml_ctx = vzalloc(sizeof(struct dml2_context));
1718
if (!(*dml_ctx))
1819
return false;
1920

20-
(*dml_ctx)->v21.dml_init.dml2_instance = kzalloc(sizeof(struct dml2_instance), GFP_KERNEL);
21+
(*dml_ctx)->v21.dml_init.dml2_instance = vzalloc(sizeof(struct dml2_instance));
2122
if (!((*dml_ctx)->v21.dml_init.dml2_instance))
2223
return false;
2324

@@ -27,7 +28,7 @@ static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
2728
(*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config;
2829
(*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config;
2930

30-
(*dml_ctx)->v21.mode_programming.programming = kzalloc(sizeof(struct dml2_display_cfg_programming), GFP_KERNEL);
31+
(*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct dml2_display_cfg_programming));
3132
if (!((*dml_ctx)->v21.mode_programming.programming))
3233
return false;
3334

@@ -115,8 +116,8 @@ bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const s
115116

116117
void dml21_destroy(struct dml2_context *dml2)
117118
{
118-
kfree(dml2->v21.dml_init.dml2_instance);
119-
kfree(dml2->v21.mode_programming.programming);
119+
vfree(dml2->v21.dml_init.dml2_instance);
120+
vfree(dml2->v21.mode_programming.programming);
120121
}
121122

122123
static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,

drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*
2525
*/
2626

27+
#include <linux/vmalloc.h>
28+
2729
#include "display_mode_core.h"
2830
#include "dml2_internal_types.h"
2931
#include "dml2_utils.h"
@@ -747,7 +749,7 @@ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2
747749

748750
static inline struct dml2_context *dml2_allocate_memory(void)
749751
{
750-
return (struct dml2_context *) kzalloc(sizeof(struct dml2_context), GFP_KERNEL);
752+
return (struct dml2_context *) vzalloc(sizeof(struct dml2_context));
751753
}
752754

753755
static void dml2_init(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2)
@@ -821,7 +823,7 @@ void dml2_destroy(struct dml2_context *dml2)
821823

822824
if (dml2->architecture == dml2_architecture_21)
823825
dml21_destroy(dml2);
824-
kfree(dml2);
826+
vfree(dml2);
825827
}
826828

827829
void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,

0 commit comments

Comments
 (0)