Skip to contentSkip to conversation

drm/amdgpu: Delete SI/CIK/VI IH soft_reset() code

PATCH Applied Timur Kristóf 3 participants 8 messages Sep 4 – Sep 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 drm/amdgpu: Delete SI/CIK/VI IH soft_reset() code

The code for SI/CIK/VI IH (interrupt handler) IP blocks has a soft_reset() function for each block. These functions are not called from anywhere and are dead code. It's unclear what the original intention was or why the IH block would ever need to be reset.

All SI/CIK/VI GPUs have been working well for 10+ years without ever resetting the IH block so it's time to just delete the dead code.

---
 drivers/gpu/drm/amd/amdgpu/cik_ih.c     | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/cz_ih.c      | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/si_ih.c      | 30 -----------------------
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c   | 32 -------------------------
 5 files changed, 155 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_ih.c +0 -31
index 314d8f1d64cc..73ec61bc69de 100644
@@ -373,36 +373,6 @@ static int cik_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int cik_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-
-	u32 srbm_soft_reset = 0;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_IH_MASK;
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int cik_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -425,7 +395,6 @@ static const struct amd_ip_funcs cik_ih_ip_funcs = {
 	.suspend = cik_ih_suspend,
 	.resume = cik_ih_resume,
 	.wait_for_idle = cik_ih_wait_for_idle,
-	.soft_reset = cik_ih_soft_reset,
 	.set_clockgating_state = cik_ih_set_clockgating_state,
 	.set_powergating_state = cik_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/cz_ih.c +0 -31
index 8d02602f8433..82bff26abd5e 100644
@@ -367,36 +367,6 @@ static int cz_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int cz_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	u32 srbm_soft_reset = 0;
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset, SRBM_SOFT_RESET,
-						SOFT_RESET_IH, 1);
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int cz_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -421,7 +391,6 @@ static const struct amd_ip_funcs cz_ih_ip_funcs = {
 	.suspend = cz_ih_suspend,
 	.resume = cz_ih_resume,
 	.wait_for_idle = cz_ih_wait_for_idle,
-	.soft_reset = cz_ih_soft_reset,
 	.set_clockgating_state = cz_ih_set_clockgating_state,
 	.set_powergating_state = cz_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +0 -31
index 49002c80dc71..29faaa726644 100644
@@ -361,36 +361,6 @@ static int iceland_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int iceland_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	u32 srbm_soft_reset = 0;
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset, SRBM_SOFT_RESET,
-						SOFT_RESET_IH, 1);
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int iceland_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -413,7 +383,6 @@ static const struct amd_ip_funcs iceland_ih_ip_funcs = {
 	.suspend = iceland_ih_suspend,
 	.resume = iceland_ih_resume,
 	.wait_for_idle = iceland_ih_wait_for_idle,
-	.soft_reset = iceland_ih_soft_reset,
 	.set_clockgating_state = iceland_ih_set_clockgating_state,
 	.set_powergating_state = iceland_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/si_ih.c +0 -30
index 52118765dccf..2c5ac398b582 100644
@@ -247,35 +247,6 @@ static int si_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int si_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-
-	u32 srbm_soft_reset = 0;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_IH_MASK;
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "mmSRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int si_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -298,7 +269,6 @@ static const struct amd_ip_funcs si_ih_ip_funcs = {
 	.suspend = si_ih_suspend,
 	.resume = si_ih_resume,
 	.wait_for_idle = si_ih_wait_for_idle,
-	.soft_reset = si_ih_soft_reset,
 	.set_clockgating_state = si_ih_set_clockgating_state,
 	.set_powergating_state = si_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +0 -32
index d84c08698dff..194487a71fd4 100644
@@ -379,37 +379,6 @@ static int tonga_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int tonga_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 srbm_soft_reset;
-
-	if (!adev->irq.srbm_soft_reset)
-		return 0;
-	srbm_soft_reset = adev->irq.srbm_soft_reset;
-
-	if (srbm_soft_reset) {
-		u32 tmp;
-
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int tonga_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -432,7 +401,6 @@ static const struct amd_ip_funcs tonga_ih_ip_funcs = {
 	.suspend = tonga_ih_suspend,
 	.resume = tonga_ih_resume,
 	.wait_for_idle = tonga_ih_wait_for_idle,
-	.soft_reset = tonga_ih_soft_reset,
 	.set_clockgating_state = tonga_ih_set_clockgating_state,
 	.set_powergating_state = tonga_ih_set_powergating_state,
 };
Signature · 1 line
2.55.0
#1 lore raw

PATCH 2/5 drm/amdgpu: Delete unimplemented IH soft_reset() code

The soft_reset() function for IH (interrupt handler) blocks of Vega and newer have never been implemented, and there are no plans to implement them.

Let's delete these functions, they don't do anything and also aren't called from anywhere.

---
 drivers/gpu/drm/amd/amdgpu/ih_v6_0.c   | 7 -------
 drivers/gpu/drm/amd/amdgpu/ih_v6_1.c   | 7 -------
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c   | 7 -------
 drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 7 -------
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 8 --------
 drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 8 --------
 6 files changed, 44 deletions(-)
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +0 -7
index d6554add485c..8dee48649650 100644
@@ -693,12 +693,6 @@ static int ih_v6_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int ih_v6_0_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-	return 0;
-}
-
 static void ih_v6_0_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -815,7 +809,6 @@ static const struct amd_ip_funcs ih_v6_0_ip_funcs = {
 	.suspend = ih_v6_0_suspend,
 	.resume = ih_v6_0_resume,
 	.wait_for_idle = ih_v6_0_wait_for_idle,
-	.soft_reset = ih_v6_0_soft_reset,
 	.set_clockgating_state = ih_v6_0_set_clockgating_state,
 	.set_powergating_state = ih_v6_0_set_powergating_state,
 	.get_clockgating_state = ih_v6_0_get_clockgating_state,
drivers/gpu/drm/amd/amdgpu/ih_v6_1.c +0 -7
index 0fc348010ac7..ad370b326e88 100644
@@ -643,12 +643,6 @@ static int ih_v6_1_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int ih_v6_1_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-	return 0;
-}
-
 static void ih_v6_1_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -769,7 +763,6 @@ static const struct amd_ip_funcs ih_v6_1_ip_funcs = {
 	.suspend = ih_v6_1_suspend,
 	.resume = ih_v6_1_resume,
 	.wait_for_idle = ih_v6_1_wait_for_idle,
-	.soft_reset = ih_v6_1_soft_reset,
 	.set_clockgating_state = ih_v6_1_set_clockgating_state,
 	.set_powergating_state = ih_v6_1_set_powergating_state,
 	.get_clockgating_state = ih_v6_1_get_clockgating_state,
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c +0 -7
index 3745439b86b3..e5f8742553eb 100644
@@ -700,12 +700,6 @@ static int ih_v7_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int ih_v7_0_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-	return 0;
-}
-
 static void ih_v7_0_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -863,7 +857,6 @@ static const struct amd_ip_funcs ih_v7_0_ip_funcs = {
 	.suspend = ih_v7_0_suspend,
 	.resume = ih_v7_0_resume,
 	.wait_for_idle = ih_v7_0_wait_for_idle,
-	.soft_reset = ih_v7_0_soft_reset,
 	.set_clockgating_state = ih_v7_0_set_clockgating_state,
 	.set_powergating_state = ih_v7_0_set_powergating_state,
 	.get_clockgating_state = ih_v7_0_get_clockgating_state,
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +0 -7
index 1dae7df9ee17..df2245fa35b7 100644
@@ -635,12 +635,6 @@ static int navi10_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int navi10_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-	return 0;
-}
-
 static void navi10_ih_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -698,7 +692,6 @@ static const struct amd_ip_funcs navi10_ih_ip_funcs = {
 	.suspend = navi10_ih_suspend,
 	.resume = navi10_ih_resume,
 	.wait_for_idle = navi10_ih_wait_for_idle,
-	.soft_reset = navi10_ih_soft_reset,
 	.set_clockgating_state = navi10_ih_set_clockgating_state,
 	.set_powergating_state = navi10_ih_set_powergating_state,
 	.get_clockgating_state = navi10_ih_get_clockgating_state,
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0 -8
index 4509e6130bc2..c9dca49fc2b9 100644
@@ -561,13 +561,6 @@ static int vega10_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int vega10_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-
-	return 0;
-}
-
 static void vega10_ih_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -625,7 +618,6 @@ const struct amd_ip_funcs vega10_ih_ip_funcs = {
 	.suspend = vega10_ih_suspend,
 	.resume = vega10_ih_resume,
 	.wait_for_idle = vega10_ih_wait_for_idle,
-	.soft_reset = vega10_ih_soft_reset,
 	.set_clockgating_state = vega10_ih_set_clockgating_state,
 	.set_powergating_state = vega10_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +0 -8
index 460f4bf195e8..0bda48558d4d 100644
@@ -661,13 +661,6 @@ static int vega20_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int vega20_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* todo */
-
-	return 0;
-}
-
 static void vega20_ih_update_clockgating_state(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -722,7 +715,6 @@ const struct amd_ip_funcs vega20_ih_ip_funcs = {
 	.suspend = vega20_ih_suspend,
 	.resume = vega20_ih_resume,
 	.wait_for_idle = vega20_ih_wait_for_idle,
-	.soft_reset = vega20_ih_soft_reset,
 	.set_clockgating_state = vega20_ih_set_clockgating_state,
 	.set_powergating_state = vega20_ih_set_powergating_state,
 };
Signature · 1 line
2.55.0
#2 lore raw

PATCH 3/5 drm/amdgpu: Delete GMC v6-v7 soft_reset() code

In reply to Timur Kristóf

Note that the soft reset code for GMC v6-v7 was never called from anywhere, so there is no loss of functionality from this commit. The implementation looks plausible but it was never enabled or tested, and unlikely to be useful.

We should only reset the memory controller during ASIC reset and otherwise leave it alone. Resetting the memory controller can break everything and risks losing the contents of VRAM (it's unclear if VRAM is lost or not, but it's likely).

---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 85 ---------------------------
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 83 --------------------------
 2 files changed, 168 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +0 -85
index cdd11587b12a..71409eb718d3 100644
@@ -61,45 +61,6 @@ MODULE_FIRMWARE("amdgpu/si58_mc.bin");
 #define MC_SEQ_MISC0__MT__HBM    0x60000000
 #define MC_SEQ_MISC0__MT__DDR3   0xB0000000
 
-static void gmc_v6_0_mc_stop(struct amdgpu_device *adev)
-{
-	u32 blackout;
-	struct amdgpu_ip_block *ip_block;
-
-	ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GMC);
-	if (!ip_block)
-		return;
-
-	gmc_v6_0_wait_for_idle(ip_block);
-
-	blackout = RREG32(mmMC_SHARED_BLACKOUT_CNTL);
-	if (REG_GET_FIELD(blackout, MC_SHARED_BLACKOUT_CNTL, BLACKOUT_MODE) != 1) {
-		/* Block CPU access */
-		WREG32(mmBIF_FB_EN, 0);
-		/* blackout the MC */
-		blackout = REG_SET_FIELD(blackout,
-					 MC_SHARED_BLACKOUT_CNTL, BLACKOUT_MODE, 0);
-		WREG32(mmMC_SHARED_BLACKOUT_CNTL, blackout | 1);
-	}
-	/* wait for the MC to settle */
-	udelay(100);
-
-}
-
-static void gmc_v6_0_mc_resume(struct amdgpu_device *adev)
-{
-	u32 tmp;
-
-	/* unblackout the MC */
-	tmp = RREG32(mmMC_SHARED_BLACKOUT_CNTL);
-	tmp = REG_SET_FIELD(tmp, MC_SHARED_BLACKOUT_CNTL, BLACKOUT_MODE, 0);
-	WREG32(mmMC_SHARED_BLACKOUT_CNTL, tmp);
-	/* allow CPU access */
-	tmp = REG_SET_FIELD(0, BIF_FB_EN, FB_READ_EN, 1);
-	tmp = REG_SET_FIELD(tmp, BIF_FB_EN, FB_WRITE_EN, 1);
-	WREG32(mmBIF_FB_EN, tmp);
-}
-
 static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
 {
 	const char *chip_name;
@@ -981,51 +942,6 @@ static int gmc_v6_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
 
 }
 
-static int gmc_v6_0_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-
-	u32 srbm_soft_reset = 0;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__VMC_BUSY_MASK)
-		srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
-						SRBM_SOFT_RESET, SOFT_RESET_VMC, 1);
-
-	if (tmp & (SRBM_STATUS__MCB_BUSY_MASK | SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK |
-		   SRBM_STATUS__MCC_BUSY_MASK | SRBM_STATUS__MCD_BUSY_MASK)) {
-		if (!(adev->flags & AMD_IS_APU))
-			srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
-							SRBM_SOFT_RESET, SOFT_RESET_MC, 1);
-	}
-
-	if (srbm_soft_reset) {
-		gmc_v6_0_mc_stop(adev);
-
-		if (gmc_v6_0_wait_for_idle(ip_block))
-			dev_warn(adev->dev, "Wait for GMC idle timed out !\n");
-
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		gmc_v6_0_mc_resume(adev);
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int gmc_v6_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
 					     struct amdgpu_irq_src *src,
 					     unsigned int type,
@@ -1139,7 +1055,6 @@ static const struct amd_ip_funcs gmc_v6_0_ip_funcs = {
 	.suspend = gmc_v6_0_suspend,
 	.resume = gmc_v6_0_resume,
 	.wait_for_idle = gmc_v6_0_wait_for_idle,
-	.soft_reset = gmc_v6_0_soft_reset,
 	.set_clockgating_state = gmc_v6_0_set_clockgating_state,
 	.set_powergating_state = gmc_v6_0_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +0 -83

101 lines not on this page · raw message

Signature · 1 line
2.55.0
#3 lore raw

PATCH 4/5 drm/amdgpu: Delete unimplemented GMC v9 soft_reset() code

In reply to Timur Kristóf

The soft_reset() function for GMC (memory controller) block of Vega has never been implemented, and there are no plans to implement it.

Let's delete this function, it doesn't do anything and also isn't called from anywhere.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -7
index 633772fa71fd..999c4d9a6deb 100644
@@ -2312,12 +2312,6 @@ static int gmc_v9_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return 0;
 }
 
-static int gmc_v9_0_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* XXX for emulation.*/
-	return 0;
-}
-
 static int gmc_v9_0_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					enum amd_clockgating_state state)
 {
@@ -2356,7 +2350,6 @@ const struct amd_ip_funcs gmc_v9_0_ip_funcs = {
 	.suspend = gmc_v9_0_suspend,
 	.resume = gmc_v9_0_resume,
 	.wait_for_idle = gmc_v9_0_wait_for_idle,
-	.soft_reset = gmc_v9_0_soft_reset,
 	.set_clockgating_state = gmc_v9_0_set_clockgating_state,
 	.set_powergating_state = gmc_v9_0_set_powergating_state,
 	.get_clockgating_state = gmc_v9_0_get_clockgating_state,
Signature · 1 line
2.55.0
#4 lore raw

PATCH 5/5 drm/amdgpu: Delete unimplemented DM soft_reset() code

In reply to Timur Kristóf

The soft_reset() function for the DCE / DCN blocks has never been implemented, and there are no plans to implement it.

Let's delete this function, it doesn't do anything and also isn't called from anywhere.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c      |  8 --------
 .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c   | 10 ----------
 2 files changed, 18 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -8
index f49cc198fb0d..4cf81b8dc030 100644
@@ -231,13 +231,6 @@ STATIC_IFN_KUNIT int dm_wait_for_idle(struct amdgpu_ip_block *ip_block)
 }
 EXPORT_IF_KUNIT(dm_wait_for_idle);
 
-STATIC_IFN_KUNIT int dm_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	/* XXX todo */
-	return 0;
-}
-EXPORT_IF_KUNIT(dm_soft_reset);
-
 /*
  * DC will program planes with their z-order determined by their ordering
  * in the dc_surface_updates array. This comparator is used to sort them
@@ -2109,7 +2102,6 @@ static const struct amd_ip_funcs amdgpu_dm_funcs = {
 	.suspend = dm_suspend,
 	.resume = dm_resume,
 	.wait_for_idle = dm_wait_for_idle,
-	.soft_reset = dm_soft_reset,
 	.set_clockgating_state = dm_set_clockgating_state,
 	.set_powergating_state = dm_set_powergating_state,
 };
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +0 -10
index a67774e6db36..a3ccb2522a6a 100644
@@ -49,15 +49,6 @@ static void dm_test_wait_for_idle(struct kunit *test)
 	KUNIT_EXPECT_EQ(test, dm_wait_for_idle(NULL), 0);
 }
 
-/**
- * dm_test_soft_reset - Test placeholder soft-reset callback returns success
- * @test: The KUnit test context
- */
-static void dm_test_soft_reset(struct kunit *test)
-{
-	KUNIT_EXPECT_EQ(test, dm_soft_reset(NULL), 0);
-}
-
 /**
  * dm_test_set_clockgating_state - Test placeholder clockgating callback returns success
  * @test: The KUnit test context
@@ -4541,7 +4532,6 @@ static void dm_test_initialize_plane_overlay(struct kunit *test)
 static struct kunit_case amdgpu_dm_tests[] = {
 	/* Simple DM callbacks */
 	KUNIT_CASE(dm_test_wait_for_idle),
