Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdkfd: add aldebaran kfd2kgd callbacks to kfd device (v2)

Create dedicated Aldebaran kfd2kgd callbacks to prepare
for new per-vmid register instructions for debug trap
setting functions and sending host traps.

v2: rebase (Alex)

Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Oak Zeng <Oak.Zeng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jonathan Kim and committed by
Alex Deucher
5073506c 51a0f459

+88 -10
+1
drivers/gpu/drm/amd/amdgpu/Makefile
··· 191 191 amdgpu_amdkfd_gfx_v8.o \ 192 192 amdgpu_amdkfd_gfx_v9.o \ 193 193 amdgpu_amdkfd_arcturus.o \ 194 + amdgpu_amdkfd_aldebaran.o \ 194 195 amdgpu_amdkfd_gfx_v10.o \ 195 196 amdgpu_amdkfd_gfx_v10_3.o 196 197
+47
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c
··· 1 + /* 2 + * Copyright 2020 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + */ 22 + #include "amdgpu.h" 23 + #include "amdgpu_amdkfd.h" 24 + #include "amdgpu_amdkfd_arcturus.h" 25 + #include "amdgpu_amdkfd_gfx_v9.h" 26 + 27 + const struct kfd2kgd_calls aldebaran_kfd2kgd = { 28 + .program_sh_mem_settings = kgd_gfx_v9_program_sh_mem_settings, 29 + .set_pasid_vmid_mapping = kgd_gfx_v9_set_pasid_vmid_mapping, 30 + .init_interrupts = kgd_gfx_v9_init_interrupts, 31 + .hqd_load = kgd_gfx_v9_hqd_load, 32 + .hiq_mqd_load = kgd_gfx_v9_hiq_mqd_load, 33 + .hqd_sdma_load = kgd_arcturus_hqd_sdma_load, 34 + .hqd_dump = kgd_gfx_v9_hqd_dump, 35 + .hqd_sdma_dump = kgd_arcturus_hqd_sdma_dump, 36 + .hqd_is_occupied = kgd_gfx_v9_hqd_is_occupied, 37 + .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied, 38 + .hqd_destroy = kgd_gfx_v9_hqd_destroy, 39 + .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy, 40 + .address_watch_disable = kgd_gfx_v9_address_watch_disable, 41 + .address_watch_execute = kgd_gfx_v9_address_watch_execute, 42 + .wave_control_execute = kgd_gfx_v9_wave_control_execute, 43 + .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset, 44 + .get_atc_vmid_pasid_mapping_info = 45 + kgd_gfx_v9_get_atc_vmid_pasid_mapping_info, 46 + .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base, 47 + };
+8 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
··· 47 47 #include "amdgpu_amdkfd_gfx_v9.h" 48 48 #include "gfxhub_v1_0.h" 49 49 #include "mmhub_v9_4.h" 50 - #include "mmhub_v1_7.h" 51 50 52 51 #define HQD_N_REGS 56 53 52 #define DUMP_REG(addr) do { \ ··· 122 123 return sdma_rlc_reg_offset; 123 124 } 124 125 125 - static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, 126 + int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, 126 127 uint32_t __user *wptr, struct mm_struct *mm) 127 128 { 128 129 struct amdgpu_device *adev = get_amdgpu_device(kgd); ··· 192 193 return 0; 193 194 } 194 195 195 - static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, 196 + int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, 196 197 uint32_t engine_id, uint32_t queue_id, 197 198 uint32_t (**dump)[2], uint32_t *n_regs) 198 199 { ··· 224 225 return 0; 225 226 } 226 227 227 - static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) 228 + bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) 228 229 { 229 230 struct amdgpu_device *adev = get_amdgpu_device(kgd); 230 231 struct v9_sdma_mqd *m; ··· 243 244 return false; 244 245 } 245 246 246 - static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, 247 + int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, 247 248 unsigned int utimeout) 248 249 { 249 250 struct amdgpu_device *adev = get_amdgpu_device(kgd); ··· 289 290 .init_interrupts = kgd_gfx_v9_init_interrupts, 290 291 .hqd_load = kgd_gfx_v9_hqd_load, 291 292 .hiq_mqd_load = kgd_gfx_v9_hiq_mqd_load, 292 - .hqd_sdma_load = kgd_hqd_sdma_load, 293 + .hqd_sdma_load = kgd_arcturus_hqd_sdma_load, 293 294 .hqd_dump = kgd_gfx_v9_hqd_dump, 294 - .hqd_sdma_dump = kgd_hqd_sdma_dump, 295 + .hqd_sdma_dump = kgd_arcturus_hqd_sdma_dump, 295 296 .hqd_is_occupied = kgd_gfx_v9_hqd_is_occupied, 296 - .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied, 297 + .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied, 297 298 .hqd_destroy = kgd_gfx_v9_hqd_destroy, 298 - .hqd_sdma_destroy = kgd_hqd_sdma_destroy, 299 + .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy, 299 300 .address_watch_disable = kgd_gfx_v9_address_watch_disable, 300 301 .address_watch_execute = kgd_gfx_v9_address_watch_execute, 301 302 .wave_control_execute = kgd_gfx_v9_wave_control_execute,
+30
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.h
··· 1 + /* 2 + * Copyright 2020 Advanced Micro Devices, Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + */ 22 + 23 + int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, 24 + uint32_t __user *wptr, struct mm_struct *mm); 25 + int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, 26 + uint32_t engine_id, uint32_t queue_id, 27 + uint32_t (**dump)[2], uint32_t *n_regs); 28 + bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); 29 + int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, 30 + unsigned int utimeout);
+2 -1
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 46 46 extern const struct kfd2kgd_calls gfx_v8_kfd2kgd; 47 47 extern const struct kfd2kgd_calls gfx_v9_kfd2kgd; 48 48 extern const struct kfd2kgd_calls arcturus_kfd2kgd; 49 + extern const struct kfd2kgd_calls aldebaran_kfd2kgd; 49 50 extern const struct kfd2kgd_calls gfx_v10_kfd2kgd; 50 51 extern const struct kfd2kgd_calls gfx_v10_3_kfd2kgd; 51 52 ··· 72 71 [CHIP_VEGA20] = &gfx_v9_kfd2kgd, 73 72 [CHIP_RENOIR] = &gfx_v9_kfd2kgd, 74 73 [CHIP_ARCTURUS] = &arcturus_kfd2kgd, 75 - [CHIP_ALDEBARAN] = &arcturus_kfd2kgd, 74 + [CHIP_ALDEBARAN] = &aldebaran_kfd2kgd, 76 75 [CHIP_NAVI10] = &gfx_v10_kfd2kgd, 77 76 [CHIP_NAVI12] = &gfx_v10_kfd2kgd, 78 77 [CHIP_NAVI14] = &gfx_v10_kfd2kgd,