Skip to contentSkip to conversation

Revert "drm/i915: Allow parsing of variable size child device entries from VBT"

PATCH In review Jani Nikula 4 participants 9 messages Aug 18, 2015 – Aug 19, 2015

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

PATCH 1/1 Revert "drm/i915: Allow parsing of variable size child device entries from VBT"

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -23
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 	const union child_device_config *p_child;
 	union child_device_config *child_dev_ptr;
 	int i, child_device_num, count;
-	u8 expected_size;
-	u16 block_size;
+	u16	block_size;
 
 	p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
 	if (!p_defs) {
 		DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
 		return;
 	}
-	if (bdb->version < 195) {
-		expected_size = 33;
-	} else if (bdb->version == 195) {
-		expected_size = 37;
-	} else if (bdb->version <= 197) {
-		expected_size = 38;
-	} else {
-		expected_size = 38;
-		DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-				 expected_size, bdb->version);
-	}
-
-	if (expected_size > sizeof(*p_child)) {
-		DRM_ERROR("child_device_config cannot fit in p_child\n");
-		return;
-	}
-
-	if (p_defs->child_dev_size != expected_size) {
-		DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-			  p_defs->child_dev_size, expected_size, bdb->version);
+	if (p_defs->child_dev_size < sizeof(*p_child)) {
+		DRM_ERROR("General definiton block child device size is too small.\n");
 		return;
 	}
 	/* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
 		child_dev_ptr = dev_priv->vbt.child_dev + count;
 		count++;
-		memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+		memcpy(child_dev_ptr, p_child, sizeof(*p_child));
 	}
 	return;
 }
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Quoted 5 lines
Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>
Quoted 65 lines

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -23
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 	const union child_device_config *p_child;
 	union child_device_config *child_dev_ptr;
 	int i, child_device_num, count;
-	u8 expected_size;
-	u16 block_size;
+	u16	block_size;
 
 	p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
 	if (!p_defs) {
 		DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
 		return;
 	}
-	if (bdb->version < 195) {
-		expected_size = 33;
-	} else if (bdb->version == 195) {
-		expected_size = 37;
-	} else if (bdb->version <= 197) {
-		expected_size = 38;
-	} else {
-		expected_size = 38;
-		DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-				 expected_size, bdb->version);
-	}
-
-	if (expected_size > sizeof(*p_child)) {
-		DRM_ERROR("child_device_config cannot fit in p_child\n");
-		return;
-	}
-
-	if (p_defs->child_dev_size != expected_size) {
-		DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-			  p_defs->child_dev_size, expected_size, bdb->version);
+	if (p_defs->child_dev_size < sizeof(*p_child)) {
+		DRM_ERROR("General definiton block child device size is too small.\n");
 		return;
 	}
 	/* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
 		child_dev_ptr = dev_priv->vbt.child_dev + count;
 		count++;
-		memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+		memcpy(child_dev_ptr, p_child, sizeof(*p_child));
 	}
 	return;
 }
Signature · 1 line
2.1.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
In reply to Jani Nikula
Quoted 10 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to. If you want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?
-Daniel

Quoted 77 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300
Quoted 7 lines
Quoted 4 lines

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to.

What regression?

Quoted 91 lines

If you
want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?
-Daniel

Quoted 77 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 10 lines · Ville Syrjälä
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to.

What regression?

Quoting the commit message: "... since we're hitting a DRM_ERROR on older platforms with this." Not every platform has the BSW vbt layout ;-) Oh and why do I even bother to write this stuff when no one reads it?
-Daniel

Quoted 95 lines
Quoted 83 lines

If you
want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?
-Daniel

Quoted 76 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Quoted 8 lines
Quoted 1 line

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Ville Syrjälä
Intel OTC

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Ville Syrjälä
Quoted 14 lines · Daniel Vetter
Quoted 10 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to.

Quoted 6 lines
Quoted 1 line

What regression?

Quoting the commit message: "... since we're hitting a DRM_ERROR on older platforms with this." Not every platform has the BSW vbt layout ;-) Oh and why do I even bother to write this stuff when no one reads it?

I read it, and I think it's wrong. I even explained why in my commit message (yes, please read it). I don't think there was a DRM_ERROR on older platform with Ville's patch, on v4.2 where the revert is targeted, and even if there were, David's patch would *not* fix it. Indeed there was no discussion of a regression on the mailing list.

If there was any regression, it was introduced by

commit 75067ddecf21271631bc018d2fb23ddd09b66aae

Author: Antti Koskipaa <[email protected]>
Date:   Fri Jul 10 14:10:55 2015 +0300

drm/i915: Per-DDI I_boost override

when the size of union child_device_config changed. But that's headed for v4.3. And we're talking about v4.2, which is getting pretty urgent. We'll have a bit more time to sort out the mess that will land in v4.3 (and I've already sent one patch sorting out SDVO breakage).

BR,
Jani.

Quoted 104 lines

-Daniel

Quoted 95 lines
Quoted 83 lines

If you
want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?
-Daniel

Quoted 76 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Quoted 8 lines
Quoted 1 line

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Ville Syrjälä
Intel OTC

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 38 lines · Jani Nikula
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Ville Syrjälä
Quoted 14 lines · Daniel Vetter
Quoted 10 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to.

Quoted 6 lines
Quoted 1 line

What regression?

Quoting the commit message: "... since we're hitting a DRM_ERROR on older platforms with this." Not every platform has the BSW vbt layout ;-) Oh and why do I even bother to write this stuff when no one reads it?

I read it, and I think it's wrong. I even explained why in my commit message (yes, please read it). I don't think there was a DRM_ERROR on older platform with Ville's patch, on v4.2 where the revert is targeted, and even if there were, David's patch would *not* fix it. Indeed there was no discussion of a regression on the mailing list.

If there was any regression, it was introduced by

commit 75067ddecf21271631bc018d2fb23ddd09b66aae

Author: Antti Koskipaa <[email protected]>
Date:   Fri Jul 10 14:10:55 2015 +0300
Quoted 6 lines

drm/i915: Per-DDI I_boost override

when the size of union child_device_config changed. But that's headed for v4.3. And we're talking about v4.2, which is getting pretty urgent. We'll have a bit more time to sort out the mess that will land in v4.3 (and I've already sent one patch sorting out SDVO breakage).

I'm not waiting with this. I'm taking my chances, pushed to drm-intel-fixes. Thanks for the review.

Note that the commit remains in drm-intel-next-fixes and drm-intel-next-queued, but not in drm-intel-nightly due to this revert. We'll need to clear that up, but for the time being getting v4.2 fixed up is of a higher priority to me.

BR,
Jani.

Quoted 113 lines

BR,
Jani.

Quoted 104 lines

-Daniel

Quoted 95 lines
Quoted 83 lines

If you
want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?
-Daniel

Quoted 76 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Quoted 8 lines
Quoted 1 line

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Ville Syrjälä
Intel OTC

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
In reply to Daniel Vetter
Quoted 12 lines · Daniel Vetter
Quoted 10 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Quoted 6 lines

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to. If you want to revert this, you need to revert more (and with that also break BSW).

Isn't there a more minimal fix we can do for 4.2?

I proposed a very minimal solution just to increase the size of the raw buffer to the maximum of 38 bytes so we could later on parse the correct info.

May not be relevant anymore

https://bugs.freedesktop.org/show_bug.cgi?id=91269

-Mika-

Quoted 69 lines

-Daniel

Quoted 67 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +3 -22
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
Quoted 13 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +1 -2
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 18 lines · Mika Kahola
Quoted 17 lines · Daniel Vetter
Quoted 10 lines · Jani Nikula

This reverts

commit 047fe6e6db9161e69271f56daaafdaf2add023b1

Author: David Weinehall <[email protected]>
Date:   Tue Aug 4 16:55:52 2015 +0300

drm/i915: Allow parsing of variable size child device entries from VBT

That commit is not valid for v4.2, however it will be valid for v4.3. It was simply queued too early.

Nope, this patch from David also incidentally fixes a regression from 90e4f1592bb6e82f6690f0e05a8aadc which is why I merged it to. If you want to revert this, you need to revert more (and with that also break BSW).

Quoted 4 lines
Quoted 1 line

Isn't there a more minimal fix we can do for 4.2?

I proposed a very minimal solution just to increase the size of the raw buffer to the maximum of 38 bytes so we could later on parse the correct info.

That doesn't work because it breaks parse_sdvo_device_mapping(). I've fixed this now in drm-intel-next-fixes to be queued for v4.3, but I do not want to start patching up broken commits at v4.2-rc7 stage.

As I've said, if Ville's commit 90e4f1592bb6 really does break stuff in v4.2 (*), David's commit 047fe6e6db91 does not fix it in v4.2 anyway.

Thus I've applied the revert. It is the minimal fix. v4.2 will be fine. For v4.3 I'll need to make a backmerge from drm-intel-fixes to drm-intel-next-fixes, and we can move on to fixing v4.3.

BR,
Jani.

(*) which I highly doubt in the first place; likely this was seen in -nightly and erroneously attributed as a regression on 90e4f1592bb6.

Quoted 91 lines

May not be relevant anymore

https://bugs.freedesktop.org/show_bug.cgi?id=91269

-Mika-

Quoted 82 lines

-Daniel

Quoted 77 lines

The referenced regressing commit is just fine until the size of struct common_child_dev_config changes, and that won't happen until v4.3. Indeed, the expected size checks here rely on the increased size of the struct, breaking new platforms.

Fixes 047fe6e6db91 ("drm/i915: Allow parsing of variable size child device entries from VBT")
Cc Daniel Vetter <[email protected]>
Cc David Weinehall <[email protected]>
Cc Ville Syrjälä <[email protected]>

---

There was another patch from David increasing the size of the struct [1], but that then regresses sdvo mapping parsing. It's the simplest to just revert and fix this up properly for v4.3.

[1] http://mid.gmane.org/20150813131415.GO6150@boom

---
 drivers/gpu/drm/i915/intel_bios.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +4 -24
index 3dcd59e694db..198fc3c3291b 100644
@@ -1075,34 +1075,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
        const union child_device_config *p_child;
        union child_device_config *child_dev_ptr;
        int i, child_device_num, count;
-       u8 expected_size;
-       u16 block_size;
+       u16     block_size;
 
        p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
        if (!p_defs) {
                DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
                return;
        }
-       if (bdb->version < 195) {
-               expected_size = 33;
-       } else if (bdb->version == 195) {
-               expected_size = 37;
-       } else if (bdb->version <= 197) {
-               expected_size = 38;
-       } else {
-               expected_size = 38;
-               DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
-                                expected_size, bdb->version);
-       }
-
-       if (expected_size > sizeof(*p_child)) {
-               DRM_ERROR("child_device_config cannot fit in p_child\n");
-               return;
-       }
-
-       if (p_defs->child_dev_size != expected_size) {
-               DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
-                         p_defs->child_dev_size, expected_size, bdb->version);
+       if (p_defs->child_dev_size < sizeof(*p_child)) {
+               DRM_ERROR("General definiton block child device size is too small.\n");
                return;
        }
        /* get the block size of general definitions */
@@ -1149,7 +1130,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
                child_dev_ptr = dev_priv->vbt.child_dev + count;
                count++;
-               memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
+               memcpy(child_dev_ptr, p_child, sizeof(*p_child));
        }
        return;
 }
--

2.1.4

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx