1HXCOMM See docs/devel/docs.rst for the format of this file. 2HXCOMM 3HXCOMM Use DEFHEADING() to define headings in both help text and rST. 4HXCOMM Text between SRST and ERST is copied to the rST version and 5HXCOMM discarded from C version. 6HXCOMM DEF(option, HAS_ARG/0, opt_enum, opt_help, arch_mask) is used to 7HXCOMM construct option structures, enums and help message for specified 8HXCOMM architectures. 9HXCOMM HXCOMM can be used for comments, discarded from both rST and C. 10 11DEFHEADING(Standard options:) 12 13DEF("help", 0, QEMU_OPTION_h, 14 "-h or -help display this help and exit\n", QEMU_ARCH_ALL) 15SRST 16``-h`` 17 Display help and exit 18ERST 19 20DEF("version", 0, QEMU_OPTION_version, 21 "-version display version information and exit\n", QEMU_ARCH_ALL) 22SRST 23``-version`` 24 Display version information and exit 25ERST 26 27DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ 28 "-machine [type=]name[,prop[=value][,...]]\n" 29 " selects emulated machine ('-machine help' for list)\n" 30 " property accel=accel1[:accel2[:...]] selects accelerator\n" 31 " supported accelerators are kvm, xen, hvf, nvmm, whpx or tcg (default: tcg)\n" 32 " vmport=on|off|auto controls emulation of vmport (default: auto)\n" 33 " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" 34 " mem-merge=on|off controls memory merge support (default: on)\n" 35 " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" 36 " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n" 37 " suppress-vmdesc=on|off disables self-describing migration (default=off)\n" 38 " nvdimm=on|off controls NVDIMM support (default=off)\n" 39 " memory-encryption=@var{} memory encryption object to use (default=none)\n" 40 " hmat=on|off controls ACPI HMAT support (default=off)\n" 41#ifdef CONFIG_POSIX 42 " aux-ram-share=on|off allocate auxiliary guest RAM as shared (default: off)\n" 43#endif 44 " memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n" 45 " cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]\n", 46 QEMU_ARCH_ALL) 47SRST 48``-machine [type=]name[,prop=value[,...]]`` 49 Select the emulated machine by name. Use ``-machine help`` to list 50 available machines. 51 52 For architectures which aim to support live migration compatibility 53 across releases, each release will introduce a new versioned machine 54 type. For example, the 2.8.0 release introduced machine types 55 "pc-i440fx-2.8" and "pc-q35-2.8" for the x86\_64/i686 architectures. 56 57 To allow live migration of guests from QEMU version 2.8.0, to QEMU 58 version 2.9.0, the 2.9.0 version must support the "pc-i440fx-2.8" 59 and "pc-q35-2.8" machines too. To allow users live migrating VMs to 60 skip multiple intermediate releases when upgrading, new releases of 61 QEMU will support machine types from many previous versions. 62 63 Supported machine properties are: 64 65 ``accel=accels1[:accels2[:...]]`` 66 This is used to enable an accelerator. Depending on the target 67 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available. 68 By default, tcg is used. If there is more than one accelerator 69 specified, the next one is used if the previous one fails to 70 initialize. 71 72 ``vmport=on|off|auto`` 73 Enables emulation of VMWare IO port, for vmmouse etc. auto says 74 to select the value based on accel and i8042. For accel=xen or 75 i8042=off the default is off otherwise the default is on. 76 77 ``dump-guest-core=on|off`` 78 Include guest memory in a core dump. The default is on. 79 80 ``mem-merge=on|off`` 81 Enables or disables memory merge support. This feature, when 82 supported by the host, de-duplicates identical memory pages 83 among VMs instances (enabled by default). 84 85 ``aes-key-wrap=on|off`` 86 Enables or disables AES key wrapping support on s390-ccw hosts. 87 This feature controls whether AES wrapping keys will be created 88 to allow execution of AES cryptographic functions. The default 89 is on. 90 91 ``dea-key-wrap=on|off`` 92 Enables or disables DEA key wrapping support on s390-ccw hosts. 93 This feature controls whether DEA wrapping keys will be created 94 to allow execution of DEA cryptographic functions. The default 95 is on. 96 97 ``nvdimm=on|off`` 98 Enables or disables NVDIMM support. The default is off. 99 100 ``memory-encryption=`` 101 Memory encryption object to use. The default is none. 102 103 ``hmat=on|off`` 104 Enables or disables ACPI Heterogeneous Memory Attribute Table 105 (HMAT) support. The default is off. 106 107 ``aux-ram-share=on|off`` 108 Allocate auxiliary guest RAM as an anonymous file that is 109 shareable with an external process. This option applies to 110 memory allocated as a side effect of creating various devices. 111 It does not apply to memory-backend-objects, whether explicitly 112 specified on the command line, or implicitly created by the -m 113 command line option. The default is off. 114 115 To use the cpr-transfer migration mode, you must set aux-ram-share=on. 116 117 ``memory-backend='id'`` 118 An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options. 119 Allows to use a memory backend as main RAM. 120 121 For example: 122 :: 123 124 -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on 125 -machine memory-backend=pc.ram 126 -m 512M 127 128 Migration compatibility note: 129 130 * as backend id one shall use value of 'default-ram-id', advertised by 131 machine type (available via ``query-machines`` QMP command), if migration 132 to/from old QEMU (<5.0) is expected. 133 * for machine types 4.0 and older, user shall 134 use ``x-use-canonical-path-for-ramblock-id=off`` backend option 135 if migration to/from old QEMU (<5.0) is expected. 136 137 For example: 138 :: 139 140 -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off 141 -machine memory-backend=pc.ram 142 -m 512M 143 144 ``cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]`` 145 Define a CXL Fixed Memory Window (CFMW). 146 147 Described in the CXL 2.0 ECN: CEDT CFMWS & QTG _DSM. 148 149 They are regions of Host Physical Addresses (HPA) on a system which 150 may be interleaved across one or more CXL host bridges. The system 151 software will assign particular devices into these windows and 152 configure the downstream Host-managed Device Memory (HDM) decoders 153 in root ports, switch ports and devices appropriately to meet the 154 interleave requirements before enabling the memory devices. 155 156 ``targets.X=target`` provides the mapping to CXL host bridges 157 which may be identified by the id provided in the -device entry. 158 Multiple entries are needed to specify all the targets when 159 the fixed memory window represents interleaved memory. X is the 160 target index from 0. 161 162 ``size=size`` sets the size of the CFMW. This must be a multiple of 163 256MiB. The region will be aligned to 256MiB but the location is 164 platform and configuration dependent. 165 166 ``interleave-granularity=granularity`` sets the granularity of 167 interleave. Default 256 (bytes). Only 256, 512, 1k, 2k, 168 4k, 8k and 16k granularities supported. 169 170 Example: 171 172 :: 173 174 -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512 175ERST 176 177DEF("M", HAS_ARG, QEMU_OPTION_M, 178 " sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n", 179 QEMU_ARCH_ALL) 180 181SRST 182``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}`` 183 Define an SGX EPC section. 184ERST 185 186DEF("cpu", HAS_ARG, QEMU_OPTION_cpu, 187 "-cpu cpu select CPU ('-cpu help' for list)\n", QEMU_ARCH_ALL) 188SRST 189``-cpu model`` 190 Select CPU model (``-cpu help`` for list and additional feature 191 selection) 192ERST 193 194DEF("accel", HAS_ARG, QEMU_OPTION_accel, 195 "-accel [accel=]accelerator[,prop[=value][,...]]\n" 196 " select accelerator (kvm, xen, hvf, nvmm, whpx or tcg; use 'help' for a list)\n" 197 " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" 198 " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n" 199 " kvm-shadow-mem=size of KVM shadow MMU in bytes\n" 200 " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n" 201 " split-wx=on|off (enable TCG split w^x mapping)\n" 202 " tb-size=n (TCG translation block cache size)\n" 203 " dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n" 204 " eager-split-size=n (KVM Eager Page Split chunk size, default 0, disabled. ARM only)\n" 205 " notify-vmexit=run|internal-error|disable,notify-window=n (enable notify VM exit and set notify window, x86 only)\n" 206 " thread=single|multi (enable multi-threaded TCG)\n" 207 " device=path (KVM device path, default /dev/kvm)\n", QEMU_ARCH_ALL) 208SRST 209``-accel name[,prop=value[,...]]`` 210 This is used to enable an accelerator. Depending on the target 211 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available. By 212 default, tcg is used. If there is more than one accelerator 213 specified, the next one is used if the previous one fails to 214 initialize. 215 216 ``igd-passthru=on|off`` 217 When Xen is in use, this option controls whether Intel 218 integrated graphics devices can be passed through to the guest 219 (default=off) 220 221 ``kernel-irqchip=on|off|split`` 222 Controls KVM in-kernel irqchip support. The default is full 223 acceleration of the interrupt controllers. On x86, split irqchip 224 reduces the kernel attack surface, at a performance cost for 225 non-MSI interrupts. Disabling the in-kernel irqchip completely 226 is not recommended except for debugging purposes. 227 228 ``kvm-shadow-mem=size`` 229 Defines the size of the KVM shadow MMU. 230 231 ``one-insn-per-tb=on|off`` 232 Makes the TCG accelerator put only one guest instruction into 233 each translation block. This slows down emulation a lot, but 234 can be useful in some situations, such as when trying to analyse 235 the logs produced by the ``-d`` option. 236 237 ``split-wx=on|off`` 238 Controls the use of split w^x mapping for the TCG code generation 239 buffer. Some operating systems require this to be enabled, and in 240 such a case this will default on. On other operating systems, this 241 will default off, but one may enable this for testing or debugging. 242 243 ``tb-size=n`` 244 Controls the size (in MiB) of the TCG translation block cache. 245 246 ``thread=single|multi`` 247 Controls number of TCG threads. When the TCG is multi-threaded 248 there will be one thread per vCPU therefore taking advantage of 249 additional host cores. The default is to enable multi-threading 250 where both the back-end and front-ends support it and no 251 incompatible TCG features have been enabled (e.g. 252 icount/replay). 253 254 ``dirty-ring-size=n`` 255 When the KVM accelerator is used, it controls the size of the per-vCPU 256 dirty page ring buffer (number of entries for each vCPU). It should 257 be a value that is power of two, and it should be 1024 or bigger (but 258 still less than the maximum value that the kernel supports). 4096 259 could be a good initial value if you have no idea which is the best. 260 Set this value to 0 to disable the feature. By default, this feature 261 is disabled (dirty-ring-size=0). When enabled, KVM will instead 262 record dirty pages in a bitmap. 263 264 ``eager-split-size=n`` 265 KVM implements dirty page logging at the PAGE_SIZE granularity and 266 enabling dirty-logging on a huge-page requires breaking it into 267 PAGE_SIZE pages in the first place. KVM on ARM does this splitting 268 lazily by default. There are performance benefits in doing huge-page 269 split eagerly, especially in situations where TLBI costs associated 270 with break-before-make sequences are considerable and also if guest 271 workloads are read intensive. The size here specifies how many pages 272 to break at a time and needs to be a valid block size which is 273 1GB/2MB/4KB, 32MB/16KB and 512MB/64KB for 4KB/16KB/64KB PAGE_SIZE 274 respectively. Be wary of specifying a higher size as it will have an 275 impact on the memory. By default, this feature is disabled 276 (eager-split-size=0). 277 278 ``notify-vmexit=run|internal-error|disable,notify-window=n`` 279 Enables or disables notify VM exit support on x86 host and specify 280 the corresponding notify window to trigger the VM exit if enabled. 281 ``run`` option enables the feature. It does nothing and continue 282 if the exit happens. ``internal-error`` option enables the feature. 283 It raises a internal error. ``disable`` option doesn't enable the feature. 284 This feature can mitigate the CPU stuck issue due to event windows don't 285 open up for a specified of time (i.e. notify-window). 286 Default: notify-vmexit=run,notify-window=0. 287 288 ``device=path`` 289 Sets the path to the KVM device node. Defaults to ``/dev/kvm``. This 290 option can be used to pass the KVM device to use via a file descriptor 291 by setting the value to ``/dev/fdset/NN``. 292 293ERST 294 295DEF("smp", HAS_ARG, QEMU_OPTION_smp, 296 "-smp [[cpus=]n][,maxcpus=maxcpus][,drawers=drawers][,books=books][,sockets=sockets]\n" 297 " [,dies=dies][,clusters=clusters][,modules=modules][,cores=cores]\n" 298 " [,threads=threads]\n" 299 " set the number of initial CPUs to 'n' [default=1]\n" 300 " maxcpus= maximum number of total CPUs, including\n" 301 " offline CPUs for hotplug, etc\n" 302 " drawers= number of drawers on the machine board\n" 303 " books= number of books in one drawer\n" 304 " sockets= number of sockets in one book\n" 305 " dies= number of dies in one socket\n" 306 " clusters= number of clusters in one die\n" 307 " modules= number of modules in one cluster\n" 308 " cores= number of cores in one module\n" 309 " threads= number of threads in one core\n" 310 "Note: Different machines may have different subsets of the CPU topology\n" 311 " parameters supported, so the actual meaning of the supported parameters\n" 312 " will vary accordingly. For example, for a machine type that supports a\n" 313 " three-level CPU hierarchy of sockets/cores/threads, the parameters will\n" 314 " sequentially mean as below:\n" 315 " sockets means the number of sockets on the machine board\n" 316 " cores means the number of cores in one socket\n" 317 " threads means the number of threads in one core\n" 318 " For a particular machine type board, an expected CPU topology hierarchy\n" 319 " can be defined through the supported sub-option. Unsupported parameters\n" 320 " can also be provided in addition to the sub-option, but their values\n" 321 " must be set as 1 in the purpose of correct parsing.\n", 322 QEMU_ARCH_ALL) 323SRST 324``-smp [[cpus=]n][,maxcpus=maxcpus][,drawers=drawers][,books=books][,sockets=sockets][,dies=dies][,clusters=clusters][,modules=modules][,cores=cores][,threads=threads]`` 325 Simulate a SMP system with '\ ``n``\ ' CPUs initially present on 326 the machine type board. On boards supporting CPU hotplug, the optional 327 '\ ``maxcpus``\ ' parameter can be set to enable further CPUs to be 328 added at runtime. When both parameters are omitted, the maximum number 329 of CPUs will be calculated from the provided topology members and the 330 initial CPU count will match the maximum number. When only one of them 331 is given then the omitted one will be set to its counterpart's value. 332 Both parameters may be specified, but the maximum number of CPUs must 333 be equal to or greater than the initial CPU count. Product of the 334 CPU topology hierarchy must be equal to the maximum number of CPUs. 335 Both parameters are subject to an upper limit that is determined by 336 the specific machine type chosen. 337 338 To control reporting of CPU topology information, values of the topology 339 parameters can be specified. Machines may only support a subset of the 340 parameters and different machines may have different subsets supported 341 which vary depending on capacity of the corresponding CPU targets. So 342 for a particular machine type board, an expected topology hierarchy can 343 be defined through the supported sub-option. Unsupported parameters can 344 also be provided in addition to the sub-option, but their values must be 345 set as 1 in the purpose of correct parsing. 346 347 Either the initial CPU count, or at least one of the topology parameters 348 must be specified. The specified parameters must be greater than zero, 349 explicit configuration like "cpus=0" is not allowed. Values for any 350 omitted parameters will be computed from those which are given. 351 352 For example, the following sub-option defines a CPU topology hierarchy 353 (2 sockets totally on the machine, 2 cores per socket, 2 threads per 354 core) for a machine that only supports sockets/cores/threads. 355 Some members of the option can be omitted but their values will be 356 automatically computed: 357 358 :: 359 360 -smp 8,sockets=2,cores=2,threads=2,maxcpus=8 361 362 The following sub-option defines a CPU topology hierarchy (2 sockets 363 totally on the machine, 2 dies per socket, 2 modules per die, 2 cores per 364 module, 2 threads per core) for PC machines which support sockets/dies 365 /modules/cores/threads. Some members of the option can be omitted but 366 their values will be automatically computed: 367 368 :: 369 370 -smp 32,sockets=2,dies=2,modules=2,cores=2,threads=2,maxcpus=32 371 372 The following sub-option defines a CPU topology hierarchy (2 sockets 373 totally on the machine, 2 clusters per socket, 2 cores per cluster, 374 2 threads per core) for ARM virt machines which support sockets/clusters 375 /cores/threads. Some members of the option can be omitted but their values 376 will be automatically computed: 377 378 :: 379 380 -smp 16,sockets=2,clusters=2,cores=2,threads=2,maxcpus=16 381 382 Historically preference was given to the coarsest topology parameters 383 when computing missing values (ie sockets preferred over cores, which 384 were preferred over threads), however, this behaviour is considered 385 liable to change. Prior to 6.2 the preference was sockets over cores 386 over threads. Since 6.2 the preference is cores over sockets over threads. 387 388 For example, the following option defines a machine board with 2 sockets 389 of 1 core before 6.2 and 1 socket of 2 cores after 6.2: 390 391 :: 392 393 -smp 2 394 395 Note: The cluster topology will only be generated in ACPI and exposed 396 to guest if it's explicitly specified in -smp. 397ERST 398 399DEF("numa", HAS_ARG, QEMU_OPTION_numa, 400 "-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n" 401 "-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n" 402 "-numa dist,src=source,dst=destination,val=distance\n" 403 "-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]\n" 404 "-numa hmat-lb,initiator=node,target=node,hierarchy=memory|first-level|second-level|third-level,data-type=access-latency|read-latency|write-latency[,latency=lat][,bandwidth=bw]\n" 405 "-numa hmat-cache,node-id=node,size=size,level=level[,associativity=none|direct|complex][,policy=none|write-back|write-through][,line=size]\n", 406 QEMU_ARCH_ALL) 407SRST 408``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]`` 409 \ 410``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]`` 411 \ 412``-numa dist,src=source,dst=destination,val=distance`` 413 \ 414``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]`` 415 \ 416``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=type[,latency=lat][,bandwidth=bw]`` 417 \ 418``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]`` 419 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA 420 distance from a source node to a destination node. Set the ACPI 421 Heterogeneous Memory Attributes for the given nodes. 422 423 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and 424 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a 425 contiguous range of CPU indexes (or a single VCPU if lastcpu is 426 omitted). A non-contiguous set of VCPUs can be represented by 427 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is 428 omitted on all nodes, VCPUs are automatically split between them. 429 430 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a 431 NUMA node: 432 433 :: 434 435 -numa node,cpus=0-2,cpus=5 436 437 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option 438 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to 439 assign CPU objects to a node using topology layout properties of 440 CPU. The set of properties is machine specific, and depends on used 441 machine type/'\ ``smp``\ ' options. It could be queried with 442 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ ' 443 property specifies node to which CPU object will be assigned, it's 444 required for node to be declared with '\ ``node``\ ' option before 445 it's used with '\ ``cpu``\ ' option. 446 447 For example: 448 449 :: 450 451 -M pc \ 452 -smp 1,sockets=2,maxcpus=2 \ 453 -numa node,nodeid=0 -numa node,nodeid=1 \ 454 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1 455 456 '\ ``memdev``\ ' option assigns RAM from a given memory backend 457 device to a node. It is recommended to use '\ ``memdev``\ ' option 458 over legacy '\ ``mem``\ ' option. This is because '\ ``memdev``\ ' 459 option provides better performance and more control over the 460 backend's RAM (e.g. '\ ``prealloc``\ ' parameter of 461 '\ ``-memory-backend-ram``\ ' allows memory preallocation). 462 463 For compatibility reasons, legacy '\ ``mem``\ ' option is 464 supported in 5.0 and older machine types. Note that '\ ``mem``\ ' 465 and '\ ``memdev``\ ' are mutually exclusive. If one node uses 466 '\ ``memdev``\ ', the rest nodes have to use '\ ``memdev``\ ' 467 option, and vice versa. 468 469 Users must specify memory for all NUMA nodes by '\ ``memdev``\ ' 470 (or legacy '\ ``mem``\ ' if available). In QEMU 5.2, the support 471 for '\ ``-numa node``\ ' without memory specified was removed. 472 473 '\ ``initiator``\ ' is an additional option that points to an 474 initiator NUMA node that has best performance (the lowest latency or 475 largest bandwidth) to this NUMA node. Note that this option can be 476 set only when the machine property 'hmat' is set to 'on'. 477 478 Following example creates a machine with 2 NUMA nodes, node 0 has 479 CPU. node 1 has only memory, and its initiator is node 0. Note that 480 because node 0 has CPU, by default the initiator of node 0 is itself 481 and must be itself. 482 483 :: 484 485 -machine hmat=on \ 486 -m 2G,slots=2,maxmem=4G \ 487 -object memory-backend-ram,size=1G,id=m0 \ 488 -object memory-backend-ram,size=1G,id=m1 \ 489 -numa node,nodeid=0,memdev=m0 \ 490 -numa node,nodeid=1,memdev=m1,initiator=0 \ 491 -smp 2,sockets=2,maxcpus=2 \ 492 -numa cpu,node-id=0,socket-id=0 \ 493 -numa cpu,node-id=0,socket-id=1 494 495 source and destination are NUMA node IDs. distance is the NUMA 496 distance from source to destination. The distance from a node to 497 itself is always 10. If any pair of nodes is given a distance, then 498 all pairs must be given distances. Although, when distances are only 499 given in one direction for each pair of nodes, then the distances in 500 the opposite directions are assumed to be the same. If, however, an 501 asymmetrical pair of distances is given for even one node pair, then 502 all node pairs must be provided distance values for both directions, 503 even when they are symmetrical. When a node is unreachable from 504 another node, set the pair's distance to 255. 505 506 Note that the -``numa`` option doesn't allocate any of the specified 507 resources, it just assigns existing resources to NUMA nodes. This 508 means that one still has to use the ``-m``, ``-smp`` options to 509 allocate RAM and VCPUs respectively. 510 511 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth 512 Information between initiator and target NUMA nodes in ACPI 513 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can 514 create memory requests, usually it has one or more processors. 515 Target NUMA node contains addressable memory. 516 517 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is 518 the memory hierarchy of the target NUMA node: if hierarchy is 519 'memory', the structure represents the memory performance; if 520 hierarchy is 'first-level\|second-level\|third-level', this 521 structure represents aggregated performance of memory side caches 522 for each domain. type of 'data-type' is type of data represented by 523 this structure instance: if 'hierarchy' is 'memory', 'data-type' is 524 'access\|read\|write' latency or 'access\|read\|write' bandwidth of 525 the target memory; if 'hierarchy' is 526 'first-level\|second-level\|third-level', 'data-type' is 527 'access\|read\|write' hit latency or 'access\|read\|write' hit 528 bandwidth of the target memory side cache. 529 530 lat is latency value in nanoseconds. bw is bandwidth value, the 531 possible value and units are NUM[M\|G\|T], mean that the bandwidth 532 value are NUM byte per second (or MB/s, GB/s or TB/s depending on 533 used suffix). Note that if latency or bandwidth value is 0, means 534 the corresponding latency or bandwidth information is not provided. 535 536 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory 537 belongs. size is the size of memory side cache in bytes. level is 538 the cache level described in this structure, note that the cache 539 level 0 should not be used with '\ ``hmat-cache``\ ' option. 540 associativity is the cache associativity, the possible value is 541 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy 542 is the write policy. line is the cache Line size in bytes. 543 544 For example, the following options describe 2 NUMA nodes. Node 0 has 545 2 cpus and a ram, node 1 has only a ram. The processors in node 0 546 access memory in node 0 with access-latency 5 nanoseconds, 547 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access 548 memory in NUMA node 1 with access-latency 10 nanoseconds, 549 access-bandwidth is 100 MB/s. And for memory side cache information, 550 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB, 551 policy is write-back, the cache Line size is 8 bytes: 552 553 :: 554 555 -machine hmat=on \ 556 -m 2G \ 557 -object memory-backend-ram,size=1G,id=m0 \ 558 -object memory-backend-ram,size=1G,id=m1 \ 559 -smp 2,sockets=2,maxcpus=2 \ 560 -numa node,nodeid=0,memdev=m0 \ 561 -numa node,nodeid=1,memdev=m1,initiator=0 \ 562 -numa cpu,node-id=0,socket-id=0 \ 563 -numa cpu,node-id=0,socket-id=1 \ 564 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \ 565 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \ 566 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \ 567 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \ 568 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \ 569 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8 570ERST 571 572DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd, 573 "-add-fd fd=fd,set=set[,opaque=opaque]\n" 574 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL) 575SRST 576``-add-fd fd=fd,set=set[,opaque=opaque]`` 577 Add a file descriptor to an fd set. Valid options are: 578 579 ``fd=fd`` 580 This option defines the file descriptor of which a duplicate is 581 added to fd set. The file descriptor cannot be stdin, stdout, or 582 stderr. 583 584 ``set=set`` 585 This option defines the ID of the fd set to add the file 586 descriptor to. 587 588 ``opaque=opaque`` 589 This option defines a free-form string that can be used to 590 describe fd. 591 592 You can open an image using pre-opened file descriptors from an fd 593 set: 594 595 .. parsed-literal:: 596 597 |qemu_system| \\ 598 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\ 599 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\ 600 -drive file=/dev/fdset/2,index=0,media=disk 601ERST 602 603DEF("set", HAS_ARG, QEMU_OPTION_set, 604 "-set group.id.arg=value\n" 605 " set <arg> parameter for item <id> of type <group>\n" 606 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL) 607SRST 608``-set group.id.arg=value`` 609 Set parameter arg for item id of type group 610ERST 611 612DEF("global", HAS_ARG, QEMU_OPTION_global, 613 "-global driver.property=value\n" 614 "-global driver=driver,property=property,value=value\n" 615 " set a global default for a driver property\n", 616 QEMU_ARCH_ALL) 617SRST 618``-global driver.prop=value`` 619 \ 620``-global driver=driver,property=property,value=value`` 621 Set default value of driver's property prop to value, e.g.: 622 623 .. parsed-literal:: 624 625 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img 626 627 In particular, you can use this to set driver properties for devices 628 which are created automatically by the machine model. To create a 629 device which is not created automatically and set properties on it, 630 use -``device``. 631 632 -global driver.prop=value is shorthand for -global 633 driver=driver,property=prop,value=value. The longhand syntax works 634 even when driver contains a dot. 635ERST 636 637DEF("boot", HAS_ARG, QEMU_OPTION_boot, 638 "-boot [order=drives][,once=drives][,menu=on|off]\n" 639 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n" 640 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n" 641 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n" 642 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n" 643 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n", 644 QEMU_ARCH_ALL) 645SRST 646``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]`` 647 Specify boot order drives as a string of drive letters. Valid drive 648 letters depend on the target architecture. The x86 PC uses: a, b 649 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p 650 (Etherboot from network adapter 1-4), hard disk boot is the default. 651 To apply a particular boot order only on the first startup, specify 652 it via ``once``. Note that the ``order`` or ``once`` parameter 653 should not be used together with the ``bootindex`` property of 654 devices, since the firmware implementations normally do not support 655 both at the same time. 656 657 Interactive boot menus/prompts can be enabled via ``menu=on`` as far 658 as firmware/BIOS supports them. The default is non-interactive boot. 659 660 A splash picture could be passed to bios, enabling user to show it 661 as logo, when option splash=sp\_name is given and menu=on, If 662 firmware/BIOS supports them. Currently Seabios for X86 system 663 support it. limitation: The splash file could be a jpeg file or a 664 BMP file in 24 BPP format(true color). The resolution should be 665 supported by the SVGA mode, so the recommended is 320x240, 640x480, 666 800x640. 667 668 A timeout could be passed to bios, guest will pause for rb\_timeout 669 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will 670 not reboot, qemu passes '-1' to bios by default. Currently Seabios 671 for X86 system support it. 672 673 Do strict boot via ``strict=on`` as far as firmware/BIOS supports 674 it. This only effects when boot priority is changed by bootindex 675 options. The default is non-strict boot. 676 677 .. parsed-literal:: 678 679 # try to boot from network first, then from hard disk 680 |qemu_system_x86| -boot order=nc 681 # boot from CD-ROM first, switch back to default order after reboot 682 |qemu_system_x86| -boot once=d 683 # boot with a splash picture for 5 seconds. 684 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000 685 686 Note: The legacy format '-boot drives' is still supported but its 687 use is discouraged as it may be removed from future versions. 688ERST 689 690DEF("m", HAS_ARG, QEMU_OPTION_m, 691 "-m [size=]megs[,slots=n,maxmem=size]\n" 692 " configure guest RAM\n" 693 " size: initial amount of guest memory\n" 694 " slots: number of hotplug slots (default: none)\n" 695 " maxmem: maximum amount of guest memory (default: none)\n" 696 " Note: Some architectures might enforce a specific granularity\n", 697 QEMU_ARCH_ALL) 698SRST 699``-m [size=]megs[,slots=n,maxmem=size]`` 700 Sets guest startup RAM size to megs megabytes. Default is 128 MiB. 701 Optionally, a suffix of "M" or "G" can be used to signify a value in 702 megabytes or gigabytes respectively. Optional pair slots, maxmem 703 could be used to set amount of hotpluggable memory slots and maximum 704 amount of memory. Note that maxmem must be aligned to the page size. 705 706 For example, the following command-line sets the guest startup RAM 707 size to 1GB, creates 3 slots to hotplug additional memory and sets 708 the maximum memory the guest can reach to 4GB: 709 710 .. parsed-literal:: 711 712 |qemu_system| -m 1G,slots=3,maxmem=4G 713 714 If slots and maxmem are not specified, memory hotplug won't be 715 enabled and the guest startup RAM will never increase. 716ERST 717 718DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath, 719 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL) 720SRST 721``-mem-path path`` 722 Allocate guest RAM from a temporarily created file in path. 723ERST 724 725DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc, 726 "-mem-prealloc preallocate guest memory (use with -mem-path)\n", 727 QEMU_ARCH_ALL) 728SRST 729``-mem-prealloc`` 730 Preallocate memory when using -mem-path. 731ERST 732 733DEF("k", HAS_ARG, QEMU_OPTION_k, 734 "-k language use keyboard layout (for example 'fr' for French)\n", 735 QEMU_ARCH_ALL) 736SRST 737``-k language`` 738 Use keyboard layout language (for example ``fr`` for French). This 739 option is only needed where it is not easy to get raw PC keycodes 740 (e.g. on Macs, with some X11 servers or with a VNC or curses 741 display). You don't normally need to use it on PC/Linux or 742 PC/Windows hosts. 743 744 The available layouts are: 745 746 :: 747 748 ar de-ch es fo fr-ca hu ja mk no pt-br sv 749 da en-gb et fr fr-ch is lt nl pl ru th 750 de en-us fi fr-be hr it lv nl-be pt sl tr 751 752 The default is ``en-us``. 753ERST 754 755 756DEF("audio", HAS_ARG, QEMU_OPTION_audio, 757 "-audio [driver=]driver[,prop[=value][,...]]\n" 758 " specifies default audio backend when `audiodev` is not\n" 759 " used to create a machine or sound device;" 760 " options are the same as for -audiodev\n" 761 "-audio [driver=]driver,model=value[,prop[=value][,...]]\n" 762 " specifies the audio backend and device to use;\n" 763 " apart from 'model', options are the same as for -audiodev.\n" 764 " use '-audio model=help' to show possible devices.\n", 765 QEMU_ARCH_ALL) 766SRST 767``-audio [driver=]driver[,model=value][,prop[=value][,...]]`` 768 If the ``model`` option is specified, ``-audio`` is a shortcut 769 for configuring both the guest audio hardware and the host audio 770 backend in one go. The guest hardware model can be set with 771 ``model=modelname``. Use ``model=help`` to list the available 772 device types. 773 774 The following two example do exactly the same, to show how ``-audio`` 775 can be used to shorten the command line length: 776 777 .. parsed-literal:: 778 779 |qemu_system| -audiodev pa,id=pa -device sb16,audiodev=pa 780 |qemu_system| -audio pa,model=sb16 781 782 If the ``model`` option is not specified, ``-audio`` is used to 783 configure a default audio backend that will be used whenever the 784 ``audiodev`` property is not set on a device or machine. In 785 particular, ``-audio none`` ensures that no audio is produced even 786 for machines that have embedded sound hardware. 787 788 In both cases, the driver option is the same as with the corresponding 789 ``-audiodev`` option below. Use ``driver=help`` to list the available 790 drivers. 791 792ERST 793 794DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev, 795 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n" 796 " specifies the audio backend to use\n" 797 " Use ``-audiodev help`` to list the available drivers\n" 798 " id= identifier of the backend\n" 799 " timer-period= timer period in microseconds\n" 800 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n" 801 " in|out.fixed-settings= use fixed settings for host audio\n" 802 " in|out.frequency= frequency to use with fixed settings\n" 803 " in|out.channels= number of channels to use with fixed settings\n" 804 " in|out.format= sample format to use with fixed settings\n" 805 " valid values: s8, s16, s32, u8, u16, u32, f32\n" 806 " in|out.voices= number of voices to use\n" 807 " in|out.buffer-length= length of buffer in microseconds\n" 808 "-audiodev none,id=id,[,prop[=value][,...]]\n" 809 " dummy driver that discards all output\n" 810#ifdef CONFIG_AUDIO_ALSA 811 "-audiodev alsa,id=id[,prop[=value][,...]]\n" 812 " in|out.dev= name of the audio device to use\n" 813 " in|out.period-length= length of period in microseconds\n" 814 " in|out.try-poll= attempt to use poll mode\n" 815 " threshold= threshold (in microseconds) when playback starts\n" 816#endif 817#ifdef CONFIG_AUDIO_COREAUDIO 818 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n" 819 " in|out.buffer-count= number of buffers\n" 820#endif 821#ifdef CONFIG_AUDIO_DSOUND 822 "-audiodev dsound,id=id[,prop[=value][,...]]\n" 823 " latency= add extra latency to playback in microseconds\n" 824#endif 825#ifdef CONFIG_AUDIO_OSS 826 "-audiodev oss,id=id[,prop[=value][,...]]\n" 827 " in|out.dev= path of the audio device to use\n" 828 " in|out.buffer-count= number of buffers\n" 829 " in|out.try-poll= attempt to use poll mode\n" 830 " try-mmap= try using memory mapped access\n" 831 " exclusive= open device in exclusive mode\n" 832 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n" 833#endif 834#ifdef CONFIG_AUDIO_PA 835 "-audiodev pa,id=id[,prop[=value][,...]]\n" 836 " server= PulseAudio server address\n" 837 " in|out.name= source/sink device name\n" 838 " in|out.latency= desired latency in microseconds\n" 839#endif 840#ifdef CONFIG_AUDIO_PIPEWIRE 841 "-audiodev pipewire,id=id[,prop[=value][,...]]\n" 842 " in|out.name= source/sink device name\n" 843 " in|out.stream-name= name of pipewire stream\n" 844 " in|out.latency= desired latency in microseconds\n" 845#endif 846#ifdef CONFIG_AUDIO_SDL 847 "-audiodev sdl,id=id[,prop[=value][,...]]\n" 848 " in|out.buffer-count= number of buffers\n" 849#endif 850#ifdef CONFIG_AUDIO_SNDIO 851 "-audiodev sndio,id=id[,prop[=value][,...]]\n" 852#endif 853#ifdef CONFIG_SPICE 854 "-audiodev spice,id=id[,prop[=value][,...]]\n" 855#endif 856#ifdef CONFIG_DBUS_DISPLAY 857 "-audiodev dbus,id=id[,prop[=value][,...]]\n" 858#endif 859 "-audiodev wav,id=id[,prop[=value][,...]]\n" 860 " path= path of wav file to record\n", 861 QEMU_ARCH_ALL) 862SRST 863``-audiodev [driver=]driver,id=id[,prop[=value][,...]]`` 864 Adds a new audio backend driver identified by id. There are global 865 and driver specific properties. Some values can be set differently 866 for input and output, they're marked with ``in|out.``. You can set 867 the input's property with ``in.prop`` and the output's property with 868 ``out.prop``. For example: 869 870 :: 871 872 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000 873 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified 874 875 NOTE: parameter validation is known to be incomplete, in many cases 876 specifying an invalid option causes QEMU to print an error message 877 and continue emulation without sound. 878 879 Valid global options are: 880 881 ``id=identifier`` 882 Identifies the audio backend. 883 884 ``timer-period=period`` 885 Sets the timer period used by the audio subsystem in 886 microseconds. Default is 10000 (10 ms). 887 888 ``in|out.mixing-engine=on|off`` 889 Use QEMU's mixing engine to mix all streams inside QEMU and 890 convert audio formats when not supported by the backend. When 891 off, fixed-settings must be off too. Note that disabling this 892 option means that the selected backend must support multiple 893 streams and the audio formats used by the virtual cards, 894 otherwise you'll get no sound. It's not recommended to disable 895 this option unless you want to use 5.1 or 7.1 audio, as mixing 896 engine only supports mono and stereo audio. Default is on. 897 898 ``in|out.fixed-settings=on|off`` 899 Use fixed settings for host audio. When off, it will change 900 based on how the guest opens the sound card. In this case you 901 must not specify frequency, channels or format. Default is on. 902 903 ``in|out.frequency=frequency`` 904 Specify the frequency to use when using fixed-settings. Default 905 is 44100Hz. 906 907 ``in|out.channels=channels`` 908 Specify the number of channels to use when using fixed-settings. 909 Default is 2 (stereo). 910 911 ``in|out.format=format`` 912 Specify the sample format to use when using fixed-settings. 913 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``, 914 ``u32``, ``f32``. Default is ``s16``. 915 916 ``in|out.voices=voices`` 917 Specify the number of voices to use. Default is 1. 918 919 ``in|out.buffer-length=usecs`` 920 Sets the size of the buffer in microseconds. 921 922``-audiodev none,id=id[,prop[=value][,...]]`` 923 Creates a dummy backend that discards all outputs. This backend has 924 no backend specific properties. 925 926``-audiodev alsa,id=id[,prop[=value][,...]]`` 927 Creates backend using the ALSA. This backend is only available on 928 Linux. 929 930 ALSA specific options are: 931 932 ``in|out.dev=device`` 933 Specify the ALSA device to use for input and/or output. Default 934 is ``default``. 935 936 ``in|out.period-length=usecs`` 937 Sets the period length in microseconds. 938 939 ``in|out.try-poll=on|off`` 940 Attempt to use poll mode with the device. Default is on. 941 942 ``threshold=threshold`` 943 Threshold (in microseconds) when playback starts. Default is 0. 944 945``-audiodev coreaudio,id=id[,prop[=value][,...]]`` 946 Creates a backend using Apple's Core Audio. This backend is only 947 available on Mac OS and only supports playback. 948 949 Core Audio specific options are: 950 951 ``in|out.buffer-count=count`` 952 Sets the count of the buffers. 953 954``-audiodev dsound,id=id[,prop[=value][,...]]`` 955 Creates a backend using Microsoft's DirectSound. This backend is 956 only available on Windows and only supports playback. 957 958 DirectSound specific options are: 959 960 ``latency=usecs`` 961 Add extra usecs microseconds latency to playback. Default is 962 10000 (10 ms). 963 964``-audiodev oss,id=id[,prop[=value][,...]]`` 965 Creates a backend using OSS. This backend is available on most 966 Unix-like systems. 967 968 OSS specific options are: 969 970 ``in|out.dev=device`` 971 Specify the file name of the OSS device to use. Default is 972 ``/dev/dsp``. 973 974 ``in|out.buffer-count=count`` 975 Sets the count of the buffers. 976 977 ``in|out.try-poll=on|of`` 978 Attempt to use poll mode with the device. Default is on. 979 980 ``try-mmap=on|off`` 981 Try using memory mapped device access. Default is off. 982 983 ``exclusive=on|off`` 984 Open the device in exclusive mode (vmix won't work in this 985 case). Default is off. 986 987 ``dsp-policy=policy`` 988 Sets the timing policy (between 0 and 10, where smaller number 989 means smaller latency but higher CPU usage). Use -1 to use 990 buffer sizes specified by ``buffer`` and ``buffer-count``. This 991 option is ignored if you do not have OSS 4. Default is 5. 992 993``-audiodev pa,id=id[,prop[=value][,...]]`` 994 Creates a backend using PulseAudio. This backend is available on 995 most systems. 996 997 PulseAudio specific options are: 998 999 ``server=server`` 1000 Sets the PulseAudio server to connect to. 1001 1002 ``in|out.name=sink`` 1003 Use the specified source/sink for recording/playback. 1004 1005 ``in|out.latency=usecs`` 1006 Desired latency in microseconds. The PulseAudio server will try 1007 to honor this value but actual latencies may be lower or higher. 1008 1009``-audiodev pipewire,id=id[,prop[=value][,...]]`` 1010 Creates a backend using PipeWire. This backend is available on 1011 most systems. 1012 1013 PipeWire specific options are: 1014 1015 ``in|out.latency=usecs`` 1016 Desired latency in microseconds. 1017 1018 ``in|out.name=sink`` 1019 Use the specified source/sink for recording/playback. 1020 1021 ``in|out.stream-name`` 1022 Specify the name of pipewire stream. 1023 1024``-audiodev sdl,id=id[,prop[=value][,...]]`` 1025 Creates a backend using SDL. This backend is available on most 1026 systems, but you should use your platform's native backend if 1027 possible. 1028 1029 SDL specific options are: 1030 1031 ``in|out.buffer-count=count`` 1032 Sets the count of the buffers. 1033 1034``-audiodev sndio,id=id[,prop[=value][,...]]`` 1035 Creates a backend using SNDIO. This backend is available on 1036 OpenBSD and most other Unix-like systems. 1037 1038 Sndio specific options are: 1039 1040 ``in|out.dev=device`` 1041 Specify the sndio device to use for input and/or output. Default 1042 is ``default``. 1043 1044 ``in|out.latency=usecs`` 1045 Sets the desired period length in microseconds. 1046 1047``-audiodev spice,id=id[,prop[=value][,...]]`` 1048 Creates a backend that sends audio through SPICE. This backend 1049 requires ``-spice`` and automatically selected in that case, so 1050 usually you can ignore this option. This backend has no backend 1051 specific properties. 1052 1053``-audiodev wav,id=id[,prop[=value][,...]]`` 1054 Creates a backend that writes audio to a WAV file. 1055 1056 Backend specific options are: 1057 1058 ``path=path`` 1059 Write recorded audio into the specified file. Default is 1060 ``qemu.wav``. 1061ERST 1062 1063DEF("device", HAS_ARG, QEMU_OPTION_device, 1064 "-device driver[,prop[=value][,...]]\n" 1065 " add device (based on driver)\n" 1066 " prop=value,... sets driver properties\n" 1067 " use '-device help' to print all possible drivers\n" 1068 " use '-device driver,help' to print all possible properties\n", 1069 QEMU_ARCH_ALL) 1070SRST 1071``-device driver[,prop[=value][,...]]`` 1072 Add device driver. prop=value sets driver properties. Valid 1073 properties depend on the driver. To get help on possible drivers and 1074 properties, use ``-device help`` and ``-device driver,help``. 1075 1076 Some drivers are: 1077 1078``-device ipmi-bmc-sim,id=id[,prop[=value][,...]]`` 1079 Add an IPMI BMC. This is a simulation of a hardware management 1080 interface processor that normally sits on a system. It provides a 1081 watchdog and the ability to reset and power control the system. You 1082 need to connect this to an IPMI interface to make it useful 1083 1084 The IPMI slave address to use for the BMC. The default is 0x20. This 1085 address is the BMC's address on the I2C network of management 1086 controllers. If you don't know what this means, it is safe to ignore 1087 it. 1088 1089 ``id=id`` 1090 The BMC id for interfaces to use this device. 1091 1092 ``slave_addr=val`` 1093 Define slave address to use for the BMC. The default is 0x20. 1094 1095 ``sdrfile=file`` 1096 file containing raw Sensor Data Records (SDR) data. The default 1097 is none. 1098 1099 ``fruareasize=val`` 1100 size of a Field Replaceable Unit (FRU) area. The default is 1101 1024. 1102 1103 ``frudatafile=file`` 1104 file containing raw Field Replaceable Unit (FRU) inventory data. 1105 The default is none. 1106 1107 ``guid=uuid`` 1108 value for the GUID for the BMC, in standard UUID format. If this 1109 is set, get "Get GUID" command to the BMC will return it. 1110 Otherwise "Get GUID" will return an error. 1111 1112``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]`` 1113 Add a connection to an external IPMI BMC simulator. Instead of 1114 locally emulating the BMC like the above item, instead connect to an 1115 external entity that provides the IPMI services. 1116 1117 A connection is made to an external BMC simulator. If you do this, 1118 it is strongly recommended that you use the "reconnect-ms=" chardev 1119 option to reconnect to the simulator if the connection is lost. Note 1120 that if this is not used carefully, it can be a security issue, as 1121 the interface has the ability to send resets, NMIs, and power off 1122 the VM. It's best if QEMU makes a connection to an external 1123 simulator running on a secure port on localhost, so neither the 1124 simulator nor QEMU is exposed to any outside network. 1125 1126 See the "lanserv/README.vm" file in the OpenIPMI library for more 1127 details on the external interface. 1128 1129``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]`` 1130 Add a KCS IPMI interface on the ISA bus. This also adds a 1131 corresponding ACPI and SMBIOS entries, if appropriate. 1132 1133 ``bmc=id`` 1134 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern 1135 above. 1136 1137 ``ioport=val`` 1138 Define the I/O address of the interface. The default is 0xca0 1139 for KCS. 1140 1141 ``irq=val`` 1142 Define the interrupt to use. The default is 5. To disable 1143 interrupts, set this to 0. 1144 1145``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]`` 1146 Like the KCS interface, but defines a BT interface. The default port 1147 is 0xe4 and the default interrupt is 5. 1148 1149``-device pci-ipmi-kcs,bmc=id`` 1150 Add a KCS IPMI interface on the PCI bus. 1151 1152 ``bmc=id`` 1153 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above. 1154 1155``-device pci-ipmi-bt,bmc=id`` 1156 Like the KCS interface, but defines a BT interface on the PCI bus. 1157 1158``-device intel-iommu[,option=...]`` 1159 This is only supported by ``-machine q35``, which will enable Intel VT-d 1160 emulation within the guest. It supports below options: 1161 1162 ``intremap=on|off`` (default: auto) 1163 This enables interrupt remapping feature. It's required to enable 1164 complete x2apic. Currently it only supports kvm kernel-irqchip modes 1165 ``off`` or ``split``, while full kernel-irqchip is not yet supported. 1166 The default value is "auto", which will be decided by the mode of 1167 kernel-irqchip. 1168 1169 ``caching-mode=on|off`` (default: off) 1170 This enables caching mode for the VT-d emulated device. When 1171 caching-mode is enabled, each guest DMA buffer mapping will generate an 1172 IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in 1173 a synchronous way. It is required for ``-device vfio-pci`` to work 1174 with the VT-d device, because host assigned devices requires to setup 1175 the DMA mapping on the host before guest DMA starts. 1176 1177 ``device-iotlb=on|off`` (default: off) 1178 This enables device-iotlb capability for the emulated VT-d device. So 1179 far virtio/vhost should be the only real user for this parameter, 1180 paired with ats=on configured for the device. 1181 1182 ``aw-bits=39|48`` (default: 39) 1183 This decides the address width of IOVA address space. The address 1184 space has 39 bits width for 3-level IOMMU page tables, and 48 bits for 1185 4-level IOMMU page tables. 1186 1187 Please also refer to the wiki page for general scenarios of VT-d 1188 emulation in QEMU: https://wiki.qemu.org/Features/VT-d. 1189 1190``-device virtio-iommu-pci[,option=...]`` 1191 This is only supported by ``-machine q35`` (x86_64) and ``-machine virt`` (ARM). 1192 It supports below options: 1193 1194 ``granule=val`` (possible values are 4k, 8k, 16k, 64k and host; default: host) 1195 This decides the default granule to be be exposed by the 1196 virtio-iommu. If host, the granule matches the host page size. 1197 1198 ``aw-bits=val`` (val between 32 and 64, default depends on machine) 1199 This decides the address width of the IOVA address space. 1200 1201ERST 1202 1203DEF("name", HAS_ARG, QEMU_OPTION_name, 1204 "-name string1[,process=string2][,debug-threads=on|off]\n" 1205 " set the name of the guest\n" 1206 " string1 sets the window title and string2 the process name\n" 1207 " When debug-threads is enabled, individual threads are given a separate name\n" 1208 " NOTE: The thread names are for debugging and not a stable API.\n", 1209 QEMU_ARCH_ALL) 1210SRST 1211``-name name`` 1212 Sets the name of the guest. This name will be displayed in the SDL 1213 window caption. The name will also be used for the VNC server. Also 1214 optionally set the top visible process name in Linux. Naming of 1215 individual threads can also be enabled on Linux to aid debugging. 1216ERST 1217 1218DEF("uuid", HAS_ARG, QEMU_OPTION_uuid, 1219 "-uuid %08x-%04x-%04x-%04x-%012x\n" 1220 " specify machine UUID\n", QEMU_ARCH_ALL) 1221SRST 1222``-uuid uuid`` 1223 Set system UUID. 1224ERST 1225 1226DEFHEADING() 1227 1228DEFHEADING(Block device options:) 1229 1230SRST 1231The QEMU block device handling options have a long history and 1232have gone through several iterations as the feature set and complexity 1233of the block layer have grown. Many online guides to QEMU often 1234reference older and deprecated options, which can lead to confusion. 1235 1236The most explicit way to describe disks is to use a combination of 1237``-device`` to specify the hardware device and ``-blockdev`` to 1238describe the backend. The device defines what the guest sees and the 1239backend describes how QEMU handles the data. It is the only guaranteed 1240stable interface for describing block devices and as such is 1241recommended for management tools and scripting. 1242 1243The ``-drive`` option combines the device and backend into a single 1244command line option which is a more human friendly. There is however no 1245interface stability guarantee although some older board models still 1246need updating to work with the modern blockdev forms. 1247 1248Older options like ``-hda`` are essentially macros which expand into 1249``-drive`` options for various drive interfaces. The original forms 1250bake in a lot of assumptions from the days when QEMU was emulating a 1251legacy PC, they are not recommended for modern configurations. 1252 1253ERST 1254 1255DEF("fda", HAS_ARG, QEMU_OPTION_fda, 1256 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL) 1257DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL) 1258SRST 1259``-fda file`` 1260 \ 1261``-fdb file`` 1262 Use file as floppy disk 0/1 image (see the :ref:`disk images` chapter in 1263 the System Emulation Users Guide). 1264ERST 1265 1266DEF("hda", HAS_ARG, QEMU_OPTION_hda, 1267 "-hda/-hdb file use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL) 1268DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL) 1269DEF("hdc", HAS_ARG, QEMU_OPTION_hdc, 1270 "-hdc/-hdd file use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL) 1271DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL) 1272SRST 1273``-hda file`` 1274 \ 1275``-hdb file`` 1276 \ 1277``-hdc file`` 1278 \ 1279``-hdd file`` 1280 Use file as hard disk 0, 1, 2 or 3 image on the default bus of the 1281 emulated machine (this is for example the IDE bus on most x86 machines, 1282 but it can also be SCSI, virtio or something else on other target 1283 architectures). See also the :ref:`disk images` chapter in the System 1284 Emulation Users Guide. 1285ERST 1286 1287DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom, 1288 "-cdrom file use 'file' as CD-ROM image\n", 1289 QEMU_ARCH_ALL) 1290SRST 1291``-cdrom file`` 1292 Use file as CD-ROM image on the default bus of the emulated machine 1293 (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom`` 1294 at the same time there). On systems that support it, you can use the 1295 host CD-ROM by using ``/dev/cdrom`` as filename. 1296ERST 1297 1298DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev, 1299 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n" 1300 " [,cache.direct=on|off][,cache.no-flush=on|off]\n" 1301 " [,read-only=on|off][,auto-read-only=on|off]\n" 1302 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n" 1303 " [,driver specific parameters...]\n" 1304 " configure a block backend\n", QEMU_ARCH_ALL) 1305SRST 1306``-blockdev option[,option[,option[,...]]]`` 1307 Define a new block driver node. Some of the options apply to all 1308 block drivers, other options are only accepted for a specific block 1309 driver. See below for a list of generic options and options for the 1310 most common block drivers. 1311 1312 Options that expect a reference to another node (e.g. ``file``) can 1313 be given in two ways. Either you specify the node name of an already 1314 existing node (file=node-name), or you define a new node inline, 1315 adding options for the referenced node after a dot 1316 (file.filename=path,file.aio=native). 1317 1318 A block driver node created with ``-blockdev`` can be used for a 1319 guest device by specifying its node name for the ``drive`` property 1320 in a ``-device`` argument that defines a block device. 1321 1322 ``Valid options for any block driver node:`` 1323 ``driver`` 1324 Specifies the block driver to use for the given node. 1325 1326 ``node-name`` 1327 This defines the name of the block driver node by which it 1328 will be referenced later. The name must be unique, i.e. it 1329 must not match the name of a different block driver node, or 1330 (if you use ``-drive`` as well) the ID of a drive. 1331 1332 If no node name is specified, it is automatically generated. 1333 The generated node name is not intended to be predictable 1334 and changes between QEMU invocations. For the top level, an 1335 explicit node name must be specified. 1336 1337 ``read-only`` 1338 Open the node read-only. Guest write attempts will fail. 1339 1340 Note that some block drivers support only read-only access, 1341 either generally or in certain configurations. In this case, 1342 the default value ``read-only=off`` does not work and the 1343 option must be specified explicitly. 1344 1345 ``auto-read-only`` 1346 If ``auto-read-only=on`` is set, QEMU may fall back to 1347 read-only usage even when ``read-only=off`` is requested, or 1348 even switch between modes as needed, e.g. depending on 1349 whether the image file is writable or whether a writing user 1350 is attached to the node. 1351 1352 ``force-share`` 1353 Override the image locking system of QEMU by forcing the 1354 node to utilize weaker shared access for permissions where 1355 it would normally request exclusive access. When there is 1356 the potential for multiple instances to have the same file 1357 open (whether this invocation of QEMU is the first or the 1358 second instance), both instances must permit shared access 1359 for the second instance to succeed at opening the file. 1360 1361 Enabling ``force-share=on`` requires ``read-only=on``. 1362 1363 ``cache.direct`` 1364 The host page cache can be avoided with ``cache.direct=on``. 1365 This will attempt to do disk IO directly to the guest's 1366 memory. QEMU may still perform an internal copy of the data. 1367 1368 ``cache.no-flush`` 1369 In case you don't care about data integrity over host 1370 failures, you can use ``cache.no-flush=on``. This option 1371 tells QEMU that it never needs to write any data to the disk 1372 but can instead keep things in cache. If anything goes 1373 wrong, like your host losing power, the disk storage getting 1374 disconnected accidentally, etc. your image will most 1375 probably be rendered unusable. 1376 1377 ``discard=discard`` 1378 discard is one of "ignore" (or "off") or "unmap" (or "on") 1379 and controls whether ``discard`` (also known as ``trim`` or 1380 ``unmap``) requests are ignored or passed to the filesystem. 1381 Some machine types may not support discard requests. 1382 1383 ``detect-zeroes=detect-zeroes`` 1384 detect-zeroes is "off", "on" or "unmap" and enables the 1385 automatic conversion of plain zero writes by the OS to 1386 driver specific optimized zero write commands. You may even 1387 choose "unmap" if discard is set to "unmap" to allow a zero 1388 write to be converted to an ``unmap`` operation. 1389 1390 ``Driver-specific options for file`` 1391 This is the protocol-level block driver for accessing regular 1392 files. 1393 1394 ``filename`` 1395 The path to the image file in the local filesystem 1396 1397 ``aio`` 1398 Specifies the AIO backend (threads/native/io_uring, 1399 default: threads) 1400 1401 ``locking`` 1402 Specifies whether the image file is protected with Linux OFD 1403 / POSIX locks. The default is to use the Linux Open File 1404 Descriptor API if available, otherwise no lock is applied. 1405 (auto/on/off, default: auto) 1406 1407 Example: 1408 1409 :: 1410 1411 -blockdev driver=file,node-name=disk,filename=disk.img 1412 1413 ``Driver-specific options for raw`` 1414 This is the image format block driver for raw images. It is 1415 usually stacked on top of a protocol level block driver such as 1416 ``file``. 1417 1418 ``file`` 1419 Reference to or definition of the data source block driver 1420 node (e.g. a ``file`` driver node) 1421 1422 Example 1: 1423 1424 :: 1425 1426 -blockdev driver=file,node-name=disk_file,filename=disk.img 1427 -blockdev driver=raw,node-name=disk,file=disk_file 1428 1429 Example 2: 1430 1431 :: 1432 1433 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img 1434 1435 ``Driver-specific options for qcow2`` 1436 This is the image format block driver for qcow2 images. It is 1437 usually stacked on top of a protocol level block driver such as 1438 ``file``. 1439 1440 ``file`` 1441 Reference to or definition of the data source block driver 1442 node (e.g. a ``file`` driver node) 1443 1444 ``backing`` 1445 Reference to or definition of the backing file block device 1446 (default is taken from the image file). It is allowed to 1447 pass ``null`` here in order to disable the default backing 1448 file. 1449 1450 ``lazy-refcounts`` 1451 Whether to enable the lazy refcounts feature (on/off; 1452 default is taken from the image file) 1453 1454 ``cache-size`` 1455 The maximum total size of the L2 table and refcount block 1456 caches in bytes (default: the sum of l2-cache-size and 1457 refcount-cache-size) 1458 1459 ``l2-cache-size`` 1460 The maximum size of the L2 table cache in bytes (default: if 1461 cache-size is not specified - 32M on Linux platforms, and 8M 1462 on non-Linux platforms; otherwise, as large as possible 1463 within the cache-size, while permitting the requested or the 1464 minimal refcount cache size) 1465 1466 ``refcount-cache-size`` 1467 The maximum size of the refcount block cache in bytes 1468 (default: 4 times the cluster size; or if cache-size is 1469 specified, the part of it which is not used for the L2 1470 cache) 1471 1472 ``cache-clean-interval`` 1473 Clean unused entries in the L2 and refcount caches. The 1474 interval is in seconds. The default value is 600 on 1475 supporting platforms, and 0 on other platforms. Setting it 1476 to 0 disables this feature. 1477 1478 ``pass-discard-request`` 1479 Whether discard requests to the qcow2 device should be 1480 forwarded to the data source (on/off; default: on if 1481 discard=unmap is specified, off otherwise) 1482 1483 ``pass-discard-snapshot`` 1484 Whether discard requests for the data source should be 1485 issued when a snapshot operation (e.g. deleting a snapshot) 1486 frees clusters in the qcow2 file (on/off; default: on) 1487 1488 ``pass-discard-other`` 1489 Whether discard requests for the data source should be 1490 issued on other occasions where a cluster gets freed 1491 (on/off; default: off) 1492 1493 ``discard-no-unref`` 1494 When enabled, data clusters will remain preallocated when they are 1495 no longer used, e.g. because they are discarded or converted to 1496 zero clusters. As usual, whether the old data is discarded or kept 1497 on the protocol level (i.e. in the image file) depends on the 1498 setting of the pass-discard-request option. Keeping the clusters 1499 preallocated prevents qcow2 fragmentation that would otherwise be 1500 caused by freeing and re-allocating them later. Besides potential 1501 performance degradation, such fragmentation can lead to increased 1502 allocation of clusters past the end of the image file, 1503 resulting in image files whose file length can grow much larger 1504 than their guest disk size would suggest. 1505 If image file length is of concern (e.g. when storing qcow2 1506 images directly on block devices), you should consider enabling 1507 this option. 1508 1509 ``overlap-check`` 1510 Which overlap checks to perform for writes to the image 1511 (none/constant/cached/all; default: cached). For details or 1512 finer granularity control refer to the QAPI documentation of 1513 ``blockdev-add``. 1514 1515 Example 1: 1516 1517 :: 1518 1519 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2 1520 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216 1521 1522 Example 2: 1523 1524 :: 1525 1526 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2 1527 1528 ``Driver-specific options for other drivers`` 1529 Please refer to the QAPI documentation of the ``blockdev-add`` 1530 QMP command. 1531ERST 1532 1533DEF("drive", HAS_ARG, QEMU_OPTION_drive, 1534 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" 1535 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" 1536 " [,snapshot=on|off][,rerror=ignore|stop|report]\n" 1537 " [,werror=ignore|stop|report|enospc][,id=name]\n" 1538 " [,aio=threads|native|io_uring]\n" 1539 " [,readonly=on|off][,copy-on-read=on|off]\n" 1540 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n" 1541 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n" 1542 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n" 1543 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n" 1544 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n" 1545 " [[,iops_size=is]]\n" 1546 " [[,group=g]]\n" 1547 " use 'file' as a drive image\n", QEMU_ARCH_ALL) 1548SRST 1549``-drive option[,option[,option[,...]]]`` 1550 Define a new drive. This includes creating a block driver node (the 1551 backend) as well as a guest device, and is mostly a shortcut for 1552 defining the corresponding ``-blockdev`` and ``-device`` options. 1553 1554 ``-drive`` accepts all options that are accepted by ``-blockdev``. 1555 In addition, it knows the following options: 1556 1557 ``file=file`` 1558 This option defines which disk image (see the :ref:`disk images` 1559 chapter in the System Emulation Users Guide) to use with this drive. 1560 If the filename contains comma, you must double it (for instance, 1561 "file=my,,file" to use file "my,file"). 1562 1563 Special files such as iSCSI devices can be specified using 1564 protocol specific URLs. See the section for "Device URL Syntax" 1565 for more information. 1566 1567 ``if=interface`` 1568 This option defines on which type on interface the drive is 1569 connected. Available types are: ide, scsi, sd, mtd, floppy, 1570 pflash, virtio, none. 1571 1572 ``bus=bus,unit=unit`` 1573 These options define where is connected the drive by defining 1574 the bus number and the unit id. 1575 1576 ``index=index`` 1577 This option defines where the drive is connected by using an 1578 index in the list of available connectors of a given interface 1579 type. 1580 1581 ``media=media`` 1582 This option defines the type of the media: disk or cdrom. 1583 1584 ``snapshot=snapshot`` 1585 snapshot is "on" or "off" and controls snapshot mode for the 1586 given drive (see ``-snapshot``). 1587 1588 ``cache=cache`` 1589 cache is "none", "writeback", "unsafe", "directsync" or 1590 "writethrough" and controls how the host cache is used to access 1591 block data. This is a shortcut that sets the ``cache.direct`` 1592 and ``cache.no-flush`` options (as in ``-blockdev``), and 1593 additionally ``cache.writeback``, which provides a default for 1594 the ``write-cache`` option of block guest devices (as in 1595 ``-device``). The modes correspond to the following settings: 1596 1597 ============= =============== ============ ============== 1598 \ cache.writeback cache.direct cache.no-flush 1599 ============= =============== ============ ============== 1600 writeback on off off 1601 none on on off 1602 writethrough off off off 1603 directsync off on off 1604 unsafe on off on 1605 ============= =============== ============ ============== 1606 1607 The default mode is ``cache=writeback``. 1608 1609 ``aio=aio`` 1610 aio is "threads", "native", or "io_uring" and selects between pthread 1611 based disk I/O, native Linux AIO, or Linux io_uring API. 1612 1613 ``format=format`` 1614 Specify which disk format will be used rather than detecting the 1615 format. Can be used to specify format=raw to avoid interpreting 1616 an untrusted format header. 1617 1618 ``werror=action,rerror=action`` 1619 Specify which action to take on write and read errors. Valid 1620 actions are: "ignore" (ignore the error and try to continue), 1621 "stop" (pause QEMU), "report" (report the error to the guest), 1622 "enospc" (pause QEMU only if the host disk is full; report the 1623 error to the guest otherwise). The default setting is 1624 ``werror=enospc`` and ``rerror=report``. 1625 1626 ``copy-on-read=copy-on-read`` 1627 copy-on-read is "on" or "off" and enables whether to copy read 1628 backing file sectors into the image file. 1629 1630 ``bps=b,bps_rd=r,bps_wr=w`` 1631 Specify bandwidth throttling limits in bytes per second, either 1632 for all request types or for reads or writes only. Small values 1633 can lead to timeouts or hangs inside the guest. A safe minimum 1634 for disks is 2 MB/s. 1635 1636 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm`` 1637 Specify bursts in bytes per second, either for all request types 1638 or for reads or writes only. Bursts allow the guest I/O to spike 1639 above the limit temporarily. 1640 1641 ``iops=i,iops_rd=r,iops_wr=w`` 1642 Specify request rate limits in requests per second, either for 1643 all request types or for reads or writes only. 1644 1645 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm`` 1646 Specify bursts in requests per second, either for all request 1647 types or for reads or writes only. Bursts allow the guest I/O to 1648 spike above the limit temporarily. 1649 1650 ``iops_size=is`` 1651 Let every is bytes of a request count as a new request for iops 1652 throttling purposes. Use this option to prevent guests from 1653 circumventing iops limits by sending fewer but larger requests. 1654 1655 ``group=g`` 1656 Join a throttling quota group with given name g. All drives that 1657 are members of the same group are accounted for together. Use 1658 this option to prevent guests from circumventing throttling 1659 limits by using many small disks instead of a single larger 1660 disk. 1661 1662 By default, the ``cache.writeback=on`` mode is used. It will report 1663 data writes as completed as soon as the data is present in the host 1664 page cache. This is safe as long as your guest OS makes sure to 1665 correctly flush disk caches where needed. If your guest OS does not 1666 handle volatile disk write caches correctly and your host crashes or 1667 loses power, then the guest may experience data corruption. 1668 1669 For such guests, you should consider using ``cache.writeback=off``. 1670 This means that the host page cache will be used to read and write 1671 data, but write notification will be sent to the guest only after 1672 QEMU has made sure to flush each write to the disk. Be aware that 1673 this has a major impact on performance. 1674 1675 When using the ``-snapshot`` option, unsafe caching is always used. 1676 1677 Copy-on-read avoids accessing the same backing file sectors 1678 repeatedly and is useful when the backing file is over a slow 1679 network. By default copy-on-read is off. 1680 1681 Instead of ``-cdrom`` you can use: 1682 1683 .. parsed-literal:: 1684 1685 |qemu_system| -drive file=file,index=2,media=cdrom 1686 1687 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use: 1688 1689 .. parsed-literal:: 1690 1691 |qemu_system| -drive file=file,index=0,media=disk 1692 |qemu_system| -drive file=file,index=1,media=disk 1693 |qemu_system| -drive file=file,index=2,media=disk 1694 |qemu_system| -drive file=file,index=3,media=disk 1695 1696 You can open an image using pre-opened file descriptors from an fd 1697 set: 1698 1699 .. parsed-literal:: 1700 1701 |qemu_system| \\ 1702 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\ 1703 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\ 1704 -drive file=/dev/fdset/2,index=0,media=disk 1705 1706 You can connect a CDROM to the slave of ide0: 1707 1708 .. parsed-literal:: 1709 1710 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom 1711 1712 If you don't specify the "file=" argument, you define an empty 1713 drive: 1714 1715 .. parsed-literal:: 1716 1717 |qemu_system_x86| -drive if=ide,index=1,media=cdrom 1718 1719 Instead of ``-fda``, ``-fdb``, you can use: 1720 1721 .. parsed-literal:: 1722 1723 |qemu_system_x86| -drive file=file,index=0,if=floppy 1724 |qemu_system_x86| -drive file=file,index=1,if=floppy 1725 1726 By default, interface is "ide" and index is automatically 1727 incremented: 1728 1729 .. parsed-literal:: 1730 1731 |qemu_system_x86| -drive file=a -drive file=b 1732 1733 is interpreted like: 1734 1735 .. parsed-literal:: 1736 1737 |qemu_system_x86| -hda a -hdb b 1738ERST 1739 1740DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock, 1741 "-mtdblock file use 'file' as on-board Flash memory image\n", 1742 QEMU_ARCH_ALL) 1743SRST 1744``-mtdblock file`` 1745 Use file as on-board Flash memory image. 1746ERST 1747 1748DEF("sd", HAS_ARG, QEMU_OPTION_sd, 1749 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL) 1750SRST 1751``-sd file`` 1752 Use file as SecureDigital card image. 1753ERST 1754 1755DEF("snapshot", 0, QEMU_OPTION_snapshot, 1756 "-snapshot write to temporary files instead of disk image files\n", 1757 QEMU_ARCH_ALL) 1758SRST 1759``-snapshot`` 1760 Write to temporary files instead of disk image files. In this case, 1761 the raw disk image you use is not written back. You can however 1762 force the write back by pressing C-a s (see the :ref:`disk images` 1763 chapter in the System Emulation Users Guide). 1764 1765 .. warning:: 1766 snapshot is incompatible with ``-blockdev`` (instead use qemu-img 1767 to manually create snapshot images to attach to your blockdev). 1768 If you have mixed ``-blockdev`` and ``-drive`` declarations you 1769 can use the 'snapshot' property on your drive declarations 1770 instead of this global option. 1771 1772ERST 1773 1774DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev, 1775 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n" 1776 " [,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode]\n" 1777 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n" 1778 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n" 1779 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n" 1780 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n" 1781 " [[,throttling.iops-size=is]]\n" 1782 "-fsdev synth,id=id\n", 1783 QEMU_ARCH_ALL) 1784 1785SRST 1786``-fsdev local,id=id,path=path,security_model=security_model [,writeout=writeout][,readonly=on][,fmode=fmode][,dmode=dmode] [,throttling.option=value[,throttling.option=value[,...]]]`` 1787 \ 1788``-fsdev synth,id=id[,readonly=on]`` 1789 Define a new file system device. Valid options are: 1790 1791 ``local`` 1792 Accesses to the filesystem are done by QEMU. 1793 1794 ``synth`` 1795 Synthetic filesystem, only used by QTests. 1796 1797 ``id=id`` 1798 Specifies identifier for this device. 1799 1800 ``path=path`` 1801 Specifies the export path for the file system device. Files 1802 under this path will be available to the 9p client on the guest. 1803 1804 ``security_model=security_model`` 1805 Specifies the security model to be used for this export path. 1806 Supported security models are "passthrough", "mapped-xattr", 1807 "mapped-file" and "none". In "passthrough" security model, files 1808 are stored using the same credentials as they are created on the 1809 guest. This requires QEMU to run as root. In "mapped-xattr" 1810 security model, some of the file attributes like uid, gid, mode 1811 bits and link target are stored as file attributes. For 1812 "mapped-file" these attributes are stored in the hidden 1813 .virtfs\_metadata directory. Directories exported by this 1814 security model cannot interact with other unix tools. "none" 1815 security model is same as passthrough except the sever won't 1816 report failures if it fails to set file attributes like 1817 ownership. Security model is mandatory only for local fsdriver. 1818 1819 ``writeout=writeout`` 1820 This is an optional argument. The only supported value is 1821 "immediate". This means that host page cache will be used to 1822 read and write data but write notification will be sent to the 1823 guest only when the data has been reported as written by the 1824 storage subsystem. 1825 1826 ``readonly=on`` 1827 Enables exporting 9p share as a readonly mount for guests. By 1828 default read-write access is given. 1829 1830 ``fmode=fmode`` 1831 Specifies the default mode for newly created files on the host. 1832 Works only with security models "mapped-xattr" and 1833 "mapped-file". 1834 1835 ``dmode=dmode`` 1836 Specifies the default mode for newly created directories on the 1837 host. Works only with security models "mapped-xattr" and 1838 "mapped-file". 1839 1840 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w`` 1841 Specify bandwidth throttling limits in bytes per second, either 1842 for all request types or for reads or writes only. 1843 1844 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm`` 1845 Specify bursts in bytes per second, either for all request types 1846 or for reads or writes only. Bursts allow the guest I/O to spike 1847 above the limit temporarily. 1848 1849 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w`` 1850 Specify request rate limits in requests per second, either for 1851 all request types or for reads or writes only. 1852 1853 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm`` 1854 Specify bursts in requests per second, either for all request 1855 types or for reads or writes only. Bursts allow the guest I/O to 1856 spike above the limit temporarily. 1857 1858 ``throttling.iops-size=is`` 1859 Let every is bytes of a request count as a new request for iops 1860 throttling purposes. 1861 1862 -fsdev option is used along with -device driver "virtio-9p-...". 1863 1864``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag`` 1865 Options for virtio-9p-... driver are: 1866 1867 ``type`` 1868 Specifies the variant to be used. Supported values are "pci", 1869 "ccw" or "device", depending on the machine type. 1870 1871 ``fsdev=id`` 1872 Specifies the id value specified along with -fsdev option. 1873 1874 ``mount_tag=mount_tag`` 1875 Specifies the tag name to be used by the guest to mount this 1876 export point. 1877ERST 1878 1879DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs, 1880 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n" 1881 " [,id=id][,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n" 1882 "-virtfs synth,mount_tag=tag[,id=id][,readonly=on]\n", 1883 QEMU_ARCH_ALL) 1884 1885SRST 1886``-virtfs local,path=path,mount_tag=mount_tag ,security_model=security_model[,writeout=writeout][,readonly=on] [,fmode=fmode][,dmode=dmode][,multidevs=multidevs]`` 1887 \ 1888``-virtfs synth,mount_tag=mount_tag`` 1889 Define a new virtual filesystem device and expose it to the guest using 1890 a virtio-9p-device (a.k.a. 9pfs), which essentially means that a certain 1891 directory on host is made directly accessible by guest as a pass-through 1892 file system by using the 9P network protocol for communication between 1893 host and guests, if desired even accessible, shared by several guests 1894 simultaneously. 1895 1896 Note that ``-virtfs`` is actually just a convenience shortcut for its 1897 generalized form ``-fsdev -device virtio-9p-pci``. 1898 1899 The general form of pass-through file system options are: 1900 1901 ``local`` 1902 Accesses to the filesystem are done by QEMU. 1903 1904 ``synth`` 1905 Synthetic filesystem, only used by QTests. 1906 1907 ``id=id`` 1908 Specifies identifier for the filesystem device 1909 1910 ``path=path`` 1911 Specifies the export path for the file system device. Files 1912 under this path will be available to the 9p client on the guest. 1913 1914 ``security_model=security_model`` 1915 Specifies the security model to be used for this export path. 1916 Supported security models are "passthrough", "mapped-xattr", 1917 "mapped-file" and "none". In "passthrough" security model, files 1918 are stored using the same credentials as they are created on the 1919 guest. This requires QEMU to run as root. In "mapped-xattr" 1920 security model, some of the file attributes like uid, gid, mode 1921 bits and link target are stored as file attributes. For 1922 "mapped-file" these attributes are stored in the hidden 1923 .virtfs\_metadata directory. Directories exported by this 1924 security model cannot interact with other unix tools. "none" 1925 security model is same as passthrough except the sever won't 1926 report failures if it fails to set file attributes like 1927 ownership. Security model is mandatory only for local fsdriver. 1928 1929 ``writeout=writeout`` 1930 This is an optional argument. The only supported value is 1931 "immediate". This means that host page cache will be used to 1932 read and write data but write notification will be sent to the 1933 guest only when the data has been reported as written by the 1934 storage subsystem. 1935 1936 ``readonly=on`` 1937 Enables exporting 9p share as a readonly mount for guests. By 1938 default read-write access is given. 1939 1940 ``fmode=fmode`` 1941 Specifies the default mode for newly created files on the host. 1942 Works only with security models "mapped-xattr" and 1943 "mapped-file". 1944 1945 ``dmode=dmode`` 1946 Specifies the default mode for newly created directories on the 1947 host. Works only with security models "mapped-xattr" and 1948 "mapped-file". 1949 1950 ``mount_tag=mount_tag`` 1951 Specifies the tag name to be used by the guest to mount this 1952 export point. 1953 1954 ``multidevs=remap|forbid|warn`` 1955 Specifies how to deal with multiple devices being shared with 1956 the same 9p export in order to avoid file ID collisions on guest. 1957 Supported behaviours are either "remap" (default), "forbid" or 1958 "warn". 1959 1960 ``remap`` : assumes the possibility that more than one device is 1961 shared with the same 9p export. Therefore inode numbers from host 1962 are remapped for guest in a way that would prevent file ID 1963 collisions on guest. Remapping inodes in such cases is required 1964 because the original device IDs from host are never passed and 1965 exposed on guest. Instead all files of an export shared with 1966 virtfs always share the same device ID on guest. So two files 1967 with identical inode numbers but from actually different devices 1968 on host would otherwise cause a file ID collision and hence 1969 potential severe misbehaviours on guest. 1970 1971 ``warn`` : virtfs 9p expects only one device to be shared with 1972 the same export. If however more than one device is shared and 1973 accessed via the same 9p export then only a warning message is 1974 logged (once) by qemu on host side. No further action is performed 1975 in this case that would prevent file ID collisions on guest. This 1976 could thus lead to severe misbehaviours in this case like wrong 1977 files being accessed and data corruption on the exported tree. 1978 1979 ``forbid`` : assumes like "warn" that only one device is shared 1980 by the same 9p export, however it will not only log a warning 1981 message but also deny access to additional devices on guest. Note 1982 though that "forbid" does currently not block all possible file 1983 access operations (e.g. readdir() would still return entries from 1984 other devices). 1985ERST 1986 1987DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi, 1988 "-iscsi [user=user][,password=password][,password-secret=secret-id]\n" 1989 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE]\n" 1990 " [,initiator-name=initiator-iqn][,id=target-iqn]\n" 1991 " [,timeout=timeout]\n" 1992 " iSCSI session parameters\n", QEMU_ARCH_ALL) 1993 1994SRST 1995``-iscsi`` 1996 Configure iSCSI session parameters. 1997ERST 1998 1999DEFHEADING() 2000 2001DEFHEADING(USB convenience options:) 2002 2003DEF("usb", 0, QEMU_OPTION_usb, 2004 "-usb enable on-board USB host controller (if not enabled by default)\n", 2005 QEMU_ARCH_ALL) 2006SRST 2007``-usb`` 2008 Enable USB emulation on machine types with an on-board USB host 2009 controller (if not enabled by default). Note that on-board USB host 2010 controllers may not support USB 3.0. In this case 2011 ``-device qemu-xhci`` can be used instead on machines with PCI. 2012ERST 2013 2014DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice, 2015 "-usbdevice name add the host or guest USB device 'name'\n", 2016 QEMU_ARCH_ALL) 2017SRST 2018``-usbdevice devname`` 2019 Add the USB device devname, and enable an on-board USB controller 2020 if possible and necessary (just like it can be done via 2021 ``-machine usb=on``). Note that this option is mainly intended for 2022 the user's convenience only. More fine-grained control can be 2023 achieved by selecting a USB host controller (if necessary) and the 2024 desired USB device via the ``-device`` option instead. For example, 2025 instead of using ``-usbdevice mouse`` it is possible to use 2026 ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse 2027 to a USB 3.0 controller instead (at least on machines that support 2028 PCI and do not have an USB controller enabled by default yet). 2029 For more details, see the chapter about 2030 :ref:`Connecting USB devices` in the System Emulation Users Guide. 2031 Possible devices for devname are: 2032 2033 ``braille`` 2034 Braille device. This will use BrlAPI to display the braille 2035 output on a real or fake device (i.e. it also creates a 2036 corresponding ``braille`` chardev automatically beside the 2037 ``usb-braille`` USB device). 2038 2039 ``keyboard`` 2040 Standard USB keyboard. Will override the PS/2 keyboard (if present). 2041 2042 ``mouse`` 2043 Virtual Mouse. This will override the PS/2 mouse emulation when 2044 activated. 2045 2046 ``tablet`` 2047 Pointer device that uses absolute coordinates (like a 2048 touchscreen). This means QEMU is able to report the mouse 2049 position without having to grab the mouse. Also overrides the 2050 PS/2 mouse emulation when activated. 2051 2052 ``wacom-tablet`` 2053 Wacom PenPartner USB tablet. 2054 2055 2056ERST 2057 2058DEFHEADING() 2059 2060DEFHEADING(Display options:) 2061 2062DEF("display", HAS_ARG, QEMU_OPTION_display, 2063#if defined(CONFIG_SPICE) 2064 "-display spice-app[,gl=on|off]\n" 2065#endif 2066#if defined(CONFIG_SDL) 2067 "-display sdl[,gl=on|core|es|off][,grab-mod=<mod>][,show-cursor=on|off]\n" 2068 " [,window-close=on|off]\n" 2069#endif 2070#if defined(CONFIG_GTK) 2071 "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n" 2072 " [,show-tabs=on|off][,show-cursor=on|off][,window-close=on|off]\n" 2073 " [,show-menubar=on|off][,zoom-to-fit=on|off]\n" 2074#endif 2075#if defined(CONFIG_VNC) 2076 "-display vnc=<display>[,<optargs>]\n" 2077#endif 2078#if defined(CONFIG_CURSES) 2079 "-display curses[,charset=<encoding>]\n" 2080#endif 2081#if defined(CONFIG_COCOA) 2082 "-display cocoa[,full-grab=on|off][,swap-opt-cmd=on|off]\n" 2083 " [,show-cursor=on|off][,left-command-key=on|off]\n" 2084 " [,full-screen=on|off][,zoom-to-fit=on|off]\n" 2085#endif 2086#if defined(CONFIG_OPENGL) 2087 "-display egl-headless[,rendernode=<file>]\n" 2088#endif 2089#if defined(CONFIG_DBUS_DISPLAY) 2090 "-display dbus[,addr=<dbusaddr>]\n" 2091 " [,gl=on|core|es|off][,rendernode=<file>]\n" 2092#endif 2093 "-display none\n" 2094 " select display backend type\n" 2095 " The default display is equivalent to\n " 2096#if defined(CONFIG_GTK) 2097 "\"-display gtk\"\n" 2098#elif defined(CONFIG_SDL) 2099 "\"-display sdl\"\n" 2100#elif defined(CONFIG_COCOA) 2101 "\"-display cocoa\"\n" 2102#elif defined(CONFIG_VNC) 2103 "\"-vnc localhost:0,to=99,id=default\"\n" 2104#else 2105 "\"-display none\"\n" 2106#endif 2107 , QEMU_ARCH_ALL) 2108SRST 2109``-display type`` 2110 Select type of display to use. Use ``-display help`` to list the available 2111 display types. Valid values for type are 2112 2113 ``spice-app[,gl=on|off]`` 2114 Start QEMU as a Spice server and launch the default Spice client 2115 application. The Spice server will redirect the serial consoles 2116 and QEMU monitors. (Since 4.0) 2117 2118 ``dbus`` 2119 Export the display over D-Bus interfaces. (Since 7.0) 2120 2121 The connection is registered with the "org.qemu" name (and queued when 2122 already owned). 2123 2124 ``addr=<dbusaddr>`` : D-Bus bus address to connect to. 2125 2126 ``p2p=yes|no`` : Use peer-to-peer connection, accepted via QMP ``add_client``. 2127 2128 ``gl=on|off|core|es`` : Use OpenGL for rendering (the D-Bus interface 2129 will share framebuffers with DMABUF file descriptors). 2130 2131 ``sdl`` 2132 Display video output via SDL (usually in a separate graphics 2133 window; see the SDL documentation for other possibilities). 2134 Valid parameters are: 2135 2136 ``grab-mod=<mods>`` : Used to select the modifier keys for toggling 2137 the mouse grabbing in conjunction with the "g" key. ``<mods>`` can be 2138 either ``lshift-lctrl-lalt`` or ``rctrl``. 2139 2140 ``gl=on|off|core|es`` : Use OpenGL for displaying 2141 2142 ``show-cursor=on|off`` : Force showing the mouse cursor 2143 2144 ``window-close=on|off`` : Allow to quit qemu with window close button 2145 2146 ``gtk`` 2147 Display video output in a GTK window. This interface provides 2148 drop-down menus and other UI elements to configure and control 2149 the VM during runtime. Valid parameters are: 2150 2151 ``full-screen=on|off`` : Start in fullscreen mode 2152 2153 ``gl=on|off`` : Use OpenGL for displaying 2154 2155 ``grab-on-hover=on|off`` : Grab keyboard input on mouse hover 2156 2157 ``show-tabs=on|off`` : Display the tab bar for switching between the 2158 various graphical interfaces (e.g. VGA and 2159 virtual console character devices) by default. 2160 2161 ``show-cursor=on|off`` : Force showing the mouse cursor 2162 2163 ``window-close=on|off`` : Allow to quit qemu with window close button 2164 2165 ``show-menubar=on|off`` : Display the main window menubar, defaults to "on" 2166 2167 ``zoom-to-fit=on|off`` : Expand video output to the window size, 2168 defaults to "off" 2169 2170 ``curses[,charset=<encoding>]`` 2171 Display video output via curses. For graphics device models 2172 which support a text mode, QEMU can display this output using a 2173 curses/ncurses interface. Nothing is displayed when the graphics 2174 device is in graphical mode or if the graphics device does not 2175 support a text mode. Generally only the VGA device models 2176 support text mode. The font charset used by the guest can be 2177 specified with the ``charset`` option, for example 2178 ``charset=CP850`` for IBM CP850 encoding. The default is 2179 ``CP437``. 2180 2181 ``cocoa`` 2182 Display video output in a Cocoa window. Mac only. This interface 2183 provides drop-down menus and other UI elements to configure and 2184 control the VM during runtime. Valid parameters are: 2185 2186 ``full-grab=on|off`` : Capture all key presses, including system combos. 2187 This requires accessibility permissions, since it 2188 performs a global grab on key events. 2189 (default: off) See 2190 https://support.apple.com/en-in/guide/mac-help/mh32356/mac 2191 2192 ``swap-opt-cmd=on|off`` : Swap the Option and Command keys so that their 2193 key codes match their position on non-Mac 2194 keyboards and you can use Meta/Super and Alt 2195 where you expect them. (default: off) 2196 2197 ``show-cursor=on|off`` : Force showing the mouse cursor 2198 2199 ``left-command-key=on|off`` : Disable forwarding left command key to host 2200 2201 ``full-screen=on|off`` : Start in fullscreen mode 2202 2203 ``zoom-to-fit=on|off`` : Expand video output to the window size, 2204 defaults to "off" 2205 2206 ``egl-headless[,rendernode=<file>]`` 2207 Offload all OpenGL operations to a local DRI device. For any 2208 graphical display, this display needs to be paired with either 2209 VNC or SPICE displays. 2210 2211 ``vnc=<display>`` 2212 Start a VNC server on display <display> 2213 2214 ``none`` 2215 Do not display video output. The guest will still see an 2216 emulated graphics card, but its output will not be displayed to 2217 the QEMU user. This option differs from the -nographic option in 2218 that it only affects what is done with video output; -nographic 2219 also changes the destination of the serial and parallel port 2220 data. 2221ERST 2222 2223DEF("nographic", 0, QEMU_OPTION_nographic, 2224 "-nographic disable graphical output and redirect serial I/Os to console\n", 2225 QEMU_ARCH_ALL) 2226SRST 2227``-nographic`` 2228 Normally, if QEMU is compiled with graphical window support, it 2229 displays output such as guest graphics, guest console, and the QEMU 2230 monitor in a window. With this option, you can totally disable 2231 graphical output so that QEMU is a simple command line application. 2232 The emulated serial port is redirected on the console and muxed with 2233 the monitor (unless redirected elsewhere explicitly). Therefore, you 2234 can still use QEMU to debug a Linux kernel with a serial console. 2235 Use C-a h for help on switching between the console and monitor. 2236ERST 2237 2238#ifdef CONFIG_SPICE 2239DEF("spice", HAS_ARG, QEMU_OPTION_spice, 2240 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n" 2241 " [,x509-key-file=<file>][,x509-key-password=<file>]\n" 2242 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n" 2243 " [,x509-dh-key-file=<file>][,addr=addr]\n" 2244 " [,ipv4=on|off][,ipv6=on|off][,unix=on|off]\n" 2245 " [,tls-ciphers=<list>]\n" 2246 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n" 2247 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n" 2248 " [,sasl=on|off][,disable-ticketing=on|off]\n" 2249 " [,password-secret=<secret-id>]\n" 2250 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n" 2251 " [,jpeg-wan-compression=[auto|never|always]]\n" 2252 " [,zlib-glz-wan-compression=[auto|never|always]]\n" 2253 " [,streaming-video=[off|all|filter]][,disable-copy-paste=on|off]\n" 2254 " [,disable-agent-file-xfer=on|off][,agent-mouse=[on|off]]\n" 2255 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n" 2256 " [,gl=[on|off]][,rendernode=<file>]\n" 2257 " enable spice\n" 2258 " at least one of {port, tls-port} is mandatory\n", 2259 QEMU_ARCH_ALL) 2260#endif 2261SRST 2262``-spice option[,option[,...]]`` 2263 Enable the spice remote desktop protocol. Valid options are 2264 2265 ``port=<nr>`` 2266 Set the TCP port spice is listening on for plaintext channels. 2267 2268 ``addr=<addr>`` 2269 Set the IP address spice is listening on. Default is any 2270 address. 2271 2272 ``ipv4=on|off``; \ ``ipv6=on|off``; \ ``unix=on|off`` 2273 Force using the specified IP version. 2274 2275 ``password-secret=<secret-id>`` 2276 Set the ID of the ``secret`` object containing the password 2277 you need to authenticate. 2278 2279 ``sasl=on|off`` 2280 Require that the client use SASL to authenticate with the spice. 2281 The exact choice of authentication method used is controlled 2282 from the system / user's SASL configuration file for the 'qemu' 2283 service. This is typically found in /etc/sasl2/qemu.conf. If 2284 running QEMU as an unprivileged user, an environment variable 2285 SASL\_CONF\_PATH can be used to make it search alternate 2286 locations for the service config. While some SASL auth methods 2287 can also provide data encryption (eg GSSAPI), it is recommended 2288 that SASL always be combined with the 'tls' and 'x509' settings 2289 to enable use of SSL and server certificates. This ensures a 2290 data encryption preventing compromise of authentication 2291 credentials. 2292 2293 ``disable-ticketing=on|off`` 2294 Allow client connects without authentication. 2295 2296 ``disable-copy-paste=on|off`` 2297 Disable copy paste between the client and the guest. 2298 2299 ``disable-agent-file-xfer=on|off`` 2300 Disable spice-vdagent based file-xfer between the client and the 2301 guest. 2302 2303 ``tls-port=<nr>`` 2304 Set the TCP port spice is listening on for encrypted channels. 2305 2306 ``x509-dir=<dir>`` 2307 Set the x509 file directory. Expects same filenames as -vnc 2308 $display,x509=$dir 2309 2310 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>`` 2311 The x509 file names can also be configured individually. 2312 2313 ``tls-ciphers=<list>`` 2314 Specify which ciphers to use. 2315 2316 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]`` 2317 Force specific channel to be used with or without TLS 2318 encryption. The options can be specified multiple times to 2319 configure multiple channels. The special name "default" can be 2320 used to set the default mode. For channels which are not 2321 explicitly forced into one mode the spice client is allowed to 2322 pick tls/plaintext as he pleases. 2323 2324 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]`` 2325 Configure image compression (lossless). Default is auto\_glz. 2326 2327 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]`` 2328 Configure wan image compression (lossy for slow links). Default 2329 is auto. 2330 2331 ``streaming-video=[off|all|filter]`` 2332 Configure video stream detection. Default is off. 2333 2334 ``agent-mouse=[on|off]`` 2335 Enable/disable passing mouse events via vdagent. Default is on. 2336 2337 ``playback-compression=[on|off]`` 2338 Enable/disable audio stream compression (using celt 0.5.1). 2339 Default is on. 2340 2341 ``seamless-migration=[on|off]`` 2342 Enable/disable spice seamless migration. Default is off. 2343 2344 ``gl=[on|off]`` 2345 Enable/disable OpenGL context. Default is off. 2346 2347 ``rendernode=<file>`` 2348 DRM render node for OpenGL rendering. If not specified, it will 2349 pick the first available. (Since 2.9) 2350ERST 2351 2352DEF("vga", HAS_ARG, QEMU_OPTION_vga, 2353 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n" 2354 " select video card type\n", QEMU_ARCH_ALL) 2355SRST 2356``-vga type`` 2357 Select type of VGA card to emulate. Valid values for type are 2358 2359 ``cirrus`` 2360 Cirrus Logic GD5446 Video card. All Windows versions starting 2361 from Windows 95 should recognize and use this graphic card. For 2362 optimal performances, use 16 bit color depth in the guest and 2363 the host OS. (This card was the default before QEMU 2.2) 2364 2365 ``std`` 2366 Standard VGA card with Bochs VBE extensions. If your guest OS 2367 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if 2368 you want to use high resolution modes (>= 1280x1024x16) then you 2369 should use this option. (This card is the default since QEMU 2370 2.2) 2371 2372 ``vmware`` 2373 VMWare SVGA-II compatible adapter. Use it if you have 2374 sufficiently recent XFree86/XOrg server or Windows guest with a 2375 driver for this card. 2376 2377 ``qxl`` 2378 QXL paravirtual graphic card. It is VGA compatible (including 2379 VESA 2.0 VBE support). Works best with qxl guest drivers 2380 installed though. Recommended choice when using the spice 2381 protocol. 2382 2383 ``tcx`` 2384 (sun4m only) Sun TCX framebuffer. This is the default 2385 framebuffer for sun4m machines and offers both 8-bit and 24-bit 2386 colour depths at a fixed resolution of 1024x768. 2387 2388 ``cg3`` 2389 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit 2390 framebuffer for sun4m machines available in both 1024x768 2391 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people 2392 wishing to run older Solaris versions. 2393 2394 ``virtio`` 2395 Virtio VGA card. 2396 2397 ``none`` 2398 Disable VGA card. 2399ERST 2400 2401DEF("full-screen", 0, QEMU_OPTION_full_screen, 2402 "-full-screen start in full screen\n", QEMU_ARCH_ALL) 2403SRST 2404``-full-screen`` 2405 Start in full screen. 2406ERST 2407 2408DEF("g", HAS_ARG, QEMU_OPTION_g , 2409 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n", 2410 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K) 2411SRST 2412``-g`` *width*\ ``x``\ *height*\ ``[x``\ *depth*\ ``]`` 2413 Set the initial graphical resolution and depth (PPC, SPARC only). 2414 2415 For PPC the default is 800x600x32. 2416 2417 For SPARC with the TCX graphics device, the default is 1024x768x8 2418 with the option of 1024x768x24. For cgthree, the default is 2419 1024x768x8 with the option of 1152x900x8 for people who wish to use 2420 OBP. 2421ERST 2422 2423#ifdef CONFIG_VNC 2424DEF("vnc", HAS_ARG, QEMU_OPTION_vnc , 2425 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL) 2426#endif 2427SRST 2428``-vnc display[,option[,option[,...]]]`` 2429 Normally, if QEMU is compiled with graphical window support, it 2430 displays output such as guest graphics, guest console, and the QEMU 2431 monitor in a window. With this option, you can have QEMU listen on 2432 VNC display display and redirect the VGA display over the VNC 2433 session. It is very useful to enable the usb tablet device when 2434 using this option (option ``-device usb-tablet``). When using the 2435 VNC display, you must use the ``-k`` parameter to set the keyboard 2436 layout if you are not using en-us. Valid syntax for the display is 2437 2438 ``to=L`` 2439 With this option, QEMU will try next available VNC displays, 2440 until the number L, if the originally defined "-vnc display" is 2441 not available, e.g. port 5900+display is already used by another 2442 application. By default, to=0. 2443 2444 ``host:d`` 2445 TCP connections will only be allowed from host on display d. By 2446 convention the TCP port is 5900+d. Optionally, host can be 2447 omitted in which case the server will accept connections from 2448 any host. 2449 2450 ``unix:path`` 2451 Connections will be allowed over UNIX domain sockets where path 2452 is the location of a unix socket to listen for connections on. 2453 2454 ``none`` 2455 VNC is initialized but not started. The monitor ``change`` 2456 command can be used to later start the VNC server. 2457 2458 Following the display value there may be one or more option flags 2459 separated by commas. Valid options are 2460 2461 ``reverse=on|off`` 2462 Connect to a listening VNC client via a "reverse" connection. 2463 The client is specified by the display. For reverse network 2464 connections (host:d,``reverse``), the d argument is a TCP port 2465 number, not a display number. 2466 2467 ``websocket=on|off`` 2468 Opens an additional TCP listening port dedicated to VNC 2469 Websocket connections. If a bare websocket option is given, the 2470 Websocket port is 5700+display. An alternative port can be 2471 specified with the syntax ``websocket``\ =port. 2472 2473 If host is specified connections will only be allowed from this 2474 host. It is possible to control the websocket listen address 2475 independently, using the syntax ``websocket``\ =host:port. 2476 2477 Websocket could be allowed over UNIX domain socket, using the syntax 2478 ``websocket``\ =unix:path, where path is the location of a unix socket 2479 to listen for connections on. 2480 2481 If no TLS credentials are provided, the websocket connection 2482 runs in unencrypted mode. If TLS credentials are provided, the 2483 websocket connection requires encrypted client connections. 2484 2485 ``password=on|off`` 2486 Require that password based authentication is used for client 2487 connections. 2488 2489 The password must be set separately using the ``set_password`` 2490 command in the :ref:`QEMU monitor`. The 2491 syntax to change your password is: 2492 ``set_password <protocol> <password>`` where <protocol> could be 2493 either "vnc" or "spice". 2494 2495 If you would like to change <protocol> password expiration, you 2496 should use ``expire_password <protocol> <expiration-time>`` 2497 where expiration time could be one of the following options: 2498 now, never, +seconds or UNIX time of expiration, e.g. +60 to 2499 make password expire in 60 seconds, or 1335196800 to make 2500 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for 2501 this date and time). 2502 2503 You can also use keywords "now" or "never" for the expiration 2504 time to allow <protocol> password to expire immediately or never 2505 expire. 2506 2507 ``password-secret=<secret-id>`` 2508 Require that password based authentication is used for client 2509 connections, using the password provided by the ``secret`` 2510 object identified by ``secret-id``. 2511 2512 ``tls-creds=ID`` 2513 Provides the ID of a set of TLS credentials to use to secure the 2514 VNC server. They will apply to both the normal VNC server socket 2515 and the websocket socket (if enabled). Setting TLS credentials 2516 will cause the VNC server socket to enable the VeNCrypt auth 2517 mechanism. The credentials should have been previously created 2518 using the ``-object tls-creds`` argument. 2519 2520 ``tls-authz=ID`` 2521 Provides the ID of the QAuthZ authorization object against which 2522 the client's x509 distinguished name will validated. This object 2523 is only resolved at time of use, so can be deleted and recreated 2524 on the fly while the VNC server is active. If missing, it will 2525 default to denying access. 2526 2527 ``sasl=on|off`` 2528 Require that the client use SASL to authenticate with the VNC 2529 server. The exact choice of authentication method used is 2530 controlled from the system / user's SASL configuration file for 2531 the 'qemu' service. This is typically found in 2532 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user, 2533 an environment variable SASL\_CONF\_PATH can be used to make it 2534 search alternate locations for the service config. While some 2535 SASL auth methods can also provide data encryption (eg GSSAPI), 2536 it is recommended that SASL always be combined with the 'tls' 2537 and 'x509' settings to enable use of SSL and server 2538 certificates. This ensures a data encryption preventing 2539 compromise of authentication credentials. See the 2540 :ref:`VNC security` section in the System Emulation Users Guide 2541 for details on using SASL authentication. 2542 2543 ``sasl-authz=ID`` 2544 Provides the ID of the QAuthZ authorization object against which 2545 the client's SASL username will validated. This object is only 2546 resolved at time of use, so can be deleted and recreated on the 2547 fly while the VNC server is active. If missing, it will default 2548 to denying access. 2549 2550 ``acl=on|off`` 2551 Legacy method for enabling authorization of clients against the 2552 x509 distinguished name and SASL username. It results in the 2553 creation of two ``authz-list`` objects with IDs of 2554 ``vnc.username`` and ``vnc.x509dname``. The rules for these 2555 objects must be configured with the HMP ACL commands. 2556 2557 This option is deprecated and should no longer be used. The new 2558 ``sasl-authz`` and ``tls-authz`` options are a replacement. 2559 2560 ``lossy=on|off`` 2561 Enable lossy compression methods (gradient, JPEG, ...). If this 2562 option is set, VNC client may receive lossy framebuffer updates 2563 depending on its encoding settings. Enabling this option can 2564 save a lot of bandwidth at the expense of quality. 2565 2566 ``non-adaptive=on|off`` 2567 Disable adaptive encodings. Adaptive encodings are enabled by 2568 default. An adaptive encoding will try to detect frequently 2569 updated screen regions, and send updates in these regions using 2570 a lossy encoding (like JPEG). This can be really helpful to save 2571 bandwidth when playing videos. Disabling adaptive encodings 2572 restores the original static behavior of encodings like Tight. 2573 2574 ``share=[allow-exclusive|force-shared|ignore]`` 2575 Set display sharing policy. 'allow-exclusive' allows clients to 2576 ask for exclusive access. As suggested by the rfb spec this is 2577 implemented by dropping other connections. Connecting multiple 2578 clients in parallel requires all clients asking for a shared 2579 session (vncviewer: -shared switch). This is the default. 2580 'force-shared' disables exclusive client access. Useful for 2581 shared desktop sessions, where you don't want someone forgetting 2582 specify -shared disconnect everybody else. 'ignore' completely 2583 ignores the shared flag and allows everybody connect 2584 unconditionally. Doesn't conform to the rfb spec but is 2585 traditional QEMU behavior. 2586 2587 ``key-delay-ms`` 2588 Set keyboard delay, for key down and key up events, in 2589 milliseconds. Default is 10. Keyboards are low-bandwidth 2590 devices, so this slowdown can help the device and guest to keep 2591 up and not lose events in case events are arriving in bulk. 2592 Possible causes for the latter are flaky network connections, or 2593 scripts for automated testing. 2594 2595 ``audiodev=audiodev`` 2596 Use the specified audiodev when the VNC client requests audio 2597 transmission. When not using an -audiodev argument, this option 2598 must be omitted, otherwise is must be present and specify a 2599 valid audiodev. 2600 2601 ``power-control=on|off`` 2602 Permit the remote client to issue shutdown, reboot or reset power 2603 control requests. 2604ERST 2605 2606ARCHHEADING(, QEMU_ARCH_I386) 2607 2608ARCHHEADING(i386 target only:, QEMU_ARCH_I386) 2609 2610DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack, 2611 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n", 2612 QEMU_ARCH_I386) 2613SRST 2614``-win2k-hack`` 2615 Use it when installing Windows 2000 to avoid a disk full bug. After 2616 Windows 2000 is installed, you no longer need this option (this 2617 option slows down the IDE transfers). Synonym of ``-global 2618 ide-device.win2k-install-hack=on``. 2619ERST 2620 2621DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk, 2622 "-no-fd-bootchk disable boot signature checking for floppy disks\n", 2623 QEMU_ARCH_I386) 2624SRST 2625``-no-fd-bootchk`` 2626 Disable boot signature checking for floppy disks in BIOS. May be 2627 needed to boot from old floppy disks. Synonym of ``-m fd-bootchk=off``. 2628ERST 2629 2630DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable, 2631 "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n" 2632 " ACPI table description\n", QEMU_ARCH_I386) 2633SRST 2634``-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n] [,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]`` 2635 Add ACPI table with specified header fields and context from 2636 specified files. For file=, take whole ACPI table from the specified 2637 files, including all ACPI headers (possible overridden by other 2638 options). For data=, only data portion of the table is used, all 2639 header information is specified in the command line. If a SLIC table 2640 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id 2641 fields will override the same in the RSDT and the FADT (a.k.a. 2642 FACP), in order to ensure the field matches required by the 2643 Microsoft SLIC spec and the ACPI spec. 2644ERST 2645 2646DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, 2647 "-smbios file=binary\n" 2648 " load SMBIOS entry from binary file\n" 2649 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n" 2650 " [,uefi=on|off]\n" 2651 " specify SMBIOS type 0 fields\n" 2652 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n" 2653 " [,uuid=uuid][,sku=str][,family=str]\n" 2654 " specify SMBIOS type 1 fields\n" 2655 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n" 2656 " [,asset=str][,location=str]\n" 2657 " specify SMBIOS type 2 fields\n" 2658 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n" 2659 " [,sku=str]\n" 2660 " specify SMBIOS type 3 fields\n" 2661 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n" 2662 " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n" 2663 " [,processor-family=%d][,processor-id=%d]\n" 2664 " specify SMBIOS type 4 fields\n" 2665 "-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n" 2666 " specify SMBIOS type 8 fields\n" 2667 "-smbios type=11[,value=str][,path=filename]\n" 2668 " specify SMBIOS type 11 fields\n" 2669 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" 2670 " [,asset=str][,part=str][,speed=%d]\n" 2671 " specify SMBIOS type 17 fields\n" 2672 "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n" 2673 " specify SMBIOS type 41 fields\n", 2674 QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH | QEMU_ARCH_RISCV) 2675SRST 2676``-smbios file=binary`` 2677 Load SMBIOS entry from binary file. 2678 2679``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]`` 2680 Specify SMBIOS type 0 fields 2681 2682``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]`` 2683 Specify SMBIOS type 1 fields 2684 2685``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]`` 2686 Specify SMBIOS type 2 fields 2687 2688``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]`` 2689 Specify SMBIOS type 3 fields 2690 2691``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-family=%d][,processor-id=%d]`` 2692 Specify SMBIOS type 4 fields 2693 2694``-smbios type=9[,slot_designation=str][,slot_type=%d][,slot_data_bus_width=%d][,current_usage=%d][,slot_length=%d][,slot_id=%d][,slot_characteristics1=%d][,slot_characteristics12=%d][,pci_device=str]`` 2695 Specify SMBIOS type 9 fields 2696 2697``-smbios type=11[,value=str][,path=filename]`` 2698 Specify SMBIOS type 11 fields 2699 2700 This argument can be repeated multiple times, and values are added in the order they are parsed. 2701 Applications intending to use OEM strings data are encouraged to use their application name as 2702 a prefix for the value string. This facilitates passing information for multiple applications 2703 concurrently. 2704 2705 The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax 2706 loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes. 2707 2708 Both the ``value`` and ``path`` options can be repeated multiple times and will be added to 2709 the SMBIOS table in the order in which they appear. 2710 2711 Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535 2712 bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the 2713 guest. Instead it should be used as a indicator to inform the guest where to locate the real 2714 data set, for example, by specifying the serial ID of a block device. 2715 2716 An example passing three strings is 2717 2718 .. parsed-literal:: 2719 2720 -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\ 2721 value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\ 2722 path=/some/file/with/oemstringsdata.txt 2723 2724 In the guest OS this is visible with the ``dmidecode`` command 2725 2726 .. parsed-literal:: 2727 2728 $ dmidecode -t 11 2729 Handle 0x0E00, DMI type 11, 5 bytes 2730 OEM Strings 2731 String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/ 2732 String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os 2733 String 3: myapp:some extra data 2734 2735 2736``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]`` 2737 Specify SMBIOS type 17 fields 2738 2739``-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]`` 2740 Specify SMBIOS type 41 fields 2741 2742 This argument can be repeated multiple times. Its main use is to allow network interfaces be created 2743 as ``enoX`` on Linux, with X being the instance number, instead of the name depending on the interface 2744 position on the PCI bus. 2745 2746 Here is an example of use: 2747 2748 .. parsed-literal:: 2749 2750 -netdev user,id=internet \\ 2751 -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \\ 2752 -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev 2753 2754 In the guest OS, the device should then appear as ``eno1``: 2755 2756 ..parsed-literal:: 2757 2758 $ ip -brief l 2759 lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 2760 eno1 UP 50:54:00:00:00:42 <BROADCAST,MULTICAST,UP,LOWER_UP> 2761 2762 Currently, the PCI device has to be attached to the root bus. 2763 2764ERST 2765 2766DEFHEADING() 2767 2768DEFHEADING(Network options:) 2769 2770DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, 2771#ifdef CONFIG_SLIRP 2772 "-netdev user,id=str[,ipv4=on|off][,net=addr[/mask]][,host=addr]\n" 2773 " [,ipv6=on|off][,ipv6-net=addr[/int]][,ipv6-host=addr]\n" 2774 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n" 2775 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n" 2776 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]" 2777#ifndef _WIN32 2778 "[,smb=dir[,smbserver=addr]]\n" 2779#endif 2780 " configure a user mode network backend with ID 'str',\n" 2781 " its DHCP server and optional services\n" 2782#endif 2783#ifdef _WIN32 2784 "-netdev tap,id=str,ifname=name\n" 2785 " configure a host TAP network backend with ID 'str'\n" 2786#else 2787 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n" 2788 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n" 2789 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n" 2790 " [,poll-us=n]\n" 2791 " configure a host TAP network backend with ID 'str'\n" 2792 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n" 2793 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n" 2794 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n" 2795 " to deconfigure it\n" 2796 " use '[down]script=no' to disable script execution\n" 2797 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n" 2798 " configure it\n" 2799 " use 'fd=h' to connect to an already opened TAP interface\n" 2800 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n" 2801 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n" 2802 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n" 2803 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n" 2804 " use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n" 2805 " use vhost=on to enable experimental in kernel accelerator\n" 2806 " (only has effect for virtio guests which use MSIX)\n" 2807 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n" 2808 " use 'vhostfd=h' to connect to an already opened vhost net device\n" 2809 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n" 2810 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n" 2811 " use 'poll-us=n' to specify the maximum number of microseconds that could be\n" 2812 " spent on busy polling for vhost net\n" 2813 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n" 2814 " configure a host TAP network backend with ID 'str' that is\n" 2815 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n" 2816 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n" 2817#endif 2818#ifdef __linux__ 2819 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n" 2820 " [,rxsession=rxsession],txsession=txsession[,ipv6=on|off][,udp=on|off]\n" 2821 " [,cookie64=on|off][,counter][,pincounter][,txcookie=txcookie]\n" 2822 " [,rxcookie=rxcookie][,offset=offset]\n" 2823 " configure a network backend with ID 'str' connected to\n" 2824 " an Ethernet over L2TPv3 pseudowire.\n" 2825 " Linux kernel 3.3+ as well as most routers can talk\n" 2826 " L2TPv3. This transport allows connecting a VM to a VM,\n" 2827 " VM to a router and even VM to Host. It is a nearly-universal\n" 2828 " standard (RFC3931). Note - this implementation uses static\n" 2829 " pre-configured tunnels (same as the Linux kernel).\n" 2830 " use 'src=' to specify source address\n" 2831 " use 'dst=' to specify destination address\n" 2832 " use 'udp=on' to specify udp encapsulation\n" 2833 " use 'srcport=' to specify source udp port\n" 2834 " use 'dstport=' to specify destination udp port\n" 2835 " use 'ipv6=on' to force v6\n" 2836 " L2TPv3 uses cookies to prevent misconfiguration as\n" 2837 " well as a weak security measure\n" 2838 " use 'rxcookie=0x012345678' to specify a rxcookie\n" 2839 " use 'txcookie=0x012345678' to specify a txcookie\n" 2840 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n" 2841 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n" 2842 " use 'pincounter=on' to work around broken counter handling in peer\n" 2843 " use 'offset=X' to add an extra offset between header and data\n" 2844#endif 2845 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n" 2846 " configure a network backend to connect to another network\n" 2847 " using a socket connection\n" 2848 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n" 2849 " configure a network backend to connect to a multicast maddr and port\n" 2850 " use 'localaddr=addr' to specify the host address to send packets from\n" 2851 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n" 2852 " configure a network backend to connect to another network\n" 2853 " using an UDP tunnel\n" 2854 "-netdev stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port[,to=maxport][,numeric=on|off][,keep-alive=on|off][,mptcp=on|off][,addr.ipv4=on|off][,addr.ipv6=on|off][,reconnect-ms=milliseconds]\n" 2855 "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect-ms=milliseconds]\n" 2856 "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect-ms=milliseconds]\n" 2857 " configure a network backend to connect to another network\n" 2858 " using a socket connection in stream mode.\n" 2859 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]\n" 2860 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]\n" 2861 " configure a network backend to connect to a multicast maddr and port\n" 2862 " use ``local.host=addr`` to specify the host address to send packets from\n" 2863 "-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]\n" 2864 "-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]\n" 2865 "-netdev dgram,id=str,local.type=fd,local.str=file-descriptor\n" 2866 " configure a network backend to connect to another network\n" 2867 " using an UDP tunnel\n" 2868#ifdef CONFIG_VDE 2869 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" 2870 " configure a network backend to connect to port 'n' of a vde switch\n" 2871 " running on host and listening for incoming connections on 'socketpath'.\n" 2872 " Use group 'groupname' and mode 'octalmode' to change default\n" 2873 " ownership and permissions for communication port.\n" 2874#endif 2875#ifdef CONFIG_NETMAP 2876 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n" 2877 " attach to the existing netmap-enabled network interface 'name', or to a\n" 2878 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n" 2879 " netmap device, defaults to '/dev/netmap')\n" 2880#endif 2881#ifdef CONFIG_AF_XDP 2882 "-netdev af-xdp,id=str,ifname=name[,mode=native|skb][,force-copy=on|off]\n" 2883 " [,queues=n][,start-queue=m][,inhibit=on|off][,sock-fds=x:y:...:z]\n" 2884 " attach to the existing network interface 'name' with AF_XDP socket\n" 2885 " use 'mode=MODE' to specify an XDP program attach mode\n" 2886 " use 'force-copy=on|off' to force XDP copy mode even if device supports zero-copy (default: off)\n" 2887 " use 'inhibit=on|off' to inhibit loading of a default XDP program (default: off)\n" 2888 " with inhibit=on,\n" 2889 " use 'sock-fds' to provide file descriptors for already open AF_XDP sockets\n" 2890 " added to a socket map in XDP program. One socket per queue.\n" 2891 " use 'queues=n' to specify how many queues of a multiqueue interface should be used\n" 2892 " use 'start-queue=m' to specify the first queue that should be used\n" 2893#endif 2894#ifdef CONFIG_POSIX 2895 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n" 2896 " configure a vhost-user network, backed by a chardev 'dev'\n" 2897#endif 2898#ifdef __linux__ 2899 "-netdev vhost-vdpa,id=str[,vhostdev=/path/to/dev][,vhostfd=h]\n" 2900 " configure a vhost-vdpa network,Establish a vhost-vdpa netdev\n" 2901 " use 'vhostdev=/path/to/dev' to open a vhost vdpa device\n" 2902 " use 'vhostfd=h' to connect to an already opened vhost vdpa device\n" 2903#endif 2904#ifdef CONFIG_VMNET 2905 "-netdev vmnet-host,id=str[,isolated=on|off][,net-uuid=uuid]\n" 2906 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n" 2907 " configure a vmnet network backend in host mode with ID 'str',\n" 2908 " isolate this interface from others with 'isolated',\n" 2909 " configure the address range and choose a subnet mask,\n" 2910 " specify network UUID 'uuid' to disable DHCP and interact with\n" 2911 " vmnet-host interfaces within this isolated network\n" 2912 "-netdev vmnet-shared,id=str[,isolated=on|off][,nat66-prefix=addr]\n" 2913 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n" 2914 " configure a vmnet network backend in shared mode with ID 'str',\n" 2915 " configure the address range and choose a subnet mask,\n" 2916 " set IPv6 ULA prefix (of length 64) to use for internal network,\n" 2917 " isolate this interface from others with 'isolated'\n" 2918 "-netdev vmnet-bridged,id=str,ifname=name[,isolated=on|off]\n" 2919 " configure a vmnet network backend in bridged mode with ID 'str',\n" 2920 " use 'ifname=name' to select a physical network interface to be bridged,\n" 2921 " isolate this interface from others with 'isolated'\n" 2922#endif 2923 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n" 2924 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL) 2925DEF("nic", HAS_ARG, QEMU_OPTION_nic, 2926 "-nic [tap|bridge|" 2927#ifdef CONFIG_SLIRP 2928 "user|" 2929#endif 2930#ifdef __linux__ 2931 "l2tpv3|" 2932#endif 2933#ifdef CONFIG_VDE 2934 "vde|" 2935#endif 2936#ifdef CONFIG_NETMAP 2937 "netmap|" 2938#endif 2939#ifdef CONFIG_AF_XDP 2940 "af-xdp|" 2941#endif 2942#ifdef CONFIG_POSIX 2943 "vhost-user|" 2944#endif 2945#ifdef CONFIG_VMNET 2946 "vmnet-host|vmnet-shared|vmnet-bridged|" 2947#endif 2948 "socket][,option][,...][mac=macaddr]\n" 2949 " initialize an on-board / default host NIC (using MAC address\n" 2950 " macaddr) and connect it to the given host network backend\n" 2951 "-nic none use it alone to have zero network devices (the default is to\n" 2952 " provided a 'user' network connection)\n", 2953 QEMU_ARCH_ALL) 2954DEF("net", HAS_ARG, QEMU_OPTION_net, 2955 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" 2956 " configure or create an on-board (or machine default) NIC and\n" 2957 " connect it to hub 0 (please use -nic unless you need a hub)\n" 2958 "-net [" 2959#ifdef CONFIG_SLIRP 2960 "user|" 2961#endif 2962 "tap|" 2963 "bridge|" 2964#ifdef CONFIG_VDE 2965 "vde|" 2966#endif 2967#ifdef CONFIG_NETMAP 2968 "netmap|" 2969#endif 2970#ifdef CONFIG_AF_XDP 2971 "af-xdp|" 2972#endif 2973#ifdef CONFIG_VMNET 2974 "vmnet-host|vmnet-shared|vmnet-bridged|" 2975#endif 2976 "socket][,option][,option][,...]\n" 2977 " old way to initialize a host network interface\n" 2978 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL) 2979SRST 2980``-nic [tap|bridge|user|l2tpv3|vde|netmap|af-xdp|vhost-user|socket][,...][,mac=macaddr][,model=mn]`` 2981 This option is a shortcut for configuring both the on-board 2982 (default) guest NIC hardware and the host network backend in one go. 2983 The host backend options are the same as with the corresponding 2984 ``-netdev`` options below. The guest NIC model can be set with 2985 ``model=modelname``. Use ``model=help`` to list the available device 2986 types. The hardware MAC address can be set with ``mac=macaddr``. 2987 2988 The following two example do exactly the same, to show how ``-nic`` 2989 can be used to shorten the command line length: 2990 2991 .. parsed-literal:: 2992 2993 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32 2994 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32 2995 2996``-nic none`` 2997 Indicate that no network devices should be configured. It is used to 2998 override the default configuration (default NIC with "user" host 2999 network backend) which is activated if no other networking options 3000 are provided. 3001 3002``-netdev user,id=id[,option][,option][,...]`` 3003 Configure user mode host network backend which requires no 3004 administrator privilege to run. Valid options are: 3005 3006 ``id=id`` 3007 Assign symbolic name for use in monitor commands. 3008 3009 ``ipv4=on|off and ipv6=on|off`` 3010 Specify that either IPv4 or IPv6 must be enabled. If neither is 3011 specified both protocols are enabled. 3012 3013 ``net=addr[/mask]`` 3014 Set IP network address the guest will see. Optionally specify 3015 the netmask, either in the form a.b.c.d or as number of valid 3016 top-most bits. Default is 10.0.2.0/24. 3017 3018 ``host=addr`` 3019 Specify the guest-visible address of the host. Default is the 3020 2nd IP in the guest network, i.e. x.x.x.2. 3021 3022 ``ipv6-net=addr[/int]`` 3023 Set IPv6 network address the guest will see (default is 3024 fec0::/64). The network prefix is given in the usual hexadecimal 3025 IPv6 address notation. The prefix size is optional, and is given 3026 as the number of valid top-most bits (default is 64). 3027 3028 ``ipv6-host=addr`` 3029 Specify the guest-visible IPv6 address of the host. Default is 3030 the 2nd IPv6 in the guest network, i.e. xxxx::2. 3031 3032 ``restrict=on|off`` 3033 If this option is enabled, the guest will be isolated, i.e. it 3034 will not be able to contact the host and no guest IP packets 3035 will be routed over the host to the outside. This option does 3036 not affect any explicitly set forwarding rules. 3037 3038 ``hostname=name`` 3039 Specifies the client hostname reported by the built-in DHCP 3040 server. 3041 3042 ``dhcpstart=addr`` 3043 Specify the first of the 16 IPs the built-in DHCP server can 3044 assign. Default is the 15th to 31st IP in the guest network, 3045 i.e. x.x.x.15 to x.x.x.31. 3046 3047 ``dns=addr`` 3048 Specify the guest-visible address of the virtual nameserver. The 3049 address must be different from the host address. Default is the 3050 3rd IP in the guest network, i.e. x.x.x.3. 3051 3052 ``ipv6-dns=addr`` 3053 Specify the guest-visible address of the IPv6 virtual 3054 nameserver. The address must be different from the host address. 3055 Default is the 3rd IP in the guest network, i.e. xxxx::3. 3056 3057 ``dnssearch=domain`` 3058 Provides an entry for the domain-search list sent by the 3059 built-in DHCP server. More than one domain suffix can be 3060 transmitted by specifying this option multiple times. If 3061 supported, this will cause the guest to automatically try to 3062 append the given domain suffix(es) in case a domain name can not 3063 be resolved. 3064 3065 Example: 3066 3067 .. parsed-literal:: 3068 3069 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org 3070 3071 ``domainname=domain`` 3072 Specifies the client domain name reported by the built-in DHCP 3073 server. 3074 3075 ``tftp=dir`` 3076 When using the user mode network stack, activate a built-in TFTP 3077 server. The files in dir will be exposed as the root of a TFTP 3078 server. The TFTP client on the guest must be configured in 3079 binary mode (use the command ``bin`` of the Unix TFTP client). 3080 The built-in TFTP server is read-only; it does not implement any 3081 command for writing files. QEMU will not write to this directory. 3082 3083 ``tftp-server-name=name`` 3084 In BOOTP reply, broadcast name as the "TFTP server name" 3085 (RFC2132 option 66). This can be used to advise the guest to 3086 load boot files or configurations from a different server than 3087 the host address. 3088 3089 ``bootfile=file`` 3090 When using the user mode network stack, broadcast file as the 3091 BOOTP filename. In conjunction with ``tftp``, this can be used 3092 to network boot a guest from a local directory. 3093 3094 Example (using pxelinux): 3095 3096 .. parsed-literal:: 3097 3098 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \\ 3099 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 3100 3101 ``smb=dir[,smbserver=addr]`` 3102 When using the user mode network stack, activate a built-in SMB 3103 server so that Windows OSes can access to the host files in 3104 ``dir`` transparently. The IP address of the SMB server can be 3105 set to addr. By default the 4th IP in the guest network is used, 3106 i.e. x.x.x.4. 3107 3108 In the guest Windows OS, the line: 3109 3110 :: 3111 3112 10.0.2.4 smbserver 3113 3114 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows 3115 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows 3116 NT/2000). 3117 3118 Then ``dir`` can be accessed in ``\\smbserver\qemu``. 3119 3120 Note that a SAMBA server must be installed on the host OS. 3121 3122 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport`` 3123 Redirect incoming TCP or UDP connections to the host port 3124 hostport to the guest IP address guestaddr on guest port 3125 guestport. If guestaddr is not specified, its value is x.x.x.15 3126 (default first address given by the built-in DHCP server). By 3127 specifying hostaddr, the rule can be bound to a specific host 3128 interface. If no connection type is set, TCP is used. This 3129 option can be given multiple times. 3130 3131 For example, to redirect host X11 connection from screen 1 to 3132 guest screen 0, use the following: 3133 3134 .. parsed-literal:: 3135 3136 # on the host 3137 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000 3138 # this host xterm should open in the guest X11 server 3139 xterm -display :1 3140 3141 To redirect telnet connections from host port 5555 to telnet 3142 port on the guest, use the following: 3143 3144 .. parsed-literal:: 3145 3146 # on the host 3147 |qemu_system| -nic user,hostfwd=tcp::5555-:23 3148 telnet localhost 5555 3149 3150 Then when you use on the host ``telnet localhost 5555``, you 3151 connect to the guest telnet server. 3152 3153 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command`` 3154 Forward guest TCP connections to the IP address server on port 3155 port to the character device dev or to a program executed by 3156 cmd:command which gets spawned for each connection. This option 3157 can be given multiple times. 3158 3159 You can either use a chardev directly and have that one used 3160 throughout QEMU's lifetime, like in the following example: 3161 3162 .. parsed-literal:: 3163 3164 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever 3165 # the guest accesses it 3166 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 3167 3168 Or you can execute a command on every TCP connection established 3169 by the guest, so that QEMU behaves similar to an inetd process 3170 for that virtual server: 3171 3172 .. parsed-literal:: 3173 3174 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234 3175 # and connect the TCP stream to its stdin/stdout 3176 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' 3177 3178``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]`` 3179 Configure a host TAP network backend with ID id. 3180 3181 Use the network script file to configure it and the network script 3182 dfile to deconfigure it. If name is not provided, the OS 3183 automatically provides one. The default network configure script is 3184 ``/etc/qemu-ifup`` and the default network deconfigure script is 3185 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to 3186 disable script execution. 3187 3188 If running QEMU as an unprivileged user, use the network helper 3189 to configure the TAP interface and attach it to the bridge. 3190 The default network helper executable is 3191 ``/path/to/qemu-bridge-helper`` and the default bridge device is 3192 ``br0``. 3193 3194 ``fd``\ =h can be used to specify the handle of an already opened 3195 host TAP interface. 3196 3197 Examples: 3198 3199 .. parsed-literal:: 3200 3201 #launch a QEMU instance with the default network script 3202 |qemu_system| linux.img -nic tap 3203 3204 .. parsed-literal:: 3205 3206 #launch a QEMU instance with two NICs, each one connected 3207 #to a TAP device 3208 |qemu_system| linux.img \\ 3209 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \\ 3210 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1 3211 3212 .. parsed-literal:: 3213 3214 #launch a QEMU instance with the default network helper to 3215 #connect a TAP device to bridge br0 3216 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3217 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper" 3218 3219``-netdev bridge,id=id[,br=bridge][,helper=helper]`` 3220 Connect a host TAP network interface to a host bridge device. 3221 3222 Use the network helper helper to configure the TAP interface and 3223 attach it to the bridge. The default network helper executable is 3224 ``/path/to/qemu-bridge-helper`` and the default bridge device is 3225 ``br0``. 3226 3227 Examples: 3228 3229 .. parsed-literal:: 3230 3231 #launch a QEMU instance with the default network helper to 3232 #connect a TAP device to bridge br0 3233 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1 3234 3235 .. parsed-literal:: 3236 3237 #launch a QEMU instance with the default network helper to 3238 #connect a TAP device to bridge qemubr0 3239 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1 3240 3241``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]`` 3242 This host network backend can be used to connect the guest's network 3243 to another QEMU virtual machine using a TCP socket connection. If 3244 ``listen`` is specified, QEMU waits for incoming connections on port 3245 (host is optional). ``connect`` is used to connect to another QEMU 3246 instance using the ``listen`` option. ``fd``\ =h specifies an 3247 already opened TCP socket. 3248 3249 Example: 3250 3251 .. parsed-literal:: 3252 3253 # launch a first QEMU instance 3254 |qemu_system| linux.img \\ 3255 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3256 -netdev socket,id=n1,listen=:1234 3257 # connect the network of this instance to the network of the first instance 3258 |qemu_system| linux.img \\ 3259 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\ 3260 -netdev socket,id=n2,connect=127.0.0.1:1234 3261 3262``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]`` 3263 Configure a socket host network backend to share the guest's network 3264 traffic with another QEMU virtual machines using a UDP multicast 3265 socket, effectively making a bus for every QEMU with same multicast 3266 address maddr and port. NOTES: 3267 3268 1. Several QEMU can be running on different hosts and share same bus 3269 (assuming correct multicast setup for these hosts). 3270 3271 2. mcast support is compatible with User Mode Linux (argument 3272 ``ethN=mcast``), see http://user-mode-linux.sf.net. 3273 3274 3. Use ``fd=h`` to specify an already opened UDP multicast socket. 3275 3276 Example: 3277 3278 .. parsed-literal:: 3279 3280 # launch one QEMU instance 3281 |qemu_system| linux.img \\ 3282 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3283 -netdev socket,id=n1,mcast=230.0.0.1:1234 3284 # launch another QEMU instance on same "bus" 3285 |qemu_system| linux.img \\ 3286 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\ 3287 -netdev socket,id=n2,mcast=230.0.0.1:1234 3288 # launch yet another QEMU instance on same "bus" 3289 |qemu_system| linux.img \\ 3290 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \\ 3291 -netdev socket,id=n3,mcast=230.0.0.1:1234 3292 3293 Example (User Mode Linux compat.): 3294 3295 .. parsed-literal:: 3296 3297 # launch QEMU instance (note mcast address selected is UML's default) 3298 |qemu_system| linux.img \\ 3299 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3300 -netdev socket,id=n1,mcast=239.192.168.1:1102 3301 # launch UML 3302 /path/to/linux ubd0=/path/to/root_fs eth0=mcast 3303 3304 Example (send packets from host's 1.2.3.4): 3305 3306 .. parsed-literal:: 3307 3308 |qemu_system| linux.img \\ 3309 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3310 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4 3311 3312``-netdev stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port[,to=maxport][,numeric=on|off][,keep-alive=on|off][,mptcp=on|off][,addr.ipv4=on|off][,addr.ipv6=on|off][,reconnect-ms=milliseconds]`` 3313 Configure a network backend to connect to another QEMU virtual machine or a proxy using a TCP/IP socket. 3314 3315 ``server=on|off`` 3316 if ``on`` create a server socket 3317 3318 ``addr.host=host,addr.port=port`` 3319 socket address to listen on (server=on) or connect to (server=off) 3320 3321 ``to=maxport`` 3322 if present, this is range of possible addresses, with port between ``port`` and ``maxport``. 3323 3324 ``numeric=on|off`` 3325 if ``on`` ``host`` and ``port`` are guaranteed to be numeric, otherwise a name resolution should be attempted (default: ``off``) 3326 3327 ``keep-alive=on|off`` 3328 enable keep-alive when connecting to this socket. Not supported for passive sockets. 3329 3330 ``mptcp=on|off`` 3331 enable multipath TCP 3332 3333 ``ipv4=on|off`` 3334 whether to accept IPv4 addresses, default to try both IPv4 and IPv6 3335 3336 ``ipv6=on|off`` 3337 whether to accept IPv6 addresses, default to try both IPv4 and IPv6 3338 3339 ``reconnect-ms=milliseconds`` 3340 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3341 Setting this to zero disables this function. (default: 0) 3342 3343 Example (two guests connected using a TCP/IP socket): 3344 3345 .. parsed-literal:: 3346 3347 # first VM 3348 |qemu_system| linux.img \\ 3349 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3350 -netdev stream,id=net0,server=on,addr.type=inet,addr.host=localhost,addr.port=1234 3351 # second VM 3352 |qemu_system| linux.img \\ 3353 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3354 -netdev stream,id=net0,server=off,addr.type=inet,addr.host=localhost,addr.port=1234,reconnect-ms=5000 3355 3356``-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect-ms=milliseconds]`` 3357 Configure a network backend to connect to another QEMU virtual machine or a proxy using a stream oriented unix domain socket. 3358 3359 ``server=on|off`` 3360 if ``on`` create a server socket 3361 3362 ``addr.path=path`` 3363 filesystem path to use 3364 3365 ``abstract=on|off`` 3366 if ``on``, this is a Linux abstract socket address. 3367 3368 ``tight=on|off`` 3369 if false, pad an abstract socket address with enough null bytes to make it fill struct sockaddr_un member sun_path. 3370 3371 ``reconnect-ms=milliseconds`` 3372 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3373 Setting this to zero disables this function. (default: 0) 3374 3375 Example (using passt as a replacement of -netdev user): 3376 3377 .. parsed-literal:: 3378 3379 # start passt server as a non privileged user 3380 passt 3381 UNIX domain socket bound at /tmp/passt_1.socket 3382 # start QEMU to connect to passt 3383 |qemu_system| linux.img \\ 3384 -device virtio-net,netdev=net0 \\ 3385 -netdev stream,id=net0,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket 3386 3387 Example (two guests connected using a stream oriented unix domain socket): 3388 3389 .. parsed-literal:: 3390 3391 # first VM 3392 |qemu_system| linux.img \\ 3393 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3394 netdev stream,id=net0,server=on,addr.type=unix,addr.path=/tmp/qemu0 3395 # second VM 3396 |qemu_system| linux.img \\ 3397 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3398 -netdev stream,id=net0,server=off,addr.type=unix,addr.path=/tmp/qemu0,reconnect-ms=5000 3399 3400``-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect-ms=milliseconds]`` 3401 Configure a network backend to connect to another QEMU virtual machine or a proxy using a stream oriented socket file descriptor. 3402 3403 ``server=on|off`` 3404 if ``on`` create a server socket 3405 3406 ``addr.str=file-descriptor`` 3407 file descriptor number to use as a socket 3408 3409 ``reconnect-ms=milliseconds`` 3410 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3411 Setting this to zero disables this function. (default: 0) 3412 3413``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]`` 3414 Configure a network backend to connect to a multicast address. 3415 3416 ``remote.host=maddr,remote.port=port`` 3417 multicast address 3418 3419 ``local.host=addr`` 3420 specify the host address to send packets from 3421 3422 Example: 3423 3424 .. parsed-literal:: 3425 3426 # launch one QEMU instance 3427 |qemu_system| linux.img \\ 3428 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3429 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3430 # launch another QEMU instance on same "bus" 3431 |qemu_system| linux.img \\ 3432 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3433 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3434 # launch yet another QEMU instance on same "bus" 3435 |qemu_system| linux.img \\ 3436 -device virtio-net,netdev=net0,mac=52:54:00:12:34:58 \\ 3437 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3438 3439``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]`` 3440 Configure a network backend to connect to a multicast address using a UDP socket file descriptor. 3441 3442 ``remote.host=maddr,remote.port=port`` 3443 multicast address 3444 3445 ``local.str=file-descriptor`` 3446 File descriptor to use to send packets 3447 3448``-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]`` 3449 Configure a network backend to connect to another QEMU virtual 3450 machine or a proxy using a datagram oriented unix domain socket. 3451 3452 ``local.host=addr,local.port=port`` 3453 IP address to use to send the packets from 3454 3455 ``remote.host=addr,remote.port=port`` 3456 Destination IP address 3457 3458 Example (two guests connected using an UDP/IP socket): 3459 3460 .. parsed-literal:: 3461 3462 # first VM 3463 |qemu_system| linux.img \\ 3464 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3465 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1234,remote.type=inet,remote.host=localhost,remote.port=1235 3466 # second VM 3467 |qemu_system| linux.img \\ 3468 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3469 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1235,remote.type=inet,remote.host=localhost,remote.port=1234 3470 3471``-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]`` 3472 Configure a network backend to connect to another QEMU virtual 3473 machine or a proxy using a datagram oriented unix socket. 3474 3475 ``local.path=path`` 3476 filesystem path to use to bind the socket 3477 3478 ``remote.path=path`` 3479 filesystem path to use as a destination (see sendto(2)) 3480 3481 Example (two guests connected using an UDP/UNIX socket): 3482 3483 .. parsed-literal:: 3484 3485 # first VM 3486 |qemu_system| linux.img \\ 3487 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3488 -netdev dgram,id=net0,local.type=unix,local.path=/tmp/qemu0,remote.type=unix,remote.path=/tmp/qemu1 3489 # second VM 3490 |qemu_system| linux.img \\ 3491 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3492 -netdev dgram,id=net0,local.type=unix,local.path=/tmp/qemu1,remote.type=unix,remote.path=/tmp/qemu0 3493 3494``-netdev dgram,id=str,local.type=fd,local.str=file-descriptor`` 3495 Configure a network backend to connect to another QEMU virtual 3496 machine or a proxy using a datagram oriented socket file descriptor. 3497 3498 ``local.str=file-descriptor`` 3499 File descriptor to use to send packets 3500 3501``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64=on|off][,counter=on|off][,pincounter=on|off][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]`` 3502 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) 3503 is a popular protocol to transport Ethernet (and other Layer 2) data 3504 frames between two systems. It is present in routers, firewalls and 3505 the Linux kernel (from version 3.3 onwards). 3506 3507 This transport allows a VM to communicate to another VM, router or 3508 firewall directly. 3509 3510 ``src=srcaddr`` 3511 source address (mandatory) 3512 3513 ``dst=dstaddr`` 3514 destination address (mandatory) 3515 3516 ``udp=on`` 3517 select udp encapsulation (default is ip). 3518 3519 ``srcport=srcport`` 3520 source udp port. 3521 3522 ``dstport=dstport`` 3523 destination udp port. 3524 3525 ``ipv6=on`` 3526 force v6, otherwise defaults to v4. 3527 3528 ``rxcookie=rxcookie``; \ ``txcookie=txcookie`` 3529 Cookies are a weak form of security in the l2tpv3 specification. 3530 Their function is mostly to prevent misconfiguration. By default 3531 they are 32 bit. 3532 3533 ``cookie64=on`` 3534 Set cookie size to 64 bit instead of the default 32 3535 3536 ``counter=off`` 3537 Force a 'cut-down' L2TPv3 with no counter as in 3538 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00 3539 3540 ``pincounter=on`` 3541 Work around broken counter handling in peer. This may also help 3542 on networks which have packet reorder. 3543 3544 ``offset=offset`` 3545 Add an extra offset between header and data 3546 3547 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to 3548 the bridge br-lan on the remote Linux host 1.2.3.4: 3549 3550 .. parsed-literal:: 3551 3552 # Setup tunnel on linux host using raw ip as encapsulation 3553 # on 1.2.3.4 3554 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \\ 3555 encap udp udp_sport 16384 udp_dport 16384 3556 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \\ 3557 0xFFFFFFFF peer_session_id 0xFFFFFFFF 3558 ifconfig vmtunnel0 mtu 1500 3559 ifconfig vmtunnel0 up 3560 brctl addif br-lan vmtunnel0 3561 3562 3563 # on 4.3.2.1 3564 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter 3565 3566 |qemu_system| linux.img -device e1000,netdev=n1 \\ 3567 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp=on,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter=on 3568 3569``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]`` 3570 Configure VDE backend to connect to PORT n of a vde switch running 3571 on host and listening for incoming connections on socketpath. Use 3572 GROUP groupname and MODE octalmode to change default ownership and 3573 permissions for communication port. This option is only available if 3574 QEMU has been compiled with vde support enabled. 3575 3576 Example: 3577 3578 .. parsed-literal:: 3579 3580 # launch vde switch 3581 vde_switch -F -sock /tmp/myswitch 3582 # launch QEMU instance 3583 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch 3584 3585``-netdev af-xdp,id=str,ifname=name[,mode=native|skb][,force-copy=on|off][,queues=n][,start-queue=m][,inhibit=on|off][,sock-fds=x:y:...:z]`` 3586 Configure AF_XDP backend to connect to a network interface 'name' 3587 using AF_XDP socket. A specific program attach mode for a default 3588 XDP program can be forced with 'mode', defaults to best-effort, 3589 where the likely most performant mode will be in use. Number of queues 3590 'n' should generally match the number or queues in the interface, 3591 defaults to 1. Traffic arriving on non-configured device queues will 3592 not be delivered to the network backend. 3593 3594 .. parsed-literal:: 3595 3596 # set number of queues to 4 3597 ethtool -L eth0 combined 4 3598 # launch QEMU instance 3599 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3600 -netdev af-xdp,id=n1,ifname=eth0,queues=4 3601 3602 'start-queue' option can be specified if a particular range of queues 3603 [m, m + n] should be in use. For example, this is may be necessary in 3604 order to use certain NICs in native mode. Kernel allows the driver to 3605 create a separate set of XDP queues on top of regular ones, and only 3606 these queues can be used for AF_XDP sockets. NICs that work this way 3607 may also require an additional traffic redirection with ethtool to these 3608 special queues. 3609 3610 .. parsed-literal:: 3611 3612 # set number of queues to 1 3613 ethtool -L eth0 combined 1 3614 # redirect all the traffic to the second queue (id: 1) 3615 # note: drivers may require non-empty key/mask pair. 3616 ethtool -N eth0 flow-type ether \\ 3617 dst 00:00:00:00:00:00 m FF:FF:FF:FF:FF:FE action 1 3618 ethtool -N eth0 flow-type ether \\ 3619 dst 00:00:00:00:00:01 m FF:FF:FF:FF:FF:FE action 1 3620 # launch QEMU instance 3621 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3622 -netdev af-xdp,id=n1,ifname=eth0,queues=1,start-queue=1 3623 3624 XDP program can also be loaded externally. In this case 'inhibit' option 3625 should be set to 'on' and 'sock-fds' provided with file descriptors for 3626 already open but not bound XDP sockets already added to a socket map for 3627 corresponding queues. One socket per queue. 3628 3629 .. parsed-literal:: 3630 3631 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3632 -netdev af-xdp,id=n1,ifname=eth0,queues=3,inhibit=on,sock-fds=15:16:17 3633 3634``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]`` 3635 Establish a vhost-user netdev, backed by a chardev id. The chardev 3636 should be a unix domain socket backed one. The vhost-user uses a 3637 specifically defined protocol to pass vhost ioctl replacement 3638 messages to an application on the other end of the socket. On 3639 non-MSIX guests, the feature can be forced with vhostforce. Use 3640 'queues=n' to specify the number of queues to be created for 3641 multiqueue vhost-user. 3642 3643 Example: 3644 3645 :: 3646 3647 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ 3648 -numa node,memdev=mem \ 3649 -chardev socket,id=chr0,path=/path/to/socket \ 3650 -netdev type=vhost-user,id=net0,chardev=chr0 \ 3651 -device virtio-net-pci,netdev=net0 3652 3653``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]`` 3654 Establish a vhost-vdpa netdev. 3655 3656 vDPA device is a device that uses a datapath which complies with 3657 the virtio specifications with a vendor specific control path. 3658 vDPA devices can be both physically located on the hardware or 3659 emulated by software. 3660 3661``-netdev hubport,id=id,hubid=hubid[,netdev=nd]`` 3662 Create a hub port on the emulated hub with ID hubid. 3663 3664 The hubport netdev lets you connect a NIC to a QEMU emulated hub 3665 instead of a single netdev. Alternatively, you can also connect the 3666 hubport to another netdev with ID nd by using the ``netdev=nd`` 3667 option. 3668 3669``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]`` 3670 Legacy option to configure or create an on-board (or machine 3671 default) Network Interface Card(NIC) and connect it either to the 3672 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd. 3673 If model is omitted, then the default NIC model associated with the 3674 machine type is used. Note that the default NIC model may change in 3675 future QEMU releases, so it is highly recommended to always specify 3676 a model. Optionally, the MAC address can be changed to mac, the 3677 device address set to addr (PCI cards only), and a name can be 3678 assigned for use in monitor commands. Optionally, for PCI cards, you 3679 can specify the number v of MSI-X vectors that the card should have; 3680 this option currently only affects virtio cards; set v = 0 to 3681 disable MSI-X. If no ``-net`` option is specified, a single NIC is 3682 created. QEMU can emulate several different models of network card. 3683 Use ``-net nic,model=help`` for a list of available devices for your 3684 target. 3685 3686``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]`` 3687 Configure a host network backend (with the options corresponding to 3688 the same ``-netdev`` option) and connect it to the emulated hub 0 3689 (the default hub). Use name to specify the name of the hub port. 3690ERST 3691 3692DEFHEADING() 3693 3694DEFHEADING(Character device options:) 3695 3696DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, 3697 "-chardev help\n" 3698 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3699 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]\n" 3700 " [,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect-ms=milliseconds][,mux=on|off]\n" 3701 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n" 3702 "-chardev socket,id=id,path=path[,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect-ms=milliseconds]\n" 3703 " [,mux=on|off][,logfile=PATH][,logappend=on|off][,abstract=on|off][,tight=on|off] (unix)\n" 3704 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n" 3705 " [,localport=localport][,ipv4=on|off][,ipv6=on|off][,mux=on|off]\n" 3706 " [,logfile=PATH][,logappend=on|off]\n" 3707 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3708 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n" 3709 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3710 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n" 3711 "-chardev file,id=id,path=path[,input-path=input-file][,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3712 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3713#ifdef _WIN32 3714 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3715 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3716#else 3717 "-chardev pty,id=id[,path=path][,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3718 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n" 3719#endif 3720#ifdef CONFIG_BRLAPI 3721 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3722#endif 3723#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ 3724 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) 3725 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3726#endif 3727#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) 3728 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3729#endif 3730#if defined(CONFIG_SPICE) 3731 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n" 3732 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n" 3733#endif 3734 , QEMU_ARCH_ALL 3735) 3736 3737SRST 3738The general form of a character device option is: 3739 3740``-chardev backend,id=id[,mux=on|off][,options]`` 3741 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``, ``hub``, 3742 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``, 3743 ``pty``, ``stdio``, ``braille``, ``parallel``, 3744 ``spicevmc``, ``spiceport``. The specific backend will determine the 3745 applicable options. 3746 3747 Use ``-chardev help`` to print all available chardev backend types. 3748 3749 All devices must have an id, which can be any string up to 127 3750 characters long. It is used to uniquely identify this device in 3751 other command line directives. 3752 3753 A character device may be used in multiplexing mode by multiple 3754 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is 3755 a "1:N" device, and here the "1" end is your specified chardev 3756 backend, and the "N" end is the various parts of QEMU that can talk 3757 to a chardev. If you create a chardev with ``id=myid`` and 3758 ``mux=on``, QEMU will create a multiplexer with your specified ID, 3759 and you can then configure multiple front ends to use that chardev 3760 ID for their input/output. Up to four different front ends can be 3761 connected to a single multiplexed chardev. (Without multiplexing 3762 enabled, a chardev can only be used by a single front end.) For 3763 instance you could use this to allow a single stdio chardev to be 3764 used by two serial ports and the QEMU monitor: 3765 3766 :: 3767 3768 -chardev stdio,mux=on,id=char0 \ 3769 -mon chardev=char0,mode=readline \ 3770 -serial chardev:char0 \ 3771 -serial chardev:char0 3772 3773 You can have more than one multiplexer in a system configuration; 3774 for instance you could have a TCP port multiplexed between UART 0 3775 and UART 1, and stdio multiplexed between the QEMU monitor and a 3776 parallel port: 3777 3778 :: 3779 3780 -chardev stdio,mux=on,id=char0 \ 3781 -mon chardev=char0,mode=readline \ 3782 -parallel chardev:char0 \ 3783 -chardev tcp,...,mux=on,id=char1 \ 3784 -serial chardev:char1 \ 3785 -serial chardev:char1 3786 3787 When you're using a multiplexed character device, some escape 3788 sequences are interpreted in the input. See the chapter about 3789 :ref:`keys in the character backend multiplexer` in the 3790 System Emulation Users Guide for more details. 3791 3792 Note that some other command line options may implicitly create 3793 multiplexed character backends; for instance ``-serial mon:stdio`` 3794 creates a multiplexed stdio backend connected to the serial port and 3795 the QEMU monitor, and ``-nographic`` also multiplexes the console 3796 and the monitor to stdio. 3797 3798 If you need to aggregate data in the opposite direction (where one 3799 QEMU frontend interface receives input and output from multiple 3800 backend chardev devices), please refer to the paragraph below 3801 regarding chardev ``hub`` aggregator device configuration. 3802 3803 Every backend supports the ``logfile`` option, which supplies the 3804 path to a file to record all data transmitted via the backend. The 3805 ``logappend`` option controls whether the log file will be truncated 3806 or appended to when opened. 3807 3808The available backends are: 3809 3810``-chardev null,id=id`` 3811 A void device. This device will not emit any data, and will drop any 3812 data it receives. The null backend does not take any options. 3813 3814``-chardev socket,id=id[,TCP options or unix options][,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect-ms=milliseconds][,tls-creds=id][,tls-authz=id]`` 3815 Create a two-way stream socket, which can be either a TCP or a unix 3816 socket. A unix socket will be created if ``path`` is specified. 3817 Behaviour is undefined if TCP options are specified for a unix 3818 socket. 3819 3820 ``server=on|off`` specifies that the socket shall be a listening socket. 3821 3822 ``wait=on|off`` specifies that QEMU should not block waiting for a client 3823 to connect to a listening socket. 3824 3825 ``telnet=on|off`` specifies that traffic on the socket should interpret 3826 telnet escape sequences. 3827 3828 ``websocket=on|off`` specifies that the socket uses WebSocket protocol for 3829 communication. 3830 3831 ``reconnect-ms`` sets the timeout for reconnecting on non-server 3832 sockets when the remote end goes away. qemu will delay this many 3833 milliseconds and then attempt to reconnect. Zero disables reconnecting, 3834 and is the default. 3835 3836 ``tls-creds`` requests enablement of the TLS protocol for 3837 encryption, and specifies the id of the TLS credentials to use for 3838 the handshake. The credentials must be previously created with the 3839 ``-object tls-creds`` argument. 3840 3841 ``tls-auth`` provides the ID of the QAuthZ authorization object 3842 against which the client's x509 distinguished name will be 3843 validated. This object is only resolved at time of use, so can be 3844 deleted and recreated on the fly while the chardev server is active. 3845 If missing, it will default to denying access. 3846 3847 TCP and unix socket options are given below: 3848 3849 ``TCP options: port=port[,host=host][,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]`` 3850 ``host`` for a listening socket specifies the local address to 3851 be bound. For a connecting socket species the remote host to 3852 connect to. ``host`` is optional for listening sockets. If not 3853 specified it defaults to ``0.0.0.0``. 3854 3855 ``port`` for a listening socket specifies the local port to be 3856 bound. For a connecting socket specifies the port on the remote 3857 host to connect to. ``port`` can be given as either a port 3858 number or a service name. ``port`` is required. 3859 3860 ``to`` is only relevant to listening sockets. If it is 3861 specified, and ``port`` cannot be bound, QEMU will attempt to 3862 bind to subsequent ports up to and including ``to`` until it 3863 succeeds. ``to`` must be specified as a port number. 3864 3865 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 3866 or IPv6 must be used. If neither is specified the socket may 3867 use either protocol. 3868 3869 ``nodelay=on|off`` disables the Nagle algorithm. 3870 3871 ``unix options: path=path[,abstract=on|off][,tight=on|off]`` 3872 ``path`` specifies the local path of the unix socket. ``path`` 3873 is required. 3874 ``abstract=on|off`` specifies the use of the abstract socket namespace, 3875 rather than the filesystem. Optional, defaults to false. 3876 ``tight=on|off`` sets the socket length of abstract sockets to their minimum, 3877 rather than the full sun_path length. Optional, defaults to true. 3878 3879``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4=on|off][,ipv6=on|off]`` 3880 Sends all traffic from the guest to a remote host over UDP. 3881 3882 ``host`` specifies the remote host to connect to. If not specified 3883 it defaults to ``localhost``. 3884 3885 ``port`` specifies the port on the remote host to connect to. 3886 ``port`` is required. 3887 3888 ``localaddr`` specifies the local address to bind to. If not 3889 specified it defaults to ``0.0.0.0``. 3890 3891 ``localport`` specifies the local port to bind to. If not specified 3892 any available local port will be used. 3893 3894 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 or IPv6 must be used. 3895 If neither is specified the device may use either protocol. 3896 3897``-chardev msmouse,id=id`` 3898 Forward QEMU's emulated msmouse events to the guest. ``msmouse`` 3899 does not take any options. 3900 3901``-chardev hub,id=id,chardevs.0=id[,chardevs.N=id]`` 3902 Explicitly create chardev backend hub device with the possibility 3903 to aggregate input from multiple backend devices and forward it to 3904 a single frontend device. Additionally, ``hub`` device takes the 3905 output from the frontend device and sends it back to all the 3906 connected backend devices. This allows for seamless interaction 3907 between different backend devices and a single frontend 3908 interface. Aggregation supported for up to 4 chardev 3909 devices. (Since 10.0) 3910 3911 For example, the following is a use case of 2 backend devices: 3912 virtual console ``vc0`` and a pseudo TTY ``pty0`` connected to 3913 a single virtio hvc console frontend device with a hub ``hub0`` 3914 help. Virtual console renders text to an image, which can be 3915 shared over the VNC protocol. In turn, pty backend provides 3916 bidirectional communication to the virtio hvc console over the 3917 pseudo TTY file. The example configuration can be as follows: 3918 3919 :: 3920 3921 -chardev pty,path=/tmp/pty,id=pty0 \ 3922 -chardev vc,id=vc0 \ 3923 -chardev hub,id=hub0,chardevs.0=pty0,chardevs.1=vc0 \ 3924 -device virtconsole,chardev=hub0 \ 3925 -vnc 0.0.0.0:0 3926 3927 Once QEMU starts VNC client and any TTY emulator can be used to 3928 control a single hvc console: 3929 3930 :: 3931 3932 # Start TTY emulator 3933 tio /tmp/pty 3934 3935 # Start VNC client and switch to virtual console Ctrl-Alt-2 3936 vncviewer :0 3937 3938 Several frontend devices is not supported. Stacking of multiplexers 3939 and hub devices is not supported as well. 3940 3941``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]`` 3942 Connect to a QEMU text console. ``vc`` may optionally be given a 3943 specific size. 3944 3945 ``width`` and ``height`` specify the width and height respectively 3946 of the console, in pixels. 3947 3948 ``cols`` and ``rows`` specify that the console be sized to fit a 3949 text console with the given dimensions. 3950 3951``-chardev ringbuf,id=id[,size=size]`` 3952 Create a ring buffer with fixed size ``size``. size must be a power 3953 of two and defaults to ``64K``. 3954 3955``-chardev file,id=id,path=path[,input-path=input-path]`` 3956 Log all traffic received from the guest to a file. 3957 3958 ``path`` specifies the path of the file to be opened. This file will 3959 be created if it does not already exist, and overwritten if it does. 3960 ``path`` is required. 3961 3962 If ``input-path`` is specified, this is the path of a second file 3963 which will be used for input. If ``input-path`` is not specified, 3964 no input will be available from the chardev. 3965 3966 Note that ``input-path`` is not supported on Windows hosts. 3967 3968``-chardev pipe,id=id,path=path`` 3969 Create a two-way connection to the guest. The behaviour differs 3970 slightly between Windows hosts and other hosts: 3971 3972 On Windows, a single duplex pipe will be created at 3973 ``\\.pipe\path``. 3974 3975 On other hosts, 2 pipes will be created called ``path.in`` and 3976 ``path.out``. Data written to ``path.in`` will be received by the 3977 guest. Data written by the guest can be read from ``path.out``. QEMU 3978 will not create these fifos, and requires them to be present. 3979 3980 ``path`` forms part of the pipe path as described above. ``path`` is 3981 required. 3982 3983``-chardev console,id=id`` 3984 Send traffic from the guest to QEMU's standard output. ``console`` 3985 does not take any options. 3986 3987 ``console`` is only available on Windows hosts. 3988 3989``-chardev serial,id=id,path=path`` 3990 Send traffic from the guest to a serial device on the host. 3991 3992 On Unix hosts serial will actually accept any tty device, not only 3993 serial lines. 3994 3995 ``path`` specifies the name of the serial device to open. 3996 3997``-chardev pty,id=id[,path=path]`` 3998 Create a new pseudo-terminal on the host and connect to it. 3999 4000 ``pty`` is not available on Windows hosts. 4001 4002 If ``path`` is specified, QEMU will create a symbolic link at 4003 that location which points to the new PTY device. 4004 4005 This avoids having to make QMP or HMP monitor queries to find out 4006 what the new PTY device path is. 4007 4008 Note that while QEMU will remove the symlink when it exits 4009 gracefully, it will not do so in case of crashes or on certain 4010 startup errors. It is recommended that the user checks and removes 4011 the symlink after QEMU terminates to account for this. 4012 4013``-chardev stdio,id=id[,signal=on|off]`` 4014 Connect to standard input and standard output of the QEMU process. 4015 4016 ``signal`` controls if signals are enabled on the terminal, that 4017 includes exiting QEMU with the key sequence Control-c. This option 4018 is enabled by default, use ``signal=off`` to disable it. 4019 4020``-chardev braille,id=id`` 4021 Connect to a local BrlAPI server. ``braille`` does not take any 4022 options. 4023 4024``-chardev parallel,id=id,path=path`` 4025 \ 4026 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD 4027 hosts. 4028 4029 Connect to a local parallel port. 4030 4031 ``path`` specifies the path to the parallel port device. ``path`` is 4032 required. 4033 4034``-chardev spicevmc,id=id,debug=debug,name=name`` 4035 ``spicevmc`` is only available when spice support is built in. 4036 4037 ``debug`` debug level for spicevmc 4038 4039 ``name`` name of spice channel to connect to 4040 4041 Connect to a spice virtual machine channel, such as vdiport. 4042 4043``-chardev spiceport,id=id,debug=debug,name=name`` 4044 ``spiceport`` is only available when spice support is built in. 4045 4046 ``debug`` debug level for spicevmc 4047 4048 ``name`` name of spice port to connect to 4049 4050 Connect to a spice port, allowing a Spice client to handle the 4051 traffic identified by a name (preferably a fqdn). 4052ERST 4053 4054DEFHEADING() 4055 4056#ifdef CONFIG_TPM 4057DEFHEADING(TPM device options:) 4058 4059DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \ 4060 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n" 4061 " use path to provide path to a character device; default is /dev/tpm0\n" 4062 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n" 4063 " not provided it will be searched for in /sys/class/misc/tpm?/device\n" 4064 "-tpmdev emulator,id=id,chardev=dev\n" 4065 " configure the TPM device using chardev backend\n", 4066 QEMU_ARCH_ALL) 4067SRST 4068The general form of a TPM device option is: 4069 4070``-tpmdev backend,id=id[,options]`` 4071 The specific backend type will determine the applicable options. The 4072 ``-tpmdev`` option creates the TPM backend and requires a 4073 ``-device`` option that specifies the TPM frontend interface model. 4074 4075 Use ``-tpmdev help`` to print all available TPM backend types. 4076 4077The available backends are: 4078 4079``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path`` 4080 (Linux-host only) Enable access to the host's TPM using the 4081 passthrough driver. 4082 4083 ``path`` specifies the path to the host's TPM device, i.e., on a 4084 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by 4085 default ``/dev/tpm0`` is used. 4086 4087 ``cancel-path`` specifies the path to the host TPM device's sysfs 4088 entry allowing for cancellation of an ongoing TPM command. 4089 ``cancel-path`` is optional and by default QEMU will search for the 4090 sysfs entry to use. 4091 4092 Some notes about using the host's TPM with the passthrough driver: 4093 4094 The TPM device accessed by the passthrough driver must not be used 4095 by any other application on the host. 4096 4097 Since the host's firmware (BIOS/UEFI) has already initialized the 4098 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize 4099 the TPM again and may therefore not show a TPM-specific menu that 4100 would otherwise allow the user to configure the TPM, e.g., allow the 4101 user to enable/disable or activate/deactivate the TPM. Further, if 4102 TPM ownership is released from within a VM then the host's TPM will 4103 get disabled and deactivated. To enable and activate the TPM again 4104 afterwards, the host has to be rebooted and the user is required to 4105 enter the firmware's menu to enable and activate the TPM. If the TPM 4106 is left disabled and/or deactivated most TPM commands will fail. 4107 4108 To create a passthrough TPM use the following two options: 4109 4110 :: 4111 4112 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0 4113 4114 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by 4115 ``tpmdev=tpm0`` in the device option. 4116 4117``-tpmdev emulator,id=id,chardev=dev`` 4118 (Linux-host only) Enable access to a TPM emulator using Unix domain 4119 socket based chardev backend. 4120 4121 ``chardev`` specifies the unique ID of a character device backend 4122 that provides connection to the software TPM server. 4123 4124 To create a TPM emulator backend device with chardev socket backend: 4125 4126 :: 4127 4128 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 4129ERST 4130 4131DEFHEADING() 4132 4133#endif 4134 4135DEFHEADING(Boot Image or Kernel specific:) 4136SRST 4137There are broadly 4 ways you can boot a system with QEMU. 4138 4139 - specify a firmware and let it control finding a kernel 4140 - specify a firmware and pass a hint to the kernel to boot 4141 - direct kernel image boot 4142 - manually load files into the guest's address space 4143 4144The third method is useful for quickly testing kernels but as there is 4145no firmware to pass configuration information to the kernel the 4146hardware must either be probeable, the kernel built for the exact 4147configuration or passed some configuration data (e.g. a DTB blob) 4148which tells the kernel what drivers it needs. This exact details are 4149often hardware specific. 4150 4151The final method is the most generic way of loading images into the 4152guest address space and used mostly for ``bare metal`` type 4153development where the reset vectors of the processor are taken into 4154account. 4155 4156ERST 4157 4158SRST 4159 4160For x86 machines and some other architectures ``-bios`` will generally 4161do the right thing with whatever it is given. For other machines the 4162more strict ``-pflash`` option needs an image that is sized for the 4163flash device for the given machine type. 4164 4165Please see the :ref:`system-targets-ref` section of the manual for 4166more detailed documentation. 4167 4168ERST 4169 4170DEF("bios", HAS_ARG, QEMU_OPTION_bios, \ 4171 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL) 4172SRST 4173``-bios file`` 4174 Set the filename for the BIOS. 4175ERST 4176 4177DEF("pflash", HAS_ARG, QEMU_OPTION_pflash, 4178 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL) 4179SRST 4180``-pflash file`` 4181 Use file as a parallel flash image. 4182ERST 4183 4184SRST 4185 4186The kernel options were designed to work with Linux kernels although 4187other things (like hypervisors) can be packaged up as a kernel 4188executable image. The exact format of a executable image is usually 4189architecture specific. 4190 4191The way in which the kernel is started (what address it is loaded at, 4192what if any information is passed to it via CPU registers, the state 4193of the hardware when it is started, and so on) is also architecture 4194specific. Typically it follows the specification laid down by the 4195Linux kernel for how kernels for that architecture must be started. 4196 4197ERST 4198 4199DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \ 4200 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL) 4201SRST 4202``-kernel bzImage`` 4203 Use bzImage as kernel image. The kernel can be either a Linux kernel 4204 or in multiboot format. 4205ERST 4206 4207DEF("shim", HAS_ARG, QEMU_OPTION_shim, \ 4208 "-shim shim.efi use 'shim.efi' to boot the kernel\n", QEMU_ARCH_ALL) 4209SRST 4210``-shim shim.efi`` 4211 Use 'shim.efi' to boot the kernel 4212ERST 4213 4214DEF("append", HAS_ARG, QEMU_OPTION_append, \ 4215 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL) 4216SRST 4217``-append cmdline`` 4218 Use cmdline as kernel command line 4219ERST 4220 4221DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \ 4222 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL) 4223SRST(initrd) 4224 4225``-initrd file`` 4226 Use file as initial ram disk. 4227 4228``-initrd "file1 arg=foo,file2"`` 4229 This syntax is only available with multiboot. 4230 4231 Use file1 and file2 as modules and pass ``arg=foo`` as parameter to the 4232 first module. Commas can be provided in module parameters by doubling 4233 them on the command line to escape them: 4234 4235``-initrd "bzImage earlyprintk=xen,,keep root=/dev/xvda1,initrd.img"`` 4236 Multiboot only. Use bzImage as the first module with 4237 "``earlyprintk=xen,keep root=/dev/xvda1``" as its command line, 4238 and initrd.img as the second module. 4239 4240ERST 4241 4242DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \ 4243 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL) 4244SRST 4245``-dtb file`` 4246 Use file as a device tree binary (dtb) image and pass it to the 4247 kernel on boot. 4248ERST 4249 4250SRST 4251 4252Finally you can also manually load images directly into the address 4253space of the guest. This is most useful for developers who already 4254know the layout of their guest and take care to ensure something sane 4255will happen when the reset vector executes. 4256 4257The generic loader can be invoked by using the loader device: 4258 4259``-device loader,addr=<addr>,data=<data>,data-len=<data-len>[,data-be=<data-be>][,cpu-num=<cpu-num>]`` 4260 4261there is also the guest loader which operates in a similar way but 4262tweaks the DTB so a hypervisor loaded via ``-kernel`` can find where 4263the guest image is: 4264 4265``-device guest-loader,addr=<addr>[,kernel=<path>,[bootargs=<arguments>]][,initrd=<path>]`` 4266 4267ERST 4268 4269DEFHEADING() 4270 4271DEFHEADING(Debug/Expert options:) 4272 4273DEF("compat", HAS_ARG, QEMU_OPTION_compat, 4274 "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n" 4275 " Policy for handling deprecated management interfaces\n" 4276 "-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n" 4277 " Policy for handling unstable management interfaces\n", 4278 QEMU_ARCH_ALL) 4279SRST 4280``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]`` 4281 Set policy for handling deprecated management interfaces (experimental): 4282 4283 ``deprecated-input=accept`` (default) 4284 Accept deprecated commands and arguments 4285 ``deprecated-input=reject`` 4286 Reject deprecated commands and arguments 4287 ``deprecated-input=crash`` 4288 Crash on deprecated commands and arguments 4289 ``deprecated-output=accept`` (default) 4290 Emit deprecated command results and events 4291 ``deprecated-output=hide`` 4292 Suppress deprecated command results and events 4293 4294 Limitation: covers only syntactic aspects of QMP. 4295 4296``-compat [unstable-input=@var{input-policy}][,unstable-output=@var{output-policy}]`` 4297 Set policy for handling unstable management interfaces (experimental): 4298 4299 ``unstable-input=accept`` (default) 4300 Accept unstable commands and arguments 4301 ``unstable-input=reject`` 4302 Reject unstable commands and arguments 4303 ``unstable-input=crash`` 4304 Crash on unstable commands and arguments 4305 ``unstable-output=accept`` (default) 4306 Emit unstable command results and events 4307 ``unstable-output=hide`` 4308 Suppress unstable command results and events 4309 4310 Limitation: covers only syntactic aspects of QMP. 4311ERST 4312 4313DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg, 4314 "-fw_cfg [name=]<name>,file=<file>\n" 4315 " add named fw_cfg entry with contents from file\n" 4316 "-fw_cfg [name=]<name>,string=<str>\n" 4317 " add named fw_cfg entry with contents from string\n", 4318 QEMU_ARCH_ALL) 4319SRST 4320``-fw_cfg [name=]name,file=file`` 4321 Add named fw\_cfg entry with contents from file file. 4322 If the filename contains comma, you must double it (for instance, 4323 "file=my,,file" to use file "my,file"). 4324 4325``-fw_cfg [name=]name,string=str`` 4326 Add named fw\_cfg entry with contents from string str. 4327 If the string contains comma, you must double it (for instance, 4328 "string=my,,string" to use file "my,string"). 4329 4330 The terminating NUL character of the contents of str will not be 4331 included as part of the fw\_cfg item data. To insert contents with 4332 embedded NUL characters, you have to use the file parameter. 4333 4334 The fw\_cfg entries are passed by QEMU through to the guest. 4335 4336 Example: 4337 4338 :: 4339 4340 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin 4341 4342 creates an fw\_cfg entry named opt/com.mycompany/blob with contents 4343 from ./my\_blob.bin. 4344ERST 4345 4346DEF("serial", HAS_ARG, QEMU_OPTION_serial, \ 4347 "-serial dev redirect the serial port to char device 'dev'\n", 4348 QEMU_ARCH_ALL) 4349SRST 4350``-serial dev`` 4351 Redirect the virtual serial port to host character device dev. The 4352 default device is ``vc`` in graphical mode and ``stdio`` in non 4353 graphical mode. 4354 4355 This option can be used several times to simulate multiple serial 4356 ports. 4357 4358 You can use ``-serial none`` to suppress the creation of default 4359 serial devices. 4360 4361 Available character devices are: 4362 4363 ``vc[:WxH]`` 4364 Virtual console. Optionally, a width and height can be given in 4365 pixel with 4366 4367 :: 4368 4369 vc:800x600 4370 4371 It is also possible to specify width or height in characters: 4372 4373 :: 4374 4375 vc:80Cx24C 4376 4377 ``pty[:path]`` 4378 [Linux only] Pseudo TTY (a new PTY is automatically allocated). 4379 4380 If ``path`` is specified, QEMU will create a symbolic link at 4381 that location which points to the new PTY device. 4382 4383 This avoids having to make QMP or HMP monitor queries to find 4384 out what the new PTY device path is. 4385 4386 Note that while QEMU will remove the symlink when it exits 4387 gracefully, it will not do so in case of crashes or on certain 4388 startup errors. It is recommended that the user checks and 4389 removes the symlink after QEMU terminates to account for this. 4390 4391 ``none`` 4392 No device is allocated. Note that for machine types which 4393 emulate systems where a serial device is always present in 4394 real hardware, this may be equivalent to the ``null`` option, 4395 in that the serial device is still present but all output 4396 is discarded. For boards where the number of serial ports is 4397 truly variable, this suppresses the creation of the device. 4398 4399 ``null`` 4400 A guest will see the UART or serial device as present in the 4401 machine, but all output is discarded, and there is no input. 4402 Conceptually equivalent to redirecting the output to ``/dev/null``. 4403 4404 ``chardev:id`` 4405 Use a named character device defined with the ``-chardev`` 4406 option. 4407 4408 ``/dev/XXX`` 4409 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial 4410 port parameters are set according to the emulated ones. 4411 4412 ``/dev/parportN`` 4413 [Linux only, parallel port only] Use host parallel port N. 4414 Currently SPP and EPP parallel port features can be used. 4415 4416 ``file:filename`` 4417 Write output to filename. No character can be read. 4418 4419 ``stdio`` 4420 [Unix only] standard input/output 4421 4422 ``pipe:filename`` 4423 name pipe filename 4424 4425 ``COMn`` 4426 [Windows only] Use host serial port n 4427 4428 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]`` 4429 This implements UDP Net Console. When remote\_host or src\_ip 4430 are not specified they default to ``0.0.0.0``. When not using a 4431 specified src\_port a random port is automatically chosen. 4432 4433 If you just want a simple readonly console you can use 4434 ``netcat`` or ``nc``, by starting QEMU with: 4435 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time 4436 QEMU writes something to that port it will appear in the 4437 netconsole session. 4438 4439 If you plan to send characters back via netconsole or you want 4440 to stop and start QEMU a lot of times, you should have QEMU use 4441 the same source port each time by using something like ``-serial 4442 udp::4555@:4556`` to QEMU. Another approach is to use a patched 4443 version of netcat which can listen to a TCP port and send and 4444 receive characters via udp. If you have a patched version of 4445 netcat which activates telnet remote echo and single char 4446 transfer, then you can use the following options to set up a 4447 netcat redirector to allow telnet on port 5555 to access the 4448 QEMU port. 4449 4450 ``QEMU Options:`` 4451 -serial udp::4555@:4556 4452 4453 ``netcat options:`` 4454 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T 4455 4456 ``telnet options:`` 4457 localhost 5555 4458 4459 ``tcp:[host]:port[,server=on|off][,wait=on|off][,nodelay=on|off][,reconnect-ms=milliseconds]`` 4460 The TCP Net Console has two modes of operation. It can send the 4461 serial I/O to a location or wait for a connection from a 4462 location. By default the TCP Net Console is sent to host at the 4463 port. If you use the ``server=on`` option QEMU will wait for a client 4464 socket application to connect to the port before continuing, 4465 unless the ``wait=on|off`` option was specified. The ``nodelay=on|off`` 4466 option disables the Nagle buffering algorithm. The ``reconnect-ms`` 4467 option only applies if ``server=no`` is set, if the connection goes 4468 down it will attempt to reconnect at the given interval. If host 4469 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a 4470 time is accepted. You can use ``telnet=on`` to connect to the 4471 corresponding character device. 4472 4473 ``Example to send tcp console to 192.168.0.2 port 4444`` 4474 -serial tcp:192.168.0.2:4444 4475 4476 ``Example to listen and wait on port 4444 for connection`` 4477 -serial tcp::4444,server=on 4478 4479 ``Example to not wait and listen on ip 192.168.0.100 port 4444`` 4480 -serial tcp:192.168.0.100:4444,server=on,wait=off 4481 4482 ``telnet:host:port[,server=on|off][,wait=on|off][,nodelay=on|off]`` 4483 The telnet protocol is used instead of raw tcp sockets. The 4484 options work the same as if you had specified ``-serial tcp``. 4485 The difference is that the port acts like a telnet server or 4486 client using telnet option negotiation. This will also allow you 4487 to send the MAGIC\_SYSRQ sequence if you use a telnet that 4488 supports sending the break sequence. Typically in unix telnet 4489 you do it with Control-] and then type "send break" followed by 4490 pressing the enter key. 4491 4492 ``websocket:host:port,server=on[,wait=on|off][,nodelay=on|off]`` 4493 The WebSocket protocol is used instead of raw tcp socket. The 4494 port acts as a WebSocket server. Client mode is not supported. 4495 4496 ``unix:path[,server=on|off][,wait=on|off][,reconnect-ms=milliseconds]`` 4497 A unix domain socket is used instead of a tcp socket. The option 4498 works the same as if you had specified ``-serial tcp`` except 4499 the unix domain socket path is used for connections. 4500 4501 ``mon:dev_string`` 4502 This is a special option to allow the monitor to be multiplexed 4503 onto another serial port. The monitor is accessed with key 4504 sequence of Control-a and then pressing c. dev\_string should be 4505 any one of the serial devices specified above. An example to 4506 multiplex the monitor onto a telnet server listening on port 4507 4444 would be: 4508 4509 ``-serial mon:telnet::4444,server=on,wait=off`` 4510 4511 When the monitor is multiplexed to stdio in this way, Ctrl+C 4512 will not terminate QEMU any more but will be passed to the guest 4513 instead. 4514 4515 ``braille`` 4516 Braille device. This will use BrlAPI to display the braille 4517 output on a real or fake device. 4518 4519 ``msmouse`` 4520 Three button serial mouse. Configure the guest to use Microsoft 4521 protocol. 4522ERST 4523 4524DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \ 4525 "-parallel dev redirect the parallel port to char device 'dev'\n", 4526 QEMU_ARCH_ALL) 4527SRST 4528``-parallel dev`` 4529 Redirect the virtual parallel port to host device dev (same devices 4530 as the serial port). On Linux hosts, ``/dev/parportN`` can be used 4531 to use hardware devices connected on the corresponding host parallel 4532 port. 4533 4534 This option can be used several times to simulate up to 3 parallel 4535 ports. 4536 4537 Use ``-parallel none`` to disable all parallel ports. 4538ERST 4539 4540DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \ 4541 "-monitor dev redirect the monitor to char device 'dev'\n", 4542 QEMU_ARCH_ALL) 4543SRST 4544``-monitor dev`` 4545 Redirect the monitor to host device dev (same devices as the serial 4546 port). The default device is ``vc`` in graphical mode and ``stdio`` 4547 in non graphical mode. Use ``-monitor none`` to disable the default 4548 monitor. 4549ERST 4550DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \ 4551 "-qmp dev like -monitor but opens in 'control' mode\n", 4552 QEMU_ARCH_ALL) 4553SRST 4554``-qmp dev`` 4555 Like ``-monitor`` but opens in 'control' mode. For example, to make 4556 QMP available on localhost port 4444:: 4557 4558 -qmp tcp:localhost:4444,server=on,wait=off 4559 4560 Not all options are configurable via this syntax; for maximum 4561 flexibility use the ``-mon`` option and an accompanying ``-chardev``. 4562 4563ERST 4564DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \ 4565 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n", 4566 QEMU_ARCH_ALL) 4567SRST 4568``-qmp-pretty dev`` 4569 Like ``-qmp`` but uses pretty JSON formatting. 4570ERST 4571 4572DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ 4573 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL) 4574SRST 4575``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]`` 4576 Set up a monitor connected to the chardev ``name``. 4577 QEMU supports two monitors: the Human Monitor Protocol 4578 (HMP; for human interaction), and the QEMU Monitor Protocol 4579 (QMP; a JSON RPC-style protocol). 4580 The default is HMP; ``mode=control`` selects QMP instead. 4581 ``pretty`` is only valid when ``mode=control``, 4582 turning on JSON pretty printing to ease 4583 human reading and debugging. 4584 4585 For example:: 4586 4587 -chardev socket,id=mon1,host=localhost,port=4444,server=on,wait=off \ 4588 -mon chardev=mon1,mode=control,pretty=on 4589 4590 enables the QMP monitor on localhost port 4444 with pretty-printing. 4591ERST 4592 4593DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \ 4594 "-debugcon dev redirect the debug console to char device 'dev'\n", 4595 QEMU_ARCH_ALL) 4596SRST 4597``-debugcon dev`` 4598 Redirect the debug console to host device dev (same devices as the 4599 serial port). The debug console is an I/O port which is typically 4600 port 0xe9; writing to that I/O port sends output to this device. The 4601 default device is ``vc`` in graphical mode and ``stdio`` in non 4602 graphical mode. 4603ERST 4604 4605DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \ 4606 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL) 4607SRST 4608``-pidfile file`` 4609 Store the QEMU process PID in file. It is useful if you launch QEMU 4610 from a script. 4611ERST 4612 4613DEF("preconfig", 0, QEMU_OPTION_preconfig, \ 4614 "--preconfig pause QEMU before machine is initialized (experimental)\n", 4615 QEMU_ARCH_ALL) 4616SRST 4617``--preconfig`` 4618 Pause QEMU for interactive configuration before the machine is 4619 created, which allows querying and configuring properties that will 4620 affect machine initialization. Use QMP command 'x-exit-preconfig' to 4621 exit the preconfig state and move to the next state (i.e. run guest 4622 if -S isn't used or pause the second time if -S is used). This 4623 option is experimental. 4624ERST 4625 4626DEF("S", 0, QEMU_OPTION_S, \ 4627 "-S freeze CPU at startup (use 'c' to start execution)\n", 4628 QEMU_ARCH_ALL) 4629SRST 4630``-S`` 4631 Do not start CPU at startup (you must type 'c' in the monitor). 4632ERST 4633 4634DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit, 4635 "-overcommit [mem-lock=on|off|on-fault][cpu-pm=on|off]\n" 4636 " run qemu with overcommit hints\n" 4637 " mem-lock=on|off|on-fault controls memory lock support (default: off)\n" 4638 " cpu-pm=on|off controls cpu power management (default: off)\n", 4639 QEMU_ARCH_ALL) 4640SRST 4641``-overcommit mem-lock=on|off|on-fault`` 4642 \ 4643``-overcommit cpu-pm=on|off`` 4644 Run qemu with hints about host resource overcommit. The default is 4645 to assume that host overcommits all resources. 4646 4647 Locking qemu and guest memory can be enabled via ``mem-lock=on`` 4648 or ``mem-lock=on-fault`` (disabled by default). This works when 4649 host memory is not overcommitted and reduces the worst-case latency for 4650 guest. The on-fault option is better for reducing the memory footprint 4651 since it makes allocations lazy, but the pages still get locked in place 4652 once faulted by the guest or QEMU. Note that the two options are mutually 4653 exclusive. 4654 4655 Guest ability to manage power state of host cpus (increasing latency 4656 for other processes on the same host cpu, but decreasing latency for 4657 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This 4658 works best when host CPU is not overcommitted. When used, host 4659 estimates of CPU cycle and power utilization will be incorrect, not 4660 taking into account guest idle time. 4661ERST 4662 4663DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ 4664 "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n" 4665 " the guest without waiting for gdb to connect; use -S too\n" 4666 " if you want it to not start execution.)\n", 4667 QEMU_ARCH_ALL) 4668SRST 4669``-gdb dev`` 4670 Accept a gdb connection on device dev (see the :ref:`GDB usage` chapter 4671 in the System Emulation Users Guide). Note that this option does not pause QEMU 4672 execution -- if you want QEMU to not start the guest until you 4673 connect with gdb and issue a ``continue`` command, you will need to 4674 also pass the ``-S`` option to QEMU. 4675 4676 The most usual configuration is to listen on a local TCP socket:: 4677 4678 -gdb tcp::3117 4679 4680 but you can specify other backends; UDP, pseudo TTY, or even stdio 4681 are all reasonable use cases. For example, a stdio connection 4682 allows you to start QEMU from within gdb and establish the 4683 connection via a pipe: 4684 4685 .. parsed-literal:: 4686 4687 (gdb) target remote | exec |qemu_system| -gdb stdio ... 4688ERST 4689 4690DEF("s", 0, QEMU_OPTION_s, \ 4691 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n", 4692 QEMU_ARCH_ALL) 4693SRST 4694``-s`` 4695 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234 4696 (see the :ref:`GDB usage` chapter in the System Emulation Users Guide). 4697ERST 4698 4699DEF("d", HAS_ARG, QEMU_OPTION_d, \ 4700 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n", 4701 QEMU_ARCH_ALL) 4702SRST 4703``-d item1[,...]`` 4704 Enable logging of specified items. Use '-d help' for a list of log 4705 items. 4706ERST 4707 4708DEF("D", HAS_ARG, QEMU_OPTION_D, \ 4709 "-D logfile output log to logfile (default stderr)\n", 4710 QEMU_ARCH_ALL) 4711SRST 4712``-D logfile`` 4713 Output log in logfile instead of to stderr 4714ERST 4715 4716DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \ 4717 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n", 4718 QEMU_ARCH_ALL) 4719SRST 4720``-dfilter range1[,...]`` 4721 Filter debug output to that relevant to a range of target addresses. 4722 The filter spec can be either start+size, start-size or start..end 4723 where start end and size are the addresses and sizes required. For 4724 example: 4725 4726 :: 4727 4728 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000 4729 4730 Will dump output for any code in the 0x1000 sized block starting at 4731 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and 4732 another 0x1000 sized block starting at 0xffffffc00005f000. 4733ERST 4734 4735DEF("seed", HAS_ARG, QEMU_OPTION_seed, \ 4736 "-seed number seed the pseudo-random number generator\n", 4737 QEMU_ARCH_ALL) 4738SRST 4739``-seed number`` 4740 Force the guest to use a deterministic pseudo-random number 4741 generator, seeded with number. This does not affect crypto routines 4742 within the host. 4743ERST 4744 4745DEF("L", HAS_ARG, QEMU_OPTION_L, \ 4746 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n", 4747 QEMU_ARCH_ALL) 4748SRST 4749``-L path`` 4750 Set the directory for the BIOS, VGA BIOS and keymaps. 4751 4752 To list all the data directories, use ``-L help``. 4753ERST 4754 4755DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \ 4756 "-enable-kvm enable KVM full virtualization support\n", 4757 QEMU_ARCH_ARM | QEMU_ARCH_I386 | QEMU_ARCH_MIPS | QEMU_ARCH_PPC | 4758 QEMU_ARCH_RISCV | QEMU_ARCH_S390X) 4759SRST 4760``-enable-kvm`` 4761 Enable KVM full virtualization support. This option is only 4762 available if KVM support is enabled when compiling. 4763ERST 4764 4765DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid, 4766 "-xen-domid id specify xen guest domain id\n", 4767 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4768DEF("xen-attach", 0, QEMU_OPTION_xen_attach, 4769 "-xen-attach attach to existing xen domain\n" 4770 " libxl will use this when starting QEMU\n", 4771 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4772DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict, 4773 "-xen-domid-restrict restrict set of available xen operations\n" 4774 " to specified domain id. (Does not affect\n" 4775 " xenpv machine type).\n", 4776 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4777SRST 4778``-xen-domid id`` 4779 Specify xen guest domain id (XEN only). 4780 4781``-xen-attach`` 4782 Attach to existing xen domain. libxl will use this when starting 4783 QEMU (XEN only). Restrict set of available xen operations to 4784 specified domain id (XEN only). 4785ERST 4786 4787DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \ 4788 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL) 4789SRST 4790``-no-reboot`` 4791 Exit instead of rebooting. 4792ERST 4793 4794DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \ 4795 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL) 4796SRST 4797``-no-shutdown`` 4798 Don't exit QEMU on guest shutdown, but instead only stop the 4799 emulation. This allows for instance switching to monitor to commit 4800 changes to the disk image. 4801ERST 4802 4803DEF("action", HAS_ARG, QEMU_OPTION_action, 4804 "-action reboot=reset|shutdown\n" 4805 " action when guest reboots [default=reset]\n" 4806 "-action shutdown=poweroff|pause\n" 4807 " action when guest shuts down [default=poweroff]\n" 4808 "-action panic=pause|shutdown|exit-failure|none\n" 4809 " action when guest panics [default=shutdown]\n" 4810 "-action watchdog=reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" 4811 " action when watchdog fires [default=reset]\n", 4812 QEMU_ARCH_ALL) 4813SRST 4814``-action event=action`` 4815 The action parameter serves to modify QEMU's default behavior when 4816 certain guest events occur. It provides a generic method for specifying the 4817 same behaviors that are modified by the ``-no-reboot`` and ``-no-shutdown`` 4818 parameters. 4819 4820 Examples: 4821 4822 ``-action panic=none`` 4823 ``-action reboot=shutdown,shutdown=pause`` 4824 ``-device i6300esb -action watchdog=pause`` 4825 4826ERST 4827 4828DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \ 4829 "-loadvm [tag|id]\n" \ 4830 " start right away with a saved state (loadvm in monitor)\n", 4831 QEMU_ARCH_ALL) 4832SRST 4833``-loadvm file`` 4834 Start right away with a saved state (``loadvm`` in monitor) 4835ERST 4836 4837#ifndef _WIN32 4838DEF("daemonize", 0, QEMU_OPTION_daemonize, \ 4839 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) 4840#endif 4841SRST 4842``-daemonize`` 4843 Daemonize the QEMU process after initialization. QEMU will not 4844 detach from standard IO until it is ready to receive connections on 4845 any of its devices. This option is a useful way for external 4846 programs to launch QEMU without having to cope with initialization 4847 race conditions. 4848ERST 4849 4850DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \ 4851 "-option-rom rom load a file, rom, into the option ROM space\n", 4852 QEMU_ARCH_ALL) 4853SRST 4854``-option-rom file`` 4855 Load the contents of file as an option ROM. This option is useful to 4856 load things like EtherBoot. 4857ERST 4858 4859DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \ 4860 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \ 4861 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n", 4862 QEMU_ARCH_ALL) 4863 4864SRST 4865``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]`` 4866 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at 4867 the current UTC or local time, respectively. ``localtime`` is 4868 required for correct date in MS-DOS or Windows. To start at a 4869 specific point in time, provide datetime in the format 4870 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC. 4871 4872 By default the RTC is driven by the host system time. This allows 4873 using of the RTC as accurate reference clock inside the guest, 4874 specifically if the host time is smoothly following an accurate 4875 external reference clock, e.g. via NTP. If you want to isolate the 4876 guest time from the host, you can set ``clock`` to ``rt`` instead, 4877 which provides a host monotonic clock if host support it. To even 4878 prevent the RTC from progressing during suspension, you can set 4879 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is 4880 recommended especially in icount mode in order to preserve 4881 determinism; however, note that in icount mode the speed of the 4882 virtual clock is variable and can in general differ from the host 4883 clock. 4884 4885 Enable ``driftfix`` (i386 targets only) if you experience time drift 4886 problems, specifically with Windows' ACPI HAL. This option will try 4887 to figure out how many timer interrupts were not processed by the 4888 Windows guest and will re-inject them. 4889ERST 4890 4891DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ 4892 "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=<filename>[,rrsnapshot=<snapshot>]]\n" \ 4893 " enable virtual instruction counter with 2^N clock ticks per\n" \ 4894 " instruction, enable aligning the host and virtual clocks\n" \ 4895 " or disable real time cpu sleeping, and optionally enable\n" \ 4896 " record-and-replay mode\n", QEMU_ARCH_ALL) 4897SRST 4898``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]`` 4899 Enable virtual instruction counter. The virtual cpu will execute one 4900 instruction every 2^N ns of virtual time. If ``auto`` is specified 4901 then the virtual cpu speed will be automatically adjusted to keep 4902 virtual time within a few seconds of real time. 4903 4904 Note that while this option can give deterministic behavior, it does 4905 not provide cycle accurate emulation. Modern CPUs contain 4906 superscalar out of order cores with complex cache hierarchies. The 4907 number of instructions executed often has little or no correlation 4908 with actual performance. 4909 4910 When the virtual cpu is sleeping, the virtual time will advance at 4911 default speed unless ``sleep=on`` is specified. With 4912 ``sleep=on``, the virtual time will jump to the next timer 4913 deadline instantly whenever the virtual cpu goes to sleep mode and 4914 will not advance if no timer is enabled. This behavior gives 4915 deterministic execution times from the guest point of view. 4916 The default if icount is enabled is ``sleep=off``. 4917 ``sleep=on`` cannot be used together with either ``shift=auto`` 4918 or ``align=on``. 4919 4920 ``align=on`` will activate the delay algorithm which will try to 4921 synchronise the host clock and the virtual clock. The goal is to 4922 have a guest running at the real frequency imposed by the shift 4923 option. Whenever the guest clock is behind the host clock and if 4924 ``align=on`` is specified then we print a message to the user to 4925 inform about the delay. Currently this option does not work when 4926 ``shift`` is ``auto``. Note: The sync algorithm will work for those 4927 shift values for which the guest clock runs ahead of the host clock. 4928 Typically this happens when the shift value is high (how high 4929 depends on the host machine). The default if icount is enabled 4930 is ``align=off``. 4931 4932 When the ``rr`` option is specified deterministic record/replay is 4933 enabled. The ``rrfile=`` option must also be provided to 4934 specify the path to the replay log. In record mode data is written 4935 to this file, and in replay mode it is read back. 4936 If the ``rrsnapshot`` option is given then it specifies a VM snapshot 4937 name. In record mode, a new VM snapshot with the given name is created 4938 at the start of execution recording. In replay mode this option 4939 specifies the snapshot name used to load the initial VM state. 4940ERST 4941 4942DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \ 4943 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \ 4944 " action when watchdog fires [default=reset]\n", 4945 QEMU_ARCH_ALL) 4946SRST 4947``-watchdog-action action`` 4948 The action controls what QEMU will do when the watchdog timer 4949 expires. The default is ``reset`` (forcefully reset the guest). 4950 Other possible actions are: ``shutdown`` (attempt to gracefully 4951 shutdown the guest), ``poweroff`` (forcefully poweroff the guest), 4952 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the 4953 guest), ``debug`` (print a debug message and continue), or ``none`` 4954 (do nothing). 4955 4956 Note that the ``shutdown`` action requires that the guest responds 4957 to ACPI signals, which it may not be able to do in the sort of 4958 situations where the watchdog would have expired, and thus 4959 ``-watchdog-action shutdown`` is not recommended for production use. 4960 4961 Examples: 4962 4963 ``-device i6300esb -watchdog-action pause`` 4964 4965ERST 4966 4967DEF("echr", HAS_ARG, QEMU_OPTION_echr, \ 4968 "-echr chr set terminal escape character instead of ctrl-a\n", 4969 QEMU_ARCH_ALL) 4970SRST 4971``-echr numeric_ascii_value`` 4972 Change the escape character used for switching to the monitor when 4973 using monitor and serial sharing. The default is ``0x01`` when using 4974 the ``-nographic`` option. ``0x01`` is equal to pressing 4975 ``Control-a``. You can select a different character from the ascii 4976 control keys where 1 through 26 map to Control-a through Control-z. 4977 For instance you could use the either of the following to change the 4978 escape character to Control-t. 4979 4980 ``-echr 0x14``; \ ``-echr 20`` 4981 4982ERST 4983 4984DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ 4985 "-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]\n" \ 4986 "-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]\n" \ 4987 "-incoming unix:socketpath\n" \ 4988 " prepare for incoming migration, listen on\n" \ 4989 " specified protocol and socket address\n" \ 4990 "-incoming fd:fd\n" \ 4991 "-incoming file:filename[,offset=offset]\n" \ 4992 "-incoming exec:cmdline\n" \ 4993 " accept incoming migration on given file descriptor\n" \ 4994 " or from given external command\n" \ 4995 "-incoming <channel>\n" \ 4996 " accept incoming migration on the migration channel\n" \ 4997 "-incoming defer\n" \ 4998 " wait for the URI to be specified via migrate_incoming\n", 4999 QEMU_ARCH_ALL) 5000SRST 5001The -incoming option specifies the migration channel for an incoming 5002migration. It may be used multiple times to specify multiple 5003migration channel types. The channel type is specified in <channel>, 5004or is 'main' for all other forms of -incoming. If multiple -incoming 5005options are specified for a channel type, the last one takes precedence. 5006 5007``-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]`` 5008 \ 5009``-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]`` 5010 Prepare for incoming migration, listen on a given tcp port. 5011 5012``-incoming unix:socketpath`` 5013 Prepare for incoming migration, listen on a given unix socket. 5014 5015``-incoming fd:fd`` 5016 Accept incoming migration from a given file descriptor. 5017 5018``-incoming file:filename[,offset=offset]`` 5019 Accept incoming migration from a given file starting at offset. 5020 offset allows the common size suffixes, or a 0x prefix, but not both. 5021 5022``-incoming exec:cmdline`` 5023 Accept incoming migration as an output from specified external 5024 command. 5025 5026``-incoming <channel>`` 5027 Accept incoming migration on the migration channel. For the syntax 5028 of <channel>, see the QAPI documentation of ``MigrationChannel``. 5029 Examples: 5030 :: 5031 5032 -incoming '{"channel-type": "main", 5033 "addr": { "transport": "socket", 5034 "type": "unix", 5035 "path": "my.sock" }}' 5036 5037 -incoming main,addr.transport=socket,addr.type=unix,addr.path=my.sock 5038 5039``-incoming defer`` 5040 Wait for the URI to be specified via migrate\_incoming. The monitor 5041 can be used to change settings (such as migration parameters) prior 5042 to issuing the migrate\_incoming to allow the migration to begin. 5043ERST 5044 5045DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \ 5046 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL) 5047SRST 5048``-only-migratable`` 5049 Only allow migratable devices. Devices will not be allowed to enter 5050 an unmigratable state. 5051ERST 5052 5053DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \ 5054 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL) 5055SRST 5056``-nodefaults`` 5057 Don't create default devices. Normally, QEMU sets the default 5058 devices like serial port, parallel port, virtual console, monitor 5059 device, VGA adapter, floppy and CD-ROM drive and others. The 5060 ``-nodefaults`` option will disable all those default devices. 5061ERST 5062 5063DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env, 5064 "-prom-env variable=value\n" 5065 " set OpenBIOS nvram variables\n", 5066 QEMU_ARCH_PPC | QEMU_ARCH_SPARC) 5067SRST 5068``-prom-env variable=value`` 5069 Set OpenBIOS nvram variable to given value (PPC, SPARC only). 5070 5071 :: 5072 5073 qemu-system-sparc -prom-env 'auto-boot?=false' \ 5074 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single' 5075 5076 :: 5077 5078 qemu-system-ppc -prom-env 'auto-boot?=false' \ 5079 -prom-env 'boot-device=hd:2,\yaboot' \ 5080 -prom-env 'boot-args=conf=hd:2,\yaboot.conf' 5081ERST 5082DEF("semihosting", 0, QEMU_OPTION_semihosting, 5083 "-semihosting semihosting mode\n", 5084 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | 5085 QEMU_ARCH_MIPS | QEMU_ARCH_RISCV) 5086SRST 5087``-semihosting`` 5088 Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, RISC-V only). 5089 5090 .. warning:: 5091 Note that this allows guest direct access to the host filesystem, so 5092 should only be used with a trusted guest OS. 5093 5094 See the -semihosting-config option documentation for further 5095 information about the facilities this enables. 5096ERST 5097DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config, 5098 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]\n" \ 5099 " semihosting configuration\n", 5100QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | 5101QEMU_ARCH_MIPS | QEMU_ARCH_RISCV) 5102SRST 5103``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]`` 5104 Enable and configure :ref:`Semihosting` (ARM, M68K, Xtensa, MIPS, RISC-V 5105 only). 5106 5107 .. warning:: 5108 Note that this allows guest direct access to the host filesystem, so 5109 should only be used with a trusted guest OS. 5110 5111 ``target=native|gdb|auto`` 5112 Defines where the semihosting calls will be addressed, to QEMU 5113 (``native``) or to GDB (``gdb``). The default is ``auto``, which 5114 means ``gdb`` during debug sessions and ``native`` otherwise. 5115 5116 ``chardev=str1`` 5117 Send the output to a chardev backend output for native or auto 5118 output when not in gdb 5119 5120 ``userspace=on|off`` 5121 Allows code running in guest userspace to access the semihosting 5122 interface. The default is that only privileged guest code can 5123 make semihosting calls. Note that setting ``userspace=on`` should 5124 only be used if all guest code is trusted (for example, in 5125 bare-metal test case code). 5126 5127 ``arg=str1,arg=str2,...`` 5128 Allows the user to pass input arguments, and can be used 5129 multiple times to build up a list. The old-style 5130 ``-kernel``/``-append`` method of passing a command line is 5131 still supported for backward compatibility. If both the 5132 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are 5133 specified, the former is passed to semihosting as it always 5134 takes precedence. 5135ERST 5136DEF("old-param", 0, QEMU_OPTION_old_param, 5137 "-old-param old param mode\n", QEMU_ARCH_ARM) 5138SRST 5139``-old-param`` 5140 Old param mode (ARM only). 5141ERST 5142 5143DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \ 5144 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \ 5145 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \ 5146 " Enable seccomp mode 2 system call filter (default 'off').\n" \ 5147 " use 'obsolete' to allow obsolete system calls that are provided\n" \ 5148 " by the kernel, but typically no longer used by modern\n" \ 5149 " C library implementations.\n" \ 5150 " use 'elevateprivileges' to allow or deny the QEMU process ability\n" \ 5151 " to elevate privileges using set*uid|gid system calls.\n" \ 5152 " The value 'children' will deny set*uid|gid system calls for\n" \ 5153 " main QEMU process but will allow forks and execves to run unprivileged\n" \ 5154 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \ 5155 " blocking *fork and execve\n" \ 5156 " use 'resourcecontrol' to disable process affinity and schedular priority\n", 5157 QEMU_ARCH_ALL) 5158SRST 5159``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]`` 5160 Enable Seccomp mode 2 system call filter. 'on' will enable syscall 5161 filtering and 'off' will disable it. The default is 'off'. 5162 5163 ``obsolete=string`` 5164 Enable Obsolete system calls 5165 5166 ``elevateprivileges=string`` 5167 Disable set\*uid\|gid system calls 5168 5169 ``spawn=string`` 5170 Disable \*fork and execve 5171 5172 ``resourcecontrol=string`` 5173 Disable process affinity and schedular priority 5174ERST 5175 5176DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig, 5177 "-readconfig <file>\n" 5178 " read config file\n", QEMU_ARCH_ALL) 5179SRST 5180``-readconfig file`` 5181 Read device configuration from file. This approach is useful when 5182 you want to spawn QEMU process with many command line options but 5183 you don't want to exceed the command line character limit. 5184ERST 5185 5186DEF("no-user-config", 0, QEMU_OPTION_nouserconfig, 5187 "-no-user-config\n" 5188 " do not load default user-provided config files at startup\n", 5189 QEMU_ARCH_ALL) 5190SRST 5191``-no-user-config`` 5192 The ``-no-user-config`` option makes QEMU not load any of the 5193 user-provided config files on sysconfdir. 5194ERST 5195 5196DEF("trace", HAS_ARG, QEMU_OPTION_trace, 5197 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" 5198 " specify tracing options\n", 5199 QEMU_ARCH_ALL) 5200SRST 5201``-trace [[enable=]pattern][,events=file][,file=file]`` 5202 .. include:: ../qemu-option-trace.rst.inc 5203 5204ERST 5205DEF("plugin", HAS_ARG, QEMU_OPTION_plugin, 5206 "-plugin [file=]<file>[,<argname>=<argvalue>]\n" 5207 " load a plugin\n", 5208 QEMU_ARCH_ALL) 5209SRST 5210``-plugin file=file[,argname=argvalue]`` 5211 Load a plugin. 5212 5213 ``file=file`` 5214 Load the given plugin from a shared library file. 5215 5216 ``argname=argvalue`` 5217 Argument passed to the plugin. (Can be given multiple times.) 5218ERST 5219 5220HXCOMM Internal use 5221DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) 5222DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL) 5223 5224#ifdef CONFIG_POSIX 5225DEF("run-with", HAS_ARG, QEMU_OPTION_run_with, 5226 "-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]\n" 5227 " Set miscellaneous QEMU process lifecycle options:\n" 5228 " async-teardown=on enables asynchronous teardown (Linux only)\n" 5229 " chroot=dir chroot to dir just before starting the VM\n" 5230 " user=username switch to the specified user before starting the VM\n" 5231 " user=uid:gid ditto, but use specified user-ID and group-ID instead\n", 5232 QEMU_ARCH_ALL) 5233SRST 5234``-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]`` 5235 Set QEMU process lifecycle options. 5236 5237 ``async-teardown=on`` enables asynchronous teardown. A new process called 5238 "cleanup/<QEMU_PID>" will be created at startup sharing the address 5239 space with the main QEMU process, using clone. It will wait for the 5240 main QEMU process to terminate completely, and then exit. This allows 5241 QEMU to terminate very quickly even if the guest was huge, leaving the 5242 teardown of the address space to the cleanup process. Since the cleanup 5243 process shares the same cgroups as the main QEMU process, accounting is 5244 performed correctly. This only works if the cleanup process is not 5245 forcefully killed with SIGKILL before the main QEMU process has 5246 terminated completely. 5247 5248 ``chroot=dir`` can be used for doing a chroot to the specified directory 5249 immediately before starting the guest execution. This is especially useful 5250 in combination with ``user=...``. 5251 5252 ``user=username`` or ``user=uid:gid`` can be used to drop root privileges 5253 before starting guest execution. QEMU will use the ``setuid`` and ``setgid`` 5254 system calls to switch to the specified identity. Note that the 5255 ``user=username`` syntax will also apply the full set of supplementary 5256 groups for the user, whereas the ``user=uid:gid`` will use only the 5257 ``gid`` group. 5258ERST 5259#endif 5260 5261DEF("msg", HAS_ARG, QEMU_OPTION_msg, 5262 "-msg [timestamp[=on|off]][,guest-name=[on|off]]\n" 5263 " control error message format\n" 5264 " timestamp=on enables timestamps (default: off)\n" 5265 " guest-name=on enables guest name prefix but only if\n" 5266 " -name guest option is set (default: off)\n", 5267 QEMU_ARCH_ALL) 5268SRST 5269``-msg [timestamp[=on|off]][,guest-name[=on|off]]`` 5270 Control error message format. 5271 5272 ``timestamp=on|off`` 5273 Prefix messages with a timestamp. Default is off. 5274 5275 ``guest-name=on|off`` 5276 Prefix messages with guest name but only if -name guest option is set 5277 otherwise the option is ignored. Default is off. 5278ERST 5279 5280DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate, 5281 "-dump-vmstate <file>\n" 5282 " Output vmstate information in JSON format to file.\n" 5283 " Use the scripts/vmstate-static-checker.py file to\n" 5284 " check for possible regressions in migration code\n" 5285 " by comparing two such vmstate dumps.\n", 5286 QEMU_ARCH_ALL) 5287SRST 5288``-dump-vmstate file`` 5289 Dump json-encoded vmstate information for current machine type to 5290 file in file 5291ERST 5292 5293DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile, 5294 "-enable-sync-profile\n" 5295 " enable synchronization profiling\n", 5296 QEMU_ARCH_ALL) 5297SRST 5298``-enable-sync-profile`` 5299 Enable synchronization profiling. 5300ERST 5301 5302#if defined(CONFIG_TCG) && defined(CONFIG_LINUX) 5303DEF("perfmap", 0, QEMU_OPTION_perfmap, 5304 "-perfmap generate a /tmp/perf-${pid}.map file for perf\n", 5305 QEMU_ARCH_ALL) 5306SRST 5307``-perfmap`` 5308 Generate a map file for Linux perf tools that will allow basic profiling 5309 information to be broken down into basic blocks. 5310ERST 5311 5312DEF("jitdump", 0, QEMU_OPTION_jitdump, 5313 "-jitdump generate a jit-${pid}.dump file for perf\n", 5314 QEMU_ARCH_ALL) 5315SRST 5316``-jitdump`` 5317 Generate a dump file for Linux perf tools that maps basic blocks to symbol 5318 names, line numbers and JITted code. 5319ERST 5320#endif 5321 5322DEFHEADING() 5323 5324DEFHEADING(Generic object creation:) 5325 5326DEF("object", HAS_ARG, QEMU_OPTION_object, 5327 "-object TYPENAME[,PROP1=VALUE1,...]\n" 5328 " create a new object of type TYPENAME setting properties\n" 5329 " in the order they are specified. Note that the 'id'\n" 5330 " property must be set. These objects are placed in the\n" 5331 " '/objects' path.\n", 5332 QEMU_ARCH_ALL) 5333SRST 5334``-object typename[,prop1=value1,...]`` 5335 Create a new object of type typename setting properties in the order 5336 they are specified. Note that the 'id' property must be set. These 5337 objects are placed in the '/objects' path. 5338 5339 ``-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align,offset=offset,readonly=on|off,rom=on|off|auto`` 5340 Creates a memory file backend object, which can be used to back 5341 the guest RAM with huge pages. 5342 5343 The ``id`` parameter is a unique ID that will be used to 5344 reference this memory region in other parameters, e.g. ``-numa``, 5345 ``-device nvdimm``, etc. 5346 5347 The ``size`` option provides the size of the memory region, and 5348 accepts common suffixes, e.g. ``500M``. 5349 5350 The ``mem-path`` provides the path to either a shared memory or 5351 huge page filesystem mount. 5352 5353 The ``share`` boolean option determines whether the memory 5354 region is marked as private to QEMU, or shared. The latter 5355 allows a co-operating external process to access the QEMU memory 5356 region. 5357 5358 Setting share=on might affect the ability to configure NUMA 5359 bindings for the memory backend under some circumstances, see 5360 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel 5361 source tree for additional details. 5362 5363 Setting the ``discard-data`` boolean option to on indicates that 5364 file contents can be destroyed when QEMU exits, to avoid 5365 unnecessarily flushing data to the backing file. Note that 5366 ``discard-data`` is only an optimization, and QEMU might not 5367 discard file contents if it aborts unexpectedly or is terminated 5368 using SIGKILL. 5369 5370 The ``merge`` boolean option enables memory merge, also known as 5371 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider 5372 the pages for memory deduplication. 5373 5374 Setting the ``dump`` boolean option to off excludes the memory 5375 from core dumps. This feature is also known as MADV\_DONTDUMP. 5376 5377 The ``prealloc`` boolean option enables memory preallocation. 5378 5379 The ``host-nodes`` option binds the memory range to a list of 5380 NUMA host nodes. 5381 5382 The ``policy`` option sets the NUMA policy to one of the 5383 following values: 5384 5385 ``default`` 5386 default host policy 5387 5388 ``preferred`` 5389 prefer the given host node list for allocation 5390 5391 ``bind`` 5392 restrict memory allocation to the given host node list 5393 5394 ``interleave`` 5395 interleave memory allocations across the given host node 5396 list 5397 5398 The ``align`` option specifies the base address alignment when 5399 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg 5400 ``2M``. Some backend store specified by ``mem-path`` requires an 5401 alignment different than the default one used by QEMU, eg the 5402 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In 5403 such cases, users can specify the required alignment via this 5404 option. 5405 5406 The ``offset`` option specifies the offset into the target file 5407 that the region starts at. You can use this parameter to back 5408 multiple regions with a single file. 5409 5410 The ``pmem`` option specifies whether the backing file specified 5411 by ``mem-path`` is in host persistent memory that can be 5412 accessed using the SNIA NVM programming model (e.g. Intel 5413 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary 5414 operations to guarantee the persistence of its own writes to 5415 ``mem-path`` (e.g. in vNVDIMM label emulation and live 5416 migration). Also, we will map the backend-file with MAP\_SYNC 5417 flag, which ensures the file metadata is in sync for 5418 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC 5419 requires support from both the host kernel (since Linux kernel 5420 4.15) and the filesystem of ``mem-path`` mounted with DAX 5421 option. 5422 5423 The ``readonly`` option specifies whether the backing file is opened 5424 read-only or read-write (default). 5425 5426 The ``rom`` option specifies whether to create Read Only Memory 5427 (ROM) that cannot be modified by the VM. Any write attempts to such 5428 ROM will be denied. Most use cases want proper RAM instead of ROM. 5429 However, selected use cases, like R/O NVDIMMs, can benefit from 5430 ROM. If set to ``on``, create ROM; if set to ``off``, create 5431 writable RAM; if set to ``auto`` (default), the value of the 5432 ``readonly`` option is used. This option is primarily helpful when 5433 we want to have writable RAM in configurations that would 5434 traditionally create ROM before the ``rom`` option was introduced: 5435 VM templating, where we want to open a file readonly 5436 (``readonly=on``) and mark the memory to be private for QEMU 5437 (``share=off``). For this use case, we need writable RAM instead 5438 of ROM, and want to also set ``rom=off``. 5439 5440 ``-object memory-backend-ram,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave`` 5441 Creates a memory backend object, which can be used to back the 5442 guest RAM. Memory backend objects offer more control than the 5443 ``-m`` option that is traditionally used to define guest RAM. 5444 Please refer to ``memory-backend-file`` for a description of the 5445 options. 5446 5447 ``-object memory-backend-memfd,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave,seal=on|off,hugetlb=on|off,hugetlbsize=size`` 5448 Creates an anonymous memory file backend object, which allows 5449 QEMU to share the memory with an external process (e.g. when 5450 using vhost-user). The memory is allocated with memfd and 5451 optional sealing. (Linux only) 5452 5453 The ``seal`` option creates a sealed-file, that will block 5454 further resizing the memory ('on' by default). 5455 5456 The ``hugetlb`` option specify the file to be created resides in 5457 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction 5458 with the ``hugetlb`` option, the ``hugetlbsize`` option specify 5459 the hugetlb page size on systems that support multiple hugetlb 5460 page sizes (it must be a power of 2 value supported by the 5461 system). 5462 5463 In some versions of Linux, the ``hugetlb`` option is 5464 incompatible with the ``seal`` option (requires at least Linux 5465 4.16). 5466 5467 Please refer to ``memory-backend-file`` for a description of the 5468 other options. 5469 5470 The ``share`` boolean option is on by default with memfd. 5471 5472 ``-object memory-backend-shm,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave`` 5473 Creates a POSIX shared memory backend object, which allows 5474 QEMU to share the memory with an external process (e.g. when 5475 using vhost-user). 5476 5477 ``memory-backend-shm`` is a more portable and less featureful version 5478 of ``memory-backend-memfd``. It can then be used in any POSIX system, 5479 especially when memfd is not supported. 5480 5481 Please refer to ``memory-backend-file`` for a description of the 5482 options. 5483 5484 The ``share`` boolean option is on by default with shm. Setting it to 5485 off will cause a failure during allocation because it is not supported 5486 by this backend. 5487 5488 ``-object iommufd,id=id[,fd=fd]`` 5489 Creates an iommufd backend which allows control of DMA mapping 5490 through the ``/dev/iommu`` device. 5491 5492 The ``id`` parameter is a unique ID which frontends (such as 5493 vfio-pci of vdpa) will use to connect with the iommufd backend. 5494 5495 The ``fd`` parameter is an optional pre-opened file descriptor 5496 resulting from ``/dev/iommu`` opening. Usually the iommufd is shared 5497 across all subsystems, bringing the benefit of centralized 5498 reference counting. 5499 5500 ``-object rng-builtin,id=id`` 5501 Creates a random number generator backend which obtains entropy 5502 from QEMU builtin functions. The ``id`` parameter is a unique ID 5503 that will be used to reference this entropy backend from the 5504 ``virtio-rng`` device. By default, the ``virtio-rng`` device 5505 uses this RNG backend. 5506 5507 ``-object rng-random,id=id,filename=/dev/random`` 5508 Creates a random number generator backend which obtains entropy 5509 from a device on the host. The ``id`` parameter is a unique ID 5510 that will be used to reference this entropy backend from the 5511 ``virtio-rng`` device. The ``filename`` parameter specifies 5512 which file to obtain entropy from and if omitted defaults to 5513 ``/dev/urandom``. 5514 5515 ``-object rng-egd,id=id,chardev=chardevid`` 5516 Creates a random number generator backend which obtains entropy 5517 from an external daemon running on the host. The ``id`` 5518 parameter is a unique ID that will be used to reference this 5519 entropy backend from the ``virtio-rng`` device. The ``chardev`` 5520 parameter is the unique ID of a character device backend that 5521 provides the connection to the RNG daemon. 5522 5523 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off`` 5524 Creates a TLS anonymous credentials object, which can be used to 5525 provide TLS support on network backends. The ``id`` parameter is 5526 a unique ID which network backends will use to access the 5527 credentials. The ``endpoint`` is either ``server`` or ``client`` 5528 depending on whether the QEMU network backend that uses the 5529 credentials will be acting as a client or as a server. If 5530 ``verify-peer`` is enabled (the default) then once the handshake 5531 is completed, the peer credentials will be verified, though this 5532 is a no-op for anonymous credentials. 5533 5534 The dir parameter tells QEMU where to find the credential files. 5535 For server endpoints, this directory may contain a file 5536 dh-params.pem providing diffie-hellman parameters to use for the 5537 TLS server. If the file is missing, QEMU will generate a set of 5538 DH parameters at startup. This is a computationally expensive 5539 operation that consumes random pool entropy, so it is 5540 recommended that a persistent set of parameters be generated 5541 upfront and saved. 5542 5543 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]`` 5544 Creates a TLS Pre-Shared Keys (PSK) credentials object, which 5545 can be used to provide TLS support on network backends. The 5546 ``id`` parameter is a unique ID which network backends will use 5547 to access the credentials. The ``endpoint`` is either ``server`` 5548 or ``client`` depending on whether the QEMU network backend that 5549 uses the credentials will be acting as a client or as a server. 5550 For clients only, ``username`` is the username which will be 5551 sent to the server. If omitted it defaults to "qemu". 5552 5553 The dir parameter tells QEMU where to find the keys file. It is 5554 called "dir/keys.psk" and contains "username:key" pairs. This 5555 file can most easily be created using the GnuTLS ``psktool`` 5556 program. 5557 5558 For server endpoints, dir may also contain a file dh-params.pem 5559 providing diffie-hellman parameters to use for the TLS server. 5560 If the file is missing, QEMU will generate a set of DH 5561 parameters at startup. This is a computationally expensive 5562 operation that consumes random pool entropy, so it is 5563 recommended that a persistent set of parameters be generated up 5564 front and saved. 5565 5566 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id`` 5567 Creates a TLS anonymous credentials object, which can be used to 5568 provide TLS support on network backends. The ``id`` parameter is 5569 a unique ID which network backends will use to access the 5570 credentials. The ``endpoint`` is either ``server`` or ``client`` 5571 depending on whether the QEMU network backend that uses the 5572 credentials will be acting as a client or as a server. If 5573 ``verify-peer`` is enabled (the default) then once the handshake 5574 is completed, the peer credentials will be verified. With x509 5575 certificates, this implies that the clients must be provided 5576 with valid client certificates too. 5577 5578 The dir parameter tells QEMU where to find the credential files. 5579 For server endpoints, this directory may contain a file 5580 dh-params.pem providing diffie-hellman parameters to use for the 5581 TLS server. If the file is missing, QEMU will generate a set of 5582 DH parameters at startup. This is a computationally expensive 5583 operation that consumes random pool entropy, so it is 5584 recommended that a persistent set of parameters be generated 5585 upfront and saved. 5586 5587 For x509 certificate credentials the directory will contain 5588 further files providing the x509 certificates. The certificates 5589 must be stored in PEM format, in filenames ca-cert.pem, 5590 ca-crl.pem (optional), server-cert.pem (only servers), 5591 server-key.pem (only servers), client-cert.pem (only clients), 5592 and client-key.pem (only clients). 5593 5594 For the server-key.pem and client-key.pem files which contain 5595 sensitive private keys, it is possible to use an encrypted 5596 version by providing the passwordid parameter. This provides the 5597 ID of a previously created ``secret`` object containing the 5598 password for decryption. 5599 5600 The priority parameter allows to override the global default 5601 priority used by gnutls. This can be useful if the system 5602 administrator needs to use a weaker set of crypto priorities for 5603 QEMU without potentially forcing the weakness onto all 5604 applications. Or conversely if one wants wants a stronger 5605 default for QEMU than for all other applications, they can do 5606 this through this parameter. Its format is a gnutls priority 5607 string as described at 5608 https://gnutls.org/manual/html_node/Priority-Strings.html. 5609 5610 ``-object tls-cipher-suites,id=id,priority=priority`` 5611 Creates a TLS cipher suites object, which can be used to control 5612 the TLS cipher/protocol algorithms that applications are permitted 5613 to use. 5614 5615 The ``id`` parameter is a unique ID which frontends will use to 5616 access the ordered list of permitted TLS cipher suites from the 5617 host. 5618 5619 The ``priority`` parameter allows to override the global default 5620 priority used by gnutls. This can be useful if the system 5621 administrator needs to use a weaker set of crypto priorities for 5622 QEMU without potentially forcing the weakness onto all 5623 applications. Or conversely if one wants wants a stronger 5624 default for QEMU than for all other applications, they can do 5625 this through this parameter. Its format is a gnutls priority 5626 string as described at 5627 https://gnutls.org/manual/html_node/Priority-Strings.html. 5628 5629 An example of use of this object is to control UEFI HTTPS Boot. 5630 The tls-cipher-suites object exposes the ordered list of permitted 5631 TLS cipher suites from the host side to the guest firmware, via 5632 fw_cfg. The list is represented as an array of IANA_TLS_CIPHER 5633 objects. The firmware uses the IANA_TLS_CIPHER array for configuring 5634 guest-side TLS. 5635 5636 In the following example, the priority at which the host-side policy 5637 is retrieved is given by the ``priority`` property. 5638 Given that QEMU uses GNUTLS, ``priority=@SYSTEM`` may be used to 5639 refer to /etc/crypto-policies/back-ends/gnutls.config. 5640 5641 .. parsed-literal:: 5642 5643 # |qemu_system| \\ 5644 -object tls-cipher-suites,id=mysuite0,priority=@SYSTEM \\ 5645 -fw_cfg name=etc/edk2/https/ciphers,gen_id=mysuite0 5646 5647 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]`` 5648 Interval t can't be 0, this filter batches the packet delivery: 5649 all packets arriving in a given interval on netdev netdevid are 5650 delayed until the end of the interval. Interval is in 5651 microseconds. ``status`` is optional that indicate whether the 5652 netfilter is on (enabled) or off (disabled), the default status 5653 for netfilter will be 'on'. 5654 5655 queue all\|rx\|tx is an option that can be applied to any 5656 netfilter. 5657 5658 ``all``: the filter is attached both to the receive and the 5659 transmit queue of the netdev (default). 5660 5661 ``rx``: the filter is attached to the receive queue of the 5662 netdev, where it will receive packets sent to the netdev. 5663 5664 ``tx``: the filter is attached to the transmit queue of the 5665 netdev, where it will receive packets sent by the netdev. 5666 5667 position head\|tail\|id=<id> is an option to specify where the 5668 filter should be inserted in the filter list. It can be applied 5669 to any netfilter. 5670 5671 ``head``: the filter is inserted at the head of the filter list, 5672 before any existing filters. 5673 5674 ``tail``: the filter is inserted at the tail of the filter list, 5675 behind any existing filters (default). 5676 5677 ``id=<id>``: the filter is inserted before or behind the filter 5678 specified by <id>, see the insert option below. 5679 5680 insert behind\|before is an option to specify where to insert 5681 the new filter relative to the one specified with 5682 position=id=<id>. It can be applied to any netfilter. 5683 5684 ``before``: insert before the specified filter. 5685 5686 ``behind``: insert behind the specified filter (default). 5687 5688 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]`` 5689 filter-mirror on netdev netdevid,mirror net packet to 5690 chardevchardevid, if it has the vnet\_hdr\_support flag, 5691 filter-mirror will mirror packet with vnet\_hdr\_len. 5692 5693 ``-object filter-redirector,id=id,netdev=netdevid,indev=chardevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]`` 5694 filter-redirector on netdev netdevid,redirect filter's net 5695 packet to chardev chardevid,and redirect indev's packet to 5696 filter.if it has the vnet\_hdr\_support flag, filter-redirector 5697 will redirect packet with vnet\_hdr\_len. Create a 5698 filter-redirector we need to differ outdev id from indev id, id 5699 can not be the same. we can just use indev or outdev, but at 5700 least one of indev or outdev need to be specified. 5701 5702 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]`` 5703 Filter-rewriter is a part of COLO project.It will rewrite tcp 5704 packet to secondary from primary to keep secondary tcp 5705 connection,and rewrite tcp packet to primary from secondary make 5706 tcp packet can be handled by client.if it has the 5707 vnet\_hdr\_support flag, we can parse packet with vnet header. 5708 5709 usage: colo secondary: -object 5710 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object 5711 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object 5712 filter-rewriter,id=rew0,netdev=hn0,queue=all 5713 5714 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]`` 5715 Dump the network traffic on netdev dev to the file specified by 5716 filename. At most len bytes (64k by default) per packet are 5717 stored. The file format is libpcap, so it can be analyzed with 5718 tools such as tcpdump or Wireshark. 5719 5720 ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id][,compare_timeout=@var{ms}][,expired_scan_cycle=@var{ms}][,max_queue_size=@var{size}]`` 5721 Colo-compare gets packet from primary\_in chardevid and 5722 secondary\_in, then compare whether the payload of primary packet 5723 and secondary packet are the same. If same, it will output 5724 primary packet to out\_dev, else it will notify COLO-framework to do 5725 checkpoint and send primary packet to out\_dev. In order to 5726 improve efficiency, we need to put the task of comparison in 5727 another iothread. If it has the vnet\_hdr\_support flag, 5728 colo compare will send/recv packet with vnet\_hdr\_len. 5729 The compare\_timeout=@var{ms} determines the maximum time of the 5730 colo-compare hold the packet. The expired\_scan\_cycle=@var{ms} 5731 is to set the period of scanning expired primary node network packets. 5732 The max\_queue\_size=@var{size} is to set the max compare queue 5733 size depend on user environment. 5734 If user want to use Xen COLO, need to add the notify\_dev to 5735 notify Xen colo-frame to do checkpoint. 5736 5737 COLO-compare must be used with the help of filter-mirror, 5738 filter-redirector and filter-rewriter. 5739 5740 :: 5741 5742 KVM COLO 5743 5744 primary: 5745 -netdev tap,id=hn0,vhost=off 5746 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 5747 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off 5748 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off 5749 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off 5750 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001 5751 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off 5752 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005 5753 -object iothread,id=iothread1 5754 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0 5755 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out 5756 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0 5757 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1 5758 5759 secondary: 5760 -netdev tap,id=hn0,vhost=off 5761 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 5762 -chardev socket,id=red0,host=3.3.3.3,port=9003 5763 -chardev socket,id=red1,host=3.3.3.3,port=9004 5764 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 5765 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 5766 5767 5768 Xen COLO 5769 5770 primary: 5771 -netdev tap,id=hn0,vhost=off 5772 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 5773 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off 5774 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off 5775 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off 5776 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001 5777 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off 5778 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005 5779 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server=on,wait=off 5780 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0 5781 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out 5782 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0 5783 -object iothread,id=iothread1 5784 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=notify_way,iothread=iothread1 5785 5786 secondary: 5787 -netdev tap,id=hn0,vhost=off 5788 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 5789 -chardev socket,id=red0,host=3.3.3.3,port=9003 5790 -chardev socket,id=red1,host=3.3.3.3,port=9004 5791 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 5792 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 5793 5794 If you want to know the detail of above command line, you can 5795 read the colo-compare git log. 5796 5797 ``-object cryptodev-backend-builtin,id=id[,queues=queues]`` 5798 Creates a cryptodev backend which executes crypto operations from 5799 the QEMU cipher APIs. The id parameter is a unique ID that will 5800 be used to reference this cryptodev backend from the 5801 ``virtio-crypto`` device. The queues parameter is optional, 5802 which specify the queue number of cryptodev backend, the default 5803 of queues is 1. 5804 5805 .. parsed-literal:: 5806 5807 # |qemu_system| \\ 5808 [...] \\ 5809 -object cryptodev-backend-builtin,id=cryptodev0 \\ 5810 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\ 5811 [...] 5812 5813 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]`` 5814 Creates a vhost-user cryptodev backend, backed by a chardev 5815 chardevid. The id parameter is a unique ID that will be used to 5816 reference this cryptodev backend from the ``virtio-crypto`` 5817 device. The chardev should be a unix domain socket backed one. 5818 The vhost-user uses a specifically defined protocol to pass 5819 vhost ioctl replacement messages to an application on the other 5820 end of the socket. The queues parameter is optional, which 5821 specify the queue number of cryptodev backend for multiqueue 5822 vhost-user, the default of queues is 1. 5823 5824 .. parsed-literal:: 5825 5826 # |qemu_system| \\ 5827 [...] \\ 5828 -chardev socket,id=chardev0,path=/path/to/socket \\ 5829 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \\ 5830 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\ 5831 [...] 5832 5833 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]`` 5834 \ 5835 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]`` 5836 Defines a secret to store a password, encryption key, or some 5837 other sensitive data. The sensitive data can either be passed 5838 directly via the data parameter, or indirectly via the file 5839 parameter. Using the data parameter is insecure unless the 5840 sensitive data is encrypted. 5841 5842 The sensitive data can be provided in raw format (the default), 5843 or base64. When encoded as JSON, the raw format only supports 5844 valid UTF-8 characters, so base64 is recommended for sending 5845 binary data. QEMU will convert from which ever format is 5846 provided to the format it needs internally. eg, an RBD password 5847 can be provided in raw format, even though it will be base64 5848 encoded when passed onto the RBD sever. 5849 5850 For added protection, it is possible to encrypt the data 5851 associated with a secret using the AES-256-CBC cipher. Use of 5852 encryption is indicated by providing the keyid and iv 5853 parameters. The keyid parameter provides the ID of a previously 5854 defined secret that contains the AES-256 decryption key. This 5855 key should be 32-bytes long and be base64 encoded. The iv 5856 parameter provides the random initialization vector used for 5857 encryption of this particular secret and should be a base64 5858 encrypted string of the 16-byte IV. 5859 5860 The simplest (insecure) usage is to provide the secret inline 5861 5862 .. parsed-literal:: 5863 5864 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw 5865 5866 The simplest secure usage is to provide the secret via a file 5867 5868 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object 5869 secret,id=sec0,file=mypasswd.txt,format=raw 5870 5871 For greater security, AES-256-CBC should be used. To illustrate 5872 usage, consider the openssl command line tool which can encrypt 5873 the data. Note that when encrypting, the plaintext must be 5874 padded to the cipher block size (32 bytes) using the standard 5875 PKCS#5/6 compatible padding algorithm. 5876 5877 First a master key needs to be created in base64 encoding: 5878 5879 :: 5880 5881 # openssl rand -base64 32 > key.b64 5882 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"') 5883 5884 Each secret to be encrypted needs to have a random 5885 initialization vector generated. These do not need to be kept 5886 secret 5887 5888 :: 5889 5890 # openssl rand -base64 16 > iv.b64 5891 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"') 5892 5893 The secret to be defined can now be encrypted, in this case 5894 we're telling openssl to base64 encode the result, but it could 5895 be left as raw bytes if desired. 5896 5897 :: 5898 5899 # SECRET=$(printf "letmein" | 5900 openssl enc -aes-256-cbc -a -K $KEY -iv $IV) 5901 5902 When launching QEMU, create a master secret pointing to 5903 ``key.b64`` and specify that to be used to decrypt the user 5904 password. Pass the contents of ``iv.b64`` to the second secret 5905 5906 .. parsed-literal:: 5907 5908 # |qemu_system| \\ 5909 -object secret,id=secmaster0,format=base64,file=key.b64 \\ 5910 -object secret,id=sec0,keyid=secmaster0,format=base64,\\ 5911 data=$SECRET,iv=$(<iv.b64) 5912 5913 ``-object sev-guest,id=id,cbitpos=cbitpos,reduced-phys-bits=val,[sev-device=string,policy=policy,handle=handle,dh-cert-file=file,session-file=file,kernel-hashes=on|off]`` 5914 Create a Secure Encrypted Virtualization (SEV) guest object, 5915 which can be used to provide the guest memory encryption support 5916 on AMD processors. 5917 5918 When memory encryption is enabled, one of the physical address 5919 bit (aka the C-bit) is utilized to mark if a memory page is 5920 protected. The ``cbitpos`` is used to provide the C-bit 5921 position. The C-bit position is Host family dependent hence user 5922 must provide this value. On EPYC, the value should be 47. 5923 5924 When memory encryption is enabled, we loose certain bits in 5925 physical address space. The ``reduced-phys-bits`` is used to 5926 provide the number of bits we loose in physical address space. 5927 Similar to C-bit, the value is Host family dependent. On EPYC, 5928 a guest will lose a maximum of 1 bit, so the value should be 1. 5929 5930 The ``sev-device`` provides the device file to use for 5931 communicating with the SEV firmware running inside AMD Secure 5932 Processor. The default device is '/dev/sev'. If hardware 5933 supports memory encryption then /dev/sev devices are created by 5934 CCP driver. 5935 5936 The ``policy`` provides the guest policy to be enforced by the 5937 SEV firmware and restrict what configuration and operational 5938 commands can be performed on this guest by the hypervisor. The 5939 policy should be provided by the guest owner and is bound to the 5940 guest and cannot be changed throughout the lifetime of the 5941 guest. The default is 0. 5942 5943 If guest ``policy`` allows sharing the key with another SEV 5944 guest then ``handle`` can be use to provide handle of the guest 5945 from which to share the key. 5946 5947 The ``dh-cert-file`` and ``session-file`` provides the guest 5948 owner's Public Diffie-Hillman key defined in SEV spec. The PDH 5949 and session parameters are used for establishing a cryptographic 5950 session with the guest owner to negotiate keys used for 5951 attestation. The file must be encoded in base64. 5952 5953 The ``kernel-hashes`` adds the hashes of given kernel/initrd/ 5954 cmdline to a designated guest firmware page for measured Linux 5955 boot with -kernel. The default is off. (Since 6.2) 5956 5957 e.g to launch a SEV guest 5958 5959 .. parsed-literal:: 5960 5961 # |qemu_system_x86| \\ 5962 ...... \\ 5963 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \\ 5964 -machine ...,memory-encryption=sev0 \\ 5965 ..... 5966 5967 ``-object authz-simple,id=id,identity=string`` 5968 Create an authorization object that will control access to 5969 network services. 5970 5971 The ``identity`` parameter is identifies the user and its format 5972 depends on the network service that authorization object is 5973 associated with. For authorizing based on TLS x509 certificates, 5974 the identity must be the x509 distinguished name. Note that care 5975 must be taken to escape any commas in the distinguished name. 5976 5977 An example authorization object to validate a x509 distinguished 5978 name would look like: 5979 5980 .. parsed-literal:: 5981 5982 # |qemu_system| \\ 5983 ... \\ 5984 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \\ 5985 ... 5986 5987 Note the use of quotes due to the x509 distinguished name 5988 containing whitespace, and escaping of ','. 5989 5990 ``-object authz-listfile,id=id,filename=path,refresh=on|off`` 5991 Create an authorization object that will control access to 5992 network services. 5993 5994 The ``filename`` parameter is the fully qualified path to a file 5995 containing the access control list rules in JSON format. 5996 5997 An example set of rules that match against SASL usernames might 5998 look like: 5999 6000 :: 6001 6002 { 6003 "rules": [ 6004 { "match": "fred", "policy": "allow", "format": "exact" }, 6005 { "match": "bob", "policy": "allow", "format": "exact" }, 6006 { "match": "danb", "policy": "deny", "format": "glob" }, 6007 { "match": "dan*", "policy": "allow", "format": "exact" }, 6008 ], 6009 "policy": "deny" 6010 } 6011 6012 When checking access the object will iterate over all the rules 6013 and the first rule to match will have its ``policy`` value 6014 returned as the result. If no rules match, then the default 6015 ``policy`` value is returned. 6016 6017 The rules can either be an exact string match, or they can use 6018 the simple UNIX glob pattern matching to allow wildcards to be 6019 used. 6020 6021 If ``refresh`` is set to true the file will be monitored and 6022 automatically reloaded whenever its content changes. 6023 6024 As with the ``authz-simple`` object, the format of the identity 6025 strings being matched depends on the network service, but is 6026 usually a TLS x509 distinguished name, or a SASL username. 6027 6028 An example authorization object to validate a SASL username 6029 would look like: 6030 6031 .. parsed-literal:: 6032 6033 # |qemu_system| \\ 6034 ... \\ 6035 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=on \\ 6036 ... 6037 6038 ``-object authz-pam,id=id,service=string`` 6039 Create an authorization object that will control access to 6040 network services. 6041 6042 The ``service`` parameter provides the name of a PAM service to 6043 use for authorization. It requires that a file 6044 ``/etc/pam.d/service`` exist to provide the configuration for 6045 the ``account`` subsystem. 6046 6047 An example authorization object to validate a TLS x509 6048 distinguished name would look like: 6049 6050 .. parsed-literal:: 6051 6052 # |qemu_system| \\ 6053 ... \\ 6054 -object authz-pam,id=auth0,service=qemu-vnc \\ 6055 ... 6056 6057 There would then be a corresponding config file for PAM at 6058 ``/etc/pam.d/qemu-vnc`` that contains: 6059 6060 :: 6061 6062 account requisite pam_listfile.so item=user sense=allow \ 6063 file=/etc/qemu/vnc.allow 6064 6065 Finally the ``/etc/qemu/vnc.allow`` file would contain the list 6066 of x509 distinguished names that are permitted access 6067 6068 :: 6069 6070 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB 6071 6072 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink,aio-max-batch=aio-max-batch`` 6073 Creates a dedicated event loop thread that devices can be 6074 assigned to. This is known as an IOThread. By default device 6075 emulation happens in vCPU threads or the main event loop thread. 6076 This can become a scalability bottleneck. IOThreads allow device 6077 emulation and I/O to run on other host CPUs. 6078 6079 The ``id`` parameter is a unique ID that will be used to 6080 reference this IOThread from ``-device ...,iothread=id``. 6081 Multiple devices can be assigned to an IOThread. Note that not 6082 all devices support an ``iothread`` parameter. 6083 6084 The ``query-iothreads`` QMP command lists IOThreads and reports 6085 their thread IDs so that the user can configure host CPU 6086 pinning/affinity. 6087 6088 IOThreads use an adaptive polling algorithm to reduce event loop 6089 latency. Instead of entering a blocking system call to monitor 6090 file descriptors and then pay the cost of being woken up when an 6091 event occurs, the polling algorithm spins waiting for events for 6092 a short time. The algorithm's default parameters are suitable 6093 for many cases but can be adjusted based on knowledge of the 6094 workload and/or host device latency. 6095 6096 The ``poll-max-ns`` parameter is the maximum number of 6097 nanoseconds to busy wait for events. Polling can be disabled by 6098 setting this value to 0. 6099 6100 The ``poll-grow`` parameter is the multiplier used to increase 6101 the polling time when the algorithm detects it is missing events 6102 due to not polling long enough. 6103 6104 The ``poll-shrink`` parameter is the divisor used to decrease 6105 the polling time when the algorithm detects it is spending too 6106 long polling without encountering events. 6107 6108 The ``aio-max-batch`` parameter is the maximum number of requests 6109 in a batch for the AIO engine, 0 means that the engine will use 6110 its default. 6111 6112 The IOThread parameters can be modified at run-time using the 6113 ``qom-set`` command (where ``iothread1`` is the IOThread's 6114 ``id``): 6115 6116 :: 6117 6118 (qemu) qom-set /objects/iothread1 poll-max-ns 100000 6119ERST 6120 6121 6122HXCOMM This is the last statement. Insert new options before this line! 6123 6124#undef DEF 6125#undef DEFHEADING 6126#undef ARCHHEADING 6127