mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 11:58:21 +07:00
drm/amdkfd: Reuse CHIP_* from amdgpu v2
There are already CHIP_* definitions under amd_shared.h file on amdgpu side, so KFD should reuse them rather than defining new ones. Using enum for asic type requires default cases on switch statements to prevent compiler warnings. WARN on unsupported ASICs. It should never get there because KFD should not be initialized on unsupported devices. v2: Replace BUG() with WARN and error return Signed-off-by: Yong Zhao <Yong.Zhao@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
44008d7a87
commit
e596b90338
@ -1130,6 +1130,10 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
|
|||||||
case CHIP_KAVERI:
|
case CHIP_KAVERI:
|
||||||
device_queue_manager_init_cik(&dqm->ops_asic_specific);
|
device_queue_manager_init_cik(&dqm->ops_asic_specific);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
WARN(1, "Unexpected ASIC family %u",
|
||||||
|
dev->device_info->asic_family);
|
||||||
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dqm->ops.initialize(dqm))
|
if (!dqm->ops.initialize(dqm))
|
||||||
|
@ -303,15 +303,21 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
|
|||||||
case CHIP_KAVERI:
|
case CHIP_KAVERI:
|
||||||
kernel_queue_init_cik(&kq->ops_asic_specific);
|
kernel_queue_init_cik(&kq->ops_asic_specific);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
WARN(1, "Unexpected ASIC family %u",
|
||||||
|
dev->device_info->asic_family);
|
||||||
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE)) {
|
if (kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE))
|
||||||
|
return kq;
|
||||||
|
|
||||||
pr_err("Failed to init kernel queue\n");
|
pr_err("Failed to init kernel queue\n");
|
||||||
|
|
||||||
|
out_free:
|
||||||
kfree(kq);
|
kfree(kq);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return kq;
|
|
||||||
}
|
|
||||||
|
|
||||||
void kernel_queue_uninit(struct kernel_queue *kq)
|
void kernel_queue_uninit(struct kernel_queue *kq)
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,9 @@ struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type,
|
|||||||
return mqd_manager_init_cik(type, dev);
|
return mqd_manager_init_cik(type, dev);
|
||||||
case CHIP_CARRIZO:
|
case CHIP_CARRIZO:
|
||||||
return mqd_manager_init_vi(type, dev);
|
return mqd_manager_init_vi(type, dev);
|
||||||
|
default:
|
||||||
|
WARN(1, "Unexpected ASIC family %u",
|
||||||
|
dev->device_info->asic_family);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include <linux/kfd_ioctl.h>
|
#include <linux/kfd_ioctl.h>
|
||||||
#include <kgd_kfd_interface.h>
|
#include <kgd_kfd_interface.h>
|
||||||
|
|
||||||
|
#include "amd_shared.h"
|
||||||
|
|
||||||
#define KFD_SYSFS_FILE_MODE 0444
|
#define KFD_SYSFS_FILE_MODE 0444
|
||||||
|
|
||||||
#define KFD_MMAP_DOORBELL_MASK 0x8000000000000
|
#define KFD_MMAP_DOORBELL_MASK 0x8000000000000
|
||||||
@ -112,11 +114,6 @@ enum cache_policy {
|
|||||||
cache_policy_noncoherent
|
cache_policy_noncoherent
|
||||||
};
|
};
|
||||||
|
|
||||||
enum asic_family_type {
|
|
||||||
CHIP_KAVERI = 0,
|
|
||||||
CHIP_CARRIZO
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kfd_event_interrupt_class {
|
struct kfd_event_interrupt_class {
|
||||||
bool (*interrupt_isr)(struct kfd_dev *dev,
|
bool (*interrupt_isr)(struct kfd_dev *dev,
|
||||||
const uint32_t *ih_ring_entry);
|
const uint32_t *ih_ring_entry);
|
||||||
@ -125,7 +122,7 @@ struct kfd_event_interrupt_class {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct kfd_device_info {
|
struct kfd_device_info {
|
||||||
unsigned int asic_family;
|
enum amd_asic_type asic_family;
|
||||||
const struct kfd_event_interrupt_class *event_interrupt_class;
|
const struct kfd_event_interrupt_class *event_interrupt_class;
|
||||||
unsigned int max_pasid_bits;
|
unsigned int max_pasid_bits;
|
||||||
unsigned int max_no_of_hqd;
|
unsigned int max_no_of_hqd;
|
||||||
|
Loading…
Reference in New Issue
Block a user