Merge tag 'amd-drm-next-5.16-2021-10-08' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.16-2021-10-08: amdgpu: - gart BO pin count fix - RAS fixes - Misc display fixes - Misc code cleanups - Validate IP discovery table - IOMMU handling fixes for hotplug - Cyan Skillfish display support - DP 2.0 fixes - Covert vega and navi to IP discovery based asic enumeration - JPEG fixes - More FP cleanup for display - DCC fixes for DCN3.x - Initial USB4 DP tunnelling support - Aldebaran MCE support amdkfd: - Misc bug fixes - Misc code cleanups - RAS fixes x86/MCE: - Export symbol for use by GPU driver Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211008200345.4689-1-alexander.deucher@amd.com
This commit is contained in:
@@ -300,8 +300,8 @@ pcie_replay_count
|
||||
.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||
:doc: pcie_replay_count
|
||||
|
||||
+GPU SmartShift Information
|
||||
============================
|
||||
GPU SmartShift Information
|
||||
==========================
|
||||
|
||||
GPU SmartShift information via sysfs
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ extern int mce_threshold_remove_device(unsigned int cpu);
|
||||
|
||||
void mce_amd_feature_init(struct cpuinfo_x86 *c);
|
||||
int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr);
|
||||
|
||||
enum smca_bank_types smca_get_bank_type(unsigned int bank);
|
||||
#else
|
||||
|
||||
static inline int mce_threshold_create_device(unsigned int cpu) { return 0; };
|
||||
|
||||
@@ -119,7 +119,7 @@ const char *smca_get_long_name(enum smca_bank_types t)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(smca_get_long_name);
|
||||
|
||||
static enum smca_bank_types smca_get_bank_type(unsigned int bank)
|
||||
enum smca_bank_types smca_get_bank_type(unsigned int bank)
|
||||
{
|
||||
struct smca_bank *b;
|
||||
|
||||
@@ -132,6 +132,7 @@ static enum smca_bank_types smca_get_bank_type(unsigned int bank)
|
||||
|
||||
return b->hwid->bank_type;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(smca_get_bank_type);
|
||||
|
||||
static struct smca_hwid smca_hwid_mcatypes[] = {
|
||||
/* { bank_type, hwid_mcatype } */
|
||||
|
||||
@@ -744,6 +744,7 @@ enum amd_hw_ip_block_type {
|
||||
UVD_HWIP,
|
||||
VCN_HWIP = UVD_HWIP,
|
||||
JPEG_HWIP = VCN_HWIP,
|
||||
VCN1_HWIP,
|
||||
VCE_HWIP,
|
||||
DF_HWIP,
|
||||
DCE_HWIP,
|
||||
@@ -755,11 +756,16 @@ enum amd_hw_ip_block_type {
|
||||
CLK_HWIP,
|
||||
UMC_HWIP,
|
||||
RSMU_HWIP,
|
||||
XGMI_HWIP,
|
||||
DCI_HWIP,
|
||||
MAX_HWIP
|
||||
};
|
||||
|
||||
#define HWIP_MAX_INSTANCE 10
|
||||
|
||||
#define HW_ID_MAX 300
|
||||
#define IP_VERSION(mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv))
|
||||
|
||||
struct amd_powerplay {
|
||||
void *pp_handle;
|
||||
const struct amd_pm_funcs *pp_funcs;
|
||||
@@ -830,6 +836,7 @@ struct amdgpu_device {
|
||||
struct notifier_block acpi_nb;
|
||||
struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS];
|
||||
struct debugfs_blob_wrapper debugfs_vbios_blob;
|
||||
struct debugfs_blob_wrapper debugfs_discovery_blob;
|
||||
struct mutex srbm_mutex;
|
||||
/* GRBM index mutex. Protects concurrent access to GRBM index */
|
||||
struct mutex grbm_idx_mutex;
|
||||
@@ -1078,8 +1085,6 @@ struct amdgpu_device {
|
||||
char product_name[32];
|
||||
char serial[20];
|
||||
|
||||
struct amdgpu_autodump autodump;
|
||||
|
||||
atomic_t throttling_logging_enabled;
|
||||
struct ratelimit_state throttling_logging_rs;
|
||||
uint32_t ras_hw_enabled;
|
||||
@@ -1087,8 +1092,10 @@ struct amdgpu_device {
|
||||
|
||||
bool no_hw_access;
|
||||
struct pci_saved_state *pci_state;
|
||||
pci_channel_state_t pci_channel_state;
|
||||
|
||||
struct amdgpu_reset_control *reset_cntl;
|
||||
uint32_t ip_versions[HW_ID_MAX][HWIP_MAX_INSTANCE];
|
||||
};
|
||||
|
||||
static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <linux/dma-buf.h>
|
||||
#include "amdgpu_xgmi.h"
|
||||
#include <uapi/linux/kfd_ioctl.h>
|
||||
#include "amdgpu_ras.h"
|
||||
#include "amdgpu_umc.h"
|
||||
|
||||
/* Total memory size in system memory and all GPU VRAM. Used to
|
||||
* estimate worst case amount of memory to reserve for page tables
|
||||
@@ -70,8 +72,7 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
|
||||
if (!kfd_initialized)
|
||||
return;
|
||||
|
||||
adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev,
|
||||
adev->pdev, adev->asic_type, vf);
|
||||
adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev, vf);
|
||||
|
||||
if (adev->kfd.dev)
|
||||
amdgpu_amdkfd_total_mem_size += adev->gmc.real_vram_size;
|
||||
@@ -780,3 +781,15 @@ bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd)
|
||||
|
||||
return adev->have_atomics_support;
|
||||
}
|
||||
|
||||
void amdgpu_amdkfd_ras_poison_consumption_handler(struct kgd_dev *kgd)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
|
||||
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_process_ras_data_cb(adev, &err_data, NULL);
|
||||
else
|
||||
amdgpu_amdkfd_gpu_reset(kgd);
|
||||
}
|
||||
|
||||
@@ -290,6 +290,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
|
||||
uint64_t *mmap_offset);
|
||||
int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd,
|
||||
struct tile_config *config);
|
||||
void amdgpu_amdkfd_ras_poison_consumption_handler(struct kgd_dev *kgd);
|
||||
#if IS_ENABLED(CONFIG_HSA_AMD)
|
||||
void amdgpu_amdkfd_gpuvm_init_mem_limits(void);
|
||||
void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
|
||||
@@ -321,8 +322,7 @@ int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
|
||||
#if IS_ENABLED(CONFIG_HSA_AMD)
|
||||
int kgd2kfd_init(void);
|
||||
void kgd2kfd_exit(void);
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev,
|
||||
unsigned int asic_type, bool vf);
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, bool vf);
|
||||
bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
||||
struct drm_device *ddev,
|
||||
const struct kgd2kfd_shared_resources *gpu_resources);
|
||||
@@ -346,8 +346,7 @@ static inline void kgd2kfd_exit(void)
|
||||
}
|
||||
|
||||
static inline
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev,
|
||||
unsigned int asic_type, bool vf)
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, bool vf)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -563,6 +563,7 @@ kfd_mem_dmaunmap_userptr(struct kgd_mem *mem,
|
||||
|
||||
dma_unmap_sgtable(adev->dev, ttm->sg, direction, 0);
|
||||
sg_free_table(ttm->sg);
|
||||
kfree(ttm->sg);
|
||||
ttm->sg = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ static void amdgpu_bo_list_free(struct kref *ref)
|
||||
|
||||
int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
|
||||
struct drm_amdgpu_bo_list_entry *info,
|
||||
unsigned num_entries, struct amdgpu_bo_list **result)
|
||||
size_t num_entries, struct amdgpu_bo_list **result)
|
||||
{
|
||||
unsigned last_entry = 0, first_userptr = num_entries;
|
||||
struct amdgpu_bo_list_entry *array;
|
||||
|
||||
@@ -61,7 +61,7 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,
|
||||
int amdgpu_bo_list_create(struct amdgpu_device *adev,
|
||||
struct drm_file *filp,
|
||||
struct drm_amdgpu_bo_list_entry *info,
|
||||
unsigned num_entries,
|
||||
size_t num_entries,
|
||||
struct amdgpu_bo_list **list);
|
||||
|
||||
static inline struct amdgpu_bo_list_entry *
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/poll.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_pm.h"
|
||||
@@ -38,85 +37,7 @@
|
||||
#include "amdgpu_fw_attestation.h"
|
||||
#include "amdgpu_umr.h"
|
||||
|
||||
int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev)
|
||||
{
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
unsigned long timeout = 600 * HZ;
|
||||
int ret;
|
||||
|
||||
wake_up_interruptible(&adev->autodump.gpu_hang);
|
||||
|
||||
ret = wait_for_completion_interruptible_timeout(&adev->autodump.dumping, timeout);
|
||||
if (ret == 0) {
|
||||
pr_err("autodump: timeout, move on to gpu recovery\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
|
||||
static int amdgpu_debugfs_autodump_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct amdgpu_device *adev = inode->i_private;
|
||||
int ret;
|
||||
|
||||
file->private_data = adev;
|
||||
|
||||
ret = down_read_killable(&adev->reset_sem);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (adev->autodump.dumping.done) {
|
||||
reinit_completion(&adev->autodump.dumping);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = -EBUSY;
|
||||
}
|
||||
|
||||
up_read(&adev->reset_sem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int amdgpu_debugfs_autodump_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct amdgpu_device *adev = file->private_data;
|
||||
|
||||
complete_all(&adev->autodump.dumping);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int amdgpu_debugfs_autodump_poll(struct file *file, struct poll_table_struct *poll_table)
|
||||
{
|
||||
struct amdgpu_device *adev = file->private_data;
|
||||
|
||||
poll_wait(file, &adev->autodump.gpu_hang, poll_table);
|
||||
|
||||
if (amdgpu_in_reset(adev))
|
||||
return POLLIN | POLLRDNORM | POLLWRNORM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations autodump_debug_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = amdgpu_debugfs_autodump_open,
|
||||
.poll = amdgpu_debugfs_autodump_poll,
|
||||
.release = amdgpu_debugfs_autodump_release,
|
||||
};
|
||||
|
||||
static void amdgpu_debugfs_autodump_init(struct amdgpu_device *adev)
|
||||
{
|
||||
init_completion(&adev->autodump.dumping);
|
||||
complete_all(&adev->autodump.dumping);
|
||||
init_waitqueue_head(&adev->autodump.gpu_hang);
|
||||
|
||||
debugfs_create_file("amdgpu_autodump", 0600,
|
||||
adev_to_drm(adev)->primary->debugfs_root,
|
||||
adev, &autodump_debug_fops);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_debugfs_process_reg_op - Handle MMIO register reads/writes
|
||||
@@ -1407,7 +1328,7 @@ static int amdgpu_debugfs_evict_vram(void *data, u64 *val)
|
||||
return r;
|
||||
}
|
||||
|
||||
*val = amdgpu_bo_evict_vram(adev);
|
||||
*val = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
@@ -1420,17 +1341,15 @@ static int amdgpu_debugfs_evict_gtt(void *data, u64 *val)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)data;
|
||||
struct drm_device *dev = adev_to_drm(adev);
|
||||
struct ttm_resource_manager *man;
|
||||
int r;
|
||||
|
||||
r = pm_runtime_get_sync(dev->dev);
|
||||
if (r < 0) {
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
return r;
|
||||
}
|
||||
|
||||
man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
|
||||
*val = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
|
||||
*val = amdgpu_ttm_evict_resources(adev, TTM_PL_TT);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
@@ -1696,6 +1615,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
||||
struct dentry *ent;
|
||||
int r, i;
|
||||
|
||||
if (!debugfs_initialized())
|
||||
return 0;
|
||||
|
||||
ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
|
||||
&fops_ib_preempt);
|
||||
if (IS_ERR(ent)) {
|
||||
@@ -1738,7 +1660,6 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
amdgpu_ras_debugfs_create_all(adev);
|
||||
amdgpu_debugfs_autodump_init(adev);
|
||||
amdgpu_rap_debugfs_init(adev);
|
||||
amdgpu_securedisplay_debugfs_init(adev);
|
||||
amdgpu_fw_attestation_debugfs_init(adev);
|
||||
@@ -1757,6 +1678,11 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
||||
debugfs_create_blob("amdgpu_vbios", 0444, root,
|
||||
&adev->debugfs_vbios_blob);
|
||||
|
||||
adev->debugfs_discovery_blob.data = adev->mman.discovery_bin;
|
||||
adev->debugfs_discovery_blob.size = adev->mman.discovery_tmr_size;
|
||||
debugfs_create_blob("amdgpu_discovery", 0444, root,
|
||||
&adev->debugfs_discovery_blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
/*
|
||||
* Debugfs
|
||||
*/
|
||||
struct amdgpu_autodump {
|
||||
struct completion dumping;
|
||||
struct wait_queue_head gpu_hang;
|
||||
};
|
||||
|
||||
int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
|
||||
int amdgpu_debugfs_init(struct amdgpu_device *adev);
|
||||
@@ -36,4 +32,3 @@ void amdgpu_debugfs_fini(struct amdgpu_device *adev);
|
||||
void amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
|
||||
void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev);
|
||||
void amdgpu_debugfs_gem_init(struct amdgpu_device *adev);
|
||||
int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev);
|
||||
|
||||
@@ -125,6 +125,7 @@ const char *amdgpu_asic_name[] = {
|
||||
"DIMGREY_CAVEFISH",
|
||||
"BEIGE_GOBY",
|
||||
"YELLOW_CARP",
|
||||
"IP DISCOVERY",
|
||||
"LAST",
|
||||
};
|
||||
|
||||
@@ -305,7 +306,7 @@ void amdgpu_device_mm_access(struct amdgpu_device *adev, loff_t pos,
|
||||
uint64_t last;
|
||||
int idx;
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return;
|
||||
|
||||
BUG_ON(!IS_ALIGNED(pos, 4) || !IS_ALIGNED(size, 4));
|
||||
@@ -2126,46 +2127,11 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
|
||||
if (r)
|
||||
return r;
|
||||
break;
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_ALDEBARAN:
|
||||
if (adev->flags & AMD_IS_APU)
|
||||
adev->family = AMDGPU_FAMILY_RV;
|
||||
else
|
||||
adev->family = AMDGPU_FAMILY_AI;
|
||||
|
||||
r = soc15_set_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
break;
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
if (adev->asic_type == CHIP_VANGOGH)
|
||||
adev->family = AMDGPU_FAMILY_VGH;
|
||||
else if (adev->asic_type == CHIP_YELLOW_CARP)
|
||||
adev->family = AMDGPU_FAMILY_YC;
|
||||
else
|
||||
adev->family = AMDGPU_FAMILY_NV;
|
||||
|
||||
r = nv_set_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
break;
|
||||
default:
|
||||
/* FIXME: not supported yet */
|
||||
return -EINVAL;
|
||||
r = amdgpu_discovery_set_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
break;
|
||||
}
|
||||
|
||||
amdgpu_amdkfd_device_probe(adev);
|
||||
@@ -2394,10 +2360,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
|
||||
if (r)
|
||||
goto init_failed;
|
||||
|
||||
r = amdgpu_amdkfd_resume_iommu(adev);
|
||||
if (r)
|
||||
goto init_failed;
|
||||
|
||||
r = amdgpu_device_ip_hw_init_phase1(adev);
|
||||
if (r)
|
||||
goto init_failed;
|
||||
@@ -2436,6 +2398,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
|
||||
if (!adev->gmc.xgmi.pending_reset)
|
||||
amdgpu_amdkfd_device_init(adev);
|
||||
|
||||
r = amdgpu_amdkfd_resume_iommu(adev);
|
||||
if (r)
|
||||
goto init_failed;
|
||||
|
||||
amdgpu_fru_get_product_info(adev);
|
||||
|
||||
init_failed:
|
||||
@@ -3241,6 +3207,7 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
@@ -3248,13 +3215,15 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
#endif
|
||||
default:
|
||||
return amdgpu_dc != 0;
|
||||
#endif
|
||||
#else
|
||||
default:
|
||||
if (amdgpu_dc > 0)
|
||||
DRM_INFO_ONCE("Display Core has been requested via kernel parameter "
|
||||
"but isn't supported by ASIC, ignoring\n");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3355,6 +3324,8 @@ static int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
|
||||
continue;
|
||||
} else if (timeout < 0) {
|
||||
timeout = MAX_SCHEDULE_TIMEOUT;
|
||||
dev_warn(adev->dev, "lockup timeout disabled");
|
||||
add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
|
||||
} else {
|
||||
timeout = msecs_to_jiffies(timeout);
|
||||
}
|
||||
@@ -3872,6 +3843,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
|
||||
|
||||
amdgpu_device_ip_fini_early(adev);
|
||||
|
||||
ttm_device_clear_dma_mappings(&adev->mman.bdev);
|
||||
|
||||
amdgpu_gart_dummy_page_fini(adev);
|
||||
|
||||
amdgpu_device_unmap_mmio(adev);
|
||||
@@ -3912,6 +3885,25 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_evict_resources - evict device resources
|
||||
* @adev: amdgpu device object
|
||||
*
|
||||
* Evicts all ttm device resources(vram BOs, gart table) from the lru list
|
||||
* of the vram memory type. Mainly used for evicting device resources
|
||||
* at suspend time.
|
||||
*
|
||||
*/
|
||||
static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||
{
|
||||
/* No need to evict vram on APUs for suspend to ram */
|
||||
if (adev->in_s3 && (adev->flags & AMD_IS_APU))
|
||||
return;
|
||||
|
||||
if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
|
||||
DRM_WARN("evicting device resources failed\n");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Suspend & resume.
|
||||
@@ -3952,17 +3944,16 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
|
||||
if (!adev->in_s0ix)
|
||||
amdgpu_amdkfd_suspend(adev, adev->in_runpm);
|
||||
|
||||
/* evict vram memory */
|
||||
amdgpu_bo_evict_vram(adev);
|
||||
/* First evict vram memory */
|
||||
amdgpu_device_evict_resources(adev);
|
||||
|
||||
amdgpu_fence_driver_hw_fini(adev);
|
||||
|
||||
amdgpu_device_ip_suspend_phase2(adev);
|
||||
/* evict remaining vram memory
|
||||
* This second call to evict vram is to evict the gart page table
|
||||
* using the CPU.
|
||||
/* This second call to evict device resources is to evict
|
||||
* the gart page table using the CPU.
|
||||
*/
|
||||
amdgpu_bo_evict_vram(adev);
|
||||
amdgpu_device_evict_resources(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4469,10 +4460,6 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
|
||||
if (reset_context->reset_req_dev == adev)
|
||||
job = reset_context->job;
|
||||
|
||||
/* no need to dump if device is not in good state during probe period */
|
||||
if (!adev->gmc.xgmi.pending_reset)
|
||||
amdgpu_debugfs_wait_dump(adev);
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
/* stop the data exchange thread */
|
||||
amdgpu_virt_fini_data_exchange(adev);
|
||||
@@ -5402,6 +5389,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
}
|
||||
|
||||
adev->pci_channel_state = state;
|
||||
|
||||
switch (state) {
|
||||
case pci_channel_io_normal:
|
||||
return PCI_ERS_RESULT_CAN_RECOVER;
|
||||
@@ -5544,6 +5533,10 @@ void amdgpu_pci_resume(struct pci_dev *pdev)
|
||||
|
||||
DRM_INFO("PCI error: resume callback!!\n");
|
||||
|
||||
/* Only continue execution for the case of pci_channel_io_frozen */
|
||||
if (adev->pci_channel_state != pci_channel_io_frozen)
|
||||
return;
|
||||
|
||||
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
|
||||
struct amdgpu_ring *ring = adev->rings[i];
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ struct amdgpu_df_funcs {
|
||||
uint64_t (*get_fica)(struct amdgpu_device *adev, uint32_t ficaa_val);
|
||||
void (*set_fica)(struct amdgpu_device *adev, uint32_t ficaa_val,
|
||||
uint32_t ficadl_val, uint32_t ficadh_val);
|
||||
bool (*query_ras_poison_mode)(struct amdgpu_device *adev);
|
||||
};
|
||||
|
||||
struct amdgpu_df {
|
||||
|
||||
@@ -21,16 +21,58 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/firmware.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_discovery.h"
|
||||
#include "soc15_hw_ip.h"
|
||||
#include "discovery.h"
|
||||
|
||||
#include "soc15.h"
|
||||
#include "gfx_v9_0.h"
|
||||
#include "gmc_v9_0.h"
|
||||
#include "df_v1_7.h"
|
||||
#include "df_v3_6.h"
|
||||
#include "nbio_v6_1.h"
|
||||
#include "nbio_v7_0.h"
|
||||
#include "nbio_v7_4.h"
|
||||
#include "hdp_v4_0.h"
|
||||
#include "vega10_ih.h"
|
||||
#include "vega20_ih.h"
|
||||
#include "sdma_v4_0.h"
|
||||
#include "uvd_v7_0.h"
|
||||
#include "vce_v4_0.h"
|
||||
#include "vcn_v1_0.h"
|
||||
#include "vcn_v2_5.h"
|
||||
#include "jpeg_v2_5.h"
|
||||
#include "smuio_v9_0.h"
|
||||
#include "gmc_v10_0.h"
|
||||
#include "gfxhub_v2_0.h"
|
||||
#include "mmhub_v2_0.h"
|
||||
#include "nbio_v2_3.h"
|
||||
#include "nbio_v7_2.h"
|
||||
#include "hdp_v5_0.h"
|
||||
#include "nv.h"
|
||||
#include "navi10_ih.h"
|
||||
#include "gfx_v10_0.h"
|
||||
#include "sdma_v5_0.h"
|
||||
#include "sdma_v5_2.h"
|
||||
#include "vcn_v2_0.h"
|
||||
#include "jpeg_v2_0.h"
|
||||
#include "vcn_v3_0.h"
|
||||
#include "jpeg_v3_0.h"
|
||||
#include "amdgpu_vkms.h"
|
||||
#include "mes_v10_1.h"
|
||||
#include "smuio_v11_0.h"
|
||||
#include "smuio_v11_0_6.h"
|
||||
#include "smuio_v13_0.h"
|
||||
|
||||
MODULE_FIRMWARE("amdgpu/ip_discovery.bin");
|
||||
|
||||
#define mmRCC_CONFIG_MEMSIZE 0xde3
|
||||
#define mmMM_INDEX 0x0
|
||||
#define mmMM_INDEX_HI 0x6
|
||||
#define mmMM_DATA 0x1
|
||||
#define HW_ID_MAX 300
|
||||
|
||||
static const char *hw_id_names[HW_ID_MAX] = {
|
||||
[MP1_HWID] = "MP1",
|
||||
@@ -129,6 +171,8 @@ static int hw_id_map[MAX_HWIP] = {
|
||||
[THM_HWIP] = THM_HWID,
|
||||
[CLK_HWIP] = CLKA_HWID,
|
||||
[UMC_HWIP] = UMC_HWID,
|
||||
[XGMI_HWIP] = XGMI_HWID,
|
||||
[DCI_HWIP] = DCI_HWID,
|
||||
};
|
||||
|
||||
static int amdgpu_discovery_read_binary(struct amdgpu_device *adev, uint8_t *binary)
|
||||
@@ -164,6 +208,7 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
|
||||
struct binary_header *bhdr;
|
||||
struct ip_discovery_header *ihdr;
|
||||
struct gpu_info_header *ghdr;
|
||||
const struct firmware *fw;
|
||||
uint16_t offset;
|
||||
uint16_t size;
|
||||
uint16_t checksum;
|
||||
@@ -174,10 +219,21 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
|
||||
if (!adev->mman.discovery_bin)
|
||||
return -ENOMEM;
|
||||
|
||||
r = amdgpu_discovery_read_binary(adev, adev->mman.discovery_bin);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to read ip discovery binary\n");
|
||||
goto out;
|
||||
if (amdgpu_discovery == 2) {
|
||||
r = request_firmware(&fw, "amdgpu/ip_discovery.bin", adev->dev);
|
||||
if (r)
|
||||
goto get_from_vram;
|
||||
dev_info(adev->dev, "Using IP discovery from file\n");
|
||||
memcpy((u8 *)adev->mman.discovery_bin, (u8 *)fw->data,
|
||||
adev->mman.discovery_tmr_size);
|
||||
release_firmware(fw);
|
||||
} else {
|
||||
get_from_vram:
|
||||
r = amdgpu_discovery_read_binary(adev, adev->mman.discovery_bin);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to read ip discovery binary\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
bhdr = (struct binary_header *)adev->mman.discovery_bin;
|
||||
@@ -245,6 +301,22 @@ void amdgpu_discovery_fini(struct amdgpu_device *adev)
|
||||
adev->mman.discovery_bin = NULL;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_validate_ip(const struct ip *ip)
|
||||
{
|
||||
if (ip->number_instance >= HWIP_MAX_INSTANCE) {
|
||||
DRM_ERROR("Unexpected number_instance (%d) from ip discovery blob\n",
|
||||
ip->number_instance);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (le16_to_cpu(ip->hw_id) >= HW_ID_MAX) {
|
||||
DRM_ERROR("Unexpected hw_id (%d) from ip discovery blob\n",
|
||||
le16_to_cpu(ip->hw_id));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct binary_header *bhdr;
|
||||
@@ -290,6 +362,10 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
|
||||
|
||||
for (j = 0; j < num_ips; j++) {
|
||||
ip = (struct ip *)(adev->mman.discovery_bin + ip_offset);
|
||||
|
||||
if (amdgpu_discovery_validate_ip(ip))
|
||||
goto next_ip;
|
||||
|
||||
num_base_address = ip->num_base_address;
|
||||
|
||||
DRM_DEBUG("%s(%d) #%d v%d.%d.%d:\n",
|
||||
@@ -301,6 +377,11 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
|
||||
|
||||
if (le16_to_cpu(ip->hw_id) == VCN_HWID)
|
||||
adev->vcn.num_vcn_inst++;
|
||||
if (le16_to_cpu(ip->hw_id) == SDMA0_HWID ||
|
||||
le16_to_cpu(ip->hw_id) == SDMA1_HWID ||
|
||||
le16_to_cpu(ip->hw_id) == SDMA2_HWID ||
|
||||
le16_to_cpu(ip->hw_id) == SDMA3_HWID)
|
||||
adev->sdma.num_instances++;
|
||||
|
||||
for (k = 0; k < num_base_address; k++) {
|
||||
/*
|
||||
@@ -317,10 +398,21 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
|
||||
hw_id_names[le16_to_cpu(ip->hw_id)]);
|
||||
adev->reg_offset[hw_ip][ip->number_instance] =
|
||||
ip->base_address;
|
||||
/* Instance support is somewhat inconsistent.
|
||||
* SDMA is a good example. Sienna cichlid has 4 total
|
||||
* SDMA instances, each enumerated separately (HWIDs
|
||||
* 42, 43, 68, 69). Arcturus has 8 total SDMA instances,
|
||||
* but they are enumerated as multiple instances of the
|
||||
* same HWIDs (4x HWID 42, 4x HWID 43). UMC is another
|
||||
* example. On most chips there are multiple instances
|
||||
* with the same HWID.
|
||||
*/
|
||||
adev->ip_versions[hw_ip][ip->number_instance] =
|
||||
IP_VERSION(ip->major, ip->minor, ip->revision);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
next_ip:
|
||||
ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
|
||||
}
|
||||
}
|
||||
@@ -401,6 +493,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
|
||||
switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
|
||||
case VCN_HWID:
|
||||
vcn_harvest_count++;
|
||||
if (harvest_info->list[i].number_instance == 0)
|
||||
adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN0;
|
||||
else
|
||||
adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
|
||||
break;
|
||||
case DMU_HWID:
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
|
||||
@@ -413,6 +509,13 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
|
||||
}
|
||||
if ((adev->pdev->device == 0x731E &&
|
||||
(adev->pdev->revision == 0xC6 || adev->pdev->revision == 0xC7)) ||
|
||||
(adev->pdev->device == 0x7340 && adev->pdev->revision == 0xC9) ||
|
||||
(adev->pdev->device == 0x7360 && adev->pdev->revision == 0xC7)) {
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
|
||||
@@ -450,3 +553,731 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_common_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
/* what IP to use for this? */
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
amdgpu_device_ip_block_add(adev, &vega10_common_ip_block);
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
amdgpu_device_ip_block_add(adev, &nv_common_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_gmc_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
/* use GC or MMHUB IP version */
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_ih_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->ip_versions[OSSSYS_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
case IP_VERSION(4, 0, 1):
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
case IP_VERSION(4, 3, 0):
|
||||
amdgpu_device_ip_block_add(adev, &vega10_ih_ip_block);
|
||||
break;
|
||||
case IP_VERSION(4, 2, 0):
|
||||
case IP_VERSION(4, 2, 1):
|
||||
case IP_VERSION(4, 4, 0):
|
||||
amdgpu_device_ip_block_add(adev, &vega20_ih_ip_block);
|
||||
break;
|
||||
case IP_VERSION(5, 0, 0):
|
||||
case IP_VERSION(5, 0, 1):
|
||||
case IP_VERSION(5, 0, 2):
|
||||
case IP_VERSION(5, 0, 3):
|
||||
case IP_VERSION(5, 2, 0):
|
||||
case IP_VERSION(5, 2, 1):
|
||||
amdgpu_device_ip_block_add(adev, &navi10_ih_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_psp_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v3_1_ip_block);
|
||||
break;
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v10_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 2):
|
||||
case IP_VERSION(11, 0, 4):
|
||||
case IP_VERSION(11, 0, 5):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
case IP_VERSION(11, 5, 0):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(11, 0, 8):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v11_0_8_ip_block);
|
||||
break;
|
||||
case IP_VERSION(11, 0, 3):
|
||||
case IP_VERSION(12, 0, 1):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v12_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 2):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_smu_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
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)
|
||||
amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
|
||||
else
|
||||
amdgpu_device_ip_block_add(adev, &pp_smu_ip_block);
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 5):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 8):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
case IP_VERSION(11, 5, 0):
|
||||
amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(12, 0, 0):
|
||||
case IP_VERSION(12, 0, 1):
|
||||
amdgpu_device_ip_block_add(adev, &smu_v12_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 2):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
amdgpu_device_ip_block_add(adev, &smu_v13_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_display_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) {
|
||||
amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
|
||||
#if defined(CONFIG_DRM_AMD_DC)
|
||||
} else if (adev->ip_versions[DCE_HWIP][0]) {
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
case IP_VERSION(3, 0, 3):
|
||||
case IP_VERSION(3, 0, 1):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
amdgpu_device_ip_block_add(adev, &dm_ip_block);
|
||||
break;
|
||||
case IP_VERSION(2, 0, 3):
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (adev->ip_versions[DCI_HWIP][0]) {
|
||||
switch (adev->ip_versions[DCI_HWIP][0]) {
|
||||
case IP_VERSION(12, 0, 0):
|
||||
case IP_VERSION(12, 0, 1):
|
||||
case IP_VERSION(12, 1, 0):
|
||||
amdgpu_device_ip_block_add(adev, &dm_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_gc_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
case IP_VERSION(4, 0, 1):
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
case IP_VERSION(4, 1, 2):
|
||||
case IP_VERSION(4, 2, 0):
|
||||
case IP_VERSION(4, 2, 2):
|
||||
case IP_VERSION(4, 4, 0):
|
||||
amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(5, 0, 0):
|
||||
case IP_VERSION(5, 0, 1):
|
||||
case IP_VERSION(5, 0, 2):
|
||||
case IP_VERSION(5, 0, 5):
|
||||
amdgpu_device_ip_block_add(adev, &sdma_v5_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(5, 2, 0):
|
||||
case IP_VERSION(5, 2, 2):
|
||||
case IP_VERSION(5, 2, 4):
|
||||
case IP_VERSION(5, 2, 5):
|
||||
case IP_VERSION(5, 2, 3):
|
||||
case IP_VERSION(5, 2, 1):
|
||||
amdgpu_device_ip_block_add(adev, &sdma_v5_2_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_mm_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->ip_versions[VCE_HWIP][0]) {
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(7, 0, 0):
|
||||
case IP_VERSION(7, 2, 0):
|
||||
/* UVD is not supported on vega20 SR-IOV */
|
||||
if (!(adev->asic_type == CHIP_VEGA20 && amdgpu_sriov_vf(adev)))
|
||||
amdgpu_device_ip_block_add(adev, &uvd_v7_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (adev->ip_versions[VCE_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
case IP_VERSION(4, 1, 0):
|
||||
/* VCE is not supported on vega20 SR-IOV */
|
||||
if (!(adev->asic_type == CHIP_VEGA20 && amdgpu_sriov_vf(adev)))
|
||||
amdgpu_device_ip_block_add(adev, &vce_v4_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v1_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 2, 0):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(2, 0, 3):
|
||||
break;
|
||||
case IP_VERSION(2, 5, 0):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v2_5_ip_block);
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v2_5_ip_block);
|
||||
break;
|
||||
case IP_VERSION(2, 6, 0):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v2_6_ip_block);
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v2_6_ip_block);
|
||||
break;
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 16):
|
||||
case IP_VERSION(3, 1, 1):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v3_0_ip_block);
|
||||
if (!amdgpu_sriov_vf(adev))
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v3_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(3, 0, 33):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v3_0_ip_block);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_discovery_set_mes_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block);
|
||||
break;
|
||||
default:
|
||||
break;;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
vega10_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 2;
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 0, 0);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 0, 0);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 0, 0);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(2, 1, 0);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(6, 1, 0);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(6, 0, 0);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 0, 1);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(7, 0, 0);
|
||||
adev->ip_versions[VCE_HWIP][0] = IP_VERSION(4, 0, 0);
|
||||
adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 0, 0);
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
vega10_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 2;
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 3, 0);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 3, 0);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 0, 1);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 0, 1);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 0, 1);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(2, 5, 0);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(6, 2, 0);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(6, 1, 0);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(9, 0, 0);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(9, 0, 1);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 2, 1);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(7, 0, 0);
|
||||
adev->ip_versions[VCE_HWIP][0] = IP_VERSION(4, 0, 0);
|
||||
adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 0, 1);
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
vega10_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 1;
|
||||
adev->vcn.num_vcn_inst = 1;
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2) {
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 2, 0);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 2, 0);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 1, 1);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 1, 1);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 1, 1);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(2, 1, 1);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(7, 0, 1);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(7, 5, 0);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(10, 0, 1);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(10, 0, 1);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(10, 1, 0);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(10, 0, 1);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 2, 2);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(1, 0, 1);
|
||||
adev->ip_versions[DCE_HWIP][0] = IP_VERSION(1, 0, 1);
|
||||
} else {
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 1, 0);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 1, 0);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 1, 0);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 1, 0);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 1, 0);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(2, 1, 0);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(7, 0, 0);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(7, 0, 0);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(10, 0, 0);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(10, 0, 0);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(10, 0, 0);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(10, 0, 0);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 1, 0);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(1, 0, 0);
|
||||
adev->ip_versions[DCE_HWIP][0] = IP_VERSION(1, 0, 0);
|
||||
}
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
vega20_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 2;
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 4, 0);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 4, 0);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 2, 0);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 2, 0);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 2, 0);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(3, 6, 0);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(7, 4, 0);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(6, 1, 1);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(11, 0, 2);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(11, 0, 2);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(11, 0, 2);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(11, 0, 2);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 4, 0);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(7, 2, 0);
|
||||
adev->ip_versions[VCE_HWIP][0] = IP_VERSION(4, 1, 0);
|
||||
adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 1, 0);
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
arct_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 8;
|
||||
adev->vcn.num_vcn_inst = 2;
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 4, 1);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 4, 1);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 2, 1);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 2, 1);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 2, 2);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(3, 6, 1);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(7, 4, 1);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(6, 1, 2);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(11, 0, 4);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(11, 0, 2);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(11, 0, 3);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(11, 0, 3);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 4, 1);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(2, 5, 0);
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
aldebaran_reg_base_init(adev);
|
||||
adev->sdma.num_instances = 5;
|
||||
adev->vcn.num_vcn_inst = 2;
|
||||
adev->ip_versions[MMHUB_HWIP][0] = IP_VERSION(9, 4, 2);
|
||||
adev->ip_versions[ATHUB_HWIP][0] = IP_VERSION(9, 4, 2);
|
||||
adev->ip_versions[OSSSYS_HWIP][0] = IP_VERSION(4, 4, 0);
|
||||
adev->ip_versions[HDP_HWIP][0] = IP_VERSION(4, 4, 0);
|
||||
adev->ip_versions[SDMA0_HWIP][0] = IP_VERSION(4, 4, 0);
|
||||
adev->ip_versions[DF_HWIP][0] = IP_VERSION(3, 6, 2);
|
||||
adev->ip_versions[NBIO_HWIP][0] = IP_VERSION(7, 4, 4);
|
||||
adev->ip_versions[UMC_HWIP][0] = IP_VERSION(6, 7, 0);
|
||||
adev->ip_versions[MP0_HWIP][0] = IP_VERSION(13, 0, 2);
|
||||
adev->ip_versions[MP1_HWIP][0] = IP_VERSION(13, 0, 2);
|
||||
adev->ip_versions[THM_HWIP][0] = IP_VERSION(13, 0, 2);
|
||||
adev->ip_versions[SMUIO_HWIP][0] = IP_VERSION(13, 0, 2);
|
||||
adev->ip_versions[GC_HWIP][0] = IP_VERSION(9, 4, 2);
|
||||
adev->ip_versions[UVD_HWIP][0] = IP_VERSION(2, 6, 0);
|
||||
adev->ip_versions[XGMI_HWIP][0] = IP_VERSION(6, 1, 0);
|
||||
break;
|
||||
default:
|
||||
r = amdgpu_discovery_reg_base_init(adev);
|
||||
if (r)
|
||||
return -EINVAL;
|
||||
|
||||
amdgpu_discovery_harvest_ip(adev);
|
||||
|
||||
if (!adev->mman.discovery_bin) {
|
||||
DRM_ERROR("ip discovery uninitialized\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->family = AMDGPU_FAMILY_AI;
|
||||
break;
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
adev->family = AMDGPU_FAMILY_RV;
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
adev->family = AMDGPU_FAMILY_NV;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 1):
|
||||
adev->family = AMDGPU_FAMILY_VGH;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->family = AMDGPU_FAMILY_YC;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (adev->ip_versions[XGMI_HWIP][0] == IP_VERSION(4, 8, 0))
|
||||
adev->gmc.xgmi.supported = true;
|
||||
|
||||
/* set NBIO version */
|
||||
switch (adev->ip_versions[NBIO_HWIP][0]) {
|
||||
case IP_VERSION(6, 1, 0):
|
||||
case IP_VERSION(6, 2, 0):
|
||||
adev->nbio.funcs = &nbio_v6_1_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v6_1_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(7, 0, 0):
|
||||
case IP_VERSION(7, 0, 1):
|
||||
case IP_VERSION(2, 5, 0):
|
||||
adev->nbio.funcs = &nbio_v7_0_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v7_0_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(7, 4, 0):
|
||||
case IP_VERSION(7, 4, 1):
|
||||
case IP_VERSION(7, 4, 4):
|
||||
adev->nbio.funcs = &nbio_v7_4_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(7, 2, 0):
|
||||
case IP_VERSION(7, 2, 1):
|
||||
case IP_VERSION(7, 5, 0):
|
||||
adev->nbio.funcs = &nbio_v7_2_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v7_2_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 3, 0):
|
||||
case IP_VERSION(2, 3, 1):
|
||||
case IP_VERSION(2, 3, 2):
|
||||
case IP_VERSION(3, 3, 0):
|
||||
case IP_VERSION(3, 3, 1):
|
||||
case IP_VERSION(3, 3, 2):
|
||||
case IP_VERSION(3, 3, 3):
|
||||
adev->nbio.funcs = &nbio_v2_3_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[HDP_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
case IP_VERSION(4, 0, 1):
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
case IP_VERSION(4, 1, 2):
|
||||
case IP_VERSION(4, 2, 0):
|
||||
case IP_VERSION(4, 2, 1):
|
||||
case IP_VERSION(4, 4, 0):
|
||||
adev->hdp.funcs = &hdp_v4_0_funcs;
|
||||
break;
|
||||
case IP_VERSION(5, 0, 0):
|
||||
case IP_VERSION(5, 0, 1):
|
||||
case IP_VERSION(5, 0, 2):
|
||||
case IP_VERSION(5, 0, 3):
|
||||
case IP_VERSION(5, 0, 4):
|
||||
case IP_VERSION(5, 2, 0):
|
||||
adev->hdp.funcs = &hdp_v5_0_funcs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[DF_HWIP][0]) {
|
||||
case IP_VERSION(3, 6, 0):
|
||||
case IP_VERSION(3, 6, 1):
|
||||
case IP_VERSION(3, 6, 2):
|
||||
adev->df.funcs = &df_v3_6_funcs;
|
||||
break;
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 5, 0):
|
||||
case IP_VERSION(3, 5, 1):
|
||||
case IP_VERSION(3, 5, 2):
|
||||
adev->df.funcs = &df_v1_7_funcs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[SMUIO_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
case IP_VERSION(10, 0, 2):
|
||||
adev->smuio.funcs = &smuio_v9_0_funcs;
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 2):
|
||||
case IP_VERSION(11, 0, 3):
|
||||
case IP_VERSION(11, 0, 4):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 8):
|
||||
adev->smuio.funcs = &smuio_v11_0_funcs;
|
||||
break;
|
||||
case IP_VERSION(11, 0, 6):
|
||||
case IP_VERSION(11, 0, 10):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 5, 0):
|
||||
case IP_VERSION(13, 0, 1):
|
||||
adev->smuio.funcs = &smuio_v11_0_6_funcs;
|
||||
break;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
adev->smuio.funcs = &smuio_v13_0_funcs;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
r = amdgpu_discovery_set_common_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_discovery_set_gmc_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* For SR-IOV, PSP needs to be initialized before IH */
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
r = amdgpu_discovery_set_psp_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
r = amdgpu_discovery_set_ih_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
} else {
|
||||
r = amdgpu_discovery_set_ih_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) {
|
||||
r = amdgpu_discovery_set_psp_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) {
|
||||
r = amdgpu_discovery_set_smu_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_discovery_set_display_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_discovery_set_gc_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_discovery_set_sdma_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
|
||||
!amdgpu_sriov_vf(adev)) {
|
||||
r = amdgpu_discovery_set_smu_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = amdgpu_discovery_set_mm_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->enable_mes) {
|
||||
r = amdgpu_discovery_set_mes_ip_blocks(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,5 +36,6 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id, int n
|
||||
int amdgpu_discovery_get_vcn_version(struct amdgpu_device *adev, int vcn_instance,
|
||||
int *major, int *minor, int *revision);
|
||||
int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev);
|
||||
int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev);
|
||||
|
||||
#endif /* __AMDGPU_DISCOVERY__ */
|
||||
|
||||
@@ -837,6 +837,28 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Mirrors the is_displayable check in radeonsi's gfx6_compute_surface */
|
||||
static int check_tiling_flags_gfx6(struct amdgpu_framebuffer *afb)
|
||||
{
|
||||
u64 micro_tile_mode;
|
||||
|
||||
/* Zero swizzle mode means linear */
|
||||
if (AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE) == 0)
|
||||
return 0;
|
||||
|
||||
micro_tile_mode = AMDGPU_TILING_GET(afb->tiling_flags, MICRO_TILE_MODE);
|
||||
switch (micro_tile_mode) {
|
||||
case 0: /* DISPLAY */
|
||||
case 3: /* RENDER */
|
||||
return 0;
|
||||
default:
|
||||
drm_dbg_kms(afb->base.dev,
|
||||
"Micro tile mode %llu not supported for scanout\n",
|
||||
micro_tile_mode);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void get_block_dimensions(unsigned int block_log2, unsigned int cpp,
|
||||
unsigned int *width, unsigned int *height)
|
||||
{
|
||||
@@ -1103,6 +1125,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
|
||||
const struct drm_mode_fb_cmd2 *mode_cmd,
|
||||
struct drm_gem_object *obj)
|
||||
{
|
||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||
int ret, i;
|
||||
|
||||
/*
|
||||
@@ -1122,6 +1145,14 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!dev->mode_config.allow_fb_modifiers) {
|
||||
drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
|
||||
"GFX9+ requires FB check based on format modifier\n");
|
||||
ret = check_tiling_flags_gfx6(rfb);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (dev->mode_config.allow_fb_modifiers &&
|
||||
!(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
|
||||
ret = convert_tiling_flags_to_modifier(rfb);
|
||||
|
||||
@@ -96,9 +96,11 @@
|
||||
* - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
|
||||
* - 3.41.0 - Add video codec query
|
||||
* - 3.42.0 - Add 16bpc fixed point display support
|
||||
* - 3.43.0 - Add device hot plug/unplug support
|
||||
* - 3.44.0 - DCN3 supports DCC independent block settings: !64B && 128B, 64B && 128B
|
||||
*/
|
||||
#define KMS_DRIVER_MAJOR 3
|
||||
#define KMS_DRIVER_MINOR 42
|
||||
#define KMS_DRIVER_MINOR 44
|
||||
#define KMS_DRIVER_PATCHLEVEL 0
|
||||
|
||||
int amdgpu_vram_limit;
|
||||
@@ -627,7 +629,7 @@ module_param_named(mcbp, amdgpu_mcbp, int, 0444);
|
||||
/**
|
||||
* DOC: discovery (int)
|
||||
* Allow driver to discover hardware IP information from IP Discovery table at the top of VRAM.
|
||||
* (-1 = auto (default), 0 = disabled, 1 = enabled)
|
||||
* (-1 = auto (default), 0 = disabled, 1 = enabled, 2 = use ip_discovery table from file)
|
||||
*/
|
||||
MODULE_PARM_DESC(discovery,
|
||||
"Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM");
|
||||
@@ -890,6 +892,636 @@ MODULE_PARM_DESC(smu_pptable_id,
|
||||
"specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");
|
||||
module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444);
|
||||
|
||||
/* These devices are not supported by amdgpu.
|
||||
* They are supported by the mach64, r128, radeon drivers
|
||||
*/
|
||||
static const u16 amdgpu_unsupported_pciidlist[] = {
|
||||
/* mach64 */
|
||||
0x4354,
|
||||
0x4358,
|
||||
0x4554,
|
||||
0x4742,
|
||||
0x4744,
|
||||
0x4749,
|
||||
0x474C,
|
||||
0x474D,
|
||||
0x474E,
|
||||
0x474F,
|
||||
0x4750,
|
||||
0x4751,
|
||||
0x4752,
|
||||
0x4753,
|
||||
0x4754,
|
||||
0x4755,
|
||||
0x4756,
|
||||
0x4757,
|
||||
0x4758,
|
||||
0x4759,
|
||||
0x475A,
|
||||
0x4C42,
|
||||
0x4C44,
|
||||
0x4C47,
|
||||
0x4C49,
|
||||
0x4C4D,
|
||||
0x4C4E,
|
||||
0x4C50,
|
||||
0x4C51,
|
||||
0x4C52,
|
||||
0x4C53,
|
||||
0x5654,
|
||||
0x5655,
|
||||
0x5656,
|
||||
/* r128 */
|
||||
0x4c45,
|
||||
0x4c46,
|
||||
0x4d46,
|
||||
0x4d4c,
|
||||
0x5041,
|
||||
0x5042,
|
||||
0x5043,
|
||||
0x5044,
|
||||
0x5045,
|
||||
0x5046,
|
||||
0x5047,
|
||||
0x5048,
|
||||
0x5049,
|
||||
0x504A,
|
||||
0x504B,
|
||||
0x504C,
|
||||
0x504D,
|
||||
0x504E,
|
||||
0x504F,
|
||||
0x5050,
|
||||
0x5051,
|
||||
0x5052,
|
||||
0x5053,
|
||||
0x5054,
|
||||
0x5055,
|
||||
0x5056,
|
||||
0x5057,
|
||||
0x5058,
|
||||
0x5245,
|
||||
0x5246,
|
||||
0x5247,
|
||||
0x524b,
|
||||
0x524c,
|
||||
0x534d,
|
||||
0x5446,
|
||||
0x544C,
|
||||
0x5452,
|
||||
/* radeon */
|
||||
0x3150,
|
||||
0x3151,
|
||||
0x3152,
|
||||
0x3154,
|
||||
0x3155,
|
||||
0x3E50,
|
||||
0x3E54,
|
||||
0x4136,
|
||||
0x4137,
|
||||
0x4144,
|
||||
0x4145,
|
||||
0x4146,
|
||||
0x4147,
|
||||
0x4148,
|
||||
0x4149,
|
||||
0x414A,
|
||||
0x414B,
|
||||
0x4150,
|
||||
0x4151,
|
||||
0x4152,
|
||||
0x4153,
|
||||
0x4154,
|
||||
0x4155,
|
||||
0x4156,
|
||||
0x4237,
|
||||
0x4242,
|
||||
0x4336,
|
||||
0x4337,
|
||||
0x4437,
|
||||
0x4966,
|
||||
0x4967,
|
||||
0x4A48,
|
||||
0x4A49,
|
||||
0x4A4A,
|
||||
0x4A4B,
|
||||
0x4A4C,
|
||||
0x4A4D,
|
||||
0x4A4E,
|
||||
0x4A4F,
|
||||
0x4A50,
|
||||
0x4A54,
|
||||
0x4B48,
|
||||
0x4B49,
|
||||
0x4B4A,
|
||||
0x4B4B,
|
||||
0x4B4C,
|
||||
0x4C57,
|
||||
0x4C58,
|
||||
0x4C59,
|
||||
0x4C5A,
|
||||
0x4C64,
|
||||
0x4C66,
|
||||
0x4C67,
|
||||
0x4E44,
|
||||
0x4E45,
|
||||
0x4E46,
|
||||
0x4E47,
|
||||
0x4E48,
|
||||
0x4E49,
|
||||
0x4E4A,
|
||||
0x4E4B,
|
||||
0x4E50,
|
||||
0x4E51,
|
||||
0x4E52,
|
||||
0x4E53,
|
||||
0x4E54,
|
||||
0x4E56,
|
||||
0x5144,
|
||||
0x5145,
|
||||
0x5146,
|
||||
0x5147,
|
||||
0x5148,
|
||||
0x514C,
|
||||
0x514D,
|
||||
0x5157,
|
||||
0x5158,
|
||||
0x5159,
|
||||
0x515A,
|
||||
0x515E,
|
||||
0x5460,
|
||||
0x5462,
|
||||
0x5464,
|
||||
0x5548,
|
||||
0x5549,
|
||||
0x554A,
|
||||
0x554B,
|
||||
0x554C,
|
||||
0x554D,
|
||||
0x554E,
|
||||
0x554F,
|
||||
0x5550,
|
||||
0x5551,
|
||||
0x5552,
|
||||
0x5554,
|
||||
0x564A,
|
||||
0x564B,
|
||||
0x564F,
|
||||
0x5652,
|
||||
0x5653,
|
||||
0x5657,
|
||||
0x5834,
|
||||
0x5835,
|
||||
0x5954,
|
||||
0x5955,
|
||||
0x5974,
|
||||
0x5975,
|
||||
0x5960,
|
||||
0x5961,
|
||||
0x5962,
|
||||
0x5964,
|
||||
0x5965,
|
||||
0x5969,
|
||||
0x5a41,
|
||||
0x5a42,
|
||||
0x5a61,
|
||||
0x5a62,
|
||||
0x5b60,
|
||||
0x5b62,
|
||||
0x5b63,
|
||||
0x5b64,
|
||||
0x5b65,
|
||||
0x5c61,
|
||||
0x5c63,
|
||||
0x5d48,
|
||||
0x5d49,
|
||||
0x5d4a,
|
||||
0x5d4c,
|
||||
0x5d4d,
|
||||
0x5d4e,
|
||||
0x5d4f,
|
||||
0x5d50,
|
||||
0x5d52,
|
||||
0x5d57,
|
||||
0x5e48,
|
||||
0x5e4a,
|
||||
0x5e4b,
|
||||
0x5e4c,
|
||||
0x5e4d,
|
||||
0x5e4f,
|
||||
0x6700,
|
||||
0x6701,
|
||||
0x6702,
|
||||
0x6703,
|
||||
0x6704,
|
||||
0x6705,
|
||||
0x6706,
|
||||
0x6707,
|
||||
0x6708,
|
||||
0x6709,
|
||||
0x6718,
|
||||
0x6719,
|
||||
0x671c,
|
||||
0x671d,
|
||||
0x671f,
|
||||
0x6720,
|
||||
0x6721,
|
||||
0x6722,
|
||||
0x6723,
|
||||
0x6724,
|
||||
0x6725,
|
||||
0x6726,
|
||||
0x6727,
|
||||
0x6728,
|
||||
0x6729,
|
||||
0x6738,
|
||||
0x6739,
|
||||
0x673e,
|
||||
0x6740,
|
||||
0x6741,
|
||||
0x6742,
|
||||
0x6743,
|
||||
0x6744,
|
||||
0x6745,
|
||||
0x6746,
|
||||
0x6747,
|
||||
0x6748,
|
||||
0x6749,
|
||||
0x674A,
|
||||
0x6750,
|
||||
0x6751,
|
||||
0x6758,
|
||||
0x6759,
|
||||
0x675B,
|
||||
0x675D,
|
||||
0x675F,
|
||||
0x6760,
|
||||
0x6761,
|
||||
0x6762,
|
||||
0x6763,
|
||||
0x6764,
|
||||
0x6765,
|
||||
0x6766,
|
||||
0x6767,
|
||||
0x6768,
|
||||
0x6770,
|
||||
0x6771,
|
||||
0x6772,
|
||||
0x6778,
|
||||
0x6779,
|
||||
0x677B,
|
||||
0x6840,
|
||||
0x6841,
|
||||
0x6842,
|
||||
0x6843,
|
||||
0x6849,
|
||||
0x684C,
|
||||
0x6850,
|
||||
0x6858,
|
||||
0x6859,
|
||||
0x6880,
|
||||
0x6888,
|
||||
0x6889,
|
||||
0x688A,
|
||||
0x688C,
|
||||
0x688D,
|
||||
0x6898,
|
||||
0x6899,
|
||||
0x689b,
|
||||
0x689c,
|
||||
0x689d,
|
||||
0x689e,
|
||||
0x68a0,
|
||||
0x68a1,
|
||||
0x68a8,
|
||||
0x68a9,
|
||||
0x68b0,
|
||||
0x68b8,
|
||||
0x68b9,
|
||||
0x68ba,
|
||||
0x68be,
|
||||
0x68bf,
|
||||
0x68c0,
|
||||
0x68c1,
|
||||
0x68c7,
|
||||
0x68c8,
|
||||
0x68c9,
|
||||
0x68d8,
|
||||
0x68d9,
|
||||
0x68da,
|
||||
0x68de,
|
||||
0x68e0,
|
||||
0x68e1,
|
||||
0x68e4,
|
||||
0x68e5,
|
||||
0x68e8,
|
||||
0x68e9,
|
||||
0x68f1,
|
||||
0x68f2,
|
||||
0x68f8,
|
||||
0x68f9,
|
||||
0x68fa,
|
||||
0x68fe,
|
||||
0x7100,
|
||||
0x7101,
|
||||
0x7102,
|
||||
0x7103,
|
||||
0x7104,
|
||||
0x7105,
|
||||
0x7106,
|
||||
0x7108,
|
||||
0x7109,
|
||||
0x710A,
|
||||
0x710B,
|
||||
0x710C,
|
||||
0x710E,
|
||||
0x710F,
|
||||
0x7140,
|
||||
0x7141,
|
||||
0x7142,
|
||||
0x7143,
|
||||
0x7144,
|
||||
0x7145,
|
||||
0x7146,
|
||||
0x7147,
|
||||
0x7149,
|
||||
0x714A,
|
||||
0x714B,
|
||||
0x714C,
|
||||
0x714D,
|
||||
0x714E,
|
||||
0x714F,
|
||||
0x7151,
|
||||
0x7152,
|
||||
0x7153,
|
||||
0x715E,
|
||||
0x715F,
|
||||
0x7180,
|
||||
0x7181,
|
||||
0x7183,
|
||||
0x7186,
|
||||
0x7187,
|
||||
0x7188,
|
||||
0x718A,
|
||||
0x718B,
|
||||
0x718C,
|
||||
0x718D,
|
||||
0x718F,
|
||||
0x7193,
|
||||
0x7196,
|
||||
0x719B,
|
||||
0x719F,
|
||||
0x71C0,
|
||||
0x71C1,
|
||||
0x71C2,
|
||||
0x71C3,
|
||||
0x71C4,
|
||||
0x71C5,
|
||||
0x71C6,
|
||||
0x71C7,
|
||||
0x71CD,
|
||||
0x71CE,
|
||||
0x71D2,
|
||||
0x71D4,
|
||||
0x71D5,
|
||||
0x71D6,
|
||||
0x71DA,
|
||||
0x71DE,
|
||||
0x7200,
|
||||
0x7210,
|
||||
0x7211,
|
||||
0x7240,
|
||||
0x7243,
|
||||
0x7244,
|
||||
0x7245,
|
||||
0x7246,
|
||||
0x7247,
|
||||
0x7248,
|
||||
0x7249,
|
||||
0x724A,
|
||||
0x724B,
|
||||
0x724C,
|
||||
0x724D,
|
||||
0x724E,
|
||||
0x724F,
|
||||
0x7280,
|
||||
0x7281,
|
||||
0x7283,
|
||||
0x7284,
|
||||
0x7287,
|
||||
0x7288,
|
||||
0x7289,
|
||||
0x728B,
|
||||
0x728C,
|
||||
0x7290,
|
||||
0x7291,
|
||||
0x7293,
|
||||
0x7297,
|
||||
0x7834,
|
||||
0x7835,
|
||||
0x791e,
|
||||
0x791f,
|
||||
0x793f,
|
||||
0x7941,
|
||||
0x7942,
|
||||
0x796c,
|
||||
0x796d,
|
||||
0x796e,
|
||||
0x796f,
|
||||
0x9400,
|
||||
0x9401,
|
||||
0x9402,
|
||||
0x9403,
|
||||
0x9405,
|
||||
0x940A,
|
||||
0x940B,
|
||||
0x940F,
|
||||
0x94A0,
|
||||
0x94A1,
|
||||
0x94A3,
|
||||
0x94B1,
|
||||
0x94B3,
|
||||
0x94B4,
|
||||
0x94B5,
|
||||
0x94B9,
|
||||
0x9440,
|
||||
0x9441,
|
||||
0x9442,
|
||||
0x9443,
|
||||
0x9444,
|
||||
0x9446,
|
||||
0x944A,
|
||||
0x944B,
|
||||
0x944C,
|
||||
0x944E,
|
||||
0x9450,
|
||||
0x9452,
|
||||
0x9456,
|
||||
0x945A,
|
||||
0x945B,
|
||||
0x945E,
|
||||
0x9460,
|
||||
0x9462,
|
||||
0x946A,
|
||||
0x946B,
|
||||
0x947A,
|
||||
0x947B,
|
||||
0x9480,
|
||||
0x9487,
|
||||
0x9488,
|
||||
0x9489,
|
||||
0x948A,
|
||||
0x948F,
|
||||
0x9490,
|
||||
0x9491,
|
||||
0x9495,
|
||||
0x9498,
|
||||
0x949C,
|
||||
0x949E,
|
||||
0x949F,
|
||||
0x94C0,
|
||||
0x94C1,
|
||||
0x94C3,
|
||||
0x94C4,
|
||||
0x94C5,
|
||||
0x94C6,
|
||||
0x94C7,
|
||||
0x94C8,
|
||||
0x94C9,
|
||||
0x94CB,
|
||||
0x94CC,
|
||||
0x94CD,
|
||||
0x9500,
|
||||
0x9501,
|
||||
0x9504,
|
||||
0x9505,
|
||||
0x9506,
|
||||
0x9507,
|
||||
0x9508,
|
||||
0x9509,
|
||||
0x950F,
|
||||
0x9511,
|
||||
0x9515,
|
||||
0x9517,
|
||||
0x9519,
|
||||
0x9540,
|
||||
0x9541,
|
||||
0x9542,
|
||||
0x954E,
|
||||
0x954F,
|
||||
0x9552,
|
||||
0x9553,
|
||||
0x9555,
|
||||
0x9557,
|
||||
0x955f,
|
||||
0x9580,
|
||||
0x9581,
|
||||
0x9583,
|
||||
0x9586,
|
||||
0x9587,
|
||||
0x9588,
|
||||
0x9589,
|
||||
0x958A,
|
||||
0x958B,
|
||||
0x958C,
|
||||
0x958D,
|
||||
0x958E,
|
||||
0x958F,
|
||||
0x9590,
|
||||
0x9591,
|
||||
0x9593,
|
||||
0x9595,
|
||||
0x9596,
|
||||
0x9597,
|
||||
0x9598,
|
||||
0x9599,
|
||||
0x959B,
|
||||
0x95C0,
|
||||
0x95C2,
|
||||
0x95C4,
|
||||
0x95C5,
|
||||
0x95C6,
|
||||
0x95C7,
|
||||
0x95C9,
|
||||
0x95CC,
|
||||
0x95CD,
|
||||
0x95CE,
|
||||
0x95CF,
|
||||
0x9610,
|
||||
0x9611,
|
||||
0x9612,
|
||||
0x9613,
|
||||
0x9614,
|
||||
0x9615,
|
||||
0x9616,
|
||||
0x9640,
|
||||
0x9641,
|
||||
0x9642,
|
||||
0x9643,
|
||||
0x9644,
|
||||
0x9645,
|
||||
0x9647,
|
||||
0x9648,
|
||||
0x9649,
|
||||
0x964a,
|
||||
0x964b,
|
||||
0x964c,
|
||||
0x964e,
|
||||
0x964f,
|
||||
0x9710,
|
||||
0x9711,
|
||||
0x9712,
|
||||
0x9713,
|
||||
0x9714,
|
||||
0x9715,
|
||||
0x9802,
|
||||
0x9803,
|
||||
0x9804,
|
||||
0x9805,
|
||||
0x9806,
|
||||
0x9807,
|
||||
0x9808,
|
||||
0x9809,
|
||||
0x980A,
|
||||
0x9900,
|
||||
0x9901,
|
||||
0x9903,
|
||||
0x9904,
|
||||
0x9905,
|
||||
0x9906,
|
||||
0x9907,
|
||||
0x9908,
|
||||
0x9909,
|
||||
0x990A,
|
||||
0x990B,
|
||||
0x990C,
|
||||
0x990D,
|
||||
0x990E,
|
||||
0x990F,
|
||||
0x9910,
|
||||
0x9913,
|
||||
0x9917,
|
||||
0x9918,
|
||||
0x9919,
|
||||
0x9990,
|
||||
0x9991,
|
||||
0x9992,
|
||||
0x9993,
|
||||
0x9994,
|
||||
0x9995,
|
||||
0x9996,
|
||||
0x9997,
|
||||
0x9998,
|
||||
0x9999,
|
||||
0x999A,
|
||||
0x999B,
|
||||
0x999C,
|
||||
0x999D,
|
||||
0x99A0,
|
||||
0x99A2,
|
||||
0x99A4,
|
||||
};
|
||||
|
||||
static const struct pci_device_id pciidlist[] = {
|
||||
#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
{0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
|
||||
@@ -1239,6 +1871,16 @@ static const struct pci_device_id pciidlist[] = {
|
||||
{0x1002, 0x7423, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY},
|
||||
{0x1002, 0x743F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY},
|
||||
|
||||
{ PCI_DEVICE(0x1002, PCI_ANY_ID),
|
||||
.class = PCI_CLASS_DISPLAY_VGA << 8,
|
||||
.class_mask = 0xffffff,
|
||||
.driver_data = CHIP_IP_DISCOVERY },
|
||||
|
||||
{ PCI_DEVICE(0x1002, PCI_ANY_ID),
|
||||
.class = PCI_CLASS_DISPLAY_OTHER << 8,
|
||||
.class_mask = 0xffffff,
|
||||
.driver_data = CHIP_IP_DISCOVERY },
|
||||
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -1252,9 +1894,20 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
|
||||
struct drm_device *ddev;
|
||||
struct amdgpu_device *adev;
|
||||
unsigned long flags = ent->driver_data;
|
||||
int ret, retry = 0;
|
||||
int ret, retry = 0, i;
|
||||
bool supports_atomic = false;
|
||||
|
||||
/* skip devices which are owned by radeon */
|
||||
for (i = 0; i < ARRAY_SIZE(amdgpu_unsupported_pciidlist); i++) {
|
||||
if (amdgpu_unsupported_pciidlist[i] == pdev->device)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (flags == 0) {
|
||||
DRM_INFO("Unsupported asic. Remove me when IP discovery init is in place.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (amdgpu_virtual_display ||
|
||||
amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
|
||||
supports_atomic = true;
|
||||
|
||||
@@ -550,7 +550,7 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)
|
||||
drm_sched_stop(&ring->sched, NULL);
|
||||
|
||||
/* You can't wait for HW to signal if it's gone */
|
||||
if (!drm_dev_is_unplugged(&adev->ddev))
|
||||
if (!drm_dev_is_unplugged(adev_to_drm(adev)))
|
||||
r = amdgpu_fence_wait_empty(ring);
|
||||
else
|
||||
r = -ENODEV;
|
||||
|
||||
@@ -238,7 +238,7 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return 0;
|
||||
|
||||
t = offset / AMDGPU_GPU_PAGE_SIZE;
|
||||
@@ -289,7 +289,7 @@ int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return 0;
|
||||
|
||||
t = offset / AMDGPU_GPU_PAGE_SIZE;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
/* delay 0.1 second to enable gfx off feature */
|
||||
#define GFX_OFF_DELAY_ENABLE msecs_to_jiffies(100)
|
||||
|
||||
#define GFX_OFF_NO_DELAY 0
|
||||
|
||||
/*
|
||||
* GPU GFX IP block helpers function.
|
||||
*/
|
||||
@@ -558,6 +560,8 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev)
|
||||
|
||||
void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
|
||||
{
|
||||
unsigned long delay = GFX_OFF_DELAY_ENABLE;
|
||||
|
||||
if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
|
||||
return;
|
||||
|
||||
@@ -573,8 +577,14 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
|
||||
|
||||
adev->gfx.gfx_off_req_count--;
|
||||
|
||||
if (adev->gfx.gfx_off_req_count == 0 && !adev->gfx.gfx_off_state)
|
||||
schedule_delayed_work(&adev->gfx.gfx_off_delay_work, GFX_OFF_DELAY_ENABLE);
|
||||
if (adev->gfx.gfx_off_req_count == 0 &&
|
||||
!adev->gfx.gfx_off_state) {
|
||||
/* If going to s2idle, no need to wait */
|
||||
if (adev->in_s0ix)
|
||||
delay = GFX_OFF_NO_DELAY;
|
||||
schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
|
||||
delay);
|
||||
}
|
||||
} else {
|
||||
if (adev->gfx.gfx_off_req_count == 0) {
|
||||
cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
|
||||
|
||||
@@ -745,7 +745,7 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev)
|
||||
u64 gart_ptb_gpu_pa = amdgpu_gmc_vram_pa(adev, adev->gart.bo);
|
||||
int idx;
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return;
|
||||
|
||||
flags |= AMDGPU_PTE_VALID | AMDGPU_PTE_READABLE;
|
||||
|
||||
@@ -38,7 +38,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
int idx;
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
DRM_INFO("%s - device unplugged skipping recovery on scheduler:%s",
|
||||
__func__, s_job->sched->name);
|
||||
|
||||
|
||||
@@ -1004,29 +1004,6 @@ void amdgpu_bo_unpin(struct amdgpu_bo *bo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_bo_evict_vram - evict VRAM buffers
|
||||
* @adev: amdgpu device object
|
||||
*
|
||||
* Evicts all VRAM buffers on the lru list of the memory type.
|
||||
* Mainly used for evicting vram at suspend time.
|
||||
*
|
||||
* Returns:
|
||||
* 0 for success or a negative error code on failure.
|
||||
*/
|
||||
int amdgpu_bo_evict_vram(struct amdgpu_device *adev)
|
||||
{
|
||||
struct ttm_resource_manager *man;
|
||||
|
||||
if (adev->in_s3 && (adev->flags & AMD_IS_APU)) {
|
||||
/* No need to evict vram on APUs for suspend to ram */
|
||||
return 0;
|
||||
}
|
||||
|
||||
man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
|
||||
return ttm_resource_manager_evict_all(&adev->mman.bdev, man);
|
||||
}
|
||||
|
||||
static const char *amdgpu_vram_names[] = {
|
||||
"UNKNOWN",
|
||||
"GDDR1",
|
||||
|
||||
@@ -304,7 +304,6 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain);
|
||||
int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
|
||||
u64 min_offset, u64 max_offset);
|
||||
void amdgpu_bo_unpin(struct amdgpu_bo *bo);
|
||||
int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
|
||||
int amdgpu_bo_init(struct amdgpu_device *adev);
|
||||
void amdgpu_bo_fini(struct amdgpu_device *adev);
|
||||
int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags);
|
||||
|
||||
@@ -71,17 +71,25 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp
|
||||
{
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
|
||||
psp->pmfw_centralized_cstate_management = false;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
psp->pmfw_centralized_cstate_management = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (adev->flags & AMD_IS_APU)
|
||||
return;
|
||||
|
||||
if ((adev->asic_type >= CHIP_ARCTURUS) ||
|
||||
(adev->asic_type >= CHIP_NAVI12))
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 4):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
case IP_VERSION(13, 0, 2):
|
||||
psp->pmfw_centralized_cstate_management = true;
|
||||
break;
|
||||
default:
|
||||
psp->pmfw_centralized_cstate_management = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int psp_early_init(void *handle)
|
||||
@@ -89,43 +97,45 @@ static int psp_early_init(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct psp_context *psp = &adev->psp;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
psp_v3_1_set_psp_funcs(psp);
|
||||
psp->autoload_supported = false;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
psp_v10_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = false;
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(11, 0, 2):
|
||||
case IP_VERSION(11, 0, 4):
|
||||
psp_v11_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = false;
|
||||
break;
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 5):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 5, 0):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
psp_v11_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = true;
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(11, 0, 3):
|
||||
case IP_VERSION(12, 0, 1):
|
||||
psp_v12_0_set_psp_funcs(psp);
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(13, 0, 2):
|
||||
psp_v13_0_set_psp_funcs(psp);
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
psp_v13_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = true;
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(11, 0, 8):
|
||||
if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2) {
|
||||
psp_v11_0_8_set_psp_funcs(psp);
|
||||
psp->autoload_supported = false;
|
||||
@@ -268,7 +278,8 @@ static int psp_sw_init(void *handle)
|
||||
DRM_ERROR("Failed to load psp firmware!\n");
|
||||
return ret;
|
||||
}
|
||||
} else if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_ALDEBARAN) {
|
||||
} else if (amdgpu_sriov_vf(adev) &&
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2)) {
|
||||
ret = psp_init_ta_microcode(psp, "aldebaran");
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to initialize ta microcode!\n");
|
||||
@@ -311,7 +322,8 @@ static int psp_sw_init(void *handle)
|
||||
}
|
||||
}
|
||||
|
||||
if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == CHIP_SIENNA_CICHLID) {
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7)) {
|
||||
ret= psp_sysfs_init(adev);
|
||||
if (ret) {
|
||||
return ret;
|
||||
@@ -341,8 +353,8 @@ static int psp_sw_fini(void *handle)
|
||||
psp->ta_fw = NULL;
|
||||
}
|
||||
|
||||
if (adev->asic_type == CHIP_NAVI10 ||
|
||||
adev->asic_type == CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
|
||||
psp_sysfs_fini(adev);
|
||||
|
||||
kfree(cmd);
|
||||
@@ -428,7 +440,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
|
||||
if (psp->adev->no_hw_access)
|
||||
return 0;
|
||||
|
||||
if (!drm_dev_enter(&psp->adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(psp->adev), &idx))
|
||||
return 0;
|
||||
|
||||
memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);
|
||||
@@ -601,10 +613,10 @@ static int psp_tmr_init(struct psp_context *psp)
|
||||
|
||||
static bool psp_skip_tmr(struct psp_context *psp)
|
||||
{
|
||||
switch (psp->adev->asic_type) {
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (psp->adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(13, 0, 2):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -938,12 +950,12 @@ static void psp_prep_ta_invoke_cmd_buf(struct psp_gfx_cmd_resp *cmd,
|
||||
|
||||
static int psp_ta_invoke(struct psp_context *psp,
|
||||
uint32_t ta_cmd_id,
|
||||
uint32_t session_id)
|
||||
struct ta_context *context)
|
||||
{
|
||||
int ret;
|
||||
struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
|
||||
|
||||
psp_prep_ta_invoke_cmd_buf(cmd, ta_cmd_id, session_id);
|
||||
psp_prep_ta_invoke_cmd_buf(cmd, ta_cmd_id, context->session_id);
|
||||
|
||||
ret = psp_cmd_submit_buf(psp, NULL, cmd,
|
||||
psp->fence_buf_mc_addr);
|
||||
@@ -989,7 +1001,7 @@ static int psp_xgmi_unload(struct psp_context *psp)
|
||||
|
||||
int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
|
||||
{
|
||||
return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.context.session_id);
|
||||
return psp_ta_invoke(psp, ta_cmd_id, &psp->xgmi_context.context);
|
||||
}
|
||||
|
||||
int psp_xgmi_terminate(struct psp_context *psp)
|
||||
@@ -998,8 +1010,9 @@ int psp_xgmi_terminate(struct psp_context *psp)
|
||||
struct amdgpu_device *adev = psp->adev;
|
||||
|
||||
/* XGMI TA unload currently is not supported on Arcturus/Aldebaran A+A */
|
||||
if (adev->asic_type == CHIP_ARCTURUS ||
|
||||
(adev->asic_type == CHIP_ALDEBARAN && adev->gmc.xgmi.connected_to_cpu))
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 4) ||
|
||||
(adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2) &&
|
||||
adev->gmc.xgmi.connected_to_cpu))
|
||||
return 0;
|
||||
|
||||
if (!psp->xgmi_context.context.initialized)
|
||||
@@ -1100,8 +1113,8 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id)
|
||||
|
||||
static bool psp_xgmi_peer_link_info_supported(struct psp_context *psp)
|
||||
{
|
||||
return psp->adev->asic_type == CHIP_ALDEBARAN &&
|
||||
psp->xgmi_context.context.bin_desc.feature_version >= 0x2000000b;
|
||||
return psp->adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2) &&
|
||||
psp->xgmi_context.context.bin_desc.feature_version >= 0x2000000b;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1291,7 +1304,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
|
||||
if (amdgpu_sriov_vf(psp->adev))
|
||||
return 0;
|
||||
|
||||
ret = psp_ta_invoke(psp, ta_cmd_id, psp->ras_context.context.session_id);
|
||||
ret = psp_ta_invoke(psp, ta_cmd_id, &psp->ras_context.context);
|
||||
|
||||
if (amdgpu_ras_intr_triggered())
|
||||
return ret;
|
||||
@@ -1444,9 +1457,9 @@ static int psp_ras_initialize(struct psp_context *psp)
|
||||
ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
|
||||
memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
|
||||
|
||||
if (psp->adev->gmc.xgmi.connected_to_cpu)
|
||||
if (amdgpu_ras_is_poison_mode_supported(adev))
|
||||
ras_cmd->ras_in_message.init_flags.poison_mode_en = 1;
|
||||
else
|
||||
if (!adev->gmc.xgmi.connected_to_cpu)
|
||||
ras_cmd->ras_in_message.init_flags.dgpu_mode = 1;
|
||||
|
||||
ret = psp_ras_load(psp);
|
||||
@@ -1551,7 +1564,7 @@ int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
|
||||
if (amdgpu_sriov_vf(psp->adev))
|
||||
return 0;
|
||||
|
||||
return psp_ta_invoke(psp, ta_cmd_id, psp->hdcp_context.context.session_id);
|
||||
return psp_ta_invoke(psp, ta_cmd_id, &psp->hdcp_context.context);
|
||||
}
|
||||
|
||||
static int psp_hdcp_terminate(struct psp_context *psp)
|
||||
@@ -1643,7 +1656,7 @@ int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
|
||||
if (amdgpu_sriov_vf(psp->adev))
|
||||
return 0;
|
||||
|
||||
return psp_ta_invoke(psp, ta_cmd_id, psp->dtm_context.context.session_id);
|
||||
return psp_ta_invoke(psp, ta_cmd_id, &psp->dtm_context.context);
|
||||
}
|
||||
|
||||
static int psp_dtm_terminate(struct psp_context *psp)
|
||||
@@ -1777,7 +1790,7 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_stat
|
||||
rap_cmd->cmd_id = ta_cmd_id;
|
||||
rap_cmd->validation_method_id = METHOD_A;
|
||||
|
||||
ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.context.session_id);
|
||||
ret = psp_ta_invoke(psp, rap_cmd->cmd_id, &psp->rap_context.context);
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
||||
@@ -1899,7 +1912,7 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
|
||||
|
||||
mutex_lock(&psp->securedisplay_context.mutex);
|
||||
|
||||
ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.context.session_id);
|
||||
ret = psp_ta_invoke(psp, ta_cmd_id, &psp->securedisplay_context.context);
|
||||
|
||||
mutex_unlock(&psp->securedisplay_context.mutex);
|
||||
|
||||
@@ -2219,8 +2232,8 @@ static int psp_load_smu_fw(struct psp_context *psp)
|
||||
|
||||
if ((amdgpu_in_reset(adev) &&
|
||||
ras && adev->ras_enabled &&
|
||||
(adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_VEGA20))) {
|
||||
(adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 4) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 2)))) {
|
||||
ret = amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_UNLOAD);
|
||||
if (ret) {
|
||||
DRM_WARN("Failed to set MP1 state prepare for reload\n");
|
||||
@@ -2317,8 +2330,9 @@ static int psp_load_non_psp_fw(struct psp_context *psp)
|
||||
continue;
|
||||
|
||||
if (psp->autoload_supported &&
|
||||
(adev->asic_type >= CHIP_SIENNA_CICHLID &&
|
||||
adev->asic_type <= CHIP_DIMGREY_CAVEFISH) &&
|
||||
(adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 11) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 12)) &&
|
||||
(ucode->ucode_id == AMDGPU_UCODE_ID_SDMA1 ||
|
||||
ucode->ucode_id == AMDGPU_UCODE_ID_SDMA2 ||
|
||||
ucode->ucode_id == AMDGPU_UCODE_ID_SDMA3))
|
||||
@@ -2905,7 +2919,8 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
|
||||
ucode_array_start_addr = (uint8_t *)sos_hdr +
|
||||
le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
|
||||
|
||||
if (adev->gmc.xgmi.connected_to_cpu || (adev->asic_type != CHIP_ALDEBARAN)) {
|
||||
if (adev->gmc.xgmi.connected_to_cpu ||
|
||||
(adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 2))) {
|
||||
adev->psp.sos.fw_version = le32_to_cpu(sos_hdr->header.ucode_version);
|
||||
adev->psp.sos.feature_version = le32_to_cpu(sos_hdr->sos.fw_version);
|
||||
|
||||
@@ -3257,7 +3272,7 @@ void psp_copy_fw(struct psp_context *psp, uint8_t *start_addr, uint32_t bin_size
|
||||
{
|
||||
int idx;
|
||||
|
||||
if (!drm_dev_enter(&psp->adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(psp->adev), &idx))
|
||||
return;
|
||||
|
||||
memset(psp->fw_pri_buf, 0, PSP_1_MEG);
|
||||
|
||||
@@ -35,7 +35,11 @@
|
||||
#include "amdgpu_xgmi.h"
|
||||
#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
|
||||
#include "atom.h"
|
||||
#ifdef CONFIG_X86_MCE_AMD
|
||||
#include <asm/mce.h>
|
||||
|
||||
static bool notifier_registered;
|
||||
#endif
|
||||
static const char *RAS_FS_NAME = "ras";
|
||||
|
||||
const char *ras_error_string[] = {
|
||||
@@ -107,6 +111,9 @@ static bool amdgpu_ras_check_bad_page_unlock(struct amdgpu_ras *con,
|
||||
uint64_t addr);
|
||||
static bool amdgpu_ras_check_bad_page(struct amdgpu_device *adev,
|
||||
uint64_t addr);
|
||||
#ifdef CONFIG_X86_MCE_AMD
|
||||
static void amdgpu_register_bad_pages_mca_notifier(void);
|
||||
#endif
|
||||
|
||||
void amdgpu_ras_set_error_query_ready(struct amdgpu_device *adev, bool ready)
|
||||
{
|
||||
@@ -710,10 +717,10 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
|
||||
if (!amdgpu_ras_intr_triggered()) {
|
||||
ret = psp_ras_enable_features(&adev->psp, info, enable);
|
||||
if (ret) {
|
||||
dev_err(adev->dev, "ras %s %s failed %d\n",
|
||||
dev_err(adev->dev, "ras %s %s failed poison:%d ret:%d\n",
|
||||
enable ? "enable":"disable",
|
||||
get_ras_block_str(head),
|
||||
ret);
|
||||
amdgpu_ras_is_poison_mode_supported(adev), ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -995,6 +1002,9 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
if (!amdgpu_persistent_edc_harvesting_supported(adev))
|
||||
amdgpu_ras_reset_error_status(adev, info->head.block);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1544,22 +1554,28 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj)
|
||||
data->rptr = (data->aligned_element_size +
|
||||
data->rptr) % data->ring_size;
|
||||
|
||||
/* Let IP handle its data, maybe we need get the output
|
||||
* from the callback to udpate the error type/count, etc
|
||||
*/
|
||||
if (data->cb) {
|
||||
ret = data->cb(obj->adev, &err_data, &entry);
|
||||
/* ue will trigger an interrupt, and in that case
|
||||
* we need do a reset to recovery the whole system.
|
||||
* But leave IP do that recovery, here we just dispatch
|
||||
* the error.
|
||||
*/
|
||||
if (ret == AMDGPU_RAS_SUCCESS) {
|
||||
/* these counts could be left as 0 if
|
||||
* some blocks do not count error number
|
||||
if (amdgpu_ras_is_poison_mode_supported(obj->adev) &&
|
||||
obj->head.block == AMDGPU_RAS_BLOCK__UMC)
|
||||
dev_info(obj->adev->dev,
|
||||
"Poison is created, no user action is needed.\n");
|
||||
else {
|
||||
/* Let IP handle its data, maybe we need get the output
|
||||
* from the callback to udpate the error type/count, etc
|
||||
*/
|
||||
obj->err_data.ue_count += err_data.ue_count;
|
||||
obj->err_data.ce_count += err_data.ce_count;
|
||||
ret = data->cb(obj->adev, &err_data, &entry);
|
||||
/* ue will trigger an interrupt, and in that case
|
||||
* we need do a reset to recovery the whole system.
|
||||
* But leave IP do that recovery, here we just dispatch
|
||||
* the error.
|
||||
*/
|
||||
if (ret == AMDGPU_RAS_SUCCESS) {
|
||||
/* these counts could be left as 0 if
|
||||
* some blocks do not count error number
|
||||
*/
|
||||
obj->err_data.ue_count += err_data.ue_count;
|
||||
obj->err_data.ce_count += err_data.ce_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2089,6 +2105,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
|
||||
adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_MCE_AMD
|
||||
if ((adev->asic_type == CHIP_ALDEBARAN) &&
|
||||
(adev->gmc.xgmi.connected_to_cpu))
|
||||
amdgpu_register_bad_pages_mca_notifier();
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
free:
|
||||
@@ -2238,6 +2259,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
|
||||
int r;
|
||||
bool df_poison, umc_poison;
|
||||
|
||||
if (con)
|
||||
return 0;
|
||||
@@ -2308,6 +2330,23 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
|
||||
goto release_con;
|
||||
}
|
||||
|
||||
/* Init poison supported flag, the default value is false */
|
||||
if (adev->df.funcs &&
|
||||
adev->df.funcs->query_ras_poison_mode &&
|
||||
adev->umc.ras_funcs &&
|
||||
adev->umc.ras_funcs->query_ras_poison_mode) {
|
||||
df_poison =
|
||||
adev->df.funcs->query_ras_poison_mode(adev);
|
||||
umc_poison =
|
||||
adev->umc.ras_funcs->query_ras_poison_mode(adev);
|
||||
/* Only poison is set in both DF and UMC, we can support it */
|
||||
if (df_poison && umc_poison)
|
||||
con->poison_supported = true;
|
||||
else if (df_poison != umc_poison)
|
||||
dev_warn(adev->dev, "Poison setting is inconsistent in DF/UMC(%d:%d)!\n",
|
||||
df_poison, umc_poison);
|
||||
}
|
||||
|
||||
if (amdgpu_ras_fs_init(adev)) {
|
||||
r = -EINVAL;
|
||||
goto release_con;
|
||||
@@ -2351,6 +2390,16 @@ static int amdgpu_persistent_edc_harvesting(struct amdgpu_device *adev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool amdgpu_ras_is_poison_mode_supported(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
|
||||
|
||||
if (!con)
|
||||
return false;
|
||||
|
||||
return con->poison_supported;
|
||||
}
|
||||
|
||||
/* helper function to handle common stuff in ip late init phase */
|
||||
int amdgpu_ras_late_init(struct amdgpu_device *adev,
|
||||
struct ras_common_if *ras_block,
|
||||
@@ -2552,3 +2601,132 @@ void amdgpu_release_ras_context(struct amdgpu_device *adev)
|
||||
kfree(con);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_MCE_AMD
|
||||
static struct amdgpu_device *find_adev(uint32_t node_id)
|
||||
{
|
||||
struct amdgpu_gpu_instance *gpu_instance;
|
||||
int i;
|
||||
struct amdgpu_device *adev = NULL;
|
||||
|
||||
mutex_lock(&mgpu_info.mutex);
|
||||
|
||||
for (i = 0; i < mgpu_info.num_gpu; i++) {
|
||||
gpu_instance = &(mgpu_info.gpu_ins[i]);
|
||||
adev = gpu_instance->adev;
|
||||
|
||||
if (adev->gmc.xgmi.connected_to_cpu &&
|
||||
adev->gmc.xgmi.physical_node_id == node_id)
|
||||
break;
|
||||
adev = NULL;
|
||||
}
|
||||
|
||||
mutex_unlock(&mgpu_info.mutex);
|
||||
|
||||
return adev;
|
||||
}
|
||||
|
||||
#define GET_MCA_IPID_GPUID(m) (((m) >> 44) & 0xF)
|
||||
#define GET_UMC_INST(m) (((m) >> 21) & 0x7)
|
||||
#define GET_CHAN_INDEX(m) ((((m) >> 12) & 0x3) | (((m) >> 18) & 0x4))
|
||||
#define GPU_ID_OFFSET 8
|
||||
|
||||
static int amdgpu_bad_page_notifier(struct notifier_block *nb,
|
||||
unsigned long val, void *data)
|
||||
{
|
||||
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;
|
||||
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,
|
||||
* and error occurred in DramECC (Extended error code = 0) then only
|
||||
* process the error, else bail out.
|
||||
*/
|
||||
if (!m || !((smca_get_bank_type(m->bank) == SMCA_UMC_V2) &&
|
||||
(XEC(m->status, 0x3f) == 0x0)))
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/*
|
||||
* If it is correctable error, return.
|
||||
*/
|
||||
if (mce_is_correctable(m))
|
||||
return NOTIFY_OK;
|
||||
|
||||
/*
|
||||
* GPU Id is offset by GPU_ID_OFFSET in MCA_IPID_UMC register.
|
||||
*/
|
||||
gpu_id = GET_MCA_IPID_GPUID(m->ipid) - GPU_ID_OFFSET;
|
||||
|
||||
adev = find_adev(gpu_id);
|
||||
if (!adev) {
|
||||
DRM_WARN("%s: Unable to find adev for gpu_id: %d\n", __func__,
|
||||
gpu_id);
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* If it is uncorrectable error, then find out UMC instance and
|
||||
* channel index.
|
||||
*/
|
||||
umc_inst = GET_UMC_INST(m->ipid);
|
||||
ch_inst = GET_CHAN_INDEX(m->ipid);
|
||||
|
||||
dev_info(adev->dev, "Uncorrectable error detected in UMC inst: %d, chan_idx: %d",
|
||||
umc_inst, ch_inst);
|
||||
|
||||
memset(&err_rec, 0x0, sizeof(struct eeprom_table_record));
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
err_rec.address = m->addr;
|
||||
err_rec.retired_page = retired_page >> AMDGPU_GPU_PAGE_SHIFT;
|
||||
err_rec.ts = (uint64_t)ktime_get_real_seconds();
|
||||
err_rec.err_type = AMDGPU_RAS_EEPROM_ERR_NON_RECOVERABLE;
|
||||
err_rec.cu = 0;
|
||||
err_rec.mem_channel = channel_index;
|
||||
err_rec.mcumc_id = umc_inst;
|
||||
|
||||
err_data.err_addr = &err_rec;
|
||||
err_data.err_addr_cnt = 1;
|
||||
|
||||
if (amdgpu_bad_page_threshold != 0) {
|
||||
amdgpu_ras_add_bad_pages(adev, err_data.err_addr,
|
||||
err_data.err_addr_cnt);
|
||||
amdgpu_ras_save_bad_pages(adev);
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static struct notifier_block amdgpu_bad_page_nb = {
|
||||
.notifier_call = amdgpu_bad_page_notifier,
|
||||
.priority = MCE_PRIO_UC,
|
||||
};
|
||||
|
||||
static void amdgpu_register_bad_pages_mca_notifier(void)
|
||||
{
|
||||
/*
|
||||
* Register the x86 notifier only once
|
||||
* with MCE subsystem.
|
||||
*/
|
||||
if (notifier_registered == false) {
|
||||
mce_register_decode_chain(&amdgpu_bad_page_nb);
|
||||
notifier_registered = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -351,6 +351,9 @@ struct amdgpu_ras {
|
||||
/* disable ras error count harvest in recovery */
|
||||
bool disable_ras_err_cnt_harvest;
|
||||
|
||||
/* is poison mode supported */
|
||||
bool poison_supported;
|
||||
|
||||
/* RAS count errors delayed work */
|
||||
struct delayed_work ras_counte_delay_work;
|
||||
atomic_t ras_ue_count;
|
||||
@@ -646,4 +649,6 @@ int amdgpu_persistent_edc_harvesting_supported(struct amdgpu_device *adev);
|
||||
|
||||
const char *get_ras_block_str(struct ras_common_if *ras_block);
|
||||
|
||||
bool amdgpu_ras_is_poison_mode_supported(struct amdgpu_device *adev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2036,6 +2036,36 @@ error_free:
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_ttm_evict_resources - evict memory buffers
|
||||
* @adev: amdgpu device object
|
||||
* @mem_type: evicted BO's memory type
|
||||
*
|
||||
* Evicts all @mem_type buffers on the lru list of the memory type.
|
||||
*
|
||||
* Returns:
|
||||
* 0 for success or a negative error code on failure.
|
||||
*/
|
||||
int amdgpu_ttm_evict_resources(struct amdgpu_device *adev, int mem_type)
|
||||
{
|
||||
struct ttm_resource_manager *man;
|
||||
|
||||
switch (mem_type) {
|
||||
case TTM_PL_VRAM:
|
||||
case TTM_PL_TT:
|
||||
case AMDGPU_PL_GWS:
|
||||
case AMDGPU_PL_GDS:
|
||||
case AMDGPU_PL_OA:
|
||||
man = ttm_manager_type(&adev->mman.bdev, mem_type);
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Trying to evict invalid memory type\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return ttm_resource_manager_evict_all(&adev->mman.bdev, man);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
|
||||
static int amdgpu_mm_vram_table_show(struct seq_file *m, void *unused)
|
||||
|
||||
@@ -190,6 +190,7 @@ bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm);
|
||||
uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem);
|
||||
uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
|
||||
struct ttm_resource *mem);
|
||||
int amdgpu_ttm_evict_resources(struct amdgpu_device *adev, int mem_type);
|
||||
|
||||
void amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
|
||||
|
||||
|
||||
@@ -416,10 +416,11 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)
|
||||
else
|
||||
return AMDGPU_FW_LOAD_PSP;
|
||||
default:
|
||||
DRM_ERROR("Unknown firmware load type\n");
|
||||
if (!load_type)
|
||||
return AMDGPU_FW_LOAD_DIRECT;
|
||||
else
|
||||
return AMDGPU_FW_LOAD_PSP;
|
||||
}
|
||||
|
||||
return AMDGPU_FW_LOAD_DIRECT;
|
||||
}
|
||||
|
||||
const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)
|
||||
|
||||
@@ -48,6 +48,7 @@ struct amdgpu_umc_ras_funcs {
|
||||
void *ras_error_status);
|
||||
void (*query_ras_error_address)(struct amdgpu_device *adev,
|
||||
void *ras_error_status);
|
||||
bool (*query_ras_poison_mode)(struct amdgpu_device *adev);
|
||||
};
|
||||
|
||||
struct amdgpu_umc_funcs {
|
||||
|
||||
@@ -454,7 +454,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
|
||||
if (!adev->uvd.inst[j].saved_bo)
|
||||
return -ENOMEM;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
/* re-write 0 since err_event_athub will corrupt VCPU buffer */
|
||||
if (in_ras_intr)
|
||||
memset(adev->uvd.inst[j].saved_bo, 0, size);
|
||||
@@ -487,7 +487,7 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
|
||||
ptr = adev->uvd.inst[i].cpu_addr;
|
||||
|
||||
if (adev->uvd.inst[i].saved_bo != NULL) {
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_toio(ptr, adev->uvd.inst[i].saved_bo, size);
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
@@ -500,7 +500,7 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
|
||||
hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
|
||||
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
|
||||
offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_toio(adev->uvd.inst[i].cpu_addr, adev->uvd.fw->data + offset,
|
||||
le32_to_cpu(hdr->ucode_size_bytes));
|
||||
drm_dev_exit(idx);
|
||||
|
||||
@@ -313,7 +313,7 @@ int amdgpu_vce_resume(struct amdgpu_device *adev)
|
||||
hdr = (const struct common_firmware_header *)adev->vce.fw->data;
|
||||
offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_toio(cpu_addr, adev->vce.fw->data + offset,
|
||||
adev->vce.fw->size - offset);
|
||||
drm_dev_exit(idx);
|
||||
|
||||
@@ -86,8 +86,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++)
|
||||
atomic_set(&adev->vcn.inst[i].dpg_enc_submission_cnt, 0);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
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)
|
||||
@@ -95,13 +96,13 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
else
|
||||
fw_name = FIRMWARE_RAVEN;
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
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 CHIP_RENOIR:
|
||||
case IP_VERSION(2, 2, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
fw_name = FIRMWARE_RENOIR;
|
||||
else
|
||||
@@ -111,58 +112,52 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
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 CHIP_NAVI10:
|
||||
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 CHIP_NAVI14:
|
||||
fw_name = FIRMWARE_NAVI14;
|
||||
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;
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
fw_name = FIRMWARE_NAVI12;
|
||||
case IP_VERSION(3, 0, 0):
|
||||
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 CHIP_SIENNA_CICHLID:
|
||||
fw_name = FIRMWARE_SIENNA_CICHLID;
|
||||
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
|
||||
(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
|
||||
adev->vcn.indirect_sram = true;
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
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 CHIP_VANGOGH:
|
||||
case IP_VERSION(3, 0, 2):
|
||||
fw_name = FIRMWARE_VANGOGH;
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
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 CHIP_BEIGE_GOBY:
|
||||
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 CHIP_YELLOW_CARP:
|
||||
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))
|
||||
@@ -330,7 +325,7 @@ int amdgpu_vcn_suspend(struct amdgpu_device *adev)
|
||||
if (!adev->vcn.inst[i].saved_bo)
|
||||
return -ENOMEM;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_fromio(adev->vcn.inst[i].saved_bo, ptr, size);
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
@@ -354,7 +349,7 @@ int amdgpu_vcn_resume(struct amdgpu_device *adev)
|
||||
ptr = adev->vcn.inst[i].cpu_addr;
|
||||
|
||||
if (adev->vcn.inst[i].saved_bo != NULL) {
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_toio(ptr, adev->vcn.inst[i].saved_bo, size);
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
@@ -367,7 +362,7 @@ int amdgpu_vcn_resume(struct amdgpu_device *adev)
|
||||
hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
|
||||
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
|
||||
offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_toio(adev->vcn.inst[i].cpu_addr, adev->vcn.fw->data + offset,
|
||||
le32_to_cpu(hdr->ucode_size_bytes));
|
||||
drm_dev_exit(idx);
|
||||
|
||||
@@ -845,7 +845,7 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return -ENODEV;
|
||||
|
||||
r = vm->update_funcs->map_table(vmbo);
|
||||
@@ -1395,7 +1395,7 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev,
|
||||
if (list_empty(&vm->relocated))
|
||||
return 0;
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return -ENODEV;
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
@@ -1718,7 +1718,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
|
||||
enum amdgpu_sync_mode sync_mode;
|
||||
int r, idx;
|
||||
|
||||
if (!drm_dev_enter(&adev->ddev, &idx))
|
||||
if (!drm_dev_enter(adev_to_drm(adev), &idx))
|
||||
return -ENODEV;
|
||||
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
@@ -77,10 +77,9 @@ int athub_v2_0_set_clockgating(struct amdgpu_device *adev,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
switch (adev->ip_versions[ATHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
athub_v2_0_update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
athub_v2_0_update_medium_grain_light_sleep(adev,
|
||||
|
||||
@@ -70,11 +70,10 @@ int athub_v2_1_set_clockgating(struct amdgpu_device *adev,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[ATHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
athub_v2_1_update_medium_grain_clock_gating(adev, state == AMD_CG_STATE_GATE);
|
||||
athub_v2_1_update_medium_grain_light_sleep(adev, state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
|
||||
@@ -637,6 +637,36 @@ static void df_v3_6_pmc_get_count(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
static bool df_v3_6_query_ras_poison_mode(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t hw_assert_msklo, hw_assert_mskhi;
|
||||
uint32_t v0, v1, v28, v31;
|
||||
|
||||
hw_assert_msklo = RREG32_SOC15(DF, 0,
|
||||
mmDF_CS_UMC_AON0_HardwareAssertMaskLow);
|
||||
hw_assert_mskhi = RREG32_SOC15(DF, 0,
|
||||
mmDF_NCS_PG0_HardwareAssertMaskHigh);
|
||||
|
||||
v0 = REG_GET_FIELD(hw_assert_msklo,
|
||||
DF_CS_UMC_AON0_HardwareAssertMaskLow, HWAssertMsk0);
|
||||
v1 = REG_GET_FIELD(hw_assert_msklo,
|
||||
DF_CS_UMC_AON0_HardwareAssertMaskLow, HWAssertMsk1);
|
||||
v28 = REG_GET_FIELD(hw_assert_mskhi,
|
||||
DF_NCS_PG0_HardwareAssertMaskHigh, HWAssertMsk28);
|
||||
v31 = REG_GET_FIELD(hw_assert_mskhi,
|
||||
DF_NCS_PG0_HardwareAssertMaskHigh, HWAssertMsk31);
|
||||
|
||||
if (v0 && v1 && v28 && v31)
|
||||
return true;
|
||||
else if (!v0 && !v1 && !v28 && !v31)
|
||||
return false;
|
||||
else {
|
||||
dev_warn(adev->dev, "DF poison setting is inconsistent(%d:%d:%d:%d)!\n",
|
||||
v0, v1, v28, v31);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const struct amdgpu_df_funcs df_v3_6_funcs = {
|
||||
.sw_init = df_v3_6_sw_init,
|
||||
.sw_fini = df_v3_6_sw_fini,
|
||||
@@ -651,4 +681,5 @@ const struct amdgpu_df_funcs df_v3_6_funcs = {
|
||||
.pmc_get_count = df_v3_6_pmc_get_count,
|
||||
.get_fica = df_v3_6_get_fica,
|
||||
.set_fica = df_v3_6_set_fica,
|
||||
.query_ras_poison_mode = df_v3_6_query_ras_poison_mode,
|
||||
};
|
||||
|
||||
@@ -1537,7 +1537,7 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32
|
||||
scratch_reg3 = adev->rmmio +
|
||||
(adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3) * 4;
|
||||
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID) {
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0)) {
|
||||
spare_int = adev->rmmio +
|
||||
(adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX]
|
||||
+ mmRLC_SPARE_INT_0_Sienna_Cichlid) * 4;
|
||||
@@ -3727,18 +3727,18 @@ static void gfx_v10_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v10_0_init_spm_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_rlc_spm_10_0_nv10,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_0_nv10));
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(10, 1, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_rlc_spm_10_1_nv14,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_nv14));
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(10, 1, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_rlc_spm_10_1_2_nv12,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_rlc_spm_10_1_2_nv12));
|
||||
@@ -3750,8 +3750,8 @@ static void gfx_v10_0_init_spm_golden_registers(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_1,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_1));
|
||||
@@ -3759,7 +3759,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_10_0_nv10,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_0_nv10));
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(10, 1, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_1_1,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_1_1));
|
||||
@@ -3767,7 +3767,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_10_1_nv14,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_1_nv14));
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(10, 1, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_1_2,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_1_2));
|
||||
@@ -3775,7 +3775,7 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_10_1_2_nv12,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_1_2_nv12));
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3));
|
||||
@@ -3783,32 +3783,32 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_10_3_sienna_cichlid,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_sienna_cichlid));
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case IP_VERSION(10, 3, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_2,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_2));
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(10, 3, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_vangogh,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_vangogh));
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 3):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_3,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_3));
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(10, 3, 4):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_4,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_4));
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(10, 3, 5):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_5,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_5));
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(10, 1, 3):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_0,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_0));
|
||||
@@ -3985,11 +3985,11 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
{
|
||||
adev->gfx.cp_fw_write_wait = false;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
if ((adev->gfx.me_fw_version >= 0x00000046) &&
|
||||
(adev->gfx.me_feature_version >= 27) &&
|
||||
(adev->gfx.pfp_fw_version >= 0x00000068) &&
|
||||
@@ -3998,12 +3998,12 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
(adev->gfx.mec_feature_version >= 27))
|
||||
adev->gfx.cp_fw_write_wait = true;
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfx.cp_fw_write_wait = true;
|
||||
break;
|
||||
default:
|
||||
@@ -4066,8 +4066,8 @@ static bool gfx_v10_0_navi10_gfxoff_should_enable(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
if (!gfx_v10_0_navi10_gfxoff_should_enable(adev))
|
||||
adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
|
||||
break;
|
||||
@@ -4093,38 +4093,38 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(10, 1, 1):
|
||||
chip_name = "navi14";
|
||||
if (!(adev->pdev->device == 0x7340 &&
|
||||
adev->pdev->revision != 0x00))
|
||||
wks = "_wks";
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(10, 1, 2):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case IP_VERSION(10, 3, 2):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(10, 3, 1):
|
||||
chip_name = "vangogh";
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(10, 3, 4):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(10, 3, 5):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 3):
|
||||
chip_name = "yellow_carp";
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(10, 1, 3):
|
||||
if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2)
|
||||
chip_name = "cyan_skillfish2";
|
||||
else
|
||||
@@ -4684,10 +4684,10 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
|
||||
adev->gfx.funcs = &gfx_v10_0_gfx_funcs;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -4695,12 +4695,12 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0;
|
||||
gb_addr_config = RREG32_SOC15(GC, 0, mmGB_ADDR_CONFIG);
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -4710,7 +4710,7 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
adev->gfx.config.gb_addr_config_fields.num_pkrs =
|
||||
1 << REG_GET_FIELD(gb_addr_config, GB_ADDR_CONFIG, NUM_PKRS);
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(10, 1, 3):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -4818,11 +4818,11 @@ static int gfx_v10_0_sw_init(void *handle)
|
||||
struct amdgpu_kiq *kiq;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
adev->gfx.me.num_me = 1;
|
||||
adev->gfx.me.num_pipe_per_me = 1;
|
||||
adev->gfx.me.num_queue_per_pipe = 1;
|
||||
@@ -4830,12 +4830,12 @@ static int gfx_v10_0_sw_init(void *handle)
|
||||
adev->gfx.mec.num_pipe_per_mec = 4;
|
||||
adev->gfx.mec.num_queue_per_pipe = 8;
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfx.me.num_me = 1;
|
||||
adev->gfx.me.num_pipe_per_me = 1;
|
||||
adev->gfx.me.num_queue_per_pipe = 1;
|
||||
@@ -5068,8 +5068,8 @@ static void gfx_v10_0_setup_rb(struct amdgpu_device *adev)
|
||||
for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
|
||||
for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
|
||||
bitmap = i * adev->gfx.config.max_sh_per_se + j;
|
||||
if (((adev->asic_type == CHIP_SIENNA_CICHLID) ||
|
||||
(adev->asic_type == CHIP_YELLOW_CARP)) &&
|
||||
if (((adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) ||
|
||||
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3))) &&
|
||||
((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
|
||||
continue;
|
||||
gfx_v10_0_select_se_sh(adev, i, j, 0xffffffff);
|
||||
@@ -5096,7 +5096,7 @@ static u32 gfx_v10_0_init_pa_sc_tile_steering_override(struct amdgpu_device *ade
|
||||
|
||||
/* for ASICs that integrates GFX v10.3
|
||||
* pa_sc_tile_steering_override should be set to 0 */
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0))
|
||||
return 0;
|
||||
|
||||
/* init num_sc */
|
||||
@@ -5249,7 +5249,7 @@ static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev)
|
||||
/* TCCs are global (not instanced). */
|
||||
uint32_t tcc_disable;
|
||||
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID) {
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0)) {
|
||||
tcc_disable = RREG32_SOC15(GC, 0, mmCGTS_TCC_DISABLE_gc_10_3) |
|
||||
RREG32_SOC15(GC, 0, mmCGTS_USER_TCC_DISABLE_gc_10_3);
|
||||
} else {
|
||||
@@ -5326,7 +5326,7 @@ static int gfx_v10_0_init_csb(struct amdgpu_device *adev)
|
||||
adev->gfx.rlc.funcs->get_csb_buffer(adev, adev->gfx.rlc.cs_ptr);
|
||||
|
||||
/* csib */
|
||||
if (adev->asic_type == CHIP_NAVI12) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2)) {
|
||||
WREG32_SOC15_RLC(GC, 0, mmRLC_CSIB_ADDR_HI,
|
||||
adev->gfx.rlc.clear_state_gpu_addr >> 32);
|
||||
WREG32_SOC15_RLC(GC, 0, mmRLC_CSIB_ADDR_LO,
|
||||
@@ -5948,7 +5948,7 @@ static int gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
|
||||
tmp = REG_SET_FIELD(tmp, CP_ME_CNTL, PFP_HALT, enable ? 0 : 1);
|
||||
tmp = REG_SET_FIELD(tmp, CP_ME_CNTL, CE_HALT, enable ? 0 : 1);
|
||||
|
||||
if (adev->asic_type == CHIP_NAVI12) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2)) {
|
||||
WREG32_SOC15_RLC(GC, 0, mmCP_ME_CNTL, tmp);
|
||||
} else {
|
||||
WREG32_SOC15(GC, 0, mmCP_ME_CNTL, tmp);
|
||||
@@ -6337,13 +6337,13 @@ static void gfx_v10_0_cp_gfx_set_doorbell(struct amdgpu_device *adev,
|
||||
}
|
||||
WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
|
||||
}
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
tmp = REG_SET_FIELD(0, CP_RB_DOORBELL_RANGE_LOWER,
|
||||
DOORBELL_RANGE_LOWER_Sienna_Cichlid, ring->doorbell_index);
|
||||
WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
|
||||
@@ -6474,13 +6474,13 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)
|
||||
static void gfx_v10_0_cp_compute_enable(struct amdgpu_device *adev, bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_CNTL_Sienna_Cichlid, 0);
|
||||
break;
|
||||
default:
|
||||
@@ -6488,13 +6488,13 @@ static void gfx_v10_0_cp_compute_enable(struct amdgpu_device *adev, bool enable)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
WREG32_SOC15(GC, 0, mmCP_MEC_CNTL_Sienna_Cichlid,
|
||||
(CP_MEC_CNTL__MEC_ME1_HALT_MASK |
|
||||
CP_MEC_CNTL__MEC_ME2_HALT_MASK));
|
||||
@@ -6586,13 +6586,13 @@ static void gfx_v10_0_kiq_setting(struct amdgpu_ring *ring)
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
|
||||
/* tell RLC which is KIQ queue */
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);
|
||||
tmp &= 0xffffff00;
|
||||
tmp |= (ring->me << 5) | (ring->pipe << 3) | (ring->queue);
|
||||
@@ -7303,11 +7303,11 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
|
||||
/* check if mmVGT_ESGS_RING_SIZE_UMD
|
||||
* has been remapped to mmVGT_ESGS_RING_SIZE */
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
data = RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid);
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid, 0);
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, pattern);
|
||||
@@ -7320,8 +7320,8 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
return true;
|
||||
default:
|
||||
data = RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE);
|
||||
@@ -7350,13 +7350,13 @@ static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
* index will auto-inc after each data writting */
|
||||
WREG32_SOC15(GC, 0, mmGRBM_CAM_INDEX, 0);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
/* mmVGT_TF_RING_SIZE_UMD -> mmVGT_TF_RING_SIZE */
|
||||
data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE_UMD) <<
|
||||
GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
|
||||
@@ -7520,19 +7520,19 @@ static int gfx_v10_0_hw_init(void *handle)
|
||||
* init golden registers and rlc resume may override some registers,
|
||||
* reconfig them here
|
||||
*/
|
||||
if (adev->asic_type == CHIP_NAVI10 ||
|
||||
adev->asic_type == CHIP_NAVI14 ||
|
||||
adev->asic_type == CHIP_NAVI12)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 10) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2))
|
||||
gfx_v10_0_tcp_harvest(adev);
|
||||
|
||||
r = gfx_v10_0_cp_resume(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->asic_type == CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
|
||||
gfx_v10_3_program_pbb_mode(adev);
|
||||
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0))
|
||||
gfx_v10_3_set_power_brake_sequence(adev);
|
||||
|
||||
return r;
|
||||
@@ -7584,7 +7584,7 @@ static int gfx_v10_0_hw_fini(void *handle)
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
gfx_v10_0_cp_gfx_enable(adev, false);
|
||||
/* Program KIQ position of RLC_CP_SCHEDULERS during destroy */
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID) {
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0)) {
|
||||
tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);
|
||||
tmp &= 0xffffff00;
|
||||
WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp);
|
||||
@@ -7670,13 +7670,13 @@ static int gfx_v10_0_soft_reset(void *handle)
|
||||
|
||||
/* GRBM_STATUS2 */
|
||||
tmp = RREG32_SOC15(GC, 0, mmGRBM_STATUS2);
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
if (REG_GET_FIELD(tmp, GRBM_STATUS2, RLC_BUSY_Sienna_Cichlid))
|
||||
grbm_soft_reset = REG_SET_FIELD(grbm_soft_reset,
|
||||
GRBM_SOFT_RESET,
|
||||
@@ -7726,9 +7726,9 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)
|
||||
{
|
||||
uint64_t clock, clock_lo, clock_hi, hi_check;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
clock = (uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER_Vangogh) |
|
||||
((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER_Vangogh) << 32ULL);
|
||||
break;
|
||||
@@ -7784,19 +7784,19 @@ static int gfx_v10_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_Sienna_Cichlid;
|
||||
break;
|
||||
default:
|
||||
@@ -7848,13 +7848,13 @@ static void gfx_v10_0_set_safe_mode(struct amdgpu_device *adev)
|
||||
data = RLC_SAFE_MODE__CMD_MASK;
|
||||
data |= (1 << RLC_SAFE_MODE__MESSAGE__SHIFT);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
WREG32_SOC15(GC, 0, mmRLC_SAFE_MODE_Sienna_Cichlid, data);
|
||||
|
||||
/* wait for RLC_SAFE_MODE */
|
||||
@@ -7884,13 +7884,13 @@ static void gfx_v10_0_unset_safe_mode(struct amdgpu_device *adev)
|
||||
uint32_t data;
|
||||
|
||||
data = RLC_SAFE_MODE__CMD_MASK;
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
WREG32_SOC15(GC, 0, mmRLC_SAFE_MODE_Sienna_Cichlid, data);
|
||||
break;
|
||||
default:
|
||||
@@ -8193,7 +8193,7 @@ static void gfx_v10_0_apply_medium_grain_clock_gating_workaround(struct amdgpu_d
|
||||
mmCGTS_SA1_QUAD1_SM_CTRL_REG
|
||||
};
|
||||
|
||||
if (adev->asic_type == CHIP_NAVI12) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2)) {
|
||||
for (i = 0; i < ARRAY_SIZE(tcp_ctrl_regs_nv12); i++) {
|
||||
reg_idx = adev->reg_offset[GC_HWIP][0][mmCGTS_SA0_WGP00_CU0_TCP_CTRL_REG_BASE_IDX] +
|
||||
tcp_ctrl_regs_nv12[i];
|
||||
@@ -8238,8 +8238,8 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev,
|
||||
/* === CGCG + CGLS === */
|
||||
gfx_v10_0_update_coarse_grain_clock_gating(adev, enable);
|
||||
|
||||
if ((adev->asic_type >= CHIP_NAVI10) &&
|
||||
(adev->asic_type <= CHIP_NAVI12))
|
||||
if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 1, 10)) &&
|
||||
(adev->ip_versions[GC_HWIP][0] <= IP_VERSION(10, 1, 2)))
|
||||
gfx_v10_0_apply_medium_grain_clock_gating_workaround(adev);
|
||||
} else {
|
||||
/* CGCG/CGLS should be disabled before MGCG/MGLS
|
||||
@@ -8335,12 +8335,12 @@ static void gfx_v10_cntl_power_gating(struct amdgpu_device *adev, bool enable)
|
||||
* Power/performance team will optimize it and might give a new value later.
|
||||
*/
|
||||
if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VANGOGH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 1):
|
||||
data = 0x4E20 & RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh;
|
||||
WREG32_SOC15(GC, 0, mmRLC_PG_DELAY_3, data);
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 3):
|
||||
data = 0x1388 & RLC_PG_DELAY_3__CGCG_ACTIVE_BEFORE_CGPG_MASK_Vangogh;
|
||||
WREG32_SOC15(GC, 0, mmRLC_PG_DELAY_3, data);
|
||||
break;
|
||||
@@ -8399,18 +8399,18 @@ static int gfx_v10_0_set_powergating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
amdgpu_gfx_off_ctrl(adev, enable);
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
gfx_v10_cntl_pg(adev, enable);
|
||||
amdgpu_gfx_off_ctrl(adev, enable);
|
||||
break;
|
||||
@@ -8428,16 +8428,16 @@ static int gfx_v10_0_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
gfx_v10_0_update_gfx_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
@@ -9541,19 +9541,19 @@ static void gfx_v10_0_set_irq_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfx.rlc.funcs = &gfx_v10_0_rlc_funcs;
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
adev->gfx.rlc.funcs = &gfx_v10_0_rlc_funcs_sriov;
|
||||
break;
|
||||
default:
|
||||
@@ -9641,8 +9641,8 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
|
||||
for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
|
||||
for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
|
||||
bitmap = i * adev->gfx.config.max_sh_per_se + j;
|
||||
if (((adev->asic_type == CHIP_SIENNA_CICHLID) ||
|
||||
(adev->asic_type == CHIP_YELLOW_CARP)) &&
|
||||
if (((adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0)) ||
|
||||
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3))) &&
|
||||
((gfx_v10_3_get_disabled_sa(adev) >> bitmap) & 1))
|
||||
continue;
|
||||
mask = 1;
|
||||
|
||||
@@ -953,8 +953,8 @@ static void gfx_v9_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_9_0,
|
||||
ARRAY_SIZE(golden_settings_gc_9_0));
|
||||
@@ -962,7 +962,7 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_9_0_vg10,
|
||||
ARRAY_SIZE(golden_settings_gc_9_0_vg10));
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_9_2_1,
|
||||
ARRAY_SIZE(golden_settings_gc_9_2_1));
|
||||
@@ -970,7 +970,7 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_9_2_1_vg12,
|
||||
ARRAY_SIZE(golden_settings_gc_9_2_1_vg12));
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_9_0,
|
||||
ARRAY_SIZE(golden_settings_gc_9_0));
|
||||
@@ -978,12 +978,13 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_9_0_vg20,
|
||||
ARRAY_SIZE(golden_settings_gc_9_0_vg20));
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_9_4_1_arct,
|
||||
ARRAY_SIZE(golden_settings_gc_9_4_1_arct));
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
soc15_program_register_sequence(adev, golden_settings_gc_9_1,
|
||||
ARRAY_SIZE(golden_settings_gc_9_1));
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
@@ -995,12 +996,12 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_gc_9_1_rv1,
|
||||
ARRAY_SIZE(golden_settings_gc_9_1_rv1));
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_9_1_rn,
|
||||
ARRAY_SIZE(golden_settings_gc_9_1_rn));
|
||||
return; /* for renoir, don't need common goldensetting */
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
gfx_v9_4_2_init_golden_registers(adev,
|
||||
adev->smuio.funcs->get_die_id(adev));
|
||||
break;
|
||||
@@ -1008,8 +1009,8 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((adev->asic_type != CHIP_ARCTURUS) &&
|
||||
(adev->asic_type != CHIP_ALDEBARAN))
|
||||
if ((adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 1)) &&
|
||||
(adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 2)))
|
||||
soc15_program_register_sequence(adev, golden_settings_gc_9_x_common,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_9_x_common));
|
||||
}
|
||||
@@ -1193,15 +1194,15 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
adev->gfx.me_fw_write_wait = false;
|
||||
adev->gfx.mec_fw_write_wait = false;
|
||||
|
||||
if ((adev->asic_type != CHIP_ARCTURUS) &&
|
||||
if ((adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 1)) &&
|
||||
((adev->gfx.mec_fw_version < 0x000001a5) ||
|
||||
(adev->gfx.mec_feature_version < 46) ||
|
||||
(adev->gfx.pfp_fw_version < 0x000000b7) ||
|
||||
(adev->gfx.pfp_feature_version < 46)))
|
||||
DRM_WARN_ONCE("CP firmware version too old, please update!");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
if ((adev->gfx.me_fw_version >= 0x0000009c) &&
|
||||
(adev->gfx.me_feature_version >= 42) &&
|
||||
(adev->gfx.pfp_fw_version >= 0x000000b1) &&
|
||||
@@ -1212,7 +1213,7 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
(adev->gfx.mec_feature_version >= 42))
|
||||
adev->gfx.mec_fw_write_wait = true;
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
if ((adev->gfx.me_fw_version >= 0x0000009c) &&
|
||||
(adev->gfx.me_feature_version >= 44) &&
|
||||
(adev->gfx.pfp_fw_version >= 0x000000b2) &&
|
||||
@@ -1223,7 +1224,7 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
(adev->gfx.mec_feature_version >= 44))
|
||||
adev->gfx.mec_fw_write_wait = true;
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
if ((adev->gfx.me_fw_version >= 0x0000009c) &&
|
||||
(adev->gfx.me_feature_version >= 44) &&
|
||||
(adev->gfx.pfp_fw_version >= 0x000000b2) &&
|
||||
@@ -1234,7 +1235,8 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
|
||||
(adev->gfx.mec_feature_version >= 44))
|
||||
adev->gfx.mec_fw_write_wait = true;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
if ((adev->gfx.me_fw_version >= 0x0000009c) &&
|
||||
(adev->gfx.me_feature_version >= 42) &&
|
||||
(adev->gfx.pfp_fw_version >= 0x000000b1) &&
|
||||
@@ -1297,7 +1299,7 @@ static bool is_raven_kicker(struct amdgpu_device *adev)
|
||||
|
||||
static bool check_if_enlarge_doorbell_range(struct amdgpu_device *adev)
|
||||
{
|
||||
if ((adev->asic_type == CHIP_RENOIR) &&
|
||||
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 3, 0)) &&
|
||||
(adev->gfx.me_fw_version >= 0x000000a5) &&
|
||||
(adev->gfx.me_feature_version >= 52))
|
||||
return true;
|
||||
@@ -1310,12 +1312,13 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
|
||||
if (gfx_v9_0_should_disable_gfxoff(adev->pdev))
|
||||
adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
if (!((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
|
||||
(adev->apu_flags & AMD_APU_IS_PICASSO)) &&
|
||||
((!is_raven_kicker(adev) &&
|
||||
@@ -1329,7 +1332,7 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
|
||||
AMD_PG_SUPPORT_CP |
|
||||
AMD_PG_SUPPORT_RLC_SMU_HS;
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (adev->pm.pp_feature & PP_GFXOFF_MASK)
|
||||
adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
|
||||
AMD_PG_SUPPORT_CP |
|
||||
@@ -1553,9 +1556,9 @@ out:
|
||||
|
||||
static bool gfx_v9_0_load_mec2_fw_bin_support(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->asic_type == CHIP_ALDEBARAN ||
|
||||
adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_RENOIR)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 3, 0))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1663,17 +1666,18 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
chip_name = "vega10";
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
chip_name = "vega12";
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
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)
|
||||
@@ -1681,16 +1685,16 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
|
||||
else
|
||||
chip_name = "raven";
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
chip_name = "renoir";
|
||||
else
|
||||
chip_name = "green_sardine";
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
default:
|
||||
@@ -1794,7 +1798,7 @@ static void gfx_v9_0_init_always_on_cu_mask(struct amdgpu_device *adev)
|
||||
|
||||
if (adev->flags & AMD_IS_APU)
|
||||
always_on_cu_num = 4;
|
||||
else if (adev->asic_type == CHIP_VEGA12)
|
||||
else if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 2, 1))
|
||||
always_on_cu_num = 8;
|
||||
else
|
||||
always_on_cu_num = 12;
|
||||
@@ -1963,11 +1967,12 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
|
||||
return r;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
gfx_v9_0_init_lbpw(adev);
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
gfx_v9_4_init_lbpw(adev);
|
||||
break;
|
||||
default:
|
||||
@@ -2142,8 +2147,8 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
|
||||
adev->gfx.funcs = &gfx_v9_0_gfx_funcs;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -2151,7 +2156,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0;
|
||||
gb_addr_config = VEGA10_GB_ADDR_CONFIG_GOLDEN;
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -2160,7 +2165,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
gb_addr_config = VEGA12_GB_ADDR_CONFIG_GOLDEN;
|
||||
DRM_INFO("fix gfx.config for vega12\n");
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
adev->gfx.ras_funcs = &gfx_v9_0_ras_funcs;
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
@@ -2175,7 +2180,8 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -2186,7 +2192,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
else
|
||||
gb_addr_config = RAVEN_GB_ADDR_CONFIG_GOLDEN;
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->gfx.ras_funcs = &gfx_v9_4_ras_funcs;
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
@@ -2197,7 +2203,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
gb_addr_config &= ~0xf3e777ff;
|
||||
gb_addr_config |= 0x22014042;
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
adev->gfx.config.sc_prim_fifo_size_backend = 0x100;
|
||||
@@ -2207,7 +2213,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)
|
||||
gb_addr_config &= ~0xf3e777ff;
|
||||
gb_addr_config |= 0x22010042;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->gfx.ras_funcs = &gfx_v9_4_2_ras_funcs;
|
||||
adev->gfx.config.max_hw_contexts = 8;
|
||||
adev->gfx.config.sc_prim_fifo_size_frontend = 0x20;
|
||||
@@ -2305,14 +2311,15 @@ static int gfx_v9_0_sw_init(void *handle)
|
||||
struct amdgpu_kiq *kiq;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->gfx.mec.num_mec = 2;
|
||||
break;
|
||||
default:
|
||||
@@ -2596,8 +2603,8 @@ static void gfx_v9_0_init_sq_config(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ARCTURUS:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 4, 1):
|
||||
tmp = RREG32_SOC15(GC, 0, mmSQ_CONFIG);
|
||||
tmp = REG_SET_FIELD(tmp, SQ_CONFIG,
|
||||
DISABLE_BARRIER_WAITCNT, 1);
|
||||
@@ -2932,7 +2939,7 @@ static void gfx_v9_0_init_gfx_power_gating(struct amdgpu_device *adev)
|
||||
/* program GRBM_REG_SAVE_GFX_IDLE_THRESHOLD to 0x55f0 */
|
||||
data |= (0x55f0 << RLC_AUTO_PG_CTRL__GRBM_REG_SAVE_GFX_IDLE_THRESHOLD__SHIFT);
|
||||
WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_AUTO_PG_CTRL), data);
|
||||
if (adev->asic_type != CHIP_RENOIR)
|
||||
if (adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 3, 0))
|
||||
pwr_10_0_gfxip_control_over_cgpg(adev, true);
|
||||
}
|
||||
}
|
||||
@@ -3044,7 +3051,7 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
|
||||
* And it's needed by gfxoff feature.
|
||||
*/
|
||||
if (adev->gfx.rlc.is_rlc_v2_1) {
|
||||
if (adev->asic_type == CHIP_VEGA12 ||
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 2, 1) ||
|
||||
(adev->apu_flags & AMD_APU_IS_RAVEN2))
|
||||
gfx_v9_1_init_rlc_save_restore_list(adev);
|
||||
gfx_v9_0_enable_save_restore_machine(adev);
|
||||
@@ -3157,14 +3164,15 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
|
||||
return r;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
if (amdgpu_lbpw == 0)
|
||||
gfx_v9_0_enable_lbpw(adev, false);
|
||||
else
|
||||
gfx_v9_0_enable_lbpw(adev, true);
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
if (amdgpu_lbpw > 0)
|
||||
gfx_v9_0_enable_lbpw(adev, true);
|
||||
else
|
||||
@@ -3599,7 +3607,7 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring)
|
||||
|
||||
/* set static priority for a queue/ring */
|
||||
gfx_v9_0_mqd_set_priority(ring, mqd);
|
||||
mqd->cp_hqd_quantum = RREG32(mmCP_HQD_QUANTUM);
|
||||
mqd->cp_hqd_quantum = RREG32_SOC15(GC, 0, mmCP_HQD_QUANTUM);
|
||||
|
||||
/* map_queues packet doesn't need activate the queue,
|
||||
* so only kiq need set this field.
|
||||
@@ -3959,8 +3967,8 @@ static void gfx_v9_0_init_tcp_config(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
if (adev->asic_type != CHIP_ARCTURUS &&
|
||||
adev->asic_type != CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 1) &&
|
||||
adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 2))
|
||||
return;
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmTCP_ADDR_CONFIG);
|
||||
@@ -4000,7 +4008,7 @@ static int gfx_v9_0_hw_init(void *handle)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
gfx_v9_4_2_set_power_brake_sequence(adev);
|
||||
|
||||
return r;
|
||||
@@ -4232,7 +4240,7 @@ static uint64_t gfx_v9_0_get_gpu_clock_counter(struct amdgpu_device *adev)
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
mutex_lock(&adev->gfx.gpu_clock_mutex);
|
||||
if (adev->asic_type == CHIP_VEGA10 && amdgpu_sriov_runtime(adev)) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 0, 1) && amdgpu_sriov_runtime(adev)) {
|
||||
clock = gfx_v9_0_kiq_read_clock(adev);
|
||||
} else {
|
||||
WREG32_SOC15(GC, 0, mmRLC_CAPTURE_GPU_CLOCK_COUNT, 1);
|
||||
@@ -4582,7 +4590,7 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
|
||||
if (!ring->sched.ready)
|
||||
return 0;
|
||||
|
||||
if (adev->asic_type == CHIP_ARCTURUS) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1)) {
|
||||
vgpr_init_shader_ptr = vgpr_init_compute_shader_arcturus;
|
||||
vgpr_init_shader_size = sizeof(vgpr_init_compute_shader_arcturus);
|
||||
vgpr_init_regs_ptr = vgpr_init_regs_arcturus;
|
||||
@@ -4732,8 +4740,8 @@ static int gfx_v9_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
if (adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
adev->gfx.num_gfx_rings = 0;
|
||||
else
|
||||
adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS;
|
||||
@@ -4767,7 +4775,7 @@ static int gfx_v9_0_ecc_late_init(void *handle)
|
||||
}
|
||||
|
||||
/* requires IBs so do in late init after IB pool is initialized */
|
||||
if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
r = gfx_v9_4_2_do_edc_gpr_workarounds(adev);
|
||||
else
|
||||
r = gfx_v9_0_do_edc_gpr_workarounds(adev);
|
||||
@@ -4895,7 +4903,7 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev
|
||||
/* 1 - RLC_CGTT_MGCG_OVERRIDE */
|
||||
def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
|
||||
|
||||
if (adev->asic_type != CHIP_VEGA12)
|
||||
if (adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 2, 1))
|
||||
data &= ~RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;
|
||||
|
||||
data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
|
||||
@@ -4929,7 +4937,7 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev
|
||||
/* 1 - MGCG_OVERRIDE */
|
||||
def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
|
||||
|
||||
if (adev->asic_type != CHIP_VEGA12)
|
||||
if (adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 2, 1))
|
||||
data |= RLC_CGTT_MGCG_OVERRIDE__CPF_CGTT_SCLK_OVERRIDE_MASK;
|
||||
|
||||
data |= (RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK |
|
||||
@@ -5035,7 +5043,7 @@ static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev
|
||||
/* enable cgcg FSM(0x0000363F) */
|
||||
def = RREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL);
|
||||
|
||||
if (adev->asic_type == CHIP_ARCTURUS)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1))
|
||||
data = (0x2000 << RLC_CGCG_CGLS_CTRL__CGCG_GFX_IDLE_THRESHOLD__SHIFT) |
|
||||
RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK;
|
||||
else
|
||||
@@ -5161,9 +5169,10 @@ static int gfx_v9_0_set_powergating_state(void *handle,
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
bool enable = (state == AMD_PG_STATE_GATE);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (!enable)
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
@@ -5189,7 +5198,7 @@ static int gfx_v9_0_set_powergating_state(void *handle,
|
||||
if (enable)
|
||||
amdgpu_gfx_off_ctrl(adev, true);
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
amdgpu_gfx_off_ctrl(adev, enable);
|
||||
break;
|
||||
default:
|
||||
@@ -5207,14 +5216,15 @@ static int gfx_v9_0_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
gfx_v9_0_update_gfx_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
@@ -5256,7 +5266,7 @@ static void gfx_v9_0_get_clockgating_state(void *handle, u32 *flags)
|
||||
if (data & CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK)
|
||||
*flags |= AMD_CG_SUPPORT_GFX_CP_LS | AMD_CG_SUPPORT_GFX_MGLS;
|
||||
|
||||
if (adev->asic_type != CHIP_ARCTURUS) {
|
||||
if (adev->ip_versions[GC_HWIP][0] != IP_VERSION(9, 4, 1)) {
|
||||
/* AMD_CG_SUPPORT_GFX_3D_CGCG */
|
||||
data = RREG32_KIQ(SOC15_REG_OFFSET(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D));
|
||||
if (data & RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK)
|
||||
@@ -7027,14 +7037,15 @@ static void gfx_v9_0_set_irq_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->gfx.rlc.funcs = &gfx_v9_0_rlc_funcs;
|
||||
break;
|
||||
default:
|
||||
@@ -7045,17 +7056,18 @@ static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev)
|
||||
static void gfx_v9_0_set_gds_init(struct amdgpu_device *adev)
|
||||
{
|
||||
/* init asci gds info */
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
adev->gds.gds_size = 0x10000;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->gds.gds_size = 0x1000;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
/* aldebaran removed all the GDS internal memory,
|
||||
* only support GWS opcode in kernel, like barrier
|
||||
* semaphore.etc */
|
||||
@@ -7066,24 +7078,25 @@ static void gfx_v9_0_set_gds_init(struct amdgpu_device *adev)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
adev->gds.gds_compute_max_wave_id = 0x7ff;
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
adev->gds.gds_compute_max_wave_id = 0x27f;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
adev->gds.gds_compute_max_wave_id = 0x77; /* raven2 */
|
||||
else
|
||||
adev->gds.gds_compute_max_wave_id = 0x15f; /* raven1 */
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->gds.gds_compute_max_wave_id = 0xfff;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
/* deprecated for Aldebaran, no usage at all */
|
||||
adev->gds.gds_compute_max_wave_id = 0;
|
||||
break;
|
||||
|
||||
@@ -506,8 +506,8 @@ static int gfxhub_v2_1_get_xgmi_info(struct amdgpu_device *adev)
|
||||
u32 max_num_physical_nodes = 0;
|
||||
u32 max_physical_node_id = 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
switch (adev->ip_versions[XGMI_HWIP][0]) {
|
||||
case IP_VERSION(4, 8, 0):
|
||||
max_num_physical_nodes = 4;
|
||||
max_physical_node_id = 3;
|
||||
break;
|
||||
@@ -544,7 +544,7 @@ static void gfxhub_v2_1_utcl2_harvest(struct amdgpu_device *adev)
|
||||
adev->gfx.config.max_sh_per_se *
|
||||
adev->gfx.config.max_shader_engines);
|
||||
|
||||
if (adev->asic_type == CHIP_YELLOW_CARP) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 3)) {
|
||||
/* Get SA disabled bitmap from eFuse setting */
|
||||
efuse_setting = RREG32_SOC15(GC, 0, mmCC_GC_SA_UNIT_DISABLE);
|
||||
efuse_setting &= CC_GC_SA_UNIT_DISABLE__SA_DISABLE_MASK;
|
||||
|
||||
@@ -133,7 +133,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev,
|
||||
* the new fast GRBM interface.
|
||||
*/
|
||||
if ((entry->vmid_src == AMDGPU_GFXHUB_0) &&
|
||||
(adev->asic_type < CHIP_SIENNA_CICHLID))
|
||||
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 3, 0)))
|
||||
RREG32(hub->vm_l2_pro_fault_status);
|
||||
|
||||
status = RREG32(hub->vm_l2_pro_fault_status);
|
||||
@@ -268,7 +268,7 @@ static void gmc_v10_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,
|
||||
* to avoid a false ACK due to the new fast GRBM interface.
|
||||
*/
|
||||
if ((vmhub == AMDGPU_GFXHUB_0) &&
|
||||
(adev->asic_type < CHIP_SIENNA_CICHLID))
|
||||
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 3, 0)))
|
||||
RREG32_RLC_NO_KIQ(hub->vm_inv_eng0_req +
|
||||
hub->eng_distance * eng, hub_ip);
|
||||
|
||||
@@ -657,8 +657,8 @@ static void gmc_v10_0_set_gmc_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v10_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
switch (adev->ip_versions[UMC_HWIP][0]) {
|
||||
case IP_VERSION(8, 7, 0):
|
||||
adev->umc.max_ras_err_cnt_per_query = UMC_V8_7_TOTAL_CHANNEL_NUM;
|
||||
adev->umc.channel_inst_num = UMC_V8_7_CHANNEL_INSTANCE_NUM;
|
||||
adev->umc.umc_inst_num = UMC_V8_7_UMC_INSTANCE_NUM;
|
||||
@@ -674,9 +674,9 @@ static void gmc_v10_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v10_0_set_mmhub_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 3, 0):
|
||||
case IP_VERSION(2, 4, 0):
|
||||
adev->mmhub.funcs = &mmhub_v2_3_funcs;
|
||||
break;
|
||||
default:
|
||||
@@ -687,13 +687,13 @@ static void gmc_v10_0_set_mmhub_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v10_0_set_gfxhub_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->gfxhub.funcs = &gfxhub_v2_1_funcs;
|
||||
break;
|
||||
default:
|
||||
@@ -800,23 +800,9 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
|
||||
adev->gmc.visible_vram_size = adev->gmc.real_vram_size;
|
||||
|
||||
/* set the gart size */
|
||||
if (amdgpu_gart_size == -1) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
default:
|
||||
adev->gmc.gart_size = 512ULL << 20;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if (amdgpu_gart_size == -1)
|
||||
adev->gmc.gart_size = 512ULL << 20;
|
||||
else
|
||||
adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
|
||||
|
||||
gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
|
||||
@@ -871,17 +857,17 @@ static int gmc_v10_0_sw_init(void *handle)
|
||||
adev->gmc.vram_vendor = vram_vendor;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
case IP_VERSION(10, 1, 1):
|
||||
case IP_VERSION(10, 1, 2):
|
||||
case IP_VERSION(10, 1, 3):
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 4):
|
||||
case IP_VERSION(10, 3, 5):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->num_vmhubs = 2;
|
||||
/*
|
||||
* To fulfill 4-level page support,
|
||||
@@ -989,21 +975,6 @@ static int gmc_v10_0_sw_fini(void *handle)
|
||||
|
||||
static void gmc_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1098,6 +1069,8 @@ static int gmc_v10_0_hw_fini(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
gmc_v10_0_gart_disable(adev);
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
/* full access mode, so don't touch any GMC register */
|
||||
DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
|
||||
@@ -1106,7 +1079,6 @@ static int gmc_v10_0_hw_fini(void *handle)
|
||||
|
||||
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
|
||||
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
|
||||
gmc_v10_0_gart_disable(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1161,8 +1133,7 @@ static int gmc_v10_0_set_clockgating_state(void *handle,
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID &&
|
||||
adev->asic_type <= CHIP_YELLOW_CARP)
|
||||
if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))
|
||||
return athub_v2_1_set_clockgating(adev, state);
|
||||
else
|
||||
return athub_v2_0_set_clockgating(adev, state);
|
||||
@@ -1174,8 +1145,7 @@ static void gmc_v10_0_get_clockgating_state(void *handle, u32 *flags)
|
||||
|
||||
adev->mmhub.funcs->get_clockgating(adev, flags);
|
||||
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID &&
|
||||
adev->asic_type <= CHIP_YELLOW_CARP)
|
||||
if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))
|
||||
athub_v2_1_get_clockgating(adev, flags);
|
||||
else
|
||||
athub_v2_0_get_clockgating(adev, flags);
|
||||
|
||||
@@ -579,7 +579,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
|
||||
* the new fast GRBM interface.
|
||||
*/
|
||||
if ((entry->vmid_src == AMDGPU_GFXHUB_0) &&
|
||||
(adev->asic_type < CHIP_ALDEBARAN))
|
||||
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
|
||||
RREG32(hub->vm_l2_pro_fault_status);
|
||||
|
||||
status = RREG32(hub->vm_l2_pro_fault_status);
|
||||
@@ -597,26 +597,28 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
|
||||
gfxhub_client_ids[cid],
|
||||
cid);
|
||||
} else {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
mmhub_cid = mmhub_client_ids_vega10[cid][rw];
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
mmhub_cid = mmhub_client_ids_vega12[cid][rw];
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
mmhub_cid = mmhub_client_ids_vega20[cid][rw];
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
mmhub_cid = mmhub_client_ids_arcturus[cid][rw];
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 0):
|
||||
mmhub_cid = mmhub_client_ids_raven[cid][rw];
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(1, 5, 0):
|
||||
case IP_VERSION(2, 4, 0):
|
||||
mmhub_cid = mmhub_client_ids_renoir[cid][rw];
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
mmhub_cid = mmhub_client_ids_aldebaran[cid][rw];
|
||||
break;
|
||||
default:
|
||||
@@ -694,7 +696,7 @@ static uint32_t gmc_v9_0_get_invalidate_req(unsigned int vmid,
|
||||
static bool gmc_v9_0_use_invalidate_semaphore(struct amdgpu_device *adev,
|
||||
uint32_t vmhub)
|
||||
{
|
||||
if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
return false;
|
||||
|
||||
return ((vmhub == AMDGPU_MMHUB_0 ||
|
||||
@@ -745,7 +747,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
|
||||
hub = &adev->vmhub[vmhub];
|
||||
if (adev->gmc.xgmi.num_physical_nodes &&
|
||||
adev->asic_type == CHIP_VEGA20) {
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 0)) {
|
||||
/* Vega20+XGMI caches PTEs in TC and TLB. Add a
|
||||
* heavy-weight TLB flush (type 2), which flushes
|
||||
* both. Due to a race condition with concurrent
|
||||
@@ -808,7 +810,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
* GRBM interface.
|
||||
*/
|
||||
if ((vmhub == AMDGPU_GFXHUB_0) &&
|
||||
(adev->asic_type < CHIP_ALDEBARAN))
|
||||
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
|
||||
RREG32_NO_KIQ(hub->vm_inv_eng0_req +
|
||||
hub->eng_distance * eng);
|
||||
|
||||
@@ -874,7 +876,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
|
||||
* still need a second TLB flush after this.
|
||||
*/
|
||||
bool vega20_xgmi_wa = (adev->gmc.xgmi.num_physical_nodes &&
|
||||
adev->asic_type == CHIP_VEGA20);
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 0));
|
||||
/* 2 dwords flush + 8 dwords fence */
|
||||
unsigned int ndw = kiq->pmf->invalidate_tlbs_size + 8;
|
||||
|
||||
@@ -1088,13 +1090,13 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev,
|
||||
*flags &= ~AMDGPU_PTE_VALID;
|
||||
}
|
||||
|
||||
if ((adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_ALDEBARAN) &&
|
||||
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) &&
|
||||
!(*flags & AMDGPU_PTE_SYSTEM) &&
|
||||
mapping->bo_va->is_xgmi)
|
||||
*flags |= AMDGPU_PTE_SNOOPED;
|
||||
|
||||
if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
*flags |= mapping->flags & AMDGPU_PTE_SNOOPED;
|
||||
}
|
||||
|
||||
@@ -1108,9 +1110,10 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
} else {
|
||||
u32 viewport;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
viewport = RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION);
|
||||
size = (REG_GET_FIELD(viewport,
|
||||
HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) *
|
||||
@@ -1118,9 +1121,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) *
|
||||
4);
|
||||
break;
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
default:
|
||||
viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
|
||||
size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
|
||||
@@ -1151,11 +1151,11 @@ static void gmc_v9_0_set_gmc_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[UMC_HWIP][0]) {
|
||||
case IP_VERSION(6, 0, 0):
|
||||
adev->umc.funcs = &umc_v6_0_funcs;
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(6, 1, 1):
|
||||
adev->umc.max_ras_err_cnt_per_query = UMC_V6_1_TOTAL_CHANNEL_NUM;
|
||||
adev->umc.channel_inst_num = UMC_V6_1_CHANNEL_INSTANCE_NUM;
|
||||
adev->umc.umc_inst_num = UMC_V6_1_UMC_INSTANCE_NUM;
|
||||
@@ -1163,7 +1163,7 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
adev->umc.channel_idx_tbl = &umc_v6_1_channel_idx_tbl[0][0];
|
||||
adev->umc.ras_funcs = &umc_v6_1_ras_funcs;
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(6, 1, 2):
|
||||
adev->umc.max_ras_err_cnt_per_query = UMC_V6_1_TOTAL_CHANNEL_NUM;
|
||||
adev->umc.channel_inst_num = UMC_V6_1_CHANNEL_INSTANCE_NUM;
|
||||
adev->umc.umc_inst_num = UMC_V6_1_UMC_INSTANCE_NUM;
|
||||
@@ -1171,7 +1171,7 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
adev->umc.channel_idx_tbl = &umc_v6_1_channel_idx_tbl[0][0];
|
||||
adev->umc.ras_funcs = &umc_v6_1_ras_funcs;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(6, 7, 0):
|
||||
adev->umc.max_ras_err_cnt_per_query = UMC_V6_7_TOTAL_CHANNEL_NUM;
|
||||
adev->umc.channel_inst_num = UMC_V6_7_CHANNEL_INSTANCE_NUM;
|
||||
adev->umc.umc_inst_num = UMC_V6_7_UMC_INSTANCE_NUM;
|
||||
@@ -1190,11 +1190,11 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ARCTURUS:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->mmhub.funcs = &mmhub_v9_4_funcs;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->mmhub.funcs = &mmhub_v1_7_funcs;
|
||||
break;
|
||||
default:
|
||||
@@ -1205,14 +1205,14 @@ static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v9_0_set_mmhub_ras_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(9, 4, 0):
|
||||
adev->mmhub.ras_funcs = &mmhub_v1_0_ras_funcs;
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->mmhub.ras_funcs = &mmhub_v9_4_ras_funcs;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->mmhub.ras_funcs = &mmhub_v1_7_ras_funcs;
|
||||
break;
|
||||
default:
|
||||
@@ -1233,8 +1233,9 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ALDEBARAN:
|
||||
/* is UMC the right IP to check for MCA? Maybe DF? */
|
||||
switch (adev->ip_versions[UMC_HWIP][0]) {
|
||||
case IP_VERSION(6, 7, 0):
|
||||
if (!adev->gmc.xgmi.connected_to_cpu)
|
||||
adev->mca.funcs = &mca_v3_0_funcs;
|
||||
break;
|
||||
@@ -1247,11 +1248,12 @@ static int gmc_v9_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
/* ARCT and VEGA20 don't have XGMI defined in their IP discovery tables */
|
||||
if (adev->asic_type == CHIP_VEGA20 ||
|
||||
adev->asic_type == CHIP_ARCTURUS)
|
||||
adev->gmc.xgmi.supported = true;
|
||||
|
||||
if (adev->asic_type == CHIP_ALDEBARAN) {
|
||||
if (adev->ip_versions[XGMI_HWIP][0] == IP_VERSION(6, 1, 0)) {
|
||||
adev->gmc.xgmi.supported = true;
|
||||
adev->gmc.xgmi.connected_to_cpu =
|
||||
adev->smuio.funcs->is_host_gpu_xgmi_supported(adev);
|
||||
@@ -1289,7 +1291,8 @@ static int gmc_v9_0_late_init(void *handle)
|
||||
* Workaround performance drop issue with VBIOS enables partial
|
||||
* writes, while disables HBM ECC for vega10.
|
||||
*/
|
||||
if (!amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_VEGA10)) {
|
||||
if (!amdgpu_sriov_vf(adev) &&
|
||||
(adev->ip_versions[UMC_HWIP][0] == IP_VERSION(6, 0, 0))) {
|
||||
if (!(adev->ras_enabled & (1 << AMDGPU_RAS_BLOCK__UMC))) {
|
||||
if (adev->df.funcs->enable_ecc_force_par_wr_rmw)
|
||||
adev->df.funcs->enable_ecc_force_par_wr_rmw(adev, false);
|
||||
@@ -1393,17 +1396,18 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
|
||||
|
||||
/* set the gart size */
|
||||
if (amdgpu_gart_size == -1) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10: /* all engines support GPUVM */
|
||||
case CHIP_VEGA12: /* all engines support GPUVM */
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1): /* all engines support GPUVM */
|
||||
case IP_VERSION(9, 2, 1): /* all engines support GPUVM */
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
default:
|
||||
adev->gmc.gart_size = 512ULL << 20;
|
||||
break;
|
||||
case CHIP_RAVEN: /* DCE SG support */
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 1, 0): /* DCE SG support */
|
||||
case IP_VERSION(9, 2, 2): /* DCE SG support */
|
||||
case IP_VERSION(9, 3, 0):
|
||||
adev->gmc.gart_size = 1024ULL << 20;
|
||||
break;
|
||||
}
|
||||
@@ -1464,7 +1468,8 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
|
||||
*/
|
||||
static void gmc_v9_0_save_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->asic_type == CHIP_RAVEN)
|
||||
if ((adev->ip_versions[DCE_HWIP][0] == IP_VERSION(1, 0, 0)) ||
|
||||
(adev->ip_versions[DCE_HWIP][0] == IP_VERSION(1, 0, 1)))
|
||||
adev->gmc.sdpif_register = RREG32_SOC15(DCE, 0, mmDCHUBBUB_SDPIF_MMIO_CNTRL_0);
|
||||
}
|
||||
|
||||
@@ -1507,8 +1512,9 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
|
||||
adev->gmc.vram_type = vram_type;
|
||||
adev->gmc.vram_vendor = vram_vendor;
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
adev->num_vmhubs = 2;
|
||||
|
||||
if (adev->rev_id == 0x0 || adev->rev_id == 0x1) {
|
||||
@@ -1520,11 +1526,11 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
adev->vm_manager.num_level > 1;
|
||||
}
|
||||
break;
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 0, 1):
|
||||
case IP_VERSION(9, 2, 1):
|
||||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->num_vmhubs = 2;
|
||||
|
||||
|
||||
@@ -1539,7 +1545,7 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
else
|
||||
amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 48);
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->num_vmhubs = 3;
|
||||
|
||||
/* Keep the vm size same with Vega20 */
|
||||
@@ -1555,7 +1561,7 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->asic_type == CHIP_ARCTURUS) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1)) {
|
||||
r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_VMC1, VMC_1_0__SRCID__VM_FAULT,
|
||||
&adev->gmc.vm_fault);
|
||||
if (r)
|
||||
@@ -1622,8 +1628,8 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
* for video processing.
|
||||
*/
|
||||
adev->vm_manager.first_kfd_vmid =
|
||||
(adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_ALDEBARAN) ? 3 : 8;
|
||||
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) ? 3 : 8;
|
||||
|
||||
amdgpu_vm_manager_init(adev);
|
||||
|
||||
@@ -1649,12 +1655,12 @@ static int gmc_v9_0_sw_fini(void *handle)
|
||||
static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
break;
|
||||
fallthrough;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_mmhub_1_0_0,
|
||||
ARRAY_SIZE(golden_settings_mmhub_1_0_0));
|
||||
@@ -1662,9 +1668,8 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_athub_1_0_0,
|
||||
ARRAY_SIZE(golden_settings_athub_1_0_0));
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 0):
|
||||
/* TODO for renoir */
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_athub_1_0_0,
|
||||
@@ -1684,7 +1689,8 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
*/
|
||||
void gmc_v9_0_restore_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->asic_type == CHIP_RAVEN) {
|
||||
if ((adev->ip_versions[DCE_HWIP][0] == IP_VERSION(1, 0, 0)) ||
|
||||
(adev->ip_versions[DCE_HWIP][0] == IP_VERSION(1, 0, 1))) {
|
||||
WREG32_SOC15(DCE, 0, mmDCHUBBUB_SDPIF_MMIO_CNTRL_0, adev->gmc.sdpif_register);
|
||||
WARN_ON(adev->gmc.sdpif_register !=
|
||||
RREG32_SOC15(DCE, 0, mmDCHUBBUB_SDPIF_MMIO_CNTRL_0));
|
||||
@@ -1794,6 +1800,8 @@ static int gmc_v9_0_hw_fini(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
gmc_v9_0_gart_disable(adev);
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
/* full access mode, so don't touch any GMC register */
|
||||
DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
|
||||
@@ -1802,7 +1810,6 @@ static int gmc_v9_0_hw_fini(void *handle)
|
||||
|
||||
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
|
||||
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
|
||||
gmc_v9_0_gart_disable(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev,
|
||||
static void hdp_v4_0_invalidate_hdp(struct amdgpu_device *adev,
|
||||
struct amdgpu_ring *ring)
|
||||
{
|
||||
if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 4, 0))
|
||||
return;
|
||||
|
||||
if (!ring || !ring->funcs->emit_wreg)
|
||||
@@ -79,7 +79,7 @@ static void hdp_v4_0_reset_ras_error_count(struct amdgpu_device *adev)
|
||||
if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP))
|
||||
return;
|
||||
|
||||
if (adev->asic_type >= CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[HDP_HWIP][0] >= IP_VERSION(4, 4, 0))
|
||||
WREG32_SOC15(HDP, 0, mmHDP_EDC_CNT, 0);
|
||||
else
|
||||
/*read back hdp ras counter to reset it to 0 */
|
||||
@@ -91,9 +91,10 @@ static void hdp_v4_0_update_clock_gating(struct amdgpu_device *adev,
|
||||
{
|
||||
uint32_t def, data;
|
||||
|
||||
if (adev->asic_type == CHIP_VEGA10 ||
|
||||
adev->asic_type == CHIP_VEGA12 ||
|
||||
adev->asic_type == CHIP_RAVEN) {
|
||||
if (adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 0, 0) ||
|
||||
adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 0, 1) ||
|
||||
adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 1, 1) ||
|
||||
adev->ip_versions[HDP_HWIP][0] == IP_VERSION(4, 1, 0)) {
|
||||
def = data = RREG32(SOC15_REG_OFFSET(HDP, 0, mmHDP_MEM_POWER_LS));
|
||||
|
||||
if (enable && (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS))
|
||||
@@ -135,8 +136,8 @@ static void hdp_v4_0_get_clockgating_state(struct amdgpu_device *adev,
|
||||
|
||||
static void hdp_v4_0_init_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ARCTURUS:
|
||||
switch (adev->ip_versions[HDP_HWIP][0]) {
|
||||
case IP_VERSION(4, 2, 1):
|
||||
WREG32_FIELD15(HDP, 0, HDP_MMHUB_CNTL, HDP_MMHUB_GCC, 1);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -32,26 +32,6 @@
|
||||
#include "vcn/vcn_2_0_0_sh_mask.h"
|
||||
#include "ivsrcid/vcn/irqsrcs_vcn_2_0.h"
|
||||
|
||||
#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET 0x1bfff
|
||||
#define mmUVD_JPEG_GPCOM_CMD_INTERNAL_OFFSET 0x4029
|
||||
#define mmUVD_JPEG_GPCOM_DATA0_INTERNAL_OFFSET 0x402a
|
||||
#define mmUVD_JPEG_GPCOM_DATA1_INTERNAL_OFFSET 0x402b
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ea
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40eb
|
||||
#define mmUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET 0x40cf
|
||||
#define mmUVD_LMI_JPEG_VMID_INTERNAL_OFFSET 0x40d1
|
||||
#define mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40e8
|
||||
#define mmUVD_LMI_JRBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40e9
|
||||
#define mmUVD_JRBC_IB_SIZE_INTERNAL_OFFSET 0x4082
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ec
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40ed
|
||||
#define mmUVD_JRBC_RB_COND_RD_TIMER_INTERNAL_OFFSET 0x4085
|
||||
#define mmUVD_JRBC_RB_REF_DATA_INTERNAL_OFFSET 0x4084
|
||||
#define mmUVD_JRBC_STATUS_INTERNAL_OFFSET 0x4089
|
||||
#define mmUVD_JPEG_PITCH_INTERNAL_OFFSET 0x401f
|
||||
|
||||
#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR 0x18000
|
||||
|
||||
static void jpeg_v2_0_set_dec_ring_funcs(struct amdgpu_device *adev);
|
||||
static void jpeg_v2_0_set_irq_funcs(struct amdgpu_device *adev);
|
||||
static int jpeg_v2_0_set_powergating_state(void *handle,
|
||||
|
||||
@@ -24,6 +24,26 @@
|
||||
#ifndef __JPEG_V2_0_H__
|
||||
#define __JPEG_V2_0_H__
|
||||
|
||||
#define mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET 0x1bfff
|
||||
#define mmUVD_JPEG_GPCOM_CMD_INTERNAL_OFFSET 0x4029
|
||||
#define mmUVD_JPEG_GPCOM_DATA0_INTERNAL_OFFSET 0x402a
|
||||
#define mmUVD_JPEG_GPCOM_DATA1_INTERNAL_OFFSET 0x402b
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ea
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_WR_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40eb
|
||||
#define mmUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET 0x40cf
|
||||
#define mmUVD_LMI_JPEG_VMID_INTERNAL_OFFSET 0x40d1
|
||||
#define mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40e8
|
||||
#define mmUVD_LMI_JRBC_IB_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40e9
|
||||
#define mmUVD_JRBC_IB_SIZE_INTERNAL_OFFSET 0x4082
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_LOW_INTERNAL_OFFSET 0x40ec
|
||||
#define mmUVD_LMI_JRBC_RB_MEM_RD_64BIT_BAR_HIGH_INTERNAL_OFFSET 0x40ed
|
||||
#define mmUVD_JRBC_RB_COND_RD_TIMER_INTERNAL_OFFSET 0x4085
|
||||
#define mmUVD_JRBC_RB_REF_DATA_INTERNAL_OFFSET 0x4084
|
||||
#define mmUVD_JRBC_STATUS_INTERNAL_OFFSET 0x4089
|
||||
#define mmUVD_JPEG_PITCH_INTERNAL_OFFSET 0x401f
|
||||
|
||||
#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR 0x18000
|
||||
|
||||
void jpeg_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring);
|
||||
void jpeg_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring);
|
||||
void jpeg_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
|
||||
|
||||
@@ -423,6 +423,42 @@ static void jpeg_v2_5_dec_ring_set_wptr(struct amdgpu_ring *ring)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* jpeg_v2_6_dec_ring_insert_start - insert a start command
|
||||
*
|
||||
* @ring: amdgpu_ring pointer
|
||||
*
|
||||
* Write a start command to the ring.
|
||||
*/
|
||||
static void jpeg_v2_6_dec_ring_insert_start(struct amdgpu_ring *ring)
|
||||
{
|
||||
amdgpu_ring_write(ring, PACKETJ(mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET,
|
||||
0, 0, PACKETJ_TYPE0));
|
||||
amdgpu_ring_write(ring, 0x6aa04); /* PCTL0_MMHUB_DEEPSLEEP_IB */
|
||||
|
||||
amdgpu_ring_write(ring, PACKETJ(JRBC_DEC_EXTERNAL_REG_WRITE_ADDR,
|
||||
0, 0, PACKETJ_TYPE0));
|
||||
amdgpu_ring_write(ring, 0x80000000 | (1 << (ring->me * 2 + 14)));
|
||||
}
|
||||
|
||||
/**
|
||||
* jpeg_v2_6_dec_ring_insert_end - insert a end command
|
||||
*
|
||||
* @ring: amdgpu_ring pointer
|
||||
*
|
||||
* Write a end command to the ring.
|
||||
*/
|
||||
static void jpeg_v2_6_dec_ring_insert_end(struct amdgpu_ring *ring)
|
||||
{
|
||||
amdgpu_ring_write(ring, PACKETJ(mmUVD_JRBC_EXTERNAL_REG_INTERNAL_OFFSET,
|
||||
0, 0, PACKETJ_TYPE0));
|
||||
amdgpu_ring_write(ring, 0x6aa04); /* PCTL0_MMHUB_DEEPSLEEP_IB */
|
||||
|
||||
amdgpu_ring_write(ring, PACKETJ(JRBC_DEC_EXTERNAL_REG_WRITE_ADDR,
|
||||
0, 0, PACKETJ_TYPE0));
|
||||
amdgpu_ring_write(ring, (1 << (ring->me * 2 + 14)));
|
||||
}
|
||||
|
||||
static bool jpeg_v2_5_is_idle(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
@@ -633,8 +669,8 @@ static const struct amdgpu_ring_funcs jpeg_v2_6_dec_ring_vm_funcs = {
|
||||
.test_ring = amdgpu_jpeg_dec_ring_test_ring,
|
||||
.test_ib = amdgpu_jpeg_dec_ring_test_ib,
|
||||
.insert_nop = jpeg_v2_0_dec_ring_nop,
|
||||
.insert_start = jpeg_v2_0_dec_ring_insert_start,
|
||||
.insert_end = jpeg_v2_0_dec_ring_insert_end,
|
||||
.insert_start = jpeg_v2_6_dec_ring_insert_start,
|
||||
.insert_end = jpeg_v2_6_dec_ring_insert_end,
|
||||
.pad_ib = amdgpu_ring_generic_pad_ib,
|
||||
.begin_use = amdgpu_jpeg_ring_begin_use,
|
||||
.end_use = amdgpu_jpeg_ring_end_use,
|
||||
|
||||
@@ -153,18 +153,16 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,
|
||||
dev_err(adev->dev,
|
||||
"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n",
|
||||
status);
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_NAVI14:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
mmhub_cid = mmhub_client_ids_navi1x[cid][rw];
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
mmhub_cid = mmhub_client_ids_sienna_cichlid[cid][rw];
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(2, 1, 2):
|
||||
mmhub_cid = mmhub_client_ids_beige_goby[cid][rw];
|
||||
break;
|
||||
default:
|
||||
@@ -571,11 +569,10 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *ad
|
||||
if (!(adev->cg_flags & AMD_CG_SUPPORT_MC_MGCG))
|
||||
return;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
def = data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid);
|
||||
def1 = data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid);
|
||||
break;
|
||||
@@ -606,11 +603,10 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *ad
|
||||
DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK);
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
if (def != data)
|
||||
WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid, data);
|
||||
if (def1 != data1)
|
||||
@@ -633,11 +629,10 @@ static void mmhub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *ade
|
||||
if (!(adev->cg_flags & AMD_CG_SUPPORT_MC_LS))
|
||||
return;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
def = data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid);
|
||||
break;
|
||||
default:
|
||||
@@ -651,11 +646,10 @@ static void mmhub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *ade
|
||||
data &= ~MM_ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK;
|
||||
|
||||
if (def != data) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid, data);
|
||||
break;
|
||||
default:
|
||||
@@ -671,14 +665,12 @@ static int mmhub_v2_0_set_clockgating(struct amdgpu_device *adev,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
mmhub_v2_0_update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
mmhub_v2_0_update_medium_grain_light_sleep(adev,
|
||||
@@ -698,11 +690,10 @@ static void mmhub_v2_0_get_clockgating(struct amdgpu_device *adev, u32 *flags)
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
*flags = 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(2, 1, 1):
|
||||
case IP_VERSION(2, 1, 2):
|
||||
data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid);
|
||||
data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid);
|
||||
break;
|
||||
|
||||
@@ -90,9 +90,9 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev,
|
||||
dev_err(adev->dev,
|
||||
"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n",
|
||||
status);
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[MMHUB_HWIP][0]) {
|
||||
case IP_VERSION(2, 3, 0):
|
||||
case IP_VERSION(2, 4, 0):
|
||||
mmhub_cid = mmhub_client_ids_vangogh[cid][rw];
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -107,7 +107,7 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
|
||||
{
|
||||
u32 ih_cntl, ih_rb_cntl;
|
||||
|
||||
if (adev->asic_type < CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[OSSSYS_HWIP][0] < IP_VERSION(5, 0, 3))
|
||||
return;
|
||||
|
||||
ih_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_CNTL2);
|
||||
@@ -332,13 +332,10 @@ static int navi10_ih_irq_init(struct amdgpu_device *adev)
|
||||
|
||||
if (unlikely(adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT)) {
|
||||
if (ih[0]->use_bus_addr) {
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[OSSSYS_HWIP][0]) {
|
||||
case IP_VERSION(5, 0, 3):
|
||||
case IP_VERSION(5, 2, 0):
|
||||
case IP_VERSION(5, 2, 1):
|
||||
ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_Sienna_Cichlid);
|
||||
ih_chicken = REG_SET_FIELD(ih_chicken,
|
||||
IH_CHICKEN, MC_SPACE_GPA_ENABLE, 1);
|
||||
|
||||
@@ -180,8 +180,8 @@ static const struct amdgpu_video_codecs yc_video_codecs_decode = {
|
||||
static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
|
||||
const struct amdgpu_video_codecs **codecs)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(3, 0, 0):
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
if (encode)
|
||||
*codecs = &sriov_sc_video_codecs_encode;
|
||||
@@ -194,29 +194,27 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,
|
||||
*codecs = &sc_video_codecs_decode;
|
||||
}
|
||||
return 0;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(3, 0, 16):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
if (encode)
|
||||
*codecs = &nv_video_codecs_encode;
|
||||
else
|
||||
*codecs = &sc_video_codecs_decode;
|
||||
return 0;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(3, 1, 1):
|
||||
if (encode)
|
||||
*codecs = &nv_video_codecs_encode;
|
||||
else
|
||||
*codecs = &yc_video_codecs_decode;
|
||||
return 0;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(3, 0, 33):
|
||||
if (encode)
|
||||
*codecs = &bg_video_codecs_encode;
|
||||
else
|
||||
*codecs = &bg_video_codecs_decode;
|
||||
return 0;
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
if (encode)
|
||||
*codecs = &nv_video_codecs_encode;
|
||||
else
|
||||
@@ -511,14 +509,15 @@ nv_asic_reset_method(struct amdgpu_device *adev)
|
||||
dev_warn(adev->dev, "Specified reset method:%d isn't supported, using AUTO instead.\n",
|
||||
amdgpu_reset_method);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(11, 5, 0):
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
return AMD_RESET_METHOD_MODE2;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
case IP_VERSION(11, 0, 13):
|
||||
return AMD_RESET_METHOD_MODE1;
|
||||
default:
|
||||
if (amdgpu_dpm_is_baco_supported(adev))
|
||||
@@ -599,7 +598,7 @@ static void nv_enable_doorbell_aperture(struct amdgpu_device *adev,
|
||||
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);
|
||||
}
|
||||
|
||||
static const struct amdgpu_ip_block_version nv_common_ip_block =
|
||||
const struct amdgpu_ip_block_version nv_common_ip_block =
|
||||
{
|
||||
.type = AMD_IP_BLOCK_TYPE_COMMON,
|
||||
.major = 1,
|
||||
@@ -608,16 +607,6 @@ static const struct amdgpu_ip_block_version nv_common_ip_block =
|
||||
.funcs = &nv_common_ip_funcs,
|
||||
};
|
||||
|
||||
static bool nv_is_headless_sku(struct pci_dev *pdev)
|
||||
{
|
||||
if ((pdev->device == 0x731E &&
|
||||
(pdev->revision == 0xC6 || pdev->revision == 0xC7)) ||
|
||||
(pdev->device == 0x7340 && pdev->revision == 0xC9) ||
|
||||
(pdev->device == 0x7360 && pdev->revision == 0xC7))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int nv_reg_base_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
@@ -631,10 +620,6 @@ static int nv_reg_base_init(struct amdgpu_device *adev)
|
||||
}
|
||||
|
||||
amdgpu_discovery_harvest_ip(adev);
|
||||
if (nv_is_headless_sku(adev->pdev)) {
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
|
||||
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -906,6 +891,10 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
|
||||
}
|
||||
if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
|
||||
amdgpu_device_ip_block_add(adev, &amdgpu_vkms_ip_block);
|
||||
#if defined(CONFIG_DRM_AMD_DC)
|
||||
else if (amdgpu_device_has_dc_support(adev))
|
||||
amdgpu_device_ip_block_add(adev, &dm_ip_block);
|
||||
#endif
|
||||
amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
|
||||
amdgpu_device_ip_block_add(adev, &sdma_v5_0_ip_block);
|
||||
break;
|
||||
@@ -1056,8 +1045,11 @@ static int nv_common_early_init(void *handle)
|
||||
|
||||
adev->rev_id = nv_get_rev_id(adev);
|
||||
adev->external_rev_id = 0xff;
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
/* TODO: split the GC and PG flags based on the relevant IP version for which
|
||||
* they are relevant.
|
||||
*/
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 1, 10):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_IH_CG |
|
||||
@@ -1079,7 +1071,7 @@ static int nv_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_ATHUB;
|
||||
adev->external_rev_id = adev->rev_id + 0x1;
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(10, 1, 1):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_IH_CG |
|
||||
@@ -1100,7 +1092,7 @@ static int nv_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_VCN_DPG;
|
||||
adev->external_rev_id = adev->rev_id + 20;
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(10, 1, 2):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
@@ -1129,7 +1121,7 @@ static int nv_common_early_init(void *handle)
|
||||
adev->rev_id = 0;
|
||||
adev->external_rev_id = adev->rev_id + 0xa;
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case IP_VERSION(10, 3, 0):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGLS |
|
||||
@@ -1153,7 +1145,7 @@ static int nv_common_early_init(void *handle)
|
||||
}
|
||||
adev->external_rev_id = adev->rev_id + 0x28;
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case IP_VERSION(10, 3, 2):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGLS |
|
||||
@@ -1172,8 +1164,7 @@ static int nv_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_MMHUB;
|
||||
adev->external_rev_id = adev->rev_id + 0x32;
|
||||
break;
|
||||
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(10, 3, 1):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
AMD_CG_SUPPORT_GFX_CP_LS |
|
||||
@@ -1196,7 +1187,7 @@ static int nv_common_early_init(void *handle)
|
||||
if (adev->apu_flags & AMD_APU_IS_VANGOGH)
|
||||
adev->external_rev_id = adev->rev_id + 0x01;
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(10, 3, 4):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGLS |
|
||||
@@ -1215,7 +1206,7 @@ static int nv_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_MMHUB;
|
||||
adev->external_rev_id = adev->rev_id + 0x3c;
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(10, 3, 5):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
AMD_CG_SUPPORT_GFX_CGLS |
|
||||
@@ -1232,7 +1223,7 @@ static int nv_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_MMHUB;
|
||||
adev->external_rev_id = adev->rev_id + 0x46;
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(10, 3, 3):
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
AMD_CG_SUPPORT_GFX_CGCG |
|
||||
@@ -1261,7 +1252,7 @@ static int nv_common_early_init(void *handle)
|
||||
else
|
||||
adev->external_rev_id = adev->rev_id + 0x01;
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(10, 1, 3):
|
||||
adev->cg_flags = 0;
|
||||
adev->pg_flags = 0;
|
||||
adev->external_rev_id = adev->rev_id + 0x82;
|
||||
@@ -1388,14 +1379,14 @@ static int nv_common_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
switch (adev->ip_versions[NBIO_HWIP][0]) {
|
||||
case IP_VERSION(2, 3, 0):
|
||||
case IP_VERSION(2, 3, 1):
|
||||
case IP_VERSION(2, 3, 2):
|
||||
case IP_VERSION(3, 3, 0):
|
||||
case IP_VERSION(3, 3, 1):
|
||||
case IP_VERSION(3, 3, 2):
|
||||
case IP_VERSION(3, 3, 3):
|
||||
adev->nbio.funcs->update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
adev->nbio.funcs->update_medium_grain_light_sleep(adev,
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "nbio_v2_3.h"
|
||||
|
||||
extern const struct amdgpu_ip_block_version nv_common_ip_block;
|
||||
|
||||
void nv_grbm_select(struct amdgpu_device *adev,
|
||||
u32 me, u32 pipe, u32 queue, u32 vmid);
|
||||
void nv_set_virt_ops(struct amdgpu_device *adev);
|
||||
|
||||
@@ -93,35 +93,35 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(11, 0, 2):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case CHIP_NAVI10:
|
||||
case IP_VERSION(11, 0, 0):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(11, 0, 5):
|
||||
chip_name = "navi14";
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(11, 0, 9):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(11, 0, 4):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case IP_VERSION(11, 0, 7):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case IP_VERSION(11, 0, 11):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(11, 5, 0):
|
||||
chip_name = "vangogh";
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(11, 0, 12):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(11, 0, 13):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
default:
|
||||
@@ -129,9 +129,9 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
}
|
||||
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_ARCTURUS:
|
||||
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);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -168,9 +168,9 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
le32_to_cpu(ta_hdr->ras.offset_bytes);
|
||||
}
|
||||
break;
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
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);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -213,9 +213,10 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
le32_to_cpu(ta_hdr->dtm.offset_bytes);
|
||||
}
|
||||
break;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
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;
|
||||
@@ -223,15 +224,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
err = psp_init_ta_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(11, 5, 0):
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -705,7 +698,7 @@ static int psp_v11_0_memory_training(struct psp_context *psp, uint32_t ops)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
memcpy_fromio(buf, adev->mman.aper_base_kaddr, sz);
|
||||
ret = psp_v11_0_memory_training_send_msg(psp, PSP_BL__DRAM_LONG_TRAIN);
|
||||
if (ret) {
|
||||
|
||||
@@ -47,18 +47,19 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)
|
||||
const char *chip_name;
|
||||
int err = 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
chip_name = "yellow_carp";
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_ALDEBARAN:
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
err = psp_init_sos_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -66,7 +67,8 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)
|
||||
if (err)
|
||||
return err;
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(13, 0, 1):
|
||||
case IP_VERSION(13, 0, 3):
|
||||
err = psp_init_asd_microcode(psp, chip_name);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -469,8 +469,8 @@ static int sdma_v4_0_irq_id_to_seq(unsigned client_id)
|
||||
|
||||
static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_4,
|
||||
ARRAY_SIZE(golden_settings_sdma_4));
|
||||
@@ -478,7 +478,7 @@ static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_vg10,
|
||||
ARRAY_SIZE(golden_settings_sdma_vg10));
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(4, 0, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_4,
|
||||
ARRAY_SIZE(golden_settings_sdma_4));
|
||||
@@ -486,7 +486,7 @@ static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_vg12,
|
||||
ARRAY_SIZE(golden_settings_sdma_vg12));
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(4, 2, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma0_4_2_init,
|
||||
ARRAY_SIZE(golden_settings_sdma0_4_2_init));
|
||||
@@ -497,17 +497,18 @@ static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma1_4_2,
|
||||
ARRAY_SIZE(golden_settings_sdma1_4_2));
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(4, 2, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_arct,
|
||||
ARRAY_SIZE(golden_settings_sdma_arct));
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(4, 4, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_aldebaran,
|
||||
ARRAY_SIZE(golden_settings_sdma_aldebaran));
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_4_1,
|
||||
ARRAY_SIZE(golden_settings_sdma_4_1));
|
||||
@@ -520,7 +521,7 @@ static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_rv1,
|
||||
ARRAY_SIZE(golden_settings_sdma_rv1));
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(4, 1, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_4_3,
|
||||
ARRAY_SIZE(golden_settings_sdma_4_3));
|
||||
@@ -538,12 +539,12 @@ static void sdma_v4_0_setup_ulv(struct amdgpu_device *adev)
|
||||
* The only chips with SDMAv4 and ULV are VG10 and VG20.
|
||||
* Server SKUs take a different hysteresis setting from other SKUs.
|
||||
*/
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
if (adev->pdev->device == 0x6860)
|
||||
break;
|
||||
return;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(4, 2, 0):
|
||||
if (adev->pdev->device == 0x66a1)
|
||||
break;
|
||||
return;
|
||||
@@ -589,8 +590,8 @@ static void sdma_v4_0_destroy_inst_ctx(struct amdgpu_device *adev)
|
||||
|
||||
/* arcturus shares the same FW memory across
|
||||
all SDMA isntances */
|
||||
if (adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_ALDEBARAN)
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) ||
|
||||
adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 4, 0))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -620,17 +621,18 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
chip_name = "vega10";
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(4, 0, 1):
|
||||
chip_name = "vega12";
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(4, 2, 0):
|
||||
chip_name = "vega20";
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
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)
|
||||
@@ -638,16 +640,16 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
|
||||
else
|
||||
chip_name = "raven";
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(4, 2, 2):
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(4, 1, 2):
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
chip_name = "renoir";
|
||||
else
|
||||
chip_name = "green_sardine";
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(4, 4, 0):
|
||||
chip_name = "aldebaran";
|
||||
break;
|
||||
default:
|
||||
@@ -665,8 +667,8 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
|
||||
goto out;
|
||||
|
||||
for (i = 1; i < adev->sdma.num_instances; i++) {
|
||||
if (adev->asic_type == CHIP_ARCTURUS ||
|
||||
adev->asic_type == CHIP_ALDEBARAN) {
|
||||
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 */
|
||||
memcpy((void *)&adev->sdma.instance[i],
|
||||
@@ -1106,7 +1108,7 @@ static void sdma_v4_0_ctx_switch_enable(struct amdgpu_device *adev, bool enable)
|
||||
* Arcturus for the moment and firmware version 14
|
||||
* and above.
|
||||
*/
|
||||
if (adev->asic_type == CHIP_ARCTURUS &&
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) &&
|
||||
adev->sdma.instance[i].fw_version >= 14)
|
||||
WREG32_SDMA(i, mmSDMA0_PUB_DUMMY_REG2, enable);
|
||||
/* Extend page fault timeout to avoid interrupt storm */
|
||||
@@ -1393,9 +1395,10 @@ static void sdma_v4_0_init_pg(struct amdgpu_device *adev)
|
||||
if (!(adev->pg_flags & AMD_PG_SUPPORT_SDMA))
|
||||
return;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
case IP_VERSION(4, 1, 2):
|
||||
sdma_v4_1_init_power_gating(adev);
|
||||
sdma_v4_1_update_power_gating(adev, true);
|
||||
break;
|
||||
@@ -1835,13 +1838,13 @@ static bool sdma_v4_0_fw_support_paging_queue(struct amdgpu_device *adev)
|
||||
{
|
||||
uint fw_version = adev->sdma.instance[0].fw_version;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
return fw_version >= 430;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(4, 0, 1):
|
||||
/*return fw_version >= 31;*/
|
||||
return false;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(4, 2, 0):
|
||||
return fw_version >= 123;
|
||||
default:
|
||||
return false;
|
||||
@@ -1853,15 +1856,6 @@ static int sdma_v4_0_early_init(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int r;
|
||||
|
||||
if (adev->flags & AMD_IS_APU)
|
||||
adev->sdma.num_instances = 1;
|
||||
else if (adev->asic_type == CHIP_ARCTURUS)
|
||||
adev->sdma.num_instances = 8;
|
||||
else if (adev->asic_type == CHIP_ALDEBARAN)
|
||||
adev->sdma.num_instances = 5;
|
||||
else
|
||||
adev->sdma.num_instances = 2;
|
||||
|
||||
r = sdma_v4_0_init_microcode(adev);
|
||||
if (r) {
|
||||
DRM_ERROR("Failed to load sdma firmware!\n");
|
||||
@@ -1869,7 +1863,8 @@ static int sdma_v4_0_early_init(void *handle)
|
||||
}
|
||||
|
||||
/* TODO: Page queue breaks driver reload under SRIOV */
|
||||
if ((adev->asic_type == CHIP_VEGA10) && amdgpu_sriov_vf((adev)))
|
||||
if ((adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 0, 0)) &&
|
||||
amdgpu_sriov_vf((adev)))
|
||||
adev->sdma.has_page_queue = false;
|
||||
else if (sdma_v4_0_fw_support_paging_queue(adev))
|
||||
adev->sdma.has_page_queue = true;
|
||||
@@ -2141,14 +2136,14 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,
|
||||
amdgpu_fence_process(&adev->sdma.instance[instance].ring);
|
||||
break;
|
||||
case 1:
|
||||
if (adev->asic_type == CHIP_VEGA20)
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 0))
|
||||
amdgpu_fence_process(&adev->sdma.instance[instance].page);
|
||||
break;
|
||||
case 2:
|
||||
/* XXX compute */
|
||||
break;
|
||||
case 3:
|
||||
if (adev->asic_type != CHIP_VEGA20)
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] != IP_VERSION(4, 2, 0))
|
||||
amdgpu_fence_process(&adev->sdma.instance[instance].page);
|
||||
break;
|
||||
}
|
||||
@@ -2364,9 +2359,10 @@ static int sdma_v4_0_set_powergating_state(void *handle,
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 1, 0):
|
||||
case IP_VERSION(4, 1, 1):
|
||||
case IP_VERSION(4, 1, 2):
|
||||
sdma_v4_1_update_power_gating(adev,
|
||||
state == AMD_PG_STATE_GATE);
|
||||
break;
|
||||
@@ -2551,7 +2547,7 @@ static void sdma_v4_0_set_ring_funcs(struct amdgpu_device *adev)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
if (adev->asic_type == CHIP_ARCTURUS && i >= 5)
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) && i >= 5)
|
||||
adev->sdma.instance[i].ring.funcs =
|
||||
&sdma_v4_0_ring_funcs_2nd_mmhub;
|
||||
else
|
||||
@@ -2559,7 +2555,7 @@ static void sdma_v4_0_set_ring_funcs(struct amdgpu_device *adev)
|
||||
&sdma_v4_0_ring_funcs;
|
||||
adev->sdma.instance[i].ring.me = i;
|
||||
if (adev->sdma.has_page_queue) {
|
||||
if (adev->asic_type == CHIP_ARCTURUS && i >= 5)
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(4, 2, 2) && i >= 5)
|
||||
adev->sdma.instance[i].page.funcs =
|
||||
&sdma_v4_0_page_ring_funcs_2nd_mmhub;
|
||||
else
|
||||
@@ -2786,12 +2782,12 @@ static const struct amdgpu_sdma_ras_funcs sdma_v4_0_ras_funcs = {
|
||||
|
||||
static void sdma_v4_0_set_ras_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_ARCTURUS:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(4, 2, 0):
|
||||
case IP_VERSION(4, 2, 2):
|
||||
adev->sdma.funcs = &sdma_v4_0_ras_funcs;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(4, 4, 0):
|
||||
adev->sdma.funcs = &sdma_v4_4_ras_funcs;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -187,8 +187,8 @@ static u32 sdma_v5_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3
|
||||
|
||||
static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 0, 0):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_5,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_5));
|
||||
@@ -196,7 +196,7 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_nv10,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_nv10));
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(5, 0, 2):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_5,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_5));
|
||||
@@ -204,7 +204,7 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_nv14,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_nv14));
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(5, 0, 5):
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_5_sriov,
|
||||
@@ -217,7 +217,7 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
golden_settings_sdma_nv12,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_nv12));
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(5, 0, 1):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_sdma_cyan_skillfish,
|
||||
(const u32)ARRAY_SIZE(golden_settings_sdma_cyan_skillfish));
|
||||
@@ -248,22 +248,22 @@ static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)
|
||||
const struct common_firmware_header *header = NULL;
|
||||
const struct sdma_firmware_header_v1_0 *hdr;
|
||||
|
||||
if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_NAVI12))
|
||||
if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 0, 5)))
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 0, 0):
|
||||
chip_name = "navi10";
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case IP_VERSION(5, 0, 2):
|
||||
chip_name = "navi14";
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
case IP_VERSION(5, 0, 5):
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
case CHIP_CYAN_SKILLFISH:
|
||||
case IP_VERSION(5, 0, 1):
|
||||
if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2)
|
||||
chip_name = "cyan_skillfish2";
|
||||
else
|
||||
@@ -1295,8 +1295,6 @@ static int sdma_v5_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
adev->sdma.num_instances = 2;
|
||||
|
||||
sdma_v5_0_set_ring_funcs(adev);
|
||||
sdma_v5_0_set_buffer_funcs(adev);
|
||||
sdma_v5_0_set_vm_pte_funcs(adev);
|
||||
@@ -1636,10 +1634,10 @@ static int sdma_v5_0_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 0, 0):
|
||||
case IP_VERSION(5, 0, 2):
|
||||
case IP_VERSION(5, 0, 5):
|
||||
sdma_v5_0_update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
sdma_v5_0_update_medium_grain_light_sleep(adev,
|
||||
|
||||
@@ -136,23 +136,23 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 2, 0):
|
||||
chip_name = "sienna_cichlid";
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case IP_VERSION(5, 2, 2):
|
||||
chip_name = "navy_flounder";
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(5, 2, 1):
|
||||
chip_name = "vangogh";
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(5, 2, 4):
|
||||
chip_name = "dimgrey_cavefish";
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(5, 2, 5):
|
||||
chip_name = "beige_goby";
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(5, 2, 3):
|
||||
chip_name = "yellow_carp";
|
||||
break;
|
||||
default:
|
||||
@@ -174,7 +174,7 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)
|
||||
(void *)&adev->sdma.instance[0],
|
||||
sizeof(struct amdgpu_sdma_instance));
|
||||
|
||||
if (amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_SIENNA_CICHLID))
|
||||
if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 2, 0)))
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("psp_load == '%s'\n",
|
||||
@@ -868,6 +868,12 @@ static int sdma_v5_2_start(struct amdgpu_device *adev)
|
||||
msleep(1000);
|
||||
}
|
||||
|
||||
/* TODO: check whether can submit a doorbell request to raise
|
||||
* a doorbell fence to exit gfxoff.
|
||||
*/
|
||||
if (adev->in_s0ix)
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
sdma_v5_2_soft_reset(adev);
|
||||
/* unhalt the MEs */
|
||||
sdma_v5_2_enable(adev, true);
|
||||
@@ -876,6 +882,8 @@ static int sdma_v5_2_start(struct amdgpu_device *adev)
|
||||
|
||||
/* start the gfx rings and rlc compute queues */
|
||||
r = sdma_v5_2_gfx_resume(adev);
|
||||
if (adev->in_s0ix)
|
||||
amdgpu_gfx_off_ctrl(adev, true);
|
||||
if (r)
|
||||
return r;
|
||||
r = sdma_v5_2_rlc_resume(adev);
|
||||
@@ -1209,23 +1217,6 @@ static int sdma_v5_2_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
adev->sdma.num_instances = 4;
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
adev->sdma.num_instances = 2;
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
adev->sdma.num_instances = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sdma_v5_2_set_ring_funcs(adev);
|
||||
sdma_v5_2_set_buffer_funcs(adev);
|
||||
sdma_v5_2_set_vm_pte_funcs(adev);
|
||||
@@ -1547,7 +1538,7 @@ static void sdma_v5_2_update_medium_grain_clock_gating(struct amdgpu_device *ade
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
|
||||
if (adev->sdma.instance[i].fw_version < 70 && adev->asic_type == CHIP_VANGOGH)
|
||||
if (adev->sdma.instance[i].fw_version < 70 && adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 2, 1))
|
||||
adev->cg_flags &= ~AMD_CG_SUPPORT_SDMA_MGCG;
|
||||
|
||||
if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) {
|
||||
@@ -1584,7 +1575,7 @@ static void sdma_v5_2_update_medium_grain_light_sleep(struct amdgpu_device *adev
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
|
||||
if (adev->sdma.instance[i].fw_version < 70 && adev->asic_type == CHIP_VANGOGH)
|
||||
if (adev->sdma.instance[i].fw_version < 70 && adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 2, 1))
|
||||
adev->cg_flags &= ~AMD_CG_SUPPORT_SDMA_LS;
|
||||
|
||||
if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_LS)) {
|
||||
@@ -1613,13 +1604,13 @@ static int sdma_v5_2_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_YELLOW_CARP:
|
||||
switch (adev->ip_versions[SDMA0_HWIP][0]) {
|
||||
case IP_VERSION(5, 2, 0):
|
||||
case IP_VERSION(5, 2, 2):
|
||||
case IP_VERSION(5, 2, 1):
|
||||
case IP_VERSION(5, 2, 4):
|
||||
case IP_VERSION(5, 2, 5):
|
||||
case IP_VERSION(5, 2, 3):
|
||||
sdma_v5_2_update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
sdma_v5_2_update_medium_grain_light_sleep(adev,
|
||||
|
||||
@@ -156,31 +156,38 @@ static const struct amdgpu_video_codecs rn_video_codecs_decode =
|
||||
static int soc15_query_video_codecs(struct amdgpu_device *adev, bool encode,
|
||||
const struct amdgpu_video_codecs **codecs)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &vega_video_codecs_decode;
|
||||
return 0;
|
||||
case CHIP_RAVEN:
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &rv_video_codecs_decode;
|
||||
return 0;
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_ALDEBARAN:
|
||||
case CHIP_RENOIR:
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &rn_video_codecs_decode;
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
if (adev->ip_versions[VCE_HWIP][0]) {
|
||||
switch (adev->ip_versions[VCE_HWIP][0]) {
|
||||
case IP_VERSION(4, 0, 0):
|
||||
case IP_VERSION(4, 1, 0):
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &vega_video_codecs_decode;
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
switch (adev->ip_versions[UVD_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &rv_video_codecs_decode;
|
||||
return 0;
|
||||
case IP_VERSION(2, 5, 0):
|
||||
case IP_VERSION(2, 6, 0):
|
||||
case IP_VERSION(2, 2, 0):
|
||||
if (encode)
|
||||
*codecs = &vega_video_codecs_encode;
|
||||
else
|
||||
*codecs = &rn_video_codecs_decode;
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,9 +341,11 @@ static u32 soc15_get_xclk(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 reference_clock = adev->clock.spll.reference_freq;
|
||||
|
||||
if (adev->asic_type == CHIP_RENOIR)
|
||||
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0) ||
|
||||
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 1))
|
||||
return 10000;
|
||||
if (adev->asic_type == CHIP_RAVEN)
|
||||
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 0) ||
|
||||
adev->ip_versions[MP1_HWIP][0] == IP_VERSION(10, 0, 1))
|
||||
return reference_clock / 4;
|
||||
|
||||
return reference_clock;
|
||||
@@ -567,28 +576,29 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
|
||||
dev_warn(adev->dev, "Specified reset method:%d isn't supported, using AUTO instead.\n",
|
||||
amdgpu_reset_method);
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(10, 0, 0):
|
||||
case IP_VERSION(10, 0, 1):
|
||||
case IP_VERSION(12, 0, 0):
|
||||
case IP_VERSION(12, 0, 1):
|
||||
return AMD_RESET_METHOD_MODE2;
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_ARCTURUS:
|
||||
baco_reset = amdgpu_dpm_is_baco_supported(adev);
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
if (adev->psp.sos.fw_version >= 0x80067)
|
||||
case IP_VERSION(9, 0, 0):
|
||||
case IP_VERSION(11, 0, 2):
|
||||
if (adev->asic_type == CHIP_VEGA20) {
|
||||
if (adev->psp.sos.fw_version >= 0x80067)
|
||||
baco_reset = amdgpu_dpm_is_baco_supported(adev);
|
||||
/*
|
||||
* 1. PMFW version > 0x284300: all cases use baco
|
||||
* 2. PMFW version <= 0x284300: only sGPU w/o RAS use baco
|
||||
*/
|
||||
if (ras && adev->ras_enabled &&
|
||||
adev->pm.fw_version <= 0x283400)
|
||||
baco_reset = false;
|
||||
} else {
|
||||
baco_reset = amdgpu_dpm_is_baco_supported(adev);
|
||||
|
||||
/*
|
||||
* 1. PMFW version > 0x284300: all cases use baco
|
||||
* 2. PMFW version <= 0x284300: only sGPU w/o RAS use baco
|
||||
*/
|
||||
if (ras && adev->ras_enabled &&
|
||||
adev->pm.fw_version <= 0x283400)
|
||||
baco_reset = false;
|
||||
}
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(13, 0, 2):
|
||||
/*
|
||||
* 1.connected to cpu: driver issue mode2 reset
|
||||
* 2.discret gpu: driver issue mode1 reset
|
||||
@@ -631,15 +641,17 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
|
||||
|
||||
static bool soc15_supports_baco(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_ARCTURUS:
|
||||
return amdgpu_dpm_is_baco_supported(adev);
|
||||
case CHIP_VEGA20:
|
||||
if (adev->psp.sos.fw_version >= 0x80067)
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 0):
|
||||
case IP_VERSION(11, 0, 2):
|
||||
if (adev->asic_type == CHIP_VEGA20) {
|
||||
if (adev->psp.sos.fw_version >= 0x80067)
|
||||
return amdgpu_dpm_is_baco_supported(adev);
|
||||
return false;
|
||||
} else {
|
||||
return amdgpu_dpm_is_baco_supported(adev);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -706,7 +718,7 @@ static void soc15_enable_doorbell_aperture(struct amdgpu_device *adev,
|
||||
adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);
|
||||
}
|
||||
|
||||
static const struct amdgpu_ip_block_version vega10_common_ip_block =
|
||||
const struct amdgpu_ip_block_version vega10_common_ip_block =
|
||||
{
|
||||
.type = AMD_IP_BLOCK_TYPE_COMMON,
|
||||
.major = 2,
|
||||
@@ -1155,10 +1167,13 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->se_cac_rreg = &soc15_se_cac_rreg;
|
||||
adev->se_cac_wreg = &soc15_se_cac_wreg;
|
||||
|
||||
|
||||
adev->rev_id = soc15_get_rev_id(adev);
|
||||
adev->external_rev_id = 0xFF;
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
/* TODO: split the GC and PG flags based on the relevant IP version for which
|
||||
* they are relevant.
|
||||
*/
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
adev->asic_funcs = &soc15_asic_funcs;
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
@@ -1182,7 +1197,7 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->pg_flags = 0;
|
||||
adev->external_rev_id = 0x1;
|
||||
break;
|
||||
case CHIP_VEGA12:
|
||||
case IP_VERSION(9, 2, 1):
|
||||
adev->asic_funcs = &soc15_asic_funcs;
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
@@ -1205,7 +1220,7 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->pg_flags = 0;
|
||||
adev->external_rev_id = adev->rev_id + 0x14;
|
||||
break;
|
||||
case CHIP_VEGA20:
|
||||
case IP_VERSION(9, 4, 0):
|
||||
adev->asic_funcs = &vega20_asic_funcs;
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
@@ -1228,7 +1243,8 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->pg_flags = 0;
|
||||
adev->external_rev_id = adev->rev_id + 0x28;
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
adev->asic_funcs = &soc15_asic_funcs;
|
||||
|
||||
if (adev->rev_id >= 0x8)
|
||||
@@ -1301,7 +1317,7 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->pg_flags = AMD_PG_SUPPORT_SDMA | AMD_PG_SUPPORT_VCN;
|
||||
}
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case IP_VERSION(9, 4, 1):
|
||||
adev->asic_funcs = &vega20_asic_funcs;
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
@@ -1320,7 +1336,7 @@ static int soc15_common_early_init(void *handle)
|
||||
adev->pg_flags = AMD_PG_SUPPORT_VCN | AMD_PG_SUPPORT_VCN_DPG;
|
||||
adev->external_rev_id = adev->rev_id + 0x32;
|
||||
break;
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(9, 3, 0):
|
||||
adev->asic_funcs = &soc15_asic_funcs;
|
||||
|
||||
if (adev->apu_flags & AMD_APU_IS_RENOIR)
|
||||
@@ -1351,7 +1367,7 @@ static int soc15_common_early_init(void *handle)
|
||||
AMD_PG_SUPPORT_JPEG |
|
||||
AMD_PG_SUPPORT_VCN_DPG;
|
||||
break;
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(9, 4, 2):
|
||||
adev->asic_funcs = &vega20_asic_funcs;
|
||||
adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
|
||||
AMD_CG_SUPPORT_GFX_MGLS |
|
||||
@@ -1566,10 +1582,10 @@ static int soc15_common_set_clockgating_state(void *handle,
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
switch (adev->ip_versions[NBIO_HWIP][0]) {
|
||||
case IP_VERSION(6, 1, 0):
|
||||
case IP_VERSION(6, 2, 0):
|
||||
case IP_VERSION(7, 4, 0):
|
||||
adev->nbio.funcs->update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
adev->nbio.funcs->update_medium_grain_light_sleep(adev,
|
||||
@@ -1585,8 +1601,9 @@ static int soc15_common_set_clockgating_state(void *handle,
|
||||
adev->df.funcs->update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
case IP_VERSION(7, 0, 0):
|
||||
case IP_VERSION(7, 0, 1):
|
||||
case IP_VERSION(2, 5, 0):
|
||||
adev->nbio.funcs->update_medium_grain_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
adev->nbio.funcs->update_medium_grain_light_sleep(adev,
|
||||
@@ -1598,8 +1615,8 @@ static int soc15_common_set_clockgating_state(void *handle,
|
||||
soc15_update_drm_light_sleep(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
case CHIP_ARCTURUS:
|
||||
case CHIP_ALDEBARAN:
|
||||
case IP_VERSION(7, 4, 1):
|
||||
case IP_VERSION(7, 4, 4):
|
||||
adev->hdp.funcs->update_clock_gating(adev,
|
||||
state == AMD_CG_STATE_GATE);
|
||||
break;
|
||||
@@ -1621,7 +1638,7 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags)
|
||||
|
||||
adev->hdp.funcs->get_clock_gating_state(adev, flags);
|
||||
|
||||
if (adev->asic_type != CHIP_ALDEBARAN) {
|
||||
if (adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 2)) {
|
||||
|
||||
/* AMD_CG_SUPPORT_DRM_MGCG */
|
||||
data = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_CGTT_CTRL0));
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "nbio_v7_0.h"
|
||||
#include "nbio_v7_4.h"
|
||||
|
||||
extern const struct amdgpu_ip_block_version vega10_common_ip_block;
|
||||
|
||||
#define SOC15_FLUSH_GPU_TLB_NUM_WREG 6
|
||||
#define SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT 3
|
||||
|
||||
|
||||
@@ -288,9 +288,43 @@ static void umc_v6_7_query_ras_error_address(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t umc_v6_7_query_ras_poison_mode_per_channel(
|
||||
struct amdgpu_device *adev,
|
||||
uint32_t umc_reg_offset)
|
||||
{
|
||||
uint32_t ecc_ctrl_addr, ecc_ctrl;
|
||||
|
||||
ecc_ctrl_addr =
|
||||
SOC15_REG_OFFSET(UMC, 0, regUMCCH0_0_EccCtrl);
|
||||
ecc_ctrl = RREG32_PCIE((ecc_ctrl_addr +
|
||||
umc_reg_offset) * 4);
|
||||
|
||||
return REG_GET_FIELD(ecc_ctrl, UMCCH0_0_EccCtrl, UCFatalEn);
|
||||
}
|
||||
|
||||
static bool umc_v6_7_query_ras_poison_mode(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t umc_inst = 0;
|
||||
uint32_t ch_inst = 0;
|
||||
uint32_t umc_reg_offset = 0;
|
||||
|
||||
LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) {
|
||||
umc_reg_offset = get_umc_v6_7_reg_offset(adev,
|
||||
umc_inst,
|
||||
ch_inst);
|
||||
/* Enabling fatal error in one channel will be considered
|
||||
as fatal error mode */
|
||||
if (umc_v6_7_query_ras_poison_mode_per_channel(adev, umc_reg_offset))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const struct amdgpu_umc_ras_funcs umc_v6_7_ras_funcs = {
|
||||
.ras_late_init = amdgpu_umc_ras_late_init,
|
||||
.ras_fini = amdgpu_umc_ras_fini,
|
||||
.query_ras_error_count = umc_v6_7_query_ras_error_count,
|
||||
.query_ras_error_address = umc_v6_7_query_ras_error_address,
|
||||
.query_ras_poison_mode = umc_v6_7_query_ras_poison_mode,
|
||||
};
|
||||
|
||||
@@ -565,7 +565,7 @@ static int vce_v4_0_suspend(void *handle)
|
||||
if (adev->vce.vcpu_bo == NULL)
|
||||
return 0;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo);
|
||||
void *ptr = adev->vce.cpu_addr;
|
||||
@@ -615,7 +615,7 @@ static int vce_v4_0_resume(void *handle)
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo);
|
||||
void *ptr = adev->vce.cpu_addr;
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ static int vcn_v1_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
adev->vcn.num_vcn_inst = 1;
|
||||
adev->vcn.num_enc_rings = 2;
|
||||
|
||||
vcn_v1_0_set_dec_ring_funcs(adev);
|
||||
|
||||
@@ -69,7 +69,6 @@ static int vcn_v2_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
adev->vcn.num_vcn_inst = 1;
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
adev->vcn.num_enc_rings = 1;
|
||||
else
|
||||
@@ -199,7 +198,7 @@ static int vcn_v2_0_sw_fini(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst->fw_shared_cpu_addr;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
fw_shared->present_flag_0 = 0;
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static int vcn_v2_5_early_init(void *handle)
|
||||
} else {
|
||||
u32 harvest;
|
||||
int i;
|
||||
adev->vcn.num_vcn_inst = VCN25_MAX_HW_INSTANCES_ARCTURUS;
|
||||
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
harvest = RREG32_SOC15(VCN, i, mmCC_UVD_HARVESTING);
|
||||
if (harvest & CC_UVD_HARVESTING__UVD_DISABLE_MASK)
|
||||
@@ -240,7 +240,7 @@ static int vcn_v2_5_sw_fini(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
volatile struct amdgpu_fw_shared *fw_shared;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
@@ -1720,7 +1720,7 @@ static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev)
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
if (adev->asic_type == CHIP_ARCTURUS)
|
||||
if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(2, 5, 0))
|
||||
adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs;
|
||||
else /* CHIP_ALDEBARAN */
|
||||
adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_6_dec_ring_vm_funcs;
|
||||
@@ -1737,7 +1737,7 @@ static void vcn_v2_5_set_enc_ring_funcs(struct amdgpu_device *adev)
|
||||
if (adev->vcn.harvest_config & (1 << j))
|
||||
continue;
|
||||
for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
|
||||
if (adev->asic_type == CHIP_ARCTURUS)
|
||||
if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(2, 5, 0))
|
||||
adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs;
|
||||
else /* CHIP_ALDEBARAN */
|
||||
adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_6_enc_ring_vm_funcs;
|
||||
|
||||
@@ -87,7 +87,6 @@ static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring);
|
||||
static int vcn_v3_0_early_init(void *handle)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int i;
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
adev->vcn.num_vcn_inst = VCN_INSTANCES_SIENNA_CICHLID;
|
||||
@@ -95,24 +94,12 @@ static int vcn_v3_0_early_init(void *handle)
|
||||
adev->vcn.num_enc_rings = 1;
|
||||
|
||||
} else {
|
||||
if (adev->asic_type == CHIP_SIENNA_CICHLID) {
|
||||
u32 harvest;
|
||||
if (adev->vcn.harvest_config == (AMDGPU_VCN_HARVEST_VCN0 |
|
||||
AMDGPU_VCN_HARVEST_VCN1))
|
||||
/* both instances are harvested, disable the block */
|
||||
return -ENOENT;
|
||||
|
||||
adev->vcn.num_vcn_inst = VCN_INSTANCES_SIENNA_CICHLID;
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
harvest = RREG32_SOC15(VCN, i, mmCC_UVD_HARVESTING);
|
||||
if (harvest & CC_UVD_HARVESTING__UVD_DISABLE_MASK)
|
||||
adev->vcn.harvest_config |= 1 << i;
|
||||
}
|
||||
|
||||
if (adev->vcn.harvest_config == (AMDGPU_VCN_HARVEST_VCN0 |
|
||||
AMDGPU_VCN_HARVEST_VCN1))
|
||||
/* both instances are harvested, disable the block */
|
||||
return -ENOENT;
|
||||
} else
|
||||
adev->vcn.num_vcn_inst = 1;
|
||||
|
||||
if (adev->asic_type == CHIP_BEIGE_GOBY)
|
||||
if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 0, 33))
|
||||
adev->vcn.num_enc_rings = 0;
|
||||
else
|
||||
adev->vcn.num_enc_rings = 2;
|
||||
@@ -276,7 +263,7 @@ static int vcn_v3_0_sw_fini(void *handle)
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int i, r, idx;
|
||||
|
||||
if (drm_dev_enter(&adev->ddev, &idx)) {
|
||||
if (drm_dev_enter(adev_to_drm(adev), &idx)) {
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
volatile struct amdgpu_fw_shared *fw_shared;
|
||||
|
||||
@@ -1272,7 +1259,7 @@ static int vcn_v3_0_start(struct amdgpu_device *adev)
|
||||
fw_shared->rb.wptr = lower_32_bits(ring->wptr);
|
||||
fw_shared->multi_queue.decode_queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET);
|
||||
|
||||
if (adev->asic_type != CHIP_BEIGE_GOBY) {
|
||||
if (adev->ip_versions[UVD_HWIP][0] != IP_VERSION(3, 0, 33)) {
|
||||
fw_shared->multi_queue.encode_generalpurpose_queue_mode |= cpu_to_le32(FW_QUEUE_RING_RESET);
|
||||
ring = &adev->vcn.inst[i].ring_enc[0];
|
||||
WREG32_SOC15(VCN, i, mmUVD_RB_RPTR, lower_32_bits(ring->wptr));
|
||||
@@ -1644,7 +1631,7 @@ static int vcn_v3_0_pause_dpg_mode(struct amdgpu_device *adev,
|
||||
UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK,
|
||||
~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK);
|
||||
|
||||
if (adev->asic_type != CHIP_BEIGE_GOBY) {
|
||||
if (adev->ip_versions[UVD_HWIP][0] != IP_VERSION(3, 0, 33)) {
|
||||
/* Restore */
|
||||
fw_shared = adev->vcn.inst[inst_idx].fw_shared_cpu_addr;
|
||||
fw_shared->multi_queue.encode_generalpurpose_queue_mode |= cpu_to_le32(FW_QUEUE_RING_RESET);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "amdgpu_amdkfd.h"
|
||||
#include "kfd_smi_events.h"
|
||||
#include "kfd_migrate.h"
|
||||
#include "amdgpu.h"
|
||||
|
||||
#define MQD_SIZE_ALIGNED 768
|
||||
|
||||
@@ -52,41 +53,6 @@ extern const struct kfd2kgd_calls aldebaran_kfd2kgd;
|
||||
extern const struct kfd2kgd_calls gfx_v10_kfd2kgd;
|
||||
extern const struct kfd2kgd_calls gfx_v10_3_kfd2kgd;
|
||||
|
||||
static const struct kfd2kgd_calls *kfd2kgd_funcs[] = {
|
||||
#ifdef KFD_SUPPORT_IOMMU_V2
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
[CHIP_KAVERI] = &gfx_v7_kfd2kgd,
|
||||
#endif
|
||||
[CHIP_CARRIZO] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_RAVEN] = &gfx_v9_kfd2kgd,
|
||||
#endif
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
[CHIP_HAWAII] = &gfx_v7_kfd2kgd,
|
||||
#endif
|
||||
[CHIP_TONGA] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_FIJI] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_POLARIS10] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_POLARIS11] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_POLARIS12] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_VEGAM] = &gfx_v8_kfd2kgd,
|
||||
[CHIP_VEGA10] = &gfx_v9_kfd2kgd,
|
||||
[CHIP_VEGA12] = &gfx_v9_kfd2kgd,
|
||||
[CHIP_VEGA20] = &gfx_v9_kfd2kgd,
|
||||
[CHIP_RENOIR] = &gfx_v9_kfd2kgd,
|
||||
[CHIP_ARCTURUS] = &arcturus_kfd2kgd,
|
||||
[CHIP_ALDEBARAN] = &aldebaran_kfd2kgd,
|
||||
[CHIP_NAVI10] = &gfx_v10_kfd2kgd,
|
||||
[CHIP_NAVI12] = &gfx_v10_kfd2kgd,
|
||||
[CHIP_NAVI14] = &gfx_v10_kfd2kgd,
|
||||
[CHIP_SIENNA_CICHLID] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_NAVY_FLOUNDER] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_VANGOGH] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_DIMGREY_CAVEFISH] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_BEIGE_GOBY] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_YELLOW_CARP] = &gfx_v10_3_kfd2kgd,
|
||||
[CHIP_CYAN_SKILLFISH] = &gfx_v10_kfd2kgd,
|
||||
};
|
||||
|
||||
#ifdef KFD_SUPPORT_IOMMU_V2
|
||||
static const struct kfd_device_info kaveri_device_info = {
|
||||
.asic_family = CHIP_KAVERI,
|
||||
@@ -653,63 +619,202 @@ static const struct kfd_device_info cyan_skillfish_device_info = {
|
||||
.num_sdma_queues_per_engine = 8,
|
||||
};
|
||||
|
||||
/* For each entry, [0] is regular and [1] is virtualisation device. */
|
||||
static const struct kfd_device_info *kfd_supported_devices[][2] = {
|
||||
#ifdef KFD_SUPPORT_IOMMU_V2
|
||||
[CHIP_KAVERI] = {&kaveri_device_info, NULL},
|
||||
[CHIP_CARRIZO] = {&carrizo_device_info, NULL},
|
||||
#endif
|
||||
[CHIP_RAVEN] = {&raven_device_info, NULL},
|
||||
[CHIP_HAWAII] = {&hawaii_device_info, NULL},
|
||||
[CHIP_TONGA] = {&tonga_device_info, NULL},
|
||||
[CHIP_FIJI] = {&fiji_device_info, &fiji_vf_device_info},
|
||||
[CHIP_POLARIS10] = {&polaris10_device_info, &polaris10_vf_device_info},
|
||||
[CHIP_POLARIS11] = {&polaris11_device_info, NULL},
|
||||
[CHIP_POLARIS12] = {&polaris12_device_info, NULL},
|
||||
[CHIP_VEGAM] = {&vegam_device_info, NULL},
|
||||
[CHIP_VEGA10] = {&vega10_device_info, &vega10_vf_device_info},
|
||||
[CHIP_VEGA12] = {&vega12_device_info, NULL},
|
||||
[CHIP_VEGA20] = {&vega20_device_info, NULL},
|
||||
[CHIP_RENOIR] = {&renoir_device_info, NULL},
|
||||
[CHIP_ARCTURUS] = {&arcturus_device_info, &arcturus_device_info},
|
||||
[CHIP_ALDEBARAN] = {&aldebaran_device_info, &aldebaran_device_info},
|
||||
[CHIP_NAVI10] = {&navi10_device_info, NULL},
|
||||
[CHIP_NAVI12] = {&navi12_device_info, &navi12_device_info},
|
||||
[CHIP_NAVI14] = {&navi14_device_info, NULL},
|
||||
[CHIP_SIENNA_CICHLID] = {&sienna_cichlid_device_info, &sienna_cichlid_device_info},
|
||||
[CHIP_NAVY_FLOUNDER] = {&navy_flounder_device_info, &navy_flounder_device_info},
|
||||
[CHIP_VANGOGH] = {&vangogh_device_info, NULL},
|
||||
[CHIP_DIMGREY_CAVEFISH] = {&dimgrey_cavefish_device_info, &dimgrey_cavefish_device_info},
|
||||
[CHIP_BEIGE_GOBY] = {&beige_goby_device_info, &beige_goby_device_info},
|
||||
[CHIP_YELLOW_CARP] = {&yellow_carp_device_info, NULL},
|
||||
[CHIP_CYAN_SKILLFISH] = {&cyan_skillfish_device_info, NULL},
|
||||
};
|
||||
|
||||
static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
|
||||
unsigned int chunk_size);
|
||||
static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
|
||||
|
||||
static int kfd_resume(struct kfd_dev *kfd);
|
||||
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
|
||||
struct pci_dev *pdev, unsigned int asic_type, bool vf)
|
||||
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, bool vf)
|
||||
{
|
||||
struct kfd_dev *kfd;
|
||||
const struct kfd_device_info *device_info;
|
||||
const struct kfd2kgd_calls *f2g;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
|
||||
struct pci_dev *pdev = adev->pdev;
|
||||
|
||||
if (asic_type >= sizeof(kfd_supported_devices) / (sizeof(void *) * 2)
|
||||
|| asic_type >= sizeof(kfd2kgd_funcs) / sizeof(void *)) {
|
||||
dev_err(kfd_device, "asic_type %d out of range\n", asic_type);
|
||||
return NULL; /* asic_type out of range */
|
||||
switch (adev->asic_type) {
|
||||
#ifdef KFD_SUPPORT_IOMMU_V2
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
case CHIP_KAVERI:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &kaveri_device_info;
|
||||
f2g = &gfx_v7_kfd2kgd;
|
||||
break;
|
||||
#endif
|
||||
case CHIP_CARRIZO:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &carrizo_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
case CHIP_HAWAII:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &hawaii_device_info;
|
||||
f2g = &gfx_v7_kfd2kgd;
|
||||
break;
|
||||
#endif
|
||||
case CHIP_TONGA:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &tonga_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
case CHIP_FIJI:
|
||||
if (vf)
|
||||
device_info = &fiji_vf_device_info;
|
||||
else
|
||||
device_info = &fiji_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
case CHIP_POLARIS10:
|
||||
if (vf)
|
||||
device_info = &polaris10_vf_device_info;
|
||||
else
|
||||
device_info = &polaris10_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
case CHIP_POLARIS11:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &polaris11_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
case CHIP_POLARIS12:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &polaris12_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
case CHIP_VEGAM:
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &vegam_device_info;
|
||||
f2g = &gfx_v8_kfd2kgd;
|
||||
break;
|
||||
default:
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 0, 1):
|
||||
if (vf)
|
||||
device_info = &vega10_vf_device_info;
|
||||
else
|
||||
device_info = &vega10_device_info;
|
||||
f2g = &gfx_v9_kfd2kgd;
|
||||
break;
|
||||
#ifdef KFD_SUPPORT_IOMMU_V2
|
||||
case IP_VERSION(9, 1, 0):
|
||||
case IP_VERSION(9, 2, 2):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &raven_device_info;
|
||||
f2g = &gfx_v9_kfd2kgd;
|
||||
break;
|
||||
#endif
|
||||
case IP_VERSION(9, 2, 1):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &vega12_device_info;
|
||||
f2g = &gfx_v9_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(9, 3, 0):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &renoir_device_info;
|
||||
f2g = &gfx_v9_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(9, 4, 0):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &vega20_device_info;
|
||||
f2g = &gfx_v9_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(9, 4, 1):
|
||||
device_info = &arcturus_device_info;
|
||||
f2g = &arcturus_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(9, 4, 2):
|
||||
device_info = &aldebaran_device_info;
|
||||
f2g = &aldebaran_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &navi10_device_info;
|
||||
f2g = &gfx_v10_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 1, 2):
|
||||
device_info = &navi12_device_info;
|
||||
f2g = &gfx_v10_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 1, 1):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &navi14_device_info;
|
||||
f2g = &gfx_v10_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 1, 3):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &cyan_skillfish_device_info;
|
||||
f2g = &gfx_v10_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 0):
|
||||
device_info = &sienna_cichlid_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 2):
|
||||
device_info = &navy_flounder_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 1):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &vangogh_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 4):
|
||||
device_info = &dimgrey_cavefish_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 5):
|
||||
device_info = &beige_goby_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
case IP_VERSION(10, 3, 3):
|
||||
if (vf)
|
||||
device_info = NULL;
|
||||
else
|
||||
device_info = &yellow_carp_device_info;
|
||||
f2g = &gfx_v10_3_kfd2kgd;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
device_info = kfd_supported_devices[asic_type][vf];
|
||||
f2g = kfd2kgd_funcs[asic_type];
|
||||
|
||||
if (!device_info || !f2g) {
|
||||
dev_err(kfd_device, "%s %s not supported in kfd\n",
|
||||
amdgpu_asic_name[asic_type], vf ? "VF" : "");
|
||||
amdgpu_asic_name[adev->asic_type], vf ? "VF" : "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1085,18 +1190,12 @@ static int kfd_resume(struct kfd_dev *kfd)
|
||||
int err = 0;
|
||||
|
||||
err = kfd->dqm->ops.start(kfd->dqm);
|
||||
if (err) {
|
||||
if (err)
|
||||
dev_err(kfd_device,
|
||||
"Error starting queue manager for device %x:%x\n",
|
||||
kfd->pdev->vendor, kfd->pdev->device);
|
||||
goto dqm_start_error;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
dqm_start_error:
|
||||
kfd_iommu_suspend(kfd);
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline void kfd_queue_work(struct workqueue_struct *wq,
|
||||
|
||||
@@ -231,7 +231,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev,
|
||||
if (sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_ILLEGAL_INST &&
|
||||
sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_MEMVIOL) {
|
||||
kfd_signal_poison_consumed_event(dev, pasid);
|
||||
amdgpu_amdkfd_gpu_reset(dev->kgd);
|
||||
amdgpu_amdkfd_ras_poison_consumption_handler(dev->kgd);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -253,7 +253,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev,
|
||||
kfd_signal_event_interrupt(pasid, context_id0 & 0xfffffff, 28);
|
||||
} else if (source_id == SOC15_INTSRC_SDMA_ECC) {
|
||||
kfd_signal_poison_consumed_event(dev, pasid);
|
||||
amdgpu_amdkfd_gpu_reset(dev->kgd);
|
||||
amdgpu_amdkfd_ras_poison_consumption_handler(dev->kgd);
|
||||
return;
|
||||
}
|
||||
} else if (client_id == SOC15_IH_CLIENTID_VMC ||
|
||||
|
||||
@@ -901,8 +901,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
|
||||
|
||||
/* Disable SVM support capability */
|
||||
pgmap->type = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1307,7 +1307,7 @@ struct svm_validate_context {
|
||||
struct svm_range *prange;
|
||||
bool intr;
|
||||
unsigned long bitmap[MAX_GPU_INSTANCE];
|
||||
struct ttm_validate_buffer tv[MAX_GPU_INSTANCE+1];
|
||||
struct ttm_validate_buffer tv[MAX_GPU_INSTANCE];
|
||||
struct list_head validate_list;
|
||||
struct ww_acquire_ctx ticket;
|
||||
};
|
||||
@@ -1334,11 +1334,6 @@ static int svm_range_reserve_bos(struct svm_validate_context *ctx)
|
||||
ctx->tv[gpuidx].num_shared = 4;
|
||||
list_add(&ctx->tv[gpuidx].head, &ctx->validate_list);
|
||||
}
|
||||
if (ctx->prange->svm_bo && ctx->prange->ttm_res) {
|
||||
ctx->tv[MAX_GPU_INSTANCE].bo = &ctx->prange->svm_bo->bo->tbo;
|
||||
ctx->tv[MAX_GPU_INSTANCE].num_shared = 1;
|
||||
list_add(&ctx->tv[MAX_GPU_INSTANCE].head, &ctx->validate_list);
|
||||
}
|
||||
|
||||
r = ttm_eu_reserve_buffers(&ctx->ticket, &ctx->validate_list,
|
||||
ctx->intr, NULL);
|
||||
|
||||
@@ -25,6 +25,8 @@ config DRM_AMD_DC_HDCP
|
||||
|
||||
config DRM_AMD_DC_SI
|
||||
bool "AMD DC support for Southern Islands ASICs"
|
||||
depends on DRM_AMDGPU_SI
|
||||
depends on DRM_AMD_DC
|
||||
default n
|
||||
help
|
||||
Choose this option to enable new AMD DC support for SI asics
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "dm_services_types.h"
|
||||
#include "dc.h"
|
||||
#include "dc_link_dp.h"
|
||||
#include "link_enc_cfg.h"
|
||||
#include "dc/inc/core_types.h"
|
||||
#include "dal_asic_id.h"
|
||||
#include "dmub/dmub_srv.h"
|
||||
@@ -648,6 +649,7 @@ void dmub_aux_setconfig_callback(struct amdgpu_device *adev, struct dmub_notific
|
||||
void dmub_hpd_callback(struct amdgpu_device *adev, struct dmub_notification *notify)
|
||||
{
|
||||
struct amdgpu_dm_connector *aconnector;
|
||||
struct amdgpu_dm_connector *hpd_aconnector = NULL;
|
||||
struct drm_connector *connector;
|
||||
struct drm_connector_list_iter iter;
|
||||
struct dc_link *link;
|
||||
@@ -678,13 +680,15 @@ void dmub_hpd_callback(struct amdgpu_device *adev, struct dmub_notification *not
|
||||
aconnector = to_amdgpu_dm_connector(connector);
|
||||
if (link && aconnector->dc_link == link) {
|
||||
DRM_INFO("DMUB HPD callback: link_index=%u\n", link_index);
|
||||
handle_hpd_irq_helper(aconnector);
|
||||
hpd_aconnector = aconnector;
|
||||
break;
|
||||
}
|
||||
}
|
||||
drm_connector_list_iter_end(&iter);
|
||||
drm_modeset_unlock(&dev->mode_config.connection_mutex);
|
||||
|
||||
if (hpd_aconnector)
|
||||
handle_hpd_irq_helper(hpd_aconnector);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -747,8 +751,10 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
|
||||
struct dmcub_trace_buf_entry entry = { 0 };
|
||||
uint32_t count = 0;
|
||||
struct dmub_hpd_work *dmub_hpd_wrk;
|
||||
struct dc_link *plink = NULL;
|
||||
|
||||
if (dc_enable_dmub_notifications(adev->dm.dc)) {
|
||||
if (dc_enable_dmub_notifications(adev->dm.dc) &&
|
||||
irq_params->irq_src == DC_IRQ_SOURCE_DMCUB_OUTBOX) {
|
||||
dmub_hpd_wrk = kzalloc(sizeof(*dmub_hpd_wrk), GFP_ATOMIC);
|
||||
if (!dmub_hpd_wrk) {
|
||||
DRM_ERROR("Failed to allocate dmub_hpd_wrk");
|
||||
@@ -756,27 +762,28 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
|
||||
}
|
||||
INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work);
|
||||
|
||||
if (irq_params->irq_src == DC_IRQ_SOURCE_DMCUB_OUTBOX) {
|
||||
do {
|
||||
dc_stat_get_dmub_notification(adev->dm.dc, ¬ify);
|
||||
if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) {
|
||||
DRM_ERROR("DM: notify type %d larger than the array size %zu!", notify.type,
|
||||
ARRAY_SIZE(dm->dmub_thread_offload));
|
||||
continue;
|
||||
do {
|
||||
dc_stat_get_dmub_notification(adev->dm.dc, ¬ify);
|
||||
if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) {
|
||||
DRM_ERROR("DM: notify type %d invalid!", notify.type);
|
||||
continue;
|
||||
}
|
||||
if (dm->dmub_thread_offload[notify.type] == true) {
|
||||
dmub_hpd_wrk->dmub_notify = ¬ify;
|
||||
dmub_hpd_wrk->adev = adev;
|
||||
if (notify.type == DMUB_NOTIFICATION_HPD) {
|
||||
plink = adev->dm.dc->links[notify.link_index];
|
||||
if (plink) {
|
||||
plink->hpd_status =
|
||||
notify.hpd_status ==
|
||||
DP_HPD_PLUG ? true : false;
|
||||
}
|
||||
}
|
||||
if (dm->dmub_thread_offload[notify.type] == true) {
|
||||
dmub_hpd_wrk->dmub_notify = ¬ify;
|
||||
dmub_hpd_wrk->adev = adev;
|
||||
queue_work(adev->dm.delayed_hpd_wq, &dmub_hpd_wrk->handle_hpd_work);
|
||||
} else {
|
||||
dm->dmub_callback[notify.type](adev, ¬ify);
|
||||
}
|
||||
|
||||
} while (notify.pending_notification);
|
||||
|
||||
} else {
|
||||
DRM_ERROR("DM: Failed to receive correct outbox IRQ !");
|
||||
}
|
||||
queue_work(adev->dm.delayed_hpd_wq, &dmub_hpd_wrk->handle_hpd_work);
|
||||
} else {
|
||||
dm->dmub_callback[notify.type](adev, ¬ify);
|
||||
}
|
||||
} while (notify.pending_notification);
|
||||
}
|
||||
|
||||
|
||||
@@ -794,7 +801,8 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
|
||||
|
||||
} while (count <= DMUB_TRACE_MAX_READ);
|
||||
|
||||
ASSERT(count <= DMUB_TRACE_MAX_READ);
|
||||
if (count > DMUB_TRACE_MAX_READ)
|
||||
DRM_DEBUG_DRIVER("Warning : count > DMUB_TRACE_MAX_READ");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1319,6 +1327,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
|
||||
|
||||
init_data.asic_id.pci_revision_id = adev->pdev->revision;
|
||||
init_data.asic_id.hw_internal_rev = adev->external_rev_id;
|
||||
init_data.asic_id.chip_id = adev->pdev->device;
|
||||
|
||||
init_data.asic_id.vram_width = adev->gmc.vram_width;
|
||||
/* TODO: initialize init_data.asic_id.vram_type here!!!! */
|
||||
@@ -1341,17 +1350,28 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_CARRIZO:
|
||||
case CHIP_STONEY:
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
init_data.flags.gpu_vm_support = true;
|
||||
if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
|
||||
init_data.flags.disable_dmcu = true;
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
init_data.flags.gpu_vm_support = true;
|
||||
break;
|
||||
default:
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 1, 0):
|
||||
init_data.flags.gpu_vm_support = true;
|
||||
if (ASICREV_IS_GREEN_SARDINE(adev->external_rev_id))
|
||||
init_data.flags.disable_dmcu = true;
|
||||
break;
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
case IP_VERSION(3, 0, 1):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
init_data.flags.gpu_vm_support = true;
|
||||
break;
|
||||
case IP_VERSION(2, 0, 3):
|
||||
init_data.flags.disable_dmcu = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1442,7 +1462,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_HDCP
|
||||
if (adev->dm.dc->caps.max_links > 0 && adev->asic_type >= CHIP_RAVEN) {
|
||||
if (adev->dm.dc->caps.max_links > 0 && adev->family >= AMDGPU_FAMILY_RV) {
|
||||
adev->dm.hdcp_workqueue = hdcp_create_workqueue(adev, &init_params.cp_psp, adev->dm.dc);
|
||||
|
||||
if (!adev->dm.hdcp_workqueue)
|
||||
@@ -1637,15 +1657,6 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
|
||||
case CHIP_VEGA10:
|
||||
case CHIP_VEGA12:
|
||||
case CHIP_VEGA20:
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
return 0;
|
||||
case CHIP_NAVI12:
|
||||
fw_name_dmcu = FIRMWARE_NAVI12_DMCU;
|
||||
@@ -1659,6 +1670,21 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 0, 3):
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
case IP_VERSION(3, 0, 3):
|
||||
case IP_VERSION(3, 0, 1):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1737,34 +1763,36 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
|
||||
enum dmub_status status;
|
||||
int r;
|
||||
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_RENOIR:
|
||||
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 CHIP_SIENNA_CICHLID:
|
||||
dmub_asic = DMUB_ASIC_DCN30;
|
||||
fw_name_dmub = FIRMWARE_SIENNA_CICHLID_DMUB;
|
||||
case IP_VERSION(3, 0, 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 {
|
||||
dmub_asic = DMUB_ASIC_DCN30;
|
||||
fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
|
||||
}
|
||||
break;
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
dmub_asic = DMUB_ASIC_DCN30;
|
||||
fw_name_dmub = FIRMWARE_NAVY_FLOUNDER_DMUB;
|
||||
break;
|
||||
case CHIP_VANGOGH:
|
||||
case IP_VERSION(3, 0, 1):
|
||||
dmub_asic = DMUB_ASIC_DCN301;
|
||||
fw_name_dmub = FIRMWARE_VANGOGH_DMUB;
|
||||
break;
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case IP_VERSION(3, 0, 2):
|
||||
dmub_asic = DMUB_ASIC_DCN302;
|
||||
fw_name_dmub = FIRMWARE_DIMGREY_CAVEFISH_DMUB;
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case IP_VERSION(3, 0, 3):
|
||||
dmub_asic = DMUB_ASIC_DCN303;
|
||||
fw_name_dmub = FIRMWARE_BEIGE_GOBY_DMUB;
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
dmub_asic = DMUB_ASIC_DCN31;
|
||||
fw_name_dmub = FIRMWARE_YELLOW_CARP_DMUB;
|
||||
break;
|
||||
@@ -1961,6 +1989,7 @@ static int dm_late_init(void *handle)
|
||||
linear_lut[i] = 0xFFFF * i / 15;
|
||||
|
||||
params.set = 0;
|
||||
params.backlight_ramping_override = false;
|
||||
params.backlight_ramping_start = 0xCCCC;
|
||||
params.backlight_ramping_reduction = 0xCCCCCCCC;
|
||||
params.backlight_lut_array_size = 16;
|
||||
@@ -2063,10 +2092,9 @@ static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev)
|
||||
* therefore, this function apply to navi10/12/14 but not Renoir
|
||||
* *
|
||||
*/
|
||||
switch(adev->asic_type) {
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_NAVI12:
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 0, 0):
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@@ -2907,7 +2935,6 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
|
||||
if (aconnector->base.force && new_connection_type == dc_connection_none) {
|
||||
emulated_link_detect(aconnector->dc_link);
|
||||
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
dm_restore_drm_connector_state(dev, connector);
|
||||
drm_modeset_unlock_all(dev);
|
||||
@@ -3287,7 +3314,7 @@ static int dce110_register_irq_handlers(struct amdgpu_device *adev)
|
||||
int i;
|
||||
unsigned client_id = AMDGPU_IRQ_CLIENTID_LEGACY;
|
||||
|
||||
if (adev->asic_type >= CHIP_VEGA10)
|
||||
if (adev->family >= AMDGPU_FAMILY_AI)
|
||||
client_id = SOC15_IH_CLIENTID_DCE;
|
||||
|
||||
int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT;
|
||||
@@ -4072,18 +4099,19 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
/* Use Outbox interrupt */
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_YELLOW_CARP:
|
||||
case CHIP_RENOIR:
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
if (register_outbox_irq_handlers(dm->adev)) {
|
||||
DRM_ERROR("DM: Failed to initialize IRQ\n");
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DRM_DEBUG_KMS("Unsupported ASIC type for outbox: 0x%X\n", adev->asic_type);
|
||||
DRM_DEBUG_KMS("Unsupported DCN IP version for outbox: 0x%X\n",
|
||||
adev->ip_versions[DCE_HWIP][0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4169,27 +4197,33 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
case CHIP_BEIGE_GOBY:
|
||||
case CHIP_VANGOGH:
|
||||
case CHIP_YELLOW_CARP:
|
||||
if (dcn10_register_irq_handlers(dm->adev)) {
|
||||
DRM_ERROR("DM: Failed to initialize IRQ\n");
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(2, 0, 3):
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(3, 0, 0):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
case IP_VERSION(3, 0, 3):
|
||||
case IP_VERSION(3, 0, 1):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
if (dcn10_register_irq_handlers(dm->adev)) {
|
||||
DRM_ERROR("DM: Failed to initialize IRQ\n");
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Unsupported DCE IP versions: 0x%X\n",
|
||||
adev->ip_versions[DCE_HWIP][0]);
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type);
|
||||
goto fail;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -4336,42 +4370,44 @@ static int dm_early_init(void *handle)
|
||||
adev->mode_info.num_hpd = 6;
|
||||
adev->mode_info.num_dig = 6;
|
||||
break;
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
case CHIP_RAVEN:
|
||||
case CHIP_RENOIR:
|
||||
case CHIP_VANGOGH:
|
||||
adev->mode_info.num_crtc = 4;
|
||||
adev->mode_info.num_hpd = 4;
|
||||
adev->mode_info.num_dig = 4;
|
||||
break;
|
||||
case CHIP_NAVI10:
|
||||
case CHIP_NAVI12:
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
case CHIP_NAVY_FLOUNDER:
|
||||
adev->mode_info.num_crtc = 6;
|
||||
adev->mode_info.num_hpd = 6;
|
||||
adev->mode_info.num_dig = 6;
|
||||
break;
|
||||
case CHIP_YELLOW_CARP:
|
||||
adev->mode_info.num_crtc = 4;
|
||||
adev->mode_info.num_hpd = 4;
|
||||
adev->mode_info.num_dig = 4;
|
||||
break;
|
||||
case CHIP_NAVI14:
|
||||
case CHIP_DIMGREY_CAVEFISH:
|
||||
adev->mode_info.num_crtc = 5;
|
||||
adev->mode_info.num_hpd = 5;
|
||||
adev->mode_info.num_dig = 5;
|
||||
break;
|
||||
case CHIP_BEIGE_GOBY:
|
||||
adev->mode_info.num_crtc = 2;
|
||||
adev->mode_info.num_hpd = 2;
|
||||
adev->mode_info.num_dig = 2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type);
|
||||
return -EINVAL;
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
switch (adev->ip_versions[DCE_HWIP][0]) {
|
||||
case IP_VERSION(2, 0, 2):
|
||||
case IP_VERSION(3, 0, 0):
|
||||
adev->mode_info.num_crtc = 6;
|
||||
adev->mode_info.num_hpd = 6;
|
||||
adev->mode_info.num_dig = 6;
|
||||
break;
|
||||
case IP_VERSION(2, 0, 0):
|
||||
case IP_VERSION(3, 0, 2):
|
||||
adev->mode_info.num_crtc = 5;
|
||||
adev->mode_info.num_hpd = 5;
|
||||
adev->mode_info.num_dig = 5;
|
||||
break;
|
||||
case IP_VERSION(2, 0, 3):
|
||||
case IP_VERSION(3, 0, 3):
|
||||
adev->mode_info.num_crtc = 2;
|
||||
adev->mode_info.num_hpd = 2;
|
||||
adev->mode_info.num_dig = 2;
|
||||
break;
|
||||
case IP_VERSION(1, 0, 0):
|
||||
case IP_VERSION(1, 0, 1):
|
||||
case IP_VERSION(3, 0, 1):
|
||||
case IP_VERSION(2, 1, 0):
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
adev->mode_info.num_crtc = 4;
|
||||
adev->mode_info.num_hpd = 4;
|
||||
adev->mode_info.num_dig = 4;
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Unsupported DCE IP versions: 0x%x\n",
|
||||
adev->ip_versions[DCE_HWIP][0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
amdgpu_dm_set_irq_funcs(adev);
|
||||
@@ -4590,12 +4626,7 @@ fill_gfx9_tiling_info_from_device(const struct amdgpu_device *adev,
|
||||
tiling_info->gfx9.num_rb_per_se =
|
||||
adev->gfx.config.gb_addr_config_fields.num_rb_per_se;
|
||||
tiling_info->gfx9.shaderEnable = 1;
|
||||
if (adev->asic_type == CHIP_SIENNA_CICHLID ||
|
||||
adev->asic_type == CHIP_NAVY_FLOUNDER ||
|
||||
adev->asic_type == CHIP_DIMGREY_CAVEFISH ||
|
||||
adev->asic_type == CHIP_BEIGE_GOBY ||
|
||||
adev->asic_type == CHIP_YELLOW_CARP ||
|
||||
adev->asic_type == CHIP_VANGOGH)
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0))
|
||||
tiling_info->gfx9.num_pkrs = adev->gfx.config.gb_addr_config_fields.num_pkrs;
|
||||
}
|
||||
|
||||
@@ -5036,7 +5067,7 @@ get_plane_modifiers(const struct amdgpu_device *adev, unsigned int plane_type, u
|
||||
case AMDGPU_FAMILY_NV:
|
||||
case AMDGPU_FAMILY_VGH:
|
||||
case AMDGPU_FAMILY_YC:
|
||||
if (adev->asic_type >= CHIP_SIENNA_CICHLID)
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0))
|
||||
add_gfx10_3_modifiers(adev, mods, &size, &capacity);
|
||||
else
|
||||
add_gfx10_1_modifiers(adev, mods, &size, &capacity);
|
||||
@@ -5081,11 +5112,11 @@ fill_gfx9_plane_attributes_from_modifiers(struct amdgpu_device *adev,
|
||||
dcc->independent_64b_blks = independent_64b_blks;
|
||||
if (AMD_FMT_MOD_GET(TILE_VERSION, modifier) == AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS) {
|
||||
if (independent_64b_blks && independent_128b_blks)
|
||||
dcc->dcc_ind_blk = hubp_ind_block_64b;
|
||||
dcc->dcc_ind_blk = hubp_ind_block_64b_no_128bcl;
|
||||
else if (independent_128b_blks)
|
||||
dcc->dcc_ind_blk = hubp_ind_block_128b;
|
||||
else if (independent_64b_blks && !independent_128b_blks)
|
||||
dcc->dcc_ind_blk = hubp_ind_block_64b_no_128bcl;
|
||||
dcc->dcc_ind_blk = hubp_ind_block_64b;
|
||||
else
|
||||
dcc->dcc_ind_blk = hubp_ind_block_unconstrained;
|
||||
} else {
|
||||
@@ -5987,7 +6018,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
|
||||
* - Cinema HFR (48 FPS)
|
||||
* - TV/PAL (50 FPS)
|
||||
* - Commonly used (60 FPS)
|
||||
* - Multiples of 24 (48,72,96 FPS)
|
||||
* - Multiples of 24 (48,72,96,120 FPS)
|
||||
*
|
||||
* The list of standards video format is not huge and can be added to the
|
||||
* connector modeset list beforehand. With that, userspace can leverage
|
||||
@@ -7949,19 +7980,19 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector)
|
||||
|
||||
/* Standard FPS values
|
||||
*
|
||||
* 23.976 - TV/NTSC
|
||||
* 24 - Cinema
|
||||
* 25 - TV/PAL
|
||||
* 29.97 - TV/NTSC
|
||||
* 30 - TV/NTSC
|
||||
* 48 - Cinema HFR
|
||||
* 50 - TV/PAL
|
||||
* 60 - Commonly used
|
||||
* 48,72,96 - Multiples of 24
|
||||
* 23.976 - TV/NTSC
|
||||
* 24 - Cinema
|
||||
* 25 - TV/PAL
|
||||
* 29.97 - TV/NTSC
|
||||
* 30 - TV/NTSC
|
||||
* 48 - Cinema HFR
|
||||
* 50 - TV/PAL
|
||||
* 60 - Commonly used
|
||||
* 48,72,96,120 - Multiples of 24
|
||||
*/
|
||||
static const uint32_t common_rates[] = {
|
||||
23976, 24000, 25000, 29970, 30000,
|
||||
48000, 50000, 60000, 72000, 96000
|
||||
48000, 50000, 60000, 72000, 96000, 120000
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -8089,7 +8120,17 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_DisplayPort:
|
||||
aconnector->base.polled = DRM_CONNECTOR_POLL_HPD;
|
||||
aconnector->base.ycbcr_420_allowed =
|
||||
if (link->is_dig_mapping_flexible &&
|
||||
link->dc->res_pool->funcs->link_encs_assign) {
|
||||
link->link_enc =
|
||||
link_enc_cfg_get_link_enc_used_by_link(link->ctx->dc, link);
|
||||
if (!link->link_enc)
|
||||
link->link_enc =
|
||||
link_enc_cfg_get_next_avail_link_enc(link->ctx->dc);
|
||||
}
|
||||
|
||||
if (link->link_enc)
|
||||
aconnector->base.ycbcr_420_allowed =
|
||||
link->link_enc->features.dp_ycbcr420_supported ? true : false;
|
||||
break;
|
||||
case DRM_MODE_CONNECTOR_DVID:
|
||||
@@ -8204,7 +8245,8 @@ create_i2c(struct ddc_service *ddc_service,
|
||||
snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
|
||||
i2c_set_adapdata(&i2c->base, i2c);
|
||||
i2c->ddc_service = ddc_service;
|
||||
i2c->ddc_service->ddc_pin->hw_info.ddc_channel = link_index;
|
||||
if (i2c->ddc_service->ddc_pin)
|
||||
i2c->ddc_service->ddc_pin->hw_info.ddc_channel = link_index;
|
||||
|
||||
return i2c;
|
||||
}
|
||||
@@ -11321,29 +11363,75 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,
|
||||
return value;
|
||||
}
|
||||
|
||||
int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int linkIndex,
|
||||
struct aux_payload *payload, enum aux_return_code_type *operation_result)
|
||||
int amdgpu_dm_set_dmub_async_sync_status(bool is_cmd_aux, struct dc_context *ctx,
|
||||
uint8_t status_type, uint32_t *operation_result)
|
||||
{
|
||||
struct amdgpu_device *adev = ctx->driver_context;
|
||||
int return_status = -1;
|
||||
struct dmub_notification *p_notify = adev->dm.dmub_notify;
|
||||
|
||||
if (is_cmd_aux) {
|
||||
if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS) {
|
||||
return_status = p_notify->aux_reply.length;
|
||||
*operation_result = p_notify->result;
|
||||
} else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT) {
|
||||
*operation_result = AUX_RET_ERROR_TIMEOUT;
|
||||
} else if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_FAIL) {
|
||||
*operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE;
|
||||
} else {
|
||||
*operation_result = AUX_RET_ERROR_UNKNOWN;
|
||||
}
|
||||
} else {
|
||||
if (status_type == DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS) {
|
||||
return_status = 0;
|
||||
*operation_result = p_notify->sc_status;
|
||||
} else {
|
||||
*operation_result = SET_CONFIG_UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return return_status;
|
||||
}
|
||||
|
||||
int amdgpu_dm_process_dmub_aux_transfer_sync(bool is_cmd_aux, struct dc_context *ctx,
|
||||
unsigned int link_index, void *cmd_payload, void *operation_result)
|
||||
{
|
||||
struct amdgpu_device *adev = ctx->driver_context;
|
||||
int ret = 0;
|
||||
|
||||
dc_process_dmub_aux_transfer_async(ctx->dc, linkIndex, payload);
|
||||
ret = wait_for_completion_interruptible_timeout(&adev->dm.dmub_aux_transfer_done, 10*HZ);
|
||||
if (is_cmd_aux) {
|
||||
dc_process_dmub_aux_transfer_async(ctx->dc,
|
||||
link_index, (struct aux_payload *)cmd_payload);
|
||||
} else if (dc_process_dmub_set_config_async(ctx->dc, link_index,
|
||||
(struct set_config_cmd_payload *)cmd_payload,
|
||||
adev->dm.dmub_notify)) {
|
||||
return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
|
||||
ctx, DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS,
|
||||
(uint32_t *)operation_result);
|
||||
}
|
||||
|
||||
ret = wait_for_completion_timeout(&adev->dm.dmub_aux_transfer_done, 10 * HZ);
|
||||
if (ret == 0) {
|
||||
*operation_result = AUX_RET_ERROR_TIMEOUT;
|
||||
return -1;
|
||||
}
|
||||
*operation_result = (enum aux_return_code_type)adev->dm.dmub_notify->result;
|
||||
|
||||
if (adev->dm.dmub_notify->result == AUX_RET_SUCCESS) {
|
||||
(*payload->reply) = adev->dm.dmub_notify->aux_reply.command;
|
||||
|
||||
// For read case, Copy data to payload
|
||||
if (!payload->write && adev->dm.dmub_notify->aux_reply.length &&
|
||||
(*payload->reply == AUX_TRANSACTION_REPLY_AUX_ACK))
|
||||
memcpy(payload->data, adev->dm.dmub_notify->aux_reply.data,
|
||||
adev->dm.dmub_notify->aux_reply.length);
|
||||
DRM_ERROR("wait_for_completion_timeout timeout!");
|
||||
return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
|
||||
ctx, DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT,
|
||||
(uint32_t *)operation_result);
|
||||
}
|
||||
|
||||
return adev->dm.dmub_notify->aux_reply.length;
|
||||
if (is_cmd_aux) {
|
||||
if (adev->dm.dmub_notify->result == AUX_RET_SUCCESS) {
|
||||
struct aux_payload *payload = (struct aux_payload *)cmd_payload;
|
||||
|
||||
payload->reply[0] = adev->dm.dmub_notify->aux_reply.command;
|
||||
if (!payload->write && adev->dm.dmub_notify->aux_reply.length &&
|
||||
payload->reply[0] == AUX_TRANSACTION_REPLY_AUX_ACK) {
|
||||
memcpy(payload->data, adev->dm.dmub_notify->aux_reply.data,
|
||||
adev->dm.dmub_notify->aux_reply.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return amdgpu_dm_set_dmub_async_sync_status(is_cmd_aux,
|
||||
ctx, DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS,
|
||||
(uint32_t *)operation_result);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,13 @@
|
||||
#define AMDGPU_DM_MAX_NUM_EDP 2
|
||||
|
||||
#define AMDGPU_DMUB_NOTIFICATION_MAX 5
|
||||
|
||||
/**
|
||||
* DMUB Async to Sync Mechanism Status
|
||||
**/
|
||||
#define DMUB_ASYNC_TO_SYNC_ACCESS_FAIL 1
|
||||
#define DMUB_ASYNC_TO_SYNC_ACCESS_TIMEOUT 2
|
||||
#define DMUB_ASYNC_TO_SYNC_ACCESS_SUCCESS 3
|
||||
/*
|
||||
#include "include/amdgpu_dal_power_if.h"
|
||||
#include "amdgpu_dm_irq.h"
|
||||
@@ -721,6 +728,7 @@ void amdgpu_dm_update_connector_after_detect(
|
||||
|
||||
extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs;
|
||||
|
||||
int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int linkIndex,
|
||||
struct aux_payload *payload, enum aux_return_code_type *operation_result);
|
||||
int amdgpu_dm_process_dmub_aux_transfer_sync(bool is_cmd_aux,
|
||||
struct dc_context *ctx, unsigned int link_index,
|
||||
void *payload, void *operation_result);
|
||||
#endif /* __AMDGPU_DM_H__ */
|
||||
|
||||
@@ -379,9 +379,9 @@ static ssize_t dp_phy_settings_read(struct file *f, char __user *buf,
|
||||
return -EINVAL;
|
||||
|
||||
snprintf(rd_buf, rd_buf_size, " %d %d %d\n",
|
||||
link->cur_lane_setting.VOLTAGE_SWING,
|
||||
link->cur_lane_setting.PRE_EMPHASIS,
|
||||
link->cur_lane_setting.POST_CURSOR2);
|
||||
link->cur_lane_setting[0].VOLTAGE_SWING,
|
||||
link->cur_lane_setting[0].PRE_EMPHASIS,
|
||||
link->cur_lane_setting[0].POST_CURSOR2);
|
||||
|
||||
while (size) {
|
||||
if (*pos >= rd_buf_size)
|
||||
@@ -733,7 +733,7 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __us
|
||||
}
|
||||
|
||||
for (i = 0; i < (unsigned int)(link_training_settings.link_settings.lane_count); i++)
|
||||
link_training_settings.lane_settings[i] = link->cur_lane_setting;
|
||||
link_training_settings.lane_settings[i] = link->cur_lane_setting[i];
|
||||
|
||||
dc_link_set_test_pattern(
|
||||
link,
|
||||
|
||||
@@ -683,8 +683,21 @@ int dm_helper_dmub_aux_transfer_sync(
|
||||
struct aux_payload *payload,
|
||||
enum aux_return_code_type *operation_result)
|
||||
{
|
||||
return amdgpu_dm_process_dmub_aux_transfer_sync(ctx, link->link_index, payload, operation_result);
|
||||
return amdgpu_dm_process_dmub_aux_transfer_sync(true, ctx,
|
||||
link->link_index, (void *)payload,
|
||||
(void *)operation_result);
|
||||
}
|
||||
|
||||
int dm_helpers_dmub_set_config_sync(struct dc_context *ctx,
|
||||
const struct dc_link *link,
|
||||
struct set_config_cmd_payload *payload,
|
||||
enum set_config_status *operation_result)
|
||||
{
|
||||
return amdgpu_dm_process_dmub_aux_transfer_sync(false, ctx,
|
||||
link->link_index, (void *)payload,
|
||||
(void *)operation_result);
|
||||
}
|
||||
|
||||
void dm_set_dcn_clocks(struct dc_context *ctx, struct dc_clocks *clks)
|
||||
{
|
||||
/* TODO: something */
|
||||
@@ -799,4 +812,4 @@ void dm_helpers_enable_periodic_detection(struct dc_context *ctx, bool enable)
|
||||
{
|
||||
/* TODO: add peridic detection implementation */
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ static DEFINE_PER_CPU(int, fpu_recursion_depth);
|
||||
* This function tells if the code is already under FPU protection or not. A
|
||||
* function that works as an API for a set of FPU operations can use this
|
||||
* function for checking if the caller invoked it after DC_FP_START(). For
|
||||
* example, take a look at dcn2x.c file.
|
||||
* example, take a look at dcn20_fpu.c file.
|
||||
*/
|
||||
inline void dc_assert_fp_enabled(void)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ DC_LIBS += dcn20
|
||||
DC_LIBS += dsc
|
||||
DC_LIBS += dcn10 dml
|
||||
DC_LIBS += dcn21
|
||||
DC_LIBS += dcn201
|
||||
DC_LIBS += dcn30
|
||||
DC_LIBS += dcn301
|
||||
DC_LIBS += dcn302
|
||||
@@ -58,7 +59,7 @@ include $(AMD_DC)
|
||||
|
||||
DISPLAY_CORE = dc.o dc_stat.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_sink.o \
|
||||
dc_surface.o dc_link_hwss.o dc_link_dp.o dc_link_ddc.o dc_debug.o dc_stream.o \
|
||||
dc_link_enc_cfg.o dc_link_dpcd.o
|
||||
dc_link_enc_cfg.o dc_link_dpia.o dc_link_dpcd.o
|
||||
|
||||
ifdef CONFIG_DRM_AMD_DC_DCN
|
||||
DISPLAY_CORE += dc_vm_helper.o
|
||||
|
||||
@@ -44,9 +44,7 @@
|
||||
bp->base.ctx->logger
|
||||
|
||||
#define GET_INDEX_INTO_MASTER_TABLE(MasterOrData, FieldName)\
|
||||
(((char *)(&((\
|
||||
struct atom_master_list_of_##MasterOrData##_functions_v2_1 *)0)\
|
||||
->FieldName)-(char *)0)/sizeof(uint16_t))
|
||||
(offsetof(struct atom_master_list_of_##MasterOrData##_functions_v2_1, FieldName) / sizeof(uint16_t))
|
||||
|
||||
#define EXEC_BIOS_CMD_TABLE(fname, params)\
|
||||
(amdgpu_atom_execute_table(((struct amdgpu_device *)bp->base.ctx->driver_context)->mode_info.atom_context, \
|
||||
|
||||
@@ -70,6 +70,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(
|
||||
case DCN_VERSION_1_01:
|
||||
case DCN_VERSION_2_0:
|
||||
case DCN_VERSION_2_1:
|
||||
case DCN_VERSION_2_01:
|
||||
case DCN_VERSION_3_0:
|
||||
case DCN_VERSION_3_01:
|
||||
case DCN_VERSION_3_02:
|
||||
|
||||
@@ -93,6 +93,15 @@ AMD_DAL_CLK_MGR_DCN20 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn20/,$(CLK_MGR_DC
|
||||
|
||||
AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN20)
|
||||
|
||||
###############################################################################
|
||||
# DCN201
|
||||
###############################################################################
|
||||
CLK_MGR_DCN201 = dcn201_clk_mgr.o
|
||||
|
||||
AMD_DAL_CLK_MGR_DCN201 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn201/,$(CLK_MGR_DCN201))
|
||||
|
||||
AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN201)
|
||||
|
||||
###############################################################################
|
||||
# DCN21
|
||||
###############################################################################
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "dcn10/rv2_clk_mgr.h"
|
||||
#include "dcn20/dcn20_clk_mgr.h"
|
||||
#include "dcn21/rn_clk_mgr.h"
|
||||
#include "dcn201/dcn201_clk_mgr.h"
|
||||
#include "dcn30/dcn30_clk_mgr.h"
|
||||
#include "dcn301/vg_clk_mgr.h"
|
||||
#include "dcn31/dcn31_clk_mgr.h"
|
||||
@@ -256,6 +257,10 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
|
||||
dcn3_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
|
||||
return &clk_mgr->base;
|
||||
}
|
||||
if (asic_id.chip_id == DEVICE_ID_NV_13FE) {
|
||||
dcn201_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
|
||||
return &clk_mgr->base;
|
||||
}
|
||||
dcn20_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
|
||||
return &clk_mgr->base;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,
|
||||
pp_smu = &dc->res_pool->pp_smu->nv_funcs;
|
||||
|
||||
for (irq_src = DC_IRQ_SOURCE_HPD1; irq_src <= DC_IRQ_SOURCE_HPD6; irq_src++) {
|
||||
hpd_state = dal_get_hpd_state_dcn20(dc->res_pool->irqs, irq_src);
|
||||
hpd_state = dc_get_hpd_state_dcn20(dc->res_pool->irqs, irq_src);
|
||||
if (hpd_state)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright 2018 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: AMD
|
||||
*
|
||||
*/
|
||||
|
||||
#include "reg_helper.h"
|
||||
#include "core_types.h"
|
||||
#include "dccg.h"
|
||||
#include "clk_mgr_internal.h"
|
||||
#include "dcn201_clk_mgr.h"
|
||||
#include "dcn20/dcn20_clk_mgr.h"
|
||||
#include "dce100/dce_clk_mgr.h"
|
||||
#include "dm_helpers.h"
|
||||
#include "dm_services.h"
|
||||
|
||||
#include "cyan_skillfish_ip_offset.h"
|
||||
#include "dcn/dcn_2_0_3_offset.h"
|
||||
#include "dcn/dcn_2_0_3_sh_mask.h"
|
||||
#include "clk/clk_11_0_1_offset.h"
|
||||
#include "clk/clk_11_0_1_sh_mask.h"
|
||||
|
||||
#define REG(reg) \
|
||||
(clk_mgr->regs->reg)
|
||||
|
||||
#define BASE_INNER(seg) DMU_BASE__INST0_SEG ## seg
|
||||
|
||||
#define BASE(seg) BASE_INNER(seg)
|
||||
|
||||
#define SR(reg_name)\
|
||||
.reg_name = BASE(mm ## reg_name ## _BASE_IDX) + \
|
||||
mm ## reg_name
|
||||
|
||||
#define CLK_BASE_INNER(seg) \
|
||||
CLK_BASE__INST0_SEG ## seg
|
||||
|
||||
#undef FN
|
||||
#define FN(reg_name, field_name) \
|
||||
clk_mgr->clk_mgr_shift->field_name, clk_mgr->clk_mgr_mask->field_name
|
||||
|
||||
#define CTX \
|
||||
clk_mgr->base.ctx
|
||||
#define DC_LOGGER \
|
||||
clk_mgr->base.ctx->logger
|
||||
|
||||
static const struct clk_mgr_registers clk_mgr_regs = {
|
||||
CLK_COMMON_REG_LIST_DCN_201()
|
||||
};
|
||||
|
||||
static const struct clk_mgr_shift clk_mgr_shift = {
|
||||
CLK_COMMON_MASK_SH_LIST_DCN201_BASE(__SHIFT)
|
||||
};
|
||||
|
||||
static const struct clk_mgr_mask clk_mgr_mask = {
|
||||
CLK_COMMON_MASK_SH_LIST_DCN201_BASE(_MASK)
|
||||
};
|
||||
|
||||
void dcn201_update_clocks_vbios(struct clk_mgr *clk_mgr,
|
||||
struct dc_state *context,
|
||||
bool safe_to_lower)
|
||||
{
|
||||
struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
|
||||
|
||||
bool update_dppclk = false;
|
||||
bool update_dispclk = false;
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->clks.dppclk_khz)) {
|
||||
clk_mgr->clks.dppclk_khz = new_clocks->dppclk_khz;
|
||||
update_dppclk = true;
|
||||
}
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr->clks.dispclk_khz)) {
|
||||
clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz;
|
||||
update_dispclk = true;
|
||||
}
|
||||
|
||||
if (update_dppclk || update_dispclk) {
|
||||
struct bp_set_dce_clock_parameters dce_clk_params;
|
||||
struct dc_bios *bp = clk_mgr->ctx->dc_bios;
|
||||
|
||||
if (update_dispclk) {
|
||||
memset(&dce_clk_params, 0, sizeof(dce_clk_params));
|
||||
dce_clk_params.target_clock_frequency = new_clocks->dispclk_khz;
|
||||
dce_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
|
||||
dce_clk_params.clock_type = DCECLOCK_TYPE_DISPLAY_CLOCK;
|
||||
bp->funcs->set_dce_clock(bp, &dce_clk_params);
|
||||
}
|
||||
/* currently there is no DCECLOCK_TYPE_DPPCLK type defined in VBIOS interface.
|
||||
* vbios program DPPCLK to the same DispCLK limitation
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static void dcn201_init_clocks(struct clk_mgr *clk_mgr)
|
||||
{
|
||||
memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
|
||||
clk_mgr->clks.p_state_change_support = true;
|
||||
clk_mgr->clks.prev_p_state_change_support = true;
|
||||
clk_mgr->clks.max_supported_dppclk_khz = 1200000;
|
||||
clk_mgr->clks.max_supported_dispclk_khz = 1200000;
|
||||
}
|
||||
|
||||
static void dcn201_update_clocks(struct clk_mgr *clk_mgr_base,
|
||||
struct dc_state *context,
|
||||
bool safe_to_lower)
|
||||
{
|
||||
struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
|
||||
struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
|
||||
struct dc *dc = clk_mgr_base->ctx->dc;
|
||||
int display_count;
|
||||
bool update_dppclk = false;
|
||||
bool update_dispclk = false;
|
||||
bool enter_display_off = false;
|
||||
bool dpp_clock_lowered = false;
|
||||
bool force_reset = false;
|
||||
bool p_state_change_support;
|
||||
int total_plane_count;
|
||||
|
||||
if (dc->work_arounds.skip_clock_update)
|
||||
return;
|
||||
|
||||
if (clk_mgr_base->clks.dispclk_khz == 0 ||
|
||||
dc->debug.force_clock_mode & 0x1) {
|
||||
force_reset = true;
|
||||
|
||||
dcn2_read_clocks_from_hw_dentist(clk_mgr_base);
|
||||
}
|
||||
|
||||
display_count = clk_mgr_helper_get_active_display_cnt(dc, context);
|
||||
|
||||
if (display_count == 0)
|
||||
enter_display_off = true;
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->phyclk_khz, clk_mgr_base->clks.phyclk_khz))
|
||||
clk_mgr_base->clks.phyclk_khz = new_clocks->phyclk_khz;
|
||||
|
||||
if (dc->debug.force_min_dcfclk_mhz > 0)
|
||||
new_clocks->dcfclk_khz = (new_clocks->dcfclk_khz > (dc->debug.force_min_dcfclk_mhz * 1000)) ?
|
||||
new_clocks->dcfclk_khz : (dc->debug.force_min_dcfclk_mhz * 1000);
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz))
|
||||
clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz;
|
||||
|
||||
if (should_set_clock(safe_to_lower,
|
||||
new_clocks->dcfclk_deep_sleep_khz, clk_mgr_base->clks.dcfclk_deep_sleep_khz))
|
||||
clk_mgr_base->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz;
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->socclk_khz, clk_mgr_base->clks.socclk_khz))
|
||||
clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz;
|
||||
|
||||
total_plane_count = clk_mgr_helper_get_active_plane_cnt(dc, context);
|
||||
p_state_change_support = new_clocks->p_state_change_support || (total_plane_count == 0);
|
||||
if (should_update_pstate_support(safe_to_lower, p_state_change_support, clk_mgr_base->clks.p_state_change_support)) {
|
||||
clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support;
|
||||
clk_mgr_base->clks.p_state_change_support = p_state_change_support;
|
||||
}
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dramclk_khz, clk_mgr_base->clks.dramclk_khz))
|
||||
clk_mgr_base->clks.dramclk_khz = new_clocks->dramclk_khz;
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
|
||||
if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
|
||||
dpp_clock_lowered = true;
|
||||
clk_mgr->base.clks.dppclk_khz = new_clocks->dppclk_khz;
|
||||
|
||||
update_dppclk = true;
|
||||
}
|
||||
|
||||
if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
|
||||
clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
|
||||
|
||||
update_dispclk = true;
|
||||
}
|
||||
|
||||
if (dc->config.forced_clocks == false || (force_reset && safe_to_lower)) {
|
||||
if (dpp_clock_lowered) {
|
||||
dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
|
||||
dcn20_update_clocks_update_dentist(clk_mgr, context);
|
||||
} else {
|
||||
if (update_dppclk || update_dispclk)
|
||||
dcn20_update_clocks_update_dentist(clk_mgr, context);
|
||||
if (new_clocks->dppclk_khz >= dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz)
|
||||
dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct clk_mgr_funcs dcn201_funcs = {
|
||||
.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
|
||||
.update_clocks = dcn201_update_clocks,
|
||||
.init_clocks = dcn201_init_clocks,
|
||||
.get_clock = dcn2_get_clock,
|
||||
};
|
||||
|
||||
void dcn201_clk_mgr_construct(struct dc_context *ctx,
|
||||
struct clk_mgr_internal *clk_mgr,
|
||||
struct pp_smu_funcs *pp_smu,
|
||||
struct dccg *dccg)
|
||||
{
|
||||
struct dc_debug_options *debug = &ctx->dc->debug;
|
||||
struct dc_bios *bp = ctx->dc_bios;
|
||||
clk_mgr->base.ctx = ctx;
|
||||
clk_mgr->base.funcs = &dcn201_funcs;
|
||||
clk_mgr->regs = &clk_mgr_regs;
|
||||
clk_mgr->clk_mgr_shift = &clk_mgr_shift;
|
||||
clk_mgr->clk_mgr_mask = &clk_mgr_mask;
|
||||
|
||||
clk_mgr->dccg = dccg;
|
||||
|
||||
clk_mgr->dfs_bypass_disp_clk = 0;
|
||||
|
||||
clk_mgr->dprefclk_ss_percentage = 0;
|
||||
clk_mgr->dprefclk_ss_divider = 1000;
|
||||
clk_mgr->ss_on_dprefclk = false;
|
||||
|
||||
if (IS_FPGA_MAXIMUS_DC(ctx->dce_environment)) {
|
||||
dcn201_funcs.update_clocks = dcn2_update_clocks_fpga;
|
||||
clk_mgr->base.dprefclk_khz = 600000;
|
||||
clk_mgr->base.dentist_vco_freq_khz = 3000000;
|
||||
} else {
|
||||
clk_mgr->base.dprefclk_khz = REG_READ(CLK4_CLK2_CURRENT_CNT);
|
||||
clk_mgr->base.dprefclk_khz *= 100;
|
||||
|
||||
if (clk_mgr->base.dprefclk_khz == 0)
|
||||
clk_mgr->base.dprefclk_khz = 600000;
|
||||
|
||||
REG_GET(CLK4_CLK_PLL_REQ, FbMult_int, &clk_mgr->base.dentist_vco_freq_khz);
|
||||
clk_mgr->base.dentist_vco_freq_khz *= 100000;
|
||||
|
||||
if (clk_mgr->base.dentist_vco_freq_khz == 0)
|
||||
clk_mgr->base.dentist_vco_freq_khz = 3000000;
|
||||
}
|
||||
|
||||
if (!debug->disable_dfs_bypass && bp->integrated_info)
|
||||
if (bp->integrated_info->gpu_cap_info & DFS_BYPASS_ENABLE)
|
||||
clk_mgr->dfs_bypass_enabled = true;
|
||||
|
||||
dce_clock_read_ss_info(clk_mgr);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2018 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: AMD
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DCN201_CLK_MGR_H__
|
||||
#define __DCN201_CLK_MGR_H__
|
||||
|
||||
void dcn201_clk_mgr_construct(struct dc_context *ctx,
|
||||
struct clk_mgr_internal *clk_mgr,
|
||||
struct pp_smu_funcs *pp_smu,
|
||||
struct dccg *dccg);
|
||||
|
||||
#endif //__DCN201_CLK_MGR_H__
|
||||
@@ -152,7 +152,7 @@ void rn_update_clocks(struct clk_mgr *clk_mgr_base,
|
||||
display_count = rn_get_active_display_cnt_wa(dc, context);
|
||||
|
||||
for (irq_src = DC_IRQ_SOURCE_HPD1; irq_src <= DC_IRQ_SOURCE_HPD5; irq_src++) {
|
||||
hpd_state = dal_get_hpd_state_dcn21(dc->res_pool->irqs, irq_src);
|
||||
hpd_state = dc_get_hpd_state_dcn21(dc->res_pool->irqs, irq_src);
|
||||
if (hpd_state)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -231,6 +231,25 @@ static bool create_links(
|
||||
|
||||
DC_LOG_DC("BIOS object table - end");
|
||||
|
||||
/* Create a link for each usb4 dpia port */
|
||||
for (i = 0; i < dc->res_pool->usb4_dpia_count; i++) {
|
||||
struct link_init_data link_init_params = {0};
|
||||
struct dc_link *link;
|
||||
|
||||
link_init_params.ctx = dc->ctx;
|
||||
link_init_params.connector_index = i;
|
||||
link_init_params.link_index = dc->link_count;
|
||||
link_init_params.dc = dc;
|
||||
link_init_params.is_dpia_link = true;
|
||||
|
||||
link = link_create(&link_init_params);
|
||||
if (link) {
|
||||
dc->links[dc->link_count] = link;
|
||||
link->dc = dc;
|
||||
++dc->link_count;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_virtual_links; i++) {
|
||||
struct dc_link *link = kzalloc(sizeof(*link), GFP_KERNEL);
|
||||
struct encoder_init_data enc_init = {0};
|
||||
@@ -296,6 +315,75 @@ failed_alloc:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Create additional DIG link encoder objects if fewer than the platform
|
||||
* supports were created during link construction. This can happen if the
|
||||
* number of physical connectors is less than the number of DIGs.
|
||||
*/
|
||||
static bool create_link_encoders(struct dc *dc)
|
||||
{
|
||||
bool res = true;
|
||||
unsigned int num_usb4_dpia = dc->res_pool->res_cap->num_usb4_dpia;
|
||||
unsigned int num_dig_link_enc = dc->res_pool->res_cap->num_dig_link_enc;
|
||||
int i;
|
||||
|
||||
/* A platform without USB4 DPIA endpoints has a fixed mapping between DIG
|
||||
* link encoders and physical display endpoints and does not require
|
||||
* additional link encoder objects.
|
||||
*/
|
||||
if (num_usb4_dpia == 0)
|
||||
return res;
|
||||
|
||||
/* Create as many link encoder objects as the platform supports. DPIA
|
||||
* endpoints can be programmably mapped to any DIG.
|
||||
*/
|
||||
if (num_dig_link_enc > dc->res_pool->dig_link_enc_count) {
|
||||
for (i = 0; i < num_dig_link_enc; i++) {
|
||||
struct link_encoder *link_enc = dc->res_pool->link_encoders[i];
|
||||
|
||||
if (!link_enc && dc->res_pool->funcs->link_enc_create_minimal) {
|
||||
link_enc = dc->res_pool->funcs->link_enc_create_minimal(dc->ctx,
|
||||
(enum engine_id)(ENGINE_ID_DIGA + i));
|
||||
if (link_enc) {
|
||||
dc->res_pool->link_encoders[i] = link_enc;
|
||||
dc->res_pool->dig_link_enc_count++;
|
||||
} else {
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Destroy any additional DIG link encoder objects created by
|
||||
* create_link_encoders().
|
||||
* NB: Must only be called after destroy_links().
|
||||
*/
|
||||
static void destroy_link_encoders(struct dc *dc)
|
||||
{
|
||||
unsigned int num_usb4_dpia = dc->res_pool->res_cap->num_usb4_dpia;
|
||||
unsigned int num_dig_link_enc = dc->res_pool->res_cap->num_dig_link_enc;
|
||||
int i;
|
||||
|
||||
/* A platform without USB4 DPIA endpoints has a fixed mapping between DIG
|
||||
* link encoders and physical display endpoints and does not require
|
||||
* additional link encoder objects.
|
||||
*/
|
||||
if (num_usb4_dpia == 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num_dig_link_enc; i++) {
|
||||
struct link_encoder *link_enc = dc->res_pool->link_encoders[i];
|
||||
|
||||
if (link_enc) {
|
||||
link_enc->funcs->destroy(&link_enc);
|
||||
dc->res_pool->link_encoders[i] = NULL;
|
||||
dc->res_pool->dig_link_enc_count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct dc_perf_trace *dc_perf_trace_create(void)
|
||||
{
|
||||
return kzalloc(sizeof(struct dc_perf_trace), GFP_KERNEL);
|
||||
@@ -729,6 +817,8 @@ static void dc_destruct(struct dc *dc)
|
||||
|
||||
destroy_links(dc);
|
||||
|
||||
destroy_link_encoders(dc);
|
||||
|
||||
if (dc->clk_mgr) {
|
||||
dc_destroy_clk_mgr(dc->clk_mgr);
|
||||
dc->clk_mgr = NULL;
|
||||
@@ -933,6 +1023,12 @@ static bool dc_construct(struct dc *dc,
|
||||
if (!create_links(dc, init_params->num_virtual_links))
|
||||
goto fail;
|
||||
|
||||
/* Create additional DIG link encoder objects if fewer than the platform
|
||||
* supports were created during link construction.
|
||||
*/
|
||||
if (!create_link_encoders(dc))
|
||||
goto fail;
|
||||
|
||||
/* Initialise DIG link encoder resource tracking variables. */
|
||||
link_enc_cfg_init(dc, dc->current_state);
|
||||
|
||||
@@ -1793,6 +1889,25 @@ static bool is_flip_pending_in_pipes(struct dc *dc, struct dc_state *context)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Perform updates here which need to be deferred until next vupdate
|
||||
*
|
||||
* i.e. blnd lut, 3dlut, and shaper lut bypass regs are double buffered
|
||||
* but forcing lut memory to shutdown state is immediate. This causes
|
||||
* single frame corruption as lut gets disabled mid-frame unless shutdown
|
||||
* is deferred until after entering bypass.
|
||||
*/
|
||||
static void process_deferred_updates(struct dc *dc)
|
||||
{
|
||||
#ifdef CONFIG_DRM_AMD_DC_DCN
|
||||
int i;
|
||||
|
||||
if (dc->debug.enable_mem_low_power.bits.cm)
|
||||
for (i = 0; i < dc->dcn_ip->max_num_dpp; i++)
|
||||
if (dc->res_pool->dpps[i]->funcs->dpp_deferred_update)
|
||||
dc->res_pool->dpps[i]->funcs->dpp_deferred_update(dc->res_pool->dpps[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void dc_post_update_surfaces_to_stream(struct dc *dc)
|
||||
{
|
||||
int i;
|
||||
@@ -1818,6 +1933,8 @@ void dc_post_update_surfaces_to_stream(struct dc *dc)
|
||||
dc->hwss.disable_plane(dc, &context->res_ctx.pipe_ctx[i]);
|
||||
}
|
||||
|
||||
process_deferred_updates(dc);
|
||||
|
||||
dc->hwss.optimize_bandwidth(dc, context);
|
||||
|
||||
dc->optimized_required = false;
|
||||
@@ -3459,6 +3576,12 @@ void dc_hardware_release(struct dc *dc)
|
||||
*/
|
||||
bool dc_enable_dmub_notifications(struct dc *dc)
|
||||
{
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
/* YELLOW_CARP B0 USB4 DPIA needs dmub notifications for interrupts */
|
||||
if (dc->ctx->asic_id.chip_family == FAMILY_YELLOW_CARP &&
|
||||
dc->ctx->asic_id.hw_internal_rev == YELLOW_CARP_B0)
|
||||
return true;
|
||||
#endif
|
||||
/* dmub aux needs dmub notifications to be enabled */
|
||||
return dc->debug.enable_dmub_aux_for_legacy_ddc;
|
||||
}
|
||||
@@ -3484,7 +3607,12 @@ bool dc_process_dmub_aux_transfer_async(struct dc *dc,
|
||||
|
||||
cmd.dp_aux_access.header.type = DMUB_CMD__DP_AUX_ACCESS;
|
||||
cmd.dp_aux_access.header.payload_bytes = 0;
|
||||
cmd.dp_aux_access.aux_control.type = AUX_CHANNEL_LEGACY_DDC;
|
||||
/* For dpia, ddc_pin is set to NULL */
|
||||
if (!dc->links[link_index]->ddc->ddc_pin)
|
||||
cmd.dp_aux_access.aux_control.type = AUX_CHANNEL_DPIA;
|
||||
else
|
||||
cmd.dp_aux_access.aux_control.type = AUX_CHANNEL_LEGACY_DDC;
|
||||
|
||||
cmd.dp_aux_access.aux_control.instance = dc->links[link_index]->ddc_hw_inst;
|
||||
cmd.dp_aux_access.aux_control.sw_crc_enabled = 0;
|
||||
cmd.dp_aux_access.aux_control.timeout = 0;
|
||||
@@ -3528,6 +3656,76 @@ bool dc_process_dmub_aux_transfer_async(struct dc *dc,
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,
|
||||
uint8_t dpia_port_index)
|
||||
{
|
||||
uint8_t index, link_index = 0xFF;
|
||||
|
||||
for (index = 0; index < dc->link_count; index++) {
|
||||
/* ddc_hw_inst has dpia port index for dpia links
|
||||
* and ddc instance for legacy links
|
||||
*/
|
||||
if (!dc->links[index]->ddc->ddc_pin) {
|
||||
if (dc->links[index]->ddc_hw_inst == dpia_port_index) {
|
||||
link_index = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT(link_index != 0xFF);
|
||||
return link_index;
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_process_dmub_set_config_async
|
||||
*
|
||||
* @brief
|
||||
* Submits set_config command to dmub via inbox message
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] link_index: link index
|
||||
* [in] payload: aux payload
|
||||
* [out] notify: set_config immediate reply
|
||||
*
|
||||
* @return
|
||||
* True if successful, False if failure
|
||||
*****************************************************************************
|
||||
*/
|
||||
bool dc_process_dmub_set_config_async(struct dc *dc,
|
||||
uint32_t link_index,
|
||||
struct set_config_cmd_payload *payload,
|
||||
struct dmub_notification *notify)
|
||||
{
|
||||
union dmub_rb_cmd cmd = {0};
|
||||
struct dc_dmub_srv *dmub_srv = dc->ctx->dmub_srv;
|
||||
bool is_cmd_complete = true;
|
||||
|
||||
/* prepare SET_CONFIG command */
|
||||
cmd.set_config_access.header.type = DMUB_CMD__DPIA;
|
||||
cmd.set_config_access.header.sub_type = DMUB_CMD__DPIA_SET_CONFIG_ACCESS;
|
||||
|
||||
cmd.set_config_access.set_config_control.instance = dc->links[link_index]->ddc_hw_inst;
|
||||
cmd.set_config_access.set_config_control.cmd_pkt.msg_type = payload->msg_type;
|
||||
cmd.set_config_access.set_config_control.cmd_pkt.msg_data = payload->msg_data;
|
||||
|
||||
if (!dc_dmub_srv_cmd_with_reply_data(dmub_srv, &cmd)) {
|
||||
/* command is not processed by dmub */
|
||||
notify->sc_status = SET_CONFIG_UNKNOWN_ERROR;
|
||||
return is_cmd_complete;
|
||||
}
|
||||
|
||||
/* command processed by dmub, if ret_status is 1, it is completed instantly */
|
||||
if (cmd.set_config_access.header.ret_status == 1)
|
||||
notify->sc_status = cmd.set_config_access.set_config_control.immed_status;
|
||||
else
|
||||
/* cmd pending, will receive notification via outbox */
|
||||
is_cmd_complete = false;
|
||||
|
||||
return is_cmd_complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* dc_disable_accelerated_mode - disable accelerated mode
|
||||
* @dc: dc structure
|
||||
@@ -3536,3 +3734,57 @@ void dc_disable_accelerated_mode(struct dc *dc)
|
||||
{
|
||||
bios_set_scratch_acc_mode_change(dc->ctx->dc_bios, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* dc_notify_vsync_int_state() - notifies vsync enable/disable state
|
||||
* @dc: dc structure
|
||||
* @stream: stream where vsync int state changed
|
||||
* @enable: whether vsync is enabled or disabled
|
||||
*
|
||||
* Called when vsync is enabled/disabled
|
||||
* Will notify DMUB to start/stop ABM interrupts after steady state is reached
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable)
|
||||
{
|
||||
int i;
|
||||
int edp_num;
|
||||
struct pipe_ctx *pipe = NULL;
|
||||
struct dc_link *link = stream->sink->link;
|
||||
struct dc_link *edp_links[MAX_NUM_EDP];
|
||||
|
||||
|
||||
if (link->psr_settings.psr_feature_enabled)
|
||||
return;
|
||||
|
||||
/*find primary pipe associated with stream*/
|
||||
for (i = 0; i < MAX_PIPES; i++) {
|
||||
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
|
||||
|
||||
if (pipe->stream == stream && pipe->stream_res.tg)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAX_PIPES) {
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
|
||||
get_edp_links(dc, edp_links, &edp_num);
|
||||
|
||||
/* Determine panel inst */
|
||||
for (i = 0; i < edp_num; i++) {
|
||||
if (edp_links[i] == link)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == edp_num) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pipe->stream_res.abm && pipe->stream_res.abm->funcs->set_abm_pause)
|
||||
pipe->stream_res.abm->funcs->set_abm_pause(pipe->stream_res.abm, !enable, i, pipe->stream_res.tg->inst);
|
||||
}
|
||||
|
||||
@@ -1425,8 +1425,8 @@ static enum transmitter translate_encoder_to_transmitter(struct graphics_object_
|
||||
}
|
||||
}
|
||||
|
||||
static bool dc_link_construct(struct dc_link *link,
|
||||
const struct link_init_data *init_params)
|
||||
static bool dc_link_construct_legacy(struct dc_link *link,
|
||||
const struct link_init_data *init_params)
|
||||
{
|
||||
uint8_t i;
|
||||
struct ddc_service_init_data ddc_service_init_data = { { 0 } };
|
||||
@@ -1701,6 +1701,77 @@ create_fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool dc_link_construct_dpia(struct dc_link *link,
|
||||
const struct link_init_data *init_params)
|
||||
{
|
||||
struct ddc_service_init_data ddc_service_init_data = { { 0 } };
|
||||
struct dc_context *dc_ctx = init_params->ctx;
|
||||
|
||||
DC_LOGGER_INIT(dc_ctx->logger);
|
||||
|
||||
/* Initialized irq source for hpd and hpd rx */
|
||||
link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
|
||||
link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
|
||||
link->link_status.dpcd_caps = &link->dpcd_caps;
|
||||
|
||||
link->dc = init_params->dc;
|
||||
link->ctx = dc_ctx;
|
||||
link->link_index = init_params->link_index;
|
||||
|
||||
memset(&link->preferred_training_settings, 0,
|
||||
sizeof(struct dc_link_training_overrides));
|
||||
memset(&link->preferred_link_setting, 0,
|
||||
sizeof(struct dc_link_settings));
|
||||
|
||||
/* Dummy Init for linkid */
|
||||
link->link_id.type = OBJECT_TYPE_CONNECTOR;
|
||||
link->link_id.id = CONNECTOR_ID_DISPLAY_PORT;
|
||||
link->link_id.enum_id = ENUM_ID_1 + init_params->connector_index;
|
||||
link->is_internal_display = false;
|
||||
link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT;
|
||||
LINK_INFO("Connector[%d] description:signal %d\n",
|
||||
init_params->connector_index,
|
||||
link->connector_signal);
|
||||
|
||||
link->ep_type = DISPLAY_ENDPOINT_USB4_DPIA;
|
||||
link->is_dig_mapping_flexible = true;
|
||||
|
||||
/* TODO: Initialize link : funcs->link_init */
|
||||
|
||||
ddc_service_init_data.ctx = link->ctx;
|
||||
ddc_service_init_data.id = link->link_id;
|
||||
ddc_service_init_data.link = link;
|
||||
/* Set indicator for dpia link so that ddc won't be created */
|
||||
ddc_service_init_data.is_dpia_link = true;
|
||||
|
||||
link->ddc = dal_ddc_service_create(&ddc_service_init_data);
|
||||
if (!link->ddc) {
|
||||
DC_ERROR("Failed to create ddc_service!\n");
|
||||
goto ddc_create_fail;
|
||||
}
|
||||
|
||||
/* Set dpia port index : 0 to number of dpia ports */
|
||||
link->ddc_hw_inst = init_params->connector_index;
|
||||
|
||||
/* TODO: Create link encoder */
|
||||
|
||||
link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
|
||||
|
||||
return true;
|
||||
|
||||
ddc_create_fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool dc_link_construct(struct dc_link *link,
|
||||
const struct link_init_data *init_params)
|
||||
{
|
||||
/* Handle dpia case */
|
||||
if (init_params->is_dpia_link)
|
||||
return dc_link_construct_dpia(link, init_params);
|
||||
else
|
||||
return dc_link_construct_legacy(link, init_params);
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Public functions
|
||||
******************************************************************************/
|
||||
@@ -1791,6 +1862,12 @@ static enum dc_status enable_link_dp(struct dc_state *state,
|
||||
/* get link settings for video mode timing */
|
||||
decide_link_settings(stream, &link_settings);
|
||||
|
||||
/* Train with fallback when enabling DPIA link. Conventional links are
|
||||
* trained with fallback during sink detection.
|
||||
*/
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
|
||||
do_fallback = true;
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
if (dp_get_link_encoding_format(&link_settings) == DP_128b_132b_ENCODING &&
|
||||
pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT) {
|
||||
@@ -1906,6 +1983,51 @@ static enum dc_status enable_link_dp_mst(
|
||||
return enable_link_dp(state, pipe_ctx);
|
||||
}
|
||||
|
||||
void blank_all_dp_displays(struct dc *dc, bool hw_init)
|
||||
{
|
||||
unsigned int i, j, fe;
|
||||
uint8_t dpcd_power_state = '\0';
|
||||
enum dc_status status = DC_ERROR_UNEXPECTED;
|
||||
|
||||
for (i = 0; i < dc->link_count; i++) {
|
||||
enum signal_type signal = dc->links[i]->connector_signal;
|
||||
|
||||
if ((signal == SIGNAL_TYPE_EDP) ||
|
||||
(signal == SIGNAL_TYPE_DISPLAY_PORT)) {
|
||||
if (hw_init && signal != SIGNAL_TYPE_EDP && dc->links[i]->priv != NULL) {
|
||||
/* DP 2.0 spec requires that we read LTTPR caps first */
|
||||
dp_retrieve_lttpr_cap(dc->links[i]);
|
||||
/* if any of the displays are lit up turn them off */
|
||||
status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
|
||||
&dpcd_power_state, sizeof(dpcd_power_state));
|
||||
}
|
||||
|
||||
if ((signal != SIGNAL_TYPE_EDP && status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) ||
|
||||
(!hw_init && dc->links[i]->link_enc &&
|
||||
dc->links[i]->link_enc->funcs->is_dig_enabled(dc->links[i]->link_enc))) {
|
||||
if (dc->links[i]->link_enc->funcs->get_dig_frontend) {
|
||||
fe = dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);
|
||||
if (fe == ENGINE_ID_UNKNOWN)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < dc->res_pool->stream_enc_count; j++) {
|
||||
if (fe == dc->res_pool->stream_enc[j]->id) {
|
||||
dc->res_pool->stream_enc[j]->funcs->dp_blank(dc->links[i],
|
||||
dc->res_pool->stream_enc[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dc->links[i]->wa_flags.dp_keep_receiver_powered ||
|
||||
(hw_init && signal != SIGNAL_TYPE_EDP && dc->links[i]->priv != NULL))
|
||||
dp_receiver_power_ctrl(dc->links[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool get_ext_hdmi_settings(struct pipe_ctx *pipe_ctx,
|
||||
enum engine_id eng_id,
|
||||
struct ext_hdmi_settings *settings)
|
||||
@@ -3197,6 +3319,29 @@ static void update_mst_stream_alloc_table(
|
||||
work_table[i];
|
||||
}
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
static void dc_log_vcp_x_y(const struct dc_link *link, struct fixed31_32 avg_time_slots_per_mtp)
|
||||
{
|
||||
const uint32_t VCP_Y_PRECISION = 1000;
|
||||
uint64_t vcp_x, vcp_y;
|
||||
|
||||
// Add 0.5*(1/VCP_Y_PRECISION) to round up to decimal precision
|
||||
avg_time_slots_per_mtp = dc_fixpt_add(
|
||||
avg_time_slots_per_mtp, dc_fixpt_from_fraction(1, 2 * VCP_Y_PRECISION));
|
||||
|
||||
vcp_x = dc_fixpt_floor(avg_time_slots_per_mtp);
|
||||
vcp_y = dc_fixpt_floor(
|
||||
dc_fixpt_mul_int(
|
||||
dc_fixpt_sub_int(avg_time_slots_per_mtp, dc_fixpt_floor(avg_time_slots_per_mtp)),
|
||||
VCP_Y_PRECISION));
|
||||
|
||||
if (link->type == dc_connection_mst_branch)
|
||||
DC_LOG_DP2("MST Update Payload: set_throttled_vcp_size slot X.Y for MST stream "
|
||||
"X: %lld Y: %lld/%d", vcp_x, vcp_y, VCP_Y_PRECISION);
|
||||
else
|
||||
DC_LOG_DP2("SST Update Payload: set_throttled_vcp_size slot X.Y for SST stream "
|
||||
"X: %lld Y: %lld/%d", vcp_x, vcp_y, VCP_Y_PRECISION);
|
||||
}
|
||||
|
||||
/*
|
||||
* Payload allocation/deallocation for SST introduced in DP2.0
|
||||
*/
|
||||
@@ -3214,18 +3359,7 @@ enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx, bool alloca
|
||||
if (!allocate) {
|
||||
avg_time_slots_per_mtp = dc_fixpt_from_int(0);
|
||||
|
||||
DC_LOG_DP2("SST Update Payload: set_throttled_vcp_size slot X.Y for SST stream"
|
||||
"X: %d "
|
||||
"Y: %d",
|
||||
dc_fixpt_floor(
|
||||
avg_time_slots_per_mtp),
|
||||
dc_fixpt_ceil(
|
||||
dc_fixpt_shl(
|
||||
dc_fixpt_sub_int(
|
||||
avg_time_slots_per_mtp,
|
||||
dc_fixpt_floor(
|
||||
avg_time_slots_per_mtp)),
|
||||
26)));
|
||||
dc_log_vcp_x_y(link, avg_time_slots_per_mtp);
|
||||
|
||||
hpo_dp_link_encoder->funcs->set_throttled_vcp_size(
|
||||
hpo_dp_link_encoder,
|
||||
@@ -3272,18 +3406,7 @@ enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx, bool alloca
|
||||
if (allocate) {
|
||||
avg_time_slots_per_mtp = calculate_sst_avg_time_slots_per_mtp(stream, link);
|
||||
|
||||
DC_LOG_DP2("SST Update Payload: "
|
||||
"slot.X: %d "
|
||||
"slot.Y: %d",
|
||||
dc_fixpt_floor(
|
||||
avg_time_slots_per_mtp),
|
||||
dc_fixpt_ceil(
|
||||
dc_fixpt_shl(
|
||||
dc_fixpt_sub_int(
|
||||
avg_time_slots_per_mtp,
|
||||
dc_fixpt_floor(
|
||||
avg_time_slots_per_mtp)),
|
||||
26)));
|
||||
dc_log_vcp_x_y(link, avg_time_slots_per_mtp);
|
||||
|
||||
hpo_dp_link_encoder->funcs->set_throttled_vcp_size(
|
||||
hpo_dp_link_encoder,
|
||||
@@ -3305,7 +3428,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx)
|
||||
{
|
||||
struct dc_stream_state *stream = pipe_ctx->stream;
|
||||
struct dc_link *link = stream->link;
|
||||
struct link_encoder *link_encoder = link->link_enc;
|
||||
struct link_encoder *link_encoder = NULL;
|
||||
struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc;
|
||||
struct dp_mst_stream_allocation_table proposed_table = {0};
|
||||
struct fixed31_32 avg_time_slots_per_mtp;
|
||||
@@ -3315,6 +3438,13 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx)
|
||||
enum act_return_status ret;
|
||||
DC_LOGGER_INIT(link->ctx->logger);
|
||||
|
||||
/* Link encoder may have been dynamically assigned to non-physical display endpoint. */
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_PHY)
|
||||
link_encoder = link->link_enc;
|
||||
else if (link->dc->res_pool->funcs->link_encs_assign)
|
||||
link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream);
|
||||
ASSERT(link_encoder);
|
||||
|
||||
/* enable_link_dp_mst already check link->enabled_stream_count
|
||||
* and stream is in link->stream[]. This is called during set mode,
|
||||
* stream_enc is available.
|
||||
@@ -3392,7 +3522,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
|
||||
{
|
||||
struct dc_stream_state *stream = pipe_ctx->stream;
|
||||
struct dc_link *link = stream->link;
|
||||
struct link_encoder *link_encoder = link->link_enc;
|
||||
struct link_encoder *link_encoder = NULL;
|
||||
struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc;
|
||||
struct dp_mst_stream_allocation_table proposed_table = {0};
|
||||
struct fixed31_32 avg_time_slots_per_mtp = dc_fixpt_from_int(0);
|
||||
@@ -3400,6 +3530,13 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
|
||||
bool mst_mode = (link->type == dc_connection_mst_branch);
|
||||
DC_LOGGER_INIT(link->ctx->logger);
|
||||
|
||||
/* Link encoder may have been dynamically assigned to non-physical display endpoint. */
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_PHY)
|
||||
link_encoder = link->link_enc;
|
||||
else if (link->dc->res_pool->funcs->link_encs_assign)
|
||||
link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream);
|
||||
ASSERT(link_encoder);
|
||||
|
||||
/* deallocate_mst_payload is called before disable link. When mode or
|
||||
* disable/enable monitor, new stream is created which is not in link
|
||||
* stream[] yet. For this, payload is not allocated yet, so de-alloc
|
||||
@@ -3608,6 +3745,9 @@ void core_link_enable_stream(
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
enum otg_out_mux_dest otg_out_dest = OUT_MUX_DIO;
|
||||
struct vpg *vpg = pipe_ctx->stream_res.stream_enc->vpg;
|
||||
|
||||
if (is_dp_128b_132b_signal(pipe_ctx))
|
||||
vpg = pipe_ctx->stream_res.hpo_dp_stream_enc->vpg;
|
||||
#endif
|
||||
DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
|
||||
|
||||
@@ -3853,6 +3993,9 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
|
||||
struct dc_link *link = stream->sink->link;
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
struct vpg *vpg = pipe_ctx->stream_res.stream_enc->vpg;
|
||||
|
||||
if (is_dp_128b_132b_signal(pipe_ctx))
|
||||
vpg = pipe_ctx->stream_res.hpo_dp_stream_enc->vpg;
|
||||
#endif
|
||||
|
||||
if (!IS_DIAG_DC(dc->ctx->dce_environment) &&
|
||||
|
||||
@@ -196,7 +196,8 @@ static void ddc_service_construct(
|
||||
ddc_service->link = init_data->link;
|
||||
ddc_service->ctx = init_data->ctx;
|
||||
|
||||
if (BP_RESULT_OK != dcb->funcs->get_i2c_info(dcb, init_data->id, &i2c_info)) {
|
||||
if (init_data->is_dpia_link ||
|
||||
dcb->funcs->get_i2c_info(dcb, init_data->id, &i2c_info) != BP_RESULT_OK) {
|
||||
ddc_service->ddc_pin = NULL;
|
||||
} else {
|
||||
DC_LOGGER_INIT(ddc_service->ctx->logger);
|
||||
@@ -658,10 +659,12 @@ int dc_link_aux_transfer_raw(struct ddc_service *ddc,
|
||||
struct aux_payload *payload,
|
||||
enum aux_return_code_type *operation_result)
|
||||
{
|
||||
if (dc_enable_dmub_notifications(ddc->ctx->dc))
|
||||
if (ddc->ctx->dc->debug.enable_dmub_aux_for_legacy_ddc ||
|
||||
!ddc->ddc_pin) {
|
||||
return dce_aux_transfer_dmub_raw(ddc, payload, operation_result);
|
||||
else
|
||||
} else {
|
||||
return dce_aux_transfer_raw(ddc, payload, operation_result);
|
||||
}
|
||||
}
|
||||
|
||||
/* dc_link_aux_transfer_with_retries() - Attempt to submit an
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "dpcd_defs.h"
|
||||
#include "dc_dmub_srv.h"
|
||||
#include "dce/dmub_hw_lock_mgr.h"
|
||||
#include "inc/dc_link_dpia.h"
|
||||
#include "inc/link_enc_cfg.h"
|
||||
|
||||
/*Travis*/
|
||||
@@ -520,7 +521,6 @@ static void dpcd_set_lt_pattern_and_lane_settings(
|
||||
|
||||
uint8_t dpcd_lt_buffer[5] = {0};
|
||||
union dpcd_training_pattern dpcd_pattern = { {0} };
|
||||
uint32_t lane;
|
||||
uint32_t size_in_bytes;
|
||||
bool edp_workaround = false; /* TODO link_prop.INTERNAL */
|
||||
dpcd_base_lt_offset = DP_TRAINING_PATTERN_SET;
|
||||
@@ -553,45 +553,8 @@ static void dpcd_set_lt_pattern_and_lane_settings(
|
||||
dpcd_base_lt_offset,
|
||||
dpcd_pattern.v1_4.TRAINING_PATTERN_SET);
|
||||
}
|
||||
/*****************************************************************
|
||||
* DpcdAddress_Lane0Set -> DpcdAddress_Lane3Set
|
||||
*****************************************************************/
|
||||
for (lane = 0; lane <
|
||||
(uint32_t)(lt_settings->link_settings.lane_count); lane++) {
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
if (dp_get_link_encoding_format(<_settings->link_settings) ==
|
||||
DP_128b_132b_ENCODING) {
|
||||
dpcd_lane[lane].tx_ffe.PRESET_VALUE =
|
||||
lt_settings->lane_settings[lane].FFE_PRESET.settings.level;
|
||||
} else if (dp_get_link_encoding_format(<_settings->link_settings) ==
|
||||
DP_8b_10b_ENCODING) {
|
||||
dpcd_lane[lane].bits.VOLTAGE_SWING_SET =
|
||||
(uint8_t)(lt_settings->lane_settings[lane].VOLTAGE_SWING);
|
||||
dpcd_lane[lane].bits.PRE_EMPHASIS_SET =
|
||||
(uint8_t)(lt_settings->lane_settings[lane].PRE_EMPHASIS);
|
||||
|
||||
dpcd_lane[lane].bits.MAX_SWING_REACHED =
|
||||
(lt_settings->lane_settings[lane].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0);
|
||||
dpcd_lane[lane].bits.MAX_PRE_EMPHASIS_REACHED =
|
||||
(lt_settings->lane_settings[lane].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
|
||||
}
|
||||
#else
|
||||
dpcd_lane[lane].bits.VOLTAGE_SWING_SET =
|
||||
(uint8_t)(lt_settings->lane_settings[lane].VOLTAGE_SWING);
|
||||
dpcd_lane[lane].bits.PRE_EMPHASIS_SET =
|
||||
(uint8_t)(lt_settings->lane_settings[lane].PRE_EMPHASIS);
|
||||
|
||||
dpcd_lane[lane].bits.MAX_SWING_REACHED =
|
||||
(lt_settings->lane_settings[lane].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0);
|
||||
dpcd_lane[lane].bits.MAX_PRE_EMPHASIS_REACHED =
|
||||
(lt_settings->lane_settings[lane].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
|
||||
#endif
|
||||
}
|
||||
dp_hw_to_dpcd_lane_settings(lt_settings, lt_settings->lane_settings, dpcd_lane);
|
||||
|
||||
/* concatenate everything into one buffer*/
|
||||
|
||||
@@ -676,8 +639,6 @@ static void dpcd_set_lt_pattern_and_lane_settings(
|
||||
dpcd_base_lt_offset,
|
||||
dpcd_lt_buffer,
|
||||
size_in_bytes + sizeof(dpcd_pattern.raw));
|
||||
|
||||
link->cur_lane_setting = lt_settings->lane_settings[0];
|
||||
}
|
||||
|
||||
bool dp_is_cr_done(enum dc_lane_count ln_count,
|
||||
@@ -719,6 +680,37 @@ bool dp_is_interlane_aligned(union lane_align_status_updated align_status)
|
||||
return align_status.bits.INTERLANE_ALIGN_DONE == 1;
|
||||
}
|
||||
|
||||
void dp_hw_to_dpcd_lane_settings(
|
||||
const struct link_training_settings *lt_settings,
|
||||
const struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX],
|
||||
union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP_MAX])
|
||||
{
|
||||
uint8_t lane = 0;
|
||||
|
||||
for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) {
|
||||
if (dp_get_link_encoding_format(<_settings->link_settings) ==
|
||||
DP_8b_10b_ENCODING) {
|
||||
dpcd_lane_settings[lane].bits.VOLTAGE_SWING_SET =
|
||||
(uint8_t)(hw_lane_settings[lane].VOLTAGE_SWING);
|
||||
dpcd_lane_settings[lane].bits.PRE_EMPHASIS_SET =
|
||||
(uint8_t)(hw_lane_settings[lane].PRE_EMPHASIS);
|
||||
dpcd_lane_settings[lane].bits.MAX_SWING_REACHED =
|
||||
(hw_lane_settings[lane].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0);
|
||||
dpcd_lane_settings[lane].bits.MAX_PRE_EMPHASIS_REACHED =
|
||||
(hw_lane_settings[lane].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
|
||||
}
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
else if (dp_get_link_encoding_format(<_settings->link_settings) ==
|
||||
DP_128b_132b_ENCODING) {
|
||||
dpcd_lane_settings[lane].tx_ffe.PRESET_VALUE =
|
||||
hw_lane_settings[lane].FFE_PRESET.settings.level;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void dp_update_drive_settings(
|
||||
struct link_training_settings *dest,
|
||||
struct link_training_settings src)
|
||||
@@ -1028,7 +1020,6 @@ enum dc_status dpcd_set_lane_settings(
|
||||
uint32_t offset)
|
||||
{
|
||||
union dpcd_training_lane dpcd_lane[LANE_COUNT_DP_MAX] = {{{0}}};
|
||||
uint32_t lane;
|
||||
unsigned int lane0_set_address;
|
||||
enum dc_status status;
|
||||
|
||||
@@ -1038,46 +1029,9 @@ enum dc_status dpcd_set_lane_settings(
|
||||
lane0_set_address = DP_TRAINING_LANE0_SET_PHY_REPEATER1 +
|
||||
((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (offset - 1));
|
||||
|
||||
for (lane = 0; lane <
|
||||
(uint32_t)(link_training_setting->
|
||||
link_settings.lane_count);
|
||||
lane++) {
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
if (dp_get_link_encoding_format(&link_training_setting->link_settings) ==
|
||||
DP_128b_132b_ENCODING) {
|
||||
dpcd_lane[lane].tx_ffe.PRESET_VALUE =
|
||||
link_training_setting->lane_settings[lane].FFE_PRESET.settings.level;
|
||||
} else if (dp_get_link_encoding_format(&link_training_setting->link_settings) ==
|
||||
DP_8b_10b_ENCODING) {
|
||||
dpcd_lane[lane].bits.VOLTAGE_SWING_SET =
|
||||
(uint8_t)(link_training_setting->lane_settings[lane].VOLTAGE_SWING);
|
||||
dpcd_lane[lane].bits.PRE_EMPHASIS_SET =
|
||||
(uint8_t)(link_training_setting->lane_settings[lane].PRE_EMPHASIS);
|
||||
|
||||
dpcd_lane[lane].bits.MAX_SWING_REACHED =
|
||||
(link_training_setting->lane_settings[lane].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0);
|
||||
dpcd_lane[lane].bits.MAX_PRE_EMPHASIS_REACHED =
|
||||
(link_training_setting->lane_settings[lane].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
|
||||
}
|
||||
#else
|
||||
dpcd_lane[lane].bits.VOLTAGE_SWING_SET =
|
||||
(uint8_t)(link_training_setting->
|
||||
lane_settings[lane].VOLTAGE_SWING);
|
||||
dpcd_lane[lane].bits.PRE_EMPHASIS_SET =
|
||||
(uint8_t)(link_training_setting->
|
||||
lane_settings[lane].PRE_EMPHASIS);
|
||||
dpcd_lane[lane].bits.MAX_SWING_REACHED =
|
||||
(link_training_setting->
|
||||
lane_settings[lane].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0);
|
||||
dpcd_lane[lane].bits.MAX_PRE_EMPHASIS_REACHED =
|
||||
(link_training_setting->
|
||||
lane_settings[lane].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
|
||||
#endif
|
||||
}
|
||||
dp_hw_to_dpcd_lane_settings(link_training_setting,
|
||||
link_training_setting->lane_settings,
|
||||
dpcd_lane);
|
||||
|
||||
status = core_link_write_dpcd(link,
|
||||
lane0_set_address,
|
||||
@@ -1145,7 +1099,6 @@ enum dc_status dpcd_set_lane_settings(
|
||||
dpcd_lane[0].bits.MAX_SWING_REACHED,
|
||||
dpcd_lane[0].bits.MAX_PRE_EMPHASIS_REACHED);
|
||||
}
|
||||
link->cur_lane_setting = link_training_setting->lane_settings[0];
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1691,12 +1644,6 @@ static void override_training_settings(
|
||||
{
|
||||
uint32_t lane;
|
||||
|
||||
/* Override link settings */
|
||||
if (link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN)
|
||||
lt_settings->link_settings.link_rate = link->preferred_link_setting.link_rate;
|
||||
if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN)
|
||||
lt_settings->link_settings.lane_count = link->preferred_link_setting.lane_count;
|
||||
|
||||
/* Override link spread */
|
||||
if (!link->dp_ss_off && overrides->downspread != NULL)
|
||||
lt_settings->link_settings.link_spread = *overrides->downspread ?
|
||||
@@ -1828,6 +1775,13 @@ static enum dc_status configure_lttpr_mode_non_transparent(
|
||||
|
||||
if (encoding == DP_8b_10b_ENCODING) {
|
||||
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
|
||||
|
||||
/* Driver does not need to train the first hop. Skip DPCD read and clear
|
||||
* AUX_RD_INTERVAL for DPTX-to-DPIA hop.
|
||||
*/
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
|
||||
link->dpcd_caps.lttpr_caps.aux_rd_interval[--repeater_cnt] = 0;
|
||||
|
||||
for (repeater_id = repeater_cnt; repeater_id > 0; repeater_id--) {
|
||||
aux_interval_address = DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 +
|
||||
((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (repeater_id - 1));
|
||||
@@ -2419,14 +2373,13 @@ bool perform_link_training_with_retries(
|
||||
if (panel_mode == DP_PANEL_MODE_EDP) {
|
||||
struct cp_psp *cp_psp = &stream->ctx->cp_psp;
|
||||
|
||||
if (cp_psp && cp_psp->funcs.enable_assr) {
|
||||
if (!cp_psp->funcs.enable_assr(cp_psp->handle, link)) {
|
||||
/* since eDP implies ASSR on, change panel
|
||||
* mode to disable ASSR
|
||||
*/
|
||||
panel_mode = DP_PANEL_MODE_DEFAULT;
|
||||
}
|
||||
}
|
||||
if (cp_psp && cp_psp->funcs.enable_assr)
|
||||
/* ASSR is bound to fail with unsigned PSP
|
||||
* verstage used during devlopment phase.
|
||||
* Report and continue with eDP panel mode to
|
||||
* perform eDP link training with right settings
|
||||
*/
|
||||
cp_psp->funcs.enable_assr(cp_psp->handle, link);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2436,10 +2389,22 @@ bool perform_link_training_with_retries(
|
||||
dc_link_dp_perform_link_training_skip_aux(link, ¤t_setting);
|
||||
return true;
|
||||
} else {
|
||||
status = dc_link_dp_perform_link_training(
|
||||
link,
|
||||
¤t_setting,
|
||||
skip_video_pattern);
|
||||
/** @todo Consolidate USB4 DP and DPx.x training. */
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) {
|
||||
status = dc_link_dpia_perform_link_training(link,
|
||||
¤t_setting,
|
||||
skip_video_pattern);
|
||||
|
||||
/* Transmit idle pattern once training successful. */
|
||||
if (status == LINK_TRAINING_SUCCESS)
|
||||
dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE,
|
||||
NULL, 0);
|
||||
} else {
|
||||
status = dc_link_dp_perform_link_training(link,
|
||||
¤t_setting,
|
||||
skip_video_pattern);
|
||||
}
|
||||
|
||||
if (status == LINK_TRAINING_SUCCESS)
|
||||
return true;
|
||||
}
|
||||
@@ -2881,14 +2846,25 @@ bool dp_verify_link_cap(
|
||||
enum link_training_result status;
|
||||
union hpd_irq_data irq_data;
|
||||
|
||||
/* link training starts with the maximum common settings
|
||||
* supported by both sink and ASIC.
|
||||
*/
|
||||
max_link_cap = get_max_link_cap(link);
|
||||
initial_link_settings = get_common_supported_link_settings(
|
||||
*known_limit_link_setting,
|
||||
max_link_cap);
|
||||
|
||||
/* Accept reported capabilities if link supports flexible encoder mapping or encoder already in use. */
|
||||
if (link->dc->debug.skip_detection_link_training ||
|
||||
link->is_dig_mapping_flexible) {
|
||||
/* TODO - should we check link encoder's max link caps here?
|
||||
* How do we know which link encoder to check from?
|
||||
*/
|
||||
link->verified_link_cap = *known_limit_link_setting;
|
||||
return true;
|
||||
} else if (link->link_enc && link->dc->res_pool->funcs->link_encs_assign &&
|
||||
!link_enc_cfg_is_link_enc_avail(link->ctx->dc, link->link_enc->preferred_engine)) {
|
||||
link->verified_link_cap = *known_limit_link_setting;
|
||||
link->verified_link_cap = initial_link_settings;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2896,8 +2872,6 @@ bool dp_verify_link_cap(
|
||||
success = false;
|
||||
skip_link_training = false;
|
||||
|
||||
max_link_cap = get_max_link_cap(link);
|
||||
|
||||
/* Grant extended timeout request */
|
||||
if ((link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) && (link->dpcd_caps.lttpr_caps.max_ext_timeout > 0)) {
|
||||
uint8_t grant = link->dpcd_caps.lttpr_caps.max_ext_timeout & 0x80;
|
||||
@@ -2919,12 +2893,6 @@ bool dp_verify_link_cap(
|
||||
|
||||
dp_cs_id = get_clock_source_id(link);
|
||||
|
||||
/* link training starts with the maximum common settings
|
||||
* supported by both sink and ASIC.
|
||||
*/
|
||||
initial_link_settings = get_common_supported_link_settings(
|
||||
*known_limit_link_setting,
|
||||
max_link_cap);
|
||||
cur_link_setting = initial_link_settings;
|
||||
|
||||
/* Temporary Renoir-specific workaround for SWDEV-215184;
|
||||
@@ -3018,7 +2986,7 @@ bool dp_verify_link_cap_with_retries(
|
||||
link->verified_link_cap.link_spread = LINK_SPREAD_DISABLED;
|
||||
break;
|
||||
} else if (dp_verify_link_cap(link,
|
||||
&link->reported_link_cap,
|
||||
known_limit_link_setting,
|
||||
&fail_count) && fail_count == 0) {
|
||||
success = true;
|
||||
break;
|
||||
@@ -3033,11 +3001,21 @@ bool dp_verify_mst_link_cap(
|
||||
{
|
||||
struct dc_link_settings max_link_cap = {0};
|
||||
|
||||
max_link_cap = get_max_link_cap(link);
|
||||
link->verified_link_cap = get_common_supported_link_settings(
|
||||
link->reported_link_cap,
|
||||
max_link_cap);
|
||||
|
||||
if (dp_get_link_encoding_format(&link->reported_link_cap) ==
|
||||
DP_8b_10b_ENCODING) {
|
||||
max_link_cap = get_max_link_cap(link);
|
||||
link->verified_link_cap = get_common_supported_link_settings(
|
||||
link->reported_link_cap,
|
||||
max_link_cap);
|
||||
}
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
else if (dp_get_link_encoding_format(&link->reported_link_cap) ==
|
||||
DP_128b_132b_ENCODING) {
|
||||
dp_verify_link_cap_with_retries(link,
|
||||
&link->reported_link_cap,
|
||||
LINK_TRAINING_MAX_VERIFY_RETRY);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4549,6 +4527,12 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
|
||||
else
|
||||
link->lttpr_mode = LTTPR_MODE_NON_TRANSPARENT;
|
||||
}
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
/* Check DP tunnel LTTPR mode debug option. */
|
||||
if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA &&
|
||||
link->dc->debug.dpia_debug.bits.force_non_lttpr)
|
||||
link->lttpr_mode = LTTPR_MODE_NON_LTTPR;
|
||||
#endif
|
||||
|
||||
if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT || link->lttpr_mode == LTTPR_MODE_TRANSPARENT) {
|
||||
/* By reading LTTPR capability, RX assumes that we will enable
|
||||
@@ -4600,6 +4584,7 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
|
||||
|
||||
/* Attempt to train in LTTPR transparent mode if repeater count exceeds 8. */
|
||||
is_lttpr_present = (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) != 0 &&
|
||||
link->dpcd_caps.lttpr_caps.phy_repeater_cnt < 0xff &&
|
||||
link->dpcd_caps.lttpr_caps.max_lane_count > 0 &&
|
||||
link->dpcd_caps.lttpr_caps.max_lane_count <= 4 &&
|
||||
link->dpcd_caps.lttpr_caps.revision.raw >= 0x14);
|
||||
@@ -4648,6 +4633,8 @@ static bool retrieve_link_cap(struct dc_link *link)
|
||||
LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD);
|
||||
|
||||
is_lttpr_present = dp_retrieve_lttpr_cap(link);
|
||||
/* Read DP tunneling information. */
|
||||
status = dpcd_get_tunneling_device_data(link);
|
||||
|
||||
status = core_link_read_dpcd(link, DP_SET_POWER,
|
||||
&dpcd_power_state, sizeof(dpcd_power_state));
|
||||
|
||||
@@ -0,0 +1,953 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright 2021 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: AMD
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dc.h"
|
||||
#include "dc_link_dpia.h"
|
||||
#include "inc/core_status.h"
|
||||
#include "dc_link.h"
|
||||
#include "dc_link_dp.h"
|
||||
#include "dpcd_defs.h"
|
||||
#include "link_hwss.h"
|
||||
#include "dm_helpers.h"
|
||||
#include "dmub/inc/dmub_cmd.h"
|
||||
#include "inc/link_dpcd.h"
|
||||
|
||||
#define DC_LOGGER \
|
||||
link->ctx->logger
|
||||
|
||||
enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link)
|
||||
{
|
||||
enum dc_status status = DC_OK;
|
||||
uint8_t dpcd_dp_tun_data[3] = {0};
|
||||
uint8_t dpcd_topology_data[DPCD_USB4_TOPOLOGY_ID_LEN] = {0};
|
||||
uint8_t i = 0;
|
||||
|
||||
status = core_link_read_dpcd(link,
|
||||
DP_TUNNELING_CAPABILITIES_SUPPORT,
|
||||
dpcd_dp_tun_data,
|
||||
sizeof(dpcd_dp_tun_data));
|
||||
|
||||
status = core_link_read_dpcd(link,
|
||||
DP_USB4_ROUTER_TOPOLOGY_ID,
|
||||
dpcd_topology_data,
|
||||
sizeof(dpcd_topology_data));
|
||||
|
||||
link->dpcd_caps.usb4_dp_tun_info.dp_tun_cap.raw =
|
||||
dpcd_dp_tun_data[DP_TUNNELING_CAPABILITIES_SUPPORT -
|
||||
DP_TUNNELING_CAPABILITIES_SUPPORT];
|
||||
link->dpcd_caps.usb4_dp_tun_info.dpia_info.raw =
|
||||
dpcd_dp_tun_data[DP_IN_ADAPTER_INFO - DP_TUNNELING_CAPABILITIES_SUPPORT];
|
||||
link->dpcd_caps.usb4_dp_tun_info.usb4_driver_id =
|
||||
dpcd_dp_tun_data[DP_USB4_DRIVER_ID - DP_TUNNELING_CAPABILITIES_SUPPORT];
|
||||
|
||||
for (i = 0; i < DPCD_USB4_TOPOLOGY_ID_LEN; i++)
|
||||
link->dpcd_caps.usb4_dp_tun_info.usb4_topology_id[i] = dpcd_topology_data[i];
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Configure link as prescribed in link_setting; set LTTPR mode; and
|
||||
* Initialize link training settings.
|
||||
* Abort link training if sink unplug detected.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param[in] link_setting Lane count, link rate and downspread control.
|
||||
* @param[out] lt_settings Link settings and drive settings (voltage swing and pre-emphasis).
|
||||
*/
|
||||
static enum link_training_result dpia_configure_link(struct dc_link *link,
|
||||
const struct dc_link_settings *link_setting,
|
||||
struct link_training_settings *lt_settings)
|
||||
{
|
||||
enum dc_status status;
|
||||
bool fec_enable;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) configuring\n - LTTPR mode(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
link->lttpr_mode);
|
||||
|
||||
dp_decide_training_settings(link,
|
||||
link_setting,
|
||||
lt_settings);
|
||||
|
||||
status = dpcd_configure_channel_coding(link, lt_settings);
|
||||
if (status != DC_OK && !link->hpd_status)
|
||||
return LINK_TRAINING_ABORT;
|
||||
|
||||
/* Configure lttpr mode */
|
||||
status = dpcd_configure_lttpr_mode(link, lt_settings);
|
||||
if (status != DC_OK && !link->hpd_status)
|
||||
return LINK_TRAINING_ABORT;
|
||||
|
||||
/* Set link rate, lane count and spread. */
|
||||
status = dpcd_set_link_settings(link, lt_settings);
|
||||
if (status != DC_OK && !link->hpd_status)
|
||||
return LINK_TRAINING_ABORT;
|
||||
|
||||
if (link->preferred_training_settings.fec_enable)
|
||||
fec_enable = *link->preferred_training_settings.fec_enable;
|
||||
else
|
||||
fec_enable = true;
|
||||
status = dp_set_fec_ready(link, fec_enable);
|
||||
if (status != DC_OK && !link->hpd_status)
|
||||
return LINK_TRAINING_ABORT;
|
||||
|
||||
return LINK_TRAINING_SUCCESS;
|
||||
}
|
||||
|
||||
static enum dc_status core_link_send_set_config(struct dc_link *link,
|
||||
uint8_t msg_type,
|
||||
uint8_t msg_data)
|
||||
{
|
||||
struct set_config_cmd_payload payload;
|
||||
enum set_config_status set_config_result = SET_CONFIG_PENDING;
|
||||
|
||||
/* prepare set_config payload */
|
||||
payload.msg_type = msg_type;
|
||||
payload.msg_data = msg_data;
|
||||
|
||||
if (!link->ddc->ddc_pin && !link->aux_access_disabled &&
|
||||
(dm_helpers_dmub_set_config_sync(link->ctx, link,
|
||||
&payload, &set_config_result) == -1)) {
|
||||
return DC_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
/* set_config should return ACK if successful */
|
||||
return (set_config_result == SET_CONFIG_ACK_RECEIVED) ? DC_OK : DC_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
/* Build SET_CONFIG message data payload for specified message type. */
|
||||
static uint8_t dpia_build_set_config_data(enum dpia_set_config_type type,
|
||||
struct dc_link *link,
|
||||
struct link_training_settings *lt_settings)
|
||||
{
|
||||
union dpia_set_config_data data;
|
||||
|
||||
data.raw = 0;
|
||||
|
||||
switch (type) {
|
||||
case DPIA_SET_CFG_SET_LINK:
|
||||
data.set_link.mode = link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT ? 1 : 0;
|
||||
break;
|
||||
case DPIA_SET_CFG_SET_PHY_TEST_MODE:
|
||||
break;
|
||||
case DPIA_SET_CFG_SET_VSPE:
|
||||
/* Assume all lanes have same drive settings. */
|
||||
data.set_vspe.swing = lt_settings->lane_settings[0].VOLTAGE_SWING;
|
||||
data.set_vspe.pre_emph = lt_settings->lane_settings[0].PRE_EMPHASIS;
|
||||
data.set_vspe.max_swing_reached =
|
||||
lt_settings->lane_settings[0].VOLTAGE_SWING ==
|
||||
VOLTAGE_SWING_MAX_LEVEL ? 1 : 0;
|
||||
data.set_vspe.max_pre_emph_reached =
|
||||
lt_settings->lane_settings[0].PRE_EMPHASIS ==
|
||||
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ASSERT(false); /* Message type not supported by helper function. */
|
||||
break;
|
||||
}
|
||||
|
||||
return data.raw;
|
||||
}
|
||||
|
||||
/* Convert DC training pattern to DPIA training stage. */
|
||||
static enum dpia_set_config_ts convert_trng_ptn_to_trng_stg(enum dc_dp_training_pattern tps)
|
||||
{
|
||||
enum dpia_set_config_ts ts;
|
||||
|
||||
switch (tps) {
|
||||
case DP_TRAINING_PATTERN_SEQUENCE_1:
|
||||
ts = DPIA_TS_TPS1;
|
||||
break;
|
||||
case DP_TRAINING_PATTERN_SEQUENCE_2:
|
||||
ts = DPIA_TS_TPS2;
|
||||
break;
|
||||
case DP_TRAINING_PATTERN_SEQUENCE_3:
|
||||
ts = DPIA_TS_TPS3;
|
||||
break;
|
||||
case DP_TRAINING_PATTERN_SEQUENCE_4:
|
||||
ts = DPIA_TS_TPS4;
|
||||
break;
|
||||
default:
|
||||
ts = DPIA_TS_DPRX_DONE;
|
||||
ASSERT(false); /* TPS not supported by helper function. */
|
||||
break;
|
||||
}
|
||||
|
||||
return ts;
|
||||
}
|
||||
|
||||
/* Write training pattern to DPCD. */
|
||||
static enum dc_status dpcd_set_lt_pattern(struct dc_link *link,
|
||||
enum dc_dp_training_pattern pattern,
|
||||
uint32_t hop)
|
||||
{
|
||||
union dpcd_training_pattern dpcd_pattern = { {0} };
|
||||
uint32_t dpcd_tps_offset = DP_TRAINING_PATTERN_SET;
|
||||
enum dc_status status;
|
||||
|
||||
if (hop != DPRX)
|
||||
dpcd_tps_offset = DP_TRAINING_PATTERN_SET_PHY_REPEATER1 +
|
||||
((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (hop - 1));
|
||||
|
||||
/* DpcdAddress_TrainingPatternSet */
|
||||
dpcd_pattern.v1_4.TRAINING_PATTERN_SET =
|
||||
dc_dp_training_pattern_to_dpcd_training_pattern(link, pattern);
|
||||
|
||||
dpcd_pattern.v1_4.SCRAMBLING_DISABLE =
|
||||
dc_dp_initialize_scrambling_data_symbols(link, pattern);
|
||||
|
||||
if (hop != DPRX) {
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n LTTPR Repeater ID: %d\n 0x%X pattern = %x\n",
|
||||
__func__,
|
||||
hop,
|
||||
dpcd_tps_offset,
|
||||
dpcd_pattern.v1_4.TRAINING_PATTERN_SET);
|
||||
} else {
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n 0x%X pattern = %x\n",
|
||||
__func__,
|
||||
dpcd_tps_offset,
|
||||
dpcd_pattern.v1_4.TRAINING_PATTERN_SET);
|
||||
}
|
||||
|
||||
status = core_link_write_dpcd(link,
|
||||
dpcd_tps_offset,
|
||||
&dpcd_pattern.raw,
|
||||
sizeof(dpcd_pattern.raw));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Execute clock recovery phase of link training for specified hop in display
|
||||
* path.in non-transparent mode:
|
||||
* - Driver issues both DPCD and SET_CONFIG transactions.
|
||||
* - TPS1 is transmitted for any hops downstream of DPOA.
|
||||
* - Drive (VS/PE) only transmitted for the hop immediately downstream of DPOA.
|
||||
* - CR for the first hop (DPTX-to-DPIA) is assumed to be successful.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_cr_non_transparent(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings,
|
||||
uint32_t hop)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_CR_FAIL_LANE0;
|
||||
uint8_t repeater_cnt = 0; /* Number of hops/repeaters in display path. */
|
||||
enum dc_status status;
|
||||
uint32_t retries_cr = 0; /* Number of consecutive attempts with same VS or PE. */
|
||||
uint32_t retry_count = 0;
|
||||
/* From DP spec, CR read interval is always 100us. */
|
||||
uint32_t wait_time_microsec = TRAINING_AUX_RD_INTERVAL;
|
||||
struct link_training_settings req_settings;
|
||||
enum dc_lane_count lane_count = lt_settings->link_settings.lane_count;
|
||||
union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX] = { { {0} } };
|
||||
union lane_align_status_updated dpcd_lane_status_updated = { {0} };
|
||||
uint8_t set_cfg_data;
|
||||
enum dpia_set_config_ts ts;
|
||||
|
||||
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
|
||||
|
||||
/* Cap of LINK_TRAINING_MAX_CR_RETRY attempts at clock recovery.
|
||||
* Fix inherited from perform_clock_recovery_sequence() -
|
||||
* the DP equivalent of this function:
|
||||
* Required for Synaptics MST hub which can put the LT in
|
||||
* infinite loop by switching the VS between level 0 and level 1
|
||||
* continuously.
|
||||
*/
|
||||
while ((retries_cr < LINK_TRAINING_MAX_RETRY_COUNT) &&
|
||||
(retry_count < LINK_TRAINING_MAX_CR_RETRY)) {
|
||||
/* DPTX-to-DPIA */
|
||||
if (hop == repeater_cnt) {
|
||||
/* Send SET_CONFIG(SET_LINK:LC,LR,LTTPR) to notify DPOA that
|
||||
* non-transparent link training has started.
|
||||
* This also enables the transmission of clk_sync packets.
|
||||
*/
|
||||
set_cfg_data = dpia_build_set_config_data(DPIA_SET_CFG_SET_LINK,
|
||||
link,
|
||||
lt_settings);
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_LINK,
|
||||
set_cfg_data);
|
||||
/* CR for this hop is considered successful as long as
|
||||
* SET_CONFIG message is acknowledged by DPOA.
|
||||
*/
|
||||
if (status == DC_OK)
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
else
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* DPOA-to-x */
|
||||
/* Instruct DPOA to transmit TPS1 then update DPCD. */
|
||||
if (retry_count == 0) {
|
||||
ts = convert_trng_ptn_to_trng_stg(lt_settings->pattern_for_cr);
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_TRAINING,
|
||||
ts);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
status = dpcd_set_lt_pattern(link, lt_settings->pattern_for_cr, hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update DPOA drive settings then DPCD. DPOA does only adjusts
|
||||
* drive settings for hops immediately downstream.
|
||||
*/
|
||||
if (hop == repeater_cnt - 1) {
|
||||
set_cfg_data = dpia_build_set_config_data(DPIA_SET_CFG_SET_VSPE,
|
||||
link,
|
||||
lt_settings);
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_VSPE,
|
||||
set_cfg_data);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = dpcd_set_lane_settings(link, lt_settings, hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
dp_wait_for_training_aux_rd_interval(link, wait_time_microsec);
|
||||
|
||||
/* Read status and adjustment requests from DPCD. */
|
||||
status = dp_get_lane_status_and_drive_settings(link,
|
||||
lt_settings,
|
||||
dpcd_lane_status,
|
||||
&dpcd_lane_status_updated,
|
||||
&req_settings,
|
||||
hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if clock recovery successful. */
|
||||
if (dp_is_cr_done(lane_count, dpcd_lane_status)) {
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
result = dp_get_cr_failure(lane_count, dpcd_lane_status);
|
||||
|
||||
if (dp_is_max_vs_reached(lt_settings))
|
||||
break;
|
||||
|
||||
/* Count number of attempts with same drive settings.
|
||||
* Note: settings are the same for all lanes,
|
||||
* so comparing first lane is sufficient.
|
||||
*/
|
||||
if (lt_settings->lane_settings[0].VOLTAGE_SWING ==
|
||||
req_settings.lane_settings[0].VOLTAGE_SWING &&
|
||||
lt_settings->lane_settings[0].PRE_EMPHASIS ==
|
||||
req_settings.lane_settings[0].PRE_EMPHASIS)
|
||||
retries_cr++;
|
||||
else
|
||||
retries_cr = 0;
|
||||
|
||||
/* Update VS/PE. */
|
||||
dp_update_drive_settings(lt_settings, req_settings);
|
||||
retry_count++;
|
||||
}
|
||||
|
||||
/* Abort link training if clock recovery failed due to HPD unplug. */
|
||||
if (!link->hpd_status)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) clock recovery\n"
|
||||
" -hop(%d)\n - result(%d)\n - retries(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
hop,
|
||||
result,
|
||||
retry_count);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute clock recovery phase of link training in transparent LTTPR mode:
|
||||
* - Driver only issues DPCD transactions and leaves USB4 tunneling (SET_CONFIG) messages to DPIA.
|
||||
* - Driver writes TPS1 to DPCD to kick off training.
|
||||
* - Clock recovery (CR) for link is handled by DPOA, which reports result to DPIA on completion.
|
||||
* - DPIA communicates result to driver by updating CR status when driver reads DPCD.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
*/
|
||||
static enum link_training_result dpia_training_cr_transparent(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_CR_FAIL_LANE0;
|
||||
enum dc_status status;
|
||||
uint32_t retries_cr = 0; /* Number of consecutive attempts with same VS or PE. */
|
||||
uint32_t retry_count = 0;
|
||||
uint32_t wait_time_microsec = lt_settings->cr_pattern_time;
|
||||
struct link_training_settings req_settings;
|
||||
enum dc_lane_count lane_count = lt_settings->link_settings.lane_count;
|
||||
union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX] = { { {0} } };
|
||||
union lane_align_status_updated dpcd_lane_status_updated = { {0} };
|
||||
|
||||
/* Cap of LINK_TRAINING_MAX_CR_RETRY attempts at clock recovery.
|
||||
* Fix inherited from perform_clock_recovery_sequence() -
|
||||
* the DP equivalent of this function:
|
||||
* Required for Synaptics MST hub which can put the LT in
|
||||
* infinite loop by switching the VS between level 0 and level 1
|
||||
* continuously.
|
||||
*/
|
||||
while ((retries_cr < LINK_TRAINING_MAX_RETRY_COUNT) &&
|
||||
(retry_count < LINK_TRAINING_MAX_CR_RETRY)) {
|
||||
/* Write TPS1 (not VS or PE) to DPCD to start CR phase.
|
||||
* DPIA sends SET_CONFIG(SET_LINK) to notify DPOA to
|
||||
* start link training.
|
||||
*/
|
||||
if (retry_count == 0) {
|
||||
status = dpcd_set_lt_pattern(link, lt_settings->pattern_for_cr, DPRX);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dp_wait_for_training_aux_rd_interval(link, wait_time_microsec);
|
||||
|
||||
/* Read status and adjustment requests from DPCD. */
|
||||
status = dp_get_lane_status_and_drive_settings(link,
|
||||
lt_settings,
|
||||
dpcd_lane_status,
|
||||
&dpcd_lane_status_updated,
|
||||
&req_settings,
|
||||
DPRX);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if clock recovery successful. */
|
||||
if (dp_is_cr_done(lane_count, dpcd_lane_status)) {
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
result = dp_get_cr_failure(lane_count, dpcd_lane_status);
|
||||
|
||||
if (dp_is_max_vs_reached(lt_settings))
|
||||
break;
|
||||
|
||||
/* Count number of attempts with same drive settings.
|
||||
* Note: settings are the same for all lanes,
|
||||
* so comparing first lane is sufficient.
|
||||
*/
|
||||
if (lt_settings->lane_settings[0].VOLTAGE_SWING ==
|
||||
req_settings.lane_settings[0].VOLTAGE_SWING &&
|
||||
lt_settings->lane_settings[0].PRE_EMPHASIS ==
|
||||
req_settings.lane_settings[0].PRE_EMPHASIS)
|
||||
retries_cr++;
|
||||
else
|
||||
retries_cr = 0;
|
||||
|
||||
/* Update VS/PE. */
|
||||
dp_update_drive_settings(lt_settings, req_settings);
|
||||
retry_count++;
|
||||
}
|
||||
|
||||
/* Abort link training if clock recovery failed due to HPD unplug. */
|
||||
if (!link->hpd_status)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) clock recovery\n"
|
||||
" -hop(%d)\n - result(%d)\n - retries(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
DPRX,
|
||||
result,
|
||||
retry_count);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute clock recovery phase of link training for specified hop in display
|
||||
* path.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_cr_phase(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings,
|
||||
uint32_t hop)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_CR_FAIL_LANE0;
|
||||
|
||||
if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
|
||||
result = dpia_training_cr_non_transparent(link, lt_settings, hop);
|
||||
else
|
||||
result = dpia_training_cr_transparent(link, lt_settings);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Return status read interval during equalization phase. */
|
||||
static uint32_t dpia_get_eq_aux_rd_interval(const struct dc_link *link,
|
||||
const struct link_training_settings *lt_settings,
|
||||
uint32_t hop)
|
||||
{
|
||||
uint32_t wait_time_microsec;
|
||||
|
||||
if (hop == DPRX)
|
||||
wait_time_microsec = lt_settings->eq_pattern_time;
|
||||
else
|
||||
wait_time_microsec =
|
||||
dp_translate_training_aux_read_interval(
|
||||
link->dpcd_caps.lttpr_caps.aux_rd_interval[hop - 1]);
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
/* Check debug option for extending aux read interval. */
|
||||
if (link->dc->debug.dpia_debug.bits.extend_aux_rd_interval)
|
||||
wait_time_microsec = DPIA_DEBUG_EXTENDED_AUX_RD_INTERVAL_US;
|
||||
#endif
|
||||
|
||||
return wait_time_microsec;
|
||||
}
|
||||
|
||||
/* Execute equalization phase of link training for specified hop in display
|
||||
* path in non-transparent mode:
|
||||
* - driver issues both DPCD and SET_CONFIG transactions.
|
||||
* - TPSx is transmitted for any hops downstream of DPOA.
|
||||
* - Drive (VS/PE) only transmitted for the hop immediately downstream of DPOA.
|
||||
* - EQ for the first hop (DPTX-to-DPIA) is assumed to be successful.
|
||||
* - DPRX EQ only reported successful when both DPRX and DPIA requirements
|
||||
* (clk sync packets sent) fulfilled.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_eq_non_transparent(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings,
|
||||
uint32_t hop)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_EQ_FAIL_EQ;
|
||||
uint8_t repeater_cnt = 0; /* Number of hops/repeaters in display path. */
|
||||
uint32_t retries_eq = 0;
|
||||
enum dc_status status;
|
||||
enum dc_dp_training_pattern tr_pattern;
|
||||
uint32_t wait_time_microsec;
|
||||
struct link_training_settings req_settings;
|
||||
enum dc_lane_count lane_count = lt_settings->link_settings.lane_count;
|
||||
union lane_align_status_updated dpcd_lane_status_updated = { {0} };
|
||||
union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX] = { { {0} } };
|
||||
uint8_t set_cfg_data;
|
||||
enum dpia_set_config_ts ts;
|
||||
|
||||
/* Training pattern is TPS4 for repeater;
|
||||
* TPS2/3/4 for DPRX depending on what it supports.
|
||||
*/
|
||||
if (hop == DPRX)
|
||||
tr_pattern = lt_settings->pattern_for_eq;
|
||||
else
|
||||
tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4;
|
||||
|
||||
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
|
||||
|
||||
for (retries_eq = 0; retries_eq < LINK_TRAINING_MAX_RETRY_COUNT; retries_eq++) {
|
||||
/* DPTX-to-DPIA equalization always successful. */
|
||||
if (hop == repeater_cnt) {
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Instruct DPOA to transmit TPSn then update DPCD. */
|
||||
if (retries_eq == 0) {
|
||||
ts = convert_trng_ptn_to_trng_stg(tr_pattern);
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_TRAINING,
|
||||
ts);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
status = dpcd_set_lt_pattern(link, tr_pattern, hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update DPOA drive settings then DPCD. DPOA only adjusts
|
||||
* drive settings for hop immediately downstream.
|
||||
*/
|
||||
if (hop == repeater_cnt - 1) {
|
||||
set_cfg_data = dpia_build_set_config_data(DPIA_SET_CFG_SET_VSPE,
|
||||
link,
|
||||
lt_settings);
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_VSPE,
|
||||
set_cfg_data);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = dpcd_set_lane_settings(link, lt_settings, hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Extend wait time on second equalisation attempt on final hop to
|
||||
* ensure clock sync packets have been sent.
|
||||
*/
|
||||
if (hop == DPRX && retries_eq == 1)
|
||||
wait_time_microsec = max(wait_time_microsec, (uint32_t)DPIA_CLK_SYNC_DELAY);
|
||||
else
|
||||
wait_time_microsec = dpia_get_eq_aux_rd_interval(link, lt_settings, hop);
|
||||
|
||||
dp_wait_for_training_aux_rd_interval(link, wait_time_microsec);
|
||||
|
||||
/* Read status and adjustment requests from DPCD. */
|
||||
status = dp_get_lane_status_and_drive_settings(link,
|
||||
lt_settings,
|
||||
dpcd_lane_status,
|
||||
&dpcd_lane_status_updated,
|
||||
&req_settings,
|
||||
hop);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* CR can still fail during EQ phase. Fail training if CR fails. */
|
||||
if (!dp_is_cr_done(lane_count, dpcd_lane_status)) {
|
||||
result = LINK_TRAINING_EQ_FAIL_CR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dp_is_ch_eq_done(lane_count, dpcd_lane_status) &&
|
||||
dp_is_symbol_locked(link->cur_link_settings.lane_count, dpcd_lane_status) &&
|
||||
dp_is_interlane_aligned(dpcd_lane_status_updated)) {
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update VS/PE. */
|
||||
dp_update_drive_settings(lt_settings, req_settings);
|
||||
}
|
||||
|
||||
/* Abort link training if equalization failed due to HPD unplug. */
|
||||
if (!link->hpd_status)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) equalization\n"
|
||||
" - hop(%d)\n - result(%d)\n - retries(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
hop,
|
||||
result,
|
||||
retries_eq);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute equalization phase of link training for specified hop in display
|
||||
* path in transparent LTTPR mode:
|
||||
* - driver only issues DPCD transactions leaves USB4 tunneling (SET_CONFIG) messages to DPIA.
|
||||
* - driver writes TPSx to DPCD to notify DPIA that is in equalization phase.
|
||||
* - equalization (EQ) for link is handled by DPOA, which reports result to DPIA on completion.
|
||||
* - DPIA communicates result to driver by updating EQ status when driver reads DPCD.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_eq_transparent(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_EQ_FAIL_EQ;
|
||||
uint32_t retries_eq = 0;
|
||||
enum dc_status status;
|
||||
enum dc_dp_training_pattern tr_pattern = lt_settings->pattern_for_eq;
|
||||
uint32_t wait_time_microsec;
|
||||
struct link_training_settings req_settings;
|
||||
enum dc_lane_count lane_count = lt_settings->link_settings.lane_count;
|
||||
union lane_align_status_updated dpcd_lane_status_updated = { {0} };
|
||||
union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX] = { { {0} } };
|
||||
|
||||
wait_time_microsec = dpia_get_eq_aux_rd_interval(link, lt_settings, DPRX);
|
||||
|
||||
for (retries_eq = 0; retries_eq < LINK_TRAINING_MAX_RETRY_COUNT; retries_eq++) {
|
||||
if (retries_eq == 0) {
|
||||
status = dpcd_set_lt_pattern(link, tr_pattern, DPRX);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dp_wait_for_training_aux_rd_interval(link, wait_time_microsec);
|
||||
|
||||
/* Read status and adjustment requests from DPCD. */
|
||||
status = dp_get_lane_status_and_drive_settings(link,
|
||||
lt_settings,
|
||||
dpcd_lane_status,
|
||||
&dpcd_lane_status_updated,
|
||||
&req_settings,
|
||||
DPRX);
|
||||
if (status != DC_OK) {
|
||||
result = LINK_TRAINING_ABORT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* CR can still fail during EQ phase. Fail training if CR fails. */
|
||||
if (!dp_is_cr_done(lane_count, dpcd_lane_status)) {
|
||||
result = LINK_TRAINING_EQ_FAIL_CR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dp_is_ch_eq_done(lane_count, dpcd_lane_status) &&
|
||||
dp_is_symbol_locked(link->cur_link_settings.lane_count, dpcd_lane_status) &&
|
||||
dp_is_interlane_aligned(dpcd_lane_status_updated)) {
|
||||
result = LINK_TRAINING_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update VS/PE. */
|
||||
dp_update_drive_settings(lt_settings, req_settings);
|
||||
}
|
||||
|
||||
/* Abort link training if equalization failed due to HPD unplug. */
|
||||
if (!link->hpd_status)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) equalization\n"
|
||||
" - hop(%d)\n - result(%d)\n - retries(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
DPRX,
|
||||
result,
|
||||
retries_eq);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute equalization phase of link training for specified hop in display
|
||||
* path.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis).
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_eq_phase(struct dc_link *link,
|
||||
struct link_training_settings *lt_settings,
|
||||
uint32_t hop)
|
||||
{
|
||||
enum link_training_result result;
|
||||
|
||||
if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
|
||||
result = dpia_training_eq_non_transparent(link, lt_settings, hop);
|
||||
else
|
||||
result = dpia_training_eq_transparent(link, lt_settings);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* End training of specified hop in display path. */
|
||||
static enum dc_status dpcd_clear_lt_pattern(struct dc_link *link, uint32_t hop)
|
||||
{
|
||||
union dpcd_training_pattern dpcd_pattern = { {0} };
|
||||
uint32_t dpcd_tps_offset = DP_TRAINING_PATTERN_SET;
|
||||
enum dc_status status;
|
||||
|
||||
if (hop != DPRX)
|
||||
dpcd_tps_offset = DP_TRAINING_PATTERN_SET_PHY_REPEATER1 +
|
||||
((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (hop - 1));
|
||||
|
||||
status = core_link_write_dpcd(link,
|
||||
dpcd_tps_offset,
|
||||
&dpcd_pattern.raw,
|
||||
sizeof(dpcd_pattern.raw));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* End training of specified hop in display path.
|
||||
*
|
||||
* In transparent LTTPR mode:
|
||||
* - driver clears training pattern for the specified hop in DPCD.
|
||||
* In non-transparent LTTPR mode:
|
||||
* - in addition to clearing training pattern, driver issues USB4 tunneling
|
||||
* (SET_CONFIG) messages to notify DPOA when training is done for first hop
|
||||
* (DPTX-to-DPIA) and last hop (DPRX).
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static enum link_training_result dpia_training_end(struct dc_link *link,
|
||||
uint32_t hop)
|
||||
{
|
||||
enum link_training_result result = LINK_TRAINING_SUCCESS;
|
||||
uint8_t repeater_cnt = 0; /* Number of hops/repeaters in display path. */
|
||||
enum dc_status status;
|
||||
|
||||
if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) {
|
||||
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
|
||||
|
||||
if (hop == repeater_cnt) { /* DPTX-to-DPIA */
|
||||
/* Send SET_CONFIG(SET_TRAINING:0xff) to notify DPOA that
|
||||
* DPTX-to-DPIA hop trained. No DPCD write needed for first hop.
|
||||
*/
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_TRAINING,
|
||||
DPIA_TS_UFP_DONE);
|
||||
if (status != DC_OK)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
} else { /* DPOA-to-x */
|
||||
/* Write 0x0 to TRAINING_PATTERN_SET */
|
||||
status = dpcd_clear_lt_pattern(link, hop);
|
||||
if (status != DC_OK)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
}
|
||||
|
||||
/* Notify DPOA that non-transparent link training of DPRX done. */
|
||||
if (hop == DPRX && result != LINK_TRAINING_ABORT) {
|
||||
status = core_link_send_set_config(link,
|
||||
DPIA_SET_CFG_SET_TRAINING,
|
||||
DPIA_TS_DPRX_DONE);
|
||||
if (status != DC_OK)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
}
|
||||
|
||||
} else { /* non-LTTPR or transparent LTTPR. */
|
||||
/* Write 0x0 to TRAINING_PATTERN_SET */
|
||||
status = dpcd_clear_lt_pattern(link, hop);
|
||||
if (status != DC_OK)
|
||||
result = LINK_TRAINING_ABORT;
|
||||
}
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) end\n - hop(%d)\n - result(%d)\n - LTTPR mode(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
hop,
|
||||
result,
|
||||
link->lttpr_mode);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* When aborting training of specified hop in display path, clean up by:
|
||||
* - Attempting to clear DPCD TRAINING_PATTERN_SET, LINK_BW_SET and LANE_COUNT_SET.
|
||||
* - Sending SET_CONFIG(SET_LINK) with lane count and link rate set to 0.
|
||||
*
|
||||
* @param link DPIA link being trained.
|
||||
* @param hop The Hop in display path. DPRX = 0.
|
||||
*/
|
||||
static void dpia_training_abort(struct dc_link *link, uint32_t hop)
|
||||
{
|
||||
uint8_t data = 0;
|
||||
uint32_t dpcd_tps_offset = DP_TRAINING_PATTERN_SET;
|
||||
|
||||
DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) aborting\n - LTTPR mode(%d)\n - HPD(%d)\n",
|
||||
__func__,
|
||||
link->link_id.enum_id - ENUM_ID_1,
|
||||
link->lttpr_mode,
|
||||
link->hpd_status);
|
||||
|
||||
/* Abandon clean-up if sink unplugged. */
|
||||
if (!link->hpd_status)
|
||||
return;
|
||||
|
||||
if (hop != DPRX)
|
||||
dpcd_tps_offset = DP_TRAINING_PATTERN_SET_PHY_REPEATER1 +
|
||||
((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (hop - 1));
|
||||
|
||||
core_link_write_dpcd(link, dpcd_tps_offset, &data, 1);
|
||||
core_link_write_dpcd(link, DP_LINK_BW_SET, &data, 1);
|
||||
core_link_write_dpcd(link, DP_LANE_COUNT_SET, &data, 1);
|
||||
core_link_send_set_config(link, DPIA_SET_CFG_SET_LINK, data);
|
||||
}
|
||||
|
||||
enum link_training_result dc_link_dpia_perform_link_training(struct dc_link *link,
|
||||
const struct dc_link_settings *link_setting,
|
||||
bool skip_video_pattern)
|
||||
{
|
||||
enum link_training_result result;
|
||||
struct link_training_settings lt_settings;
|
||||
uint8_t repeater_cnt = 0; /* Number of hops/repeaters in display path. */
|
||||
int8_t repeater_id; /* Current hop. */
|
||||
|
||||
/* Configure link as prescribed in link_setting and set LTTPR mode. */
|
||||
result = dpia_configure_link(link, link_setting, <_settings);
|
||||
if (result != LINK_TRAINING_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
|
||||
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
|
||||
|
||||
/* Train each hop in turn starting with the one closest to DPTX.
|
||||
* In transparent or non-LTTPR mode, train only the final hop (DPRX).
|
||||
*/
|
||||
for (repeater_id = repeater_cnt; repeater_id >= 0; repeater_id--) {
|
||||
/* Clock recovery. */
|
||||
result = dpia_training_cr_phase(link, <_settings, repeater_id);
|
||||
if (result != LINK_TRAINING_SUCCESS)
|
||||
break;
|
||||
|
||||
/* Equalization. */
|
||||
result = dpia_training_eq_phase(link, <_settings, repeater_id);
|
||||
if (result != LINK_TRAINING_SUCCESS)
|
||||
break;
|
||||
|
||||
/* Stop training hop. */
|
||||
result = dpia_training_end(link, repeater_id);
|
||||
if (result != LINK_TRAINING_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Double-check link status if training successful; gracefully abort
|
||||
* training of current hop if training failed due to message tunneling
|
||||
* failure; end training of hop if training ended conventionally and
|
||||
* falling back to lower bandwidth settings possible.
|
||||
*/
|
||||
if (result == LINK_TRAINING_SUCCESS) {
|
||||
msleep(5);
|
||||
result = dp_check_link_loss_status(link, <_settings);
|
||||
} else if (result == LINK_TRAINING_ABORT) {
|
||||
dpia_training_abort(link, repeater_id);
|
||||
} else {
|
||||
dpia_training_end(link, repeater_id);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
* Copyright 2021 Advanced Micro Devices, Inc.
|
||||
/* Copyright 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -177,13 +176,27 @@ static enum engine_id find_first_avail_link_enc(
|
||||
return eng_id;
|
||||
}
|
||||
|
||||
static bool is_avail_link_enc(struct dc_state *state, enum engine_id eng_id)
|
||||
/* Check for availability of link encoder eng_id. */
|
||||
static bool is_avail_link_enc(struct dc_state *state, enum engine_id eng_id, struct dc_stream_state *stream)
|
||||
{
|
||||
bool is_avail = false;
|
||||
int eng_idx = eng_id - ENGINE_ID_DIGA;
|
||||
|
||||
if (eng_id != ENGINE_ID_UNKNOWN && state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_idx] != ENGINE_ID_UNKNOWN)
|
||||
/* An encoder is available if it is still in the availability pool. */
|
||||
if (eng_id != ENGINE_ID_UNKNOWN && state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_idx] != ENGINE_ID_UNKNOWN) {
|
||||
is_avail = true;
|
||||
} else {
|
||||
struct dc_stream_state *stream_assigned = NULL;
|
||||
|
||||
/* MST streams share the same link and should share the same encoder.
|
||||
* If a stream that has already been assigned a link encoder uses as the
|
||||
* same link as the stream checking for availability, it is an MST stream
|
||||
* and should use the same link encoder.
|
||||
*/
|
||||
stream_assigned = get_stream_using_link_enc(state, eng_id);
|
||||
if (stream_assigned && stream != stream_assigned && stream->link == stream_assigned->link)
|
||||
is_avail = true;
|
||||
}
|
||||
|
||||
return is_avail;
|
||||
}
|
||||
@@ -296,7 +309,7 @@ void link_enc_cfg_link_encs_assign(
|
||||
if (stream == prev_stream && stream->link == prev_stream->link &&
|
||||
prev_state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[j].valid) {
|
||||
eng_id = prev_state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[j].eng_id;
|
||||
if (is_avail_link_enc(state, eng_id))
|
||||
if (is_avail_link_enc(state, eng_id, stream))
|
||||
add_link_enc_assignment(state, stream, eng_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +372,9 @@ void dp_set_hw_lane_settings(
|
||||
#else
|
||||
encoder->funcs->dp_set_lane_settings(encoder, link_settings);
|
||||
#endif
|
||||
memmove(link->cur_lane_setting,
|
||||
link_settings->lane_settings,
|
||||
sizeof(link->cur_lane_setting));
|
||||
}
|
||||
|
||||
void dp_set_hw_test_pattern(
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "dcn10/dcn10_resource.h"
|
||||
#include "dcn20/dcn20_resource.h"
|
||||
#include "dcn21/dcn21_resource.h"
|
||||
#include "dcn201/dcn201_resource.h"
|
||||
#include "dcn30/dcn30_resource.h"
|
||||
#include "dcn301/dcn301_resource.h"
|
||||
#include "dcn302/dcn302_resource.h"
|
||||
@@ -130,6 +131,10 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)
|
||||
|
||||
case FAMILY_NV:
|
||||
dc_version = DCN_VERSION_2_0;
|
||||
if (asic_id.chip_id == DEVICE_ID_NV_13FE) {
|
||||
dc_version = DCN_VERSION_2_01;
|
||||
break;
|
||||
}
|
||||
if (ASICREV_IS_SIENNA_CICHLID_P(asic_id.hw_internal_rev))
|
||||
dc_version = DCN_VERSION_3_0;
|
||||
if (ASICREV_IS_DIMGREY_CAVEFISH_P(asic_id.hw_internal_rev))
|
||||
@@ -219,6 +224,9 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,
|
||||
case DCN_VERSION_2_1:
|
||||
res_pool = dcn21_create_resource_pool(init_data, dc);
|
||||
break;
|
||||
case DCN_VERSION_2_01:
|
||||
res_pool = dcn201_create_resource_pool(init_data, dc);
|
||||
break;
|
||||
case DCN_VERSION_3_0:
|
||||
res_pool = dcn30_create_resource_pool(init_data, dc);
|
||||
break;
|
||||
|
||||
@@ -61,6 +61,14 @@ void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification
|
||||
|
||||
status = dmub_srv_stat_get_notification(dmub, notify);
|
||||
ASSERT(status == DMUB_STATUS_OK);
|
||||
|
||||
/* For HPD/HPD RX, convert dpia port index into link index */
|
||||
if (notify->type == DMUB_NOTIFICATION_HPD ||
|
||||
notify->type == DMUB_NOTIFICATION_HPD_IRQ ||
|
||||
notify->type == DMUB_NOTIFICATION_SET_CONFIG_REPLY) {
|
||||
notify->link_index =
|
||||
get_link_index_from_dpia_port_index(dc, notify->link_index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,8 +44,10 @@
|
||||
|
||||
/* forward declaration */
|
||||
struct aux_payload;
|
||||
struct set_config_cmd_payload;
|
||||
struct dmub_notification;
|
||||
|
||||
#define DC_VER "3.2.154"
|
||||
#define DC_VER "3.2.156"
|
||||
|
||||
#define MAX_SURFACES 3
|
||||
#define MAX_PLANES 6
|
||||
@@ -477,6 +479,33 @@ union mem_low_power_enable_options {
|
||||
uint32_t u32All;
|
||||
};
|
||||
|
||||
union root_clock_optimization_options {
|
||||
struct {
|
||||
bool dpp: 1;
|
||||
bool dsc: 1;
|
||||
bool hdmistream: 1;
|
||||
bool hdmichar: 1;
|
||||
bool dpstream: 1;
|
||||
bool symclk32_se: 1;
|
||||
bool symclk32_le: 1;
|
||||
bool symclk_fe: 1;
|
||||
bool physymclk: 1;
|
||||
bool dpiasymclk: 1;
|
||||
uint32_t reserved: 22;
|
||||
} bits;
|
||||
uint32_t u32All;
|
||||
};
|
||||
|
||||
union dpia_debug_options {
|
||||
struct {
|
||||
uint32_t disable_dpia:1;
|
||||
uint32_t force_non_lttpr:1;
|
||||
uint32_t extend_aux_rd_interval:1;
|
||||
uint32_t reserved:29;
|
||||
} bits;
|
||||
uint32_t raw;
|
||||
};
|
||||
|
||||
struct dc_debug_data {
|
||||
uint32_t ltFailCount;
|
||||
uint32_t i2cErrorCount;
|
||||
@@ -565,6 +594,7 @@ struct dc_debug_options {
|
||||
enum wm_report_mode pplib_wm_report_mode;
|
||||
unsigned int min_disp_clk_khz;
|
||||
unsigned int min_dpp_clk_khz;
|
||||
unsigned int min_dram_clk_khz;
|
||||
int sr_exit_time_dpm0_ns;
|
||||
int sr_enter_plus_exit_time_dpm0_ns;
|
||||
int sr_exit_time_ns;
|
||||
@@ -636,6 +666,7 @@ struct dc_debug_options {
|
||||
bool legacy_dp2_lt;
|
||||
#endif
|
||||
union mem_low_power_enable_options enable_mem_low_power;
|
||||
union root_clock_optimization_options root_clock_optimization;
|
||||
bool force_vblank_alignment;
|
||||
|
||||
/* Enable dmub aux for legacy ddc */
|
||||
@@ -647,6 +678,7 @@ struct dc_debug_options {
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
bool disable_z10;
|
||||
bool enable_sw_cntl_psr;
|
||||
union dpia_debug_options dpia_debug;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1165,6 +1197,7 @@ struct dpcd_caps {
|
||||
struct dpcd_dsc_capabilities dsc_caps;
|
||||
struct dc_lttpr_caps lttpr_caps;
|
||||
struct psr_caps psr_caps;
|
||||
struct dpcd_usb4_dp_tunneling_info usb4_dp_tun_info;
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
union dp_128b_132b_supported_link_rates dp_128b_132b_supported_link_rates;
|
||||
@@ -1313,6 +1346,8 @@ void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
|
||||
enum dc_irq_source dc_get_hpd_irq_source_at_index(
|
||||
struct dc *dc, uint32_t link_index);
|
||||
|
||||
void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable);
|
||||
|
||||
/*******************************************************************************
|
||||
* Power Interfaces
|
||||
******************************************************************************/
|
||||
@@ -1373,6 +1408,14 @@ bool dc_process_dmub_aux_transfer_async(struct dc *dc,
|
||||
uint32_t link_index,
|
||||
struct aux_payload *payload);
|
||||
|
||||
/* Get dc link index from dpia port index */
|
||||
uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,
|
||||
uint8_t dpia_port_index);
|
||||
|
||||
bool dc_process_dmub_set_config_async(struct dc *dc,
|
||||
uint32_t link_index,
|
||||
struct set_config_cmd_payload *payload,
|
||||
struct dmub_notification *notify);
|
||||
/*******************************************************************************
|
||||
* DSC Interfaces
|
||||
******************************************************************************/
|
||||
|
||||
@@ -859,29 +859,104 @@ struct psr_caps {
|
||||
bool psr_exit_link_training_required;
|
||||
};
|
||||
|
||||
/* Length of router topology ID read from DPCD in bytes. */
|
||||
#define DPCD_USB4_TOPOLOGY_ID_LEN 5
|
||||
|
||||
/* DPCD[0xE000D] DP_TUNNELING_CAPABILITIES SUPPORT register. */
|
||||
union dp_tun_cap_support {
|
||||
struct {
|
||||
uint8_t dp_tunneling :1;
|
||||
uint8_t rsvd :5;
|
||||
uint8_t panel_replay_tun_opt :1;
|
||||
uint8_t dpia_bw_alloc :1;
|
||||
} bits;
|
||||
uint8_t raw;
|
||||
};
|
||||
|
||||
/* DPCD[0xE000E] DP_IN_ADAPTER_INFO register. */
|
||||
union dpia_info {
|
||||
struct {
|
||||
uint8_t dpia_num :5;
|
||||
uint8_t rsvd :3;
|
||||
} bits;
|
||||
uint8_t raw;
|
||||
};
|
||||
|
||||
/* DP Tunneling over USB4 */
|
||||
struct dpcd_usb4_dp_tunneling_info {
|
||||
union dp_tun_cap_support dp_tun_cap;
|
||||
union dpia_info dpia_info;
|
||||
uint8_t usb4_driver_id;
|
||||
uint8_t usb4_topology_id[DPCD_USB4_TOPOLOGY_ID_LEN];
|
||||
};
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
#ifndef DP_MAIN_LINK_CHANNEL_CODING_CAP
|
||||
#define DP_MAIN_LINK_CHANNEL_CODING_CAP 0x006
|
||||
#endif
|
||||
#ifndef DP_SINK_VIDEO_FALLBACK_FORMATS
|
||||
#define DP_SINK_VIDEO_FALLBACK_FORMATS 0x020
|
||||
#endif
|
||||
#ifndef DP_FEC_CAPABILITY_1
|
||||
#define DP_FEC_CAPABILITY_1 0x091
|
||||
#endif
|
||||
#ifndef DP_DFP_CAPABILITY_EXTENSION_SUPPORT
|
||||
#define DP_DFP_CAPABILITY_EXTENSION_SUPPORT 0x0A3
|
||||
#endif
|
||||
#ifndef DP_DSC_CONFIGURATION
|
||||
#define DP_DSC_CONFIGURATION 0x161
|
||||
#endif
|
||||
#ifndef DP_PHY_SQUARE_PATTERN
|
||||
#define DP_PHY_SQUARE_PATTERN 0x249
|
||||
#endif
|
||||
#ifndef DP_128b_132b_SUPPORTED_LINK_RATES
|
||||
#define DP_128b_132b_SUPPORTED_LINK_RATES 0x2215
|
||||
#endif
|
||||
#ifndef DP_128b_132b_TRAINING_AUX_RD_INTERVAL
|
||||
#define DP_128b_132b_TRAINING_AUX_RD_INTERVAL 0x2216
|
||||
#endif
|
||||
#ifndef DP_TEST_264BIT_CUSTOM_PATTERN_7_0
|
||||
#define DP_TEST_264BIT_CUSTOM_PATTERN_7_0 0X2230
|
||||
#endif
|
||||
#ifndef DP_TEST_264BIT_CUSTOM_PATTERN_263_256
|
||||
#define DP_TEST_264BIT_CUSTOM_PATTERN_263_256 0X2250
|
||||
#endif
|
||||
#ifndef DP_DSC_SUPPORT_AND_DECODER_COUNT
|
||||
#define DP_DSC_SUPPORT_AND_DECODER_COUNT 0x2260
|
||||
#endif
|
||||
#ifndef DP_DSC_MAX_SLICE_COUNT_AND_AGGREGATION_0
|
||||
#define DP_DSC_MAX_SLICE_COUNT_AND_AGGREGATION_0 0x2270
|
||||
# define DP_DSC_DECODER_0_MAXIMUM_SLICE_COUNT_MASK (1 << 0)
|
||||
# define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_MASK (0b111 << 1)
|
||||
# define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_SHIFT 1
|
||||
# define DP_DSC_DECODER_COUNT_MASK (0b111 << 5)
|
||||
# define DP_DSC_DECODER_COUNT_SHIFT 5
|
||||
#endif
|
||||
#ifndef DP_DSC_DECODER_0_MAXIMUM_SLICE_COUNT_MASK
|
||||
#define DP_DSC_DECODER_0_MAXIMUM_SLICE_COUNT_MASK (1 << 0)
|
||||
#endif
|
||||
#ifndef DP_DSC_DECODER_0_AGGREGATION_SUPPORT_MASK
|
||||
#define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_MASK (0b111 << 1)
|
||||
#endif
|
||||
#ifndef DP_DSC_DECODER_0_AGGREGATION_SUPPORT_SHIFT
|
||||
#define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_SHIFT 1
|
||||
#endif
|
||||
#ifndef DP_DSC_DECODER_COUNT_MASK
|
||||
#define DP_DSC_DECODER_COUNT_MASK (0b111 << 5)
|
||||
#endif
|
||||
#ifndef DP_DSC_DECODER_COUNT_SHIFT
|
||||
#define DP_DSC_DECODER_COUNT_SHIFT 5
|
||||
#endif
|
||||
#ifndef DP_MAIN_LINK_CHANNEL_CODING_SET
|
||||
#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
|
||||
#endif
|
||||
#ifndef DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER
|
||||
#define DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER 0xF0006
|
||||
#endif
|
||||
#ifndef DP_PHY_REPEATER_128b_132b_RATES
|
||||
#define DP_PHY_REPEATER_128b_132b_RATES 0xF0007
|
||||
#endif
|
||||
#ifndef DP_128b_132b_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1
|
||||
#define DP_128b_132b_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 0xF0022
|
||||
#endif
|
||||
#ifndef DP_INTRA_HOP_AUX_REPLY_INDICATION
|
||||
#define DP_INTRA_HOP_AUX_REPLY_INDICATION (1 << 3)
|
||||
#endif
|
||||
/* TODO - Use DRM header to replace above once available */
|
||||
|
||||
union dp_main_line_channel_coding_cap {
|
||||
|
||||
@@ -121,7 +121,7 @@ struct dc_link {
|
||||
struct dc_link_settings reported_link_cap;
|
||||
struct dc_link_settings verified_link_cap;
|
||||
struct dc_link_settings cur_link_settings;
|
||||
struct dc_lane_settings cur_lane_setting;
|
||||
struct dc_lane_settings cur_lane_setting[LANE_COUNT_DP_MAX];
|
||||
struct dc_link_settings preferred_link_setting;
|
||||
struct dc_link_training_overrides preferred_training_settings;
|
||||
struct dp_audio_test_data audio_test_data;
|
||||
@@ -277,6 +277,7 @@ bool dc_link_setup_psr(struct dc_link *dc_link,
|
||||
struct psr_context *psr_context);
|
||||
|
||||
void dc_link_get_psr_residency(const struct dc_link *link, uint32_t *residency);
|
||||
void blank_all_dp_displays(struct dc *dc, bool hw_init);
|
||||
|
||||
/* Request DC to detect if there is a Panel connected.
|
||||
* boot - If this call is during initial boot.
|
||||
|
||||
@@ -955,6 +955,7 @@ enum dc_psr_version {
|
||||
/* Possible values of display_endpoint_id.endpoint */
|
||||
enum display_endpoint_type {
|
||||
DISPLAY_ENDPOINT_PHY = 0, /* Physical connector. */
|
||||
DISPLAY_ENDPOINT_USB4_DPIA, /* USB4 DisplayPort tunnel. */
|
||||
DISPLAY_ENDPOINT_UNKNOWN = -1
|
||||
};
|
||||
|
||||
|
||||
@@ -627,6 +627,7 @@ int dce_aux_transfer_dmub_raw(struct ddc_service *ddc,
|
||||
#define AUX_MAX_I2C_DEFER_RETRIES 7
|
||||
#define AUX_MAX_INVALID_REPLY_RETRIES 2
|
||||
#define AUX_MAX_TIMEOUT_RETRIES 3
|
||||
#define AUX_DEFER_DELAY_FOR_DPIA 4 /*ms*/
|
||||
|
||||
static void dce_aux_log_payload(const char *payload_name,
|
||||
unsigned char *payload, uint32_t length, uint32_t max_length_to_log)
|
||||
@@ -772,6 +773,8 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
|
||||
/* polling_timeout_period is in us */
|
||||
if (aux110)
|
||||
defer_time_in_ms += aux110->polling_timeout_period / 1000;
|
||||
else
|
||||
defer_time_in_ms += AUX_DEFER_DELAY_FOR_DPIA;
|
||||
++aux_defer_retries;
|
||||
fallthrough;
|
||||
case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:
|
||||
|
||||
@@ -76,6 +76,15 @@
|
||||
SRII(PIXEL_RATE_CNTL, OTG, 4),\
|
||||
SRII(PIXEL_RATE_CNTL, OTG, 5)
|
||||
|
||||
#define CS_COMMON_REG_LIST_DCN201(index, pllid) \
|
||||
SRI(PIXCLK_RESYNC_CNTL, PHYPLL, pllid),\
|
||||
SRII(PHASE, DP_DTO, 0),\
|
||||
SRII(PHASE, DP_DTO, 1),\
|
||||
SRII(MODULO, DP_DTO, 0),\
|
||||
SRII(MODULO, DP_DTO, 1),\
|
||||
SRII(PIXEL_RATE_CNTL, OTG, 0),\
|
||||
SRII(PIXEL_RATE_CNTL, OTG, 1)
|
||||
|
||||
#define CS_COMMON_REG_LIST_DCN2_1(index, pllid) \
|
||||
SRI(PIXCLK_RESYNC_CNTL, PHYPLL, pllid),\
|
||||
SRII(PHASE, DP_DTO, 0),\
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
SRII(PIXEL_RATE_CNTL, blk, 4), \
|
||||
SRII(PIXEL_RATE_CNTL, blk, 5)
|
||||
|
||||
#define HWSEQ_PIXEL_RATE_REG_LIST_201(blk) \
|
||||
SRII(PIXEL_RATE_CNTL, blk, 0), \
|
||||
SRII(PIXEL_RATE_CNTL, blk, 1)
|
||||
|
||||
#define HWSEQ_PHYPLL_REG_LIST(blk) \
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 0), \
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 1), \
|
||||
@@ -94,6 +98,10 @@
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 4), \
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 5)
|
||||
|
||||
#define HWSEQ_PHYPLL_REG_LIST_201(blk) \
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 0), \
|
||||
SRII(PHYPLL_PIXEL_RATE_CNTL, blk, 1)
|
||||
|
||||
#define HWSEQ_DCE11_REG_LIST_BASE() \
|
||||
SR(DC_MEM_GLOBAL_PWR_REQ_CNTL), \
|
||||
SR(DCFEV_CLOCK_CONTROL), \
|
||||
@@ -337,6 +345,29 @@
|
||||
SR(D6VGA_CONTROL), \
|
||||
SR(DC_IP_REQUEST_CNTL)
|
||||
|
||||
#define HWSEQ_DCN201_REG_LIST()\
|
||||
HWSEQ_DCN_REG_LIST(), \
|
||||
HWSEQ_PIXEL_RATE_REG_LIST_201(OTG), \
|
||||
HWSEQ_PHYPLL_REG_LIST_201(OTG), \
|
||||
SR(MICROSECOND_TIME_BASE_DIV), \
|
||||
SR(MILLISECOND_TIME_BASE_DIV), \
|
||||
SR(DISPCLK_FREQ_CHANGE_CNTL), \
|
||||
SR(RBBMIF_TIMEOUT_DIS), \
|
||||
SR(RBBMIF_TIMEOUT_DIS_2), \
|
||||
SR(DCHUBBUB_CRC_CTRL), \
|
||||
SR(DPP_TOP0_DPP_CRC_CTRL), \
|
||||
SR(DPP_TOP0_DPP_CRC_VAL_B_A), \
|
||||
SR(DPP_TOP0_DPP_CRC_VAL_R_G), \
|
||||
SR(MPC_CRC_CTRL), \
|
||||
SR(MPC_CRC_RESULT_GB), \
|
||||
SR(MPC_CRC_RESULT_C), \
|
||||
SR(MPC_CRC_RESULT_AR), \
|
||||
SR(AZALIA_AUDIO_DTO), \
|
||||
SR(AZALIA_CONTROLLER_CLOCK_GATING), \
|
||||
MMHUB_SR(MC_VM_FB_LOCATION_BASE), \
|
||||
MMHUB_SR(MC_VM_FB_LOCATION_TOP), \
|
||||
MMHUB_SR(MC_VM_FB_OFFSET)
|
||||
|
||||
#define HWSEQ_DCN30_REG_LIST()\
|
||||
HWSEQ_DCN2_REG_LIST(),\
|
||||
HWSEQ_DCN_REG_LIST(), \
|
||||
@@ -637,6 +668,9 @@ struct dce_hwseq_registers {
|
||||
uint32_t DMU_MEM_PWR_CNTL;
|
||||
uint32_t MMHUBBUB_MEM_PWR_CNTL;
|
||||
uint32_t DCHUBBUB_ARB_HOSTVM_CNTL;
|
||||
uint32_t MC_VM_FB_LOCATION_BASE;
|
||||
uint32_t MC_VM_FB_LOCATION_TOP;
|
||||
uint32_t MC_VM_FB_OFFSET;
|
||||
};
|
||||
/* set field name */
|
||||
#define HWS_SF(blk_name, reg_name, field_name, post_fix)\
|
||||
@@ -872,6 +906,11 @@ struct dce_hwseq_registers {
|
||||
HWS_SF(, DOMAIN18_PG_STATUS, DOMAIN18_PGFSM_PWR_STATUS, mask_sh), \
|
||||
HWS_SF(, DC_IP_REQUEST_CNTL, IP_REQUEST_EN, mask_sh)
|
||||
|
||||
#define HWSEQ_DCN201_MASK_SH_LIST(mask_sh)\
|
||||
HWSEQ_DCN_MASK_SH_LIST(mask_sh), \
|
||||
HWS_SF(, DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, mask_sh), \
|
||||
HWS_SF(, AZALIA_AUDIO_DTO, AZALIA_AUDIO_DTO_MODULE, mask_sh)
|
||||
|
||||
#define HWSEQ_DCN30_MASK_SH_LIST(mask_sh)\
|
||||
HWSEQ_DCN2_MASK_SH_LIST(mask_sh), \
|
||||
HWS_SF(, AZALIA_AUDIO_DTO, AZALIA_AUDIO_DTO_MODULE, mask_sh), \
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user