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