Skip to content

Commit ca04ce7

Browse files
akhilpo-qcomRob Clark
authored andcommitted
drm/msm/a6xx: Improve MX rail fallback in RPMH vote init
Current logic assumes that the voltage corners in both MxG and MxA are always same. This is not true for recent targets. So, rework the rpmh init sequence to probe and calculate the votes with the respective rails, ie, GX rails should use MxG as secondary rail and Cx rail should use MxA as the secondary rail. Fixes: d6225e0 ("drm/msm/adreno: Add support for X185 GPU") Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/689014/ Message-ID: <20251118-kaana-gpu-support-v4-12-86eeb8e93fb6@oss.qualcomm.com> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
1 parent 50e8a55 commit ca04ce7

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,13 +1544,14 @@ static unsigned int a6xx_gmu_get_arc_level(struct device *dev,
15441544
}
15451545

15461546
static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
1547-
unsigned long *freqs, int freqs_count, const char *id)
1547+
unsigned long *freqs, int freqs_count,
1548+
const char *pri_id, const char *sec_id)
15481549
{
15491550
int i, j;
15501551
const u16 *pri, *sec;
15511552
size_t pri_count, sec_count;
15521553

1553-
pri = cmd_db_read_aux_data(id, &pri_count);
1554+
pri = cmd_db_read_aux_data(pri_id, &pri_count);
15541555
if (IS_ERR(pri))
15551556
return PTR_ERR(pri);
15561557
/*
@@ -1561,13 +1562,7 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
15611562
if (!pri_count)
15621563
return -EINVAL;
15631564

1564-
/*
1565-
* Some targets have a separate gfx mxc rail. So try to read that first and then fall back
1566-
* to regular mx rail if it is missing
1567-
*/
1568-
sec = cmd_db_read_aux_data("gmxc.lvl", &sec_count);
1569-
if (IS_ERR(sec) && sec != ERR_PTR(-EPROBE_DEFER))
1570-
sec = cmd_db_read_aux_data("mx.lvl", &sec_count);
1565+
sec = cmd_db_read_aux_data(sec_id, &sec_count);
15711566
if (IS_ERR(sec))
15721567
return PTR_ERR(sec);
15731568

@@ -1635,15 +1630,24 @@ static int a6xx_gmu_rpmh_votes_init(struct a6xx_gmu *gmu)
16351630
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
16361631
const struct a6xx_info *info = adreno_gpu->info->a6xx;
16371632
struct msm_gpu *gpu = &adreno_gpu->base;
1633+
const char *sec_id;
1634+
const u16 *gmxc;
16381635
int ret;
16391636

1637+
gmxc = cmd_db_read_aux_data("gmxc.lvl", NULL);
1638+
if (gmxc == ERR_PTR(-EPROBE_DEFER))
1639+
return -EPROBE_DEFER;
1640+
1641+
/* If GMxC is present, prefer that as secondary rail for GX votes */
1642+
sec_id = IS_ERR_OR_NULL(gmxc) ? "mx.lvl" : "gmxc.lvl";
1643+
16401644
/* Build the GX votes */
16411645
ret = a6xx_gmu_rpmh_arc_votes_init(&gpu->pdev->dev, gmu->gx_arc_votes,
1642-
gmu->gpu_freqs, gmu->nr_gpu_freqs, "gfx.lvl");
1646+
gmu->gpu_freqs, gmu->nr_gpu_freqs, "gfx.lvl", sec_id);
16431647

16441648
/* Build the CX votes */
16451649
ret |= a6xx_gmu_rpmh_arc_votes_init(gmu->dev, gmu->cx_arc_votes,
1646-
gmu->gmu_freqs, gmu->nr_gmu_freqs, "cx.lvl");
1650+
gmu->gmu_freqs, gmu->nr_gmu_freqs, "cx.lvl", "mx.lvl");
16471651

16481652
/* Build the interconnect votes */
16491653
if (info->bcms && gmu->nr_gpu_bws > 1)

0 commit comments

Comments
 (0)