firmware: coreboot: Don't register a pdev if screen_info data is present
PATCH v2 1/1 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.
---
Changes in v2:
- Declare the struct screen_info as constant variable (Thomas Zimmermann).
- Use screen_info_video_type() instead of checking the screen_info video types directly (Thomas Zimmermann).
- Fix missing "device" word in a comment (Brian Norris).
- Fix some mispellings in a comment (Brian Norris).
- Change error code returned from -EINVAL to -ENODEV (Brian Norris).
drivers/firmware/google/framebuffer-coreboot.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/firmware/google/framebuffer-coreboot.c +17 -0
@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> +#include <linux/screen_info.h> #include "coreboot_table.h"
@@ -27,8 +28,10 @@ static int framebuffer_probe(struct coreboot_device *dev)int i;u32 length;struct lb_framebuffer *fb = &dev->framebuffer; +const struct screen_info *si = &screen_info;struct platform_device *pdev;struct resource res; +unsigned int type;struct simplefb_platform_data pdata = { .width = fb->x_resolution, .height = fb->y_resolution,
@@ -36,6 +39,20 @@ static int framebuffer_probe(struct coreboot_device *dev) .format = NULL, }; +/* +* On Coreboot systems, the advertised LB_TAG_FRAMEBUFFER entry +* in the Coreboot table should only be used if the payload did +* not pass a framebuffer information to the Linux kernel. +* +* If the global screen_info data has been filled, the Generic +* System Framebuffers (sysfb) will already register a platform +* device and pass that screen_info as platform_data to a driver +* that can scan-out using the system provided framebuffer. +*/ + type =screen_info_video_type (si); +if (type) +return -ENODEV ; +if (!fb->physical_address)return -ENODEV ;
Signature · 1 line
2.46.0
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for firmware: coreboot: Don't register a pdev if screen_info data is present
== Series Details ==
== Series Details ==
Series: firmware: coreboot: Don't register a pdev if screen_info data is present
URL : https://patchwork.freedesktop.org/series/138665/
State : warning
== Summary ==
Error: dim checkpatch failedcaff745aae47 firmware: coreboot: Don't register a pdev if screen_info data is present
-:21: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #21:
sysfs: cannot create duplicate filename '/bus/platform/devices/simple-framebuffer.0'
total: 0 errors, 1 warnings, 0 checks, 37 lines checked
Patchwork
CI✓ Fi.CI.BAT: success for firmware: coreboot: Don't register a pdev if screen_info data is present
In reply to Javier Martinez Canillas== Series Details ==
== Series Details ==
Series: firmware: coreboot: Don't register a pdev if screen_info data is present
URL : https://patchwork.freedesktop.org/series/138665/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_15417 -> Patchwork_138665v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/index.html
Participating hosts (42 -> 38)
------------------------------
Missing (4): fi-kbl-7567u bat-dg2-11 bat-arlh-2 fi-snb-2520m
Known issues
------------
Here are the changes found in Patchwork_138665v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@debugfs_test@basic-hwmon:
- bat-mtlp-6: NOTRUN -> [SKIP][1] ([i915#9318])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@fbdev@info:
- bat-mtlp-6: NOTRUN -> [SKIP][2] ([i915#1849] / [i915#2582])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@fbdev@write:
- bat-mtlp-6: NOTRUN -> [SKIP][3] ([i915#2582]) +3 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@gem_lmem_swapping@verify-random:
- bat-mtlp-6: NOTRUN -> [SKIP][4] ([i915#4613]) +3 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@gem_mmap@basic:
- bat-mtlp-6: NOTRUN -> [SKIP][5] ([i915#4083])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@gem_tiled_blits@basic:
- bat-mtlp-6: NOTRUN -> [SKIP][6] ([i915#4077]) +2 other tests skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@gem_tiled_pread_basic:
- bat-mtlp-6: NOTRUN -> [SKIP][7] ([i915#4079]) +1 other test skip
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@gem_tiled_pread_basic.html
* igt@i915_pm_rps@basic-api:
- bat-mtlp-6: NOTRUN -> [SKIP][8] ([i915#11681] / [i915#6621])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_addfb_basic@addfb25-x-tiled-legacy:
- bat-mtlp-6: NOTRUN -> [SKIP][9] ([i915#4212] / [i915#9792]) +8 other tests skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-mtlp-6: NOTRUN -> [SKIP][10] ([i915#5190] / [i915#9792])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_cursor_legacy@basic-flip-after-cursor-legacy:
- bat-mtlp-6: NOTRUN -> [SKIP][11] ([i915#9792]) +17 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_flip@basic-flip-vs-dpms:
- bat-mtlp-6: NOTRUN -> [SKIP][12] ([i915#3637] / [i915#9792]) +3 other tests skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_force_connector_basic@prune-stale-modes:
- bat-mtlp-6: NOTRUN -> [SKIP][13] ([i915#5274] / [i915#9792])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_frontbuffer_tracking@basic:
- bat-mtlp-6: NOTRUN -> [SKIP][14] ([i915#4342] / [i915#5354] / [i915#9792])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_pm_backlight@basic-brightness:
- bat-mtlp-6: NOTRUN -> [SKIP][15] ([i915#5354] / [i915#9792])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_psr@psr-cursor-plane-move:
- bat-mtlp-6: NOTRUN -> [SKIP][16] ([i915#1072] / [i915#9673] / [i915#9732] / [i915#9792]) +3 other tests skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@kms_setmode@basic-clone-single-crtc:
- bat-mtlp-6: NOTRUN -> [SKIP][17] ([i915#3555] / [i915#8809] / [i915#9792])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@prime_vgem@basic-fence-flip:
- bat-mtlp-6: NOTRUN -> [SKIP][18] ([i915#3708] / [i915#9792])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@prime_vgem@basic-fence-mmap:
- bat-mtlp-6: NOTRUN -> [SKIP][19] ([i915#3708] / [i915#4077]) +1 other test skip
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@prime_vgem@basic-read:
- bat-mtlp-6: NOTRUN -> [SKIP][20] ([i915#3708]) +1 other test skip
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
* igt@prime_vgem@basic-write:
- bat-mtlp-6: NOTRUN -> [SKIP][21] ([i915#10216] / [i915#3708])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-mtlp-6/igt@[email protected]
#### Possible fixes ####
* igt@kms_pipe_crc_basic@nonblocking-crc:
- bat-arls-5: [INCOMPLETE][22] ([i915#11320]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15417/bat-arls-5/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-arls-5/igt@[email protected]
#### Warnings ####
* igt@i915_module_load@load:
- bat-apl-1: [DMESG-WARN][24] ([i915#180] / [i915#1982]) -> [DMESG-WARN][25] ([i915#180])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15417/bat-apl-1/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-apl-1/igt@[email protected]
* igt@i915_module_load@reload:
- bat-apl-1: [DMESG-WARN][26] ([i915#180]) -> [DMESG-WARN][27] ([i915#180] / [i915#1982])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15417/bat-apl-1/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/bat-apl-1/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#10216]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10216
[i915#10341]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10341
[i915#1072]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1072
[i915#11320]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11320
[i915#11681]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11681
[i915#11981]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11981
[i915#12133]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12133
[i915#180]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/180
[i915#1849]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1849
[i915#1982]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1982
[i915#2582]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/2582
[i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3637
[i915#3708]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4083
[i915#4212]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4212
[i915#4342]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4342
[i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
[i915#5190]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
[i915#6621]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/6621
[i915#8809]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/8809
[i915#9318]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9318
[i915#9673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9673
[i915#9732]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9732
[i915#9792]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9792
Build changes
-------------
* Linux: CI_DRM_15417 -> Patchwork_138665v1
CI-20190529: 20190529
CI_DRM_15417: 8839c645d7a7d76cbee6f4807984dbd6c77eb543 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8018: 04e0fe37d4ce8d2fb05a157b4fdb972b90d6ac6b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_138665v1: 8839c645d7a7d76cbee6f4807984dbd6c77eb543 @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138665v1/index.html
drivers/firmware/google/framebuffer-coreboot.c static int framebuffer_probe(struct coreboot_device *dev) · line 45
Quoted 4 lines
drivers/firmware/google/framebuffer-coreboot.c +4
-0+/* +* On Coreboot systems, the advertised LB_TAG_FRAMEBUFFER entry +* in the Coreboot table should only be used if the payload did +* not pass a framebuffer information to the Linux kernel.
nit: The official brand spelling is "coreboot", always lowercase (even at the start of a sentence). Not a big deal though.