amdgpu_drm.h revision d8807b2f
13f012e29Smrg/* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*-
23f012e29Smrg *
33f012e29Smrg * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
43f012e29Smrg * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
53f012e29Smrg * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
63f012e29Smrg * Copyright 2014 Advanced Micro Devices, Inc.
73f012e29Smrg *
83f012e29Smrg * Permission is hereby granted, free of charge, to any person obtaining a
93f012e29Smrg * copy of this software and associated documentation files (the "Software"),
103f012e29Smrg * to deal in the Software without restriction, including without limitation
113f012e29Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
123f012e29Smrg * and/or sell copies of the Software, and to permit persons to whom the
133f012e29Smrg * Software is furnished to do so, subject to the following conditions:
143f012e29Smrg *
153f012e29Smrg * The above copyright notice and this permission notice shall be included in
163f012e29Smrg * all copies or substantial portions of the Software.
173f012e29Smrg *
183f012e29Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
193f012e29Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
203f012e29Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
213f012e29Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
223f012e29Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
233f012e29Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
243f012e29Smrg * OTHER DEALINGS IN THE SOFTWARE.
253f012e29Smrg *
263f012e29Smrg * Authors:
273f012e29Smrg *    Kevin E. Martin <martin@valinux.com>
283f012e29Smrg *    Gareth Hughes <gareth@valinux.com>
293f012e29Smrg *    Keith Whitwell <keith@tungstengraphics.com>
303f012e29Smrg */
313f012e29Smrg
323f012e29Smrg#ifndef __AMDGPU_DRM_H__
333f012e29Smrg#define __AMDGPU_DRM_H__
343f012e29Smrg
353f012e29Smrg#include "drm.h"
363f012e29Smrg
37037b3c26Smrg#if defined(__cplusplus)
38037b3c26Smrgextern "C" {
39037b3c26Smrg#endif
40037b3c26Smrg
413f012e29Smrg#define DRM_AMDGPU_GEM_CREATE		0x00
423f012e29Smrg#define DRM_AMDGPU_GEM_MMAP		0x01
433f012e29Smrg#define DRM_AMDGPU_CTX			0x02
443f012e29Smrg#define DRM_AMDGPU_BO_LIST		0x03
453f012e29Smrg#define DRM_AMDGPU_CS			0x04
463f012e29Smrg#define DRM_AMDGPU_INFO			0x05
473f012e29Smrg#define DRM_AMDGPU_GEM_METADATA		0x06
483f012e29Smrg#define DRM_AMDGPU_GEM_WAIT_IDLE	0x07
493f012e29Smrg#define DRM_AMDGPU_GEM_VA		0x08
503f012e29Smrg#define DRM_AMDGPU_WAIT_CS		0x09
513f012e29Smrg#define DRM_AMDGPU_GEM_OP		0x10
523f012e29Smrg#define DRM_AMDGPU_GEM_USERPTR		0x11
53d8807b2fSmrg#define DRM_AMDGPU_WAIT_FENCES		0x12
54d8807b2fSmrg#define DRM_AMDGPU_VM			0x13
553f012e29Smrg
563f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
573f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_MMAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
583f012e29Smrg#define DRM_IOCTL_AMDGPU_CTX		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
593f012e29Smrg#define DRM_IOCTL_AMDGPU_BO_LIST	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
603f012e29Smrg#define DRM_IOCTL_AMDGPU_CS		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
613f012e29Smrg#define DRM_IOCTL_AMDGPU_INFO		DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
623f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_METADATA	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata)
633f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
643f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_VA		DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va)
653f012e29Smrg#define DRM_IOCTL_AMDGPU_WAIT_CS	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
663f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_OP		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
673f012e29Smrg#define DRM_IOCTL_AMDGPU_GEM_USERPTR	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
68d8807b2fSmrg#define DRM_IOCTL_AMDGPU_WAIT_FENCES	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
69d8807b2fSmrg#define DRM_IOCTL_AMDGPU_VM		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm)
703f012e29Smrg
713f012e29Smrg#define AMDGPU_GEM_DOMAIN_CPU		0x1
723f012e29Smrg#define AMDGPU_GEM_DOMAIN_GTT		0x2
733f012e29Smrg#define AMDGPU_GEM_DOMAIN_VRAM		0x4
743f012e29Smrg#define AMDGPU_GEM_DOMAIN_GDS		0x8
753f012e29Smrg#define AMDGPU_GEM_DOMAIN_GWS		0x10
763f012e29Smrg#define AMDGPU_GEM_DOMAIN_OA		0x20
773f012e29Smrg
783f012e29Smrg/* Flag that CPU access will be required for the case of VRAM domain */
793f012e29Smrg#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED	(1 << 0)
803f012e29Smrg/* Flag that CPU access will not work, this VRAM domain is invisible */
813f012e29Smrg#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS		(1 << 1)
823f012e29Smrg/* Flag that USWC attributes should be used for GTT */
833f012e29Smrg#define AMDGPU_GEM_CREATE_CPU_GTT_USWC		(1 << 2)
84037b3c26Smrg/* Flag that the memory should be in VRAM and cleared */
85037b3c26Smrg#define AMDGPU_GEM_CREATE_VRAM_CLEARED		(1 << 3)
86d8807b2fSmrg/* Flag that create shadow bo(GTT) while allocating vram bo */
87d8807b2fSmrg#define AMDGPU_GEM_CREATE_SHADOW		(1 << 4)
88d8807b2fSmrg/* Flag that allocating the BO should use linear VRAM */
89d8807b2fSmrg#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS	(1 << 5)
903f012e29Smrg
913f012e29Smrgstruct drm_amdgpu_gem_create_in  {
923f012e29Smrg	/** the requested memory size */
93d8807b2fSmrg	__u64 bo_size;
943f012e29Smrg	/** physical start_addr alignment in bytes for some HW requirements */
95d8807b2fSmrg	__u64 alignment;
963f012e29Smrg	/** the requested memory domains */
97d8807b2fSmrg	__u64 domains;
983f012e29Smrg	/** allocation flags */
99d8807b2fSmrg	__u64 domain_flags;
1003f012e29Smrg};
1013f012e29Smrg
1023f012e29Smrgstruct drm_amdgpu_gem_create_out  {
1033f012e29Smrg	/** returned GEM object handle */
104d8807b2fSmrg	__u32 handle;
105d8807b2fSmrg	__u32 _pad;
1063f012e29Smrg};
1073f012e29Smrg
1083f012e29Smrgunion drm_amdgpu_gem_create {
1093f012e29Smrg	struct drm_amdgpu_gem_create_in		in;
1103f012e29Smrg	struct drm_amdgpu_gem_create_out	out;
1113f012e29Smrg};
1123f012e29Smrg
1133f012e29Smrg/** Opcode to create new residency list.  */
1143f012e29Smrg#define AMDGPU_BO_LIST_OP_CREATE	0
1153f012e29Smrg/** Opcode to destroy previously created residency list */
1163f012e29Smrg#define AMDGPU_BO_LIST_OP_DESTROY	1
1173f012e29Smrg/** Opcode to update resource information in the list */
1183f012e29Smrg#define AMDGPU_BO_LIST_OP_UPDATE	2
1193f012e29Smrg
1203f012e29Smrgstruct drm_amdgpu_bo_list_in {
1213f012e29Smrg	/** Type of operation */
122d8807b2fSmrg	__u32 operation;
1233f012e29Smrg	/** Handle of list or 0 if we want to create one */
124d8807b2fSmrg	__u32 list_handle;
1253f012e29Smrg	/** Number of BOs in list  */
126d8807b2fSmrg	__u32 bo_number;
1273f012e29Smrg	/** Size of each element describing BO */
128d8807b2fSmrg	__u32 bo_info_size;
1293f012e29Smrg	/** Pointer to array describing BOs */
130d8807b2fSmrg	__u64 bo_info_ptr;
1313f012e29Smrg};
1323f012e29Smrg
1333f012e29Smrgstruct drm_amdgpu_bo_list_entry {
1343f012e29Smrg	/** Handle of BO */
135d8807b2fSmrg	__u32 bo_handle;
1363f012e29Smrg	/** New (if specified) BO priority to be used during migration */
137d8807b2fSmrg	__u32 bo_priority;
1383f012e29Smrg};
1393f012e29Smrg
1403f012e29Smrgstruct drm_amdgpu_bo_list_out {
1413f012e29Smrg	/** Handle of resource list  */
142d8807b2fSmrg	__u32 list_handle;
143d8807b2fSmrg	__u32 _pad;
1443f012e29Smrg};
1453f012e29Smrg
1463f012e29Smrgunion drm_amdgpu_bo_list {
1473f012e29Smrg	struct drm_amdgpu_bo_list_in in;
1483f012e29Smrg	struct drm_amdgpu_bo_list_out out;
1493f012e29Smrg};
1503f012e29Smrg
1513f012e29Smrg/* context related */
1523f012e29Smrg#define AMDGPU_CTX_OP_ALLOC_CTX	1
1533f012e29Smrg#define AMDGPU_CTX_OP_FREE_CTX	2
1543f012e29Smrg#define AMDGPU_CTX_OP_QUERY_STATE	3
1553f012e29Smrg
1563f012e29Smrg/* GPU reset status */
1573f012e29Smrg#define AMDGPU_CTX_NO_RESET		0
1583f012e29Smrg/* this the context caused it */
1593f012e29Smrg#define AMDGPU_CTX_GUILTY_RESET		1
1603f012e29Smrg/* some other context caused it */
1613f012e29Smrg#define AMDGPU_CTX_INNOCENT_RESET	2
1623f012e29Smrg/* unknown cause */
1633f012e29Smrg#define AMDGPU_CTX_UNKNOWN_RESET	3
1643f012e29Smrg
1653f012e29Smrgstruct drm_amdgpu_ctx_in {
1663f012e29Smrg	/** AMDGPU_CTX_OP_* */
167d8807b2fSmrg	__u32	op;
1683f012e29Smrg	/** For future use, no flags defined so far */
169d8807b2fSmrg	__u32	flags;
170d8807b2fSmrg	__u32	ctx_id;
171d8807b2fSmrg	__u32	_pad;
1723f012e29Smrg};
1733f012e29Smrg
1743f012e29Smrgunion drm_amdgpu_ctx_out {
1753f012e29Smrg		struct {
176d8807b2fSmrg			__u32	ctx_id;
177d8807b2fSmrg			__u32	_pad;
1783f012e29Smrg		} alloc;
1793f012e29Smrg
1803f012e29Smrg		struct {
1813f012e29Smrg			/** For future use, no flags defined so far */
182d8807b2fSmrg			__u64	flags;
1833f012e29Smrg			/** Number of resets caused by this context so far. */
184d8807b2fSmrg			__u32	hangs;
1853f012e29Smrg			/** Reset status since the last call of the ioctl. */
186d8807b2fSmrg			__u32	reset_status;
1873f012e29Smrg		} state;
1883f012e29Smrg};
1893f012e29Smrg
1903f012e29Smrgunion drm_amdgpu_ctx {
1913f012e29Smrg	struct drm_amdgpu_ctx_in in;
1923f012e29Smrg	union drm_amdgpu_ctx_out out;
1933f012e29Smrg};
1943f012e29Smrg
195d8807b2fSmrg/* vm ioctl */
196d8807b2fSmrg#define AMDGPU_VM_OP_RESERVE_VMID	1
197d8807b2fSmrg#define AMDGPU_VM_OP_UNRESERVE_VMID	2
198d8807b2fSmrg
199d8807b2fSmrgstruct drm_amdgpu_vm_in {
200d8807b2fSmrg	/** AMDGPU_VM_OP_* */
201d8807b2fSmrg	__u32	op;
202d8807b2fSmrg	__u32	flags;
203d8807b2fSmrg};
204d8807b2fSmrg
205d8807b2fSmrgstruct drm_amdgpu_vm_out {
206d8807b2fSmrg	/** For future use, no flags defined so far */
207d8807b2fSmrg	__u64	flags;
208d8807b2fSmrg};
209d8807b2fSmrg
210d8807b2fSmrgunion drm_amdgpu_vm {
211d8807b2fSmrg	struct drm_amdgpu_vm_in in;
212d8807b2fSmrg	struct drm_amdgpu_vm_out out;
213d8807b2fSmrg};
214d8807b2fSmrg
2153f012e29Smrg/*
2163f012e29Smrg * This is not a reliable API and you should expect it to fail for any
2173f012e29Smrg * number of reasons and have fallback path that do not use userptr to
2183f012e29Smrg * perform any operation.
2193f012e29Smrg */
2203f012e29Smrg#define AMDGPU_GEM_USERPTR_READONLY	(1 << 0)
2213f012e29Smrg#define AMDGPU_GEM_USERPTR_ANONONLY	(1 << 1)
2223f012e29Smrg#define AMDGPU_GEM_USERPTR_VALIDATE	(1 << 2)
2233f012e29Smrg#define AMDGPU_GEM_USERPTR_REGISTER	(1 << 3)
2243f012e29Smrg
2253f012e29Smrgstruct drm_amdgpu_gem_userptr {
226d8807b2fSmrg	__u64		addr;
227d8807b2fSmrg	__u64		size;
2283f012e29Smrg	/* AMDGPU_GEM_USERPTR_* */
229d8807b2fSmrg	__u32		flags;
2303f012e29Smrg	/* Resulting GEM handle */
231d8807b2fSmrg	__u32		handle;
2323f012e29Smrg};
2333f012e29Smrg
234d8807b2fSmrg/* SI-CI-VI: */
2353f012e29Smrg/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
2363f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_SHIFT			0
2373f012e29Smrg#define AMDGPU_TILING_ARRAY_MODE_MASK			0xf
2383f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_SHIFT			4
2393f012e29Smrg#define AMDGPU_TILING_PIPE_CONFIG_MASK			0x1f
2403f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_SHIFT			9
2413f012e29Smrg#define AMDGPU_TILING_TILE_SPLIT_MASK			0x7
2423f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT		12
2433f012e29Smrg#define AMDGPU_TILING_MICRO_TILE_MODE_MASK		0x7
2443f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_SHIFT			15
2453f012e29Smrg#define AMDGPU_TILING_BANK_WIDTH_MASK			0x3
2463f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_SHIFT			17
2473f012e29Smrg#define AMDGPU_TILING_BANK_HEIGHT_MASK			0x3
2483f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT		19
2493f012e29Smrg#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK		0x3
2503f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_SHIFT			21
2513f012e29Smrg#define AMDGPU_TILING_NUM_BANKS_MASK			0x3
2523f012e29Smrg
253d8807b2fSmrg/* GFX9 and later: */
254d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_SHIFT		0
255d8807b2fSmrg#define AMDGPU_TILING_SWIZZLE_MODE_MASK			0x1f
256d8807b2fSmrg
257d8807b2fSmrg/* Set/Get helpers for tiling flags. */
2583f012e29Smrg#define AMDGPU_TILING_SET(field, value) \
259d8807b2fSmrg	(((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
2603f012e29Smrg#define AMDGPU_TILING_GET(value, field) \
261d8807b2fSmrg	(((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
2623f012e29Smrg
2633f012e29Smrg#define AMDGPU_GEM_METADATA_OP_SET_METADATA                  1
2643f012e29Smrg#define AMDGPU_GEM_METADATA_OP_GET_METADATA                  2
2653f012e29Smrg
2663f012e29Smrg/** The same structure is shared for input/output */
2673f012e29Smrgstruct drm_amdgpu_gem_metadata {
2683f012e29Smrg	/** GEM Object handle */
269d8807b2fSmrg	__u32	handle;
2703f012e29Smrg	/** Do we want get or set metadata */
271d8807b2fSmrg	__u32	op;
2723f012e29Smrg	struct {
2733f012e29Smrg		/** For future use, no flags defined so far */
274d8807b2fSmrg		__u64	flags;
2753f012e29Smrg		/** family specific tiling info */
276d8807b2fSmrg		__u64	tiling_info;
277d8807b2fSmrg		__u32	data_size_bytes;
278d8807b2fSmrg		__u32	data[64];
2793f012e29Smrg	} data;
2803f012e29Smrg};
2813f012e29Smrg
2823f012e29Smrgstruct drm_amdgpu_gem_mmap_in {
2833f012e29Smrg	/** the GEM object handle */
284d8807b2fSmrg	__u32 handle;
285d8807b2fSmrg	__u32 _pad;
2863f012e29Smrg};
2873f012e29Smrg
2883f012e29Smrgstruct drm_amdgpu_gem_mmap_out {
2893f012e29Smrg	/** mmap offset from the vma offset manager */
290d8807b2fSmrg	__u64 addr_ptr;
2913f012e29Smrg};
2923f012e29Smrg
2933f012e29Smrgunion drm_amdgpu_gem_mmap {
2943f012e29Smrg	struct drm_amdgpu_gem_mmap_in   in;
2953f012e29Smrg	struct drm_amdgpu_gem_mmap_out out;
2963f012e29Smrg};
2973f012e29Smrg
2983f012e29Smrgstruct drm_amdgpu_gem_wait_idle_in {
2993f012e29Smrg	/** GEM object handle */
300d8807b2fSmrg	__u32 handle;
3013f012e29Smrg	/** For future use, no flags defined so far */
302d8807b2fSmrg	__u32 flags;
3033f012e29Smrg	/** Absolute timeout to wait */
304d8807b2fSmrg	__u64 timeout;
3053f012e29Smrg};
3063f012e29Smrg
3073f012e29Smrgstruct drm_amdgpu_gem_wait_idle_out {
3083f012e29Smrg	/** BO status:  0 - BO is idle, 1 - BO is busy */
309d8807b2fSmrg	__u32 status;
3103f012e29Smrg	/** Returned current memory domain */
311d8807b2fSmrg	__u32 domain;
3123f012e29Smrg};
3133f012e29Smrg
3143f012e29Smrgunion drm_amdgpu_gem_wait_idle {
3153f012e29Smrg	struct drm_amdgpu_gem_wait_idle_in  in;
3163f012e29Smrg	struct drm_amdgpu_gem_wait_idle_out out;
3173f012e29Smrg};
3183f012e29Smrg
3193f012e29Smrgstruct drm_amdgpu_wait_cs_in {
320d8807b2fSmrg	/* Command submission handle
321d8807b2fSmrg         * handle equals 0 means none to wait for
322d8807b2fSmrg         * handle equals ~0ull means wait for the latest sequence number
323d8807b2fSmrg         */
324d8807b2fSmrg	__u64 handle;
3253f012e29Smrg	/** Absolute timeout to wait */
326d8807b2fSmrg	__u64 timeout;
327d8807b2fSmrg	__u32 ip_type;
328d8807b2fSmrg	__u32 ip_instance;
329d8807b2fSmrg	__u32 ring;
330d8807b2fSmrg	__u32 ctx_id;
3313f012e29Smrg};
3323f012e29Smrg
3333f012e29Smrgstruct drm_amdgpu_wait_cs_out {
3343f012e29Smrg	/** CS status:  0 - CS completed, 1 - CS still busy */
335d8807b2fSmrg	__u64 status;
3363f012e29Smrg};
3373f012e29Smrg
3383f012e29Smrgunion drm_amdgpu_wait_cs {
3393f012e29Smrg	struct drm_amdgpu_wait_cs_in in;
3403f012e29Smrg	struct drm_amdgpu_wait_cs_out out;
3413f012e29Smrg};
3423f012e29Smrg
343d8807b2fSmrgstruct drm_amdgpu_fence {
344d8807b2fSmrg	__u32 ctx_id;
345d8807b2fSmrg	__u32 ip_type;
346d8807b2fSmrg	__u32 ip_instance;
347d8807b2fSmrg	__u32 ring;
348d8807b2fSmrg	__u64 seq_no;
349d8807b2fSmrg};
350d8807b2fSmrg
351d8807b2fSmrgstruct drm_amdgpu_wait_fences_in {
352d8807b2fSmrg	/** This points to uint64_t * which points to fences */
353d8807b2fSmrg	__u64 fences;
354d8807b2fSmrg	__u32 fence_count;
355d8807b2fSmrg	__u32 wait_all;
356d8807b2fSmrg	__u64 timeout_ns;
357d8807b2fSmrg};
358d8807b2fSmrg
359d8807b2fSmrgstruct drm_amdgpu_wait_fences_out {
360d8807b2fSmrg	__u32 status;
361d8807b2fSmrg	__u32 first_signaled;
362d8807b2fSmrg};
363d8807b2fSmrg
364d8807b2fSmrgunion drm_amdgpu_wait_fences {
365d8807b2fSmrg	struct drm_amdgpu_wait_fences_in in;
366d8807b2fSmrg	struct drm_amdgpu_wait_fences_out out;
367d8807b2fSmrg};
368d8807b2fSmrg
3693f012e29Smrg#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO	0
3703f012e29Smrg#define AMDGPU_GEM_OP_SET_PLACEMENT		1
3713f012e29Smrg
3723f012e29Smrg/* Sets or returns a value associated with a buffer. */
3733f012e29Smrgstruct drm_amdgpu_gem_op {
3743f012e29Smrg	/** GEM object handle */
375d8807b2fSmrg	__u32	handle;
3763f012e29Smrg	/** AMDGPU_GEM_OP_* */
377d8807b2fSmrg	__u32	op;
3783f012e29Smrg	/** Input or return value */
379d8807b2fSmrg	__u64	value;
3803f012e29Smrg};
3813f012e29Smrg
3823f012e29Smrg#define AMDGPU_VA_OP_MAP			1
3833f012e29Smrg#define AMDGPU_VA_OP_UNMAP			2
384d8807b2fSmrg#define AMDGPU_VA_OP_CLEAR			3
385d8807b2fSmrg#define AMDGPU_VA_OP_REPLACE			4
3863f012e29Smrg
3873f012e29Smrg/* Delay the page table update till the next CS */
3883f012e29Smrg#define AMDGPU_VM_DELAY_UPDATE		(1 << 0)
3893f012e29Smrg
3903f012e29Smrg/* Mapping flags */
3913f012e29Smrg/* readable mapping */
3923f012e29Smrg#define AMDGPU_VM_PAGE_READABLE		(1 << 1)
3933f012e29Smrg/* writable mapping */
3943f012e29Smrg#define AMDGPU_VM_PAGE_WRITEABLE	(1 << 2)
3953f012e29Smrg/* executable mapping, new for VI */
3963f012e29Smrg#define AMDGPU_VM_PAGE_EXECUTABLE	(1 << 3)
397d8807b2fSmrg/* partially resident texture */
398d8807b2fSmrg#define AMDGPU_VM_PAGE_PRT		(1 << 4)
399d8807b2fSmrg/* MTYPE flags use bit 5 to 8 */
400d8807b2fSmrg#define AMDGPU_VM_MTYPE_MASK		(0xf << 5)
401d8807b2fSmrg/* Default MTYPE. Pre-AI must use this.  Recommended for newer ASICs. */
402d8807b2fSmrg#define AMDGPU_VM_MTYPE_DEFAULT		(0 << 5)
403d8807b2fSmrg/* Use NC MTYPE instead of default MTYPE */
404d8807b2fSmrg#define AMDGPU_VM_MTYPE_NC		(1 << 5)
405d8807b2fSmrg/* Use WC MTYPE instead of default MTYPE */
406d8807b2fSmrg#define AMDGPU_VM_MTYPE_WC		(2 << 5)
407d8807b2fSmrg/* Use CC MTYPE instead of default MTYPE */
408d8807b2fSmrg#define AMDGPU_VM_MTYPE_CC		(3 << 5)
409d8807b2fSmrg/* Use UC MTYPE instead of default MTYPE */
410d8807b2fSmrg#define AMDGPU_VM_MTYPE_UC		(4 << 5)
4113f012e29Smrg
4123f012e29Smrgstruct drm_amdgpu_gem_va {
4133f012e29Smrg	/** GEM object handle */
414d8807b2fSmrg	__u32 handle;
415d8807b2fSmrg	__u32 _pad;
4163f012e29Smrg	/** AMDGPU_VA_OP_* */
417d8807b2fSmrg	__u32 operation;
4183f012e29Smrg	/** AMDGPU_VM_PAGE_* */
419d8807b2fSmrg	__u32 flags;
4203f012e29Smrg	/** va address to assign . Must be correctly aligned.*/
421d8807b2fSmrg	__u64 va_address;
4223f012e29Smrg	/** Specify offset inside of BO to assign. Must be correctly aligned.*/
423d8807b2fSmrg	__u64 offset_in_bo;
4243f012e29Smrg	/** Specify mapping size. Must be correctly aligned. */
425d8807b2fSmrg	__u64 map_size;
4263f012e29Smrg};
4273f012e29Smrg
4283f012e29Smrg#define AMDGPU_HW_IP_GFX          0
4293f012e29Smrg#define AMDGPU_HW_IP_COMPUTE      1
4303f012e29Smrg#define AMDGPU_HW_IP_DMA          2
4313f012e29Smrg#define AMDGPU_HW_IP_UVD          3
4323f012e29Smrg#define AMDGPU_HW_IP_VCE          4
433d8807b2fSmrg#define AMDGPU_HW_IP_UVD_ENC      5
434d8807b2fSmrg#define AMDGPU_HW_IP_VCN_DEC      6
435d8807b2fSmrg#define AMDGPU_HW_IP_VCN_ENC      7
436d8807b2fSmrg#define AMDGPU_HW_IP_NUM          8
4373f012e29Smrg
4383f012e29Smrg#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
4393f012e29Smrg
4403f012e29Smrg#define AMDGPU_CHUNK_ID_IB		0x01
4413f012e29Smrg#define AMDGPU_CHUNK_ID_FENCE		0x02
4423f012e29Smrg#define AMDGPU_CHUNK_ID_DEPENDENCIES	0x03
443d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_IN      0x04
444d8807b2fSmrg#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT     0x05
4453f012e29Smrg
4463f012e29Smrgstruct drm_amdgpu_cs_chunk {
447d8807b2fSmrg	__u32		chunk_id;
448d8807b2fSmrg	__u32		length_dw;
449d8807b2fSmrg	__u64		chunk_data;
4503f012e29Smrg};
4513f012e29Smrg
4523f012e29Smrgstruct drm_amdgpu_cs_in {
4533f012e29Smrg	/** Rendering context id */
454d8807b2fSmrg	__u32		ctx_id;
4553f012e29Smrg	/**  Handle of resource list associated with CS */
456d8807b2fSmrg	__u32		bo_list_handle;
457d8807b2fSmrg	__u32		num_chunks;
458d8807b2fSmrg	__u32		_pad;
459d8807b2fSmrg	/** this points to __u64 * which point to cs chunks */
460d8807b2fSmrg	__u64		chunks;
4613f012e29Smrg};
4623f012e29Smrg
4633f012e29Smrgstruct drm_amdgpu_cs_out {
464d8807b2fSmrg	__u64 handle;
4653f012e29Smrg};
4663f012e29Smrg
4673f012e29Smrgunion drm_amdgpu_cs {
4683f012e29Smrg	struct drm_amdgpu_cs_in in;
4693f012e29Smrg	struct drm_amdgpu_cs_out out;
4703f012e29Smrg};
4713f012e29Smrg
4723f012e29Smrg/* Specify flags to be used for IB */
4733f012e29Smrg
4743f012e29Smrg/* This IB should be submitted to CE */
4753f012e29Smrg#define AMDGPU_IB_FLAG_CE	(1<<0)
4763f012e29Smrg
477d8807b2fSmrg/* Preamble flag, which means the IB could be dropped if no context switch */
4783f012e29Smrg#define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
4793f012e29Smrg
480d8807b2fSmrg/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
481d8807b2fSmrg#define AMDGPU_IB_FLAG_PREEMPT (1<<2)
482d8807b2fSmrg
4833f012e29Smrgstruct drm_amdgpu_cs_chunk_ib {
484d8807b2fSmrg	__u32 _pad;
4853f012e29Smrg	/** AMDGPU_IB_FLAG_* */
486d8807b2fSmrg	__u32 flags;
4873f012e29Smrg	/** Virtual address to begin IB execution */
488d8807b2fSmrg	__u64 va_start;
4893f012e29Smrg	/** Size of submission */
490d8807b2fSmrg	__u32 ib_bytes;
4913f012e29Smrg	/** HW IP to submit to */
492d8807b2fSmrg	__u32 ip_type;
4933f012e29Smrg	/** HW IP index of the same type to submit to  */
494d8807b2fSmrg	__u32 ip_instance;
4953f012e29Smrg	/** Ring index to submit to */
496d8807b2fSmrg	__u32 ring;
4973f012e29Smrg};
4983f012e29Smrg
4993f012e29Smrgstruct drm_amdgpu_cs_chunk_dep {
500d8807b2fSmrg	__u32 ip_type;
501d8807b2fSmrg	__u32 ip_instance;
502d8807b2fSmrg	__u32 ring;
503d8807b2fSmrg	__u32 ctx_id;
504d8807b2fSmrg	__u64 handle;
5053f012e29Smrg};
5063f012e29Smrg
5073f012e29Smrgstruct drm_amdgpu_cs_chunk_fence {
508d8807b2fSmrg	__u32 handle;
509d8807b2fSmrg	__u32 offset;
510d8807b2fSmrg};
511d8807b2fSmrg
512d8807b2fSmrgstruct drm_amdgpu_cs_chunk_sem {
513d8807b2fSmrg	__u32 handle;
5143f012e29Smrg};
5153f012e29Smrg
5163f012e29Smrgstruct drm_amdgpu_cs_chunk_data {
5173f012e29Smrg	union {
5183f012e29Smrg		struct drm_amdgpu_cs_chunk_ib		ib_data;
5193f012e29Smrg		struct drm_amdgpu_cs_chunk_fence	fence_data;
5203f012e29Smrg	};
5213f012e29Smrg};
5223f012e29Smrg
5233f012e29Smrg/**
5243f012e29Smrg *  Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
5253f012e29Smrg *
5263f012e29Smrg */
5273f012e29Smrg#define AMDGPU_IDS_FLAGS_FUSION         0x1
528d8807b2fSmrg#define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
5293f012e29Smrg
5303f012e29Smrg/* indicate if acceleration can be working */
5313f012e29Smrg#define AMDGPU_INFO_ACCEL_WORKING		0x00
5323f012e29Smrg/* get the crtc_id from the mode object id? */
5333f012e29Smrg#define AMDGPU_INFO_CRTC_FROM_ID		0x01
5343f012e29Smrg/* query hw IP info */
5353f012e29Smrg#define AMDGPU_INFO_HW_IP_INFO			0x02
5363f012e29Smrg/* query hw IP instance count for the specified type */
5373f012e29Smrg#define AMDGPU_INFO_HW_IP_COUNT			0x03
5383f012e29Smrg/* timestamp for GL_ARB_timer_query */
5393f012e29Smrg#define AMDGPU_INFO_TIMESTAMP			0x05
5403f012e29Smrg/* Query the firmware version */
5413f012e29Smrg#define AMDGPU_INFO_FW_VERSION			0x0e
5423f012e29Smrg	/* Subquery id: Query VCE firmware version */
5433f012e29Smrg	#define AMDGPU_INFO_FW_VCE		0x1
5443f012e29Smrg	/* Subquery id: Query UVD firmware version */
5453f012e29Smrg	#define AMDGPU_INFO_FW_UVD		0x2
5463f012e29Smrg	/* Subquery id: Query GMC firmware version */
5473f012e29Smrg	#define AMDGPU_INFO_FW_GMC		0x03
5483f012e29Smrg	/* Subquery id: Query GFX ME firmware version */
5493f012e29Smrg	#define AMDGPU_INFO_FW_GFX_ME		0x04
5503f012e29Smrg	/* Subquery id: Query GFX PFP firmware version */
5513f012e29Smrg	#define AMDGPU_INFO_FW_GFX_PFP		0x05
5523f012e29Smrg	/* Subquery id: Query GFX CE firmware version */
5533f012e29Smrg	#define AMDGPU_INFO_FW_GFX_CE		0x06
5543f012e29Smrg	/* Subquery id: Query GFX RLC firmware version */
5553f012e29Smrg	#define AMDGPU_INFO_FW_GFX_RLC		0x07
5563f012e29Smrg	/* Subquery id: Query GFX MEC firmware version */
5573f012e29Smrg	#define AMDGPU_INFO_FW_GFX_MEC		0x08
5583f012e29Smrg	/* Subquery id: Query SMC firmware version */
5593f012e29Smrg	#define AMDGPU_INFO_FW_SMC		0x0a
5603f012e29Smrg	/* Subquery id: Query SDMA firmware version */
5613f012e29Smrg	#define AMDGPU_INFO_FW_SDMA		0x0b
562d8807b2fSmrg	/* Subquery id: Query PSP SOS firmware version */
563d8807b2fSmrg	#define AMDGPU_INFO_FW_SOS		0x0c
564d8807b2fSmrg	/* Subquery id: Query PSP ASD firmware version */
565d8807b2fSmrg	#define AMDGPU_INFO_FW_ASD		0x0d
5663f012e29Smrg/* number of bytes moved for TTM migration */
5673f012e29Smrg#define AMDGPU_INFO_NUM_BYTES_MOVED		0x0f
5683f012e29Smrg/* the used VRAM size */
5693f012e29Smrg#define AMDGPU_INFO_VRAM_USAGE			0x10
5703f012e29Smrg/* the used GTT size */
5713f012e29Smrg#define AMDGPU_INFO_GTT_USAGE			0x11
5723f012e29Smrg/* Information about GDS, etc. resource configuration */
5733f012e29Smrg#define AMDGPU_INFO_GDS_CONFIG			0x13
5743f012e29Smrg/* Query information about VRAM and GTT domains */
5753f012e29Smrg#define AMDGPU_INFO_VRAM_GTT			0x14
5763f012e29Smrg/* Query information about register in MMR address space*/
5773f012e29Smrg#define AMDGPU_INFO_READ_MMR_REG		0x15
5783f012e29Smrg/* Query information about device: rev id, family, etc. */
5793f012e29Smrg#define AMDGPU_INFO_DEV_INFO			0x16
5803f012e29Smrg/* visible vram usage */
5813f012e29Smrg#define AMDGPU_INFO_VIS_VRAM_USAGE		0x17
582d8807b2fSmrg/* number of TTM buffer evictions */
583d8807b2fSmrg#define AMDGPU_INFO_NUM_EVICTIONS		0x18
584d8807b2fSmrg/* Query memory about VRAM and GTT domains */
585d8807b2fSmrg#define AMDGPU_INFO_MEMORY			0x19
586d8807b2fSmrg/* Query vce clock table */
587d8807b2fSmrg#define AMDGPU_INFO_VCE_CLOCK_TABLE		0x1A
588d8807b2fSmrg/* Query vbios related information */
589d8807b2fSmrg#define AMDGPU_INFO_VBIOS			0x1B
590d8807b2fSmrg	/* Subquery id: Query vbios size */
591d8807b2fSmrg	#define AMDGPU_INFO_VBIOS_SIZE		0x1
592d8807b2fSmrg	/* Subquery id: Query vbios image */
593d8807b2fSmrg	#define AMDGPU_INFO_VBIOS_IMAGE		0x2
594d8807b2fSmrg/* Query UVD handles */
595d8807b2fSmrg#define AMDGPU_INFO_NUM_HANDLES			0x1C
596d8807b2fSmrg/* Query sensor related information */
597d8807b2fSmrg#define AMDGPU_INFO_SENSOR			0x1D
598d8807b2fSmrg	/* Subquery id: Query GPU shader clock */
599d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GFX_SCLK		0x1
600d8807b2fSmrg	/* Subquery id: Query GPU memory clock */
601d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GFX_MCLK		0x2
602d8807b2fSmrg	/* Subquery id: Query GPU temperature */
603d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_TEMP		0x3
604d8807b2fSmrg	/* Subquery id: Query GPU load */
605d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_LOAD		0x4
606d8807b2fSmrg	/* Subquery id: Query average GPU power	*/
607d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_GPU_AVG_POWER	0x5
608d8807b2fSmrg	/* Subquery id: Query northbridge voltage */
609d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_VDDNB		0x6
610d8807b2fSmrg	/* Subquery id: Query graphics voltage */
611d8807b2fSmrg	#define AMDGPU_INFO_SENSOR_VDDGFX		0x7
612d8807b2fSmrg/* Number of VRAM page faults on CPU access. */
613d8807b2fSmrg#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS	0x1E
6143f012e29Smrg
6153f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT	0
6163f012e29Smrg#define AMDGPU_INFO_MMR_SE_INDEX_MASK	0xff
6173f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT	8
6183f012e29Smrg#define AMDGPU_INFO_MMR_SH_INDEX_MASK	0xff
6193f012e29Smrg
620037b3c26Smrgstruct drm_amdgpu_query_fw {
621037b3c26Smrg	/** AMDGPU_INFO_FW_* */
622d8807b2fSmrg	__u32 fw_type;
623037b3c26Smrg	/**
624037b3c26Smrg	 * Index of the IP if there are more IPs of
625037b3c26Smrg	 * the same type.
626037b3c26Smrg	 */
627d8807b2fSmrg	__u32 ip_instance;
628037b3c26Smrg	/**
629037b3c26Smrg	 * Index of the engine. Whether this is used depends
630037b3c26Smrg	 * on the firmware type. (e.g. MEC, SDMA)
631037b3c26Smrg	 */
632d8807b2fSmrg	__u32 index;
633d8807b2fSmrg	__u32 _pad;
634037b3c26Smrg};
635037b3c26Smrg
6363f012e29Smrg/* Input structure for the INFO ioctl */
6373f012e29Smrgstruct drm_amdgpu_info {
6383f012e29Smrg	/* Where the return value will be stored */
639d8807b2fSmrg	__u64 return_pointer;
6403f012e29Smrg	/* The size of the return value. Just like "size" in "snprintf",
6413f012e29Smrg	 * it limits how many bytes the kernel can write. */
642d8807b2fSmrg	__u32 return_size;
6433f012e29Smrg	/* The query request id. */
644d8807b2fSmrg	__u32 query;
6453f012e29Smrg
6463f012e29Smrg	union {
6473f012e29Smrg		struct {
648d8807b2fSmrg			__u32 id;
649d8807b2fSmrg			__u32 _pad;
6503f012e29Smrg		} mode_crtc;
6513f012e29Smrg
6523f012e29Smrg		struct {
6533f012e29Smrg			/** AMDGPU_HW_IP_* */
654d8807b2fSmrg			__u32 type;
6553f012e29Smrg			/**
6563f012e29Smrg			 * Index of the IP if there are more IPs of the same
6573f012e29Smrg			 * type. Ignored by AMDGPU_INFO_HW_IP_COUNT.
6583f012e29Smrg			 */
659d8807b2fSmrg			__u32 ip_instance;
6603f012e29Smrg		} query_hw_ip;
6613f012e29Smrg
6623f012e29Smrg		struct {
663d8807b2fSmrg			__u32 dword_offset;
6643f012e29Smrg			/** number of registers to read */
665d8807b2fSmrg			__u32 count;
666d8807b2fSmrg			__u32 instance;
6673f012e29Smrg			/** For future use, no flags defined so far */
668d8807b2fSmrg			__u32 flags;
6693f012e29Smrg		} read_mmr_reg;
6703f012e29Smrg
671037b3c26Smrg		struct drm_amdgpu_query_fw query_fw;
672d8807b2fSmrg
673d8807b2fSmrg		struct {
674d8807b2fSmrg			__u32 type;
675d8807b2fSmrg			__u32 offset;
676d8807b2fSmrg		} vbios_info;
677d8807b2fSmrg
678d8807b2fSmrg		struct {
679d8807b2fSmrg			__u32 type;
680d8807b2fSmrg		} sensor_info;
6813f012e29Smrg	};
6823f012e29Smrg};
6833f012e29Smrg
6843f012e29Smrgstruct drm_amdgpu_info_gds {
6853f012e29Smrg	/** GDS GFX partition size */
686d8807b2fSmrg	__u32 gds_gfx_partition_size;
6873f012e29Smrg	/** GDS compute partition size */
688d8807b2fSmrg	__u32 compute_partition_size;
6893f012e29Smrg	/** total GDS memory size */
690d8807b2fSmrg	__u32 gds_total_size;
6913f012e29Smrg	/** GWS size per GFX partition */
692d8807b2fSmrg	__u32 gws_per_gfx_partition;
6933f012e29Smrg	/** GSW size per compute partition */
694d8807b2fSmrg	__u32 gws_per_compute_partition;
6953f012e29Smrg	/** OA size per GFX partition */
696d8807b2fSmrg	__u32 oa_per_gfx_partition;
6973f012e29Smrg	/** OA size per compute partition */
698d8807b2fSmrg	__u32 oa_per_compute_partition;
699d8807b2fSmrg	__u32 _pad;
7003f012e29Smrg};
7013f012e29Smrg
7023f012e29Smrgstruct drm_amdgpu_info_vram_gtt {
703d8807b2fSmrg	__u64 vram_size;
704d8807b2fSmrg	__u64 vram_cpu_accessible_size;
705d8807b2fSmrg	__u64 gtt_size;
706d8807b2fSmrg};
707d8807b2fSmrg
708d8807b2fSmrgstruct drm_amdgpu_heap_info {
709d8807b2fSmrg	/** max. physical memory */
710d8807b2fSmrg	__u64 total_heap_size;
711d8807b2fSmrg
712d8807b2fSmrg	/** Theoretical max. available memory in the given heap */
713d8807b2fSmrg	__u64 usable_heap_size;
714d8807b2fSmrg
715d8807b2fSmrg	/**
716d8807b2fSmrg	 * Number of bytes allocated in the heap. This includes all processes
717d8807b2fSmrg	 * and private allocations in the kernel. It changes when new buffers
718d8807b2fSmrg	 * are allocated, freed, and moved. It cannot be larger than
719d8807b2fSmrg	 * heap_size.
720d8807b2fSmrg	 */
721d8807b2fSmrg	__u64 heap_usage;
722d8807b2fSmrg
723d8807b2fSmrg	/**
724d8807b2fSmrg	 * Theoretical possible max. size of buffer which
725d8807b2fSmrg	 * could be allocated in the given heap
726d8807b2fSmrg	 */
727d8807b2fSmrg	__u64 max_allocation;
728d8807b2fSmrg};
729d8807b2fSmrg
730d8807b2fSmrgstruct drm_amdgpu_memory_info {
731d8807b2fSmrg	struct drm_amdgpu_heap_info vram;
732d8807b2fSmrg	struct drm_amdgpu_heap_info cpu_accessible_vram;
733d8807b2fSmrg	struct drm_amdgpu_heap_info gtt;
7343f012e29Smrg};
7353f012e29Smrg
7363f012e29Smrgstruct drm_amdgpu_info_firmware {
737d8807b2fSmrg	__u32 ver;
738d8807b2fSmrg	__u32 feature;
7393f012e29Smrg};
7403f012e29Smrg
7413f012e29Smrg#define AMDGPU_VRAM_TYPE_UNKNOWN 0
7423f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR1 1
7433f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR2  2
7443f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR3 3
7453f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR4 4
7463f012e29Smrg#define AMDGPU_VRAM_TYPE_GDDR5 5
7473f012e29Smrg#define AMDGPU_VRAM_TYPE_HBM   6
7483f012e29Smrg#define AMDGPU_VRAM_TYPE_DDR3  7
7493f012e29Smrg
7503f012e29Smrgstruct drm_amdgpu_info_device {
7513f012e29Smrg	/** PCI Device ID */
752d8807b2fSmrg	__u32 device_id;
7533f012e29Smrg	/** Internal chip revision: A0, A1, etc.) */
754d8807b2fSmrg	__u32 chip_rev;
755d8807b2fSmrg	__u32 external_rev;
7563f012e29Smrg	/** Revision id in PCI Config space */
757d8807b2fSmrg	__u32 pci_rev;
758d8807b2fSmrg	__u32 family;
759d8807b2fSmrg	__u32 num_shader_engines;
760d8807b2fSmrg	__u32 num_shader_arrays_per_engine;
7613f012e29Smrg	/* in KHz */
762d8807b2fSmrg	__u32 gpu_counter_freq;
763d8807b2fSmrg	__u64 max_engine_clock;
764d8807b2fSmrg	__u64 max_memory_clock;
7653f012e29Smrg	/* cu information */
766d8807b2fSmrg	__u32 cu_active_number;
767d8807b2fSmrg	__u32 cu_ao_mask;
768d8807b2fSmrg	__u32 cu_bitmap[4][4];
7693f012e29Smrg	/** Render backend pipe mask. One render backend is CB+DB. */
770d8807b2fSmrg	__u32 enabled_rb_pipes_mask;
771d8807b2fSmrg	__u32 num_rb_pipes;
772d8807b2fSmrg	__u32 num_hw_gfx_contexts;
773d8807b2fSmrg	__u32 _pad;
774d8807b2fSmrg	__u64 ids_flags;
7753f012e29Smrg	/** Starting virtual address for UMDs. */
776d8807b2fSmrg	__u64 virtual_address_offset;
7773f012e29Smrg	/** The maximum virtual address */
778d8807b2fSmrg	__u64 virtual_address_max;
7793f012e29Smrg	/** Required alignment of virtual addresses. */
780d8807b2fSmrg	__u32 virtual_address_alignment;
7813f012e29Smrg	/** Page table entry - fragment size */
782d8807b2fSmrg	__u32 pte_fragment_size;
783d8807b2fSmrg	__u32 gart_page_size;
7843f012e29Smrg	/** constant engine ram size*/
785d8807b2fSmrg	__u32 ce_ram_size;
7863f012e29Smrg	/** video memory type info*/
787d8807b2fSmrg	__u32 vram_type;
7883f012e29Smrg	/** video memory bit width*/
789d8807b2fSmrg	__u32 vram_bit_width;
7903f012e29Smrg	/* vce harvesting instance */
791d8807b2fSmrg	__u32 vce_harvest_config;
792d8807b2fSmrg	/* gfx double offchip LDS buffers */
793d8807b2fSmrg	__u32 gc_double_offchip_lds_buf;
794d8807b2fSmrg	/* NGG Primitive Buffer */
795d8807b2fSmrg	__u64 prim_buf_gpu_addr;
796d8807b2fSmrg	/* NGG Position Buffer */
797d8807b2fSmrg	__u64 pos_buf_gpu_addr;
798d8807b2fSmrg	/* NGG Control Sideband */
799d8807b2fSmrg	__u64 cntl_sb_buf_gpu_addr;
800d8807b2fSmrg	/* NGG Parameter Cache */
801d8807b2fSmrg	__u64 param_buf_gpu_addr;
802d8807b2fSmrg	__u32 prim_buf_size;
803d8807b2fSmrg	__u32 pos_buf_size;
804d8807b2fSmrg	__u32 cntl_sb_buf_size;
805d8807b2fSmrg	__u32 param_buf_size;
806d8807b2fSmrg	/* wavefront size*/
807d8807b2fSmrg	__u32 wave_front_size;
808d8807b2fSmrg	/* shader visible vgprs*/
809d8807b2fSmrg	__u32 num_shader_visible_vgprs;
810d8807b2fSmrg	/* CU per shader array*/
811d8807b2fSmrg	__u32 num_cu_per_sh;
812d8807b2fSmrg	/* number of tcc blocks*/
813d8807b2fSmrg	__u32 num_tcc_blocks;
814d8807b2fSmrg	/* gs vgt table depth*/
815d8807b2fSmrg	__u32 gs_vgt_table_depth;
816d8807b2fSmrg	/* gs primitive buffer depth*/
817d8807b2fSmrg	__u32 gs_prim_buffer_depth;
818d8807b2fSmrg	/* max gs wavefront per vgt*/
819d8807b2fSmrg	__u32 max_gs_waves_per_vgt;
820d8807b2fSmrg	__u32 _pad1;
8213f012e29Smrg};
8223f012e29Smrg
8233f012e29Smrgstruct drm_amdgpu_info_hw_ip {
8243f012e29Smrg	/** Version of h/w IP */
825d8807b2fSmrg	__u32  hw_ip_version_major;
826d8807b2fSmrg	__u32  hw_ip_version_minor;
8273f012e29Smrg	/** Capabilities */
828d8807b2fSmrg	__u64  capabilities_flags;
8293f012e29Smrg	/** command buffer address start alignment*/
830d8807b2fSmrg	__u32  ib_start_alignment;
8313f012e29Smrg	/** command buffer size alignment*/
832d8807b2fSmrg	__u32  ib_size_alignment;
8333f012e29Smrg	/** Bitmask of available rings. Bit 0 means ring 0, etc. */
834d8807b2fSmrg	__u32  available_rings;
835d8807b2fSmrg	__u32  _pad;
836d8807b2fSmrg};
837d8807b2fSmrg
838d8807b2fSmrgstruct drm_amdgpu_info_num_handles {
839d8807b2fSmrg	/** Max handles as supported by firmware for UVD */
840d8807b2fSmrg	__u32  uvd_max_handles;
841d8807b2fSmrg	/** Handles currently in use for UVD */
842d8807b2fSmrg	__u32  uvd_used_handles;
843d8807b2fSmrg};
844d8807b2fSmrg
845d8807b2fSmrg#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES		6
846d8807b2fSmrg
847d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table_entry {
848d8807b2fSmrg	/** System clock */
849d8807b2fSmrg	__u32 sclk;
850d8807b2fSmrg	/** Memory clock */
851d8807b2fSmrg	__u32 mclk;
852d8807b2fSmrg	/** VCE clock */
853d8807b2fSmrg	__u32 eclk;
854d8807b2fSmrg	__u32 pad;
855d8807b2fSmrg};
856d8807b2fSmrg
857d8807b2fSmrgstruct drm_amdgpu_info_vce_clock_table {
858d8807b2fSmrg	struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
859d8807b2fSmrg	__u32 num_valid_entries;
860d8807b2fSmrg	__u32 pad;
8613f012e29Smrg};
8623f012e29Smrg
8633f012e29Smrg/*
8643f012e29Smrg * Supported GPU families
8653f012e29Smrg */
8663f012e29Smrg#define AMDGPU_FAMILY_UNKNOWN			0
867d8807b2fSmrg#define AMDGPU_FAMILY_SI			110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */
8683f012e29Smrg#define AMDGPU_FAMILY_CI			120 /* Bonaire, Hawaii */
8693f012e29Smrg#define AMDGPU_FAMILY_KV			125 /* Kaveri, Kabini, Mullins */
8703f012e29Smrg#define AMDGPU_FAMILY_VI			130 /* Iceland, Tonga */
871037b3c26Smrg#define AMDGPU_FAMILY_CZ			135 /* Carrizo, Stoney */
872d8807b2fSmrg#define AMDGPU_FAMILY_AI			141 /* Vega10 */
873d8807b2fSmrg#define AMDGPU_FAMILY_RV			142 /* Raven */
874037b3c26Smrg
875037b3c26Smrg#if defined(__cplusplus)
876037b3c26Smrg}
877037b3c26Smrg#endif
8783f012e29Smrg
8793f012e29Smrg#endif
880