162306a36Sopenharmony_ci/* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*- 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. 462306a36Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Fremont, California. 562306a36Sopenharmony_ci * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. 662306a36Sopenharmony_ci * Copyright 2014 Advanced Micro Devices, Inc. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 962306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 1062306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 1162306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1262306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 1362306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1662306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1962306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2062306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2162306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 2262306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2362306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2462306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2562306a36Sopenharmony_ci * 2662306a36Sopenharmony_ci * Authors: 2762306a36Sopenharmony_ci * Kevin E. Martin <martin@valinux.com> 2862306a36Sopenharmony_ci * Gareth Hughes <gareth@valinux.com> 2962306a36Sopenharmony_ci * Keith Whitwell <keith@tungstengraphics.com> 3062306a36Sopenharmony_ci */ 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#ifndef __AMDGPU_DRM_H__ 3362306a36Sopenharmony_ci#define __AMDGPU_DRM_H__ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#include "drm.h" 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#if defined(__cplusplus) 3862306a36Sopenharmony_ciextern "C" { 3962306a36Sopenharmony_ci#endif 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_CREATE 0x00 4262306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_MMAP 0x01 4362306a36Sopenharmony_ci#define DRM_AMDGPU_CTX 0x02 4462306a36Sopenharmony_ci#define DRM_AMDGPU_BO_LIST 0x03 4562306a36Sopenharmony_ci#define DRM_AMDGPU_CS 0x04 4662306a36Sopenharmony_ci#define DRM_AMDGPU_INFO 0x05 4762306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_METADATA 0x06 4862306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_WAIT_IDLE 0x07 4962306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_VA 0x08 5062306a36Sopenharmony_ci#define DRM_AMDGPU_WAIT_CS 0x09 5162306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_OP 0x10 5262306a36Sopenharmony_ci#define DRM_AMDGPU_GEM_USERPTR 0x11 5362306a36Sopenharmony_ci#define DRM_AMDGPU_WAIT_FENCES 0x12 5462306a36Sopenharmony_ci#define DRM_AMDGPU_VM 0x13 5562306a36Sopenharmony_ci#define DRM_AMDGPU_FENCE_TO_HANDLE 0x14 5662306a36Sopenharmony_ci#define DRM_AMDGPU_SCHED 0x15 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) 5962306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) 6062306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx) 6162306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list) 6262306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs) 6362306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info) 6462306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata) 6562306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle) 6662306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va) 6762306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) 6862306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) 6962306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) 7062306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences) 7162306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm) 7262306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle) 7362306a36Sopenharmony_ci#define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci/** 7662306a36Sopenharmony_ci * DOC: memory domains 7762306a36Sopenharmony_ci * 7862306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible. 7962306a36Sopenharmony_ci * Memory in this pool could be swapped out to disk if there is pressure. 8062306a36Sopenharmony_ci * 8162306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the 8262306a36Sopenharmony_ci * GPU's virtual address space via gart. Gart memory linearizes non-contiguous 8362306a36Sopenharmony_ci * pages of system memory, allows GPU access system memory in a linearized 8462306a36Sopenharmony_ci * fashion. 8562306a36Sopenharmony_ci * 8662306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory 8762306a36Sopenharmony_ci * carved out by the BIOS. 8862306a36Sopenharmony_ci * 8962306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data 9062306a36Sopenharmony_ci * across shader threads. 9162306a36Sopenharmony_ci * 9262306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the 9362306a36Sopenharmony_ci * execution of all the waves on a device. 9462306a36Sopenharmony_ci * 9562306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines 9662306a36Sopenharmony_ci * for appending data. 9762306a36Sopenharmony_ci * 9862306a36Sopenharmony_ci * %AMDGPU_GEM_DOMAIN_DOORBELL Doorbell. It is an MMIO region for 9962306a36Sopenharmony_ci * signalling user mode queues. 10062306a36Sopenharmony_ci */ 10162306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_CPU 0x1 10262306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_GTT 0x2 10362306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_VRAM 0x4 10462306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_GDS 0x8 10562306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_GWS 0x10 10662306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_OA 0x20 10762306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_DOORBELL 0x40 10862306a36Sopenharmony_ci#define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \ 10962306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_GTT | \ 11062306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_VRAM | \ 11162306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_GDS | \ 11262306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_GWS | \ 11362306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_OA | \ 11462306a36Sopenharmony_ci AMDGPU_GEM_DOMAIN_DOORBELL) 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci/* Flag that CPU access will be required for the case of VRAM domain */ 11762306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0) 11862306a36Sopenharmony_ci/* Flag that CPU access will not work, this VRAM domain is invisible */ 11962306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1) 12062306a36Sopenharmony_ci/* Flag that USWC attributes should be used for GTT */ 12162306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2) 12262306a36Sopenharmony_ci/* Flag that the memory should be in VRAM and cleared */ 12362306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3) 12462306a36Sopenharmony_ci/* Flag that allocating the BO should use linear VRAM */ 12562306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5) 12662306a36Sopenharmony_ci/* Flag that BO is always valid in this VM */ 12762306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6) 12862306a36Sopenharmony_ci/* Flag that BO sharing will be explicitly synchronized */ 12962306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7) 13062306a36Sopenharmony_ci/* Flag that indicates allocating MQD gart on GFX9, where the mtype 13162306a36Sopenharmony_ci * for the second page onward should be set to NC. It should never 13262306a36Sopenharmony_ci * be used by user space applications. 13362306a36Sopenharmony_ci */ 13462306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8) 13562306a36Sopenharmony_ci/* Flag that BO may contain sensitive data that must be wiped before 13662306a36Sopenharmony_ci * releasing the memory 13762306a36Sopenharmony_ci */ 13862306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9) 13962306a36Sopenharmony_ci/* Flag that BO will be encrypted and that the TMZ bit should be 14062306a36Sopenharmony_ci * set in the PTEs when mapping this buffer via GPUVM or 14162306a36Sopenharmony_ci * accessing it with various hw blocks 14262306a36Sopenharmony_ci */ 14362306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10) 14462306a36Sopenharmony_ci/* Flag that BO will be used only in preemptible context, which does 14562306a36Sopenharmony_ci * not require GTT memory accounting 14662306a36Sopenharmony_ci */ 14762306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_PREEMPTIBLE (1 << 11) 14862306a36Sopenharmony_ci/* Flag that BO can be discarded under memory pressure without keeping the 14962306a36Sopenharmony_ci * content. 15062306a36Sopenharmony_ci */ 15162306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_DISCARDABLE (1 << 12) 15262306a36Sopenharmony_ci/* Flag that BO is shared coherently between multiple devices or CPU threads. 15362306a36Sopenharmony_ci * May depend on GPU instructions to flush caches explicitly 15462306a36Sopenharmony_ci * 15562306a36Sopenharmony_ci * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and 15662306a36Sopenharmony_ci * may override the MTYPE selected in AMDGPU_VA_OP_MAP. 15762306a36Sopenharmony_ci */ 15862306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_COHERENT (1 << 13) 15962306a36Sopenharmony_ci/* Flag that BO should not be cached by GPU. Coherent without having to flush 16062306a36Sopenharmony_ci * GPU caches explicitly 16162306a36Sopenharmony_ci * 16262306a36Sopenharmony_ci * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and 16362306a36Sopenharmony_ci * may override the MTYPE selected in AMDGPU_VA_OP_MAP. 16462306a36Sopenharmony_ci */ 16562306a36Sopenharmony_ci#define AMDGPU_GEM_CREATE_UNCACHED (1 << 14) 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_cistruct drm_amdgpu_gem_create_in { 16862306a36Sopenharmony_ci /** the requested memory size */ 16962306a36Sopenharmony_ci __u64 bo_size; 17062306a36Sopenharmony_ci /** physical start_addr alignment in bytes for some HW requirements */ 17162306a36Sopenharmony_ci __u64 alignment; 17262306a36Sopenharmony_ci /** the requested memory domains */ 17362306a36Sopenharmony_ci __u64 domains; 17462306a36Sopenharmony_ci /** allocation flags */ 17562306a36Sopenharmony_ci __u64 domain_flags; 17662306a36Sopenharmony_ci}; 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_cistruct drm_amdgpu_gem_create_out { 17962306a36Sopenharmony_ci /** returned GEM object handle */ 18062306a36Sopenharmony_ci __u32 handle; 18162306a36Sopenharmony_ci __u32 _pad; 18262306a36Sopenharmony_ci}; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ciunion drm_amdgpu_gem_create { 18562306a36Sopenharmony_ci struct drm_amdgpu_gem_create_in in; 18662306a36Sopenharmony_ci struct drm_amdgpu_gem_create_out out; 18762306a36Sopenharmony_ci}; 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci/** Opcode to create new residency list. */ 19062306a36Sopenharmony_ci#define AMDGPU_BO_LIST_OP_CREATE 0 19162306a36Sopenharmony_ci/** Opcode to destroy previously created residency list */ 19262306a36Sopenharmony_ci#define AMDGPU_BO_LIST_OP_DESTROY 1 19362306a36Sopenharmony_ci/** Opcode to update resource information in the list */ 19462306a36Sopenharmony_ci#define AMDGPU_BO_LIST_OP_UPDATE 2 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_cistruct drm_amdgpu_bo_list_in { 19762306a36Sopenharmony_ci /** Type of operation */ 19862306a36Sopenharmony_ci __u32 operation; 19962306a36Sopenharmony_ci /** Handle of list or 0 if we want to create one */ 20062306a36Sopenharmony_ci __u32 list_handle; 20162306a36Sopenharmony_ci /** Number of BOs in list */ 20262306a36Sopenharmony_ci __u32 bo_number; 20362306a36Sopenharmony_ci /** Size of each element describing BO */ 20462306a36Sopenharmony_ci __u32 bo_info_size; 20562306a36Sopenharmony_ci /** Pointer to array describing BOs */ 20662306a36Sopenharmony_ci __u64 bo_info_ptr; 20762306a36Sopenharmony_ci}; 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_cistruct drm_amdgpu_bo_list_entry { 21062306a36Sopenharmony_ci /** Handle of BO */ 21162306a36Sopenharmony_ci __u32 bo_handle; 21262306a36Sopenharmony_ci /** New (if specified) BO priority to be used during migration */ 21362306a36Sopenharmony_ci __u32 bo_priority; 21462306a36Sopenharmony_ci}; 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_cistruct drm_amdgpu_bo_list_out { 21762306a36Sopenharmony_ci /** Handle of resource list */ 21862306a36Sopenharmony_ci __u32 list_handle; 21962306a36Sopenharmony_ci __u32 _pad; 22062306a36Sopenharmony_ci}; 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ciunion drm_amdgpu_bo_list { 22362306a36Sopenharmony_ci struct drm_amdgpu_bo_list_in in; 22462306a36Sopenharmony_ci struct drm_amdgpu_bo_list_out out; 22562306a36Sopenharmony_ci}; 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci/* context related */ 22862306a36Sopenharmony_ci#define AMDGPU_CTX_OP_ALLOC_CTX 1 22962306a36Sopenharmony_ci#define AMDGPU_CTX_OP_FREE_CTX 2 23062306a36Sopenharmony_ci#define AMDGPU_CTX_OP_QUERY_STATE 3 23162306a36Sopenharmony_ci#define AMDGPU_CTX_OP_QUERY_STATE2 4 23262306a36Sopenharmony_ci#define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5 23362306a36Sopenharmony_ci#define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci/* GPU reset status */ 23662306a36Sopenharmony_ci#define AMDGPU_CTX_NO_RESET 0 23762306a36Sopenharmony_ci/* this the context caused it */ 23862306a36Sopenharmony_ci#define AMDGPU_CTX_GUILTY_RESET 1 23962306a36Sopenharmony_ci/* some other context caused it */ 24062306a36Sopenharmony_ci#define AMDGPU_CTX_INNOCENT_RESET 2 24162306a36Sopenharmony_ci/* unknown cause */ 24262306a36Sopenharmony_ci#define AMDGPU_CTX_UNKNOWN_RESET 3 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/* indicate gpu reset occured after ctx created */ 24562306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0) 24662306a36Sopenharmony_ci/* indicate vram lost occured after ctx created */ 24762306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1) 24862306a36Sopenharmony_ci/* indicate some job from this context once cause gpu hang */ 24962306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2) 25062306a36Sopenharmony_ci/* indicate some errors are detected by RAS */ 25162306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3) 25262306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4) 25362306a36Sopenharmony_ci/* indicate that the reset hasn't completed yet */ 25462306a36Sopenharmony_ci#define AMDGPU_CTX_QUERY2_FLAGS_RESET_IN_PROGRESS (1<<5) 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci/* Context priority level */ 25762306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_UNSET -2048 25862306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_VERY_LOW -1023 25962306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_LOW -512 26062306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_NORMAL 0 26162306a36Sopenharmony_ci/* 26262306a36Sopenharmony_ci * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires 26362306a36Sopenharmony_ci * CAP_SYS_NICE or DRM_MASTER 26462306a36Sopenharmony_ci*/ 26562306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_HIGH 512 26662306a36Sopenharmony_ci#define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci/* select a stable profiling pstate for perfmon tools */ 26962306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK 0xf 27062306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_NONE 0 27162306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_STANDARD 1 27262306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK 2 27362306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3 27462306a36Sopenharmony_ci#define AMDGPU_CTX_STABLE_PSTATE_PEAK 4 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_cistruct drm_amdgpu_ctx_in { 27762306a36Sopenharmony_ci /** AMDGPU_CTX_OP_* */ 27862306a36Sopenharmony_ci __u32 op; 27962306a36Sopenharmony_ci /** Flags */ 28062306a36Sopenharmony_ci __u32 flags; 28162306a36Sopenharmony_ci __u32 ctx_id; 28262306a36Sopenharmony_ci /** AMDGPU_CTX_PRIORITY_* */ 28362306a36Sopenharmony_ci __s32 priority; 28462306a36Sopenharmony_ci}; 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ciunion drm_amdgpu_ctx_out { 28762306a36Sopenharmony_ci struct { 28862306a36Sopenharmony_ci __u32 ctx_id; 28962306a36Sopenharmony_ci __u32 _pad; 29062306a36Sopenharmony_ci } alloc; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_ci struct { 29362306a36Sopenharmony_ci /** For future use, no flags defined so far */ 29462306a36Sopenharmony_ci __u64 flags; 29562306a36Sopenharmony_ci /** Number of resets caused by this context so far. */ 29662306a36Sopenharmony_ci __u32 hangs; 29762306a36Sopenharmony_ci /** Reset status since the last call of the ioctl. */ 29862306a36Sopenharmony_ci __u32 reset_status; 29962306a36Sopenharmony_ci } state; 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci struct { 30262306a36Sopenharmony_ci __u32 flags; 30362306a36Sopenharmony_ci __u32 _pad; 30462306a36Sopenharmony_ci } pstate; 30562306a36Sopenharmony_ci}; 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ciunion drm_amdgpu_ctx { 30862306a36Sopenharmony_ci struct drm_amdgpu_ctx_in in; 30962306a36Sopenharmony_ci union drm_amdgpu_ctx_out out; 31062306a36Sopenharmony_ci}; 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci/* vm ioctl */ 31362306a36Sopenharmony_ci#define AMDGPU_VM_OP_RESERVE_VMID 1 31462306a36Sopenharmony_ci#define AMDGPU_VM_OP_UNRESERVE_VMID 2 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_cistruct drm_amdgpu_vm_in { 31762306a36Sopenharmony_ci /** AMDGPU_VM_OP_* */ 31862306a36Sopenharmony_ci __u32 op; 31962306a36Sopenharmony_ci __u32 flags; 32062306a36Sopenharmony_ci}; 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_cistruct drm_amdgpu_vm_out { 32362306a36Sopenharmony_ci /** For future use, no flags defined so far */ 32462306a36Sopenharmony_ci __u64 flags; 32562306a36Sopenharmony_ci}; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ciunion drm_amdgpu_vm { 32862306a36Sopenharmony_ci struct drm_amdgpu_vm_in in; 32962306a36Sopenharmony_ci struct drm_amdgpu_vm_out out; 33062306a36Sopenharmony_ci}; 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_ci/* sched ioctl */ 33362306a36Sopenharmony_ci#define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1 33462306a36Sopenharmony_ci#define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_cistruct drm_amdgpu_sched_in { 33762306a36Sopenharmony_ci /* AMDGPU_SCHED_OP_* */ 33862306a36Sopenharmony_ci __u32 op; 33962306a36Sopenharmony_ci __u32 fd; 34062306a36Sopenharmony_ci /** AMDGPU_CTX_PRIORITY_* */ 34162306a36Sopenharmony_ci __s32 priority; 34262306a36Sopenharmony_ci __u32 ctx_id; 34362306a36Sopenharmony_ci}; 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ciunion drm_amdgpu_sched { 34662306a36Sopenharmony_ci struct drm_amdgpu_sched_in in; 34762306a36Sopenharmony_ci}; 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ci/* 35062306a36Sopenharmony_ci * This is not a reliable API and you should expect it to fail for any 35162306a36Sopenharmony_ci * number of reasons and have fallback path that do not use userptr to 35262306a36Sopenharmony_ci * perform any operation. 35362306a36Sopenharmony_ci */ 35462306a36Sopenharmony_ci#define AMDGPU_GEM_USERPTR_READONLY (1 << 0) 35562306a36Sopenharmony_ci#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1) 35662306a36Sopenharmony_ci#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2) 35762306a36Sopenharmony_ci#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3) 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_cistruct drm_amdgpu_gem_userptr { 36062306a36Sopenharmony_ci __u64 addr; 36162306a36Sopenharmony_ci __u64 size; 36262306a36Sopenharmony_ci /* AMDGPU_GEM_USERPTR_* */ 36362306a36Sopenharmony_ci __u32 flags; 36462306a36Sopenharmony_ci /* Resulting GEM handle */ 36562306a36Sopenharmony_ci __u32 handle; 36662306a36Sopenharmony_ci}; 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci/* SI-CI-VI: */ 36962306a36Sopenharmony_ci/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ 37062306a36Sopenharmony_ci#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 37162306a36Sopenharmony_ci#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf 37262306a36Sopenharmony_ci#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4 37362306a36Sopenharmony_ci#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f 37462306a36Sopenharmony_ci#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9 37562306a36Sopenharmony_ci#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7 37662306a36Sopenharmony_ci#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12 37762306a36Sopenharmony_ci#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7 37862306a36Sopenharmony_ci#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15 37962306a36Sopenharmony_ci#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3 38062306a36Sopenharmony_ci#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17 38162306a36Sopenharmony_ci#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3 38262306a36Sopenharmony_ci#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19 38362306a36Sopenharmony_ci#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3 38462306a36Sopenharmony_ci#define AMDGPU_TILING_NUM_BANKS_SHIFT 21 38562306a36Sopenharmony_ci#define AMDGPU_TILING_NUM_BANKS_MASK 0x3 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/* GFX9 and later: */ 38862306a36Sopenharmony_ci#define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0 38962306a36Sopenharmony_ci#define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f 39062306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT 5 39162306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_OFFSET_256B_MASK 0xFFFFFF 39262306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT 29 39362306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF 39462306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43 39562306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1 39662306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44 39762306a36Sopenharmony_ci#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1 39862306a36Sopenharmony_ci#define AMDGPU_TILING_SCANOUT_SHIFT 63 39962306a36Sopenharmony_ci#define AMDGPU_TILING_SCANOUT_MASK 0x1 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci/* Set/Get helpers for tiling flags. */ 40262306a36Sopenharmony_ci#define AMDGPU_TILING_SET(field, value) \ 40362306a36Sopenharmony_ci (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) 40462306a36Sopenharmony_ci#define AMDGPU_TILING_GET(value, field) \ 40562306a36Sopenharmony_ci (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK) 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1 40862306a36Sopenharmony_ci#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci/** The same structure is shared for input/output */ 41162306a36Sopenharmony_cistruct drm_amdgpu_gem_metadata { 41262306a36Sopenharmony_ci /** GEM Object handle */ 41362306a36Sopenharmony_ci __u32 handle; 41462306a36Sopenharmony_ci /** Do we want get or set metadata */ 41562306a36Sopenharmony_ci __u32 op; 41662306a36Sopenharmony_ci struct { 41762306a36Sopenharmony_ci /** For future use, no flags defined so far */ 41862306a36Sopenharmony_ci __u64 flags; 41962306a36Sopenharmony_ci /** family specific tiling info */ 42062306a36Sopenharmony_ci __u64 tiling_info; 42162306a36Sopenharmony_ci __u32 data_size_bytes; 42262306a36Sopenharmony_ci __u32 data[64]; 42362306a36Sopenharmony_ci } data; 42462306a36Sopenharmony_ci}; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_cistruct drm_amdgpu_gem_mmap_in { 42762306a36Sopenharmony_ci /** the GEM object handle */ 42862306a36Sopenharmony_ci __u32 handle; 42962306a36Sopenharmony_ci __u32 _pad; 43062306a36Sopenharmony_ci}; 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_cistruct drm_amdgpu_gem_mmap_out { 43362306a36Sopenharmony_ci /** mmap offset from the vma offset manager */ 43462306a36Sopenharmony_ci __u64 addr_ptr; 43562306a36Sopenharmony_ci}; 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_ciunion drm_amdgpu_gem_mmap { 43862306a36Sopenharmony_ci struct drm_amdgpu_gem_mmap_in in; 43962306a36Sopenharmony_ci struct drm_amdgpu_gem_mmap_out out; 44062306a36Sopenharmony_ci}; 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_cistruct drm_amdgpu_gem_wait_idle_in { 44362306a36Sopenharmony_ci /** GEM object handle */ 44462306a36Sopenharmony_ci __u32 handle; 44562306a36Sopenharmony_ci /** For future use, no flags defined so far */ 44662306a36Sopenharmony_ci __u32 flags; 44762306a36Sopenharmony_ci /** Absolute timeout to wait */ 44862306a36Sopenharmony_ci __u64 timeout; 44962306a36Sopenharmony_ci}; 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_cistruct drm_amdgpu_gem_wait_idle_out { 45262306a36Sopenharmony_ci /** BO status: 0 - BO is idle, 1 - BO is busy */ 45362306a36Sopenharmony_ci __u32 status; 45462306a36Sopenharmony_ci /** Returned current memory domain */ 45562306a36Sopenharmony_ci __u32 domain; 45662306a36Sopenharmony_ci}; 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ciunion drm_amdgpu_gem_wait_idle { 45962306a36Sopenharmony_ci struct drm_amdgpu_gem_wait_idle_in in; 46062306a36Sopenharmony_ci struct drm_amdgpu_gem_wait_idle_out out; 46162306a36Sopenharmony_ci}; 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_cistruct drm_amdgpu_wait_cs_in { 46462306a36Sopenharmony_ci /* Command submission handle 46562306a36Sopenharmony_ci * handle equals 0 means none to wait for 46662306a36Sopenharmony_ci * handle equals ~0ull means wait for the latest sequence number 46762306a36Sopenharmony_ci */ 46862306a36Sopenharmony_ci __u64 handle; 46962306a36Sopenharmony_ci /** Absolute timeout to wait */ 47062306a36Sopenharmony_ci __u64 timeout; 47162306a36Sopenharmony_ci __u32 ip_type; 47262306a36Sopenharmony_ci __u32 ip_instance; 47362306a36Sopenharmony_ci __u32 ring; 47462306a36Sopenharmony_ci __u32 ctx_id; 47562306a36Sopenharmony_ci}; 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_cistruct drm_amdgpu_wait_cs_out { 47862306a36Sopenharmony_ci /** CS status: 0 - CS completed, 1 - CS still busy */ 47962306a36Sopenharmony_ci __u64 status; 48062306a36Sopenharmony_ci}; 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_ciunion drm_amdgpu_wait_cs { 48362306a36Sopenharmony_ci struct drm_amdgpu_wait_cs_in in; 48462306a36Sopenharmony_ci struct drm_amdgpu_wait_cs_out out; 48562306a36Sopenharmony_ci}; 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_cistruct drm_amdgpu_fence { 48862306a36Sopenharmony_ci __u32 ctx_id; 48962306a36Sopenharmony_ci __u32 ip_type; 49062306a36Sopenharmony_ci __u32 ip_instance; 49162306a36Sopenharmony_ci __u32 ring; 49262306a36Sopenharmony_ci __u64 seq_no; 49362306a36Sopenharmony_ci}; 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_cistruct drm_amdgpu_wait_fences_in { 49662306a36Sopenharmony_ci /** This points to uint64_t * which points to fences */ 49762306a36Sopenharmony_ci __u64 fences; 49862306a36Sopenharmony_ci __u32 fence_count; 49962306a36Sopenharmony_ci __u32 wait_all; 50062306a36Sopenharmony_ci __u64 timeout_ns; 50162306a36Sopenharmony_ci}; 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_cistruct drm_amdgpu_wait_fences_out { 50462306a36Sopenharmony_ci __u32 status; 50562306a36Sopenharmony_ci __u32 first_signaled; 50662306a36Sopenharmony_ci}; 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ciunion drm_amdgpu_wait_fences { 50962306a36Sopenharmony_ci struct drm_amdgpu_wait_fences_in in; 51062306a36Sopenharmony_ci struct drm_amdgpu_wait_fences_out out; 51162306a36Sopenharmony_ci}; 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ci#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 51462306a36Sopenharmony_ci#define AMDGPU_GEM_OP_SET_PLACEMENT 1 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci/* Sets or returns a value associated with a buffer. */ 51762306a36Sopenharmony_cistruct drm_amdgpu_gem_op { 51862306a36Sopenharmony_ci /** GEM object handle */ 51962306a36Sopenharmony_ci __u32 handle; 52062306a36Sopenharmony_ci /** AMDGPU_GEM_OP_* */ 52162306a36Sopenharmony_ci __u32 op; 52262306a36Sopenharmony_ci /** Input or return value */ 52362306a36Sopenharmony_ci __u64 value; 52462306a36Sopenharmony_ci}; 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci#define AMDGPU_VA_OP_MAP 1 52762306a36Sopenharmony_ci#define AMDGPU_VA_OP_UNMAP 2 52862306a36Sopenharmony_ci#define AMDGPU_VA_OP_CLEAR 3 52962306a36Sopenharmony_ci#define AMDGPU_VA_OP_REPLACE 4 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci/* Delay the page table update till the next CS */ 53262306a36Sopenharmony_ci#define AMDGPU_VM_DELAY_UPDATE (1 << 0) 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci/* Mapping flags */ 53562306a36Sopenharmony_ci/* readable mapping */ 53662306a36Sopenharmony_ci#define AMDGPU_VM_PAGE_READABLE (1 << 1) 53762306a36Sopenharmony_ci/* writable mapping */ 53862306a36Sopenharmony_ci#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) 53962306a36Sopenharmony_ci/* executable mapping, new for VI */ 54062306a36Sopenharmony_ci#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) 54162306a36Sopenharmony_ci/* partially resident texture */ 54262306a36Sopenharmony_ci#define AMDGPU_VM_PAGE_PRT (1 << 4) 54362306a36Sopenharmony_ci/* MTYPE flags use bit 5 to 8 */ 54462306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_MASK (0xf << 5) 54562306a36Sopenharmony_ci/* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */ 54662306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_DEFAULT (0 << 5) 54762306a36Sopenharmony_ci/* Use Non Coherent MTYPE instead of default MTYPE */ 54862306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_NC (1 << 5) 54962306a36Sopenharmony_ci/* Use Write Combine MTYPE instead of default MTYPE */ 55062306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_WC (2 << 5) 55162306a36Sopenharmony_ci/* Use Cache Coherent MTYPE instead of default MTYPE */ 55262306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_CC (3 << 5) 55362306a36Sopenharmony_ci/* Use UnCached MTYPE instead of default MTYPE */ 55462306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_UC (4 << 5) 55562306a36Sopenharmony_ci/* Use Read Write MTYPE instead of default MTYPE */ 55662306a36Sopenharmony_ci#define AMDGPU_VM_MTYPE_RW (5 << 5) 55762306a36Sopenharmony_ci/* don't allocate MALL */ 55862306a36Sopenharmony_ci#define AMDGPU_VM_PAGE_NOALLOC (1 << 9) 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_cistruct drm_amdgpu_gem_va { 56162306a36Sopenharmony_ci /** GEM object handle */ 56262306a36Sopenharmony_ci __u32 handle; 56362306a36Sopenharmony_ci __u32 _pad; 56462306a36Sopenharmony_ci /** AMDGPU_VA_OP_* */ 56562306a36Sopenharmony_ci __u32 operation; 56662306a36Sopenharmony_ci /** AMDGPU_VM_PAGE_* */ 56762306a36Sopenharmony_ci __u32 flags; 56862306a36Sopenharmony_ci /** va address to assign . Must be correctly aligned.*/ 56962306a36Sopenharmony_ci __u64 va_address; 57062306a36Sopenharmony_ci /** Specify offset inside of BO to assign. Must be correctly aligned.*/ 57162306a36Sopenharmony_ci __u64 offset_in_bo; 57262306a36Sopenharmony_ci /** Specify mapping size. Must be correctly aligned. */ 57362306a36Sopenharmony_ci __u64 map_size; 57462306a36Sopenharmony_ci}; 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci#define AMDGPU_HW_IP_GFX 0 57762306a36Sopenharmony_ci#define AMDGPU_HW_IP_COMPUTE 1 57862306a36Sopenharmony_ci#define AMDGPU_HW_IP_DMA 2 57962306a36Sopenharmony_ci#define AMDGPU_HW_IP_UVD 3 58062306a36Sopenharmony_ci#define AMDGPU_HW_IP_VCE 4 58162306a36Sopenharmony_ci#define AMDGPU_HW_IP_UVD_ENC 5 58262306a36Sopenharmony_ci#define AMDGPU_HW_IP_VCN_DEC 6 58362306a36Sopenharmony_ci/* 58462306a36Sopenharmony_ci * From VCN4, AMDGPU_HW_IP_VCN_ENC is re-used to support 58562306a36Sopenharmony_ci * both encoding and decoding jobs. 58662306a36Sopenharmony_ci */ 58762306a36Sopenharmony_ci#define AMDGPU_HW_IP_VCN_ENC 7 58862306a36Sopenharmony_ci#define AMDGPU_HW_IP_VCN_JPEG 8 58962306a36Sopenharmony_ci#define AMDGPU_HW_IP_NUM 9 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_IB 0x01 59462306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_FENCE 0x02 59562306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03 59662306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04 59762306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 59862306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 59962306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07 60062306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08 60162306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09 60262306a36Sopenharmony_ci#define AMDGPU_CHUNK_ID_CP_GFX_SHADOW 0x0a 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk { 60562306a36Sopenharmony_ci __u32 chunk_id; 60662306a36Sopenharmony_ci __u32 length_dw; 60762306a36Sopenharmony_ci __u64 chunk_data; 60862306a36Sopenharmony_ci}; 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_cistruct drm_amdgpu_cs_in { 61162306a36Sopenharmony_ci /** Rendering context id */ 61262306a36Sopenharmony_ci __u32 ctx_id; 61362306a36Sopenharmony_ci /** Handle of resource list associated with CS */ 61462306a36Sopenharmony_ci __u32 bo_list_handle; 61562306a36Sopenharmony_ci __u32 num_chunks; 61662306a36Sopenharmony_ci __u32 flags; 61762306a36Sopenharmony_ci /** this points to __u64 * which point to cs chunks */ 61862306a36Sopenharmony_ci __u64 chunks; 61962306a36Sopenharmony_ci}; 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_cistruct drm_amdgpu_cs_out { 62262306a36Sopenharmony_ci __u64 handle; 62362306a36Sopenharmony_ci}; 62462306a36Sopenharmony_ci 62562306a36Sopenharmony_ciunion drm_amdgpu_cs { 62662306a36Sopenharmony_ci struct drm_amdgpu_cs_in in; 62762306a36Sopenharmony_ci struct drm_amdgpu_cs_out out; 62862306a36Sopenharmony_ci}; 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci/* Specify flags to be used for IB */ 63162306a36Sopenharmony_ci 63262306a36Sopenharmony_ci/* This IB should be submitted to CE */ 63362306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_CE (1<<0) 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci/* Preamble flag, which means the IB could be dropped if no context switch */ 63662306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_PREAMBLE (1<<1) 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_ci/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */ 63962306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_PREEMPT (1<<2) 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci/* The IB fence should do the L2 writeback but not invalidate any shader 64262306a36Sopenharmony_ci * caches (L2/vL1/sL1/I$). */ 64362306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3) 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci/* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER. 64662306a36Sopenharmony_ci * This will reset wave ID counters for the IB. 64762306a36Sopenharmony_ci */ 64862306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4) 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci/* Flag the IB as secure (TMZ) 65162306a36Sopenharmony_ci */ 65262306a36Sopenharmony_ci#define AMDGPU_IB_FLAGS_SECURE (1 << 5) 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_ci/* Tell KMD to flush and invalidate caches 65562306a36Sopenharmony_ci */ 65662306a36Sopenharmony_ci#define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6) 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_ib { 65962306a36Sopenharmony_ci __u32 _pad; 66062306a36Sopenharmony_ci /** AMDGPU_IB_FLAG_* */ 66162306a36Sopenharmony_ci __u32 flags; 66262306a36Sopenharmony_ci /** Virtual address to begin IB execution */ 66362306a36Sopenharmony_ci __u64 va_start; 66462306a36Sopenharmony_ci /** Size of submission */ 66562306a36Sopenharmony_ci __u32 ib_bytes; 66662306a36Sopenharmony_ci /** HW IP to submit to */ 66762306a36Sopenharmony_ci __u32 ip_type; 66862306a36Sopenharmony_ci /** HW IP index of the same type to submit to */ 66962306a36Sopenharmony_ci __u32 ip_instance; 67062306a36Sopenharmony_ci /** Ring index to submit to */ 67162306a36Sopenharmony_ci __u32 ring; 67262306a36Sopenharmony_ci}; 67362306a36Sopenharmony_ci 67462306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_dep { 67562306a36Sopenharmony_ci __u32 ip_type; 67662306a36Sopenharmony_ci __u32 ip_instance; 67762306a36Sopenharmony_ci __u32 ring; 67862306a36Sopenharmony_ci __u32 ctx_id; 67962306a36Sopenharmony_ci __u64 handle; 68062306a36Sopenharmony_ci}; 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_fence { 68362306a36Sopenharmony_ci __u32 handle; 68462306a36Sopenharmony_ci __u32 offset; 68562306a36Sopenharmony_ci}; 68662306a36Sopenharmony_ci 68762306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_sem { 68862306a36Sopenharmony_ci __u32 handle; 68962306a36Sopenharmony_ci}; 69062306a36Sopenharmony_ci 69162306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_syncobj { 69262306a36Sopenharmony_ci __u32 handle; 69362306a36Sopenharmony_ci __u32 flags; 69462306a36Sopenharmony_ci __u64 point; 69562306a36Sopenharmony_ci}; 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0 69862306a36Sopenharmony_ci#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1 69962306a36Sopenharmony_ci#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_ciunion drm_amdgpu_fence_to_handle { 70262306a36Sopenharmony_ci struct { 70362306a36Sopenharmony_ci struct drm_amdgpu_fence fence; 70462306a36Sopenharmony_ci __u32 what; 70562306a36Sopenharmony_ci __u32 pad; 70662306a36Sopenharmony_ci } in; 70762306a36Sopenharmony_ci struct { 70862306a36Sopenharmony_ci __u32 handle; 70962306a36Sopenharmony_ci } out; 71062306a36Sopenharmony_ci}; 71162306a36Sopenharmony_ci 71262306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_data { 71362306a36Sopenharmony_ci union { 71462306a36Sopenharmony_ci struct drm_amdgpu_cs_chunk_ib ib_data; 71562306a36Sopenharmony_ci struct drm_amdgpu_cs_chunk_fence fence_data; 71662306a36Sopenharmony_ci }; 71762306a36Sopenharmony_ci}; 71862306a36Sopenharmony_ci 71962306a36Sopenharmony_ci#define AMDGPU_CS_CHUNK_CP_GFX_SHADOW_FLAGS_INIT_SHADOW 0x1 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_cistruct drm_amdgpu_cs_chunk_cp_gfx_shadow { 72262306a36Sopenharmony_ci __u64 shadow_va; 72362306a36Sopenharmony_ci __u64 csa_va; 72462306a36Sopenharmony_ci __u64 gds_va; 72562306a36Sopenharmony_ci __u64 flags; 72662306a36Sopenharmony_ci}; 72762306a36Sopenharmony_ci 72862306a36Sopenharmony_ci/* 72962306a36Sopenharmony_ci * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU 73062306a36Sopenharmony_ci * 73162306a36Sopenharmony_ci */ 73262306a36Sopenharmony_ci#define AMDGPU_IDS_FLAGS_FUSION 0x1 73362306a36Sopenharmony_ci#define AMDGPU_IDS_FLAGS_PREEMPTION 0x2 73462306a36Sopenharmony_ci#define AMDGPU_IDS_FLAGS_TMZ 0x4 73562306a36Sopenharmony_ci#define AMDGPU_IDS_FLAGS_CONFORMANT_TRUNC_COORD 0x8 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_ci/* indicate if acceleration can be working */ 73862306a36Sopenharmony_ci#define AMDGPU_INFO_ACCEL_WORKING 0x00 73962306a36Sopenharmony_ci/* get the crtc_id from the mode object id? */ 74062306a36Sopenharmony_ci#define AMDGPU_INFO_CRTC_FROM_ID 0x01 74162306a36Sopenharmony_ci/* query hw IP info */ 74262306a36Sopenharmony_ci#define AMDGPU_INFO_HW_IP_INFO 0x02 74362306a36Sopenharmony_ci/* query hw IP instance count for the specified type */ 74462306a36Sopenharmony_ci#define AMDGPU_INFO_HW_IP_COUNT 0x03 74562306a36Sopenharmony_ci/* timestamp for GL_ARB_timer_query */ 74662306a36Sopenharmony_ci#define AMDGPU_INFO_TIMESTAMP 0x05 74762306a36Sopenharmony_ci/* Query the firmware version */ 74862306a36Sopenharmony_ci#define AMDGPU_INFO_FW_VERSION 0x0e 74962306a36Sopenharmony_ci /* Subquery id: Query VCE firmware version */ 75062306a36Sopenharmony_ci #define AMDGPU_INFO_FW_VCE 0x1 75162306a36Sopenharmony_ci /* Subquery id: Query UVD firmware version */ 75262306a36Sopenharmony_ci #define AMDGPU_INFO_FW_UVD 0x2 75362306a36Sopenharmony_ci /* Subquery id: Query GMC firmware version */ 75462306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GMC 0x03 75562306a36Sopenharmony_ci /* Subquery id: Query GFX ME firmware version */ 75662306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_ME 0x04 75762306a36Sopenharmony_ci /* Subquery id: Query GFX PFP firmware version */ 75862306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_PFP 0x05 75962306a36Sopenharmony_ci /* Subquery id: Query GFX CE firmware version */ 76062306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_CE 0x06 76162306a36Sopenharmony_ci /* Subquery id: Query GFX RLC firmware version */ 76262306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLC 0x07 76362306a36Sopenharmony_ci /* Subquery id: Query GFX MEC firmware version */ 76462306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_MEC 0x08 76562306a36Sopenharmony_ci /* Subquery id: Query SMC firmware version */ 76662306a36Sopenharmony_ci #define AMDGPU_INFO_FW_SMC 0x0a 76762306a36Sopenharmony_ci /* Subquery id: Query SDMA firmware version */ 76862306a36Sopenharmony_ci #define AMDGPU_INFO_FW_SDMA 0x0b 76962306a36Sopenharmony_ci /* Subquery id: Query PSP SOS firmware version */ 77062306a36Sopenharmony_ci #define AMDGPU_INFO_FW_SOS 0x0c 77162306a36Sopenharmony_ci /* Subquery id: Query PSP ASD firmware version */ 77262306a36Sopenharmony_ci #define AMDGPU_INFO_FW_ASD 0x0d 77362306a36Sopenharmony_ci /* Subquery id: Query VCN firmware version */ 77462306a36Sopenharmony_ci #define AMDGPU_INFO_FW_VCN 0x0e 77562306a36Sopenharmony_ci /* Subquery id: Query GFX RLC SRLC firmware version */ 77662306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f 77762306a36Sopenharmony_ci /* Subquery id: Query GFX RLC SRLG firmware version */ 77862306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10 77962306a36Sopenharmony_ci /* Subquery id: Query GFX RLC SRLS firmware version */ 78062306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11 78162306a36Sopenharmony_ci /* Subquery id: Query DMCU firmware version */ 78262306a36Sopenharmony_ci #define AMDGPU_INFO_FW_DMCU 0x12 78362306a36Sopenharmony_ci #define AMDGPU_INFO_FW_TA 0x13 78462306a36Sopenharmony_ci /* Subquery id: Query DMCUB firmware version */ 78562306a36Sopenharmony_ci #define AMDGPU_INFO_FW_DMCUB 0x14 78662306a36Sopenharmony_ci /* Subquery id: Query TOC firmware version */ 78762306a36Sopenharmony_ci #define AMDGPU_INFO_FW_TOC 0x15 78862306a36Sopenharmony_ci /* Subquery id: Query CAP firmware version */ 78962306a36Sopenharmony_ci #define AMDGPU_INFO_FW_CAP 0x16 79062306a36Sopenharmony_ci /* Subquery id: Query GFX RLCP firmware version */ 79162306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLCP 0x17 79262306a36Sopenharmony_ci /* Subquery id: Query GFX RLCV firmware version */ 79362306a36Sopenharmony_ci #define AMDGPU_INFO_FW_GFX_RLCV 0x18 79462306a36Sopenharmony_ci /* Subquery id: Query MES_KIQ firmware version */ 79562306a36Sopenharmony_ci #define AMDGPU_INFO_FW_MES_KIQ 0x19 79662306a36Sopenharmony_ci /* Subquery id: Query MES firmware version */ 79762306a36Sopenharmony_ci #define AMDGPU_INFO_FW_MES 0x1a 79862306a36Sopenharmony_ci /* Subquery id: Query IMU firmware version */ 79962306a36Sopenharmony_ci #define AMDGPU_INFO_FW_IMU 0x1b 80062306a36Sopenharmony_ci 80162306a36Sopenharmony_ci/* number of bytes moved for TTM migration */ 80262306a36Sopenharmony_ci#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f 80362306a36Sopenharmony_ci/* the used VRAM size */ 80462306a36Sopenharmony_ci#define AMDGPU_INFO_VRAM_USAGE 0x10 80562306a36Sopenharmony_ci/* the used GTT size */ 80662306a36Sopenharmony_ci#define AMDGPU_INFO_GTT_USAGE 0x11 80762306a36Sopenharmony_ci/* Information about GDS, etc. resource configuration */ 80862306a36Sopenharmony_ci#define AMDGPU_INFO_GDS_CONFIG 0x13 80962306a36Sopenharmony_ci/* Query information about VRAM and GTT domains */ 81062306a36Sopenharmony_ci#define AMDGPU_INFO_VRAM_GTT 0x14 81162306a36Sopenharmony_ci/* Query information about register in MMR address space*/ 81262306a36Sopenharmony_ci#define AMDGPU_INFO_READ_MMR_REG 0x15 81362306a36Sopenharmony_ci/* Query information about device: rev id, family, etc. */ 81462306a36Sopenharmony_ci#define AMDGPU_INFO_DEV_INFO 0x16 81562306a36Sopenharmony_ci/* visible vram usage */ 81662306a36Sopenharmony_ci#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17 81762306a36Sopenharmony_ci/* number of TTM buffer evictions */ 81862306a36Sopenharmony_ci#define AMDGPU_INFO_NUM_EVICTIONS 0x18 81962306a36Sopenharmony_ci/* Query memory about VRAM and GTT domains */ 82062306a36Sopenharmony_ci#define AMDGPU_INFO_MEMORY 0x19 82162306a36Sopenharmony_ci/* Query vce clock table */ 82262306a36Sopenharmony_ci#define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A 82362306a36Sopenharmony_ci/* Query vbios related information */ 82462306a36Sopenharmony_ci#define AMDGPU_INFO_VBIOS 0x1B 82562306a36Sopenharmony_ci /* Subquery id: Query vbios size */ 82662306a36Sopenharmony_ci #define AMDGPU_INFO_VBIOS_SIZE 0x1 82762306a36Sopenharmony_ci /* Subquery id: Query vbios image */ 82862306a36Sopenharmony_ci #define AMDGPU_INFO_VBIOS_IMAGE 0x2 82962306a36Sopenharmony_ci /* Subquery id: Query vbios info */ 83062306a36Sopenharmony_ci #define AMDGPU_INFO_VBIOS_INFO 0x3 83162306a36Sopenharmony_ci/* Query UVD handles */ 83262306a36Sopenharmony_ci#define AMDGPU_INFO_NUM_HANDLES 0x1C 83362306a36Sopenharmony_ci/* Query sensor related information */ 83462306a36Sopenharmony_ci#define AMDGPU_INFO_SENSOR 0x1D 83562306a36Sopenharmony_ci /* Subquery id: Query GPU shader clock */ 83662306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1 83762306a36Sopenharmony_ci /* Subquery id: Query GPU memory clock */ 83862306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2 83962306a36Sopenharmony_ci /* Subquery id: Query GPU temperature */ 84062306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3 84162306a36Sopenharmony_ci /* Subquery id: Query GPU load */ 84262306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4 84362306a36Sopenharmony_ci /* Subquery id: Query average GPU power */ 84462306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5 84562306a36Sopenharmony_ci /* Subquery id: Query northbridge voltage */ 84662306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_VDDNB 0x6 84762306a36Sopenharmony_ci /* Subquery id: Query graphics voltage */ 84862306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 84962306a36Sopenharmony_ci /* Subquery id: Query GPU stable pstate shader clock */ 85062306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8 85162306a36Sopenharmony_ci /* Subquery id: Query GPU stable pstate memory clock */ 85262306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9 85362306a36Sopenharmony_ci /* Subquery id: Query GPU peak pstate shader clock */ 85462306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_SCLK 0xa 85562306a36Sopenharmony_ci /* Subquery id: Query GPU peak pstate memory clock */ 85662306a36Sopenharmony_ci #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_MCLK 0xb 85762306a36Sopenharmony_ci/* Number of VRAM page faults on CPU access. */ 85862306a36Sopenharmony_ci#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E 85962306a36Sopenharmony_ci#define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F 86062306a36Sopenharmony_ci/* query ras mask of enabled features*/ 86162306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20 86262306a36Sopenharmony_ci/* RAS MASK: UMC (VRAM) */ 86362306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0) 86462306a36Sopenharmony_ci/* RAS MASK: SDMA */ 86562306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1) 86662306a36Sopenharmony_ci/* RAS MASK: GFX */ 86762306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2) 86862306a36Sopenharmony_ci/* RAS MASK: MMHUB */ 86962306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3) 87062306a36Sopenharmony_ci/* RAS MASK: ATHUB */ 87162306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4) 87262306a36Sopenharmony_ci/* RAS MASK: PCIE */ 87362306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5) 87462306a36Sopenharmony_ci/* RAS MASK: HDP */ 87562306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6) 87662306a36Sopenharmony_ci/* RAS MASK: XGMI */ 87762306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7) 87862306a36Sopenharmony_ci/* RAS MASK: DF */ 87962306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8) 88062306a36Sopenharmony_ci/* RAS MASK: SMN */ 88162306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9) 88262306a36Sopenharmony_ci/* RAS MASK: SEM */ 88362306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10) 88462306a36Sopenharmony_ci/* RAS MASK: MP0 */ 88562306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11) 88662306a36Sopenharmony_ci/* RAS MASK: MP1 */ 88762306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12) 88862306a36Sopenharmony_ci/* RAS MASK: FUSE */ 88962306a36Sopenharmony_ci#define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13) 89062306a36Sopenharmony_ci/* query video encode/decode caps */ 89162306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS 0x21 89262306a36Sopenharmony_ci /* Subquery id: Decode */ 89362306a36Sopenharmony_ci #define AMDGPU_INFO_VIDEO_CAPS_DECODE 0 89462306a36Sopenharmony_ci /* Subquery id: Encode */ 89562306a36Sopenharmony_ci #define AMDGPU_INFO_VIDEO_CAPS_ENCODE 1 89662306a36Sopenharmony_ci/* Query the max number of IBs per gang per submission */ 89762306a36Sopenharmony_ci#define AMDGPU_INFO_MAX_IBS 0x22 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 90062306a36Sopenharmony_ci#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff 90162306a36Sopenharmony_ci#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8 90262306a36Sopenharmony_ci#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff 90362306a36Sopenharmony_ci 90462306a36Sopenharmony_cistruct drm_amdgpu_query_fw { 90562306a36Sopenharmony_ci /** AMDGPU_INFO_FW_* */ 90662306a36Sopenharmony_ci __u32 fw_type; 90762306a36Sopenharmony_ci /** 90862306a36Sopenharmony_ci * Index of the IP if there are more IPs of 90962306a36Sopenharmony_ci * the same type. 91062306a36Sopenharmony_ci */ 91162306a36Sopenharmony_ci __u32 ip_instance; 91262306a36Sopenharmony_ci /** 91362306a36Sopenharmony_ci * Index of the engine. Whether this is used depends 91462306a36Sopenharmony_ci * on the firmware type. (e.g. MEC, SDMA) 91562306a36Sopenharmony_ci */ 91662306a36Sopenharmony_ci __u32 index; 91762306a36Sopenharmony_ci __u32 _pad; 91862306a36Sopenharmony_ci}; 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci/* Input structure for the INFO ioctl */ 92162306a36Sopenharmony_cistruct drm_amdgpu_info { 92262306a36Sopenharmony_ci /* Where the return value will be stored */ 92362306a36Sopenharmony_ci __u64 return_pointer; 92462306a36Sopenharmony_ci /* The size of the return value. Just like "size" in "snprintf", 92562306a36Sopenharmony_ci * it limits how many bytes the kernel can write. */ 92662306a36Sopenharmony_ci __u32 return_size; 92762306a36Sopenharmony_ci /* The query request id. */ 92862306a36Sopenharmony_ci __u32 query; 92962306a36Sopenharmony_ci 93062306a36Sopenharmony_ci union { 93162306a36Sopenharmony_ci struct { 93262306a36Sopenharmony_ci __u32 id; 93362306a36Sopenharmony_ci __u32 _pad; 93462306a36Sopenharmony_ci } mode_crtc; 93562306a36Sopenharmony_ci 93662306a36Sopenharmony_ci struct { 93762306a36Sopenharmony_ci /** AMDGPU_HW_IP_* */ 93862306a36Sopenharmony_ci __u32 type; 93962306a36Sopenharmony_ci /** 94062306a36Sopenharmony_ci * Index of the IP if there are more IPs of the same 94162306a36Sopenharmony_ci * type. Ignored by AMDGPU_INFO_HW_IP_COUNT. 94262306a36Sopenharmony_ci */ 94362306a36Sopenharmony_ci __u32 ip_instance; 94462306a36Sopenharmony_ci } query_hw_ip; 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci struct { 94762306a36Sopenharmony_ci __u32 dword_offset; 94862306a36Sopenharmony_ci /** number of registers to read */ 94962306a36Sopenharmony_ci __u32 count; 95062306a36Sopenharmony_ci __u32 instance; 95162306a36Sopenharmony_ci /** For future use, no flags defined so far */ 95262306a36Sopenharmony_ci __u32 flags; 95362306a36Sopenharmony_ci } read_mmr_reg; 95462306a36Sopenharmony_ci 95562306a36Sopenharmony_ci struct drm_amdgpu_query_fw query_fw; 95662306a36Sopenharmony_ci 95762306a36Sopenharmony_ci struct { 95862306a36Sopenharmony_ci __u32 type; 95962306a36Sopenharmony_ci __u32 offset; 96062306a36Sopenharmony_ci } vbios_info; 96162306a36Sopenharmony_ci 96262306a36Sopenharmony_ci struct { 96362306a36Sopenharmony_ci __u32 type; 96462306a36Sopenharmony_ci } sensor_info; 96562306a36Sopenharmony_ci 96662306a36Sopenharmony_ci struct { 96762306a36Sopenharmony_ci __u32 type; 96862306a36Sopenharmony_ci } video_cap; 96962306a36Sopenharmony_ci }; 97062306a36Sopenharmony_ci}; 97162306a36Sopenharmony_ci 97262306a36Sopenharmony_cistruct drm_amdgpu_info_gds { 97362306a36Sopenharmony_ci /** GDS GFX partition size */ 97462306a36Sopenharmony_ci __u32 gds_gfx_partition_size; 97562306a36Sopenharmony_ci /** GDS compute partition size */ 97662306a36Sopenharmony_ci __u32 compute_partition_size; 97762306a36Sopenharmony_ci /** total GDS memory size */ 97862306a36Sopenharmony_ci __u32 gds_total_size; 97962306a36Sopenharmony_ci /** GWS size per GFX partition */ 98062306a36Sopenharmony_ci __u32 gws_per_gfx_partition; 98162306a36Sopenharmony_ci /** GSW size per compute partition */ 98262306a36Sopenharmony_ci __u32 gws_per_compute_partition; 98362306a36Sopenharmony_ci /** OA size per GFX partition */ 98462306a36Sopenharmony_ci __u32 oa_per_gfx_partition; 98562306a36Sopenharmony_ci /** OA size per compute partition */ 98662306a36Sopenharmony_ci __u32 oa_per_compute_partition; 98762306a36Sopenharmony_ci __u32 _pad; 98862306a36Sopenharmony_ci}; 98962306a36Sopenharmony_ci 99062306a36Sopenharmony_cistruct drm_amdgpu_info_vram_gtt { 99162306a36Sopenharmony_ci __u64 vram_size; 99262306a36Sopenharmony_ci __u64 vram_cpu_accessible_size; 99362306a36Sopenharmony_ci __u64 gtt_size; 99462306a36Sopenharmony_ci}; 99562306a36Sopenharmony_ci 99662306a36Sopenharmony_cistruct drm_amdgpu_heap_info { 99762306a36Sopenharmony_ci /** max. physical memory */ 99862306a36Sopenharmony_ci __u64 total_heap_size; 99962306a36Sopenharmony_ci 100062306a36Sopenharmony_ci /** Theoretical max. available memory in the given heap */ 100162306a36Sopenharmony_ci __u64 usable_heap_size; 100262306a36Sopenharmony_ci 100362306a36Sopenharmony_ci /** 100462306a36Sopenharmony_ci * Number of bytes allocated in the heap. This includes all processes 100562306a36Sopenharmony_ci * and private allocations in the kernel. It changes when new buffers 100662306a36Sopenharmony_ci * are allocated, freed, and moved. It cannot be larger than 100762306a36Sopenharmony_ci * heap_size. 100862306a36Sopenharmony_ci */ 100962306a36Sopenharmony_ci __u64 heap_usage; 101062306a36Sopenharmony_ci 101162306a36Sopenharmony_ci /** 101262306a36Sopenharmony_ci * Theoretical possible max. size of buffer which 101362306a36Sopenharmony_ci * could be allocated in the given heap 101462306a36Sopenharmony_ci */ 101562306a36Sopenharmony_ci __u64 max_allocation; 101662306a36Sopenharmony_ci}; 101762306a36Sopenharmony_ci 101862306a36Sopenharmony_cistruct drm_amdgpu_memory_info { 101962306a36Sopenharmony_ci struct drm_amdgpu_heap_info vram; 102062306a36Sopenharmony_ci struct drm_amdgpu_heap_info cpu_accessible_vram; 102162306a36Sopenharmony_ci struct drm_amdgpu_heap_info gtt; 102262306a36Sopenharmony_ci}; 102362306a36Sopenharmony_ci 102462306a36Sopenharmony_cistruct drm_amdgpu_info_firmware { 102562306a36Sopenharmony_ci __u32 ver; 102662306a36Sopenharmony_ci __u32 feature; 102762306a36Sopenharmony_ci}; 102862306a36Sopenharmony_ci 102962306a36Sopenharmony_cistruct drm_amdgpu_info_vbios { 103062306a36Sopenharmony_ci __u8 name[64]; 103162306a36Sopenharmony_ci __u8 vbios_pn[64]; 103262306a36Sopenharmony_ci __u32 version; 103362306a36Sopenharmony_ci __u32 pad; 103462306a36Sopenharmony_ci __u8 vbios_ver_str[32]; 103562306a36Sopenharmony_ci __u8 date[32]; 103662306a36Sopenharmony_ci}; 103762306a36Sopenharmony_ci 103862306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_UNKNOWN 0 103962306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_GDDR1 1 104062306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_DDR2 2 104162306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_GDDR3 3 104262306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_GDDR4 4 104362306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_GDDR5 5 104462306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_HBM 6 104562306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_DDR3 7 104662306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_DDR4 8 104762306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_GDDR6 9 104862306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_DDR5 10 104962306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_LPDDR4 11 105062306a36Sopenharmony_ci#define AMDGPU_VRAM_TYPE_LPDDR5 12 105162306a36Sopenharmony_ci 105262306a36Sopenharmony_cistruct drm_amdgpu_info_device { 105362306a36Sopenharmony_ci /** PCI Device ID */ 105462306a36Sopenharmony_ci __u32 device_id; 105562306a36Sopenharmony_ci /** Internal chip revision: A0, A1, etc.) */ 105662306a36Sopenharmony_ci __u32 chip_rev; 105762306a36Sopenharmony_ci __u32 external_rev; 105862306a36Sopenharmony_ci /** Revision id in PCI Config space */ 105962306a36Sopenharmony_ci __u32 pci_rev; 106062306a36Sopenharmony_ci __u32 family; 106162306a36Sopenharmony_ci __u32 num_shader_engines; 106262306a36Sopenharmony_ci __u32 num_shader_arrays_per_engine; 106362306a36Sopenharmony_ci /* in KHz */ 106462306a36Sopenharmony_ci __u32 gpu_counter_freq; 106562306a36Sopenharmony_ci __u64 max_engine_clock; 106662306a36Sopenharmony_ci __u64 max_memory_clock; 106762306a36Sopenharmony_ci /* cu information */ 106862306a36Sopenharmony_ci __u32 cu_active_number; 106962306a36Sopenharmony_ci /* NOTE: cu_ao_mask is INVALID, DON'T use it */ 107062306a36Sopenharmony_ci __u32 cu_ao_mask; 107162306a36Sopenharmony_ci __u32 cu_bitmap[4][4]; 107262306a36Sopenharmony_ci /** Render backend pipe mask. One render backend is CB+DB. */ 107362306a36Sopenharmony_ci __u32 enabled_rb_pipes_mask; 107462306a36Sopenharmony_ci __u32 num_rb_pipes; 107562306a36Sopenharmony_ci __u32 num_hw_gfx_contexts; 107662306a36Sopenharmony_ci /* PCIe version (the smaller of the GPU and the CPU/motherboard) */ 107762306a36Sopenharmony_ci __u32 pcie_gen; 107862306a36Sopenharmony_ci __u64 ids_flags; 107962306a36Sopenharmony_ci /** Starting virtual address for UMDs. */ 108062306a36Sopenharmony_ci __u64 virtual_address_offset; 108162306a36Sopenharmony_ci /** The maximum virtual address */ 108262306a36Sopenharmony_ci __u64 virtual_address_max; 108362306a36Sopenharmony_ci /** Required alignment of virtual addresses. */ 108462306a36Sopenharmony_ci __u32 virtual_address_alignment; 108562306a36Sopenharmony_ci /** Page table entry - fragment size */ 108662306a36Sopenharmony_ci __u32 pte_fragment_size; 108762306a36Sopenharmony_ci __u32 gart_page_size; 108862306a36Sopenharmony_ci /** constant engine ram size*/ 108962306a36Sopenharmony_ci __u32 ce_ram_size; 109062306a36Sopenharmony_ci /** video memory type info*/ 109162306a36Sopenharmony_ci __u32 vram_type; 109262306a36Sopenharmony_ci /** video memory bit width*/ 109362306a36Sopenharmony_ci __u32 vram_bit_width; 109462306a36Sopenharmony_ci /* vce harvesting instance */ 109562306a36Sopenharmony_ci __u32 vce_harvest_config; 109662306a36Sopenharmony_ci /* gfx double offchip LDS buffers */ 109762306a36Sopenharmony_ci __u32 gc_double_offchip_lds_buf; 109862306a36Sopenharmony_ci /* NGG Primitive Buffer */ 109962306a36Sopenharmony_ci __u64 prim_buf_gpu_addr; 110062306a36Sopenharmony_ci /* NGG Position Buffer */ 110162306a36Sopenharmony_ci __u64 pos_buf_gpu_addr; 110262306a36Sopenharmony_ci /* NGG Control Sideband */ 110362306a36Sopenharmony_ci __u64 cntl_sb_buf_gpu_addr; 110462306a36Sopenharmony_ci /* NGG Parameter Cache */ 110562306a36Sopenharmony_ci __u64 param_buf_gpu_addr; 110662306a36Sopenharmony_ci __u32 prim_buf_size; 110762306a36Sopenharmony_ci __u32 pos_buf_size; 110862306a36Sopenharmony_ci __u32 cntl_sb_buf_size; 110962306a36Sopenharmony_ci __u32 param_buf_size; 111062306a36Sopenharmony_ci /* wavefront size*/ 111162306a36Sopenharmony_ci __u32 wave_front_size; 111262306a36Sopenharmony_ci /* shader visible vgprs*/ 111362306a36Sopenharmony_ci __u32 num_shader_visible_vgprs; 111462306a36Sopenharmony_ci /* CU per shader array*/ 111562306a36Sopenharmony_ci __u32 num_cu_per_sh; 111662306a36Sopenharmony_ci /* number of tcc blocks*/ 111762306a36Sopenharmony_ci __u32 num_tcc_blocks; 111862306a36Sopenharmony_ci /* gs vgt table depth*/ 111962306a36Sopenharmony_ci __u32 gs_vgt_table_depth; 112062306a36Sopenharmony_ci /* gs primitive buffer depth*/ 112162306a36Sopenharmony_ci __u32 gs_prim_buffer_depth; 112262306a36Sopenharmony_ci /* max gs wavefront per vgt*/ 112362306a36Sopenharmony_ci __u32 max_gs_waves_per_vgt; 112462306a36Sopenharmony_ci /* PCIe number of lanes (the smaller of the GPU and the CPU/motherboard) */ 112562306a36Sopenharmony_ci __u32 pcie_num_lanes; 112662306a36Sopenharmony_ci /* always on cu bitmap */ 112762306a36Sopenharmony_ci __u32 cu_ao_bitmap[4][4]; 112862306a36Sopenharmony_ci /** Starting high virtual address for UMDs. */ 112962306a36Sopenharmony_ci __u64 high_va_offset; 113062306a36Sopenharmony_ci /** The maximum high virtual address */ 113162306a36Sopenharmony_ci __u64 high_va_max; 113262306a36Sopenharmony_ci /* gfx10 pa_sc_tile_steering_override */ 113362306a36Sopenharmony_ci __u32 pa_sc_tile_steering_override; 113462306a36Sopenharmony_ci /* disabled TCCs */ 113562306a36Sopenharmony_ci __u64 tcc_disabled_mask; 113662306a36Sopenharmony_ci __u64 min_engine_clock; 113762306a36Sopenharmony_ci __u64 min_memory_clock; 113862306a36Sopenharmony_ci /* The following fields are only set on gfx11+, older chips set 0. */ 113962306a36Sopenharmony_ci __u32 tcp_cache_size; /* AKA GL0, VMEM cache */ 114062306a36Sopenharmony_ci __u32 num_sqc_per_wgp; 114162306a36Sopenharmony_ci __u32 sqc_data_cache_size; /* AKA SMEM cache */ 114262306a36Sopenharmony_ci __u32 sqc_inst_cache_size; 114362306a36Sopenharmony_ci __u32 gl1c_cache_size; 114462306a36Sopenharmony_ci __u32 gl2c_cache_size; 114562306a36Sopenharmony_ci __u64 mall_size; /* AKA infinity cache */ 114662306a36Sopenharmony_ci /* high 32 bits of the rb pipes mask */ 114762306a36Sopenharmony_ci __u32 enabled_rb_pipes_mask_hi; 114862306a36Sopenharmony_ci /* shadow area size for gfx11 */ 114962306a36Sopenharmony_ci __u32 shadow_size; 115062306a36Sopenharmony_ci /* shadow area base virtual alignment for gfx11 */ 115162306a36Sopenharmony_ci __u32 shadow_alignment; 115262306a36Sopenharmony_ci /* context save area size for gfx11 */ 115362306a36Sopenharmony_ci __u32 csa_size; 115462306a36Sopenharmony_ci /* context save area base virtual alignment for gfx11 */ 115562306a36Sopenharmony_ci __u32 csa_alignment; 115662306a36Sopenharmony_ci}; 115762306a36Sopenharmony_ci 115862306a36Sopenharmony_cistruct drm_amdgpu_info_hw_ip { 115962306a36Sopenharmony_ci /** Version of h/w IP */ 116062306a36Sopenharmony_ci __u32 hw_ip_version_major; 116162306a36Sopenharmony_ci __u32 hw_ip_version_minor; 116262306a36Sopenharmony_ci /** Capabilities */ 116362306a36Sopenharmony_ci __u64 capabilities_flags; 116462306a36Sopenharmony_ci /** command buffer address start alignment*/ 116562306a36Sopenharmony_ci __u32 ib_start_alignment; 116662306a36Sopenharmony_ci /** command buffer size alignment*/ 116762306a36Sopenharmony_ci __u32 ib_size_alignment; 116862306a36Sopenharmony_ci /** Bitmask of available rings. Bit 0 means ring 0, etc. */ 116962306a36Sopenharmony_ci __u32 available_rings; 117062306a36Sopenharmony_ci /** version info: bits 23:16 major, 15:8 minor, 7:0 revision */ 117162306a36Sopenharmony_ci __u32 ip_discovery_version; 117262306a36Sopenharmony_ci}; 117362306a36Sopenharmony_ci 117462306a36Sopenharmony_cistruct drm_amdgpu_info_num_handles { 117562306a36Sopenharmony_ci /** Max handles as supported by firmware for UVD */ 117662306a36Sopenharmony_ci __u32 uvd_max_handles; 117762306a36Sopenharmony_ci /** Handles currently in use for UVD */ 117862306a36Sopenharmony_ci __u32 uvd_used_handles; 117962306a36Sopenharmony_ci}; 118062306a36Sopenharmony_ci 118162306a36Sopenharmony_ci#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6 118262306a36Sopenharmony_ci 118362306a36Sopenharmony_cistruct drm_amdgpu_info_vce_clock_table_entry { 118462306a36Sopenharmony_ci /** System clock */ 118562306a36Sopenharmony_ci __u32 sclk; 118662306a36Sopenharmony_ci /** Memory clock */ 118762306a36Sopenharmony_ci __u32 mclk; 118862306a36Sopenharmony_ci /** VCE clock */ 118962306a36Sopenharmony_ci __u32 eclk; 119062306a36Sopenharmony_ci __u32 pad; 119162306a36Sopenharmony_ci}; 119262306a36Sopenharmony_ci 119362306a36Sopenharmony_cistruct drm_amdgpu_info_vce_clock_table { 119462306a36Sopenharmony_ci struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES]; 119562306a36Sopenharmony_ci __u32 num_valid_entries; 119662306a36Sopenharmony_ci __u32 pad; 119762306a36Sopenharmony_ci}; 119862306a36Sopenharmony_ci 119962306a36Sopenharmony_ci/* query video encode/decode caps */ 120062306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 0 120162306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 1 120262306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 2 120362306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC 3 120462306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC 4 120562306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG 5 120662306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 6 120762306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 7 120862306a36Sopenharmony_ci#define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT 8 120962306a36Sopenharmony_ci 121062306a36Sopenharmony_cistruct drm_amdgpu_info_video_codec_info { 121162306a36Sopenharmony_ci __u32 valid; 121262306a36Sopenharmony_ci __u32 max_width; 121362306a36Sopenharmony_ci __u32 max_height; 121462306a36Sopenharmony_ci __u32 max_pixels_per_frame; 121562306a36Sopenharmony_ci __u32 max_level; 121662306a36Sopenharmony_ci __u32 pad; 121762306a36Sopenharmony_ci}; 121862306a36Sopenharmony_ci 121962306a36Sopenharmony_cistruct drm_amdgpu_info_video_caps { 122062306a36Sopenharmony_ci struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT]; 122162306a36Sopenharmony_ci}; 122262306a36Sopenharmony_ci 122362306a36Sopenharmony_ci/* 122462306a36Sopenharmony_ci * Supported GPU families 122562306a36Sopenharmony_ci */ 122662306a36Sopenharmony_ci#define AMDGPU_FAMILY_UNKNOWN 0 122762306a36Sopenharmony_ci#define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */ 122862306a36Sopenharmony_ci#define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */ 122962306a36Sopenharmony_ci#define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */ 123062306a36Sopenharmony_ci#define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */ 123162306a36Sopenharmony_ci#define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */ 123262306a36Sopenharmony_ci#define AMDGPU_FAMILY_AI 141 /* Vega10 */ 123362306a36Sopenharmony_ci#define AMDGPU_FAMILY_RV 142 /* Raven */ 123462306a36Sopenharmony_ci#define AMDGPU_FAMILY_NV 143 /* Navi10 */ 123562306a36Sopenharmony_ci#define AMDGPU_FAMILY_VGH 144 /* Van Gogh */ 123662306a36Sopenharmony_ci#define AMDGPU_FAMILY_GC_11_0_0 145 /* GC 11.0.0 */ 123762306a36Sopenharmony_ci#define AMDGPU_FAMILY_YC 146 /* Yellow Carp */ 123862306a36Sopenharmony_ci#define AMDGPU_FAMILY_GC_11_0_1 148 /* GC 11.0.1 */ 123962306a36Sopenharmony_ci#define AMDGPU_FAMILY_GC_10_3_6 149 /* GC 10.3.6 */ 124062306a36Sopenharmony_ci#define AMDGPU_FAMILY_GC_10_3_7 151 /* GC 10.3.7 */ 124162306a36Sopenharmony_ci 124262306a36Sopenharmony_ci#if defined(__cplusplus) 124362306a36Sopenharmony_ci} 124462306a36Sopenharmony_ci#endif 124562306a36Sopenharmony_ci 124662306a36Sopenharmony_ci#endif 1247