aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h704
1 files changed, 55 insertions, 649 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 447c4c7a36d6..d0102cfc8efb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -28,6 +28,8 @@
28#ifndef __AMDGPU_H__ 28#ifndef __AMDGPU_H__
29#define __AMDGPU_H__ 29#define __AMDGPU_H__
30 30
31#include "amdgpu_ctx.h"
32
31#include <linux/atomic.h> 33#include <linux/atomic.h>
32#include <linux/wait.h> 34#include <linux/wait.h>
33#include <linux/list.h> 35#include <linux/list.h>
@@ -69,12 +71,32 @@
69#include "amdgpu_vcn.h" 71#include "amdgpu_vcn.h"
70#include "amdgpu_mn.h" 72#include "amdgpu_mn.h"
71#include "amdgpu_gmc.h" 73#include "amdgpu_gmc.h"
74#include "amdgpu_gfx.h"
75#include "amdgpu_sdma.h"
72#include "amdgpu_dm.h" 76#include "amdgpu_dm.h"
73#include "amdgpu_virt.h" 77#include "amdgpu_virt.h"
74#include "amdgpu_gart.h" 78#include "amdgpu_gart.h"
75#include "amdgpu_debugfs.h" 79#include "amdgpu_debugfs.h"
76#include "amdgpu_job.h" 80#include "amdgpu_job.h"
77#include "amdgpu_bo_list.h" 81#include "amdgpu_bo_list.h"
82#include "amdgpu_gem.h"
83
84#define MAX_GPU_INSTANCE 16
85
86struct amdgpu_gpu_instance
87{
88 struct amdgpu_device *adev;
89 int mgpu_fan_enabled;
90};
91
92struct amdgpu_mgpu_info
93{
94 struct amdgpu_gpu_instance gpu_ins[MAX_GPU_INSTANCE];
95 struct mutex mutex;
96 uint32_t num_gpu;
97 uint32_t num_dgpu;
98 uint32_t num_apu;
99};
78 100
79/* 101/*
80 * Modules parameters. 102 * Modules parameters.
@@ -129,6 +151,7 @@ extern int amdgpu_compute_multipipe;
129extern int amdgpu_gpu_recovery; 151extern int amdgpu_gpu_recovery;
130extern int amdgpu_emu_mode; 152extern int amdgpu_emu_mode;
131extern uint amdgpu_smu_memory_pool_size; 153extern uint amdgpu_smu_memory_pool_size;
154extern struct amdgpu_mgpu_info mgpu_info;
132 155
133#ifdef CONFIG_DRM_AMDGPU_SI 156#ifdef CONFIG_DRM_AMDGPU_SI
134extern int amdgpu_si_support; 157extern int amdgpu_si_support;
@@ -148,9 +171,6 @@ extern int amdgpu_cik_support;
148#define AMDGPUFB_CONN_LIMIT 4 171#define AMDGPUFB_CONN_LIMIT 4
149#define AMDGPU_BIOS_NUM_SCRATCH 16 172#define AMDGPU_BIOS_NUM_SCRATCH 16
150 173
151/* max number of IP instances */
152#define AMDGPU_MAX_SDMA_INSTANCES 2
153
154/* hard reset data */ 174/* hard reset data */
155#define AMDGPU_ASIC_RESET_DATA 0x39d5e86b 175#define AMDGPU_ASIC_RESET_DATA 0x39d5e86b
156 176
@@ -171,13 +191,6 @@ extern int amdgpu_cik_support;
171#define AMDGPU_RESET_VCE (1 << 13) 191#define AMDGPU_RESET_VCE (1 << 13)
172#define AMDGPU_RESET_VCE1 (1 << 14) 192#define AMDGPU_RESET_VCE1 (1 << 14)
173 193
174/* GFX current status */
175#define AMDGPU_GFX_NORMAL_MODE 0x00000000L
176#define AMDGPU_GFX_SAFE_MODE 0x00000001L
177#define AMDGPU_GFX_PG_DISABLED_MODE 0x00000002L
178#define AMDGPU_GFX_CG_DISABLED_MODE 0x00000004L
179#define AMDGPU_GFX_LBPW_DISABLED_MODE 0x00000008L
180
181/* max cursor sizes (in pixels) */ 194/* max cursor sizes (in pixels) */
182#define CIK_CURSOR_WIDTH 128 195#define CIK_CURSOR_WIDTH 128
183#define CIK_CURSOR_HEIGHT 128 196#define CIK_CURSOR_HEIGHT 128
@@ -205,13 +218,6 @@ enum amdgpu_cp_irq {
205 AMDGPU_CP_IRQ_LAST 218 AMDGPU_CP_IRQ_LAST
206}; 219};
207 220
208enum amdgpu_sdma_irq {
209 AMDGPU_SDMA_IRQ_TRAP0 = 0,
210 AMDGPU_SDMA_IRQ_TRAP1,
211
212 AMDGPU_SDMA_IRQ_LAST
213};
214
215enum amdgpu_thermal_irq { 221enum amdgpu_thermal_irq {
216 AMDGPU_THERMAL_IRQ_LOW_TO_HIGH = 0, 222 AMDGPU_THERMAL_IRQ_LOW_TO_HIGH = 0,
217 AMDGPU_THERMAL_IRQ_HIGH_TO_LOW, 223 AMDGPU_THERMAL_IRQ_HIGH_TO_LOW,
@@ -224,6 +230,10 @@ enum amdgpu_kiq_irq {
224 AMDGPU_CP_KIQ_IRQ_LAST 230 AMDGPU_CP_KIQ_IRQ_LAST
225}; 231};
226 232
233#define MAX_KIQ_REG_WAIT 5000 /* in usecs, 5ms */
234#define MAX_KIQ_REG_BAILOUT_INTERVAL 5 /* in msecs, 5ms */
235#define MAX_KIQ_REG_TRY 20
236
227int amdgpu_device_ip_set_clockgating_state(void *dev, 237int amdgpu_device_ip_set_clockgating_state(void *dev,
228 enum amd_ip_block_type block_type, 238 enum amd_ip_block_type block_type,
229 enum amd_clockgating_state state); 239 enum amd_clockgating_state state);
@@ -271,70 +281,6 @@ amdgpu_device_ip_get_ip_block(struct amdgpu_device *adev,
271int amdgpu_device_ip_block_add(struct amdgpu_device *adev, 281int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
272 const struct amdgpu_ip_block_version *ip_block_version); 282 const struct amdgpu_ip_block_version *ip_block_version);
273 283
274/* provided by hw blocks that can move/clear data. e.g., gfx or sdma */
275struct amdgpu_buffer_funcs {
276 /* maximum bytes in a single operation */
277 uint32_t copy_max_bytes;
278
279 /* number of dw to reserve per operation */
280 unsigned copy_num_dw;
281
282 /* used for buffer migration */
283 void (*emit_copy_buffer)(struct amdgpu_ib *ib,
284 /* src addr in bytes */
285 uint64_t src_offset,
286 /* dst addr in bytes */
287 uint64_t dst_offset,
288 /* number of byte to transfer */
289 uint32_t byte_count);
290
291 /* maximum bytes in a single operation */
292 uint32_t fill_max_bytes;
293
294 /* number of dw to reserve per operation */
295 unsigned fill_num_dw;
296
297 /* used for buffer clearing */
298 void (*emit_fill_buffer)(struct amdgpu_ib *ib,
299 /* value to write to memory */
300 uint32_t src_data,
301 /* dst addr in bytes */
302 uint64_t dst_offset,
303 /* number of byte to fill */
304 uint32_t byte_count);
305};
306
307/* provided by hw blocks that can write ptes, e.g., sdma */
308struct amdgpu_vm_pte_funcs {
309 /* number of dw to reserve per operation */
310 unsigned copy_pte_num_dw;
311
312 /* copy pte entries from GART */
313 void (*copy_pte)(struct amdgpu_ib *ib,
314 uint64_t pe, uint64_t src,
315 unsigned count);
316
317 /* write pte one entry at a time with addr mapping */
318 void (*write_pte)(struct amdgpu_ib *ib, uint64_t pe,
319 uint64_t value, unsigned count,
320 uint32_t incr);
321 /* for linear pte/pde updates without addr mapping */
322 void (*set_pte_pde)(struct amdgpu_ib *ib,
323 uint64_t pe,
324 uint64_t addr, unsigned count,
325 uint32_t incr, uint64_t flags);
326};
327
328/* provided by the ih block */
329struct amdgpu_ih_funcs {
330 /* ring read/write ptr handling, called from interrupt context */
331 u32 (*get_wptr)(struct amdgpu_device *adev);
332 bool (*prescreen_iv)(struct amdgpu_device *adev);
333 void (*decode_iv)(struct amdgpu_device *adev,
334 struct amdgpu_iv_entry *entry);
335 void (*set_rptr)(struct amdgpu_device *adev);
336};
337
338/* 284/*
339 * BIOS. 285 * BIOS.
340 */ 286 */
@@ -360,34 +306,6 @@ struct amdgpu_clock {
360 uint32_t max_pixel_clock; 306 uint32_t max_pixel_clock;
361}; 307};
362 308
363/*
364 * GEM.
365 */
366
367#define AMDGPU_GEM_DOMAIN_MAX 0x3
368#define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, gem_base) </