aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-28 20:49:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-28 20:49:53 -0400
commit53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8 (patch)
treeb29473f21270aefd113b298c9402be8b4b3c91b4 /drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
parent746bb4ed6d626f3f9e431a7f9b20504538e62ded (diff)
parentf2bfc71aee75feff33ca659322b72ffeed5a243d (diff)
Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie: "This is going to rebuild more than drm as it adds a new helper to list.h for doing bulk updates. Seemed like a reasonable addition to me. Otherwise the usual merge window stuff lots of i915 and amdgpu, not so much nouveau, and piles of everything else. Core: - Adds a new list.h helper for doing bulk list updates for TTM. - Don't leak fb address in smem_start to userspace (comes with EXPORT workaround for people using mali out of tree hacks) - udmabuf device to turn memfd regions into dma-buf - Per-plane blend mode property - ref/unref replacements with get/put - fbdev conflicting framebuffers code cleaned up - host-endian format variants - panel orientation quirk for Acer One 10 bridge: - TI SN65DSI86 chip support vkms: - GEM support. - Cursor support amdgpu: - Merge amdkfd and amdgpu into one module - CEC over DP AUX support - Picasso APU support + VCN dynamic powergating - Raven2 APU support - Vega20 enablement + kfd support - ACP powergating improvements - ABGR/XBGR display support - VCN jpeg support - xGMI support - DC i2c/aux cleanup - Ycbcr 4:2:0 support - GPUVM improvements - Powerplay and powerplay endian fixes - Display underflow fixes vmwgfx: - Move vmwgfx specific TTM code to vmwgfx - Split out vmwgfx buffer/resource validation code - Atomic operation rework bochs: - use more helpers - format/byteorder improvements qxl: - use more helpers i915: - GGTT coherency getparam - Turn off resource streamer API - More Icelake enablement + DMC firmware - Full PPGTT for Ivybridge, Haswell and Valleyview - DDB distribution based on resolution - Limited range DP display support nouveau: - CEC over DP AUX support - Initial HDMI 2.0 support virtio-gpu: - vmap support for PRIME objects tegra: - Initial Tegra194 support - DMA/IOMMU integration fixes msm: - a6xx perf improvements + clock prefix - GPU preemption optimisations - a6xx devfreq support - cursor support rockchip: - PX30 support - rgb output interface support mediatek: - HDMI output support on mt2701 and mt7623 rcar-du: - Interlaced modes on Gen3 - LVDS on R8A77980 - D3 and E3 SoC support hisilicon: - misc fixes mxsfb: - runtime pm support sun4i: - R40 TCON support - Allwinner A64 support - R40 HDMI support omapdrm: - Driver rework changing display pipeline ordering to use common code - DMM memory barrier and irq fixes - Errata workarounds exynos: - out-bridge support for LVDS bridge driver - Samsung 16x16 tiled format support - Plane alpha and pixel blend mode support tilcdc: - suspend/resume update mali-dp: - misc updates" * tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits) firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake. drm/i915/icl: Fix signal_levels drm/i915/icl: Fix DDI/TC port clk_off bits drm/i915/icl: create function to identify combophy port drm/i915/gen9+: Fix initial readout for Y tiled framebuffers drm/i915: Large page offsets for pread/pwrite drm/i915/selftests: Disable shrinker across mmap-exhaustion drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode drm/i915: Fix intel_dp_mst_best_encoder() drm/i915: Skip vcpi allocation for MSTB ports that are gone drm/i915: Don't unset intel_connector->mst_port drm/i915: Only reset seqno if actually idle drm/i915: Use the correct crtc when sanitizing plane mapping drm/i915: Restore vblank interrupts earlier drm/i915: Check fb stride against plane max stride drm/amdgpu/vcn:Fix uninitialized symbol error drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003) drm/amd/amdgpu: Fix debugfs error handling drm/amdgpu: Update gc_9_0 golden settings. drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c93
1 files changed, 49 insertions, 44 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 0c791e35acf0..c31a8849e9f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -28,7 +28,6 @@
28#include <linux/module.h> 28#include <linux/module.h>
29 29
30const struct kgd2kfd_calls *kgd2kfd; 30const struct kgd2kfd_calls *kgd2kfd;
31bool (*kgd2kfd_init_p)(unsigned int, const struct kgd2kfd_calls**);
32 31
33static const unsigned int compute_vmid_bitmap = 0xFF00; 32static const unsigned int compute_vmid_bitmap = 0xFF00;
34 33
@@ -36,45 +35,23 @@ int amdgpu_amdkfd_init(void)
36{ 35{
37 int ret; 36 int ret;
38 37
39#if defined(CONFIG_HSA_AMD_MODULE) 38#ifdef CONFIG_HSA_AMD
40 int (*kgd2kfd_init_p)(unsigned int, const struct kgd2kfd_calls**);
41
42 kgd2kfd_init_p = symbol_request(kgd2kfd_init);
43
44 if (kgd2kfd_init_p == NULL)
45 return -ENOENT;
46
47 ret = kgd2kfd_init_p(KFD_INTERFACE_VERSION, &kgd2kfd);
48 if (ret) {
49 symbol_put(kgd2kfd_init);
50 kgd2kfd = NULL;
51 }
52
53
54#elif defined(CONFIG_HSA_AMD)
55
56 ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd); 39 ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd);
57 if (ret) 40 if (ret)
58 kgd2kfd = NULL; 41 kgd2kfd = NULL;
59 42 amdgpu_amdkfd_gpuvm_init_mem_limits();
60#else 43#else
61 kgd2kfd = NULL; 44 kgd2kfd = NULL;
62 ret = -ENOENT; 45 ret = -ENOENT;
63#endif 46#endif
64 47
65#if defined(CONFIG_HSA_AMD_MODULE) || defined(CONFIG_HSA_AMD)
66 amdgpu_amdkfd_gpuvm_init_mem_limits();
67#endif
68
69 return ret; 48 return ret;
70} 49}
71 50
72void amdgpu_amdkfd_fini(void) 51void amdgpu_amdkfd_fini(void)
73{ 52{
74 if (kgd2kfd) { 53 if (kgd2kfd)
75 kgd2kfd->exit(); 54 kgd2kfd->exit();
76 symbol_put(kgd2kfd_init);
77 }
78} 55}
79 56
80void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev) 57void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
@@ -99,6 +76,7 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
99 kfd2kgd = amdgpu_amdkfd_gfx_8_0_get_functions(); 76 kfd2kgd = amdgpu_amdkfd_gfx_8_0_get_functions();
100 break; 77 break;
101 case CHIP_VEGA10: 78 case CHIP_VEGA10:
79 case CHIP_VEGA20:
102 case CHIP_RAVEN: 80 case CHIP_RAVEN:
103 kfd2kgd = amdgpu_amdkfd_gfx_9_0_get_functions(); 81 kfd2kgd = amdgpu_amdkfd_gfx_9_0_get_functions();
104 break; 82 break;
@@ -146,7 +124,7 @@ static void amdgpu_doorbell_get_kfd_info(struct amdgpu_device *adev,
146 124
147void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) 125void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
148{ 126{
149 int i; 127 int i, n;
150 int last_valid_bit; 128 int last_valid_bit;
151 if (adev->kfd) { 129 if (adev->kfd) {
152 struct kgd2kfd_shared_resources gpu_resources = { 130 struct kgd2kfd_shared_resources gpu_resources = {
@@ -155,7 +133,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
155 .num_queue_per_pipe = adev->gfx.mec.num_queue_per_pipe, 133 .num_queue_per_pipe = adev->gfx.mec.num_queue_per_pipe,
156 .gpuvm_size = min(adev->vm_manager.max_pfn 134 .gpuvm_size = min(adev->vm_manager.max_pfn
157 << AMDGPU_GPU_PAGE_SHIFT, 135 << AMDGPU_GPU_PAGE_SHIFT,
158 AMDGPU_VA_HOLE_START), 136 AMDGPU_GMC_HOLE_START),
159 .drm_render_minor = adev->ddev->render->index 137 .drm_render_minor = adev->ddev->render->index
160 }; 138 };
161 139
@@ -185,7 +163,15 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
185 &gpu_resources.doorbell_physical_address, 163 &gpu_resources.doorbell_physical_address,
186 &gpu_resources.doorbell_aperture_size, 164 &gpu_resources.doorbell_aperture_size,
187 &gpu_resources.doorbell_start_offset); 165 &gpu_resources.doorbell_start_offset);
188 if (adev->asic_type >= CHIP_VEGA10) { 166
167 if (adev->asic_type < CHIP_VEGA10) {
168 kgd2kfd->device_init(adev->kfd, &gpu_resources);
169 return;
170 }
171
172 n = (adev->asic_type < CHIP_VEGA20) ? 2 : 8;
173
174 for (i = 0; i < n; i += 2) {
189 /* On SOC15 the BIF is involved in routing 175 /* On SOC15 the BIF is involved in routing
190 * doorbells using the low 12 bits of the 176 * doorbells using the low 12 bits of the
191 * address. Communicate the assignments to 177 * address. Communicate the assignments to
@@ -193,20 +179,31 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
193 * process in case of 64-bit doorbells so we 179 * process in case of 64-bit doorbells so we
194 * can use each doorbell assignment twice. 180 * can use each doorbell assignment twice.
195 */ 181 */
196 gpu_resources.sdma_doorbell[0][0] = 182 if (adev->asic_type == CHIP_VEGA10) {
197 AMDGPU_DOORBELL64_sDMA_ENGINE0; 183 gpu_resources.sdma_doorbell[0][i] =
198 gpu_resources.sdma_doorbell[0][1] = 184 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + (i >> 1);
199 AMDGPU_DOORBELL64_sDMA_ENGINE0 + 0x200; 185 gpu_resources.sdma_doorbell[0][i+1] =
200 gpu_resources.sdma_doorbell[1][0] = 186 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + 0x200 + (i >> 1);
201 AMDGPU_DOORBELL64_sDMA_ENGINE1; 187 gpu_resources.sdma_doorbell[1][i] =
202 gpu_resources.sdma_doorbell[1][1] = 188 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + (i >> 1);
203 AMDGPU_DOORBELL64_sDMA_ENGINE1 + 0x200; 189 gpu_resources.sdma_doorbell[1][i+1] =
204 /* Doorbells 0x0f0-0ff and 0x2f0-2ff are reserved for 190 AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + 0x200 + (i >> 1);
205 * SDMA, IH and VCN. So don't use them for the CP. 191 } else {
206 */ 192 gpu_resources.sdma_doorbell[0][i] =
207 gpu_resources.reserved_doorbell_mask = 0x1f0; 193 AMDGPU_DOORBELL64_sDMA_ENGINE0 + (i >> 1);
208 gpu_resources.reserved_doorbell_val = 0x0f0; 194 gpu_resources.sdma_doorbell[0][i+1] =
195 AMDGPU_DOORBELL64_sDMA_ENGINE0 + 0x200 + (i >> 1);
196 gpu_resources.sdma_doorbell[1][i] =
197 AMDGPU_DOORBELL64_sDMA_ENGINE1 + (i >> 1);
198 gpu_resources.sdma_doorbell[1][i+1] =
199 AMDGPU_DOORBELL64_sDMA_ENGINE1 + 0x200 + (i >> 1);
200 }
209 } 201 }
202 /* Doorbells 0x0e0-0ff and 0x2e0-2ff are reserved for
203 * SDMA, IH and VCN. So don't use them for the CP.
204 */
205 gpu_resources.reserved_doorbell_mask = 0x1e0;
206 gpu_resources.reserved_doorbell_val = 0x0e0;
210 207
211 kgd2kfd->device_init(adev->kfd, &gpu_resources); 208 kgd2kfd->device_init(adev->kfd, &gpu_resources);
212 } 209 }
@@ -267,7 +264,8 @@ void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd)
267{ 264{
268 struct amdgpu_device *adev = (struct amdgpu_device *)kgd; 265 struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
269 266