amdgpu_amdkfd.h revision 1.1 1 /* $NetBSD: amdgpu_amdkfd.h,v 1.1 2018/08/27 01:34:43 riastradh Exp $ */
2
3 /*
4 * Copyright 2014 Advanced Micro Devices, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /* amdgpu_amdkfd.h defines the private interface between amdgpu and amdkfd. */
26
27 #ifndef AMDGPU_AMDKFD_H_INCLUDED
28 #define AMDGPU_AMDKFD_H_INCLUDED
29
30 #include <linux/types.h>
31 #include <kgd_kfd_interface.h>
32
33 struct amdgpu_device;
34
35 struct kgd_mem {
36 struct amdgpu_bo *bo;
37 uint64_t gpu_addr;
38 void *cpu_ptr;
39 };
40
41 bool amdgpu_amdkfd_init(void);
42 void amdgpu_amdkfd_fini(void);
43
44 bool amdgpu_amdkfd_load_interface(struct amdgpu_device *rdev);
45
46 void amdgpu_amdkfd_suspend(struct amdgpu_device *rdev);
47 int amdgpu_amdkfd_resume(struct amdgpu_device *rdev);
48 void amdgpu_amdkfd_interrupt(struct amdgpu_device *rdev,
49 const void *ih_ring_entry);
50 void amdgpu_amdkfd_device_probe(struct amdgpu_device *rdev);
51 void amdgpu_amdkfd_device_init(struct amdgpu_device *rdev);
52 void amdgpu_amdkfd_device_fini(struct amdgpu_device *rdev);
53
54 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void);
55 struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void);
56
57 /* Shared API */
58 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
59 void **mem_obj, uint64_t *gpu_addr,
60 void **cpu_ptr);
61 void free_gtt_mem(struct kgd_dev *kgd, void *mem_obj);
62 uint64_t get_vmem_size(struct kgd_dev *kgd);
63 uint64_t get_gpu_clock_counter(struct kgd_dev *kgd);
64
65 uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd);
66
67 #endif /* AMDGPU_AMDKFD_H_INCLUDED */
68