/* * Copyright 2018 Advanced Micro Devices, Inc. * All Rights Reserved. * * 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. *
*/ #ifndef __AMDGPU_GMC_H__ #define __AMDGPU_GMC_H__
/* VA hole for 48bit addresses on Vega10 */ #define AMDGPU_GMC_HOLE_START 0x0000800000000000ULL #define AMDGPU_GMC_HOLE_END 0xffff800000000000ULL
/* * Hardware is programmed as if the hole doesn't exists with start and end * address values. * * This mask is used to remove the upper 16bits of the VA and so come up with * the linear addr value.
*/ #define AMDGPU_GMC_HOLE_MASK 0x0000ffffffffffffULL
/* * Ring size as power of two for the log of recent faults.
*/ #define AMDGPU_GMC_FAULT_RING_ORDER 8 #define AMDGPU_GMC_FAULT_RING_SIZE (1 << AMDGPU_GMC_FAULT_RING_ORDER)
/* * Hash size as power of two for the log of recent faults
*/ #define AMDGPU_GMC_FAULT_HASH_ORDER 8 #define AMDGPU_GMC_FAULT_HASH_SIZE (1 << AMDGPU_GMC_FAULT_HASH_ORDER)
/* * Number of IH timestamp ticks until a fault is considered handled
*/ #define AMDGPU_GMC_FAULT_TIMEOUT 5000ULL
/* * store the register distances between two continuous context domain * and invalidation engine.
*/
uint32_t ctx_distance;
uint32_t ctx_addr_distance; /* include LO32/HI32 */
uint32_t eng_distance;
uint32_t eng_addr_distance; /* include LO32/HI32 */
struct amdgpu_gmc { /* FB's physical address in MMIO space (for CPU to * map FB). This is different compared to the agp/ * gart/vram_start/end field as the later is from * GPU's view and aper_base is from CPU's view.
*/
resource_size_t aper_size;
resource_size_t aper_base; /* for some chips with <= 32MB we need to lie
* about vram size near mc fb location */
u64 mc_vram_size;
u64 visible_vram_size; /* AGP aperture start and end in MC address space * Driver find a hole in the MC address space * to place AGP by setting MC_VM_AGP_BOT/TOP registers * Under VMID0, logical address == MC address. AGP * aperture maps to physical bus or IOVA addressed. * AGP aperture is used to simulate FB in ZFB case. * AGP aperture is also used for page table in system * memory (mainly for APU). *
*/
u64 agp_size;
u64 agp_start;
u64 agp_end; /* GART aperture start and end in MC address space * Driver find a hole in the MC address space * to place GART by setting VM_CONTEXT0_PAGE_TABLE_START/END_ADDR * registers * Under VMID0, logical address inside GART aperture will * be translated through gpuvm gart page table to access * paged system memory
*/
u64 gart_size;
u64 gart_start;
u64 gart_end; /* Frame buffer aperture of this GPU device. Different from * fb_start (see below), this only covers the local GPU device. * If driver uses FB aperture to access FB, driver get fb_start from * MC_VM_FB_LOCATION_BASE (set by vbios) and calculate vram_start * of this local device by adding an offset inside the XGMI hive. * If driver uses GART table for VMID0 FB access, driver finds a hole in * VMID0's virtual address space to place the SYSVM aperture inside * which the first part is vram and the second part is gart (covering * system ram).
*/
u64 vram_start;
u64 vram_end; /* FB region , it's same as local vram region in single GPU, in XGMI * configuration, this region covers all GPUs in the same hive , * each GPU in the hive has the same view of this FB region . * GPU0's vram starts at offset (0 * segment size) , * GPU1 starts at offset (1 * segment size), etc.
*/
u64 fb_start;
u64 fb_end; unsigned vram_width;
u64 real_vram_size; int vram_mtrr;
u64 mc_mask; conststruct firmware *fw; /* MC firmware */
uint32_t fw_version; struct amdgpu_irq_src vm_fault;
uint32_t vram_type;
uint8_t vram_vendor;
uint32_t srbm_soft_reset; bool prt_warning;
uint32_t sdpif_register; /* apertures */
u64 shared_aperture_start;
u64 shared_aperture_end;
u64 private_aperture_start;
u64 private_aperture_end; /* protects concurrent invalidation */
spinlock_t invalidate_lock; bool translate_further; struct kfd_vm_fault_info *vm_fault_info;
atomic_t vm_fault_info_updated;
/** * amdgpu_gmc_vram_full_visible - Check if full VRAM is visible through the BAR * * @adev: amdgpu_device pointer * * Returns: * True if full VRAM is visible through the BAR
*/ staticinlinebool amdgpu_gmc_vram_full_visible(struct amdgpu_gmc *gmc)
{
WARN_ON(gmc->real_vram_size < gmc->visible_vram_size);
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.