/* * Copyright 2023 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. *
*/
/* Maximum log buffer size for MES. Needs to be updated if MES expands MES_EVT_INTR_HIST_LOG_12 */ #define AMDGPU_MES_LOG_BUFFER_SIZE 0xC000
/* Driver submits one API(cmd) as a single Frame and this command size is same for all API * to ease the debugging and parsing of ring buffer.
*/ enum {API_FRAME_SIZE_IN_DWORDS = 64};
/* To avoid command in scheduler context to be overwritten whenenver mutilple interrupts come in, * this creates another queue
*/ enum {API_NUMBER_OF_COMMAND_MAX = 32};
/* * MES will set api_completion_fence_value in api_completion_fence_addr * when it can successflly process the API. MES will also trigger * following interrupt when it finish process the API no matter success * or failed. * Interrupt source id 181 (EOP) with context ID (DW 6 in the int * cookie) set to 0xb1 and context type set to 8. Driver side need * to enable TIME_STAMP_INT_ENABLE in CPC_INT_CNTL for MES pipe to * catch this interrupt. * Driver side also need to set enable_mes_fence_int = 1 in * set_HW_resource package to enable this fence interrupt. * when the API process failed. * lowre 32 bits set to 0. * higher 32 bits set as follows (bit shift within high 32) * bit 0 - 7 API specific error code. * bit 8 - 15 API OPCODE. * bit 16 - 23 MISC OPCODE if any * bit 24 - 30 ERROR category (API_ERROR_XXX) * bit 31 Set to 1 to indicate error status *
*/ enum { MES_SCH_ERROR_CODE_HEADER_SHIFT_12 = 8 }; enum { MES_SCH_ERROR_CODE_MISC_OP_SHIFT_12 = 16 }; enum { MES_ERROR_CATEGORY_SHIFT_12 = 24 }; enum { MES_API_STATUS_ERROR_SHIFT_12 = 31 };
enum SET_DEBUG_VMID_OPERATIONS {
DEBUG_VMID_OP_PROGRAM = 0,
DEBUG_VMID_OP_ALLOCATE = 1,
DEBUG_VMID_OP_RELEASE = 2,
DEBUG_VMID_OP_VM_SETUP = 3 // used to set up the debug vmid page table in the kernel queue case (mode 1)
};
union MESAPI__SET_SCHEDULING_CONFIG { struct { union MES_API_HEADER header; /* Grace period when preempting another priority band for this priority band. * The value for idle priority band is ignored, as it never preempts other bands.
*/
uint64_t grace_period_other_levels[AMD_PRIORITY_NUM_LEVELS];
/* Default quantum for scheduling across processes within a priority band. */
uint64_t process_quantum_for_level[AMD_PRIORITY_NUM_LEVELS];
/* Default grace period for processes that preempt each other within a priority band.*/
uint64_t process_grace_period_same_level[AMD_PRIORITY_NUM_LEVELS];
/* For normal level this field specifies the target GPU percentage in situations when it's starved by the high level. * Valid values are between 0 and 50, with the default being 10.
*/
uint32_t normal_yield_percent;
union MESAPI__SUSPEND { struct { union MES_API_HEADER header; /* false - suspend all gangs; true - specific gang */ struct {
uint32_t suspend_all_gangs : 1;
uint32_t reserved : 31;
}; /* gang_context_addr is valid only if suspend_all = false */
union MESAPI__RESET { struct { union MES_API_HEADER header;
struct { /* Only reset the queue given by doorbell_offset (not entire gang) */
uint32_t reset_queue_only : 1; /* Hang detection first then reset any queues that are hung */
uint32_t hang_detect_then_reset : 1; /* Only do hang detection (no reset) */
uint32_t hang_detect_only : 1; /* Reset HP and LP kernel queues not managed by MES */
uint32_t reset_legacy_gfx : 1; /* Fallback to use conneceted queue index when CP_CNTX_STAT method fails (gfx pipe 0) */
uint32_t use_connected_queue_index : 1; /* For gfx pipe 1 */
uint32_t use_connected_queue_index_p1 : 1;
uint32_t reserved : 26;
};
uint64_t gang_context_addr;
/* valid only if reset_queue_only = true */
uint32_t doorbell_offset;
/* valid only if hang_detect_then_reset = true */
uint64_t doorbell_offset_addr; enum MES_QUEUE_TYPE queue_type;
/* valid only if reset_legacy_gfx = true */
uint32_t pipe_id_lp;
uint32_t queue_id_lp;
uint32_t vmid_id_lp;
uint64_t mqd_mc_addr_lp;
uint32_t doorbell_offset_lp;
uint64_t wptr_addr_lp;
union MESAPI__SET_LOGGING_BUFFER { struct { union MES_API_HEADER header; /* There are separate log buffers for each queue type */ enum MES_QUEUE_TYPE log_type; /* Log buffer GPU Address */
uint64_t logging_buffer_addr; /* number of entries in the log buffer */
uint32_t number_of_entries; /* Entry index at which CPU interrupt needs to be signalled */
uint32_t interrupt_entry;
union MESAPI__SET_SE_MODE { struct { union MES_API_HEADER header; /* the new SE mode to apply*/ enum MES_SE_MODE new_se_mode; /* the fence to make sure the ItCpgCtxtSync packet is completed */
uint64_t cpg_ctxt_sync_fence_addr;
uint32_t cpg_ctxt_sync_fence_value; /* log_seq_time - Scheduler logs the switch seq start/end ts in the IH cookies */ union { struct {
uint32_t log_seq_time : 1;
uint32_t reserved : 31;
};
uint32_t uint32_all;
}; struct MES_API_STATUS api_status;
};
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.