Commit 6bfc7c7e authored by Graham Sider's avatar Graham Sider Committed by Alex Deucher

drm/amdkfd: replace kgd_dev in various amgpu_amdkfd funcs

Modified definitions:

- amdgpu_amdkfd_submit_ib
- amdgpu_amdkfd_set_compute_idle
- amdgpu_amdkfd_have_atomics_support
- amdgpu_amdkfd_flush_gpu_tlb_pasid
- amdgpu_amdkfd_flush_gpu_tlb_pasid
- amdgpu_amdkfd_gpu_reset
- amdgpu_amdkfd_alloc_gtt_mem
- amdgpu_amdkfd_free_gtt_mem
- amdgpu_amdkfd_alloc_gws
- amdgpu_amdkfd_free_gws
- amdgpu_amdkfd_ras_poison_consumption_handler
Signed-off-by: default avatarGraham Sider <Graham.Sider@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3356c38d
...@@ -233,19 +233,16 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev) ...@@ -233,19 +233,16 @@ int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev)
return r; return r;
} }
void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd) void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
if (amdgpu_device_should_recover_gpu(adev)) if (amdgpu_device_should_recover_gpu(adev))
amdgpu_device_gpu_recover(adev, NULL); amdgpu_device_gpu_recover(adev, NULL);
} }
int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size, int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
void **mem_obj, uint64_t *gpu_addr, void **mem_obj, uint64_t *gpu_addr,
void **cpu_ptr, bool cp_mqd_gfx9) void **cpu_ptr, bool cp_mqd_gfx9)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
struct amdgpu_bo *bo = NULL; struct amdgpu_bo *bo = NULL;
struct amdgpu_bo_param bp; struct amdgpu_bo_param bp;
int r; int r;
...@@ -314,7 +311,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size, ...@@ -314,7 +311,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
return r; return r;
} }
void amdgpu_amdkfd_free_gtt_mem(struct kgd_dev *kgd, void *mem_obj) void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void *mem_obj)
{ {
struct amdgpu_bo *bo = (struct amdgpu_bo *) mem_obj; struct amdgpu_bo *bo = (struct amdgpu_bo *) mem_obj;
...@@ -325,10 +322,9 @@ void amdgpu_amdkfd_free_gtt_mem(struct kgd_dev *kgd, void *mem_obj) ...@@ -325,10 +322,9 @@ void amdgpu_amdkfd_free_gtt_mem(struct kgd_dev *kgd, void *mem_obj)
amdgpu_bo_unref(&(bo)); amdgpu_bo_unref(&(bo));
} }
int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size, int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size,
void **mem_obj) void **mem_obj)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
struct amdgpu_bo *bo = NULL; struct amdgpu_bo *bo = NULL;
struct amdgpu_bo_user *ubo; struct amdgpu_bo_user *ubo;
struct amdgpu_bo_param bp; struct amdgpu_bo_param bp;
...@@ -355,7 +351,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size, ...@@ -355,7 +351,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
return 0; return 0;
} }
void amdgpu_amdkfd_free_gws(struct kgd_dev *kgd, void *mem_obj) void amdgpu_amdkfd_free_gws(struct amdgpu_device *adev, void *mem_obj)
{ {
struct amdgpu_bo *bo = (struct amdgpu_bo *)mem_obj; struct amdgpu_bo *bo = (struct amdgpu_bo *)mem_obj;
...@@ -675,11 +671,11 @@ int amdgpu_amdkfd_get_noretry(struct kgd_dev *kgd) ...@@ -675,11 +671,11 @@ int amdgpu_amdkfd_get_noretry(struct kgd_dev *kgd)
return adev->gmc.noretry; return adev->gmc.noretry;
} }
int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine, int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
enum kgd_engine_type engine,
uint32_t vmid, uint64_t gpu_addr, uint32_t vmid, uint64_t gpu_addr,
uint32_t *ib_cmd, uint32_t ib_len) uint32_t *ib_cmd, uint32_t ib_len)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
struct amdgpu_job *job; struct amdgpu_job *job;
struct amdgpu_ib *ib; struct amdgpu_ib *ib;
struct amdgpu_ring *ring; struct amdgpu_ring *ring;
...@@ -730,10 +726,8 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine, ...@@ -730,10 +726,8 @@ int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine,
return ret; return ret;
} }
void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle) void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
amdgpu_dpm_switch_power_profile(adev, amdgpu_dpm_switch_power_profile(adev,
PP_SMC_POWER_PROFILE_COMPUTE, PP_SMC_POWER_PROFILE_COMPUTE,
!idle); !idle);
...@@ -747,10 +741,9 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid) ...@@ -747,10 +741,9 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
return false; return false;
} }
int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid) int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct amdgpu_device *adev,
uint16_t vmid)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
if (adev->family == AMDGPU_FAMILY_AI) { if (adev->family == AMDGPU_FAMILY_AI) {
int i; int i;
...@@ -763,10 +756,9 @@ int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid) ...@@ -763,10 +756,9 @@ int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid)
return 0; return 0;
} }
int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid, int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
enum TLB_FLUSH_TYPE flush_type) uint16_t pasid, enum TLB_FLUSH_TYPE flush_type)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
bool all_hub = false; bool all_hub = false;
if (adev->family == AMDGPU_FAMILY_AI) if (adev->family == AMDGPU_FAMILY_AI)
...@@ -775,21 +767,18 @@ int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid, ...@@ -775,21 +767,18 @@ int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid,
return amdgpu_gmc_flush_gpu_tlb_pasid(adev, pasid, flush_type, all_hub); return amdgpu_gmc_flush_gpu_tlb_pasid(adev, pasid, flush_type, all_hub);
} }
bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd) bool amdgpu_amdkfd_have_atomics_support(struct amdgpu_device *adev)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
return adev->have_atomics_support; return adev->have_atomics_support;
} }
void amdgpu_amdkfd_ras_poison_consumption_handler(struct kgd_dev *kgd) void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
struct ras_err_data err_data = {0, 0, 0, NULL}; struct ras_err_data err_data = {0, 0, 0, NULL};
/* CPU MCA will handle page retirement if connected_to_cpu is 1 */ /* CPU MCA will handle page retirement if connected_to_cpu is 1 */
if (!adev->gmc.xgmi.connected_to_cpu) if (!adev->gmc.xgmi.connected_to_cpu)
amdgpu_umc_process_ras_data_cb(adev, &err_data, NULL); amdgpu_umc_process_ras_data_cb(adev, &err_data, NULL);
else else
amdgpu_amdkfd_gpu_reset(kgd); amdgpu_amdkfd_gpu_reset(adev);
} }
...@@ -144,14 +144,16 @@ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev, ...@@ -144,14 +144,16 @@ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev); void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev);
void amdgpu_amdkfd_device_init(struct amdgpu_device *adev); void amdgpu_amdkfd_device_init(struct amdgpu_device *adev);
void amdgpu_amdkfd_device_fini_sw(struct amdgpu_device *adev); void amdgpu_amdkfd_device_fini_sw(struct amdgpu_device *adev);
int amdgpu_amdkfd_submit_ib(struct kgd_dev *kgd, enum kgd_engine_type engine, int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
enum kgd_engine_type engine,
uint32_t vmid, uint64_t gpu_addr, uint32_t vmid, uint64_t gpu_addr,
uint32_t *ib_cmd, uint32_t ib_len); uint32_t *ib_cmd, uint32_t ib_len);
void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle); void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle);
bool amdgpu_amdkfd_have_atomics_support(struct kgd_dev *kgd); bool amdgpu_amdkfd_have_atomics_support(struct amdgpu_device *adev);
int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct kgd_dev *kgd, uint16_t vmid); int amdgpu_amdkfd_flush_gpu_tlb_vmid(struct amdgpu_device *adev,
int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct kgd_dev *kgd, uint16_t pasid, uint16_t vmid);
enum TLB_FLUSH_TYPE flush_type); int amdgpu_amdkfd_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
uint16_t pasid, enum TLB_FLUSH_TYPE flush_type);
bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid); bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid);
...@@ -159,7 +161,7 @@ int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev); ...@@ -159,7 +161,7 @@ int amdgpu_amdkfd_pre_reset(struct amdgpu_device *adev);
int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev); int amdgpu_amdkfd_post_reset(struct amdgpu_device *adev);
void amdgpu_amdkfd_gpu_reset(struct kgd_dev *kgd); void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev);
int amdgpu_queue_mask_bit_to_set_resource_bit(struct amdgpu_device *adev, int amdgpu_queue_mask_bit_to_set_resource_bit(struct amdgpu_device *adev,
int queue_bit); int queue_bit);
...@@ -198,12 +200,13 @@ int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm) ...@@ -198,12 +200,13 @@ int amdgpu_amdkfd_evict_userptr(struct kgd_mem *mem, struct mm_struct *mm)
} }
#endif #endif
/* Shared API */ /* Shared API */
int amdgpu_amdkfd_alloc_gtt_mem(struct kgd_dev *kgd, size_t size, int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
void **mem_obj, uint64_t *gpu_addr, void **mem_obj, uint64_t *gpu_addr,
void **cpu_ptr, bool mqd_gfx9); void **cpu_ptr, bool mqd_gfx9);
void amdgpu_amdkfd_free_gtt_mem(struct kgd_dev *kgd, void *mem_obj); void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void *mem_obj);
int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size, void **mem_obj); int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size,
void amdgpu_amdkfd_free_gws(struct kgd_dev *kgd, void *mem_obj); void **mem_obj);
void amdgpu_amdkfd_free_gws(struct amdgpu_device *adev, void *mem_obj);
int amdgpu_amdkfd_add_gws_to_process(void *info, void *gws, struct kgd_mem **mem); int amdgpu_amdkfd_add_gws_to_process(void *info, void *gws, struct kgd_mem **mem);
int amdgpu_amdkfd_remove_gws_from_process(void *info, void *mem); int amdgpu_amdkfd_remove_gws_from_process(void *info, void *mem);
uint32_t amdgpu_amdkfd_get_fw_version(struct kgd_dev *kgd, uint32_t amdgpu_amdkfd_get_fw_version(struct kgd_dev *kgd,
...@@ -292,7 +295,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, ...@@ -292,7 +295,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
uint64_t *mmap_offset); uint64_t *mmap_offset);
int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd, int amdgpu_amdkfd_get_tile_config(struct kgd_dev *kgd,
struct tile_config *config); struct tile_config *config);
void amdgpu_amdkfd_ras_poison_consumption_handler(struct kgd_dev *kgd); void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev);
#if IS_ENABLED(CONFIG_HSA_AMD) #if IS_ENABLED(CONFIG_HSA_AMD)
void amdgpu_amdkfd_gpuvm_init_mem_limits(void); void amdgpu_amdkfd_gpuvm_init_mem_limits(void);
void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev, void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
......
...@@ -893,7 +893,7 @@ static int kfd_gws_init(struct kfd_dev *kfd) ...@@ -893,7 +893,7 @@ static int kfd_gws_init(struct kfd_dev *kfd)
&& kfd->mec2_fw_version >= 0x30) && kfd->mec2_fw_version >= 0x30)
|| (kfd->device_info->asic_family == CHIP_ALDEBARAN || (kfd->device_info->asic_family == CHIP_ALDEBARAN
&& kfd->mec2_fw_version >= 0x28)) && kfd->mec2_fw_version >= 0x28))
ret = amdgpu_amdkfd_alloc_gws(kfd->kgd, ret = amdgpu_amdkfd_alloc_gws(kfd->adev,
amdgpu_amdkfd_get_num_gws(kfd->kgd), &kfd->gws); amdgpu_amdkfd_get_num_gws(kfd->kgd), &kfd->gws);
return ret; return ret;
...@@ -928,7 +928,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, ...@@ -928,7 +928,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
* 32 and 64-bit requests are possible and must be * 32 and 64-bit requests are possible and must be
* supported. * supported.
*/ */
kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kfd->kgd); kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kfd->adev);
if (!kfd->pci_atomic_requested && if (!kfd->pci_atomic_requested &&
kfd->device_info->needs_pci_atomics && kfd->device_info->needs_pci_atomics &&
(!kfd->device_info->no_atomic_fw_version || (!kfd->device_info->no_atomic_fw_version ||
...@@ -975,7 +975,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, ...@@ -975,7 +975,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
size += 512 * 1024; size += 512 * 1024;
if (amdgpu_amdkfd_alloc_gtt_mem( if (amdgpu_amdkfd_alloc_gtt_mem(
kfd->kgd, size, &kfd->gtt_mem, kfd->adev, size, &kfd->gtt_mem,
&kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr,
false)) { false)) {
dev_err(kfd_device, "Could not allocate %d bytes\n", size); dev_err(kfd_device, "Could not allocate %d bytes\n", size);
...@@ -1069,10 +1069,10 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, ...@@ -1069,10 +1069,10 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
kfd_doorbell_error: kfd_doorbell_error:
kfd_gtt_sa_fini(kfd); kfd_gtt_sa_fini(kfd);
kfd_gtt_sa_init_error: kfd_gtt_sa_init_error:
amdgpu_amdkfd_free_gtt_mem(kfd->kgd, kfd->gtt_mem); amdgpu_amdkfd_free_gtt_mem(kfd->adev, kfd->gtt_mem);
alloc_gtt_mem_failure: alloc_gtt_mem_failure:
if (kfd->gws) if (kfd->gws)
amdgpu_amdkfd_free_gws(kfd->kgd, kfd->gws); amdgpu_amdkfd_free_gws(kfd->adev, kfd->gws);
dev_err(kfd_device, dev_err(kfd_device,
"device %x:%x NOT added due to errors\n", "device %x:%x NOT added due to errors\n",
kfd->pdev->vendor, kfd->pdev->device); kfd->pdev->vendor, kfd->pdev->device);
...@@ -1089,9 +1089,9 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd) ...@@ -1089,9 +1089,9 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)
kfd_doorbell_fini(kfd); kfd_doorbell_fini(kfd);
ida_destroy(&kfd->doorbell_ida); ida_destroy(&kfd->doorbell_ida);
kfd_gtt_sa_fini(kfd); kfd_gtt_sa_fini(kfd);
amdgpu_amdkfd_free_gtt_mem(kfd->kgd, kfd->gtt_mem); amdgpu_amdkfd_free_gtt_mem(kfd->adev, kfd->gtt_mem);
if (kfd->gws) if (kfd->gws)
amdgpu_amdkfd_free_gws(kfd->kgd, kfd->gws); amdgpu_amdkfd_free_gws(kfd->adev, kfd->gws);
} }
kfree(kfd); kfree(kfd);
...@@ -1527,7 +1527,7 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd) ...@@ -1527,7 +1527,7 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd)
void kfd_inc_compute_active(struct kfd_dev *kfd) void kfd_inc_compute_active(struct kfd_dev *kfd)
{ {
if (atomic_inc_return(&kfd->compute_profile) == 1) if (atomic_inc_return(&kfd->compute_profile) == 1)
amdgpu_amdkfd_set_compute_idle(kfd->kgd, false); amdgpu_amdkfd_set_compute_idle(kfd->adev, false);
} }
void kfd_dec_compute_active(struct kfd_dev *kfd) void kfd_dec_compute_active(struct kfd_dev *kfd)
...@@ -1535,7 +1535,7 @@ void kfd_dec_compute_active(struct kfd_dev *kfd) ...@@ -1535,7 +1535,7 @@ void kfd_dec_compute_active(struct kfd_dev *kfd)
int count = atomic_dec_return(&kfd->compute_profile); int count = atomic_dec_return(&kfd->compute_profile);
if (count == 0) if (count == 0)
amdgpu_amdkfd_set_compute_idle(kfd->kgd, true); amdgpu_amdkfd_set_compute_idle(kfd->adev, true);
WARN_ONCE(count < 0, "Compute profile ref. count error"); WARN_ONCE(count < 0, "Compute profile ref. count error");
} }
......
...@@ -283,7 +283,7 @@ static int flush_texture_cache_nocpsch(struct kfd_dev *kdev, ...@@ -283,7 +283,7 @@ static int flush_texture_cache_nocpsch(struct kfd_dev *kdev,
if (ret) if (ret)
return ret; return ret;
return amdgpu_amdkfd_submit_ib(kdev->kgd, KGD_ENGINE_MEC1, qpd->vmid, return amdgpu_amdkfd_submit_ib(kdev->adev, KGD_ENGINE_MEC1, qpd->vmid,
qpd->ib_base, (uint32_t *)qpd->ib_kaddr, qpd->ib_base, (uint32_t *)qpd->ib_kaddr,
pmf->release_mem_size / sizeof(uint32_t)); pmf->release_mem_size / sizeof(uint32_t));
} }
...@@ -1845,7 +1845,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm) ...@@ -1845,7 +1845,7 @@ static int allocate_hiq_sdma_mqd(struct device_queue_manager *dqm)
dev->device_info->num_sdma_queues_per_engine + dev->device_info->num_sdma_queues_per_engine +
dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ]->mqd_size; dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ]->mqd_size;
retval = amdgpu_amdkfd_alloc_gtt_mem(dev->kgd, size, retval = amdgpu_amdkfd_alloc_gtt_mem(dev->adev, size,
&(mem_obj->gtt_mem), &(mem_obj->gpu_addr), &(mem_obj->gtt_mem), &(mem_obj->gpu_addr),
(void *)&(mem_obj->cpu_ptr), false); (void *)&(mem_obj->cpu_ptr), false);
...@@ -1995,7 +1995,7 @@ static void deallocate_hiq_sdma_mqd(struct kfd_dev *dev, ...@@ -1995,7 +1995,7 @@ static void deallocate_hiq_sdma_mqd(struct kfd_dev *dev,
{ {
WARN(!mqd, "No hiq sdma mqd trunk to free"); WARN(!mqd, "No hiq sdma mqd trunk to free");
amdgpu_amdkfd_free_gtt_mem(dev->kgd, mqd->gtt_mem); amdgpu_amdkfd_free_gtt_mem(dev->adev, mqd->gtt_mem);
} }
void device_queue_manager_uninit(struct device_queue_manager *dqm) void device_queue_manager_uninit(struct device_queue_manager *dqm)
...@@ -2026,7 +2026,7 @@ static void kfd_process_hw_exception(struct work_struct *work) ...@@ -2026,7 +2026,7 @@ static void kfd_process_hw_exception(struct work_struct *work)
{ {
struct device_queue_manager *dqm = container_of(work, struct device_queue_manager *dqm = container_of(work,
struct device_queue_manager, hw_exception_work); struct device_queue_manager, hw_exception_work);
amdgpu_amdkfd_gpu_reset(dqm->dev->kgd); amdgpu_amdkfd_gpu_reset(dqm->dev->adev);
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
......
...@@ -231,7 +231,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev, ...@@ -231,7 +231,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev,
if (sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_ILLEGAL_INST && if (sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_ILLEGAL_INST &&
sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_MEMVIOL) { sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_MEMVIOL) {
kfd_signal_poison_consumed_event(dev, pasid); kfd_signal_poison_consumed_event(dev, pasid);
amdgpu_amdkfd_ras_poison_consumption_handler(dev->kgd); amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev);
return; return;
} }
break; break;
...@@ -253,7 +253,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev, ...@@ -253,7 +253,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev,
kfd_signal_event_interrupt(pasid, context_id0 & 0xfffffff, 28); kfd_signal_event_interrupt(pasid, context_id0 & 0xfffffff, 28);
} else if (source_id == SOC15_INTSRC_SDMA_ECC) { } else if (source_id == SOC15_INTSRC_SDMA_ECC) {
kfd_signal_poison_consumed_event(dev, pasid); kfd_signal_poison_consumed_event(dev, pasid);
amdgpu_amdkfd_ras_poison_consumption_handler(dev->kgd); amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev);
return; return;
} }
} else if (client_id == SOC15_IH_CLIENTID_VMC || } else if (client_id == SOC15_IH_CLIENTID_VMC ||
......
...@@ -108,7 +108,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd, ...@@ -108,7 +108,7 @@ static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL); mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
if (!mqd_mem_obj) if (!mqd_mem_obj)
return NULL; return NULL;
retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd, retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->adev,
ALIGN(q->ctl_stack_size, PAGE_SIZE) + ALIGN(q->ctl_stack_size, PAGE_SIZE) +
ALIGN(sizeof(struct v9_mqd), PAGE_SIZE), ALIGN(sizeof(struct v9_mqd), PAGE_SIZE),
&(mqd_mem_obj->gtt_mem), &(mqd_mem_obj->gtt_mem),
...@@ -301,7 +301,7 @@ static void free_mqd(struct mqd_manager *mm, void *mqd, ...@@ -301,7 +301,7 @@ static void free_mqd(struct mqd_manager *mm, void *mqd,
struct kfd_dev *kfd = mm->dev; struct kfd_dev *kfd = mm->dev;
if (mqd_mem_obj->gtt_mem) { if (mqd_mem_obj->gtt_mem) {
amdgpu_amdkfd_free_gtt_mem(kfd->kgd, mqd_mem_obj->gtt_mem); amdgpu_amdkfd_free_gtt_mem(kfd->adev, mqd_mem_obj->gtt_mem);
kfree(mqd_mem_obj); kfree(mqd_mem_obj);
} else { } else {
kfd_gtt_sa_free(mm->dev, mqd_mem_obj); kfd_gtt_sa_free(mm->dev, mqd_mem_obj);
......
...@@ -1951,10 +1951,10 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type) ...@@ -1951,10 +1951,10 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type)
* only happens when the first queue is created. * only happens when the first queue is created.
*/ */
if (pdd->qpd.vmid) if (pdd->qpd.vmid)
amdgpu_amdkfd_flush_gpu_tlb_vmid(dev->kgd, amdgpu_amdkfd_flush_gpu_tlb_vmid(dev->adev,
pdd->qpd.vmid); pdd->qpd.vmid);
} else { } else {
amdgpu_amdkfd_flush_gpu_tlb_pasid(dev->kgd, amdgpu_amdkfd_flush_gpu_tlb_pasid(dev->adev,
pdd->process->pasid, type); pdd->process->pasid, type);
} }
} }
......
...@@ -1129,7 +1129,6 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start, ...@@ -1129,7 +1129,6 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
DECLARE_BITMAP(bitmap, MAX_GPU_INSTANCE); DECLARE_BITMAP(bitmap, MAX_GPU_INSTANCE);
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
struct dma_fence *fence = NULL; struct dma_fence *fence = NULL;
struct amdgpu_device *adev;
struct kfd_process *p; struct kfd_process *p;
uint32_t gpuidx; uint32_t gpuidx;
int r = 0; int r = 0;
...@@ -1145,9 +1144,9 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start, ...@@ -1145,9 +1144,9 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
pr_debug("failed to find device idx %d\n", gpuidx); pr_debug("failed to find device idx %d\n", gpuidx);
return -EINVAL; return -EINVAL;
} }
adev = (struct amdgpu_device *)pdd->dev->kgd;
r = svm_range_unmap_from_gpu(adev, drm_priv_to_vm(pdd->drm_priv), r = svm_range_unmap_from_gpu(pdd->dev->adev,
drm_priv_to_vm(pdd->drm_priv),
start, last, &fence); start, last, &fence);
if (r) if (r)
break; break;
...@@ -1159,7 +1158,7 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start, ...@@ -1159,7 +1158,7 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
if (r) if (r)
break; break;
} }
amdgpu_amdkfd_flush_gpu_tlb_pasid((struct kgd_dev *)adev, amdgpu_amdkfd_flush_gpu_tlb_pasid(pdd->dev->adev,
p->pasid, TLB_FLUSH_HEAVYWEIGHT); p->pasid, TLB_FLUSH_HEAVYWEIGHT);
} }
...@@ -1243,8 +1242,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -1243,8 +1242,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct kfd_process *p; struct kfd_process *p;
p = container_of(prange->svms, struct kfd_process, svms); p = container_of(prange->svms, struct kfd_process, svms);
amdgpu_amdkfd_flush_gpu_tlb_pasid((struct kgd_dev *)adev, amdgpu_amdkfd_flush_gpu_tlb_pasid(adev, p->pasid, TLB_FLUSH_LEGACY);
p->pasid, TLB_FLUSH_LEGACY);
} }
out: out:
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment