drm/amdkfd: Conditionally enable PCIe atomics
Subsystems (3)
PATCH 30/37 drm/amdkfd: Conditionally enable PCIe atomics
This will be needed for most dGPUs.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +13 -0
@@ -41,6 +41,7 @@ static const struct kfd_device_info kaveri_device_info = { .num_of_watch_points = 4, .mqd_size_aligned = MQD_SIZE_ALIGNED, .supports_cwsr = false, + .needs_pci_atomics = false, };static const struct kfd_device_info carrizo_device_info = {
@@ -53,6 +54,7 @@ static const struct kfd_device_info carrizo_device_info = { .num_of_watch_points = 4, .mqd_size_aligned = MQD_SIZE_ALIGNED, .supports_cwsr = true, + .needs_pci_atomics = false, };struct kfd_deviceid {
@@ -127,6 +129,17 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,return NULL ; } +if (device_info->needs_pci_atomics) { +/* Allow BIF to recode atomics to PCIe 3.0 AtomicOps. +*/ +if (pci_enable_atomic_ops_to_root (pdev) <0 ) { +dev_info (kfd_device, +"skipped device %x:%x, PCI rejects atomics" , + pdev->vendor, pdev->device); +return NULL ; + } + } + kfd =kzalloc (sizeof (*kfd),GFP_KERNEL );if (!kfd)return NULL ;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -0
@@ -158,6 +158,7 @@ struct kfd_device_info {uint8_t num_of_watch_points;uint16_t mqd_size_aligned;bool supports_cwsr; +bool needs_pci_atomics; };struct kfd_mem_obj {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1512792678-26211-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org
PATCH 31/37 drm/amdkfd: Make IOMMUv2 code conditional
dGPUs work without IOMMUv2. Make IOMMUv2 initialization dependent on ASIC information. Also allow building KFD without IOMMUv2 support. This is still useful for dGPUs and prepares for enabling KFD on architectures that don't support AMD IOMMUv2.
--- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 8 +++- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 62 +++++++++++++++++++++---------- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 2 + drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 ++++++--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 + drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 2 + 8 files changed, 74 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -1
@@ -4,6 +4,6 @@ config HSA_AMD tristate "HSA kernel driver for AMD GPU devices" - depends on DRM_AMDGPU && AMD_IOMMU_V2 && X86_64 + depends on DRM_AMDGPU && X86_64 help Enable this if you want to use HSA features on AMD GPU devices.
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +7 -1
@@ -20,7 +20,9 @@* OTHER DEALINGS IN THE SOFTWARE. */ #include <linux/acpi.h> +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )#include <linux/amd-iommu.h> +#endif #include "kfd_crat.h" #include "kfd_priv.h" #include "kfd_topology.h"
@@ -1035,15 +1037,17 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,struct crat_subtype_generic *sub_type_hdr;struct crat_subtype_computeunit *cu;struct kfd_cu_info cu_info; -struct amd_iommu_device_info iommu_info;int avail_size = *size;uint32_t total_num_of_cu;int num_of_cache_entries =0 ;int cache_mem_filled =0 ;int ret =0 ; +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 ) +struct amd_iommu_device_info iommu_info;const u32 required_iommu_flags =AMD_IOMMU_DEVICE_FLAG_ATS_SUP |AMD_IOMMU_DEVICE_FLAG_PRI_SUP |AMD_IOMMU_DEVICE_FLAG_PASID_SUP ; +#endif struct kfd_local_mem_info local_mem_info;if (!pcrat_image || avail_size <VCRAT_SIZE_FOR_GPU )
@@ -1104,12 +1108,14 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,/* Check if this node supports IOMMU. During parsing this flag will * translate to HSA_CAP_ATS_PRESENT */ +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 ) iommu_info.flags =0 ;if (amd_iommu_device_info (kdev->pdev, &iommu_info) ==0 ) {if ((iommu_info.flags & required_iommu_flags) == required_iommu_flags) cu->hsa_capability |=CRAT_CU_FLAGS_IOMMU_PRESENT ; } +#endif crat_table->length += sub_type_hdr->length; crat_table->total_entries++;
drivers/gpu/drm/amd/amdkfd/kfd_device.c +43 -19
144 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_events.c +2 -0
@@ -837,6 +837,7 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p, } } +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )void kfd_signal_iommu_event (struct kfd_dev *dev,unsigned int pasid,unsigned long address,bool is_write_requested,bool is_execute_requested)
@@ -905,6 +906,7 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid,mutex_unlock (&p->event_mutex); kfd_unref_process(p); } +#endif /* CONFIG_AMD_IOMMU_V2_MODULE */ void kfd_signal_hw_exception_event (unsigned int pasid) {
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +5 -0
@@ -158,6 +158,7 @@ struct kfd_device_info {uint8_t num_of_watch_points;uint16_t mqd_size_aligned;bool supports_cwsr; +bool needs_iommu_device;bool needs_pci_atomics; };
@@ -617,9 +618,11 @@ void kfd_unref_process(struct kfd_process *p);struct kfd_process_device *kfd_bind_process_to_device (struct kfd_dev *dev,struct kfd_process *p); +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )int kfd_bind_processes_to_device (struct kfd_dev *dev);void kfd_unbind_processes_from_device (struct kfd_dev *dev);void kfd_process_iommu_unbind_callback (struct kfd_dev *dev,unsigned int pasid); +#endif struct kfd_process_device *kfd_get_process_device_data (struct kfd_dev *dev,struct kfd_process *p); struct kfd_process_device *kfd_create_process_device_data(struct kfd_dev *dev,
@@ -784,9 +787,11 @@ int kfd_wait_on_events(struct kfd_process *p, uint32_t *wait_result);void kfd_signal_event_interrupt (unsigned int pasid,uint32_t partial_id,uint32_t valid_id_bits); +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )void kfd_signal_iommu_event (struct kfd_dev *dev,unsigned int pasid,unsigned long address,bool is_write_requested,bool is_execute_requested); +#endif void kfd_signal_hw_exception_event (unsigned int pasid);int kfd_set_event (struct kfd_process *p,uint32_t event_id);int kfd_reset_event (struct kfd_process *p,uint32_t event_id);
drivers/gpu/drm/amd/amdkfd/kfd_process.c +12 -5
@@ -173,14 +173,17 @@ static void kfd_process_wq_release(struct work_struct *work) { struct kfd_process *p = container_of(work, struct kfd_process, release_work); +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )struct kfd_process_device *pdd;pr_debug ("Releasing process (pasid %d) in workqueue\n" , p->pasid);list_for_each_entry (pdd, &p->per_device_data, per_device_list) { -if (pdd->bound ==PDD_BOUND ) +if (pdd->bound ==PDD_BOUND && + pdd->dev->device_info->needs_iommu_device)amd_iommu_unbind_pasid (pdd->dev->pdev, p->pasid); } +#endif kfd_process_destroy_pdds (p);
@@ -421,7 +424,6 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_dev *dev, struct kfd_process *p) {struct kfd_process_device *pdd; -int err; pdd =kfd_get_process_device_data (dev, p);if (!pdd) {
@@ -436,9 +438,14 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_dev *dev,return ERR_PTR (-EINVAL ); } - err =amd_iommu_bind_pasid (dev->pdev, p->pasid, p->lead_thread); -if (err <0 ) -return ERR_PTR (err); +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 ) +if (dev->device_info->needs_iommu_device) { +int err =amd_iommu_bind_pasid (dev->pdev, p->pasid, + p->lead_thread); +if (err <0 ) +return ERR_PTR (err); + } +#endif pdd->bound =PDD_BOUND ;
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2 -0
@@ -905,6 +905,7 @@ static void find_system_memory(const struct dmi_header *dm,*/ static int kfd_add_perf_to_topology (struct kfd_topology_device *kdev) { +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )struct kfd_perf_properties *props;if (amd_iommu_pc_supported ()) {
@@ -916,6 +917,7 @@ static int kfd_add_perf_to_topology(struct kfd_topology_device *kdev)amd_iommu_pc_get_max_counters (0 );/* assume one iommu */ list_add_tail(&props->list, &kdev->perf_props); } +#endif return 0 ; }
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +2 -0
@@ -185,8 +185,10 @@ struct kfd_topology_device *kfd_create_topology_device( struct list_head *device_list);void kfd_release_topology_device_list (struct list_head *device_list); +#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 )extern bool amd_iommu_pc_supported (void );extern u8 amd_iommu_pc_get_max_banks (u16 devid);extern u8 amd_iommu_pc_get_max_counters (u16 devid); +#endif #endif /* __KFD_TOPOLOGY_H__ */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/37 drm/amdkfd: Make sched_policy a per-device setting
In reply to a message not in the archiveSome dGPUs don't support HWS. Allow them to use a per-device sched_policy that may be different from the global default.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 22 +++++++++++++++++++--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 1 + .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 3 ++- 6 files changed, 27 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -1
@@ -901,7 +901,8 @@ static int kfd_ioctl_set_scratch_backing_va(struct file *filep,mutex_unlock (&p->mutex); -if (sched_policy ==KFD_SCHED_POLICY_NO_HWS && pdd->qpd.vmid !=0 ) +if (dev->dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS && + pdd->qpd.vmid !=0 ) dev->kfd2kgd->set_scratch_backing_va ( dev->kgd, args->va_addr, pdd->qpd.vmid);
drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c +2 -1
@@ -33,6 +33,7 @@#include "kfd_pm4_headers_diq.h" #include "kfd_dbgmgr.h" #include "kfd_dbgdev.h" +#include "kfd_device_queue_manager.h" static DEFINE_MUTEX (kfd_dbgmgr_mutex);
@@ -83,7 +84,7 @@ bool kfd_dbgmgr_create(struct kfd_dbgmgr **ppmgr, struct kfd_dev *pdev) }/* get actual type of DBGDevice cpsch or not */ -if (sched_policy ==KFD_SCHED_POLICY_NO_HWS ) +if (pdev->dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) type =DBGDEV_TYPE_NODIQ ;kfd_dbgdev_init (new_buff->dbgdev, pdev, type);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -1
@@ -348,7 +348,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, kfd->pdev->device);pr_debug ("Starting kfd with the following scheduling policy %d\n" , - sched_policy); + kfd->dqm->sched_policy); goto out;
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +19 -3
@@ -385,7 +385,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) prev_active = q->properties.is_active;/* Make sure the queue is unmapped before updating the MQD */ -if (sched_policy !=KFD_SCHED_POLICY_NO_HWS ) { +if (dqm->sched_policy !=KFD_SCHED_POLICY_NO_HWS ) { retval =unmap_queues_cpsch (dqm,KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES ,0 );if (retval) {
@@ -417,7 +417,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)else if (!q->properties.is_active && prev_active) dqm->queue_count--; -if (sched_policy !=KFD_SCHED_POLICY_NO_HWS ) +if (dqm->sched_policy !=KFD_SCHED_POLICY_NO_HWS ) retval =map_queues_cpsch (dqm); else if (q->properties.is_active && (q->properties.type == KFD_QUEUE_TYPE_COMPUTE ||
@@ -1097,7 +1097,7 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm, alternate_aperture_base, alternate_aperture_size); -if ((sched_policy ==KFD_SCHED_POLICY_NO_HWS ) && (qpd->vmid !=0 )) +if ((dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) && (qpd->vmid !=0 ))program_sh_mem_settings (dqm, qpd); pr_debug("sh_mem_config: 0x%x, ape1_base: 0x%x, ape1_limit: 0x%x\n",
@@ -1242,6 +1242,22 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)if (!dqm)return NULL ; +switch (dev->device_info->asic_family) { +/* HWS is not available on Hawaii. */ +case CHIP_HAWAII : +/* HWS depends on CWSR for timely dequeue. CWSR is not +* available on Tonga. +* +* FIXME: This argument also applies to Kaveri. +*/ +case CHIP_TONGA : + dqm->sched_policy =KFD_SCHED_POLICY_NO_HWS ; +break ; +default : + dqm->sched_policy = sched_policy; +break ; + } + dqm->dev = dev;switch (sched_policy) {case KFD_SCHED_POLICY_HWS :
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1 -0
@@ -180,6 +180,7 @@ struct device_queue_manager {unsigned int *fence_addr;struct kfd_mem_obj *fence_mem;bool active_runlist; +int sched_policy; }; void device_queue_manager_init_cik(
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +2 -1
@@ -208,7 +208,8 @@ int pqm_create_queue(struct process_queue_manager *pqm,case KFD_QUEUE_TYPE_COMPUTE :/* check if there is over subscription */ -if ((sched_policy ==KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION ) && +if ((dev->dqm->sched_policy == +KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION ) && ((dev->dqm->processes_count >= dev->vm_info.vmid_num_kfd) || (dev->dqm->queue_count >=get_queues_num (dev->dqm)))) {pr_err ("Over-subscription is not allowed in radeon_kfd.sched_policy == 1\n" );
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/37 drm/amdkfd: Add dGPU support to the device queue manager
In reply to a message not in the archiveGFXv7 and v8 dGPUs use a different addressing mode for KFD compared to APUs (GPUVM64 vs HSA64). And dGPUs don't support MTYPE_CC. They use MTYPE_UC instead for memory that requires coherency.
--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 +++ .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 4 + .../drm/amd/amdkfd/kfd_device_queue_manager_cik.c | 56 +++++++++++++ .../drm/amd/amdkfd/kfd_device_queue_manager_vi.c | 93 ++++++++++++++++++++++ 4 files changed, 164 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +11 -0
@@ -1308,6 +1308,17 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)case CHIP_KAVERI :device_queue_manager_init_cik (&dqm->asic_ops);break ; + +case CHIP_HAWAII : +device_queue_manager_init_cik_hawaii (&dqm->asic_ops); +break ; + +case CHIP_TONGA : +case CHIP_FIJI : +case CHIP_POLARIS10 : +case CHIP_POLARIS11 : +device_queue_manager_init_vi_tonga (&dqm->asic_ops); +break ;default :WARN (1 ,"Unexpected ASIC family %u" , dev->device_info->asic_family);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +4 -0
@@ -185,8 +185,12 @@ struct device_queue_manager {void device_queue_manager_init_cik (struct device_queue_manager_asic_ops *asic_ops); +void device_queue_manager_init_cik_hawaii ( +struct device_queue_manager_asic_ops *asic_ops);void device_queue_manager_init_vi (struct device_queue_manager_asic_ops *asic_ops); +void device_queue_manager_init_vi_tonga ( +struct device_queue_manager_asic_ops *asic_ops);void program_sh_mem_settings (struct device_queue_manager *dqm,struct qcm_process_device *qpd);unsigned int get_queues_num (struct device_queue_manager *dqm);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +56 -0
79 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c +93 -0
124 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/37 drm/amdkfd: Add dGPU support to the MQD manager
In reply to a message not in the archiveOn dGPUs don't set ATC addressing bits and use MTYPE_UC for coherent memory.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 7 +++++ drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 35 ++++++++++++++++++++++-- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c | 21 ++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 4 +++ 4 files changed, 64 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +7 -0
@@ -29,8 +29,15 @@ struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type,switch (dev->device_info->asic_family) {case CHIP_KAVERI :return mqd_manager_init_cik (type, dev); +case CHIP_HAWAII : +return mqd_manager_init_cik_hawaii (type, dev);case CHIP_CARRIZO :return mqd_manager_init_vi (type, dev); +case CHIP_TONGA : +case CHIP_FIJI : +case CHIP_POLARIS10 : +case CHIP_POLARIS11 : +return mqd_manager_init_vi_tonga (type, dev);default :WARN (1 ,"Unexpected ASIC family %u" , dev->device_info->asic_family);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +32 -3
@@ -170,14 +170,19 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, mms); } -static int update_mqd (struct mqd_manager *mm,void *mqd, -struct queue_properties *q) +static int __update_mqd (struct mqd_manager *mm,void *mqd, +struct queue_properties *q,unsigned int atc_bit) {struct cik_mqd *m; m =get_mqd (mqd); m->cp_hqd_pq_control =DEFAULT_RPTR_BLOCK_SIZE | -DEFAULT_MIN_AVAIL_SIZE |PQ_ATC_EN ; +DEFAULT_MIN_AVAIL_SIZE ; + m->cp_hqd_ib_control =DEFAULT_MIN_IB_AVAIL_SIZE ; +if (atc_bit) { + m->cp_hqd_pq_control |=PQ_ATC_EN ; + m->cp_hqd_ib_control |=IB_ATC_EN ; + }/* * Calculating queue size which is log base 2 of actual queue size -1
@@ -202,6 +207,18 @@ static int update_mqd(struct mqd_manager *mm, void *mqd,return 0 ; } +static int update_mqd (struct mqd_manager *mm,void *mqd, +struct queue_properties *q) +{ +return __update_mqd (mm, mqd, q,1 ); +} + +static int update_mqd_hawaii (struct mqd_manager *mm,void *mqd, +struct queue_properties *q) +{ +return __update_mqd (mm, mqd, q,0 ); +} +static int update_mqd_sdma (struct mqd_manager *mm,void *mqd,struct queue_properties *q) {
@@ -441,3 +458,15 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,return mqd; } +struct mqd_manager *mqd_manager_init_cik_hawaii (enum KFD_MQD_TYPE type, +struct kfd_dev *dev) +{ +struct mqd_manager *mqd; + + mqd =mqd_manager_init_cik (type, dev); +if (!mqd) +return NULL ; +if ((type ==KFD_MQD_TYPE_CP ) || (type ==KFD_MQD_TYPE_COMPUTE )) + mqd->update_mqd = update_mqd_hawaii; +return mqd; +}
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +21 -0
@@ -151,6 +151,8 @@ static int __update_mqd(struct mqd_manager *mm, void *mqd, m->cp_hqd_pq_rptr_report_addr_lo =lower_32_bits ((uint64_t )q->read_ptr); m->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits ((uint64_t )q->read_ptr); + m->cp_hqd_pq_wptr_poll_addr_lo =lower_32_bits ((uint64_t )q->write_ptr); + m->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits ((uint64_t )q->write_ptr); m->cp_hqd_pq_doorbell_control = q->doorbell_off <<
@@ -208,6 +210,12 @@ static int update_mqd(struct mqd_manager *mm, void *mqd,return __update_mqd (mm, mqd, q,MTYPE_CC ,1 ); } +static int update_mqd_tonga (struct mqd_manager *mm,void *mqd, +struct queue_properties *q) +{ +return __update_mqd (mm, mqd, q,MTYPE_UC ,0 ); +} + static int destroy_mqd(struct mqd_manager *mm, void *mqd, enum kfd_preempt_type type, unsigned int timeout, uint32_t pipe_id,
@@ -432,3 +440,16 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,return mqd; } + +struct mqd_manager *mqd_manager_init_vi_tonga (enum KFD_MQD_TYPE type, +struct kfd_dev *dev) +{ +struct mqd_manager *mqd; + + mqd =mqd_manager_init_vi (type, dev); +if (!mqd) +return NULL ; +if ((type ==KFD_MQD_TYPE_CP ) || (type ==KFD_MQD_TYPE_COMPUTE )) + mqd->update_mqd = update_mqd_tonga; +return mqd; +}
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +4 -0
@@ -709,8 +709,12 @@ struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type, struct kfd_dev *dev);struct mqd_manager *mqd_manager_init_cik (enum KFD_MQD_TYPE type,struct kfd_dev *dev); +struct mqd_manager *mqd_manager_init_cik_hawaii (enum KFD_MQD_TYPE type, +struct kfd_dev *dev);struct mqd_manager *mqd_manager_init_vi (enum KFD_MQD_TYPE type,struct kfd_dev *dev); +struct mqd_manager *mqd_manager_init_vi_tonga (enum KFD_MQD_TYPE type, +struct kfd_dev *dev);struct device_queue_manager *device_queue_manager_init (struct kfd_dev *dev);void device_queue_manager_uninit (struct device_queue_manager *dqm); struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/37 drm/amdkfd: Add dGPU support to kernel_queue_init
In reply to a message not in the archiveRecognize dGPU ASIC families.
--- drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +5 -0
@@ -297,10 +297,15 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,switch (dev->device_info->asic_family) {case CHIP_CARRIZO : +case CHIP_TONGA : +case CHIP_FIJI : +case CHIP_POLARIS10 : +case CHIP_POLARIS11 :kernel_queue_init_vi (&kq->ops_asic_specific);break ;case CHIP_KAVERI : +case CHIP_HAWAII :kernel_queue_init_cik (&kq->ops_asic_specific);break ;default :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 36/37 drm/amdkfd: Add dGPU device IDs and device info
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 153 +++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +151 -2
@@ -63,12 +63,118 @@ static const struct kfd_device_info carrizo_device_info = { };#endif +static const struct kfd_device_info hawaii_device_info = { + .asic_family =CHIP_HAWAII , + .max_pasid_bits =16 , +/* max num of queues for KV.TODO should be a dynamic value */ + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = false, + .needs_iommu_device = false, + .needs_pci_atomics = false, +}; + +static const struct kfd_device_info tonga_device_info = { + .asic_family =CHIP_TONGA , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = false, + .needs_iommu_device = false, + .needs_pci_atomics = true, +}; + +static const struct kfd_device_info tonga_vf_device_info = { + .asic_family =CHIP_TONGA , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = false, + .needs_iommu_device = false, + .needs_pci_atomics = false, +}; + +static const struct kfd_device_info fiji_device_info = { + .asic_family =CHIP_FIJI , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = true, + .needs_iommu_device = false, + .needs_pci_atomics = true, +}; + +static const struct kfd_device_info fiji_vf_device_info = { + .asic_family =CHIP_FIJI , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = true, + .needs_iommu_device = false, + .needs_pci_atomics = false, +}; + + +static const struct kfd_device_info polaris10_device_info = { + .asic_family =CHIP_POLARIS10 , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = true, + .needs_iommu_device = false, + .needs_pci_atomics = true, +}; + +static const struct kfd_device_info polaris10_vf_device_info = { + .asic_family =CHIP_POLARIS10 , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = true, + .needs_iommu_device = false, + .needs_pci_atomics = false, +}; + +static const struct kfd_device_info polaris11_device_info = { + .asic_family =CHIP_POLARIS11 , + .max_pasid_bits =16 , + .max_no_of_hqd =24 , + .ih_ring_entry_size =4 *sizeof (uint32_t ), + .event_interrupt_class = &event_interrupt_class_cik, + .num_of_watch_points =4 , + .mqd_size_aligned =MQD_SIZE_ALIGNED , + .supports_cwsr = true, + .needs_iommu_device = false, + .needs_pci_atomics = true, +}; + +struct kfd_deviceid {unsigned short did;const struct kfd_device_info *device_info; }; -/* Please keep this sorted by increasing device id. */ static const struct kfd_deviceid supported_devices[] = { #if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2) { 0x1304, &kaveri_device_info }, /* Kaveri */
@@ -97,8 +203,51 @@ static const struct kfd_deviceid supported_devices[] = { { 0x9874, &carrizo_device_info }, /* Carrizo */ { 0x9875, &carrizo_device_info }, /* Carrizo */ { 0x9876, &carrizo_device_info }, /* Carrizo */ - { 0x9877, &carrizo_device_info } /* Carrizo */ + { 0x9877, &carrizo_device_info }, /* Carrizo */ #endif + { 0x67A0, &hawaii_device_info }, /* Hawaii */ + { 0x67A1, &hawaii_device_info }, /* Hawaii */ + { 0x67A2, &hawaii_device_info }, /* Hawaii */ + { 0x67A8, &hawaii_device_info }, /* Hawaii */ + { 0x67A9, &hawaii_device_info }, /* Hawaii */ + { 0x67AA, &hawaii_device_info }, /* Hawaii */ + { 0x67B0, &hawaii_device_info }, /* Hawaii */ + { 0x67B1, &hawaii_device_info }, /* Hawaii */ + { 0x67B8, &hawaii_device_info }, /* Hawaii */ + { 0x67B9, &hawaii_device_info }, /* Hawaii */ + { 0x67BA, &hawaii_device_info }, /* Hawaii */ + { 0x67BE, &hawaii_device_info }, /* Hawaii */ + { 0x6920, &tonga_device_info }, /* Tonga */ + { 0x6921, &tonga_device_info }, /* Tonga */ + { 0x6928, &tonga_device_info }, /* Tonga */ + { 0x6929, &tonga_device_info }, /* Tonga */ + { 0x692B, &tonga_device_info }, /* Tonga */ + { 0x692F, &tonga_vf_device_info }, /* Tonga vf */ + { 0x6938, &tonga_device_info }, /* Tonga */ + { 0x6939, &tonga_device_info }, /* Tonga */ + { 0x7300, &fiji_device_info }, /* Fiji */ + { 0x730F, &fiji_vf_device_info }, /* Fiji vf*/ + { 0x67C0, &polaris10_device_info }, /* Polaris10 */ + { 0x67C1, &polaris10_device_info }, /* Polaris10 */ + { 0x67C2, &polaris10_device_info }, /* Polaris10 */ + { 0x67C4, &polaris10_device_info }, /* Polaris10 */ + { 0x67C7, &polaris10_device_info }, /* Polaris10 */ + { 0x67C8, &polaris10_device_info }, /* Polaris10 */ + { 0x67C9, &polaris10_device_info }, /* Polaris10 */ + { 0x67CA, &polaris10_device_info }, /* Polaris10 */ + { 0x67CC, &polaris10_device_info }, /* Polaris10 */ + { 0x67CF, &polaris10_device_info }, /* Polaris10 */ + { 0x67D0, &polaris10_vf_device_info }, /* Polaris10 vf*/ + { 0x67DF, &polaris10_device_info }, /* Polaris10 */ + { 0x67E0, &polaris11_device_info }, /* Polaris11 */ + { 0x67E1, &polaris11_device_info }, /* Polaris11 */ + { 0x67E3, &polaris11_device_info }, /* Polaris11 */ + { 0x67E7, &polaris11_device_info }, /* Polaris11 */ + { 0x67E8, &polaris11_device_info }, /* Polaris11 */ + { 0x67E9, &polaris11_device_info }, /* Polaris11 */ + { 0x67EB, &polaris11_device_info }, /* Polaris11 */ + { 0x67EF, &polaris11_device_info }, /* Polaris11 */ + { 0x67FF, &polaris11_device_info }, /* Polaris11 */ }; static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 37/37 drm/amdgpu: Enable KFD initialization on dGPUs
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -0
@@ -78,10 +78,15 @@ void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)switch (adev->asic_type) {#ifdef CONFIG_DRM_AMDGPU_CIK case CHIP_KAVERI : +case CHIP_HAWAII : kfd2kgd =amdgpu_amdkfd_gfx_7_get_functions ();break ;#endif case CHIP_CARRIZO : +case CHIP_TONGA : +case CHIP_FIJI : +case CHIP_POLARIS10 : +case CHIP_POLARIS11 : kfd2kgd =amdgpu_amdkfd_gfx_8_0_get_functions ();break ;default :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx