xref: /linux/drivers/gpu/drm/amd/amdkfd/kfd_crat.h (revision 5a2df8ecba868e91fa4eff393ceef34d134fe916)
1d87f36a0SRajneesh Bhardwaj /* SPDX-License-Identifier: GPL-2.0 OR MIT */
25b5c4e40SEvgeny Pinchuk /*
3d87f36a0SRajneesh Bhardwaj  * Copyright 2014-2022 Advanced Micro Devices, Inc.
45b5c4e40SEvgeny Pinchuk  *
55b5c4e40SEvgeny Pinchuk  * Permission is hereby granted, free of charge, to any person obtaining a
65b5c4e40SEvgeny Pinchuk  * copy of this software and associated documentation files (the "Software"),
75b5c4e40SEvgeny Pinchuk  * to deal in the Software without restriction, including without limitation
85b5c4e40SEvgeny Pinchuk  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
95b5c4e40SEvgeny Pinchuk  * and/or sell copies of the Software, and to permit persons to whom the
105b5c4e40SEvgeny Pinchuk  * Software is furnished to do so, subject to the following conditions:
115b5c4e40SEvgeny Pinchuk  *
125b5c4e40SEvgeny Pinchuk  * The above copyright notice and this permission notice shall be included in
135b5c4e40SEvgeny Pinchuk  * all copies or substantial portions of the Software.
145b5c4e40SEvgeny Pinchuk  *
155b5c4e40SEvgeny Pinchuk  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
165b5c4e40SEvgeny Pinchuk  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
175b5c4e40SEvgeny Pinchuk  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
185b5c4e40SEvgeny Pinchuk  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
195b5c4e40SEvgeny Pinchuk  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
205b5c4e40SEvgeny Pinchuk  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
215b5c4e40SEvgeny Pinchuk  * OTHER DEALINGS IN THE SOFTWARE.
225b5c4e40SEvgeny Pinchuk  */
235b5c4e40SEvgeny Pinchuk 
245b5c4e40SEvgeny Pinchuk #ifndef KFD_CRAT_H_INCLUDED
255b5c4e40SEvgeny Pinchuk #define KFD_CRAT_H_INCLUDED
265b5c4e40SEvgeny Pinchuk 
275b5c4e40SEvgeny Pinchuk #include <linux/types.h>
285b5c4e40SEvgeny Pinchuk 
295b5c4e40SEvgeny Pinchuk #pragma pack(1)
305b5c4e40SEvgeny Pinchuk 
315b5c4e40SEvgeny Pinchuk /*
3225135748SPaulo Miguel Almeida  * 4CC signature value for the CRAT ACPI table
335b5c4e40SEvgeny Pinchuk  */
345b5c4e40SEvgeny Pinchuk 
355b5c4e40SEvgeny Pinchuk #define CRAT_SIGNATURE	"CRAT"
365b5c4e40SEvgeny Pinchuk 
375b5c4e40SEvgeny Pinchuk /*
385b5c4e40SEvgeny Pinchuk  * Component Resource Association Table (CRAT)
395b5c4e40SEvgeny Pinchuk  */
405b5c4e40SEvgeny Pinchuk 
415b5c4e40SEvgeny Pinchuk #define CRAT_OEMID_LENGTH	6
425b5c4e40SEvgeny Pinchuk #define CRAT_OEMTABLEID_LENGTH	8
435b5c4e40SEvgeny Pinchuk #define CRAT_RESERVED_LENGTH	6
445b5c4e40SEvgeny Pinchuk 
455b5c4e40SEvgeny Pinchuk #define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1)
465b5c4e40SEvgeny Pinchuk 
47520b8fb7SFelix Kuehling /* Compute Unit flags */
48520b8fb7SFelix Kuehling #define COMPUTE_UNIT_CPU	(1 << 0)  /* Create Virtual CRAT for CPU */
49520b8fb7SFelix Kuehling #define COMPUTE_UNIT_GPU	(1 << 1)  /* Create Virtual CRAT for GPU */
50520b8fb7SFelix Kuehling 
515b5c4e40SEvgeny Pinchuk struct crat_header {
525b5c4e40SEvgeny Pinchuk 	uint32_t	signature;
535b5c4e40SEvgeny Pinchuk 	uint32_t	length;
545b5c4e40SEvgeny Pinchuk 	uint8_t		revision;
555b5c4e40SEvgeny Pinchuk 	uint8_t		checksum;
565b5c4e40SEvgeny Pinchuk 	uint8_t		oem_id[CRAT_OEMID_LENGTH];
575b5c4e40SEvgeny Pinchuk 	uint8_t		oem_table_id[CRAT_OEMTABLEID_LENGTH];
585b5c4e40SEvgeny Pinchuk 	uint32_t	oem_revision;
595b5c4e40SEvgeny Pinchuk 	uint32_t	creator_id;
605b5c4e40SEvgeny Pinchuk 	uint32_t	creator_revision;
615b5c4e40SEvgeny Pinchuk 	uint32_t	total_entries;
625b5c4e40SEvgeny Pinchuk 	uint16_t	num_domains;
635b5c4e40SEvgeny Pinchuk 	uint8_t		reserved[CRAT_RESERVED_LENGTH];
645b5c4e40SEvgeny Pinchuk };
655b5c4e40SEvgeny Pinchuk 
665b5c4e40SEvgeny Pinchuk /*
675b5c4e40SEvgeny Pinchuk  * The header structure is immediately followed by total_entries of the
685b5c4e40SEvgeny Pinchuk  * data definitions
695b5c4e40SEvgeny Pinchuk  */
705b5c4e40SEvgeny Pinchuk 
715b5c4e40SEvgeny Pinchuk /*
725b5c4e40SEvgeny Pinchuk  * The currently defined subtype entries in the CRAT
735b5c4e40SEvgeny Pinchuk  */
745b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_COMPUTEUNIT_AFFINITY	0
755b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_MEMORY_AFFINITY		1
765b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_CACHE_AFFINITY		2
775b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_TLB_AFFINITY		3
785b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_CCOMPUTE_AFFINITY		4
795b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_IOLINK_AFFINITY		5
805b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_MAX			6
815b5c4e40SEvgeny Pinchuk 
820752e66eSMukul Joshi /*
830752e66eSMukul Joshi  * Do not change the value of CRAT_SIBLINGMAP_SIZE from 32
840752e66eSMukul Joshi  * as it breaks the ABI.
850752e66eSMukul Joshi  */
865b5c4e40SEvgeny Pinchuk #define CRAT_SIBLINGMAP_SIZE	32
875b5c4e40SEvgeny Pinchuk 
885b5c4e40SEvgeny Pinchuk /*
895b5c4e40SEvgeny Pinchuk  * ComputeUnit Affinity structure and definitions
905b5c4e40SEvgeny Pinchuk  */
915b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_ENABLED		0x00000001
925b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_HOT_PLUGGABLE	0x00000002
935b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_CPU_PRESENT	0x00000004
945b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_GPU_PRESENT	0x00000008
955b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_IOMMU_PRESENT	0x00000010
965b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_RESERVED		0xffffffe0
975b5c4e40SEvgeny Pinchuk 
985b5c4e40SEvgeny Pinchuk #define CRAT_COMPUTEUNIT_RESERVED_LENGTH 4
995b5c4e40SEvgeny Pinchuk 
1005b5c4e40SEvgeny Pinchuk struct crat_subtype_computeunit {
1015b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1025b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1035b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1045b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1055b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain;
1065b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1075b5c4e40SEvgeny Pinchuk 	uint16_t	num_cpu_cores;
1085b5c4e40SEvgeny Pinchuk 	uint16_t	num_simd_cores;
1095b5c4e40SEvgeny Pinchuk 	uint16_t	max_waves_simd;
1105b5c4e40SEvgeny Pinchuk 	uint16_t	io_count;
1115b5c4e40SEvgeny Pinchuk 	uint16_t	hsa_capability;
1125b5c4e40SEvgeny Pinchuk 	uint16_t	lds_size_in_kb;
1135b5c4e40SEvgeny Pinchuk 	uint8_t		wave_front_size;
1145b5c4e40SEvgeny Pinchuk 	uint8_t		num_banks;
1155b5c4e40SEvgeny Pinchuk 	uint16_t	micro_engine_id;
1163a87177eSHarish Kasiviswanathan 	uint8_t		array_count;
1175b5c4e40SEvgeny Pinchuk 	uint8_t		num_cu_per_array;
1185b5c4e40SEvgeny Pinchuk 	uint8_t		num_simd_per_cu;
1195b5c4e40SEvgeny Pinchuk 	uint8_t		max_slots_scatch_cu;
1205b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_COMPUTEUNIT_RESERVED_LENGTH];
1215b5c4e40SEvgeny Pinchuk };
1225b5c4e40SEvgeny Pinchuk 
1235b5c4e40SEvgeny Pinchuk /*
1245b5c4e40SEvgeny Pinchuk  * HSA Memory Affinity structure and definitions
1255b5c4e40SEvgeny Pinchuk  */
1265b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_ENABLED		0x00000001
1275b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_HOT_PLUGGABLE	0x00000002
1285b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_NON_VOLATILE	0x00000004
1295b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_RESERVED		0xfffffff8
1305b5c4e40SEvgeny Pinchuk 
1315b5c4e40SEvgeny Pinchuk #define CRAT_MEMORY_RESERVED_LENGTH 8
1325b5c4e40SEvgeny Pinchuk 
1335b5c4e40SEvgeny Pinchuk struct crat_subtype_memory {
1345b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1355b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1365b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1375b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
138174de876SFelix Kuehling 	uint32_t	proximity_domain;
1395b5c4e40SEvgeny Pinchuk 	uint32_t	base_addr_low;
1405b5c4e40SEvgeny Pinchuk 	uint32_t	base_addr_high;
1415b5c4e40SEvgeny Pinchuk 	uint32_t	length_low;
1425b5c4e40SEvgeny Pinchuk 	uint32_t	length_high;
1435b5c4e40SEvgeny Pinchuk 	uint32_t	width;
1443a87177eSHarish Kasiviswanathan 	uint8_t		visibility_type; /* for virtual (dGPU) CRAT */
1453a87177eSHarish Kasiviswanathan 	uint8_t		reserved2[CRAT_MEMORY_RESERVED_LENGTH - 1];
1465b5c4e40SEvgeny Pinchuk };
1475b5c4e40SEvgeny Pinchuk 
1485b5c4e40SEvgeny Pinchuk /*
1495b5c4e40SEvgeny Pinchuk  * HSA Cache Affinity structure and definitions
1505b5c4e40SEvgeny Pinchuk  */
1515b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_ENABLED	0x00000001
1525b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_DATA_CACHE	0x00000002
1535b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_INST_CACHE	0x00000004
1545b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_CPU_CACHE	0x00000008
1555b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_SIMD_CACHE	0x00000010
1565b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_RESERVED	0xffffffe0
1575b5c4e40SEvgeny Pinchuk 
1585b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_RESERVED_LENGTH 8
1595b5c4e40SEvgeny Pinchuk 
1605b5c4e40SEvgeny Pinchuk struct crat_subtype_cache {
1615b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1625b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1635b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1645b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1655b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1665b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1675b5c4e40SEvgeny Pinchuk 	uint32_t	cache_size;
1685b5c4e40SEvgeny Pinchuk 	uint8_t		cache_level;
1695b5c4e40SEvgeny Pinchuk 	uint8_t		lines_per_tag;
1705b5c4e40SEvgeny Pinchuk 	uint16_t	cache_line_size;
1715b5c4e40SEvgeny Pinchuk 	uint8_t		associativity;
1725b5c4e40SEvgeny Pinchuk 	uint8_t		cache_properties;
1735b5c4e40SEvgeny Pinchuk 	uint16_t	cache_latency;
1745b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_CACHE_RESERVED_LENGTH];
1755b5c4e40SEvgeny Pinchuk };
1765b5c4e40SEvgeny Pinchuk 
1775b5c4e40SEvgeny Pinchuk /*
1785b5c4e40SEvgeny Pinchuk  * HSA TLB Affinity structure and definitions
1795b5c4e40SEvgeny Pinchuk  */
1805b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_ENABLED	0x00000001
1815b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_DATA_TLB	0x00000002
1825b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_INST_TLB	0x00000004
1835b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_CPU_TLB	0x00000008
1845b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_SIMD_TLB	0x00000010
1855b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_RESERVED	0xffffffe0
1865b5c4e40SEvgeny Pinchuk 
1875b5c4e40SEvgeny Pinchuk #define CRAT_TLB_RESERVED_LENGTH 4
1885b5c4e40SEvgeny Pinchuk 
1895b5c4e40SEvgeny Pinchuk struct crat_subtype_tlb {
1905b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1915b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1925b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1935b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1945b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1955b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1965b5c4e40SEvgeny Pinchuk 	uint32_t	tlb_level;
1975b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_2mb;
1985b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_2mb;
1995b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_2mb;
2005b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_2mb;
2015b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_4k;
2025b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_4k;
2035b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_4k;
2045b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_4k;
2055b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_1gb;
2065b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_1gb;
2075b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_1gb;
2085b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_1gb;
2095b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_TLB_RESERVED_LENGTH];
2105b5c4e40SEvgeny Pinchuk };
2115b5c4e40SEvgeny Pinchuk 
2125b5c4e40SEvgeny Pinchuk /*
2135b5c4e40SEvgeny Pinchuk  * HSA CCompute/APU Affinity structure and definitions
2145b5c4e40SEvgeny Pinchuk  */
2155b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_FLAGS_ENABLED	0x00000001
2165b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_FLAGS_RESERVED	0xfffffffe
2175b5c4e40SEvgeny Pinchuk 
2185b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_RESERVED_LENGTH 16
2195b5c4e40SEvgeny Pinchuk 
2205b5c4e40SEvgeny Pinchuk struct crat_subtype_ccompute {
2215b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2225b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2235b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2245b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2255b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
2265b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
2275b5c4e40SEvgeny Pinchuk 	uint32_t	apu_size;
2285b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_CCOMPUTE_RESERVED_LENGTH];
2295b5c4e40SEvgeny Pinchuk };
2305b5c4e40SEvgeny Pinchuk 
2315b5c4e40SEvgeny Pinchuk /*
2325b5c4e40SEvgeny Pinchuk  * HSA IO Link Affinity structure and definitions
2335b5c4e40SEvgeny Pinchuk  */
2344f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_ENABLED		(1 << 0)
2354f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NON_COHERENT		(1 << 1)
2364f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT	(1 << 2)
2374f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT	(1 << 3)
2384f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA	(1 << 4)
23967f7cf9fSshaoyunl #define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL	(1 << 31)
24067f7cf9fSshaoyunl #define CRAT_IOLINK_FLAGS_RESERVED_MASK		0x7fffffe0
2415b5c4e40SEvgeny Pinchuk 
2425b5c4e40SEvgeny Pinchuk /*
2435b5c4e40SEvgeny Pinchuk  * IO interface types
2445b5c4e40SEvgeny Pinchuk  */
2455b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_UNDEFINED	0
2465b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_HYPERTRANSPORT	1
2475b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_PCIEXPRESS	2
2484f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_AMBA		3
2494f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_MIPI		4
2504f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_QPI_1_1	5
2514f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED1	6
2524f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED2	7
2534f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RAPID_IO	8
2544f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_INFINIBAND	9
2554f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED3	10
256aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_XGMI		11
257aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_XGOP		12
258aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_GZ		13
259aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_ETHERNET_RDMA	14
260aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_RDMA_OTHER	15
261aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_OTHER		16
2625b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_MAX		255
2635b5c4e40SEvgeny Pinchuk 
2645b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_RESERVED_LENGTH	24
2655b5c4e40SEvgeny Pinchuk 
2665b5c4e40SEvgeny Pinchuk struct crat_subtype_iolink {
2675b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2685b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2695b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2705b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2715b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain_from;
2725b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain_to;
2735b5c4e40SEvgeny Pinchuk 	uint8_t		io_interface_type;
2745b5c4e40SEvgeny Pinchuk 	uint8_t		version_major;
2755b5c4e40SEvgeny Pinchuk 	uint16_t	version_minor;
2765b5c4e40SEvgeny Pinchuk 	uint32_t	minimum_latency;
2775b5c4e40SEvgeny Pinchuk 	uint32_t	maximum_latency;
2785b5c4e40SEvgeny Pinchuk 	uint32_t	minimum_bandwidth_mbs;
2795b5c4e40SEvgeny Pinchuk 	uint32_t	maximum_bandwidth_mbs;
2805b5c4e40SEvgeny Pinchuk 	uint32_t	recommended_transfer_size;
2810fb0df03Sshaoyunl 	uint8_t		reserved2[CRAT_IOLINK_RESERVED_LENGTH - 1];
28292085240SJonathan Kim 	uint8_t		weight_xgmi;
2835b5c4e40SEvgeny Pinchuk };
2845b5c4e40SEvgeny Pinchuk 
2855b5c4e40SEvgeny Pinchuk /*
2865b5c4e40SEvgeny Pinchuk  * HSA generic sub-type header
2875b5c4e40SEvgeny Pinchuk  */
2885b5c4e40SEvgeny Pinchuk 
2895b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_FLAGS_ENABLED 0x00000001
2905b5c4e40SEvgeny Pinchuk 
2915b5c4e40SEvgeny Pinchuk struct crat_subtype_generic {
2925b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2935b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2945b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2955b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2965b5c4e40SEvgeny Pinchuk };
2975b5c4e40SEvgeny Pinchuk 
2985b5c4e40SEvgeny Pinchuk #pragma pack()
2995b5c4e40SEvgeny Pinchuk 
3008dc1db31SMukul Joshi struct kfd_node;
301520b8fb7SFelix Kuehling 
302c0cc999fSMa Jun /* Static table to describe GPU Cache information */
303c0cc999fSMa Jun struct kfd_gpu_cache_info {
304c0cc999fSMa Jun 	uint32_t	cache_size;
305c0cc999fSMa Jun 	uint32_t	cache_level;
3065a2df8ecSJoseph Greathouse 	uint32_t	cache_line_size;
307c0cc999fSMa Jun 	uint32_t	flags;
308c0cc999fSMa Jun 	/* Indicates how many Compute Units share this cache
309c0cc999fSMa Jun 	 * within a SA. Value = 1 indicates the cache is not shared
310c0cc999fSMa Jun 	 */
311c0cc999fSMa Jun 	uint32_t	num_cu_shared;
312c0cc999fSMa Jun };
3138dc1db31SMukul Joshi int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info);
314c0cc999fSMa Jun 
3158e05247dSHarish Kasiviswanathan void kfd_destroy_crat_image(void *crat_image);
3164f449311SHarish Kasiviswanathan int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
3174f449311SHarish Kasiviswanathan 			 uint32_t proximity_domain);
318520b8fb7SFelix Kuehling int kfd_create_crat_image_virtual(void **crat_image, size_t *size,
3198dc1db31SMukul Joshi 				  int flags, struct kfd_node *kdev,
320520b8fb7SFelix Kuehling 				  uint32_t proximity_domain);
321174de876SFelix Kuehling 
3225b5c4e40SEvgeny Pinchuk #endif /* KFD_CRAT_H_INCLUDED */
323