Commit 0339258b authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher
Browse files

drm/amd/pm: invalidate hdp before CPU access the memory written by GPU



To eliminate the possible influence by outdated HDP read cache.

Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b7a1f382
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -139,8 +139,7 @@ static int smu10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
			priv->smu_tables.entry[table_id].table_id,
			NULL);

	/* flush hdp cache */
	amdgpu_asic_flush_hdp(adev, NULL);
	amdgpu_asic_invalidate_hdp(adev, NULL);

	memcpy(table, (uint8_t *)priv->smu_tables.entry[table_id].table,
			priv->smu_tables.entry[table_id].size);
+1 −2
Original line number Diff line number Diff line
@@ -60,8 +60,7 @@ static int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
			priv->smu_tables.entry[table_id].table_id,
			NULL);

	/* flush hdp cache */
	amdgpu_asic_flush_hdp(adev, NULL);
	amdgpu_asic_invalidate_hdp(adev, NULL);

	memcpy(table, priv->smu_tables.entry[table_id].table,
			priv->smu_tables.entry[table_id].size);
+1 −2
Original line number Diff line number Diff line
@@ -68,8 +68,7 @@ static int vega12_copy_table_from_smc(struct pp_hwmgr *hwmgr,
			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
			return -EINVAL);

	/* flush hdp cache */
	amdgpu_asic_flush_hdp(adev, NULL);
	amdgpu_asic_invalidate_hdp(adev, NULL);

	memcpy(table, priv->smu_tables.entry[table_id].table,
			priv->smu_tables.entry[table_id].size);
+2 −4
Original line number Diff line number Diff line
@@ -192,8 +192,7 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr,
			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
			return ret);

	/* flush hdp cache */
	amdgpu_asic_flush_hdp(adev, NULL);
	amdgpu_asic_invalidate_hdp(adev, NULL);

	memcpy(table, priv->smu_tables.entry[table_id].table,
			priv->smu_tables.entry[table_id].size);
@@ -307,8 +306,7 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
			"[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!",
			return ret);

	/* flush hdp cache */
	amdgpu_asic_flush_hdp(adev, NULL);
	amdgpu_asic_invalidate_hdp(adev, NULL);

	memcpy(table, priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table,
			priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
+1 −1
Original line number Diff line number Diff line
@@ -655,7 +655,7 @@ int smu_cmn_update_table(struct smu_context *smu,
		return ret;

	if (!drv2smu) {
		amdgpu_asic_flush_hdp(adev, NULL);
		amdgpu_asic_invalidate_hdp(adev, NULL);
		memcpy(table_data, table->cpu_addr, table_size);
	}