Skip to contentSkip to conversation

drm/amdgpu: Remove invalidate and flush hdp macros

PATCH In review Asad Kamal 3 participants 3 messages Oct 28, 2025 – Oct 29, 2025

Subsystems (3)
lore
Share & tools
lore

Asad Kamal

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Remove invalidate and flush hdp macros

Remove amdgpu_asic_flush_hdp & amdgpu_asic_invalidate_hdp functions and directly use the mapped ones

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h                     | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c              | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c                  | 2 +-
 drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c  | 4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c | 4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c | 4 ++--
 drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c | 8 ++++----
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c   | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c    | 6 +++---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                  | 4 ++--
 11 files changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index d1137d8beca7..bcfed46eedaf 100644
@@ -1539,8 +1539,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
 #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
 #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
 #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
-#define amdgpu_asic_flush_hdp(adev, r) amdgpu_hdp_flush(adev, r)
-#define amdgpu_asic_invalidate_hdp(adev, r) amdgpu_hdp_invalidate(adev, r)
 #define amdgpu_asic_need_full_reset(adev) (adev)->asic_funcs->need_full_reset((adev))
 #define amdgpu_asic_init_doorbell_index(adev) (adev)->asic_funcs->init_doorbell_index((adev))
 #define amdgpu_asic_get_pcie_usage(adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index b92234d63562..962380af4ee9 100644
@@ -7327,7 +7327,7 @@ void amdgpu_device_flush_hdp(struct amdgpu_device *adev,
 			return;
 	}
 
-	amdgpu_asic_flush_hdp(adev, ring);
+	amdgpu_hdp_flush(adev, ring);
 }
 
 void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
@@ -7340,7 +7340,7 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
 	if (adev->gmc.xgmi.connected_to_cpu)
 		return;
 
