[Nouveau] [PATCH v4 05/37] clk: don't create cstates whit voltages higher than what the gpu can do

Karol Herbst nouveau at karolherbst.de
Mon Apr 18 19:13:39 UTC 2016


Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
Reviewed-by: Martin Peres <martin.peres at free.fr>
Tested-by: Pierre Moreau <pierre.morrow at free.fr>
---
 drm/nouveau/nvkm/subdev/clk/base.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index 7102c25..763e1bf 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -138,6 +138,7 @@ static int
 nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
 {
 	struct nvkm_bios *bios = clk->subdev.device->bios;
+	struct nvkm_volt *volt = clk->subdev.device->volt;
 	const struct nvkm_domain *domain = clk->domains;
 	struct nvkm_cstate *cstate = NULL;
 	struct nvbios_cstepX cstepX;
@@ -148,6 +149,9 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
 	if (!data)
 		return -ENOENT;
 
+	if (volt && nvkm_volt_map_min(volt, cstepX.voltage) > volt->max_uv)
+		return -EINVAL;
+
 	cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
 	if (!cstate)
 		return -ENOMEM;
-- 
2.8.1



More information about the Nouveau mailing list