mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
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 <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://lore.kernel.org/r/20250416223137.1146653-1-alexander.deucher@amd.com
This commit is contained in:
@@ -1123,6 +1123,7 @@ struct amdgpu_device {
|
||||
bool in_s3;
|
||||
bool in_s4;
|
||||
bool in_s0ix;
|
||||
suspend_state_t last_suspend_state;
|
||||
|
||||
enum pp_mp1_state mp1_state;
|
||||
struct amdgpu_doorbell_index doorbell_index;
|
||||
|
||||
@@ -3510,6 +3510,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
|
||||
amdgpu_device_mem_scratch_fini(adev);
|
||||
amdgpu_ib_pool_fini(adev);
|
||||
amdgpu_seq64_fini(adev);
|
||||
amdgpu_doorbell_fini(adev);
|
||||
}
|
||||
if (adev->ip_blocks[i].version->funcs->sw_fini) {
|
||||
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)
|
||||
|
||||
iounmap(adev->rmmio);
|
||||
adev->rmmio = NULL;
|
||||
amdgpu_doorbell_fini(adev);
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -2548,8 +2548,20 @@ static int amdgpu_pmops_suspend(struct device *dev)
|
||||
adev->in_s0ix = true;
|
||||
else if (amdgpu_acpi_is_s3_active(adev))
|
||||
adev->in_s3 = true;
|
||||
if (!adev->in_s0ix && !adev->in_s3)
|
||||
if (!adev->in_s0ix && !adev->in_s3) {
|
||||
/* don't allow going deep first time followed by s2idle the next time */
|
||||
if (adev->last_suspend_state != PM_SUSPEND_ON &&
|
||||
adev->last_suspend_state != pm_suspend_target_state) {
|
||||
drm_err_once(drm_dev, "Unsupported suspend state %d\n",
|
||||
pm_suspend_target_state);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* cache the state last used for suspend */
|
||||
adev->last_suspend_state = pm_suspend_target_state;
|
||||
|
||||
return amdgpu_device_suspend(drm_dev, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1438,9 +1438,11 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
struct drm_gpu_scheduler *sched = &ring->sched;
|
||||
struct drm_sched_entity entity;
|
||||
static atomic_t counter;
|
||||
struct dma_fence *f;
|
||||
struct amdgpu_job *job;
|
||||
struct amdgpu_ib *ib;
|
||||
void *owner;
|
||||
int i, r;
|
||||
|
||||
/* Initialize the scheduler entity */
|
||||
@@ -1451,9 +1453,15 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
|
||||
goto err;
|
||||
}
|
||||
|
||||
r = amdgpu_job_alloc_with_ib(ring->adev, &entity, NULL,
|
||||
64, 0,
|
||||
&job);
|
||||
/*
|
||||
* Use some unique dummy value as the owner to make sure we execute
|
||||
* the cleaner shader on each submission. The value just need to change
|
||||
* for each submission and is otherwise meaningless.
|
||||
*/
|
||||
owner = (void *)(unsigned long)atomic_inc_return(&counter);
|
||||
|
||||
r = amdgpu_job_alloc_with_ib(ring->adev, &entity, owner,
|
||||
64, 0, &job);
|
||||
if (r)
|
||||
goto err;
|
||||
|
||||
|
||||
@@ -6114,7 +6114,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmCP_PFP_IC_BASE_CNTL);
|
||||
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)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmCP_CE_IC_BASE_CNTL);
|
||||
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)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmCP_ME_IC_BASE_CNTL);
|
||||
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)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmCP_CPC_IC_BASE_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0);
|
||||
|
||||
@@ -2428,7 +2428,7 @@ static int gfx_v11_0_config_me_cache(struct amdgpu_device *adev, uint64_t addr)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regCP_ME_IC_BASE_CNTL);
|
||||
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)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_CNTL);
|
||||
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)
|
||||
}
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_CNTL);
|
||||
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)
|
||||
amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj);
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO,
|
||||
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)
|
||||
amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj);
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO,
|
||||
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)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
|
||||
false : true;
|
||||
|
||||
@@ -2324,7 +2324,7 @@ static int gfx_v12_0_cp_gfx_load_pfp_microcode_rs64(struct amdgpu_device *adev)
|
||||
amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj);
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO,
|
||||
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)
|
||||
amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj);
|
||||
|
||||
if (amdgpu_emu_mode == 1)
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO,
|
||||
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)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
|
||||
false : true;
|
||||
|
||||
@@ -268,7 +268,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
|
||||
|
||||
/* flush hdp cache */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
/* This is necessary for SRIOV as well as for GFXOFF to function
|
||||
* properly under bare metal
|
||||
@@ -969,7 +969,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
|
||||
adev->hdp.funcs->init_registers(adev);
|
||||
|
||||
/* Flush HDP after it is initialized */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
|
||||
false : true;
|
||||
|
||||
@@ -229,7 +229,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
|
||||
|
||||
/* flush hdp cache */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
/* This is necessary for SRIOV as well as for GFXOFF to function
|
||||
* properly under bare metal
|
||||
@@ -899,7 +899,7 @@ static int gmc_v11_0_gart_enable(struct amdgpu_device *adev)
|
||||
return r;
|
||||
|
||||
/* Flush HDP after it is initialized */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
|
||||
false : true;
|
||||
|
||||
@@ -297,7 +297,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
return;
|
||||
|
||||
/* flush hdp cache */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
/* This is necessary for SRIOV as well as for GFXOFF to function
|
||||
* properly under bare metal
|
||||
@@ -881,7 +881,7 @@ static int gmc_v12_0_gart_enable(struct amdgpu_device *adev)
|
||||
return r;
|
||||
|
||||
/* Flush HDP after it is initialized */
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ?
|
||||
false : true;
|
||||
|
||||
@@ -2435,7 +2435,7 @@ static int gmc_v9_0_hw_init(struct amdgpu_ip_block *ip_block)
|
||||
adev->hdp.funcs->init_registers(adev);
|
||||
|
||||
/* After HDP is initialized, flush HDP.*/
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
|
||||
if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS)
|
||||
value = false;
|
||||
|
||||
@@ -533,7 +533,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops)
|
||||
}
|
||||
|
||||
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
vfree(buf);
|
||||
drm_dev_exit(idx);
|
||||
} else {
|
||||
|
||||
@@ -610,7 +610,7 @@ static int psp_v13_0_memory_training(struct psp_context *psp, uint32_t ops)
|
||||
}
|
||||
|
||||
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
vfree(buf);
|
||||
drm_dev_exit(idx);
|
||||
} else {
|
||||
|
||||
@@ -498,7 +498,7 @@ static int psp_v14_0_memory_training(struct psp_context *psp, uint32_t ops)
|
||||
}
|
||||
|
||||
memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
|
||||
adev->hdp.funcs->flush_hdp(adev, NULL);
|
||||
amdgpu_device_flush_hdp(adev, NULL);
|
||||
vfree(buf);
|
||||
drm_dev_exit(idx);
|
||||
} else {
|
||||
|
||||
@@ -239,6 +239,13 @@ static const struct amdgpu_video_codec_info cz_video_codecs_decode_array[] =
|
||||
.max_pixels_per_frame = 4096 * 4096,
|
||||
.max_level = 186,
|
||||
},
|
||||
{
|
||||
.codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG,
|
||||
.max_width = 4096,
|
||||
.max_height = 4096,
|
||||
.max_pixels_per_frame = 4096 * 4096,
|
||||
.max_level = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct amdgpu_video_codecs cz_video_codecs_decode =
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
//
|
||||
// Copyright 2024 Advanced Micro Devices, Inc.
|
||||
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "dml2_internal_types.h"
|
||||
#include "dml_top.h"
|
||||
@@ -13,11 +14,11 @@
|
||||
|
||||
static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
|
||||
{
|
||||
*dml_ctx = kzalloc(sizeof(struct dml2_context), GFP_KERNEL);
|
||||
*dml_ctx = vzalloc(sizeof(struct dml2_context));
|
||||
if (!(*dml_ctx))
|
||||
return false;
|
||||
|
||||
(*dml_ctx)->v21.dml_init.dml2_instance = kzalloc(sizeof(struct dml2_instance), GFP_KERNEL);
|
||||
(*dml_ctx)->v21.dml_init.dml2_instance = vzalloc(sizeof(struct dml2_instance));
|
||||
if (!((*dml_ctx)->v21.dml_init.dml2_instance))
|
||||
return false;
|
||||
|
||||
@@ -27,7 +28,7 @@ static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
|
||||
(*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config;
|
||||
(*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config;
|
||||
|
||||
(*dml_ctx)->v21.mode_programming.programming = kzalloc(sizeof(struct dml2_display_cfg_programming), GFP_KERNEL);
|
||||
(*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct dml2_display_cfg_programming));
|
||||
if (!((*dml_ctx)->v21.mode_programming.programming))
|
||||
return false;
|
||||
|
||||
@@ -115,8 +116,8 @@ bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const s
|
||||
|
||||
void dml21_destroy(struct dml2_context *dml2)
|
||||
{
|
||||
kfree(dml2->v21.dml_init.dml2_instance);
|
||||
kfree(dml2->v21.mode_programming.programming);
|
||||
vfree(dml2->v21.dml_init.dml2_instance);
|
||||
vfree(dml2->v21.mode_programming.programming);
|
||||
}
|
||||
|
||||
static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "display_mode_core.h"
|
||||
#include "dml2_internal_types.h"
|
||||
#include "dml2_utils.h"
|
||||
@@ -747,7 +749,7 @@ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2
|
||||
|
||||
static inline struct dml2_context *dml2_allocate_memory(void)
|
||||
{
|
||||
return (struct dml2_context *) kzalloc(sizeof(struct dml2_context), GFP_KERNEL);
|
||||
return (struct dml2_context *) vzalloc(sizeof(struct dml2_context));
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if (dml2->architecture == dml2_architecture_21)
|
||||
dml21_destroy(dml2);
|
||||
kfree(dml2);
|
||||
vfree(dml2);
|
||||
}
|
||||
|
||||
void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
|
||||
|
||||
Reference in New Issue
Block a user