Skip to contentSkip to conversation

nv30: Fix parsing of perf table

PATCH In review Emil Velikov 2 participants 4 messages Mar 18, 2011 – Mar 19, 2011 2 messages not in the archive

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

PATCH 1/1 nv30: Fix parsing of perf table

Perf tables v 1.2 and 1.3 (seen on Geforce FX / 5) are not long enough to store the voltage label/id

---
 drivers/gpu/drm/nouveau/nouveau_perf.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_perf.c +5 -1
index ac62a1b..b09780b 100644
@@ -134,7 +134,11 @@ nouveau_perf_init(struct drm_device *dev)
 		case 0x13:
 		case 0x15:
 			perflvl->fanspeed = entry[55];
-			perflvl->voltage = entry[56];
+/*
+ * Table v 1.2 and 1.3 does not have big enough recordlen to store the
+ * voltage
+ */
+			perflvl->voltage = (recordlen > 56) ? entry[56] : 0;
 			perflvl->core = ROM32(entry[1]) * 10;
 			perflvl->memory = ROM32(entry[5]) * 20;
 			break;
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1300409184-6853-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 13 lines · Emil Velikov

Perf tables v 1.2 and 1.3 (seen on Geforce FX / 5) are not long enough to store the voltage label/id

---
 drivers/gpu/drm/nouveau/nouveau_perf.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_perf.c +0 -0
index ac62a1b..b09780b 100644

drivers/gpu/drm/nouveau/nouveau_perf.c nouveau_perf_init(struct drm_device *dev) · line 140

Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_perf.c +4 -1
@@ -134,7 +134,11 @@ nouveau_perf_init(struct drm_device *dev)
 		case 0x13:
 		case 0x15:
 			perflvl->fanspeed = entry[55];
-			perflvl->voltage = entry[56];
+/*
+ * Table v 1.2 and 1.3 does not have big enough recordlen to store the
+ * voltage
+ */

I'm not sure the comment is 100% necessary, but, it should be indented to the same level as the perflvl->* member settings.

Quoted 4 lines
drivers/gpu/drm/nouveau/nouveau_perf.c +1 -0
+			perflvl->voltage = (recordlen > 56) ? entry[56] : 0;
 			perflvl->core = ROM32(entry[1]) * 10;
 			perflvl->memory = ROM32(entry[5]) * 20;
 			break;
#3 lore raw

PATCH 1/1 nv30: Fix parsing of perf table

Perf tables v 1.2 and 1.3 (seen on Geforce FX/ 5) are not long enough to store the voltage label/id

v2 - Remove comment from the code

---
 drivers/gpu/drm/nouveau/nouveau_perf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_perf.c +1 -1
index ac62a1b..670e3cb 100644
@@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev)
 		case 0x13:
 		case 0x15:
 			perflvl->fanspeed = entry[55];
-			perflvl->voltage = entry[56];
+			perflvl->voltage = (recordlen > 56) ? entry[56] : 0;
 			perflvl->core = ROM32(entry[1]) * 10;
 			perflvl->memory = ROM32(entry[5]) * 20;
 			break;
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1300479593-15388-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw
Quoted 3 lines · Emil Velikov

Perf tables v 1.2 and 1.3 (seen on Geforce FX/ 5) are not long enough to store the voltage label/id

v2 - Remove comment from the code

Thank you :)

Pushed, with the log message line split to fit into 80 chars.

Ben.

Quoted 19 lines
---
 drivers/gpu/drm/nouveau/nouveau_perf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_perf.c +1 -1
index ac62a1b..670e3cb 100644
@@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev)
 		case 0x13:
 		case 0x15:
 			perflvl->fanspeed = entry[55];
-			perflvl->voltage = entry[56];
+			perflvl->voltage = (recordlen > 56) ? entry[56] : 0;
 			perflvl->core = ROM32(entry[1]) * 10;
 			perflvl->memory = ROM32(entry[5]) * 20;
 			break;