summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/xeon_sp/include/soc/numa.h
blob: aba3f0926bc32e1ecc99d10ac277bd10cc44f8c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* SPDX-License-Identifier: GPL-2.0-only */

/*
 * This header file defines data structures and operations related
 * to NUMA proximity domains.
 */
#ifndef NUMA_H
#define NUMA_H

#include <types.h>

enum proximity_domain_type {
	PD_TYPE_PROCESSOR,
	/*
	 * The Generic Initiator concept is used in ACPI spec. A typical
	 * Generic Initiator domain is a CXL memory device.
	 */
	PD_TYPE_GENERIC_INITIATOR,
};

/*
 * This proximity domain structure records all data related to
 * a proximity doamin needed for following purpose:
 * a. Device resource allocation. IIO stack involving CXL device
 *    needs to have different resource allocation method.
 * b. e820 table setup. For example, CXL memory region may need to
 *    be set as soft reserved, since it is specific purpose memory.
 * c. ACPI NUMA tables (SRAT, SLIT, HMAT).
 */
struct proximity_domain {
	enum proximity_domain_type pd_type;
	/*
	 * For processor domain, this holds the socket #.
	 * For generic initiator domain, this indicates to which socket the
	 * device is attached to. CXL 2.0 allows interleaving within and between
	 * sockets, so we need a bitmap.
	 */
	uint8_t socket_bitmap;
	/* Relative distances (memory latency) from all domains */
	uint8_t *distances;
	/*
	 * Below fields are set to 0 for processor domains.
	 */
	struct device *dev;
	uint32_t base; /* Memory region base address in the unit of 64MB */
	uint32_t size; /* Memory region size in the unit of 64MB */
};

struct proximity_domains {
	uint8_t num_pds;
	struct proximity_domain *pds;
};

extern struct proximity_domains pds;

void dump_pds(void);
void fill_pds(void);

/*
 * Return the total size of memory regions in generic initiator affinity
 * domains.  The size is in unit of 64MB.
 */
uint32_t get_generic_initiator_mem_size(void);

#endif /* NUMA_H */