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