OSDN Git Service

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 2e3d74f..2466a73 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 0a60317..4f7aec6 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 78ae96f..3527090 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 f29b393..fafc7b1 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 =