drm/amdkfd: convert KFD_IS_SOC to IP version checking
authorGraham Sider <Graham.Sider@amd.com>
Tue, 9 Nov 2021 21:22:44 +0000 (16:22 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Nov 2021 22:09:28 +0000 (17:09 -0500)
Defined as GC HWIP >= IP_VERSION(9, 0, 1).

Also defines KFD_GC_VERSION to return GC HWIP version.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 2e3d74f7fbfb8fb9a7d88dc2c373651290a1bcb2..2466a73b8c7ddd44e0179190be3b639bd9e374d1 100644 (file)
@@ -321,7 +321,7 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
        /* Return gpu_id as doorbell offset for mmap usage */
        args->doorbell_offset = KFD_MMAP_TYPE_DOORBELL;
        args->doorbell_offset |= KFD_MMAP_GPU_ID(args->gpu_id);
-       if (KFD_IS_SOC15(dev->device_info->asic_family))
+       if (KFD_IS_SOC15(dev))
                /* On SOC15 ASICs, include the doorbell offset within the
                 * process doorbell frame, which is 2 pages.
                 */
index 0a60317509c8ee97b99c24007b1f94bc7eeb5cf0..4f7aec6a481b8638216cc94c9712331b37eb3a54 100644 (file)
@@ -157,7 +157,7 @@ static int allocate_doorbell(struct qcm_process_device *qpd, struct queue *q)
 {
        struct kfd_dev *dev = qpd->dqm->dev;
 
-       if (!KFD_IS_SOC15(dev->device_info->asic_family)) {
+       if (!KFD_IS_SOC15(dev)) {
                /* On pre-SOC15 chips we need to use the queue ID to
                 * preserve the user mode ABI.
                 */
@@ -202,7 +202,7 @@ static void deallocate_doorbell(struct qcm_process_device *qpd,
        unsigned int old;
        struct kfd_dev *dev = qpd->dqm->dev;
 
-       if (!KFD_IS_SOC15(dev->device_info->asic_family) ||
+       if (!KFD_IS_SOC15(dev) ||
            q->properties.type == KFD_QUEUE_TYPE_SDMA ||
            q->properties.type == KFD_QUEUE_TYPE_SDMA_XGMI)
                return;
index 78ae96fc8a6ae4c1325ef3edfba595adb643bb1b..352709034acfd51a324943417e95a70feae76aa2 100644 (file)
@@ -183,7 +183,8 @@ enum cache_policy {
        cache_policy_noncoherent
 };
 
-#define KFD_IS_SOC15(chip) ((chip) >= CHIP_VEGA10)
+#define KFD_GC_VERSION(dev) ((dev)->adev->ip_versions[GC_HWIP][0])
+#define KFD_IS_SOC15(dev)   ((KFD_GC_VERSION(dev)) >= (IP_VERSION(9, 0, 1)))
 
 struct kfd_event_interrupt_class {
        bool (*interrupt_isr)(struct kfd_dev *dev,
index f29b3932e3dcb5a2e378c569a81df1a2968ae478..fafc7b187fad37cf416738f1029a485579c1c316 100644 (file)
@@ -1431,7 +1431,7 @@ static int init_doorbell_bitmap(struct qcm_process_device *qpd,
        int range_start = dev->shared_resources.non_cp_doorbells_start;
        int range_end = dev->shared_resources.non_cp_doorbells_end;
 
-       if (!KFD_IS_SOC15(dev->device_info->asic_family))
+       if (!KFD_IS_SOC15(dev))
                return 0;
 
        qpd->doorbell_bitmap =