diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 31 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c | 19 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 19 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/nv.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/si_dpm.c | 2 | 
15 files changed, 76 insertions, 24 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c index 7e59e473a190..cdea1338c8dc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c @@ -152,7 +152,7 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,  		dev_warn(adev->dev,  			 "Invalid sdma engine id (%d), using engine id 0\n",  			 engine_id); -		/* fall through */ +		fallthrough;  	case 0:  		sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,  				mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c index c7fd0c47b254..1102de76d876 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c @@ -195,19 +195,32 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,  				unsigned int engine_id,  				unsigned int queue_id)  { -	uint32_t sdma_engine_reg_base[2] = { -		SOC15_REG_OFFSET(SDMA0, 0, -				 mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL, -		SOC15_REG_OFFSET(SDMA1, 0, -				 mmSDMA1_RLC0_RB_CNTL) - mmSDMA1_RLC0_RB_CNTL -	}; -	uint32_t retval = sdma_engine_reg_base[engine_id] +	uint32_t sdma_engine_reg_base = 0; +	uint32_t sdma_rlc_reg_offset; + +	switch (engine_id) { +	default: +		dev_warn(adev->dev, +			 "Invalid sdma engine id (%d), using engine id 0\n", +			 engine_id); +		fallthrough; +	case 0: +		sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0, +				mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL; +		break; +	case 1: +		sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA1, 0, +				mmSDMA1_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL; +		break; +	} + +	sdma_rlc_reg_offset = sdma_engine_reg_base  		+ queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL);  	pr_debug("RLC register offset for SDMA%d RLC%d: 0x%x\n", engine_id, -			queue_id, retval); +		 queue_id, sdma_rlc_reg_offset); -	return retval; +	return sdma_rlc_reg_offset;  }  static inline struct v9_mqd *get_mqd(void *mqd) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 0047da06041f..414548064648 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -179,6 +179,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)  		case CHIP_VEGA20:  		case CHIP_ARCTURUS:  		case CHIP_SIENNA_CICHLID: +		case CHIP_NAVY_FLOUNDER:  			/* enable runpm if runpm=1 */  			if (amdgpu_runtime_pm > 0)  				adev->runpm = true; @@ -678,8 +679,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file  		 * in the bitfields */  		if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)  			se_num = 0xffffffff; +		else if (se_num >= AMDGPU_GFX_MAX_SE) +			return -EINVAL;  		if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)  			sh_num = 0xffffffff; +		else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE) +			return -EINVAL;  		if (info->read_mmr_reg.count > 128)  			return -EINVAL; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 7fe564275457..d8c6520ff74a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -522,8 +522,7 @@ static int psp_asd_load(struct psp_context *psp)  	 * add workaround to bypass it for sriov now.  	 * TODO: add version check to make it common  	 */ -	if (amdgpu_sriov_vf(psp->adev) || -	    (psp->adev->asic_type == CHIP_NAVY_FLOUNDER)) +	if (amdgpu_sriov_vf(psp->adev) || !psp->asd_fw)  		return 0;  	cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index bcce4c0be462..1bedb416eebd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1243,7 +1243,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,  	if (!obj || !obj->ent)  		return; -	debugfs_remove(obj->ent);  	obj->ent = NULL;  	put_obj(obj);  } @@ -1257,7 +1256,6 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)  		amdgpu_ras_debugfs_remove(adev, &obj->head);  	} -	debugfs_remove_recursive(con->dir);  	con->dir = NULL;  }  /* debugfs end */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 134cc36e30c5..0739e259bf91 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -462,7 +462,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev,  	unsigned int pages;  	int i, r; -	*sgt = kmalloc(sizeof(*sg), GFP_KERNEL); +	*sgt = kmalloc(sizeof(**sgt), GFP_KERNEL);  	if (!*sgt)  		return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 65997ffaed45..037a187aa42f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -7263,10 +7263,8 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *ade  		def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);  		data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |  			  RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK | -			  RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK); - -		/* only for Vega10 & Raven1 */ -		data |= RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK; +			  RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK | +			  RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK);  		if (def != data)  			WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 33f1c4a46ebe..88f63d7ea371 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -3250,7 +3250,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct amdgpu_device *adev)  		dev_warn(adev->dev,  			 "Unknown chip type (%d) in function gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",  			 adev->asic_type); -		/* fall through */ +		fallthrough;  	case CHIP_CARRIZO:  		modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index cb9d60a4e05e..b95f22262a90 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -691,6 +691,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_4_1_arct[] =  	SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_5_ARCT, 0x3ff, 0x135),  	SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_CONFIG, 0xffffffff, 0x011A0000),  	SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_FIFO_SIZES, 0xffffffff, 0x00000f00), +	SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_UTCL1_CNTL1, 0x30000000, 0x30000000)  };  static const struct soc15_reg_rlcg rlcg_access_gc_9_0[] = { diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c index fa0bca3e1f73..5d2505956f84 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c @@ -135,6 +135,12 @@ static void gfxhub_v2_1_init_cache_regs(struct amdgpu_device *adev)  {  	uint32_t tmp; +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	/* Setup L2 cache */  	tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL);  	tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL, ENABLE_L2_CACHE, 1); @@ -190,6 +196,12 @@ static void gfxhub_v2_1_enable_system_domain(struct amdgpu_device *adev)  static void gfxhub_v2_1_disable_identity_aperture(struct amdgpu_device *adev)  { +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,  		     0xFFFFFFFF);  	WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32, @@ -326,6 +338,13 @@ void gfxhub_v2_1_set_fault_enable_default(struct amdgpu_device *adev,  					  bool value)  {  	u32 tmp; + +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL);  	tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL,  			    RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value); diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 6e4f3ff4810f..b67ba38a195f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1297,7 +1297,7 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)  	case CHIP_VEGA10:  		if (amdgpu_sriov_vf(adev))  			break; -		/* fall through */ +		fallthrough;  	case CHIP_VEGA20:  		soc15_program_register_sequence(adev,  						golden_settings_mmhub_1_0_0, diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c index 757fa8e83f5b..c79fc54bc3c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c @@ -134,6 +134,12 @@ static void mmhub_v2_0_init_cache_regs(struct amdgpu_device *adev)  {  	uint32_t tmp; +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	/* Setup L2 cache */  	tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL);  	tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL, ENABLE_L2_CACHE, 1); @@ -189,6 +195,12 @@ static void mmhub_v2_0_enable_system_domain(struct amdgpu_device *adev)  static void mmhub_v2_0_disable_identity_aperture(struct amdgpu_device *adev)  { +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	WREG32_SOC15(MMHUB, 0,  		     mmMMVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,  		     0xFFFFFFFF); @@ -318,6 +330,13 @@ void mmhub_v2_0_gart_disable(struct amdgpu_device *adev)  void mmhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev, bool value)  {  	u32 tmp; + +	/* These registers are not accessible to VF-SRIOV. +	 * The PF will program them instead. +	 */ +	if (amdgpu_sriov_vf(adev)) +		return; +  	tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_PROTECTION_FAULT_CNTL);  	tmp = REG_SET_FIELD(tmp, MMVM_L2_PROTECTION_FAULT_CNTL,  			    RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value); diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c index da8024c2826e..ca11253e787c 100644 --- a/drivers/gpu/drm/amd/amdgpu/nv.c +++ b/drivers/gpu/drm/amd/amdgpu/nv.c @@ -364,6 +364,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)  	switch (adev->asic_type) {  	case CHIP_SIENNA_CICHLID: +	case CHIP_NAVY_FLOUNDER:  		return AMD_RESET_METHOD_MODE1;  	default:  		if (smu_baco_is_support(smu)) diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c index d488d250805d..e16874f30d5d 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c @@ -179,12 +179,11 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)  		}  		break;  	case CHIP_SIENNA_CICHLID: +	case CHIP_NAVY_FLOUNDER:  		err = psp_init_ta_microcode(&adev->psp, chip_name);  		if (err)  			return err;  		break; -	case CHIP_NAVY_FLOUNDER: -		break;  	default:  		BUG();  	} diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c index ea914b256ebd..b5986d19dc08 100644 --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c @@ -6196,7 +6196,7 @@ static void si_request_link_speed_change_before_state_change(struct amdgpu_devic  			si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;  			if (current_link_speed == AMDGPU_PCIE_GEN2)  				break; -			/* fall through */ +			fallthrough;  		case AMDGPU_PCIE_GEN2:  			if (amdgpu_acpi_pcie_performance_request(adev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)  				break; |