-	amdgpu_asic_invalidate_hdp(adev, ring);
+	amdgpu_hdp_invalidate(adev, ring);
 }
 
 int amdgpu_in_reset(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
index 3bd44c24f692..de7a1e168a76 100644
@@ -342,7 +342,7 @@ static void sdma_v5_2_ring_emit_hdp_flush(struct amdgpu_ring *ring)
 	const struct nbio_hdp_flush_reg *nbio_hf_reg = adev->nbio.hdp_flush_reg;
 
 	if (ring->me > 1) {
-		amdgpu_asic_flush_hdp(adev, ring);
+		amdgpu_hdp_flush(adev, ring);
 	} else {
 		ref_and_mask = nbio_hf_reg->ref_and_mask_sdma0 << ring->me;
 
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +2 -2
index ac9ec8257f82..38e19e5cad4d 100644
@@ -139,7 +139,7 @@ static int smu10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
 			priv->smu_tables.entry[table_id].table_id,
 			NULL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
 	memcpy(table, (uint8_t *)priv->smu_tables.entry[table_id].table,
 			priv->smu_tables.entry[table_id].size);
@@ -164,7 +164,7 @@ static int smu10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
 	memcpy(priv->smu_tables.entry[table_id].table, table,
 			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
 	smum_send_msg_to_smc_with_parameter(hwmgr,
 			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c +2 -2
index f9c0f117725d..0bf1bf5528c2 100644
@@ -60,7 +60,7 @@ static int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
 			priv->smu_tables.entry[table_id].table_id,
 			NULL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
 	memcpy(table, priv->smu_tables.entry[table_id].table,
 			priv->smu_tables.entry[table_id].size);
@@ -90,7 +90,7 @@ static int vega10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
 	memcpy(priv->smu_tables.entry[table_id].table, table,
 			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
 	smum_send_msg_to_smc_with_parameter(hwmgr,
 			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c +2 -2
index d3ff6a831ed5..e2ba593faa5d 100644
@@ -68,7 +68,7 @@ static int vega12_copy_table_from_smc(struct pp_hwmgr *hwmgr,
 			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
 			return -EINVAL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
 	memcpy(table, priv->smu_tables.entry[table_id].table,
 			priv->smu_tables.entry[table_id].size);
@@ -98,7 +98,7 @@ static int vega12_copy_table_to_smc(struct pp_hwmgr *hwmgr,
 	memcpy(priv->smu_tables.entry[table_id].table, table,
 			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
 	PP_ASSERT_WITH_CODE(smum_send_msg_to_smc_with_parameter(hwmgr,
 			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +4 -4
index a5c95b180672..e3515156d26f 100644
@@ -192,7 +192,7 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr,
 			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
 			return ret);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
 	memcpy(table, priv->smu_tables.entry[table_id].table,
 			priv->smu_tables.entry[table_id].size);
@@ -223,7 +223,7 @@ static int vega20_copy_table_to_smc(struct pp_hwmgr *hwmgr,
 	memcpy(priv->smu_tables.entry[table_id].table, table,
 			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
 	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
 			PPSMC_MSG_SetDriverDramAddrHigh,
@@ -256,7 +256,7 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
 	memcpy(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table, table,
 			priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
 	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
 			PPSMC_MSG_SetDriverDramAddrHigh,
@@ -306,7 +306,7 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
 			"[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!",
 			return ret);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
 	memcpy(table, priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table,
 			priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -1
index bbf09aec9152..7c9f77124ab2 100644
@@ -2889,7 +2889,7 @@ static int navi10_set_dummy_pstates_table_location(struct smu_context *smu)
 		dummy_table += 0x1000;
 	}
 
-	amdgpu_asic_flush_hdp(smu->adev, NULL);
+	amdgpu_hdp_flush(smu->adev, NULL);
 
 	ret = smu_cmn_send_smc_msg_with_param(smu,
 					      SMU_MSG_SET_DRIVER_DUMMY_TABLE_DRAM_ADDR_HIGH,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c +1 -1
index cb3fea9e8cf3..a0c844bf852c 100644
@@ -449,7 +449,7 @@ static int smu_v13_0_12_get_system_metrics_table(struct smu_context *smu)
 		return ret;
 	}
 
-	amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+	amdgpu_hdp_invalidate(smu->adev, NULL);
 	smu_table_cache_update_time(sys_table, jiffies);
 	memcpy(sys_table->cache.buffer, table->cpu_addr,
 	       smu_v13_0_12_get_system_metrics_size());
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -3
index 0a7d2cea7dc6..e1f9aa5d6c20 100644
@@ -766,7 +766,7 @@ int smu_v13_0_6_get_metrics_table(struct smu_context *smu, void *metrics_table,
 			return ret;
 		}
 
-		amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+		amdgpu_hdp_invalidate(smu->adev, NULL);
 		memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
 
 		smu_table->metrics_time = jiffies;
@@ -845,7 +845,7 @@ int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu)
 		return ret;
 	}
 
-	amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+	amdgpu_hdp_invalidate(smu->adev, NULL);
 	memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
 
 	return 0;
@@ -2385,7 +2385,7 @@ static int smu_v13_0_6_request_i2c_xfer(struct smu_context *smu,
 
 	memcpy(table->cpu_addr, table_data, table_size);
 	/* Flush hdp cache */
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 	ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RequestI2cTransaction,
 					  NULL);
 
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -2
index a8961a8f5c42..3b98065dac1d 100644
@@ -980,7 +980,7 @@ int smu_cmn_update_table(struct smu_context *smu,
 		 * Flush hdp cache: to guard the content seen by
 		 * GPU is consitent with CPU.
 		 */
-		amdgpu_asic_flush_hdp(adev, NULL);
+		amdgpu_hdp_flush(adev, NULL);
 	}
 
 	ret = smu_cmn_send_smc_msg_with_param(smu, drv2smu ?
@@ -992,7 +992,7 @@ int smu_cmn_update_table(struct smu_context *smu,
 		return ret;
 
 	if (!drv2smu) {
-		amdgpu_asic_invalidate_hdp(adev, NULL);
+		amdgpu_hdp_invalidate(adev, NULL);
 		memcpy(table_data, table->cpu_addr, table_size);
 	}
 
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Asad Kamal

Remove amdgpu_asic_flush_hdp & amdgpu_asic_invalidate_hdp functions and directly use the mapped ones

Two patches (invalidate/flush) would have been ideal.

Thanks,
Lijo

Quoted 247 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h                     | 2 --
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c              | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c                  | 2 +-
  drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c  | 4 ++--
  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c | 4 ++--
  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c | 4 ++--
  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c | 8 ++++----
  drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 2 +-
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c   | 2 +-
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c    | 6 +++---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                  | 4 ++--
  11 files changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index d1137d8beca7..bcfed46eedaf 100644
@@ -1539,8 +1539,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
  #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
  #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
  #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
-#define amdgpu_asic_flush_hdp(adev, r) amdgpu_hdp_flush(adev, r)
-#define amdgpu_asic_invalidate_hdp(adev, r) amdgpu_hdp_invalidate(adev, r)
  #define amdgpu_asic_need_full_reset(adev) (adev)->asic_funcs->need_full_reset((adev))
  #define amdgpu_asic_init_doorbell_index(adev) (adev)->asic_funcs->init_doorbell_index((adev))
  #define amdgpu_asic_get_pcie_usage(adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index b92234d63562..962380af4ee9 100644
@@ -7327,7 +7327,7 @@ void amdgpu_device_flush_hdp(struct amdgpu_device *adev,
  			return;
  	}
 
-	amdgpu_asic_flush_hdp(adev, ring);
+	amdgpu_hdp_flush(adev, ring);
  }
 
  void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
@@ -7340,7 +7340,7 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
  	if (adev->gmc.xgmi.connected_to_cpu)
  		return;
 
-	amdgpu_asic_invalidate_hdp(adev, ring);
+	amdgpu_hdp_invalidate(adev, ring);
  }
 
  int amdgpu_in_reset(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
index 3bd44c24f692..de7a1e168a76 100644
@@ -342,7 +342,7 @@ static void sdma_v5_2_ring_emit_hdp_flush(struct amdgpu_ring *ring)
  	const struct nbio_hdp_flush_reg *nbio_hf_reg = adev->nbio.hdp_flush_reg;
 
  	if (ring->me > 1) {
-		amdgpu_asic_flush_hdp(adev, ring);
+		amdgpu_hdp_flush(adev, ring);
  	} else {
  		ref_and_mask = nbio_hf_reg->ref_and_mask_sdma0 << ring->me;
 
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +2 -2
index ac9ec8257f82..38e19e5cad4d 100644
@@ -139,7 +139,7 @@ static int smu10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
  			priv->smu_tables.entry[table_id].table_id,
  			NULL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
  	memcpy(table, (uint8_t *)priv->smu_tables.entry[table_id].table,
  			priv->smu_tables.entry[table_id].size);
@@ -164,7 +164,7 @@ static int smu10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
  	memcpy(priv->smu_tables.entry[table_id].table, table,
  			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
  	smum_send_msg_to_smc_with_parameter(hwmgr,
  			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c +2 -2
index f9c0f117725d..0bf1bf5528c2 100644
@@ -60,7 +60,7 @@ static int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
  			priv->smu_tables.entry[table_id].table_id,
  			NULL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
  	memcpy(table, priv->smu_tables.entry[table_id].table,
  			priv->smu_tables.entry[table_id].size);
@@ -90,7 +90,7 @@ static int vega10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
  	memcpy(priv->smu_tables.entry[table_id].table, table,
  			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
  	smum_send_msg_to_smc_with_parameter(hwmgr,
  			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c +2 -2
index d3ff6a831ed5..e2ba593faa5d 100644
@@ -68,7 +68,7 @@ static int vega12_copy_table_from_smc(struct pp_hwmgr *hwmgr,
  			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
  			return -EINVAL);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
  	memcpy(table, priv->smu_tables.entry[table_id].table,
  			priv->smu_tables.entry[table_id].size);
@@ -98,7 +98,7 @@ static int vega12_copy_table_to_smc(struct pp_hwmgr *hwmgr,
  	memcpy(priv->smu_tables.entry[table_id].table, table,
  			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
  	PP_ASSERT_WITH_CODE(smum_send_msg_to_smc_with_parameter(hwmgr,
  			PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +4 -4
index a5c95b180672..e3515156d26f 100644
@@ -192,7 +192,7 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr,
  			"[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
  			return ret);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
  	memcpy(table, priv->smu_tables.entry[table_id].table,
  			priv->smu_tables.entry[table_id].size);
@@ -223,7 +223,7 @@ static int vega20_copy_table_to_smc(struct pp_hwmgr *hwmgr,
  	memcpy(priv->smu_tables.entry[table_id].table, table,
  			priv->smu_tables.entry[table_id].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
  	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
  			PPSMC_MSG_SetDriverDramAddrHigh,
@@ -256,7 +256,7 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
  	memcpy(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table, table,
  			priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
 
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
 
  	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
  			PPSMC_MSG_SetDriverDramAddrHigh,
@@ -306,7 +306,7 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
  			"[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!",
  			return ret);
 
-	amdgpu_asic_invalidate_hdp(adev, NULL);
+	amdgpu_hdp_invalidate(adev, NULL);
 
  	memcpy(table, priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table,
  			priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -1
index bbf09aec9152..7c9f77124ab2 100644
@@ -2889,7 +2889,7 @@ static int navi10_set_dummy_pstates_table_location(struct smu_context *smu)
  		dummy_table += 0x1000;
  	}
 
-	amdgpu_asic_flush_hdp(smu->adev, NULL);
+	amdgpu_hdp_flush(smu->adev, NULL);
 
  	ret = smu_cmn_send_smc_msg_with_param(smu,
  					      SMU_MSG_SET_DRIVER_DUMMY_TABLE_DRAM_ADDR_HIGH,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c +1 -1
index cb3fea9e8cf3..a0c844bf852c 100644
@@ -449,7 +449,7 @@ static int smu_v13_0_12_get_system_metrics_table(struct smu_context *smu)
  		return ret;
  	}
 
-	amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+	amdgpu_hdp_invalidate(smu->adev, NULL);
  	smu_table_cache_update_time(sys_table, jiffies);
  	memcpy(sys_table->cache.buffer, table->cpu_addr,
  	       smu_v13_0_12_get_system_metrics_size());
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -3
index 0a7d2cea7dc6..e1f9aa5d6c20 100644
@@ -766,7 +766,7 @@ int smu_v13_0_6_get_metrics_table(struct smu_context *smu, void *metrics_table,
  			return ret;
  		}
 
-		amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+		amdgpu_hdp_invalidate(smu->adev, NULL);
  		memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
 
  		smu_table->metrics_time = jiffies;
@@ -845,7 +845,7 @@ int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu)
  		return ret;
  	}
 
-	amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+	amdgpu_hdp_invalidate(smu->adev, NULL);
  	memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
 
  	return 0;
@@ -2385,7 +2385,7 @@ static int smu_v13_0_6_request_i2c_xfer(struct smu_context *smu,
 
  	memcpy(table->cpu_addr, table_data, table_size);
  	/* Flush hdp cache */
-	amdgpu_asic_flush_hdp(adev, NULL);
+	amdgpu_hdp_flush(adev, NULL);
  	ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RequestI2cTransaction,
  					  NULL);
 
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -2
index a8961a8f5c42..3b98065dac1d 100644
@@ -980,7 +980,7 @@ int smu_cmn_update_table(struct smu_context *smu,
  		 * Flush hdp cache: to guard the content seen by
  		 * GPU is consitent with CPU.
  		 */
-		amdgpu_asic_flush_hdp(adev, NULL);
+		amdgpu_hdp_flush(adev, NULL);
  	}
 
  	ret = smu_cmn_send_smc_msg_with_param(smu, drv2smu ?
@@ -992,7 +992,7 @@ int smu_cmn_update_table(struct smu_context *smu,
  		return ret;
 
  	if (!drv2smu) {
-		amdgpu_asic_invalidate_hdp(adev, NULL);
+		amdgpu_hdp_invalidate(adev, NULL);
  		memcpy(table_data, table->cpu_addr, table_size);
  	}
 
maintainer Reviewed-by
#2 lore raw
Quoted 11 lines · Lijo
Quoted 4 lines · Asad Kamal

Remove amdgpu_asic_flush_hdp & amdgpu_asic_invalidate_hdp functions and directly use the mapped ones

Two patches (invalidate/flush) would have been ideal.

Quoted 215 lines

Thanks,
Lijo

Quoted 210 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h                     | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c              | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c                  | 2 +- drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c  | 4 ++--

  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c | 4 ++--
  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c | 4 ++--
  drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c | 8 ++++----

  drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c   | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c    | 6 +++--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                  | 4 ++--

  11 files changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index d1137d8beca7..bcfed46eedaf 100644
@@ -1539,8 +1539,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
   #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
   #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
   #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
-#define amdgpu_asic_flush_hdp(adev, r) amdgpu_hdp_flush(adev, r)
-#define amdgpu_asic_invalidate_hdp(adev, r) amdgpu_hdp_invalidate(adev, r)
   #define amdgpu_asic_need_full_reset(adev) (adev)->asic_funcs->need_full_reset((adev))
   #define amdgpu_asic_init_doorbell_index(adev) (adev)->asic_funcs->init_doorbell_index((adev))
   #define amdgpu_asic_get_pcie_usage(adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index b92234d63562..962380af4ee9 100644
@@ -7327,7 +7327,7 @@ void amdgpu_device_flush_hdp(struct amdgpu_device *adev,
               return;
       }
   -    amdgpu_asic_flush_hdp(adev, ring);
+    amdgpu_hdp_flush(adev, ring);
   }
     void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
@@ -7340,7 +7340,7 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
       if (adev->gmc.xgmi.connected_to_cpu)
           return;
   -    amdgpu_asic_invalidate_hdp(adev, ring);
+    amdgpu_hdp_invalidate(adev, ring);
   }
     int amdgpu_in_reset(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
index 3bd44c24f692..de7a1e168a76 100644
@@ -342,7 +342,7 @@ static void sdma_v5_2_ring_emit_hdp_flush(struct amdgpu_ring *ring)
       const struct nbio_hdp_flush_reg *nbio_hf_reg = adev->nbio.hdp_flush_reg;
         if (ring->me > 1) {
-        amdgpu_asic_flush_hdp(adev, ring);
+        amdgpu_hdp_flush(adev, ring);
       } else {
           ref_and_mask = nbio_hf_reg->ref_and_mask_sdma0 << ring->me;

  diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c index ac9ec8257f82..38e19e5cad4d 100644

drivers/gpu/drm/amd/pm/powerplay/smumgr/smu10_smumgr.c +2 -0
@@ -139,7 +139,7 @@ static int smu10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
               priv->smu_tables.entry[table_id].table_id,
               NULL);
   -    amdgpu_asic_invalidate_hdp(adev, NULL);
+    amdgpu_hdp_invalidate(adev, NULL);
         memcpy(table, (uint8_t *)priv->smu_tables.entry[table_id].table,
               priv->smu_tables.entry[table_id].size);
@@ -164,7 +164,7 @@ static int smu10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
       memcpy(priv->smu_tables.entry[table_id].table, table,
               priv->smu_tables.entry[table_id].size);
   -    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
         smum_send_msg_to_smc_with_parameter(hwmgr,
               PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c +2 -0
index f9c0f117725d..0bf1bf5528c2 100644
@@ -60,7 +60,7 @@ static int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
               priv->smu_tables.entry[table_id].table_id,
               NULL);
   -    amdgpu_asic_invalidate_hdp(adev, NULL);
+    amdgpu_hdp_invalidate(adev, NULL);
         memcpy(table, priv->smu_tables.entry[table_id].table,
               priv->smu_tables.entry[table_id].size);
@@ -90,7 +90,7 @@ static int vega10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
       memcpy(priv->smu_tables.entry[table_id].table, table,
               priv->smu_tables.entry[table_id].size);
   -    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
         smum_send_msg_to_smc_with_parameter(hwmgr,
               PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega12_smumgr.c +2 -0
index d3ff6a831ed5..e2ba593faa5d 100644
@@ -68,7 +68,7 @@ static int vega12_copy_table_from_smc(struct pp_hwmgr *hwmgr,
               "[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
               return -EINVAL);
   -    amdgpu_asic_invalidate_hdp(adev, NULL);
+    amdgpu_hdp_invalidate(adev, NULL);
         memcpy(table, priv->smu_tables.entry[table_id].table,
               priv->smu_tables.entry[table_id].size);
@@ -98,7 +98,7 @@ static int vega12_copy_table_to_smc(struct pp_hwmgr *hwmgr,
       memcpy(priv->smu_tables.entry[table_id].table, table,
               priv->smu_tables.entry[table_id].size);
   -    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
         PP_ASSERT_WITH_CODE(smum_send_msg_to_smc_with_parameter(hwmgr,
               PPSMC_MSG_SetDriverDramAddrHigh,
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega20_smumgr.c +4 -0
index a5c95b180672..e3515156d26f 100644
@@ -192,7 +192,7 @@ static int vega20_copy_table_from_smc(struct pp_hwmgr *hwmgr,
               "[CopyTableFromSMC] Attempt to Transfer Table From SMU Failed!",
               return ret);
   -    amdgpu_asic_invalidate_hdp(adev, NULL);
+    amdgpu_hdp_invalidate(adev, NULL);
         memcpy(table, priv->smu_tables.entry[table_id].table,
               priv->smu_tables.entry[table_id].size);
@@ -223,7 +223,7 @@ static int vega20_copy_table_to_smc(struct pp_hwmgr *hwmgr,
       memcpy(priv->smu_tables.entry[table_id].table, table,
               priv->smu_tables.entry[table_id].size);
   -    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
         PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
               PPSMC_MSG_SetDriverDramAddrHigh,
@@ -256,7 +256,7 @@ int vega20_set_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
       memcpy(priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table, table,
               priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
   -    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
         PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(hwmgr,
               PPSMC_MSG_SetDriverDramAddrHigh,
@@ -306,7 +306,7 @@ int vega20_get_activity_monitor_coeff(struct pp_hwmgr *hwmgr,
               "[GetActivityMonitor] Attempt to Transfer Table From SMU Failed!",
               return ret);
   -    amdgpu_asic_invalidate_hdp(adev, NULL);
+    amdgpu_hdp_invalidate(adev, NULL);
         memcpy(table, priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].table,
               priv->smu_tables.entry[TABLE_ACTIVITY_MONITOR_COEFF].size);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
index bbf09aec9152..7c9f77124ab2 100644
@@ -2889,7 +2889,7 @@ static int navi10_set_dummy_pstates_table_location(struct smu_context *smu)
           dummy_table += 0x1000;
       }
   -    amdgpu_asic_flush_hdp(smu->adev, NULL);
+    amdgpu_hdp_flush(smu->adev, NULL);
         ret = smu_cmn_send_smc_msg_with_param(smu,
                             SMU_MSG_SET_DRIVER_DUMMY_TABLE_DRAM_ADDR_HIGH,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c +1 -0
index cb3fea9e8cf3..a0c844bf852c 100644
@@ -449,7 +449,7 @@ static int smu_v13_0_12_get_system_metrics_table(struct smu_context *smu)
           return ret;
       }
   -    amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+    amdgpu_hdp_invalidate(smu->adev, NULL);
       smu_table_cache_update_time(sys_table, jiffies);
       memcpy(sys_table->cache.buffer, table->cpu_addr,
              smu_v13_0_12_get_system_metrics_size());
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -1
index 0a7d2cea7dc6..e1f9aa5d6c20 100644
@@ -766,7 +766,7 @@ int smu_v13_0_6_get_metrics_table(struct smu_context *smu, void *metrics_table,
               return ret;
           }
   -        amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+        amdgpu_hdp_invalidate(smu->adev, NULL);
           memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
             smu_table->metrics_time = jiffies;
@@ -845,7 +845,7 @@ int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu)
           return ret;
       }
   -    amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+    amdgpu_hdp_invalidate(smu->adev, NULL);
       memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
         return 0;
@@ -2385,7 +2385,7 @@ static int smu_v13_0_6_request_i2c_xfer(struct smu_context *smu,
         memcpy(table->cpu_addr, table_data, table_size);
       /* Flush hdp cache */
-    amdgpu_asic_flush_hdp(adev, NULL);
+    amdgpu_hdp_flush(adev, NULL);
       ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RequestI2cTransaction,
                         NULL);

  diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c index a8961a8f5c42..3b98065dac1d 100644

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
@@ -980,7 +980,7 @@ int smu_cmn_update_table(struct smu_context *smu,
            * Flush hdp cache: to guard the content seen by
            * GPU is consitent with CPU.
            */
-        amdgpu_asic_flush_hdp(adev, NULL);
+        amdgpu_hdp_flush(adev, NULL);
       }

        ret = smu_cmn_send_smc_msg_with_param(smu, drv2smu ?

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
@@ -992,7 +992,7 @@ int smu_cmn_update_table(struct smu_context *smu,
           return ret;
         if (!drv2smu) {
-        amdgpu_asic_invalidate_hdp(adev, NULL);
+        amdgpu_hdp_invalidate(adev, NULL);
           memcpy(table_data, table->cpu_addr, table_size);
       }