diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/nv.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.c | 5 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc21.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/umc_v8_10.h | 4 | 
10 files changed, 39 insertions, 36 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c index b719852daa07..1a3cb53d2e0d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -543,6 +543,7 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,  	struct harvest_table *harvest_info;  	u16 offset;  	int i; +	uint32_t umc_harvest_config = 0;  	bhdr = (struct binary_header *)adev->mman.discovery_bin;  	offset = le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset); @@ -570,12 +571,17 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,  			adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;  			break;  		case UMC_HWID: +			umc_harvest_config |= +				1 << (le16_to_cpu(harvest_info->list[i].number_instance));  			(*umc_harvest_count)++;  			break;  		default:  			break;  		}  	} + +	adev->umc.active_mask = ((1 << adev->umc.node_inst_num) - 1) & +				~umc_harvest_config;  }  /* ================================================== */ @@ -1156,8 +1162,10 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)  						AMDGPU_MAX_SDMA_INSTANCES);  			} -			if (le16_to_cpu(ip->hw_id) == UMC_HWID) +			if (le16_to_cpu(ip->hw_id) == UMC_HWID) {  				adev->gmc.num_umc++; +				adev->umc.node_inst_num++; +			}  			for (k = 0; k < num_base_address; k++) {  				/* diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index e3e1ed4314dd..6c7d672412b2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -1315,7 +1315,7 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo)  	if (!bo->resource || bo->resource->mem_type != TTM_PL_VRAM ||  	    !(abo->flags & AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE) || -	    adev->in_suspend || adev->shutdown) +	    adev->in_suspend || drm_dev_is_unplugged(adev_to_drm(adev)))  		return;  	if (WARN_ON_ONCE(!dma_resv_trylock(bo->base.resv))) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 28fe6d941054..3f5d13035aff 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -602,27 +602,14 @@ psp_cmd_submit_buf(struct psp_context *psp,  		   struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr)  {  	int ret; -	int index, idx; +	int index;  	int timeout = 20000;  	bool ras_intr = false;  	bool skip_unsupport = false; -	bool dev_entered;  	if (psp->adev->no_hw_access)  		return 0; -	dev_entered = drm_dev_enter(adev_to_drm(psp->adev), &idx); -	/* -	 * We allow sending PSP messages LOAD_ASD and UNLOAD_TA without acquiring -	 * a lock in drm_dev_enter during driver unload because we must call -	 * drm_dev_unplug as the beginning  of unload driver sequence . It is very -	 * crucial that userspace can't access device instances anymore. -	 */ -	if (!dev_entered) -		WARN_ON(psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_LOAD_ASD && -			psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_UNLOAD_TA && -			psp->cmd_buf_mem->cmd_id != GFX_CMD_ID_INVOKE_CMD); -  	memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);  	memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp)); @@ -686,8 +673,6 @@ psp_cmd_submit_buf(struct psp_context *psp,  	}  exit: -	if (dev_entered) -		drm_dev_exit(idx);  	return ret;  } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h index f2bf979af588..36e19336f3b3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h @@ -42,7 +42,7 @@  #define LOOP_UMC_INST_AND_CH(umc_inst, ch_inst) LOOP_UMC_INST((umc_inst)) LOOP_UMC_CH_INST((ch_inst))  #define LOOP_UMC_NODE_INST(node_inst) \ -		for ((node_inst) = 0; (node_inst) < adev->umc.node_inst_num; (node_inst)++) +		for_each_set_bit((node_inst), &(adev->umc.active_mask), adev->umc.node_inst_num)  #define LOOP_UMC_EACH_NODE_INST_AND_CH(node_inst, umc_inst, ch_inst) \  		LOOP_UMC_NODE_INST((node_inst)) LOOP_UMC_INST_AND_CH((umc_inst), (ch_inst)) @@ -69,7 +69,7 @@ struct amdgpu_umc {  	/* number of umc instance with memory map register access */  	uint32_t umc_inst_num; -	/*number of umc node instance with memory map register access*/ +	/* Total number of umc node instance including harvest one */  	uint32_t node_inst_num;  	/* UMC regiser per channel offset */ @@ -82,6 +82,9 @@ struct amdgpu_umc {  	const struct amdgpu_umc_funcs *funcs;  	struct amdgpu_umc_ras *ras; + +	/* active mask for umc node instance */ +	unsigned long active_mask;  };  int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block); diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c index 85e0afc3d4f7..af7b3ba1ca00 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c @@ -567,7 +567,6 @@ static void gmc_v11_0_set_umc_funcs(struct amdgpu_device *adev)  	case IP_VERSION(8, 10, 0):  		adev->umc.channel_inst_num = UMC_V8_10_CHANNEL_INSTANCE_NUM;  		adev->umc.umc_inst_num = UMC_V8_10_UMC_INSTANCE_NUM; -		adev->umc.node_inst_num = adev->gmc.num_umc;  		adev->umc.max_ras_err_cnt_per_query = UMC_V8_10_TOTAL_CHANNEL_NUM(adev);  		adev->umc.channel_offs = UMC_V8_10_PER_CHANNEL_OFFSET;  		adev->umc.retire_unit = UMC_V8_10_NA_COL_2BITS_POWER_OF_2_NUM; diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c index 4b0d563c6522..4ef1fa4603c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c @@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)  		if (def != data)  			WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3), data);  		break; -	case IP_VERSION(7, 5, 1): -		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2); -		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK; -		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data); -		fallthrough;  	default:  		def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL));  		data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL, @@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)  		break;  	} +	switch (adev->ip_versions[NBIO_HWIP][0]) { +	case IP_VERSION(7, 3, 0): +	case IP_VERSION(7, 5, 1): +		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2); +		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK; +		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data); +		break; +	} +  	if (amdgpu_sriov_vf(adev))  		adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,  			regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c index d972025f0d20..855d390c41de 100644 --- a/drivers/gpu/drm/amd/amdgpu/nv.c +++ b/drivers/gpu/drm/amd/amdgpu/nv.c @@ -444,9 +444,10 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num,  	*value = 0;  	for (i = 0; i < ARRAY_SIZE(nv_allowed_read_registers); i++) {  		en = &nv_allowed_read_registers[i]; -		if (adev->reg_offset[en->hwip][en->inst] && -		    reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] -				   + en->reg_offset)) +		if (!adev->reg_offset[en->hwip][en->inst]) +			continue; +		else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] +					+ en->reg_offset))  			continue;  		*value = nv_get_register_value(adev, diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 7cd17dda32ce..2eddd7f6cd41 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -439,8 +439,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,  	*value = 0;  	for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {  		en = &soc15_allowed_read_registers[i]; -		if (adev->reg_offset[en->hwip][en->inst] && -			reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] +		if (!adev->reg_offset[en->hwip][en->inst]) +			continue; +		else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]  					+ en->reg_offset))  			continue; diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index 620f7409825d..061793d390cc 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -111,6 +111,7 @@ static int soc21_query_video_codecs(struct amdgpu_device *adev, bool encode,  	switch (adev->ip_versions[UVD_HWIP][0]) {  	case IP_VERSION(4, 0, 0):  	case IP_VERSION(4, 0, 2): +	case IP_VERSION(4, 0, 4):  		if (adev->vcn.harvest_config & AMDGPU_VCN_HARVEST_VCN0) {  			if (encode)  				*codecs = &vcn_4_0_0_video_codecs_encode_vcn1; @@ -291,9 +292,10 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,  	*value = 0;  	for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {  		en = &soc21_allowed_read_registers[i]; -		if (adev->reg_offset[en->hwip][en->inst] && -		    reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] -				   + en->reg_offset)) +		if (!adev->reg_offset[en->hwip][en->inst]) +			continue; +		else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] +					+ en->reg_offset))  			continue;  		*value = soc21_get_register_value(adev, diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v8_10.h b/drivers/gpu/drm/amd/amdgpu/umc_v8_10.h index 25eaf4af5fcf..c6dfd433fec7 100644 --- a/drivers/gpu/drm/amd/amdgpu/umc_v8_10.h +++ b/drivers/gpu/drm/amd/amdgpu/umc_v8_10.h @@ -31,9 +31,9 @@  /* number of umc instance with memory map register access */  #define UMC_V8_10_UMC_INSTANCE_NUM		2 -/* Total channel instances for all umc nodes */ +/* Total channel instances for all available umc nodes */  #define UMC_V8_10_TOTAL_CHANNEL_NUM(adev) \ -	(UMC_V8_10_CHANNEL_INSTANCE_NUM * UMC_V8_10_UMC_INSTANCE_NUM * (adev)->umc.node_inst_num) +	(UMC_V8_10_CHANNEL_INSTANCE_NUM * UMC_V8_10_UMC_INSTANCE_NUM * (adev)->gmc.num_umc)  /* UMC regiser per channel offset */  #define UMC_V8_10_PER_CHANNEL_OFFSET	0x400 |