aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/core
AgeCommit message (Collapse)AuthorFilesLines
2019-06-12fbdev: Call fbcon_get_requirement directlyDaniel Vetter2-11/+3
Pretty simple case really. v2: Forgot to remove a break; v3: Add static inline to the dummy versions. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: "Steven Rostedt (VMware)" <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Kees Cook <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbcon: Call fbcon_mode_deleted/new_modelist directlyDaniel Vetter2-26/+10
I'm not entirely clear on what new_modelist actually does, it seems exclusively for a sysfs interface. Which in the end does amount to a normal fb_set_par to check the mode, but then takes a different path in both fbmem.c and fbcon.c. I have no idea why these 2 paths are different, but then I also don't really want to find out. So just do the simple conversion to a direct function call. v2: static inline for the dummy versions, I forgot. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Kees Cook <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: directly call fbcon_suspended/resumedDaniel Vetter2-13/+4
With the sh_mobile notifier removed we can just directly call the fbcon code here. v2: Remove now unused local variable. v3: fixup !CONFIG_FRAMEBUFFER_CONSOLE, noticed by kbuild Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Kees Cook <[email protected]> Cc: Konstantin Khorenko <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: unify unlink_framebuffer pathsDaniel Vetter1-27/+20
For some reasons the pm_vt_switch_unregister call was missing from the direct unregister_framebuffer path. Fix this. v2: fbinfo->dev is used to decided whether unlink_framebuffer has been called already. I botched that in v1. Make this all clearer by inlining __unlink_framebuffer. v3: Fix typoe in subject (Maarten). Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Mikulas Patocka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: make unregister/unlink functions not failDaniel Vetter1-50/+23
Except for driver bugs (which we'll catch with a WARN_ON) this is only to report failures of the new driver taking over the console. There's nothing the outgoing driver can do about that, and no one ever bothered to actually look at these return values. So remove them all. v2: fixup unregister_framebuffer in savagefb, fbtft, ivtvfb, and neofb drivers, reported by kbuild. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbcon: call fbcon_fb_bind directlyDaniel Vetter2-22/+9
Also remove the error return value. That's all errors for either driver bugs (trying to unbind something that isn't bound), or errors of the new driver that will take over. There's nothing the outgoing driver can do about this anyway, so switch over to void. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Kees Cook <[email protected]> Cc: Konstantin Khorenko <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: lock_fb_info cannot failDaniel Vetter3-63/+19
Ever since commit c47747fde931c02455683bd00ea43eaa62f35b0e Author: Linus Torvalds <[email protected]> Date: Wed May 11 14:58:34 2011 -0700 fbmem: make read/write/ioctl use the frame buffer at open time fbdev has gained proper refcounting for the fbinfo attached to any open files, which means that the backing driver (stored in fb_info->fbops) cannot untimely disappear anymore. The only thing that can happen is that the entire device just outright disappears and gets unregistered, but file_fb_info does check for that. Except that it's racy - it only checks once at the start of a file_ops, there's no guarantee that the underlying fbdev won't untimely disappear. Aside: A proper way to fix that race is probably to replicate the srcu trickery we've rolled out in drm. But given that this race has existed since forever it's probably not one we need to fix right away. do_unregister_framebuffer also nowhere clears fb_info->fbops, hence the check in lock_fb_info can't possible catch a disappearing fbdev later on. Long story short: Ever since the above commit the fb_info->fbops checks have essentially become dead code. Remove this all. Aside from the file_ops callbacks, and stuff called from there there's only register/unregister code left. If that goes wrong a driver managed to register/unregister a device instance twice or in the wrong order. That's just a driver bug. v2: - fb_mmap had an open-coded version of the fbinfo->fops check, because it doesn't need the fbinfo->lock. Delete that too. - Use the wrapper function in fb_open/release now, since no difference anymore. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: "Noralf Trønnes" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: sysfs files can't disappear before the device is goneDaniel Vetter1-8/+2
Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Rob Clark <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbcon: call fbcon_fb_(un)registered directlyDaniel Vetter2-18/+20
With commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter <[email protected]> Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev we have a static dependency between fbcon and fbdev, and we can replace the indirection through the notifier chain with a function call. v2: Sam Ravnborg noticed that mach-pxa/am200epd.c has a notifier too, and listens to this. ... Looking at the code it seems to wait for some fb to show up, so that it can get the framebuffer base address from the fb_info struct. I suspect his is some firmware fbdev. Then it uses that information to let the real fbdev driver (metronomefb.c by the looks) get at the framebuffer memory. This doesn't looke like it's easy to fix (except by deleting the entire thing, seems untouched since 2008, we might be able to get away with that), so let's just stuff a few #ifdef into fb.h and fbmem.c and cry over them for a bit. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Noralf Trønnes" <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: Peter Rosin <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: [email protected] Cc: Daniel Mack <[email protected]> Cc: Haojian Zhuang <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Konstantin Khorenko <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: Steve Sakoman <[email protected]> Cc: Steve Sakoman <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbcon: Remove fbcon_has_exitedDaniel Vetter1-34/+7
This is unused code since commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter <[email protected]> Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev when fbcon was made a compile-time static dependency of fbdev. We can't exit fbcon anymore without exiting fbdev first, which only works if all fbdev drivers have unloaded already. Hence this is all dead code. v2: I missed that fbcon_exit is also called from con_deinit stuff, and there fbcon_has_exited prevents double-cleanup. But we can fix that by properly resetting con2fb_map[] to all -1, which is used everywhere else to indicate "no fb_info allocate to this console". With that change the double-cleanup (which resulted in a module refcount underflow, among other things) is prevented. Aside: con2fb_map is a signed char, so don't register more than 128 fb_info or hilarity will ensue. v3: CI showed me that I still didn't fully understand what's going on here. The leaked references in con2fb_map have been used upon rebinding the fb console in fbcon_init. It worked because fbdev unregistering still cleaned out con2fb_map, and reset it to info_idx. If the last fbdev driver unregistered, then it also reset info_idx, and unregistered the fbcon driver. Imo that's all a bit fragile, so let's keep the con2fb_map reset to -1, and in fbcon_init pick info_idx if we're starting fresh. That means unbinding and rebinding will cleanse the mapping, but why are you doing that if you want to retain the mapping, so should be fine. Also, I think info_idx == -1 is impossible in fbcon_init - we unregister the fbcon in that case. So catch&warn about that. v4: Drop unecessary assignment - I forgot to delete the first assignment of info in fbcon_init. Cc: Sam Ravnborg <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: "Noralf Trønnes" <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: Konstantin Khorenko <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Kees Cook <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbcon: s/struct display/struct fbcon_display/Daniel Vetter2-40/+40
This was formerly used in fbdev drivers (not sure why, predates most git history), but now it's entirely an fbcon internal thing. Give it a more specific name. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Kees Cook <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Konstantin Khorenko <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Yisheng Xie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-06-12fbdev: locking check for fb_set_suspendDaniel Vetter1-0/+2
Just drive-by, nothing systematic yet. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Manfred Schlaegl <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Kees Cook <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-05-31Merge tag 'spdx-5.2-rc3-1' of ↵Linus Torvalds1-5/+1
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull yet more SPDX updates from Greg KH: "Here is another set of reviewed patches that adds SPDX tags to different kernel files, based on a set of rules that are being used to parse the comments to try to determine that the license of the file is "GPL-2.0-or-later" or "GPL-2.0-only". Only the "obvious" versions of these matches are included here, a number of "non-obvious" variants of text have been found but those have been postponed for later review and analysis. There is also a patch in here to add the proper SPDX header to a bunch of Kbuild files that we have missed in the past due to new files being added and forgetting that Kbuild uses two different file names for Makefiles. This issue was reported by the Kbuild maintainer. These patches have been out for review on the linux-spdx@vger mailing list, and while they were created by automatic tools, they were hand-verified by a bunch of different people, all whom names are on the patches are reviewers" * tag 'spdx-5.2-rc3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (82 commits) treewide: Add SPDX license identifier - Kbuild treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 225 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 224 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 223 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 222 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 221 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 220 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 218 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 217 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 216 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 215 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 214 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 213 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 211 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 210 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 209 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 207 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 203 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 ...
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24vt/fbcon: deinitialize resources in visual_init() after failed memory allocationGrzegorz Halat1-1/+1
After memory allocation failure vc_allocate() doesn't clean up data which has been initialized in visual_init(). In case of fbcon this leads to divide-by-0 in fbcon_init() on next open of the same tty. memory allocation in vc_allocate() may fail here: 1097: vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); on next open() fbcon_init() skips vc_font.data initialization: 1088: if (!p->fontdata) { division by zero in fbcon_init() happens here: 1149: new_cols /= vc->vc_font.width; Additional check is needed in fbcon_deinit() to prevent usage of uninitialized vc_screenbuf: 1251: if (vc->vc_hi_font_mask && vc->vc_screenbuf) 1252: set_vc_hi_font(vc, false); Crash: #6 [ffffc90001eafa60] divide_error at ffffffff81a00be4 [exception RIP: fbcon_init+463] RIP: ffffffff814b860f RSP: ffffc90001eafb18 RFLAGS: 00010246 ... #7 [ffffc90001eafb60] visual_init at ffffffff8154c36e #8 [ffffc90001eafb80] vc_allocate at ffffffff8154f53c #9 [ffffc90001eafbc8] con_install at ffffffff8154f624 ... Signed-off-by: Grzegorz Halat <[email protected]> Reviewed-by: Oleksandr Natalenko <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-06fbcon: Don't reset logo_shown when logo is currently shownAndreas Schwab1-1/+1
When the logo is currently drawn on a virtual console, and the console loglevel is reduced to quiet, logo_shown must be left alone, so that it the scrolling region on that virtual console is properly reset. Fixes: 10993504d647 ("fbcon: Silence fbcon logo on 'quiet' boots") Signed-off-by: Andreas Schwab <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Yisheng Xie <[email protected]> Cc: Kees Cook <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Marko Myllynen <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Thierry Reding <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-04-11fbdev: fix WARNING in __alloc_pages_nodemask bugJiufei Xue1-0/+2
Syzkaller hit 'WARNING in __alloc_pages_nodemask' bug. WARNING: CPU: 1 PID: 1473 at mm/page_alloc.c:4377 __alloc_pages_nodemask+0x4da/0x2130 Kernel panic - not syncing: panic_on_warn set ... Call Trace: alloc_pages_current+0xb1/0x1e0 kmalloc_order+0x1f/0x60 kmalloc_order_trace+0x1d/0x120 fb_alloc_cmap_gfp+0x85/0x2b0 fb_set_user_cmap+0xff/0x370 do_fb_ioctl+0x949/0xa20 fb_ioctl+0xdd/0x120 do_vfs_ioctl+0x186/0x1070 ksys_ioctl+0x89/0xa0 __x64_sys_ioctl+0x74/0xb0 do_syscall_64+0xc8/0x550 entry_SYSCALL_64_after_hwframe+0x49/0xbe This is a warning about order >= MAX_ORDER and the order is from userspace ioctl. Add flag __NOWARN to silence this warning. Signed-off-by: Jiufei Xue <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-04-01fbdev: fix divide error in fb_var_to_videomodeShile Zhang1-0/+3
To fix following divide-by-zero error found by Syzkaller: divide error: 0000 [#1] SMP PTI CPU: 7 PID: 8447 Comm: test Kdump: loaded Not tainted 4.19.24-8.al7.x86_64 #1 Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 RIP: 0010:fb_var_to_videomode+0xae/0xc0 Code: 04 44 03 46 78 03 4e 7c 44 03 46 68 03 4e 70 89 ce d1 ee 69 c0 e8 03 00 00 f6 c2 01 0f 45 ce 83 e2 02 8d 34 09 0f 45 ce 31 d2 <41> f7 f0 31 d2 f7 f1 89 47 08 f3 c3 66 0f 1f 44 00 00 0f 1f 44 00 RSP: 0018:ffffb7e189347bf0 EFLAGS: 00010246 RAX: 00000000e1692410 RBX: ffffb7e189347d60 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffb7e189347c10 RBP: ffff99972a091c00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000100 R13: 0000000000010000 R14: 00007ffd66baf6d0 R15: 0000000000000000 FS: 00007f2054d11740(0000) GS:ffff99972fbc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f205481fd20 CR3: 00000004288a0001 CR4: 00000000001606a0 Call Trace: fb_set_var+0x257/0x390 ? lookup_fast+0xbb/0x2b0 ? fb_open+0xc0/0x140 ? chrdev_open+0xa6/0x1a0 do_fb_ioctl+0x445/0x5a0 do_vfs_ioctl+0x92/0x5f0 ? __alloc_fd+0x3d/0x160 ksys_ioctl+0x60/0x90 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x5b/0x190 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f20548258d7 Code: 44 00 00 48 8b 05 b9 15 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 89 15 2d 00 f7 d8 64 89 01 48 It can be triggered easily with following test code: #include <linux/fb.h> #include <fcntl.h> #include <sys/ioctl.h> int main(void) { struct fb_var_screeninfo var = {.activate = 0x100, .pixclock = 60}; int fd = open("/dev/fb0", O_RDWR); if (fd < 0) return 1; if (ioctl(fd, FBIOPUT_VSCREENINFO, &var)) return 1; return 0; } Signed-off-by: Shile Zhang <[email protected]> Cc: Fredrik Noring <[email protected]> Cc: Daniel Vetter <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-04-01fbdev: list all pci memory bars as conflicting aperturesGerd Hoffmann1-4/+25
Simply add all pci memory bars to struct apertures_struct in remove_conflicting_pci_framebuffers(), without depending on the res_id parameter. The plan is to drop the res_id parameter later on. For now keep the parameter, use it for sanity-checking and warn on inconsistencies. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-02-08video: fbdev: Fix potential NULL pointer dereferenceYueHaibing1-0/+2
There is a potential NULL pointer dereference in case fb_create_modedb() fails and returns NULL. Signed-off-by: YueHaibing <[email protected]> Cc: Kees Cook <[email protected]> Cc: Rob Herring <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-02-08fbcon: Silence fbcon logo on 'quiet' bootsPrarit Bhargava1-1/+7
On text-based systems the 'quiet' boot option will show printk levels higher than CONSOLE_LOGLEVEL_QUIET. The displaying of the Tux logo during boot can cause some consoles to lose display data and as a result confuse the end user. Do not display the Tux logo on systems that are in 'quiet' boot. v2: It helps to commit all my changes before sending them. Remove extra bracket. v3: buildbot error fix: fbcon can be built as part of a module so export console_printk v4: move console_printk change to separate patch, and drop logo cleanup v5: Only set FBCON_LOGO_DONTSHOW for console loglevel Signed-off-by: Prarit Bhargava <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Marko Myllynen <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Kees Cook <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Yisheng Xie <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-02-08fbdev: fbmem: fix memory access if logo is bigger than the screenManfred Schlaegl1-0/+3
There is no clipping on the x or y axis for logos larger that the framebuffer size. Therefore: a logo bigger than screen size leads to invalid memory access: [ 1.254664] Backtrace: [ 1.254728] [<c02714e0>] (cfb_imageblit) from [<c026184c>] (fb_show_logo+0x620/0x684) [ 1.254763] r10:00000003 r9:00027fd8 r8:c6a40000 r7:c6a36e50 r6:00000000 r5:c06b81e4 [ 1.254774] r4:c6a3e800 [ 1.254810] [<c026122c>] (fb_show_logo) from [<c026c1e4>] (fbcon_switch+0x3fc/0x46c) [ 1.254842] r10:c6a3e824 r9:c6a3e800 r8:00000000 r7:c6a0c000 r6:c070b014 r5:c6a3e800 [ 1.254852] r4:c6808c00 [ 1.254889] [<c026bde8>] (fbcon_switch) from [<c029c8f8>] (redraw_screen+0xf0/0x1e8) [ 1.254918] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:c070d5a0 r5:00000080 [ 1.254928] r4:c6808c00 [ 1.254961] [<c029c808>] (redraw_screen) from [<c029d264>] (do_bind_con_driver+0x194/0x2e4) [ 1.254991] r9:00000000 r8:00000000 r7:00000014 r6:c070d5a0 r5:c070d5a0 r4:c070d5a0 So prevent displaying a logo bigger than screen size and avoid invalid memory access. Signed-off-by: Manfred Schlaegl <[email protected]> Signed-off-by: Martin Kepplinger <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-02-08video/fbdev: refactor video= cmdline parsingJani Nikula1-13/+10
Make the video_setup() function slightly easier to read by removing the repeated checks for !global. Remove the misleading return value comment while at it. I'm slightly hesitant to change any of this, but here goes anyway, with hopes that the next person to have to look at this has it a wee bit easier. Signed-off-by: Jani Nikula <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-02-08fbcon: use kvmalloc() for scrollback bufferKonstantin Khorenko1-3/+3
Scrollback frame buffer is rather big - 32K, so it requires 3rd order page, so let's use kvmalloc() instead of ordinary kmalloc() for it. Signed-off-by: Konstantin Khorenko <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2019-01-16fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line optionPeter Rosin2-9/+17
A command line option is much more flexible than a config option and the supporting code is small. Gets rid of #ifdefs in the code too... Suggested-by: Geert Uytterhoeven <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Peter Rosin <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-12-20fbdev: fbcon: Fix unregister crash when more than one framebufferNoralf Trønnes1-1/+1
When unregistering fbdev using unregister_framebuffer(), any bound console will unbind automatically. This is working fine if this is the only framebuffer, resulting in a switch to the dummy console. However if there is a fb0 and I unregister fb1 having a bound console, I eventually get a crash. The fastest way for me to trigger the crash is to do a reboot, resulting in this splat: [ 76.478825] WARNING: CPU: 0 PID: 527 at linux/kernel/workqueue.c:1442 __queue_work+0x2d4/0x41c [ 76.478849] Modules linked in: raspberrypi_hwmon gpio_backlight backlight bcm2835_rng rng_core [last unloaded: tinydrm] [ 76.478916] CPU: 0 PID: 527 Comm: systemd-udevd Not tainted 4.20.0-rc4+ #4 [ 76.478933] Hardware name: BCM2835 [ 76.478949] Backtrace: [ 76.478995] [<c010d388>] (dump_backtrace) from [<c010d670>] (show_stack+0x20/0x24) [ 76.479022] r6:00000000 r5:c0bc73be r4:00000000 r3:6fb5bf81 [ 76.479060] [<c010d650>] (show_stack) from [<c08e82f4>] (dump_stack+0x20/0x28) [ 76.479102] [<c08e82d4>] (dump_stack) from [<c0120070>] (__warn+0xec/0x12c) [ 76.479134] [<c011ff84>] (__warn) from [<c01201e4>] (warn_slowpath_null+0x4c/0x58) [ 76.479165] r9:c0eb6944 r8:00000001 r7:c0e927f8 r6:c0bc73be r5:000005a2 r4:c0139e84 [ 76.479197] [<c0120198>] (warn_slowpath_null) from [<c0139e84>] (__queue_work+0x2d4/0x41c) [ 76.479222] r6:d7666a00 r5:c0e918ee r4:dbc4e700 [ 76.479251] [<c0139bb0>] (__queue_work) from [<c013a02c>] (queue_work_on+0x60/0x88) [ 76.479281] r10:c0496bf8 r9:00000100 r8:c0e92ae0 r7:00000001 r6:d9403700 r5:d7666a00 [ 76.479298] r4:20000113 [ 76.479348] [<c0139fcc>] (queue_work_on) from [<c0496c28>] (cursor_timer_handler+0x30/0x54) [ 76.479374] r7:d8a8fabc r6:c0e08088 r5:d8afdc5c r4:d8a8fabc [ 76.479413] [<c0496bf8>] (cursor_timer_handler) from [<c0178744>] (call_timer_fn+0x100/0x230) [ 76.479435] r4:c0e9192f r3:d758a340 [ 76.479465] [<c0178644>] (call_timer_fn) from [<c0178980>] (expire_timers+0x10c/0x12c) [ 76.479495] r10:40000000 r9:c0e9192f r8:c0e92ae0 r7:d8afdccc r6:c0e19280 r5:c0496bf8 [ 76.479513] r4:d8a8fabc [ 76.479541] [<c0178874>] (expire_timers) from [<c0179630>] (run_timer_softirq+0xa8/0x184) [ 76.479570] r9:00000001 r8:c0e19280 r7:00000000 r6:c0e08088 r5:c0e1a3e0 r4:c0e19280 [ 76.479603] [<c0179588>] (run_timer_softirq) from [<c0102404>] (__do_softirq+0x1ac/0x3fc) [ 76.479632] r10:c0e91680 r9:d8afc020 r8:0000000a r7:00000100 r6:00000001 r5:00000002 [ 76.479650] r4:c0eb65ec [ 76.479686] [<c0102258>] (__do_softirq) from [<c0124d10>] (irq_exit+0xe8/0x168) [ 76.479716] r10:d8d1a9b0 r9:d8afc000 r8:00000001 r7:d949c000 r6:00000000 r5:c0e8b3f0 [ 76.479734] r4:00000000 [ 76.479764] [<c0124c28>] (irq_exit) from [<c016b72c>] (__handle_domain_irq+0x94/0xb0) [ 76.479793] [<c016b698>] (__handle_domain_irq) from [<c01021dc>] (bcm2835_handle_irq+0x3c/0x48) [ 76.479823] r8:d8afdebc r7:d8afddfc r6:ffffffff r5:c0e089f8 r4:d8afddc8 r3:d8afddc8 [ 76.479851] [<c01021a0>] (bcm2835_handle_irq) from [<c01019f0>] (__irq_svc+0x70/0x98) The problem is in the console rebinding in fbcon_fb_unbind(). It uses the virtual console index as the new framebuffer index to bind the console(s) to. The correct way is to use the con2fb_map lookup table to find the framebuffer index. Fixes: cfafca8067c6 ("fbdev: fbcon: console unregistration from unregister_framebuffer") Signed-off-by: Noralf Trønnes <[email protected]> Reviewed-by: Mikulas Patocka <[email protected]> Acked-by: Daniel Vetter <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-12-20fbdev: fbmem: add config option to center the bootup logoPeter Rosin1-1/+24
If there are extra logos (CONFIG_FB_LOGO_EXTRA) the heights of these extra logos are not considered when centering the first logo vertically. Signed-off-by: Peter Rosin <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-12-20fbdev: fbmem: make fb_show_logo_line return the end instead of the heightPeter Rosin1-3/+3
In preparation for allowing centering of the bootup logo, make fb_show_logo_line return where the next free framebuffer line is, instead of returning the height of the shown logo. Signed-off-by: Peter Rosin <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-12-20fbdev: fbmem: behave better with small rotated displays and many CPUsPeter Rosin1-2/+6
Blitting an image with "negative" offsets is not working since there is no clipping. It hopefully just crashes. For the bootup logo, there is protection so that blitting does not happen as the image is drawn further and further to the right (ROTATE_UR) or further and further down (ROTATE_CW). There is however no protection when drawing in the opposite directions (ROTATE_UD and ROTATE_CCW). Add back this protection. The regression is 20-odd years old but the mindless warning-killing mentality displayed in commit 34bdb666f4b2 ("fbdev: fbmem: remove positive test on unsigned values") is also to blame, methinks. Fixes: 448d479747b8 ("fbdev: fb_do_show_logo() updates") Signed-off-by: Peter Rosin <[email protected]> Cc: Tomi Valkeinen <[email protected]> Cc: Fabian Frederick <[email protected]> Cc: Geert Uytterhoeven <[email protected]> cc: Geoff Levand <[email protected]> Cc: James Simmons <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-12-20fbdev: make FB_BACKLIGHT a tristateRob Clark1-4/+4
BACKLIGHT_CLASS_DEVICE is already tristate, but a dependency FB_BACKLIGHT prevents it from being built as a module. There doesn't seem to be any particularly good reason for this, so switch FB_BACKLIGHT over to tristate. Signed-off-by: Rob Clark <[email protected]> Tested-by: Arnd Bergmann <[email protected]> Cc: Simon Horman <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Ulf Magnusson <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Hans de Goede <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-10-31Merge tag 'fbdev-v4.20' of https://github.com/bzolnier/linuxLinus Torvalds1-2/+2
Pull fbdev updates from Bartlomiej Zolnierkiewicz: "No major changes to the subsystem itself, mainly fb drivers fixes & cleanups (atyfb & udlfb updates stand out from the rest) + removal of no longer needed old clps711xfb driver. Details: - update atyfb driver - improvements for ATI Mach64 chips: detect the dot clock divider correctly on Sparc, fix display corruptions (due to endianness issues and improper reading of accelerator registers), optimize scrolling performance and also fix debugging printks (Mikulas Patocka) - rewrite USB unplug handling in udlfb driver using framebuffer subsystem reference counting (Mikulas Patocka) - fix support for native-mode display-timings in atmel_lcdfb driver (Sam Ravnborg) - fix information leak & add missing access_ok() checks in sbuslib (Dan Carpenter) - allow using GPIO expanders that can sleep in ssd1307fb driver (Michal Vokáč) - convert omapfb driver to use GPIO descriptors instead of GPIO numbers for Amstrad Delta board (Janusz Krzysztofik) - fix broken Kconfig menu dependencies (Randy Dunlap) - convert fbdev subsystem to use %pOFn instead of device_node.name (Rob Herring) - remove the dead old CLPS711x LCD support driver (the new CLPS711x LCD support driver is still available) - misc fixes (Jia-Ju Bai, Gustavo A. R. Silva) - misc cleanups (Mehdi Bounya, Nathan Chancellor, YueHaibing)" * tag 'fbdev-v4.20' of https://github.com/bzolnier/linux: (22 commits) video: fbdev: remove redundant 'default n' from Kconfig-s video: fbdev: remove dead old CLPS711x LCD support driver Revert "video: ssd1307fb: Do not hard code active-low reset sequence" video: fbdev: arcfb: mark expected switch fall-through pxa168fb: remove set but not used variables 'mi' video: ssd1307fb: Do not hard code active-low reset sequence video: ssd1307fb: Use gpiod_set_value_cansleep() for reset fbdev: fix broken menu dependencies video: fbdev: sis: Remove unnecessary parentheses and commented code video: fbdev: omapfb: lcd_ams_delta: use GPIO lookup table fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper() fbdev: sbuslib: use checked version of put_user() fbdev: Convert to using %pOFn instead of device_node.name atmel_lcdfb: support native-mode display-timings Video: vgastate: fixed a spacing coding style atyfb: fix debugging printks mach64: optimize wait_for_fifo mach64: fix image corruption due to reading accelerator registers mach64: fix display corruption on big endian machines mach64: detect the dot clock divider correctly on sparc ...
2018-10-08fbdev: Convert to using %pOFn instead of device_node.nameRob Herring1-2/+2
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-09-11fbdev: Add FBINFO_HIDE_SMEM_START flagDaniel Vetter1-0/+4
DRM drivers really, really, really don't want random userspace to share buffer behind it's back, bypassing the dma-buf buffer sharing machanism. For that reason we've ruthlessly rejected any IOCTL exposing the physical address of any graphics buffer. Unfortunately fbdev comes with that built-in. We could just set smem_start to 0, but that means we'd have to hand-roll our own fb_mmap implementation. For good reasons many drivers do that, but smem_start/length is still super convenient. Hence instead just stop the leak in the ioctl, to keep fb mmap working as-is. A second patch will set this flag for all drm drivers. Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Kees Cook <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-11vt: Remove vc_panic_force_writeDaniel Vetter1-2/+1
It was only used by the panic support in fbcon, which is now gone. Remove this now dead code too. Acked-by: Greg Kroah-Hartman <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Kees Cook <[email protected]> Cc: Joe Perches <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Meng Xu <[email protected]> Cc: Nicolas Pitre <[email protected]> Cc: Thomas Meyer <[email protected]> Cc: Mike Frysinger <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Thierry Reding <[email protected]> Cc: David Lechner <[email protected]> Cc: Philippe Ombredanne <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Kate Stewart <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-11fbdev: Drop FBINFO_CAN_FORCE_OUTPUT flagDaniel Vetter1-1/+0
This was only added for the drm's fbdev emulation support, so that it would try harder to show the Oops. Unfortunately this never really worked reliably, and in practice ended up pushing the real Oops off the screen due to plentyfull locking, sleep-while-atomic and other issues. So we removed all that support from the fbdev emulation a while back. Aside: We've also removed the kgdb support, for similar reasons. Since it's such a small patch I figured I don't split this up into the usual 3-phase removal. Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Hans de Goede <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Alexander Kapshuk <[email protected]> Cc: Kees Cook <[email protected]> Cc: Thierry Reding <[email protected]> Cc: David Lechner <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-07fbdev: fix kerneldocMichał Mirosław1-2/+2
As noticed by kbuild test robot <[email protected]>, remove_conflicting_pci_framebuffers()'s second argument is called res_id not resource_id. Fix this. Signed-off-by: Michał Mirosław <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/38ca9044455a33e398b45e0281643cc24da3c2fc.1536342224.git.mirq-linux@rere.qmqm.pl
2018-09-03fbdev: add remove_conflicting_pci_framebuffers()Michał Mirosław1-0/+35
Almost all PCI drivers using remove_conflicting_framebuffers() wrap it with the same code. v2: add kerneldoc for DRM helper v3: propagate remove_conflicting_framebuffers() return value + move kerneldoc to where function is implemented Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/7db1c278276de420eb45a1b71d06b5eb6bbd49ef.1535810304.git.mirq-linux@rere.qmqm.pl
2018-09-03fbdev: add kerneldoc do remove_conflicting_framebuffers()Michał Mirosław1-0/+10
Document remove_conflicting_framebuffers() behaviour. Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/283fef19815b991700b56119d8d5874a2a8da44e.1535810304.git.mirq-linux@rere.qmqm.pl
2018-09-03fbdev: allow apertures == NULL in remove_conflicting_framebuffers()Michał Mirosław1-0/+14
Interpret (otherwise-invalid) NULL apertures argument to mean all-memory range. This will allow to remove several duplicates of this code from drivers in following patches. Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/b5fed539fe569035139c8594c23effd8c39f12ca.1535810304.git.mirq-linux@rere.qmqm.pl
2018-09-03fbdev: show fbdev number for debuggingMichał Mirosław1-2/+2
Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Acked-by: Daniel Vetter <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ef584ecd8642e8b1a04f28d6d9c1864b5aa507bb.1535810304.git.mirq-linux@rere.qmqm.pl
2018-08-10fbcon: Do not takeover the console from atomic contextHans de Goede1-4/+15
Taking over the console involves allocating mem with GFP_KERNEL, talking to drm drivers, etc. So this should not be done from an atomic context. But the console-output trigger deferred console takeover may happen from an atomic context, which leads to "BUG: sleeping function called from invalid context" errors. This commit fixes these errors by doing the deferred takeover from a workqueue. Signed-off-by: Hans de Goede <[email protected]> [b.zolnierkie: remove unused variable] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-08-10fbcon: Only defer console takeover if the current console driver is the dummyconHans de Goede1-14/+10
We rely on dummycon's output notifier mechanism to defer the takeover. If say vgacon is the current console driver then dummycon will never get used so its output notifier will also never get called and fbcon never takes over. This commit fixes this by only deferring the console takeover if the current console driver is the dummycon driver. This commit also moves the entirety of fbcon_start under the console_lock, since the conswitchp which fbcon_start now checks is protected by it. This commit also inlines fbcon_register_output_notifier, since we now need a #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER in fbcon_start anyways because of the write access to the deferred_takeover variable, this has the added advantage that it puts the dummycon_register_output_notifier() call directly after the "conswitchp != &dummy_con" comparison making it clear why that check is there. Note the arch setup code will set conswitchp to either dummy_con or vga_con, in the cases where it gets set to vga_con even though their is no vga_con present we rely on vga_con_startup() to set conswitchp to dummy_con. vga_con_startup() is guaranteed to happen before fb_console_init() as it gets called as a console_initcall where as fb_console_init() gets called as a subsys_initcall. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-31fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is setThomas Zimmermann1-4/+9
If the console is unlocked during registration, the console subsystem generates significant amounts of warnings, which obfuscate actual debugging messages. Setting ignore_console_lock_warning while debugging console registration avoid the noise. v3: - manipulate ignore_console_lock_warning with atomic_{inc,dec} v2: - restore ignore_console_lock_warning if lock_fb_info() fails Signed-off-by: Thomas Zimmermann <[email protected]> Acked-by: Hans de Goede <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-25fb: fix lost console when the user unplugs a USB adapterMikulas Patocka1-6/+32
I have a USB display adapter using the udlfb driver and I use it on an ARM board that doesn't have any graphics card. When I plug the adapter in, the console is properly displayed, however when I unplug and re-plug the adapter, the console is not displayed and I can't access it until I reboot the board. The reason is this: When the adapter is unplugged, dlfb_usb_disconnect calls unlink_framebuffer, then it waits until the reference count drops to zero and then it deallocates the framebuffer. However, the console that is attached to the framebuffer device keeps the reference count non-zero, so the framebuffer device is never destroyed. When the USB adapter is plugged again, it creates a new device /dev/fb1 and the console is not attached to it. This patch fixes the bug by unbinding the console from unlink_framebuffer. The code to unbind the console is moved from do_unregister_framebuffer to a function unbind_console. When the console is unbound, the reference count drops to zero and the udlfb driver frees the framebuffer. When the adapter is plugged back, a new framebuffer is created and the console is attached to it. Signed-off-by: Mikulas Patocka <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Bernie Thompson <[email protected]> Cc: Ladislav Michl <[email protected]> Cc: [email protected] [b.zolnierkie: preserve old behavior for do_unregister_framebuffer()] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-24fbdev: fbmem: mark expected switch fall-throughGustavo A. R. Silva1-0/+1
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-24fbdev: fix modedb docs in fb_find_modeDaniel Vetter1-30/+32
Fix up the indenting that confused sphinx. To make sure we don't have to make the examples unreadable with escaping just put them in as block quotes, that seems the simplest solution. Signed-off-by: Daniel Vetter <[email protected]> [b.zolnierkie: ported over fbdev changes] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-24fbcon: introduce for_each_registered_fb() helperYisheng Xie2-23/+12
Following pattern is often used: for (i = 0; i < FB_MAX; i++) { if (registered_fb[i]) { ... } } Therefore, as Andy's suggestion, for_each_registered_fb() helper can be introduced to make the code easier to read and write by reducing indentation level. It also saves few lines of code in each occurrence. This patch convert all part here at the same time. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Yisheng Xie <[email protected]> Acked-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Kees Cook <[email protected]> Cc: David Lechner <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-07-24fbdev: Distinguish between interlaced and progressive modesFredrik Noring1-11/+30
I discovered the problem when developing a frame buffer driver for the PlayStation 2 (not yet merged), using the following video modes for the PlayStation 3 in drivers/video/fbdev/ps3fb.c: }, { /* 1080if */ "1080if", 50, 1920, 1080, 13468, 148, 484, 36, 4, 88, 5, FB_SYNC_BROADCAST, FB_VMODE_INTERLACED }, { /* 1080pf */ "1080pf", 50, 1920, 1080, 6734, 148, 484, 36, 4, 88, 5, FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED }, In ps3fb_probe, the mode_option module parameter is used with fb_find_mode but it can only select the interlaced variant of 1920x1080 since the loop matching the modes does not take the difference between interlaced and progressive modes into account. In short, without the patch, progressive 1920x1080 cannot be chosen as a mode_option parameter since fb_find_mode (falsely) thinks interlace is a perfect match. Signed-off-by: Fredrik Noring <[email protected]> Cc: "Maciej W. Rozycki" <[email protected]> [b.zolnierkie: updated patch description] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-06-28console/fbcon: Add support for deferred console takeoverHans de Goede1-0/+72
Currently fbcon claims fbdevs as soon as they are registered and takes over the console as soon as the first fbdev gets registered. This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is. The current solution for this problem (on embedded systems) is to not enable fbcon. This commit adds a new FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER config option, which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the "quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as soon as e.g. an error message is logged. Note the choice to detect the first console output in the dummycon driver, rather then handling this entirely inside the fbcon code, was made after 2 failed attempts to handle this entirely inside the fbcon code. The fbcon code is woven quite tightly into the console code, making this to only feasible option. Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
2018-06-28fbcon: Call WARN_CONSOLE_UNLOCKED() where applicableHans de Goede1-0/+11
Replace comments about places where the console lock should be held with calls to WARN_CONSOLE_UNLOCKED() to assert that it is actually held. Acked-by: Steven Rostedt (VMware) <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>