[PATCH] drm/amd/display: Use kmalloc_array() instead of kmalloc()

2025-09-12 Thread James Flowers
Documentation/process/deprecated.rst recommends against the use of kmalloc with dynamic size calculations due to the risk of overflow and smaller allocation being made than the caller was expecting. This could lead to buffer overflow in code similar to the memcpy in amdgpu_dm_plane_add_modifier().

[PATCH 12/16] drm/amdgpu: More compact SDMA 4.4.2 IB emission

2025-09-12 Thread Tvrtko Ursulin
Avoid constant register reloads while emitting IBs by using a local write pointer and only updating the size at the end of each helper. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 108 ++- 1 file changed, 65 insertions(+), 43 deletions(-) dif

[PATCH] drm/amd: Drop unnecessary calls to smu_dpm_set_vpe_enable()

2025-09-12 Thread Mario Limonciello (AMD)
smu_hw_init() and smu_hw_fini() call smu_dpm_set_vpe_enable() for APUs as part of startup and teardown. These calls however are not necessary because vpe_hw_init()/vpe_hw_fini() will call at init/fini: ``` vpe_hw_init() / vpe_hw_fini() amdgpu_device_ip_set_powergating_state() vpe_set_powerg

[PATCH] drm/amd: Suspend drm clients during shutdown()

2025-09-12 Thread Mario Limonciello (AMD)
If the drm device is used for displaying the console then writing to the console could potentially cause a hang on the system if DCN is in IPS. This is more likely to happen after commit 6ea9a1781c70a ("Flush console log from kernel_power_off()") which has caused the console to get flushed at shutd

Re: [v2 1/2] drm/amdgpu: Simplify user queue locking with global device mutex

2025-09-12 Thread Alex Deucher
On Fri, Sep 12, 2025 at 10:06 AM Christian König wrote: > > On 12.09.25 15:02, Alex Deucher wrote: > > On Fri, Sep 12, 2025 at 7:17 AM Christian König > > wrote: > >> > >> On 12.09.25 11:31, Jesse.Zhang wrote: > >>> The current user queue implementation uses a dual-mutex scheme with > >>> both pe

Re: [v2 1/2] drm/amdgpu: Simplify user queue locking with global device mutex

2025-09-12 Thread Christian König
On 12.09.25 15:02, Alex Deucher wrote: > On Fri, Sep 12, 2025 at 7:17 AM Christian König > wrote: >> >> On 12.09.25 11:31, Jesse.Zhang wrote: >>> The current user queue implementation uses a dual-mutex scheme with >>> both per-device (adev->userq_mutex) and per-process (uq_mgr->userq_mutex) >>> lo

Re: [PATCH] drm/amdkfd: Replace kmalloc + copy_from_user with memdup_user

2025-09-12 Thread Thorsten Blum
Hi Alex, On 9. Sep 2025, at 17:35, Alex Deucher wrote: > Applied. Thanks! > > On Tue, Sep 9, 2025 at 11:29 AM Thorsten Blum wrote: >> >> Replace kmalloc() followed by copy_from_user() with memdup_user() to >> improve and simplify kfd_criu_restore_queue(). >> >> No functional changes intended.

RE: [PATCH] drm/amd/pm: move smu ppt->post_init() into smu_hw_init() stage

2025-09-12 Thread Lazar, Lijo
[Public] late_init is the right place to apply any late WA (after that there is no other opportunity). There are already multiple callbacks done during hw_init. Any other SOC specific thing can be done during one of them. Thanks, Lijo -Original Message- From: Wang, Yang(Kevin) Sent: Fr

RE: [PATCH v3 0/7] Add field encoding to gpu metrics fields

2025-09-12 Thread Kamal, Asad
[AMD Official Use Only - AMD Internal Distribution Only] Series is Reviewed-by: Asad Kamal Thanks & Regards Asad -Original Message- From: Lazar, Lijo Sent: Tuesday, September 9, 2025 11:18 AM To: amd-gfx@lists.freedesktop.org Cc: Zhang, Hawking ; Deucher, Alexander ; Kamal, Asad Sub

Re: [v2 1/2] drm/amdgpu: Simplify user queue locking with global device mutex

2025-09-12 Thread Christian König
On 12.09.25 11:31, Jesse.Zhang wrote: > The current user queue implementation uses a dual-mutex scheme with > both per-device (adev->userq_mutex) and per-process (uq_mgr->userq_mutex) > locking. This overcomplicated design creates potential deadlock scenarios > and makes the code harder to maintain

[PATCH v2 3/3] drm/amdgpu/dma-buf: Map/Unmap MMIO_REMAP as BAR register window (dma_map_resource)

2025-09-12 Thread Srinivasan Shanmugam
MMIO_REMAP (HDP flush page) exposes a hardware MMIO register window via a PCI BAR. Handle it as fixed I/O: - map(): if MMIO_REMAP, require P2P, compute the BAR address (bus_addr + page offset), and build a 1-entry sg_table with dma_map_resource(). - unmap(): if MMIO_REMAP, call dma_unmap_resour

[PATCH v2 1/3] drm/amdgpu/ttm: Pin 4K MMIO_REMAP Singleton BO at Init

2025-09-12 Thread Srinivasan Shanmugam
MMIO_REMAP (HDP flush page) is a hardware I/O window exposed via a PCI BAR. It must not migrate or be evicted. Allocate a single 4 KB GEM BO in AMDGPU_GEM_DOMAIN_MMIO_REMAP during TTM initialization when the hardware exposes a remap bus address and the host page size is <= 4 KiB. Reserve the BO a

RE: [PATCH] drm/amd/pm: move smu ppt->post_init() into smu_hw_init() stage

2025-09-12 Thread Wang, Yang(Kevin)
[Public] >> There needs to be a specific callback to do SOC specific things during >> late_init stage. Presently post_init is providing that, I don't think that >> should be moved. @post_init: Helper function for asic specific workarounds. In the previous code, the "post_init" was mainly used

Re: [RFC v8 04/12] drm/sched: Consolidate entity run queue management

2025-09-12 Thread Philipp Stanner
On Wed, 2025-09-03 at 11:18 +0100, Tvrtko Ursulin wrote: > Move the code dealing with entities entering and exiting run queues to > helpers to logically separate it from jobs entering and exiting entities. Sorry if I've asked this before, but does this strictly depend on the preceding patches or c

Re: [PATCH 04/11] PCI: Improve Resizable BAR functions kernel doc

2025-09-12 Thread Randy Dunlap
Hi, On 9/11/25 12:55 AM, Ilpo Järvinen wrote: > Fix the copy-pasted errors in the Resizable BAR handling functions > kernel doc and generally improve wording choices. > > Fix the formatting errors of the Return: line. > > Signed-off-by: Ilpo Järvinen > --- > drivers/pci/rebar.c | 29 ++

Re: evergreen_packet3_check:... radeon 0000:1d:00.0: vbo resource seems too big for the bo

2025-09-12 Thread Michel Dänzer
On 01.09.25 12:10, Borislav Petkov wrote: > On Mon, Sep 01, 2025 at 11:27:01AM +0200, Michel Dänzer wrote: >> use some kind of debug output API which doesn't hit dmesg by default > > You still want to be enabled by default so that normal users can see it and > actually report it. These messages a

Re: [PATCH] drm/amdkfd: Replace kmalloc + copy_from_user with memdup_user

2025-09-12 Thread Alex Deucher
Applied. Thanks! Alex On Tue, Sep 9, 2025 at 11:29 AM Thorsten Blum wrote: > > Replace kmalloc() followed by copy_from_user() with memdup_user() to > improve and simplify kfd_criu_restore_queue(). > > No functional changes intended. > > Signed-off-by: Thorsten Blum > --- > .../amd/amdkfd/kfd_

Re: [PATCH v5 1/3] drm/buddy: Optimize free block management with RB tree

2025-09-12 Thread Arunpravin Paneer Selvam
Hi Christian, On 9/9/2025 9:55 PM, Christian König wrote: On 09.09.25 16:05, Peter Zijlstra wrote: On Tue, Sep 09, 2025 at 02:04:30PM +0200, Christian König wrote: Hi Arun, On 09.09.25 11:56, Arunpravin Paneer Selvam wrote: [SNIP] +/** + * rbtree_for_each_entry_safe - iterate in-order over

Re: [PATCH v2 2/2] drm/amd/display: change dc stream color settings only in atomic commit

2025-09-12 Thread Melissa Wen
On 09/09/2025 12:00, Harry Wentland wrote: On 2025-09-01 17:33, Melissa Wen wrote: Don't update DC stream color components during atomic check. The driver will continue validating the new CRTC color state but will not change DC stream color components. The DC stream color state will only be

[PATCH] drm/amd/pm: move smu ppt->post_init() into smu_hw_init() stage

2025-09-12 Thread Yang Wang
it is more reasonable to move smu post_init() from late_init() to hw_init() stage, beacuse the smu specific hw init should be done before call other ip block late_init funcs. Signed-off-by: Yang Wang --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 ++-- 1 file changed, 6 insertions(+

[PATCH 04/11] PCI: Improve Resizable BAR functions kernel doc

2025-09-12 Thread Ilpo Järvinen
Fix the copy-pasted errors in the Resizable BAR handling functions kernel doc and generally improve wording choices. Fix the formatting errors of the Return: line. Signed-off-by: Ilpo Järvinen --- drivers/pci/rebar.c | 29 ++--- 1 file changed, 18 insertions(+), 11 delet

[PATCH] drm/amdgpu/userqueue: validate userptrs for userqueues

2025-09-12 Thread Sunil Khatri
userptrs could be changed by the user at any time and hence while locking all the bos before GPU start processing validate all the userptr bos. Signed-off-by: Sunil Khatri --- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 89 +++ 1 file changed, 89 insertions(+) diff --git a/d

[RFC PATCH 3/4] drm/amdgpu/dma-buf: Pin MMIO_REMAP at export; unpin on release

2025-09-12 Thread Srinivasan Shanmugam
This keeps MMIO_REMAP fixed for its whole lifetime. Other buffers (VRAM/GTT) are unchanged. This change pins it when we export the dma-buf. If the export fails, we undo the pin. When the dma-buf is released, we unpin it. MMIO_REMAP (HDP flush page) is a hardware I/O window, not normal RAM. It sho

RE: [PATCH 1/4] drm/amdgpu: fix userq VM validation v4

2025-09-12 Thread Liang, Prike
[Public] Regards, Prike > -Original Message- > From: Christian König > Sent: Thursday, September 11, 2025 8:10 PM > To: alexdeuc...@gmail.com; Khatri, Sunil ; Yang, Philip > ; Liang, Prike > Cc: amd-gfx@lists.freedesktop.org > Subject: [PATCH 1/4] drm/amdgpu: fix userq VM validati