-	KUNIT_CASE(dm_test_soft_reset),
 	KUNIT_CASE(dm_test_set_clockgating_state),
 	KUNIT_CASE(dm_test_set_powergating_state),
 	KUNIT_CASE(dm_test_bandwidth_update),
Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/5
#5 lore raw
In reply to Timur Kristóf
Quoted 11 lines · Timur Kristóf

The code for SI/CIK/VI IH (interrupt handler) IP blocks has a soft_reset() function for each block. These functions are not called from anywhere and are dead code. It's unclear what the original intention was or why the IH block would ever need to be reset.

All SI/CIK/VI GPUs have been working well for 10+ years without ever resetting the IH block so it's time to just delete the dead code.

@Alex do you pick them up or should I?

Thanks,
Christian.

Quoted 253 lines
---
 drivers/gpu/drm/amd/amdgpu/cik_ih.c     | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/cz_ih.c      | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 31 ------------------------
 drivers/gpu/drm/amd/amdgpu/si_ih.c      | 30 -----------------------
 drivers/gpu/drm/amd/amdgpu/tonga_ih.c   | 32 -------------------------
 5 files changed, 155 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_ih.c +0 -31
index 314d8f1d64cc..73ec61bc69de 100644
@@ -373,36 +373,6 @@ static int cik_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int cik_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-
-	u32 srbm_soft_reset = 0;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_IH_MASK;
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int cik_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -425,7 +395,6 @@ static const struct amd_ip_funcs cik_ih_ip_funcs = {
 	.suspend = cik_ih_suspend,
 	.resume = cik_ih_resume,
 	.wait_for_idle = cik_ih_wait_for_idle,
-	.soft_reset = cik_ih_soft_reset,
 	.set_clockgating_state = cik_ih_set_clockgating_state,
 	.set_powergating_state = cik_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/cz_ih.c +0 -31
index 8d02602f8433..82bff26abd5e 100644
@@ -367,36 +367,6 @@ static int cz_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int cz_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	u32 srbm_soft_reset = 0;
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset, SRBM_SOFT_RESET,
-						SOFT_RESET_IH, 1);
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int cz_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -421,7 +391,6 @@ static const struct amd_ip_funcs cz_ih_ip_funcs = {
 	.suspend = cz_ih_suspend,
 	.resume = cz_ih_resume,
 	.wait_for_idle = cz_ih_wait_for_idle,
-	.soft_reset = cz_ih_soft_reset,
 	.set_clockgating_state = cz_ih_set_clockgating_state,
 	.set_powergating_state = cz_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +0 -31
index 49002c80dc71..29faaa726644 100644
@@ -361,36 +361,6 @@ static int iceland_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int iceland_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	u32 srbm_soft_reset = 0;
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset, SRBM_SOFT_RESET,
-						SOFT_RESET_IH, 1);
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int iceland_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -413,7 +383,6 @@ static const struct amd_ip_funcs iceland_ih_ip_funcs = {
 	.suspend = iceland_ih_suspend,
 	.resume = iceland_ih_resume,
 	.wait_for_idle = iceland_ih_wait_for_idle,
-	.soft_reset = iceland_ih_soft_reset,
 	.set_clockgating_state = iceland_ih_set_clockgating_state,
 	.set_powergating_state = iceland_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/si_ih.c +0 -30
index 52118765dccf..2c5ac398b582 100644
@@ -247,35 +247,6 @@ static int si_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int si_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-
-	u32 srbm_soft_reset = 0;
-	u32 tmp = RREG32(mmSRBM_STATUS);
-
-	if (tmp & SRBM_STATUS__IH_BUSY_MASK)
-		srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_IH_MASK;
-
-	if (srbm_soft_reset) {
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "mmSRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int si_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -298,7 +269,6 @@ static const struct amd_ip_funcs si_ih_ip_funcs = {
 	.suspend = si_ih_suspend,
 	.resume = si_ih_resume,
 	.wait_for_idle = si_ih_wait_for_idle,
-	.soft_reset = si_ih_soft_reset,
 	.set_clockgating_state = si_ih_set_clockgating_state,
 	.set_powergating_state = si_ih_set_powergating_state,
 };
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +0 -32
index d84c08698dff..194487a71fd4 100644
@@ -379,37 +379,6 @@ static int tonga_ih_wait_for_idle(struct amdgpu_ip_block *ip_block)
 	return -ETIMEDOUT;
 }
 
