summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
2026-09-02drm/amdgpu: Add handlers for ualink notificationsLijo Lazar
Add handlers for ualink notifications from ASP. Pause/Resume notifications are not handled currently. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add support to send ASP completionLijo Lazar
Add interface to send completion command to ASPs after processing ualink notifications. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Drop duplicate vpod check functionsLijo Lazar
Use __check_local_vpod_integrity and __check_vpod_info for vpod validation checks. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Assign accel state based on ASP configLijo Lazar
Add explicit PPOD/VPOD states for clarity. Assign the state accordingly as received from ASP during initialization. UALink accel state transitions: UNCONFIGURED -> PPOD_CONFIGURED -> VPOD_CONFIGURED -> READY -> ACTIVE - PPOD: sysfs ppod commit/ ASP {UAL_CFG_PPOD} - VPOD: sysfs vpod commit/ ASP {UAL_CFG_VPOD} | {UAL_CFG_STATION} - READY: local vpod integrity + activate_accelerator() - ACTIVE: all local gpus belonging to one vpod are configured and ready. deactivate_accelerator(): READY -> PPOD_CONFIGURED invalid vpod: -> ERROR Query ualink info during late init phase. Add a local vpod integrity check before activating devices in the vpod. Move the devices to active state once integrity check passes. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/admgpu: Seggregate ualink nht messagingLijo Lazar
Message handshake with NHT firmware is IP specific. Separate that into IP specific file. Move ip block v1.0 definition also the version specific file. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add ualink as separate ip blockLijo Lazar
Manage ualink lifecycle as a separate IP block. For now, use GC version to add specific ualink ip block. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Acked-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Separate out ualink init sequencesLijo Lazar
Separate out sw_init and hw_init part of ualink. ualink init errors are ignored temporarily. Keep ualink sysfs init together with sysfs init sequence of other IPs. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdkfd: program compute MQD coherent_aql_mtype on GFX 12.1Mukul Joshi
Name the compute MQD dword at offset 509 (previously reserved_509) as coherent_aql_mtype in v12_1_compute_mqd and program it when initializing a compute queue MQD. The field must be set to 0 whenever the driver maps local or remote memory as MTYPE_NC, and to 1 in all other cases. Add a shared helper gmc_v12_1_get_mtypes() as the single source of truth for the local and remote MTYPE decision (used by both the PTE coherence flags and the MQD programming), and gmc_v12_1_get_coherent_aql_mtype() which derives the 0/1 value from it. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: always use MTYPE_UC for remote memory on GFX 12.1Mukul Joshi
On GFX 12.1 remote (non-local / system) memory accesses should always be mapped as MTYPE_UC. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Initialize NPA PT/PDs to noretryFelix Kuehling
Unmapped NPA addresses should result in no-retry faults on the importer side. Signed-off-by: Felix Kuehling <felix.kuehling@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Pin page tables in NPA VMsFelix Kuehling
With latest POR, remote importers aren't guaranteed to support instruction replay-on-fault. Therefore, we cannot support unpinned exports or unpinned page-tables in the exporter mappings into NPA space. Signed-off-by: Felix Kuehling <felix.kuehling@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Use vm->last_update fence in UALink NPA unmap pathsMukul Joshi
amdgpu_ualink_map_npa_addr() already uses vm->last_update as the fence output for amdgpu_vm_update_range(), but the two unmap functions used a local fence variable instead. This is incorrect because amdgpu_vm_update_pdes() always commits into vm->last_update regardless of the fence passed to update_range(). As a result the PDE update job (submitted after the range update) would not wait before the TLB flush. As a result, switch both amdgpu_ualink_unmap_npa_addr() and amdgpu_ualink_unmap_all_npa_addr() to use vm->last_update fence. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Fix uninitialized fence in UALink NPA unmapMukul Joshi
Initialize fence to NULL in UALink NPA unmap to make sure we don't end with a garbage value which then gets incorrectly dereferenced inside amdgpu_vm_tlb_flush(). Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Increase UALink soft ring sizePhilip Yang
The UALink soft ring overflows under bursts of interrupts from remote GPUs. Size it at 16x the default soft ring to absorb the burst. While here, read the source accel_id and context dwords before the delegate path and log them, so the originating GPU is recorded for every interrupt. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: fix dma_buf leak in UALink exporter cleanupMukul Joshi
At export time the driver code always builds a dma_buf for the BO which is then shared for local imports. During cleanup, if there are no importers, which is true for local imports, we never free the dma_buf thus causing the memory leak. Fix by dropping the dma_buf reference in the no-importers branch as well. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Fix initialization flags for UALink XAsMukul Joshi
The UALink exp_xa, imp_xa and handle_invalid_xa xarrays are only ever accessed from process context: ioctls or workqueues. None of them run in softirq or hardirq context, so initializing the Xarray with BH flag is unnecessary. Drop XA_FLAGS_LOCK_BH and use the default plain-spinlock locking (xa_init() and the plain xa_* accessors). Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: initialize UALink importer node list headMukul Joshi
Initialize the list head at node creation so list_del_init() is safe on a node that has not yet been added to imp_handles_list. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: fix NPA-RELEASE race in UALink exporter cleanupMukul Joshi
Processing of NPA-RELEASE messages can run concurrently with sending of NPA-REVOKEs to all the importers. This can lead to a race condition where the interrupt handler can signal npa_done as soon as npa_release_bitmap becomes empty even though the cleanup worker was still sending NPA-REVOKEs to all the importers. This would prevent the cleanup worker thread to wait for all NPA-RELEASE messages to come before freeing the NPA addresses. Fix this by setting the importer_bitmap for all importers before sending any NPA-REVOKE messages. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Prevent double-free of drm_execFelix Kuehling
Always check the return value of amdgpu_ualink_reserve_npa_vm_and_bos. It's not expected to fail when used in non-interruptible mode. But if it fails anyway it calls drm_exec_fini. The caller must not call amdgpu_ualink_unreserve_npa_vm_and_bos in this case to avoid a double-free. Signed-off-by: Felix Kuehling <felix.kuehling@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: log remote memory MTYPE for GC 12.1.0Alex Sierra
MTYPE UC in A0 and MTYPE NC in A1 for remote memory Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Temporarily Flush TLB on NPA mapping alwaysMukul Joshi
This is a temporary patch to always flush TLBs when mapping NPA addresses. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Temporarily disable sending remote TLB shootdownsMukul Joshi
Remote TLB shootdown is not working currently and hangs the driver. As a result, temporarily prevent sending the Remote TLB shootdown messages to remote GPUs for now. Additionally, also temporarily set PTE.X = 0 for imported memory. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add debugfs to drop UALink protocol messagesMukul Joshi
Introduce a debugfs-controlled bitmap, amdgpu_ualink_drop_msg_bitmap, where each bit corresponds to a value from enum AMDGPU_UALINK_PROTOCOL_MESSAGES (e.g. NPA-REQ, NPA-RSP, NPA-FAIL, NPA-REVOKE, NPA-RELEASE). When a bit is set, the next incoming message of that type is dropped in amdgpu_ualink_process_irq() and the bit is atomically cleared via test_and_clear_bit(), so subsequent incoming messages are processed normally. This allows exercising the UALink connection reset and recovery paths (NPA-RSP timeout on the importer, retransmit/teardown on the exporter, etc.) by injecting a single packet loss from userspace, e.g.: # drop one NPA-REQ echo 0x08 > /sys/kernel/debug/dri/0/amdgpu_ualink_drop_msg_bitmap # drop one NPA-RSP echo 0x10 > /sys/kernel/debug/dri/0/amdgpu_ualink_drop_msg_bitmap The bitmap lives in struct amdgpu_ualink_mgr and is exposed via debugfs_create_ulong() next to the existing amdgpu_ualink_test entry. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Handle local GPUs in UALink importMukul Joshi
When the remote GPU is part of the local_accels array (same physical pod), bypass the HELLO/NPA-REQ messaging protocol and directly look up the exported BO in the peer's exporter xarray. Export it as a DMA-buf and return the fd to user-space without creating an importer xarray entry. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Send TLB shootdown on exported memory unmapMukul Joshi
Replace the stub implementation of TLB shootdown message with the actual implementation. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add handling for remote interruptsMukul Joshi
Add interrupt handling to process the NPA remote interrupts. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Setup PTE mappings for NPA addressesMukul Joshi
Map NPA addresses into importer's application page tables using a unique pairing of PTE fields. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Handle connection resetMukul Joshi
This patch adds connection reset handling. There can be two case which signal connection reset: 1. Receiving a HELLO message from a remote GPU, when the connection state is already setup, signals the remote GPU underwent a reset. 2. If no response received for a NPA-REQ/NPA_REVOKE message. In either of the two case, we cleanup all exported and imported ualink handles exchanged with the remote GPU. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Cleanup imported UALink handlesMukul Joshi
Add implementation for cleaning up ualink handles imported on the importer GPU and the corresponding xarray entries. This includes cleaning up the NPA BO dmabuf and freeing the NPA BO. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Cleanup exported UALink handlesMukul Joshi
Add implementation for freeing up exporter GPU's UALink handles and the corresponding xarray entries. Before freeing, the exporter GPU would send the NPA-REVOKE message to all the importers and wait for the NPA-RELEASE messages to come back before freeing the xarray entry. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: lock UALink import invalidation via drm_execMukul Joshi
Convert amdgpu_ualink_invalidate_import_mappings() to lock the BO and every client VM root PD in a single drm_exec transaction instead of borrowing the caller's reservation ticket via dma_resv_locking_ctx(). drm_exec owns its ww_acquire_ctx (exec.ticket) for the lifetime of the transaction, so amdgpu_vm_handle_moved() now uses &exec.ticket. Also, drop the explicit dma_resv_reserve_fences call as amdgpu_vm_lock_pd() already reserves 2 + num_fences on the same VM root PD. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Implement mechanism to revoke exported memoryMukul Joshi
This patch adds implementation to revoke exported memory. The exporter GPU will send a NPA-REVOKE message to inform the importer GPUs to stop using the exported memory. Once the importers stop using the exporter memory, they would send back a NPA-RELEASE message to inform the exporters to free the exporter memory. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Implement UALink handle import ioctlMukul Joshi
The ualink handle import process involves NPA protocol message exchange between the exporting and the importing GPUs in the rack scale setup. The process is as follows: 1. On the importing GPU, check if connection is already setup with the exporting GPU. If not, then exchange HELLO/HELLO_ACK messages to setup the connection. 2. Once the connection is setup, then exchange NPA-REQ/NPA-RSP messages with the exporter GPU to get the NPA address and size of the BO associated with the ualink handle. 3. On the exporter GPU, upon receipt of NPA-REQ message, do basic validation to check the ualink handle is valid. If not, send a NPA-FAIL message back. If its valid, then using the address allocator, allocate a NPA address, map it into the NPA VM and send back the address and size in the NPA-RSP to the importing GPU. 4. On the importer GPU, upon receipt of NPA-RSP message, allocate a NPA BO at the NPA address received in the NPA-RSP message. 5. Finally, generate the corresponding DMABuf for the NPA BO and return the dmabuf to user-space. 6. We are using refcount to keep track of the importer/exporter xarray entries. The cleanup functions for these are added in the subsequent patches. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add connection state managementMukul Joshi
Add functions for managing connection state between GPUs before import/export of ualink handles occurs. These functions handle the lifecycle of connections between GPUs,including handling GPU resets, in the NPA-based memory sharing model. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Implement UALink handle exportMukul Joshi
This patch adds the implementation for exporting a ualink handle associated with a BO. If the BO doesn't have a ualink handle generated yet, we first allocate a unique ualink handle, add it to a lookup table and return the handle to user-space. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add ualink handle to BOsMukul Joshi
Add a ualink handle to the amdgpu_bo struct. The ualink handle is a 128-bit unique identifier associated with a BO and is shared across the network to facilitate NPA based memory sharing across GPUs in a rack scale setup. We are only storing the low 64 bits of that handle in the BO struct as that is gauranteed to be unique. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Control NPA DMA-buf importingMukul Joshi
NPA DMA-Bufs can only be imported on the same device as the original BO. In source-identification mode NPA addresses are importer-specific. Each GPU needs to import the UALink handle by themselves. Sharing the NPA addresses between devices is meaningless and potentially dangerous. Put controls to ensure this is not violated. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Create a drm client for UALink NPA BOsMukul Joshi
Create a drm client for storing the GEM handles corresponding to NPA BOs. We always want to keep one GEM handle alive for the NPA BOs during the lifetime of the BO. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: UALink use LSDMA to send remote interrupt commandPhilip Yang
Add a use_lsdma flag to amdgpu_ualink_remote and set it during SDMA entity initialization. When use_lsdma is set, use amdgpu_lsdma_copy_mem() instead of SDMA IBs to write the remote command ring data, wptr and doorbell to their respective NPA GART addresses. This provides an alternative low-latency path for sending UALink remote interrupt commands via LSDMA, avoiding SDMA ring/IB overhead for these small NPA writes. v2: fix 32 bit build (Alex) Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink IH ring and enable interruptPhilip Yang
Register the UALink IRQ source with the IH subsystem. Hardware IH entries are re-queued onto a dedicated soft ring and drained by a work queue handler. Add the soft ring, worker, and delegate helper to the IRQ layer. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink software init, teardown, and resetPhilip Yang
Sequence the setup steps into a single init path with rollback on failure, and a teardown that halts firmware first. Hook both paths into the virtual pod commit so resources rebuild on reconfiguration. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink cross-GPU TLB shootdown and remote interruptPhilip Yang
Expose the two public send operations for remote TLB invalidation and remote interrupt delivery. Set up per-peer GART entries covering ring buffers, write pointer pages, and doorbells for every active remote GPU. v2: fix 32 bit build (Ivan) Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink firmware writeback address configurationPhilip Yang
Compute the writeback buffer addresses for a ring, send a configuration command to firmware, and mark the ring ready on acknowledgement. Configuration is deferred to first use. v2: fix 32 bit build (Ivan) Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/pagemap: Fix folio allocation fallback and use-after-putMatthew Brost
drm_pagemap_migrate_populate_ram_pfn() had two issues when populating RAM PFNs with higher-order folios: 1. The higher-order vma_alloc_folio()/folio_alloc() calls did not pass __GFP_NOWARN, so a THP allocation failure under memory pressure would spam the kernel log, and there was no fallback path despite a TODO comment stating one was needed. Add __GFP_NOWARN to the higher-order allocation and, on failure, fall back to order-0 allocations for the entire range originally covered by the failed higher-order allocation, leaving MIGRATE_PFN_COMPOUND unset for those PFNs. 2. In the free_pages error path, order was computed via folio_order(page_folio(page)) *after* put_page(page) had already dropped the reference, resulting in a use-after-free/put when that was the last reference on the page. Compute order before releasing the page. Introducing the fallback in 1. also requires the source page array handed to ->copy_to_ram() to be built differently. Both callers only populated the entry at the head of each source folio, relying on the copy callback to derive the rest of the folio from the order recorded in the matching drm_pagemap_addr. Once the destination has been demoted to order-0 folios the drm_pagemap_addr entries are per-page, so a source page is needed for every one of them; leaving them NULL makes the copy callback stop after the first page and the remainder of the range is never copied. The source folio is only split later, by migrate_vma_pages() / migrate_device_pages(), so its order cannot be used to detect the demotion - test the destination for MIGRATE_PFN_COMPOUND instead. Factor the array population out into drm_pagemap_migrate_populate_src_pages() and use it from both drm_pagemap_evict_to_ram() and __drm_pagemap_migrate_to_ram(). Fixes: ddeda6136038 ("drm/pagemap: Allocate folios when possible") Cc: stable@vger.kernel.org Assisted-by: GitHub_Copilot:claude-opus-5 Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://patch.msgid.link/20260902063504.3024362-2-matthew.brost@intel.com
2026-09-02drm/pagemap: dma-unmap pages before handling migration errorsMatthew Brost
drm_pagemap_migrate_unmap_pages() relies on the pages array to determine which pages require DMA unmapping. However, drm_pagemap_migration_unlock_put_pages() clears the array as part of its cleanup, leaving drm_pagemap_migrate_unmap_pages() with no valid page information if it is called afterward. Call drm_pagemap_migrate_unmap_pages() before drm_pagemap_migration_unlock_put_pages() so the pages array remains valid during DMA unmapping. Reported-by: Sashiko <sashiko-bot@kernel.org> Fixes: f86ad0ed620c ("drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap") Cc: stable@vger.kernel.org Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://patch.msgid.link/20260902063504.3024362-1-matthew.brost@intel.com
2026-09-02drm/amdgpu: Add UALink remote command packets and SDMA dispatchPhilip Yang
Add 16-dword packet layouts for TLB shootdown, remote interrupt, and writeback address update. The dispatch path issues three sequential SDMA copies (ring entry, write pointer, doorbell) and polls the firmware writeback buffer for the acknowledged sequence number. v2: fix 32 bit build (Alex) Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink ring buffer allocation and firmware initPhilip Yang
Allocate pinned memory for firmware metadata, ring buffers, and write and read pointer pages. Populate per-GPU metadata entries and send them to MPNHT firmware via SMN mailbox, then poll for a ready acknowledgement. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink GART helpers for NPA address accessPhilip Yang
Add helpers to insert and remove NPA addresses in the GART page table without a TTM buffer object, allowing the local SDMA engine to reach remote GPU ring buffers, write pointer pages, and doorbell addresses. v2: fix 32 bit build (Alex) Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink SDMA scheduler entitiesPhilip Yang
Allocate one GPU scheduler entity per SDMA instance for remote command dispatch. Commands to the same peer are serialized through one entity; different peers can be targeted concurrently by different SDMA engines. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-02drm/amdgpu: Add UALink NPA VM mapping for ring buffersPhilip Yang
Populate the NPA VM so remote GPUs can access local ring buffers and write pointer pages at their reserved NPA addresses. Teardown waits for DMA fences and issues a heavyweight TLB flush. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>