Skip to contentSkip to conversation

video: arm: rpi: Avoid crash without HDMI monitor connected

PATCH New Andre Przywara 2 participants 3 messages Jul 26, 2019 – Jul 29, 2019 1 message not in the archive

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

PATCH 1/1 video: arm: rpi: Avoid crash without HDMI monitor connected

Before we use random pointers that bcm2835_set_video_params() is supposed to populate, we should check its return value, which could indicate that the function bailed out early. This happend when there is no monitor connected.

That fixes a horrible crash when just booting with a serial console.

---
Hi,

I saw this on the RPi4 (with Andrei's v2 series), but it looks like this would happen on the other boards as well.

Cheers,
Andre.

 drivers/video/bcm2835.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/bcm2835.c +2 -0
index bc41090aed..4188a94cba 100644
@@ -26,6 +26,8 @@ static int bcm2835_video_probe(struct udevice *dev)
 	ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
 				       BCM2835_MBOX_ALPHA_MODE_IGNORED,
 				       &fb_base, &fb_size, &pitch);
+	if (ret)
+		return ret;
 
 	debug("bcm2835: Final resolution is %d x %d\n", w, h);
 
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 video: arm: rpi: Avoid crash without HDMI monitor connected

Quoted 6 lines · On Fri, 26 Jul 2019 13:35:26 +0000 Matthias Brugger <[email protected]> wrote:
Quoted 5 lines · Andre Przywara

Before we use random pointers that bcm2835_set_video_params() is supposed to populate, we should check its return value, which could indicate that the function bailed out early. This happend when there is no monitor connected.

Quoted 6 lines
Quoted 1 line

That fixes a horrible crash when just booting with a serial console.

Can you test this patch?
https://patchwork.ozlabs.org/patch/1130837/

It should fix your issue.

Yes, of course it does. Sorry that I missed that email, just replied to that as well.

Quoted 1 line

By the way which version of the FW do you use?

Some older one, I guess. I downloaded some image on the day the board was announced.

Btw: I run this with ATF as armstub8.bin, which gives me PSCI, errata fixes and the ability to tweak the DT:
https://github.com/Andre-ARM/arm-trusted-firmware/commits/rpi4
That works with the kernel or U-Boot as kernel8.img.
The upstreaming discussion is happening on the official Gerrit (yikes!) server:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/1629

Cheers,
Andre

Quoted 27 lines
Quoted 27 lines

---
Hi,

I saw this on the RPi4 (with Andrei's v2 series), but it looks like this would happen on the other boards as well.

Cheers,
Andre.

 drivers/video/bcm2835.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/bcm2835.c +2 -0
index bc41090aed..4188a94cba 100644
@@ -26,6 +26,8 @@ static int bcm2835_video_probe(struct udevice *dev)
 	ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
 				       BCM2835_MBOX_ALPHA_MODE_IGNORED,
 				       &fb_base, &fb_size, &pitch);
+	if (ret)
+		return ret;
 
 	debug("bcm2835: Final resolution is %d x %d\n", w, h);