Skip to content

Commit

Permalink
hsa/radeon: Workaround for a bug in amd_iommu
Browse files Browse the repository at this point in the history
This patch creates a workaround for a bug in amd_iommu driver, where the driver
doesn't save all necessary information when going to suspend.
The workaround removes a device from the IOMMU device list on suspend and register a resumed device in the IOMMU device list.

Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
  • Loading branch information
Oded Gabbay committed Mar 24, 2014
1 parent fbb5fbc commit 4c86b1c
Showing 5 changed files with 36 additions and 44 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/hsa/radeon/Makefile
Original file line number Diff line number Diff line change
@@ -5,6 +5,6 @@
radeon_kfd-y := kfd_module.o kfd_device.o kfd_chardev.o \
kfd_pasid.o kfd_topology.o kfd_process.o \
kfd_doorbell.o kfd_sched_cik_static.o kfd_registers.o \
kfd_vidmem.o kfd_interrupt.o kfd_pm.o
kfd_vidmem.o kfd_interrupt.o

obj-$(CONFIG_HSA_RADEON) += radeon_kfd.o
29 changes: 29 additions & 0 deletions drivers/gpu/hsa/radeon/kfd_device.c
Original file line number Diff line number Diff line change
@@ -188,3 +188,32 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)

kfree(kfd);
}

void kgd2kfd_suspend(struct kfd_dev *kfd)
{
BUG_ON(kfd == NULL);

if (kfd->init_complete) {
kfd->device_info->scheduler_class->stop(kfd->scheduler);
amd_iommu_free_device(kfd->pdev);
}
}

int kgd2kfd_resume(struct kfd_dev *kfd)
{
pasid_t pasid_limit;
int err;
BUG_ON(kfd == NULL);

pasid_limit = radeon_kfd_get_pasid_limit();

if (kfd->init_complete) {
err = amd_iommu_init_device(kfd->pdev, pasid_limit);
if (err < 0)
return -ENXIO;
amd_iommu_set_invalidate_ctx_cb(kfd->pdev, iommu_pasid_shutdown_callback);
kfd->device_info->scheduler_class->start(kfd->scheduler);
}

return 0;
}
5 changes: 5 additions & 0 deletions drivers/gpu/hsa/radeon/kfd_pasid.c
Original file line number Diff line number Diff line change
@@ -70,6 +70,11 @@ bool radeon_kfd_set_pasid_limit(pasid_t new_limit)
}
}

inline pasid_t radeon_kfd_get_pasid_limit(void)
{
return pasid_limit;
}

pasid_t radeon_kfd_pasid_alloc(void)
{
pasid_t found;
43 changes: 0 additions & 43 deletions drivers/gpu/hsa/radeon/kfd_pm.c

This file was deleted.

1 change: 1 addition & 0 deletions drivers/gpu/hsa/radeon/kfd_priv.h
Original file line number Diff line number Diff line change
@@ -205,6 +205,7 @@ struct kfd_queue *radeon_kfd_get_queue(struct kfd_process *p, unsigned int queue
int radeon_kfd_pasid_init(void);
void radeon_kfd_pasid_exit(void);
bool radeon_kfd_set_pasid_limit(pasid_t new_limit);
pasid_t radeon_kfd_get_pasid_limit(void);
pasid_t radeon_kfd_pasid_alloc(void);
void radeon_kfd_pasid_free(pasid_t pasid);

0 comments on commit 4c86b1c

Please sign in to comment.