1. 04 Dec, 2022 1 commit
  2. 01 Dec, 2022 1 commit
  3. 30 Nov, 2022 1 commit
  4. 28 Nov, 2022 1 commit
  5. 22 Nov, 2022 2 commits
    • Tetsuo Handa's avatar
      fbcon: Use kzalloc() in fbcon_prepare_logo() · a6a00d7e
      Tetsuo Handa authored
      A kernel built with syzbot's config file reported that
      
        scr_memcpyw(q, save, array3_size(logo_lines, new_cols, 2))
      
      causes uninitialized "save" to be copied.
      
        ----------
        [drm] Initialized vgem 1.0.0 20120112 for vgem on minor 0
        [drm] Initialized vkms 1.0.0 20180514 for vkms on minor 1
        Console: switching to colour frame buffer device 128x48
        =====================================================
        BUG: KMSAN: uninit-value in do_update_region+0x4b8/0xba0
         do_update_region+0x4b8/0xba0
         update_region+0x40d/0x840
         fbcon_switch+0x3364/0x35e0
         redraw_screen+0xae3/0x18a0
         do_bind_con_driver+0x1cb3/0x1df0
         do_take_over_console+0x11cb/0x13f0
         fbcon_fb_registered+0xacc/0xfd0
         register_framebuffer+0x1179/0x1320
         __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40
         drm_fbdev_client_hotplug+0xbea/0xda0
         drm_fbdev_generic_setup+0x65e/0x9d0
         vkms_init+0x9f3/0xc76
         (...snipped...)
      
        Uninit was stored to memory at:
         fbcon_prepare_logo+0x143b/0x1940
         fbcon_init+0x2c1b/0x31c0
         visual_init+0x3e7/0x820
         do_bind_con_driver+0x14a4/0x1df0
         do_take_over_console+0x11cb/0x13f0
         fbcon_fb_registered+0xacc/0xfd0
         register_framebuffer+0x1179/0x1320
         __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40
         drm_fbdev_client_hotplug+0xbea/0xda0
         drm_fbdev_generic_setup+0x65e/0x9d0
         vkms_init+0x9f3/0xc76
         (...snipped...)
      
        Uninit was created at:
         __kmem_cache_alloc_node+0xb69/0x1020
         __kmalloc+0x379/0x680
         fbcon_prepare_logo+0x704/0x1940
         fbcon_init+0x2c1b/0x31c0
         visual_init+0x3e7/0x820
         do_bind_con_driver+0x14a4/0x1df0
         do_take_over_console+0x11cb/0x13f0
         fbcon_fb_registered+0xacc/0xfd0
         register_framebuffer+0x1179/0x1320
         __drm_fb_helper_initial_config_and_unlock+0x23ad/0x2b40
         drm_fbdev_client_hotplug+0xbea/0xda0
         drm_fbdev_generic_setup+0x65e/0x9d0
         vkms_init+0x9f3/0xc76
         (...snipped...)
      
        CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.1.0-rc4-00356-g8f2975c2 #924
        Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
        ----------
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/cad03d25-0ea0-32c4-8173-fd1895314bce@I-love.SAKURA.ne.jp
      a6a00d7e
    • Dawei Li's avatar
      dma-buf: fix racing conflict of dma_heap_add() · 432e2590
      Dawei Li authored
      Racing conflict could be:
      task A                 task B
      list_for_each_entry
      strcmp(h->name))
                             list_for_each_entry
                             strcmp(h->name)
      kzalloc                kzalloc
      ......                 .....
      device_create          device_create
      list_add
                             list_add
      
      The root cause is that task B has no idea about the fact someone
      else(A) has inserted heap with same name when it calls list_add,
      so a potential collision occurs.
      
      Fixes: c02a81fb ("dma-buf: Add dma-buf heaps framework")
      Signed-off-by: default avatarDawei Li <set_pte_at@outlook.com>
      Acked-by: default avatarAndrew Davis <afd@ti.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/TYCP286MB2323873BBDF88020781FB986CA3B9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
      432e2590
  6. 18 Nov, 2022 2 commits
  7. 15 Nov, 2022 3 commits
  8. 14 Nov, 2022 1 commit
  9. 10 Nov, 2022 4 commits
  10. 09 Nov, 2022 1 commit
  11. 08 Nov, 2022 3 commits
  12. 07 Nov, 2022 2 commits
  13. 03 Nov, 2022 3 commits
    • maxime@cerno.tech's avatar
      drm/vc4: hdmi: Fix HSM clock too low on Pi4 · 3bc6a37f
      maxime@cerno.tech authored
      Commit ae71ab58 ("drm/vc4: hdmi: Enforce the minimum rate at
      runtime_resume") reintroduced the call to clk_set_min_rate in an attempt
      to fix the boot without a monitor connected on the RaspberryPi3.
      
      However, that introduced a regression breaking the display output
      entirely (black screen but no vblank timeout) on the Pi4.
      
      This is due to the fact that we now have in a typical modeset at boot,
      in vc4_hdmi_encoder_pre_crtc_configure(), we have a first call to
      clk_set_min_rate() asking for the minimum rate of the HSM clock for our
      given resolution, and then a call to pm_runtime_resume_and_get(). We
      will thus execute vc4_hdmi_runtime_resume() which, since the commit
      mentioned above, will call clk_set_min_rate() a second time with the
      absolute minimum rate we want to enforce on the HSM clock.
      
      We're thus effectively erasing the minimum mandated by the mode we're
      trying to set. The fact that only the Pi4 is affected is due to the fact
      that it uses a different clock driver that tries to minimize the HSM
      clock at all time. It will thus lower the HSM clock rate to 120MHz on
      the second clk_set_min_rate() call.
      
      The Pi3 doesn't use the same driver and will not change the frequency on
      the second clk_set_min_rate() call since it's still within the new
      boundaries and it doesn't have the code to minimize the clock rate as
      needed. So even though the boundaries are still off, the clock rate is
      still the right one for our given mode, so everything works.
      
      There is a lot of moving parts, so I couldn't find any obvious
      solution:
      
        - Reverting the original is not an option, as that would break the Pi3
          again.
      
        - We can't move the clk_set_min_rate() call in _pre_crtc_configure()
          since because, on the Pi3, the HSM clock has the CLK_SET_RATE_GATE
          flag which prevents the clock rate from being changed after it's
          been enabled. Our calls to clk_set_min_rate() can change it, so they
          need to be done before clk_prepare_enable().
      
        - We can't remove the call to clk_prepare_enable() from the
          runtime_resume hook to put it into _pre_crtc_configure() either,
          since we need that clock to be enabled to access the registers, and
          we can't count on the fact that the display will be active in all
          situations (doing any CEC operation, or listing the modes while
          inactive are valid for example()).
      
        - We can't drop the call to clk_set_min_rate() in
          _pre_crtc_configure() since we would need to still enforce the
          minimum rate for a given resolution, and runtime_resume doesn't have
          access to the current mode, if there's any.
      
        - We can't copy the TMDS character rate into vc4_hdmi and reuse it
          since, because it's part of the KMS atomic state, it needs to be
          protected by a mutex. Unfortunately, some functions (CEC operations,
          mostly) can be reentrant (through the CEC framework) and still need
          a pm_runtime_get.
      
      However, we can work around this issue by leveraging the fact that the
      clk_set_min_rate() calls set boundaries for its given struct clk, and
      that each different clk_get() call will return a different instance of
      struct clk. The clock framework will then aggregate the boundaries for
      each struct clk instances linked to a given clock, plus its hardware
      boundaries, and will use that.
      
      We can thus get an extra HSM clock user for runtime_pm use only, and use
      our different clock instances depending on the context: runtime_pm will
      use its own to set the absolute minimum clock setup so that we never
      lock the CPU waiting for a register access, and the modeset part will
      set its requirement for the current resolution. And we let the CCF do
      the coordination.
      
      It's not an ideal solution, but it's fairly unintrusive and doesn't
      really change any part of the logic so it looks like a rather safe fix.
      
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2136234
      Fixes: ae71ab58 ("drm/vc4: hdmi: Enforce the minimum rate at runtime_resume")
      Reported-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Tested-by: default avatarPeter Robinson <pbrobinson@gmail.com>
      Link: https://lore.kernel.org/r/20221021131339.2203291-1-maxime@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      3bc6a37f
    • maxime@cerno.tech's avatar
      drm/vc4: hdmi: Fix outdated function name in comment · 76ffa2af
      maxime@cerno.tech authored
      A comment introduced by commit 6bed2ea3 ("drm/vc4: hdmi: Reset link
      on hotplug") mentions a drm_atomic_helper_connector_hdmi_reset_link()
      function that was part of the earlier versions but got moved internally
      and is now named vc4_hdmi_reset_link(). Let's fix the function name.
      
      Fixes: 6bed2ea3 ("drm/vc4: hdmi: Reset link on hotplug")
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Link: https://lore.kernel.org/r/20221024093634.118190-2-maxime@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      76ffa2af
    • maxime@cerno.tech's avatar
      drm/vc4: hdmi: Take our lock to reset the link · 682f99b8
      maxime@cerno.tech authored
      We access some fields protected by our internal mutex in
      vc4_hdmi_reset_link() (saved_adjusted_mode, output_bpc, output_format)
      and are calling functions that need to have that lock taken
      (vc4_hdmi_supports_scrambling()).
      
      However, the current code doesn't lock that mutex. Let's make sure it
      does.
      
      Fixes: 6bed2ea3 ("drm/vc4: hdmi: Reset link on hotplug")
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Link: https://lore.kernel.org/r/20221024093634.118190-1-maxime@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      682f99b8
  14. 01 Nov, 2022 2 commits
  15. 31 Oct, 2022 1 commit
    • Hector Martin's avatar
      drm/format-helper: Only advertise supported formats for conversion · 6fdaed8c
      Hector Martin authored
      drm_fb_build_fourcc_list() currently returns all emulated formats
      unconditionally as long as the native format is among them, even though
      not all combinations have conversion helpers. Although the list is
      arguably provided to userspace in precedence order, userspace can pick
      something out-of-order (and thus break when it shouldn't), or simply
      only support a format that is unsupported (and thus think it can work,
      which results in the appearance of a hang as FB blits fail later on,
      instead of the initialization error you'd expect in this case).
      
      Add checks to filter the list of emulated formats to only those
      supported for conversion to the native format. This presumes that there
      is a single native format (only the first is checked, if there are
      multiple). Refactoring this API to drop the native list or support it
      properly (by returning the appropriate emulated->native mapping table)
      is left for a future patch.
      
      The simpledrm driver is left as-is with a full table of emulated
      formats. This keeps all currently working conversions available and
      drops all the broken ones (i.e. this a strict bugfix patch, adding no
      new supported formats nor removing any actually working ones). In order
      to avoid proliferation of emulated formats, future drivers should
      advertise only XRGB8888 as the sole emulated format (since some
      userspace assumes its presence).
      
      This fixes a real user regression where the ?RGB2101010 support commit
      started advertising it unconditionally where not supported, and KWin
      decided to start to use it over the native format and broke, but also
      the fixes the spurious RGB565/RGB888 formats which have been wrongly
      unconditionally advertised since the dawn of simpledrm.
      
      Fixes: 6ea966fc ("drm/simpledrm: Add [AX]RGB2101010 formats")
      Fixes: 11e8f5fd ("drm: Add simpledrm driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHector Martin <marcan@marcan.st>
      Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221027135711.24425-1-marcan@marcan.st
      6fdaed8c
  16. 29 Oct, 2022 7 commits
  17. 27 Oct, 2022 1 commit
  18. 25 Oct, 2022 1 commit
  19. 24 Oct, 2022 1 commit
  20. 23 Oct, 2022 2 commits
    • Linus Torvalds's avatar
      Linux 6.1-rc2 · 247f34f7
      Linus Torvalds authored
      247f34f7
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 05b4ebd2
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "RISC-V:
      
         - Fix compilation without RISCV_ISA_ZICBOM
      
         - Fix kvm_riscv_vcpu_timer_pending() for Sstc
      
        ARM:
      
         - Fix a bug preventing restoring an ITS containing mappings for very
           large and very sparse device topology
      
         - Work around a relocation handling error when compiling the nVHE
           object with profile optimisation
      
         - Fix for stage-2 invalidation holding the VM MMU lock for too long
           by limiting the walk to the largest block mapping size
      
         - Enable stack protection and branch profiling for VHE
      
         - Two selftest fixes
      
        x86:
      
         - add compat implementation for KVM_X86_SET_MSR_FILTER ioctl
      
        selftests:
      
         - synchronize includes between include/uapi and tools/include/uapi"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        tools: include: sync include/api/linux/kvm.h
        KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER
        KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter()
        kvm: Add support for arch compat vm ioctls
        RISC-V: KVM: Fix kvm_riscv_vcpu_timer_pending() for Sstc
        RISC-V: Fix compilation without RISCV_ISA_ZICBOM
        KVM: arm64: vgic: Fix exit condition in scan_its_table()
        KVM: arm64: nvhe: Fix build with profile optimization
        KVM: selftests: Fix number of pages for memory slot in memslot_modification_stress_test
        KVM: arm64: selftests: Fix multiple versions of GIC creation
        KVM: arm64: Enable stack protection and branch profiling for VHE
        KVM: arm64: Limit stage2_apply_range() batch size to largest block
        KVM: arm64: Work out supported block level at compile time
      05b4ebd2