[PATCH] drm/amdgpu: remove grbm cam remmaping for gfx v10

Huang Rui ray.huang at amd.com
Tue Oct 19 10:02:47 UTC 2021


PSP firmware will be responsible for applying the GRBM CAM remapping in
the production. And the GRBM_CAM_INDEX / GRBM_CAM_DATA registers will be
protected by PSP under security policy. So remove it according to the
new security policy.

Signed-off-by: Huang Rui <ray.huang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 201 -------------------------
 1 file changed, 201 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 71bb3c0dc1da..a53036a05d7e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -270,25 +270,6 @@ MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec.bin");
 MODULE_FIRMWARE("amdgpu/cyan_skillfish2_mec2.bin");
 MODULE_FIRMWARE("amdgpu/cyan_skillfish2_rlc.bin");
 
-static const struct soc15_reg_golden golden_settings_gc_10_0[] =
-{
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_INDEX, 0xffffffff, 0x00000000),
-	/* TA_GRAD_ADJ_UCONFIG -> TA_GRAD_ADJ */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2544c382),
-	/* VGT_TF_RING_SIZE_UMD -> VGT_TF_RING_SIZE */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2262c24e),
-	/* VGT_HS_OFFCHIP_PARAM_UMD -> VGT_HS_OFFCHIP_PARAM */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x226cc24f),
-	/* VGT_TF_MEMORY_BASE_UMD -> VGT_TF_MEMORY_BASE */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x226ec250),
-	/* VGT_TF_MEMORY_BASE_HI_UMD -> VGT_TF_MEMORY_BASE_HI */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2278c261),
-	/* VGT_ESGS_RING_SIZE_UMD -> VGT_ESGS_RING_SIZE */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2232c240),
-	/* VGT_GSVS_RING_SIZE_UMD -> VGT_GSVS_RING_SIZE */
-	SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_CAM_DATA, 0xffffffff, 0x2233c241),
-};
-
 static const struct soc15_reg_golden golden_settings_gc_10_1[] =
 {
 	SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
@@ -3809,9 +3790,6 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_3_5));
 		break;
 	case IP_VERSION(10, 1, 3):
-		soc15_program_register_sequence(adev,
-						golden_settings_gc_10_0,
-						(const u32)ARRAY_SIZE(golden_settings_gc_10_0));
 		soc15_program_register_sequence(adev,
 						golden_settings_gc_10_0_cyan_skillfish,
 						(const u32)ARRAY_SIZE(golden_settings_gc_10_0_cyan_skillfish));
@@ -7297,181 +7275,6 @@ static void gfx_v10_0_cp_enable(struct amdgpu_device *adev, bool enable)
 	gfx_v10_0_cp_compute_enable(adev, enable);
 }
 
