#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/acpi.h>
#include <linux/hash.h>
#include <linux/cpufreq.h>
#include <linux/log2.h>
#include <linux/dmi.h>
#include <linux/atomic.h>
#include <linux/crc16.h>
#include "kfd_priv.h"
#include "kfd_crat.h"
#include "kfd_topology.h"
#include "kfd_device_queue_manager.h"
#include "kfd_svm.h"
#include "kfd_debug.h"
#include "amdgpu_amdkfd.h"
#include "amdgpu_ras.h"
#include "amdgpu.h"
static struct list_head topology_device_list;
static struct kfd_system_properties sys_props;
static DECLARE_RWSEM(topology_lock);
static uint32_t topology_crat_proximity_domain;
struct kfd_topology_device *kfd_topology_device_by_proximity_domain_no_lock(
uint32_t proximity_domain)
{ … }
struct kfd_topology_device *kfd_topology_device_by_proximity_domain(
uint32_t proximity_domain)
{ … }
struct kfd_topology_device *kfd_topology_device_by_id(uint32_t gpu_id)
{ … }
struct kfd_node *kfd_device_by_id(uint32_t gpu_id)
{ … }
struct kfd_node *kfd_device_by_pci_dev(const struct pci_dev *pdev)
{ … }
static void kfd_release_topology_device(struct kfd_topology_device *dev)
{ … }
void kfd_release_topology_device_list(struct list_head *device_list)
{ … }
static void kfd_release_live_view(void)
{ … }
struct kfd_topology_device *kfd_create_topology_device(
struct list_head *device_list)
{ … }
#define sysfs_show_gen_prop(buffer, offs, fmt, ...) …
#define sysfs_show_32bit_prop(buffer, offs, name, value) …
#define sysfs_show_64bit_prop(buffer, offs, name, value) …
#define sysfs_show_32bit_val(buffer, offs, value) …
#define sysfs_show_str_val(buffer, offs, value) …
static ssize_t sysprops_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{ … }
static void kfd_topology_kobj_release(struct kobject *kobj)
{ … }
static const struct sysfs_ops sysprops_ops = …;
static const struct kobj_type sysprops_type = …;
static ssize_t iolink_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{ … }
static const struct sysfs_ops iolink_ops = …;
static const struct kobj_type iolink_type = …;
static ssize_t mem_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{ … }
static const struct sysfs_ops mem_ops = …;
static const struct kobj_type mem_type = …;
static ssize_t kfd_cache_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{ … }
static const struct sysfs_ops cache_ops = …;
static const struct kobj_type cache_type = …;
struct kfd_perf_attr { … };
static ssize_t perf_show(struct kobject *kobj, struct kobj_attribute *attrs,
char *buf)
{ … }
#define KFD_PERF_DESC(_name, _data) …
static struct kfd_perf_attr perf_attr_iommu[] = …;
static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{ … }
static const struct sysfs_ops node_ops = …;
static const struct kobj_type node_type = …;
static void kfd_remove_sysfs_file(struct kobject *kobj, struct attribute *attr)
{ … }
static void kfd_remove_sysfs_node_entry(struct kfd_topology_device *dev)
{ … }
static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
uint32_t id)
{ … }
static int kfd_build_sysfs_node_tree(void)
{ … }
static void kfd_remove_sysfs_node_tree(void)
{ … }
static int kfd_topology_update_sysfs(void)
{ … }
static void kfd_topology_release_sysfs(void)
{ … }
static void kfd_topology_update_device_list(struct list_head *temp_list,
struct list_head *master_list)
{ … }
static void kfd_debug_print_topology(void)
{ … }
static void kfd_update_system_properties(void)
{ … }
static void find_system_memory(const struct dmi_header *dm,
void *private)
{ … }
static void kfd_add_non_crat_information(struct kfd_topology_device *kdev)
{ … }
int kfd_topology_init(void)
{ … }
void kfd_topology_shutdown(void)
{ … }
static uint32_t kfd_generate_gpu_id(struct kfd_node *gpu)
{ … }
static struct kfd_topology_device *kfd_assign_gpu(struct kfd_node *gpu)
{ … }
static void kfd_notify_gpu_change(uint32_t gpu_id, int arrival)
{ … }
static void kfd_fill_mem_clk_max_info(struct kfd_topology_device *dev)
{ … }
static void kfd_set_iolink_no_atomics(struct kfd_topology_device *dev,
struct kfd_topology_device *target_gpu_dev,
struct kfd_iolink_properties *link)
{ … }
static void kfd_set_iolink_non_coherent(struct kfd_topology_device *to_dev,
struct kfd_iolink_properties *outbound_link,
struct kfd_iolink_properties *inbound_link)
{ … }
static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
{ … }
static int kfd_build_p2p_node_entry(struct kfd_topology_device *dev,
struct kfd_iolink_properties *p2plink)
{ … }
static int kfd_create_indirect_link_prop(struct kfd_topology_device *kdev, int gpu_node)
{ … }
#if defined(CONFIG_HSA_AMD_P2P)
static int kfd_add_peer_prop(struct kfd_topology_device *kdev,
struct kfd_topology_device *peer, int from, int to)
{ … }
#endif
static int kfd_dev_create_p2p_links(void)
{ … }
static int fill_in_l1_pcache(struct kfd_cache_properties **props_ext,
struct kfd_gpu_cache_info *pcache_info,
int cu_bitmask,
int cache_type, unsigned int cu_processor_id,
int cu_block)
{ … }
static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
struct kfd_gpu_cache_info *pcache_info,
struct amdgpu_cu_info *cu_info,
struct amdgpu_gfx_config *gfx_info,
int cache_type, unsigned int cu_processor_id,
struct kfd_node *knode)
{ … }
#define KFD_MAX_CACHE_TYPES …
static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct kfd_node *kdev)
{ … }
static int kfd_topology_add_device_locked(struct kfd_node *gpu,
struct kfd_topology_device **dev)
{ … }
static void kfd_topology_set_dbg_firmware_support(struct kfd_topology_device *dev)
{ … }
static void kfd_topology_set_capabilities(struct kfd_topology_device *dev)
{ … }
int kfd_topology_add_device(struct kfd_node *gpu)
{ … }
static void kfd_topology_update_io_links(int proximity_domain)
{ … }
int kfd_topology_remove_device(struct kfd_node *gpu)
{ … }
int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_node **kdev)
{ … }
static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask)
{ … }
int kfd_numa_node_to_apic_id(int numa_node_id)
{ … }
#if defined(CONFIG_DEBUG_FS)
int kfd_debugfs_hqds_by_device(struct seq_file *m, void *data)
{ … }
int kfd_debugfs_rls_by_device(struct seq_file *m, void *data)
{ … }
#endif