xref: /openbmc/linux/Documentation/devicetree/bindings/numa.txt (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
12bc4da1dSGanapatrao Kulkarni==============================================================================
22bc4da1dSGanapatrao KulkarniNUMA binding description.
32bc4da1dSGanapatrao Kulkarni==============================================================================
42bc4da1dSGanapatrao Kulkarni
52bc4da1dSGanapatrao Kulkarni==============================================================================
62bc4da1dSGanapatrao Kulkarni1 - Introduction
72bc4da1dSGanapatrao Kulkarni==============================================================================
82bc4da1dSGanapatrao Kulkarni
92bc4da1dSGanapatrao KulkarniSystems employing a Non Uniform Memory Access (NUMA) architecture contain
102bc4da1dSGanapatrao Kulkarnicollections of hardware resources including processors, memory, and I/O buses,
112bc4da1dSGanapatrao Kulkarnithat comprise what is commonly known as a NUMA node.
122bc4da1dSGanapatrao KulkarniProcessor accesses to memory within the local NUMA node is generally faster
132bc4da1dSGanapatrao Kulkarnithan processor accesses to memory outside of the local NUMA node.
142bc4da1dSGanapatrao KulkarniDT defines interfaces that allow the platform to convey NUMA node
152bc4da1dSGanapatrao Kulkarnitopology information to OS.
162bc4da1dSGanapatrao Kulkarni
172bc4da1dSGanapatrao Kulkarni==============================================================================
182bc4da1dSGanapatrao Kulkarni2 - numa-node-id
192bc4da1dSGanapatrao Kulkarni==============================================================================
202bc4da1dSGanapatrao Kulkarni
212bc4da1dSGanapatrao KulkarniFor the purpose of identification, each NUMA node is associated with a unique
222bc4da1dSGanapatrao Kulkarnitoken known as a node id. For the purpose of this binding
232bc4da1dSGanapatrao Kulkarnia node id is a 32-bit integer.
242bc4da1dSGanapatrao Kulkarni
252bc4da1dSGanapatrao KulkarniA device node is associated with a NUMA node by the presence of a
262bc4da1dSGanapatrao Kulkarninuma-node-id property which contains the node id of the device.
272bc4da1dSGanapatrao Kulkarni
282bc4da1dSGanapatrao KulkarniExample:
292bc4da1dSGanapatrao Kulkarni	/* numa node 0 */
302bc4da1dSGanapatrao Kulkarni	numa-node-id = <0>;
312bc4da1dSGanapatrao Kulkarni
322bc4da1dSGanapatrao Kulkarni	/* numa node 1 */
332bc4da1dSGanapatrao Kulkarni	numa-node-id = <1>;
342bc4da1dSGanapatrao Kulkarni
352bc4da1dSGanapatrao Kulkarni==============================================================================
362bc4da1dSGanapatrao Kulkarni3 - distance-map
372bc4da1dSGanapatrao Kulkarni==============================================================================
382bc4da1dSGanapatrao Kulkarni
392bc4da1dSGanapatrao KulkarniThe optional device tree node distance-map describes the relative
402bc4da1dSGanapatrao Kulkarnidistance (memory latency) between all numa nodes.
412bc4da1dSGanapatrao Kulkarni
422bc4da1dSGanapatrao Kulkarni- compatible : Should at least contain "numa-distance-map-v1".
432bc4da1dSGanapatrao Kulkarni
442bc4da1dSGanapatrao Kulkarni- distance-matrix
452bc4da1dSGanapatrao Kulkarni  This property defines a matrix to describe the relative distances
462bc4da1dSGanapatrao Kulkarni  between all numa nodes.
472bc4da1dSGanapatrao Kulkarni  It is represented as a list of node pairs and their relative distance.
482bc4da1dSGanapatrao Kulkarni
492bc4da1dSGanapatrao Kulkarni  Note:
502bc4da1dSGanapatrao Kulkarni	1. Each entry represents distance from first node to second node.
512bc4da1dSGanapatrao Kulkarni	The distances are equal in either direction.
522bc4da1dSGanapatrao Kulkarni	2. The distance from a node to self (local distance) is represented
532bc4da1dSGanapatrao Kulkarni	with value 10 and all internode distance should be represented with
542bc4da1dSGanapatrao Kulkarni	a value greater than 10.
552bc4da1dSGanapatrao Kulkarni	3. distance-matrix should have entries in lexicographical ascending
562bc4da1dSGanapatrao Kulkarni	order of nodes.
572bc4da1dSGanapatrao Kulkarni	4. There must be only one device node distance-map which must
582bc4da1dSGanapatrao Kulkarni	reside in the root node.
592bc4da1dSGanapatrao Kulkarni	5. If the distance-map node is not present, a default
602bc4da1dSGanapatrao Kulkarni	distance-matrix is used.
612bc4da1dSGanapatrao Kulkarni
622bc4da1dSGanapatrao KulkarniExample:
632bc4da1dSGanapatrao Kulkarni	4 nodes connected in mesh/ring topology as below,
642bc4da1dSGanapatrao Kulkarni
652bc4da1dSGanapatrao Kulkarni		0_______20______1
662bc4da1dSGanapatrao Kulkarni		|               |
672bc4da1dSGanapatrao Kulkarni		|               |
682bc4da1dSGanapatrao Kulkarni		20             20
692bc4da1dSGanapatrao Kulkarni		|               |
702bc4da1dSGanapatrao Kulkarni		|               |
712bc4da1dSGanapatrao Kulkarni		|_______________|
722bc4da1dSGanapatrao Kulkarni		3       20      2
732bc4da1dSGanapatrao Kulkarni
742bc4da1dSGanapatrao Kulkarni	if relative distance for each hop is 20,
752bc4da1dSGanapatrao Kulkarni	then internode distance would be,
762bc4da1dSGanapatrao Kulkarni	      0 -> 1 = 20
772bc4da1dSGanapatrao Kulkarni	      1 -> 2 = 20
782bc4da1dSGanapatrao Kulkarni	      2 -> 3 = 20
792bc4da1dSGanapatrao Kulkarni	      3 -> 0 = 20
802bc4da1dSGanapatrao Kulkarni	      0 -> 2 = 40
812bc4da1dSGanapatrao Kulkarni	      1 -> 3 = 40
822bc4da1dSGanapatrao Kulkarni
832bc4da1dSGanapatrao Kulkarni     and dt presentation for this distance matrix is,
842bc4da1dSGanapatrao Kulkarni
852bc4da1dSGanapatrao Kulkarni		distance-map {
862bc4da1dSGanapatrao Kulkarni			 compatible = "numa-distance-map-v1";
872bc4da1dSGanapatrao Kulkarni			 distance-matrix = <0 0  10>,
882bc4da1dSGanapatrao Kulkarni					   <0 1  20>,
892bc4da1dSGanapatrao Kulkarni					   <0 2  40>,
902bc4da1dSGanapatrao Kulkarni					   <0 3  20>,
912bc4da1dSGanapatrao Kulkarni					   <1 0  20>,
922bc4da1dSGanapatrao Kulkarni					   <1 1  10>,
932bc4da1dSGanapatrao Kulkarni					   <1 2  20>,
942bc4da1dSGanapatrao Kulkarni					   <1 3  40>,
952bc4da1dSGanapatrao Kulkarni					   <2 0  40>,
962bc4da1dSGanapatrao Kulkarni					   <2 1  20>,
972bc4da1dSGanapatrao Kulkarni					   <2 2  10>,
982bc4da1dSGanapatrao Kulkarni					   <2 3  20>,
992bc4da1dSGanapatrao Kulkarni					   <3 0  20>,
1002bc4da1dSGanapatrao Kulkarni					   <3 1  40>,
1012bc4da1dSGanapatrao Kulkarni					   <3 2  20>,
1022bc4da1dSGanapatrao Kulkarni					   <3 3  10>;
1032bc4da1dSGanapatrao Kulkarni		};
1042bc4da1dSGanapatrao Kulkarni
1052bc4da1dSGanapatrao Kulkarni==============================================================================
106*58ae0b51SGavin Shan4 - Empty memory nodes
107*58ae0b51SGavin Shan==============================================================================
108*58ae0b51SGavin Shan
109*58ae0b51SGavin ShanEmpty memory nodes, which no memory resides in, are allowed. There are no
110*58ae0b51SGavin Shandevice nodes for these empty memory nodes. However, the NUMA node IDs and
111*58ae0b51SGavin Shandistance maps are still valid and memory may be added into them through
112*58ae0b51SGavin Shanhotplug afterwards.
113*58ae0b51SGavin Shan
114*58ae0b51SGavin ShanExample:
115*58ae0b51SGavin Shan
116*58ae0b51SGavin Shan	memory@0 {
117*58ae0b51SGavin Shan		device_type = "memory";
118*58ae0b51SGavin Shan		reg = <0x0 0x0 0x0 0x80000000>;
119*58ae0b51SGavin Shan		numa-node-id = <0>;
120*58ae0b51SGavin Shan	};
121*58ae0b51SGavin Shan
122*58ae0b51SGavin Shan	memory@80000000 {
123*58ae0b51SGavin Shan		device_type = "memory";
124*58ae0b51SGavin Shan		reg = <0x0 0x80000000 0x0 0x80000000>;
125*58ae0b51SGavin Shan		numa-node-id = <1>;
126*58ae0b51SGavin Shan	};
127*58ae0b51SGavin Shan
128*58ae0b51SGavin Shan	/* Empty memory node 2 and 3 */
129*58ae0b51SGavin Shan	distance-map {
130*58ae0b51SGavin Shan		compatible = "numa-distance-map-v1";
131*58ae0b51SGavin Shan		distance-matrix = <0 0  10>,
132*58ae0b51SGavin Shan				  <0 1  20>,
133*58ae0b51SGavin Shan				  <0 2  40>,
134*58ae0b51SGavin Shan				  <0 3  20>,
135*58ae0b51SGavin Shan				  <1 0  20>,
136*58ae0b51SGavin Shan				  <1 1  10>,
137*58ae0b51SGavin Shan				  <1 2  20>,
138*58ae0b51SGavin Shan				  <1 3  40>,
139*58ae0b51SGavin Shan				  <2 0  40>,
140*58ae0b51SGavin Shan				  <2 1  20>,
141*58ae0b51SGavin Shan				  <2 2  10>,
142*58ae0b51SGavin Shan				  <2 3  20>,
143*58ae0b51SGavin Shan				  <3 0  20>,
144*58ae0b51SGavin Shan				  <3 1  40>,
145*58ae0b51SGavin Shan				  <3 2  20>,
146*58ae0b51SGavin Shan				  <3 3  10>;
147*58ae0b51SGavin Shan	};
148*58ae0b51SGavin Shan
149*58ae0b51SGavin Shan==============================================================================
150*58ae0b51SGavin Shan5 - Example dts
1512bc4da1dSGanapatrao Kulkarni==============================================================================
1522bc4da1dSGanapatrao Kulkarni
1532bc4da1dSGanapatrao KulkarniDual socket system consists of 2 boards connected through ccn bus and
1542bc4da1dSGanapatrao Kulkarnieach board having one socket/soc of 8 cpus, memory and pci bus.
1552bc4da1dSGanapatrao Kulkarni
1562bc4da1dSGanapatrao Kulkarni	memory@c00000 {
1572bc4da1dSGanapatrao Kulkarni		device_type = "memory";
1582bc4da1dSGanapatrao Kulkarni		reg = <0x0 0xc00000 0x0 0x80000000>;
1592bc4da1dSGanapatrao Kulkarni		/* node 0 */
1602bc4da1dSGanapatrao Kulkarni		numa-node-id = <0>;
1612bc4da1dSGanapatrao Kulkarni	};
1622bc4da1dSGanapatrao Kulkarni
1632bc4da1dSGanapatrao Kulkarni	memory@10000000000 {
1642bc4da1dSGanapatrao Kulkarni		device_type = "memory";
1652bc4da1dSGanapatrao Kulkarni		reg = <0x100 0x0 0x0 0x80000000>;
1662bc4da1dSGanapatrao Kulkarni		/* node 1 */
1672bc4da1dSGanapatrao Kulkarni		numa-node-id = <1>;
1682bc4da1dSGanapatrao Kulkarni	};
1692bc4da1dSGanapatrao Kulkarni
1702bc4da1dSGanapatrao Kulkarni	cpus {
1712bc4da1dSGanapatrao Kulkarni		#address-cells = <2>;
1722bc4da1dSGanapatrao Kulkarni		#size-cells = <0>;
1732bc4da1dSGanapatrao Kulkarni
1742bc4da1dSGanapatrao Kulkarni		cpu@0 {
1752bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
1762bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
1772bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x0>;
1782bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
1792bc4da1dSGanapatrao Kulkarni			/* node 0 */
1802bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
1812bc4da1dSGanapatrao Kulkarni		};
1822bc4da1dSGanapatrao Kulkarni		cpu@1 {
1832bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
1842bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
1852bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x1>;
1862bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
1872bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
1882bc4da1dSGanapatrao Kulkarni		};
1892bc4da1dSGanapatrao Kulkarni		cpu@2 {
1902bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
1912bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
1922bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x2>;
1932bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
1942bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
1952bc4da1dSGanapatrao Kulkarni		};
1962bc4da1dSGanapatrao Kulkarni		cpu@3 {
1972bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
1982bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
1992bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x3>;
2002bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2012bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
2022bc4da1dSGanapatrao Kulkarni		};
2032bc4da1dSGanapatrao Kulkarni		cpu@4 {
2042bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2052bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2062bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x4>;
2072bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2082bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
2092bc4da1dSGanapatrao Kulkarni		};
2102bc4da1dSGanapatrao Kulkarni		cpu@5 {
2112bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2122bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2132bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x5>;
2142bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2152bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
2162bc4da1dSGanapatrao Kulkarni		};
2172bc4da1dSGanapatrao Kulkarni		cpu@6 {
2182bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2192bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2202bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x6>;
2212bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2222bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
2232bc4da1dSGanapatrao Kulkarni		};
2242bc4da1dSGanapatrao Kulkarni		cpu@7 {
2252bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2262bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2272bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x7>;
2282bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2292bc4da1dSGanapatrao Kulkarni			numa-node-id = <0>;
2302bc4da1dSGanapatrao Kulkarni		};
2312bc4da1dSGanapatrao Kulkarni		cpu@8 {
2322bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2332bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2342bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x8>;
2352bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2362bc4da1dSGanapatrao Kulkarni			/* node 1 */
2372bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2382bc4da1dSGanapatrao Kulkarni		};
2392bc4da1dSGanapatrao Kulkarni		cpu@9 {
2402bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2412bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2422bc4da1dSGanapatrao Kulkarni			reg = <0x0 0x9>;
2432bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2442bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2452bc4da1dSGanapatrao Kulkarni		};
2462bc4da1dSGanapatrao Kulkarni		cpu@a {
2472bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2482bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2492bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xa>;
2502bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2512bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2522bc4da1dSGanapatrao Kulkarni		};
2532bc4da1dSGanapatrao Kulkarni		cpu@b {
2542bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2552bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2562bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xb>;
2572bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2582bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2592bc4da1dSGanapatrao Kulkarni		};
2602bc4da1dSGanapatrao Kulkarni		cpu@c {
2612bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2622bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2632bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xc>;
2642bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2652bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2662bc4da1dSGanapatrao Kulkarni		};
2672bc4da1dSGanapatrao Kulkarni		cpu@d {
2682bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2692bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2702bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xd>;
2712bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2722bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2732bc4da1dSGanapatrao Kulkarni		};
2742bc4da1dSGanapatrao Kulkarni		cpu@e {
2752bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2762bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2772bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xe>;
2782bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2792bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2802bc4da1dSGanapatrao Kulkarni		};
2812bc4da1dSGanapatrao Kulkarni		cpu@f {
2822bc4da1dSGanapatrao Kulkarni			device_type = "cpu";
2832bc4da1dSGanapatrao Kulkarni			compatible =  "arm,armv8";
2842bc4da1dSGanapatrao Kulkarni			reg = <0x0 0xf>;
2852bc4da1dSGanapatrao Kulkarni			enable-method = "psci";
2862bc4da1dSGanapatrao Kulkarni			numa-node-id = <1>;
2872bc4da1dSGanapatrao Kulkarni		};
2882bc4da1dSGanapatrao Kulkarni	};
2892bc4da1dSGanapatrao Kulkarni
2902bc4da1dSGanapatrao Kulkarni	pcie0: pcie0@848000000000 {
2912bc4da1dSGanapatrao Kulkarni		compatible = "arm,armv8";
2922bc4da1dSGanapatrao Kulkarni		device_type = "pci";
2932bc4da1dSGanapatrao Kulkarni		bus-range = <0 255>;
2942bc4da1dSGanapatrao Kulkarni		#size-cells = <2>;
2952bc4da1dSGanapatrao Kulkarni		#address-cells = <3>;
2962bc4da1dSGanapatrao Kulkarni		reg = <0x8480 0x00000000 0 0x10000000>;  /* Configuration space */
2972bc4da1dSGanapatrao Kulkarni		ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>;
2982bc4da1dSGanapatrao Kulkarni		/* node 0 */
2992bc4da1dSGanapatrao Kulkarni		numa-node-id = <0>;
3002bc4da1dSGanapatrao Kulkarni        };
3012bc4da1dSGanapatrao Kulkarni
3022bc4da1dSGanapatrao Kulkarni	pcie1: pcie1@948000000000 {
3032bc4da1dSGanapatrao Kulkarni		compatible = "arm,armv8";
3042bc4da1dSGanapatrao Kulkarni		device_type = "pci";
3052bc4da1dSGanapatrao Kulkarni		bus-range = <0 255>;
3062bc4da1dSGanapatrao Kulkarni		#size-cells = <2>;
3072bc4da1dSGanapatrao Kulkarni		#address-cells = <3>;
3082bc4da1dSGanapatrao Kulkarni		reg = <0x9480 0x00000000 0 0x10000000>;  /* Configuration space */
3092bc4da1dSGanapatrao Kulkarni		ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>;
3102bc4da1dSGanapatrao Kulkarni		/* node 1 */
3112bc4da1dSGanapatrao Kulkarni		numa-node-id = <1>;
3122bc4da1dSGanapatrao Kulkarni        };
3132bc4da1dSGanapatrao Kulkarni
3142bc4da1dSGanapatrao Kulkarni	distance-map {
3152bc4da1dSGanapatrao Kulkarni		compatible = "numa-distance-map-v1";
3162bc4da1dSGanapatrao Kulkarni		distance-matrix = <0 0 10>,
3172bc4da1dSGanapatrao Kulkarni				  <0 1 20>,
3182bc4da1dSGanapatrao Kulkarni				  <1 1 10>;
3192bc4da1dSGanapatrao Kulkarni	};
320