diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc21.c | 3 | 
13 files changed, 43 insertions, 28 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index f29c1d0ad4c1..458362e4ea01 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -1079,20 +1079,16 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)  	 * S0ix even though the system is suspending to idle, so return false  	 * in that case.  	 */ -	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) { +	if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))  		dev_warn_once(adev->dev,  			      "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"  			      "To use suspend-to-idle change the sleep mode in BIOS setup.\n"); -		return false; -	}  #if !IS_ENABLED(CONFIG_AMD_PMC)  	dev_warn_once(adev->dev,  		      "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n"); -	return false; -#else -	return true;  #endif /* CONFIG_AMD_PMC */ +	return true;  }  #endif /* CONFIG_SUSPEND */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 5bee3ff62344..d376faad7696 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4031,7 +4031,8 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)  	amdgpu_gart_dummy_page_fini(adev); -	amdgpu_device_unmap_mmio(adev); +	if (drm_dev_is_unplugged(adev_to_drm(adev))) +		amdgpu_device_unmap_mmio(adev);  } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 7bb12a76631f..1bf31707e4f7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2227,6 +2227,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)  	struct drm_device *dev = pci_get_drvdata(pdev);  	struct amdgpu_device *adev = drm_to_adev(dev); +	drm_dev_unplug(dev); +  	if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {  		pm_runtime_get_sync(dev->dev);  		pm_runtime_forbid(dev->dev); @@ -2266,8 +2268,6 @@ amdgpu_pci_remove(struct pci_dev *pdev)  	amdgpu_driver_unload_kms(dev); -	drm_dev_unplug(dev); -  	/*  	 * Flush any in flight DMA operations from device.  	 * Clear the Bus Master Enable bit and then wait on the PCIe Device diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index a8391f269cd0..40929f34447c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -606,12 +606,21 @@ psp_cmd_submit_buf(struct psp_context *psp,  	int timeout = 20000;  	bool ras_intr = false;  	bool skip_unsupport = false; +	bool dev_entered;  	if (psp->adev->no_hw_access)  		return 0; -	if (!drm_dev_enter(adev_to_drm(psp->adev), &idx)) -		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);  	memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE); @@ -676,7 +685,8 @@ psp_cmd_submit_buf(struct psp_context *psp,  	}  exit: -	drm_dev_exit(idx); +	if (dev_entered) +		drm_dev_exit(idx);  	return ret;  } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index f39391e03d46..ca5a1d026f5a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -983,11 +983,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v  	if (offset == reg_access_ctrl->grbm_cntl) {  		/* if the target reg offset is grbm_cntl, write to scratch_reg2 */  		writel(v, scratch_reg2); -		writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));  	} else if (offset == reg_access_ctrl->grbm_idx) {  		/* if the target reg offset is grbm_idx, write to scratch_reg3 */  		writel(v, scratch_reg3); -		writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));  	} else {  		/*  		 * SCRATCH_REG0 	= read/write value diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c index b991609f46c1..5dfab80ffff2 100644 --- a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c +++ b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c @@ -94,7 +94,7 @@ static void df_v1_7_update_medium_grain_clock_gating(struct amdgpu_device *adev,  		WREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater, tmp);  	} -	/* Exit boradcast mode */ +	/* Exit broadcast mode */  	adev->df.funcs->enable_broadcast_mode(adev, false);  } diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index c621b2ad7ba3..8ad8a0bffcac 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -754,8 +754,8 @@ static void gfx_v11_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd,  	 * zero here */  	WARN_ON(simd != 0); -	/* type 2 wave data */ -	dst[(*no_fields)++] = 2; +	/* type 3 wave data */ +	dst[(*no_fields)++] = 3;  	dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_STATUS);  	dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_LO);  	dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_HI); diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c index fa42d1907dfa..7c069010ca9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v3_0.c @@ -151,10 +151,11 @@ static void gfxhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)  {  	uint64_t value; -	/* Disable AGP. */ +	/* Program the AGP BAR */  	WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BASE, 0); -	WREG32_SOC15(GC, 0, regGCMC_VM_AGP_TOP, 0); -	WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BOT, 0x00FFFFFF); +	WREG32_SOC15(GC, 0, regGCMC_VM_AGP_BOT, adev->gmc.agp_start >> 24); +	WREG32_SOC15(GC, 0, regGCMC_VM_AGP_TOP, adev->gmc.agp_end >> 24); +  	/* Program the system aperture low logical page number. */  	WREG32_SOC15(GC, 0, regGCMC_VM_SYSTEM_APERTURE_LOW_ADDR, diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c index 5e0018fe7e7d..0a31a341aa43 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c @@ -673,6 +673,7 @@ static void gmc_v11_0_vram_gtt_location(struct amdgpu_device *adev,  	amdgpu_gmc_vram_location(adev, &adev->gmc, base);  	amdgpu_gmc_gart_location(adev, mc); +	amdgpu_gmc_agp_location(adev, mc);  	/* base offset of vram pages */  	if (amdgpu_sriov_vf(adev)) diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c index ae9cd1a4cfee..923fc09bc8fc 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c @@ -177,10 +177,11 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)  	 * these regs, and they will be programed at host.  	 * so skip programing these regs.  	 */ -	/* Disable AGP. */ +	/* Program the AGP BAR */  	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); -	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); -	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); +	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, adev->gmc.agp_start >> 24); +	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, adev->gmc.agp_end >> 24); +  	/* Program the system aperture low logical page number. */  	WREG32_SOC15(MMHUB, 0, regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR,  		     adev->gmc.vram_start >> 18); diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c index c30e40e52fb2..51580302ec42 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c @@ -162,10 +162,10 @@ static void mmhub_v3_0_2_init_system_aperture_regs(struct amdgpu_device *adev)  	uint64_t value;  	uint32_t tmp; -	/* Disable AGP. */ +	/* Program the AGP BAR */  	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); -	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); -	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); +	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, adev->gmc.agp_start >> 24); +	WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);  	if (!amdgpu_sriov_vf(adev)) {  		/* diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c index 15eb3658d70e..09fdcd20cb91 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c @@ -337,7 +337,13 @@ const struct nbio_hdp_flush_reg nbio_v4_3_hdp_flush_reg = {  static void nbio_v4_3_init_registers(struct amdgpu_device *adev)  { -	return; +	if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(4, 3, 0)) { +		uint32_t data; + +		data = RREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2); +		data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK; +		WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data); +	}  }  static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index e03cf7f766c5..477be4b62bc3 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -676,7 +676,8 @@ static int soc21_common_early_init(void *handle)  			AMD_CG_SUPPORT_GFX_CGCG |  			AMD_CG_SUPPORT_GFX_CGLS |  			AMD_CG_SUPPORT_REPEATER_FGCG | -			AMD_CG_SUPPORT_GFX_MGCG; +			AMD_CG_SUPPORT_GFX_MGCG | +			AMD_CG_SUPPORT_HDP_SD;  		adev->pg_flags = AMD_PG_SUPPORT_VCN |  			AMD_PG_SUPPORT_VCN_DPG |  			AMD_PG_SUPPORT_JPEG; | 
