From f440efe8934c1832ef9c12847db5a58a77842b2a Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Fri, 21 Jul 2017 20:47:50 -0400 Subject: [PATCH 1743/4131] drm/amdkfd: Reuse CHIP_* from amdgpu There are already CHIP_* definitions under amd_shared.h file on amdgpu side, so KFD should reuse them rather than defining new ones. Change-Id: I78d8ab5b13f62bb7d64d4713f8a83756ac471c9e Signed-off-by: Yong Zhao --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c | 8 ++++---- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 18 ++---------------- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 ++ 9 files changed, 19 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index c2eda25..99238f1 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1041,7 +1041,7 @@ kfd_ioctl_create_event(struct file *filp, struct kfd_process *p, void *data) pr_err("Getting device by id failed in %s\n", __func__); return -EFAULT; } - if (KFD_IS_DGPU(kfd->device_info->asic_family)) { + if (!kfd->device_info->is_need_iommu_device) { down_write(&p->lock); pdd = kfd_bind_process_to_device(kfd, p); if (IS_ERR(pdd)) { @@ -1175,7 +1175,7 @@ bool kfd_is_large_bar(struct kfd_dev *dev) return true; } - if (!KFD_IS_DGPU(dev->device_info->asic_family)) + if (dev->device_info->is_need_iommu_device) return false; dev->kfd2kgd->get_local_mem_info(dev->kgd, &mem_info); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c index bf390b3..942d863 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c @@ -250,7 +250,7 @@ static void dbgdev_address_watch_set_registers( union TCP_WATCH_ADDR_L_BITS *addrLo, union TCP_WATCH_CNTL_BITS *cntl, unsigned int index, unsigned int vmid, - unsigned int asic_family) + bool is_apu) { union ULARGE_INTEGER addr; @@ -276,7 +276,7 @@ static void dbgdev_address_watch_set_registers( cntl->bitfields.mode = adw_info->watch_mode[index]; cntl->bitfields.vmid = (uint32_t) vmid; /* for APU assume it is an ATC address. */ - if (!KFD_IS_DGPU(asic_family)) + if (is_apu) cntl->u32All |= ADDRESS_WATCH_REG_CNTL_ATC_BIT; pr_debug("\t\t%20s %08x\n", "set reg mask :", cntl->bitfields.mask); pr_debug("\t\t%20s %08x\n", "set reg add high :", @@ -328,7 +328,7 @@ static int dbgdev_address_watch_nodiq(struct kfd_dbgdev *dbgdev, &cntl, i, vmid, - dbgdev->dev->device_info->asic_family + dbgdev->dev->device_info->is_need_iommu_device ); pr_debug("\t\t%30s\n", "* * * * * * * * * * * * * * * * * *"); @@ -425,7 +425,7 @@ static int dbgdev_address_watch_diq(struct kfd_dbgdev *dbgdev, &cntl, i, vmid, - dbgdev->dev->device_info->asic_family + dbgdev->dev->device_info->is_need_iommu_device ); pr_debug("\t\t%30s\n", "* * * * * * * * * * * * * * * * * *"); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index e70d122..7b17979 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1631,6 +1631,8 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) case CHIP_VEGA10: device_queue_manager_init_v9_vega10(&dqm->asic_ops); break; + default: + BUG(); } if (dqm->ops.initialize(dqm) != 0) { diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c index 1fefacd..2e172f6 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c @@ -399,7 +399,7 @@ int kfd_init_apertures(struct kfd_process *process) return -1; } - if (KFD_IS_DGPU(dev->device_info->asic_family)) { + if (!dev->device_info->is_need_iommu_device) { pdd->qpd.cwsr_base = DGPU_VM_BASE_DEFAULT; pdd->qpd.ib_base = DGPU_IB_BASE_DEFAULT; } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c index fb8c859..6d70d28 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c @@ -347,6 +347,8 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev, case CHIP_VEGA10: kernel_queue_init_v9(&kq->ops_asic_specific); break; + default: + BUG(); } if (!kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE)) { diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c index 046282a..3589c0b 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c @@ -82,6 +82,8 @@ struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type, return mqd_manager_init_vi_tonga(type, dev); case CHIP_VEGA10: return mqd_manager_init_v9(type, dev); + default: + BUG(); } return NULL; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c index f0087be..7848517 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c @@ -240,7 +240,8 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm, case CHIP_VEGA10: kfd_pm_func_init_v9(pm, fw_ver); break; - + default: + BUG(); } return 0; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 5dd89f9..226084a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -40,6 +40,7 @@ #include #include +#include "amd_shared.h" #define KFD_SYSFS_FILE_MODE 0444 @@ -170,21 +171,6 @@ enum cache_policy { cache_policy_noncoherent }; -enum asic_family_type { - CHIP_KAVERI = 0, - CHIP_HAWAII, - CHIP_CARRIZO, - CHIP_TONGA, - CHIP_FIJI, - CHIP_POLARIS10, - CHIP_POLARIS11, - CHIP_VEGA10 -}; - -#define KFD_IS_VI(chip) ((chip) >= CHIP_CARRIZO && (chip) <= CHIP_POLARIS11) -#define KFD_IS_DGPU(chip) (((chip) >= CHIP_TONGA && \ - (chip) <= CHIP_VEGA10) || \ - (chip) == CHIP_HAWAII) #define KFD_IS_SOC15(chip) ((chip) >= CHIP_VEGA10) struct kfd_event_interrupt_class { @@ -196,7 +182,7 @@ struct kfd_event_interrupt_class { }; struct kfd_device_info { - unsigned int asic_family; + enum amd_asic_type asic_family; const struct kfd_event_interrupt_class *event_interrupt_class; unsigned int max_pasid_bits; unsigned int max_no_of_hqd; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index fc83141..0cfeba2 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c @@ -1329,6 +1329,8 @@ int kfd_topology_add_device(struct kfd_dev *gpu) HSA_CAP_DOORBELL_TYPE_TOTALBITS_SHIFT) & HSA_CAP_DOORBELL_TYPE_TOTALBITS_MASK); break; + default: + BUG(); } /* Fix errors in CZ CRAT. -- 2.7.4