Back to home page

OSCL-LXR

 
 

    


0001 ==============================================================================
0002 NUMA binding description.
0003 ==============================================================================
0004 
0005 ==============================================================================
0006 1 - Introduction
0007 ==============================================================================
0008 
0009 Systems employing a Non Uniform Memory Access (NUMA) architecture contain
0010 collections of hardware resources including processors, memory, and I/O buses,
0011 that comprise what is commonly known as a NUMA node.
0012 Processor accesses to memory within the local NUMA node is generally faster
0013 than processor accesses to memory outside of the local NUMA node.
0014 DT defines interfaces that allow the platform to convey NUMA node
0015 topology information to OS.
0016 
0017 ==============================================================================
0018 2 - numa-node-id
0019 ==============================================================================
0020 
0021 For the purpose of identification, each NUMA node is associated with a unique
0022 token known as a node id. For the purpose of this binding
0023 a node id is a 32-bit integer.
0024 
0025 A device node is associated with a NUMA node by the presence of a
0026 numa-node-id property which contains the node id of the device.
0027 
0028 Example:
0029         /* numa node 0 */
0030         numa-node-id = <0>;
0031 
0032         /* numa node 1 */
0033         numa-node-id = <1>;
0034 
0035 ==============================================================================
0036 3 - distance-map
0037 ==============================================================================
0038 
0039 The optional device tree node distance-map describes the relative
0040 distance (memory latency) between all numa nodes.
0041 
0042 - compatible : Should at least contain "numa-distance-map-v1".
0043 
0044 - distance-matrix
0045   This property defines a matrix to describe the relative distances
0046   between all numa nodes.
0047   It is represented as a list of node pairs and their relative distance.
0048 
0049   Note:
0050         1. Each entry represents distance from first node to second node.
0051         The distances are equal in either direction.
0052         2. The distance from a node to self (local distance) is represented
0053         with value 10 and all internode distance should be represented with
0054         a value greater than 10.
0055         3. distance-matrix should have entries in lexicographical ascending
0056         order of nodes.
0057         4. There must be only one device node distance-map which must
0058         reside in the root node.
0059         5. If the distance-map node is not present, a default
0060         distance-matrix is used.
0061 
0062 Example:
0063         4 nodes connected in mesh/ring topology as below,
0064 
0065                 0_______20______1
0066                 |               |
0067                 |               |
0068                 20             20
0069                 |               |
0070                 |               |
0071                 |_______________|
0072                 3       20      2
0073 
0074         if relative distance for each hop is 20,
0075         then internode distance would be,
0076               0 -> 1 = 20
0077               1 -> 2 = 20
0078               2 -> 3 = 20
0079               3 -> 0 = 20
0080               0 -> 2 = 40
0081               1 -> 3 = 40
0082 
0083      and dt presentation for this distance matrix is,
0084 
0085                 distance-map {
0086                          compatible = "numa-distance-map-v1";
0087                          distance-matrix = <0 0  10>,
0088                                            <0 1  20>,
0089                                            <0 2  40>,
0090                                            <0 3  20>,
0091                                            <1 0  20>,
0092                                            <1 1  10>,
0093                                            <1 2  20>,
0094                                            <1 3  40>,
0095                                            <2 0  40>,
0096                                            <2 1  20>,
0097                                            <2 2  10>,
0098                                            <2 3  20>,
0099                                            <3 0  20>,
0100                                            <3 1  40>,
0101                                            <3 2  20>,
0102                                            <3 3  10>;
0103                 };
0104 
0105 ==============================================================================
0106 4 - Empty memory nodes
0107 ==============================================================================
0108 
0109 Empty memory nodes, which no memory resides in, are allowed. There are no
0110 device nodes for these empty memory nodes. However, the NUMA node IDs and
0111 distance maps are still valid and memory may be added into them through
0112 hotplug afterwards.
0113 
0114 Example:
0115 
0116         memory@0 {
0117                 device_type = "memory";
0118                 reg = <0x0 0x0 0x0 0x80000000>;
0119                 numa-node-id = <0>;
0120         };
0121 
0122         memory@80000000 {
0123                 device_type = "memory";
0124                 reg = <0x0 0x80000000 0x0 0x80000000>;
0125                 numa-node-id = <1>;
0126         };
0127 
0128         /* Empty memory node 2 and 3 */
0129         distance-map {
0130                 compatible = "numa-distance-map-v1";
0131                 distance-matrix = <0 0  10>,
0132                                   <0 1  20>,
0133                                   <0 2  40>,
0134                                   <0 3  20>,
0135                                   <1 0  20>,
0136                                   <1 1  10>,
0137                                   <1 2  20>,
0138                                   <1 3  40>,
0139                                   <2 0  40>,
0140                                   <2 1  20>,
0141                                   <2 2  10>,
0142                                   <2 3  20>,
0143                                   <3 0  20>,
0144                                   <3 1  40>,
0145                                   <3 2  20>,
0146                                   <3 3  10>;
0147         };
0148 
0149 ==============================================================================
0150 5 - Example dts
0151 ==============================================================================
0152 
0153 Dual socket system consists of 2 boards connected through ccn bus and
0154 each board having one socket/soc of 8 cpus, memory and pci bus.
0155 
0156         memory@c00000 {
0157                 device_type = "memory";
0158                 reg = <0x0 0xc00000 0x0 0x80000000>;
0159                 /* node 0 */
0160                 numa-node-id = <0>;
0161         };
0162 
0163         memory@10000000000 {
0164                 device_type = "memory";
0165                 reg = <0x100 0x0 0x0 0x80000000>;
0166                 /* node 1 */
0167                 numa-node-id = <1>;
0168         };
0169 
0170         cpus {
0171                 #address-cells = <2>;
0172                 #size-cells = <0>;
0173 
0174                 cpu@0 {
0175                         device_type = "cpu";
0176                         compatible =  "arm,armv8";
0177                         reg = <0x0 0x0>;
0178                         enable-method = "psci";
0179                         /* node 0 */
0180                         numa-node-id = <0>;
0181                 };
0182                 cpu@1 {
0183                         device_type = "cpu";
0184                         compatible =  "arm,armv8";
0185                         reg = <0x0 0x1>;
0186                         enable-method = "psci";
0187                         numa-node-id = <0>;
0188                 };
0189                 cpu@2 {
0190                         device_type = "cpu";
0191                         compatible =  "arm,armv8";
0192                         reg = <0x0 0x2>;
0193                         enable-method = "psci";
0194                         numa-node-id = <0>;
0195                 };
0196                 cpu@3 {
0197                         device_type = "cpu";
0198                         compatible =  "arm,armv8";
0199                         reg = <0x0 0x3>;
0200                         enable-method = "psci";
0201                         numa-node-id = <0>;
0202                 };
0203                 cpu@4 {
0204                         device_type = "cpu";
0205                         compatible =  "arm,armv8";
0206                         reg = <0x0 0x4>;
0207                         enable-method = "psci";
0208                         numa-node-id = <0>;
0209                 };
0210                 cpu@5 {
0211                         device_type = "cpu";
0212                         compatible =  "arm,armv8";
0213                         reg = <0x0 0x5>;
0214                         enable-method = "psci";
0215                         numa-node-id = <0>;
0216                 };
0217                 cpu@6 {
0218                         device_type = "cpu";
0219                         compatible =  "arm,armv8";
0220                         reg = <0x0 0x6>;
0221                         enable-method = "psci";
0222                         numa-node-id = <0>;
0223                 };
0224                 cpu@7 {
0225                         device_type = "cpu";
0226                         compatible =  "arm,armv8";
0227                         reg = <0x0 0x7>;
0228                         enable-method = "psci";
0229                         numa-node-id = <0>;
0230                 };
0231                 cpu@8 {
0232                         device_type = "cpu";
0233                         compatible =  "arm,armv8";
0234                         reg = <0x0 0x8>;
0235                         enable-method = "psci";
0236                         /* node 1 */
0237                         numa-node-id = <1>;
0238                 };
0239                 cpu@9 {
0240                         device_type = "cpu";
0241                         compatible =  "arm,armv8";
0242                         reg = <0x0 0x9>;
0243                         enable-method = "psci";
0244                         numa-node-id = <1>;
0245                 };
0246                 cpu@a {
0247                         device_type = "cpu";
0248                         compatible =  "arm,armv8";
0249                         reg = <0x0 0xa>;
0250                         enable-method = "psci";
0251                         numa-node-id = <1>;
0252                 };
0253                 cpu@b {
0254                         device_type = "cpu";
0255                         compatible =  "arm,armv8";
0256                         reg = <0x0 0xb>;
0257                         enable-method = "psci";
0258                         numa-node-id = <1>;
0259                 };
0260                 cpu@c {
0261                         device_type = "cpu";
0262                         compatible =  "arm,armv8";
0263                         reg = <0x0 0xc>;
0264                         enable-method = "psci";
0265                         numa-node-id = <1>;
0266                 };
0267                 cpu@d {
0268                         device_type = "cpu";
0269                         compatible =  "arm,armv8";
0270                         reg = <0x0 0xd>;
0271                         enable-method = "psci";
0272                         numa-node-id = <1>;
0273                 };
0274                 cpu@e {
0275                         device_type = "cpu";
0276                         compatible =  "arm,armv8";
0277                         reg = <0x0 0xe>;
0278                         enable-method = "psci";
0279                         numa-node-id = <1>;
0280                 };
0281                 cpu@f {
0282                         device_type = "cpu";
0283                         compatible =  "arm,armv8";
0284                         reg = <0x0 0xf>;
0285                         enable-method = "psci";
0286                         numa-node-id = <1>;
0287                 };
0288         };
0289 
0290         pcie0: pcie0@848000000000 {
0291                 compatible = "arm,armv8";
0292                 device_type = "pci";
0293                 bus-range = <0 255>;
0294                 #size-cells = <2>;
0295                 #address-cells = <3>;
0296                 reg = <0x8480 0x00000000 0 0x10000000>;  /* Configuration space */
0297                 ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>;
0298                 /* node 0 */
0299                 numa-node-id = <0>;
0300         };
0301 
0302         pcie1: pcie1@948000000000 {
0303                 compatible = "arm,armv8";
0304                 device_type = "pci";
0305                 bus-range = <0 255>;
0306                 #size-cells = <2>;
0307                 #address-cells = <3>;
0308                 reg = <0x9480 0x00000000 0 0x10000000>;  /* Configuration space */
0309                 ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>;
0310                 /* node 1 */
0311                 numa-node-id = <1>;
0312         };
0313 
0314         distance-map {
0315                 compatible = "numa-distance-map-v1";
0316                 distance-matrix = <0 0 10>,
0317                                   <0 1 20>,
0318                                   <1 1 10>;
0319         };