// SPDX-License-Identifier: GPL-2.0 OR MIT /* * Copyright 2016-2022 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE.
*/
/* * GFX9 SQ Interrupts * * There are 3 encoding types of interrupts sourced from SQ sent as a 44-bit * packet to the Interrupt Handler: * Auto - Generated by the SQG (various cmd overflows, timestamps etc) * Wave - Generated by S_SENDMSG through a shader program * Error - HW generated errors (Illegal instructions, Memviols, EDC etc) * * The 44-bit packet is mapped as {context_id1[7:0],context_id0[31:0]} plus * 4-bits for VMID (SOC15_VMID_FROM_IH_ENTRY) as such: * * - context_id0[27:26] * Encoding type (0 = Auto, 1 = Wave, 2 = Error) * * - context_id0[13] * PRIV bit indicates that Wave S_SEND or error occurred within trap * * - {context_id1[7:0],context_id0[31:28],context_id0[11:0]} * 24-bit data with the following layout per encoding type: * Auto - only context_id0[8:0] is used, which reports various interrupts * generated by SQG. The rest is 0. * Wave - user data sent from m0 via S_SENDMSG * Error - Error type (context_id1[7:4]), Error Details (rest of bits) * * The other context_id bits show coordinates (SE/SH/CU/SIMD/WAVE) for wave * S_SENDMSG and Errors. These are 0 for Auto.
*/
/* all queues of a process will be unmapped in one time */
old_poison = atomic_cmpxchg(&p->poison, 0, 1);
kfd_unref_process(p); if (old_poison) return;
switch (client_id) { case SOC15_IH_CLIENTID_SE0SH: case SOC15_IH_CLIENTID_SE1SH: case SOC15_IH_CLIENTID_SE2SH: case SOC15_IH_CLIENTID_SE3SH: case SOC15_IH_CLIENTID_UTCL2:
block = AMDGPU_RAS_BLOCK__GFX; if (amdgpu_ip_version(dev->adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3)) { /* driver mode-2 for gfx poison is only supported by
* pmfw 0x00557300 and onwards */ if (dev->adev->pm.fw_version < 0x00557300)
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; else
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
} elseif (amdgpu_ip_version(dev->adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4)) { /* driver mode-2 for gfx poison is only supported by
* pmfw 0x05550C00 and onwards */ if (dev->adev->pm.fw_version < 0x05550C00)
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; else
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
} else {
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
}
amdgpu_ras_set_err_poison(dev->adev, AMDGPU_RAS_BLOCK__GFX); break; case SOC15_IH_CLIENTID_VMC: case SOC15_IH_CLIENTID_VMC1:
block = AMDGPU_RAS_BLOCK__MMHUB;
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; break; case SOC15_IH_CLIENTID_SDMA0: case SOC15_IH_CLIENTID_SDMA1: case SOC15_IH_CLIENTID_SDMA2: case SOC15_IH_CLIENTID_SDMA3: case SOC15_IH_CLIENTID_SDMA4:
block = AMDGPU_RAS_BLOCK__SDMA; if (amdgpu_ip_version(dev->adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 2)) { /* driver mode-2 for gfx poison is only supported by
* pmfw 0x00557300 and onwards */ if (dev->adev->pm.fw_version < 0x00557300)
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; else
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
} elseif (amdgpu_ip_version(dev->adev, SDMA0_HWIP, 0) == IP_VERSION(4, 4, 5)) { /* driver mode-2 for gfx poison is only supported by
* pmfw 0x05550C00 and onwards */ if (dev->adev->pm.fw_version < 0x05550C00)
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; else
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
} else {
reset = AMDGPU_RAS_GPU_RESET_MODE2_RESET;
}
amdgpu_ras_set_err_poison(dev->adev, AMDGPU_RAS_BLOCK__SDMA); break; default:
dev_warn(dev->adev->dev, "client %d does not support poison consumption\n", client_id); return;
}
ret = amdgpu_ras_mark_ras_event(dev->adev, type); if (ret) return;
/* This is a known issue for gfx9. Under non HWS, pasid is not set * in the interrupt payload, so we need to find out the pasid on our * own.
*/ if (!pasid && dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) { const uint32_t pasid_mask = 0xffff;
/* If there is no valid PASID, it's likely a bug */ if (WARN_ONCE(pasid == 0, "Bug: No PASID in KFD interrupt")) returnfalse;
/* Workaround CP firmware sending bogus signals with 0 context_id. * Those can be safely ignored on hardware and firmware versions that * include a valid context_id on legitimate signals. This avoids the * slow path in kfd_signal_event_interrupt that scans all event slots * for signaled events.
*/ if (source_id == SOC15_INTSRC_CP_END_OF_PIPE) {
uint32_t context_id =
SOC15_CONTEXT_ID0_FROM_IH_ENTRY(ih_ring_entry);
if (context_id == 0 && context_id_expected(dev->kfd)) returnfalse;
}
/* Interrupt types we care about: various signals and faults. * They will be forwarded to a work queue (see below).
*/ return source_id == SOC15_INTSRC_CP_END_OF_PIPE ||
source_id == SOC15_INTSRC_SDMA_TRAP ||
source_id == SOC15_INTSRC_SDMA_ECC ||
source_id == SOC15_INTSRC_SQ_INTERRUPT_MSG ||
source_id == SOC15_INTSRC_CP_BAD_OPCODE ||
KFD_IRQ_IS_FENCE(client_id, source_id) ||
((client_id == SOC15_IH_CLIENTID_VMC ||
client_id == SOC15_IH_CLIENTID_VMC1 ||
client_id == SOC15_IH_CLIENTID_UTCL2) &&
!amdgpu_no_queue_eviction_on_vm_fault);
}
/* * For GFX 9.4.3, process the interrupt if: * - NodeID field in IH entry matches the corresponding bit * set in interrupt_bitmap Bits 0-15. * OR * - If partition mode is CPX and interrupt came from * Node_id 0,4,8,12, then check if the Bit (16 + client id) * is set in interrupt bitmap Bits 16-31.
*/
node_id = SOC15_NODEID_FROM_IH_ENTRY(ih_ring_entry);
vmid = SOC15_VMID_FROM_IH_ENTRY(ih_ring_entry); if (kfd_irq_is_from_node(node, node_id, vmid)) return event_interrupt_isr_v9(node, ih_ring_entry,
patched_ihre, patched_flag); returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.