Lines Matching full:gpu

107 	return top_dev->gpu;  in kfd_device_by_id()
118 if (top_dev->gpu && top_dev->gpu->adev->pdev == pdev) { in kfd_device_by_pci_dev()
119 device = top_dev->gpu; in kfd_device_by_pci_dev()
278 if (iolink->gpu && kfd_devcgroup_check_permission(iolink->gpu)) in iolink_show()
318 if (mem->gpu && kfd_devcgroup_check_permission(mem->gpu)) in mem_show()
350 if (cache->gpu && kfd_devcgroup_check_permission(cache->gpu)) in kfd_cache_show()
432 if (dev->gpu && kfd_devcgroup_check_permission(dev->gpu)) in node_show()
441 if (dev->gpu && kfd_devcgroup_check_permission(dev->gpu)) in node_show()
448 if (dev->gpu && kfd_devcgroup_check_permission(dev->gpu)) in node_show()
453 dev->gpu ? dev->node_props.simd_count : 0); in node_show()
477 dev->gpu ? (dev->node_props.array_count * in node_show()
478 NUM_XCC(dev->gpu->xcc_mask)) : 0); in node_show()
510 if (dev->gpu) { in node_show()
512 __ilog2_u32(dev->gpu->kfd->device_info.num_of_watch_points); in node_show()
524 if (dev->gpu->adev->asic_type == CHIP_TONGA) in node_show()
534 dev->gpu->kfd->mec_fw_version); in node_show()
540 dev->gpu->kfd->sdma_fw_version); in node_show()
542 dev->gpu->adev->unique_id); in node_show()
544 NUM_XCC(dev->gpu->xcc_mask)); in node_show()
996 if (!kdev->gpu) { in kfd_add_non_crat_information()
1000 /* TODO: For GPU node, rearrange code from kfd_topology_add_device */ in kfd_add_non_crat_information()
1067 /* For nodes with GPU, this information gets added in kfd_topology_init()
1068 * when GPU is detected (kfd_topology_add_device). in kfd_topology_init()
1092 static uint32_t kfd_generate_gpu_id(struct kfd_node *gpu) in kfd_generate_gpu_id() argument
1099 if (!gpu) in kfd_generate_gpu_id()
1102 local_mem_size = gpu->local_mem_info.local_mem_size_private + in kfd_generate_gpu_id()
1103 gpu->local_mem_info.local_mem_size_public; in kfd_generate_gpu_id()
1104 buf[0] = gpu->adev->pdev->devfn; in kfd_generate_gpu_id()
1105 buf[1] = gpu->adev->pdev->subsystem_vendor | in kfd_generate_gpu_id()
1106 (gpu->adev->pdev->subsystem_device << 16); in kfd_generate_gpu_id()
1107 buf[2] = pci_domain_nr(gpu->adev->pdev->bus); in kfd_generate_gpu_id()
1108 buf[3] = gpu->adev->pdev->device; in kfd_generate_gpu_id()
1109 buf[4] = gpu->adev->pdev->bus->number; in kfd_generate_gpu_id()
1112 buf[7] = (ffs(gpu->xcc_mask) - 1) | (NUM_XCC(gpu->xcc_mask) << 16); in kfd_generate_gpu_id()
1119 /* kfd_assign_gpu - Attach @gpu to the correct kfd topology device. If
1120 * the GPU device is not already present in the topology device
1122 * be created for this GPU.
1124 static struct kfd_topology_device *kfd_assign_gpu(struct kfd_node *gpu) in kfd_assign_gpu() argument
1140 if (!dev->gpu && (dev->node_props.simd_count > 0)) { in kfd_assign_gpu()
1141 dev->gpu = gpu; in kfd_assign_gpu()
1145 mem->gpu = dev->gpu; in kfd_assign_gpu()
1147 cache->gpu = dev->gpu; in kfd_assign_gpu()
1149 iolink->gpu = dev->gpu; in kfd_assign_gpu()
1151 p2plink->gpu = dev->gpu; in kfd_assign_gpu()
1162 * of the GPU in kfd_notify_gpu_change()
1183 amdgpu_amdkfd_get_local_mem_info(dev->gpu->adev, &local_mem_info, in kfd_fill_mem_clk_max_info()
1184 dev->gpu->xcp); in kfd_fill_mem_clk_max_info()
1202 pcie_capability_read_dword(target_gpu_dev->gpu->adev->pdev, in kfd_set_iolink_no_atomics()
1209 /* set gpu (dev) flags. */ in kfd_set_iolink_no_atomics()
1211 if (!dev->gpu->kfd->pci_atomic_requested || in kfd_set_iolink_no_atomics()
1212 dev->gpu->adev->asic_type == CHIP_HAWAII) in kfd_set_iolink_no_atomics()
1222 /* CPU -> GPU with PCIe */ in kfd_set_iolink_non_coherent()
1223 if (!to_dev->gpu && in kfd_set_iolink_non_coherent()
1227 if (to_dev->gpu) { in kfd_set_iolink_non_coherent()
1228 /* GPU <-> GPU with PCIe and in kfd_set_iolink_non_coherent()
1233 KFD_GC_VERSION(to_dev->gpu) == IP_VERSION(9, 4, 0))) { in kfd_set_iolink_non_coherent()
1245 if (!dev || !dev->gpu) in kfd_fill_iolink_non_crat_info()
1248 /* GPU only creates direct links so apply flags setting to all */ in kfd_fill_iolink_non_crat_info()
1258 /* Include the CPU peer in GPU hive if connected over xGMI. */ in kfd_fill_iolink_non_crat_info()
1259 if (!peer_dev->gpu && in kfd_fill_iolink_non_crat_info()
1262 * If the GPU is not part of a GPU hive, use its pci in kfd_fill_iolink_non_crat_info()
1266 dev->node_props.hive_id = pci_dev_id(dev->gpu->adev->pdev); in kfd_fill_iolink_non_crat_info()
1339 if (cpu_dev->gpu) in kfd_create_indirect_link_prop()
1351 /* CPU <--> GPU */ in kfd_create_indirect_link_prop()
1371 /* CPU <--> CPU <--> GPU, GPU node*/ in kfd_create_indirect_link_prop()
1391 /* for small Bar, no CPU --> GPU in-direct links */ in kfd_create_indirect_link_prop()
1392 if (kfd_dev_is_large_bar(kdev->gpu)) { in kfd_create_indirect_link_prop()
1393 /* CPU <--> CPU <--> GPU, CPU node*/ in kfd_create_indirect_link_prop()
1422 kdev->gpu->adev, in kfd_add_peer_prop()
1423 peer->gpu->adev)) in kfd_add_peer_prop()
1499 if (WARN_ON(!new_dev->gpu)) in kfd_dev_create_p2p_links()
1515 if (!dev->gpu || !dev->gpu->adev || in kfd_dev_create_p2p_links()
1516 (dev->gpu->kfd->hive_id && in kfd_dev_create_p2p_links()
1517 dev->gpu->kfd->hive_id == new_dev->gpu->kfd->hive_id)) in kfd_dev_create_p2p_links()
1671 /* kfd_fill_cache_non_crat_info - Fill GPU cache info using kfd_gpu_cache_info
1756 pr_debug("Added [%d] GPU cache entries\n", num_of_entries); in kfd_fill_cache_non_crat_info()
1759 static int kfd_topology_add_device_locked(struct kfd_node *gpu, uint32_t gpu_id, in kfd_topology_add_device_locked() argument
1769 COMPUTE_UNIT_GPU, gpu, in kfd_topology_add_device_locked()
1772 pr_err("Error creating VCRAT for GPU (ID: 0x%x)\n", in kfd_topology_add_device_locked()
1784 pr_err("Error parsing VCRAT for GPU (ID: 0x%x)\n", in kfd_topology_add_device_locked()
1793 *dev = kfd_assign_gpu(gpu); in kfd_topology_add_device_locked()
1802 kfd_fill_cache_non_crat_info(*dev, gpu); in kfd_topology_add_device_locked()
1811 pr_err("Failed to update GPU (ID: 0x%x) to sysfs topology. res=%d\n", in kfd_topology_add_device_locked()
1823 if (KFD_GC_VERSION(dev->gpu) >= IP_VERSION(11, 0, 0) && in kfd_topology_set_dbg_firmware_support()
1824 KFD_GC_VERSION(dev->gpu) < IP_VERSION(12, 0, 0)) { in kfd_topology_set_dbg_firmware_support()
1825 uint32_t mes_api_rev = (dev->gpu->adev->mes.sched_version & in kfd_topology_set_dbg_firmware_support()
1828 uint32_t mes_rev = dev->gpu->adev->mes.sched_version & in kfd_topology_set_dbg_firmware_support()
1839 switch (KFD_GC_VERSION(dev->gpu)) { in kfd_topology_set_dbg_firmware_support()
1841 firmware_supported = dev->gpu->kfd->mec_fw_version >= 459 + 32768; in kfd_topology_set_dbg_firmware_support()
1848 firmware_supported = dev->gpu->kfd->mec_fw_version >= 459; in kfd_topology_set_dbg_firmware_support()
1851 firmware_supported = dev->gpu->kfd->mec_fw_version >= 60; in kfd_topology_set_dbg_firmware_support()
1854 firmware_supported = dev->gpu->kfd->mec_fw_version >= 51; in kfd_topology_set_dbg_firmware_support()
1859 firmware_supported = dev->gpu->kfd->mec_fw_version >= 144; in kfd_topology_set_dbg_firmware_support()
1866 firmware_supported = dev->gpu->kfd->mec_fw_version >= 89; in kfd_topology_set_dbg_firmware_support()
1891 if (kfd_dbg_has_ttmps_always_setup(dev->gpu)) in kfd_topology_set_capabilities()
1894 if (KFD_GC_VERSION(dev->gpu) < IP_VERSION(10, 0, 0)) { in kfd_topology_set_capabilities()
1895 if (KFD_GC_VERSION(dev->gpu) == IP_VERSION(9, 4, 3)) in kfd_topology_set_capabilities()
1904 if (KFD_GC_VERSION(dev->gpu) >= IP_VERSION(9, 4, 2)) in kfd_topology_set_capabilities()
1911 if (KFD_GC_VERSION(dev->gpu) >= IP_VERSION(11, 0, 0)) in kfd_topology_set_capabilities()
1919 int kfd_topology_add_device(struct kfd_node *gpu) in kfd_topology_add_device() argument
1925 const char *asic_name = amdgpu_asic_name[gpu->adev->asic_type]; in kfd_topology_add_device()
1926 struct amdgpu_gfx_config *gfx_info = &gpu->adev->gfx.config; in kfd_topology_add_device()
1927 struct amdgpu_cu_info *cu_info = &gpu->adev->gfx.cu_info; in kfd_topology_add_device()
1929 gpu_id = kfd_generate_gpu_id(gpu); in kfd_topology_add_device()
1930 if (gpu->xcp && !gpu->xcp->ddev) { in kfd_topology_add_device()
1931 dev_warn(gpu->adev->dev, in kfd_topology_add_device()
1932 "Won't add GPU (ID: 0x%x) to topology since it has no drm node assigned.", in kfd_topology_add_device()
1936 pr_debug("Adding new GPU (ID: 0x%x) to topology\n", gpu_id); in kfd_topology_add_device()
1939 /* Check to see if this gpu device exists in the topology_device_list. in kfd_topology_add_device()
1940 * If so, assign the gpu to that device, in kfd_topology_add_device()
1941 * else create a Virtual CRAT for this gpu device and then parse that in kfd_topology_add_device()
1942 * CRAT to create a new topology device. Once created assign the gpu to in kfd_topology_add_device()
1946 dev = kfd_assign_gpu(gpu); in kfd_topology_add_device()
1948 res = kfd_topology_add_device_locked(gpu, gpu_id, &dev); in kfd_topology_add_device()
1954 gpu->id = gpu_id; in kfd_topology_add_device()
1976 gpu->kfd->device_info.gfx_target_version; in kfd_topology_add_device()
1977 dev->node_props.vendor_id = gpu->adev->pdev->vendor; in kfd_topology_add_device()
1978 dev->node_props.device_id = gpu->adev->pdev->device; in kfd_topology_add_device()
1980 ((dev->gpu->adev->rev_id << HSA_CAP_ASIC_REVISION_SHIFT) & in kfd_topology_add_device()
1983 dev->node_props.location_id = pci_dev_id(gpu->adev->pdev); in kfd_topology_add_device()
1984 if (KFD_GC_VERSION(dev->gpu->kfd) == IP_VERSION(9, 4, 3)) in kfd_topology_add_device()
1985 dev->node_props.location_id |= dev->gpu->node_id; in kfd_topology_add_device()
1987 dev->node_props.domain = pci_domain_nr(gpu->adev->pdev->bus); in kfd_topology_add_device()
1989 amdgpu_amdkfd_get_max_engine_clock_in_mhz(dev->gpu->adev); in kfd_topology_add_device()
1993 if (gpu->xcp) in kfd_topology_add_device()
1994 dev->node_props.drm_render_minor = gpu->xcp->ddev->render->index; in kfd_topology_add_device()
1997 gpu->kfd->shared_resources.drm_render_minor; in kfd_topology_add_device()
1999 dev->node_props.hive_id = gpu->kfd->hive_id; in kfd_topology_add_device()
2000 dev->node_props.num_sdma_engines = kfd_get_num_sdma_engines(gpu); in kfd_topology_add_device()
2002 kfd_get_num_xgmi_sdma_engines(gpu); in kfd_topology_add_device()
2004 gpu->kfd->device_info.num_sdma_queues_per_engine - in kfd_topology_add_device()
2005 gpu->kfd->device_info.num_reserved_sdma_queues_per_engine; in kfd_topology_add_device()
2006 dev->node_props.num_gws = (dev->gpu->gws && in kfd_topology_add_device()
2007 dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ? in kfd_topology_add_device()
2008 dev->gpu->adev->gds.gws_size : 0; in kfd_topology_add_device()
2009 dev->node_props.num_cp_queues = get_cp_queues_num(dev->gpu->dqm); in kfd_topology_add_device()
2014 switch (dev->gpu->adev->asic_type) { in kfd_topology_add_device()
2034 if (KFD_GC_VERSION(dev->gpu) < IP_VERSION(9, 0, 1)) in kfd_topology_add_device()
2036 dev->gpu->adev->asic_type); in kfd_topology_add_device()
2052 if (dev->gpu->adev->asic_type == CHIP_CARRIZO) { in kfd_topology_add_device()
2060 ((dev->gpu->adev->ras_enabled & BIT(AMDGPU_RAS_BLOCK__GFX)) != 0) ? in kfd_topology_add_device()
2063 ((dev->gpu->adev->ras_enabled & BIT(AMDGPU_RAS_BLOCK__UMC)) != 0) ? in kfd_topology_add_device()
2066 if (KFD_GC_VERSION(dev->gpu) != IP_VERSION(9, 0, 1)) in kfd_topology_add_device()
2067 dev->node_props.capability |= (dev->gpu->adev->ras_enabled != 0) ? in kfd_topology_add_device()
2070 if (KFD_IS_SVM_API_SUPPORTED(dev->gpu->adev)) in kfd_topology_add_device()
2073 if (dev->gpu->adev->gmc.is_app_apu || in kfd_topology_add_device()
2074 dev->gpu->adev->gmc.xgmi.connected_to_cpu) in kfd_topology_add_device()
2146 int kfd_topology_remove_device(struct kfd_node *gpu) in kfd_topology_remove_device() argument
2156 if (dev->gpu == gpu) { in kfd_topology_remove_device()
2181 * topology. If GPU device is found @idx, then valid kfd_dev pointer is
2183 * Return - 0: On success (@kdev will be NULL for non GPU nodes)
2197 *kdev = top_dev->gpu; in kfd_topology_enum_kfd_devices()
2251 if (!dev->gpu) { in kfd_debugfs_hqds_by_device()
2256 seq_printf(m, "Node %u, gpu_id %x:\n", i++, dev->gpu->id); in kfd_debugfs_hqds_by_device()
2257 r = dqm_debugfs_hqds(m, dev->gpu->dqm); in kfd_debugfs_hqds_by_device()
2276 if (!dev->gpu) { in kfd_debugfs_rls_by_device()
2281 seq_printf(m, "Node %u, gpu_id %x:\n", i++, dev->gpu->id); in kfd_debugfs_rls_by_device()
2282 r = pm_debugfs_runlist(m, &dev->gpu->dqm->packet_mgr); in kfd_debugfs_rls_by_device()