-static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
-{
-	uint32_t data, pattern = 0xDEADBEEF;
-
-	/* check if mmVGT_ESGS_RING_SIZE_UMD
-	 * has been remapped to mmVGT_ESGS_RING_SIZE */
-	switch (adev->ip_versions[GC_HWIP][0]) {
-	case IP_VERSION(10, 3, 0):
-	case IP_VERSION(10, 3, 2):
-	case IP_VERSION(10, 3, 4):
-	case IP_VERSION(10, 3, 5):
-		data = RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid);
-		WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid, 0);
-		WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, pattern);
-
-		if (RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid) == pattern) {
-			WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD , data);
-			return true;
-		} else {
-			WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid, data);
-			return false;
-		}
-		break;
-	case IP_VERSION(10, 3, 1):
-	case IP_VERSION(10, 3, 3):
-		return true;
-	default:
-		data = RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE);
-		WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE, 0);
-		WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, pattern);
-
-		if (RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE) == pattern) {
-			WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, data);
-			return true;
-		} else {
-			WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE, data);
-			return false;
-		}
-		break;
-	}
-}
-
-static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev)
-{
-	uint32_t data;
-
-	if (amdgpu_sriov_vf(adev))
-		return;
-
-	/* initialize cam_index to 0
-	 * index will auto-inc after each data writting */
-	WREG32_SOC15(GC, 0, mmGRBM_CAM_INDEX, 0);
-
-	switch (adev->ip_versions[GC_HWIP][0]) {
-	case IP_VERSION(10, 3, 0):
-	case IP_VERSION(10, 3, 2):
-	case IP_VERSION(10, 3, 1):
-	case IP_VERSION(10, 3, 4):
-	case IP_VERSION(10, 3, 5):
-	case IP_VERSION(10, 3, 3):
-		/* mmVGT_TF_RING_SIZE_UMD -> mmVGT_TF_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_TF_MEMORY_BASE_UMD -> mmVGT_TF_MEMORY_BASE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_TF_MEMORY_BASE_HI_UMD -> mmVGT_TF_MEMORY_BASE_HI */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_HI_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_HI_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_HS_OFFCHIP_PARAM_UMD -> mmVGT_HS_OFFCHIP_PARAM */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_HS_OFFCHIP_PARAM_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_HS_OFFCHIP_PARAM_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_ESGS_RING_SIZE_UMD -> mmVGT_ESGS_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_ESGS_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_GSVS_RING_SIZE_UMD -> mmVGT_GSVS_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_GSVS_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_GSVS_RING_SIZE_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmSPI_CONFIG_CNTL_REMAP -> mmSPI_CONFIG_CNTL */
-		data = (SOC15_REG_OFFSET(GC, 0, mmSPI_CONFIG_CNTL_REMAP) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmSPI_CONFIG_CNTL_Sienna_Cichlid) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		break;
-	default:
-		/* mmVGT_TF_RING_SIZE_UMD -> mmVGT_TF_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_RING_SIZE) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_TF_MEMORY_BASE_UMD -> mmVGT_TF_MEMORY_BASE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_TF_MEMORY_BASE_HI_UMD -> mmVGT_TF_MEMORY_BASE_HI */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_HI_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_TF_MEMORY_BASE_HI) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_HS_OFFCHIP_PARAM_UMD -> mmVGT_HS_OFFCHIP_PARAM */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_HS_OFFCHIP_PARAM_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_HS_OFFCHIP_PARAM) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_ESGS_RING_SIZE_UMD -> mmVGT_ESGS_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_ESGS_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_ESGS_RING_SIZE) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmVGT_GSVS_RING_SIZE_UMD -> mmVGT_GSVS_RING_SIZE */
-		data = (SOC15_REG_OFFSET(GC, 0, mmVGT_GSVS_RING_SIZE_UMD) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmVGT_GSVS_RING_SIZE) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-		WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-
-		/* mmSPI_CONFIG_CNTL_REMAP -> mmSPI_CONFIG_CNTL */
-		data = (SOC15_REG_OFFSET(GC, 0, mmSPI_CONFIG_CNTL_REMAP) <<
-			GRBM_CAM_DATA__CAM_ADDR__SHIFT) |
-		       (SOC15_REG_OFFSET(GC, 0, mmSPI_CONFIG_CNTL) <<
-			GRBM_CAM_DATA__CAM_REMAPADDR__SHIFT);
-		break;
-	}
-
-	WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA_UPPER, 0);
-	WREG32_SOC15(GC, 0, mmGRBM_CAM_DATA, data);
-}
-
 static void gfx_v10_0_disable_gpa_mode(struct amdgpu_device *adev)
 {
 	uint32_t data;
@@ -7506,10 +7309,6 @@ static int gfx_v10_0_hw_init(void *handle)
 		gfx_v10_0_disable_gpa_mode(adev);
 	}
 
-	/* if GRBM CAM not remapped, set up the remapping */
-	if (!gfx_v10_0_check_grbm_cam_remapping(adev))
-		gfx_v10_0_setup_grbm_cam_remapping(adev);
-
 	gfx_v10_0_constants_init(adev);
 
 	r = gfx_v10_0_rlc_resume(adev);
-- 
2.25.1



More information about the amd-gfx mailing list