1. 15 Jun, 2023 8 commits
    • Thomas Zimmermann's avatar
      drm/radeon: Disable outputs when releasing fbdev client · c069dbbc
      Thomas Zimmermann authored
      Disable the modesetting pipeline before release the radeon's fbdev
      client. Fixes the following error:
      
      [   17.217408] WARNING: CPU: 5 PID: 1464 at drivers/gpu/drm/ttm/ttm_bo.c:326 ttm_bo_release+0x27e/0x2d0 [ttm]
      [   17.217418] Modules linked in: edac_mce_amd radeon(+) drm_ttm_helper ttm video drm_suballoc_helper drm_display_helper kvm irqbypass drm_kms_helper syscopyarea crc32_pclmul sysfillrect sha512_ssse3 sysimgblt sha512_generic cfbfillrect cfbimgblt wmi_bmof aesni_intel cfbcopyarea crypto_simd cryptd k10temp acpi_cpufreq wmi dm_mod
      [   17.217432] CPU: 5 PID: 1464 Comm: systemd-udevd Not tainted 6.4.0-rc4+ #1
      [   17.217436] Hardware name: Micro-Star International Co., Ltd. MS-7A38/B450M PRO-VDH MAX (MS-7A38), BIOS B.G0 07/26/2022
      [   17.217438] RIP: 0010:ttm_bo_release+0x27e/0x2d0 [ttm]
      [   17.217444] Code: 48 89 43 38 48 89 43 40 48 8b 5c 24 30 48 8b b5 40 08 00 00 48 8b 6c 24 38 48 83 c4 58 e9 7a 49 f7 e0 48 89 ef e9 6c fe ff ff <0f> 0b 48 83 7b 20 00 0f 84 b7 fd ff ff 0f 0b 0f 1f 00 e9 ad fd ff
      [   17.217448] RSP: 0018:ffffc9000095fbb0 EFLAGS: 00010202
      [   17.217451] RAX: 0000000000000001 RBX: ffff8881052c8de0 RCX: 0000000000000000
      [   17.217453] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8881052c8de0
      [   17.217455] RBP: ffff888104a66e00 R08: ffff8881052c8de0 R09: ffff888104a7cf08
      [   17.217457] R10: ffffc9000095fbe0 R11: ffffc9000095fbe8 R12: ffff8881052c8c78
      [   17.217458] R13: ffff8881052c8c78 R14: dead000000000100 R15: ffff88810528b108
      [   17.217460] FS:  00007f319fcbb8c0(0000) GS:ffff88881a540000(0000) knlGS:0000000000000000
      [   17.217463] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   17.217464] CR2: 000055dc8b0224a0 CR3: 000000010373d000 CR4: 0000000000750ee0
      [   17.217466] PKRU: 55555554
      [   17.217468] Call Trace:
      [   17.217470]  <TASK>
      [   17.217472]  ? __warn+0x97/0x160
      [   17.217476]  ? ttm_bo_release+0x27e/0x2d0 [ttm]
      [   17.217481]  ? report_bug+0x1ec/0x200
      [   17.217487]  ? handle_bug+0x3c/0x70
      [   17.217490]  ? exc_invalid_op+0x1f/0x90
      [   17.217493]  ? preempt_count_sub+0xb5/0x100
      [   17.217496]  ? asm_exc_invalid_op+0x16/0x20
      [   17.217500]  ? ttm_bo_release+0x27e/0x2d0 [ttm]
      [   17.217505]  ? ttm_resource_move_to_lru_tail+0x1ab/0x1d0 [ttm]
      [   17.217511]  radeon_bo_unref+0x1a/0x30 [radeon]
      [   17.217547]  radeon_gem_object_free+0x20/0x30 [radeon]
      [   17.217579]  radeon_fbdev_fb_destroy+0x57/0x90 [radeon]
      [   17.217616]  unregister_framebuffer+0x72/0x110
      [   17.217620]  drm_client_dev_unregister+0x6d/0xe0
      [   17.217623]  drm_dev_unregister+0x2e/0x90
      [   17.217626]  drm_put_dev+0x26/0x90
      [   17.217628]  pci_device_remove+0x44/0xc0
      [   17.217631]  really_probe+0x257/0x340
      [   17.217635]  __driver_probe_device+0x73/0x120
      [   17.217638]  driver_probe_device+0x2c/0xb0
      [   17.217641]  __driver_attach+0xa0/0x150
      [   17.217643]  ? __pfx___driver_attach+0x10/0x10
      [   17.217646]  bus_for_each_dev+0x67/0xa0
      [   17.217649]  bus_add_driver+0x10e/0x210
      [   17.217651]  driver_register+0x5c/0x120
      [   17.217653]  ? __pfx_radeon_module_init+0x10/0x10 [radeon]
      [   17.217681]  do_one_initcall+0x44/0x220
      [   17.217684]  ? kmalloc_trace+0x37/0xc0
      [   17.217688]  do_init_module+0x64/0x240
      [   17.217691]  __do_sys_finit_module+0xb2/0x100
      [   17.217694]  do_syscall_64+0x3b/0x90
      [   17.217697]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      [   17.217700] RIP: 0033:0x7f319feaa5a9
      [   17.217702] Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 27 08 0d 00 f7 d8 64 89 01 48
      [   17.217706] RSP: 002b:00007ffc6bf3e7f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      [   17.217709] RAX: ffffffffffffffda RBX: 00005607204f3170 RCX: 00007f319feaa5a9
      [   17.217710] RDX: 0000000000000000 RSI: 00007f31a002eefd RDI: 0000000000000018
      [   17.217712] RBP: 00007f31a002eefd R08: 0000000000000000 R09: 00005607204f1860
      [   17.217714] R10: 0000000000000018 R11: 0000000000000246 R12: 0000000000020000
      [   17.217716] R13: 0000000000000000 R14: 0000560720522450 R15: 0000560720255899
      [   17.217718]  </TASK>
      [   17.217719] ---[ end trace 0000000000000000 ]---
      
      The buffer object backing the fbdev emulation got pinned twice: by the
      fb_probe helper radeon_fbdev_create_pinned_object() and the modesetting
      code when the framebuffer got displayed. It only got unpinned once by
      the fbdev helper radeon_fbdev_destroy_pinned_object(). Hence TTM's BO-
      release function complains about the pin counter. Forcing the outputs
      off also undoes the modesettings pin increment.
      Tested-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reported-by: default avatarBorislav Petkov <bp@alien8.de>
      Closes: https://lore.kernel.org/dri-devel/20230603174814.GCZHt83pN+wNjf63sC@fat_crate.local/Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: e317a69f ("drm/radeon: Implement client-based fbdev emulation")
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
      Cc: amd-gfx@lists.freedesktop.org
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      c069dbbc
    • Hamza Mahfooz's avatar
      drm/amd/amdgpu: enable W=1 for amdgpu · 8020f0f9
      Hamza Mahfooz authored
      We have a clean build with W=1 as of
      commit c168feed ("drm/amd/display/amdgpu_dm/amdgpu_dm_helpers: Move
      SYNAPTICS_DEVICE_ID into CONFIG_DRM_AMD_DC_DCN ifdef"). So, let's enable
      these checks unconditionally for the entire module to catch these errors
      during development.
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      8020f0f9
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix kdoc warning · e06da817
      Srinivasan Shanmugam authored
      Fixes the following gcc with W=1:
      
      drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c:76: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
       * EEPROM Table structure v1
      drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c:98: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
       * EEPROM Table structrue v2.1
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      e06da817
    • Daniel Miess's avatar
      drm/amd/display: Enable dcn314 DPP RCO · 17fbdbda
      Daniel Miess authored
      [Why and How]
      Add back debug bits enabling RCO for dcn314 as underflow
      associated with this change has been resolved
      Acked-by: default avatarStylon Wang <stylon.wang@amd.com>
      Signed-off-by: default avatarDaniel Miess <daniel.miess@amd.com>
      Reviewed-by: default avatarJun Lei <jun.lei@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      17fbdbda
    • Mukul Joshi's avatar
      drm/amdgpu: Rename DRM schedulers in amdgpu TTM · 41ce6d6d
      Mukul Joshi authored
      Rename mman.entity to mman.high_pr to make the distinction
      clearer that this is a high priority scheduler. Similarly,
      rename the recently added mman.delayed to mman.low_pr to
      make it clear it is a low priority scheduler.
      No functional change in this patch.
      Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      41ce6d6d
    • Lee Jones's avatar
      drm/amd/display/amdgpu_dm/amdgpu_dm_helpers: Move SYNAPTICS_DEVICE_ID into... · c168feed
      Lee Jones authored
      drm/amd/display/amdgpu_dm/amdgpu_dm_helpers: Move SYNAPTICS_DEVICE_ID into CONFIG_DRM_AMD_DC_DCN ifdef
      
      Fixes the following W=1 kernel build warning(s):
      
       drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:48:22: warning: ‘SYNAPTICS_DEVICE_ID’ defined but not used [-Wunused-const-variable=]
      
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Leo Li <sunpeng.li@amd.com>
      Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
      Cc: David Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: amd-gfx@lists.freedesktop.org
      Cc: dri-devel@lists.freedesktop.org
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: default avatarLee Jones <lee@kernel.org>
      Signed-off-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      c168feed
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Skip DPP DTO update if root clock is gated · 30f90f3c
      Nicholas Kazlauskas authored
      [Why]
      Hardware implements root clock gating by utilizing the DPP DTO registers
      with a special case of DTO enabled, phase = 0, modulo = 1. This
      conflicts with our policy to always update the DPPDTO for cases where
      it's expected to be disabled.
      
      The pipes unexpectedly enter a higher power state than expected because
      of this programming flow.
      
      [How]
      Guard the upper layers of HWSS against this hardware quirk with
      programming the register with an internal state flag in DCCG.
      
      While technically acting as global state for the DCCG, HWSS shouldn't be
      expected to understand the hardware quirk for having DTO disabled
      causing more power than DTO enabled with this specific setting.
      
      This also prevents sequencing errors from occuring in the future if
      we have to program DPP DTO in multiple locations.
      Acked-by: default avatarStylon Wang <stylon.wang@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: default avatarJun Lei <jun.lei@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      30f90f3c
    • Dave Airlie's avatar
      Merge tag 'amd-drm-next-6.5-2023-06-09' of https://gitlab.freedesktop.org/agd5f/linux into drm-next · 901bdf5e
      Dave Airlie authored
      amd-drm-next-6.5-2023-06-02:
      
      amdgpu:
      - SR-IOV fixes
      - Warning fixes
      - Misc code cleanups and spelling fixes
      - DCN 3.2 updates
      - Improved DC FAMS support for better power management
      - Improved DC SubVP support for better power management
      - DCN 3.1.x fixes
      - Max IB size query
      - DC GPU reset fixes
      - RAS updates
      - DCN 3.0.x fixes
      - S/G display fixes
      - CP shadow buffer support
      - Implement connector force callback
      - Z8 power improvements
      - PSP 13.0.10 vbflash support
      - Mode2 reset fixes
      - Store MQDs in VRAM to improve queue switch latency
      - VCN 3.x fixes
      - JPEG 3.x fixes
      - Enable DC_FP on LoongArch
      - GFXOFF fixes
      - GC 9.4.3 partition support
      - SDMA 4.4.2 partition support
      - VCN/JPEG 4.0.3 partition support
      - VCN 4.0.3 updates
      - NBIO 7.9 updates
      - GC 9.4.3 updates
      - Take NUMA into account when allocating memory
      - Handle NUMA for partitions
      - SMU 13.0.6 updates
      - GC 9.4.3 RAS updates
      - Stop including unused swiotlb.h
      - SMU 13.0.7 fixes
      - Fix clock output ordering on some APUs
      - Clean up DC FPGA code
      - GFX9 preemption fixes
      - Misc irq fixes
      - S0ix fixes
      - Add new DRM_AMDGPU_WERROR config parameter to help with CI
      - PCIe fix for RDNA2
      - kdoc fixes
      - Documentation updates
      
      amdkfd:
      - Query TTM mem limit rather than hardcoding it
      - GC 9.4.3 partition support
      - Handle NUMA for partitions
      
      radeon:
      - Fix possible double free
      - Stop including unused swiotlb.h
      - Fix possible division by zero
      
      ttm:
      - Add query for TTM mem limit
      - Add NUMA awareness to pools
      - Export ttm_pool_fini()
      
      UAPI:
      - Add new ctx query flag to better handle GPU resets
        Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22290
      - Add new interface to query and set shadow buffer for RDNA3
        Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21986
      - Add new INFO query for max IB size
        Proposed userspace: https://gitlab.freedesktop.org/bnieuwenhuizen/mesa/-/commits/ib-rejection-v3
      
      amd-drm-next-6.5-2023-06-09:
      
      amdgpu:
      - S0ix fixes
      - Initial SMU13 Overdrive support
      - kdoc fixes
      - Misc clode cleanups
      - Flexible array fixes
      - Display OTG fixes
      - SMU 13.0.6 updates
      - Revert some broken clock counter updates
      - Misc display fixes
      - GFX9 preemption fixes
      - Add support for newer EEPROM bad page table format
      - Add missing radeon secondary id
      - Add support for new colorspace KMS API
      - CSA fix
      - Stable pstate fixes for APUs
      - make vbl interface admin only
      - Handle PCI accelerator class
      
      amdkfd:
      - Add debugger support for gdb
      
      radeon:
      - Fix possible UAF
      
      drm:
      - Add Colorspace functionality
      
      UAPI:
      - Add debugger interface for enabling gdb
        Proposed userspace: https://github.com/ROCm-Developer-Tools/ROCdbgapi/tree/wip-dbgapi
      - Add KMS colorspace API
        Discussion: https://lists.freedesktop.org/archives/dri-devel/2023-June/408128.html
      
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230609174817.7764-1-alexander.deucher@amd.com
      901bdf5e
  2. 09 Jun, 2023 32 commits