1. 06 4月, 2019 1 次提交
  2. 24 3月, 2019 1 次提交
    • N
      drm/fb-helper: generic: Fix drm_fbdev_client_restore() · 9bc6e567
      Noralf Trønnes 提交于
      commit 78de14c23e031420aa5f61973583635eccd6cd2a upstream.
      
      If fbdev setup has failed, lastclose will give a NULL pointer deref:
      
      [   77.794295] [drm:drm_lastclose]
      [   77.794414] [drm:drm_lastclose] driver lastclose completed
      [   77.794660] Unable to handle kernel NULL pointer dereference at virtual address 00000014
      [   77.809460] pgd = b376b71b
      [   77.818275] [00000014] *pgd=175ba831, *pte=00000000, *ppte=00000000
      [   77.830813] Internal error: Oops: 17 [#1] ARM
      [   77.840963] Modules linked in: mi0283qt mipi_dbi tinydrm raspberrypi_hwmon gpio_backlight backlight snd_bcm2835(C) bcm2835_rng rng_core
      [   77.865203] CPU: 0 PID: 527 Comm: lt-modetest Tainted: G         C        5.0.0-rc1+ #1
      [   77.879525] Hardware name: BCM2835
      [   77.889185] PC is at restore_fbdev_mode+0x20/0x164
      [   77.900261] LR is at drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c
      [   78.002446] Process lt-modetest (pid: 527, stack limit = 0x7a3d5c14)
      [   78.291030] Backtrace:
      [   78.300815] [<c04f2d0c>] (restore_fbdev_mode) from [<c04f4708>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c)
      [   78.319095]  r9:d8a8a288 r8:d891acf0 r7:d7697910 r6:00000000 r5:d891ac00 r4:d891ac00
      [   78.334432] [<c04f46b4>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c04f47e8>] (drm_fbdev_client_restore+0x18/0x20)
      [   78.353296]  r8:d76978c0 r7:d7697910 r6:d7697950 r5:d7697800 r4:d891ac00 r3:c04f47d0
      [   78.368689] [<c04f47d0>] (drm_fbdev_client_restore) from [<c051b6b4>] (drm_client_dev_restore+0x7c/0xc0)
      [   78.385982] [<c051b638>] (drm_client_dev_restore) from [<c04f8fd0>] (drm_lastclose+0xc4/0xd4)
      [   78.402332]  r8:d76978c0 r7:d7471080 r6:c0e0c088 r5:d8a85e00 r4:d7697800
      [   78.416688] [<c04f8f0c>] (drm_lastclose) from [<c04f9088>] (drm_release+0xa8/0x10c)
      [   78.431929]  r5:d8a85e00 r4:d7697800
      [   78.442989] [<c04f8fe0>] (drm_release) from [<c02640c4>] (__fput+0x104/0x1c8)
      [   78.457740]  r8:d5ccea10 r7:d96cfb10 r6:00000008 r5:d74c1b90 r4:d8a8a280
      [   78.472043] [<c0263fc0>] (__fput) from [<c02641ec>] (____fput+0x18/0x1c)
      [   78.486363]  r10:00000006 r9:d7722000 r8:c01011c4 r7:00000000 r6:c0ebac6c r5:d892a340
      [   78.501869]  r4:d8a8a280
      [   78.512002] [<c02641d4>] (____fput) from [<c013ef1c>] (task_work_run+0x98/0xac)
      [   78.527186] [<c013ee84>] (task_work_run) from [<c010cc54>] (do_work_pending+0x4f8/0x570)
      [   78.543238]  r7:d7722030 r6:00000004 r5:d7723fb0 r4:00000000
      [   78.556825] [<c010c75c>] (do_work_pending) from [<c0101034>] (slow_work_pending+0xc/0x20)
      [   78.674256] ---[ end trace 70d3a60cf739be3b ]---
      
      Fix by using drm_fb_helper_lastclose() which checks if fbdev is in use.
      
      Fixes: 9060d7f4 ("drm/fb-helper: Finish the generic fbdev emulation")
      Cc: stable@vger.kernel.org
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190125150300.33268-1-noralf@tronnes.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9bc6e567
  3. 23 1月, 2019 1 次提交
    • I
      drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock · 241e5148
      Ivan Mironov 提交于
      commit 66a8d5bfb518f9f12d47e1d2dce1732279f9451e upstream.
      
      Strict requirement of pixclock to be zero breaks support of SDL 1.2
      which contains hardcoded table of supported video modes with non-zero
      pixclock values[1].
      
      To better understand which pixclock values are considered valid and how
      driver should handle these values, I briefly examined few existing fbdev
      drivers and documentation in Documentation/fb/. And it looks like there
      are no strict rules on that and actual behaviour varies:
      
      	* some drivers treat (pixclock == 0) as "use defaults" (uvesafb.c);
      	* some treat (pixclock == 0) as invalid value which leads to
      	  -EINVAL (clps711x-fb.c);
      	* some pass converted pixclock value to hardware (uvesafb.c);
      	* some are trying to find nearest value from predefined table
                (vga16fb.c, video_gx.c).
      
      Given this, I believe that it should be safe to just ignore this value if
      changing is not supported. It seems that any portable fbdev application
      which was not written only for one specific device working under one
      specific kernel version should not rely on any particular behaviour of
      pixclock anyway.
      
      However, while enabling SDL1 applications to work out of the box when
      there is no /etc/fb.modes with valid settings, this change affects the
      video mode choosing logic in SDL. Depending on current screen
      resolution, contents of /etc/fb.modes and resolution requested by
      application, this may lead to user-visible difference (not always):
      image will be displayed in a right way, but it will be aligned to the
      left instead of center. There is no "right behaviour" here as well, as
      emulated fbdev, opposing to old fbdev drivers, simply ignores any
      requsts of video mode changes with resolutions smaller than current.
      
      The easiest way to reproduce this problem is to install sdl-sopwith[2],
      remove /etc/fb.modes file if it exists, and then try to run sopwith
      from console without X. At least in Fedora 29, sopwith may be simply
      installed from standard repositories.
      
      [1] SDL 1.2.15 source code, src/video/fbcon/SDL_fbvideo.c, vesa_timings
      [2] http://sdl-sopwith.sourceforge.net/Signed-off-by: NIvan Mironov <mironov.ivan@gmail.com>
      Cc: stable@vger.kernel.org
      Fixes: 79e53945 ("DRM: i915: add mode setting support")
      Fixes: 771fe6b9 ("drm/radeon: introduce kernel modesetting for radeon hardware")
      Fixes: 785b93ef ("drm/kms: move driver specific fb common code to helper functions (v2)")
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-3-mironov.ivan@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      241e5148
  4. 17 1月, 2019 2 次提交
    • I
      drm/fb-helper: Partially bring back workaround for bugs of SDL 1.2 · f57bef95
      Ivan Mironov 提交于
      commit 62d85b3bf9d978ed4b6b2aeef5cf0ccf1423906e upstream.
      
      SDL 1.2 sets all fields related to the pixel format to zero in some
      cases[1]. Prior to commit db05c481 ("drm: fb-helper: Reject all
      pixel format changing requests"), there was an unintentional workaround
      for this that existed for more than a decade. First in device-specific DRM
      drivers, then here in drm_fb_helper.c.
      
      Previous code containing this workaround just ignores pixel format fields
      from userspace code. Not a good thing either, as this way, driver may
      silently use pixel format different from what client actually requested,
      and this in turn will lead to displaying garbage on the screen. I think
      that returning EINVAL to userspace in this particular case is the right
      option, so I decided to left code from problematic commit untouched
      instead of just reverting it entirely.
      
      Here is the steps required to reproduce this problem exactly:
      	1) Compile fceux[2] with SDL 1.2.15 and without GTK or OpenGL
      	   support. SDL should be compiled with fbdev support (which is
      	   on by default).
      	2) Create /etc/fb.modes with following contents (values seems
      	   not used, and just required to trigger problematic code in
      	   SDL):
      
      		mode "test"
      		    geometry 1 1 1 1 1
      		    timings 1 1 1 1 1 1 1
      		endmode
      
      	3) Create ~/.fceux/fceux.cfg with following contents:
      
      		SDL.Hotkeys.Quit = 27
      		SDL.DoubleBuffering = 1
      
      	4) Ensure that screen resolution is at least 1280x960 (e.g.
      	   append "video=Virtual-1:1280x960-32" to the kernel cmdline
      	   for qemu/QXL).
      
      	5) Try to run fceux on VT with some ROM file[3]:
      
      		# ./fceux color_test.nes
      
      [1] SDL 1.2.15 source code, src/video/fbcon/SDL_fbvideo.c,
          FB_SetVideoMode()
      [2] http://www.fceux.com
      [3] Example ROM: https://github.com/bokuweb/rustynes/blob/master/roms/color_test.nesReported-by: Nsaahriktu <mail@saahriktu.org>
      Suggested-by: Nsaahriktu <mail@saahriktu.org>
      Cc: stable@vger.kernel.org
      Fixes: db05c481 ("drm: fb-helper: Reject all pixel format changing requests")
      Signed-off-by: NIvan Mironov <mironov.ivan@gmail.com>
      [danvet: Delete misleading comment.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-2-mironov.ivan@gmail.com
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-2-mironov.ivan@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f57bef95
    • N
      drm/fb_helper: Allow leaking fbdev smem_start · 7398668b
      Neil Armstrong 提交于
      commit 4be9bd10e22dfc7fc101c5cf5969ef2d3a042d8a upstream.
      
      Since "drm/fb: Stop leaking physical address", the default behaviour of
      the DRM fbdev emulation is to set the smem_base to 0 and pass the new
      FBINFO_HIDE_SMEM_START flag.
      
      The main reason is to avoid leaking physical addresse to user-space, and
      it follows a general move over the kernel code to avoid user-space to
      manipulate physical addresses and then use some other mechanisms like
      dma-buf to transfer physical buffer handles over multiple subsystems.
      
      But, a lot of devices depends on closed sources binaries to enable
      OpenGL hardware acceleration that uses this smem_start value to
      pass physical addresses to out-of-tree modules in order to render
      into these physical adresses. These should use dma-buf buffers allocated
      from the DRM display device instead and stop relying on fbdev overallocation
      to gather DMA memory (some HW vendors delivers GBM and Wayland capable
      binaries, but older unsupported devices won't have these new binaries
      and are doomed until an Open Source solution like Lima finalizes).
      
      Since these devices heavily depends on this kind of software and because
      the smem_start population was available for years, it's a breakage to
      stop leaking smem_start without any alternative solutions.
      
      This patch adds a Kconfig depending on the EXPERT config and an unsafe
      kernel module parameter tainting the kernel when enabled.
      
      A clear comment and Kconfig help text was added to clarify why and when
      this patch should be reverted, but in the meantime it's a necessary
      feature to keep.
      
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Cc: Maxime Ripard <maxime.ripard@bootlin.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Ben Skeggs <skeggsb@gmail.com>
      Cc: Christian König <christian.koenig@amd.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: NMaxime Ripard <maxime.ripard@bootlin.com>
      Tested-by: NMaxime Ripard <maxime.ripard@bootlin.com>
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: NDave Airlie <airlied@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1538136355-15383-1-git-send-email-narmstrong@baylibre.comSigned-off-by: NMaxime Ripard <maxime.ripard@bootlin.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      7398668b
  5. 01 12月, 2018 1 次提交
  6. 04 10月, 2018 1 次提交
  7. 02 10月, 2018 1 次提交
    • N
      drm/cma-helper: Fix crash in fbdev error path · 4d4c2d89
      Noralf Trønnes 提交于
      Sergey Suloev reported a crash happening in drm_client_dev_hotplug()
      when fbdev had failed to register.
      
      [    9.124598] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
      [    9.147667] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
      [    9.155184] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
      [    9.166544] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
      [    9.173840] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
      [    9.181029] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
      [    9.188519] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
      [    9.195690] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.203523] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.215032] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.274785] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
      [    9.290246] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
      [    9.297464] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
      [    9.304600] [drm] Driver supports precise vblank timestamp query.
      [    9.382856] vc4-drm soc:gpu: [drm:drm_fb_helper_fbdev_setup [drm_kms_helper]] *ERROR* Failed to set fbdev configuration
      [   10.404937] Unable to handle kernel paging request at virtual address 00330a656369768a
      [   10.441620] [00330a656369768a] address between user and kernel address ranges
      [   10.449087] Internal error: Oops: 96000004 [#1] PREEMPT SMP
      [   10.454762] Modules linked in: brcmfmac vc4 drm_kms_helper cfg80211 drm rfkill smsc95xx brcmutil usbnet drm_panel_orientation_quirks raspberrypi_hwmon bcm2835_dma crc32_ce pwm_bcm2835 bcm2835_rng virt_dma rng_core i2c_bcm2835 ip_tables x_tables ipv6
      [   10.477296] CPU: 2 PID: 45 Comm: kworker/2:1 Not tainted 4.19.0-rc5 #3
      [   10.483934] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
      [   10.489966] Workqueue: events output_poll_execute [drm_kms_helper]
      [   10.596515] Process kworker/2:1 (pid: 45, stack limit = 0x000000007e8924dc)
      [   10.603590] Call trace:
      [   10.606259]  drm_client_dev_hotplug+0x5c/0xb0 [drm]
      [   10.611303]  drm_kms_helper_hotplug_event+0x30/0x40 [drm_kms_helper]
      [   10.617849]  output_poll_execute+0xc4/0x1e0 [drm_kms_helper]
      [   10.623616]  process_one_work+0x1c8/0x318
      [   10.627695]  worker_thread+0x48/0x428
      [   10.631420]  kthread+0xf8/0x128
      [   10.634615]  ret_from_fork+0x10/0x18
      [   10.638255] Code: 54000220 f9401261 aa1303e0 b4000141 (f9400c21)
      [   10.644456] ---[ end trace c75b4a4b0e141908 ]---
      
      The reason for this is that drm_fbdev_cma_init() removes the drm_client
      when fbdev registration fails, but it doesn't remove the client from the
      drm_device client list. So the client list now has a pointer that points
      into the unknown and we have a 'use after free' situation.
      
      Split drm_client_new() into drm_client_init() and drm_client_add() to fix
      removal in the error path.
      
      Fixes: 894a677f ("drm/cma-helper: Use the generic fbdev emulation")
      Reported-by: NSergey Suloev <ssuloev@orpaltech.com>
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181001194536.57756-1-noralf@tronnes.org
      4d4c2d89
  8. 12 9月, 2018 1 次提交
  9. 10 7月, 2018 2 次提交
  10. 05 7月, 2018 2 次提交
  11. 12 6月, 2018 1 次提交
  12. 29 5月, 2018 1 次提交
  13. 11 5月, 2018 1 次提交
  14. 16 3月, 2018 1 次提交
  15. 20 12月, 2017 4 次提交
  16. 07 12月, 2017 1 次提交
  17. 05 12月, 2017 1 次提交
  18. 29 11月, 2017 1 次提交
  19. 23 11月, 2017 1 次提交
  20. 01 11月, 2017 3 次提交
  21. 14 10月, 2017 1 次提交
  22. 02 9月, 2017 1 次提交
  23. 07 8月, 2017 1 次提交
  24. 04 8月, 2017 1 次提交
  25. 03 8月, 2017 1 次提交
  26. 26 7月, 2017 1 次提交
    • D
      drm/fb-helper: Support deferred setup · ca91a275
      Daniel Vetter 提交于
      FB helper code falls back to a 1024x768 mode if no outputs are connected
      or don't report back any modes upon initialization. This can be annoying
      because outputs that are added to FB helper later on can't be used with
      FB helper if they don't support a matching mode.
      
      The fallback is in place because VGA connectors can happen to report an
      unknown connection status even when they are in fact connected.
      
      Some drivers have custom solutions in place to defer FB helper setup
      until at least one output is connected. But the logic behind these
      solutions is always the same and there is nothing driver-specific about
      it, so a better alterative is to fix the FB helper core and add support
      for all drivers automatically.
      
      This patch adds support for deferred FB helper setup. It checks all the
      connectors for their connection status, and if all of them report to be
      disconnected marks the FB helper as needing deferred setup. Whet setup
      is deferred, the FB helper core will automatically retry setup after a
      hotplug event, and it will keep trying until it succeeds.
      
      v2: Rebase onto my entirely reworked fbdev helper locking. One big
      difference is that this version again drops&reacquires the fbdev lock
      (which is now fb_helper->lock, but before this patch series it was
      mode_config->mutex), because register_framebuffer must be able to
      recurse back into fbdev helper code for the initial screen setup.
      
      v3: __drm_fb_helper_initial_config must hold fb_helper->lock upon
      return, I've fumbled that in the deferred setup case (Liviu).
      
      v4: I was blind, redo this all. __drm_fb_helper_initial_config
      shouldn't need to reacquire fb_helper->lock, that just confuses
      callers. I myself got confused by kernel_fb_helper_lock and somehow
      thought it's the same as fb_helper->lock. Tsk.
      
      Also simplify the logic a bit (we don't need two functions to probe
      connectors), we can stick much closer to the existing code. And update
      some comments I've spotted that are outdated.
      
      v5: Don't pass -EAGAIN to drivers, it's just an internal error code
      (Liviu).
      
      v6: Add _and_unlock suffix to clarify locking (Maarten)
      
      Cc: Liviu Dudau <liviu@dudau.co.uk>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Tested-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: Thierry Reding <treding@nvidia.com> (v1)
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@intel.com>
      Reviewed-by: NLiviu Dudau <liviu@dudau.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20170706130023.28417-3-daniel.vetter@ffwll.chSigned-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ca91a275
  27. 14 7月, 2017 1 次提交
  28. 06 7月, 2017 5 次提交