mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
Merge tag 'amd-drm-next-6.4-2023-03-31' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.4-2023-03-31: amdgpu: - Misc code cleanups - S4 fixes - MES fixes - SR-IOV fixes - Link DC backlight to connector device rather than PCI device - W=1 fixes - ASPM quirk - RAS fixes - DC dynamic split fixes and enablement for remaining chips - Navi1x SMU fix - Initial NBIO 7.9 support - Initial GC 9.4.3 support - Initial GFXHUB 1.2 support - Initial MMHUB 1.8 support - DCN 3.1.5 fixes - Initial DC FAMs infrastructure - Add support for 6.75Gbps link rates - Add sysfs nodes for secondary VCN clocks amdkfd: - Initial support for GC 9.4.3 radeon: - Convert to client-based fbdev emulation Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230331221955.7896-1-alexander.deucher@amd.com
This commit is contained in:
commit
1138398d71
|
|
@ -77,7 +77,8 @@ amdgpu-y += \
|
|||
vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \
|
||||
vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o arct_reg_init.o mxgpu_nv.o \
|
||||
nbio_v7_2.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o soc21.o \
|
||||
sienna_cichlid.o smu_v13_0_10.o nbio_v4_3.o hdp_v6_0.o nbio_v7_7.o hdp_v5_2.o lsdma_v6_0.o
|
||||
sienna_cichlid.o smu_v13_0_10.o nbio_v4_3.o hdp_v6_0.o nbio_v7_7.o hdp_v5_2.o lsdma_v6_0.o \
|
||||
nbio_v7_9.o
|
||||
|
||||
# add DF block
|
||||
amdgpu-y += \
|
||||
|
|
@ -92,7 +93,7 @@ amdgpu-y += \
|
|||
gfxhub_v1_0.o mmhub_v1_0.o gmc_v9_0.o gfxhub_v1_1.o mmhub_v9_4.o \
|
||||
gfxhub_v2_0.o mmhub_v2_0.o gmc_v10_0.o gfxhub_v2_1.o mmhub_v2_3.o \
|
||||
mmhub_v1_7.o gfxhub_v3_0.o mmhub_v3_0.o mmhub_v3_0_2.o gmc_v11_0.o \
|
||||
mmhub_v3_0_1.o gfxhub_v3_0_3.o
|
||||
mmhub_v3_0_1.o gfxhub_v3_0_3.o gfxhub_v1_2.o mmhub_v1_8.o
|
||||
|
||||
# add UMC block
|
||||
amdgpu-y += \
|
||||
|
|
|
|||
|
|
@ -3181,9 +3181,11 @@ static int amdgpu_device_ip_reinit_late_sriov(struct amdgpu_device *adev)
|
|||
AMD_IP_BLOCK_TYPE_DCE,
|
||||
AMD_IP_BLOCK_TYPE_GFX,
|
||||
AMD_IP_BLOCK_TYPE_SDMA,
|
||||
AMD_IP_BLOCK_TYPE_MES,
|
||||
AMD_IP_BLOCK_TYPE_UVD,
|
||||
AMD_IP_BLOCK_TYPE_VCE,
|
||||
AMD_IP_BLOCK_TYPE_VCN
|
||||
AMD_IP_BLOCK_TYPE_VCN,
|
||||
AMD_IP_BLOCK_TYPE_JPEG
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ip_order); i++) {
|
||||
|
|
@ -5176,6 +5178,7 @@ static inline void amdgpu_device_stop_pending_resets(struct amdgpu_device *adev)
|
|||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @job: which job trigger hang
|
||||
* @reset_context: amdgpu reset context pointer
|
||||
*
|
||||
* Attempt to reset the GPU if it has hung (all asics).
|
||||
* Attempt to do soft-reset or full-reset and reinitialize Asic
|
||||
|
|
@ -5345,8 +5348,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
|
|||
if (r)
|
||||
adev->asic_reset_res = r;
|
||||
|
||||
/* Aldebaran supports ras in SRIOV, so need resume ras during reset */
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
/* Aldebaran and gfx_11_0_3 support ras in SRIOV, so need resume ras during reset */
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(11, 0, 3))
|
||||
amdgpu_ras_resume(adev);
|
||||
} else {
|
||||
r = amdgpu_do_asic_reset(device_list_handle, reset_context);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "nbio_v6_1.h"
|
||||
#include "nbio_v7_0.h"
|
||||
#include "nbio_v7_4.h"
|
||||
#include "nbio_v7_9.h"
|
||||
#include "hdp_v4_0.h"
|
||||
#include "vega10_ih.h"
|
||||
#include "vega20_ih.h"
|
||||
|
|
@ -1546,6 +1547,7 @@ static int amdgpu_discovery_set_gmc_ip_blocks(struct amdgpu_device *adev)
|
|||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(10, 1, 10):
|
||||
|
|
@ -1948,9 +1950,8 @@ static int amdgpu_discovery_set_mm_ip_blocks(struct amdgpu_device *adev)
|
|||
case IP_VERSION(4, 0, 2):
|
||||
case IP_VERSION(4, 0, 4):
|
||||
amdgpu_device_ip_block_add(adev, &vcn_v4_0_ip_block);
|
||||
if (!amdgpu_sriov_vf(adev))
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v4_0_ip_block);
|
||||
break;
|
||||
amdgpu_device_ip_block_add(adev, &jpeg_v4_0_ip_block);
|
||||
return 0;
|
||||
default:
|
||||
dev_err(adev->dev,
|
||||
"Failed to add vcn/jpeg ip block(UVD_HWIP:0x%x)\n",
|
||||
|
|
@ -2181,6 +2182,7 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
|
|||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
adev->family = AMDGPU_FAMILY_AI;
|
||||
break;
|
||||
case IP_VERSION(9, 1, 0):
|
||||
|
|
@ -2265,6 +2267,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
|
|||
adev->nbio.funcs = &nbio_v7_4_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(7, 9, 0):
|
||||
adev->nbio.funcs = &nbio_v7_9_funcs;
|
||||
adev->nbio.hdp_flush_reg = &nbio_v7_9_hdp_flush_reg;
|
||||
break;
|
||||
case IP_VERSION(7, 2, 0):
|
||||
case IP_VERSION(7, 2, 1):
|
||||
case IP_VERSION(7, 3, 0):
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ uint amdgpu_pcie_lane_cap;
|
|||
u64 amdgpu_cg_mask = 0xffffffffffffffff;
|
||||
uint amdgpu_pg_mask = 0xffffffff;
|
||||
uint amdgpu_sdma_phase_quantum = 32;
|
||||
char *amdgpu_disable_cu = NULL;
|
||||
char *amdgpu_virtual_display = NULL;
|
||||
char *amdgpu_disable_cu;
|
||||
char *amdgpu_virtual_display;
|
||||
|
||||
/*
|
||||
* OverDrive(bit 14) disabled by default
|
||||
|
|
@ -822,7 +822,7 @@ MODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = defa
|
|||
* DOC: no_queue_eviction_on_vm_fault (int)
|
||||
* If set, process queues will not be evicted on gpuvm fault. This is to keep the wavefront context for debugging (0 = queue eviction, 1 = no queue eviction). The default is 0 (queue eviction).
|
||||
*/
|
||||
int amdgpu_no_queue_eviction_on_vm_fault = 0;
|
||||
int amdgpu_no_queue_eviction_on_vm_fault;
|
||||
MODULE_PARM_DESC(no_queue_eviction_on_vm_fault, "No queue eviction on VM fault (0 = queue eviction, 1 = no queue eviction)");
|
||||
module_param_named(no_queue_eviction_on_vm_fault, amdgpu_no_queue_eviction_on_vm_fault, int, 0444);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -624,6 +624,7 @@ void amdgpu_gmc_noretry_set(struct amdgpu_device *adev)
|
|||
gc_ver == IP_VERSION(9, 4, 0) ||
|
||||
gc_ver == IP_VERSION(9, 4, 1) ||
|
||||
gc_ver == IP_VERSION(9, 4, 2) ||
|
||||
gc_ver == IP_VERSION(9, 4, 3) ||
|
||||
gc_ver >= IP_VERSION(10, 3, 0));
|
||||
|
||||
gmc->noretry = (amdgpu_noretry == -1) ? noretry_default : amdgpu_noretry;
|
||||
|
|
|
|||
|
|
@ -118,6 +118,10 @@ int amdgpu_jpeg_dec_ring_test_ring(struct amdgpu_ring *ring)
|
|||
unsigned i;
|
||||
int r;
|
||||
|
||||
/* JPEG in SRIOV does not support direct register read/write */
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
WREG32(adev->jpeg.inst[ring->me].external.jpeg_pitch, 0xCAFEDEAD);
|
||||
r = amdgpu_ring_alloc(ring, 3);
|
||||
if (r)
|
||||
|
|
@ -202,17 +206,18 @@ int amdgpu_jpeg_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
|||
} else {
|
||||
r = 0;
|
||||
}
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
for (i = 0; i < adev->usec_timeout; i++) {
|
||||
tmp = RREG32(adev->jpeg.inst[ring->me].external.jpeg_pitch);
|
||||
if (tmp == 0xDEADBEEF)
|
||||
break;
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < adev->usec_timeout; i++) {
|
||||
tmp = RREG32(adev->jpeg.inst[ring->me].external.jpeg_pitch);
|
||||
if (tmp == 0xDEADBEEF)
|
||||
break;
|
||||
udelay(1);
|
||||
if (i >= adev->usec_timeout)
|
||||
r = -ETIMEDOUT;
|
||||
}
|
||||
|
||||
if (i >= adev->usec_timeout)
|
||||
r = -ETIMEDOUT;
|
||||
|
||||
dma_fence_put(fence);
|
||||
error:
|
||||
return r;
|
||||
|
|
|
|||
|
|
@ -1104,6 +1104,11 @@ int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,
|
|||
&ctx_data->meta_data_obj,
|
||||
&ctx_data->meta_data_mc_addr,
|
||||
&ctx_data->meta_data_ptr);
|
||||
if (r) {
|
||||
dev_warn(adev->dev, "(%d) create CTX bo failed\n", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!ctx_data->meta_data_obj)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1328,12 +1333,9 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
|
|||
struct amdgpu_mes_ctx_data ctx_data = {0};
|
||||
struct amdgpu_ring *added_rings[AMDGPU_MES_CTX_MAX_RINGS] = { NULL };
|
||||
int gang_ids[3] = {0};
|
||||
int queue_types[][2] = { { AMDGPU_RING_TYPE_GFX,
|
||||
AMDGPU_MES_CTX_MAX_GFX_RINGS},
|
||||
{ AMDGPU_RING_TYPE_COMPUTE,
|
||||
AMDGPU_MES_CTX_MAX_COMPUTE_RINGS},
|
||||
{ AMDGPU_RING_TYPE_SDMA,
|
||||
AMDGPU_MES_CTX_MAX_SDMA_RINGS } };
|
||||
int queue_types[][2] = { { AMDGPU_RING_TYPE_GFX, 1 },
|
||||
{ AMDGPU_RING_TYPE_COMPUTE, 1 },
|
||||
{ AMDGPU_RING_TYPE_SDMA, 1} };
|
||||
int i, r, pasid, k = 0;
|
||||
|
||||
pasid = amdgpu_pasid_alloc(16);
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ static int psp_init_sriov_microcode(struct psp_context *psp)
|
|||
break;
|
||||
case IP_VERSION(13, 0, 10):
|
||||
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA;
|
||||
ret = psp_init_cap_microcode(psp, ucode_prefix);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
|
@ -838,7 +839,15 @@ static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
|
|||
static int psp_tmr_unload(struct psp_context *psp)
|
||||
{
|
||||
int ret;
|
||||
struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
|
||||
struct psp_gfx_cmd_resp *cmd;
|
||||
|
||||
/* skip TMR unload for Navi12 and CHIP_SIENNA_CICHLID SRIOV,
|
||||
* as TMR is not loaded at all
|
||||
*/
|
||||
if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
|
||||
return 0;
|
||||
|
||||
cmd = acquire_psp_cmd_buf(psp);
|
||||
|
||||
psp_prep_tmr_unload_cmd_buf(psp, cmd);
|
||||
dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "amdgpu_atomfirmware.h"
|
||||
#include "amdgpu_xgmi.h"
|
||||
#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
|
||||
#include "nbio_v4_3.h"
|
||||
#include "atom.h"
|
||||
#include "amdgpu_reset.h"
|
||||
|
||||
|
|
@ -2340,6 +2341,7 @@ static bool amdgpu_ras_asic_supported(struct amdgpu_device *adev)
|
|||
if (amdgpu_sriov_vf(adev)) {
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 2):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -2561,6 +2563,16 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
|
|||
if (!adev->gmc.xgmi.connected_to_cpu)
|
||||
adev->nbio.ras = &nbio_v7_4_ras;
|
||||
break;
|
||||
case IP_VERSION(4, 3, 0):
|
||||
if (adev->ras_hw_enabled & (1 << AMDGPU_RAS_BLOCK__DF))
|
||||
/* unlike other generation of nbio ras,
|
||||
* nbio v4_3 only support fatal error interrupt
|
||||
* to inform software that DF is freezed due to
|
||||
* system fatal error event. driver should not
|
||||
* enable nbio ras in such case. Instead,
|
||||
* check DF RAS */
|
||||
adev->nbio.ras = &nbio_v4_3_ras;
|
||||
break;
|
||||
default:
|
||||
/* nbio ras is not available */
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -181,14 +181,14 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
|||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case CHIP_ARCTURUS:
|
||||
return __get_eeprom_i2c_addr_arct(adev, control);
|
||||
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case CHIP_ALDEBARAN:
|
||||
if (strnstr(atom_ctx->vbios_version, "D673",
|
||||
|
|
@ -196,7 +196,7 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
|||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
break;
|
||||
return true;
|
||||
|
||||
case CHIP_IP_DISCOVERY:
|
||||
return __get_eeprom_i2c_addr_ip_discovery(adev, control);
|
||||
|
|
@ -204,17 +204,6 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[MP1_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 0):
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -126,19 +126,6 @@ void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr)
|
|||
}
|
||||
}
|
||||
|
||||
void amdgpu_ucode_print_imu_hdr(const struct common_firmware_header *hdr)
|
||||
{
|
||||
uint16_t version_major = le16_to_cpu(hdr->header_version_major);
|
||||
uint16_t version_minor = le16_to_cpu(hdr->header_version_minor);
|
||||
|
||||
DRM_DEBUG("IMU\n");
|
||||
amdgpu_ucode_print_common_hdr(hdr);
|
||||
|
||||
if (version_major != 1) {
|
||||
DRM_ERROR("Unknown GFX ucode version: %u.%u\n", version_major, version_minor);
|
||||
}
|
||||
}
|
||||
|
||||
void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr)
|
||||
{
|
||||
uint16_t version_major = le16_to_cpu(hdr->header_version_major);
|
||||
|
|
@ -472,6 +459,12 @@ void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr)
|
|||
DRM_DEBUG("psp_dbg_drv_size_bytes: %u\n",
|
||||
le32_to_cpu(desc->size_bytes));
|
||||
break;
|
||||
case PSP_FW_TYPE_PSP_RAS_DRV:
|
||||
DRM_DEBUG("psp_ras_drv_version: %u\n",
|
||||
le32_to_cpu(desc->fw_version));
|
||||
DRM_DEBUG("psp_ras_drv_size_bytes: %u\n",
|
||||
le32_to_cpu(desc->size_bytes));
|
||||
break;
|
||||
default:
|
||||
DRM_DEBUG("Unsupported PSP fw type: %d\n", desc->fw_type);
|
||||
break;
|
||||
|
|
@ -669,6 +662,8 @@ const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id)
|
|||
return "VCN1_RAM";
|
||||
case AMDGPU_UCODE_ID_DMCUB:
|
||||
return "DMCUB";
|
||||
case AMDGPU_UCODE_ID_CAP:
|
||||
return "CAP";
|
||||
default:
|
||||
return "UNKNOWN UCODE";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ int amdgpu_umc_ras_sw_init(struct amdgpu_device *adev)
|
|||
if (!ras->ras_block.ras_late_init)
|
||||
ras->ras_block.ras_late_init = amdgpu_umc_ras_late_init;
|
||||
|
||||
if (ras->ras_block.ras_cb)
|
||||
if (!ras->ras_block.ras_cb)
|
||||
ras->ras_block.ras_cb = amdgpu_umc_process_ras_data_cb;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -585,6 +585,7 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
|
|||
/**
|
||||
* amdgpu_vce_validate_bo - make sure not to cross 4GB boundary
|
||||
*
|
||||
* @p: cs parser
|
||||
* @ib: indirect buffer to use
|
||||
* @lo: address of lower dword
|
||||
* @hi: address of higher dword
|
||||
|
|
|
|||
|
|
@ -673,6 +673,7 @@ void amdgpu_vm_pt_free_work(struct work_struct *work)
|
|||
* @adev: amdgpu device structure
|
||||
* @vm: amdgpu vm structure
|
||||
* @start: optional cursor where to start freeing PDs/PTs
|
||||
* @unlocked: vm resv unlock status
|
||||
*
|
||||
* Free the page directory or page table level and all sub levels.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static void amdgpu_vm_sdma_copy_ptes(struct amdgpu_vm_update_params *p,
|
|||
|
||||
src += p->num_dw_left * 4;
|
||||
|
||||
pe += amdgpu_gmc_sign_extend(amdgpu_bo_gpu_offset_no_check(bo));
|
||||
pe += amdgpu_bo_gpu_offset_no_check(bo);
|
||||
trace_amdgpu_vm_copy_ptes(pe, src, count, p->immediate);
|
||||
|
||||
amdgpu_vm_copy_pte(p->adev, ib, pe, src, count);
|
||||
|
|
@ -198,7 +198,7 @@ static void amdgpu_vm_sdma_set_ptes(struct amdgpu_vm_update_params *p,
|
|||
{
|
||||
struct amdgpu_ib *ib = p->job->ibs;
|
||||
|
||||
pe += amdgpu_gmc_sign_extend(amdgpu_bo_gpu_offset_no_check(bo));
|
||||
pe += amdgpu_bo_gpu_offset_no_check(bo);
|
||||
trace_amdgpu_vm_set_ptes(pe, addr, count, incr, flags, p->immediate);
|
||||
if (count < 3) {
|
||||
amdgpu_vm_write_pte(p->adev, ib, pe, addr | flags,
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ int amdgpu_xgmi_ras_sw_init(struct amdgpu_device *adev)
|
|||
return err;
|
||||
}
|
||||
|
||||
strcpy(ras->ras_block.ras_comm.name, "xgmi_wafl_pcs");
|
||||
strcpy(ras->ras_block.ras_comm.name, "xgmi_wafl");
|
||||
ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
|
||||
ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
|
||||
adev->gmc.xgmi.ras_if = &ras->ras_block.ras_comm;
|
||||
|
|
|
|||
471
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
Normal file
471
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
Normal file
|
|
@ -0,0 +1,471 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
#include "amdgpu.h"
|
||||
#include "gfxhub_v1_2.h"
|
||||
#include "gfxhub_v1_1.h"
|
||||
|
||||
#include "gc/gc_9_4_3_offset.h"
|
||||
#include "gc/gc_9_4_3_sh_mask.h"
|
||||
#include "vega10_enum.h"
|
||||
|
||||
#include "soc15_common.h"
|
||||
|
||||
#define regVM_L2_CNTL3_DEFAULT 0x80100007
|
||||
#define regVM_L2_CNTL4_DEFAULT 0x000000c1
|
||||
|
||||
static u64 gfxhub_v1_2_get_mc_fb_offset(struct amdgpu_device *adev)
|
||||
{
|
||||
return (u64)RREG32_SOC15(GC, 0, regMC_VM_FB_OFFSET) << 24;
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_setup_vm_pt_regs(struct amdgpu_device *adev,
|
||||
uint32_t vmid,
|
||||
uint64_t page_table_base)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB_0];
|
||||
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
|
||||
hub->ctx_addr_distance * vmid,
|
||||
lower_32_bits(page_table_base));
|
||||
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32,
|
||||
hub->ctx_addr_distance * vmid,
|
||||
upper_32_bits(page_table_base));
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_init_gart_aperture_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint64_t pt_base;
|
||||
|
||||
if (adev->gmc.pdb0_bo)
|
||||
pt_base = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo);
|
||||
else
|
||||
pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
|
||||
|
||||
gfxhub_v1_2_setup_vm_pt_regs(adev, 0, pt_base);
|
||||
|
||||
/* If use GART for FB translation, vmid0 page table covers both
|
||||
* vram and system memory (gart)
|
||||
*/
|
||||
if (adev->gmc.pdb0_bo) {
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
|
||||
(u32)(adev->gmc.fb_start >> 12));
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
|
||||
(u32)(adev->gmc.fb_start >> 44));
|
||||
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_end >> 12));
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_end >> 44));
|
||||
} else {
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_start >> 12));
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_start >> 44));
|
||||
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_end >> 12));
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_end >> 44));
|
||||
}
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_init_system_aperture_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint64_t value;
|
||||
uint32_t tmp;
|
||||
|
||||
/* Program the AGP BAR */
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_AGP_BASE, 0);
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
|
||||
|
||||
if (!amdgpu_sriov_vf(adev) || adev->asic_type <= CHIP_VEGA10) {
|
||||
/* Program the system aperture low logical page number. */
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR,
|
||||
min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
|
||||
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
/*
|
||||
* Raven2 has a HW issue that it is unable to use the
|
||||
* vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
|
||||
* So here is the workaround that increase system
|
||||
* aperture high address (add 1) to get rid of the VM
|
||||
* fault and hardware hang.
|
||||
*/
|
||||
WREG32_SOC15_RLC(GC, 0,
|
||||
regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
|
||||
max((adev->gmc.fb_end >> 18) + 0x1,
|
||||
adev->gmc.agp_end >> 18));
|
||||
else
|
||||
WREG32_SOC15_RLC(GC, 0,
|
||||
regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
|
||||
max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18);
|
||||
|
||||
/* Set default page address. */
|
||||
value = amdgpu_gmc_vram_mc2pa(adev, adev->mem_scratch.gpu_addr);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,
|
||||
(u32)(value >> 12));
|
||||
WREG32_SOC15(GC, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,
|
||||
(u32)(value >> 44));
|
||||
|
||||
/* Program "protection fault". */
|
||||
WREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32,
|
||||
(u32)(adev->dummy_page_addr >> 12));
|
||||
WREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32,
|
||||
(u32)((u64)adev->dummy_page_addr >> 44));
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_CNTL2);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL2,
|
||||
ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_CNTL2, tmp);
|
||||
}
|
||||
|
||||
/* In the case squeezing vram into GART aperture, we don't use
|
||||
* FB aperture and AGP aperture. Disable them.
|
||||
*/
|
||||
if (adev->gmc.pdb0_bo) {
|
||||
WREG32_SOC15(GC, 0, regMC_VM_FB_LOCATION_TOP, 0);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_FB_LOCATION_BASE, 0x00FFFFFF);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_AGP_TOP, 0);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_AGP_BOT, 0xFFFFFF);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR, 0x3FFFFFFF);
|
||||
WREG32_SOC15(GC, 0, regMC_VM_SYSTEM_APERTURE_HIGH_ADDR, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_init_tlb_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* Setup TLB control */
|
||||
tmp = RREG32_SOC15(GC, 0, regMC_VM_MX_L1_TLB_CNTL);
|
||||
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, SYSTEM_ACCESS_MODE, 3);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
ENABLE_ADVANCED_DRIVER_MODEL, 1);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
SYSTEM_APERTURE_UNMAPPED_ACCESS, 0);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
MTYPE, MTYPE_UC);/* XXX for emulation. */
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1);
|
||||
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_MX_L1_TLB_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_init_cache_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* Setup L2 cache */
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_L2_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_FRAGMENT_PROCESSING, 1);
|
||||
/* XXX for emulation, Refer to closed source code.*/
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, L2_PDE0_CACHE_TAG_GENERATION_MODE,
|
||||
0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, PDE_FAULT_CLASSIFICATION, 0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, IDENTITY_MODE_FRAGMENT_SIZE, 0);
|
||||
WREG32_SOC15_RLC(GC, 0, regVM_L2_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_L2_CNTL2);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1);
|
||||
WREG32_SOC15_RLC(GC, 0, regVM_L2_CNTL2, tmp);
|
||||
|
||||
tmp = regVM_L2_CNTL3_DEFAULT;
|
||||
if (adev->gmc.translate_further) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
|
||||
L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
|
||||
} else {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
|
||||
L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
|
||||
}
|
||||
WREG32_SOC15_RLC(GC, 0, regVM_L2_CNTL3, tmp);
|
||||
|
||||
tmp = regVM_L2_CNTL4_DEFAULT;
|
||||
if (adev->gmc.xgmi.connected_to_cpu) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 1);
|
||||
} else {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
|
||||
}
|
||||
WREG32_SOC15_RLC(GC, 0, regVM_L2_CNTL4, tmp);
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_enable_system_domain(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_CONTEXT0_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, ENABLE_CONTEXT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH,
|
||||
adev->gmc.vmid0_page_table_depth);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_BLOCK_SIZE,
|
||||
adev->gmc.vmid0_page_table_block_size);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL,
|
||||
RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, 0);
|
||||
WREG32_SOC15(GC, 0, regVM_CONTEXT0_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_disable_identity_aperture(struct amdgpu_device *adev)
|
||||
{
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
|
||||
0XFFFFFFFF);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32,
|
||||
0x0000000F);
|
||||
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_LO32,
|
||||
0);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_HI32,
|
||||
0);
|
||||
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_LO32, 0);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_HI32, 0);
|
||||
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_setup_vmid_config(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB_0];
|
||||
unsigned num_level, block_size;
|
||||
uint32_t tmp;
|
||||
int i;
|
||||
|
||||
num_level = adev->vm_manager.num_level;
|
||||
block_size = adev->vm_manager.block_size;
|
||||
if (adev->gmc.translate_further)
|
||||
num_level -= 1;
|
||||
else
|
||||
block_size -= 9;
|
||||
|
||||
for (i = 0; i <= 14; i++) {
|
||||
tmp = RREG32_SOC15_OFFSET(GC, 0, regVM_CONTEXT1_CNTL, i);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH,
|
||||
num_level);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT,
|
||||
1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
PAGE_TABLE_BLOCK_SIZE,
|
||||
block_size);
|
||||
/* Send no-retry XNACK on fault to suppress VM fault storm.
|
||||
* On Aldebaran, XNACK can be enabled in the SQ per-process.
|
||||
* Retry faults need to be enabled for that to work.
|
||||
*/
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
RETRY_PERMISSION_OR_INVALID_PAGE_FAULT,
|
||||
!adev->gmc.noretry ||
|
||||
adev->asic_type == CHIP_ALDEBARAN);
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_CONTEXT1_CNTL,
|
||||
i * hub->ctx_distance, tmp);
|
||||
WREG32_SOC15_OFFSET(GC, 0,
|
||||
regVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32,
|
||||
i * hub->ctx_addr_distance, 0);
|
||||
WREG32_SOC15_OFFSET(GC, 0,
|
||||
regVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32,
|
||||
i * hub->ctx_addr_distance, 0);
|
||||
WREG32_SOC15_OFFSET(GC, 0,
|
||||
regVM_CONTEXT1_PAGE_TABLE_END_ADDR_LO32,
|
||||
i * hub->ctx_addr_distance,
|
||||
lower_32_bits(adev->vm_manager.max_pfn - 1));
|
||||
WREG32_SOC15_OFFSET(GC, 0,
|
||||
regVM_CONTEXT1_PAGE_TABLE_END_ADDR_HI32,
|
||||
i * hub->ctx_addr_distance,
|
||||
upper_32_bits(adev->vm_manager.max_pfn - 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB_0];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
i * hub->eng_addr_distance, 0xffffffff);
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_HI32,
|
||||
i * hub->eng_addr_distance, 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
static int gfxhub_v1_2_gart_enable(struct amdgpu_device *adev)
|
||||
{
|
||||
if (amdgpu_sriov_vf(adev) && adev->asic_type != CHIP_ARCTURUS) {
|
||||
/*
|
||||
* MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are
|
||||
* VF copy registers so vbios post doesn't program them, for
|
||||
* SRIOV driver need to program them
|
||||
*/
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_FB_LOCATION_BASE,
|
||||
adev->gmc.vram_start >> 24);
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_FB_LOCATION_TOP,
|
||||
adev->gmc.vram_end >> 24);
|
||||
}
|
||||
|
||||
/* GART Enable. */
|
||||
gfxhub_v1_2_init_gart_aperture_regs(adev);
|
||||
gfxhub_v1_2_init_system_aperture_regs(adev);
|
||||
gfxhub_v1_2_init_tlb_regs(adev);
|
||||
if (!amdgpu_sriov_vf(adev))
|
||||
gfxhub_v1_2_init_cache_regs(adev);
|
||||
|
||||
gfxhub_v1_2_enable_system_domain(adev);
|
||||
if (!amdgpu_sriov_vf(adev))
|
||||
gfxhub_v1_2_disable_identity_aperture(adev);
|
||||
gfxhub_v1_2_setup_vmid_config(adev);
|
||||
gfxhub_v1_2_program_invalidation(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_gart_disable(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB_0];
|
||||
u32 tmp;
|
||||
u32 i;
|
||||
|
||||
/* Disable all tables */
|
||||
for (i = 0; i < 16; i++)
|
||||
WREG32_SOC15_OFFSET(GC, 0, regVM_CONTEXT0_CNTL,
|
||||
i * hub->ctx_distance, 0);
|
||||
|
||||
/* Setup TLB control */
|
||||
tmp = RREG32_SOC15(GC, 0, regMC_VM_MX_L1_TLB_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 0);
|
||||
tmp = REG_SET_FIELD(tmp,
|
||||
MC_VM_MX_L1_TLB_CNTL,
|
||||
ENABLE_ADVANCED_DRIVER_MODEL,
|
||||
0);
|
||||
WREG32_SOC15_RLC(GC, 0, regMC_VM_MX_L1_TLB_CNTL, tmp);
|
||||
|
||||
/* Setup L2 cache */
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_L2_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CNTL, tmp);
|
||||
WREG32_SOC15(GC, 0, regVM_L2_CNTL3, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gfxhub_v1_2_set_fault_enable_default - update GART/VM fault handling
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @value: true redirects VM faults to the default page
|
||||
*/
|
||||
static void gfxhub_v1_2_set_fault_enable_default(struct amdgpu_device *adev,
|
||||
bool value)
|
||||
{
|
||||
u32 tmp;
|
||||
tmp = RREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE1_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE2_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp,
|
||||
VM_L2_PROTECTION_FAULT_CNTL,
|
||||
TRANSLATE_FURTHER_PROTECTION_FAULT_ENABLE_DEFAULT,
|
||||
value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
NACK_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
VALID_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
READ_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
if (!value) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
CRASH_ON_NO_RETRY_FAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
CRASH_ON_RETRY_FAULT, 1);
|
||||
}
|
||||
WREG32_SOC15(GC, 0, regVM_L2_PROTECTION_FAULT_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void gfxhub_v1_2_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB_0];
|
||||
|
||||
hub->ctx0_ptb_addr_lo32 =
|
||||
SOC15_REG_OFFSET(GC, 0,
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32);
|
||||
hub->ctx0_ptb_addr_hi32 =
|
||||
SOC15_REG_OFFSET(GC, 0,
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32);
|
||||
hub->vm_inv_eng0_sem =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_INVALIDATE_ENG0_SEM);
|
||||
hub->vm_inv_eng0_req =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_INVALIDATE_ENG0_REQ);
|
||||
hub->vm_inv_eng0_ack =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_INVALIDATE_ENG0_ACK);
|
||||
hub->vm_context0_cntl =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_CONTEXT0_CNTL);
|
||||
hub->vm_l2_pro_fault_status =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_L2_PROTECTION_FAULT_STATUS);
|
||||
hub->vm_l2_pro_fault_cntl =
|
||||
SOC15_REG_OFFSET(GC, 0, regVM_L2_PROTECTION_FAULT_CNTL);
|
||||
|
||||
hub->ctx_distance = regVM_CONTEXT1_CNTL - regVM_CONTEXT0_CNTL;
|
||||
hub->ctx_addr_distance = regVM_CONTEXT1_PAGE_TABLE_BASE_ADDR_LO32 -
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32;
|
||||
hub->eng_distance = regVM_INVALIDATE_ENG1_REQ - regVM_INVALIDATE_ENG0_REQ;
|
||||
hub->eng_addr_distance = regVM_INVALIDATE_ENG1_ADDR_RANGE_LO32 -
|
||||
regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32;
|
||||
}
|
||||
|
||||
|
||||
const struct amdgpu_gfxhub_funcs gfxhub_v1_2_funcs = {
|
||||
.get_mc_fb_offset = gfxhub_v1_2_get_mc_fb_offset,
|
||||
.setup_vm_pt_regs = gfxhub_v1_2_setup_vm_pt_regs,
|
||||
.gart_enable = gfxhub_v1_2_gart_enable,
|
||||
.gart_disable = gfxhub_v1_2_gart_disable,
|
||||
.set_fault_enable_default = gfxhub_v1_2_set_fault_enable_default,
|
||||
.init = gfxhub_v1_2_init,
|
||||
.get_xgmi_info = gfxhub_v1_1_get_xgmi_info,
|
||||
};
|
||||
29
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.h
Normal file
29
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GFXHUB_V1_2_H__
|
||||
#define __GFXHUB_V1_2_H__
|
||||
|
||||
extern const struct amdgpu_gfxhub_funcs gfxhub_v1_2_funcs;
|
||||
|
||||
#endif
|
||||
|
|
@ -274,6 +274,8 @@ static void gmc_v11_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,
|
|||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @vmid: vm instance to flush
|
||||
* @vmhub: which hub to flush
|
||||
* @flush_type: the flush type
|
||||
*
|
||||
* Flush the TLB for the requested page table.
|
||||
*/
|
||||
|
|
@ -313,6 +315,8 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
|||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @pasid: pasid to be flush
|
||||
* @flush_type: the flush type
|
||||
* @all_hub: flush all hubs
|
||||
*
|
||||
* Flush the TLB for the requested pasid.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -49,8 +49,10 @@
|
|||
#include "mmhub_v1_0.h"
|
||||
#include "athub_v1_0.h"
|
||||
#include "gfxhub_v1_1.h"
|
||||
#include "gfxhub_v1_2.h"
|
||||
#include "mmhub_v9_4.h"
|
||||
#include "mmhub_v1_7.h"
|
||||
#include "mmhub_v1_8.h"
|
||||
#include "umc_v6_1.h"
|
||||
#include "umc_v6_0.h"
|
||||
#include "umc_v6_7.h"
|
||||
|
|
@ -657,6 +659,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
|
|||
case IP_VERSION(2, 4, 0):
|
||||
mmhub_cid = mmhub_client_ids_renoir[cid][rw];
|
||||
break;
|
||||
case IP_VERSION(1, 8, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
mmhub_cid = mmhub_client_ids_aldebaran[cid][rw];
|
||||
break;
|
||||
|
|
@ -735,7 +738,8 @@ 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->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3))
|
||||
return false;
|
||||
|
||||
return ((vmhub == AMDGPU_MMHUB_0 ||
|
||||
|
|
@ -1144,6 +1148,7 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
|
|||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
if (is_vram) {
|
||||
if (bo_adev == adev) {
|
||||
if (uncached)
|
||||
|
|
@ -1155,8 +1160,8 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
|
|||
/* FIXME: is this still needed? Or does
|
||||
* amdgpu_ttm_tt_pde_flags already handle this?
|
||||
*/
|
||||
if (adev->ip_versions[GC_HWIP][0] ==
|
||||
IP_VERSION(9, 4, 2) &&
|
||||
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) &&
|
||||
adev->gmc.xgmi.connected_to_cpu)
|
||||
snoop = true;
|
||||
} else {
|
||||
|
|
@ -1329,6 +1334,9 @@ static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev)
|
|||
case IP_VERSION(9, 4, 2):
|
||||
adev->mmhub.funcs = &mmhub_v1_7_funcs;
|
||||
break;
|
||||
case IP_VERSION(1, 8, 0):
|
||||
adev->mmhub.funcs = &mmhub_v1_8_funcs;
|
||||
break;
|
||||
default:
|
||||
adev->mmhub.funcs = &mmhub_v1_0_funcs;
|
||||
break;
|
||||
|
|
@ -1355,7 +1363,10 @@ static void gmc_v9_0_set_mmhub_ras_funcs(struct amdgpu_device *adev)
|
|||
|
||||
static void gmc_v9_0_set_gfxhub_funcs(struct amdgpu_device *adev)
|
||||
{
|
||||
adev->gfxhub.funcs = &gfxhub_v1_0_funcs;
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3))
|
||||
adev->gfxhub.funcs = &gfxhub_v1_2_funcs;
|
||||
else
|
||||
adev->gfxhub.funcs = &gfxhub_v1_0_funcs;
|
||||
}
|
||||
|
||||
static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
|
||||
|
|
@ -1544,6 +1555,7 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
|
|||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 4, 1):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
default:
|
||||
adev->gmc.gart_size = 512ULL << 20;
|
||||
break;
|
||||
|
|
@ -1673,6 +1685,7 @@ static int gmc_v9_0_sw_init(void *handle)
|
|||
case IP_VERSION(9, 4, 0):
|
||||
case IP_VERSION(9, 3, 0):
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
adev->num_vmhubs = 2;
|
||||
|
||||
|
||||
|
|
@ -1769,7 +1782,8 @@ static int gmc_v9_0_sw_init(void *handle)
|
|||
*/
|
||||
adev->vm_manager.first_kfd_vmid =
|
||||
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 1) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) ? 3 : 8;
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2) ||
|
||||
adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) ? 3 : 8;
|
||||
|
||||
amdgpu_vm_manager_init(adev);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,
|
|||
* ih_v6_0_toggle_ring_interrupts - toggle the interrupt ring buffer
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @ih: amdgpu_ih_ring pointet
|
||||
* @ih: amdgpu_ih_ring pointer
|
||||
* @enable: true - enable the interrupts, false - disable the interrupts
|
||||
*
|
||||
* Toggle the interrupt ring buffer (IH_V6_0)
|
||||
|
|
@ -381,6 +381,7 @@ static void ih_v6_0_irq_disable(struct amdgpu_device *adev)
|
|||
* ih_v6_0_get_wptr - get the IH ring buffer wptr
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @ih: amdgpu_ih_ring pointer
|
||||
*
|
||||
* Get the IH ring buffer wptr from either the register
|
||||
* or the writeback memory buffer. Also check for
|
||||
|
|
@ -425,6 +426,7 @@ static u32 ih_v6_0_get_wptr(struct amdgpu_device *adev,
|
|||
* ih_v6_0_irq_rearm - rearm IRQ if lost
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @ih: amdgpu_ih_ring pointer
|
||||
*
|
||||
*/
|
||||
static void ih_v6_0_irq_rearm(struct amdgpu_device *adev,
|
||||
|
|
@ -450,6 +452,7 @@ static void ih_v6_0_irq_rearm(struct amdgpu_device *adev,
|
|||
* ih_v6_0_set_rptr - set the IH ring buffer rptr
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @ih: amdgpu_ih_ring pointer
|
||||
*
|
||||
* Set the IH ring buffer rptr.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "soc15d.h"
|
||||
#include "jpeg_v2_0.h"
|
||||
#include "jpeg_v4_0.h"
|
||||
#include "mmsch_v4_0.h"
|
||||
|
||||
#include "vcn/vcn_4_0_0_offset.h"
|
||||
#include "vcn/vcn_4_0_0_sh_mask.h"
|
||||
|
|
@ -35,12 +36,15 @@
|
|||
|
||||
#define regUVD_JPEG_PITCH_INTERNAL_OFFSET 0x401f
|
||||
|
||||
static int jpeg_v4_0_start_sriov(struct amdgpu_device *adev);
|
||||
static void jpeg_v4_0_set_dec_ring_funcs(struct amdgpu_device *adev);
|
||||
static void jpeg_v4_0_set_irq_funcs(struct amdgpu_device *adev);
|
||||
static int jpeg_v4_0_set_powergating_state(void *handle,
|
||||
enum amd_powergating_state state);
|
||||
static void jpeg_v4_0_set_ras_funcs(struct amdgpu_device *adev);
|
||||
|
||||
static void jpeg_v4_0_dec_ring_set_wptr(struct amdgpu_ring *ring);
|
||||
|
||||
/**
|
||||
* jpeg_v4_0_early_init - set function pointers
|
||||
*
|
||||
|
|
@ -103,7 +107,8 @@ static int jpeg_v4_0_sw_init(void *handle)
|
|||
|
||||
ring = &adev->jpeg.inst->ring_dec;
|
||||
ring->use_doorbell = true;
|
||||
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1;
|
||||
ring->doorbell_index = amdgpu_sriov_vf(adev) ? (((adev->doorbell_index.vcn.vcn_ring0_1) << 1) + 4) : ((adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1);
|
||||
|
||||
sprintf(ring->name, "jpeg_dec");
|
||||
r = amdgpu_ring_init(adev, ring, 512, &adev->jpeg.inst->irq, 0,
|
||||
AMDGPU_RING_PRIO_DEFAULT, NULL);
|
||||
|
|
@ -153,16 +158,26 @@ static int jpeg_v4_0_hw_init(void *handle)
|
|||
struct amdgpu_ring *ring = &adev->jpeg.inst->ring_dec;
|
||||
int r;
|
||||
|
||||
adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
|
||||
(adev->doorbell_index.vcn.vcn_ring0_1 << 1), 0);
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
r = jpeg_v4_0_start_sriov(adev);
|
||||
if (r)
|
||||
return r;
|
||||
ring->wptr = 0;
|
||||
ring->wptr_old = 0;
|
||||
jpeg_v4_0_dec_ring_set_wptr(ring);
|
||||
ring->sched.ready = true;
|
||||
} else {
|
||||
adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
|
||||
(adev->doorbell_index.vcn.vcn_ring0_1 << 1), 0);
|
||||
|
||||
WREG32_SOC15(VCN, 0, regVCN_JPEG_DB_CTRL,
|
||||
ring->doorbell_index << VCN_JPEG_DB_CTRL__OFFSET__SHIFT |
|
||||
VCN_JPEG_DB_CTRL__EN_MASK);
|
||||
WREG32_SOC15(VCN, 0, regVCN_JPEG_DB_CTRL,
|
||||
ring->doorbell_index << VCN_JPEG_DB_CTRL__OFFSET__SHIFT |
|
||||
VCN_JPEG_DB_CTRL__EN_MASK);
|
||||
|
||||
r = amdgpu_ring_test_helper(ring);
|
||||
if (r)
|
||||
return r;
|
||||
r = amdgpu_ring_test_helper(ring);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
DRM_DEV_INFO(adev->dev, "JPEG decode initialized successfully.\n");
|
||||
|
||||
|
|
@ -181,11 +196,11 @@ static int jpeg_v4_0_hw_fini(void *handle)
|
|||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
cancel_delayed_work_sync(&adev->vcn.idle_work);
|
||||
|
||||
if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(JPEG, 0, regUVD_JRBC_STATUS))
|
||||
jpeg_v4_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(JPEG, 0, regUVD_JRBC_STATUS))
|
||||
jpeg_v4_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
|
||||
}
|
||||
amdgpu_irq_put(adev, &adev->jpeg.inst->irq, 0);
|
||||
|
||||
return 0;
|
||||
|
|
@ -390,6 +405,120 @@ static int jpeg_v4_0_start(struct amdgpu_device *adev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int jpeg_v4_0_start_sriov(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_ring *ring;
|
||||
uint64_t ctx_addr;
|
||||
uint32_t param, resp, expected;
|
||||
uint32_t tmp, timeout;
|
||||
|
||||
struct amdgpu_mm_table *table = &adev->virt.mm_table;
|
||||
uint32_t *table_loc;
|
||||
uint32_t table_size;
|
||||
uint32_t size, size_dw;
|
||||
uint32_t init_status;
|
||||
|
||||
struct mmsch_v4_0_cmd_direct_write
|
||||
direct_wt = { {0} };
|
||||
struct mmsch_v4_0_cmd_end end = { {0} };
|
||||
struct mmsch_v4_0_init_header header;
|
||||
|
||||
direct_wt.cmd_header.command_type =
|
||||
MMSCH_COMMAND__DIRECT_REG_WRITE;
|
||||
end.cmd_header.command_type =
|
||||
MMSCH_COMMAND__END;
|
||||
|
||||
header.version = MMSCH_VERSION;
|
||||
header.total_size = sizeof(struct mmsch_v4_0_init_header) >> 2;
|
||||
|
||||
header.jpegdec.init_status = 0;
|
||||
header.jpegdec.table_offset = 0;
|
||||
header.jpegdec.table_size = 0;
|
||||
|
||||
table_loc = (uint32_t *)table->cpu_addr;
|
||||
table_loc += header.total_size;
|
||||
|
||||
table_size = 0;
|
||||
|
||||
ring = &adev->jpeg.inst->ring_dec;
|
||||
|
||||
MMSCH_V4_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(JPEG, 0,
|
||||
regUVD_LMI_JRBC_RB_64BIT_BAR_LOW),
|
||||
lower_32_bits(ring->gpu_addr));
|
||||
MMSCH_V4_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(JPEG, 0,
|
||||
regUVD_LMI_JRBC_RB_64BIT_BAR_HIGH),
|
||||
upper_32_bits(ring->gpu_addr));
|
||||
MMSCH_V4_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(JPEG, 0,
|
||||
regUVD_JRBC_RB_SIZE), ring->ring_size / 4);
|
||||
|
||||
/* add end packet */
|
||||
MMSCH_V4_0_INSERT_END();
|
||||
|
||||
/* refine header */
|
||||
header.jpegdec.init_status = 0;
|
||||
header.jpegdec.table_offset = header.total_size;
|
||||
header.jpegdec.table_size = table_size;
|
||||
header.total_size += table_size;
|
||||
|
||||
/* Update init table header in memory */
|
||||
size = sizeof(struct mmsch_v4_0_init_header);
|
||||
table_loc = (uint32_t *)table->cpu_addr;
|
||||
memcpy((void *)table_loc, &header, size);
|
||||
|
||||
/* message MMSCH (in VCN[0]) to initialize this client
|
||||
* 1, write to mmsch_vf_ctx_addr_lo/hi register with GPU mc addr
|
||||
* of memory descriptor location
|
||||
*/
|
||||
ctx_addr = table->gpu_addr;
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_CTX_ADDR_LO, lower_32_bits(ctx_addr));
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_CTX_ADDR_HI, upper_32_bits(ctx_addr));
|
||||
|
||||
/* 2, update vmid of descriptor */
|
||||
tmp = RREG32_SOC15(VCN, 0, regMMSCH_VF_VMID);
|
||||
tmp &= ~MMSCH_VF_VMID__VF_CTX_VMID_MASK;
|
||||
/* use domain0 for MM scheduler */
|
||||
tmp |= (0 << MMSCH_VF_VMID__VF_CTX_VMID__SHIFT);
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_VMID, tmp);
|
||||
|
||||
/* 3, notify mmsch about the size of this descriptor */
|
||||
size = header.total_size;
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_CTX_SIZE, size);
|
||||
|
||||
/* 4, set resp to zero */
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_MAILBOX_RESP, 0);
|
||||
|
||||
/* 5, kick off the initialization and wait until
|
||||
* MMSCH_VF_MAILBOX_RESP becomes non-zero
|
||||
*/
|
||||
param = 0x00000001;
|
||||
WREG32_SOC15(VCN, 0, regMMSCH_VF_MAILBOX_HOST, param);
|
||||
tmp = 0;
|
||||
timeout = 1000;
|
||||
resp = 0;
|
||||
expected = MMSCH_VF_MAILBOX_RESP__OK;
|
||||
init_status = ((struct mmsch_v4_0_init_header *)(table_loc))->jpegdec.init_status;
|
||||
while (resp != expected) {
|
||||
resp = RREG32_SOC15(VCN, 0, regMMSCH_VF_MAILBOX_RESP);
|
||||
|
||||
if (resp != 0)
|
||||
break;
|
||||
udelay(10);
|
||||
tmp = tmp + 10;
|
||||
if (tmp >= timeout) {
|
||||
DRM_ERROR("failed to init MMSCH. TIME-OUT after %d usec"\
|
||||
" waiting for regMMSCH_VF_MAILBOX_RESP "\
|
||||
"(expected=0x%08x, readback=0x%08x)\n",
|
||||
tmp, expected, resp);
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if (resp != expected && resp != MMSCH_VF_MAILBOX_RESP__INCOMPLETE && init_status != MMSCH_VF_ENGINE_STATUS__PASS)
|
||||
DRM_ERROR("MMSCH init status is incorrect! readback=0x%08x, header init status for jpeg: %x\n", resp, init_status);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* jpeg_v4_0_stop - stop JPEG block
|
||||
*
|
||||
|
|
@ -513,6 +642,11 @@ static int jpeg_v4_0_set_powergating_state(void *handle,
|
|||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
int ret;
|
||||
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
adev->jpeg.cur_state = AMD_PG_STATE_UNGATE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (state == adev->jpeg.cur_state)
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
477
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
Normal file
477
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
Normal file
|
|
@ -0,0 +1,477 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
#include "amdgpu.h"
|
||||
#include "mmhub_v1_8.h"
|
||||
|
||||
#include "mmhub/mmhub_1_8_0_offset.h"
|
||||
#include "mmhub/mmhub_1_8_0_sh_mask.h"
|
||||
#include "vega10_enum.h"
|
||||
|
||||
#include "soc15_common.h"
|
||||
#include "soc15.h"
|
||||
|
||||
#define regVM_L2_CNTL3_DEFAULT 0x80100007
|
||||
#define regVM_L2_CNTL4_DEFAULT 0x000000c1
|
||||
|
||||
static u64 mmhub_v1_8_get_fb_location(struct amdgpu_device *adev)
|
||||
{
|
||||
u64 base = RREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE);
|
||||
u64 top = RREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP);
|
||||
|
||||
base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
|
||||
base <<= 24;
|
||||
|
||||
top &= MC_VM_FB_LOCATION_TOP__FB_TOP_MASK;
|
||||
top <<= 24;
|
||||
|
||||
adev->gmc.fb_start = base;
|
||||
adev->gmc.fb_end = top;
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_setup_vm_pt_regs(struct amdgpu_device *adev, uint32_t vmid,
|
||||
uint64_t page_table_base)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
|
||||
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
|
||||
hub->ctx_addr_distance * vmid, lower_32_bits(page_table_base));
|
||||
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32,
|
||||
hub->ctx_addr_distance * vmid, upper_32_bits(page_table_base));
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint64_t pt_base;
|
||||
|
||||
if (adev->gmc.pdb0_bo)
|
||||
pt_base = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo);
|
||||
else
|
||||
pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
|
||||
|
||||
mmhub_v1_8_setup_vm_pt_regs(adev, 0, pt_base);
|
||||
|
||||
/* If use GART for FB translation, vmid0 page table covers both
|
||||
* vram and system memory (gart)
|
||||
*/
|
||||
if (adev->gmc.pdb0_bo) {
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
|
||||
(u32)(adev->gmc.fb_start >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
|
||||
(u32)(adev->gmc.fb_start >> 44));
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_end >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_end >> 44));
|
||||
|
||||
} else {
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_start >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_start >> 44));
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
|
||||
(u32)(adev->gmc.gart_end >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
|
||||
(u32)(adev->gmc.gart_end >> 44));
|
||||
}
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_init_system_aperture_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint64_t value;
|
||||
uint32_t tmp;
|
||||
|
||||
/* Program the AGP BAR */
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BASE, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
|
||||
|
||||
/* Program the system aperture low logical page number. */
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR,
|
||||
min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
|
||||
max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18);
|
||||
|
||||
/* In the case squeezing vram into GART aperture, we don't use
|
||||
* FB aperture and AGP aperture. Disable them.
|
||||
*/
|
||||
if (adev->gmc.pdb0_bo) {
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BOT, 0xFFFFFF);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_TOP, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE, 0x00FFFFFF);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR, 0x3FFFFFFF);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_HIGH_ADDR, 0);
|
||||
}
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return;
|
||||
|
||||
/* Set default page address. */
|
||||
value = amdgpu_gmc_vram_mc2pa(adev, adev->mem_scratch.gpu_addr);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,
|
||||
(u32)(value >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,
|
||||
(u32)(value >> 44));
|
||||
|
||||
/* Program "protection fault". */
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32,
|
||||
(u32)(adev->dummy_page_addr >> 12));
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32,
|
||||
(u32)((u64)adev->dummy_page_addr >> 44));
|
||||
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL2);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL2,
|
||||
ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL2, tmp);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_init_tlb_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* Setup TLB control */
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL);
|
||||
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, SYSTEM_ACCESS_MODE, 3);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
ENABLE_ADVANCED_DRIVER_MODEL, 1);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
SYSTEM_APERTURE_UNMAPPED_ACCESS, 0);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
MTYPE, MTYPE_UC);/* XXX for emulation. */
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1);
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_init_cache_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return;
|
||||
|
||||
/* Setup L2 cache */
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_FRAGMENT_PROCESSING, 1);
|
||||
/* XXX for emulation, Refer to closed source code.*/
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, L2_PDE0_CACHE_TAG_GENERATION_MODE,
|
||||
0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, PDE_FAULT_CLASSIFICATION, 0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, IDENTITY_MODE_FRAGMENT_SIZE, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL, tmp);
|
||||
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL2);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL2, tmp);
|
||||
|
||||
tmp = regVM_L2_CNTL3_DEFAULT;
|
||||
if (adev->gmc.translate_further) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
|
||||
L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
|
||||
} else {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
|
||||
L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
|
||||
}
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL3, tmp);
|
||||
|
||||
tmp = regVM_L2_CNTL4_DEFAULT;
|
||||
if (adev->gmc.xgmi.connected_to_cpu) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4,
|
||||
VMC_TAP_PDE_REQUEST_PHYSICAL, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4,
|
||||
VMC_TAP_PTE_REQUEST_PHYSICAL, 1);
|
||||
} else {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4,
|
||||
VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4,
|
||||
VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
|
||||
}
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL4, tmp);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_enable_system_domain(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, ENABLE_CONTEXT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH,
|
||||
adev->gmc.vmid0_page_table_depth);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_BLOCK_SIZE,
|
||||
adev->gmc.vmid0_page_table_block_size);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL,
|
||||
RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_disable_identity_aperture(struct amdgpu_device *adev)
|
||||
{
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return;
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32, 0xFFFFFFFF);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32, 0x0000000F);
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_LO32, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_HI32, 0);
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_LO32, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_HI32, 0);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_setup_vmid_config(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
|
||||
unsigned num_level, block_size;
|
||||
uint32_t tmp;
|
||||
int i;
|
||||
|
||||
num_level = adev->vm_manager.num_level;
|
||||
block_size = adev->vm_manager.block_size;
|
||||
if (adev->gmc.translate_further)
|
||||
num_level -= 1;
|
||||
else
|
||||
block_size -= 9;
|
||||
|
||||
for (i = 0; i <= 14; i++) {
|
||||
tmp = RREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_CNTL, i);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH,
|
||||
num_level);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT,
|
||||
1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
PAGE_TABLE_BLOCK_SIZE,
|
||||
block_size);
|
||||
/* On Aldebaran, XNACK can be enabled in the SQ per-process.
|
||||
* Retry faults need to be enabled for that to work.
|
||||
*/
|
||||
tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
|
||||
RETRY_PERMISSION_OR_INVALID_PAGE_FAULT,
|
||||
1);
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_CNTL,
|
||||
i * hub->ctx_distance, tmp);
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32,
|
||||
i * hub->ctx_addr_distance, 0);
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32,
|
||||
i * hub->ctx_addr_distance, 0);
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_END_ADDR_LO32,
|
||||
i * hub->ctx_addr_distance,
|
||||
lower_32_bits(adev->vm_manager.max_pfn - 1));
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_END_ADDR_HI32,
|
||||
i * hub->ctx_addr_distance,
|
||||
upper_32_bits(adev->vm_manager.max_pfn - 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
i * hub->eng_addr_distance, 0xffffffff);
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_HI32,
|
||||
i * hub->eng_addr_distance, 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
static int mmhub_v1_8_gart_enable(struct amdgpu_device *adev)
|
||||
{
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
/*
|
||||
* MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are
|
||||
* VF copy registers so vbios post doesn't program them, for
|
||||
* SRIOV driver need to program them
|
||||
*/
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE,
|
||||
adev->gmc.vram_start >> 24);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP,
|
||||
adev->gmc.vram_end >> 24);
|
||||
}
|
||||
|
||||
/* GART Enable. */
|
||||
mmhub_v1_8_init_gart_aperture_regs(adev);
|
||||
mmhub_v1_8_init_system_aperture_regs(adev);
|
||||
mmhub_v1_8_init_tlb_regs(adev);
|
||||
mmhub_v1_8_init_cache_regs(adev);
|
||||
|
||||
mmhub_v1_8_enable_system_domain(adev);
|
||||
mmhub_v1_8_disable_identity_aperture(adev);
|
||||
mmhub_v1_8_setup_vmid_config(adev);
|
||||
mmhub_v1_8_program_invalidation(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_gart_disable(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
|
||||
u32 tmp;
|
||||
u32 i;
|
||||
|
||||
/* Disable all tables */
|
||||
for (i = 0; i < 16; i++)
|
||||
WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_CNTL,
|
||||
i * hub->ctx_distance, 0);
|
||||
|
||||
/* Setup TLB control */
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 0);
|
||||
tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
|
||||
ENABLE_ADVANCED_DRIVER_MODEL, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL, tmp);
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
/* Setup L2 cache */
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL, tmp);
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* mmhub_v1_8_set_fault_enable_default - update GART/VM fault handling
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @value: true redirects VM faults to the default page
|
||||
*/
|
||||
static void mmhub_v1_8_set_fault_enable_default(struct amdgpu_device *adev, bool value)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return;
|
||||
|
||||
tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE1_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
PDE2_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
TRANSLATE_FURTHER_PROTECTION_FAULT_ENABLE_DEFAULT,
|
||||
value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
NACK_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
VALID_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
READ_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
if (!value) {
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
CRASH_ON_NO_RETRY_FAULT, 1);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
CRASH_ON_RETRY_FAULT, 1);
|
||||
}
|
||||
|
||||
WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_init(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0];
|
||||
|
||||
hub->ctx0_ptb_addr_lo32 =
|
||||
SOC15_REG_OFFSET(MMHUB, 0,
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32);
|
||||
hub->ctx0_ptb_addr_hi32 =
|
||||
SOC15_REG_OFFSET(MMHUB, 0,
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32);
|
||||
hub->vm_inv_eng0_req =
|
||||
SOC15_REG_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_REQ);
|
||||
hub->vm_inv_eng0_ack =
|
||||
SOC15_REG_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ACK);
|
||||
hub->vm_context0_cntl =
|
||||
SOC15_REG_OFFSET(MMHUB, 0, regVM_CONTEXT0_CNTL);
|
||||
hub->vm_l2_pro_fault_status =
|
||||
SOC15_REG_OFFSET(MMHUB, 0, regVM_L2_PROTECTION_FAULT_STATUS);
|
||||
hub->vm_l2_pro_fault_cntl =
|
||||
SOC15_REG_OFFSET(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL);
|
||||
|
||||
hub->ctx_distance = regVM_CONTEXT1_CNTL - regVM_CONTEXT0_CNTL;
|
||||
hub->ctx_addr_distance = regVM_CONTEXT1_PAGE_TABLE_BASE_ADDR_LO32 -
|
||||
regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32;
|
||||
hub->eng_distance = regVM_INVALIDATE_ENG1_REQ - regVM_INVALIDATE_ENG0_REQ;
|
||||
hub->eng_addr_distance = regVM_INVALIDATE_ENG1_ADDR_RANGE_LO32 -
|
||||
regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32;
|
||||
|
||||
}
|
||||
|
||||
static int mmhub_v1_8_set_clockgating(struct amdgpu_device *adev,
|
||||
enum amd_clockgating_state state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mmhub_v1_8_get_clockgating(struct amdgpu_device *adev, u64 *flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const struct amdgpu_mmhub_funcs mmhub_v1_8_funcs = {
|
||||
.get_fb_location = mmhub_v1_8_get_fb_location,
|
||||
.init = mmhub_v1_8_init,
|
||||
.gart_enable = mmhub_v1_8_gart_enable,
|
||||
.set_fault_enable_default = mmhub_v1_8_set_fault_enable_default,
|
||||
.gart_disable = mmhub_v1_8_gart_disable,
|
||||
.setup_vm_pt_regs = mmhub_v1_8_setup_vm_pt_regs,
|
||||
.set_clockgating = mmhub_v1_8_set_clockgating,
|
||||
.get_clockgating = mmhub_v1_8_get_clockgating,
|
||||
};
|
||||
28
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.h
Normal file
28
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
#ifndef __MMHUB_V1_8_H__
|
||||
#define __MMHUB_V1_8_H__
|
||||
|
||||
extern const struct amdgpu_mmhub_funcs mmhub_v1_8_funcs;
|
||||
|
||||
#endif
|
||||
|
|
@ -38,6 +38,11 @@
|
|||
#define MMSCH_VF_MAILBOX_RESP__OK 0x1
|
||||
#define MMSCH_VF_MAILBOX_RESP__INCOMPLETE 0x2
|
||||
|
||||
#define MMSCH_VF_ENGINE_STATUS__PASS 0x1
|
||||
|
||||
#define MMSCH_VF_MAILBOX_RESP__OK 0x1
|
||||
#define MMSCH_VF_MAILBOX_RESP__INCOMPLETE 0x2
|
||||
|
||||
enum mmsch_v4_0_command_type {
|
||||
MMSCH_COMMAND__DIRECT_REG_WRITE = 0,
|
||||
MMSCH_COMMAND__DIRECT_REG_POLLING = 2,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "nbio/nbio_4_3_0_offset.h"
|
||||
#include "nbio/nbio_4_3_0_sh_mask.h"
|
||||
#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
|
||||
#include <uapi/linux/kfd_ioctl.h>
|
||||
|
||||
static void nbio_v4_3_remap_hdp_registers(struct amdgpu_device *adev)
|
||||
|
|
@ -538,3 +539,81 @@ const struct amdgpu_nbio_funcs nbio_v4_3_sriov_funcs = {
|
|||
.remap_hdp_registers = nbio_v4_3_remap_hdp_registers,
|
||||
.get_rom_offset = nbio_v4_3_get_rom_offset,
|
||||
};
|
||||
|
||||
static int nbio_v4_3_set_ras_err_event_athub_irq_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
/* The ras_controller_irq enablement should be done in psp bl when it
|
||||
* tries to enable ras feature. Driver only need to set the correct interrupt
|
||||
* vector for bare-metal and sriov use case respectively
|
||||
*/
|
||||
uint32_t bif_doorbell_int_cntl;
|
||||
|
||||
bif_doorbell_int_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL);
|
||||
bif_doorbell_int_cntl = REG_SET_FIELD(bif_doorbell_int_cntl,
|
||||
BIF_BX0_BIF_DOORBELL_INT_CNTL,
|
||||
RAS_ATHUB_ERR_EVENT_INTERRUPT_DISABLE,
|
||||
(state == AMDGPU_IRQ_STATE_ENABLE) ? 0 : 1);
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL, bif_doorbell_int_cntl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nbio_v4_3_process_err_event_athub_irq(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
struct amdgpu_iv_entry *entry)
|
||||
{
|
||||
/* By design, the ih cookie for err_event_athub_irq should be written
|
||||
* to bif ring. since bif ring is not enabled, just leave process callback
|
||||
* as a dummy one.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct amdgpu_irq_src_funcs nbio_v4_3_ras_err_event_athub_irq_funcs = {
|
||||
.set = nbio_v4_3_set_ras_err_event_athub_irq_state,
|
||||
.process = nbio_v4_3_process_err_event_athub_irq,
|
||||
};
|
||||
|
||||
static void nbio_v4_3_handle_ras_err_event_athub_intr_no_bifring(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t bif_doorbell_int_cntl;
|
||||
|
||||
bif_doorbell_int_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL);
|
||||
if (REG_GET_FIELD(bif_doorbell_int_cntl,
|
||||
BIF_DOORBELL_INT_CNTL,
|
||||
RAS_ATHUB_ERR_EVENT_INTERRUPT_STATUS)) {
|
||||
/* driver has to clear the interrupt status when bif ring is disabled */
|
||||
bif_doorbell_int_cntl = REG_SET_FIELD(bif_doorbell_int_cntl,
|
||||
BIF_DOORBELL_INT_CNTL,
|
||||
RAS_ATHUB_ERR_EVENT_INTERRUPT_CLEAR, 1);
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL, bif_doorbell_int_cntl);
|
||||
amdgpu_ras_global_ras_isr(adev);
|
||||
}
|
||||
}
|
||||
|
||||
static int nbio_v4_3_init_ras_err_event_athub_interrupt(struct amdgpu_device *adev)
|
||||
{
|
||||
|
||||
int r;
|
||||
|
||||
/* init the irq funcs */
|
||||
adev->nbio.ras_err_event_athub_irq.funcs =
|
||||
&nbio_v4_3_ras_err_event_athub_irq_funcs;
|
||||
adev->nbio.ras_err_event_athub_irq.num_types = 1;
|
||||
|
||||
/* register ras err event athub interrupt
|
||||
* nbio v4_3 uses the same irq source as nbio v7_4 */
|
||||
r = amdgpu_irq_add_id(adev, SOC21_IH_CLIENTID_BIF,
|
||||
NBIF_7_4__SRCID__ERREVENT_ATHUB_INTERRUPT,
|
||||
&adev->nbio.ras_err_event_athub_irq);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
struct amdgpu_nbio_ras nbio_v4_3_ras = {
|
||||
.handle_ras_err_event_athub_intr_no_bifring = nbio_v4_3_handle_ras_err_event_athub_intr_no_bifring,
|
||||
.init_ras_err_event_athub_interrupt = nbio_v4_3_init_ras_err_event_athub_interrupt,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,5 +29,6 @@
|
|||
extern const struct nbio_hdp_flush_reg nbio_v4_3_hdp_flush_reg;
|
||||
extern const struct amdgpu_nbio_funcs nbio_v4_3_funcs;
|
||||
extern const struct amdgpu_nbio_funcs nbio_v4_3_sriov_funcs;
|
||||
extern struct amdgpu_nbio_ras nbio_v4_3_ras;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
369
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
Normal file
369
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_atombios.h"
|
||||
#include "nbio_v7_9.h"
|
||||
#include "amdgpu_ras.h"
|
||||
|
||||
#include "nbio/nbio_7_9_0_offset.h"
|
||||
#include "nbio/nbio_7_9_0_sh_mask.h"
|
||||
#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h"
|
||||
#include <uapi/linux/kfd_ioctl.h>
|
||||
|
||||
static void nbio_v7_9_remap_hdp_registers(struct amdgpu_device *adev)
|
||||
{
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL,
|
||||
adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL,
|
||||
adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_rev_id(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = RREG32_SOC15(NBIO, 0, regRCC_STRAP0_RCC_DEV0_EPF0_STRAP0);
|
||||
tmp = REG_GET_FIELD(tmp, RCC_STRAP0_RCC_DEV0_EPF0_STRAP0, STRAP_ATI_REV_ID_DEV0_F0);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static void nbio_v7_9_mc_access_enable(struct amdgpu_device *adev, bool enable)
|
||||
{
|
||||
if (enable)
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN,
|
||||
BIF_BX0_BIF_FB_EN__FB_READ_EN_MASK | BIF_BX0_BIF_FB_EN__FB_WRITE_EN_MASK);
|
||||
else
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_FB_EN, 0);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_memsize(struct amdgpu_device *adev)
|
||||
{
|
||||
return RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE);
|
||||
}
|
||||
|
||||
static void nbio_v7_9_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
|
||||
bool use_doorbell, int doorbell_index, int doorbell_size)
|
||||
{
|
||||
u32 doorbell_range = 0, doorbell_ctrl = 0;
|
||||
|
||||
doorbell_range =
|
||||
REG_SET_FIELD(doorbell_range, DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_OFFSET_ENTRY, doorbell_index);
|
||||
doorbell_range =
|
||||
REG_SET_FIELD(doorbell_range, DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_SIZE_ENTRY, doorbell_size);
|
||||
doorbell_ctrl =
|
||||
REG_SET_FIELD(doorbell_ctrl, S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_ENABLE, 1);
|
||||
doorbell_ctrl =
|
||||
REG_SET_FIELD(doorbell_ctrl, S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_SIZE, doorbell_size);
|
||||
|
||||
switch (instance) {
|
||||
case 0:
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_1, doorbell_range);
|
||||
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0xe);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0xe);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE,
|
||||
0x1);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_1_CTRL, doorbell_ctrl);
|
||||
break;
|
||||
case 1:
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_2, doorbell_range);
|
||||
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0x8);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0x8);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE,
|
||||
0x2);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_2_CTRL, doorbell_ctrl);
|
||||
break;
|
||||
case 2:
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_3, doorbell_range);
|
||||
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0x9);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0x9);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE,
|
||||
0x8);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_5_CTRL, doorbell_ctrl);
|
||||
break;
|
||||
case 3:
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_4, doorbell_range);
|
||||
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0xa);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0xa);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE,
|
||||
0x9);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_6_CTRL, doorbell_ctrl);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void nbio_v7_9_vcn_doorbell_range(struct amdgpu_device *adev, bool use_doorbell,
|
||||
int doorbell_index, int instance)
|
||||
{
|
||||
u32 doorbell_range = 0, doorbell_ctrl = 0;
|
||||
|
||||
if (use_doorbell) {
|
||||
doorbell_range = REG_SET_FIELD(doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_OFFSET_ENTRY,
|
||||
doorbell_index);
|
||||
doorbell_range = REG_SET_FIELD(doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_SIZE_ENTRY,
|
||||
0x8);
|
||||
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_ENABLE, 1);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0x4);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0x4);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_SIZE, 0x8);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE, 0x4);
|
||||
} else {
|
||||
doorbell_range = REG_SET_FIELD(doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_SIZE_ENTRY, 0);
|
||||
doorbell_ctrl = REG_SET_FIELD(doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_SIZE, 0);
|
||||
}
|
||||
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_17, doorbell_range);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_4_CTRL, doorbell_ctrl);
|
||||
}
|
||||
|
||||
static void nbio_v7_9_enable_doorbell_aperture(struct amdgpu_device *adev,
|
||||
bool enable)
|
||||
{
|
||||
/* Enable to allow doorbell pass thru on pre-silicon bare-metal */
|
||||
WREG32_SOC15(NBIO, 0, regBIFC_DOORBELL_ACCESS_EN_PF, 0xfffff);
|
||||
WREG32_FIELD15_PREREG(NBIO, 0, RCC_DEV0_EPF0_RCC_DOORBELL_APER_EN,
|
||||
BIF_DOORBELL_APER_EN, enable ? 1 : 0);
|
||||
}
|
||||
|
||||
static void nbio_v7_9_enable_doorbell_selfring_aperture(struct amdgpu_device *adev,
|
||||
bool enable)
|
||||
{
|
||||
u32 tmp = 0;
|
||||
|
||||
if (enable) {
|
||||
tmp = REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,
|
||||
DOORBELL_SELFRING_GPA_APER_EN, 1) |
|
||||
REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,
|
||||
DOORBELL_SELFRING_GPA_APER_MODE, 1) |
|
||||
REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL,
|
||||
DOORBELL_SELFRING_GPA_APER_SIZE, 0);
|
||||
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_LOW,
|
||||
lower_32_bits(adev->doorbell.base));
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_HIGH,
|
||||
upper_32_bits(adev->doorbell.base));
|
||||
}
|
||||
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL, tmp);
|
||||
}
|
||||
|
||||
static void nbio_v7_9_ih_doorbell_range(struct amdgpu_device *adev,
|
||||
bool use_doorbell, int doorbell_index)
|
||||
{
|
||||
u32 ih_doorbell_range = 0, ih_doorbell_ctrl = 0;
|
||||
|
||||
if (use_doorbell) {
|
||||
ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_OFFSET_ENTRY,
|
||||
doorbell_index);
|
||||
ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_SIZE_ENTRY,
|
||||
0x4);
|
||||
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_ENABLE, 1);
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWID, 0);
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_OFFSET, 0);
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_SIZE, 0x4);
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_AWADDR_31_28_VALUE, 0);
|
||||
} else {
|
||||
ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range,
|
||||
DOORBELL0_CTRL_ENTRY_0,
|
||||
BIF_DOORBELL0_RANGE_SIZE_ENTRY, 0);
|
||||
ih_doorbell_ctrl = REG_SET_FIELD(ih_doorbell_ctrl,
|
||||
S2A_DOORBELL_ENTRY_1_CTRL,
|
||||
S2A_DOORBELL_PORT1_RANGE_SIZE, 0);
|
||||
}
|
||||
|
||||
WREG32_SOC15(NBIO, 0, regDOORBELL0_CTRL_ENTRY_0, ih_doorbell_range);
|
||||
WREG32_SOC15(NBIO, 0, regS2A_DOORBELL_ENTRY_3_CTRL, ih_doorbell_ctrl);
|
||||
}
|
||||
|
||||
|
||||
static void nbio_v7_9_update_medium_grain_clock_gating(struct amdgpu_device *adev,
|
||||
bool enable)
|
||||
{
|
||||
}
|
||||
|
||||
static void nbio_v7_9_update_medium_grain_light_sleep(struct amdgpu_device *adev,
|
||||
bool enable)
|
||||
{
|
||||
}
|
||||
|
||||
static void nbio_v7_9_get_clockgating_state(struct amdgpu_device *adev,
|
||||
u64 *flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void nbio_v7_9_ih_control(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 interrupt_cntl;
|
||||
|
||||
/* setup interrupt control */
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_INTERRUPT_CNTL2, adev->dummy_page_addr >> 8);
|
||||
interrupt_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_INTERRUPT_CNTL);
|
||||
/* INTERRUPT_CNTL__IH_DUMMY_RD_OVERRIDE_MASK=0 - dummy read disabled with msi, enabled without msi
|
||||
* INTERRUPT_CNTL__IH_DUMMY_RD_OVERRIDE_MASK=1 - dummy read controlled by IH_DUMMY_RD_EN
|
||||
*/
|
||||
interrupt_cntl =
|
||||
REG_SET_FIELD(interrupt_cntl, BIF_BX0_INTERRUPT_CNTL, IH_DUMMY_RD_OVERRIDE, 0);
|
||||
/* INTERRUPT_CNTL__IH_REQ_NONSNOOP_EN_MASK=1 if ring is in non-cacheable memory, e.g., vram */
|
||||
interrupt_cntl =
|
||||
REG_SET_FIELD(interrupt_cntl, BIF_BX0_INTERRUPT_CNTL, IH_REQ_NONSNOOP_EN, 0);
|
||||
WREG32_SOC15(NBIO, 0, regBIF_BX0_INTERRUPT_CNTL, interrupt_cntl);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_hdp_flush_req_offset(struct amdgpu_device *adev)
|
||||
{
|
||||
return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_GPU_HDP_FLUSH_REQ);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_hdp_flush_done_offset(struct amdgpu_device *adev)
|
||||
{
|
||||
return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX_PF0_GPU_HDP_FLUSH_DONE);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_pcie_index_offset(struct amdgpu_device *adev)
|
||||
{
|
||||
return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX0_PCIE_INDEX2);
|
||||
}
|
||||
|
||||
static u32 nbio_v7_9_get_pcie_data_offset(struct amdgpu_device *adev)
|
||||
{
|
||||
return SOC15_REG_OFFSET(NBIO, 0, regBIF_BX0_PCIE_DATA2);
|
||||
}
|
||||
|
||||
const struct nbio_hdp_flush_reg nbio_v7_9_hdp_flush_reg = {
|
||||
.ref_and_mask_cp0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP0_MASK,
|
||||
.ref_and_mask_cp1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP1_MASK,
|
||||
.ref_and_mask_cp2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP2_MASK,
|
||||
.ref_and_mask_cp3 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP3_MASK,
|
||||
.ref_and_mask_cp4 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP4_MASK,
|
||||
.ref_and_mask_cp5 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP5_MASK,
|
||||
.ref_and_mask_cp6 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP6_MASK,
|
||||
.ref_and_mask_cp7 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP7_MASK,
|
||||
.ref_and_mask_cp8 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP8_MASK,
|
||||
.ref_and_mask_cp9 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP9_MASK,
|
||||
.ref_and_mask_sdma0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA0_MASK,
|
||||
.ref_and_mask_sdma1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA1_MASK,
|
||||
.ref_and_mask_sdma2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG0_MASK,
|
||||
.ref_and_mask_sdma3 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG1_MASK,
|
||||
.ref_and_mask_sdma4 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG2_MASK,
|
||||
.ref_and_mask_sdma5 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG3_MASK,
|
||||
.ref_and_mask_sdma6 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG4_MASK,
|
||||
.ref_and_mask_sdma7 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__RSVD_ENG5_MASK,
|
||||
};
|
||||
|
||||
static void nbio_v7_9_enable_doorbell_interrupt(struct amdgpu_device *adev,
|
||||
bool enable)
|
||||
{
|
||||
WREG32_FIELD15_PREREG(NBIO, 0, BIF_BX0_BIF_DOORBELL_INT_CNTL,
|
||||
DOORBELL_INTERRUPT_DISABLE, enable ? 0 : 1);
|
||||
}
|
||||
|
||||
const struct amdgpu_nbio_funcs nbio_v7_9_funcs = {
|
||||
.get_hdp_flush_req_offset = nbio_v7_9_get_hdp_flush_req_offset,
|
||||
.get_hdp_flush_done_offset = nbio_v7_9_get_hdp_flush_done_offset,
|
||||
.get_pcie_index_offset = nbio_v7_9_get_pcie_index_offset,
|
||||
.get_pcie_data_offset = nbio_v7_9_get_pcie_data_offset,
|
||||
.get_rev_id = nbio_v7_9_get_rev_id,
|
||||
.mc_access_enable = nbio_v7_9_mc_access_enable,
|
||||
.get_memsize = nbio_v7_9_get_memsize,
|
||||
.sdma_doorbell_range = nbio_v7_9_sdma_doorbell_range,
|
||||
.vcn_doorbell_range = nbio_v7_9_vcn_doorbell_range,
|
||||
.enable_doorbell_aperture = nbio_v7_9_enable_doorbell_aperture,
|
||||
.enable_doorbell_selfring_aperture = nbio_v7_9_enable_doorbell_selfring_aperture,
|
||||
.ih_doorbell_range = nbio_v7_9_ih_doorbell_range,
|
||||
.enable_doorbell_interrupt = nbio_v7_9_enable_doorbell_interrupt,
|
||||
.update_medium_grain_clock_gating = nbio_v7_9_update_medium_grain_clock_gating,
|
||||
.update_medium_grain_light_sleep = nbio_v7_9_update_medium_grain_light_sleep,
|
||||
.get_clockgating_state = nbio_v7_9_get_clockgating_state,
|
||||
.ih_control = nbio_v7_9_ih_control,
|
||||
.remap_hdp_registers = nbio_v7_9_remap_hdp_registers,
|
||||
};
|
||||
32
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.h
Normal file
32
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NBIO_V7_9_H__
|
||||
#define __NBIO_V7_9_H__
|
||||
|
||||
#include "soc15_common.h"
|
||||
|
||||
extern const struct nbio_hdp_flush_reg nbio_v7_9_hdp_flush_reg;
|
||||
extern const struct amdgpu_nbio_funcs nbio_v7_9_funcs;
|
||||
|
||||
#endif
|
||||
|
|
@ -754,6 +754,14 @@ static int soc21_common_late_init(void *handle)
|
|||
sriov_vcn_4_0_0_video_codecs_decode_array_vcn0,
|
||||
ARRAY_SIZE(sriov_vcn_4_0_0_video_codecs_decode_array_vcn0));
|
||||
}
|
||||
} else {
|
||||
if (adev->nbio.ras &&
|
||||
adev->nbio.ras_err_event_athub_irq.funcs)
|
||||
/* don't need to fail gpu late init
|
||||
* if enabling athub_err_event interrupt failed
|
||||
* nbio v4_3 only support fatal error hanlding
|
||||
* just enable the interrupt directly */
|
||||
amdgpu_irq_get(adev, &adev->nbio.ras_err_event_athub_irq, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -801,8 +809,13 @@ static int soc21_common_hw_fini(void *handle)
|
|||
/* disable the doorbell aperture */
|
||||
soc21_enable_doorbell_aperture(adev, false);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
xgpu_nv_mailbox_put_irq(adev);
|
||||
} else {
|
||||
if (adev->nbio.ras &&
|
||||
adev->nbio.ras_err_event_athub_irq.funcs)
|
||||
amdgpu_irq_put(adev, &adev->nbio.ras_err_event_athub_irq, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2936,3 +2936,490 @@ static const uint32_t cwsr_trap_gfx11_hex[] = {
|
|||
0xbf9f0000, 0xbf9f0000,
|
||||
0xbf9f0000, 0x00000000,
|
||||
};
|
||||
|
||||
static const uint32_t cwsr_trap_gfx9_4_3_hex[] = {
|
||||
0xbf820001, 0xbf8202d6,
|
||||
0xb8f8f802, 0x89788678,
|
||||
0xb8fbf803, 0x866eff78,
|
||||
0x00002000, 0xbf840009,
|
||||
0x866eff6d, 0x00ff0000,
|
||||
0xbf85001a, 0x866eff7b,
|
||||
0x00000400, 0xbf85004d,
|
||||
0xbf8e0010, 0xb8fbf803,
|
||||
0xbf82fffa, 0x866eff7b,
|
||||
0x03c00900, 0xbf850011,
|
||||
0x866eff7b, 0x000071ff,
|
||||
0xbf840008, 0x866fff7b,
|
||||
0x00007080, 0xbf840001,
|
||||
0xbeee1a87, 0xb8eff801,
|
||||
0x8e6e8c6e, 0x866e6f6e,
|
||||
0xbf850006, 0x866eff6d,
|
||||
0x00ff0000, 0xbf850003,
|
||||
0x866eff7b, 0x00000400,
|
||||
0xbf850036, 0xb8faf807,
|
||||
0x867aff7a, 0x001f8000,
|
||||
0x8e7a8b7a, 0x8979ff79,
|
||||
0xfc000000, 0x87797a79,
|
||||
0xba7ff807, 0x00000000,
|
||||
0xb8faf812, 0xb8fbf813,
|
||||
0x8efa887a, 0xc0031bbd,
|
||||
0x00000010, 0xbf8cc07f,
|
||||
0x8e6e976e, 0x8979ff79,
|
||||
0x00800000, 0x87796e79,
|
||||
0xc0071bbd, 0x00000000,
|
||||
0xbf8cc07f, 0xc0071ebd,
|
||||
0x00000008, 0xbf8cc07f,
|
||||
0x86ee6e6e, 0xbf840001,
|
||||
0xbe801d6e, 0x866eff6d,
|
||||
0x01ff0000, 0xbf850005,
|
||||
0x8778ff78, 0x00002000,
|
||||
0x80ec886c, 0x82ed806d,
|
||||
0xbf820005, 0x866eff6d,
|
||||
0x01000000, 0xbf850002,
|
||||
0x806c846c, 0x826d806d,
|
||||
0x866dff6d, 0x0000ffff,
|
||||
0x8f7a8b79, 0x867aff7a,
|
||||
0x001f8000, 0xb97af807,
|
||||
0x86fe7e7e, 0x86ea6a6a,
|
||||
0x8f6e8378, 0xb96ee0c2,
|
||||
0xbf800002, 0xb9780002,
|
||||
0xbe801f6c, 0x866dff6d,
|
||||
0x0000ffff, 0xbefa0080,
|
||||
0xb97a0283, 0xb8faf807,
|
||||
0x867aff7a, 0x001f8000,
|
||||
0x8e7a8b7a, 0x8979ff79,
|
||||
0xfc000000, 0x87797a79,
|
||||
0xba7ff807, 0x00000000,
|
||||
0xbeee007e, 0xbeef007f,
|
||||
0xbefe0180, 0xbf900004,
|
||||
0x877a8478, 0xb97af802,
|
||||
0xbf8e0002, 0xbf88fffe,
|
||||
0xb8fa2985, 0x807a817a,
|
||||
0x8e7a8a7a, 0x8e7a817a,
|
||||
0xb8fb1605, 0x807b817b,
|
||||
0x8e7b867b, 0x807a7b7a,
|
||||
0x807a7e7a, 0x827b807f,
|
||||
0x867bff7b, 0x0000ffff,
|
||||
0xc04b1c3d, 0x00000050,
|
||||
0xbf8cc07f, 0xc04b1d3d,
|
||||
0x00000060, 0xbf8cc07f,
|
||||
0xc0431e7d, 0x00000074,
|
||||
0xbf8cc07f, 0xbef4007e,
|
||||
0x8675ff7f, 0x0000ffff,
|
||||
0x8775ff75, 0x00040000,
|
||||
0xbef60080, 0xbef700ff,
|
||||
0x00807fac, 0xbef1007c,
|
||||
0xbef00080, 0xb8f02985,
|
||||
0x80708170, 0x8e708a70,
|
||||
0x8e708170, 0xb8fa1605,
|
||||
0x807a817a, 0x8e7a867a,
|
||||
0x80707a70, 0xbef60084,
|
||||
0xbef600ff, 0x01000000,
|
||||
0xbefe007c, 0xbefc0070,
|
||||
0xc0611c7a, 0x0000007c,
|
||||
0xbf8cc07f, 0x80708470,
|
||||
0xbefc007e, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611b3a,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0xbefe007c, 0xbefc0070,
|
||||
0xc0611b7a, 0x0000007c,
|
||||
0xbf8cc07f, 0x80708470,
|
||||
0xbefc007e, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611bba,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0xbefe007c, 0xbefc0070,
|
||||
0xc0611bfa, 0x0000007c,
|
||||
0xbf8cc07f, 0x80708470,
|
||||
0xbefc007e, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611e3a,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0xb8fbf803, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611efa,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0xbefe007c, 0xbefc0070,
|
||||
0xc0611a3a, 0x0000007c,
|
||||
0xbf8cc07f, 0x80708470,
|
||||
0xbefc007e, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611a7a,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0xb8f1f801, 0xbefe007c,
|
||||
0xbefc0070, 0xc0611c7a,
|
||||
0x0000007c, 0xbf8cc07f,
|
||||
0x80708470, 0xbefc007e,
|
||||
0x867aff7f, 0x04000000,
|
||||
0xbeef0080, 0x876f6f7a,
|
||||
0xb8f02985, 0x80708170,
|
||||
0x8e708a70, 0x8e708170,
|
||||
0xb8fb1605, 0x807b817b,
|
||||
0x8e7b847b, 0x8e76827b,
|
||||
0xbef600ff, 0x01000000,
|
||||
0xbef20174, 0x80747074,
|
||||
0x82758075, 0xbefc0080,
|
||||
0xbf800000, 0xbe802b00,
|
||||
0xbe822b02, 0xbe842b04,
|
||||
0xbe862b06, 0xbe882b08,
|
||||
0xbe8a2b0a, 0xbe8c2b0c,
|
||||
0xbe8e2b0e, 0xc06b003a,
|
||||
0x00000000, 0xbf8cc07f,
|
||||
0xc06b013a, 0x00000010,
|
||||
0xbf8cc07f, 0xc06b023a,
|
||||
0x00000020, 0xbf8cc07f,
|
||||
0xc06b033a, 0x00000030,
|
||||
0xbf8cc07f, 0x8074c074,
|
||||
0x82758075, 0x807c907c,
|
||||
0xbf0a7b7c, 0xbf85ffe7,
|
||||
0xbef40172, 0xbef00080,
|
||||
0xbefe00c1, 0xbeff00c1,
|
||||
0xbee80080, 0xbee90080,
|
||||
0xbef600ff, 0x01000000,
|
||||
0x867aff78, 0x00400000,
|
||||
0xbf850003, 0xb8faf803,
|
||||
0x897a7aff, 0x10000000,
|
||||
0xbf85004d, 0xbe840080,
|
||||
0xd2890000, 0x00000900,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890002, 0x00000900,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000900, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890001, 0x00000901,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890003, 0x00000901,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbe840080,
|
||||
0xd2890000, 0x00000902,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000902, 0x80048104,
|
||||
0xd2890002, 0x00000902,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000902, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000903, 0x80048104,
|
||||
0xd2890001, 0x00000903,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000903, 0x80048104,
|
||||
0xd2890003, 0x00000903,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbf820008,
|
||||
0xe0724000, 0x701d0000,
|
||||
0xe0724100, 0x701d0100,
|
||||
0xe0724200, 0x701d0200,
|
||||
0xe0724300, 0x701d0300,
|
||||
0xbefe00c1, 0xbeff00c1,
|
||||
0xb8fb4306, 0x867bc17b,
|
||||
0xbf840064, 0xbf8a0000,
|
||||
0x867aff6f, 0x04000000,
|
||||
0xbf840060, 0x8e7b867b,
|
||||
0x8e7b827b, 0xbef6007b,
|
||||
0xb8f02985, 0x80708170,
|
||||
0x8e708a70, 0x8e708170,
|
||||
0xb8fa1605, 0x807a817a,
|
||||
0x8e7a867a, 0x80707a70,
|
||||
0x8070ff70, 0x00000080,
|
||||
0xbef600ff, 0x01000000,
|
||||
0xbefc0080, 0xd28c0002,
|
||||
0x000100c1, 0xd28d0003,
|
||||
0x000204c1, 0x867aff78,
|
||||
0x00400000, 0xbf850003,
|
||||
0xb8faf803, 0x897a7aff,
|
||||
0x10000000, 0xbf850030,
|
||||
0x24040682, 0xd86e4000,
|
||||
0x00000002, 0xbf8cc07f,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890001, 0x00000900,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890003, 0x00000900,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbe840080,
|
||||
0xd2890000, 0x00000901,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890002, 0x00000901,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000901, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0x680404ff, 0x00000200,
|
||||
0xd0c9006a, 0x0000f702,
|
||||
0xbf87ffd2, 0xbf820015,
|
||||
0xd1060002, 0x00011103,
|
||||
0x7e0602ff, 0x00000200,
|
||||
0xbefc00ff, 0x00010000,
|
||||
0xbe800077, 0x8677ff77,
|
||||
0xff7fffff, 0x8777ff77,
|
||||
0x00058000, 0xd8ec0000,
|
||||
0x00000002, 0xbf8cc07f,
|
||||
0xe0765000, 0x701d0002,
|
||||
0x68040702, 0xd0c9006a,
|
||||
0x0000f702, 0xbf87fff7,
|
||||
0xbef70000, 0xbef000ff,
|
||||
0x00000400, 0xbefe00c1,
|
||||
0xbeff00c1, 0xb8fb2b05,
|
||||
0x807b817b, 0x8e7b827b,
|
||||
0xbef600ff, 0x01000000,
|
||||
0xbefc0084, 0xbf0a7b7c,
|
||||
0xbf84006d, 0xbf11017c,
|
||||
0x807bff7b, 0x00001000,
|
||||
0x867aff78, 0x00400000,
|
||||
0xbf850003, 0xb8faf803,
|
||||
0x897a7aff, 0x10000000,
|
||||
0xbf850051, 0xbe840080,
|
||||
0xd2890000, 0x00000900,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890002, 0x00000900,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000900, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890001, 0x00000901,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890003, 0x00000901,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbe840080,
|
||||
0xd2890000, 0x00000902,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000902, 0x80048104,
|
||||
0xd2890002, 0x00000902,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000902, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000903, 0x80048104,
|
||||
0xd2890001, 0x00000903,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000903, 0x80048104,
|
||||
0xd2890003, 0x00000903,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0x807c847c,
|
||||
0xbf0a7b7c, 0xbf85ffb1,
|
||||
0xbf9c0000, 0xbf820012,
|
||||
0x7e000300, 0x7e020301,
|
||||
0x7e040302, 0x7e060303,
|
||||
0xe0724000, 0x701d0000,
|
||||
0xe0724100, 0x701d0100,
|
||||
0xe0724200, 0x701d0200,
|
||||
0xe0724300, 0x701d0300,
|
||||
0x807c847c, 0x8070ff70,
|
||||
0x00000400, 0xbf0a7b7c,
|
||||
0xbf85ffef, 0xbf9c0000,
|
||||
0xb8fb2985, 0x807b817b,
|
||||
0x8e7b837b, 0xb8fa2b05,
|
||||
0x807a817a, 0x8e7a827a,
|
||||
0x80fb7a7b, 0x867b7b7b,
|
||||
0xbf84007a, 0x807bff7b,
|
||||
0x00001000, 0xbefc0080,
|
||||
0xbf11017c, 0x867aff78,
|
||||
0x00400000, 0xbf850003,
|
||||
0xb8faf803, 0x897a7aff,
|
||||
0x10000000, 0xbf850059,
|
||||
0xd3d84000, 0x18000100,
|
||||
0xd3d84001, 0x18000101,
|
||||
0xd3d84002, 0x18000102,
|
||||
0xd3d84003, 0x18000103,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890001, 0x00000900,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000900, 0x80048104,
|
||||
0xd2890003, 0x00000900,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbe840080,
|
||||
0xd2890000, 0x00000901,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000901, 0x80048104,
|
||||
0xd2890002, 0x00000901,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000901, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0xbe840080, 0xd2890000,
|
||||
0x00000902, 0x80048104,
|
||||
0xd2890001, 0x00000902,
|
||||
0x80048104, 0xd2890002,
|
||||
0x00000902, 0x80048104,
|
||||
0xd2890003, 0x00000902,
|
||||
0x80048104, 0xc069003a,
|
||||
0x00000070, 0xbf8cc07f,
|
||||
0x80709070, 0xbf06c004,
|
||||
0xbf84ffee, 0xbe840080,
|
||||
0xd2890000, 0x00000903,
|
||||
0x80048104, 0xd2890001,
|
||||
0x00000903, 0x80048104,
|
||||
0xd2890002, 0x00000903,
|
||||
0x80048104, 0xd2890003,
|
||||
0x00000903, 0x80048104,
|
||||
0xc069003a, 0x00000070,
|
||||
0xbf8cc07f, 0x80709070,
|
||||
0xbf06c004, 0xbf84ffee,
|
||||
0x807c847c, 0xbf0a7b7c,
|
||||
0xbf85ffa9, 0xbf9c0000,
|
||||
0xbf820016, 0xd3d84000,
|
||||
0x18000100, 0xd3d84001,
|
||||
0x18000101, 0xd3d84002,
|
||||
0x18000102, 0xd3d84003,
|
||||
0x18000103, 0xe0724000,
|
||||
0x701d0000, 0xe0724100,
|
||||
0x701d0100, 0xe0724200,
|
||||
0x701d0200, 0xe0724300,
|
||||
0x701d0300, 0x807c847c,
|
||||
0x8070ff70, 0x00000400,
|
||||
0xbf0a7b7c, 0xbf85ffeb,
|
||||
0xbf9c0000, 0xbf8200ee,
|
||||
0xbef4007e, 0x8675ff7f,
|
||||
0x0000ffff, 0x8775ff75,
|
||||
0x00040000, 0xbef60080,
|
||||
0xbef700ff, 0x00807fac,
|
||||
0x866eff7f, 0x04000000,
|
||||
0xbf84001f, 0xbefe00c1,
|
||||
0xbeff00c1, 0xb8ef4306,
|
||||
0x866fc16f, 0xbf84001a,
|
||||
0x8e6f866f, 0x8e6f826f,
|
||||
0xbef6006f, 0xb8f82985,
|
||||
0x80788178, 0x8e788a78,
|
||||
0x8e788178, 0xb8ee1605,
|
||||
0x806e816e, 0x8e6e866e,
|
||||
0x80786e78, 0x8078ff78,
|
||||
0x00000080, 0xbef600ff,
|
||||
0x01000000, 0xbefc0080,
|
||||
0xe0510000, 0x781d0000,
|
||||
0xe0510100, 0x781d0000,
|
||||
0x807cff7c, 0x00000200,
|
||||
0x8078ff78, 0x00000200,
|
||||
0xbf0a6f7c, 0xbf85fff6,
|
||||
0xbefe00c1, 0xbeff00c1,
|
||||
0xbef600ff, 0x01000000,
|
||||
0xb8ef2b05, 0x806f816f,
|
||||
0x8e6f826f, 0x806fff6f,
|
||||
0x00008000, 0xbef80080,
|
||||
0xbeee0078, 0x8078ff78,
|
||||
0x00000400, 0xbefc0084,
|
||||
0xbf11087c, 0xe0524000,
|
||||
0x781d0000, 0xe0524100,
|
||||
0x781d0100, 0xe0524200,
|
||||
0x781d0200, 0xe0524300,
|
||||
0x781d0300, 0xbf8c0f70,
|
||||
0x7e000300, 0x7e020301,
|
||||
0x7e040302, 0x7e060303,
|
||||
0x807c847c, 0x8078ff78,
|
||||
0x00000400, 0xbf0a6f7c,
|
||||
0xbf85ffee, 0xb8ef2985,
|
||||
0x806f816f, 0x8e6f836f,
|
||||
0xb8f92b05, 0x80798179,
|
||||
0x8e798279, 0x80ef796f,
|
||||
0x866f6f6f, 0xbf84001a,
|
||||
0x806fff6f, 0x00008000,
|
||||
0xbefc0080, 0xbf11087c,
|
||||
0xe0524000, 0x781d0000,
|
||||
0xe0524100, 0x781d0100,
|
||||
0xe0524200, 0x781d0200,
|
||||
0xe0524300, 0x781d0300,
|
||||
0xbf8c0f70, 0xd3d94000,
|
||||
0x18000100, 0xd3d94001,
|
||||
0x18000101, 0xd3d94002,
|
||||
0x18000102, 0xd3d94003,
|
||||
0x18000103, 0x807c847c,
|
||||
0x8078ff78, 0x00000400,
|
||||
0xbf0a6f7c, 0xbf85ffea,
|
||||
0xbf9c0000, 0xe0524000,
|
||||
0x6e1d0000, 0xe0524100,
|
||||
0x6e1d0100, 0xe0524200,
|
||||
0x6e1d0200, 0xe0524300,
|
||||
0x6e1d0300, 0xbf8c0f70,
|
||||
0xb8f82985, 0x80788178,
|
||||
0x8e788a78, 0x8e788178,
|
||||
0xb8ee1605, 0x806e816e,
|
||||
0x8e6e866e, 0x80786e78,
|
||||
0x80f8c078, 0xb8ef1605,
|
||||
0x806f816f, 0x8e6f846f,
|
||||
0x8e76826f, 0xbef600ff,
|
||||
0x01000000, 0xbefc006f,
|
||||
0xc031003a, 0x00000078,
|
||||
0x80f8c078, 0xbf8cc07f,
|
||||
0x80fc907c, 0xbf800000,
|
||||
0xbe802d00, 0xbe822d02,
|
||||
0xbe842d04, 0xbe862d06,
|
||||
0xbe882d08, 0xbe8a2d0a,
|
||||
0xbe8c2d0c, 0xbe8e2d0e,
|
||||
0xbf06807c, 0xbf84fff0,
|
||||
0xb8f82985, 0x80788178,
|
||||
0x8e788a78, 0x8e788178,
|
||||
0xb8ee1605, 0x806e816e,
|
||||
0x8e6e866e, 0x80786e78,
|
||||
0xbef60084, 0xbef600ff,
|
||||
0x01000000, 0xc0211bfa,
|
||||
0x00000078, 0x80788478,
|
||||
0xc0211b3a, 0x00000078,
|
||||
0x80788478, 0xc0211b7a,
|
||||
0x00000078, 0x80788478,
|
||||
0xc0211c3a, 0x00000078,
|
||||
0x80788478, 0xc0211c7a,
|
||||
0x00000078, 0x80788478,
|
||||
0xc0211eba, 0x00000078,
|
||||
0x80788478, 0xc0211efa,
|
||||
0x00000078, 0x80788478,
|
||||
0xc0211a3a, 0x00000078,
|
||||
0x80788478, 0xc0211a7a,
|
||||
0x00000078, 0x80788478,
|
||||
0xc0211cfa, 0x00000078,
|
||||
0x80788478, 0xbf8cc07f,
|
||||
0xbefc006f, 0xbefe0070,
|
||||
0xbeff0071, 0x866f7bff,
|
||||
0x000003ff, 0xb96f4803,
|
||||
0x866f7bff, 0xfffff800,
|
||||
0x8f6f8b6f, 0xb96fa2c3,
|
||||
0xb973f801, 0xb8ee2985,
|
||||
0x806e816e, 0x8e6e8a6e,
|
||||
0x8e6e816e, 0xb8ef1605,
|
||||
0x806f816f, 0x8e6f866f,
|
||||
0x806e6f6e, 0x806e746e,
|
||||
0x826f8075, 0x866fff6f,
|
||||
0x0000ffff, 0xc00b1c37,
|
||||
0x00000050, 0xc00b1d37,
|
||||
0x00000060, 0xc0031e77,
|
||||
0x00000074, 0xbf8cc07f,
|
||||
0x8f6e8b79, 0x866eff6e,
|
||||
0x001f8000, 0xb96ef807,
|
||||
0x866dff6d, 0x0000ffff,
|
||||
0x86fe7e7e, 0x86ea6a6a,
|
||||
0x8f6e837a, 0xb96ee0c2,
|
||||
0xbf800002, 0xb97a0002,
|
||||
0xbf8a0000, 0xbe801f6c,
|
||||
0xbf810000, 0x00000000,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,15 +33,20 @@
|
|||
* aldebaran:
|
||||
* cpp -DASIC_FAMILY=CHIP_ALDEBARAN cwsr_trap_handler_gfx9.asm -P -o aldebaran.sp3
|
||||
* sp3 aldebaran.sp3 -hex aldebaran.hex
|
||||
*
|
||||
* gc_9_4_3:
|
||||
* cpp -DASIC_FAMILY=GC_9_4_3 cwsr_trap_handler_gfx9.asm -P -o gc_9_4_3.sp3
|
||||
* sp3 gc_9_4_3.sp3 -hex gc_9_4_3.hex
|
||||
*/
|
||||
|
||||
#define CHIP_VEGAM 18
|
||||
#define CHIP_ARCTURUS 23
|
||||
#define CHIP_ALDEBARAN 25
|
||||
#define CHIP_GC_9_4_3 26
|
||||
|
||||
var ACK_SQC_STORE = 1 //workaround for suspected SQC store bug causing incorrect stores under concurrency
|
||||
var SAVE_AFTER_XNACK_ERROR = 1 //workaround for TCP store failure after XNACK error when ALLOW_REPLAY=0, for debugger
|
||||
var SINGLE_STEP_MISSED_WORKAROUND = 1 //workaround for lost MODE.DEBUG_EN exception when SAVECTX raised
|
||||
var SINGLE_STEP_MISSED_WORKAROUND = (ASIC_FAMILY <= CHIP_ALDEBARAN) //workaround for lost MODE.DEBUG_EN exception when SAVECTX raised
|
||||
|
||||
/**************************************************************************/
|
||||
/* variables */
|
||||
|
|
@ -77,6 +82,10 @@ var SQ_WAVE_TRAPSTS_ADDR_WATCH_MASK = 0x80
|
|||
var SQ_WAVE_TRAPSTS_ADDR_WATCH_SHIFT = 7
|
||||
var SQ_WAVE_TRAPSTS_MEM_VIOL_MASK = 0x100
|
||||
var SQ_WAVE_TRAPSTS_MEM_VIOL_SHIFT = 8
|
||||
var SQ_WAVE_TRAPSTS_HOST_TRAP_MASK = 0x400000
|
||||
var SQ_WAVE_TRAPSTS_WAVE_BEGIN_MASK = 0x800000
|
||||
var SQ_WAVE_TRAPSTS_WAVE_END_MASK = 0x1000000
|
||||
var SQ_WAVE_TRAPSTS_TRAP_AFTER_INST_MASK = 0x2000000
|
||||
var SQ_WAVE_TRAPSTS_PRE_SAVECTX_MASK = 0x3FF
|
||||
var SQ_WAVE_TRAPSTS_PRE_SAVECTX_SHIFT = 0x0
|
||||
var SQ_WAVE_TRAPSTS_PRE_SAVECTX_SIZE = 10
|
||||
|
|
@ -95,10 +104,10 @@ var SQ_WAVE_IB_STS_RCNT_FIRST_REPLAY_MASK = 0x1F8000
|
|||
|
||||
var SQ_WAVE_MODE_DEBUG_EN_MASK = 0x800
|
||||
|
||||
var TTMP11_SAVE_RCNT_FIRST_REPLAY_SHIFT = 26 // bits [31:26] unused by SPI debug data
|
||||
var TTMP11_SAVE_RCNT_FIRST_REPLAY_MASK = 0xFC000000
|
||||
var TTMP11_DEBUG_TRAP_ENABLED_SHIFT = 23
|
||||
var TTMP11_DEBUG_TRAP_ENABLED_MASK = 0x800000
|
||||
var TTMP_SAVE_RCNT_FIRST_REPLAY_SHIFT = 26 // bits [31:26] unused by SPI debug data
|
||||
var TTMP_SAVE_RCNT_FIRST_REPLAY_MASK = 0xFC000000
|
||||
var TTMP_DEBUG_TRAP_ENABLED_SHIFT = 23
|
||||
var TTMP_DEBUG_TRAP_ENABLED_MASK = 0x800000
|
||||
|
||||
/* Save */
|
||||
var S_SAVE_BUF_RSRC_WORD1_STRIDE = 0x00040000 //stride is 4 bytes
|
||||
|
|
@ -129,6 +138,11 @@ var s_save_alloc_size = s_save_trapsts //conflict
|
|||
var s_save_m0 = ttmp5
|
||||
var s_save_ttmps_lo = s_save_tmp //no conflict
|
||||
var s_save_ttmps_hi = s_save_trapsts //no conflict
|
||||
#if ASIC_FAMILY >= CHIP_GC_9_4_3
|
||||
var s_save_ib_sts = ttmp13
|
||||
#else
|
||||
var s_save_ib_sts = ttmp11
|
||||
#endif
|
||||
|
||||
/* Restore */
|
||||
var S_RESTORE_BUF_RSRC_WORD1_STRIDE = S_SAVE_BUF_RSRC_WORD1_STRIDE
|
||||
|
|
@ -215,9 +229,15 @@ L_NOT_HALTED:
|
|||
// Any concurrent SAVECTX will be handled upon re-entry once halted.
|
||||
|
||||
// Check non-maskable exceptions. memory_violation, illegal_instruction
|
||||
// and xnack_error exceptions always cause the wave to enter the trap
|
||||
// handler.
|
||||
s_and_b32 ttmp2, s_save_trapsts, SQ_WAVE_TRAPSTS_MEM_VIOL_MASK|SQ_WAVE_TRAPSTS_ILLEGAL_INST_MASK
|
||||
// and debugger (host trap, wave start/end, trap after instruction)
|
||||
// exceptions always cause the wave to enter the trap handler.
|
||||
s_and_b32 ttmp2, s_save_trapsts, \
|
||||
SQ_WAVE_TRAPSTS_MEM_VIOL_MASK | \
|
||||
SQ_WAVE_TRAPSTS_ILLEGAL_INST_MASK | \
|
||||
SQ_WAVE_TRAPSTS_HOST_TRAP_MASK | \
|
||||
SQ_WAVE_TRAPSTS_WAVE_BEGIN_MASK | \
|
||||
SQ_WAVE_TRAPSTS_WAVE_END_MASK | \
|
||||
SQ_WAVE_TRAPSTS_TRAP_AFTER_INST_MASK
|
||||
s_cbranch_scc1 L_FETCH_2ND_TRAP
|
||||
|
||||
// Check for maskable exceptions in trapsts.excp and trapsts.excp_hi.
|
||||
|
|
@ -265,9 +285,9 @@ L_FETCH_2ND_TRAP:
|
|||
|
||||
s_load_dword ttmp2, [ttmp14, ttmp15], 0x10 glc:1 // debug trap enabled flag
|
||||
s_waitcnt lgkmcnt(0)
|
||||
s_lshl_b32 ttmp2, ttmp2, TTMP11_DEBUG_TRAP_ENABLED_SHIFT
|
||||
s_andn2_b32 ttmp11, ttmp11, TTMP11_DEBUG_TRAP_ENABLED_MASK
|
||||
s_or_b32 ttmp11, ttmp11, ttmp2
|
||||
s_lshl_b32 ttmp2, ttmp2, TTMP_DEBUG_TRAP_ENABLED_SHIFT
|
||||
s_andn2_b32 s_save_ib_sts, s_save_ib_sts, TTMP_DEBUG_TRAP_ENABLED_MASK
|
||||
s_or_b32 s_save_ib_sts, s_save_ib_sts, ttmp2
|
||||
|
||||
s_load_dwordx2 [ttmp2, ttmp3], [ttmp14, ttmp15], 0x0 glc:1 // second-level TBA
|
||||
s_waitcnt lgkmcnt(0)
|
||||
|
|
@ -1058,17 +1078,17 @@ function set_status_without_spi_prio(status, tmp)
|
|||
end
|
||||
|
||||
function save_and_clear_ib_sts(tmp)
|
||||
// Save IB_STS.FIRST_REPLAY[15] and IB_STS.RCNT[20:16] into unused space ttmp11[31:26].
|
||||
// Save IB_STS.FIRST_REPLAY[15] and IB_STS.RCNT[20:16] into unused space s_save_ib_sts[31:26].
|
||||
s_getreg_b32 tmp, hwreg(HW_REG_IB_STS)
|
||||
s_and_b32 tmp, tmp, SQ_WAVE_IB_STS_RCNT_FIRST_REPLAY_MASK
|
||||
s_lshl_b32 tmp, tmp, (TTMP11_SAVE_RCNT_FIRST_REPLAY_SHIFT - SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT)
|
||||
s_andn2_b32 ttmp11, ttmp11, TTMP11_SAVE_RCNT_FIRST_REPLAY_MASK
|
||||
s_or_b32 ttmp11, ttmp11, tmp
|
||||
s_lshl_b32 tmp, tmp, (TTMP_SAVE_RCNT_FIRST_REPLAY_SHIFT - SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT)
|
||||
s_andn2_b32 s_save_ib_sts, s_save_ib_sts, TTMP_SAVE_RCNT_FIRST_REPLAY_MASK
|
||||
s_or_b32 s_save_ib_sts, s_save_ib_sts, tmp
|
||||
s_setreg_imm32_b32 hwreg(HW_REG_IB_STS), 0x0
|
||||
end
|
||||
|
||||
function restore_ib_sts(tmp)
|
||||
s_lshr_b32 tmp, ttmp11, (TTMP11_SAVE_RCNT_FIRST_REPLAY_SHIFT - SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT)
|
||||
s_lshr_b32 tmp, s_save_ib_sts, (TTMP_SAVE_RCNT_FIRST_REPLAY_SHIFT - SQ_WAVE_IB_STS_FIRST_REPLAY_SHIFT)
|
||||
s_and_b32 tmp, tmp, SQ_WAVE_IB_STS_RCNT_FIRST_REPLAY_MASK
|
||||
s_setreg_b32 hwreg(HW_REG_IB_STS), tmp
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1462,6 +1462,7 @@ int kfd_get_gpu_cache_info(struct kfd_dev *kdev, struct kfd_gpu_cache_info **pca
|
|||
num_of_cache_types = ARRAY_SIZE(vega20_cache_info);
|
||||
break;
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
*pcache_info = aldebaran_cache_info;
|
||||
num_of_cache_types = ARRAY_SIZE(aldebaran_cache_info);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
|
|||
break;
|
||||
/* Aldebaran */
|
||||
case IP_VERSION(9, 4, 2):
|
||||
case IP_VERSION(9, 4, 3):
|
||||
gfx_target_version = 90010;
|
||||
f2g = &aldebaran_kfd2kgd;
|
||||
break;
|
||||
|
|
@ -450,6 +451,10 @@ static void kfd_cwsr_init(struct kfd_dev *kfd)
|
|||
BUILD_BUG_ON(sizeof(cwsr_trap_aldebaran_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_aldebaran_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_aldebaran_hex);
|
||||
} else if (KFD_GC_VERSION(kfd) == IP_VERSION(9, 4, 3)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_gfx9_4_3_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_gfx9_4_3_hex;
|
||||
kfd->cwsr_isa_size = sizeof(cwsr_trap_gfx9_4_3_hex);
|
||||
} else if (KFD_GC_VERSION(kfd) < IP_VERSION(10, 1, 1)) {
|
||||
BUILD_BUG_ON(sizeof(cwsr_trap_gfx9_hex) > PAGE_SIZE);
|
||||
kfd->cwsr_isa = cwsr_trap_gfx9_hex;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ static void init_mqd(struct mqd_manager *mm, void **mqd,
|
|||
{
|
||||
uint64_t addr;
|
||||
struct v9_mqd *m;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)mm->dev->adev;
|
||||
|
||||
m = (struct v9_mqd *) mqd_mem_obj->cpu_ptr;
|
||||
addr = mqd_mem_obj->gpu_addr;
|
||||
|
|
@ -167,6 +168,20 @@ static void init_mqd(struct mqd_manager *mm, void **mqd,
|
|||
if (q->format == KFD_QUEUE_FORMAT_AQL) {
|
||||
m->cp_hqd_aql_control =
|
||||
1 << CP_HQD_AQL_CONTROL__CONTROL0__SHIFT;
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) {
|
||||
/* On GC 9.4.3, DW 41 is re-purposed as
|
||||
* compute_tg_chunk_size.
|
||||
* TODO: review this setting when active CUs in the
|
||||
* partition play a role
|
||||
*/
|
||||
m->compute_static_thread_mgmt_se6 = 1;
|
||||
}
|
||||
} else {
|
||||
/* PM4 queue */
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) {
|
||||
m->compute_static_thread_mgmt_se6 = 0;
|
||||
/* TODO: program pm4_target_xcc */
|
||||
}
|
||||
}
|
||||
|
||||
if (q->tba_addr) {
|
||||
|
|
|
|||
|
|
@ -238,7 +238,8 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm)
|
|||
pm->pmf = &kfd_vi_pm_funcs;
|
||||
break;
|
||||
default:
|
||||
if (KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 2))
|
||||
if (KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 2) ||
|
||||
KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 3))
|
||||
pm->pmf = &kfd_aldebaran_pm_funcs;
|
||||
else if (KFD_GC_VERSION(dqm->dev) >= IP_VERSION(9, 0, 1))
|
||||
pm->pmf = &kfd_v9_pm_funcs;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,8 @@ enum cache_policy {
|
|||
#define KFD_GC_VERSION(dev) ((dev)->adev->ip_versions[GC_HWIP][0])
|
||||
#define KFD_IS_SOC15(dev) ((KFD_GC_VERSION(dev)) >= (IP_VERSION(9, 0, 1)))
|
||||
#define KFD_SUPPORT_XNACK_PER_PROCESS(dev)\
|
||||
(KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2))
|
||||
((KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) || \
|
||||
(KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3)))
|
||||
|
||||
struct kfd_event_interrupt_class {
|
||||
bool (*interrupt_isr)(struct kfd_dev *dev,
|
||||
|
|
|
|||
|
|
@ -820,15 +820,14 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
|
|||
DRM_ERROR("Failed to allocate dmub_hpd_wrk");
|
||||
return;
|
||||
}
|
||||
dmub_hpd_wrk->dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_ATOMIC);
|
||||
dmub_hpd_wrk->dmub_notify = kmemdup(¬ify, sizeof(struct dmub_notification),
|
||||
GFP_ATOMIC);
|
||||
if (!dmub_hpd_wrk->dmub_notify) {
|
||||
kfree(dmub_hpd_wrk);
|
||||
DRM_ERROR("Failed to allocate dmub_hpd_wrk->dmub_notify");
|
||||
return;
|
||||
}
|
||||
INIT_WORK(&dmub_hpd_wrk->handle_hpd_work, dm_handle_hpd_work);
|
||||
if (dmub_hpd_wrk->dmub_notify)
|
||||
memcpy(dmub_hpd_wrk->dmub_notify, ¬ify, sizeof(struct dmub_notification));
|
||||
dmub_hpd_wrk->adev = adev;
|
||||
if (notify.type == DMUB_NOTIFICATION_HPD) {
|
||||
plink = adev->dm.dc->links[notify.link_index];
|
||||
|
|
@ -2300,9 +2299,9 @@ static int dm_late_init(void *handle)
|
|||
*/
|
||||
params.min_abm_backlight = 0x28F;
|
||||
/* In the case where abm is implemented on dmcub,
|
||||
* dmcu object will be null.
|
||||
* ABM 2.4 and up are implemented on dmcub.
|
||||
*/
|
||||
* dmcu object will be null.
|
||||
* ABM 2.4 and up are implemented on dmcub.
|
||||
*/
|
||||
if (dmcu) {
|
||||
if (!dmcu_load_iram(dmcu, params))
|
||||
return -EINVAL;
|
||||
|
|
@ -2976,30 +2975,18 @@ static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
|
|||
static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
|
||||
{
|
||||
struct amdgpu_dm_backlight_caps *caps;
|
||||
struct amdgpu_display_manager *dm;
|
||||
struct drm_connector *conn_base;
|
||||
struct amdgpu_device *adev;
|
||||
struct dc_link *link = NULL;
|
||||
struct drm_luminance_range_info *luminance_range;
|
||||
int i;
|
||||
|
||||
if (!aconnector || !aconnector->dc_link)
|
||||
return;
|
||||
|
||||
link = aconnector->dc_link;
|
||||
if (link->connector_signal != SIGNAL_TYPE_EDP)
|
||||
if (aconnector->bl_idx == -1 ||
|
||||
aconnector->dc_link->connector_signal != SIGNAL_TYPE_EDP)
|
||||
return;
|
||||
|
||||
conn_base = &aconnector->base;
|
||||
adev = drm_to_adev(conn_base->dev);
|
||||
dm = &adev->dm;
|
||||
for (i = 0; i < dm->num_of_edps; i++) {
|
||||
if (link == dm->backlight_link[i])
|
||||
break;
|
||||
}
|
||||
if (i >= dm->num_of_edps)
|
||||
return;
|
||||
caps = &dm->backlight_caps[i];
|
||||
|
||||
caps = &adev->dm.backlight_caps[aconnector->bl_idx];
|
||||
caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
|
||||
caps->aux_support = false;
|
||||
|
||||
|
|
@ -4190,16 +4177,18 @@ static const struct backlight_ops amdgpu_dm_backlight_ops = {
|
|||
};
|
||||
|
||||
static void
|
||||
amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
|
||||
amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
|
||||
{
|
||||
char bl_name[16];
|
||||
struct drm_device *drm = aconnector->base.dev;
|
||||
struct amdgpu_display_manager *dm = &drm_to_adev(drm)->dm;
|
||||
struct backlight_properties props = { 0 };
|
||||
char bl_name[16];
|
||||
|
||||
amdgpu_dm_update_backlight_caps(dm, dm->num_of_edps);
|
||||
dm->brightness[dm->num_of_edps] = AMDGPU_MAX_BL_LEVEL;
|
||||
if (aconnector->bl_idx == -1)
|
||||
return;
|
||||
|
||||
if (!acpi_video_backlight_use_native()) {
|
||||
drm_info(adev_to_drm(dm->adev), "Skipping amdgpu DM backlight registration\n");
|
||||
drm_info(drm, "Skipping amdgpu DM backlight registration\n");
|
||||
/* Try registering an ACPI video backlight device instead. */
|
||||
acpi_video_register_backlight();
|
||||
return;
|
||||
|
|
@ -4210,17 +4199,16 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
|
|||
props.type = BACKLIGHT_RAW;
|
||||
|
||||
snprintf(bl_name, sizeof(bl_name), "amdgpu_bl%d",
|
||||
adev_to_drm(dm->adev)->primary->index + dm->num_of_edps);
|
||||
drm->primary->index + aconnector->bl_idx);
|
||||
|
||||
dm->backlight_dev[dm->num_of_edps] = backlight_device_register(bl_name,
|
||||
adev_to_drm(dm->adev)->dev,
|
||||
dm,
|
||||
&amdgpu_dm_backlight_ops,
|
||||
&props);
|
||||
dm->backlight_dev[aconnector->bl_idx] =
|
||||
backlight_device_register(bl_name, aconnector->base.kdev, dm,
|
||||
&amdgpu_dm_backlight_ops, &props);
|
||||
|
||||
if (IS_ERR(dm->backlight_dev[dm->num_of_edps]))
|
||||
if (IS_ERR(dm->backlight_dev[aconnector->bl_idx])) {
|
||||
DRM_ERROR("DM: Backlight registration failed!\n");
|
||||
else
|
||||
dm->backlight_dev[aconnector->bl_idx] = NULL;
|
||||
} else
|
||||
DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);
|
||||
}
|
||||
|
||||
|
|
@ -4265,24 +4253,29 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
|
|||
}
|
||||
|
||||
|
||||
static void register_backlight_device(struct amdgpu_display_manager *dm,
|
||||
struct dc_link *link)
|
||||
static void setup_backlight_device(struct amdgpu_display_manager *dm,
|
||||
struct amdgpu_dm_connector *aconnector)
|
||||
{
|
||||
if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) &&
|
||||
link->type != dc_connection_none) {
|
||||
/*
|
||||
* Event if registration failed, we should continue with
|
||||
* DM initialization because not having a backlight control
|
||||
* is better then a black screen.
|
||||
*/
|
||||
if (!dm->backlight_dev[dm->num_of_edps])
|
||||
amdgpu_dm_register_backlight_device(dm);
|
||||
struct dc_link *link = aconnector->dc_link;
|
||||
int bl_idx = dm->num_of_edps;
|
||||
|
||||
if (dm->backlight_dev[dm->num_of_edps]) {
|
||||
dm->backlight_link[dm->num_of_edps] = link;
|
||||
dm->num_of_edps++;
|
||||
}
|
||||
if (!(link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) ||
|
||||
link->type == dc_connection_none)
|
||||
return;
|
||||
|
||||
if (dm->num_of_edps >= AMDGPU_DM_MAX_NUM_EDP) {
|
||||
drm_warn(adev_to_drm(dm->adev), "Too much eDP connections, skipping backlight setup for additional eDPs\n");
|
||||
return;
|
||||
}
|
||||
|
||||
aconnector->bl_idx = bl_idx;
|
||||
|
||||
amdgpu_dm_update_backlight_caps(dm, bl_idx);
|
||||
dm->brightness[bl_idx] = AMDGPU_MAX_BL_LEVEL;
|
||||
dm->backlight_link[bl_idx] = link;
|
||||
dm->num_of_edps++;
|
||||
|
||||
update_connector_ext_caps(aconnector);
|
||||
}
|
||||
|
||||
static void amdgpu_set_panel_orientation(struct drm_connector *connector);
|
||||
|
|
@ -4462,10 +4455,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
|
|||
|
||||
if (ret) {
|
||||
amdgpu_dm_update_connector_after_detect(aconnector);
|
||||
register_backlight_device(dm, link);
|
||||
|
||||
if (dm->num_of_edps)
|
||||
update_connector_ext_caps(aconnector);
|
||||
setup_backlight_device(dm, aconnector);
|
||||
|
||||
if (psr_feature_enabled)
|
||||
amdgpu_dm_set_psr_caps(link);
|
||||
|
|
@ -6241,10 +6231,8 @@ static void amdgpu_dm_connector_unregister(struct drm_connector *connector)
|
|||
static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
|
||||
const struct dc_link *link = aconnector->dc_link;
|
||||
struct amdgpu_device *adev = drm_to_adev(connector->dev);
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Call only if mst_mgr was initialized before since it's not done
|
||||
|
|
@ -6253,11 +6241,9 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
|
|||
if (aconnector->mst_mgr.dev)
|
||||
drm_dp_mst_topology_mgr_destroy(&aconnector->mst_mgr);
|
||||
|
||||
for (i = 0; i < dm->num_of_edps; i++) {
|
||||
if ((link == dm->backlight_link[i]) && dm->backlight_dev[i]) {
|
||||
backlight_device_unregister(dm->backlight_dev[i]);
|
||||
dm->backlight_dev[i] = NULL;
|
||||
}
|
||||
if (aconnector->bl_idx != -1) {
|
||||
backlight_device_unregister(dm->backlight_dev[aconnector->bl_idx]);
|
||||
dm->backlight_dev[aconnector->bl_idx] = NULL;
|
||||
}
|
||||
|
||||
if (aconnector->dc_em_sink)
|
||||
|
|
@ -6339,6 +6325,8 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
|
|||
to_amdgpu_dm_connector(connector);
|
||||
int r;
|
||||
|
||||
amdgpu_dm_register_backlight_device(amdgpu_dm_connector);
|
||||
|
||||
if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
|
||||
(connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
|
||||
amdgpu_dm_connector->dm_dp_aux.aux.dev = connector->kdev;
|
||||
|
|
@ -7103,13 +7091,13 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector)
|
|||
/* Standard FPS values
|
||||
*
|
||||
* 23.976 - TV/NTSC
|
||||
* 24 - Cinema
|
||||
* 25 - TV/PAL
|
||||
* 24 - Cinema
|
||||
* 25 - TV/PAL
|
||||
* 29.97 - TV/NTSC
|
||||
* 30 - TV/NTSC
|
||||
* 48 - Cinema HFR
|
||||
* 50 - TV/PAL
|
||||
* 60 - Commonly used
|
||||
* 30 - TV/NTSC
|
||||
* 48 - Cinema HFR
|
||||
* 50 - TV/PAL
|
||||
* 60 - Commonly used
|
||||
* 48,72,96,120 - Multiples of 24
|
||||
*/
|
||||
static const u32 common_rates[] = {
|
||||
|
|
@ -7227,6 +7215,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
|
|||
aconnector->base.funcs->reset(&aconnector->base);
|
||||
|
||||
aconnector->connector_id = link_index;
|
||||
aconnector->bl_idx = -1;
|
||||
aconnector->dc_link = link;
|
||||
aconnector->base.interlace_allowed = false;
|
||||
aconnector->base.doublescan_allowed = false;
|
||||
|
|
@ -7737,7 +7726,7 @@ static void update_freesync_state_on_stream(
|
|||
return;
|
||||
|
||||
spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
|
||||
vrr_params = acrtc->dm_irq_params.vrr_params;
|
||||
vrr_params = acrtc->dm_irq_params.vrr_params;
|
||||
|
||||
if (surface) {
|
||||
mod_freesync_handle_preflip(
|
||||
|
|
@ -8318,7 +8307,7 @@ static void amdgpu_dm_commit_audio(struct drm_device *dev,
|
|||
if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
|
||||
continue;
|
||||
|
||||
notify:
|
||||
notify:
|
||||
aconnector = to_amdgpu_dm_connector(connector);
|
||||
|
||||
mutex_lock(&adev->dm.audio_lock);
|
||||
|
|
@ -9334,7 +9323,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
|
|||
skip_modeset:
|
||||
/* Release extra reference */
|
||||
if (new_stream)
|
||||
dc_stream_release(new_stream);
|
||||
dc_stream_release(new_stream);
|
||||
|
||||
/*
|
||||
* We want to do dc stream updates that do not require a
|
||||
|
|
@ -10668,7 +10657,7 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(
|
|||
if (!dc_process_dmub_aux_transfer_async(ctx->dc, link_index, payload)) {
|
||||
*operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wait_for_completion_timeout(&adev->dm.dmub_aux_transfer_done, 10 * HZ)) {
|
||||
DRM_ERROR("wait_for_completion_timeout timeout!");
|
||||
|
|
|
|||
|
|
@ -610,6 +610,7 @@ struct amdgpu_dm_connector {
|
|||
|
||||
struct drm_connector base;
|
||||
uint32_t connector_id;
|
||||
int bl_idx;
|
||||
|
||||
/* we need to mind the EDID between detect
|
||||
and get modes due to analog/digital/tvencoder */
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@
|
|||
#include "dm_helpers.h"
|
||||
#include "ddc_service_types.h"
|
||||
|
||||
/* MST Dock */
|
||||
static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
|
||||
|
||||
/* dm_helpers_parse_edid_caps
|
||||
*
|
||||
* Parse edid caps
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ bool needs_dsc_aux_workaround(struct dc_link *link)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool is_synaptics_cascaded_panamera(struct dc_link *link, struct drm_dp_mst_port *port)
|
||||
static bool is_synaptics_cascaded_panamera(struct dc_link *link, struct drm_dp_mst_port *port)
|
||||
{
|
||||
u8 branch_vendor_data[4] = { 0 }; // Vendor data 0x50C ~ 0x50F
|
||||
|
||||
|
|
|
|||
|
|
@ -522,6 +522,11 @@ static void dcn315_clk_mgr_helper_populate_bw_params(
|
|||
bw_params->clk_table.entries[i].dcfclk_mhz = clock_table->DcfClocks[0];
|
||||
bw_params->clk_table.entries[i].wck_ratio = 1;
|
||||
i++;
|
||||
} else if (clock_table->NumDcfClkLevelsEnabled != clock_table->NumSocClkLevelsEnabled) {
|
||||
bw_params->clk_table.entries[i-1].voltage = clock_table->SocVoltage[clock_table->NumSocClkLevelsEnabled - 1];
|
||||
bw_params->clk_table.entries[i-1].socclk_mhz = clock_table->SocClocks[clock_table->NumSocClkLevelsEnabled - 1];
|
||||
bw_params->clk_table.entries[i-1].dispclk_mhz = clock_table->DispClocks[clock_table->NumDispClkLevelsEnabled - 1];
|
||||
bw_params->clk_table.entries[i-1].dppclk_mhz = clock_table->DppClocks[clock_table->NumDispClkLevelsEnabled - 1];
|
||||
}
|
||||
bw_params->clk_table.num_entries = i;
|
||||
|
||||
|
|
|
|||
|
|
@ -888,6 +888,10 @@ static bool dc_construct_ctx(struct dc *dc,
|
|||
|
||||
dc->ctx = dc_ctx;
|
||||
|
||||
dc->link_srv = link_create_link_service();
|
||||
if (!dc->link_srv)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -985,8 +989,6 @@ static bool dc_construct(struct dc *dc,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
dc->link_srv = link_create_link_service();
|
||||
|
||||
dc->res_pool = dc_create_resource_pool(dc, init_params, dc_ctx->dce_version);
|
||||
if (!dc->res_pool)
|
||||
goto fail;
|
||||
|
|
@ -3492,22 +3494,6 @@ static void commit_planes_for_stream(struct dc *dc,
|
|||
|
||||
dc_dmub_update_dirty_rect(dc, surface_count, stream, srf_updates, context);
|
||||
|
||||
if (update_type != UPDATE_TYPE_FAST) {
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i];
|
||||
|
||||
if ((new_pipe->stream && new_pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) ||
|
||||
subvp_prev_use) {
|
||||
// If old context or new context has phantom pipes, apply
|
||||
// the phantom timings now. We can't change the phantom
|
||||
// pipe configuration safely without driver acquiring
|
||||
// the DMCUB lock first.
|
||||
dc->hwss.apply_ctx_to_hw(dc, context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stream updates
|
||||
if (stream_update)
|
||||
commit_planes_do_stream_update(dc, stream, stream_update, update_type, context);
|
||||
|
|
@ -3723,6 +3709,9 @@ static void commit_planes_for_stream(struct dc *dc,
|
|||
}
|
||||
}
|
||||
|
||||
if (update_type != UPDATE_TYPE_FAST)
|
||||
dc->hwss.post_unlock_program_front_end(dc, context);
|
||||
|
||||
if (subvp_prev_use && !subvp_curr_use) {
|
||||
/* If disabling subvp, disable phantom streams after front end
|
||||
* programming has completed (we turn on phantom OTG in order
|
||||
|
|
@ -3731,16 +3720,9 @@ static void commit_planes_for_stream(struct dc *dc,
|
|||
dc->hwss.apply_ctx_to_hw(dc, context);
|
||||
}
|
||||
|
||||
if (update_type != UPDATE_TYPE_FAST)
|
||||
dc->hwss.post_unlock_program_front_end(dc, context);
|
||||
if (update_type != UPDATE_TYPE_FAST)
|
||||
if (dc->hwss.commit_subvp_config)
|
||||
dc->hwss.commit_subvp_config(dc, context);
|
||||
|
||||
if (update_type != UPDATE_TYPE_FAST)
|
||||
if (dc->hwss.commit_subvp_config)
|
||||
dc->hwss.commit_subvp_config(dc, context);
|
||||
|
||||
/* Since phantom pipe programming is moved to post_unlock_program_front_end,
|
||||
* move the SubVP lock to after the phantom pipes have been setup
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -285,8 +285,7 @@ int dc_link_aux_transfer_raw(struct ddc_service *ddc,
|
|||
ddc, payload, operation_result);
|
||||
}
|
||||
|
||||
uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(
|
||||
struct dc *dc, uint8_t bw)
|
||||
uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(const struct dc *dc, uint8_t bw)
|
||||
{
|
||||
return dc->link_srv->bw_kbps_from_raw_frl_link_rate_data(bw);
|
||||
}
|
||||
|
|
@ -474,3 +473,8 @@ void dc_link_enable_hpd_filter(struct dc_link *link, bool enable)
|
|||
{
|
||||
link->dc->link_srv->enable_hpd_filter(link, enable);
|
||||
}
|
||||
|
||||
bool dc_link_validate(struct dc *dc, const struct dc_stream_state *streams, const unsigned int count)
|
||||
{
|
||||
return dc->link_srv->validate_dpia_bandwidth(streams, count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,15 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_stat_get_dmub_notification
|
||||
* dc_stat_get_dmub_notification
|
||||
*
|
||||
* @brief
|
||||
* Calls dmub layer to retrieve dmub notification
|
||||
* Calls dmub layer to retrieve dmub notification
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] notify: dmub notification structure
|
||||
* @dc: dc structure
|
||||
* @notify: dmub notification structure
|
||||
*
|
||||
* @return
|
||||
* Returns
|
||||
* None
|
||||
*****************************************************************************
|
||||
*/
|
||||
void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification *notify)
|
||||
{
|
||||
|
|
@ -73,19 +69,15 @@ void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification
|
|||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_stat_get_dmub_dataout
|
||||
* dc_stat_get_dmub_dataout
|
||||
*
|
||||
* @brief
|
||||
* Calls dmub layer to retrieve dmub gpint dataout
|
||||
* Calls dmub layer to retrieve dmub gpint dataout
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] dataout: dmub gpint dataout
|
||||
* @dc: dc structure
|
||||
* @dataout: dmub gpint dataout
|
||||
*
|
||||
* @return
|
||||
* Returns
|
||||
* None
|
||||
*****************************************************************************
|
||||
*/
|
||||
void dc_stat_get_dmub_dataout(const struct dc *dc, uint32_t *dataout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ struct aux_payload;
|
|||
struct set_config_cmd_payload;
|
||||
struct dmub_notification;
|
||||
|
||||
#define DC_VER "3.2.227"
|
||||
#define DC_VER "3.2.229"
|
||||
|
||||
#define MAX_SURFACES 3
|
||||
#define MAX_PLANES 6
|
||||
|
|
@ -873,6 +873,8 @@ struct dc_debug_options {
|
|||
bool dig_fifo_off_in_blank;
|
||||
bool temp_mst_deallocation_sequence;
|
||||
bool override_dispclk_programming;
|
||||
bool disable_fpo_optimizations;
|
||||
bool support_eDP1_5;
|
||||
};
|
||||
|
||||
struct gpu_info_soc_bounding_box_v1_0;
|
||||
|
|
@ -1768,8 +1770,7 @@ void dc_restore_link_res_map(const struct dc *dc, uint32_t *map);
|
|||
bool dc_link_update_dsc_config(struct pipe_ctx *pipe_ctx);
|
||||
|
||||
/* translate a raw link rate data to bandwidth in kbps */
|
||||
uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(
|
||||
struct dc *dc, uint8_t bw);
|
||||
uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(const struct dc *dc, uint8_t bw);
|
||||
|
||||
/* determine the optimal bandwidth given link and required bw.
|
||||
* @link - current detected link
|
||||
|
|
@ -2029,6 +2030,19 @@ void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link,
|
|||
int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
|
||||
struct dc_link *link, int peak_bw);
|
||||
|
||||
/*
|
||||
* Validate the BW of all the valid DPIA links to make sure it doesn't exceed
|
||||
* available BW for each host router
|
||||
*
|
||||
* @dc: pointer to dc struct
|
||||
* @stream: pointer to all possible streams
|
||||
* @num_streams: number of valid DPIA streams
|
||||
*
|
||||
* return: TRUE if bw used by DPIAs doesn't exceed available BW else return FALSE
|
||||
*/
|
||||
bool dc_link_validate(struct dc *dc, const struct dc_stream_state *streams,
|
||||
const unsigned int count);
|
||||
|
||||
/* Sink Interfaces - A sink corresponds to a display output device */
|
||||
|
||||
struct dc_container_id {
|
||||
|
|
|
|||
|
|
@ -302,27 +302,29 @@ static uint8_t dc_dmub_srv_get_pipes_for_stream(struct dc *dc, struct dc_stream_
|
|||
return pipes;
|
||||
}
|
||||
|
||||
static int dc_dmub_srv_get_timing_generator_offset(struct dc *dc, struct dc_stream_state *stream)
|
||||
static void dc_dmub_srv_populate_fams_pipe_info(struct dc *dc, struct dc_state *context,
|
||||
struct pipe_ctx *head_pipe,
|
||||
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data *fams_pipe_data)
|
||||
{
|
||||
int tg_inst = 0;
|
||||
int i = 0;
|
||||
int j;
|
||||
int pipe_idx = 0;
|
||||
|
||||
for (i = 0; i < MAX_PIPES; i++) {
|
||||
struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
|
||||
fams_pipe_data->pipe_index[pipe_idx++] = head_pipe->plane_res.hubp->inst;
|
||||
for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
||||
struct pipe_ctx *split_pipe = &context->res_ctx.pipe_ctx[j];
|
||||
|
||||
if (pipe->stream == stream && pipe->stream_res.tg) {
|
||||
tg_inst = pipe->stream_res.tg->inst;
|
||||
break;
|
||||
if (split_pipe->stream == head_pipe->stream && (split_pipe->top_pipe || split_pipe->prev_odm_pipe)) {
|
||||
fams_pipe_data->pipe_index[pipe_idx++] = split_pipe->plane_res.hubp->inst;
|
||||
}
|
||||
}
|
||||
return tg_inst;
|
||||
fams_pipe_data->pipe_count = pipe_idx;
|
||||
}
|
||||
|
||||
bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, struct dc_state *context)
|
||||
{
|
||||
union dmub_rb_cmd cmd = { 0 };
|
||||
struct dmub_cmd_fw_assisted_mclk_switch_config *config_data = &cmd.fw_assisted_mclk_switch.config_data;
|
||||
int i = 0;
|
||||
int i = 0, k = 0;
|
||||
int ramp_up_num_steps = 1; // TODO: Ramp is currently disabled. Reenable it.
|
||||
uint8_t visual_confirm_enabled;
|
||||
|
||||
|
|
@ -337,17 +339,21 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru
|
|||
cmd.fw_assisted_mclk_switch.config_data.fams_enabled = should_manage_pstate;
|
||||
cmd.fw_assisted_mclk_switch.config_data.visual_confirm_enabled = visual_confirm_enabled;
|
||||
|
||||
for (i = 0; context && i < context->stream_count; i++) {
|
||||
struct dc_stream_state *stream = context->streams[i];
|
||||
uint8_t min_refresh_in_hz = (stream->timing.min_refresh_in_uhz + 999999) / 1000000;
|
||||
int tg_inst = dc_dmub_srv_get_timing_generator_offset(dc, stream);
|
||||
for (i = 0, k = 0; context && i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
||||
|
||||
config_data->pipe_data[tg_inst].pix_clk_100hz = stream->timing.pix_clk_100hz;
|
||||
config_data->pipe_data[tg_inst].min_refresh_in_hz = min_refresh_in_hz;
|
||||
config_data->pipe_data[tg_inst].max_ramp_step = ramp_up_num_steps;
|
||||
config_data->pipe_data[tg_inst].pipes = dc_dmub_srv_get_pipes_for_stream(dc, stream);
|
||||
if (!pipe->top_pipe && !pipe->prev_odm_pipe && pipe->stream && pipe->stream->fpo_in_use) {
|
||||
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
||||
uint8_t min_refresh_in_hz = (pipe->stream->timing.min_refresh_in_uhz + 999999) / 1000000;
|
||||
|
||||
config_data->pipe_data[k].pix_clk_100hz = pipe->stream->timing.pix_clk_100hz;
|
||||
config_data->pipe_data[k].min_refresh_in_hz = min_refresh_in_hz;
|
||||
config_data->pipe_data[k].max_ramp_step = ramp_up_num_steps;
|
||||
config_data->pipe_data[k].pipes = dc_dmub_srv_get_pipes_for_stream(dc, pipe->stream);
|
||||
dc_dmub_srv_populate_fams_pipe_info(dc, context, pipe, &config_data->pipe_data[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
cmd.fw_assisted_mclk_switch.header.payload_bytes =
|
||||
sizeof(cmd.fw_assisted_mclk_switch) - sizeof(cmd.fw_assisted_mclk_switch.header);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,14 +47,15 @@ enum dc_lane_count {
|
|||
*/
|
||||
enum dc_link_rate {
|
||||
LINK_RATE_UNKNOWN = 0,
|
||||
LINK_RATE_LOW = 0x06, // Rate_1 (RBR) - 1.62 Gbps/Lane
|
||||
LINK_RATE_RATE_2 = 0x08, // Rate_2 - 2.16 Gbps/Lane
|
||||
LINK_RATE_RATE_3 = 0x09, // Rate_3 - 2.43 Gbps/Lane
|
||||
LINK_RATE_HIGH = 0x0A, // Rate_4 (HBR) - 2.70 Gbps/Lane
|
||||
LINK_RATE_RBR2 = 0x0C, // Rate_5 (RBR2)- 3.24 Gbps/Lane
|
||||
LINK_RATE_RATE_6 = 0x10, // Rate_6 - 4.32 Gbps/Lane
|
||||
LINK_RATE_HIGH2 = 0x14, // Rate_7 (HBR2)- 5.40 Gbps/Lane
|
||||
LINK_RATE_HIGH3 = 0x1E, // Rate_8 (HBR3)- 8.10 Gbps/Lane
|
||||
LINK_RATE_LOW = 0x06, // Rate_1 (RBR) - 1.62 Gbps/Lane
|
||||
LINK_RATE_RATE_2 = 0x08, // Rate_2 - 2.16 Gbps/Lane
|
||||
LINK_RATE_RATE_3 = 0x09, // Rate_3 - 2.43 Gbps/Lane
|
||||
LINK_RATE_HIGH = 0x0A, // Rate_4 (HBR) - 2.70 Gbps/Lane
|
||||
LINK_RATE_RBR2 = 0x0C, // Rate_5 (RBR2) - 3.24 Gbps/Lane
|
||||
LINK_RATE_RATE_6 = 0x10, // Rate_6 - 4.32 Gbps/Lane
|
||||
LINK_RATE_HIGH2 = 0x14, // Rate_7 (HBR2) - 5.40 Gbps/Lane
|
||||
LINK_RATE_RATE_8 = 0x19, // Rate_8 - 6.75 Gbps/Lane
|
||||
LINK_RATE_HIGH3 = 0x1E, // Rate_9 (HBR3) - 8.10 Gbps/Lane
|
||||
/* Starting from DP2.0 link rate enum directly represents actual
|
||||
* link rate value in unit of 10 mbps
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ struct dp_hdmi_dongle_signature_data {
|
|||
|
||||
/* DP-HDMI dongle slave address for retrieving dongle signature*/
|
||||
#define DP_HDMI_DONGLE_ADDRESS 0x40
|
||||
static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR";
|
||||
#define DP_HDMI_DONGLE_SIGNATURE_EOT 0x04
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ struct dc_stream_state {
|
|||
|
||||
bool has_non_synchronizable_pclk;
|
||||
bool vblank_synchronized;
|
||||
bool fpo_in_use;
|
||||
struct mall_stream_config mall_stream_config;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1157,6 +1157,7 @@ const struct pixel_rate_range_table_entry video_optimized_pixel_rates[] = {
|
|||
{25170, 25180, 25200, 1000, 1001}, //25.2MHz -> 25.17
|
||||
{59340, 59350, 59400, 1000, 1001}, //59.4Mhz -> 59.340
|
||||
{74170, 74180, 74250, 1000, 1001}, //74.25Mhz -> 74.1758
|
||||
{89910, 90000, 90000, 1000, 1001}, //90Mhz -> 89.91
|
||||
{125870, 125880, 126000, 1000, 1001}, //126Mhz -> 125.87
|
||||
{148350, 148360, 148500, 1000, 1001}, //148.5Mhz -> 148.3516
|
||||
{167830, 167840, 168000, 1000, 1001}, //168Mhz -> 167.83
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@
|
|||
|
||||
#define MAX_PIPES 6
|
||||
|
||||
static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3};
|
||||
static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5};
|
||||
|
||||
/*
|
||||
* Convert dmcub psr state to dmcu psr state.
|
||||
*/
|
||||
|
|
@ -250,7 +253,7 @@ static void dmub_psr_set_level(struct dmub_psr *dmub, uint16_t psr_level, uint8_
|
|||
dc_dmub_srv_wait_idle(dc->dmub_srv);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set PSR vtotal requirement for FreeSync PSR.
|
||||
*/
|
||||
static void dmub_psr_set_sink_vtotal_in_psr_active(struct dmub_psr *dmub,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# Makefile for the 'controller' sub-component of DAL.
|
||||
# It provides the control and status of HW CRTC block.
|
||||
|
||||
CFLAGS_AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
|
||||
CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
|
||||
|
||||
DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
|
||||
dce60_resource.o
|
||||
|
|
|
|||
|
|
@ -726,11 +726,15 @@ void dcn10_hubp_pg_control(
|
|||
}
|
||||
}
|
||||
|
||||
static void power_on_plane(
|
||||
static void power_on_plane_resources(
|
||||
struct dce_hwseq *hws,
|
||||
int plane_id)
|
||||
{
|
||||
DC_LOGGER_INIT(hws->ctx->logger);
|
||||
|
||||
if (hws->funcs.dpp_root_clock_control)
|
||||
hws->funcs.dpp_root_clock_control(hws, plane_id, true);
|
||||
|
||||
if (REG(DC_IP_REQUEST_CNTL)) {
|
||||
REG_SET(DC_IP_REQUEST_CNTL, 0,
|
||||
IP_REQUEST_EN, 1);
|
||||
|
|
@ -1237,11 +1241,15 @@ void dcn10_plane_atomic_power_down(struct dc *dc,
|
|||
hws->funcs.hubp_pg_control(hws, hubp->inst, false);
|
||||
|
||||
dpp->funcs->dpp_reset(dpp);
|
||||
|
||||
REG_SET(DC_IP_REQUEST_CNTL, 0,
|
||||
IP_REQUEST_EN, 0);
|
||||
DC_LOG_DEBUG(
|
||||
"Power gated front end %d\n", hubp->inst);
|
||||
}
|
||||
|
||||
if (hws->funcs.dpp_root_clock_control)
|
||||
hws->funcs.dpp_root_clock_control(hws, dpp->inst, false);
|
||||
}
|
||||
|
||||
/* disable HW used by plane.
|
||||
|
|
@ -2462,7 +2470,7 @@ static void dcn10_enable_plane(
|
|||
|
||||
undo_DEGVIDCN10_253_wa(dc);
|
||||
|
||||
power_on_plane(dc->hwseq,
|
||||
power_on_plane_resources(dc->hwseq,
|
||||
pipe_ctx->plane_res.hubp->inst);
|
||||
|
||||
/* enable DCFCLK current DCHUB */
|
||||
|
|
@ -3385,7 +3393,9 @@ static bool dcn10_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
|
|||
for (test_pipe = pipe_ctx->top_pipe; test_pipe;
|
||||
test_pipe = test_pipe->top_pipe) {
|
||||
// Skip invisible layer and pipe-split plane on same layer
|
||||
if (!test_pipe->plane_state->visible || test_pipe->plane_state->layer_index == cur_layer)
|
||||
if (!test_pipe->plane_state ||
|
||||
!test_pipe->plane_state->visible ||
|
||||
test_pipe->plane_state->layer_index == cur_layer)
|
||||
continue;
|
||||
|
||||
r2 = test_pipe->plane_res.scl_data.recout;
|
||||
|
|
|
|||
|
|
@ -161,10 +161,20 @@ struct dcn_optc_registers {
|
|||
uint32_t OTG_CRC_CNTL2;
|
||||
uint32_t OTG_CRC0_DATA_RG;
|
||||
uint32_t OTG_CRC0_DATA_B;
|
||||
uint32_t OTG_CRC1_DATA_B;
|
||||
uint32_t OTG_CRC2_DATA_B;
|
||||
uint32_t OTG_CRC3_DATA_B;
|
||||
uint32_t OTG_CRC1_DATA_RG;
|
||||
uint32_t OTG_CRC2_DATA_RG;
|
||||
uint32_t OTG_CRC3_DATA_RG;
|
||||
uint32_t OTG_CRC0_WINDOWA_X_CONTROL;
|
||||
uint32_t OTG_CRC0_WINDOWA_Y_CONTROL;
|
||||
uint32_t OTG_CRC0_WINDOWB_X_CONTROL;
|
||||
uint32_t OTG_CRC0_WINDOWB_Y_CONTROL;
|
||||
uint32_t OTG_CRC1_WINDOWA_X_CONTROL;
|
||||
uint32_t OTG_CRC1_WINDOWA_Y_CONTROL;
|
||||
uint32_t OTG_CRC1_WINDOWB_X_CONTROL;
|
||||
uint32_t OTG_CRC1_WINDOWB_Y_CONTROL;
|
||||
uint32_t GSL_SOURCE_SELECT;
|
||||
uint32_t DWB_SOURCE_SELECT;
|
||||
uint32_t OTG_DSC_START_POSITION;
|
||||
|
|
@ -464,6 +474,15 @@ struct dcn_optc_registers {
|
|||
type CRC0_R_CR;\
|
||||
type CRC0_G_Y;\
|
||||
type CRC0_B_CB;\
|
||||
type CRC1_R_CR;\
|
||||
type CRC1_G_Y;\
|
||||
type CRC1_B_CB;\
|
||||
type CRC2_R_CR;\
|
||||
type CRC2_G_Y;\
|
||||
type CRC2_B_CB;\
|
||||
type CRC3_R_CR;\
|
||||
type CRC3_G_Y;\
|
||||
type CRC3_B_CB;\
|
||||
type OTG_CRC0_WINDOWA_X_START;\
|
||||
type OTG_CRC0_WINDOWA_X_END;\
|
||||
type OTG_CRC0_WINDOWA_Y_START;\
|
||||
|
|
@ -472,6 +491,15 @@ struct dcn_optc_registers {
|
|||
type OTG_CRC0_WINDOWB_X_END;\
|
||||
type OTG_CRC0_WINDOWB_Y_START;\
|
||||
type OTG_CRC0_WINDOWB_Y_END;\
|
||||
type OTG_CRC_WINDOW_DB_EN;\
|
||||
type OTG_CRC1_WINDOWA_X_START;\
|
||||
type OTG_CRC1_WINDOWA_X_END;\
|
||||
type OTG_CRC1_WINDOWA_Y_START;\
|
||||
type OTG_CRC1_WINDOWA_Y_END;\
|
||||
type OTG_CRC1_WINDOWB_X_START;\
|
||||
type OTG_CRC1_WINDOWB_X_END;\
|
||||
type OTG_CRC1_WINDOWB_Y_START;\
|
||||
type OTG_CRC1_WINDOWB_Y_END;\
|
||||
type GSL0_READY_SOURCE_SEL;\
|
||||
type GSL1_READY_SOURCE_SEL;\
|
||||
type GSL2_READY_SOURCE_SEL;\
|
||||
|
|
@ -525,6 +553,7 @@ struct dcn_optc_registers {
|
|||
#define TG_REG_FIELD_LIST_DCN3_2(type) \
|
||||
type OTG_H_TIMING_DIV_MODE_MANUAL;
|
||||
|
||||
|
||||
struct dcn_optc_shift {
|
||||
TG_REG_FIELD_LIST(uint8_t)
|
||||
TG_REG_FIELD_LIST_DCN3_2(uint8_t)
|
||||
|
|
|
|||
|
|
@ -542,8 +542,8 @@ static const struct dc_debug_options debug_defaults_drv = {
|
|||
.disable_pplib_clock_request = false,
|
||||
.disable_pplib_wm_range = false,
|
||||
.pplib_wm_report_mode = WM_REPORT_DEFAULT,
|
||||
.pipe_split_policy = MPC_SPLIT_AVOID,
|
||||
.force_single_disp_pipe_split = false,
|
||||
.pipe_split_policy = MPC_SPLIT_DYNAMIC,
|
||||
.force_single_disp_pipe_split = true,
|
||||
.disable_dcc = DCC_ENABLE,
|
||||
.voltage_align_fclk = true,
|
||||
.disable_stereo_support = true,
|
||||
|
|
|
|||
|
|
@ -230,7 +230,8 @@
|
|||
type DTBCLK_P2_SRC_SEL;\
|
||||
type DTBCLK_P2_EN;\
|
||||
type DTBCLK_P3_SRC_SEL;\
|
||||
type DTBCLK_P3_EN;
|
||||
type DTBCLK_P3_EN;\
|
||||
type DENTIST_DISPCLK_CHG_DONE;
|
||||
|
||||
struct dccg_shift {
|
||||
DCCG_REG_FIELD_LIST(uint8_t)
|
||||
|
|
|
|||
|
|
@ -1130,11 +1130,15 @@ void dcn20_blank_pixel_data(
|
|||
}
|
||||
|
||||
|
||||
static void dcn20_power_on_plane(
|
||||
static void dcn20_power_on_plane_resources(
|
||||
struct dce_hwseq *hws,
|
||||
struct pipe_ctx *pipe_ctx)
|
||||
{
|
||||
DC_LOGGER_INIT(hws->ctx->logger);
|
||||
|
||||
if (hws->funcs.dpp_root_clock_control)
|
||||
hws->funcs.dpp_root_clock_control(hws, pipe_ctx->plane_res.dpp->inst, true);
|
||||
|
||||
if (REG(DC_IP_REQUEST_CNTL)) {
|
||||
REG_SET(DC_IP_REQUEST_CNTL, 0,
|
||||
IP_REQUEST_EN, 1);
|
||||
|
|
@ -1158,7 +1162,7 @@ static void dcn20_enable_plane(struct dc *dc, struct pipe_ctx *pipe_ctx,
|
|||
//if (dc->debug.sanity_checks) {
|
||||
// dcn10_verify_allow_pstate_change_high(dc);
|
||||
//}
|
||||
dcn20_power_on_plane(dc->hwseq, pipe_ctx);
|
||||
dcn20_power_on_plane_resources(dc->hwseq, pipe_ctx);
|
||||
|
||||
/* enable DCFCLK current DCHUB */
|
||||
pipe_ctx->plane_res.hubp->funcs->hubp_clk_cntl(pipe_ctx->plane_res.hubp, true);
|
||||
|
|
@ -1720,10 +1724,8 @@ static void dcn20_program_pipe(
|
|||
pipe_ctx->pipe_dlg_param.vupdate_offset,
|
||||
pipe_ctx->pipe_dlg_param.vupdate_width);
|
||||
|
||||
if (pipe_ctx->stream->mall_stream_config.type != SUBVP_PHANTOM) {
|
||||
pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg, CRTC_STATE_VBLANK);
|
||||
if (pipe_ctx->stream->mall_stream_config.type != SUBVP_PHANTOM)
|
||||
pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg, CRTC_STATE_VACTIVE);
|
||||
}
|
||||
|
||||
pipe_ctx->stream_res.tg->funcs->set_vtg_params(
|
||||
pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing, true);
|
||||
|
|
@ -1991,6 +1993,16 @@ void dcn20_post_unlock_program_front_end(
|
|||
}
|
||||
}
|
||||
|
||||
/* P-State support transitions:
|
||||
* Natural -> FPO: P-State disabled in prepare, force disallow anytime is safe
|
||||
* FPO -> Natural: Unforce anytime after FW disable is safe (P-State will assert naturally)
|
||||
* Unsupported -> FPO: P-State enabled in optimize, force disallow anytime is safe
|
||||
* FPO -> Unsupported: P-State disabled in prepare, unforce disallow anytime is safe
|
||||
* FPO <-> SubVP: Force disallow is maintained on the FPO / SubVP pipes
|
||||
*/
|
||||
if (hwseq && hwseq->funcs.update_force_pstate)
|
||||
dc->hwseq->funcs.update_force_pstate(dc, context);
|
||||
|
||||
/* Only program the MALL registers after all the main and phantom pipes
|
||||
* are done programming.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ static const struct dc_debug_options debug_defaults_drv = {
|
|||
.timing_trace = false,
|
||||
.clock_trace = true,
|
||||
.disable_pplib_clock_request = true,
|
||||
.pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP,
|
||||
.pipe_split_policy = MPC_SPLIT_DYNAMIC,
|
||||
.force_single_disp_pipe_split = false,
|
||||
.disable_dcc = DCC_ENABLE,
|
||||
.vsr_support = true,
|
||||
|
|
|
|||
|
|
@ -621,7 +621,8 @@ void dcn30_init_hw(struct dc *dc)
|
|||
if (dc->clk_mgr->funcs->notify_wm_ranges)
|
||||
dc->clk_mgr->funcs->notify_wm_ranges(dc->clk_mgr);
|
||||
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk)
|
||||
//if softmax is enabled then hardmax will be set by a different call
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled)
|
||||
dc->clk_mgr->funcs->set_hard_max_memclk(dc->clk_mgr);
|
||||
|
||||
if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ static void optc3_set_timing_double_buffer(struct timing_generator *optc, bool e
|
|||
OTG_DRR_TIMING_DBUF_UPDATE_MODE, mode);
|
||||
}
|
||||
|
||||
void optc3_wait_drr_doublebuffer_pending_clear(struct timing_generator *optc)
|
||||
static void optc3_wait_drr_doublebuffer_pending_clear(struct timing_generator *optc)
|
||||
{
|
||||
struct optc *optc1 = DCN10TG_FROM_TG(optc);
|
||||
|
||||
|
|
|
|||
|
|
@ -2016,6 +2016,8 @@ bool dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(struct dc *dc,
|
|||
if (context->streams[0]->vrr_active_variable)
|
||||
return false;
|
||||
|
||||
context->streams[0]->fpo_in_use = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ static const struct dc_debug_options debug_defaults_drv = {
|
|||
.disable_clock_gate = true,
|
||||
.disable_pplib_clock_request = true,
|
||||
.disable_pplib_wm_range = true,
|
||||
.pipe_split_policy = MPC_SPLIT_AVOID,
|
||||
.pipe_split_policy = MPC_SPLIT_DYNAMIC,
|
||||
.force_single_disp_pipe_split = false,
|
||||
.disable_dcc = DCC_ENABLE,
|
||||
.vsr_support = true,
|
||||
|
|
|
|||
|
|
@ -66,17 +66,8 @@ void dccg31_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk)
|
|||
REG_UPDATE(DPPCLK_DTO_CTRL,
|
||||
DPPCLK_DTO_ENABLE[dpp_inst], 1);
|
||||
} else {
|
||||
//DTO must be enabled to generate a 0Hz clock output
|
||||
if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) {
|
||||
REG_UPDATE(DPPCLK_DTO_CTRL,
|
||||
DPPCLK_DTO_ENABLE[dpp_inst], 1);
|
||||
REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0,
|
||||
DPPCLK0_DTO_PHASE, 0,
|
||||
DPPCLK0_DTO_MODULO, 1);
|
||||
} else {
|
||||
REG_UPDATE(DPPCLK_DTO_CTRL,
|
||||
DPPCLK_DTO_ENABLE[dpp_inst], 0);
|
||||
}
|
||||
REG_UPDATE(DPPCLK_DTO_CTRL,
|
||||
DPPCLK_DTO_ENABLE[dpp_inst], 0);
|
||||
}
|
||||
dccg->pipe_dppclk_khz[dpp_inst] = req_dppclk;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void dcn31_init_hw(struct dc *dc)
|
|||
if (dc->clk_mgr->funcs->notify_wm_ranges)
|
||||
dc->clk_mgr->funcs->notify_wm_ranges(dc->clk_mgr);
|
||||
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk)
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled)
|
||||
dc->clk_mgr->funcs->set_hard_max_memclk(dc->clk_mgr);
|
||||
|
||||
if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
|
||||
|
|
|
|||
|
|
@ -289,8 +289,31 @@ static void dccg314_set_valid_pixel_rate(
|
|||
dccg314_set_dtbclk_dto(dccg, &dto_params);
|
||||
}
|
||||
|
||||
static void dccg314_dpp_root_clock_control(
|
||||
struct dccg *dccg,
|
||||
unsigned int dpp_inst,
|
||||
bool clock_on)
|
||||
{
|
||||
struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
|
||||
|
||||
if (clock_on) {
|
||||
/* turn off the DTO and leave phase/modulo at max */
|
||||
REG_UPDATE(DPPCLK_DTO_CTRL, DPPCLK_DTO_ENABLE[dpp_inst], 0);
|
||||
REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0,
|
||||
DPPCLK0_DTO_PHASE, 0xFF,
|
||||
DPPCLK0_DTO_MODULO, 0xFF);
|
||||
} else {
|
||||
/* turn on the DTO to generate a 0hz clock */
|
||||
REG_UPDATE(DPPCLK_DTO_CTRL, DPPCLK_DTO_ENABLE[dpp_inst], 1);
|
||||
REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0,
|
||||
DPPCLK0_DTO_PHASE, 0,
|
||||
DPPCLK0_DTO_MODULO, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct dccg_funcs dccg314_funcs = {
|
||||
.update_dpp_dto = dccg31_update_dpp_dto,
|
||||
.dpp_root_clock_control = dccg314_dpp_root_clock_control,
|
||||
.get_dccg_ref_freq = dccg31_get_dccg_ref_freq,
|
||||
.dccg_init = dccg31_init,
|
||||
.set_dpstreamclk = dccg314_set_dpstreamclk,
|
||||
|
|
|
|||
|
|
@ -390,6 +390,16 @@ void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx)
|
|||
pix_per_cycle);
|
||||
}
|
||||
|
||||
void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on)
|
||||
{
|
||||
if (!hws->ctx->dc->debug.root_clock_optimization.bits.dpp)
|
||||
return;
|
||||
|
||||
if (hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control)
|
||||
hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control(
|
||||
hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on);
|
||||
}
|
||||
|
||||
void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on)
|
||||
{
|
||||
struct dc_context *ctx = hws->ctx;
|
||||
|
|
|
|||
|
|
@ -43,4 +43,6 @@ void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx);
|
|||
|
||||
void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on);
|
||||
|
||||
void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on);
|
||||
|
||||
#endif /* __DC_HWSS_DCN314_H__ */
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
|
|||
.plane_atomic_disable = dcn20_plane_atomic_disable,
|
||||
.plane_atomic_power_down = dcn10_plane_atomic_power_down,
|
||||
.enable_power_gating_plane = dcn314_enable_power_gating_plane,
|
||||
.dpp_root_clock_control = dcn314_dpp_root_clock_control,
|
||||
.hubp_pg_control = dcn314_hubp_pg_control,
|
||||
.program_all_writeback_pipes_in_tree = dcn30_program_all_writeback_pipes_in_tree,
|
||||
.update_odm = dcn314_update_odm,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,20 @@
|
|||
#define DC_LOGGER \
|
||||
dccg->ctx->logger
|
||||
|
||||
/* This function is a workaround for writing to OTG_PIXEL_RATE_DIV
|
||||
* without the probability of causing a DIG FIFO error.
|
||||
*/
|
||||
static void dccg32_wait_for_dentist_change_done(
|
||||
struct dccg *dccg)
|
||||
{
|
||||
struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
|
||||
|
||||
uint32_t dentist_dispclk_value = REG_READ(DENTIST_DISPCLK_CNTL);
|
||||
|
||||
REG_WRITE(DENTIST_DISPCLK_CNTL, dentist_dispclk_value);
|
||||
REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 50, 2000);
|
||||
}
|
||||
|
||||
static void dccg32_get_pixel_rate_div(
|
||||
struct dccg *dccg,
|
||||
uint32_t otg_inst,
|
||||
|
|
@ -110,21 +124,29 @@ static void dccg32_set_pixel_rate_div(
|
|||
REG_UPDATE_2(OTG_PIXEL_RATE_DIV,
|
||||
OTG0_PIXEL_RATE_DIVK1, k1,
|
||||
OTG0_PIXEL_RATE_DIVK2, k2);
|
||||
|
||||
dccg32_wait_for_dentist_change_done(dccg);
|
||||
break;
|
||||
case 1:
|
||||
REG_UPDATE_2(OTG_PIXEL_RATE_DIV,
|
||||
OTG1_PIXEL_RATE_DIVK1, k1,
|
||||
OTG1_PIXEL_RATE_DIVK2, k2);
|
||||
|
||||
dccg32_wait_for_dentist_change_done(dccg);
|
||||
break;
|
||||
case 2:
|
||||
REG_UPDATE_2(OTG_PIXEL_RATE_DIV,
|
||||
OTG2_PIXEL_RATE_DIVK1, k1,
|
||||
OTG2_PIXEL_RATE_DIVK2, k2);
|
||||
|
||||
dccg32_wait_for_dentist_change_done(dccg);
|
||||
break;
|
||||
case 3:
|
||||
REG_UPDATE_2(OTG_PIXEL_RATE_DIV,
|
||||
OTG3_PIXEL_RATE_DIVK1, k1,
|
||||
OTG3_PIXEL_RATE_DIVK2, k2);
|
||||
|
||||
dccg32_wait_for_dentist_change_done(dccg);
|
||||
break;
|
||||
default:
|
||||
BREAK_TO_DEBUGGER();
|
||||
|
|
|
|||
|
|
@ -111,7 +111,8 @@
|
|||
DCCG_SF(DTBCLK_P_CNTL, DTBCLK_P3_SRC_SEL, mask_sh),\
|
||||
DCCG_SF(DTBCLK_P_CNTL, DTBCLK_P3_EN, mask_sh),\
|
||||
DCCG_SF(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO_SEL, mask_sh),\
|
||||
DCCG_SF(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL, mask_sh)
|
||||
DCCG_SF(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL, mask_sh),\
|
||||
DCCG_SF(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, mask_sh)
|
||||
|
||||
|
||||
struct dccg *dccg32_create(
|
||||
|
|
|
|||
|
|
@ -274,10 +274,10 @@ static bool is_dp_dig_pixel_rate_div_policy(struct dc *dc, const struct dc_crtc_
|
|||
dc->debug.enable_dp_dig_pixel_rate_div_policy;
|
||||
}
|
||||
|
||||
static void enc32_stream_encoder_dp_unblank(
|
||||
struct dc_link *link,
|
||||
struct stream_encoder *enc,
|
||||
const struct encoder_unblank_param *param)
|
||||
void enc32_stream_encoder_dp_unblank(
|
||||
struct dc_link *link,
|
||||
struct stream_encoder *enc,
|
||||
const struct encoder_unblank_param *param)
|
||||
{
|
||||
struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
|
||||
struct dc *dc = enc->ctx->dc;
|
||||
|
|
@ -286,6 +286,7 @@ static void enc32_stream_encoder_dp_unblank(
|
|||
uint32_t n_vid = 0x8000;
|
||||
uint32_t m_vid;
|
||||
uint32_t n_multiply = 0;
|
||||
uint32_t pix_per_cycle = 0;
|
||||
uint64_t m_vid_l = n_vid;
|
||||
|
||||
/* YCbCr 4:2:0 : Computed VID_M will be 2X the input rate */
|
||||
|
|
@ -293,6 +294,7 @@ static void enc32_stream_encoder_dp_unblank(
|
|||
|| is_dp_dig_pixel_rate_div_policy(dc, ¶m->timing)) {
|
||||
/*this logic should be the same in get_pixel_clock_parameters() */
|
||||
n_multiply = 1;
|
||||
pix_per_cycle = 1;
|
||||
}
|
||||
/* M / N = Fstream / Flink
|
||||
* m_vid / n_vid = pixel rate / link rate
|
||||
|
|
@ -320,6 +322,10 @@ static void enc32_stream_encoder_dp_unblank(
|
|||
REG_UPDATE_2(DP_VID_TIMING,
|
||||
DP_VID_M_N_GEN_EN, 1,
|
||||
DP_VID_N_MUL, n_multiply);
|
||||
|
||||
REG_UPDATE(DP_PIXEL_FORMAT,
|
||||
DP_PIXEL_PER_CYCLE_PROCESSING_MODE,
|
||||
pix_per_cycle);
|
||||
}
|
||||
|
||||
/* make sure stream is disabled before resetting steer fifo */
|
||||
|
|
@ -434,7 +440,7 @@ static void enc32_reset_fifo(struct stream_encoder *enc, bool reset)
|
|||
udelay(10);
|
||||
}
|
||||
|
||||
static void enc32_enable_fifo(struct stream_encoder *enc)
|
||||
void enc32_enable_fifo(struct stream_encoder *enc)
|
||||
{
|
||||
struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
|
||||
|
||||
|
|
|
|||
|
|
@ -194,4 +194,12 @@ void dcn32_dio_stream_encoder_construct(
|
|||
const struct dcn10_stream_encoder_shift *se_shift,
|
||||
const struct dcn10_stream_encoder_mask *se_mask);
|
||||
|
||||
|
||||
void enc32_enable_fifo(struct stream_encoder *enc);
|
||||
|
||||
void enc32_stream_encoder_dp_unblank(
|
||||
struct dc_link *link,
|
||||
struct stream_encoder *enc,
|
||||
const struct encoder_unblank_param *param);
|
||||
|
||||
#endif /* __DC_DIO_STREAM_ENCODER_DCN32_H__ */
|
||||
|
|
|
|||
|
|
@ -47,6 +47,15 @@ void hubp32_update_force_pstate_disallow(struct hubp *hubp, bool pstate_disallow
|
|||
DATA_UCLK_PSTATE_FORCE_VALUE, 0);
|
||||
}
|
||||
|
||||
void hubp32_update_force_cursor_pstate_disallow(struct hubp *hubp, bool pstate_disallow)
|
||||
{
|
||||
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
|
||||
|
||||
REG_UPDATE_2(UCLK_PSTATE_FORCE,
|
||||
CURSOR_UCLK_PSTATE_FORCE_EN, pstate_disallow,
|
||||
CURSOR_UCLK_PSTATE_FORCE_VALUE, 0);
|
||||
}
|
||||
|
||||
void hubp32_update_mall_sel(struct hubp *hubp, uint32_t mall_sel, bool c_cursor)
|
||||
{
|
||||
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
|
||||
|
|
@ -188,6 +197,7 @@ static struct hubp_funcs dcn32_hubp_funcs = {
|
|||
.hubp_set_flip_int = hubp1_set_flip_int,
|
||||
.hubp_in_blank = hubp1_in_blank,
|
||||
.hubp_update_force_pstate_disallow = hubp32_update_force_pstate_disallow,
|
||||
.hubp_update_force_cursor_pstate_disallow = hubp32_update_force_cursor_pstate_disallow,
|
||||
.phantom_hubp_post_enable = hubp32_phantom_hubp_post_enable,
|
||||
.hubp_update_mall_sel = hubp32_update_mall_sel,
|
||||
.hubp_prepare_subvp_buffering = hubp32_prepare_subvp_buffering
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
void hubp32_update_force_pstate_disallow(struct hubp *hubp, bool pstate_disallow);
|
||||
|
||||
void hubp32_update_force_cursor_pstate_disallow(struct hubp *hubp, bool pstate_disallow);
|
||||
|
||||
void hubp32_update_mall_sel(struct hubp *hubp, uint32_t mall_sel, bool c_cursor);
|
||||
|
||||
void hubp32_prepare_subvp_buffering(struct hubp *hubp, bool enable);
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ void dcn32_subvp_pipe_control_lock(struct dc *dc,
|
|||
}
|
||||
|
||||
|
||||
static bool dcn32_set_mpc_shaper_3dlut(
|
||||
bool dcn32_set_mpc_shaper_3dlut(
|
||||
struct pipe_ctx *pipe_ctx, const struct dc_stream_state *stream)
|
||||
{
|
||||
struct dpp *dpp_base = pipe_ctx->plane_res.dpp;
|
||||
|
|
@ -571,40 +571,57 @@ bool dcn32_set_output_transfer_func(struct dc *dc,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Program P-State force value according to if pipe is using SubVP or not:
|
||||
/* Program P-State force value according to if pipe is using SubVP / FPO or not:
|
||||
* 1. Reset P-State force on all pipes first
|
||||
* 2. For each main pipe, force P-State disallow (P-State allow moderated by DMUB)
|
||||
*/
|
||||
void dcn32_subvp_update_force_pstate(struct dc *dc, struct dc_state *context)
|
||||
void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)
|
||||
{
|
||||
int i;
|
||||
int num_subvp = 0;
|
||||
/* Unforce p-state for each pipe
|
||||
|
||||
/* Unforce p-state for each pipe if it is not FPO or SubVP.
|
||||
* For FPO and SubVP, if it's already forced disallow, leave
|
||||
* it as disallow.
|
||||
*/
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
||||
struct hubp *hubp = pipe->plane_res.hubp;
|
||||
|
||||
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_pstate_disallow(hubp, false);
|
||||
if (pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_MAIN)
|
||||
num_subvp++;
|
||||
}
|
||||
if (!pipe->stream || (pipe->stream && !(pipe->stream->mall_stream_config.type == SUBVP_MAIN ||
|
||||
pipe->stream->fpo_in_use))) {
|
||||
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_pstate_disallow(hubp, false);
|
||||
}
|
||||
|
||||
if (num_subvp == 0)
|
||||
return;
|
||||
/* Today only FPO uses cursor P-State force. Only clear cursor P-State force
|
||||
* if it's not FPO.
|
||||
*/
|
||||
if (!pipe->stream || (pipe->stream && !pipe->stream->fpo_in_use)) {
|
||||
if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_cursor_pstate_disallow(hubp, false);
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop through each pipe -- for each subvp main pipe force p-state allow equal to false.
|
||||
*/
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
||||
struct hubp *hubp = pipe->plane_res.hubp;
|
||||
|
||||
if (pipe->stream && pipe->plane_state && (pipe->stream->mall_stream_config.type == SUBVP_MAIN)) {
|
||||
struct hubp *hubp = pipe->plane_res.hubp;
|
||||
|
||||
if (pipe->stream && pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_MAIN) {
|
||||
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_pstate_disallow(hubp, true);
|
||||
}
|
||||
|
||||
if (pipe->stream && pipe->stream->fpo_in_use) {
|
||||
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_pstate_disallow(hubp, true);
|
||||
/* For now only force cursor p-state disallow for FPO
|
||||
* Needs to be added for subvp once FW side gets updated
|
||||
*/
|
||||
if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
|
||||
hubp->funcs->hubp_update_force_cursor_pstate_disallow(hubp, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -677,10 +694,6 @@ void dcn32_program_mall_pipe_config(struct dc *dc, struct dc_state *context)
|
|||
if (hws && hws->funcs.update_mall_sel)
|
||||
hws->funcs.update_mall_sel(dc, context);
|
||||
|
||||
//update subvp force pstate
|
||||
if (hws && hws->funcs.subvp_update_force_pstate)
|
||||
dc->hwseq->funcs.subvp_update_force_pstate(dc, context);
|
||||
|
||||
// Program FORCE_ONE_ROW_FOR_FRAME and CURSOR_REQ_MODE for main subvp pipes
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
||||
|
|
@ -902,7 +915,7 @@ void dcn32_init_hw(struct dc *dc)
|
|||
if (dc->clk_mgr->funcs->notify_wm_ranges)
|
||||
dc->clk_mgr->funcs->notify_wm_ranges(dc->clk_mgr);
|
||||
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk)
|
||||
if (dc->clk_mgr->funcs->set_hard_max_memclk && !dc->clk_mgr->dc_mode_softmax_enabled)
|
||||
dc->clk_mgr->funcs->set_hard_max_memclk(dc->clk_mgr);
|
||||
|
||||
if (dc->res_pool->hubbub->funcs->force_pstate_change_control)
|
||||
|
|
@ -1111,7 +1124,7 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsign
|
|||
*k2_div = PIXEL_RATE_DIV_BY_2;
|
||||
else
|
||||
*k2_div = PIXEL_RATE_DIV_BY_4;
|
||||
} else if (dc_is_dp_signal(stream->signal)) {
|
||||
} else if (dc_is_dp_signal(stream->signal) || dc_is_virtual_signal(stream->signal)) {
|
||||
if (two_pix_per_container) {
|
||||
*k1_div = PIXEL_RATE_DIV_BY_1;
|
||||
*k2_div = PIXEL_RATE_DIV_BY_2;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ bool dcn32_set_input_transfer_func(struct dc *dc,
|
|||
struct pipe_ctx *pipe_ctx,
|
||||
const struct dc_plane_state *plane_state);
|
||||
|
||||
bool dcn32_set_mpc_shaper_3dlut(
|
||||
struct pipe_ctx *pipe_ctx, const struct dc_stream_state *stream);
|
||||
|
||||
bool dcn32_set_output_transfer_func(struct dc *dc,
|
||||
struct pipe_ctx *pipe_ctx,
|
||||
const struct dc_stream_state *stream);
|
||||
|
|
@ -64,7 +67,7 @@ void dcn32_program_mall_pipe_config(struct dc *dc, struct dc_state *context);
|
|||
|
||||
void dcn32_update_mall_sel(struct dc *dc, struct dc_state *context);
|
||||
|
||||
void dcn32_subvp_update_force_pstate(struct dc *dc, struct dc_state *context);
|
||||
void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context);
|
||||
|
||||
void dcn32_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx *pipe_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static const struct hwseq_private_funcs dcn32_private_funcs = {
|
|||
.dccg_init = dcn20_dccg_init,
|
||||
.set_mcm_luts = dcn32_set_mcm_luts,
|
||||
.program_mall_pipe_config = dcn32_program_mall_pipe_config,
|
||||
.subvp_update_force_pstate = dcn32_subvp_update_force_pstate,
|
||||
.update_force_pstate = dcn32_update_force_pstate,
|
||||
.update_mall_sel = dcn32_update_mall_sel,
|
||||
.calculate_dccg_k1_k2_values = dcn32_calculate_dccg_k1_k2_values,
|
||||
.set_pixels_per_cycle = dcn32_set_pixels_per_cycle,
|
||||
|
|
|
|||
|
|
@ -725,6 +725,7 @@ static const struct dc_debug_options debug_defaults_drv = {
|
|||
.min_prefetch_in_strobe_ns = 60000, // 60us
|
||||
.disable_unbounded_requesting = false,
|
||||
.override_dispclk_programming = true,
|
||||
.disable_fpo_optimizations = false,
|
||||
};
|
||||
|
||||
static const struct dc_debug_options debug_defaults_diags = {
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,8 @@ double dcn32_determine_max_vratio_prefetch(struct dc *dc, struct dc_state *conte
|
|||
DCCG_SRII(PHASE, DTBCLK_DTO, 0), DCCG_SRII(PHASE, DTBCLK_DTO, 1), \
|
||||
DCCG_SRII(PHASE, DTBCLK_DTO, 2), DCCG_SRII(PHASE, DTBCLK_DTO, 3), \
|
||||
SR(DCCG_AUDIO_DTBCLK_DTO_MODULO), SR(DCCG_AUDIO_DTBCLK_DTO_PHASE), \
|
||||
SR(OTG_PIXEL_RATE_DIV), SR(DTBCLK_P_CNTL), SR(DCCG_AUDIO_DTO_SOURCE) \
|
||||
SR(OTG_PIXEL_RATE_DIV), SR(DTBCLK_P_CNTL), \
|
||||
SR(DCCG_AUDIO_DTO_SOURCE), SR(DENTIST_DISPCLK_CNTL) \
|
||||
)
|
||||
|
||||
/* VMID */
|
||||
|
|
|
|||
|
|
@ -723,6 +723,7 @@ static const struct dc_debug_options debug_defaults_drv = {
|
|||
.min_prefetch_in_strobe_ns = 60000, // 60us
|
||||
.disable_unbounded_requesting = false,
|
||||
.override_dispclk_programming = true,
|
||||
.disable_fpo_optimizations = false,
|
||||
};
|
||||
|
||||
static const struct dc_debug_options debug_defaults_diags = {
|
||||
|
|
|
|||
|
|
@ -384,9 +384,38 @@ void dcn30_fpu_calculate_wm_and_dlg(
|
|||
int i, pipe_idx;
|
||||
double dcfclk = context->bw_ctx.dml.vba.DCFCLKState[vlevel][maxMpcComb];
|
||||
bool pstate_en = context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] != dm_dram_clock_change_unsupported;
|
||||
unsigned int dummy_latency_index = 0;
|
||||
|
||||
dc_assert_fp_enabled();
|
||||
|
||||
context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;
|
||||
for (i = 0; i < context->stream_count; i++) {
|
||||
if (context->streams[i])
|
||||
context->streams[i]->fpo_in_use = false;
|
||||
}
|
||||
|
||||
if (!pstate_en) {
|
||||
/* only when the mclk switch can not be natural, is the fw based vblank stretch attempted */
|
||||
context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching =
|
||||
dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(dc, context);
|
||||
|
||||
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
|
||||
dummy_latency_index = dcn30_find_dummy_latency_index_for_fw_based_mclk_switch(dc,
|
||||
context, pipes, pipe_cnt, vlevel);
|
||||
|
||||
/* After calling dcn30_find_dummy_latency_index_for_fw_based_mclk_switch
|
||||
* we reinstate the original dram_clock_change_latency_us on the context
|
||||
* and all variables that may have changed up to this point, except the
|
||||
* newly found dummy_latency_index
|
||||
*/
|
||||
context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us;
|
||||
dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false, true);
|
||||
maxMpcComb = context->bw_ctx.dml.vba.maxMpcComb;
|
||||
dcfclk = context->bw_ctx.dml.vba.DCFCLKState[vlevel][context->bw_ctx.dml.vba.maxMpcComb];
|
||||
pstate_en = context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] != dm_dram_clock_change_unsupported;
|
||||
}
|
||||
}
|
||||
|
||||
if (context->bw_ctx.dml.soc.min_dcfclk > dcfclk)
|
||||
dcfclk = context->bw_ctx.dml.soc.min_dcfclk;
|
||||
|
||||
|
|
@ -449,15 +478,29 @@ void dcn30_fpu_calculate_wm_and_dlg(
|
|||
unsigned int min_dram_speed_mts = context->bw_ctx.dml.vba.DRAMSpeed;
|
||||
unsigned int min_dram_speed_mts_margin = 160;
|
||||
|
||||
if (context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb] == dm_dram_clock_change_unsupported)
|
||||
min_dram_speed_mts = dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries - 1].memclk_mhz * 16;
|
||||
context->bw_ctx.dml.soc.dram_clock_change_latency_us =
|
||||
dc->clk_mgr->bw_params->dummy_pstate_table[0].dummy_pstate_latency_us;
|
||||
|
||||
/* find largest table entry that is lower than dram speed, but lower than DPM0 still uses DPM0 */
|
||||
for (i = 3; i > 0; i--)
|
||||
if (min_dram_speed_mts + min_dram_speed_mts_margin > dc->clk_mgr->bw_params->dummy_pstate_table[i].dram_speed_mts)
|
||||
break;
|
||||
if (context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] ==
|
||||
dm_dram_clock_change_unsupported) {
|
||||
int min_dram_speed_mts_offset = dc->clk_mgr->bw_params->clk_table.num_entries - 1;
|
||||
|
||||
context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->dummy_pstate_table[i].dummy_pstate_latency_us;
|
||||
min_dram_speed_mts =
|
||||
dc->clk_mgr->bw_params->clk_table.entries[min_dram_speed_mts_offset].memclk_mhz * 16;
|
||||
}
|
||||
|
||||
if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
|
||||
/* find largest table entry that is lower than dram speed,
|
||||
* but lower than DPM0 still uses DPM0
|
||||
*/
|
||||
for (dummy_latency_index = 3; dummy_latency_index > 0; dummy_latency_index--)
|
||||
if (min_dram_speed_mts + min_dram_speed_mts_margin >
|
||||
dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dram_speed_mts)
|
||||
break;
|
||||
}
|
||||
|
||||
context->bw_ctx.dml.soc.dram_clock_change_latency_us =
|
||||
dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us;
|
||||
|
||||
context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_C].dml_input.sr_enter_plus_exit_time_us;
|
||||
context->bw_ctx.dml.soc.sr_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_C].dml_input.sr_exit_time_us;
|
||||
|
|
|
|||
|
|
@ -988,7 +988,6 @@ static void dml_rq_dlg_get_dlg_params(
|
|||
double hratio_c;
|
||||
double vratio_l;
|
||||
double vratio_c;
|
||||
bool scl_enable;
|
||||
|
||||
unsigned int swath_width_ub_l;
|
||||
unsigned int dpte_groups_per_row_ub_l;
|
||||
|
|
@ -1001,7 +1000,6 @@ static void dml_rq_dlg_get_dlg_params(
|
|||
unsigned int vupdate_width;
|
||||
unsigned int vready_offset;
|
||||
|
||||
unsigned int dppclk_delay_subtotal;
|
||||
unsigned int dispclk_delay_subtotal;
|
||||
|
||||
unsigned int vstartup_start;
|
||||
|
|
@ -1118,7 +1116,6 @@ static void dml_rq_dlg_get_dlg_params(
|
|||
hratio_c = scl->hscl_ratio_c;
|
||||
vratio_l = scl->vscl_ratio;
|
||||
vratio_c = scl->vscl_ratio_c;
|
||||
scl_enable = scl->scl_enable;
|
||||
|
||||
swath_width_ub_l = rq_dlg_param->rq_l.swath_width_ub;
|
||||
dpte_groups_per_row_ub_l = rq_dlg_param->rq_l.dpte_groups_per_row_ub;
|
||||
|
|
@ -1130,17 +1127,8 @@ static void dml_rq_dlg_get_dlg_params(
|
|||
vupdate_offset = dst->vupdate_offset;
|
||||
vupdate_width = dst->vupdate_width;
|
||||
vready_offset = dst->vready_offset;
|
||||
|
||||
dppclk_delay_subtotal = mode_lib->ip.dppclk_delay_subtotal;
|
||||
dispclk_delay_subtotal = mode_lib->ip.dispclk_delay_subtotal;
|
||||
|
||||
if (scl_enable)
|
||||
dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl;
|
||||
else
|
||||
dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_scl_lb_only;
|
||||
|
||||
dppclk_delay_subtotal += mode_lib->ip.dppclk_delay_cnvc_formatter + src->num_cursors * mode_lib->ip.dppclk_delay_cnvc_cursor;
|
||||
|
||||
if (dout->dsc_enable) {
|
||||
double dsc_delay = get_dsc_delay(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); // FROM VBA
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc = {
|
|||
.urgent_latency_pixel_data_only_us = 4.0,
|
||||
.urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
|
||||
.urgent_latency_vm_data_only_us = 4.0,
|
||||
.fclk_change_latency_us = 20,
|
||||
.fclk_change_latency_us = 25,
|
||||
.usr_retraining_latency_us = 2,
|
||||
.smn_latency_us = 2,
|
||||
.mall_allocated_for_dcn_mbytes = 64,
|
||||
|
|
@ -1960,8 +1960,13 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
|
|||
}
|
||||
|
||||
context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;
|
||||
for (i = 0; i < context->stream_count; i++) {
|
||||
if (context->streams[i])
|
||||
context->streams[i]->fpo_in_use = false;
|
||||
}
|
||||
|
||||
if (!pstate_en) {
|
||||
if (!pstate_en || (!dc->debug.disable_fpo_optimizations &&
|
||||
pstate_en && vlevel != 0)) {
|
||||
/* only when the mclk switch can not be natural, is the fw based vblank stretch attempted */
|
||||
context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching =
|
||||
dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(dc, context);
|
||||
|
|
@ -1985,11 +1990,21 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
|
|||
context->bw_ctx.dml.soc.fclk_change_latency_us =
|
||||
dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us;
|
||||
}
|
||||
dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false);
|
||||
maxMpcComb = context->bw_ctx.dml.vba.maxMpcComb;
|
||||
dcfclk_from_fw_based_mclk_switching = context->bw_ctx.dml.vba.DCFCLKState[vlevel][context->bw_ctx.dml.vba.maxMpcComb];
|
||||
pstate_en = context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][maxMpcComb] !=
|
||||
dm_dram_clock_change_unsupported;
|
||||
dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel_temp, false);
|
||||
if (vlevel_temp < vlevel) {
|
||||
vlevel = vlevel_temp;
|
||||
maxMpcComb = context->bw_ctx.dml.vba.maxMpcComb;
|
||||
dcfclk_from_fw_based_mclk_switching = context->bw_ctx.dml.vba.DCFCLKState[vlevel][context->bw_ctx.dml.vba.maxMpcComb];
|
||||
pstate_en = true;
|
||||
} else {
|
||||
/* Restore FCLK latency and re-run validation to go back to original validation
|
||||
* output if we find that enabling FPO does not give us any benefit (i.e. lower
|
||||
* voltage level)
|
||||
*/
|
||||
context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching = false;
|
||||
context->bw_ctx.dml.soc.fclk_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.fclk_change_latency_us;
|
||||
dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2188,10 +2203,6 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
|
|||
context->bw_ctx.dml.soc.dram_clock_change_latency_us =
|
||||
dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us;
|
||||
|
||||
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
|
||||
dcn30_setup_mclk_switch_using_fw_based_vblank_stretch(dc, context);
|
||||
}
|
||||
|
||||
/* revert fclk lat changes if required */
|
||||
if (need_fclk_lat_as_dummy)
|
||||
context->bw_ctx.dml.soc.fclk_change_latency_us =
|
||||
|
|
|
|||
|
|
@ -148,18 +148,21 @@ struct dccg_funcs {
|
|||
struct dccg *dccg,
|
||||
int inst);
|
||||
|
||||
void (*set_pixel_rate_div)(
|
||||
struct dccg *dccg,
|
||||
uint32_t otg_inst,
|
||||
enum pixel_rate_div k1,
|
||||
enum pixel_rate_div k2);
|
||||
void (*set_pixel_rate_div)(struct dccg *dccg,
|
||||
uint32_t otg_inst,
|
||||
enum pixel_rate_div k1,
|
||||
enum pixel_rate_div k2);
|
||||
|
||||
void (*set_valid_pixel_rate)(
|
||||
struct dccg *dccg,
|
||||
int ref_dtbclk_khz,
|
||||
int otg_inst,
|
||||
int pixclk_khz);
|
||||
void (*set_valid_pixel_rate)(
|
||||
struct dccg *dccg,
|
||||
int ref_dtbclk_khz,
|
||||
int otg_inst,
|
||||
int pixclk_khz);
|
||||
|
||||
void (*dpp_root_clock_control)(
|
||||
struct dccg *dccg,
|
||||
unsigned int dpp_inst,
|
||||
bool clock_on);
|
||||
};
|
||||
|
||||
#endif //__DAL_DCCG_H__
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ struct hubp_funcs {
|
|||
void (*hubp_soft_reset)(struct hubp *hubp, bool reset);
|
||||
|
||||
void (*hubp_update_force_pstate_disallow)(struct hubp *hubp, bool allow);
|
||||
void (*hubp_update_force_cursor_pstate_disallow)(struct hubp *hubp, bool allow);
|
||||
void (*hubp_update_mall_sel)(struct hubp *hubp, uint32_t mall_sel, bool c_cursor);
|
||||
void (*hubp_prepare_subvp_buffering)(struct hubp *hubp, bool enable);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ struct hwseq_private_funcs {
|
|||
void (*plane_atomic_disable)(struct dc *dc, struct pipe_ctx *pipe_ctx);
|
||||
void (*enable_power_gating_plane)(struct dce_hwseq *hws,
|
||||
bool enable);
|
||||
void (*dpp_root_clock_control)(
|
||||
struct dce_hwseq *hws,
|
||||
unsigned int dpp_inst,
|
||||
bool clock_on);
|
||||
void (*dpp_pg_control)(struct dce_hwseq *hws,
|
||||
unsigned int dpp_inst,
|
||||
bool power_on);
|
||||
|
|
@ -150,7 +154,7 @@ struct hwseq_private_funcs {
|
|||
void (*setup_hpo_hw_control)(const struct dce_hwseq *hws, bool enable);
|
||||
#ifdef CONFIG_DRM_AMD_DC_FP
|
||||
void (*program_mall_pipe_config)(struct dc *dc, struct dc_state *context);
|
||||
void (*subvp_update_force_pstate)(struct dc *dc, struct dc_state *context);
|
||||
void (*update_force_pstate)(struct dc *dc, struct dc_state *context);
|
||||
void (*update_mall_sel)(struct dc *dc, struct dc_state *context);
|
||||
unsigned int (*calculate_dccg_k1_k2_values)(struct pipe_ctx *pipe_ctx,
|
||||
unsigned int *k1_div,
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ struct link_service {
|
|||
uint32_t (*dp_link_bandwidth_kbps)(
|
||||
const struct dc_link *link,
|
||||
const struct dc_link_settings *link_settings);
|
||||
bool (*validate_dpia_bandwidth)(
|
||||
const struct dc_stream_state *stream,
|
||||
const unsigned int num_streams);
|
||||
|
||||
|
||||
/*************************** DPMS *************************************/
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@
|
|||
*/
|
||||
#define LINK_TRAINING_MAX_VERIFY_RETRY 2
|
||||
|
||||
static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
|
||||
|
||||
static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI ADAPTOR";
|
||||
|
||||
static enum ddc_transaction_type get_ddc_transaction_type(enum signal_type sink_signal)
|
||||
{
|
||||
enum ddc_transaction_type transaction_type = DDC_TRANSACTION_TYPE_NONE;
|
||||
|
|
@ -494,8 +498,6 @@ static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
|
|||
dc_process_hdcp_msg(signal, link, &msg22);
|
||||
|
||||
if (signal == SIGNAL_TYPE_DISPLAY_PORT || signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
|
||||
enum hdcp_message_status status = HDCP_MESSAGE_UNSUPPORTED;
|
||||
|
||||
msg14.data = &link->hdcp_caps.bcaps.raw;
|
||||
msg14.length = sizeof(link->hdcp_caps.bcaps.raw);
|
||||
msg14.msg_id = HDCP_MESSAGE_ID_READ_BCAPS;
|
||||
|
|
@ -503,7 +505,7 @@ static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
|
|||
msg14.link = HDCP_LINK_PRIMARY;
|
||||
msg14.max_retries = 5;
|
||||
|
||||
status = dc_process_hdcp_msg(signal, link, &msg14);
|
||||
dc_process_hdcp_msg(signal, link, &msg14);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -830,7 +832,7 @@ static void verify_link_capability(struct dc_link *link, struct dc_sink *sink,
|
|||
verify_link_capability_non_destructive(link);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* detect_link_and_local_sink() - Detect if a sink is attached to a given link
|
||||
*
|
||||
* link->local_sink is created or destroyed as needed.
|
||||
|
|
@ -1183,7 +1185,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* link_detect_connection_type() - Determine if there is a sink connected
|
||||
*
|
||||
* @type: Returned connection type
|
||||
|
|
@ -1225,6 +1227,11 @@ bool link_detect_connection_type(struct dc_link *link, enum dc_connection_type *
|
|||
/* TODO: need to do the actual detection */
|
||||
} else {
|
||||
*type = dc_connection_none;
|
||||
if (link->connector_signal == SIGNAL_TYPE_EDP) {
|
||||
/* eDP is not connected, power down it */
|
||||
if (!link->dc->config.edp_no_power_sequencing)
|
||||
link->dc->hwss.edp_power_control(link, false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2160,6 +2160,7 @@ static enum dc_status enable_link_dp_mst(
|
|||
struct pipe_ctx *pipe_ctx)
|
||||
{
|
||||
struct dc_link *link = pipe_ctx->stream->link;
|
||||
unsigned char mstm_cntl;
|
||||
|
||||
/* sink signal type after MST branch is MST. Multiple MST sinks
|
||||
* share one link. Link DP PHY is enable or training only once.
|
||||
|
|
@ -2168,7 +2169,9 @@ static enum dc_status enable_link_dp_mst(
|
|||
return DC_OK;
|
||||
|
||||
/* clear payload table */
|
||||
dm_helpers_dp_mst_clear_payload_allocation_table(link->ctx, link);
|
||||
core_link_read_dpcd(link, DP_MSTM_CTRL, &mstm_cntl, 1);
|
||||
if (mstm_cntl & DP_MST_EN)
|
||||
dm_helpers_dp_mst_clear_payload_allocation_table(link->ctx, link);
|
||||
|
||||
/* to make sure the pending down rep can be processed
|
||||
* before enabling the link
|
||||
|
|
@ -2477,11 +2480,12 @@ void link_set_dpms_on(
|
|||
* from transmitter control.
|
||||
*/
|
||||
if (!(dc_is_virtual_signal(pipe_ctx->stream->signal) ||
|
||||
dp_is_128b_132b_signal(pipe_ctx)))
|
||||
if (link_enc)
|
||||
link_enc->funcs->setup(
|
||||
link_enc,
|
||||
pipe_ctx->stream->signal);
|
||||
dp_is_128b_132b_signal(pipe_ctx))) {
|
||||
if (link_enc)
|
||||
link_enc->funcs->setup(
|
||||
link_enc,
|
||||
pipe_ctx->stream->signal);
|
||||
}
|
||||
|
||||
dc->hwss.enable_stream(pipe_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ static void construct_link_service_validation(struct link_service *link_srv)
|
|||
{
|
||||
link_srv->validate_mode_timing = link_validate_mode_timing;
|
||||
link_srv->dp_link_bandwidth_kbps = dp_link_bandwidth_kbps;
|
||||
link_srv->validate_dpia_bandwidth = link_validate_dpia_bandwidth;
|
||||
}
|
||||
|
||||
/* link dpms owns the programming sequence of stream's dpms state associated
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
#include "link_validation.h"
|
||||
#include "protocols/link_dp_capability.h"
|
||||
#include "protocols/link_dp_dpia_bw.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define DC_LOGGER_INIT(logger)
|
||||
|
|
@ -255,57 +256,6 @@ uint32_t dp_link_bandwidth_kbps(
|
|||
return link_rate_per_lane_kbps * link_settings->lane_count / 10000 * total_data_bw_efficiency_x10000;
|
||||
}
|
||||
|
||||
uint32_t link_timing_bandwidth_kbps(const struct dc_crtc_timing *timing)
|
||||
{
|
||||
uint32_t bits_per_channel = 0;
|
||||
uint32_t kbps;
|
||||
|
||||
if (timing->flags.DSC)
|
||||
return dc_dsc_stream_bandwidth_in_kbps(timing,
|
||||
timing->dsc_cfg.bits_per_pixel,
|
||||
timing->dsc_cfg.num_slices_h,
|
||||
timing->dsc_cfg.is_dp);
|
||||
|
||||
switch (timing->display_color_depth) {
|
||||
case COLOR_DEPTH_666:
|
||||
bits_per_channel = 6;
|
||||
break;
|
||||
case COLOR_DEPTH_888:
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
case COLOR_DEPTH_101010:
|
||||
bits_per_channel = 10;
|
||||
break;
|
||||
case COLOR_DEPTH_121212:
|
||||
bits_per_channel = 12;
|
||||
break;
|
||||
case COLOR_DEPTH_141414:
|
||||
bits_per_channel = 14;
|
||||
break;
|
||||
case COLOR_DEPTH_161616:
|
||||
bits_per_channel = 16;
|
||||
break;
|
||||
default:
|
||||
ASSERT(bits_per_channel != 0);
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
kbps = timing->pix_clk_100hz / 10;
|
||||
kbps *= bits_per_channel;
|
||||
|
||||
if (timing->flags.Y_ONLY != 1) {
|
||||
/*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/
|
||||
kbps *= 3;
|
||||
if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
|
||||
kbps /= 2;
|
||||
else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422)
|
||||
kbps = kbps * 2 / 3;
|
||||
}
|
||||
|
||||
return kbps;
|
||||
}
|
||||
|
||||
static bool dp_validate_mode_timing(
|
||||
struct dc_link *link,
|
||||
const struct dc_crtc_timing *timing)
|
||||
|
|
@ -394,3 +344,20 @@ enum dc_status link_validate_mode_timing(
|
|||
|
||||
return DC_OK;
|
||||
}
|
||||
|
||||
bool link_validate_dpia_bandwidth(const struct dc_stream_state *stream, const unsigned int num_streams)
|
||||
{
|
||||
bool ret = true;
|
||||
int bw_needed[MAX_DPIA_NUM];
|
||||
struct dc_link *link[MAX_DPIA_NUM];
|
||||
|
||||
if (!num_streams || num_streams > MAX_DPIA_NUM)
|
||||
return ret;
|
||||
|
||||
for (uint8_t i = 0; i < num_streams; ++i) {
|
||||
|
||||
link[i] = stream[i].link;
|
||||
bw_needed[i] = dc_bandwidth_in_kbps_from_timing(&stream[i].timing);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ enum dc_status link_validate_mode_timing(
|
|||
const struct dc_stream_state *stream,
|
||||
struct dc_link *link,
|
||||
const struct dc_crtc_timing *timing);
|
||||
bool link_validate_dpia_bandwidth(
|
||||
const struct dc_stream_state *stream,
|
||||
const unsigned int num_streams);
|
||||
uint32_t dp_link_bandwidth_kbps(
|
||||
const struct dc_link *link,
|
||||
const struct dc_link_settings *link_settings);
|
||||
|
||||
#endif /* __LINK_VALIDATION_H__ */
|
||||
|
|
|
|||
|
|
@ -203,8 +203,11 @@ static enum dc_link_rate linkRateInKHzToLinkRateMultiplier(uint32_t link_rate_in
|
|||
case 5400000:
|
||||
link_rate = LINK_RATE_HIGH2; // Rate_7 (HBR2)- 5.40 Gbps/Lane
|
||||
break;
|
||||
case 6750000:
|
||||
link_rate = LINK_RATE_RATE_8; // Rate_8 - 6.75 Gbps/Lane
|
||||
break;
|
||||
case 8100000:
|
||||
link_rate = LINK_RATE_HIGH3; // Rate_8 (HBR3)- 8.10 Gbps/Lane
|
||||
link_rate = LINK_RATE_HIGH3; // Rate_9 (HBR3)- 8.10 Gbps/Lane
|
||||
break;
|
||||
default:
|
||||
link_rate = LINK_RATE_UNKNOWN;
|
||||
|
|
@ -444,8 +447,12 @@ static enum dc_lane_count reduce_lane_count(enum dc_lane_count lane_count)
|
|||
}
|
||||
}
|
||||
|
||||
static enum dc_link_rate reduce_link_rate(enum dc_link_rate link_rate)
|
||||
static enum dc_link_rate reduce_link_rate(const struct dc_link *link, enum dc_link_rate link_rate)
|
||||
{
|
||||
// NEEDSWORK: provide some details about why this function never returns some of the
|
||||
// obscure link rates such as 4.32 Gbps or 3.24 Gbps and if such behavior is intended.
|
||||
//
|
||||
|
||||
switch (link_rate) {
|
||||
case LINK_RATE_UHBR20:
|
||||
return LINK_RATE_UHBR13_5;
|
||||
|
|
@ -454,13 +461,22 @@ static enum dc_link_rate reduce_link_rate(enum dc_link_rate link_rate)
|
|||
case LINK_RATE_UHBR10:
|
||||
return LINK_RATE_HIGH3;
|
||||
case LINK_RATE_HIGH3:
|
||||
if (link->connector_signal == SIGNAL_TYPE_EDP && link->dc->debug.support_eDP1_5)
|
||||
return LINK_RATE_RATE_8;
|
||||
return LINK_RATE_HIGH2;
|
||||
case LINK_RATE_RATE_8:
|
||||
return LINK_RATE_HIGH2;
|
||||
case LINK_RATE_HIGH2:
|
||||
return LINK_RATE_HIGH;
|
||||
case LINK_RATE_RATE_6:
|
||||
case LINK_RATE_RBR2:
|
||||
return LINK_RATE_HIGH;
|
||||
case LINK_RATE_HIGH:
|
||||
return LINK_RATE_LOW;
|
||||
case LINK_RATE_RATE_3:
|
||||
case LINK_RATE_RATE_2:
|
||||
return LINK_RATE_LOW;
|
||||
case LINK_RATE_LOW:
|
||||
return LINK_RATE_UNKNOWN;
|
||||
default:
|
||||
return LINK_RATE_UNKNOWN;
|
||||
}
|
||||
|
|
@ -583,7 +599,7 @@ bool decide_fallback_link_setting(
|
|||
case LINK_TRAINING_LQA_FAIL:
|
||||
{
|
||||
if (!reached_minimum_link_rate(cur->link_rate)) {
|
||||
cur->link_rate = reduce_link_rate(cur->link_rate);
|
||||
cur->link_rate = reduce_link_rate(link, cur->link_rate);
|
||||
} else if (!reached_minimum_lane_count(cur->lane_count)) {
|
||||
cur->link_rate = max->link_rate;
|
||||
if (training_result == LINK_TRAINING_CR_FAIL_LANE0)
|
||||
|
|
@ -605,7 +621,7 @@ bool decide_fallback_link_setting(
|
|||
if (!reached_minimum_lane_count(cur->lane_count)) {
|
||||
cur->lane_count = reduce_lane_count(cur->lane_count);
|
||||
} else if (!reached_minimum_link_rate(cur->link_rate)) {
|
||||
cur->link_rate = reduce_link_rate(cur->link_rate);
|
||||
cur->link_rate = reduce_link_rate(link, cur->link_rate);
|
||||
/* Reduce max link rate to avoid potential infinite loop.
|
||||
* Needed so that any subsequent CR_FAIL fallback can't
|
||||
* re-set the link rate higher than the link rate from
|
||||
|
|
@ -621,7 +637,7 @@ bool decide_fallback_link_setting(
|
|||
case LINK_TRAINING_EQ_FAIL_CR:
|
||||
{
|
||||
if (!reached_minimum_link_rate(cur->link_rate)) {
|
||||
cur->link_rate = reduce_link_rate(cur->link_rate);
|
||||
cur->link_rate = reduce_link_rate(link, cur->link_rate);
|
||||
/* Reduce max link rate to avoid potential infinite loop.
|
||||
* Needed so that any subsequent CR_FAIL fallback can't
|
||||
* re-set the link rate higher than the link rate from
|
||||
|
|
@ -1284,7 +1300,7 @@ bool dp_overwrite_extended_receiver_cap(struct dc_link *link)
|
|||
void dpcd_set_source_specific_data(struct dc_link *link)
|
||||
{
|
||||
if (!link->dc->vendor_signature.is_valid) {
|
||||
enum dc_status result_write_min_hblank = DC_NOT_SUPPORTED;
|
||||
enum dc_status __maybe_unused result_write_min_hblank = DC_NOT_SUPPORTED;
|
||||
struct dpcd_amd_signature amd_signature = {0};
|
||||
struct dpcd_amd_device_id amd_device_id = {0};
|
||||
|
||||
|
|
@ -2177,7 +2193,7 @@ bool dp_verify_link_cap_with_retries(
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Check if there is a native DP or passive DP-HDMI dongle connected
|
||||
*/
|
||||
bool dp_is_sink_present(struct dc_link *link)
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@
|
|||
#define DC_LOGGER \
|
||||
link->ctx->logger
|
||||
|
||||
/* Number of Host Routers per motherboard is 2 */
|
||||
#define MAX_HR_NUM 2
|
||||
/* Number of DPIA per host router is 2 */
|
||||
#define MAX_DPIA_NUM (MAX_HR_NUM * 2)
|
||||
#define Kbps_TO_Gbps (1000 * 1000)
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
|
@ -379,9 +375,8 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res
|
|||
// 1. If due to unplug of other sink
|
||||
if (estimated == host_router_total_estimated_bw) {
|
||||
// First update the estimated & max_bw fields
|
||||
if (link->dpia_bw_alloc_config.estimated_bw < estimated) {
|
||||
if (link->dpia_bw_alloc_config.estimated_bw < estimated)
|
||||
link->dpia_bw_alloc_config.estimated_bw = estimated;
|
||||
}
|
||||
}
|
||||
// 2. If due to realloc bw btw 2 dpia due to plug OR realloc unused Bw
|
||||
else {
|
||||
|
|
@ -464,7 +459,7 @@ int link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int re
|
|||
out:
|
||||
return ret;
|
||||
}
|
||||
bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed_per_dpia, uint8_t num_dpias)
|
||||
bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed_per_dpia, const unsigned int num_dpias)
|
||||
{
|
||||
bool ret = true;
|
||||
int bw_needed_per_hr[MAX_HR_NUM] = { 0, 0 };
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
#include "link.h"
|
||||
|
||||
/* Number of Host Routers per motherboard is 2 */
|
||||
#define MAX_HR_NUM 2
|
||||
/* Number of DPIA per host router is 2 */
|
||||
#define MAX_DPIA_NUM (MAX_HR_NUM * 2)
|
||||
|
||||
/*
|
||||
* Host Router BW type
|
||||
*/
|
||||
|
|
@ -92,6 +97,6 @@ void dpia_handle_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t res
|
|||
*
|
||||
* return: TRUE if bw used by DPIAs doesn't exceed available BW else return FALSE
|
||||
*/
|
||||
bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed, uint8_t num_dpias);
|
||||
bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed, const unsigned int num_dpias);
|
||||
|
||||
#endif /* DC_INC_LINK_DP_DPIA_BW_H_ */
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ void dp_log_training_result(
|
|||
case LINK_RATE_HIGH2:
|
||||
link_rate = "HBR2";
|
||||
break;
|
||||
case LINK_RATE_RATE_8:
|
||||
link_rate = "R8";
|
||||
break;
|
||||
case LINK_RATE_HIGH3:
|
||||
link_rate = "HBR3";
|
||||
break;
|
||||
|
|
@ -1580,8 +1583,7 @@ bool perform_link_training_with_retries(
|
|||
* Report and continue with eDP panel mode to
|
||||
* perform eDP link training with right settings
|
||||
*/
|
||||
bool result;
|
||||
result = cp_psp->funcs.enable_assr(cp_psp->handle, link);
|
||||
cp_psp->funcs.enable_assr(cp_psp->handle, link);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@
|
|||
#include "abm.h"
|
||||
#define DC_LOGGER_INIT(logger)
|
||||
|
||||
/* Travis */
|
||||
static const uint8_t DP_VGA_LVDS_CONVERTER_ID_2[] = "sivarT";
|
||||
/* Nutmeg */
|
||||
static const uint8_t DP_VGA_LVDS_CONVERTER_ID_3[] = "dnomlA";
|
||||
|
||||
void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode)
|
||||
{
|
||||
union dpcd_edp_config edp_config_set;
|
||||
|
|
|
|||
|
|
@ -261,6 +261,8 @@ struct dmub_srv_hw_params {
|
|||
bool usb4_cm_version;
|
||||
bool fw_in_system_memory;
|
||||
bool dpia_hpd_int_enable_supported;
|
||||
bool disable_clock_gate;
|
||||
bool disallow_dispclk_dppclk_ds;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,6 +95,13 @@
|
|||
/* Maximum number of SubVP streams */
|
||||
#define DMUB_MAX_SUBVP_STREAMS 2
|
||||
|
||||
/* Define max FPO streams as 4 for now. Current implementation today
|
||||
* only supports 1, but could be more in the future. Reduce array
|
||||
* size to ensure the command size remains less than 64 bytes if
|
||||
* adding new fields.
|
||||
*/
|
||||
#define DMUB_MAX_FPO_STREAMS 4
|
||||
|
||||
/* Maximum number of streams on any ASIC. */
|
||||
#define DMUB_MAX_STREAMS 6
|
||||
|
||||
|
|
@ -3084,14 +3091,15 @@ struct dmub_cmd_fw_assisted_mclk_switch_pipe_data {
|
|||
uint8_t max_ramp_step;
|
||||
uint8_t pipes;
|
||||
uint8_t min_refresh_in_hz;
|
||||
uint8_t padding[1];
|
||||
uint8_t pipe_count;
|
||||
uint8_t pipe_index[4];
|
||||
};
|
||||
|
||||
struct dmub_cmd_fw_assisted_mclk_switch_config {
|
||||
uint8_t fams_enabled;
|
||||
uint8_t visual_confirm_enabled;
|
||||
uint8_t padding[2];
|
||||
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data pipe_data[DMUB_MAX_STREAMS];
|
||||
uint16_t vactive_stretch_margin_us; // Extra vblank stretch required when doing FPO + Vactive
|
||||
struct dmub_cmd_fw_assisted_mclk_switch_pipe_data pipe_data[DMUB_MAX_FPO_STREAMS];
|
||||
};
|
||||
|
||||
struct dmub_rb_cmd_fw_assisted_mclk_switch {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user