xref: /linux/drivers/gpu/drm/amd/amdkfd/kfd_crat.h (revision c771600c6af14749609b49565ffb4cac2959710d)
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 
45520b8fb7SFelix Kuehling /* Compute Unit flags */
46520b8fb7SFelix Kuehling #define COMPUTE_UNIT_CPU	(1 << 0)  /* Create Virtual CRAT for CPU */
47520b8fb7SFelix Kuehling #define COMPUTE_UNIT_GPU	(1 << 1)  /* Create Virtual CRAT for GPU */
48520b8fb7SFelix Kuehling 
495b5c4e40SEvgeny Pinchuk struct crat_header {
505b5c4e40SEvgeny Pinchuk 	uint32_t	signature;
515b5c4e40SEvgeny Pinchuk 	uint32_t	length;
525b5c4e40SEvgeny Pinchuk 	uint8_t		revision;
535b5c4e40SEvgeny Pinchuk 	uint8_t		checksum;
545b5c4e40SEvgeny Pinchuk 	uint8_t		oem_id[CRAT_OEMID_LENGTH];
555b5c4e40SEvgeny Pinchuk 	uint8_t		oem_table_id[CRAT_OEMTABLEID_LENGTH];
565b5c4e40SEvgeny Pinchuk 	uint32_t	oem_revision;
575b5c4e40SEvgeny Pinchuk 	uint32_t	creator_id;
585b5c4e40SEvgeny Pinchuk 	uint32_t	creator_revision;
595b5c4e40SEvgeny Pinchuk 	uint32_t	total_entries;
605b5c4e40SEvgeny Pinchuk 	uint16_t	num_domains;
615b5c4e40SEvgeny Pinchuk 	uint8_t		reserved[CRAT_RESERVED_LENGTH];
625b5c4e40SEvgeny Pinchuk };
635b5c4e40SEvgeny Pinchuk 
645b5c4e40SEvgeny Pinchuk /*
655b5c4e40SEvgeny Pinchuk  * The header structure is immediately followed by total_entries of the
665b5c4e40SEvgeny Pinchuk  * data definitions
675b5c4e40SEvgeny Pinchuk  */
685b5c4e40SEvgeny Pinchuk 
695b5c4e40SEvgeny Pinchuk /*
705b5c4e40SEvgeny Pinchuk  * The currently defined subtype entries in the CRAT
715b5c4e40SEvgeny Pinchuk  */
725b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_COMPUTEUNIT_AFFINITY	0
735b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_MEMORY_AFFINITY		1
745b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_CACHE_AFFINITY		2
755b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_TLB_AFFINITY		3
765b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_CCOMPUTE_AFFINITY		4
775b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_IOLINK_AFFINITY		5
785b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_MAX			6
795b5c4e40SEvgeny Pinchuk 
800752e66eSMukul Joshi /*
810752e66eSMukul Joshi  * Do not change the value of CRAT_SIBLINGMAP_SIZE from 32
820752e66eSMukul Joshi  * as it breaks the ABI.
830752e66eSMukul Joshi  */
845b5c4e40SEvgeny Pinchuk #define CRAT_SIBLINGMAP_SIZE	32
855b5c4e40SEvgeny Pinchuk 
865b5c4e40SEvgeny Pinchuk /*
875b5c4e40SEvgeny Pinchuk  * ComputeUnit Affinity structure and definitions
885b5c4e40SEvgeny Pinchuk  */
895b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_ENABLED		0x00000001
905b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_HOT_PLUGGABLE	0x00000002
915b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_CPU_PRESENT	0x00000004
925b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_GPU_PRESENT	0x00000008
935b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_IOMMU_PRESENT	0x00000010
945b5c4e40SEvgeny Pinchuk #define CRAT_CU_FLAGS_RESERVED		0xffffffe0
955b5c4e40SEvgeny Pinchuk 
965b5c4e40SEvgeny Pinchuk #define CRAT_COMPUTEUNIT_RESERVED_LENGTH 4
975b5c4e40SEvgeny Pinchuk 
985b5c4e40SEvgeny Pinchuk struct crat_subtype_computeunit {
995b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1005b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1015b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1025b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1035b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain;
1045b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1055b5c4e40SEvgeny Pinchuk 	uint16_t	num_cpu_cores;
1065b5c4e40SEvgeny Pinchuk 	uint16_t	num_simd_cores;
1075b5c4e40SEvgeny Pinchuk 	uint16_t	max_waves_simd;
1085b5c4e40SEvgeny Pinchuk 	uint16_t	io_count;
1095b5c4e40SEvgeny Pinchuk 	uint16_t	hsa_capability;
1105b5c4e40SEvgeny Pinchuk 	uint16_t	lds_size_in_kb;
1115b5c4e40SEvgeny Pinchuk 	uint8_t		wave_front_size;
1125b5c4e40SEvgeny Pinchuk 	uint8_t		num_banks;
1135b5c4e40SEvgeny Pinchuk 	uint16_t	micro_engine_id;
1143a87177eSHarish Kasiviswanathan 	uint8_t		array_count;
1155b5c4e40SEvgeny Pinchuk 	uint8_t		num_cu_per_array;
1165b5c4e40SEvgeny Pinchuk 	uint8_t		num_simd_per_cu;
1175b5c4e40SEvgeny Pinchuk 	uint8_t		max_slots_scatch_cu;
1185b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_COMPUTEUNIT_RESERVED_LENGTH];
1195b5c4e40SEvgeny Pinchuk };
1205b5c4e40SEvgeny Pinchuk 
1215b5c4e40SEvgeny Pinchuk /*
1225b5c4e40SEvgeny Pinchuk  * HSA Memory Affinity structure and definitions
1235b5c4e40SEvgeny Pinchuk  */
1245b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_ENABLED		0x00000001
1255b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_HOT_PLUGGABLE	0x00000002
1265b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_NON_VOLATILE	0x00000004
1275b5c4e40SEvgeny Pinchuk #define CRAT_MEM_FLAGS_RESERVED		0xfffffff8
1285b5c4e40SEvgeny Pinchuk 
1295b5c4e40SEvgeny Pinchuk #define CRAT_MEMORY_RESERVED_LENGTH 8
1305b5c4e40SEvgeny Pinchuk 
1315b5c4e40SEvgeny Pinchuk struct crat_subtype_memory {
1325b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1335b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1345b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1355b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
136174de876SFelix Kuehling 	uint32_t	proximity_domain;
1375b5c4e40SEvgeny Pinchuk 	uint32_t	base_addr_low;
1385b5c4e40SEvgeny Pinchuk 	uint32_t	base_addr_high;
1395b5c4e40SEvgeny Pinchuk 	uint32_t	length_low;
1405b5c4e40SEvgeny Pinchuk 	uint32_t	length_high;
1415b5c4e40SEvgeny Pinchuk 	uint32_t	width;
1423a87177eSHarish Kasiviswanathan 	uint8_t		visibility_type; /* for virtual (dGPU) CRAT */
1433a87177eSHarish Kasiviswanathan 	uint8_t		reserved2[CRAT_MEMORY_RESERVED_LENGTH - 1];
1445b5c4e40SEvgeny Pinchuk };
1455b5c4e40SEvgeny Pinchuk 
1465b5c4e40SEvgeny Pinchuk /*
1475b5c4e40SEvgeny Pinchuk  * HSA Cache Affinity structure and definitions
1485b5c4e40SEvgeny Pinchuk  */
1495b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_ENABLED	0x00000001
1505b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_DATA_CACHE	0x00000002
1515b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_INST_CACHE	0x00000004
1525b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_CPU_CACHE	0x00000008
1535b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_SIMD_CACHE	0x00000010
1545b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_FLAGS_RESERVED	0xffffffe0
1555b5c4e40SEvgeny Pinchuk 
1565b5c4e40SEvgeny Pinchuk #define CRAT_CACHE_RESERVED_LENGTH 8
1575b5c4e40SEvgeny Pinchuk 
1585b5c4e40SEvgeny Pinchuk struct crat_subtype_cache {
1595b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1605b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1615b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1625b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1635b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1645b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1655b5c4e40SEvgeny Pinchuk 	uint32_t	cache_size;
1665b5c4e40SEvgeny Pinchuk 	uint8_t		cache_level;
1675b5c4e40SEvgeny Pinchuk 	uint8_t		lines_per_tag;
1685b5c4e40SEvgeny Pinchuk 	uint16_t	cache_line_size;
1695b5c4e40SEvgeny Pinchuk 	uint8_t		associativity;
1705b5c4e40SEvgeny Pinchuk 	uint8_t		cache_properties;
1715b5c4e40SEvgeny Pinchuk 	uint16_t	cache_latency;
1725b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_CACHE_RESERVED_LENGTH];
1735b5c4e40SEvgeny Pinchuk };
1745b5c4e40SEvgeny Pinchuk 
1755b5c4e40SEvgeny Pinchuk /*
1765b5c4e40SEvgeny Pinchuk  * HSA TLB Affinity structure and definitions
1775b5c4e40SEvgeny Pinchuk  */
1785b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_ENABLED	0x00000001
1795b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_DATA_TLB	0x00000002
1805b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_INST_TLB	0x00000004
1815b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_CPU_TLB	0x00000008
1825b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_SIMD_TLB	0x00000010
1835b5c4e40SEvgeny Pinchuk #define CRAT_TLB_FLAGS_RESERVED	0xffffffe0
1845b5c4e40SEvgeny Pinchuk 
1855b5c4e40SEvgeny Pinchuk #define CRAT_TLB_RESERVED_LENGTH 4
1865b5c4e40SEvgeny Pinchuk 
1875b5c4e40SEvgeny Pinchuk struct crat_subtype_tlb {
1885b5c4e40SEvgeny Pinchuk 	uint8_t		type;
1895b5c4e40SEvgeny Pinchuk 	uint8_t		length;
1905b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
1915b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
1925b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
1935b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1945b5c4e40SEvgeny Pinchuk 	uint32_t	tlb_level;
1955b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_2mb;
1965b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_2mb;
1975b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_2mb;
1985b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_2mb;
1995b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_4k;
2005b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_4k;
2015b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_4k;
2025b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_4k;
2035b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_associativity_1gb;
2045b5c4e40SEvgeny Pinchuk 	uint8_t		data_tlb_size_1gb;
2055b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_associativity_1gb;
2065b5c4e40SEvgeny Pinchuk 	uint8_t		instruction_tlb_size_1gb;
2075b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_TLB_RESERVED_LENGTH];
2085b5c4e40SEvgeny Pinchuk };
2095b5c4e40SEvgeny Pinchuk 
2105b5c4e40SEvgeny Pinchuk /*
2115b5c4e40SEvgeny Pinchuk  * HSA CCompute/APU Affinity structure and definitions
2125b5c4e40SEvgeny Pinchuk  */
2135b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_FLAGS_ENABLED	0x00000001
2145b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_FLAGS_RESERVED	0xfffffffe
2155b5c4e40SEvgeny Pinchuk 
2165b5c4e40SEvgeny Pinchuk #define CRAT_CCOMPUTE_RESERVED_LENGTH 16
2175b5c4e40SEvgeny Pinchuk 
2185b5c4e40SEvgeny Pinchuk struct crat_subtype_ccompute {
2195b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2205b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2215b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2225b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2235b5c4e40SEvgeny Pinchuk 	uint32_t	processor_id_low;
2245b5c4e40SEvgeny Pinchuk 	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
2255b5c4e40SEvgeny Pinchuk 	uint32_t	apu_size;
2265b5c4e40SEvgeny Pinchuk 	uint8_t		reserved2[CRAT_CCOMPUTE_RESERVED_LENGTH];
2275b5c4e40SEvgeny Pinchuk };
2285b5c4e40SEvgeny Pinchuk 
2295b5c4e40SEvgeny Pinchuk /*
2305b5c4e40SEvgeny Pinchuk  * HSA IO Link Affinity structure and definitions
2315b5c4e40SEvgeny Pinchuk  */
2324f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_ENABLED		(1 << 0)
2334f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NON_COHERENT		(1 << 1)
2344f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT	(1 << 2)
2354f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT	(1 << 3)
2364f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA	(1 << 4)
23767f7cf9fSshaoyunl #define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL	(1 << 31)
23867f7cf9fSshaoyunl #define CRAT_IOLINK_FLAGS_RESERVED_MASK		0x7fffffe0
2395b5c4e40SEvgeny Pinchuk 
2405b5c4e40SEvgeny Pinchuk /*
2415b5c4e40SEvgeny Pinchuk  * IO interface types
2425b5c4e40SEvgeny Pinchuk  */
2435b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_UNDEFINED	0
2445b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_HYPERTRANSPORT	1
2455b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_PCIEXPRESS	2
2464f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_AMBA		3
2474f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_MIPI		4
2484f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_QPI_1_1	5
2494f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED1	6
2504f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED2	7
2514f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RAPID_IO	8
2524f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_INFINIBAND	9
2534f2937bfSHarish Kasiviswanathan #define CRAT_IOLINK_TYPE_RESERVED3	10
254aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_XGMI		11
255aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_XGOP		12
256aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_GZ		13
257aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_ETHERNET_RDMA	14
258aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_RDMA_OTHER	15
259aa64ca38SShaoyun Liu #define CRAT_IOLINK_TYPE_OTHER		16
2605b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_TYPE_MAX		255
2615b5c4e40SEvgeny Pinchuk 
2625b5c4e40SEvgeny Pinchuk #define CRAT_IOLINK_RESERVED_LENGTH	24
2635b5c4e40SEvgeny Pinchuk 
2645b5c4e40SEvgeny Pinchuk struct crat_subtype_iolink {
2655b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2665b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2675b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2685b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2695b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain_from;
2705b5c4e40SEvgeny Pinchuk 	uint32_t	proximity_domain_to;
2715b5c4e40SEvgeny Pinchuk 	uint8_t		io_interface_type;
2725b5c4e40SEvgeny Pinchuk 	uint8_t		version_major;
2735b5c4e40SEvgeny Pinchuk 	uint16_t	version_minor;
2745b5c4e40SEvgeny Pinchuk 	uint32_t	minimum_latency;
2755b5c4e40SEvgeny Pinchuk 	uint32_t	maximum_latency;
2765b5c4e40SEvgeny Pinchuk 	uint32_t	minimum_bandwidth_mbs;
2775b5c4e40SEvgeny Pinchuk 	uint32_t	maximum_bandwidth_mbs;
2785b5c4e40SEvgeny Pinchuk 	uint32_t	recommended_transfer_size;
2790fb0df03Sshaoyunl 	uint8_t		reserved2[CRAT_IOLINK_RESERVED_LENGTH - 1];
28092085240SJonathan Kim 	uint8_t		weight_xgmi;
2815b5c4e40SEvgeny Pinchuk };
2825b5c4e40SEvgeny Pinchuk 
2835b5c4e40SEvgeny Pinchuk /*
2845b5c4e40SEvgeny Pinchuk  * HSA generic sub-type header
2855b5c4e40SEvgeny Pinchuk  */
2865b5c4e40SEvgeny Pinchuk 
2875b5c4e40SEvgeny Pinchuk #define CRAT_SUBTYPE_FLAGS_ENABLED 0x00000001
2885b5c4e40SEvgeny Pinchuk 
2895b5c4e40SEvgeny Pinchuk struct crat_subtype_generic {
2905b5c4e40SEvgeny Pinchuk 	uint8_t		type;
2915b5c4e40SEvgeny Pinchuk 	uint8_t		length;
2925b5c4e40SEvgeny Pinchuk 	uint16_t	reserved;
2935b5c4e40SEvgeny Pinchuk 	uint32_t	flags;
2945b5c4e40SEvgeny Pinchuk };
2955b5c4e40SEvgeny Pinchuk 
2965b5c4e40SEvgeny Pinchuk #pragma pack()
2975b5c4e40SEvgeny Pinchuk 
2988dc1db31SMukul Joshi struct kfd_node;
299520b8fb7SFelix Kuehling 
300c0cc999fSMa Jun /* Static table to describe GPU Cache information */
301c0cc999fSMa Jun struct kfd_gpu_cache_info {
302c0cc999fSMa Jun 	uint32_t	cache_size;
303c0cc999fSMa Jun 	uint32_t	cache_level;
3045a2df8ecSJoseph Greathouse 	uint32_t	cache_line_size;
305c0cc999fSMa Jun 	uint32_t	flags;
306c0cc999fSMa Jun 	/* Indicates how many Compute Units share this cache
307c0cc999fSMa Jun 	 * within a SA. Value = 1 indicates the cache is not shared
308c0cc999fSMa Jun 	 */
309c0cc999fSMa Jun 	uint32_t	num_cu_shared;
310c0cc999fSMa Jun };
3118dc1db31SMukul Joshi int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info);
312c0cc999fSMa Jun 
3138e05247dSHarish Kasiviswanathan void kfd_destroy_crat_image(void *crat_image);
3144f449311SHarish Kasiviswanathan int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
3154f449311SHarish Kasiviswanathan 			 uint32_t proximity_domain);
316520b8fb7SFelix Kuehling int kfd_create_crat_image_virtual(void **crat_image, size_t *size,
3178dc1db31SMukul Joshi 				  int flags, struct kfd_node *kdev,
318520b8fb7SFelix Kuehling 				  uint32_t proximity_domain);
319174de876SFelix Kuehling 
3205b5c4e40SEvgeny Pinchuk #endif /* KFD_CRAT_H_INCLUDED */
321