1. 20 5月, 2021 12 次提交
  2. 13 5月, 2021 15 次提交
  3. 11 5月, 2021 1 次提交
  4. 09 5月, 2021 1 次提交
    • L
      drm/i915/display: fix compiler warning about array overrun · fec4d427
      Linus Torvalds 提交于
      intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
      Status Indicator data, but then passes that buffer at offset 10 off as
      an argument to drm_dp_channel_eq_ok().
      
      End result: there are only 4 bytes remaining of the buffer, yet
      drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
      about this case:
      
        drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
         3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
              |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
        In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
        include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
         1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
              |      ^~~~~~~~~~~~~~~~~~~~
             6:14 elapsed
      
      This commit just extends the original array by 2 zero-initialized bytes,
      avoiding the warning.
      
      There may be some underlying bug in here that caused this confusion, but
      this is at least no worse than the existing situation that could use
      random data off the stack.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fec4d427
  5. 07 5月, 2021 3 次提交
  6. 06 5月, 2021 2 次提交
    • B
      drm/amdgpu: Use device specific BO size & stride check. · 234055fd
      Bas Nieuwenhuizen 提交于
      The builtin size check isn't really the right thing for AMD
      modifiers due to a couple of reasons:
      
      1) In the format structs we don't do set any of the tilesize / blocks
      etc. to avoid having format arrays per modifier/GPU
      2) The pitch on the main plane is pixel_pitch * bytes_per_pixel even
      for tiled ...
      3) The pitch for the DCC planes is really the pixel pitch of the main
      surface that would be covered by it ...
      
      Note that we only handle GFX9+ case but we do this after converting
      the implicit modifier to an explicit modifier, so on GFX9+ all
      framebuffers should be checked here.
      
      There is a TODO about DCC alignment, but it isn't worse than before
      and I'd need to dig a bunch into the specifics. Getting this out in
      a reasonable timeframe to make sure it gets the appropriate testing
      seemed more important.
      
      Finally as I've found that debugging addfb2 failures is a pita I was
      generous adding explicit error messages to every failure case.
      
      Fixes: f258907f ("drm/amdgpu: Verify bo size can fit framebuffer size on init.")
      Tested-by: NSimon Ser <contact@emersion.fr>
      Signed-off-by: NBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      234055fd
    • B
      drm/amdgpu: Init GFX10_ADDR_CONFIG for VCN v3 in DPG mode. · 8bf073ca
      Bas Nieuwenhuizen 提交于
      Otherwise tiling modes that require the values form this field
      (In particular _*_X) would be corrupted upon video decode.
      
      Copied from the VCN v2 code.
      
      Fixes: 99541f39 ("drm/amdgpu: add mc resume DPG mode for VCN3.0")
      Reviewed-and-Tested by: Leo Liu <leo.liu@amd.com>
      Signed-off-by: NBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      8bf073ca
  7. 05 5月, 2021 5 次提交
    • T
      drm/amd/pm: initialize variable · 8651fcb9
      Tom Rix 提交于
      Static analysis reports this problem
      
      amdgpu_pm.c:478:16: warning: The right operand of '<' is a garbage value
        for (i = 0; i < data.nums; i++) {
                      ^ ~~~~~~~~~
      
      In some cases data is not set.  Initialize to 0 and flag not setting
      data as an error with the existing check.
      Signed-off-by: NTom Rix <trix@redhat.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      8651fcb9
    • K
      drm/radeon: Avoid power table parsing memory leaks · c69f2713
      Kees Cook 提交于
      Avoid leaving a hanging pre-allocated clock_info if last mode is
      invalid, and avoid heap corruption if no valid modes are found.
      
      Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211537
      Fixes: 6991b8f2 ("drm/radeon/kms: fix segfault in pm rework")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      c69f2713
    • K
      drm/radeon: Fix off-by-one power_state index heap overwrite · 5bbf2193
      Kees Cook 提交于
      An out of bounds write happens when setting the default power state.
      KASAN sees this as:
      
      [drm] radeon: 512M of GTT memory ready.
      [drm] GART: num cpu pages 131072, num gpu pages 131072
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in
      radeon_atombios_parse_power_table_1_3+0x1837/0x1998 [radeon]
      Write of size 4 at addr ffff88810178d858 by task systemd-udevd/157
      
      CPU: 0 PID: 157 Comm: systemd-udevd Not tainted 5.12.0-E620 #50
      Hardware name: eMachines        eMachines E620  /Nile       , BIOS V1.03 09/30/2008
      Call Trace:
       dump_stack+0xa5/0xe6
       print_address_description.constprop.0+0x18/0x239
       kasan_report+0x170/0x1a8
       radeon_atombios_parse_power_table_1_3+0x1837/0x1998 [radeon]
       radeon_atombios_get_power_modes+0x144/0x1888 [radeon]
       radeon_pm_init+0x1019/0x1904 [radeon]
       rs690_init+0x76e/0x84a [radeon]
       radeon_device_init+0x1c1a/0x21e5 [radeon]
       radeon_driver_load_kms+0xf5/0x30b [radeon]
       drm_dev_register+0x255/0x4a0 [drm]
       radeon_pci_probe+0x246/0x2f6 [radeon]
       pci_device_probe+0x1aa/0x294
       really_probe+0x30e/0x850
       driver_probe_device+0xe6/0x135
       device_driver_attach+0xc1/0xf8
       __driver_attach+0x13f/0x146
       bus_for_each_dev+0xfa/0x146
       bus_add_driver+0x2b3/0x447
       driver_register+0x242/0x2c1
       do_one_initcall+0x149/0x2fd
       do_init_module+0x1ae/0x573
       load_module+0x4dee/0x5cca
       __do_sys_finit_module+0xf1/0x140
       do_syscall_64+0x33/0x40
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Without KASAN, this will manifest later when the kernel attempts to
      allocate memory that was stomped, since it collides with the inline slab
      freelist pointer:
      
      invalid opcode: 0000 [#1] SMP NOPTI
      CPU: 0 PID: 781 Comm: openrc-run.sh Tainted: G        W 5.10.12-gentoo-E620 #2
      Hardware name: eMachines        eMachines E620  /Nile , BIOS V1.03       09/30/2008
      RIP: 0010:kfree+0x115/0x230
      Code: 89 c5 e8 75 ea ff ff 48 8b 00 0f ba e0 09 72 63 e8 1f f4 ff ff 41 89 c4 48 8b 45 00 0f ba e0 10 72 0a 48 8b 45 08 a8 01 75 02 <0f> 0b 44 89 e1 48 c7 c2 00 f0 ff ff be 06 00 00 00 48 d3 e2 48 c7
      RSP: 0018:ffffb42f40267e10 EFLAGS: 00010246
      RAX: ffffd61280ee8d88 RBX: 0000000000000004 RCX: 000000008010000d
      RDX: 4000000000000000 RSI: ffffffffba1360b0 RDI: ffffd61280ee8d80
      RBP: ffffd61280ee8d80 R08: ffffffffb91bebdf R09: 0000000000000000
      R10: ffff8fe2c1047ac8 R11: 0000000000000000 R12: 0000000000000000
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000100
      FS:  00007fe80eff6b68(0000) GS:ffff8fe339c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fe80eec7bc0 CR3: 0000000038012000 CR4: 00000000000006f0
      Call Trace:
       __free_fdtable+0x16/0x1f
       put_files_struct+0x81/0x9b
       do_exit+0x433/0x94d
       do_group_exit+0xa6/0xa6
       __x64_sys_exit_group+0xf/0xf
       do_syscall_64+0x33/0x40
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7fe80ef64bea
      Code: Unable to access opcode bytes at RIP 0x7fe80ef64bc0.
      RSP: 002b:00007ffdb1c47528 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fe80ef64bea
      RDX: 00007fe80ef64f60 RSI: 0000000000000000 RDI: 0000000000000000
      RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
      R10: 00007fe80ee2c620 R11: 0000000000000246 R12: 00007fe80eff41e0
      R13: 00000000ffffffff R14: 0000000000000024 R15: 00007fe80edf9cd0
      Modules linked in: radeon(+) ath5k(+) snd_hda_codec_realtek ...
      
      Use a valid power_state index when initializing the "flags" and "misc"
      and "misc2" fields.
      
      Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211537Reported-by: NErhard F. <erhard_f@mailbox.org>
      Fixes: a48b9b4e ("drm/radeon/kms/pm: add asic specific callbacks for getting power state (v2)")
      Fixes: 79daedc9 ("drm/radeon/kms: minor pm cleanups")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      5bbf2193
    • R
      drm/amd/display: Fix two cursor duplication when using overlay · 16e9b3e5
      Rodrigo Siqueira 提交于
      Our driver supports overlay planes, and as expected, some userspace
      compositor takes advantage of these features. If the userspace is not
      enabling the cursor, they can use multiple planes as they please.
      Nevertheless, we start to have constraints when userspace tries to
      enable hardware cursor with various planes. Basically, we cannot draw
      the cursor at the same size and position on two separated pipes since it
      uses extra bandwidth and DML only run with one cursor.
      
      For those reasons, when we enable hardware cursor and multiple planes,
      our driver should accept variations like the ones described below:
      
        +-------------+   +--------------+
        | +---------+ |   |              |
        | |Primary  | |   | Primary      |
        | |         | |   | Overlay      |
        | +---------+ |   |              |
        |Overlay      |   |              |
        +-------------+   +--------------+
      
      In this scenario, we can have the desktop UI in the overlay and some
      other framebuffer attached to the primary plane (e.g., video). However,
      userspace needs to obey some rules and avoid scenarios like the ones
      described below (when enabling hw cursor):
      
                                            +--------+
                                            |Overlay |
       +-------------+    +-----+-------+ +-|        |--+
       | +--------+  | +--------+       | | +--------+  |
       | |Overlay |  | |Overlay |       | |             |
       | |        |  | |        |       | |             |
       | +--------+  | +--------+       | |             |
       | Primary     |    | Primary     | | Primary     |
       +-------------+    +-------------+ +-------------+
      
       +-------------+   +-------------+
       |     +--------+  |  Primary    |
       |     |Overlay |  |             |
       |     |        |  |             |
       |     +--------+  | +--------+  |
       | Primary     |   | |Overlay |  |
       +-------------+   +-|        |--+
                           +--------+
      
      If the userspace violates some of the above scenarios, our driver needs
      to reject the commit; otherwise, we can have unexpected behavior. Since
      we don't have a proper driver validation for the above case, we can see
      some problems like a duplicate cursor in applications that use multiple
      planes. This commit fixes the cursor issue and others by adding adequate
      verification for multiple planes.
      
      Change since V1 (Harry and Sean):
      - Remove cursor verification from the equation.
      
      Cc: Louis Li <Ching-shih.Li@amd.com>
      Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Cc: Harry Wentland <Harry.Wentland@amd.com>
      Cc: Hersen Wu <hersenxs.wu@amd.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Signed-off-by: NRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Reviewed-by: NHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      16e9b3e5
    • E
      drm/amdgpu: add new MC firmware for Polaris12 32bit ASIC · c83c4e19
      Evan Quan 提交于
      Polaris12 32bit ASIC needs a special MC firmware.
      Signed-off-by: NEvan Quan <evan.quan@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      c83c4e19
  8. 03 5月, 2021 1 次提交
    • R
      drm/msm/dpu: Delete bonkers code · a712b307
      Rob Clark 提交于
      dpu_crtc_atomic_flush() was directly poking it's attached planes in a
      code path that ended up in dpu_plane_atomic_update(), even if the plane
      was not involved in the current atomic update.  While a bit dubious,
      this worked before because plane->state would always point to something
      valid.  But now using drm_atomic_get_new_plane_state() we could get a
      NULL state pointer instead, leading to:
      
         [   20.873273] Call trace:
         [   20.875740]  dpu_plane_atomic_update+0x5c/0xed0
         [   20.880311]  dpu_plane_restore+0x40/0x88
         [   20.884266]  dpu_crtc_atomic_flush+0xf4/0x208
         [   20.888660]  drm_atomic_helper_commit_planes+0x150/0x238
         [   20.894014]  msm_atomic_commit_tail+0x1d4/0x7a0
         [   20.898579]  commit_tail+0xa4/0x168
         [   20.902102]  drm_atomic_helper_commit+0x164/0x178
         [   20.906841]  drm_atomic_commit+0x54/0x60
         [   20.910798]  drm_atomic_connector_commit_dpms+0x10c/0x118
         [   20.916236]  drm_mode_obj_set_property_ioctl+0x1e4/0x440
         [   20.921588]  drm_connector_property_set_ioctl+0x60/0x88
         [   20.926852]  drm_ioctl_kernel+0xd0/0x120
         [   20.930807]  drm_ioctl+0x21c/0x478
         [   20.934235]  __arm64_sys_ioctl+0xa8/0xe0
         [   20.938193]  invoke_syscall+0x64/0x130
         [   20.941977]  el0_svc_common.constprop.3+0x5c/0xe0
         [   20.946716]  do_el0_svc+0x80/0xa0
         [   20.950058]  el0_svc+0x20/0x30
         [   20.953145]  el0_sync_handler+0x88/0xb0
         [   20.957014]  el0_sync+0x13c/0x140
      
      The reason for the codepath seems dubious, the atomic suspend/resume
      heplers should handle the power-collapse case.  If not, the CRTC's
      atomic_check() should be adding the planes to the atomic update.
      Reported-by: NStephen Boyd <swboyd@chromium.org>
      Reported-by: NJohn Stultz <john.stultz@linaro.org>
      Fixes: 37418bf1 ("drm: Use state helper instead of the plane state pointer")
      Tested-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210430171744.1721408-1-robdclark@gmail.com
      a712b307