-static int tonga_ih_soft_reset(struct amdgpu_ip_block *ip_block)
-{
-	struct amdgpu_device *adev = ip_block->adev;
-	u32 srbm_soft_reset;
-
-	if (!adev->irq.srbm_soft_reset)
-		return 0;
-	srbm_soft_reset = adev->irq.srbm_soft_reset;
-
-	if (srbm_soft_reset) {
-		u32 tmp;
-
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-		tmp |= srbm_soft_reset;
-		dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		udelay(50);
-
-		tmp &= ~srbm_soft_reset;
-		WREG32(mmSRBM_SOFT_RESET, tmp);
-		tmp = RREG32(mmSRBM_SOFT_RESET);
-
-		/* Wait a little for things to settle down */
-		udelay(50);
-	}
-
-	return 0;
-}
-
 static int tonga_ih_set_clockgating_state(struct amdgpu_ip_block *ip_block,
 					  enum amd_clockgating_state state)
 {
@@ -432,7 +401,6 @@ static const struct amd_ip_funcs tonga_ih_ip_funcs = {
 	.suspend = tonga_ih_suspend,
 	.resume = tonga_ih_resume,
 	.wait_for_idle = tonga_ih_wait_for_idle,
-	.soft_reset = tonga_ih_soft_reset,
 	.set_clockgating_state = tonga_ih_set_clockgating_state,
 	.set_powergating_state = tonga_ih_set_powergating_state,
 };
#6 lore raw
Quoted 11 lines · Central European Summer Time Christian König
Quoted 10 lines · Timur Kristóf

The code for SI/CIK/VI IH (interrupt handler) IP blocks has a soft_reset() function for each block. These functions are not called from anywhere and are dead code. It's unclear what the original intention was or why the IH block would ever need to be reset.

All SI/CIK/VI GPUs have been working well for 10+ years without ever resetting the IH block so it's time to just delete the dead code.

Quoted 8 lines
Quoted 1 line

@Alex do you pick them up or should I?

Thanks,
Christian.

Hi Alex & Christian,

Ping. Is there anything I need to do to move forward with this series?

Applied
#7 lore raw

Applied. Thanks!

Alex

Quoted 29 lines · Timur Kristóf
Quoted 11 lines · Central European Summer Time Christian König
Quoted 10 lines · Timur Kristóf

The code for SI/CIK/VI IH (interrupt handler) IP blocks has a soft_reset() function for each block. These functions are not called from anywhere and are dead code. It's unclear what the original intention was or why the IH block would ever need to be reset.

All SI/CIK/VI GPUs have been working well for 10+ years without ever resetting the IH block so it's time to just delete the dead code.

Quoted 8 lines
Quoted 1 line

@Alex do you pick them up or should I?

Thanks,
Christian.

Hi Alex & Christian,

Ping. Is there anything I need to do to move forward with this series?