Skip to contentSkip to conversation

volt: Improve min/max deteaction of range based volting

PATCH In review Karol Herbst 3 participants 4 messages Apr 22, 2017 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 volt: Improve min/max deteaction of range based volting

info.min and info.max doesn't always represent the actual voltage range we can use. Do the same as with the entry based volting.

Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors in sensors.

---
 drm/nouveau/nvkm/subdev/volt/base.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drm/nouveau/nvkm/subdev/volt/base.c +4 -2
index e344901c..61b29c7a 100644
@@ -195,14 +195,16 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt)
 	data = nvbios_volt_parse(bios, &ver, &hdr, &cnt, &len, &info);
 	if (data && info.vidmask && info.base && info.step && info.ranged) {
 		nvkm_debug(subdev, "found ranged based VIDs\n");
-		volt->min_uv = info.min;
-		volt->max_uv = info.max;
+		volt->min_uv = 0xffffffff;
+		volt->max_uv = 0;
 		for (i = 0; i < info.vidmask + 1; i++) {
 			if (info.base >= info.min &&
 				info.base <= info.max) {
 				volt->vid[volt->vid_nr].uv = info.base;
 				volt->vid[volt->vid_nr].vid = i;
 				volt->vid_nr++;
+				volt->min_uv = min(volt->min_uv, info.base);
+				volt->max_uv = max(volt->max_uv, info.base);
 			}
 			info.base += info.step;
 		}
Signature · 6 lines
2.12.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Reviewed-by
#2 lore raw
In reply to a message not in the archive

deteaction -> detection

Quoted 25 lines · Karol Herbst

info.min and info.max doesn't always represent the actual voltage range we can use. Do the same as with the entry based volting.

Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors in sensors.

---
  drm/nouveau/nvkm/subdev/volt/base.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drm/nouveau/nvkm/subdev/volt/base.c +2 -2
index e344901c..61b29c7a 100644
@@ -195,14 +195,16 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt)
  	data = nvbios_volt_parse(bios, &ver, &hdr, &cnt, &len, &info);
  	if (data && info.vidmask && info.base && info.step && info.ranged) {
  		nvkm_debug(subdev, "found ranged based VIDs\n");
-		volt->min_uv = info.min;
-		volt->max_uv = info.max;
+		volt->min_uv = 0xffffffff;
+		volt->max_uv = 0;
  		for (i = 0; i < info.vidmask + 1; i++) {

drm/nouveau/nvkm/subdev/volt/base.c nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt) · line 210

Quoted 10 lines
drm/nouveau/nvkm/subdev/volt/base.c +2 -0
  			if (info.base >= info.min &&
  				info.base <= info.max) {
  				volt->vid[volt->vid_nr].uv = info.base;
  				volt->vid[volt->vid_nr].vid = i;
  				volt->vid_nr++;
+				volt->min_uv = min(volt->min_uv, info.base);
+				volt->max_uv = max(volt->max_uv, info.base);
  			}
  			info.base += info.step;
  		}

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw
In reply to a message not in the archive

Response in-line:

Op 22-04-17 om 13:22 schreef Karol Herbst:

Quoted 16 lines

info.min and info.max doesn't always represent the actual voltage range we can use. Do the same as with the entry based volting.

Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors in sensors.

---
  drm/nouveau/nvkm/subdev/volt/base.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drm/nouveau/nvkm/subdev/volt/base.c +0 -0
index e344901c..61b29c7a 100644

drm/nouveau/nvkm/subdev/volt/base.c nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt) · line 202

Quoted 10 lines
drm/nouveau/nvkm/subdev/volt/base.c +2 -2
@@ -195,14 +195,16 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt)
  	data = nvbios_volt_parse(bios, &ver, &hdr, &cnt, &len, &info);
  	if (data && info.vidmask && info.base && info.step && info.ranged) {
  		nvkm_debug(subdev, "found ranged based VIDs\n");
-		volt->min_uv = info.min;
-		volt->max_uv = info.max;
+		volt->min_uv = 0xffffffff;
+		volt->max_uv = 0;
  		for (i = 0; i < info.vidmask + 1; i++) {
  			if (info.base >= info.min &&
  				info.base <= info.max) {

How bogus are info.min and info.max when you get that error? Is this if-statement still valid?

drm/nouveau/nvkm/subdev/volt/base.c nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt) · line 210

Quoted 8 lines
drm/nouveau/nvkm/subdev/volt/base.c +2 -0
  				volt->vid[volt->vid_nr].uv = info.base;
  				volt->vid[volt->vid_nr].vid = i;
  				volt->vid_nr++;
+				volt->min_uv = min(volt->min_uv, info.base);
+				volt->max_uv = max(volt->max_uv, info.base);
  			}
  			info.base += info.step;
  		}

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#5 lore raw
In reply to a message not in the archive

2017-04-22 16:46 GMT+02:00 Roy Spliet <[email protected]>:

Quoted 29 lines

Response in-line:

Op 22-04-17 om 13:22 schreef Karol Herbst:

Quoted 25 lines

info.min and info.max doesn't always represent the actual voltage range we can use. Do the same as with the entry based volting.

Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors in sensors.

---
  drm/nouveau/nvkm/subdev/volt/base.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drm/nouveau/nvkm/subdev/volt/base.c +0 -2
index e344901c..61b29c7a 100644
@@ -195,14 +195,16 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct
 nvkm_volt *volt)
        data = nvbios_volt_parse(bios, &ver, &hdr, &cnt, &len, &info);
        if (data && info.vidmask && info.base && info.step && info.ranged)
 {
                nvkm_debug(subdev, "found ranged based VIDs\n");
-               volt->min_uv = info.min;
-               volt->max_uv = info.max;
Quoted 8 lines

drm/nouveau/nvkm/subdev/volt/base.c nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt) · line 202

Quoted 5 lines
drm/nouveau/nvkm/subdev/volt/base.c +2 -0
+               volt->min_uv = 0xffffffff;
+               volt->max_uv = 0;
                for (i = 0; i < info.vidmask + 1; i++) {
                        if (info.base >= info.min &&
                                info.base <= info.max) {

How bogus are info.min and info.max when you get that error? Is this if-statement still valid?

info.min is set to 0. and info.max to the base value. The vbios parsing is also a little incomplete, which I could fix instead as well.

Let me hack something up.

Quoted 13 lines
Quoted 11 lines
drm/nouveau/nvkm/subdev/volt/base.c +2 -0
                                volt->vid[volt->vid_nr].uv = info.base;
                                volt->vid[volt->vid_nr].vid = i;
                                volt->vid_nr++;
+                               volt->min_uv = min(volt->min_uv,
 info.base);
+                               volt->max_uv = max(volt->max_uv,
info.base);
                        }
                        info.base += info.step;
                }

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau