mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Merge tag 'amd-drm-next-6.1-2022-09-30' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.1-2022-09-30: amdgpu: - RLC FW code cleanup - RLC fixes for GC 11.x - SMU 13.x fixes - CP FW code cleanup - SDMA FW code cleanup - GC 11.x fixes - DCN 3.2.x fixes - DCN 3.1.4 fixes - Misc fixes - RAS fixes - SR-IOV fixes - VCN 4.x fixes amdkfd: - GC 11.x fixes - Xnack fixes - UBSAN warning fix Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220930162012.5823-1-alexander.deucher@amd.com
This commit is contained in:
@@ -1053,6 +1053,10 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->flags & AMD_IS_APU)
|
||||
return false;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return false;
|
||||
|
||||
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -756,11 +756,7 @@ void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bo
|
||||
{
|
||||
struct ras_err_data err_data = {0, 0, 0, NULL};
|
||||
|
||||
/* CPU MCA will handle page retirement if connected_to_cpu is 1 */
|
||||
if (!adev->gmc.xgmi.connected_to_cpu)
|
||||
amdgpu_umc_poison_handler(adev, &err_data, reset);
|
||||
else if (reset)
|
||||
amdgpu_amdkfd_gpu_reset(adev);
|
||||
amdgpu_umc_poison_handler(adev, &err_data, reset);
|
||||
}
|
||||
|
||||
bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev)
|
||||
|
||||
@@ -3154,7 +3154,8 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
|
||||
continue;
|
||||
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
|
||||
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC ||
|
||||
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH) {
|
||||
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH ||
|
||||
(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP && amdgpu_sriov_vf(adev))) {
|
||||
|
||||
r = adev->ip_blocks[i].version->funcs->resume(adev);
|
||||
if (r) {
|
||||
@@ -4069,12 +4070,20 @@ static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||
int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
|
||||
{
|
||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||
int r = 0;
|
||||
|
||||
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
||||
return 0;
|
||||
|
||||
adev->in_suspend = true;
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
amdgpu_virt_fini_data_exchange(adev);
|
||||
r = amdgpu_virt_request_full_gpu(adev, false);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D3))
|
||||
DRM_WARN("smart shift update failed\n");
|
||||
|
||||
@@ -4098,6 +4107,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
|
||||
|
||||
amdgpu_device_ip_suspend_phase2(adev);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
amdgpu_virt_release_full_gpu(adev, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4116,6 +4128,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
|
||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||
int r = 0;
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
r = amdgpu_virt_request_full_gpu(adev, true);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
||||
return 0;
|
||||
|
||||
@@ -4130,6 +4148,13 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
|
||||
}
|
||||
|
||||
r = amdgpu_device_ip_resume(adev);
|
||||
|
||||
/* no matter what r is, always need to properly release full GPU */
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
amdgpu_virt_init_data_exchange(adev);
|
||||
amdgpu_virt_release_full_gpu(adev, true);
|
||||
}
|
||||
|
||||
if (r) {
|
||||
dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r);
|
||||
return r;
|
||||
@@ -5576,9 +5601,9 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
|
||||
~*peer_adev->dev->dma_mask : ~((1ULL << 32) - 1);
|
||||
resource_size_t aper_limit =
|
||||
adev->gmc.aper_base + adev->gmc.aper_size - 1;
|
||||
bool p2p_access = !adev->gmc.xgmi.connected_to_cpu &&
|
||||
!(pci_p2pdma_distance_many(adev->pdev,
|
||||
&peer_adev->dev, 1, true) < 0);
|
||||
bool p2p_access =
|
||||
!adev->gmc.xgmi.connected_to_cpu &&
|
||||
!(pci_p2pdma_distance(adev->pdev, peer_adev->dev, false) < 0);
|
||||
|
||||
return pcie_p2p && p2p_access && (adev->gmc.visible_vram_size &&
|
||||
adev->gmc.real_vram_size == adev->gmc.visible_vram_size &&
|
||||
|
||||
@@ -229,7 +229,7 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev, ui
|
||||
return r;
|
||||
}
|
||||
|
||||
memcpy((u8 *)binary, (u8 *)fw->data, adev->mman.discovery_tmr_size);
|
||||
memcpy((u8 *)binary, (u8 *)fw->data, fw->size);
|
||||
release_firmware(fw);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
|
||||
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
|
||||
int r;
|
||||
|
||||
if (pci_p2pdma_distance_many(adev->pdev, &attach->dev, 1, true) < 0)
|
||||
if (pci_p2pdma_distance(adev->pdev, attach->dev, false) < 0)
|
||||
attach->peer2peer = false;
|
||||
|
||||
r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
|
||||
|
||||
@@ -400,7 +400,6 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring)
|
||||
/* We are not protected by ring lock when reading the last sequence
|
||||
* but it's ok to report slightly wrong fence count here.
|
||||
*/
|
||||
amdgpu_fence_process(ring);
|
||||
emitted = 0x100000000ull;
|
||||
emitted -= atomic_read(&ring->fence_drv.last_seq);
|
||||
emitted += READ_ONCE(ring->fence_drv.sync_seq);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/firmware.h>
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_gfx.h"
|
||||
#include "amdgpu_rlc.h"
|
||||
@@ -865,3 +866,142 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)
|
||||
}
|
||||
return amdgpu_num_kcq;
|
||||
}
|
||||
|
||||
void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev,
|
||||
uint32_t ucode_id)
|
||||
{
|
||||
const struct gfx_firmware_header_v1_0 *cp_hdr;
|
||||
const struct gfx_firmware_header_v2_0 *cp_hdr_v2_0;
|
||||
struct amdgpu_firmware_info *info = NULL;
|
||||
const struct firmware *ucode_fw;
|
||||
unsigned int fw_size;
|
||||
|
||||
switch (ucode_id) {
|
||||
case AMDGPU_UCODE_ID_CP_PFP:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.pfp_fw->data;
|
||||
adev->gfx.pfp_fw_version =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.pfp_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.pfp_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->header.ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_PFP:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.pfp_fw->data;
|
||||
adev->gfx.pfp_fw_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->header.ucode_version);
|
||||
adev->gfx.pfp_feature_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.pfp_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK:
|
||||
case AMDGPU_UCODE_ID_CP_RS64_PFP_P1_STACK:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.pfp_fw->data;
|
||||
ucode_fw = adev->gfx.pfp_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->data_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_ME:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.me_fw->data;
|
||||
adev->gfx.me_fw_version =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.me_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.me_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->header.ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_ME:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.me_fw->data;
|
||||
adev->gfx.me_fw_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->header.ucode_version);
|
||||
adev->gfx.me_feature_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.me_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_ME_P0_STACK:
|
||||
case AMDGPU_UCODE_ID_CP_RS64_ME_P1_STACK:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.me_fw->data;
|
||||
ucode_fw = adev->gfx.me_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->data_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_CE:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.ce_fw->data;
|
||||
adev->gfx.ce_fw_version =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.ce_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.ce_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->header.ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_MEC1:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.mec_fw->data;
|
||||
adev->gfx.mec_fw_version =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.mec_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.mec_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->header.ucode_size_bytes) -
|
||||
le32_to_cpu(cp_hdr->jt_size) * 4;
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_MEC1_JT:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.mec_fw->data;
|
||||
ucode_fw = adev->gfx.mec_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->jt_size) * 4;
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_MEC2:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.mec2_fw->data;
|
||||
adev->gfx.mec2_fw_version =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.mec2_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.mec2_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->header.ucode_size_bytes) -
|
||||
le32_to_cpu(cp_hdr->jt_size) * 4;
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_MEC2_JT:
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)
|
||||
adev->gfx.mec2_fw->data;
|
||||
ucode_fw = adev->gfx.mec2_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr->jt_size) * 4;
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_MEC:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.mec_fw->data;
|
||||
adev->gfx.mec_fw_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->header.ucode_version);
|
||||
adev->gfx.mec_feature_version =
|
||||
le32_to_cpu(cp_hdr_v2_0->ucode_feature_version);
|
||||
ucode_fw = adev->gfx.mec_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->ucode_size_bytes);
|
||||
break;
|
||||
case AMDGPU_UCODE_ID_CP_RS64_MEC_P0_STACK:
|
||||
case AMDGPU_UCODE_ID_CP_RS64_MEC_P1_STACK:
|
||||
case AMDGPU_UCODE_ID_CP_RS64_MEC_P2_STACK:
|
||||
case AMDGPU_UCODE_ID_CP_RS64_MEC_P3_STACK:
|
||||
cp_hdr_v2_0 = (const struct gfx_firmware_header_v2_0 *)
|
||||
adev->gfx.mec_fw->data;
|
||||
ucode_fw = adev->gfx.mec_fw;
|
||||
fw_size = le32_to_cpu(cp_hdr_v2_0->data_size_bytes);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
info = &adev->firmware.ucode[ucode_id];
|
||||
info->ucode_id = ucode_id;
|
||||
info->fw = ucode_fw;
|
||||
adev->firmware.fw_size += ALIGN(fw_size, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,4 +426,6 @@ int amdgpu_gfx_cp_ecc_error_irq(struct amdgpu_device *adev,
|
||||
uint32_t amdgpu_kiq_rreg(struct amdgpu_device *adev, uint32_t reg);
|
||||
void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v);
|
||||
int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev);
|
||||
void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev, uint32_t ucode_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -572,45 +572,15 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev)
|
||||
void amdgpu_gmc_noretry_set(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_gmc *gmc = &adev->gmc;
|
||||
uint32_t gc_ver = adev->ip_versions[GC_HWIP][0];
|
||||
bool noretry_default = (gc_ver == IP_VERSION(9, 0, 1) ||
|
||||
gc_ver == IP_VERSION(9, 3, 0) ||
|
||||
gc_ver == IP_VERSION(9, 4, 0) ||
|
||||
gc_ver == IP_VERSION(9, 4, 1) ||
|
||||
gc_ver == IP_VERSION(9, 4, 2) ||
|
||||
gc_ver >= IP_VERSION(10, 3, 0));
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 6):
|
||||
case IP_VERSION(10, 3, 7):
|
||||
/*
|
||||
* noretry = 0 will cause kfd page fault tests fail
|
||||
* for some ASICs, so set default to 1 for these ASICs.
|
||||
*/
|
||||
if (amdgpu_noretry == -1)
|
||||
gmc->noretry = 1;
|
||||
else
|
||||
gmc->noretry = amdgpu_noretry;
|
||||
break;
|
||||
default:
|
||||
/* Raven currently has issues with noretry
|
||||
* regardless of what we decide for other
|
||||
* asics, we should leave raven with
|
||||
* noretry = 0 until we root cause the
|
||||
* issues.
|
||||
*
|
||||
* default this to 0 for now, but we may want
|
||||
* to change this in the future for certain
|
||||
* GPUs as it can increase performance in
|
||||
* certain cases.
|
||||
*/
|
||||
if (amdgpu_noretry == -1)
|
||||
gmc->noretry = 0;
|
||||
else
|
||||
gmc->noretry = amdgpu_noretry;
|
||||
break;
|
||||
}
|
||||
gmc->noretry = (amdgpu_noretry == -1) ? noretry_default : amdgpu_noretry;
|
||||
}
|
||||
|
||||
void amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type,
|
||||
|
||||
@@ -222,6 +222,8 @@ struct mes_add_queue_input {
|
||||
uint64_t tba_addr;
|
||||
uint64_t tma_addr;
|
||||
uint32_t is_kfd_process;
|
||||
uint32_t is_aql_queue;
|
||||
uint32_t queue_size;
|
||||
};
|
||||
|
||||
struct mes_remove_queue_input {
|
||||
|
||||
@@ -2720,7 +2720,8 @@ int amdgpu_ras_pre_fini(struct amdgpu_device *adev)
|
||||
|
||||
|
||||
/* Need disable ras on all IPs here before ip [hw/sw]fini */
|
||||
amdgpu_ras_disable_all_features(adev, 0);
|
||||
if (con->features)
|
||||
amdgpu_ras_disable_all_features(adev, 0);
|
||||
amdgpu_ras_recovery_fini(adev);
|
||||
return 0;
|
||||
}
|
||||
@@ -2833,11 +2834,8 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
struct mce *m = (struct mce *)data;
|
||||
struct amdgpu_device *adev = NULL;
|
||||
uint32_t gpu_id = 0;
|
||||
uint32_t umc_inst = 0;
|
||||
uint32_t ch_inst, channel_index = 0;
|
||||
uint32_t umc_inst = 0, ch_inst = 0;
|
||||
struct ras_err_data err_data = {0, 0, 0, NULL};
|
||||
struct eeprom_table_record err_rec;
|
||||
uint64_t retired_page;
|
||||
|
||||
/*
|
||||
* If the error was generated in UMC_V2, which belongs to GPU UMCs,
|
||||
@@ -2876,21 +2874,22 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
dev_info(adev->dev, "Uncorrectable error detected in UMC inst: %d, chan_idx: %d",
|
||||
umc_inst, ch_inst);
|
||||
|
||||
err_data.err_addr =
|
||||
kcalloc(adev->umc.max_ras_err_cnt_per_query,
|
||||
sizeof(struct eeprom_table_record), GFP_KERNEL);
|
||||
if(!err_data.err_addr) {
|
||||
dev_warn(adev->dev, "Failed to alloc memory for "
|
||||
"umc error address record in mca notifier!\n");
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate UMC channel address to Physical address
|
||||
*/
|
||||
channel_index =
|
||||
adev->umc.channel_idx_tbl[umc_inst * adev->umc.channel_inst_num
|
||||
+ ch_inst];
|
||||
|
||||
retired_page = ADDR_OF_8KB_BLOCK(m->addr) |
|
||||
ADDR_OF_256B_BLOCK(channel_index) |
|
||||
OFFSET_IN_256B_BLOCK(m->addr);
|
||||
|
||||
memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
|
||||
err_data.err_addr = &err_rec;
|
||||
amdgpu_umc_fill_error_record(&err_data, m->addr,
|
||||
retired_page, channel_index, umc_inst);
|
||||
if (adev->umc.ras &&
|
||||
adev->umc.ras->convert_ras_error_address)
|
||||
adev->umc.ras->convert_ras_error_address(adev,
|
||||
&err_data, 0, ch_inst, umc_inst, m->addr);
|
||||
|
||||
if (amdgpu_bad_page_threshold != 0) {
|
||||
amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
|
||||
@@ -2898,6 +2897,7 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
amdgpu_ras_save_bad_pages(adev);
|
||||
}
|
||||
|
||||
kfree(err_data.err_addr);
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,8 @@ static inline bool amdgpu_reset_get_reset_domain(struct amdgpu_reset_domain *dom
|
||||
|
||||
static inline void amdgpu_reset_put_reset_domain(struct amdgpu_reset_domain *domain)
|
||||
{
|
||||
kref_put(&domain->refcount, amdgpu_reset_destroy_reset_domain);
|
||||
if (domain)
|
||||
kref_put(&domain->refcount, amdgpu_reset_destroy_reset_domain);
|
||||
}
|
||||
|
||||
static inline bool amdgpu_reset_domain_schedule(struct amdgpu_reset_domain *domain,
|
||||
|
||||
@@ -272,3 +272,275 @@ void amdgpu_gfx_rlc_fini(struct amdgpu_device *adev)
|
||||
&adev->gfx.rlc.cp_table_gpu_addr,
|
||||
(void **)&adev->gfx.rlc.cp_table_ptr);
|
||||
}
|
||||
|
||||
static int amdgpu_gfx_rlc_init_microcode_v2_0(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct common_firmware_header *common_hdr;
|
||||
const struct rlc_firmware_header_v2_0 *rlc_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
unsigned int *tmp;
|
||||
unsigned int i;
|
||||
|
||||
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);
|
||||
adev->gfx.rlc.save_and_restore_offset =
|
||||
le32_to_cpu(rlc_hdr->save_and_restore_offset);
|
||||
adev->gfx.rlc.clear_state_descriptor_offset =
|
||||
le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
|
||||
adev->gfx.rlc.avail_scratch_ram_locations =
|
||||
le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
|
||||
adev->gfx.rlc.reg_restore_list_size =
|
||||
le32_to_cpu(rlc_hdr->reg_restore_list_size);
|
||||
adev->gfx.rlc.reg_list_format_start =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_start);
|
||||
adev->gfx.rlc.reg_list_format_separate_start =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
|
||||
adev->gfx.rlc.starting_offsets_start =
|
||||
le32_to_cpu(rlc_hdr->starting_offsets_start);
|
||||
adev->gfx.rlc.reg_list_format_size_bytes =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
|
||||
adev->gfx.rlc.reg_list_size_bytes =
|
||||
le32_to_cpu(rlc_hdr->reg_list_size_bytes);
|
||||
adev->gfx.rlc.register_list_format =
|
||||
kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
|
||||
adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
|
||||
if (!adev->gfx.rlc.register_list_format) {
|
||||
dev_err(adev->dev, "failed to allocate memory for rlc register_list_format\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
tmp = (unsigned int *)((uintptr_t)rlc_hdr +
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
|
||||
for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
|
||||
adev->gfx.rlc.register_list_format[i] = le32_to_cpu(tmp[i]);
|
||||
|
||||
adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
|
||||
|
||||
tmp = (unsigned int *)((uintptr_t)rlc_hdr +
|
||||
le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
|
||||
for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
|
||||
adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
if (info->fw) {
|
||||
common_hdr = (const struct common_firmware_header *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(common_hdr->ucode_size_bytes), PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void amdgpu_gfx_rlc_init_microcode_v2_1(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_1 *rlc_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_1 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc_srlc_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_ucode_ver);
|
||||
adev->gfx.rlc_srlc_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_cntl_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_cntl_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_cntl = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_cntl_offset_bytes);
|
||||
adev->gfx.rlc_srlg_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_ucode_ver);
|
||||
adev->gfx.rlc_srlg_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_gpm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_gpm_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_gpm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_gpm_offset_bytes);
|
||||
adev->gfx.rlc_srls_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_ucode_ver);
|
||||
adev->gfx.rlc_srls_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_srm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_srm_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_srm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_srm_offset_bytes);
|
||||
adev->gfx.rlc.reg_list_format_direct_reg_list_length =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
if (adev->gfx.rlc.save_restore_list_cntl_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_cntl_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.save_restore_list_gpm_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_gpm_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.save_restore_list_srm_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_srm_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void amdgpu_gfx_rlc_init_microcode_v2_2(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_2 *rlc_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);
|
||||
adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
if (adev->gfx.rlc.rlc_iram_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlc_iram_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.rlc_dram_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlc_dram_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void amdgpu_gfx_rlc_init_microcode_v2_3(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_3 *rlc_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_3 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlcp_ucode_version = le32_to_cpu(rlc_hdr->rlcp_ucode_version);
|
||||
adev->gfx.rlcp_ucode_feature_version = le32_to_cpu(rlc_hdr->rlcp_ucode_feature_version);
|
||||
adev->gfx.rlc.rlcp_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlcp_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlcp_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlcp_ucode_offset_bytes);
|
||||
|
||||
adev->gfx.rlcv_ucode_version = le32_to_cpu(rlc_hdr->rlcv_ucode_version);
|
||||
adev->gfx.rlcv_ucode_feature_version = le32_to_cpu(rlc_hdr->rlcv_ucode_feature_version);
|
||||
adev->gfx.rlc.rlcv_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlcv_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlcv_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlcv_ucode_offset_bytes);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
if (adev->gfx.rlc.rlcp_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_P];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_P;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlcp_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.rlcv_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_V];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_V;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlcv_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void amdgpu_gfx_rlc_init_microcode_v2_4(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_4 *rlc_hdr;
|
||||
struct amdgpu_firmware_info *info;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_4 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc.global_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->global_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.global_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->global_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se0_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se0_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se0_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se0_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se1_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se1_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se1_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se1_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se2_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se2_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se2_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se2_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se3_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se3_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se3_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se3_tap_delays_ucode_offset_bytes);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
if (adev->gfx.rlc.global_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.global_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se0_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE0_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE0_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se0_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se1_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE1_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE1_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se1_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se2_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE2_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE2_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se2_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se3_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE3_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE3_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se3_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int amdgpu_gfx_rlc_init_microcode(struct amdgpu_device *adev,
|
||||
uint16_t version_major,
|
||||
uint16_t version_minor)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (version_major < 2) {
|
||||
/* only support rlc_hdr v2.x and onwards */
|
||||
dev_err(adev->dev, "unsupported rlc fw hdr\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* is_rlc_v2_1 is still used in APU code path */
|
||||
if (version_major == 2 && version_minor == 1)
|
||||
adev->gfx.rlc.is_rlc_v2_1 = true;
|
||||
|
||||
if (version_minor >= 0) {
|
||||
err = amdgpu_gfx_rlc_init_microcode_v2_0(adev);
|
||||
if (err) {
|
||||
dev_err(adev->dev, "fail to init rlc v2_0 microcode\n");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
if (version_minor >= 1)
|
||||
amdgpu_gfx_rlc_init_microcode_v2_1(adev);
|
||||
if (version_minor >= 2)
|
||||
amdgpu_gfx_rlc_init_microcode_v2_2(adev);
|
||||
if (version_minor == 3)
|
||||
amdgpu_gfx_rlc_init_microcode_v2_3(adev);
|
||||
if (version_minor == 4)
|
||||
amdgpu_gfx_rlc_init_microcode_v2_4(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -267,5 +267,7 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev);
|
||||
int amdgpu_gfx_rlc_init_cpt(struct amdgpu_device *adev);
|
||||
void amdgpu_gfx_rlc_setup_cp_table(struct amdgpu_device *adev);
|
||||
void amdgpu_gfx_rlc_fini(struct amdgpu_device *adev);
|
||||
|
||||
int amdgpu_gfx_rlc_init_microcode(struct amdgpu_device *adev,
|
||||
uint16_t version_major,
|
||||
uint16_t version_minor);
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/firmware.h>
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_sdma.h"
|
||||
#include "amdgpu_ras.h"
|
||||
@@ -150,3 +151,135 @@ int amdgpu_sdma_process_ecc_irq(struct amdgpu_device *adev,
|
||||
amdgpu_ras_interrupt_dispatch(adev, &ih_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
switch (version_major) {
|
||||
case 1:
|
||||
hdr = (const struct sdma_firmware_header_v1_0 *)sdma_inst->fw->data;
|
||||
sdma_inst->fw_version = le32_to_cpu(hdr->header.ucode_version);
|
||||
sdma_inst->feature_version = le32_to_cpu(hdr->ucode_feature_version);
|
||||
break;
|
||||
case 2:
|
||||
hdr_v2 = (const struct sdma_firmware_header_v2_0 *)sdma_inst->fw->data;
|
||||
sdma_inst->fw_version = le32_to_cpu(hdr_v2->header.ucode_version);
|
||||
sdma_inst->feature_version = le32_to_cpu(hdr_v2->ucode_feature_version);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (sdma_inst->feature_version >= 20)
|
||||
sdma_inst->burst_nop = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev,
|
||||
bool duplicate)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
release_firmware(adev->sdma.instance[i].fw);
|
||||
if (duplicate)
|
||||
break;
|
||||
}
|
||||
|
||||
memset((void *)adev->sdma.instance, 0,
|
||||
sizeof(struct amdgpu_sdma_instance) * AMDGPU_MAX_SDMA_INSTANCES);
|
||||
}
|
||||
|
||||
int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
|
||||
char *fw_name, u32 instance,
|
||||
bool duplicate)
|
||||
{
|
||||
struct amdgpu_firmware_info *info = NULL;
|
||||
const struct common_firmware_header *header = NULL;
|
||||
int err = 0, i;
|
||||
const struct sdma_firmware_header_v2_0 *sdma_hdr;
|
||||
uint16_t version_major;
|
||||
|
||||
err = request_firmware(&adev->sdma.instance[instance].fw, fw_name, adev->dev);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
header = (const struct common_firmware_header *)
|
||||
adev->sdma.instance[instance].fw->data;
|
||||
version_major = le16_to_cpu(header->header_version_major);
|
||||
|
||||
if ((duplicate && instance) || (!duplicate && version_major > 1))
|
||||
return -EINVAL;
|
||||
|
||||
err = amdgpu_sdma_init_inst_ctx(&adev->sdma.instance[instance]);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
if (duplicate) {
|
||||
for (i = 1; i < adev->sdma.num_instances; i++)
|
||||
memcpy((void *)&adev->sdma.instance[i],
|
||||
(void *)&adev->sdma.instance[0],
|
||||
sizeof(struct amdgpu_sdma_instance));
|
||||
}
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("psp_load == '%s'\n",
|
||||
adev->firmware.load_type == AMDGPU_FW_LOAD_PSP ? "true" : "false");
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
switch (version_major) {
|
||||
case 1:
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
if (!duplicate && (instance != i))
|
||||
continue;
|
||||
else {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
|
||||
info->fw = adev->sdma.instance[i].fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sdma_hdr = (const struct sdma_firmware_header_v2_0 *)
|
||||
adev->sdma.instance[0].fw->data;
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA_UCODE_TH0];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SDMA_UCODE_TH0;
|
||||
info->fw = adev->sdma.instance[0].fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(sdma_hdr->ctx_ucode_size_bytes), PAGE_SIZE);
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA_UCODE_TH1];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SDMA_UCODE_TH1;
|
||||
info->fw = adev->sdma.instance[0].fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(sdma_hdr->ctl_ucode_size_bytes), PAGE_SIZE);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (err) {
|
||||
DRM_ERROR("SDMA: Failed to init firmware \"%s\"\n", fw_name);
|
||||
amdgpu_sdma_destroy_inst_ctx(adev, duplicate);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -124,4 +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);
|
||||
void amdgpu_sdma_destroy_inst_ctx(struct amdgpu_device *adev,
|
||||
bool duplicate);
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#define __AMDGPU_UMC_H__
|
||||
#include "amdgpu_ras.h"
|
||||
|
||||
#define UMC_INVALID_ADDR 0x1ULL
|
||||
|
||||
/*
|
||||
* (addr / 256) * 4096, the higher 26 bits in ErrorAddr
|
||||
* is the index of 4KB block
|
||||
@@ -51,6 +53,10 @@ struct amdgpu_umc_ras {
|
||||
struct amdgpu_ras_block_object ras_block;
|
||||
void (*err_cnt_init)(struct amdgpu_device *adev);
|
||||
bool (*query_ras_poison_mode)(struct amdgpu_device *adev);
|
||||
void (*convert_ras_error_address)(struct amdgpu_device *adev,
|
||||
struct ras_err_data *err_data,
|
||||
uint32_t umc_reg_offset, uint32_t ch_inst,
|
||||
uint32_t umc_inst, uint64_t mca_addr);
|
||||
void (*ecc_info_query_ras_error_count)(struct amdgpu_device *adev,
|
||||
void *ras_error_status);
|
||||
void (*ecc_info_query_ras_error_address)(struct amdgpu_device *adev,
|
||||
|
||||
@@ -191,7 +191,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
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 = false;
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case IP_VERSION(4, 0, 4):
|
||||
fw_name = FIRMWARE_VCN4_0_4;
|
||||
|
||||
@@ -161,7 +161,8 @@
|
||||
#define AMDGPU_VCN_SW_RING_FLAG (1 << 9)
|
||||
#define AMDGPU_VCN_FW_LOGGING_FLAG (1 << 10)
|
||||
#define AMDGPU_VCN_SMU_VERSION_INFO_FLAG (1 << 11)
|
||||
#define AMDGPU_VCN_VF_RB_SETUP_FLAG (1 << 12)
|
||||
#define AMDGPU_VCN_SMU_DPM_INTERFACE_FLAG (1 << 11)
|
||||
#define AMDGPU_VCN_VF_RB_SETUP_FLAG (1 << 14)
|
||||
|
||||
#define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER 0x00000001
|
||||
#define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER 0x00000001
|
||||
@@ -171,6 +172,9 @@
|
||||
#define VCN_CODEC_DISABLE_MASK_HEVC (1 << 2)
|
||||
#define VCN_CODEC_DISABLE_MASK_H264 (1 << 3)
|
||||
|
||||
#define AMDGPU_VCN_SMU_DPM_INTERFACE_DGPU (0)
|
||||
#define AMDGPU_VCN_SMU_DPM_INTERFACE_APU (1)
|
||||
|
||||
enum fw_queue_mode {
|
||||
FW_QUEUE_RING_RESET = 1,
|
||||
FW_QUEUE_DPG_HOLD_OFF = 2,
|
||||
@@ -335,7 +339,9 @@ struct amdgpu_vcn4_fw_shared {
|
||||
struct amdgpu_fw_shared_unified_queue_struct sq;
|
||||
uint8_t pad1[8];
|
||||
struct amdgpu_fw_shared_fw_logging fw_log;
|
||||
uint8_t pad2[20];
|
||||
struct amdgpu_fw_shared_rb_setup rb_setup;
|
||||
struct amdgpu_fw_shared_smu_interface_info smu_dpm_interface;
|
||||
};
|
||||
|
||||
struct amdgpu_vcn_fwlog {
|
||||
|
||||
@@ -3943,56 +3943,6 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
DRM_WARN_ONCE("CP firmware version too old, please update!");
|
||||
}
|
||||
|
||||
|
||||
static void gfx_v10_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_1 *rlc_hdr;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_1 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc_srlc_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_ucode_ver);
|
||||
adev->gfx.rlc_srlc_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_cntl_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_cntl_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_cntl_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_cntl = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_cntl_offset_bytes);
|
||||
adev->gfx.rlc_srlg_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_ucode_ver);
|
||||
adev->gfx.rlc_srlg_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_gpm_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_gpm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_gpm_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_gpm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_gpm_offset_bytes);
|
||||
adev->gfx.rlc_srls_fw_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_ucode_ver);
|
||||
adev->gfx.rlc_srls_feature_version = le32_to_cpu(rlc_hdr->save_restore_list_srm_feature_ver);
|
||||
adev->gfx.rlc.save_restore_list_srm_size_bytes = le32_to_cpu(rlc_hdr->save_restore_list_srm_size_bytes);
|
||||
adev->gfx.rlc.save_restore_list_srm = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->save_restore_list_srm_offset_bytes);
|
||||
adev->gfx.rlc.reg_list_format_direct_reg_list_length =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length);
|
||||
}
|
||||
|
||||
static void gfx_v10_0_init_rlc_iram_dram_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_2 *rlc_hdr;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_2 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc.rlc_iram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_iram_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlc_iram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_iram_ucode_offset_bytes);
|
||||
adev->gfx.rlc.rlc_dram_ucode_size_bytes = le32_to_cpu(rlc_hdr->rlc_dram_ucode_size_bytes);
|
||||
adev->gfx.rlc.rlc_dram_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->rlc_dram_ucode_offset_bytes);
|
||||
}
|
||||
|
||||
static void gfx_v10_0_init_tap_delays_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_4 *rlc_hdr;
|
||||
|
||||
rlc_hdr = (const struct rlc_firmware_header_v2_4 *)adev->gfx.rlc_fw->data;
|
||||
adev->gfx.rlc.global_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->global_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.global_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->global_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se0_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se0_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se0_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se0_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se1_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se1_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se1_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se1_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se2_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se2_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se2_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se2_tap_delays_ucode_offset_bytes);
|
||||
adev->gfx.rlc.se3_tap_delays_ucode_size_bytes = le32_to_cpu(rlc_hdr->se3_tap_delays_ucode_size_bytes);
|
||||
adev->gfx.rlc.se3_tap_delays_ucode = (u8 *)rlc_hdr + le32_to_cpu(rlc_hdr->se3_tap_delays_ucode_offset_bytes);
|
||||
}
|
||||
|
||||
static bool gfx_v10_0_navi10_gfxoff_should_enable(struct amdgpu_device *adev)
|
||||
{
|
||||
bool ret = false;
|
||||
@@ -4028,12 +3978,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
char fw_name[40];
|
||||
char *wks = "";
|
||||
int err;
|
||||
struct amdgpu_firmware_info *info = NULL;
|
||||
const struct common_firmware_header *header = NULL;
|
||||
const struct gfx_firmware_header_v1_0 *cp_hdr;
|
||||
const struct rlc_firmware_header_v2_0 *rlc_hdr;
|
||||
unsigned int *tmp = NULL;
|
||||
unsigned int i = 0;
|
||||
uint16_t version_major;
|
||||
uint16_t version_minor;
|
||||
|
||||
@@ -4091,9 +4036,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
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;
|
||||
adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
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);
|
||||
@@ -4102,9 +4045,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
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;
|
||||
adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
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);
|
||||
@@ -4113,69 +4054,27 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
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;
|
||||
adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
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;
|
||||
/* 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)
|
||||
dev_dbg(adev->dev,
|
||||
"gfx10: amdgpu_ucode_validate() 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);
|
||||
version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
|
||||
|
||||
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);
|
||||
adev->gfx.rlc.save_and_restore_offset =
|
||||
le32_to_cpu(rlc_hdr->save_and_restore_offset);
|
||||
adev->gfx.rlc.clear_state_descriptor_offset =
|
||||
le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
|
||||
adev->gfx.rlc.avail_scratch_ram_locations =
|
||||
le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
|
||||
adev->gfx.rlc.reg_restore_list_size =
|
||||
le32_to_cpu(rlc_hdr->reg_restore_list_size);
|
||||
adev->gfx.rlc.reg_list_format_start =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_start);
|
||||
adev->gfx.rlc.reg_list_format_separate_start =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
|
||||
adev->gfx.rlc.starting_offsets_start =
|
||||
le32_to_cpu(rlc_hdr->starting_offsets_start);
|
||||
adev->gfx.rlc.reg_list_format_size_bytes =
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
|
||||
adev->gfx.rlc.reg_list_size_bytes =
|
||||
le32_to_cpu(rlc_hdr->reg_list_size_bytes);
|
||||
adev->gfx.rlc.register_list_format =
|
||||
kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
|
||||
adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
|
||||
if (!adev->gfx.rlc.register_list_format) {
|
||||
err = -ENOMEM;
|
||||
err = amdgpu_gfx_rlc_init_microcode(adev, version_major, version_minor);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
tmp = (unsigned int *)((uintptr_t)rlc_hdr +
|
||||
le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
|
||||
for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
|
||||
adev->gfx.rlc.register_list_format[i] = le32_to_cpu(tmp[i]);
|
||||
|
||||
adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
|
||||
|
||||
tmp = (unsigned int *)((uintptr_t)rlc_hdr +
|
||||
le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
|
||||
for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
|
||||
adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
|
||||
|
||||
if (version_major == 2) {
|
||||
if (version_minor >= 1)
|
||||
gfx_v10_0_init_rlc_ext_microcode(adev);
|
||||
if (version_minor >= 2)
|
||||
gfx_v10_0_init_rlc_iram_dram_microcode(adev);
|
||||
if (version_minor == 4) {
|
||||
gfx_v10_0_init_tap_delays_microcode(adev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
|
||||
@@ -4185,9 +4084,8 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
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;
|
||||
adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
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);
|
||||
@@ -4195,164 +4093,18 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
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 =
|
||||
le32_to_cpu(cp_hdr->header.ucode_version);
|
||||
adev->gfx.mec2_feature_version =
|
||||
le32_to_cpu(cp_hdr->ucode_feature_version);
|
||||
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;
|
||||
}
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
|
||||
info->fw = adev->gfx.pfp_fw;
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
|
||||
info->fw = adev->gfx.me_fw;
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
|
||||
info->fw = adev->gfx.ce_fw;
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
if (info->fw) {
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
|
||||
}
|
||||
if (adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
|
||||
adev->gfx.rlc.save_restore_list_gpm_size_bytes &&
|
||||
adev->gfx.rlc.save_restore_list_srm_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_cntl_size_bytes, PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_gpm_size_bytes, PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.save_restore_list_srm_size_bytes, PAGE_SIZE);
|
||||
|
||||
if (adev->gfx.rlc.rlc_iram_ucode_size_bytes &&
|
||||
adev->gfx.rlc.rlc_dram_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_IRAM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_IRAM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlc_iram_ucode_size_bytes, PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_DRAM];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_RLC_DRAM;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.rlc_dram_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.global_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.global_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se0_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE0_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE0_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se0_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se1_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE1_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE1_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se1_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se2_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE2_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE2_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se2_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
if (adev->gfx.rlc.se3_tap_delays_ucode_size_bytes) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE3_TAP_DELAYS];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_SE3_TAP_DELAYS;
|
||||
info->fw = adev->gfx.rlc_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(adev->gfx.rlc.se3_tap_delays_ucode_size_bytes, PAGE_SIZE);
|
||||
}
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
|
||||
info->fw = adev->gfx.mec_fw;
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes) -
|
||||
le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
|
||||
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1_JT];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1_JT;
|
||||
info->fw = adev->gfx.mec_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(cp_hdr->jt_size) * 4, PAGE_SIZE);
|
||||
|
||||
if (adev->gfx.mec2_fw) {
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
|
||||
info->fw = adev->gfx.mec2_fw;
|
||||
header = (const struct common_firmware_header *)info->fw->data;
|
||||
cp_hdr = (const struct gfx_firmware_header_v1_0 *)info->fw->data;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(header->ucode_size_bytes) -
|
||||
le32_to_cpu(cp_hdr->jt_size) * 4,
|
||||
PAGE_SIZE);
|
||||
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2_JT];
|
||||
info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2_JT;
|
||||
info->fw = adev->gfx.mec2_fw;
|
||||
adev->firmware.fw_size +=
|
||||
ALIGN(le32_to_cpu(cp_hdr->jt_size) * 4,
|
||||
PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
gfx_v10_0_check_fw_write_wait(adev);
|
||||
out:
|
||||
if (err) {
|
||||
dev_err(adev->dev,
|
||||
"gfx10: Failed to load firmware \"%s\"\n",
|
||||
"gfx10: Failed to init firmware \"%s\"\n",
|
||||
fw_name);
|
||||
release_firmware(adev->gfx.pfp_fw);
|
||||
adev->gfx.pfp_fw = NULL;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user