Skip to content

Commit 67f488d

Browse files
martinezjavierTzung-Bi Shih
authored andcommitted
firmware: coreboot: Don't register a pdev if screen_info data is present
On coreboot platforms, a system framebuffer may be provided to the Linux kernel by filling a LB_TAG_FRAMEBUFFER entry in the coreboot table. But a coreboot payload (e.g: SeaBIOS) could also provide its own framebuffer information to the Linux kernel. If that's the case, arch x86 boot code will fill the global screen_info data and this used by the Generic System Framebuffers (sysfb) framework, to register a platform device with pdata about the system's framebuffer. But later, the framebuffer_coreboot driver will try to do the same and attempt to register a "simple-framebuffer" platform device (using the information from the coreboot table), which will lead to an error due a device with the same name already being registered: sysfs: cannot create duplicate filename '/bus/platform/devices/simple-framebuffer.0' ... coreboot: could not register framebuffer framebuffer coreboot8: probe with driver framebuffer failed with error -17 To prevent this issue, make the framebuffer_core driver to not register a platform device if the global struct screen_info data has been filled. Reported-by: Brian Norris <briannorris@chromium.org> Closes: https://lore.kernel.org/all/ZuCG-DggNThuF4pj@b20ea791c01f/T/#ma7fb65acbc1a56042258adac910992bb225a20d2 Suggested-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Link: https://lore.kernel.org/r/20240916110040.1688511-3-javierm@redhat.com Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
1 parent 6074e90 commit 67f488d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/firmware/google/framebuffer-coreboot.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/platform_data/simplefb.h>
1717
#include <linux/platform_device.h>
18+
#include <linux/sysfb.h>
1819

1920
#include "coreboot_table.h"
2021

@@ -36,6 +37,19 @@ static int framebuffer_probe(struct coreboot_device *dev)
3637
.format = NULL,
3738
};
3839

40+
/*
41+
* On coreboot systems, the advertised LB_TAG_FRAMEBUFFER entry
42+
* in the coreboot table should only be used if the payload did
43+
* not pass a framebuffer information to the Linux kernel.
44+
*
45+
* If the global screen_info data has been filled, the Generic
46+
* System Framebuffers (sysfb) will already register a platform
47+
* device and pass that screen_info as platform_data to a driver
48+
* that can scan-out using the system provided framebuffer.
49+
*/
50+
if (sysfb_handles_screen_info())
51+
return -ENODEV;
52+
3953
if (!fb->physical_address)
4054
return -ENODEV;
4155

0 commit comments

Comments
 (0)