mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
Merge tag 'amd-drm-next-6.3-2023-01-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.3-2023-01-13: amdgpu: - Fix possible segfault in failure case - Rework FW requests to happen in early_init for all IPs so that we don't lose the sbios console if FW is missing - PSR fixes - Misc cleanups - Unload fix - SMU13 fixes amdkfd: - Fix for cleared VRAM BOs - Fix cleanup if GPUVM creation fails - Memory accounting fix - Use resource_size rather than open codeing it - GC11 mGPU fix radeon: - Fix memory leak on shutdown Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230113225911.7776-1-alexander.deucher@amd.com
This commit is contained in:
commit
1f1c24dee2
@ -97,7 +97,7 @@ struct amdgpu_amdkfd_fence {
|
||||
|
||||
struct amdgpu_kfd_dev {
|
||||
struct kfd_dev *dev;
|
||||
uint64_t vram_used;
|
||||
int64_t vram_used;
|
||||
uint64_t vram_used_aligned;
|
||||
bool init_complete;
|
||||
struct work_struct reset_work;
|
||||
@ -271,9 +271,9 @@ int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct amdgpu_device *adev, bool is_
|
||||
((struct drm_file *)(drm_priv))->driver_priv)->vm)
|
||||
|
||||
int amdgpu_amdkfd_gpuvm_set_vm_pasid(struct amdgpu_device *adev,
|
||||
struct file *filp, u32 pasid);
|
||||
struct amdgpu_vm *avm, u32 pasid);
|
||||
int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct amdgpu_device *adev,
|
||||
struct file *filp,
|
||||
struct amdgpu_vm *avm,
|
||||
void **process_info,
|
||||
struct dma_fence **ef);
|
||||
void amdgpu_amdkfd_gpuvm_release_process_vm(struct amdgpu_device *adev,
|
||||
|
@ -1431,18 +1431,11 @@ static void amdgpu_amdkfd_gpuvm_unpin_bo(struct amdgpu_bo *bo)
|
||||
}
|
||||
|
||||
int amdgpu_amdkfd_gpuvm_set_vm_pasid(struct amdgpu_device *adev,
|
||||
struct file *filp, u32 pasid)
|
||||
struct amdgpu_vm *avm, u32 pasid)
|
||||
|
||||
{
|
||||
struct amdgpu_fpriv *drv_priv;
|
||||
struct amdgpu_vm *avm;
|
||||
int ret;
|
||||
|
||||
ret = amdgpu_file_to_fpriv(filp, &drv_priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
avm = &drv_priv->vm;
|
||||
|
||||
/* Free the original amdgpu allocated pasid,
|
||||
* will be replaced with kfd allocated pasid.
|
||||
*/
|
||||
@ -1459,19 +1452,12 @@ int amdgpu_amdkfd_gpuvm_set_vm_pasid(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
int amdgpu_amdkfd_gpuvm_acquire_process_vm(struct amdgpu_device *adev,
|
||||
struct file *filp,
|
||||
struct amdgpu_vm *avm,
|
||||
void **process_info,
|
||||
struct dma_fence **ef)
|
||||
{
|
||||
struct amdgpu_fpriv *drv_priv;
|
||||
struct amdgpu_vm *avm;
|
||||
int ret;
|
||||
|
||||
ret = amdgpu_file_to_fpriv(filp, &drv_priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
avm = &drv_priv->vm;
|
||||
|
||||
/* Already a compute VM? */
|
||||
if (avm->process_info)
|
||||
return -EINVAL;
|
||||
@ -1613,6 +1599,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
|
||||
struct amdgpu_bo *bo;
|
||||
struct drm_gem_object *gobj = NULL;
|
||||
u32 domain, alloc_domain;
|
||||
uint64_t aligned_size;
|
||||
u64 alloc_flags;
|
||||
int ret;
|
||||
|
||||
@ -1668,22 +1655,23 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
|
||||
* the memory.
|
||||
*/
|
||||
if ((*mem)->aql_queue)
|
||||
size = size >> 1;
|
||||
size >>= 1;
|
||||
aligned_size = PAGE_ALIGN(size);
|
||||
|
||||
(*mem)->alloc_flags = flags;
|
||||
|
||||
amdgpu_sync_create(&(*mem)->sync);
|
||||
|
||||
ret = amdgpu_amdkfd_reserve_mem_limit(adev, size, flags);
|
||||
ret = amdgpu_amdkfd_reserve_mem_limit(adev, aligned_size, flags);
|
||||
if (ret) {
|
||||
pr_debug("Insufficient memory\n");
|
||||
goto err_reserve_limit;
|
||||
}
|
||||
|
||||
pr_debug("\tcreate BO VA 0x%llx size 0x%llx domain %s\n",
|
||||
va, size, domain_string(alloc_domain));
|
||||
va, (*mem)->aql_queue ? size << 1 : size, domain_string(alloc_domain));
|
||||
|
||||
ret = amdgpu_gem_object_create(adev, size, 1, alloc_domain, alloc_flags,
|
||||
ret = amdgpu_gem_object_create(adev, aligned_size, 1, alloc_domain, alloc_flags,
|
||||
bo_type, NULL, &gobj);
|
||||
if (ret) {
|
||||
pr_debug("Failed to create BO on domain %s. ret %d\n",
|
||||
@ -1740,7 +1728,7 @@ err_node_allow:
|
||||
/* Don't unreserve system mem limit twice */
|
||||
goto err_reserve_limit;
|
||||
err_bo_create:
|
||||
amdgpu_amdkfd_unreserve_mem_limit(adev, size, flags);
|
||||
amdgpu_amdkfd_unreserve_mem_limit(adev, aligned_size, flags);
|
||||
err_reserve_limit:
|
||||
mutex_destroy(&(*mem)->lock);
|
||||
if (gobj)
|
||||
@ -2100,7 +2088,7 @@ int amdgpu_amdkfd_map_gtt_bo_to_gart(struct amdgpu_device *adev, struct amdgpu_b
|
||||
}
|
||||
|
||||
amdgpu_amdkfd_remove_eviction_fence(
|
||||
bo, bo->kfd_bo->process_info->eviction_fence);
|
||||
bo, bo->vm_bo->vm->process_info->eviction_fence);
|
||||
|
||||
amdgpu_bo_unreserve(bo);
|
||||
|
||||
|
@ -411,17 +411,10 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
DRM_ERROR("Failed to request firmware\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = amdgpu_ucode_validate(adev->pm.fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
|
||||
if (err) {
|
||||
DRM_ERROR("Failed to load firmware \"%s\"", fw_name);
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <generated/utsrelease.h>
|
||||
#include <linux/pci-p2pdma.h>
|
||||
|
||||
#include <drm/drm_aperture.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
@ -90,6 +91,8 @@ MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
|
||||
#define AMDGPU_MAX_RETRY_LIMIT 2
|
||||
#define AMDGPU_RETRY_SRIOV_RESET(r) ((r) == -EBUSY || (r) == -ETIMEDOUT || (r) == -EINVAL)
|
||||
|
||||
static const struct drm_driver amdgpu_kms_driver;
|
||||
|
||||
const char *amdgpu_asic_name[] = {
|
||||
"TAHITI",
|
||||
"PITCAIRN",
|
||||
@ -1982,17 +1985,10 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name);
|
||||
err = request_firmware(&adev->firmware.gpu_info_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->firmware.gpu_info_fw, fw_name);
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"Failed to load gpu_info firmware \"%s\"\n",
|
||||
fw_name);
|
||||
goto out;
|
||||
}
|
||||
err = amdgpu_ucode_validate(adev->firmware.gpu_info_fw);
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"Failed to validate gpu_info firmware \"%s\"\n",
|
||||
"Failed to get gpu_info firmware \"%s\"\n",
|
||||
fw_name);
|
||||
goto out;
|
||||
}
|
||||
@ -3688,6 +3684,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* Get rid of things like offb */
|
||||
r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* Enable TMZ based on IP_VERSION */
|
||||
amdgpu_gmc_tmz_set(adev);
|
||||
|
||||
@ -4023,8 +4024,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||
|
||||
amdgpu_fence_driver_sw_fini(adev);
|
||||
amdgpu_device_ip_fini(adev);
|
||||
release_firmware(adev->firmware.gpu_info_fw);
|
||||
adev->firmware.gpu_info_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->firmware.gpu_info_fw);
|
||||
adev->accel_working = false;
|
||||
dma_fence_put(rcu_dereference_protected(adev->gang_submit, true));
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include <drm/drm_aperture.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_fbdev_generic.h>
|
||||
#include <drm/drm_gem.h>
|
||||
@ -2124,11 +2123,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get rid of things like offb */
|
||||
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &amdgpu_kms_driver);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
adev = devm_drm_dev_alloc(&pdev->dev, &amdgpu_kms_driver, typeof(*adev), ddev);
|
||||
if (IS_ERR(adev))
|
||||
return PTR_ERR(adev);
|
||||
|
@ -62,10 +62,10 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf)
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
|
||||
TTM_BO_VM_NUM_PREFAULT);
|
||||
ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
|
||||
TTM_BO_VM_NUM_PREFAULT);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
drm_dev_exit(idx);
|
||||
} else {
|
||||
ret = ttm_bo_vm_dummy_page(vmf, vmf->vma->vm_page_prot);
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/firmware.h>
|
||||
|
||||
#include "amdgpu_mes.h"
|
||||
#include "amdgpu.h"
|
||||
#include "soc15_common.h"
|
||||
@ -1423,3 +1425,60 @@ error_pasid:
|
||||
kfree(vm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
|
||||
{
|
||||
const struct mes_firmware_header_v1_0 *mes_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
char ucode_prefix[30];
|
||||
char fw_name[40];
|
||||
int r;
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
|
||||
ucode_prefix,
|
||||
pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
|
||||
r = amdgpu_ucode_request(adev, &adev->mes.fw[pipe], fw_name);
|
||||
if (r)
|
||||
goto out;
|
||||
|
||||
mes_hdr = (const struct mes_firmware_header_v1_0 *)
|
||||
adev->mes.fw[pipe]->data;
|
||||
adev->mes.uc_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32);
|
||||
adev->mes.data_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_data_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
int ucode, ucode_data;
|
||||
|
||||
if (pipe == AMDGPU_MES_SCHED_PIPE) {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA;
|
||||
} else {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES1;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
}
|
||||
|
||||
info = &adev->firmware.ucode[ucode];
|
||||
info->ucode_id = ucode;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes),
|
||||
PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[ucode_data];
|
||||
info->ucode_id = ucode_data;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes),
|
||||
PAGE_SIZE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
amdgpu_ucode_release(&adev->mes.fw[pipe]);
|
||||
return r;
|
||||
}
|
||||
|
@ -306,6 +306,7 @@ struct amdgpu_mes_funcs {
|
||||
|
||||
int amdgpu_mes_ctx_get_offs(struct amdgpu_ring *ring, unsigned int id_offs);
|
||||
|
||||
int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe);
|
||||
int amdgpu_mes_init(struct amdgpu_device *adev);
|
||||
void amdgpu_mes_fini(struct amdgpu_device *adev);
|
||||
|
||||
|
@ -470,8 +470,9 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
|
||||
return true;
|
||||
|
||||
fail:
|
||||
DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
|
||||
man->size);
|
||||
if (man)
|
||||
DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
|
||||
man->size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,38 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp
|
||||
}
|
||||
}
|
||||
|
||||
static int psp_init_sriov_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char ucode_prefix[30];
|
||||
int ret = 0;
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, ucode_prefix);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, ucode_prefix);
|
||||
ret &= psp_init_ta_microcode(psp, ucode_prefix);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 0):
|
||||
adev->virt.autoload_ucode_id = 0;
|
||||
break;
|
||||
case IP_VERSION(13, 0, 10):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int psp_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@ -193,7 +225,10 @@ static int psp_early_init(void *handle)
|
||||
|
||||
psp_check_pmfw_centralized_cstate_management(psp);
|
||||
|
||||
return 0;
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return psp_init_sriov_microcode(psp);
|
||||
else
|
||||
return psp_init_microcode(psp);
|
||||
}
|
||||
|
||||
void psp_ta_free_shared_buf(struct ta_mem_context *mem_ctx)
|
||||
@ -351,42 +386,6 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int psp_init_sriov_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
int ret = 0;
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, "vega10");
|
||||
break;
|
||||
case IP_VERSION(11, 0, 9):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, "navi12");
|
||||
break;
|
||||
case IP_VERSION(11, 0, 7):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, "sienna_cichlid");
|
||||
break;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
ret = psp_init_cap_microcode(psp, "aldebaran");
|
||||
ret &= psp_init_ta_microcode(psp, "aldebaran");
|
||||
break;
|
||||
case IP_VERSION(13, 0, 0):
|
||||
adev->virt.autoload_ucode_id = 0;
|
||||
break;
|
||||
case IP_VERSION(13, 0, 10):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int psp_sw_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@ -402,15 +401,6 @@ static int psp_sw_init(void *handle)
|
||||
ret = -ENOMEM;
|
||||
}
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
ret = psp_init_sriov_microcode(psp);
|
||||
else
|
||||
ret = psp_init_microcode(psp);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to load psp firmware!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
adev->psp.xgmi_context.supports_extended_data =
|
||||
!adev->gmc.xgmi.connected_to_cpu &&
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2);
|
||||
@ -515,20 +505,11 @@ static int psp_sw_fini(void *handle)
|
||||
|
||||
psp_memory_training_fini(psp);
|
||||
|
||||
release_firmware(psp->sos_fw);
|
||||
psp->sos_fw = NULL;
|
||||
|
||||
release_firmware(psp->asd_fw);
|
||||
psp->asd_fw = NULL;
|
||||
|
||||
release_firmware(psp->ta_fw);
|
||||
psp->ta_fw = NULL;
|
||||
|
||||
release_firmware(psp->cap_fw);
|
||||
psp->cap_fw = NULL;
|
||||
|
||||
release_firmware(psp->toc_fw);
|
||||
psp->toc_fw = NULL;
|
||||
amdgpu_ucode_release(&psp->sos_fw);
|
||||
amdgpu_ucode_release(&psp->asd_fw);
|
||||
amdgpu_ucode_release(&psp->ta_fw);
|
||||
amdgpu_ucode_release(&psp->cap_fw);
|
||||
amdgpu_ucode_release(&psp->toc_fw);
|
||||
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
|
||||
@ -2914,25 +2895,15 @@ int psp_ring_cmd_submit(struct psp_context *psp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int psp_init_asd_microcode(struct psp_context *psp,
|
||||
const char *chip_name)
|
||||
int psp_init_asd_microcode(struct psp_context *psp, const char *chip_name)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
const struct psp_firmware_header_v1_0 *asd_hdr;
|
||||
int err = 0;
|
||||
|
||||
if (!chip_name) {
|
||||
dev_err(adev->dev, "invalid chip name for asd microcode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.asd_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.asd_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -2944,31 +2915,19 @@ int psp_init_asd_microcode(struct psp_context *psp,
|
||||
le32_to_cpu(asd_hdr->header.ucode_array_offset_bytes);
|
||||
return 0;
|
||||
out:
|
||||
dev_err(adev->dev, "fail to initialize asd microcode\n");
|
||||
release_firmware(adev->psp.asd_fw);
|
||||
adev->psp.asd_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->psp.asd_fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
int psp_init_toc_microcode(struct psp_context *psp,
|
||||
const char *chip_name)
|
||||
int psp_init_toc_microcode(struct psp_context *psp, const char *chip_name)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
const struct psp_firmware_header_v1_0 *toc_hdr;
|
||||
int err = 0;
|
||||
|
||||
if (!chip_name) {
|
||||
dev_err(adev->dev, "invalid chip name for toc microcode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.toc_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -2980,9 +2939,7 @@ int psp_init_toc_microcode(struct psp_context *psp,
|
||||
le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes);
|
||||
return 0;
|
||||
out:
|
||||
dev_err(adev->dev, "fail to request/validate toc microcode\n");
|
||||
release_firmware(adev->psp.toc_fw);
|
||||
adev->psp.toc_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->psp.toc_fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -3113,8 +3070,7 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int psp_init_sos_microcode(struct psp_context *psp,
|
||||
const char *chip_name)
|
||||
int psp_init_sos_microcode(struct psp_context *psp, const char *chip_name)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
@ -3127,17 +3083,8 @@ int psp_init_sos_microcode(struct psp_context *psp,
|
||||
uint8_t *ucode_array_start_addr;
|
||||
int fw_index = 0;
|
||||
|
||||
if (!chip_name) {
|
||||
dev_err(adev->dev, "invalid chip name for sos microcode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.sos_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.sos_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -3209,10 +3156,7 @@ int psp_init_sos_microcode(struct psp_context *psp,
|
||||
|
||||
return 0;
|
||||
out:
|
||||
dev_err(adev->dev,
|
||||
"failed to init sos firmware\n");
|
||||
release_firmware(adev->psp.sos_fw);
|
||||
adev->psp.sos_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->psp.sos_fw);
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -3278,41 +3222,76 @@ static int parse_ta_bin_descriptor(struct psp_context *psp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int psp_init_ta_microcode(struct psp_context *psp,
|
||||
const char *chip_name)
|
||||
static int parse_ta_v1_microcode(struct psp_context *psp)
|
||||
{
|
||||
const struct ta_firmware_header_v1_0 *ta_hdr;
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v1_0 *) adev->psp.ta_fw->data;
|
||||
|
||||
if (le16_to_cpu(ta_hdr->header.header_version_major) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
adev->psp.xgmi_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->xgmi.fw_version);
|
||||
adev->psp.xgmi_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->xgmi.size_bytes);
|
||||
adev->psp.xgmi_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
adev->psp.ras_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->ras.fw_version);
|
||||
adev->psp.ras_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->ras.size_bytes);
|
||||
adev->psp.ras_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.xgmi_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->ras.offset_bytes);
|
||||
|
||||
adev->psp.hdcp_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->hdcp.fw_version);
|
||||
adev->psp.hdcp_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->hdcp.size_bytes);
|
||||
adev->psp.hdcp_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
adev->psp.dtm_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->dtm.fw_version);
|
||||
adev->psp.dtm_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->dtm.size_bytes);
|
||||
adev->psp.dtm_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->dtm.offset_bytes);
|
||||
|
||||
adev->psp.securedisplay_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->securedisplay.fw_version);
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->securedisplay.size_bytes);
|
||||
adev->psp.securedisplay_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->securedisplay.offset_bytes);
|
||||
|
||||
adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_ta_v2_microcode(struct psp_context *psp)
|
||||
{
|
||||
const struct ta_firmware_header_v2_0 *ta_hdr;
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
int err = 0;
|
||||
int ta_index = 0;
|
||||
|
||||
if (!chip_name) {
|
||||
dev_err(adev->dev, "invalid chip name for ta microcode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.ta_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v2_0 *)adev->psp.ta_fw->data;
|
||||
|
||||
if (le16_to_cpu(ta_hdr->header.header_version_major) != 2) {
|
||||
dev_err(adev->dev, "unsupported TA header version\n");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (le16_to_cpu(ta_hdr->header.header_version_major) != 2)
|
||||
return -EINVAL;
|
||||
|
||||
if (le32_to_cpu(ta_hdr->ta_fw_bin_count) >= UCODE_MAX_PSP_PACKAGING) {
|
||||
dev_err(adev->dev, "packed TA count exceeds maximum limit\n");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (ta_index = 0; ta_index < le32_to_cpu(ta_hdr->ta_fw_bin_count); ta_index++) {
|
||||
@ -3320,19 +3299,44 @@ int psp_init_ta_microcode(struct psp_context *psp,
|
||||
&ta_hdr->ta_fw_bin[ta_index],
|
||||
ta_hdr);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
dev_err(adev->dev, "fail to initialize ta microcode\n");
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
}
|
||||
|
||||
int psp_init_ta_microcode(struct psp_context *psp, const char *chip_name)
|
||||
{
|
||||
const struct common_firmware_header *hdr;
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
int err;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.ta_fw, fw_name);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
hdr = (const struct common_firmware_header *)adev->psp.ta_fw->data;
|
||||
switch (le16_to_cpu(hdr->header_version_major)) {
|
||||
case 1:
|
||||
err = parse_ta_v1_microcode(psp);
|
||||
break;
|
||||
case 2:
|
||||
err = parse_ta_v2_microcode(psp);
|
||||
break;
|
||||
default:
|
||||
dev_err(adev->dev, "unsupported TA header version\n");
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
if (err)
|
||||
amdgpu_ucode_release(&adev->psp.ta_fw);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int psp_init_cap_microcode(struct psp_context *psp,
|
||||
const char *chip_name)
|
||||
int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
@ -3340,28 +3344,20 @@ int psp_init_cap_microcode(struct psp_context *psp,
|
||||
struct amdgpu_firmware_info *info = NULL;
|
||||
int err = 0;
|
||||
|
||||
if (!chip_name) {
|
||||
dev_err(adev->dev, "invalid chip name for cap microcode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
dev_err(adev->dev, "cap microcode should only be loaded under SRIOV\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_cap.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.cap_fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
dev_warn(adev->dev, "cap microcode does not exist, skip\n");
|
||||
err = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.cap_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.cap_fw, fw_name);
|
||||
if (err) {
|
||||
if (err == -ENODEV) {
|
||||
dev_warn(adev->dev, "cap microcode does not exist, skip\n");
|
||||
err = 0;
|
||||
goto out;
|
||||
}
|
||||
dev_err(adev->dev, "fail to initialize cap microcode\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP];
|
||||
@ -3378,8 +3374,7 @@ int psp_init_cap_microcode(struct psp_context *psp,
|
||||
return 0;
|
||||
|
||||
out:
|
||||
release_firmware(adev->psp.cap_fw);
|
||||
adev->psp.cap_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->psp.cap_fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -154,16 +154,11 @@ int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev,
|
||||
|
||||
static int amdgpu_sdma_init_inst_ctx(struct amdgpu_sdma_instance *sdma_inst)
|
||||
{
|
||||
int err = 0;
|
||||
uint16_t version_major;
|
||||
const struct common_firmware_header *header = NULL;
|
||||
const struct sdma_firmware_header_v1_0 *hdr;
|
||||
const struct sdma_firmware_header_v2_0 *hdr_v2;
|
||||
|
||||
err = amdgpu_ucode_validate(sdma_inst->fw);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
header = (const struct common_firmware_header *)
|
||||
sdma_inst->fw->data;
|
||||
version_major = le16_to_cpu(header->header_version_major);
|
||||
@ -195,7 +190,7 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
if (duplicate)
|
||||
break;
|
||||
}
|
||||
@ -205,16 +200,22 @@ void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
|
||||
char *fw_name, u32 instance,
|
||||
bool duplicate)
|
||||
u32 instance, bool duplicate)
|
||||
{
|
||||
struct amdgpu_firmware_info *info = NULL;
|
||||
const struct common_firmware_header *header = NULL;
|
||||
int err = 0, i;
|
||||
int err, i;
|
||||
const struct sdma_firmware_header_v2_0 *sdma_hdr;
|
||||
uint16_t version_major;
|
||||
char ucode_prefix[30];
|
||||
char fw_name[40];
|
||||
|
||||
err = request_firmware(&adev->sdma.instance[instance].fw, fw_name, adev->dev);
|
||||
amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
if (instance == 0)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s%d.bin", ucode_prefix, instance);
|
||||
err = amdgpu_ucode_request(adev, &adev->sdma.instance[instance].fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -279,10 +280,8 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
DRM_ERROR("SDMA: Failed to init firmware \"%s\"\n", fw_name);
|
||||
if (err)
|
||||
amdgpu_sdma_destroy_inst_ctx(adev, duplicate);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev,
|
||||
int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
struct amdgpu_iv_entry *entry);
|
||||
int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
|
||||
char *fw_name, u32 instance, bool duplicate);
|
||||
int amdgpu_sdma_init_microcode(struct amdgpu_device *adev, u32 instance,
|
||||
bool duplicate);
|
||||
void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev,
|
||||
bool duplicate);
|
||||
void amdgpu_sdma_unset_buffer_funcs_helper(struct amdgpu_device *adev);
|
||||
|
@ -504,7 +504,7 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr)
|
||||
}
|
||||
}
|
||||
|
||||
int amdgpu_ucode_validate(const struct firmware *fw)
|
||||
static int amdgpu_ucode_validate(const struct firmware *fw)
|
||||
{
|
||||
const struct common_firmware_header *hdr =
|
||||
(const struct common_firmware_header *)fw->data;
|
||||
@ -1059,12 +1059,233 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int block_type)
|
||||
{
|
||||
if (block_type == MP0_HWIP) {
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
return "vega10";
|
||||
case CHIP_VEGA12:
|
||||
return "vega12";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
if (adev->asic_type == CHIP_RAVEN) {
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
return "raven2";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
return "picasso";
|
||||
return "raven";
|
||||
}
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
return "navi10";
|
||||
case IP_VERSION(11, 0, 2):
|
||||
return "vega20";
|
||||
case IP_VERSION(11, 0, 4):
|
||||
return "arcturus";
|
||||
case IP_VERSION(11, 0, 5):
|
||||
return "navi14";
|
||||
case IP_VERSION(11, 0, 7):
|
||||
return "sienna_cichlid";
|
||||
case IP_VERSION(11, 0, 9):
|
||||
return "navi12";
|
||||
case IP_VERSION(11, 0, 11):
|
||||
return "navy_flounder";
|
||||
case IP_VERSION(11, 0, 12):
|
||||
return "dimgrey_cavefish";
|
||||
case IP_VERSION(11, 0, 13):
|
||||
return "beige_goby";
|
||||
case IP_VERSION(11, 5, 0):
|
||||
return "vangogh";
|
||||
case IP_VERSION(12, 0, 1):
|
||||
if (adev->asic_type == CHIP_RENOIR) {
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
return "renoir";
|
||||
return "green_sardine";
|
||||
}
|
||||
break;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
return "aldebaran";
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
return "yellow_carp";
|
||||
}
|
||||
} else if (block_type == MP1_HWIP) {
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
case IP_VERSION(11, 0, 2):
|
||||
if (adev->asic_type == CHIP_ARCTURUS)
|
||||
return "arcturus_smc";
|
||||
return NULL;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
return "navi10_smc";
|
||||
case IP_VERSION(11, 0, 5):
|
||||
return "navi14_smc";
|
||||
case IP_VERSION(11, 0, 9):
|
||||
return "navi12_smc";
|
||||
case IP_VERSION(11, 0, 7):
|
||||
return "sienna_cichlid_smc";
|
||||
case IP_VERSION(11, 0, 11):
|
||||
return "navy_flounder_smc";
|
||||
case IP_VERSION(11, 0, 12):
|
||||
return "dimgrey_cavefish_smc";
|
||||
case IP_VERSION(11, 0, 13):
|
||||
return "beige_goby_smc";
|
||||
case IP_VERSION(13, 0, 2):
|
||||
return "aldebaran_smc";
|
||||
}
|
||||
} else if (block_type == SDMA0_HWIP) {
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
return "vega10_sdma";
|
||||
case IP_VERSION(4, 0, 1):
|
||||
return "vega12_sdma";
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
return "raven2_sdma";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
return "picasso_sdma";
|
||||
return "raven_sdma";
|
||||
case IP_VERSION(4, 1, 2):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
return "renoir_sdma";
|
||||
return "green_sardine_sdma";
|
||||
case IP_VERSION(4, 2, 0):
|
||||
return "vega20_sdma";
|
||||
case IP_VERSION(4, 2, 2):
|
||||
return "arcturus_sdma";
|
||||
case IP_VERSION(4, 4, 0):
|
||||
return "aldebaran_sdma";
|
||||
case IP_VERSION(5, 0, 0):
|
||||
return "navi10_sdma";
|
||||
case IP_VERSION(5, 0, 1):
|
||||
return "cyan_skillfish2_sdma";
|
||||
case IP_VERSION(5, 0, 2):
|
||||
return "navi14_sdma";
|
||||
case IP_VERSION(5, 0, 5):
|
||||
return "navi12_sdma";
|
||||
case IP_VERSION(5, 2, 0):
|
||||
return "sienna_cichlid_sdma";
|
||||
case IP_VERSION(5, 2, 2):
|
||||
return "navy_flounder_sdma";
|
||||
case IP_VERSION(5, 2, 4):
|
||||
return "dimgrey_cavefish_sdma";
|
||||
case IP_VERSION(5, 2, 5):
|
||||
return "beige_goby_sdma";
|
||||
case IP_VERSION(5, 2, 3):
|
||||
return "yellow_carp_sdma";
|
||||
case IP_VERSION(5, 2, 1):
|
||||
return "vangogh_sdma";
|
||||
}
|
||||
} else if (block_type == UVD_HWIP) {
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
return "raven2_vcn";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
return "picasso_vcn";
|
||||
return "raven_vcn";
|
||||
case IP_VERSION(2, 5, 0):
|
||||
return "arcturus_vcn";
|
||||
case IP_VERSION(2, 2, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
return "renoir_vcn";
|
||||
return "green_sardine_vcn";
|
||||
case IP_VERSION(2, 6, 0):
|
||||
return "aldebaran_vcn";
|
||||
case IP_VERSION(2, 0, 0):
|
||||
return "navi10_vcn";
|
||||
case IP_VERSION(2, 0, 2):
|
||||
if (adev->asic_type == CHIP_NAVI12)
|
||||
return "navi12_vcn";
|
||||
return "navi14_vcn";
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 64):
|
||||
case IP_VERSION(3, 0, 192):
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
|
||||
return "sienna_cichlid_vcn";
|
||||
return "navy_flounder_vcn";
|
||||
case IP_VERSION(3, 0, 2):
|
||||
return "vangogh_vcn";
|
||||
case IP_VERSION(3, 0, 16):
|
||||
return "dimgrey_cavefish_vcn";
|
||||
case IP_VERSION(3, 0, 33):
|
||||
return "beige_goby_vcn";
|
||||
case IP_VERSION(3, 1, 1):
|
||||
return "yellow_carp_vcn";
|
||||
}
|
||||
} else if (block_type == GC_HWIP) {
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
return "vega10";
|
||||
case IP_VERSION(9, 2, 1):
|
||||
return "vega12";
|
||||
case IP_VERSION(9, 4, 0):
|
||||
return "vega20";
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
return "raven2";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
return "picasso";
|
||||
return "raven";
|
||||
case IP_VERSION(9, 4, 1):
|
||||
return "arcturus";
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
return "renoir";
|
||||
return "green_sardine";
|
||||
case IP_VERSION(9, 4, 2):
|
||||
return "aldebaran";
|
||||
case IP_VERSION(10, 1, 10):
|
||||
return "navi10";
|
||||
case IP_VERSION(10, 1, 1):
|
||||
return "navi14";
|
||||
case IP_VERSION(10, 1, 2):
|
||||
return "navi12";
|
||||
case IP_VERSION(10, 3, 0):
|
||||
return "sienna_cichlid";
|
||||
case IP_VERSION(10, 3, 2):
|
||||
return "navy_flounder";
|
||||
case IP_VERSION(10, 3, 1):
|
||||
return "vangogh";
|
||||
case IP_VERSION(10, 3, 4):
|
||||
return "dimgrey_cavefish";
|
||||
case IP_VERSION(10, 3, 5):
|
||||
return "beige_goby";
|
||||
case IP_VERSION(10, 3, 3):
|
||||
return "yellow_carp";
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 1, 4):
|
||||
return "cyan_skillfish2";
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, char *ucode_prefix, int len)
|
||||
{
|
||||
int maj, min, rev;
|
||||
char *ip_name;
|
||||
const char *legacy;
|
||||
uint32_t version = adev->ip_versions[block_type][0];
|
||||
|
||||
legacy = amdgpu_ucode_legacy_naming(adev, block_type);
|
||||
if (legacy) {
|
||||
snprintf(ucode_prefix, len, "%s", legacy);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (block_type) {
|
||||
case GC_HWIP:
|
||||
ip_name = "gc";
|
||||
@ -1091,3 +1312,39 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,
|
||||
|
||||
snprintf(ucode_prefix, len, "%s_%d_%d_%d", ip_name, maj, min, rev);
|
||||
}
|
||||
|
||||
/*
|
||||
* amdgpu_ucode_request - Fetch and validate amdgpu microcode
|
||||
*
|
||||
* @adev: amdgpu device
|
||||
* @fw: pointer to load firmware to
|
||||
* @fw_name: firmware to load
|
||||
*
|
||||
* This is a helper that will use request_firmware and amdgpu_ucode_validate
|
||||
* to load and run basic validation on firmware. If the load fails, remap
|
||||
* the error code to -ENODEV, so that early_init functions will fail to load.
|
||||
*/
|
||||
int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
|
||||
const char *fw_name)
|
||||
{
|
||||
int err = request_firmware(fw, fw_name, adev->dev);
|
||||
|
||||
if (err)
|
||||
return -ENODEV;
|
||||
err = amdgpu_ucode_validate(*fw);
|
||||
if (err)
|
||||
dev_dbg(adev->dev, "\"%s\" failed to validate\n", fw_name);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* amdgpu_ucode_release - Release firmware microcode
|
||||
*
|
||||
* @fw: pointer to firmware to release
|
||||
*/
|
||||
void amdgpu_ucode_release(const struct firmware **fw)
|
||||
{
|
||||
release_firmware(*fw);
|
||||
*fw = NULL;
|
||||
}
|
||||
|
@ -543,7 +543,9 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
|
||||
void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
|
||||
void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr);
|
||||
void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
|
||||
int amdgpu_ucode_validate(const struct firmware *fw);
|
||||
int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw,
|
||||
const char *fw_name);
|
||||
void amdgpu_ucode_release(const struct firmware **fw);
|
||||
bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
|
||||
uint16_t hdr_major, uint16_t hdr_minor);
|
||||
|
||||
|
@ -260,19 +260,11 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = request_firmware(&adev->uvd.fw, fw_name, adev->dev);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_uvd: Can't load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_ucode_validate(adev->uvd.fw);
|
||||
r = amdgpu_ucode_request(adev, &adev->uvd.fw, fw_name);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_uvd: Can't validate firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->uvd.fw);
|
||||
adev->uvd.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->uvd.fw);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -397,7 +389,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev)
|
||||
amdgpu_ring_fini(&adev->uvd.inst[j].ring_enc[i]);
|
||||
}
|
||||
amdgpu_bo_free_kernel(&adev->uvd.ib_bo, NULL, &addr);
|
||||
release_firmware(adev->uvd.fw);
|
||||
amdgpu_ucode_release(&adev->uvd.fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -158,19 +158,11 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = request_firmware(&adev->vce.fw, fw_name, adev->dev);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_vce: Can't load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_ucode_validate(adev->vce.fw);
|
||||
r = amdgpu_ucode_request(adev, &adev->vce.fw, fw_name);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_vce: Can't validate firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->vce.fw);
|
||||
adev->vce.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->vce.fw);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -228,7 +220,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)
|
||||
for (i = 0; i < adev->vce.num_rings; i++)
|
||||
amdgpu_ring_fini(&adev->vce.ring[i]);
|
||||
|
||||
release_firmware(adev->vce.fw);
|
||||
amdgpu_ucode_release(&adev->vce.fw);
|
||||
mutex_destroy(&adev->vce.idle_mutex);
|
||||
|
||||
return 0;
|
||||
|
@ -80,10 +80,24 @@ MODULE_FIRMWARE(FIRMWARE_VCN4_0_4);
|
||||
|
||||
static void amdgpu_vcn_idle_work_handler(struct work_struct *work);
|
||||
|
||||
int amdgpu_vcn_early_init(struct amdgpu_device *adev)
|
||||
{
|
||||
char ucode_prefix[30];
|
||||
char fw_name[40];
|
||||
int r;
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
|
||||
r = amdgpu_ucode_request(adev, &adev->vcn.fw, fw_name);
|
||||
if (r)
|
||||
amdgpu_ucode_release(&adev->vcn.fw);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
{
|
||||
unsigned long bo_size;
|
||||
const char *fw_name;
|
||||
const struct common_firmware_header *hdr;
|
||||
unsigned char fw_check;
|
||||
unsigned int fw_shared_size, log_offset;
|
||||
@ -99,46 +113,27 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
fw_name = FIRMWARE_RAVEN2;
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
fw_name = FIRMWARE_PICASSO;
|
||||
else
|
||||
fw_name = FIRMWARE_RAVEN;
|
||||
break;
|
||||
case IP_VERSION(2, 5, 0):
|
||||
fw_name = FIRMWARE_ARCTURUS;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(2, 2, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
fw_name = FIRMWARE_RENOIR;
|
||||
else
|
||||
fw_name = FIRMWARE_GREEN_SARDINE;
|
||||
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(2, 6, 0):
|
||||
fw_name = FIRMWARE_ALDEBARAN;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(2, 0, 0):
|
||||
fw_name = FIRMWARE_NAVI10;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(2, 0, 2):
|
||||
if (adev->asic_type == CHIP_NAVI12)
|
||||
fw_name = FIRMWARE_NAVI12;
|
||||
else
|
||||
fw_name = FIRMWARE_NAVI14;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
@ -146,58 +141,46 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 64):
|
||||
case IP_VERSION(3, 0, 192):
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
|
||||
fw_name = FIRMWARE_SIENNA_CICHLID;
|
||||
else
|
||||
fw_name = FIRMWARE_NAVY_FLOUNDER;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 2):
|
||||
fw_name = FIRMWARE_VANGOGH;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 16):
|
||||
fw_name = FIRMWARE_DIMGREY_CAVEFISH;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 33):
|
||||
fw_name = FIRMWARE_BEIGE_GOBY;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 1):
|
||||
fw_name = FIRMWARE_YELLOW_CARP;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 2):
|
||||
fw_name = FIRMWARE_VCN_3_1_2;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(4, 0, 0):
|
||||
fw_name = FIRMWARE_VCN4_0_0;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(4, 0, 2):
|
||||
fw_name = FIRMWARE_VCN4_0_2;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(4, 0, 4):
|
||||
fw_name = FIRMWARE_VCN4_0_4;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
@ -206,22 +189,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = request_firmware(&adev->vcn.fw, fw_name, adev->dev);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_vcn: Can't load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_ucode_validate(adev->vcn.fw);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_vcn: Can't validate firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->vcn.fw);
|
||||
adev->vcn.fw = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
|
||||
adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version);
|
||||
|
||||
@ -339,7 +306,7 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
|
||||
amdgpu_ring_fini(&adev->vcn.inst[j].ring_enc[i]);
|
||||
}
|
||||
|
||||
release_firmware(adev->vcn.fw);
|
||||
amdgpu_ucode_release(&adev->vcn.fw);
|
||||
mutex_destroy(&adev->vcn.vcn1_jpeg1_workaround);
|
||||
mutex_destroy(&adev->vcn.vcn_pg_lock);
|
||||
|
||||
|
@ -369,6 +369,7 @@ enum vcn_ring_type {
|
||||
VCN_UNIFIED_RING,
|
||||
};
|
||||
|
||||
int amdgpu_vcn_early_init(struct amdgpu_device *adev);
|
||||
int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
|
||||
int amdgpu_vcn_sw_fini(struct amdgpu_device *adev);
|
||||
int amdgpu_vcn_suspend(struct amdgpu_device *adev);
|
||||
|
@ -882,7 +882,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
|
||||
kfree(rsv);
|
||||
|
||||
list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) {
|
||||
drm_buddy_free_list(&mgr->mm, &rsv->blocks);
|
||||
drm_buddy_free_list(&mgr->mm, &rsv->allocated);
|
||||
kfree(rsv);
|
||||
}
|
||||
drm_buddy_fini(&mgr->mm);
|
||||
|
@ -73,10 +73,9 @@ u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev);
|
||||
static void cik_sdma_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -137,18 +136,15 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name);
|
||||
err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->sdma.instance[i].fw);
|
||||
}
|
||||
out:
|
||||
if (err) {
|
||||
pr_err("cik_sdma: Failed to load firmware \"%s\"\n", fw_name);
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -3891,18 +3891,12 @@ err1:
|
||||
|
||||
static void gfx_v10_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
|
||||
kfree(adev->gfx.rlc.register_list_format);
|
||||
}
|
||||
@ -3974,9 +3968,9 @@ static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev)
|
||||
|
||||
static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const char *chip_name;
|
||||
char fw_name[40];
|
||||
char *wks = "";
|
||||
char ucode_prefix[30];
|
||||
const char *wks = "";
|
||||
int err;
|
||||
const struct rlc_firmware_header_v2_0 *rlc_hdr;
|
||||
uint16_t version_major;
|
||||
@ -3984,90 +3978,40 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case IP_VERSION(10, 1, 1):
|
||||
chip_name = "navi14";
|
||||
if (!(adev->pdev->device == 0x7340 &&
|
||||
adev->pdev->revision != 0x00))
|
||||
wks = "_wks";
|
||||
break;
|
||||
case IP_VERSION(10, 1, 2):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 0):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 2):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 1):
|
||||
chip_name = "vangogh";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 4):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 5):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 3):
|
||||
chip_name = "yellow_carp";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 6):
|
||||
chip_name = "gc_10_3_6";
|
||||
break;
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 1, 4):
|
||||
chip_name = "cyan_skillfish2";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 7):
|
||||
chip_name = "gc_10_3_7";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 1) &&
|
||||
(!(adev->pdev->device == 0x7340 && adev->pdev->revision != 0x00)))
|
||||
wks = "_wks";
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", chip_name, wks);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", chip_name, wks);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", ucode_prefix, wks);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", chip_name, wks);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.ce_fw);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE);
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
/* don't check this. There are apparently firmwares in the wild with
|
||||
* incorrect size in the header
|
||||
*/
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
if (err == -ENODEV)
|
||||
goto out;
|
||||
if (err)
|
||||
dev_dbg(adev->dev,
|
||||
"gfx10: amdgpu_ucode_validate() failed \"%s\"\n",
|
||||
"gfx10: amdgpu_ucode_request() failed \"%s\"\n",
|
||||
fw_name);
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
|
||||
version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
|
||||
@ -4077,47 +4021,34 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec_fw);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", chip_name, wks);
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
if (!err) {
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT);
|
||||
} else {
|
||||
err = 0;
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
}
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT);
|
||||
|
||||
gfx_v10_0_check_fw_write_wait(adev);
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx10: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
}
|
||||
|
||||
gfx_v10_0_check_gfxoff_flag(adev);
|
||||
@ -4270,19 +4201,11 @@ static void gfx_v10_0_mec_fini(struct amdgpu_device *adev)
|
||||
amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_obj, NULL, NULL);
|
||||
}
|
||||
|
||||
static int gfx_v10_0_me_init(struct amdgpu_device *adev)
|
||||
static void gfx_v10_0_me_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
|
||||
bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES);
|
||||
|
||||
amdgpu_gfx_graphics_queue_acquire(adev);
|
||||
|
||||
r = gfx_v10_0_init_microcode(adev);
|
||||
if (r)
|
||||
DRM_ERROR("Failed to load gfx firmware!\n");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int gfx_v10_0_mec_init(struct amdgpu_device *adev)
|
||||
@ -4650,9 +4573,7 @@ static int gfx_v10_0_sw_init(void *handle)
|
||||
|
||||
adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE;
|
||||
|
||||
r = gfx_v10_0_me_init(adev);
|
||||
if (r)
|
||||
return r;
|
||||
gfx_v10_0_me_init(adev);
|
||||
|
||||
if (adev->gfx.rlc.funcs) {
|
||||
if (adev->gfx.rlc.funcs->init) {
|
||||
@ -7630,7 +7551,7 @@ static int gfx_v10_0_early_init(void *handle)
|
||||
/* init rlcg reg access ctrl */
|
||||
gfx_v10_0_init_rlcg_reg_access_ctrl(adev);
|
||||
|
||||
return 0;
|
||||
return gfx_v10_0_init_microcode(adev);
|
||||
}
|
||||
|
||||
static int gfx_v10_0_late_init(void *handle)
|
||||
|
@ -431,18 +431,37 @@ err1:
|
||||
|
||||
static void gfx_v11_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
|
||||
kfree(adev->gfx.rlc.register_list_format);
|
||||
}
|
||||
|
||||
static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *ucode_prefix)
|
||||
{
|
||||
const struct psp_firmware_header_v1_0 *toc_hdr;
|
||||
int err = 0;
|
||||
char fw_name[40];
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix);
|
||||
err = amdgpu_ucode_request(adev, &adev->psp.toc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data;
|
||||
adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version);
|
||||
adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version);
|
||||
adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes);
|
||||
adev->psp.toc.start_addr = (uint8_t *)toc_hdr +
|
||||
le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes);
|
||||
return 0;
|
||||
out:
|
||||
amdgpu_ucode_release(&adev->psp.toc_fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
char fw_name[40];
|
||||
@ -457,10 +476,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
/* check pfp fw hdr version to decide if enable rs64 for gfx11.*/
|
||||
@ -477,10 +493,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
if (adev->gfx.rs64_enable) {
|
||||
@ -493,10 +506,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
|
||||
@ -508,10 +518,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
if (adev->gfx.rs64_enable) {
|
||||
@ -525,59 +532,23 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
|
||||
}
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO)
|
||||
err = gfx_v11_0_init_toc_microcode(adev, ucode_prefix);
|
||||
|
||||
/* only one MEC for gfx 11.0.0. */
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx11: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct psp_firmware_header_v1_0 *toc_hdr;
|
||||
int err = 0;
|
||||
char fw_name[40];
|
||||
char ucode_prefix[30];
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_toc.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->psp.toc_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->psp.toc_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
toc_hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.toc_fw->data;
|
||||
adev->psp.toc.fw_version = le32_to_cpu(toc_hdr->header.ucode_version);
|
||||
adev->psp.toc.feature_version = le32_to_cpu(toc_hdr->sos.fw_version);
|
||||
adev->psp.toc.size_bytes = le32_to_cpu(toc_hdr->header.ucode_size_bytes);
|
||||
adev->psp.toc.start_addr = (uint8_t *)toc_hdr +
|
||||
le32_to_cpu(toc_hdr->header.ucode_array_offset_bytes);
|
||||
return 0;
|
||||
out:
|
||||
dev_err(adev->dev, "Failed to load TOC microcode\n");
|
||||
release_firmware(adev->psp.toc_fw);
|
||||
adev->psp.toc_fw = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
static u32 gfx_v11_0_get_csb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 count = 0;
|
||||
@ -714,19 +685,11 @@ static void gfx_v11_0_mec_fini(struct amdgpu_device *adev)
|
||||
amdgpu_bo_free_kernel(&adev->gfx.mec.mec_fw_data_obj, NULL, NULL);
|
||||
}
|
||||
|
||||
static int gfx_v11_0_me_init(struct amdgpu_device *adev)
|
||||
static void gfx_v11_0_me_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
|
||||
bitmap_zero(adev->gfx.me.queue_bitmap, AMDGPU_MAX_GFX_QUEUES);
|
||||
|
||||
amdgpu_gfx_graphics_queue_acquire(adev);
|
||||
|
||||
r = gfx_v11_0_init_microcode(adev);
|
||||
if (r)
|
||||
DRM_ERROR("Failed to load gfx firmware!\n");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int gfx_v11_0_mec_init(struct amdgpu_device *adev)
|
||||
@ -1340,9 +1303,7 @@ static int gfx_v11_0_sw_init(void *handle)
|
||||
}
|
||||
}
|
||||
|
||||
r = gfx_v11_0_me_init(adev);
|
||||
if (r)
|
||||
return r;
|
||||
gfx_v11_0_me_init(adev);
|
||||
|
||||
r = gfx_v11_0_rlc_init(adev);
|
||||
if (r) {
|
||||
@ -1410,9 +1371,6 @@ static int gfx_v11_0_sw_init(void *handle)
|
||||
|
||||
/* allocate visible FB for rlc auto-loading fw */
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) {
|
||||
r = gfx_v11_0_init_toc_microcode(adev);
|
||||
if (r)
|
||||
dev_err(adev->dev, "Failed to load toc firmware!\n");
|
||||
r = gfx_v11_0_rlc_autoload_buffer_init(adev);
|
||||
if (r)
|
||||
return r;
|
||||
@ -4693,7 +4651,7 @@ static int gfx_v11_0_early_init(void *handle)
|
||||
|
||||
gfx_v11_0_init_rlcg_reg_access_ctrl(adev);
|
||||
|
||||
return 0;
|
||||
return gfx_v11_0_init_microcode(adev);
|
||||
}
|
||||
|
||||
static int gfx_v11_0_ras_late_init(void *handle)
|
||||
|
@ -338,10 +338,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data;
|
||||
@ -349,10 +346,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data;
|
||||
@ -360,10 +354,7 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.ce_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data;
|
||||
@ -371,10 +362,9 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
rlc_hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
|
||||
adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
|
||||
@ -382,14 +372,10 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
out:
|
||||
if (err) {
|
||||
pr_err("gfx6: Failed to load firmware \"%s\"\n", fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -887,6 +887,16 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *bu
|
||||
static void gfx_v7_0_init_pg(struct amdgpu_device *adev);
|
||||
static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev);
|
||||
|
||||
static void gfx_v7_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
}
|
||||
|
||||
/*
|
||||
* Core functions
|
||||
*/
|
||||
@ -927,88 +937,44 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.ce_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
if (adev->asic_type == CHIP_KAVERI) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
pr_err("gfx7: Failed to load firmware \"%s\"\n", fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
gfx_v7_0_free_microcode(adev);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static void gfx_v7_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gfx_v7_0_tiling_mode_table_init - init the hw tiling table
|
||||
*
|
||||
|
@ -924,20 +924,14 @@ err1:
|
||||
|
||||
static void gfx_v8_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
if ((adev->asic_type != CHIP_STONEY) &&
|
||||
(adev->asic_type != CHIP_TOPAZ))
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
|
||||
kfree(adev->gfx.rlc.register_list_format);
|
||||
}
|
||||
@ -989,18 +983,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err == -ENOENT) {
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err == -ENODEV) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
}
|
||||
} else {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
}
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data;
|
||||
@ -1009,18 +1000,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err == -ENOENT) {
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err == -ENODEV) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
}
|
||||
} else {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
}
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data;
|
||||
@ -1030,18 +1018,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
if (err == -ENOENT) {
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
if (err == -ENODEV) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
}
|
||||
} else {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
}
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.ce_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data;
|
||||
@ -1060,10 +1045,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
adev->virt.chained_ib_support = false;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
|
||||
adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
|
||||
@ -1110,18 +1094,15 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
if (err == -ENOENT) {
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
if (err == -ENODEV) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
}
|
||||
} else {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
}
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
|
||||
@ -1132,19 +1113,16 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
(adev->asic_type != CHIP_TOPAZ)) {
|
||||
if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
if (err == -ENOENT) {
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
if (err == -ENODEV) {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
}
|
||||
} else {
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
}
|
||||
if (!err) {
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.mec2_fw->data;
|
||||
adev->gfx.mec2_fw_version =
|
||||
@ -1219,18 +1197,12 @@ out:
|
||||
dev_err(adev->dev,
|
||||
"gfx8: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -1078,18 +1078,12 @@ err1:
|
||||
|
||||
static void gfx_v9_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
|
||||
kfree(adev->gfx.rlc.register_list_format);
|
||||
}
|
||||
@ -1251,55 +1245,40 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
static int gfx_v9_0_init_cp_gfx_microcode(struct amdgpu_device *adev,
|
||||
const char *chip_name)
|
||||
char *chip_name)
|
||||
{
|
||||
char fw_name[30];
|
||||
int err;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_PFP);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.me_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.me_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_ME);
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.ce_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.ce_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_CE);
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx9: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
release_firmware(adev->gfx.me_fw);
|
||||
adev->gfx.me_fw = NULL;
|
||||
release_firmware(adev->gfx.ce_fw);
|
||||
adev->gfx.ce_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.pfp_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.me_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.ce_fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
|
||||
const char *chip_name)
|
||||
char *chip_name)
|
||||
{
|
||||
char fw_name[30];
|
||||
int err;
|
||||
@ -1328,10 +1307,7 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
|
||||
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
|
||||
@ -1340,13 +1316,9 @@ static int gfx_v9_0_init_rlc_microcode(struct amdgpu_device *adev,
|
||||
version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
|
||||
err = amdgpu_gfx_rlc_init_microcode(adev, version_major, version_minor);
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx9: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.rlc_fw);
|
||||
adev->gfx.rlc_fw = NULL;
|
||||
}
|
||||
if (err)
|
||||
amdgpu_ucode_release(&adev->gfx.rlc_fw);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1361,7 +1333,7 @@ static bool gfx_v9_0_load_mec2_fw_bin_support(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
|
||||
const char *chip_name)
|
||||
char *chip_name)
|
||||
{
|
||||
char fw_name[30];
|
||||
int err;
|
||||
@ -1371,12 +1343,9 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
|
||||
|
||||
err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1);
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC1_JT);
|
||||
|
||||
@ -1386,11 +1355,8 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
|
||||
|
||||
err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.mec2_fw, fw_name);
|
||||
if (!err) {
|
||||
err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
|
||||
amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT);
|
||||
} else {
|
||||
@ -1402,75 +1368,35 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev,
|
||||
adev->gfx.mec2_feature_version = adev->gfx.mec_feature_version;
|
||||
}
|
||||
|
||||
out:
|
||||
gfx_v9_0_check_if_need_gfxoff(adev);
|
||||
gfx_v9_0_check_fw_write_wait(adev);
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx9: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.mec_fw);
|
||||
adev->gfx.mec_fw = NULL;
|
||||
release_firmware(adev->gfx.mec2_fw);
|
||||
adev->gfx.mec2_fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gfx.mec_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.mec2_fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const char *chip_name;
|
||||
char ucode_prefix[30];
|
||||
int r;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
chip_name = "vega10";
|
||||
break;
|
||||
case IP_VERSION(9, 2, 1):
|
||||
chip_name = "vega12";
|
||||
break;
|
||||
case IP_VERSION(9, 4, 0):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
chip_name = "raven2";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
chip_name = "picasso";
|
||||
else
|
||||
chip_name = "raven";
|
||||
break;
|
||||
case IP_VERSION(9, 4, 1):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
chip_name = "renoir";
|
||||
else
|
||||
chip_name = "green_sardine";
|
||||
break;
|
||||
case IP_VERSION(9, 4, 2):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
/* No CPG in Arcturus */
|
||||
if (adev->gfx.num_gfx_rings) {
|
||||
r = gfx_v9_0_init_cp_gfx_microcode(adev, chip_name);
|
||||
r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = gfx_v9_0_init_rlc_microcode(adev, chip_name);
|
||||
r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = gfx_v9_0_init_cp_compute_microcode(adev, chip_name);
|
||||
r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
@ -2159,12 +2085,6 @@ static int gfx_v9_0_sw_init(void *handle)
|
||||
|
||||
adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE;
|
||||
|
||||
r = gfx_v9_0_init_microcode(adev);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to load gfx firmware!\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.funcs) {
|
||||
if (adev->gfx.rlc.funcs->init) {
|
||||
r = adev->gfx.rlc.funcs->init(adev);
|
||||
@ -4606,7 +4526,7 @@ static int gfx_v9_0_early_init(void *handle)
|
||||
/* init rlcg reg access ctrl */
|
||||
gfx_v9_0_init_rlcg_reg_access_ctrl(adev);
|
||||
|
||||
return 0;
|
||||
return gfx_v9_0_init_microcode(adev);
|
||||
}
|
||||
|
||||
static int gfx_v9_0_ecc_late_init(void *handle)
|
||||
|
@ -131,19 +131,12 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/si58_mc.bin");
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
|
||||
err = request_firmware(&adev->gmc.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->gmc.fw);
|
||||
|
||||
out:
|
||||
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"si_mc: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -894,8 +887,7 @@ static int gmc_v6_0_sw_fini(void *handle)
|
||||
amdgpu_vm_manager_fini(adev);
|
||||
amdgpu_gart_table_vram_free(adev);
|
||||
amdgpu_bo_fini(adev);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -156,16 +156,10 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
|
||||
|
||||
err = request_firmware(&adev->gmc.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gmc.fw);
|
||||
|
||||
out:
|
||||
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
|
||||
if (err) {
|
||||
pr_err("cik_mc: Failed to load firmware \"%s\"\n", fw_name);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -1078,8 +1072,7 @@ static int gmc_v7_0_sw_fini(void *handle)
|
||||
kfree(adev->gmc.vm_fault_info);
|
||||
amdgpu_gart_table_vram_free(adev);
|
||||
amdgpu_bo_fini(adev);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -264,16 +264,10 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
|
||||
err = request_firmware(&adev->gmc.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gmc.fw);
|
||||
|
||||
out:
|
||||
err = amdgpu_ucode_request(adev, &adev->gmc.fw, fw_name);
|
||||
if (err) {
|
||||
pr_err("mc: Failed to load firmware \"%s\"\n", fw_name);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -1200,8 +1194,7 @@ static int gmc_v8_0_sw_fini(void *handle)
|
||||
kfree(adev->gmc.vm_fault_info);
|
||||
amdgpu_gart_table_vram_free(adev);
|
||||
amdgpu_bo_fini(adev);
|
||||
release_firmware(adev->gmc.fw);
|
||||
adev->gmc.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->gmc.fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,10 +49,7 @@ static int imu_v11_0_init_microcode(struct amdgpu_device *adev)
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_imu.bin", ucode_prefix);
|
||||
err = request_firmware(&adev->gfx.imu_fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->gfx.imu_fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->gfx.imu_fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
imu_hdr = (const struct imu_firmware_header_v1_0 *)adev->gfx.imu_fw->data;
|
||||
@ -77,7 +74,7 @@ out:
|
||||
dev_err(adev->dev,
|
||||
"gfx11: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.imu_fw);
|
||||
amdgpu_ucode_release(&adev->gfx.imu_fw);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -379,89 +379,6 @@ static const struct amdgpu_mes_funcs mes_v10_1_funcs = {
|
||||
.resume_gang = mes_v10_1_resume_gang,
|
||||
};
|
||||
|
||||
static int mes_v10_1_init_microcode(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
const char *chip_name;
|
||||
char fw_name[30];
|
||||
int err;
|
||||
const struct mes_firmware_header_v1_0 *mes_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case IP_VERSION(10, 3, 0):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
if (pipe == AMDGPU_MES_SCHED_PIPE)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
|
||||
chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin",
|
||||
chip_name);
|
||||
|
||||
err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->mes.fw[pipe]);
|
||||
if (err) {
|
||||
release_firmware(adev->mes.fw[pipe]);
|
||||
adev->mes.fw[pipe] = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
mes_hdr = (const struct mes_firmware_header_v1_0 *)
|
||||
adev->mes.fw[pipe]->data;
|
||||
adev->mes.uc_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32);
|
||||
adev->mes.data_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_data_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
int ucode, ucode_data;
|
||||
|
||||
if (pipe == AMDGPU_MES_SCHED_PIPE) {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA;
|
||||
} else {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES1;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
}
|
||||
|
||||
info = &adev->firmware.ucode[ucode];
|
||||
info->ucode_id = ucode;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes),
|
||||
PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[ucode_data];
|
||||
info->ucode_id = ucode_data;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes),
|
||||
PAGE_SIZE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mes_v10_1_free_microcode(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
release_firmware(adev->mes.fw[pipe]);
|
||||
adev->mes.fw[pipe] = NULL;
|
||||
}
|
||||
|
||||
static int mes_v10_1_allocate_ucode_buffer(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
@ -1007,7 +924,6 @@ static int mes_v10_1_sw_init(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int pipe, r;
|
||||
|
||||
adev->mes.adev = adev;
|
||||
adev->mes.funcs = &mes_v10_1_funcs;
|
||||
adev->mes.kiq_hw_init = &mes_v10_1_kiq_hw_init;
|
||||
|
||||
@ -1019,10 +935,6 @@ static int mes_v10_1_sw_init(void *handle)
|
||||
if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE)
|
||||
continue;
|
||||
|
||||
r = mes_v10_1_init_microcode(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = mes_v10_1_allocate_eop_buf(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
@ -1059,8 +971,7 @@ static int mes_v10_1_sw_fini(void *handle)
|
||||
amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe],
|
||||
&adev->mes.eop_gpu_addr[pipe],
|
||||
NULL);
|
||||
|
||||
mes_v10_1_free_microcode(adev, pipe);
|
||||
amdgpu_ucode_release(&adev->mes.fw[pipe]);
|
||||
}
|
||||
|
||||
amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj,
|
||||
@ -1229,6 +1140,22 @@ static int mes_v10_1_resume(void *handle)
|
||||
return amdgpu_mes_resume(adev);
|
||||
}
|
||||
|
||||
static int mes_v10_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int pipe, r;
|
||||
|
||||
for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) {
|
||||
if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE)
|
||||
continue;
|
||||
r = amdgpu_mes_init_microcode(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mes_v10_0_late_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@ -1241,6 +1168,7 @@ static int mes_v10_0_late_init(void *handle)
|
||||
|
||||
static const struct amd_ip_funcs mes_v10_1_ip_funcs = {
|
||||
.name = "mes_v10_1",
|
||||
.early_init = mes_v10_0_early_init,
|
||||
.late_init = mes_v10_0_late_init,
|
||||
.sw_init = mes_v10_1_sw_init,
|
||||
.sw_fini = mes_v10_1_sw_fini,
|
||||
|
@ -459,80 +459,6 @@ static const struct amdgpu_mes_funcs mes_v11_0_funcs = {
|
||||
.misc_op = mes_v11_0_misc_op,
|
||||
};
|
||||
|
||||
static int mes_v11_0_init_microcode(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
char fw_name[30];
|
||||
char ucode_prefix[30];
|
||||
int err;
|
||||
const struct mes_firmware_header_v1_0 *mes_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
if (pipe == AMDGPU_MES_SCHED_PIPE)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
|
||||
ucode_prefix);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes1.bin",
|
||||
ucode_prefix);
|
||||
|
||||
err = request_firmware(&adev->mes.fw[pipe], fw_name, adev->dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = amdgpu_ucode_validate(adev->mes.fw[pipe]);
|
||||
if (err) {
|
||||
release_firmware(adev->mes.fw[pipe]);
|
||||
adev->mes.fw[pipe] = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
mes_hdr = (const struct mes_firmware_header_v1_0 *)
|
||||
adev->mes.fw[pipe]->data;
|
||||
adev->mes.uc_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_uc_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_uc_start_addr_hi)) << 32);
|
||||
adev->mes.data_start_addr[pipe] =
|
||||
le32_to_cpu(mes_hdr->mes_data_start_addr_lo) |
|
||||
((uint64_t)(le32_to_cpu(mes_hdr->mes_data_start_addr_hi)) << 32);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
int ucode, ucode_data;
|
||||
|
||||
if (pipe == AMDGPU_MES_SCHED_PIPE) {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES_DATA;
|
||||
} else {
|
||||
ucode = AMDGPU_UCODE_ID_CP_MES1;
|
||||
ucode_data = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
}
|
||||
|
||||
info = &adev->firmware.ucode[ucode];
|
||||
info->ucode_id = ucode;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_size_bytes),
|
||||
PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[ucode_data];
|
||||
info->ucode_id = ucode_data;
|
||||
info->fw = adev->mes.fw[pipe];
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(mes_hdr->mes_ucode_data_size_bytes),
|
||||
PAGE_SIZE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mes_v11_0_free_microcode(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
release_firmware(adev->mes.fw[pipe]);
|
||||
adev->mes.fw[pipe] = NULL;
|
||||
}
|
||||
|
||||
static int mes_v11_0_allocate_ucode_buffer(struct amdgpu_device *adev,
|
||||
enum admgpu_mes_pipe pipe)
|
||||
{
|
||||
@ -1091,7 +1017,6 @@ static int mes_v11_0_sw_init(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int pipe, r;
|
||||
|
||||
adev->mes.adev = adev;
|
||||
adev->mes.funcs = &mes_v11_0_funcs;
|
||||
adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init;
|
||||
adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini;
|
||||
@ -1104,10 +1029,6 @@ static int mes_v11_0_sw_init(void *handle)
|
||||
if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE)
|
||||
continue;
|
||||
|
||||
r = mes_v11_0_init_microcode(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = mes_v11_0_allocate_eop_buf(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
@ -1144,8 +1065,7 @@ static int mes_v11_0_sw_fini(void *handle)
|
||||
amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj[pipe],
|
||||
&adev->mes.eop_gpu_addr[pipe],
|
||||
NULL);
|
||||
|
||||
mes_v11_0_free_microcode(adev, pipe);
|
||||
amdgpu_ucode_release(&adev->mes.fw[pipe]);
|
||||
}
|
||||
|
||||
amdgpu_bo_free_kernel(&adev->gfx.kiq.ring.mqd_obj,
|
||||
@ -1342,6 +1262,22 @@ static int mes_v11_0_resume(void *handle)
|
||||
return amdgpu_mes_resume(adev);
|
||||
}
|
||||
|
||||
static int mes_v11_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int pipe, r;
|
||||
|
||||
for (pipe = 0; pipe < AMDGPU_MAX_MES_PIPES; pipe++) {
|
||||
if (!adev->enable_mes_kiq && pipe == AMDGPU_MES_KIQ_PIPE)
|
||||
continue;
|
||||
r = amdgpu_mes_init_microcode(adev, pipe);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mes_v11_0_late_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@ -1356,6 +1292,7 @@ static int mes_v11_0_late_init(void *handle)
|
||||
|
||||
static const struct amd_ip_funcs mes_v11_0_ip_funcs = {
|
||||
.name = "mes_v11_0",
|
||||
.early_init = mes_v11_0_early_init,
|
||||
.late_init = mes_v11_0_late_init,
|
||||
.sw_init = mes_v11_0_sw_init,
|
||||
.sw_fini = mes_v11_0_sw_fini,
|
||||
|
@ -47,83 +47,17 @@ MODULE_FIRMWARE("amdgpu/raven_ta.bin");
|
||||
static int psp_v10_0_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char fw_name[30];
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
const struct ta_firmware_header_v1_0 *ta_hdr;
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
chip_name = "raven2";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
chip_name = "picasso";
|
||||
else
|
||||
chip_name = "raven";
|
||||
break;
|
||||
default: BUG();
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
dev_info(adev->dev,
|
||||
"psp v10.0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
} else {
|
||||
err = amdgpu_ucode_validate(adev->psp.ta_fw);
|
||||
if (err)
|
||||
goto out2;
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v1_0 *)
|
||||
adev->psp.ta_fw->data;
|
||||
adev->psp.hdcp_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->hdcp.fw_version);
|
||||
adev->psp.hdcp_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->hdcp.size_bytes);
|
||||
adev->psp.hdcp_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
adev->psp.dtm_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->dtm.fw_version);
|
||||
adev->psp.dtm_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->dtm.size_bytes);
|
||||
adev->psp.dtm_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->dtm.offset_bytes);
|
||||
|
||||
adev->psp.securedisplay_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->securedisplay.fw_version);
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->securedisplay.size_bytes);
|
||||
adev->psp.securedisplay_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->securedisplay.offset_bytes);
|
||||
|
||||
adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"psp v10.0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
}
|
||||
|
||||
return err;
|
||||
return psp_init_ta_microcode(psp, ucode_prefix);
|
||||
}
|
||||
|
||||
static int psp_v10_0_ring_create(struct psp_context *psp,
|
||||
|
@ -88,159 +88,56 @@ MODULE_FIRMWARE("amdgpu/beige_goby_ta.bin");
|
||||
static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char fw_name[PSP_FW_NAME_LEN];
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
const struct ta_firmware_header_v1_0 *ta_hdr;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 2):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 5):
|
||||
chip_name = "navi14";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 9):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 4):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 7):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 11):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case IP_VERSION(11, 5, 0):
|
||||
chip_name = "vangogh";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 12):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 13):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 2):
|
||||
case IP_VERSION(11, 0, 4):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
dev_info(adev->dev,
|
||||
"psp v11.0: Failed to load firmware \"%s\"\n", fw_name);
|
||||
} else {
|
||||
err = amdgpu_ucode_validate(adev->psp.ta_fw);
|
||||
if (err)
|
||||
goto out2;
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
|
||||
adev->psp.xgmi_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->xgmi.fw_version);
|
||||
adev->psp.xgmi_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->xgmi.size_bytes);
|
||||
adev->psp.xgmi_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
|
||||
adev->psp.ras_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->ras.fw_version);
|
||||
adev->psp.ras_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->ras.size_bytes);
|
||||
adev->psp.ras_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.xgmi_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->ras.offset_bytes);
|
||||
}
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0;
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 5):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
dev_info(adev->dev,
|
||||
"psp v11.0: Failed to load firmware \"%s\"\n", fw_name);
|
||||
} else {
|
||||
err = amdgpu_ucode_validate(adev->psp.ta_fw);
|
||||
if (err)
|
||||
goto out2;
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
|
||||
adev->psp.hdcp_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->hdcp.fw_version);
|
||||
adev->psp.hdcp_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->hdcp.size_bytes);
|
||||
adev->psp.hdcp_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(
|
||||
ta_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
|
||||
|
||||
adev->psp.dtm_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->dtm.fw_version);
|
||||
adev->psp.dtm_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->dtm.size_bytes);
|
||||
adev->psp.dtm_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context
|
||||
.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->dtm.offset_bytes);
|
||||
}
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0;
|
||||
break;
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_ta_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
break;
|
||||
case IP_VERSION(11, 5, 0):
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_toc_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_toc_microcode(psp, ucode_prefix);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -48,83 +48,25 @@ MODULE_FIRMWARE("amdgpu/green_sardine_ta.bin");
|
||||
static int psp_v12_0_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char fw_name[30];
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
const struct ta_firmware_header_v1_0 *ta_hdr;
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RENOIR:
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
chip_name = "renoir";
|
||||
else
|
||||
chip_name = "green_sardine";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
|
||||
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
|
||||
if (err) {
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
dev_info(adev->dev,
|
||||
"psp v12.0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
} else {
|
||||
err = amdgpu_ucode_validate(adev->psp.ta_fw);
|
||||
if (err)
|
||||
goto out;
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ta_hdr = (const struct ta_firmware_header_v1_0 *)
|
||||
adev->psp.ta_fw->data;
|
||||
adev->psp.hdcp_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->hdcp.fw_version);
|
||||
adev->psp.hdcp_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->hdcp.size_bytes);
|
||||
adev->psp.hdcp_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)ta_hdr +
|
||||
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
|
||||
|
||||
adev->psp.dtm_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->dtm.fw_version);
|
||||
adev->psp.dtm_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->dtm.size_bytes);
|
||||
adev->psp.dtm_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->dtm.offset_bytes);
|
||||
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR) {
|
||||
adev->psp.securedisplay_context.context.bin_desc.fw_version =
|
||||
le32_to_cpu(ta_hdr->securedisplay.fw_version);
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes =
|
||||
le32_to_cpu(ta_hdr->securedisplay.size_bytes);
|
||||
adev->psp.securedisplay_context.context.bin_desc.start_addr =
|
||||
(uint8_t *)adev->psp.hdcp_context.context.bin_desc.start_addr +
|
||||
le32_to_cpu(ta_hdr->securedisplay.offset_bytes);
|
||||
}
|
||||
}
|
||||
/* only supported on renoir */
|
||||
if (!(adev->apu_flags & AMD_APU_IS_RENOIR))
|
||||
adev->psp.securedisplay_context.context.bin_desc.size_bytes = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
release_firmware(adev->psp.ta_fw);
|
||||
adev->psp.ta_fw = NULL;
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"psp v12.0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int psp_v12_0_bootloader_load_sysdrv(struct psp_context *psp)
|
||||
|
@ -70,32 +70,19 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_11_ta.bin");
|
||||
static int psp_v13_0_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
chip_name = "yellow_carp";
|
||||
break;
|
||||
default:
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
chip_name = ucode_prefix;
|
||||
break;
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
/* It's not necessary to load ras ta on Guest side */
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
err = psp_init_ta_microcode(&adev->psp, chip_name);
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -105,21 +92,21 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)
|
||||
case IP_VERSION(13, 0, 5):
|
||||
case IP_VERSION(13, 0, 8):
|
||||
case IP_VERSION(13, 0, 11):
|
||||
err = psp_init_toc_microcode(psp, chip_name);
|
||||
err = psp_init_toc_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_ta_microcode(psp, chip_name);
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case IP_VERSION(13, 0, 0):
|
||||
case IP_VERSION(13, 0, 7):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
/* It's not necessary to load ras ta on Guest side */
|
||||
err = psp_init_ta_microcode(psp, chip_name);
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
|
@ -35,25 +35,17 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_4_ta.bin");
|
||||
static int psp_v13_0_4_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 4):
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
chip_name = ucode_prefix;
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 4):
|
||||
err = psp_init_toc_microcode(psp, chip_name);
|
||||
err = psp_init_toc_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_ta_microcode(psp, chip_name);
|
||||
err = psp_init_ta_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
|
@ -57,26 +57,18 @@ static int psp_v3_1_ring_stop(struct psp_context *psp,
|
||||
static int psp_v3_1_init_microcode(struct psp_context *psp)
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
const char *chip_name;
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
chip_name = "vega10";
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
chip_name = "vega12";
|
||||
break;
|
||||
default: BUG();
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
err = psp_init_sos_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
err = psp_init_asd_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -113,10 +113,9 @@ static void sdma_v2_4_init_golden_registers(struct amdgpu_device *adev)
|
||||
static void sdma_v2_4_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,10 +150,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name);
|
||||
err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->sdma.instance[i].fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data;
|
||||
@ -176,10 +172,8 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)
|
||||
out:
|
||||
if (err) {
|
||||
pr_err("sdma_v2_4: Failed to load firmware \"%s\"\n", fw_name);
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -250,10 +250,9 @@ static void sdma_v3_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
static void sdma_v3_0_free_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,10 +308,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name);
|
||||
err = request_firmware(&adev->sdma.instance[i].fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->sdma.instance[i].fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->sdma.instance[i].fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma.instance[i].fw->data;
|
||||
@ -332,10 +328,8 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)
|
||||
out:
|
||||
if (err) {
|
||||
pr_err("sdma_v3_0: Failed to load firmware \"%s\"\n", fw_name);
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
adev->sdma.instance[i].fw = NULL;
|
||||
}
|
||||
for (i = 0; i < adev->sdma.num_instances; i++)
|
||||
amdgpu_ucode_release(&adev->sdma.instance[i].fw);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
@ -575,60 +575,17 @@ static void sdma_v4_0_setup_ulv(struct amdgpu_device *adev)
|
||||
// vega10 real chip need to use PSP to load firmware
|
||||
static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const char *chip_name;
|
||||
char fw_name[30];
|
||||
int ret, i;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
chip_name = "vega10";
|
||||
break;
|
||||
case IP_VERSION(4, 0, 1):
|
||||
chip_name = "vega12";
|
||||
break;
|
||||
case IP_VERSION(4, 2, 0):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
chip_name = "raven2";
|
||||
else if (adev->apu_flags & AMD_APU_IS_PICASSO)
|
||||
chip_name = "picasso";
|
||||
else
|
||||
chip_name = "raven";
|
||||
break;
|
||||
case IP_VERSION(4, 2, 2):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case IP_VERSION(4, 1, 2):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
chip_name = "renoir";
|
||||
else
|
||||
chip_name = "green_sardine";
|
||||
break;
|
||||
case IP_VERSION(4, 4, 0):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
if (i == 0)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma%d.bin", chip_name, i);
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) ||
|
||||
adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 4, 0)) {
|
||||
/* Acturus & Aldebaran will leverage the same FW memory
|
||||
for every SDMA instance */
|
||||
ret = amdgpu_sdma_init_microcode(adev, fw_name, 0, true);
|
||||
ret = amdgpu_sdma_init_microcode(adev, 0, true);
|
||||
break;
|
||||
} else {
|
||||
ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false);
|
||||
ret = amdgpu_sdma_init_microcode(adev, i, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
@ -237,39 +237,13 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
// emulation only, won't work on real chip
|
||||
// navi10 real chip need to use PSP to load firmware
|
||||
static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const char *chip_name;
|
||||
char fw_name[40];
|
||||
int ret, i;
|
||||
{ int ret, i;
|
||||
|
||||
if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 0, 5)))
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 0, 0):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case IP_VERSION(5, 0, 2):
|
||||
chip_name = "navi14";
|
||||
break;
|
||||
case IP_VERSION(5, 0, 5):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case IP_VERSION(5, 0, 1):
|
||||
chip_name = "cyan_skillfish2";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
if (i == 0)
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma.bin", chip_name);
|
||||
else
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sdma1.bin", chip_name);
|
||||
ret = amdgpu_sdma_init_microcode(adev, fw_name, i, false);
|
||||
ret = amdgpu_sdma_init_microcode(adev, i, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
@ -89,59 +89,6 @@ static u32 sdma_v5_2_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3
|
||||
return base + internal_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* sdma_v5_2_init_microcode - load ucode images from disk
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Use the firmware interface to load the ucode images into
|
||||
* the driver (not loaded into hw).
|
||||
* Returns 0 on success, error on failure.
|
||||
*/
|
||||
|
||||
// emulation only, won't work on real chip
|
||||
// navi10 real chip need to use PSP to load firmware
|
||||
static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const char *chip_name;
|
||||
char fw_name[40];
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 2, 0):
|
||||
chip_name = "sienna_cichlid_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 2):
|
||||
chip_name = "navy_flounder_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 1):
|
||||
chip_name = "vangogh_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 4):
|
||||
chip_name = "dimgrey_cavefish_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 5):
|
||||
chip_name = "beige_goby_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 3):
|
||||
chip_name = "yellow_carp_sdma";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 6):
|
||||
chip_name = "sdma_5_2_6";
|
||||
break;
|
||||
case IP_VERSION(5, 2, 7):
|
||||
chip_name = "sdma_5_2_7";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name);
|
||||
|
||||
return amdgpu_sdma_init_microcode(adev, fw_name, 0, true);
|
||||
}
|
||||
|
||||
static unsigned sdma_v5_2_ring_init_cond_exec(struct amdgpu_ring *ring)
|
||||
{
|
||||
unsigned ret;
|
||||
@ -1288,7 +1235,7 @@ static int sdma_v5_2_sw_init(void *handle)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = sdma_v5_2_init_microcode(adev);
|
||||
r = amdgpu_sdma_init_microcode(adev, 0, true);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to load sdma firmware!\n");
|
||||
return r;
|
||||
|
@ -78,29 +78,6 @@ static u32 sdma_v6_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3
|
||||
return base + internal_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* sdma_v6_0_init_microcode - load ucode images from disk
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Use the firmware interface to load the ucode images into
|
||||
* the driver (not loaded into hw).
|
||||
* Returns 0 on success, error on failure.
|
||||
*/
|
||||
static int sdma_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
char fw_name[30];
|
||||
char ucode_prefix[30];
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
amdgpu_ucode_ip_version_decode(adev, SDMA0_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
|
||||
|
||||
return amdgpu_sdma_init_microcode(adev, fw_name, 0, true);
|
||||
}
|
||||
|
||||
static unsigned sdma_v6_0_ring_init_cond_exec(struct amdgpu_ring *ring)
|
||||
{
|
||||
unsigned ret;
|
||||
@ -1260,7 +1237,7 @@ static int sdma_v6_0_sw_init(void *handle)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = sdma_v6_0_init_microcode(adev);
|
||||
r = amdgpu_sdma_init_microcode(adev, 0, true);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to load sdma firmware!\n");
|
||||
return r;
|
||||
|
@ -57,11 +57,12 @@ static void vcn_v1_0_idle_work_handler(struct work_struct *work);
|
||||
static void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
|
||||
|
||||
/**
|
||||
* vcn_v1_0_early_init - set function pointers
|
||||
* vcn_v1_0_early_init - set function pointers and load microcode
|
||||
*
|
||||
* @handle: amdgpu_device pointer
|
||||
*
|
||||
* Set ring and irq function pointers
|
||||
* Load microcode from filesystem
|
||||
*/
|
||||
static int vcn_v1_0_early_init(void *handle)
|
||||
{
|
||||
@ -75,7 +76,7 @@ static int vcn_v1_0_early_init(void *handle)
|
||||
|
||||
jpeg_v1_0_early_init(handle);
|
||||
|
||||
return 0;
|
||||
return amdgpu_vcn_early_init(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,11 +62,12 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
|
||||
int inst_idx, struct dpg_pause_state *new_state);
|
||||
static int vcn_v2_0_start_sriov(struct amdgpu_device *adev);
|
||||
/**
|
||||
* vcn_v2_0_early_init - set function pointers
|
||||
* vcn_v2_0_early_init - set function pointers and load microcode
|
||||
*
|
||||
* @handle: amdgpu_device pointer
|
||||
*
|
||||
* Set ring and irq function pointers
|
||||
* Load microcode from filesystem
|
||||
*/
|
||||
static int vcn_v2_0_early_init(void *handle)
|
||||
{
|
||||
@ -81,7 +82,7 @@ static int vcn_v2_0_early_init(void *handle)
|
||||
vcn_v2_0_set_enc_ring_funcs(adev);
|
||||
vcn_v2_0_set_irq_funcs(adev);
|
||||
|
||||
return 0;
|
||||
return amdgpu_vcn_early_init(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,11 +71,12 @@ static int amdgpu_ih_clientid_vcns[] = {
|
||||
};
|
||||
|
||||
/**
|
||||
* vcn_v2_5_early_init - set function pointers
|
||||
* vcn_v2_5_early_init - set function pointers and load microcode
|
||||
*
|
||||
* @handle: amdgpu_device pointer
|
||||
*
|
||||
* Set ring and irq function pointers
|
||||
* Load microcode from filesystem
|
||||
*/
|
||||
static int vcn_v2_5_early_init(void *handle)
|
||||
{
|
||||
@ -107,7 +108,7 @@ static int vcn_v2_5_early_init(void *handle)
|
||||
vcn_v2_5_set_irq_funcs(adev);
|
||||
vcn_v2_5_set_ras_funcs(adev);
|
||||
|
||||
return 0;
|
||||
return amdgpu_vcn_early_init(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,11 +78,12 @@ static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring);
|
||||
static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring);
|
||||
|
||||
/**
|
||||
* vcn_v3_0_early_init - set function pointers
|
||||
* vcn_v3_0_early_init - set function pointers and load microcode
|
||||
*
|
||||
* @handle: amdgpu_device pointer
|
||||
*
|
||||
* Set ring and irq function pointers
|
||||
* Load microcode from filesystem
|
||||
*/
|
||||
static int vcn_v3_0_early_init(void *handle)
|
||||
{
|
||||
@ -109,7 +110,7 @@ static int vcn_v3_0_early_init(void *handle)
|
||||
vcn_v3_0_set_enc_ring_funcs(adev);
|
||||
vcn_v3_0_set_irq_funcs(adev);
|
||||
|
||||
return 0;
|
||||
return amdgpu_vcn_early_init(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,11 +68,12 @@ static void vcn_v4_0_unified_ring_set_wptr(struct amdgpu_ring *ring);
|
||||
static void vcn_v4_0_set_ras_funcs(struct amdgpu_device *adev);
|
||||
|
||||
/**
|
||||
* vcn_v4_0_early_init - set function pointers
|
||||
* vcn_v4_0_early_init - set function pointers and load microcode
|
||||
*
|
||||
* @handle: amdgpu_device pointer
|
||||
*
|
||||
* Set ring and irq function pointers
|
||||
* Load microcode from filesystem
|
||||
*/
|
||||
static int vcn_v4_0_early_init(void *handle)
|
||||
{
|
||||
@ -88,7 +89,7 @@ static int vcn_v4_0_early_init(void *handle)
|
||||
vcn_v4_0_set_irq_funcs(adev);
|
||||
vcn_v4_0_set_ras_funcs(adev);
|
||||
|
||||
return 0;
|
||||
return amdgpu_vcn_early_init(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1127,8 +1127,13 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
|
||||
}
|
||||
|
||||
/* Update the VRAM usage count */
|
||||
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
|
||||
WRITE_ONCE(pdd->vram_usage, pdd->vram_usage + args->size);
|
||||
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
|
||||
uint64_t size = args->size;
|
||||
|
||||
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM)
|
||||
size >>= 1;
|
||||
WRITE_ONCE(pdd->vram_usage, pdd->vram_usage + PAGE_ALIGN(size));
|
||||
}
|
||||
|
||||
mutex_unlock(&p->mutex);
|
||||
|
||||
|
@ -200,7 +200,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
|
||||
queue_input.wptr_addr = (uint64_t)q->properties.write_ptr;
|
||||
|
||||
if (q->wptr_bo) {
|
||||
wptr_addr_off = (uint64_t)q->properties.write_ptr - (uint64_t)q->wptr_bo->kfd_bo->va;
|
||||
wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
|
||||
queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
|
||||
}
|
||||
|
||||
|
@ -1027,8 +1027,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
|
||||
/* Disable SVM support capability */
|
||||
pgmap->type = 0;
|
||||
if (pgmap->type == MEMORY_DEVICE_PRIVATE)
|
||||
devm_release_mem_region(adev->dev, res->start,
|
||||
res->end - res->start + 1);
|
||||
devm_release_mem_region(adev->dev, res->start, resource_size(res));
|
||||
return PTR_ERR(r);
|
||||
}
|
||||
|
||||
|
@ -1563,6 +1563,8 @@ err_free_pdd:
|
||||
int kfd_process_device_init_vm(struct kfd_process_device *pdd,
|
||||
struct file *drm_file)
|
||||
{
|
||||
struct amdgpu_fpriv *drv_priv;
|
||||
struct amdgpu_vm *avm;
|
||||
struct kfd_process *p;
|
||||
struct kfd_dev *dev;
|
||||
int ret;
|
||||
@ -1573,10 +1575,15 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
|
||||
if (pdd->drm_priv)
|
||||
return -EBUSY;
|
||||
|
||||
ret = amdgpu_file_to_fpriv(drm_file, &drv_priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
avm = &drv_priv->vm;
|
||||
|
||||
p = pdd->process;
|
||||
dev = pdd->dev;
|
||||
|
||||
ret = amdgpu_amdkfd_gpuvm_acquire_process_vm(dev->adev, drm_file,
|
||||
ret = amdgpu_amdkfd_gpuvm_acquire_process_vm(dev->adev, avm,
|
||||
&p->kgd_process_info,
|
||||
&p->ef);
|
||||
if (ret) {
|
||||
@ -1593,7 +1600,7 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
|
||||
if (ret)
|
||||
goto err_init_cwsr;
|
||||
|
||||
ret = amdgpu_amdkfd_gpuvm_set_vm_pasid(dev->adev, drm_file, p->pasid);
|
||||
ret = amdgpu_amdkfd_gpuvm_set_vm_pasid(dev->adev, avm, p->pasid);
|
||||
if (ret)
|
||||
goto err_set_pasid;
|
||||
|
||||
@ -1607,6 +1614,7 @@ err_init_cwsr:
|
||||
kfd_process_device_destroy_ib_mem(pdd);
|
||||
err_reserve_ib_mem:
|
||||
pdd->drm_priv = NULL;
|
||||
amdgpu_amdkfd_gpuvm_destroy_cb(dev->adev, avm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -571,6 +571,15 @@ svm_range_vram_node_new(struct amdgpu_device *adev, struct svm_range *prange,
|
||||
goto reserve_bo_failed;
|
||||
}
|
||||
|
||||
if (clear) {
|
||||
r = amdgpu_bo_sync_wait(bo, AMDGPU_FENCE_OWNER_KFD, false);
|
||||
if (r) {
|
||||
pr_debug("failed %d to sync bo\n", r);
|
||||
amdgpu_bo_unreserve(bo);
|
||||
goto reserve_bo_failed;
|
||||
}
|
||||
}
|
||||
|
||||
r = dma_resv_reserve_fences(bo->tbo.base.resv, 1);
|
||||
if (r) {
|
||||
pr_debug("failed %d to reserve bo\n", r);
|
||||
|
@ -1883,25 +1883,17 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = request_firmware_direct(&adev->dm.fw_dmcu, fw_name_dmcu, adev->dev);
|
||||
if (r == -ENOENT) {
|
||||
r = amdgpu_ucode_request(adev, &adev->dm.fw_dmcu, fw_name_dmcu);
|
||||
if (r == -ENODEV) {
|
||||
/* DMCU firmware is not necessary, so don't raise a fuss if it's missing */
|
||||
DRM_DEBUG_KMS("dm: DMCU firmware not found\n");
|
||||
adev->dm.fw_dmcu = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_dm: Can't load firmware \"%s\"\n",
|
||||
fw_name_dmcu);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_ucode_validate(adev->dm.fw_dmcu);
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_dm: Can't validate firmware \"%s\"\n",
|
||||
fw_name_dmcu);
|
||||
release_firmware(adev->dm.fw_dmcu);
|
||||
adev->dm.fw_dmcu = NULL;
|
||||
amdgpu_ucode_release(&adev->dm.fw_dmcu);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1947,7 +1939,6 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
|
||||
struct dmub_srv_fb_info *fb_info;
|
||||
struct dmub_srv *dmub_srv;
|
||||
const struct dmcub_firmware_header_v1_0 *hdr;
|
||||
const char *fw_name_dmub;
|
||||
enum dmub_asic dmub_asic;
|
||||
enum dmub_status status;
|
||||
int r;
|
||||
@ -1955,73 +1946,46 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
dmub_asic = DMUB_ASIC_DCN21;
|
||||
fw_name_dmub = FIRMWARE_RENOIR_DMUB;
|
||||
if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
|
||||
fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 0):
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
|
||||
dmub_asic = DMUB_ASIC_DCN30;
|
||||
fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB;
|
||||
} else {
|
||||
else
|
||||
dmub_asic = DMUB_ASIC_DCN30;
|
||||
fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
|
||||
}
|
||||
break;
|
||||
case IP_VERSION(3, 0, 1):
|
||||
dmub_asic = DMUB_ASIC_DCN301;
|
||||
fw_name_dmub = FIRMWARE_VANGOGH_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 2):
|
||||
dmub_asic = DMUB_ASIC_DCN302;
|
||||
fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 3):
|
||||
dmub_asic = DMUB_ASIC_DCN303;
|
||||
fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
dmub_asic = (adev->external_rev_id == YELLOW_CARP_B0) ? DMUB_ASIC_DCN31B : DMUB_ASIC_DCN31;
|
||||
fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 4):
|
||||
dmub_asic = DMUB_ASIC_DCN314;
|
||||
fw_name_dmub = FIRMWARE_DCN_314_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 5):
|
||||
dmub_asic = DMUB_ASIC_DCN315;
|
||||
fw_name_dmub = FIRMWARE_DCN_315_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 6):
|
||||
dmub_asic = DMUB_ASIC_DCN316;
|
||||
fw_name_dmub = FIRMWARE_DCN316_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 2, 0):
|
||||
dmub_asic = DMUB_ASIC_DCN32;
|
||||
fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB;
|
||||
break;
|
||||
case IP_VERSION(3, 2, 1):
|
||||
dmub_asic = DMUB_ASIC_DCN321;
|
||||
fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB;
|
||||
break;
|
||||
default:
|
||||
/* ASIC doesn't support DMUB. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = request_firmware_direct(&adev->dm.dmub_fw, fw_name_dmub, adev->dev);
|
||||
if (r) {
|
||||
DRM_ERROR("DMUB firmware loading failed: %d\n", r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = amdgpu_ucode_validate(adev->dm.dmub_fw);
|
||||
if (r) {
|
||||
DRM_ERROR("Couldn't validate DMUB firmware: %d\n", r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hdr = (const struct dmcub_firmware_header_v1_0 *)adev->dm.dmub_fw->data;
|
||||
adev->dm.dmcub_fw_version = le32_to_cpu(hdr->header.ucode_version);
|
||||
|
||||
@ -2145,11 +2109,8 @@ static int dm_sw_fini(void *handle)
|
||||
adev->dm.dmub_srv = NULL;
|
||||
}
|
||||
|
||||
release_firmware(adev->dm.dmub_fw);
|
||||
adev->dm.dmub_fw = NULL;
|
||||
|
||||
release_firmware(adev->dm.fw_dmcu);
|
||||
adev->dm.fw_dmcu = NULL;
|
||||
amdgpu_ucode_release(&adev->dm.dmub_fw);
|
||||
amdgpu_ucode_release(&adev->dm.fw_dmcu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4518,6 +4479,61 @@ DEVICE_ATTR_WO(s3_debug);
|
||||
|
||||
#endif
|
||||
|
||||
static int dm_init_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
char *fw_name_dmub;
|
||||
int r;
|
||||
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
fw_name_dmub = FIRMWARE_RENOIR_DMUB;
|
||||
if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
|
||||
fw_name_dmub = FIRMWARE_GREEN_SARDINE_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 0):
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
|
||||
fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB;
|
||||
else
|
||||
fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 1):
|
||||
fw_name_dmub = FIRMWARE_VANGOGH_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 2):
|
||||
fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 0, 3):
|
||||
fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 4):
|
||||
fw_name_dmub = FIRMWARE_DCN_314_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 5):
|
||||
fw_name_dmub = FIRMWARE_DCN_315_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 6):
|
||||
fw_name_dmub = FIRMWARE_DCN316_DMUB;
|
||||
break;
|
||||
case IP_VERSION(3, 2, 0):
|
||||
fw_name_dmub = FIRMWARE_DCN_V3_2_0_DMCUB;
|
||||
break;
|
||||
case IP_VERSION(3, 2, 1):
|
||||
fw_name_dmub = FIRMWARE_DCN_V3_2_1_DMCUB;
|
||||
break;
|
||||
default:
|
||||
/* ASIC doesn't support DMUB. */
|
||||
return 0;
|
||||
}
|
||||
r = amdgpu_ucode_request(adev, &adev->dm.dmub_fw, fw_name_dmub);
|
||||
if (r)
|
||||
DRM_ERROR("DMUB firmware loading failed: %d\n", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dm_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@ -4650,7 +4666,7 @@ static int dm_early_init(void *handle)
|
||||
#endif
|
||||
adev->dc_enabled = true;
|
||||
|
||||
return 0;
|
||||
return dm_init_microcode(adev);
|
||||
}
|
||||
|
||||
static bool modereset_required(struct drm_crtc_state *crtc_state)
|
||||
@ -7428,7 +7444,7 @@ static bool is_content_protection_different(struct drm_crtc_state *new_crtc_stat
|
||||
new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
|
||||
pr_debug("[HDCP_DM] ENABLED->DESIRED & mode_changed %s :true\n", __func__);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_ENABLED;
|
||||
pr_debug("[HDCP_DM] ENABLED -> DESIRED %s :false\n", __func__);
|
||||
return false;
|
||||
@ -7482,11 +7498,11 @@ static bool is_content_protection_different(struct drm_crtc_state *new_crtc_stat
|
||||
pr_debug("[HDCP_DM] DESIRED->DESIRED or ENABLE->ENABLE mode_change %s :true\n",
|
||||
__func__);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
pr_debug("[HDCP_DM] DESIRED->DESIRED & ENABLE->ENABLE %s :false\n",
|
||||
__func__);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
pr_debug("[HDCP_DM] UNDESIRED->UNDESIRED %s :false\n", __func__);
|
||||
return false;
|
||||
|
@ -122,6 +122,9 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream)
|
||||
psr_config.allow_multi_disp_optimizations =
|
||||
(amdgpu_dc_feature_mask & DC_PSR_ALLOW_MULTI_DISP_OPT);
|
||||
|
||||
if (!psr_su_set_y_granularity(dc, link, stream, &psr_config))
|
||||
return false;
|
||||
|
||||
ret = dc_link_setup_psr(link, stream, &psr_config, &psr_context);
|
||||
|
||||
}
|
||||
|
@ -577,8 +577,7 @@ void dcn3_clk_mgr_construct(
|
||||
|
||||
void dcn3_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
|
||||
{
|
||||
if (clk_mgr->base.bw_params)
|
||||
kfree(clk_mgr->base.bw_params);
|
||||
kfree(clk_mgr->base.bw_params);
|
||||
|
||||
if (clk_mgr->wm_range_table)
|
||||
dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
|
||||
|
@ -783,8 +783,7 @@ void dcn32_clk_mgr_construct(
|
||||
|
||||
void dcn32_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
|
||||
{
|
||||
if (clk_mgr->base.bw_params)
|
||||
kfree(clk_mgr->base.bw_params);
|
||||
kfree(clk_mgr->base.bw_params);
|
||||
|
||||
if (clk_mgr->wm_range_table)
|
||||
dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
|
||||
|
@ -408,7 +408,7 @@ bool dc_stream_set_cursor_position(
|
||||
struct dc_stream_state *stream,
|
||||
const struct dc_cursor_position *position)
|
||||
{
|
||||
struct dc *dc = stream->ctx->dc;
|
||||
struct dc *dc;
|
||||
bool reset_idle_optimizations = false;
|
||||
|
||||
if (NULL == stream) {
|
||||
|
@ -916,3 +916,34 @@ bool mod_power_only_edp(const struct dc_state *context, const struct dc_stream_s
|
||||
{
|
||||
return context && context->stream_count == 1 && dc_is_embedded_signal(stream->signal);
|
||||
}
|
||||
|
||||
bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
|
||||
struct dc_stream_state *stream,
|
||||
struct psr_config *config)
|
||||
{
|
||||
uint16_t pic_height;
|
||||
uint8_t slice_height;
|
||||
|
||||
if ((link->connector_signal & SIGNAL_TYPE_EDP) &&
|
||||
(!dc->caps.edp_dsc_support ||
|
||||
link->panel_config.dsc.disable_dsc_edp ||
|
||||
!link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT ||
|
||||
!stream->timing.dsc_cfg.num_slices_v))
|
||||
return true;
|
||||
|
||||
pic_height = stream->timing.v_addressable +
|
||||
stream->timing.v_border_top + stream->timing.v_border_bottom;
|
||||
slice_height = pic_height / stream->timing.dsc_cfg.num_slices_v;
|
||||
|
||||
if (slice_height) {
|
||||
if (config->su_y_granularity &&
|
||||
(slice_height % config->su_y_granularity)) {
|
||||
ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
config->su_y_granularity = slice_height;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -59,4 +59,7 @@ void mod_power_calc_psr_configs(struct psr_config *psr_config,
|
||||
const struct dc_stream_state *stream);
|
||||
bool mod_power_only_edp(const struct dc_state *context,
|
||||
const struct dc_stream_state *stream);
|
||||
bool psr_su_set_y_granularity(struct dc *dc, struct dc_link *link,
|
||||
struct dc_stream_state *stream,
|
||||
struct psr_config *config);
|
||||
#endif /* MODULES_POWER_POWER_HELPERS_H_ */
|
||||
|
@ -7714,20 +7714,13 @@ static int si_dpm_init_microcode(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name);
|
||||
err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->pm.fw);
|
||||
|
||||
out:
|
||||
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
|
||||
if (err) {
|
||||
DRM_ERROR("si_smc: Failed to load firmware. err = %d\"%s\"\n",
|
||||
err, fw_name);
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
}
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
static int si_dpm_sw_init(void *handle)
|
||||
|
@ -111,8 +111,7 @@ static int pp_sw_fini(void *handle)
|
||||
|
||||
hwmgr_sw_fini(hwmgr);
|
||||
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -623,6 +623,7 @@ static int smu_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct smu_context *smu;
|
||||
int r;
|
||||
|
||||
smu = kzalloc(sizeof(struct smu_context), GFP_KERNEL);
|
||||
if (!smu)
|
||||
@ -640,7 +641,10 @@ static int smu_early_init(void *handle)
|
||||
adev->powerplay.pp_handle = smu;
|
||||
adev->powerplay.pp_funcs = &swsmu_pm_funcs;
|
||||
|
||||
return smu_set_funcs(adev);
|
||||
r = smu_set_funcs(adev);
|
||||
if (r)
|
||||
return r;
|
||||
return smu_init_microcode(smu);
|
||||
}
|
||||
|
||||
static int smu_set_default_dpm_table(struct smu_context *smu)
|
||||
@ -1067,12 +1071,6 @@ static int smu_sw_init(void *handle)
|
||||
smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
|
||||
smu->smu_dpm.requested_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
|
||||
|
||||
ret = smu_init_microcode(smu);
|
||||
if (ret) {
|
||||
dev_err(adev->dev, "Failed to load smu firmware!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = smu_smc_table_sw_init(smu);
|
||||
if (ret) {
|
||||
dev_err(adev->dev, "Failed to sw init smc table!\n");
|
||||
|
@ -93,7 +93,7 @@ static void smu_v11_0_poll_baco_exit(struct smu_context *smu)
|
||||
int smu_v11_0_init_microcode(struct smu_context *smu)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
const char *chip_name;
|
||||
char ucode_prefix[30];
|
||||
char fw_name[SMU_FW_NAME_LEN];
|
||||
int err = 0;
|
||||
const struct smc_firmware_header_v1_0 *hdr;
|
||||
@ -105,43 +105,11 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
|
||||
(adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7))))
|
||||
return 0;
|
||||
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 0):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 5):
|
||||
chip_name = "navi14";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 9):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 7):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 11):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 12):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 13):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
case IP_VERSION(11, 0, 2):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
default:
|
||||
dev_err(adev->dev, "Unsupported IP version 0x%x\n",
|
||||
adev->ip_versions[MP1_HWIP][0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
|
||||
|
||||
err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->pm.fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -159,12 +127,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
|
||||
}
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
DRM_ERROR("smu_v11_0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
}
|
||||
if (err)
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -172,8 +136,7 @@ void smu_v11_0_fini_microcode(struct smu_context *smu)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
adev->pm.fw_version = 0;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,6 @@ static const int link_speed[] = {25, 50, 80, 160};
|
||||
int smu_v13_0_init_microcode(struct smu_context *smu)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
const char *chip_name;
|
||||
char fw_name[30];
|
||||
char ucode_prefix[30];
|
||||
int err = 0;
|
||||
@ -100,21 +99,11 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
chip_name = "aldebaran_smc";
|
||||
break;
|
||||
default:
|
||||
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
chip_name = ucode_prefix;
|
||||
}
|
||||
amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name);
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
|
||||
|
||||
err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
err = amdgpu_ucode_validate(adev->pm.fw);
|
||||
err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@ -132,12 +121,8 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
|
||||
}
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
DRM_ERROR("smu_v13_0: Failed to load firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
}
|
||||
if (err)
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -145,8 +130,7 @@ void smu_v13_0_fini_microcode(struct smu_context *smu)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
|
||||
release_firmware(adev->pm.fw);
|
||||
adev->pm.fw = NULL;
|
||||
amdgpu_ucode_release(&adev->pm.fw);
|
||||
adev->pm.fw_version = 0;
|
||||
}
|
||||
|
||||
@ -2259,6 +2243,10 @@ bool smu_v13_0_baco_is_support(struct smu_context *smu)
|
||||
!smu_baco->platform_support)
|
||||
return false;
|
||||
|
||||
/* return true if ASIC is in BACO state already */
|
||||
if (smu_v13_0_baco_get_state(smu) == SMU_BACO_STATE_ENTER)
|
||||
return true;
|
||||
|
||||
if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
|
||||
!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
|
||||
return false;
|
||||
|
@ -1023,6 +1023,7 @@ void radeon_atombios_fini(struct radeon_device *rdev)
|
||||
{
|
||||
if (rdev->mode_info.atom_context) {
|
||||
kfree(rdev->mode_info.atom_context->scratch);
|
||||
kfree(rdev->mode_info.atom_context->iio);
|
||||
}
|
||||
kfree(rdev->mode_info.atom_context);
|
||||
rdev->mode_info.atom_context = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user