Skip to content

Commit 6e332c9

Browse files
konradybciorobclark
authored andcommitted
drm/msm/a6xx: Move a6xx_bus_clear_pending_transactions to a6xx_gpu
This function is responsible for telling the GPU to halt transactions on all of its relevant buses, drain them and leave them in a predictable state, so that the GPU can be e.g. reset cleanly. Move the function to a6xx_gpu.c, remove the static keyword and add a prototype in a6xx_gpu.h to accomodate for the move. Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/542762/ Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent ce8f138 commit 6e332c9

3 files changed

Lines changed: 38 additions & 37 deletions

File tree

drivers/gpu/drm/msm/adreno/a6xx_gmu.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -868,43 +868,6 @@ static void a6xx_gmu_rpmh_off(struct a6xx_gmu *gmu)
868868
(val & 1), 100, 1000);
869869
}
870870

871-
#define GBIF_CLIENT_HALT_MASK BIT(0)
872-
#define GBIF_ARB_HALT_MASK BIT(1)
873-
874-
static void a6xx_bus_clear_pending_transactions(struct adreno_gpu *adreno_gpu,
875-
bool gx_off)
876-
{
877-
struct msm_gpu *gpu = &adreno_gpu->base;
878-
879-
if (!a6xx_has_gbif(adreno_gpu)) {
880-
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0xf);
881-
spin_until((gpu_read(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL1) &
882-
0xf) == 0xf);
883-
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0);
884-
885-
return;
886-
}
887-
888-
if (gx_off) {
889-
/* Halt the gx side of GBIF */
890-
gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, 1);
891-
spin_until(gpu_read(gpu, REG_A6XX_RBBM_GBIF_HALT_ACK) & 1);
892-
}
893-
894-
/* Halt new client requests on GBIF */
895-
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_CLIENT_HALT_MASK);
896-
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
897-
(GBIF_CLIENT_HALT_MASK)) == GBIF_CLIENT_HALT_MASK);
898-
899-
/* Halt all AXI requests on GBIF */
900-
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_ARB_HALT_MASK);
901-
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
902-
(GBIF_ARB_HALT_MASK)) == GBIF_ARB_HALT_MASK);
903-
904-
/* The GBIF halt needs to be explicitly cleared */
905-
gpu_write(gpu, REG_A6XX_GBIF_HALT, 0x0);
906-
}
907-
908871
/* Force the GMU off in case it isn't responsive */
909872
static void a6xx_gmu_force_off(struct a6xx_gmu *gmu)
910873
{

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,42 @@ static void a6xx_llc_slices_init(struct platform_device *pdev,
17051705
a6xx_gpu->llc_mmio = ERR_PTR(-EINVAL);
17061706
}
17071707

1708+
#define GBIF_CLIENT_HALT_MASK BIT(0)
1709+
#define GBIF_ARB_HALT_MASK BIT(1)
1710+
1711+
void a6xx_bus_clear_pending_transactions(struct adreno_gpu *adreno_gpu, bool gx_off)
1712+
{
1713+
struct msm_gpu *gpu = &adreno_gpu->base;
1714+
1715+
if (!a6xx_has_gbif(adreno_gpu)) {
1716+
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0xf);
1717+
spin_until((gpu_read(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL1) &
1718+
0xf) == 0xf);
1719+
gpu_write(gpu, REG_A6XX_VBIF_XIN_HALT_CTRL0, 0);
1720+
1721+
return;
1722+
}
1723+
1724+
if (gx_off) {
1725+
/* Halt the gx side of GBIF */
1726+
gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, 1);
1727+
spin_until(gpu_read(gpu, REG_A6XX_RBBM_GBIF_HALT_ACK) & 1);
1728+
}
1729+
1730+
/* Halt new client requests on GBIF */
1731+
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_CLIENT_HALT_MASK);
1732+
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
1733+
(GBIF_CLIENT_HALT_MASK)) == GBIF_CLIENT_HALT_MASK);
1734+
1735+
/* Halt all AXI requests on GBIF */
1736+
gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_ARB_HALT_MASK);
1737+
spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) &
1738+
(GBIF_ARB_HALT_MASK)) == GBIF_ARB_HALT_MASK);
1739+
1740+
/* The GBIF halt needs to be explicitly cleared */
1741+
gpu_write(gpu, REG_A6XX_GBIF_HALT, 0x0);
1742+
}
1743+
17081744
static int a6xx_pm_resume(struct msm_gpu *gpu)
17091745
{
17101746
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);

drivers/gpu/drm/msm/adreno/a6xx_gpu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,6 @@ void a6xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
8888
struct msm_gpu_state *a6xx_gpu_state_get(struct msm_gpu *gpu);
8989
int a6xx_gpu_state_put(struct msm_gpu_state *state);
9090

91+
void a6xx_bus_clear_pending_transactions(struct adreno_gpu *adreno_gpu, bool gx_off);
92+
9193
#endif /* __A6XX_GPU_H__ */

0 commit comments

Comments
 (0)