/* * Copyright 2016 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. * * Authors: Christian König
*/ #ifndef __AMDGPU_RING_H__ #define __AMDGPU_RING_H__
/* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED ((void *)0ul) #define AMDGPU_FENCE_OWNER_VM ((void *)1ul) #define AMDGPU_FENCE_OWNER_KFD ((void *)2ul)
enum amdgpu_ib_pool_type { /* Normal submissions to the top of the pipeline. */
AMDGPU_IB_POOL_DELAYED, /* Immediate submissions to the bottom of the pipeline. */
AMDGPU_IB_POOL_IMMEDIATE, /* Direct submission to the ring buffer during init and reset. */
AMDGPU_IB_POOL_DIRECT,
/* * Fences mark an event in the GPUs pipeline and are used * for GPU/CPU synchronization. When the fence is written, * it is expected that all buffers associated with that fence * are no longer in use by the associated ring on the GPU and * that the relevant GPU caches have been flushed.
*/
struct amdgpu_fence { struct dma_fence base;
/* RB, DMA, etc. */ struct amdgpu_ring *ring;
ktime_t start_timestamp;
/* wptr for the fence for resets */
u64 wptr; /* fence context for resets */
u64 context;
uint32_t seq;
};
/* provided by hw blocks that expose a ring buffer for commands */ struct amdgpu_ring_funcs { /** * @type: * * GFX, Compute, SDMA, UVD, VCE, VCN, VPE, KIQ, MES, UMSCH, and CPER * use ring buffers. The type field just identifies which component the * ring buffer is associated with.
*/ enum amdgpu_ring_type type;
uint32_t align_mask;
/** * @nop: * * Every block in the amdgpu has no-op instructions (e.g., GFX 10 * uses PACKET3(PACKET3_NOP, 0x3FFF), VCN 5 uses VCN_ENC_CMD_NO_OP, * etc). This field receives the specific no-op for the component * that initializes the ring.
*/
u32 nop; bool support_64bit_ptrs; bool no_user_fence; bool secure_submission_supported;
/** * @extra_bytes: * * Optional extra space in bytes that is added to the ring size * when allocating the BO that holds the contents of the ring. * This space isn't used for command submission to the ring, * but is just there to satisfy some hardware requirements or * implement workarounds. It's up to the implementation of each * specific ring to initialize this space.
*/ unsigned extra_bytes;
/** * @wptr: * * This is part of the Ring buffer implementation and represents the * write pointer. The wptr determines where the host has written.
*/
u64 wptr;
/** * @wptr_old: * * Before update wptr with the new value, usually the old value is * stored in the wptr_old.
*/
u64 wptr_old; unsigned ring_size;
/** * @max_dw: * * Maximum number of DWords for ring allocation. This information is * provided at the ring initialization time, and each IP block can * specify a specific value. Check places that invoke * amdgpu_ring_init() to see the maximum size per block.
*/ unsigned max_dw;
/** * @count_dw: * * This value starts with the maximum amount of DWords supported by the * ring. This value is updated based on the ring manipulation.
*/ int count_dw;
uint64_t gpu_addr;
/** * @ptr_mask: * * Some IPs provide support for 64-bit pointers and others for 32-bit * only; this behavior is component-specific and defined by the field * support_64bit_ptr. If the IP block supports 64-bits, the mask * 0xffffffffffffffff is set; otherwise, this value assumes buf_mask. * Notice that this field is used to keep wptr under a valid range.
*/
uint64_t ptr_mask;
/** * @buf_mask: * * Buffer mask is a value used to keep wptr count under its * thresholding. Buffer mask initialized during the ring buffer * initialization time, and it is defined as (ring_size / 4) -1.
*/
uint32_t buf_mask;
u32 idx;
u32 xcc_id;
u32 xcp_id;
u32 me;
u32 pipe;
u32 queue; struct amdgpu_bo *mqd_obj;
uint64_t mqd_gpu_addr; void *mqd_ptr; unsigned mqd_size;
uint64_t eop_gpu_addr;
u32 doorbell_index; bool use_doorbell; bool use_pollmem; unsigned wptr_offs;
u64 wptr_gpu_addr;
/** * @wptr_cpu_addr: * * This is the CPU address pointer in the writeback slot. This is used * to commit changes to the GPU.
*/ volatile u32 *wptr_cpu_addr; unsigned fence_offs;
u64 fence_gpu_addr; volatile u32 *fence_cpu_addr;
uint64_t current_ctx; char name[16];
u32 trail_seq; unsigned trail_fence_offs;
u64 trail_fence_gpu_addr; volatile u32 *trail_fence_cpu_addr; unsigned cond_exe_offs;
u64 cond_exe_gpu_addr; volatile u32 *cond_exe_cpu_addr; unsignedint set_q_mode_offs;
u32 *set_q_mode_ptr;
u64 set_q_mode_token; unsigned vm_hub; unsigned vm_inv_eng; struct dma_fence *vmid_wait; bool has_compute_vm_bug; bool no_scheduler; bool no_user_submission; int hw_prio; unsigned num_hw_submission;
atomic_t *sched_score;
bool is_sw_ring; unsignedint entry_index; /* store the cached rptr to restore after reset */
uint64_t cached_rptr;
};
¤ 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.0.11Bemerkung:
(vorverarbeitet)
¤
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.