| 1 |
Dom0 kernel and ramdisk modules |
| 2 |
================================ |
| 3 |
|
| 4 |
Xen is passed the dom0 kernel and initrd via a reference in the /chosen |
| 5 |
node of the device tree. |
| 6 |
|
| 7 |
Each node contains the following properties: |
| 8 |
|
| 9 |
- compatible |
| 10 |
|
| 11 |
Must always include at least the generic compatiblity string: |
| 12 |
|
| 13 |
"multiboot,module" |
| 14 |
|
| 15 |
Optionally a more specific compatible string may be used in |
| 16 |
addition to the above. One of: |
| 17 |
|
| 18 |
- "multiboot,kernel" -- the dom0 kernel |
| 19 |
- "multiboot,ramdisk" -- the dom0 ramdisk |
| 20 |
- "xen,xsm-policy" -- XSM policy blob |
| 21 |
|
| 22 |
It is normally recommended to include a more specific |
| 23 |
compatible string (if one applies) in addition to the generic |
| 24 |
string (which must always be present). |
| 25 |
|
| 26 |
Xen will assume that the first module which lacks a more |
| 27 |
specific compatible string is a "multiboot,kernel". |
| 28 |
|
| 29 |
Xen will examine each module, starting from the second |
| 30 |
module that lacks a specific compatible string. Xen will |
| 31 |
check each such module for the XSM Magic number: |
| 32 |
|
| 33 |
- For a module which has the XSM Magic number: it will be |
| 34 |
treated by Xen as if its compatible string was |
| 35 |
"xen,xsm-policy"; |
| 36 |
|
| 37 |
- For a module which does not have the XSM Magic: the second |
| 38 |
module lacking a compatible string will be treated by Xen as |
| 39 |
if its compatible string was "multiboot,ramdisk"; for the |
| 40 |
third and subsequent modules which lack a specific |
| 41 |
compatible string, Xen will not apply any special treatment. |
| 42 |
|
| 43 |
This means if the ramdisk module is present and does not have the |
| 44 |
compatible string "multiboot,ramdisk", then it must always be the |
| 45 |
second module. |
| 46 |
|
| 47 |
Note: This XSM Magic detection behavior was introduced by Xen 4.7. |
| 48 |
Xen 4.6 (and downwards) still requires the XSM module to have the |
| 49 |
compatible string "xen,xsm-policy". |
| 50 |
|
| 51 |
Xen 4.4 supported a different set of legacy compatible strings |
| 52 |
which remain supported such that systems supporting both 4.4 |
| 53 |
and later can use a single DTB. |
| 54 |
However when booting Xen using UEFI, the legacy compatible |
| 55 |
strings are not supported. |
| 56 |
|
| 57 |
- "xen,multiboot-module" equivalent to "multiboot,module" |
| 58 |
- "xen,linux-zimage" equivalent to "multiboot,kernel" |
| 59 |
- "xen,linux-initrd" equivalent to "multiboot,ramdisk" |
| 60 |
|
| 61 |
For compatibility with Xen 4.4 the more specific "xen,linux-*" |
| 62 |
names are non-optional and must be included. |
| 63 |
|
| 64 |
- reg |
| 65 |
|
| 66 |
Specifies the physical address of the module in RAM and the |
| 67 |
length of the module. |
| 68 |
|
| 69 |
- bootargs (optional) |
| 70 |
|
| 71 |
Command line associated with this module. See below for the |
| 72 |
priority of this field vs. other mechanisms of specifying the |
| 73 |
bootargs for the kernel. |
| 74 |
|
| 75 |
- xen,uefi-binary (UEFI boot only) |
| 76 |
|
| 77 |
String property that specifies the file name to be loaded by the UEFI |
| 78 |
boot for this module. If this is specified, there is no need to specify |
| 79 |
the reg property because it will be created by the UEFI stub on boot. |
| 80 |
This option is needed only when UEFI boot is used, the node needs to be |
| 81 |
compatible with multiboot,kernel or multiboot,ramdisk. |
| 82 |
|
| 83 |
Examples |
| 84 |
======== |
| 85 |
|
| 86 |
A boot module of unspecified type: |
| 87 |
|
| 88 |
module@0xc0000000 { |
| 89 |
compatible = "multiboot,module"; |
| 90 |
reg = <0xc0000000 0x1234>; |
| 91 |
bootargs = "..."; |
| 92 |
}; |
| 93 |
|
| 94 |
A boot module containing a ramdisk: |
| 95 |
|
| 96 |
module@0xd0000000 { |
| 97 |
compatible = "multiboot,ramdisk", "multiboot,module"; |
| 98 |
reg = <0xd0000000 0x5678>; |
| 99 |
}; |
| 100 |
|
| 101 |
The previous examples are compatible with Xen 4.5+ only. |
| 102 |
|
| 103 |
To be compatible with Xen 4.4 as well use the legacy names: |
| 104 |
|
| 105 |
module@0xd0000000 { |
| 106 |
compatible = "xen,linux-initrd", "xen,multiboot-module"; |
| 107 |
reg = <0xd0000000 0x5678>; |
| 108 |
}; |
| 109 |
|
| 110 |
Command lines |
| 111 |
============= |
| 112 |
|
| 113 |
Xen also checks for properties directly under /chosen to find suitable command |
| 114 |
lines for Xen and Dom0. The logic is the following: |
| 115 |
|
| 116 |
- If xen,xen-bootargs is present, it will be used for Xen. |
| 117 |
- If xen,dom0-bootargs is present, it will be used for Dom0. |
| 118 |
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, |
| 119 |
bootargs will be used for Xen. |
| 120 |
- If a kernel boot module is present and has a bootargs property then |
| 121 |
the top-level bootargs will used for Xen. |
| 122 |
- If no Xen specific properties are present, bootargs is for Dom0. |
| 123 |
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, |
| 124 |
bootargs will be used for Dom0. |
| 125 |
|
| 126 |
Most of these cases is to make booting with Xen-unaware bootloaders easier. |
| 127 |
For those you would hardcode the Xen commandline in the DTB under |
| 128 |
/chosen/xen,xen-bootargs and would let the bootloader set the Dom0 command |
| 129 |
line by writing bootargs (as for native Linux). |
| 130 |
A Xen-aware bootloader would set xen,xen-bootargs for Xen, xen,dom0-bootargs |
| 131 |
for Dom0 and bootargs for native Linux. |
| 132 |
|
| 133 |
|
| 134 |
UEFI boot and DT |
| 135 |
================ |
| 136 |
|
| 137 |
When Xen is booted using UEFI, it doesn't read the configuration file if any |
| 138 |
multiboot module is specified. To force Xen to load the configuration file, the |
| 139 |
boolean property xen,uefi-cfg-load must be declared in the /chosen node. |
| 140 |
|
| 141 |
|
| 142 |
Creating Multiple Domains directly from Xen |
| 143 |
=========================================== |
| 144 |
|
| 145 |
It is possible to have Xen create other domains, in addition to dom0, |
| 146 |
out of the information provided via device tree. A kernel and initrd |
| 147 |
(optional) need to be specified for each guest. |
| 148 |
|
| 149 |
For each domain to be created there needs to be one node under /chosen |
| 150 |
with the following properties: |
| 151 |
|
| 152 |
- compatible |
| 153 |
|
| 154 |
For domUs: "xen,domain" |
| 155 |
|
| 156 |
- memory |
| 157 |
|
| 158 |
A 64-bit integer specifying the amount of kilobytes of RAM to |
| 159 |
allocate to the guest. |
| 160 |
|
| 161 |
- cpus |
| 162 |
|
| 163 |
An integer specifying the number of vcpus to allocate to the guest. |
| 164 |
|
| 165 |
- llc-colors |
| 166 |
A string specifying the LLC color configuration for the guest. |
| 167 |
Refer to docs/misc/cache_coloring.rst for syntax. This option is applicable |
| 168 |
only to Arm64 guests. |
| 169 |
|
| 170 |
- vpl011 |
| 171 |
|
| 172 |
An empty property to enable/disable a virtual pl011 for the guest to |
| 173 |
use. The virtual pl011 uses SPI number 0 (see GUEST_VPL011_SPI). |
| 174 |
Please note that the SPI used for the virtual pl011 could clash with the |
| 175 |
physical SPI of a physical device assigned to the guest. |
| 176 |
|
| 177 |
- nr_spis |
| 178 |
|
| 179 |
Optional. A 32-bit integer specifying the number of SPIs (Shared |
| 180 |
Peripheral Interrupts) to allocate for the domain. If nr_spis is |
| 181 |
missing, the max number of SPIs supported by the physical GIC is |
| 182 |
used, or GUEST_VPL011_SPI+1 if vpl011 is enabled, whichever is |
| 183 |
greater. |
| 184 |
|
| 185 |
- #address-cells and #size-cells |
| 186 |
|
| 187 |
Both #address-cells and #size-cells need to be specified because |
| 188 |
both sub-nodes (described shortly) have reg properties. |
| 189 |
|
| 190 |
- direct-map |
| 191 |
|
| 192 |
Only available when statically allocated memory is used for the domain. |
| 193 |
An empty property to request the memory of the domain to be |
| 194 |
direct-map (guest physical address == physical address). |
| 195 |
|
| 196 |
- domain-cpupool |
| 197 |
|
| 198 |
Optional. Handle to a xen,cpupool device tree node that identifies the |
| 199 |
cpupool where the guest will be started at boot. |
| 200 |
|
| 201 |
- sve |
| 202 |
|
| 203 |
Optional. The `sve` property enables Arm SVE usage for the domain and sets |
| 204 |
the maximum SVE vector length, the option is applicable only to Arm64 |
| 205 |
guests. |
| 206 |
A value equal to 0 disables the feature, this is the default value. |
| 207 |
Specifying this property with no value, means that the SVE vector length |
| 208 |
will be set equal to the maximum vector length supported by the platform. |
| 209 |
Values above 0 explicitly set the maximum SVE vector length for the domain, |
| 210 |
allowed values are from 128 to maximum 2048, being multiple of 128. |
| 211 |
Please note that when the user explicitly specifies the value, if that value |
| 212 |
is above the hardware supported maximum SVE vector length, the domain |
| 213 |
creation will fail and the system will stop, the same will occur if the |
| 214 |
option is provided with a non zero value, but the platform doesn't support |
| 215 |
SVE. |
| 216 |
|
| 217 |
- xen,enhanced |
| 218 |
|
| 219 |
A string property. Possible property values are: |
| 220 |
|
| 221 |
- "enabled" (or missing property value) |
| 222 |
Xen PV interfaces, including grant-table and xenstore, will be |
| 223 |
enabled for the VM. |
| 224 |
|
| 225 |
- "disabled" |
| 226 |
Xen PV interfaces are disabled. |
| 227 |
|
| 228 |
- "no-xenstore" |
| 229 |
All default Xen PV interfaces, including grant-table will be enabled but |
| 230 |
xenstore will be disabled for the VM. |
| 231 |
|
| 232 |
If the xen,enhanced property is present with no value, it defaults |
| 233 |
to "enabled". If the xen,enhanced property is not present, PV |
| 234 |
interfaces are disabled. |
| 235 |
|
| 236 |
In the future other possible property values might be added to |
| 237 |
enable only selected interfaces. |
| 238 |
|
| 239 |
- xen,domain-p2m-mem-mb |
| 240 |
|
| 241 |
Optional. A 32-bit integer specifying the amount of megabytes of RAM |
| 242 |
used for the domain P2M pool. This is in-sync with the shadow_memory |
| 243 |
option in xl.cfg. Leaving this field empty in device tree will lead to |
| 244 |
the default size of domain P2M pool, i.e. 1MB per guest vCPU plus 4KB |
| 245 |
per MB of guest RAM plus 512KB for guest extended regions. |
| 246 |
|
| 247 |
- max_grant_version |
| 248 |
|
| 249 |
Optional. A 32-bit integer specifying the maximum grant table version |
| 250 |
the domain is allowed to use (valid values are 1 or 2). If this property |
| 251 |
is missing, the value specified by Xen command line parameter gnttab=max-ver |
| 252 |
(or its default value if unspecified, i.e. 1) is used. |
| 253 |
|
| 254 |
- max_grant_frames |
| 255 |
|
| 256 |
Optional. A 32-bit integer specifying the maximum number of grant frames |
| 257 |
the domain is allowed to have. If this property is missing, the value |
| 258 |
specified by Xen command line parameter gnttab_max_frames (or its default |
| 259 |
value if unspecified, i.e. 64) is used. |
| 260 |
|
| 261 |
- max_maptrack_frames |
| 262 |
|
| 263 |
Optional. A 32-bit integer specifying the maximum number of grant maptrack |
| 264 |
frames the domain is allowed to have. If this property is missing, the |
| 265 |
value specified by Xen command line parameter gnttab_max_maptrack_frames |
| 266 |
(or its default value if unspecified, i.e. 1024) is used. |
| 267 |
|
| 268 |
- passthrough |
| 269 |
|
| 270 |
A string property specifying whether IOMMU mappings are enabled for the |
| 271 |
domain and hence whether it will be enabled for passthrough hardware. |
| 272 |
Possible property values are: |
| 273 |
|
| 274 |
- "enabled" |
| 275 |
IOMMU mappings are enabled for the domain. Note that this option is the |
| 276 |
default if the user provides the device partial passthrough device tree |
| 277 |
for the domain. |
| 278 |
|
| 279 |
- "disabled" |
| 280 |
IOMMU mappings are disabled for the domain and so hardware may not be |
| 281 |
passed through. This option is the default if this property is missing |
| 282 |
and the user does not provide the device partial device tree for the domain. |
| 283 |
|
| 284 |
Under the "xen,domain" compatible node, one or more sub-nodes are present |
| 285 |
for the DomU kernel and ramdisk. |
| 286 |
|
| 287 |
The kernel sub-node has the following properties: |
| 288 |
|
| 289 |
- compatible |
| 290 |
|
| 291 |
"multiboot,kernel", "multiboot,module" |
| 292 |
|
| 293 |
- reg |
| 294 |
|
| 295 |
Specifies the physical address of the kernel in RAM and its |
| 296 |
length. |
| 297 |
|
| 298 |
- bootargs (optional) |
| 299 |
|
| 300 |
Command line parameters for the guest kernel. |
| 301 |
|
| 302 |
- xen,uefi-binary (UEFI boot only) |
| 303 |
|
| 304 |
String property that specifies the file name to be loaded by the UEFI boot |
| 305 |
for this module. If this is specified, there is no need to specify the reg |
| 306 |
property because it will be created by the UEFI stub on boot. |
| 307 |
This option is needed only when UEFI boot is used. |
| 308 |
|
| 309 |
The ramdisk sub-node has the following properties: |
| 310 |
|
| 311 |
- compatible |
| 312 |
|
| 313 |
"multiboot,ramdisk", "multiboot,module" |
| 314 |
|
| 315 |
- reg |
| 316 |
|
| 317 |
Specifies the physical address of the ramdisk in RAM and its |
| 318 |
length. |
| 319 |
|
| 320 |
- xen,uefi-binary (UEFI boot only) |
| 321 |
|
| 322 |
String property that specifies the file name to be loaded by the UEFI boot |
| 323 |
for this module. If this is specified, there is no need to specify the reg |
| 324 |
property because it will be created by the UEFI stub on boot. |
| 325 |
This option is needed only when UEFI boot is used. |
| 326 |
|
| 327 |
|
| 328 |
Example |
| 329 |
======= |
| 330 |
|
| 331 |
chosen { |
| 332 |
domU1 { |
| 333 |
compatible = "xen,domain"; |
| 334 |
#address-cells = <0x2>; |
| 335 |
#size-cells = <0x1>; |
| 336 |
memory = <0 131072>; |
| 337 |
cpus = <2>; |
| 338 |
vpl011; |
| 339 |
|
| 340 |
module@0x4a000000 { |
| 341 |
compatible = "multiboot,kernel", "multiboot,module"; |
| 342 |
reg = <0x0 0x4a000000 0xffffff>; |
| 343 |
bootargs = "console=ttyAMA0 init=/bin/sh"; |
| 344 |
}; |
| 345 |
|
| 346 |
module@0x4b000000 { |
| 347 |
compatible = "multiboot,ramdisk", "multiboot,module"; |
| 348 |
reg = <0x0 0x4b000000 0xffffff>; |
| 349 |
}; |
| 350 |
}; |
| 351 |
|
| 352 |
domU2 { |
| 353 |
compatible = "xen,domain"; |
| 354 |
#address-cells = <0x2>; |
| 355 |
#size-cells = <0x1>; |
| 356 |
memory = <0 65536>; |
| 357 |
cpus = <1>; |
| 358 |
|
| 359 |
module@0x4c000000 { |
| 360 |
compatible = "multiboot,kernel", "multiboot,module"; |
| 361 |
reg = <0x0 0x4c000000 0xffffff>; |
| 362 |
bootargs = "console=ttyAMA0 init=/bin/sh"; |
| 363 |
}; |
| 364 |
|
| 365 |
module@0x4d000000 { |
| 366 |
compatible = "multiboot,ramdisk", "multiboot,module"; |
| 367 |
reg = <0x0 0x4d000000 0xffffff>; |
| 368 |
}; |
| 369 |
}; |
| 370 |
}; |
| 371 |
|
| 372 |
|
| 373 |
Device Assignment |
| 374 |
================= |
| 375 |
|
| 376 |
Device Assignment (Passthrough) is supported by adding another module, |
| 377 |
alongside the kernel and ramdisk, with the device tree fragment |
| 378 |
corresponding to the device node to assign to the guest. |
| 379 |
|
| 380 |
The dtb sub-node should have the following properties: |
| 381 |
|
| 382 |
- compatible |
| 383 |
|
| 384 |
"multiboot,device-tree" and "multiboot,module" |
| 385 |
|
| 386 |
- reg |
| 387 |
|
| 388 |
Specifies the physical address of the device tree binary fragment |
| 389 |
RAM and its length. |
| 390 |
|
| 391 |
- xen,uefi-binary (UEFI boot only) |
| 392 |
|
| 393 |
String property that specifies the file name to be loaded by the UEFI boot |
| 394 |
for this module. If this is specified, there is no need to specify the reg |
| 395 |
property because it will be created by the UEFI stub on boot. |
| 396 |
This option is needed only when UEFI boot is used. |
| 397 |
|
| 398 |
As an example: |
| 399 |
|
| 400 |
module@0xc000000 { |
| 401 |
compatible = "multiboot,device-tree", "multiboot,module"; |
| 402 |
reg = <0x0 0xc000000 0xffffff>; |
| 403 |
}; |
| 404 |
|
| 405 |
The DTB fragment is loaded at 0xc000000 in the example above. It should |
| 406 |
follow the convention explained in docs/misc/arm/passthrough.txt. The |
| 407 |
DTB fragment will be added to the guest device tree, so that the guest |
| 408 |
kernel will be able to discover the device. |
| 409 |
|
| 410 |
|
| 411 |
Static Allocation |
| 412 |
============= |
| 413 |
|
| 414 |
Static Allocation refers to system or sub-system(domains) for which memory |
| 415 |
areas are pre-defined by configuration using physical address ranges. |
| 416 |
|
| 417 |
Memory can be statically allocated to a domain using the property "xen,static- |
| 418 |
mem" defined in the domain configuration. The number of cells for the address |
| 419 |
and the size must be defined respectively by the parent node properties |
| 420 |
"#address-cells" and "#size-cells". |
| 421 |
|
| 422 |
The property 'memory' is still needed and should match the amount of memory |
| 423 |
given to the guest. Currently, it either comes from static memory or lets Xen |
| 424 |
allocate from heap. *Mixing* is not supported. |
| 425 |
|
| 426 |
The static memory will be mapped in the guest at the usual guest memory |
| 427 |
addresses (GUEST_RAM0_BASE, GUEST_RAM1_BASE) defined by |
| 428 |
xen/include/public/arch-arm.h. |
| 429 |
|
| 430 |
Below is an example on how to specify the static memory region in the |
| 431 |
device-tree: |
| 432 |
|
| 433 |
/ { |
| 434 |
chosen { |
| 435 |
#address-cells = <0x1>; |
| 436 |
#size-cells = <0x1>; |
| 437 |
... |
| 438 |
domU1 { |
| 439 |
compatible = "xen,domain"; |
| 440 |
cpus = <2>; |
| 441 |
memory = <0x0 0x80000>; |
| 442 |
xen,static-mem = <0x30000000 0x20000000>; |
| 443 |
... |
| 444 |
}; |
| 445 |
}; |
| 446 |
}; |
| 447 |
|
| 448 |
This will reserve a 512MB region starting at the host physical address |
| 449 |
0x30000000 to be exclusively used by DomU1. |
| 450 |
|
| 451 |
Static Event Channel |
| 452 |
==================== |
| 453 |
The event channel communication will be established statically between two |
| 454 |
domains (dom0 and domU also). Event channel connection information between |
| 455 |
domains will be passed to Xen via the device tree node. The event channel |
| 456 |
will be created and established in Xen before the domain started. The domain |
| 457 |
does not need to do any operation to establish a connection. Domain only |
| 458 |
needs hypercall EVTCHNOP_send(local port) to send notifications to the |
| 459 |
remote guest. |
| 460 |
|
| 461 |
There is no need to describe the static event channel info in the domU device |
| 462 |
tree. Static event channels are only useful in fully static configurations, |
| 463 |
and in those configurations, the domU device tree dynamically generated by Xen |
| 464 |
is not needed. |
| 465 |
|
| 466 |
To enable the event-channel interface for domU guests include the |
| 467 |
xen,enhanced = "no-xenstore" property in the domU Xen device tree node. |
| 468 |
|
| 469 |
Under the "xen,domain" compatible node for domU, there needs to be sub-nodes |
| 470 |
with compatible "xen,evtchn" that describe the event channel connection |
| 471 |
between two domUs. For dom0, there needs to be sub-nodes with compatible |
| 472 |
"xen,evtchn" under the chosen node. |
| 473 |
|
| 474 |
The static event channel node has the following properties: |
| 475 |
|
| 476 |
- compatible |
| 477 |
|
| 478 |
"xen,evtchn" |
| 479 |
|
| 480 |
- xen,evtchn |
| 481 |
|
| 482 |
The property is tuples of two numbers |
| 483 |
(local-evtchn link-to-foreign-evtchn) where: |
| 484 |
|
| 485 |
local-evtchn is an integer value that will be used to allocate local port |
| 486 |
for a domain to send and receive event notifications to/from the remote |
| 487 |
domain. Maximum supported value is 2^17 for FIFO ABI and 4096 for 2L ABI. |
| 488 |
It is recommended to use low event channel IDs. |
| 489 |
|
| 490 |
link-to-foreign-evtchn is a single phandle to a remote evtchn to which |
| 491 |
local-evtchn will be connected. |
| 492 |
|
| 493 |
Example |
| 494 |
======= |
| 495 |
|
| 496 |
chosen { |
| 497 |
|
| 498 |
/* One sub-node per local event channel. This sub-node is for Dom0. */ |
| 499 |
ec1: evtchn@1 { |
| 500 |
compatible = "xen,evtchn-v1"; |
| 501 |
/* local-evtchn link-to-foreign-evtchn */ |
| 502 |
xen,evtchn = <0xa &ec2>; |
| 503 |
}; |
| 504 |
|
| 505 |
domU1 { |
| 506 |
compatible = "xen,domain"; |
| 507 |
#address-cells = <0x2>; |
| 508 |
#size-cells = <0x1>; |
| 509 |
xen,enhanced = "no-xenstore"; |
| 510 |
|
| 511 |
/* One sub-node per local event channel */ |
| 512 |
ec2: evtchn@2 { |
| 513 |
compatible = "xen,evtchn-v1"; |
| 514 |
/* local-evtchn link-to-foreign-evtchn */ |
| 515 |
xen,evtchn = <0xa &ec1>; |
| 516 |
}; |
| 517 |
|
| 518 |
ec3: evtchn@3 { |
| 519 |
compatible = "xen,evtchn-v1"; |
| 520 |
xen,evtchn = <0xb &ec5>; |
| 521 |
}; |
| 522 |
|
| 523 |
ec4: evtchn@4 { |
| 524 |
compatible = "xen,evtchn-v1"; |
| 525 |
xen,evtchn = <0xc &ec6>; |
| 526 |
}; |
| 527 |
}; |
| 528 |
|
| 529 |
domU2 { |
| 530 |
compatible = "xen,domain"; |
| 531 |
#address-cells = <0x2>; |
| 532 |
#size-cells = <0x1>; |
| 533 |
xen,enhanced = "no-xenstore"; |
| 534 |
|
| 535 |
/* One sub-node per local event channel */ |
| 536 |
ec5: evtchn@5 { |
| 537 |
compatible = "xen,evtchn-v1"; |
| 538 |
/* local-evtchn link-to-foreign-evtchn */ |
| 539 |
xen,evtchn = <0xb &ec3>; |
| 540 |
}; |
| 541 |
|
| 542 |
ec6: evtchn@6 { |
| 543 |
compatible = "xen,evtchn-v1"; |
| 544 |
xen,evtchn = <0xd &ec4>; |
| 545 |
}; |
| 546 |
}; |
| 547 |
}; |
| 548 |
|
| 549 |
Static Heap Memory |
| 550 |
================== |
| 551 |
|
| 552 |
The static heap memory refers to parts of RAM reserved in the beginning of |
| 553 |
boot time for heap. The memory is reserved by configuration in the device |
| 554 |
tree using physical address ranges. |
| 555 |
|
| 556 |
The static heap memory declared in the device tree defines the memory areas |
| 557 |
that will be reserved to be used exclusively as heap. |
| 558 |
|
| 559 |
- For Arm32, since there are separated heaps, the static heap will be used |
| 560 |
for both domheap and xenheap. The admin should make sure that the static |
| 561 |
heap region should contain enough memory below 4GB to cater 32-bit DMA. |
| 562 |
|
| 563 |
- For Arm64, since there is a single heap, the defined static heap areas |
| 564 |
shall always go to the heap allocator. |
| 565 |
|
| 566 |
The static heap memory is an optional feature and can be enabled by adding |
| 567 |
below device tree property. |
| 568 |
|
| 569 |
- xen,static-heap |
| 570 |
|
| 571 |
Property under the top-level "chosen" node. It specifies the address |
| 572 |
and size of Xen static heap memory. Number of address and size cells |
| 573 |
for the "xen,static-heap" property is determined by the root node |
| 574 |
"#address-cells" and "#size-cells". Note that at least a 64KB alignment |
| 575 |
is required. |
| 576 |
|
| 577 |
Below is an example on how to specify the static heap in device tree: |
| 578 |
|
| 579 |
/ { |
| 580 |
#address-cells = <0x2>; |
| 581 |
#size-cells = <0x2>; |
| 582 |
... |
| 583 |
chosen { |
| 584 |
xen,static-heap = <0x0 0x30000000 0x0 0x40000000>; |
| 585 |
... |
| 586 |
}; |
| 587 |
}; |
| 588 |
|
| 589 |
RAM starting from the host physical address 0x30000000 of 1GB size will |
| 590 |
be reserved as static heap. |
| 591 |
|
| 592 |
Static Shared Memory |
| 593 |
==================== |
| 594 |
|
| 595 |
The static shared memory device tree nodes allow users to statically set up |
| 596 |
shared memory on dom0less system, enabling domains to do shm-based |
| 597 |
communication. |
| 598 |
|
| 599 |
- compatible |
| 600 |
|
| 601 |
"xen,domain-shared-memory-v1" |
| 602 |
|
| 603 |
- xen,shm-id |
| 604 |
|
| 605 |
An arbitrary string that represents the unique identifier of the shared |
| 606 |
memory region, with a strict limit on the number of characters(\0 included), |
| 607 |
`MAX_SHM_ID_LENGTH(16)`. e.g. "xen,shm-id = "my-shared-mem-1"". |
| 608 |
|
| 609 |
- xen,shared-mem |
| 610 |
|
| 611 |
An array takes a physical address, which is the base address of the |
| 612 |
shared memory region in host physical address space, a size, and a guest |
| 613 |
physical address, as the target address of the mapping. |
| 614 |
e.g. xen,shared-mem = < [host physical address] [guest address] [size] >; |
| 615 |
Note that if a domain is direct-mapped, i.e. the Dom0 and the Dom0less |
| 616 |
DomUs with `direct-map` device tree property, the static shared memory |
| 617 |
should also be direct-mapped (host physical address == guest address). |
| 618 |
|
| 619 |
It shall also meet the following criteria: |
| 620 |
1) If the SHM ID matches with an existing region, the address range of the |
| 621 |
region shall also exactly match. |
| 622 |
2) If the SHM ID does not match with any other existing region, it should |
| 623 |
also not overlap with any other regions. |
| 624 |
|
| 625 |
The number of cells for the host address (and size) is the same as the |
| 626 |
guest pseudo-physical address and they are inherited from the parent node. |
| 627 |
|
| 628 |
Host physical address is optional, when missing Xen decides the location. |
| 629 |
e.g. xen,shared-mem = < [guest address] [size] >; |
| 630 |
|
| 631 |
- role (Optional) |
| 632 |
|
| 633 |
A string property specifying the ownership of a shared memory region, |
| 634 |
the value must be one of the following: "owner", or "borrower" |
| 635 |
A shared memory region could be explicitly backed by one domain, which is |
| 636 |
called "owner domain", and all the other domains who are also sharing |
| 637 |
this region are called "borrower domain". |
| 638 |
If not specified, the default value is "borrower" and owner is |
| 639 |
DOMID_IO, a system domain. |
| 640 |
|
| 641 |
As an example: |
| 642 |
|
| 643 |
chosen { |
| 644 |
#address-cells = <0x1>; |
| 645 |
#size-cells = <0x1>; |
| 646 |
xen,xen-bootargs = "console=dtuart dtuart=serial0 bootscrub=0"; |
| 647 |
|
| 648 |
...... |
| 649 |
|
| 650 |
/* this is for Dom0 */ |
| 651 |
dom0-shared-mem@10000000 { |
| 652 |
compatible = "xen,domain-shared-memory-v1"; |
| 653 |
role = "owner"; |
| 654 |
xen,shm-id = "my-shared-mem-0"; |
| 655 |
xen,shared-mem = <0x10000000 0x10000000 0x10000000>; |
| 656 |
}; |
| 657 |
|
| 658 |
domU1 { |
| 659 |
compatible = "xen,domain"; |
| 660 |
#address-cells = <0x1>; |
| 661 |
#size-cells = <0x1>; |
| 662 |
memory = <0 131072>; |
| 663 |
cpus = <2>; |
| 664 |
vpl011; |
| 665 |
|
| 666 |
/* |
| 667 |
* shared memory region "my-shared-mem-0" is shared |
| 668 |
* between Dom0 and DomU1. |
| 669 |
*/ |
| 670 |
domU1-shared-mem@10000000 { |
| 671 |
compatible = "xen,domain-shared-memory-v1"; |
| 672 |
role = "borrower"; |
| 673 |
xen,shm-id = "my-shared-mem-0"; |
| 674 |
xen,shared-mem = <0x10000000 0x50000000 0x10000000>; |
| 675 |
}; |
| 676 |
|
| 677 |
/* |
| 678 |
* shared memory region "my-shared-mem-1" is shared between |
| 679 |
* DomU1 and DomU2. |
| 680 |
*/ |
| 681 |
domU1-shared-mem@50000000 { |
| 682 |
compatible = "xen,domain-shared-memory-v1"; |
| 683 |
xen,shm-id = "my-shared-mem-1"; |
| 684 |
xen,shared-mem = <0x50000000 0x60000000 0x20000000>; |
| 685 |
}; |
| 686 |
|
| 687 |
/* |
| 688 |
* shared memory region "my-shared-mem-2" is shared between |
| 689 |
* DomU1 and DomU2. |
| 690 |
*/ |
| 691 |
domU1-shared-mem-2 { |
| 692 |
compatible = "xen,domain-shared-memory-v1"; |
| 693 |
xen,shm-id = "my-shared-mem-2"; |
| 694 |
role = "owner"; |
| 695 |
xen,shared-mem = <0x80000000 0x20000000>; |
| 696 |
}; |
| 697 |
|
| 698 |
...... |
| 699 |
|
| 700 |
}; |
| 701 |
|
| 702 |
domU2 { |
| 703 |
compatible = "xen,domain"; |
| 704 |
#address-cells = <0x1>; |
| 705 |
#size-cells = <0x1>; |
| 706 |
memory = <0 65536>; |
| 707 |
cpus = <1>; |
| 708 |
|
| 709 |
/* |
| 710 |
* shared memory region "my-shared-mem-1" is shared between |
| 711 |
* domU1 and domU2. |
| 712 |
*/ |
| 713 |
domU2-shared-mem@50000000 { |
| 714 |
compatible = "xen,domain-shared-memory-v1"; |
| 715 |
xen,shm-id = "my-shared-mem-1"; |
| 716 |
xen,shared-mem = <0x50000000 0x70000000 0x20000000>; |
| 717 |
}; |
| 718 |
|
| 719 |
domU2-shared-mem-2 { |
| 720 |
compatible = "xen,domain-shared-memory-v1"; |
| 721 |
xen,shm-id = "my-shared-mem-2"; |
| 722 |
role = "borrower"; |
| 723 |
xen,shared-mem = <0x90000000 0x20000000>; |
| 724 |
}; |
| 725 |
|
| 726 |
...... |
| 727 |
}; |
| 728 |
}; |
| 729 |
|
| 730 |
This is an example with two static shared memory regions. |
| 731 |
|
| 732 |
For the static shared memory region identified as "my-shared-mem-0", host |
| 733 |
physical address starting at 0x10000000 of 256MB will be reserved to be |
| 734 |
shared between Dom0 and DomU1. It will get mapped at 0x10000000 in Dom0 guest |
| 735 |
physical address space, and at 0x50000000 in DomU1 guest physical address space. |
| 736 |
Dom0 is explicitly defined as the owner domain, and DomU1 is the borrower domain. |
| 737 |
|
| 738 |
For the static shared memory region identified as "my-shared-mem-1", host |
| 739 |
physical address starting at 0x50000000 of 512MB will be reserved to be |
| 740 |
shared between DomU1 and DomU2. It will get mapped at 0x60000000 in DomU1 guest |
| 741 |
physical address space, and at 0x70000000 in DomU2 guest physical address space. |
| 742 |
DomU1 and DomU2 are both the borrower domain, the owner domain is the default |
| 743 |
owner domain DOMID_IO. |
| 744 |
|
| 745 |
For the static shared memory region "my-shared-mem-2", since host physical |
| 746 |
address is not provided by user, Xen will automatically allocate 512MB |
| 747 |
from heap as static shared memory to be shared between DomU1 and DomU2. |
| 748 |
The automatically allocated static shared memory will get mapped at |
| 749 |
0x80000000 in DomU1 guest physical address space, and at 0x90000000 in DomU2 |
| 750 |
guest physical address space. DomU1 is explicitly defined as the owner domain, |
| 751 |
and DomU2 is the borrower domain. |