mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 21:56:41 +07:00
amdkfd: Add topology module to amdkfd
This patch adds the topology module to the driver. The topology is exposed to userspace through the sysfs. The calls to add and remove a device to/from topology are done by the radeon driver. v3: The CPU information, that is provided in the topology section of the amdkfd driver, is extracted from the CRAT table. Unlike the CPU information located in /sys/devices/system/cpu/cpu*, which is extracted from the SRAT table. While the CPU information provided by the CRAT and the SRAT tables might be identical, the node topology might be different. The SRAT table contains the topology of CPU nodes only. The CRAT table contains the topology of CPU and GPU nodes together (and can be interleaved). For example CPU node 1 in SRAT can be CPU node 3 in CRAT. Furthermore it's worth to mention that the CRAT table contains only HSA compatible nodes (nodes which are compliant with the HSA spec). To recap, amdkfd exposes a different kind of topology than the one exposed by /sys/devices/system/cpu/cpu even though it may contain similar information. v4: The topology module doesn't support uevent handling and doesn't notify the userspace about runtime modifications. It is up to the userspace to acquire snapshots of the topology information created by the amdkfd and exposed in sysfs. The following is an example of how the topology looks on a Kaveri A10-7850K system with amdkfd installed: /sys/devices/virtual/kfd/kfd/ | --- topology/ | |--- generation_id |--- system_properties |--- nodes/ | |--- 0/ | |--- gpu_id |--- name |--- properties |--- caches/ | |--- 0/ | |--- properties |--- 1/ | |--- properties |--- 2/ | |--- properties |--- io_links/ | |--- mem_banks/ | |--- 0/ | |--- properties |--- 1/ | |--- properties |--- 2/ | |--- properties |--- 3/ | |--- properties v5: Move amdkfd from drm/radeon/ to drm/amd/ Add a check if dev->gpu pointer is null before accessing it in the node_show function in kfd_topology.c This situation may occur when amdkfd is loaded and there is a GPU with a CRAT table, but that GPU isn't supported by amdkfd Signed-off-by: Evgeny Pinchuk <evgeny.pinchuk@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
This commit is contained in:
parent
4a488a7ad7
commit
5b5c4e40a3
@ -4,6 +4,6 @@
|
||||
|
||||
ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/
|
||||
|
||||
amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o
|
||||
amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o
|
||||
|
||||
obj-$(CONFIG_HSA_AMD) += amdkfd.o
|
||||
|
294
drivers/gpu/drm/amd/amdkfd/kfd_crat.h
Normal file
294
drivers/gpu/drm/amd/amdkfd/kfd_crat.h
Normal file
@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Copyright 2014 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef KFD_CRAT_H_INCLUDED
|
||||
#define KFD_CRAT_H_INCLUDED
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*
|
||||
* 4CC signature values for the CRAT and CDIT ACPI tables
|
||||
*/
|
||||
|
||||
#define CRAT_SIGNATURE "CRAT"
|
||||
#define CDIT_SIGNATURE "CDIT"
|
||||
|
||||
/*
|
||||
* Component Resource Association Table (CRAT)
|
||||
*/
|
||||
|
||||
#define CRAT_OEMID_LENGTH 6
|
||||
#define CRAT_OEMTABLEID_LENGTH 8
|
||||
#define CRAT_RESERVED_LENGTH 6
|
||||
|
||||
#define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1)
|
||||
|
||||
struct crat_header {
|
||||
uint32_t signature;
|
||||
uint32_t length;
|
||||
uint8_t revision;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[CRAT_OEMID_LENGTH];
|
||||
uint8_t oem_table_id[CRAT_OEMTABLEID_LENGTH];
|
||||
uint32_t oem_revision;
|
||||
uint32_t creator_id;
|
||||
uint32_t creator_revision;
|
||||
uint32_t total_entries;
|
||||
uint16_t num_domains;
|
||||
uint8_t reserved[CRAT_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* The header structure is immediately followed by total_entries of the
|
||||
* data definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* The currently defined subtype entries in the CRAT
|
||||
*/
|
||||
#define CRAT_SUBTYPE_COMPUTEUNIT_AFFINITY 0
|
||||
#define CRAT_SUBTYPE_MEMORY_AFFINITY 1
|
||||
#define CRAT_SUBTYPE_CACHE_AFFINITY 2
|
||||
#define CRAT_SUBTYPE_TLB_AFFINITY 3
|
||||
#define CRAT_SUBTYPE_CCOMPUTE_AFFINITY 4
|
||||
#define CRAT_SUBTYPE_IOLINK_AFFINITY 5
|
||||
#define CRAT_SUBTYPE_MAX 6
|
||||
|
||||
#define CRAT_SIBLINGMAP_SIZE 32
|
||||
|
||||
/*
|
||||
* ComputeUnit Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_CU_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_CU_FLAGS_HOT_PLUGGABLE 0x00000002
|
||||
#define CRAT_CU_FLAGS_CPU_PRESENT 0x00000004
|
||||
#define CRAT_CU_FLAGS_GPU_PRESENT 0x00000008
|
||||
#define CRAT_CU_FLAGS_IOMMU_PRESENT 0x00000010
|
||||
#define CRAT_CU_FLAGS_RESERVED 0xffffffe0
|
||||
|
||||
#define CRAT_COMPUTEUNIT_RESERVED_LENGTH 4
|
||||
|
||||
struct crat_subtype_computeunit {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t proximity_domain;
|
||||
uint32_t processor_id_low;
|
||||
uint16_t num_cpu_cores;
|
||||
uint16_t num_simd_cores;
|
||||
uint16_t max_waves_simd;
|
||||
uint16_t io_count;
|
||||
uint16_t hsa_capability;
|
||||
uint16_t lds_size_in_kb;
|
||||
uint8_t wave_front_size;
|
||||
uint8_t num_banks;
|
||||
uint16_t micro_engine_id;
|
||||
uint8_t num_arrays;
|
||||
uint8_t num_cu_per_array;
|
||||
uint8_t num_simd_per_cu;
|
||||
uint8_t max_slots_scatch_cu;
|
||||
uint8_t reserved2[CRAT_COMPUTEUNIT_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA Memory Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_MEM_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_MEM_FLAGS_HOT_PLUGGABLE 0x00000002
|
||||
#define CRAT_MEM_FLAGS_NON_VOLATILE 0x00000004
|
||||
#define CRAT_MEM_FLAGS_RESERVED 0xfffffff8
|
||||
|
||||
#define CRAT_MEMORY_RESERVED_LENGTH 8
|
||||
|
||||
struct crat_subtype_memory {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t promixity_domain;
|
||||
uint32_t base_addr_low;
|
||||
uint32_t base_addr_high;
|
||||
uint32_t length_low;
|
||||
uint32_t length_high;
|
||||
uint32_t width;
|
||||
uint8_t reserved2[CRAT_MEMORY_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA Cache Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_CACHE_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_CACHE_FLAGS_DATA_CACHE 0x00000002
|
||||
#define CRAT_CACHE_FLAGS_INST_CACHE 0x00000004
|
||||
#define CRAT_CACHE_FLAGS_CPU_CACHE 0x00000008
|
||||
#define CRAT_CACHE_FLAGS_SIMD_CACHE 0x00000010
|
||||
#define CRAT_CACHE_FLAGS_RESERVED 0xffffffe0
|
||||
|
||||
#define CRAT_CACHE_RESERVED_LENGTH 8
|
||||
|
||||
struct crat_subtype_cache {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t processor_id_low;
|
||||
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
|
||||
uint32_t cache_size;
|
||||
uint8_t cache_level;
|
||||
uint8_t lines_per_tag;
|
||||
uint16_t cache_line_size;
|
||||
uint8_t associativity;
|
||||
uint8_t cache_properties;
|
||||
uint16_t cache_latency;
|
||||
uint8_t reserved2[CRAT_CACHE_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA TLB Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_TLB_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_TLB_FLAGS_DATA_TLB 0x00000002
|
||||
#define CRAT_TLB_FLAGS_INST_TLB 0x00000004
|
||||
#define CRAT_TLB_FLAGS_CPU_TLB 0x00000008
|
||||
#define CRAT_TLB_FLAGS_SIMD_TLB 0x00000010
|
||||
#define CRAT_TLB_FLAGS_RESERVED 0xffffffe0
|
||||
|
||||
#define CRAT_TLB_RESERVED_LENGTH 4
|
||||
|
||||
struct crat_subtype_tlb {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t processor_id_low;
|
||||
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
|
||||
uint32_t tlb_level;
|
||||
uint8_t data_tlb_associativity_2mb;
|
||||
uint8_t data_tlb_size_2mb;
|
||||
uint8_t instruction_tlb_associativity_2mb;
|
||||
uint8_t instruction_tlb_size_2mb;
|
||||
uint8_t data_tlb_associativity_4k;
|
||||
uint8_t data_tlb_size_4k;
|
||||
uint8_t instruction_tlb_associativity_4k;
|
||||
uint8_t instruction_tlb_size_4k;
|
||||
uint8_t data_tlb_associativity_1gb;
|
||||
uint8_t data_tlb_size_1gb;
|
||||
uint8_t instruction_tlb_associativity_1gb;
|
||||
uint8_t instruction_tlb_size_1gb;
|
||||
uint8_t reserved2[CRAT_TLB_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA CCompute/APU Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_CCOMPUTE_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_CCOMPUTE_FLAGS_RESERVED 0xfffffffe
|
||||
|
||||
#define CRAT_CCOMPUTE_RESERVED_LENGTH 16
|
||||
|
||||
struct crat_subtype_ccompute {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t processor_id_low;
|
||||
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
|
||||
uint32_t apu_size;
|
||||
uint8_t reserved2[CRAT_CCOMPUTE_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA IO Link Affinity structure and definitions
|
||||
*/
|
||||
#define CRAT_IOLINK_FLAGS_ENABLED 0x00000001
|
||||
#define CRAT_IOLINK_FLAGS_COHERENCY 0x00000002
|
||||
#define CRAT_IOLINK_FLAGS_RESERVED 0xfffffffc
|
||||
|
||||
/*
|
||||
* IO interface types
|
||||
*/
|
||||
#define CRAT_IOLINK_TYPE_UNDEFINED 0
|
||||
#define CRAT_IOLINK_TYPE_HYPERTRANSPORT 1
|
||||
#define CRAT_IOLINK_TYPE_PCIEXPRESS 2
|
||||
#define CRAT_IOLINK_TYPE_OTHER 3
|
||||
#define CRAT_IOLINK_TYPE_MAX 255
|
||||
|
||||
#define CRAT_IOLINK_RESERVED_LENGTH 24
|
||||
|
||||
struct crat_subtype_iolink {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
uint32_t proximity_domain_from;
|
||||
uint32_t proximity_domain_to;
|
||||
uint8_t io_interface_type;
|
||||
uint8_t version_major;
|
||||
uint16_t version_minor;
|
||||
uint32_t minimum_latency;
|
||||
uint32_t maximum_latency;
|
||||
uint32_t minimum_bandwidth_mbs;
|
||||
uint32_t maximum_bandwidth_mbs;
|
||||
uint32_t recommended_transfer_size;
|
||||
uint8_t reserved2[CRAT_IOLINK_RESERVED_LENGTH];
|
||||
};
|
||||
|
||||
/*
|
||||
* HSA generic sub-type header
|
||||
*/
|
||||
|
||||
#define CRAT_SUBTYPE_FLAGS_ENABLED 0x00000001
|
||||
|
||||
struct crat_subtype_generic {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint16_t reserved;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Component Locality Distance Information Table (CDIT)
|
||||
*/
|
||||
#define CDIT_OEMID_LENGTH 6
|
||||
#define CDIT_OEMTABLEID_LENGTH 8
|
||||
|
||||
struct cdit_header {
|
||||
uint32_t signature;
|
||||
uint32_t length;
|
||||
uint8_t revision;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[CDIT_OEMID_LENGTH];
|
||||
uint8_t oem_table_id[CDIT_OEMTABLEID_LENGTH];
|
||||
uint32_t oem_revision;
|
||||
uint32_t creator_id;
|
||||
uint32_t creator_revision;
|
||||
uint32_t total_entries;
|
||||
uint16_t num_domains;
|
||||
uint8_t entry[1];
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* KFD_CRAT_H_INCLUDED */
|
@ -101,6 +101,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
||||
{
|
||||
kfd->shared_resources = *gpu_resources;
|
||||
|
||||
if (kfd_topology_add_device(kfd) != 0)
|
||||
return false;
|
||||
|
||||
kfd->init_complete = true;
|
||||
dev_info(kfd_device, "added device (%x:%x)\n", kfd->pdev->vendor,
|
||||
kfd->pdev->device);
|
||||
@ -110,6 +113,10 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
||||
|
||||
void kgd2kfd_device_exit(struct kfd_dev *kfd)
|
||||
{
|
||||
int err = kfd_topology_remove_device(kfd);
|
||||
|
||||
BUG_ON(err != 0);
|
||||
|
||||
kfree(kfd);
|
||||
}
|
||||
|
||||
|
@ -76,16 +76,23 @@ static int __init kfd_module_init(void)
|
||||
if (err < 0)
|
||||
goto err_ioctl;
|
||||
|
||||
err = kfd_topology_init();
|
||||
if (err < 0)
|
||||
goto err_topology;
|
||||
|
||||
dev_info(kfd_device, "Initialized module\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err_topology:
|
||||
kfd_chardev_exit();
|
||||
err_ioctl:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit kfd_module_exit(void)
|
||||
{
|
||||
kfd_topology_shutdown();
|
||||
kfd_chardev_exit();
|
||||
dev_info(kfd_device, "Removed module\n");
|
||||
}
|
||||
|
@ -32,6 +32,15 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <kgd_kfd_interface.h>
|
||||
|
||||
#define KFD_SYSFS_FILE_MODE 0444
|
||||
|
||||
/* GPU ID hash width in bits */
|
||||
#define KFD_GPU_ID_HASH_WIDTH 16
|
||||
|
||||
/* Macro for allocating structures */
|
||||
#define kfd_alloc_struct(ptr_to_struct) \
|
||||
((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))
|
||||
|
||||
struct kfd_device_info {
|
||||
unsigned int max_pasid_bits;
|
||||
size_t ih_ring_entry_size;
|
||||
@ -71,6 +80,15 @@ struct kfd_process {
|
||||
|
||||
extern struct device *kfd_device;
|
||||
|
||||
/* Topology */
|
||||
int kfd_topology_init(void);
|
||||
void kfd_topology_shutdown(void);
|
||||
int kfd_topology_add_device(struct kfd_dev *gpu);
|
||||
int kfd_topology_remove_device(struct kfd_dev *gpu);
|
||||
struct kfd_dev *kfd_device_by_id(uint32_t gpu_id);
|
||||
struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev);
|
||||
struct kfd_dev *kfd_topology_enum_kfd_devices(uint8_t idx);
|
||||
|
||||
/* Interrupts */
|
||||
void kgd2kfd_interrupt(struct kfd_dev *dev, const void *ih_ring_entry);
|
||||
|
||||
|
1235
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
Normal file
1235
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
Normal file
File diff suppressed because it is too large
Load Diff
168
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
Normal file
168
drivers/gpu/drm/amd/amdkfd/kfd_topology.h
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright 2014 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __KFD_TOPOLOGY_H__
|
||||
#define __KFD_TOPOLOGY_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include "kfd_priv.h"
|
||||
|
||||
#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 128
|
||||
|
||||
#define HSA_CAP_HOT_PLUGGABLE 0x00000001
|
||||
#define HSA_CAP_ATS_PRESENT 0x00000002
|
||||
#define HSA_CAP_SHARED_WITH_GRAPHICS 0x00000004
|
||||
#define HSA_CAP_QUEUE_SIZE_POW2 0x00000008
|
||||
#define HSA_CAP_QUEUE_SIZE_32BIT 0x00000010
|
||||
#define HSA_CAP_QUEUE_IDLE_EVENT 0x00000020
|
||||
#define HSA_CAP_VA_LIMIT 0x00000040
|
||||
#define HSA_CAP_WATCH_POINTS_SUPPORTED 0x00000080
|
||||
#define HSA_CAP_WATCH_POINTS_TOTALBITS_MASK 0x00000f00
|
||||
#define HSA_CAP_WATCH_POINTS_TOTALBITS_SHIFT 8
|
||||
#define HSA_CAP_RESERVED 0xfffff000
|
||||
|
||||
struct kfd_node_properties {
|
||||
uint32_t cpu_cores_count;
|
||||
uint32_t simd_count;
|
||||
uint32_t mem_banks_count;
|
||||
uint32_t caches_count;
|
||||
uint32_t io_links_count;
|
||||
uint32_t cpu_core_id_base;
|
||||
uint32_t simd_id_base;
|
||||
uint32_t capability;
|
||||
uint32_t max_waves_per_simd;
|
||||
uint32_t lds_size_in_kb;
|
||||
uint32_t gds_size_in_kb;
|
||||
uint32_t wave_front_size;
|
||||
uint32_t array_count;
|
||||
uint32_t simd_arrays_per_engine;
|
||||
uint32_t cu_per_simd_array;
|
||||
uint32_t simd_per_cu;
|
||||
uint32_t max_slots_scratch_cu;
|
||||
uint32_t engine_id;
|
||||
uint32_t vendor_id;
|
||||
uint32_t device_id;
|
||||
uint32_t location_id;
|
||||
uint32_t max_engine_clk_fcompute;
|
||||
uint32_t max_engine_clk_ccompute;
|
||||
uint16_t marketing_name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
|
||||
};
|
||||
|
||||
#define HSA_MEM_HEAP_TYPE_SYSTEM 0
|
||||
#define HSA_MEM_HEAP_TYPE_FB_PUBLIC 1
|
||||
#define HSA_MEM_HEAP_TYPE_FB_PRIVATE 2
|
||||
#define HSA_MEM_HEAP_TYPE_GPU_GDS 3
|
||||
#define HSA_MEM_HEAP_TYPE_GPU_LDS 4
|
||||
#define HSA_MEM_HEAP_TYPE_GPU_SCRATCH 5
|
||||
|
||||
#define HSA_MEM_FLAGS_HOT_PLUGGABLE 0x00000001
|
||||
#define HSA_MEM_FLAGS_NON_VOLATILE 0x00000002
|
||||
#define HSA_MEM_FLAGS_RESERVED 0xfffffffc
|
||||
|
||||
struct kfd_mem_properties {
|
||||
struct list_head list;
|
||||
uint32_t heap_type;
|
||||
uint64_t size_in_bytes;
|
||||
uint32_t flags;
|
||||
uint32_t width;
|
||||
uint32_t mem_clk_max;
|
||||
struct kobject *kobj;
|
||||
struct attribute attr;
|
||||
};
|
||||
|
||||
#define KFD_TOPOLOGY_CPU_SIBLINGS 256
|
||||
|
||||
#define HSA_CACHE_TYPE_DATA 0x00000001
|
||||
#define HSA_CACHE_TYPE_INSTRUCTION 0x00000002
|
||||
#define HSA_CACHE_TYPE_CPU 0x00000004
|
||||
#define HSA_CACHE_TYPE_HSACU 0x00000008
|
||||
#define HSA_CACHE_TYPE_RESERVED 0xfffffff0
|
||||
|
||||
struct kfd_cache_properties {
|
||||
struct list_head list;
|
||||
uint32_t processor_id_low;
|
||||
uint32_t cache_level;
|
||||
uint32_t cache_size;
|
||||
uint32_t cacheline_size;
|
||||
uint32_t cachelines_per_tag;
|
||||
uint32_t cache_assoc;
|
||||
uint32_t cache_latency;
|
||||
uint32_t cache_type;
|
||||
uint8_t sibling_map[KFD_TOPOLOGY_CPU_SIBLINGS];
|
||||
struct kobject *kobj;
|
||||
struct attribute attr;
|
||||
};
|
||||
|
||||
struct kfd_iolink_properties {
|
||||
struct list_head list;
|
||||
uint32_t iolink_type;
|
||||
uint32_t ver_maj;
|
||||
uint32_t ver_min;
|
||||
uint32_t node_from;
|
||||
uint32_t node_to;
|
||||
uint32_t weight;
|
||||
uint32_t min_latency;
|
||||
uint32_t max_latency;
|
||||
uint32_t min_bandwidth;
|
||||
uint32_t max_bandwidth;
|
||||
uint32_t rec_transfer_size;
|
||||
uint32_t flags;
|
||||
struct kobject *kobj;
|
||||
struct attribute attr;
|
||||
};
|
||||
|
||||
struct kfd_topology_device {
|
||||
struct list_head list;
|
||||
uint32_t gpu_id;
|
||||
struct kfd_node_properties node_props;
|
||||
uint32_t mem_bank_count;
|
||||
struct list_head mem_props;
|
||||
uint32_t cache_count;
|
||||
struct list_head cache_props;
|
||||
uint32_t io_link_count;
|
||||
struct list_head io_link_props;
|
||||
struct kfd_dev *gpu;
|
||||
struct kobject *kobj_node;
|
||||
struct kobject *kobj_mem;
|
||||
struct kobject *kobj_cache;
|
||||
struct kobject *kobj_iolink;
|
||||
struct attribute attr_gpuid;
|
||||
struct attribute attr_name;
|
||||
struct attribute attr_props;
|
||||
};
|
||||
|
||||
struct kfd_system_properties {
|
||||
uint32_t num_devices; /* Number of H-NUMA nodes */
|
||||
uint32_t generation_count;
|
||||
uint64_t platform_oem;
|
||||
uint64_t platform_id;
|
||||
uint64_t platform_rev;
|
||||
struct kobject *kobj_topology;
|
||||
struct kobject *kobj_nodes;
|
||||
struct attribute attr_genid;
|
||||
struct attribute attr_props;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* __KFD_TOPOLOGY_H__ */
|
Loading…
Reference in New Issue
Block a user