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 " [,gl=[on|off]][,rendernode=<file>]\n" 2290 " enable spice\n" 2291 " at least one of {port, tls-port} is mandatory\n", 2292 QEMU_ARCH_ALL) 2293#endif 2294SRST 2295``-spice option[,option[,...]]`` 2296 Enable the spice remote desktop protocol. Valid options are 2297 2298 ``port=<nr>`` 2299 Set the TCP port spice is listening on for plaintext channels. 2300 2301 ``addr=<addr>`` 2302 Set the IP address spice is listening on. Default is any 2303 address. 2304 2305 ``ipv4=on|off``; \ ``ipv6=on|off``; \ ``unix=on|off`` 2306 Force using the specified IP version. 2307 2308 ``password-secret=<secret-id>`` 2309 Set the ID of the ``secret`` object containing the password 2310 you need to authenticate. 2311 2312 ``sasl=on|off`` 2313 Require that the client use SASL to authenticate with the spice. 2314 The exact choice of authentication method used is controlled 2315 from the system / user's SASL configuration file for the 'qemu' 2316 service. This is typically found in /etc/sasl2/qemu.conf. If 2317 running QEMU as an unprivileged user, an environment variable 2318 SASL\_CONF\_PATH can be used to make it search alternate 2319 locations for the service config. While some SASL auth methods 2320 can also provide data encryption (eg GSSAPI), it is recommended 2321 that SASL always be combined with the 'tls' and 'x509' settings 2322 to enable use of SSL and server certificates. This ensures a 2323 data encryption preventing compromise of authentication 2324 credentials. 2325 2326 ``disable-ticketing=on|off`` 2327 Allow client connects without authentication. 2328 2329 ``disable-copy-paste=on|off`` 2330 Disable copy paste between the client and the guest. 2331 2332 ``disable-agent-file-xfer=on|off`` 2333 Disable spice-vdagent based file-xfer between the client and the 2334 guest. 2335 2336 ``tls-port=<nr>`` 2337 Set the TCP port spice is listening on for encrypted channels. 2338 2339 ``x509-dir=<dir>`` 2340 Set the x509 file directory. Expects same filenames as -vnc 2341 $display,x509=$dir 2342 2343 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>`` 2344 The x509 file names can also be configured individually. 2345 2346 ``tls-ciphers=<list>`` 2347 Specify which ciphers to use. 2348 2349 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]`` 2350 Force specific channel to be used with or without TLS 2351 encryption. The options can be specified multiple times to 2352 configure multiple channels. The special name "default" can be 2353 used to set the default mode. For channels which are not 2354 explicitly forced into one mode the spice client is allowed to 2355 pick tls/plaintext as he pleases. 2356 2357 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]`` 2358 Configure image compression (lossless). Default is auto\_glz. 2359 2360 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]`` 2361 Configure wan image compression (lossy for slow links). Default 2362 is auto. 2363 2364 ``streaming-video=[off|all|filter]`` 2365 Configure video stream detection. Default is off. 2366 2367 ``agent-mouse=[on|off]`` 2368 Enable/disable passing mouse events via vdagent. Default is on. 2369 2370 ``playback-compression=[on|off]`` 2371 Enable/disable audio stream compression (using celt 0.5.1). 2372 Default is on. 2373 2374 ``seamless-migration=[on|off]`` 2375 Enable/disable spice seamless migration. Default is off. 2376 2377 ``gl=[on|off]`` 2378 Enable/disable OpenGL context. Default is off. 2379 2380 ``rendernode=<file>`` 2381 DRM render node for OpenGL rendering. If not specified, it will 2382 pick the first available. (Since 2.9) 2383ERST 2384 2385DEF("vga", HAS_ARG, QEMU_OPTION_vga, 2386 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n" 2387 " select video card type\n", QEMU_ARCH_ALL) 2388SRST 2389``-vga type`` 2390 Select type of VGA card to emulate. Valid values for type are 2391 2392 ``cirrus`` 2393 Cirrus Logic GD5446 Video card. All Windows versions starting 2394 from Windows 95 should recognize and use this graphic card. For 2395 optimal performances, use 16 bit color depth in the guest and 2396 the host OS. (This card was the default before QEMU 2.2) 2397 2398 ``std`` 2399 Standard VGA card with Bochs VBE extensions. If your guest OS 2400 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if 2401 you want to use high resolution modes (>= 1280x1024x16) then you 2402 should use this option. (This card is the default since QEMU 2403 2.2) 2404 2405 ``vmware`` 2406 VMWare SVGA-II compatible adapter. Use it if you have 2407 sufficiently recent XFree86/XOrg server or Windows guest with a 2408 driver for this card. 2409 2410 ``qxl`` 2411 QXL paravirtual graphic card. It is VGA compatible (including 2412 VESA 2.0 VBE support). Works best with qxl guest drivers 2413 installed though. Recommended choice when using the spice 2414 protocol. 2415 2416 ``tcx`` 2417 (sun4m only) Sun TCX framebuffer. This is the default 2418 framebuffer for sun4m machines and offers both 8-bit and 24-bit 2419 colour depths at a fixed resolution of 1024x768. 2420 2421 ``cg3`` 2422 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit 2423 framebuffer for sun4m machines available in both 1024x768 2424 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people 2425 wishing to run older Solaris versions. 2426 2427 ``virtio`` 2428 Virtio VGA card. 2429 2430 ``none`` 2431 Disable VGA card. 2432ERST 2433 2434DEF("full-screen", 0, QEMU_OPTION_full_screen, 2435 "-full-screen start in full screen\n", QEMU_ARCH_ALL) 2436SRST 2437``-full-screen`` 2438 Start in full screen. 2439ERST 2440 2441DEF("g", HAS_ARG, QEMU_OPTION_g , 2442 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n", 2443 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K) 2444SRST 2445``-g`` *width*\ ``x``\ *height*\ ``[x``\ *depth*\ ``]`` 2446 Set the initial graphical resolution and depth (PPC, SPARC only). 2447 2448 For PPC the default is 800x600x32. 2449 2450 For SPARC with the TCX graphics device, the default is 1024x768x8 2451 with the option of 1024x768x24. For cgthree, the default is 2452 1024x768x8 with the option of 1152x900x8 for people who wish to use 2453 OBP. 2454ERST 2455 2456#ifdef CONFIG_VNC 2457DEF("vnc", HAS_ARG, QEMU_OPTION_vnc , 2458 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL) 2459#endif 2460SRST 2461``-vnc display[,option[,option[,...]]]`` 2462 Normally, if QEMU is compiled with graphical window support, it 2463 displays output such as guest graphics, guest console, and the QEMU 2464 monitor in a window. With this option, you can have QEMU listen on 2465 VNC display display and redirect the VGA display over the VNC 2466 session. It is very useful to enable the usb tablet device when 2467 using this option (option ``-device usb-tablet``). When using the 2468 VNC display, you must use the ``-k`` parameter to set the keyboard 2469 layout if you are not using en-us. Valid syntax for the display is 2470 2471 ``to=L`` 2472 With this option, QEMU will try next available VNC displays, 2473 until the number L, if the originally defined "-vnc display" is 2474 not available, e.g. port 5900+display is already used by another 2475 application. By default, to=0. 2476 2477 ``host:d`` 2478 TCP connections will only be allowed from host on display d. By 2479 convention the TCP port is 5900+d. Optionally, host can be 2480 omitted in which case the server will accept connections from 2481 any host. 2482 2483 ``unix:path`` 2484 Connections will be allowed over UNIX domain sockets where path 2485 is the location of a unix socket to listen for connections on. 2486 2487 ``none`` 2488 VNC is initialized but not started. The monitor ``change`` 2489 command can be used to later start the VNC server. 2490 2491 Following the display value there may be one or more option flags 2492 separated by commas. Valid options are 2493 2494 ``reverse=on|off`` 2495 Connect to a listening VNC client via a "reverse" connection. 2496 The client is specified by the display. For reverse network 2497 connections (host:d,``reverse``), the d argument is a TCP port 2498 number, not a display number. 2499 2500 ``websocket=on|off`` 2501 Opens an additional TCP listening port dedicated to VNC 2502 Websocket connections. If a bare websocket option is given, the 2503 Websocket port is 5700+display. An alternative port can be 2504 specified with the syntax ``websocket``\ =port. 2505 2506 If host is specified connections will only be allowed from this 2507 host. It is possible to control the websocket listen address 2508 independently, using the syntax ``websocket``\ =host:port. 2509 2510 Websocket could be allowed over UNIX domain socket, using the syntax 2511 ``websocket``\ =unix:path, where path is the location of a unix socket 2512 to listen for connections on. 2513 2514 If no TLS credentials are provided, the websocket connection 2515 runs in unencrypted mode. If TLS credentials are provided, the 2516 websocket connection requires encrypted client connections. 2517 2518 ``password=on|off`` 2519 Require that password based authentication is used for client 2520 connections. 2521 2522 The password must be set separately using the ``set_password`` 2523 command in the :ref:`QEMU monitor`. The 2524 syntax to change your password is: 2525 ``set_password <protocol> <password>`` where <protocol> could be 2526 either "vnc" or "spice". 2527 2528 If you would like to change <protocol> password expiration, you 2529 should use ``expire_password <protocol> <expiration-time>`` 2530 where expiration time could be one of the following options: 2531 now, never, +seconds or UNIX time of expiration, e.g. +60 to 2532 make password expire in 60 seconds, or 1335196800 to make 2533 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for 2534 this date and time). 2535 2536 You can also use keywords "now" or "never" for the expiration 2537 time to allow <protocol> password to expire immediately or never 2538 expire. 2539 2540 ``password-secret=<secret-id>`` 2541 Require that password based authentication is used for client 2542 connections, using the password provided by the ``secret`` 2543 object identified by ``secret-id``. 2544 2545 ``tls-creds=ID`` 2546 Provides the ID of a set of TLS credentials to use to secure the 2547 VNC server. They will apply to both the normal VNC server socket 2548 and the websocket socket (if enabled). Setting TLS credentials 2549 will cause the VNC server socket to enable the VeNCrypt auth 2550 mechanism. The credentials should have been previously created 2551 using the ``-object tls-creds`` argument. 2552 2553 ``tls-authz=ID`` 2554 Provides the ID of the QAuthZ authorization object against which 2555 the client's x509 distinguished name will validated. This object 2556 is only resolved at time of use, so can be deleted and recreated 2557 on the fly while the VNC server is active. If missing, it will 2558 default to denying access. 2559 2560 ``sasl=on|off`` 2561 Require that the client use SASL to authenticate with the VNC 2562 server. The exact choice of authentication method used is 2563 controlled from the system / user's SASL configuration file for 2564 the 'qemu' service. This is typically found in 2565 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user, 2566 an environment variable SASL\_CONF\_PATH can be used to make it 2567 search alternate locations for the service config. While some 2568 SASL auth methods can also provide data encryption (eg GSSAPI), 2569 it is recommended that SASL always be combined with the 'tls' 2570 and 'x509' settings to enable use of SSL and server 2571 certificates. This ensures a data encryption preventing 2572 compromise of authentication credentials. See the 2573 :ref:`VNC security` section in the System Emulation Users Guide 2574 for details on using SASL authentication. 2575 2576 ``sasl-authz=ID`` 2577 Provides the ID of the QAuthZ authorization object against which 2578 the client's SASL username will validated. This object is only 2579 resolved at time of use, so can be deleted and recreated on the 2580 fly while the VNC server is active. If missing, it will default 2581 to denying access. 2582 2583 ``acl=on|off`` 2584 Legacy method for enabling authorization of clients against the 2585 x509 distinguished name and SASL username. It results in the 2586 creation of two ``authz-list`` objects with IDs of 2587 ``vnc.username`` and ``vnc.x509dname``. The rules for these 2588 objects must be configured with the HMP ACL commands. 2589 2590 This option is deprecated and should no longer be used. The new 2591 ``sasl-authz`` and ``tls-authz`` options are a replacement. 2592 2593 ``lossy=on|off`` 2594 Enable lossy compression methods (gradient, JPEG, ...). If this 2595 option is set, VNC client may receive lossy framebuffer updates 2596 depending on its encoding settings. Enabling this option can 2597 save a lot of bandwidth at the expense of quality. 2598 2599 ``non-adaptive=on|off`` 2600 Disable adaptive encodings. Adaptive encodings are enabled by 2601 default. An adaptive encoding will try to detect frequently 2602 updated screen regions, and send updates in these regions using 2603 a lossy encoding (like JPEG). This can be really helpful to save 2604 bandwidth when playing videos. Disabling adaptive encodings 2605 restores the original static behavior of encodings like Tight. 2606 2607 ``share=[allow-exclusive|force-shared|ignore]`` 2608 Set display sharing policy. 'allow-exclusive' allows clients to 2609 ask for exclusive access. As suggested by the rfb spec this is 2610 implemented by dropping other connections. Connecting multiple 2611 clients in parallel requires all clients asking for a shared 2612 session (vncviewer: -shared switch). This is the default. 2613 'force-shared' disables exclusive client access. Useful for 2614 shared desktop sessions, where you don't want someone forgetting 2615 specify -shared disconnect everybody else. 'ignore' completely 2616 ignores the shared flag and allows everybody connect 2617 unconditionally. Doesn't conform to the rfb spec but is 2618 traditional QEMU behavior. 2619 2620 ``key-delay-ms`` 2621 Set keyboard delay, for key down and key up events, in 2622 milliseconds. Default is 10. Keyboards are low-bandwidth 2623 devices, so this slowdown can help the device and guest to keep 2624 up and not lose events in case events are arriving in bulk. 2625 Possible causes for the latter are flaky network connections, or 2626 scripts for automated testing. 2627 2628 ``audiodev=audiodev`` 2629 Use the specified audiodev when the VNC client requests audio 2630 transmission. When not using an -audiodev argument, this option 2631 must be omitted, otherwise is must be present and specify a 2632 valid audiodev. 2633 2634 ``power-control=on|off`` 2635 Permit the remote client to issue shutdown, reboot or reset power 2636 control requests. 2637ERST 2638 2639ARCHHEADING(, QEMU_ARCH_I386) 2640 2641ARCHHEADING(i386 target only:, QEMU_ARCH_I386) 2642 2643DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack, 2644 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n", 2645 QEMU_ARCH_I386) 2646SRST 2647``-win2k-hack`` 2648 Use it when installing Windows 2000 to avoid a disk full bug. After 2649 Windows 2000 is installed, you no longer need this option (this 2650 option slows down the IDE transfers). Synonym of ``-global 2651 ide-device.win2k-install-hack=on``. 2652ERST 2653 2654DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk, 2655 "-no-fd-bootchk disable boot signature checking for floppy disks\n", 2656 QEMU_ARCH_I386) 2657SRST 2658``-no-fd-bootchk`` 2659 Disable boot signature checking for floppy disks in BIOS. May be 2660 needed to boot from old floppy disks. Synonym of ``-m fd-bootchk=off``. 2661ERST 2662 2663DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable, 2664 "-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" 2665 " ACPI table description\n", QEMU_ARCH_I386) 2666SRST 2667``-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]...]`` 2668 Add ACPI table with specified header fields and context from 2669 specified files. For file=, take whole ACPI table from the specified 2670 files, including all ACPI headers (possible overridden by other 2671 options). For data=, only data portion of the table is used, all 2672 header information is specified in the command line. If a SLIC table 2673 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id 2674 fields will override the same in the RSDT and the FADT (a.k.a. 2675 FACP), in order to ensure the field matches required by the 2676 Microsoft SLIC spec and the ACPI spec. 2677ERST 2678 2679DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, 2680 "-smbios file=binary\n" 2681 " load SMBIOS entry from binary file\n" 2682 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n" 2683 " [,uefi=on|off]\n" 2684 " specify SMBIOS type 0 fields\n" 2685 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n" 2686 " [,uuid=uuid][,sku=str][,family=str]\n" 2687 " specify SMBIOS type 1 fields\n" 2688 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n" 2689 " [,asset=str][,location=str]\n" 2690 " specify SMBIOS type 2 fields\n" 2691 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n" 2692 " [,sku=str]\n" 2693 " specify SMBIOS type 3 fields\n" 2694 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n" 2695 " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n" 2696 " [,processor-family=%d][,processor-id=%d]\n" 2697 " specify SMBIOS type 4 fields\n" 2698 "-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n" 2699 " specify SMBIOS type 8 fields\n" 2700 "-smbios type=11[,value=str][,path=filename]\n" 2701 " specify SMBIOS type 11 fields\n" 2702 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" 2703 " [,asset=str][,part=str][,speed=%d]\n" 2704 " specify SMBIOS type 17 fields\n" 2705 "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n" 2706 " specify SMBIOS type 41 fields\n", 2707 QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH | QEMU_ARCH_RISCV) 2708SRST 2709``-smbios file=binary`` 2710 Load SMBIOS entry from binary file. 2711 2712``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]`` 2713 Specify SMBIOS type 0 fields 2714 2715``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]`` 2716 Specify SMBIOS type 1 fields 2717 2718``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]`` 2719 Specify SMBIOS type 2 fields 2720 2721``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]`` 2722 Specify SMBIOS type 3 fields 2723 2724``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-family=%d][,processor-id=%d]`` 2725 Specify SMBIOS type 4 fields 2726 2727``-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]`` 2728 Specify SMBIOS type 9 fields 2729 2730``-smbios type=11[,value=str][,path=filename]`` 2731 Specify SMBIOS type 11 fields 2732 2733 This argument can be repeated multiple times, and values are added in the order they are parsed. 2734 Applications intending to use OEM strings data are encouraged to use their application name as 2735 a prefix for the value string. This facilitates passing information for multiple applications 2736 concurrently. 2737 2738 The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax 2739 loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes. 2740 2741 Both the ``value`` and ``path`` options can be repeated multiple times and will be added to 2742 the SMBIOS table in the order in which they appear. 2743 2744 Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535 2745 bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the 2746 guest. Instead it should be used as a indicator to inform the guest where to locate the real 2747 data set, for example, by specifying the serial ID of a block device. 2748 2749 An example passing three strings is 2750 2751 .. parsed-literal:: 2752 2753 -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\ 2754 value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\ 2755 path=/some/file/with/oemstringsdata.txt 2756 2757 In the guest OS this is visible with the ``dmidecode`` command 2758 2759 .. parsed-literal:: 2760 2761 $ dmidecode -t 11 2762 Handle 0x0E00, DMI type 11, 5 bytes 2763 OEM Strings 2764 String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/ 2765 String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os 2766 String 3: myapp:some extra data 2767 2768 2769``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]`` 2770 Specify SMBIOS type 17 fields 2771 2772``-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]`` 2773 Specify SMBIOS type 41 fields 2774 2775 This argument can be repeated multiple times. Its main use is to allow network interfaces be created 2776 as ``enoX`` on Linux, with X being the instance number, instead of the name depending on the interface 2777 position on the PCI bus. 2778 2779 Here is an example of use: 2780 2781 .. parsed-literal:: 2782 2783 -netdev user,id=internet \\ 2784 -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \\ 2785 -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev 2786 2787 In the guest OS, the device should then appear as ``eno1``: 2788 2789 ..parsed-literal:: 2790 2791 $ ip -brief l 2792 lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 2793 eno1 UP 50:54:00:00:00:42 <BROADCAST,MULTICAST,UP,LOWER_UP> 2794 2795 Currently, the PCI device has to be attached to the root bus. 2796 2797ERST 2798 2799DEFHEADING() 2800 2801DEFHEADING(Network options:) 2802 2803DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, 2804#ifdef CONFIG_PASST 2805 "-netdev passt,id=str[,path=file][,quiet=on|off][,vhost-user=on|off]\n" 2806 "[,mtu=mtu][,address=addr][,netmask=mask][,mac=addr][,gateway=addr]\n" 2807 " [,interface=name][,outbound=address][,outbound-if4=name]\n" 2808 " [,outbound-if6=name][,dns=addr][,search=list][,fqdn=name]\n" 2809 " [,dhcp-dns=on|off][,dhcp-search=on|off][,map-host-loopback=addr]\n" 2810 " [,map-guest-addr=addr][,dns-forward=addr][,dns-host=addr]\n" 2811 " [,tcp=on|off][,udp=on|off][,icmp=on|off][,dhcp=on|off]\n" 2812 " [,ndp=on|off][,dhcpv6=on|off][,ra=on|off][,freebind=on|off]\n" 2813 " [,ipv4=on|off][,ipv6=on|off][,tcp-ports=spec][,udp-ports=spec]\n" 2814 " [,param=list]\n" 2815 " configure a passt network backend with ID 'str'\n" 2816 " if 'path' is not provided 'passt' will be started according to PATH\n" 2817 " by default, informational message of passt are not displayed (quiet=on)\n" 2818 " to display this message, use 'quiet=off'\n" 2819 " by default, passt will be started in socket-based mode, to enable vhost-mode,\n" 2820 " use 'vhost-user=on'\n" 2821 " for details on other options, refer to passt(1)\n" 2822 " 'param' allows to pass any option defined by passt(1)\n" 2823#endif 2824#ifdef CONFIG_SLIRP 2825 "-netdev user,id=str[,ipv4=on|off][,net=addr[/mask]][,host=addr]\n" 2826 " [,ipv6=on|off][,ipv6-net=addr[/int]][,ipv6-host=addr]\n" 2827 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n" 2828 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n" 2829 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]" 2830#ifndef _WIN32 2831 "[,smb=dir[,smbserver=addr]]\n" 2832#endif 2833 " configure a user mode network backend with ID 'str',\n" 2834 " its DHCP server and optional services\n" 2835#endif 2836#ifdef _WIN32 2837 "-netdev tap,id=str,ifname=name\n" 2838 " configure a host TAP network backend with ID 'str'\n" 2839#else 2840 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n" 2841 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n" 2842 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n" 2843 " [,poll-us=n]\n" 2844 " configure a host TAP network backend with ID 'str'\n" 2845 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n" 2846 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n" 2847 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n" 2848 " to deconfigure it\n" 2849 " use '[down]script=no' to disable script execution\n" 2850 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n" 2851 " configure it\n" 2852 " use 'fd=h' to connect to an already opened TAP interface\n" 2853 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n" 2854 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n" 2855 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n" 2856 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n" 2857 " use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n" 2858 " use vhost=on to enable experimental in kernel accelerator\n" 2859 " (only has effect for virtio guests which use MSIX)\n" 2860 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n" 2861 " use 'vhostfd=h' to connect to an already opened vhost net device\n" 2862 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n" 2863 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n" 2864 " use 'poll-us=n' to specify the maximum number of microseconds that could be\n" 2865 " spent on busy polling for vhost net\n" 2866 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n" 2867 " configure a host TAP network backend with ID 'str' that is\n" 2868 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n" 2869 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n" 2870#endif 2871#ifdef __linux__ 2872 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n" 2873 " [,rxsession=rxsession],txsession=txsession[,ipv6=on|off][,udp=on|off]\n" 2874 " [,cookie64=on|off][,counter][,pincounter][,txcookie=txcookie]\n" 2875 " [,rxcookie=rxcookie][,offset=offset]\n" 2876 " configure a network backend with ID 'str' connected to\n" 2877 " an Ethernet over L2TPv3 pseudowire.\n" 2878 " Linux kernel 3.3+ as well as most routers can talk\n" 2879 " L2TPv3. This transport allows connecting a VM to a VM,\n" 2880 " VM to a router and even VM to Host. It is a nearly-universal\n" 2881 " standard (RFC3931). Note - this implementation uses static\n" 2882 " pre-configured tunnels (same as the Linux kernel).\n" 2883 " use 'src=' to specify source address\n" 2884 " use 'dst=' to specify destination address\n" 2885 " use 'udp=on' to specify udp encapsulation\n" 2886 " use 'srcport=' to specify source udp port\n" 2887 " use 'dstport=' to specify destination udp port\n" 2888 " use 'ipv6=on' to force v6\n" 2889 " L2TPv3 uses cookies to prevent misconfiguration as\n" 2890 " well as a weak security measure\n" 2891 " use 'rxcookie=0x012345678' to specify a rxcookie\n" 2892 " use 'txcookie=0x012345678' to specify a txcookie\n" 2893 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n" 2894 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n" 2895 " use 'pincounter=on' to work around broken counter handling in peer\n" 2896 " use 'offset=X' to add an extra offset between header and data\n" 2897#endif 2898 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n" 2899 " configure a network backend to connect to another network\n" 2900 " using a socket connection\n" 2901 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n" 2902 " configure a network backend to connect to a multicast maddr and port\n" 2903 " use 'localaddr=addr' to specify the host address to send packets from\n" 2904 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n" 2905 " configure a network backend to connect to another network\n" 2906 " using an UDP tunnel\n" 2907 "-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" 2908 "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect-ms=milliseconds]\n" 2909 "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect-ms=milliseconds]\n" 2910 " configure a network backend to connect to another network\n" 2911 " using a socket connection in stream mode.\n" 2912 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]\n" 2913 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]\n" 2914 " configure a network backend to connect to a multicast maddr and port\n" 2915 " use ``local.host=addr`` to specify the host address to send packets from\n" 2916 "-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]\n" 2917 "-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]\n" 2918 "-netdev dgram,id=str,local.type=fd,local.str=file-descriptor\n" 2919 " configure a network backend to connect to another network\n" 2920 " using an UDP tunnel\n" 2921#ifdef CONFIG_VDE 2922 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n" 2923 " configure a network backend to connect to port 'n' of a vde switch\n" 2924 " running on host and listening for incoming connections on 'socketpath'.\n" 2925 " Use group 'groupname' and mode 'octalmode' to change default\n" 2926 " ownership and permissions for communication port.\n" 2927#endif 2928#ifdef CONFIG_NETMAP 2929 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n" 2930 " attach to the existing netmap-enabled network interface 'name', or to a\n" 2931 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n" 2932 " netmap device, defaults to '/dev/netmap')\n" 2933#endif 2934#ifdef CONFIG_AF_XDP 2935 "-netdev af-xdp,id=str,ifname=name[,mode=native|skb][,force-copy=on|off]\n" 2936 " [,queues=n][,start-queue=m][,inhibit=on|off][,sock-fds=x:y:...:z]\n" 2937 " [,map-path=/path/to/socket/map][,map-start-index=i]\n" 2938 " attach to the existing network interface 'name' with AF_XDP socket\n" 2939 " use 'mode=MODE' to specify an XDP program attach mode\n" 2940 " use 'force-copy=on|off' to force XDP copy mode even if device supports zero-copy (default: off)\n" 2941 " use 'inhibit=on|off' to inhibit loading of a default XDP program (default: off)\n" 2942 " with inhibit=on,\n" 2943 " use 'sock-fds' to provide file descriptors for already open AF_XDP sockets\n" 2944 " added to a socket map in XDP program. One socket per queue.\n" 2945 " use 'map-path' to provide the socket map location to populate AF_XDP sockets with,\n" 2946 " and use 'map-start-index' to specify the starting index for the map (default: 0) (Since 10.1)\n" 2947 " use 'queues=n' to specify how many queues of a multiqueue interface should be used\n" 2948 " use 'start-queue=m' to specify the first queue that should be used\n" 2949#endif 2950#ifdef CONFIG_POSIX 2951 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n" 2952 " configure a vhost-user network, backed by a chardev 'dev'\n" 2953#endif 2954#ifdef __linux__ 2955 "-netdev vhost-vdpa,id=str[,vhostdev=/path/to/dev][,vhostfd=h]\n" 2956 " configure a vhost-vdpa network,Establish a vhost-vdpa netdev\n" 2957 " use 'vhostdev=/path/to/dev' to open a vhost vdpa device\n" 2958 " use 'vhostfd=h' to connect to an already opened vhost vdpa device\n" 2959#endif 2960#ifdef CONFIG_VMNET 2961 "-netdev vmnet-host,id=str[,isolated=on|off][,net-uuid=uuid]\n" 2962 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n" 2963 " configure a vmnet network backend in host mode with ID 'str',\n" 2964 " isolate this interface from others with 'isolated',\n" 2965 " configure the address range and choose a subnet mask,\n" 2966 " specify network UUID 'uuid' to disable DHCP and interact with\n" 2967 " vmnet-host interfaces within this isolated network\n" 2968 "-netdev vmnet-shared,id=str[,isolated=on|off][,nat66-prefix=addr]\n" 2969 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n" 2970 " configure a vmnet network backend in shared mode with ID 'str',\n" 2971 " configure the address range and choose a subnet mask,\n" 2972 " set IPv6 ULA prefix (of length 64) to use for internal network,\n" 2973 " isolate this interface from others with 'isolated'\n" 2974 "-netdev vmnet-bridged,id=str,ifname=name[,isolated=on|off]\n" 2975 " configure a vmnet network backend in bridged mode with ID 'str',\n" 2976 " use 'ifname=name' to select a physical network interface to be bridged,\n" 2977 " isolate this interface from others with 'isolated'\n" 2978#endif 2979 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n" 2980 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL) 2981DEF("nic", HAS_ARG, QEMU_OPTION_nic, 2982 "-nic [tap|bridge|" 2983#ifdef CONFIG_PASST 2984 "passt|" 2985#endif 2986#ifdef CONFIG_SLIRP 2987 "user|" 2988#endif 2989#ifdef __linux__ 2990 "l2tpv3|" 2991#endif 2992#ifdef CONFIG_VDE 2993 "vde|" 2994#endif 2995#ifdef CONFIG_NETMAP 2996 "netmap|" 2997#endif 2998#ifdef CONFIG_AF_XDP 2999 "af-xdp|" 3000#endif 3001#ifdef CONFIG_POSIX 3002 "vhost-user|" 3003#endif 3004#ifdef CONFIG_VMNET 3005 "vmnet-host|vmnet-shared|vmnet-bridged|" 3006#endif 3007 "socket][,option][,...][mac=macaddr]\n" 3008 " initialize an on-board / default host NIC (using MAC address\n" 3009 " macaddr) and connect it to the given host network backend\n" 3010 "-nic none use it alone to have zero network devices (the default is to\n" 3011 " provided a 'user' network connection)\n", 3012 QEMU_ARCH_ALL) 3013DEF("net", HAS_ARG, QEMU_OPTION_net, 3014 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" 3015 " configure or create an on-board (or machine default) NIC and\n" 3016 " connect it to hub 0 (please use -nic unless you need a hub)\n" 3017 "-net [" 3018#ifdef CONFIG_PASST 3019 "passt|" 3020#endif 3021#ifdef CONFIG_SLIRP 3022 "user|" 3023#endif 3024 "tap|" 3025 "bridge|" 3026#ifdef CONFIG_VDE 3027 "vde|" 3028#endif 3029#ifdef CONFIG_NETMAP 3030 "netmap|" 3031#endif 3032#ifdef CONFIG_AF_XDP 3033 "af-xdp|" 3034#endif 3035#ifdef CONFIG_VMNET 3036 "vmnet-host|vmnet-shared|vmnet-bridged|" 3037#endif 3038 "socket][,option][,option][,...]\n" 3039 " old way to initialize a host network interface\n" 3040 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL) 3041SRST 3042``-nic [tap|passt|bridge|user|l2tpv3|vde|netmap|af-xdp|vhost-user|socket][,...][,mac=macaddr][,model=mn]`` 3043 This option is a shortcut for configuring both the on-board 3044 (default) guest NIC hardware and the host network backend in one go. 3045 The host backend options are the same as with the corresponding 3046 ``-netdev`` options below. The guest NIC model can be set with 3047 ``model=modelname``. Use ``model=help`` to list the available device 3048 types. The hardware MAC address can be set with ``mac=macaddr``. 3049 3050 The following two example do exactly the same, to show how ``-nic`` 3051 can be used to shorten the command line length: 3052 3053 .. parsed-literal:: 3054 3055 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32 3056 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32 3057 3058``-nic none`` 3059 Indicate that no network devices should be configured. It is used to 3060 override the default configuration (default NIC with "user" host 3061 network backend) which is activated if no other networking options 3062 are provided. 3063 3064``-netdev passt,id=str[,option][,...]`` 3065 Configure a passt network backend which requires no administrator 3066 privilege to run. Valid options are: 3067 3068 ``id=id`` 3069 Assign symbolic name for use in monitor commands. 3070 3071 ``path=file`` 3072 Filename of the passt program to run. If it is not provided, 3073 passt command will be started with the help of the PATH environment 3074 variable. 3075 3076 ``quiet=on|off`` 3077 By default, ``quiet=on`` to disable informational message from 3078 passt. ``quiet=on`` is passed as ``--quiet`` to passt. 3079 3080 ``vhost-user=on|off`` 3081 By default, ``vhost-user=off`` and QEMU uses the stream network 3082 backend to communicate with passt. If ``vhost-user=on``, passt is 3083 started with ``--vhost-user`` and QEMU uses the vhost-user network 3084 backend to communicate with passt. 3085 3086 ``@mtu`` 3087 Assign MTU via DHCP/NDP 3088 3089 ``address`` 3090 IPv4 or IPv6 address 3091 3092 ``netmask`` 3093 IPv4 mask 3094 3095 ``mac`` 3096 source MAC address 3097 3098 ``gateway`` 3099 IPv4 or IPv6 address as gateway 3100 3101 ``interface`` 3102 Interface for addresses and routes 3103 3104 ``outbound`` 3105 Bind to address as outbound source 3106 3107 ``outbound-if4`` 3108 Bind to outbound interface for IPv4 3109 3110 ``outbound-if6`` 3111 Bind to outbound interface for IPv6 3112 3113 ``dns`` 3114 IPv4 or IPv6 address as DNS 3115 3116 ``search`` 3117 Search domains 3118 3119 ``fqdn`` 3120 FQDN to configure client with 3121 3122 ``dhcp-dns`` 3123 Enable/disable DNS list in DHCP/DHCPv6/NDP 3124 3125 ``dhcp-search`` 3126 Enable/disable list in DHCP/DHCPv6/NDP 3127 3128 ``map-host-loopback`` 3129 Addresse to refer to host 3130 3131 ``map-guest-addr`` 3132 Addr to translate to guest's address 3133 3134 ``dns-forward`` 3135 Forward DNS queries sent to 3136 3137 ``dns-host`` 3138 Host nameserver to direct queries to 3139 3140 ``tcp`` 3141 Enable/disable TCP 3142 3143 ``udp`` 3144 Enable/disable UDP 3145 3146 ``icmp`` 3147 Enable/disable ICMP 3148 3149 ``dhcp`` 3150 Enable/disable DHCP 3151 3152 ``ndp`` 3153 Enable/disable NDP 3154 3155 ``dhcpv6`` 3156 Enable/disable DHCPv6 3157 3158 ``ra`` 3159 Enable/disable route advertisements 3160 3161 ``freebind`` 3162 Bind to any address for forwarding 3163 3164 ``ipv4`` 3165 Enable/disable IPv4 3166 3167 ``ipv6`` 3168 Enable/disable IPv6 3169 3170 ``tcp-ports`` 3171 TCP ports to forward 3172 3173 ``udp-ports`` 3174 UDP ports to forward 3175 3176 ``param=string`` 3177 ``string`` will be passed to passt has a command line parameter, 3178 we can have multiple occurences of the ``param`` parameter to 3179 pass multiple parameters to passt. 3180 3181 For instance, to pass ``--trace --log=trace.log``: 3182 3183 .. parsed-literal:: 3184 3185 |qemu_system| -nic passt,param=--trace,param=--log=trace.log 3186 3187``-netdev user,id=id[,option][,option][,...]`` 3188 Configure user mode host network backend which requires no 3189 administrator privilege to run. Valid options are: 3190 3191 ``id=id`` 3192 Assign symbolic name for use in monitor commands. 3193 3194 ``ipv4=on|off and ipv6=on|off`` 3195 Specify that either IPv4 or IPv6 must be enabled. If neither is 3196 specified both protocols are enabled. 3197 3198 ``net=addr[/mask]`` 3199 Set IP network address the guest will see. Optionally specify 3200 the netmask, either in the form a.b.c.d or as number of valid 3201 top-most bits. Default is 10.0.2.0/24. 3202 3203 ``host=addr`` 3204 Specify the guest-visible address of the host. Default is the 3205 2nd IP in the guest network, i.e. x.x.x.2. 3206 3207 ``ipv6-net=addr[/int]`` 3208 Set IPv6 network address the guest will see (default is 3209 fec0::/64). The network prefix is given in the usual hexadecimal 3210 IPv6 address notation. The prefix size is optional, and is given 3211 as the number of valid top-most bits (default is 64). 3212 3213 ``ipv6-host=addr`` 3214 Specify the guest-visible IPv6 address of the host. Default is 3215 the 2nd IPv6 in the guest network, i.e. xxxx::2. 3216 3217 ``restrict=on|off`` 3218 If this option is enabled, the guest will be isolated, i.e. it 3219 will not be able to contact the host and no guest IP packets 3220 will be routed over the host to the outside. This option does 3221 not affect any explicitly set forwarding rules. 3222 3223 ``hostname=name`` 3224 Specifies the client hostname reported by the built-in DHCP 3225 server. 3226 3227 ``dhcpstart=addr`` 3228 Specify the first of the 16 IPs the built-in DHCP server can 3229 assign. Default is the 15th to 31st IP in the guest network, 3230 i.e. x.x.x.15 to x.x.x.31. 3231 3232 ``dns=addr`` 3233 Specify the guest-visible address of the virtual nameserver. The 3234 address must be different from the host address. Default is the 3235 3rd IP in the guest network, i.e. x.x.x.3. 3236 3237 ``ipv6-dns=addr`` 3238 Specify the guest-visible address of the IPv6 virtual 3239 nameserver. The address must be different from the host address. 3240 Default is the 3rd IP in the guest network, i.e. xxxx::3. 3241 3242 ``dnssearch=domain`` 3243 Provides an entry for the domain-search list sent by the 3244 built-in DHCP server. More than one domain suffix can be 3245 transmitted by specifying this option multiple times. If 3246 supported, this will cause the guest to automatically try to 3247 append the given domain suffix(es) in case a domain name can not 3248 be resolved. 3249 3250 Example: 3251 3252 .. parsed-literal:: 3253 3254 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org 3255 3256 ``domainname=domain`` 3257 Specifies the client domain name reported by the built-in DHCP 3258 server. 3259 3260 ``tftp=dir`` 3261 When using the user mode network stack, activate a built-in TFTP 3262 server. The files in dir will be exposed as the root of a TFTP 3263 server. The TFTP client on the guest must be configured in 3264 binary mode (use the command ``bin`` of the Unix TFTP client). 3265 The built-in TFTP server is read-only; it does not implement any 3266 command for writing files. QEMU will not write to this directory. 3267 3268 ``tftp-server-name=name`` 3269 In BOOTP reply, broadcast name as the "TFTP server name" 3270 (RFC2132 option 66). This can be used to advise the guest to 3271 load boot files or configurations from a different server than 3272 the host address. 3273 3274 ``bootfile=file`` 3275 When using the user mode network stack, broadcast file as the 3276 BOOTP filename. In conjunction with ``tftp``, this can be used 3277 to network boot a guest from a local directory. 3278 3279 Example (using pxelinux): 3280 3281 .. parsed-literal:: 3282 3283 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \\ 3284 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 3285 3286 ``smb=dir[,smbserver=addr]`` 3287 When using the user mode network stack, activate a built-in SMB 3288 server so that Windows OSes can access to the host files in 3289 ``dir`` transparently. The IP address of the SMB server can be 3290 set to addr. By default the 4th IP in the guest network is used, 3291 i.e. x.x.x.4. 3292 3293 In the guest Windows OS, the line: 3294 3295 :: 3296 3297 10.0.2.4 smbserver 3298 3299 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows 3300 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows 3301 NT/2000). 3302 3303 Then ``dir`` can be accessed in ``\\smbserver\qemu``. 3304 3305 Note that a SAMBA server must be installed on the host OS. 3306 3307 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport`` 3308 Redirect incoming TCP or UDP connections to the host port 3309 hostport to the guest IP address guestaddr on guest port 3310 guestport. If guestaddr is not specified, its value is x.x.x.15 3311 (default first address given by the built-in DHCP server). By 3312 specifying hostaddr, the rule can be bound to a specific host 3313 interface. If no connection type is set, TCP is used. This 3314 option can be given multiple times. 3315 3316 For example, to redirect host X11 connection from screen 1 to 3317 guest screen 0, use the following: 3318 3319 .. parsed-literal:: 3320 3321 # on the host 3322 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000 3323 # this host xterm should open in the guest X11 server 3324 xterm -display :1 3325 3326 To redirect telnet connections from host port 5555 to telnet 3327 port on the guest, use the following: 3328 3329 .. parsed-literal:: 3330 3331 # on the host 3332 |qemu_system| -nic user,hostfwd=tcp::5555-:23 3333 telnet localhost 5555 3334 3335 Then when you use on the host ``telnet localhost 5555``, you 3336 connect to the guest telnet server. 3337 3338 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command`` 3339 Forward guest TCP connections to the IP address server on port 3340 port to the character device dev or to a program executed by 3341 cmd:command which gets spawned for each connection. This option 3342 can be given multiple times. 3343 3344 You can either use a chardev directly and have that one used 3345 throughout QEMU's lifetime, like in the following example: 3346 3347 .. parsed-literal:: 3348 3349 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever 3350 # the guest accesses it 3351 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 3352 3353 Or you can execute a command on every TCP connection established 3354 by the guest, so that QEMU behaves similar to an inetd process 3355 for that virtual server: 3356 3357 .. parsed-literal:: 3358 3359 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234 3360 # and connect the TCP stream to its stdin/stdout 3361 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321' 3362 3363``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]`` 3364 Configure a host TAP network backend with ID id. 3365 3366 Use the network script file to configure it and the network script 3367 dfile to deconfigure it. If name is not provided, the OS 3368 automatically provides one. The default network configure script is 3369 ``/etc/qemu-ifup`` and the default network deconfigure script is 3370 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to 3371 disable script execution. 3372 3373 If running QEMU as an unprivileged user, use the network helper 3374 to configure the TAP interface and attach it to the bridge. 3375 The default network helper executable is 3376 ``/path/to/qemu-bridge-helper`` and the default bridge device is 3377 ``br0``. 3378 3379 ``fd``\ =h can be used to specify the handle of an already opened 3380 host TAP interface. 3381 3382 Examples: 3383 3384 .. parsed-literal:: 3385 3386 #launch a QEMU instance with the default network script 3387 |qemu_system| linux.img -nic tap 3388 3389 .. parsed-literal:: 3390 3391 #launch a QEMU instance with two NICs, each one connected 3392 #to a TAP device 3393 |qemu_system| linux.img \\ 3394 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \\ 3395 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1 3396 3397 .. parsed-literal:: 3398 3399 #launch a QEMU instance with the default network helper to 3400 #connect a TAP device to bridge br0 3401 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3402 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper" 3403 3404``-netdev bridge,id=id[,br=bridge][,helper=helper]`` 3405 Connect a host TAP network interface to a host bridge device. 3406 3407 Use the network helper helper to configure the TAP interface and 3408 attach it to the bridge. The default network helper executable is 3409 ``/path/to/qemu-bridge-helper`` and the default bridge device is 3410 ``br0``. 3411 3412 Examples: 3413 3414 .. parsed-literal:: 3415 3416 #launch a QEMU instance with the default network helper to 3417 #connect a TAP device to bridge br0 3418 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1 3419 3420 .. parsed-literal:: 3421 3422 #launch a QEMU instance with the default network helper to 3423 #connect a TAP device to bridge qemubr0 3424 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1 3425 3426``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]`` 3427 This host network backend can be used to connect the guest's network 3428 to another QEMU virtual machine using a TCP socket connection. If 3429 ``listen`` is specified, QEMU waits for incoming connections on port 3430 (host is optional). ``connect`` is used to connect to another QEMU 3431 instance using the ``listen`` option. ``fd``\ =h specifies an 3432 already opened TCP socket. 3433 3434 Example: 3435 3436 .. parsed-literal:: 3437 3438 # launch a first QEMU instance 3439 |qemu_system| linux.img \\ 3440 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3441 -netdev socket,id=n1,listen=:1234 3442 # connect the network of this instance to the network of the first instance 3443 |qemu_system| linux.img \\ 3444 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\ 3445 -netdev socket,id=n2,connect=127.0.0.1:1234 3446 3447``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]`` 3448 Configure a socket host network backend to share the guest's network 3449 traffic with another QEMU virtual machines using a UDP multicast 3450 socket, effectively making a bus for every QEMU with same multicast 3451 address maddr and port. NOTES: 3452 3453 1. Several QEMU can be running on different hosts and share same bus 3454 (assuming correct multicast setup for these hosts). 3455 3456 2. mcast support is compatible with User Mode Linux (argument 3457 ``ethN=mcast``), see http://user-mode-linux.sf.net. 3458 3459 3. Use ``fd=h`` to specify an already opened UDP multicast socket. 3460 3461 Example: 3462 3463 .. parsed-literal:: 3464 3465 # launch one QEMU instance 3466 |qemu_system| linux.img \\ 3467 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3468 -netdev socket,id=n1,mcast=230.0.0.1:1234 3469 # launch another QEMU instance on same "bus" 3470 |qemu_system| linux.img \\ 3471 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\ 3472 -netdev socket,id=n2,mcast=230.0.0.1:1234 3473 # launch yet another QEMU instance on same "bus" 3474 |qemu_system| linux.img \\ 3475 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \\ 3476 -netdev socket,id=n3,mcast=230.0.0.1:1234 3477 3478 Example (User Mode Linux compat.): 3479 3480 .. parsed-literal:: 3481 3482 # launch QEMU instance (note mcast address selected is UML's default) 3483 |qemu_system| linux.img \\ 3484 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3485 -netdev socket,id=n1,mcast=239.192.168.1:1102 3486 # launch UML 3487 /path/to/linux ubd0=/path/to/root_fs eth0=mcast 3488 3489 Example (send packets from host's 1.2.3.4): 3490 3491 .. parsed-literal:: 3492 3493 |qemu_system| linux.img \\ 3494 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\ 3495 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4 3496 3497``-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]`` 3498 Configure a network backend to connect to another QEMU virtual machine or a proxy using a TCP/IP socket. 3499 3500 ``server=on|off`` 3501 if ``on`` create a server socket 3502 3503 ``addr.host=host,addr.port=port`` 3504 socket address to listen on (server=on) or connect to (server=off) 3505 3506 ``to=maxport`` 3507 if present, this is range of possible addresses, with port between ``port`` and ``maxport``. 3508 3509 ``numeric=on|off`` 3510 if ``on`` ``host`` and ``port`` are guaranteed to be numeric, otherwise a name resolution should be attempted (default: ``off``) 3511 3512 ``keep-alive=on|off`` 3513 enable keep-alive when connecting to this socket. Not supported for passive sockets. 3514 3515 ``mptcp=on|off`` 3516 enable multipath TCP 3517 3518 ``ipv4=on|off`` 3519 whether to accept IPv4 addresses, default to try both IPv4 and IPv6 3520 3521 ``ipv6=on|off`` 3522 whether to accept IPv6 addresses, default to try both IPv4 and IPv6 3523 3524 ``reconnect-ms=milliseconds`` 3525 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3526 Setting this to zero disables this function. (default: 0) 3527 3528 Example (two guests connected using a TCP/IP socket): 3529 3530 .. parsed-literal:: 3531 3532 # first VM 3533 |qemu_system| linux.img \\ 3534 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3535 -netdev stream,id=net0,server=on,addr.type=inet,addr.host=localhost,addr.port=1234 3536 # second VM 3537 |qemu_system| linux.img \\ 3538 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3539 -netdev stream,id=net0,server=off,addr.type=inet,addr.host=localhost,addr.port=1234,reconnect-ms=5000 3540 3541``-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect-ms=milliseconds]`` 3542 Configure a network backend to connect to another QEMU virtual machine or a proxy using a stream oriented unix domain socket. 3543 3544 ``server=on|off`` 3545 if ``on`` create a server socket 3546 3547 ``addr.path=path`` 3548 filesystem path to use 3549 3550 ``abstract=on|off`` 3551 if ``on``, this is a Linux abstract socket address. 3552 3553 ``tight=on|off`` 3554 if false, pad an abstract socket address with enough null bytes to make it fill struct sockaddr_un member sun_path. 3555 3556 ``reconnect-ms=milliseconds`` 3557 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3558 Setting this to zero disables this function. (default: 0) 3559 3560 Example (using passt as a replacement of -netdev user): 3561 3562 .. parsed-literal:: 3563 3564 # start passt server as a non privileged user 3565 passt 3566 UNIX domain socket bound at /tmp/passt_1.socket 3567 # start QEMU to connect to passt 3568 |qemu_system| linux.img \\ 3569 -device virtio-net,netdev=net0 \\ 3570 -netdev stream,id=net0,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket 3571 3572 Example (two guests connected using a stream oriented unix domain socket): 3573 3574 .. parsed-literal:: 3575 3576 # first VM 3577 |qemu_system| linux.img \\ 3578 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3579 netdev stream,id=net0,server=on,addr.type=unix,addr.path=/tmp/qemu0 3580 # second VM 3581 |qemu_system| linux.img \\ 3582 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3583 -netdev stream,id=net0,server=off,addr.type=unix,addr.path=/tmp/qemu0,reconnect-ms=5000 3584 3585``-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect-ms=milliseconds]`` 3586 Configure a network backend to connect to another QEMU virtual machine or a proxy using a stream oriented socket file descriptor. 3587 3588 ``server=on|off`` 3589 if ``on`` create a server socket 3590 3591 ``addr.str=file-descriptor`` 3592 file descriptor number to use as a socket 3593 3594 ``reconnect-ms=milliseconds`` 3595 for a client socket, if a socket is disconnected, then attempt a reconnect after the given number of milliseconds. 3596 Setting this to zero disables this function. (default: 0) 3597 3598``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]`` 3599 Configure a network backend to connect to a multicast address. 3600 3601 ``remote.host=maddr,remote.port=port`` 3602 multicast address 3603 3604 ``local.host=addr`` 3605 specify the host address to send packets from 3606 3607 Example: 3608 3609 .. parsed-literal:: 3610 3611 # launch one QEMU instance 3612 |qemu_system| linux.img \\ 3613 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3614 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3615 # launch another QEMU instance on same "bus" 3616 |qemu_system| linux.img \\ 3617 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3618 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3619 # launch yet another QEMU instance on same "bus" 3620 |qemu_system| linux.img \\ 3621 -device virtio-net,netdev=net0,mac=52:54:00:12:34:58 \\ 3622 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234 3623 3624``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]`` 3625 Configure a network backend to connect to a multicast address using a UDP socket file descriptor. 3626 3627 ``remote.host=maddr,remote.port=port`` 3628 multicast address 3629 3630 ``local.str=file-descriptor`` 3631 File descriptor to use to send packets 3632 3633``-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]`` 3634 Configure a network backend to connect to another QEMU virtual 3635 machine or a proxy using a datagram oriented unix domain socket. 3636 3637 ``local.host=addr,local.port=port`` 3638 IP address to use to send the packets from 3639 3640 ``remote.host=addr,remote.port=port`` 3641 Destination IP address 3642 3643 Example (two guests connected using an UDP/IP socket): 3644 3645 .. parsed-literal:: 3646 3647 # first VM 3648 |qemu_system| linux.img \\ 3649 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3650 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1234,remote.type=inet,remote.host=localhost,remote.port=1235 3651 # second VM 3652 |qemu_system| linux.img \\ 3653 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3654 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1235,remote.type=inet,remote.host=localhost,remote.port=1234 3655 3656``-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]`` 3657 Configure a network backend to connect to another QEMU virtual 3658 machine or a proxy using a datagram oriented unix socket. 3659 3660 ``local.path=path`` 3661 filesystem path to use to bind the socket 3662 3663 ``remote.path=path`` 3664 filesystem path to use as a destination (see sendto(2)) 3665 3666 Example (two guests connected using an UDP/UNIX socket): 3667 3668 .. parsed-literal:: 3669 3670 # first VM 3671 |qemu_system| linux.img \\ 3672 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\ 3673 -netdev dgram,id=net0,local.type=unix,local.path=/tmp/qemu0,remote.type=unix,remote.path=/tmp/qemu1 3674 # second VM 3675 |qemu_system| linux.img \\ 3676 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\ 3677 -netdev dgram,id=net0,local.type=unix,local.path=/tmp/qemu1,remote.type=unix,remote.path=/tmp/qemu0 3678 3679``-netdev dgram,id=str,local.type=fd,local.str=file-descriptor`` 3680 Configure a network backend to connect to another QEMU virtual 3681 machine or a proxy using a datagram oriented socket file descriptor. 3682 3683 ``local.str=file-descriptor`` 3684 File descriptor to use to send packets 3685 3686``-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]`` 3687 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) 3688 is a popular protocol to transport Ethernet (and other Layer 2) data 3689 frames between two systems. It is present in routers, firewalls and 3690 the Linux kernel (from version 3.3 onwards). 3691 3692 This transport allows a VM to communicate to another VM, router or 3693 firewall directly. 3694 3695 ``src=srcaddr`` 3696 source address (mandatory) 3697 3698 ``dst=dstaddr`` 3699 destination address (mandatory) 3700 3701 ``udp=on`` 3702 select udp encapsulation (default is ip). 3703 3704 ``srcport=srcport`` 3705 source udp port. 3706 3707 ``dstport=dstport`` 3708 destination udp port. 3709 3710 ``ipv6=on`` 3711 force v6, otherwise defaults to v4. 3712 3713 ``rxcookie=rxcookie``; \ ``txcookie=txcookie`` 3714 Cookies are a weak form of security in the l2tpv3 specification. 3715 Their function is mostly to prevent misconfiguration. By default 3716 they are 32 bit. 3717 3718 ``cookie64=on`` 3719 Set cookie size to 64 bit instead of the default 32 3720 3721 ``counter=off`` 3722 Force a 'cut-down' L2TPv3 with no counter as in 3723 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00 3724 3725 ``pincounter=on`` 3726 Work around broken counter handling in peer. This may also help 3727 on networks which have packet reorder. 3728 3729 ``offset=offset`` 3730 Add an extra offset between header and data 3731 3732 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to 3733 the bridge br-lan on the remote Linux host 1.2.3.4: 3734 3735 .. parsed-literal:: 3736 3737 # Setup tunnel on linux host using raw ip as encapsulation 3738 # on 1.2.3.4 3739 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \\ 3740 encap udp udp_sport 16384 udp_dport 16384 3741 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \\ 3742 0xFFFFFFFF peer_session_id 0xFFFFFFFF 3743 ifconfig vmtunnel0 mtu 1500 3744 ifconfig vmtunnel0 up 3745 brctl addif br-lan vmtunnel0 3746 3747 3748 # on 4.3.2.1 3749 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter 3750 3751 |qemu_system| linux.img -device e1000,netdev=n1 \\ 3752 -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 3753 3754``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]`` 3755 Configure VDE backend to connect to PORT n of a vde switch running 3756 on host and listening for incoming connections on socketpath. Use 3757 GROUP groupname and MODE octalmode to change default ownership and 3758 permissions for communication port. This option is only available if 3759 QEMU has been compiled with vde support enabled. 3760 3761 Example: 3762 3763 .. parsed-literal:: 3764 3765 # launch vde switch 3766 vde_switch -F -sock /tmp/myswitch 3767 # launch QEMU instance 3768 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch 3769 3770``-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]`` 3771 Configure AF_XDP backend to connect to a network interface 'name' 3772 using AF_XDP socket. A specific program attach mode for a default 3773 XDP program can be forced with 'mode', defaults to best-effort, 3774 where the likely most performant mode will be in use. Number of queues 3775 'n' should generally match the number or queues in the interface, 3776 defaults to 1. Traffic arriving on non-configured device queues will 3777 not be delivered to the network backend. 3778 3779 .. parsed-literal:: 3780 3781 # set number of queues to 4 3782 ethtool -L eth0 combined 4 3783 # launch QEMU instance 3784 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3785 -netdev af-xdp,id=n1,ifname=eth0,queues=4 3786 3787 'start-queue' option can be specified if a particular range of queues 3788 [m, m + n] should be in use. For example, this is may be necessary in 3789 order to use certain NICs in native mode. Kernel allows the driver to 3790 create a separate set of XDP queues on top of regular ones, and only 3791 these queues can be used for AF_XDP sockets. NICs that work this way 3792 may also require an additional traffic redirection with ethtool to these 3793 special queues. 3794 3795 .. parsed-literal:: 3796 3797 # set number of queues to 1 3798 ethtool -L eth0 combined 1 3799 # redirect all the traffic to the second queue (id: 1) 3800 # note: drivers may require non-empty key/mask pair. 3801 ethtool -N eth0 flow-type ether \\ 3802 dst 00:00:00:00:00:00 m FF:FF:FF:FF:FF:FE action 1 3803 ethtool -N eth0 flow-type ether \\ 3804 dst 00:00:00:00:00:01 m FF:FF:FF:FF:FF:FE action 1 3805 # launch QEMU instance 3806 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3807 -netdev af-xdp,id=n1,ifname=eth0,queues=1,start-queue=1 3808 3809 XDP program can also be loaded externally. In this case 'inhibit' option 3810 should be set to 'on'. Either 'sock-fds' or 'map-path' can be used with 3811 'inhibit' enabled. 'sock-fds' can be provided with file descriptors for 3812 already open but not bound XDP sockets already added to a socket map for 3813 corresponding queues. One socket per queue. 3814 3815 .. parsed-literal:: 3816 3817 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3818 -netdev af-xdp,id=n1,ifname=eth0,queues=3,inhibit=on,sock-fds=15:16:17 3819 3820 For the 'inhibit' option set to 'on' used together with 'map-path' it is 3821 expected that the XDP program with the socket map is already loaded on 3822 the networking device and the map pinned into BPF file system. The path 3823 to the pinned map is then passed to QEMU which then creates the file 3824 descriptors and inserts them into the existing socket map. 3825 3826 .. parsed-literal:: 3827 3828 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\ 3829 -netdev af-xdp,id=n1,ifname=eth0,queues=2,inhibit=on,map-path=/sys/fs/bpf/xsks_map 3830 3831 Additionally, 'map-start-index' can be used to specify the start offset 3832 for insertion into the socket map. The combination of 'map-path' and 3833 'sock-fds' together is not supported. 3834 3835``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]`` 3836 Establish a vhost-user netdev, backed by a chardev id. The chardev 3837 should be a unix domain socket backed one. The vhost-user uses a 3838 specifically defined protocol to pass vhost ioctl replacement 3839 messages to an application on the other end of the socket. On 3840 non-MSIX guests, the feature can be forced with vhostforce. Use 3841 'queues=n' to specify the number of queues to be created for 3842 multiqueue vhost-user. 3843 3844 Example: 3845 3846 :: 3847 3848 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ 3849 -numa node,memdev=mem \ 3850 -chardev socket,id=chr0,path=/path/to/socket \ 3851 -netdev type=vhost-user,id=net0,chardev=chr0 \ 3852 -device virtio-net-pci,netdev=net0 3853 3854``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]`` 3855 Establish a vhost-vdpa netdev. 3856 3857 vDPA device is a device that uses a datapath which complies with 3858 the virtio specifications with a vendor specific control path. 3859 vDPA devices can be both physically located on the hardware or 3860 emulated by software. 3861 3862``-netdev hubport,id=id,hubid=hubid[,netdev=nd]`` 3863 Create a hub port on the emulated hub with ID hubid. 3864 3865 The hubport netdev lets you connect a NIC to a QEMU emulated hub 3866 instead of a single netdev. Alternatively, you can also connect the 3867 hubport to another netdev with ID nd by using the ``netdev=nd`` 3868 option. 3869 3870``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]`` 3871 Legacy option to configure or create an on-board (or machine 3872 default) Network Interface Card(NIC) and connect it either to the 3873 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd. 3874 If model is omitted, then the default NIC model associated with the 3875 machine type is used. Note that the default NIC model may change in 3876 future QEMU releases, so it is highly recommended to always specify 3877 a model. Optionally, the MAC address can be changed to mac, the 3878 device address set to addr (PCI cards only), and a name can be 3879 assigned for use in monitor commands. Optionally, for PCI cards, you 3880 can specify the number v of MSI-X vectors that the card should have; 3881 this option currently only affects virtio cards; set v = 0 to 3882 disable MSI-X. If no ``-net`` option is specified, a single NIC is 3883 created. QEMU can emulate several different models of network card. 3884 Use ``-net nic,model=help`` for a list of available devices for your 3885 target. 3886 3887``-net user|passt|tap|bridge|socket|l2tpv3|vde[,...][,name=name]`` 3888 Configure a host network backend (with the options corresponding to 3889 the same ``-netdev`` option) and connect it to the emulated hub 0 3890 (the default hub). Use name to specify the name of the hub port. 3891ERST 3892 3893DEFHEADING() 3894 3895DEFHEADING(Character device options:) 3896 3897DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, 3898 "-chardev help\n" 3899 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3900 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]\n" 3901 " [,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect-ms=milliseconds][,mux=on|off]\n" 3902 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n" 3903 "-chardev socket,id=id,path=path[,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect-ms=milliseconds]\n" 3904 " [,mux=on|off][,logfile=PATH][,logappend=on|off][,abstract=on|off][,tight=on|off] (unix)\n" 3905 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n" 3906 " [,localport=localport][,ipv4=on|off][,ipv6=on|off][,mux=on|off]\n" 3907 " [,logfile=PATH][,logappend=on|off]\n" 3908 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3909 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n" 3910 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3911 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n" 3912 "-chardev file,id=id,path=path[,input-path=input-file][,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3913 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3914#ifdef _WIN32 3915 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3916 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3917#else 3918 "-chardev pty,id=id[,path=path][,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3919 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n" 3920#endif 3921#ifdef CONFIG_BRLAPI 3922 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3923#endif 3924#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ 3925 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) 3926 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3927#endif 3928#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) 3929 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" 3930#endif 3931#if defined(CONFIG_SPICE) 3932 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n" 3933 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n" 3934#endif 3935 , QEMU_ARCH_ALL 3936) 3937 3938SRST 3939The general form of a character device option is: 3940 3941``-chardev backend,id=id[,mux=on|off][,options]`` 3942 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``, ``hub``, 3943 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``, 3944 ``pty``, ``stdio``, ``braille``, ``parallel``, 3945 ``spicevmc``, ``spiceport``. The specific backend will determine the 3946 applicable options. 3947 3948 Use ``-chardev help`` to print all available chardev backend types. 3949 3950 All devices must have an id, which can be any string up to 127 3951 characters long. It is used to uniquely identify this device in 3952 other command line directives. 3953 3954 A character device may be used in multiplexing mode by multiple 3955 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is 3956 a "1:N" device, and here the "1" end is your specified chardev 3957 backend, and the "N" end is the various parts of QEMU that can talk 3958 to a chardev. If you create a chardev with ``id=myid`` and 3959 ``mux=on``, QEMU will create a multiplexer with your specified ID, 3960 and you can then configure multiple front ends to use that chardev 3961 ID for their input/output. Up to four different front ends can be 3962 connected to a single multiplexed chardev. (Without multiplexing 3963 enabled, a chardev can only be used by a single front end.) For 3964 instance you could use this to allow a single stdio chardev to be 3965 used by two serial ports and the QEMU monitor: 3966 3967 :: 3968 3969 -chardev stdio,mux=on,id=char0 \ 3970 -mon chardev=char0,mode=readline \ 3971 -serial chardev:char0 \ 3972 -serial chardev:char0 3973 3974 You can have more than one multiplexer in a system configuration; 3975 for instance you could have a TCP port multiplexed between UART 0 3976 and UART 1, and stdio multiplexed between the QEMU monitor and a 3977 parallel port: 3978 3979 :: 3980 3981 -chardev stdio,mux=on,id=char0 \ 3982 -mon chardev=char0,mode=readline \ 3983 -parallel chardev:char0 \ 3984 -chardev tcp,...,mux=on,id=char1 \ 3985 -serial chardev:char1 \ 3986 -serial chardev:char1 3987 3988 When you're using a multiplexed character device, some escape 3989 sequences are interpreted in the input. See the chapter about 3990 :ref:`keys in the character backend multiplexer` in the 3991 System Emulation Users Guide for more details. 3992 3993 Note that some other command line options may implicitly create 3994 multiplexed character backends; for instance ``-serial mon:stdio`` 3995 creates a multiplexed stdio backend connected to the serial port and 3996 the QEMU monitor, and ``-nographic`` also multiplexes the console 3997 and the monitor to stdio. 3998 3999 If you need to aggregate data in the opposite direction (where one 4000 QEMU frontend interface receives input and output from multiple 4001 backend chardev devices), please refer to the paragraph below 4002 regarding chardev ``hub`` aggregator device configuration. 4003 4004 Every backend supports the ``logfile`` option, which supplies the 4005 path to a file to record all data transmitted via the backend. The 4006 ``logappend`` option controls whether the log file will be truncated 4007 or appended to when opened. 4008 4009The available backends are: 4010 4011``-chardev null,id=id`` 4012 A void device. This device will not emit any data, and will drop any 4013 data it receives. The null backend does not take any options. 4014 4015``-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]`` 4016 Create a two-way stream socket, which can be either a TCP or a unix 4017 socket. A unix socket will be created if ``path`` is specified. 4018 Behaviour is undefined if TCP options are specified for a unix 4019 socket. 4020 4021 ``server=on|off`` specifies that the socket shall be a listening socket. 4022 4023 ``wait=on|off`` specifies that QEMU should not block waiting for a client 4024 to connect to a listening socket. 4025 4026 ``telnet=on|off`` specifies that traffic on the socket should interpret 4027 telnet escape sequences. 4028 4029 ``websocket=on|off`` specifies that the socket uses WebSocket protocol for 4030 communication. 4031 4032 ``reconnect-ms`` sets the timeout for reconnecting on non-server 4033 sockets when the remote end goes away. qemu will delay this many 4034 milliseconds and then attempt to reconnect. Zero disables reconnecting, 4035 and is the default. 4036 4037 ``tls-creds`` requests enablement of the TLS protocol for 4038 encryption, and specifies the id of the TLS credentials to use for 4039 the handshake. The credentials must be previously created with the 4040 ``-object tls-creds`` argument. 4041 4042 ``tls-auth`` provides the ID of the QAuthZ authorization object 4043 against which the client's x509 distinguished name will be 4044 validated. This object is only resolved at time of use, so can be 4045 deleted and recreated on the fly while the chardev server is active. 4046 If missing, it will default to denying access. 4047 4048 TCP and unix socket options are given below: 4049 4050 ``TCP options: port=port[,host=host][,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]`` 4051 ``host`` for a listening socket specifies the local address to 4052 be bound. For a connecting socket species the remote host to 4053 connect to. ``host`` is optional for listening sockets. If not 4054 specified it defaults to ``0.0.0.0``. 4055 4056 ``port`` for a listening socket specifies the local port to be 4057 bound. For a connecting socket specifies the port on the remote 4058 host to connect to. ``port`` can be given as either a port 4059 number or a service name. ``port`` is required. 4060 4061 ``to`` is only relevant to listening sockets. If it is 4062 specified, and ``port`` cannot be bound, QEMU will attempt to 4063 bind to subsequent ports up to and including ``to`` until it 4064 succeeds. ``to`` must be specified as a port number. 4065 4066 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 4067 or IPv6 must be used. If neither is specified the socket may 4068 use either protocol. 4069 4070 ``nodelay=on|off`` disables the Nagle algorithm. 4071 4072 ``unix options: path=path[,abstract=on|off][,tight=on|off]`` 4073 ``path`` specifies the local path of the unix socket. ``path`` 4074 is required. 4075 ``abstract=on|off`` specifies the use of the abstract socket namespace, 4076 rather than the filesystem. Optional, defaults to false. 4077 ``tight=on|off`` sets the socket length of abstract sockets to their minimum, 4078 rather than the full sun_path length. Optional, defaults to true. 4079 4080``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4=on|off][,ipv6=on|off]`` 4081 Sends all traffic from the guest to a remote host over UDP. 4082 4083 ``host`` specifies the remote host to connect to. If not specified 4084 it defaults to ``localhost``. 4085 4086 ``port`` specifies the port on the remote host to connect to. 4087 ``port`` is required. 4088 4089 ``localaddr`` specifies the local address to bind to. If not 4090 specified it defaults to ``0.0.0.0``. 4091 4092 ``localport`` specifies the local port to bind to. If not specified 4093 any available local port will be used. 4094 4095 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 or IPv6 must be used. 4096 If neither is specified the device may use either protocol. 4097 4098``-chardev msmouse,id=id`` 4099 Forward QEMU's emulated msmouse events to the guest. ``msmouse`` 4100 does not take any options. 4101 4102``-chardev hub,id=id,chardevs.0=id[,chardevs.N=id]`` 4103 Explicitly create chardev backend hub device with the possibility 4104 to aggregate input from multiple backend devices and forward it to 4105 a single frontend device. Additionally, ``hub`` device takes the 4106 output from the frontend device and sends it back to all the 4107 connected backend devices. This allows for seamless interaction 4108 between different backend devices and a single frontend 4109 interface. Aggregation supported for up to 4 chardev 4110 devices. (Since 10.0) 4111 4112 For example, the following is a use case of 2 backend devices: 4113 virtual console ``vc0`` and a pseudo TTY ``pty0`` connected to 4114 a single virtio hvc console frontend device with a hub ``hub0`` 4115 help. Virtual console renders text to an image, which can be 4116 shared over the VNC protocol. In turn, pty backend provides 4117 bidirectional communication to the virtio hvc console over the 4118 pseudo TTY file. The example configuration can be as follows: 4119 4120 :: 4121 4122 -chardev pty,path=/tmp/pty,id=pty0 \ 4123 -chardev vc,id=vc0 \ 4124 -chardev hub,id=hub0,chardevs.0=pty0,chardevs.1=vc0 \ 4125 -device virtconsole,chardev=hub0 \ 4126 -vnc 0.0.0.0:0 4127 4128 Once QEMU starts VNC client and any TTY emulator can be used to 4129 control a single hvc console: 4130 4131 :: 4132 4133 # Start TTY emulator 4134 tio /tmp/pty 4135 4136 # Start VNC client and switch to virtual console Ctrl-Alt-2 4137 vncviewer :0 4138 4139 Several frontend devices is not supported. Stacking of multiplexers 4140 and hub devices is not supported as well. 4141 4142``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]`` 4143 Connect to a QEMU text console. ``vc`` may optionally be given a 4144 specific size. 4145 4146 ``width`` and ``height`` specify the width and height respectively 4147 of the console, in pixels. 4148 4149 ``cols`` and ``rows`` specify that the console be sized to fit a 4150 text console with the given dimensions. 4151 4152``-chardev ringbuf,id=id[,size=size]`` 4153 Create a ring buffer with fixed size ``size``. size must be a power 4154 of two and defaults to ``64K``. 4155 4156``-chardev file,id=id,path=path[,input-path=input-path]`` 4157 Log all traffic received from the guest to a file. 4158 4159 ``path`` specifies the path of the file to be opened. This file will 4160 be created if it does not already exist, and overwritten if it does. 4161 ``path`` is required. 4162 4163 If ``input-path`` is specified, this is the path of a second file 4164 which will be used for input. If ``input-path`` is not specified, 4165 no input will be available from the chardev. 4166 4167 Note that ``input-path`` is not supported on Windows hosts. 4168 4169``-chardev pipe,id=id,path=path`` 4170 Create a two-way connection to the guest. The behaviour differs 4171 slightly between Windows hosts and other hosts: 4172 4173 On Windows, a single duplex pipe will be created at 4174 ``\\.pipe\path``. 4175 4176 On other hosts, 2 pipes will be created called ``path.in`` and 4177 ``path.out``. Data written to ``path.in`` will be received by the 4178 guest. Data written by the guest can be read from ``path.out``. QEMU 4179 will not create these fifos, and requires them to be present. 4180 4181 ``path`` forms part of the pipe path as described above. ``path`` is 4182 required. 4183 4184``-chardev console,id=id`` 4185 Send traffic from the guest to QEMU's standard output. ``console`` 4186 does not take any options. 4187 4188 ``console`` is only available on Windows hosts. 4189 4190``-chardev serial,id=id,path=path`` 4191 Send traffic from the guest to a serial device on the host. 4192 4193 On Unix hosts serial will actually accept any tty device, not only 4194 serial lines. 4195 4196 ``path`` specifies the name of the serial device to open. 4197 4198``-chardev pty,id=id[,path=path]`` 4199 Create a new pseudo-terminal on the host and connect to it. 4200 4201 ``pty`` is not available on Windows hosts. 4202 4203 If ``path`` is specified, QEMU will create a symbolic link at 4204 that location which points to the new PTY device. 4205 4206 This avoids having to make QMP or HMP monitor queries to find out 4207 what the new PTY device path is. 4208 4209 Note that while QEMU will remove the symlink when it exits 4210 gracefully, it will not do so in case of crashes or on certain 4211 startup errors. It is recommended that the user checks and removes 4212 the symlink after QEMU terminates to account for this. 4213 4214``-chardev stdio,id=id[,signal=on|off]`` 4215 Connect to standard input and standard output of the QEMU process. 4216 4217 ``signal`` controls if signals are enabled on the terminal, that 4218 includes exiting QEMU with the key sequence Control-c. This option 4219 is enabled by default, use ``signal=off`` to disable it. 4220 4221``-chardev braille,id=id`` 4222 Connect to a local BrlAPI server. ``braille`` does not take any 4223 options. 4224 4225``-chardev parallel,id=id,path=path`` 4226 \ 4227 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD 4228 hosts. 4229 4230 Connect to a local parallel port. 4231 4232 ``path`` specifies the path to the parallel port device. ``path`` is 4233 required. 4234 4235``-chardev spicevmc,id=id,debug=debug,name=name`` 4236 ``spicevmc`` is only available when spice support is built in. 4237 4238 ``debug`` debug level for spicevmc 4239 4240 ``name`` name of spice channel to connect to 4241 4242 Connect to a spice virtual machine channel, such as vdiport. 4243 4244``-chardev spiceport,id=id,debug=debug,name=name`` 4245 ``spiceport`` is only available when spice support is built in. 4246 4247 ``debug`` debug level for spicevmc 4248 4249 ``name`` name of spice port to connect to 4250 4251 Connect to a spice port, allowing a Spice client to handle the 4252 traffic identified by a name (preferably a fqdn). 4253ERST 4254 4255DEFHEADING() 4256 4257#ifdef CONFIG_TPM 4258DEFHEADING(TPM device options:) 4259 4260DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \ 4261 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n" 4262 " use path to provide path to a character device; default is /dev/tpm0\n" 4263 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n" 4264 " not provided it will be searched for in /sys/class/misc/tpm?/device\n" 4265 "-tpmdev emulator,id=id,chardev=dev\n" 4266 " configure the TPM device using chardev backend\n", 4267 QEMU_ARCH_ALL) 4268SRST 4269The general form of a TPM device option is: 4270 4271``-tpmdev backend,id=id[,options]`` 4272 The specific backend type will determine the applicable options. The 4273 ``-tpmdev`` option creates the TPM backend and requires a 4274 ``-device`` option that specifies the TPM frontend interface model. 4275 4276 Use ``-tpmdev help`` to print all available TPM backend types. 4277 4278The available backends are: 4279 4280``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path`` 4281 (Linux-host only) Enable access to the host's TPM using the 4282 passthrough driver. 4283 4284 ``path`` specifies the path to the host's TPM device, i.e., on a 4285 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by 4286 default ``/dev/tpm0`` is used. 4287 4288 ``cancel-path`` specifies the path to the host TPM device's sysfs 4289 entry allowing for cancellation of an ongoing TPM command. 4290 ``cancel-path`` is optional and by default QEMU will search for the 4291 sysfs entry to use. 4292 4293 Some notes about using the host's TPM with the passthrough driver: 4294 4295 The TPM device accessed by the passthrough driver must not be used 4296 by any other application on the host. 4297 4298 Since the host's firmware (BIOS/UEFI) has already initialized the 4299 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize 4300 the TPM again and may therefore not show a TPM-specific menu that 4301 would otherwise allow the user to configure the TPM, e.g., allow the 4302 user to enable/disable or activate/deactivate the TPM. Further, if 4303 TPM ownership is released from within a VM then the host's TPM will 4304 get disabled and deactivated. To enable and activate the TPM again 4305 afterwards, the host has to be rebooted and the user is required to 4306 enter the firmware's menu to enable and activate the TPM. If the TPM 4307 is left disabled and/or deactivated most TPM commands will fail. 4308 4309 To create a passthrough TPM use the following two options: 4310 4311 :: 4312 4313 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0 4314 4315 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by 4316 ``tpmdev=tpm0`` in the device option. 4317 4318``-tpmdev emulator,id=id,chardev=dev`` 4319 (Linux-host only) Enable access to a TPM emulator using Unix domain 4320 socket based chardev backend. 4321 4322 ``chardev`` specifies the unique ID of a character device backend 4323 that provides connection to the software TPM server. 4324 4325 To create a TPM emulator backend device with chardev socket backend: 4326 4327 :: 4328 4329 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 4330ERST 4331 4332DEFHEADING() 4333 4334#endif 4335 4336DEFHEADING(Boot Image or Kernel specific:) 4337SRST 4338There are broadly 4 ways you can boot a system with QEMU. 4339 4340 - specify a firmware and let it control finding a kernel 4341 - specify a firmware and pass a hint to the kernel to boot 4342 - direct kernel image boot 4343 - manually load files into the guest's address space 4344 4345The third method is useful for quickly testing kernels but as there is 4346no firmware to pass configuration information to the kernel the 4347hardware must either be probeable, the kernel built for the exact 4348configuration or passed some configuration data (e.g. a DTB blob) 4349which tells the kernel what drivers it needs. This exact details are 4350often hardware specific. 4351 4352The final method is the most generic way of loading images into the 4353guest address space and used mostly for ``bare metal`` type 4354development where the reset vectors of the processor are taken into 4355account. 4356 4357ERST 4358 4359SRST 4360 4361For x86 machines and some other architectures ``-bios`` will generally 4362do the right thing with whatever it is given. For other machines the 4363more strict ``-pflash`` option needs an image that is sized for the 4364flash device for the given machine type. 4365 4366Please see the :ref:`system-targets-ref` section of the manual for 4367more detailed documentation. 4368 4369ERST 4370 4371DEF("bios", HAS_ARG, QEMU_OPTION_bios, \ 4372 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL) 4373SRST 4374``-bios file`` 4375 Set the filename for the BIOS. 4376ERST 4377 4378DEF("pflash", HAS_ARG, QEMU_OPTION_pflash, 4379 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL) 4380SRST 4381``-pflash file`` 4382 Use file as a parallel flash image. 4383ERST 4384 4385SRST 4386 4387The kernel options were designed to work with Linux kernels although 4388other things (like hypervisors) can be packaged up as a kernel 4389executable image. The exact format of a executable image is usually 4390architecture specific. 4391 4392The way in which the kernel is started (what address it is loaded at, 4393what if any information is passed to it via CPU registers, the state 4394of the hardware when it is started, and so on) is also architecture 4395specific. Typically it follows the specification laid down by the 4396Linux kernel for how kernels for that architecture must be started. 4397 4398ERST 4399 4400DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \ 4401 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL) 4402SRST 4403``-kernel bzImage`` 4404 Use bzImage as kernel image. The kernel can be either a Linux kernel 4405 or in multiboot format. 4406ERST 4407 4408DEF("shim", HAS_ARG, QEMU_OPTION_shim, \ 4409 "-shim shim.efi use 'shim.efi' to boot the kernel\n", QEMU_ARCH_ALL) 4410SRST 4411``-shim shim.efi`` 4412 Use 'shim.efi' to boot the kernel 4413ERST 4414 4415DEF("append", HAS_ARG, QEMU_OPTION_append, \ 4416 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL) 4417SRST 4418``-append cmdline`` 4419 Use cmdline as kernel command line 4420ERST 4421 4422DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \ 4423 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL) 4424SRST(initrd) 4425 4426``-initrd file`` 4427 Use file as initial ram disk. 4428 4429``-initrd "file1 arg=foo,file2"`` 4430 This syntax is only available with multiboot. 4431 4432 Use file1 and file2 as modules and pass ``arg=foo`` as parameter to the 4433 first module. Commas can be provided in module parameters by doubling 4434 them on the command line to escape them: 4435 4436``-initrd "bzImage earlyprintk=xen,,keep root=/dev/xvda1,initrd.img"`` 4437 Multiboot only. Use bzImage as the first module with 4438 "``earlyprintk=xen,keep root=/dev/xvda1``" as its command line, 4439 and initrd.img as the second module. 4440 4441ERST 4442 4443DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \ 4444 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL) 4445SRST 4446``-dtb file`` 4447 Use file as a device tree binary (dtb) image and pass it to the 4448 kernel on boot. 4449ERST 4450 4451SRST 4452 4453Finally you can also manually load images directly into the address 4454space of the guest. This is most useful for developers who already 4455know the layout of their guest and take care to ensure something sane 4456will happen when the reset vector executes. 4457 4458The generic loader can be invoked by using the loader device: 4459 4460``-device loader,addr=<addr>,data=<data>,data-len=<data-len>[,data-be=<data-be>][,cpu-num=<cpu-num>]`` 4461 4462there is also the guest loader which operates in a similar way but 4463tweaks the DTB so a hypervisor loaded via ``-kernel`` can find where 4464the guest image is: 4465 4466``-device guest-loader,addr=<addr>[,kernel=<path>,[bootargs=<arguments>]][,initrd=<path>]`` 4467 4468ERST 4469 4470DEFHEADING() 4471 4472DEFHEADING(Debug/Expert options:) 4473 4474DEF("compat", HAS_ARG, QEMU_OPTION_compat, 4475 "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n" 4476 " Policy for handling deprecated management interfaces\n" 4477 "-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n" 4478 " Policy for handling unstable management interfaces\n", 4479 QEMU_ARCH_ALL) 4480SRST 4481``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]`` 4482 Set policy for handling deprecated management interfaces (experimental): 4483 4484 ``deprecated-input=accept`` (default) 4485 Accept deprecated commands and arguments 4486 ``deprecated-input=reject`` 4487 Reject deprecated commands and arguments 4488 ``deprecated-input=crash`` 4489 Crash on deprecated commands and arguments 4490 ``deprecated-output=accept`` (default) 4491 Emit deprecated command results and events 4492 ``deprecated-output=hide`` 4493 Suppress deprecated command results and events 4494 4495 Limitation: covers only syntactic aspects of QMP. 4496 4497``-compat [unstable-input=@var{input-policy}][,unstable-output=@var{output-policy}]`` 4498 Set policy for handling unstable management interfaces (experimental): 4499 4500 ``unstable-input=accept`` (default) 4501 Accept unstable commands and arguments 4502 ``unstable-input=reject`` 4503 Reject unstable commands and arguments 4504 ``unstable-input=crash`` 4505 Crash on unstable commands and arguments 4506 ``unstable-output=accept`` (default) 4507 Emit unstable command results and events 4508 ``unstable-output=hide`` 4509 Suppress unstable command results and events 4510 4511 Limitation: covers only syntactic aspects of QMP. 4512ERST 4513 4514DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg, 4515 "-fw_cfg [name=]<name>,file=<file>\n" 4516 " add named fw_cfg entry with contents from file\n" 4517 "-fw_cfg [name=]<name>,string=<str>\n" 4518 " add named fw_cfg entry with contents from string\n", 4519 QEMU_ARCH_ALL) 4520SRST 4521``-fw_cfg [name=]name,file=file`` 4522 Add named fw\_cfg entry with contents from file file. 4523 If the filename contains comma, you must double it (for instance, 4524 "file=my,,file" to use file "my,file"). 4525 4526``-fw_cfg [name=]name,string=str`` 4527 Add named fw\_cfg entry with contents from string str. 4528 If the string contains comma, you must double it (for instance, 4529 "string=my,,string" to use file "my,string"). 4530 4531 The terminating NUL character of the contents of str will not be 4532 included as part of the fw\_cfg item data. To insert contents with 4533 embedded NUL characters, you have to use the file parameter. 4534 4535 The fw\_cfg entries are passed by QEMU through to the guest. 4536 4537 Example: 4538 4539 :: 4540 4541 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin 4542 4543 creates an fw\_cfg entry named opt/com.mycompany/blob with contents 4544 from ./my\_blob.bin. 4545ERST 4546 4547DEF("serial", HAS_ARG, QEMU_OPTION_serial, \ 4548 "-serial dev redirect the serial port to char device 'dev'\n", 4549 QEMU_ARCH_ALL) 4550SRST 4551``-serial dev`` 4552 Redirect the virtual serial port to host character device dev. The 4553 default device is ``vc`` in graphical mode and ``stdio`` in non 4554 graphical mode. 4555 4556 This option can be used several times to simulate multiple serial 4557 ports. 4558 4559 You can use ``-serial none`` to suppress the creation of default 4560 serial devices. 4561 4562 Available character devices are: 4563 4564 ``vc[:WxH]`` 4565 Virtual console. Optionally, a width and height can be given in 4566 pixel with 4567 4568 :: 4569 4570 vc:800x600 4571 4572 It is also possible to specify width or height in characters: 4573 4574 :: 4575 4576 vc:80Cx24C 4577 4578 ``pty[:path]`` 4579 [Linux only] Pseudo TTY (a new PTY is automatically allocated). 4580 4581 If ``path`` is specified, QEMU will create a symbolic link at 4582 that location which points to the new PTY device. 4583 4584 This avoids having to make QMP or HMP monitor queries to find 4585 out what the new PTY device path is. 4586 4587 Note that while QEMU will remove the symlink when it exits 4588 gracefully, it will not do so in case of crashes or on certain 4589 startup errors. It is recommended that the user checks and 4590 removes the symlink after QEMU terminates to account for this. 4591 4592 ``none`` 4593 No device is allocated. Note that for machine types which 4594 emulate systems where a serial device is always present in 4595 real hardware, this may be equivalent to the ``null`` option, 4596 in that the serial device is still present but all output 4597 is discarded. For boards where the number of serial ports is 4598 truly variable, this suppresses the creation of the device. 4599 4600 ``null`` 4601 A guest will see the UART or serial device as present in the 4602 machine, but all output is discarded, and there is no input. 4603 Conceptually equivalent to redirecting the output to ``/dev/null``. 4604 4605 ``chardev:id`` 4606 Use a named character device defined with the ``-chardev`` 4607 option. 4608 4609 ``/dev/XXX`` 4610 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial 4611 port parameters are set according to the emulated ones. 4612 4613 ``/dev/parportN`` 4614 [Linux only, parallel port only] Use host parallel port N. 4615 Currently SPP and EPP parallel port features can be used. 4616 4617 ``file:filename`` 4618 Write output to filename. No character can be read. 4619 4620 ``stdio`` 4621 [Unix only] standard input/output 4622 4623 ``pipe:filename`` 4624 name pipe filename 4625 4626 ``COMn`` 4627 [Windows only] Use host serial port n 4628 4629 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]`` 4630 This implements UDP Net Console. When remote\_host or src\_ip 4631 are not specified they default to ``0.0.0.0``. When not using a 4632 specified src\_port a random port is automatically chosen. 4633 4634 If you just want a simple readonly console you can use 4635 ``netcat`` or ``nc``, by starting QEMU with: 4636 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time 4637 QEMU writes something to that port it will appear in the 4638 netconsole session. 4639 4640 If you plan to send characters back via netconsole or you want 4641 to stop and start QEMU a lot of times, you should have QEMU use 4642 the same source port each time by using something like ``-serial 4643 udp::4555@:4556`` to QEMU. Another approach is to use a patched 4644 version of netcat which can listen to a TCP port and send and 4645 receive characters via udp. If you have a patched version of 4646 netcat which activates telnet remote echo and single char 4647 transfer, then you can use the following options to set up a 4648 netcat redirector to allow telnet on port 5555 to access the 4649 QEMU port. 4650 4651 ``QEMU Options:`` 4652 -serial udp::4555@:4556 4653 4654 ``netcat options:`` 4655 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T 4656 4657 ``telnet options:`` 4658 localhost 5555 4659 4660 ``tcp:[host]:port[,server=on|off][,wait=on|off][,nodelay=on|off][,reconnect-ms=milliseconds]`` 4661 The TCP Net Console has two modes of operation. It can send the 4662 serial I/O to a location or wait for a connection from a 4663 location. By default the TCP Net Console is sent to host at the 4664 port. If you use the ``server=on`` option QEMU will wait for a client 4665 socket application to connect to the port before continuing, 4666 unless the ``wait=on|off`` option was specified. The ``nodelay=on|off`` 4667 option disables the Nagle buffering algorithm. The ``reconnect-ms`` 4668 option only applies if ``server=no`` is set, if the connection goes 4669 down it will attempt to reconnect at the given interval. If host 4670 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a 4671 time is accepted. You can use ``telnet=on`` to connect to the 4672 corresponding character device. 4673 4674 ``Example to send tcp console to 192.168.0.2 port 4444`` 4675 -serial tcp:192.168.0.2:4444 4676 4677 ``Example to listen and wait on port 4444 for connection`` 4678 -serial tcp::4444,server=on 4679 4680 ``Example to not wait and listen on ip 192.168.0.100 port 4444`` 4681 -serial tcp:192.168.0.100:4444,server=on,wait=off 4682 4683 ``telnet:host:port[,server=on|off][,wait=on|off][,nodelay=on|off]`` 4684 The telnet protocol is used instead of raw tcp sockets. The 4685 options work the same as if you had specified ``-serial tcp``. 4686 The difference is that the port acts like a telnet server or 4687 client using telnet option negotiation. This will also allow you 4688 to send the MAGIC\_SYSRQ sequence if you use a telnet that 4689 supports sending the break sequence. Typically in unix telnet 4690 you do it with Control-] and then type "send break" followed by 4691 pressing the enter key. 4692 4693 ``websocket:host:port,server=on[,wait=on|off][,nodelay=on|off]`` 4694 The WebSocket protocol is used instead of raw tcp socket. The 4695 port acts as a WebSocket server. Client mode is not supported. 4696 4697 ``unix:path[,server=on|off][,wait=on|off][,reconnect-ms=milliseconds]`` 4698 A unix domain socket is used instead of a tcp socket. The option 4699 works the same as if you had specified ``-serial tcp`` except 4700 the unix domain socket path is used for connections. 4701 4702 ``mon:dev_string`` 4703 This is a special option to allow the monitor to be multiplexed 4704 onto another serial port. The monitor is accessed with key 4705 sequence of Control-a and then pressing c. dev\_string should be 4706 any one of the serial devices specified above. An example to 4707 multiplex the monitor onto a telnet server listening on port 4708 4444 would be: 4709 4710 ``-serial mon:telnet::4444,server=on,wait=off`` 4711 4712 When the monitor is multiplexed to stdio in this way, Ctrl+C 4713 will not terminate QEMU any more but will be passed to the guest 4714 instead. 4715 4716 ``braille`` 4717 Braille device. This will use BrlAPI to display the braille 4718 output on a real or fake device. 4719 4720 ``msmouse`` 4721 Three button serial mouse. Configure the guest to use Microsoft 4722 protocol. 4723ERST 4724 4725DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \ 4726 "-parallel dev redirect the parallel port to char device 'dev'\n", 4727 QEMU_ARCH_ALL) 4728SRST 4729``-parallel dev`` 4730 Redirect the virtual parallel port to host device dev (same devices 4731 as the serial port). On Linux hosts, ``/dev/parportN`` can be used 4732 to use hardware devices connected on the corresponding host parallel 4733 port. 4734 4735 This option can be used several times to simulate up to 3 parallel 4736 ports. 4737 4738 Use ``-parallel none`` to disable all parallel ports. 4739ERST 4740 4741DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \ 4742 "-monitor dev redirect the monitor to char device 'dev'\n", 4743 QEMU_ARCH_ALL) 4744SRST 4745``-monitor dev`` 4746 Redirect the monitor to host device dev (same devices as the serial 4747 port). The default device is ``vc`` in graphical mode and ``stdio`` 4748 in non graphical mode. Use ``-monitor none`` to disable the default 4749 monitor. 4750ERST 4751DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \ 4752 "-qmp dev like -monitor but opens in 'control' mode\n", 4753 QEMU_ARCH_ALL) 4754SRST 4755``-qmp dev`` 4756 Like ``-monitor`` but opens in 'control' mode. For example, to make 4757 QMP available on localhost port 4444:: 4758 4759 -qmp tcp:localhost:4444,server=on,wait=off 4760 4761 Not all options are configurable via this syntax; for maximum 4762 flexibility use the ``-mon`` option and an accompanying ``-chardev``. 4763 4764ERST 4765DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \ 4766 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n", 4767 QEMU_ARCH_ALL) 4768SRST 4769``-qmp-pretty dev`` 4770 Like ``-qmp`` but uses pretty JSON formatting. 4771ERST 4772 4773DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ 4774 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL) 4775SRST 4776``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]`` 4777 Set up a monitor connected to the chardev ``name``. 4778 QEMU supports two monitors: the Human Monitor Protocol 4779 (HMP; for human interaction), and the QEMU Monitor Protocol 4780 (QMP; a JSON RPC-style protocol). 4781 The default is HMP; ``mode=control`` selects QMP instead. 4782 ``pretty`` is only valid when ``mode=control``, 4783 turning on JSON pretty printing to ease 4784 human reading and debugging. 4785 4786 For example:: 4787 4788 -chardev socket,id=mon1,host=localhost,port=4444,server=on,wait=off \ 4789 -mon chardev=mon1,mode=control,pretty=on 4790 4791 enables the QMP monitor on localhost port 4444 with pretty-printing. 4792ERST 4793 4794DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \ 4795 "-debugcon dev redirect the debug console to char device 'dev'\n", 4796 QEMU_ARCH_ALL) 4797SRST 4798``-debugcon dev`` 4799 Redirect the debug console to host device dev (same devices as the 4800 serial port). The debug console is an I/O port which is typically 4801 port 0xe9; writing to that I/O port sends output to this device. The 4802 default device is ``vc`` in graphical mode and ``stdio`` in non 4803 graphical mode. 4804ERST 4805 4806DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \ 4807 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL) 4808SRST 4809``-pidfile file`` 4810 Store the QEMU process PID in file. It is useful if you launch QEMU 4811 from a script. 4812ERST 4813 4814DEF("preconfig", 0, QEMU_OPTION_preconfig, \ 4815 "--preconfig pause QEMU before machine is initialized (experimental)\n", 4816 QEMU_ARCH_ALL) 4817SRST 4818``--preconfig`` 4819 Pause QEMU for interactive configuration before the machine is 4820 created, which allows querying and configuring properties that will 4821 affect machine initialization. Use QMP command 'x-exit-preconfig' to 4822 exit the preconfig state and move to the next state (i.e. run guest 4823 if -S isn't used or pause the second time if -S is used). This 4824 option is experimental. 4825ERST 4826 4827DEF("S", 0, QEMU_OPTION_S, \ 4828 "-S freeze CPU at startup (use 'c' to start execution)\n", 4829 QEMU_ARCH_ALL) 4830SRST 4831``-S`` 4832 Do not start CPU at startup (you must type 'c' in the monitor). 4833ERST 4834 4835DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit, 4836 "-overcommit [mem-lock=on|off|on-fault][cpu-pm=on|off]\n" 4837 " run qemu with overcommit hints\n" 4838 " mem-lock=on|off|on-fault controls memory lock support (default: off)\n" 4839 " cpu-pm=on|off controls cpu power management (default: off)\n", 4840 QEMU_ARCH_ALL) 4841SRST 4842``-overcommit mem-lock=on|off|on-fault`` 4843 \ 4844``-overcommit cpu-pm=on|off`` 4845 Run qemu with hints about host resource overcommit. The default is 4846 to assume that host overcommits all resources. 4847 4848 Locking qemu and guest memory can be enabled via ``mem-lock=on`` 4849 or ``mem-lock=on-fault`` (disabled by default). This works when 4850 host memory is not overcommitted and reduces the worst-case latency for 4851 guest. The on-fault option is better for reducing the memory footprint 4852 since it makes allocations lazy, but the pages still get locked in place 4853 once faulted by the guest or QEMU. Note that the two options are mutually 4854 exclusive. 4855 4856 Guest ability to manage power state of host cpus (increasing latency 4857 for other processes on the same host cpu, but decreasing latency for 4858 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This 4859 works best when host CPU is not overcommitted. When used, host 4860 estimates of CPU cycle and power utilization will be incorrect, not 4861 taking into account guest idle time. 4862ERST 4863 4864DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ 4865 "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n" 4866 " the guest without waiting for gdb to connect; use -S too\n" 4867 " if you want it to not start execution.)\n", 4868 QEMU_ARCH_ALL) 4869SRST 4870``-gdb dev`` 4871 Accept a gdb connection on device dev (see the :ref:`GDB usage` chapter 4872 in the System Emulation Users Guide). Note that this option does not pause QEMU 4873 execution -- if you want QEMU to not start the guest until you 4874 connect with gdb and issue a ``continue`` command, you will need to 4875 also pass the ``-S`` option to QEMU. 4876 4877 The most usual configuration is to listen on a local TCP socket:: 4878 4879 -gdb tcp::3117 4880 4881 but you can specify other backends; UDP, pseudo TTY, or even stdio 4882 are all reasonable use cases. For example, a stdio connection 4883 allows you to start QEMU from within gdb and establish the 4884 connection via a pipe: 4885 4886 .. parsed-literal:: 4887 4888 (gdb) target remote | exec |qemu_system| -gdb stdio ... 4889ERST 4890 4891DEF("s", 0, QEMU_OPTION_s, \ 4892 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n", 4893 QEMU_ARCH_ALL) 4894SRST 4895``-s`` 4896 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234 4897 (see the :ref:`GDB usage` chapter in the System Emulation Users Guide). 4898ERST 4899 4900DEF("d", HAS_ARG, QEMU_OPTION_d, \ 4901 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n", 4902 QEMU_ARCH_ALL) 4903SRST 4904``-d item1[,...]`` 4905 Enable logging of specified items. Use '-d help' for a list of log 4906 items. 4907ERST 4908 4909DEF("D", HAS_ARG, QEMU_OPTION_D, \ 4910 "-D logfile output log to logfile (default stderr)\n", 4911 QEMU_ARCH_ALL) 4912SRST 4913``-D logfile`` 4914 Output log in logfile instead of to stderr 4915ERST 4916 4917DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \ 4918 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n", 4919 QEMU_ARCH_ALL) 4920SRST 4921``-dfilter range1[,...]`` 4922 Filter debug output to that relevant to a range of target addresses. 4923 The filter spec can be either start+size, start-size or start..end 4924 where start end and size are the addresses and sizes required. For 4925 example: 4926 4927 :: 4928 4929 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000 4930 4931 Will dump output for any code in the 0x1000 sized block starting at 4932 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and 4933 another 0x1000 sized block starting at 0xffffffc00005f000. 4934ERST 4935 4936DEF("seed", HAS_ARG, QEMU_OPTION_seed, \ 4937 "-seed number seed the pseudo-random number generator\n", 4938 QEMU_ARCH_ALL) 4939SRST 4940``-seed number`` 4941 Force the guest to use a deterministic pseudo-random number 4942 generator, seeded with number. This does not affect crypto routines 4943 within the host. 4944ERST 4945 4946DEF("L", HAS_ARG, QEMU_OPTION_L, \ 4947 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n", 4948 QEMU_ARCH_ALL) 4949SRST 4950``-L path`` 4951 Set the directory for the BIOS, VGA BIOS and keymaps. 4952 4953 To list all the data directories, use ``-L help``. 4954ERST 4955 4956DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \ 4957 "-enable-kvm enable KVM full virtualization support\n", 4958 QEMU_ARCH_ARM | QEMU_ARCH_I386 | QEMU_ARCH_MIPS | QEMU_ARCH_PPC | 4959 QEMU_ARCH_RISCV | QEMU_ARCH_S390X) 4960SRST 4961``-enable-kvm`` 4962 Enable KVM full virtualization support. This option is only 4963 available if KVM support is enabled when compiling. 4964ERST 4965 4966DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid, 4967 "-xen-domid id specify xen guest domain id\n", 4968 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4969DEF("xen-attach", 0, QEMU_OPTION_xen_attach, 4970 "-xen-attach attach to existing xen domain\n" 4971 " libxl will use this when starting QEMU\n", 4972 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4973DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict, 4974 "-xen-domid-restrict restrict set of available xen operations\n" 4975 " to specified domain id. (Does not affect\n" 4976 " xenpv machine type).\n", 4977 QEMU_ARCH_ARM | QEMU_ARCH_I386) 4978SRST 4979``-xen-domid id`` 4980 Specify xen guest domain id (XEN only). 4981 4982``-xen-attach`` 4983 Attach to existing xen domain. libxl will use this when starting 4984 QEMU (XEN only). Restrict set of available xen operations to 4985 specified domain id (XEN only). 4986ERST 4987 4988DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \ 4989 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL) 4990SRST 4991``-no-reboot`` 4992 Exit instead of rebooting. 4993ERST 4994 4995DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \ 4996 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL) 4997SRST 4998``-no-shutdown`` 4999 Don't exit QEMU on guest shutdown, but instead only stop the 5000 emulation. This allows for instance switching to monitor to commit 5001 changes to the disk image. 5002ERST 5003 5004DEF("action", HAS_ARG, QEMU_OPTION_action, 5005 "-action reboot=reset|shutdown\n" 5006 " action when guest reboots [default=reset]\n" 5007 "-action shutdown=poweroff|pause\n" 5008 " action when guest shuts down [default=poweroff]\n" 5009 "-action panic=pause|shutdown|exit-failure|none\n" 5010 " action when guest panics [default=shutdown]\n" 5011 "-action watchdog=reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" 5012 " action when watchdog fires [default=reset]\n", 5013 QEMU_ARCH_ALL) 5014SRST 5015``-action event=action`` 5016 The action parameter serves to modify QEMU's default behavior when 5017 certain guest events occur. It provides a generic method for specifying the 5018 same behaviors that are modified by the ``-no-reboot`` and ``-no-shutdown`` 5019 parameters. 5020 5021 Examples: 5022 5023 ``-action panic=none`` 5024 ``-action reboot=shutdown,shutdown=pause`` 5025 ``-device i6300esb -action watchdog=pause`` 5026 5027ERST 5028 5029DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \ 5030 "-loadvm [tag|id]\n" \ 5031 " start right away with a saved state (loadvm in monitor)\n", 5032 QEMU_ARCH_ALL) 5033SRST 5034``-loadvm file`` 5035 Start right away with a saved state (``loadvm`` in monitor) 5036ERST 5037 5038#if !defined(_WIN32) && !defined(EMSCRIPTEN) 5039DEF("daemonize", 0, QEMU_OPTION_daemonize, \ 5040 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) 5041#endif 5042SRST 5043``-daemonize`` 5044 Daemonize the QEMU process after initialization. QEMU will not 5045 detach from standard IO until it is ready to receive connections on 5046 any of its devices. This option is a useful way for external 5047 programs to launch QEMU without having to cope with initialization 5048 race conditions. 5049ERST 5050 5051DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \ 5052 "-option-rom rom load a file, rom, into the option ROM space\n", 5053 QEMU_ARCH_ALL) 5054SRST 5055``-option-rom file`` 5056 Load the contents of file as an option ROM. This option is useful to 5057 load things like EtherBoot. 5058ERST 5059 5060DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \ 5061 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \ 5062 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n", 5063 QEMU_ARCH_ALL) 5064 5065SRST 5066``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]`` 5067 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at 5068 the current UTC or local time, respectively. ``localtime`` is 5069 required for correct date in MS-DOS or Windows. To start at a 5070 specific point in time, provide datetime in the format 5071 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC. 5072 5073 By default the RTC is driven by the host system time. This allows 5074 using of the RTC as accurate reference clock inside the guest, 5075 specifically if the host time is smoothly following an accurate 5076 external reference clock, e.g. via NTP. If you want to isolate the 5077 guest time from the host, you can set ``clock`` to ``rt`` instead, 5078 which provides a host monotonic clock if host support it. To even 5079 prevent the RTC from progressing during suspension, you can set 5080 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is 5081 recommended especially in icount mode in order to preserve 5082 determinism; however, note that in icount mode the speed of the 5083 virtual clock is variable and can in general differ from the host 5084 clock. 5085 5086 Enable ``driftfix`` (i386 targets only) if you experience time drift 5087 problems, specifically with Windows' ACPI HAL. This option will try 5088 to figure out how many timer interrupts were not processed by the 5089 Windows guest and will re-inject them. 5090ERST 5091 5092DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ 5093 "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=<filename>[,rrsnapshot=<snapshot>]]\n" \ 5094 " enable virtual instruction counter with 2^N clock ticks per\n" \ 5095 " instruction, enable aligning the host and virtual clocks\n" \ 5096 " or disable real time cpu sleeping, and optionally enable\n" \ 5097 " record-and-replay mode\n", QEMU_ARCH_ALL) 5098SRST 5099``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]`` 5100 Enable virtual instruction counter. The virtual cpu will execute one 5101 instruction every 2^N ns of virtual time. If ``auto`` is specified 5102 then the virtual cpu speed will be automatically adjusted to keep 5103 virtual time within a few seconds of real time. 5104 5105 Note that while this option can give deterministic behavior, it does 5106 not provide cycle accurate emulation. Modern CPUs contain 5107 superscalar out of order cores with complex cache hierarchies. The 5108 number of instructions executed often has little or no correlation 5109 with actual performance. 5110 5111 When the virtual cpu is sleeping, the virtual time will advance at 5112 default speed unless ``sleep=off`` is specified. With 5113 ``sleep=off``, the virtual time will jump to the next timer 5114 deadline instantly whenever the virtual cpu goes to sleep mode and 5115 will not advance if no timer is enabled. This behavior gives 5116 deterministic execution times from the guest point of view. 5117 The default if icount is enabled is ``sleep=on``. 5118 ``sleep=off`` cannot be used together with either ``shift=auto`` 5119 or ``align=on``. 5120 5121 ``align=on`` will activate the delay algorithm which will try to 5122 synchronise the host clock and the virtual clock. The goal is to 5123 have a guest running at the real frequency imposed by the shift 5124 option. Whenever the guest clock is behind the host clock and if 5125 ``align=on`` is specified then we print a message to the user to 5126 inform about the delay. Currently this option does not work when 5127 ``shift`` is ``auto``. Note: The sync algorithm will work for those 5128 shift values for which the guest clock runs ahead of the host clock. 5129 Typically this happens when the shift value is high (how high 5130 depends on the host machine). The default if icount is enabled 5131 is ``align=off``. 5132 5133 When the ``rr`` option is specified deterministic record/replay is 5134 enabled. The ``rrfile=`` option must also be provided to 5135 specify the path to the replay log. In record mode data is written 5136 to this file, and in replay mode it is read back. 5137 If the ``rrsnapshot`` option is given then it specifies a VM snapshot 5138 name. In record mode, a new VM snapshot with the given name is created 5139 at the start of execution recording. In replay mode this option 5140 specifies the snapshot name used to load the initial VM state. 5141ERST 5142 5143DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \ 5144 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \ 5145 " action when watchdog fires [default=reset]\n", 5146 QEMU_ARCH_ALL) 5147SRST 5148``-watchdog-action action`` 5149 The action controls what QEMU will do when the watchdog timer 5150 expires. The default is ``reset`` (forcefully reset the guest). 5151 Other possible actions are: ``shutdown`` (attempt to gracefully 5152 shutdown the guest), ``poweroff`` (forcefully poweroff the guest), 5153 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the 5154 guest), ``debug`` (print a debug message and continue), or ``none`` 5155 (do nothing). 5156 5157 Note that the ``shutdown`` action requires that the guest responds 5158 to ACPI signals, which it may not be able to do in the sort of 5159 situations where the watchdog would have expired, and thus 5160 ``-watchdog-action shutdown`` is not recommended for production use. 5161 5162 Examples: 5163 5164 ``-device i6300esb -watchdog-action pause`` 5165 5166ERST 5167 5168DEF("echr", HAS_ARG, QEMU_OPTION_echr, \ 5169 "-echr chr set terminal escape character instead of ctrl-a\n", 5170 QEMU_ARCH_ALL) 5171SRST 5172``-echr numeric_ascii_value`` 5173 Change the escape character used for switching to the monitor when 5174 using monitor and serial sharing. The default is ``0x01`` when using 5175 the ``-nographic`` option. ``0x01`` is equal to pressing 5176 ``Control-a``. You can select a different character from the ascii 5177 control keys where 1 through 26 map to Control-a through Control-z. 5178 For instance you could use the either of the following to change the 5179 escape character to Control-t. 5180 5181 ``-echr 0x14``; \ ``-echr 20`` 5182 5183ERST 5184 5185DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ 5186 "-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]\n" \ 5187 "-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]\n" \ 5188 "-incoming unix:socketpath\n" \ 5189 " prepare for incoming migration, listen on\n" \ 5190 " specified protocol and socket address\n" \ 5191 "-incoming fd:fd\n" \ 5192 "-incoming file:filename[,offset=offset]\n" \ 5193 "-incoming exec:cmdline\n" \ 5194 " accept incoming migration on given file descriptor\n" \ 5195 " or from given external command\n" \ 5196 "-incoming <channel>\n" \ 5197 " accept incoming migration on the migration channel\n" \ 5198 "-incoming defer\n" \ 5199 " wait for the URI to be specified via migrate_incoming\n", 5200 QEMU_ARCH_ALL) 5201SRST 5202The -incoming option specifies the migration channel for an incoming 5203migration. It may be used multiple times to specify multiple 5204migration channel types. The channel type is specified in <channel>, 5205or is 'main' for all other forms of -incoming. If multiple -incoming 5206options are specified for a channel type, the last one takes precedence. 5207 5208``-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]`` 5209 \ 5210``-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]`` 5211 Prepare for incoming migration, listen on a given tcp port. 5212 5213``-incoming unix:socketpath`` 5214 Prepare for incoming migration, listen on a given unix socket. 5215 5216``-incoming fd:fd`` 5217 Accept incoming migration from a given file descriptor. 5218 5219``-incoming file:filename[,offset=offset]`` 5220 Accept incoming migration from a given file starting at offset. 5221 offset allows the common size suffixes, or a 0x prefix, but not both. 5222 5223``-incoming exec:cmdline`` 5224 Accept incoming migration as an output from specified external 5225 command. 5226 5227``-incoming <channel>`` 5228 Accept incoming migration on the migration channel. For the syntax 5229 of <channel>, see the QAPI documentation of ``MigrationChannel``. 5230 Examples: 5231 :: 5232 5233 -incoming '{"channel-type": "main", 5234 "addr": { "transport": "socket", 5235 "type": "unix", 5236 "path": "my.sock" }}' 5237 5238 -incoming main,addr.transport=socket,addr.type=unix,addr.path=my.sock 5239 5240``-incoming defer`` 5241 Wait for the URI to be specified via migrate\_incoming. The monitor 5242 can be used to change settings (such as migration parameters) prior 5243 to issuing the migrate\_incoming to allow the migration to begin. 5244ERST 5245 5246DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \ 5247 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL) 5248SRST 5249``-only-migratable`` 5250 Only allow migratable devices. Devices will not be allowed to enter 5251 an unmigratable state. 5252ERST 5253 5254DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \ 5255 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL) 5256SRST 5257``-nodefaults`` 5258 Don't create default devices. Normally, QEMU sets the default 5259 devices like serial port, parallel port, virtual console, monitor 5260 device, VGA adapter, floppy and CD-ROM drive and others. The 5261 ``-nodefaults`` option will disable all those default devices. 5262ERST 5263 5264DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env, 5265 "-prom-env variable=value\n" 5266 " set OpenBIOS nvram variables\n", 5267 QEMU_ARCH_PPC | QEMU_ARCH_SPARC) 5268SRST 5269``-prom-env variable=value`` 5270 Set OpenBIOS nvram variable to given value (PPC, SPARC only). 5271 5272 :: 5273 5274 qemu-system-sparc -prom-env 'auto-boot?=false' \ 5275 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single' 5276 5277 :: 5278 5279 qemu-system-ppc -prom-env 'auto-boot?=false' \ 5280 -prom-env 'boot-device=hd:2,\yaboot' \ 5281 -prom-env 'boot-args=conf=hd:2,\yaboot.conf' 5282ERST 5283DEF("semihosting", 0, QEMU_OPTION_semihosting, 5284 "-semihosting semihosting mode\n", 5285 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | 5286 QEMU_ARCH_MIPS | QEMU_ARCH_RISCV) 5287SRST 5288``-semihosting`` 5289 Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, RISC-V only). 5290 5291 .. warning:: 5292 Note that this allows guest direct access to the host filesystem, so 5293 should only be used with a trusted guest OS. 5294 5295 See the -semihosting-config option documentation for further 5296 information about the facilities this enables. 5297ERST 5298DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config, 5299 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]\n" \ 5300 " semihosting configuration\n", 5301QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | 5302QEMU_ARCH_MIPS | QEMU_ARCH_RISCV) 5303SRST 5304``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]`` 5305 Enable and configure :ref:`Semihosting` (ARM, M68K, Xtensa, MIPS, RISC-V 5306 only). 5307 5308 .. warning:: 5309 Note that this allows guest direct access to the host filesystem, so 5310 should only be used with a trusted guest OS. 5311 5312 ``target=native|gdb|auto`` 5313 Defines where the semihosting calls will be addressed, to QEMU 5314 (``native``) or to GDB (``gdb``). The default is ``auto``, which 5315 means ``gdb`` during debug sessions and ``native`` otherwise. 5316 5317 ``chardev=str1`` 5318 Send the output to a chardev backend output for native or auto 5319 output when not in gdb 5320 5321 ``userspace=on|off`` 5322 Allows code running in guest userspace to access the semihosting 5323 interface. The default is that only privileged guest code can 5324 make semihosting calls. Note that setting ``userspace=on`` should 5325 only be used if all guest code is trusted (for example, in 5326 bare-metal test case code). 5327 5328 ``arg=str1,arg=str2,...`` 5329 Allows the user to pass input arguments, and can be used 5330 multiple times to build up a list. The old-style 5331 ``-kernel``/``-append`` method of passing a command line is 5332 still supported for backward compatibility. If both the 5333 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are 5334 specified, the former is passed to semihosting as it always 5335 takes precedence. 5336ERST 5337DEF("old-param", 0, QEMU_OPTION_old_param, 5338 "-old-param old param mode\n", QEMU_ARCH_ARM) 5339SRST 5340``-old-param`` 5341 Old param mode (ARM only). 5342ERST 5343 5344DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \ 5345 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \ 5346 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \ 5347 " Enable seccomp mode 2 system call filter (default 'off').\n" \ 5348 " use 'obsolete' to allow obsolete system calls that are provided\n" \ 5349 " by the kernel, but typically no longer used by modern\n" \ 5350 " C library implementations.\n" \ 5351 " use 'elevateprivileges' to allow or deny the QEMU process ability\n" \ 5352 " to elevate privileges using set*uid|gid system calls.\n" \ 5353 " The value 'children' will deny set*uid|gid system calls for\n" \ 5354 " main QEMU process but will allow forks and execves to run unprivileged\n" \ 5355 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \ 5356 " blocking *fork and execve\n" \ 5357 " use 'resourcecontrol' to disable process affinity and schedular priority\n", 5358 QEMU_ARCH_ALL) 5359SRST 5360``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]`` 5361 Enable Seccomp mode 2 system call filter. 'on' will enable syscall 5362 filtering and 'off' will disable it. The default is 'off'. 5363 5364 ``obsolete=string`` 5365 Enable Obsolete system calls 5366 5367 ``elevateprivileges=string`` 5368 Disable set\*uid\|gid system calls 5369 5370 ``spawn=string`` 5371 Disable \*fork and execve 5372 5373 ``resourcecontrol=string`` 5374 Disable process affinity and schedular priority 5375ERST 5376 5377DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig, 5378 "-readconfig <file>\n" 5379 " read config file\n", QEMU_ARCH_ALL) 5380SRST 5381``-readconfig file`` 5382 Read device configuration from file. This approach is useful when 5383 you want to spawn QEMU process with many command line options but 5384 you don't want to exceed the command line character limit. 5385ERST 5386 5387DEF("no-user-config", 0, QEMU_OPTION_nouserconfig, 5388 "-no-user-config\n" 5389 " do not load default user-provided config files at startup\n", 5390 QEMU_ARCH_ALL) 5391SRST 5392``-no-user-config`` 5393 The ``-no-user-config`` option makes QEMU not load any of the 5394 user-provided config files on sysconfdir. 5395ERST 5396 5397DEF("trace", HAS_ARG, QEMU_OPTION_trace, 5398 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" 5399 " specify tracing options\n", 5400 QEMU_ARCH_ALL) 5401SRST 5402``-trace [[enable=]pattern][,events=file][,file=file]`` 5403 .. include:: ../qemu-option-trace.rst.inc 5404 5405ERST 5406DEF("plugin", HAS_ARG, QEMU_OPTION_plugin, 5407 "-plugin [file=]<file>[,<argname>=<argvalue>]\n" 5408 " load a plugin\n", 5409 QEMU_ARCH_ALL) 5410SRST 5411``-plugin file=file[,argname=argvalue]`` 5412 Load a plugin. 5413 5414 ``file=file`` 5415 Load the given plugin from a shared library file. 5416 5417 ``argname=argvalue`` 5418 Argument passed to the plugin. (Can be given multiple times.) 5419ERST 5420 5421HXCOMM Internal use 5422DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) 5423DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL) 5424 5425#if defined(CONFIG_POSIX) && !defined(EMSCRIPTEN) 5426DEF("run-with", HAS_ARG, QEMU_OPTION_run_with, 5427 "-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]\n" 5428 " Set miscellaneous QEMU process lifecycle options:\n" 5429 " async-teardown=on enables asynchronous teardown (Linux only)\n" 5430 " chroot=dir chroot to dir just before starting the VM\n" 5431 " user=username switch to the specified user before starting the VM\n" 5432 " user=uid:gid ditto, but use specified user-ID and group-ID instead\n", 5433 QEMU_ARCH_ALL) 5434SRST 5435``-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]`` 5436 Set QEMU process lifecycle options. 5437 5438 ``async-teardown=on`` enables asynchronous teardown. A new process called 5439 "cleanup/<QEMU_PID>" will be created at startup sharing the address 5440 space with the main QEMU process, using clone. It will wait for the 5441 main QEMU process to terminate completely, and then exit. This allows 5442 QEMU to terminate very quickly even if the guest was huge, leaving the 5443 teardown of the address space to the cleanup process. Since the cleanup 5444 process shares the same cgroups as the main QEMU process, accounting is 5445 performed correctly. This only works if the cleanup process is not 5446 forcefully killed with SIGKILL before the main QEMU process has 5447 terminated completely. 5448 5449 ``chroot=dir`` can be used for doing a chroot to the specified directory 5450 immediately before starting the guest execution. This is especially useful 5451 in combination with ``user=...``. 5452 5453 ``user=username`` or ``user=uid:gid`` can be used to drop root privileges 5454 before starting guest execution. QEMU will use the ``setuid`` and ``setgid`` 5455 system calls to switch to the specified identity. Note that the 5456 ``user=username`` syntax will also apply the full set of supplementary 5457 groups for the user, whereas the ``user=uid:gid`` will use only the 5458 ``gid`` group. 5459ERST 5460#endif 5461 5462DEF("msg", HAS_ARG, QEMU_OPTION_msg, 5463 "-msg [timestamp[=on|off]][,guest-name=[on|off]]\n" 5464 " control error message format\n" 5465 " timestamp=on enables timestamps (default: off)\n" 5466 " guest-name=on enables guest name prefix but only if\n" 5467 " -name guest option is set (default: off)\n", 5468 QEMU_ARCH_ALL) 5469SRST 5470``-msg [timestamp[=on|off]][,guest-name[=on|off]]`` 5471 Control error message format. 5472 5473 ``timestamp=on|off`` 5474 Prefix messages with a timestamp. Default is off. 5475 5476 ``guest-name=on|off`` 5477 Prefix messages with guest name but only if -name guest option is set 5478 otherwise the option is ignored. Default is off. 5479ERST 5480 5481DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate, 5482 "-dump-vmstate <file>\n" 5483 " Output vmstate information in JSON format to file.\n" 5484 " Use the scripts/vmstate-static-checker.py file to\n" 5485 " check for possible regressions in migration code\n" 5486 " by comparing two such vmstate dumps.\n", 5487 QEMU_ARCH_ALL) 5488SRST 5489``-dump-vmstate file`` 5490 Dump json-encoded vmstate information for current machine type to 5491 file in file 5492ERST 5493 5494DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile, 5495 "-enable-sync-profile\n" 5496 " enable synchronization profiling\n", 5497 QEMU_ARCH_ALL) 5498SRST 5499``-enable-sync-profile`` 5500 Enable synchronization profiling. 5501ERST 5502 5503#if defined(CONFIG_TCG) && defined(CONFIG_LINUX) 5504DEF("perfmap", 0, QEMU_OPTION_perfmap, 5505 "-perfmap generate a /tmp/perf-${pid}.map file for perf\n", 5506 QEMU_ARCH_ALL) 5507SRST 5508``-perfmap`` 5509 Generate a map file for Linux perf tools that will allow basic profiling 5510 information to be broken down into basic blocks. 5511ERST 5512 5513DEF("jitdump", 0, QEMU_OPTION_jitdump, 5514 "-jitdump generate a jit-${pid}.dump file for perf\n", 5515 QEMU_ARCH_ALL) 5516SRST 5517``-jitdump`` 5518 Generate a dump file for Linux perf tools that maps basic blocks to symbol 5519 names, line numbers and JITted code. 5520ERST 5521#endif 5522 5523DEFHEADING() 5524 5525DEFHEADING(Generic object creation:) 5526 5527DEF("object", HAS_ARG, QEMU_OPTION_object, 5528 "-object TYPENAME[,PROP1=VALUE1,...]\n" 5529 " create a new object of type TYPENAME setting properties\n" 5530 " in the order they are specified. Note that the 'id'\n" 5531 " property must be set. These objects are placed in the\n" 5532 " '/objects' path.\n", 5533 QEMU_ARCH_ALL) 5534SRST 5535``-object typename[,prop1=value1,...]`` 5536 Create a new object of type typename setting properties in the order 5537 they are specified. Note that the 'id' property must be set. These 5538 objects are placed in the '/objects' path. 5539 5540 ``-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`` 5541 Creates a memory file backend object, which can be used to back 5542 the guest RAM with huge pages. 5543 5544 The ``id`` parameter is a unique ID that will be used to 5545 reference this memory region in other parameters, e.g. ``-numa``, 5546 ``-device nvdimm``, etc. 5547 5548 The ``size`` option provides the size of the memory region, and 5549 accepts common suffixes, e.g. ``500M``. 5550 5551 The ``mem-path`` provides the path to either a shared memory or 5552 huge page filesystem mount. 5553 5554 The ``share`` boolean option determines whether the memory 5555 region is marked as private to QEMU, or shared. The latter 5556 allows a co-operating external process to access the QEMU memory 5557 region. 5558 5559 Setting share=on might affect the ability to configure NUMA 5560 bindings for the memory backend under some circumstances, see 5561 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel 5562 source tree for additional details. 5563 5564 Setting the ``discard-data`` boolean option to on indicates that 5565 file contents can be destroyed when QEMU exits, to avoid 5566 unnecessarily flushing data to the backing file. Note that 5567 ``discard-data`` is only an optimization, and QEMU might not 5568 discard file contents if it aborts unexpectedly or is terminated 5569 using SIGKILL. 5570 5571 The ``merge`` boolean option enables memory merge, also known as 5572 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider 5573 the pages for memory deduplication. 5574 5575 Setting the ``dump`` boolean option to off excludes the memory 5576 from core dumps. This feature is also known as MADV\_DONTDUMP. 5577 5578 The ``prealloc`` boolean option enables memory preallocation. 5579 5580 The ``host-nodes`` option binds the memory range to a list of 5581 NUMA host nodes. 5582 5583 The ``policy`` option sets the NUMA policy to one of the 5584 following values: 5585 5586 ``default`` 5587 default host policy 5588 5589 ``preferred`` 5590 prefer the given host node list for allocation 5591 5592 ``bind`` 5593 restrict memory allocation to the given host node list 5594 5595 ``interleave`` 5596 interleave memory allocations across the given host node 5597 list 5598 5599 The ``align`` option specifies the base address alignment when 5600 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg 5601 ``2M``. Some backend store specified by ``mem-path`` requires an 5602 alignment different than the default one used by QEMU, eg the 5603 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In 5604 such cases, users can specify the required alignment via this 5605 option. 5606 5607 The ``offset`` option specifies the offset into the target file 5608 that the region starts at. You can use this parameter to back 5609 multiple regions with a single file. 5610 5611 The ``pmem`` option specifies whether the backing file specified 5612 by ``mem-path`` is in host persistent memory that can be 5613 accessed using the SNIA NVM programming model (e.g. Intel 5614 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary 5615 operations to guarantee the persistence of its own writes to 5616 ``mem-path`` (e.g. in vNVDIMM label emulation and live 5617 migration). Also, we will map the backend-file with MAP\_SYNC 5618 flag, which ensures the file metadata is in sync for 5619 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC 5620 requires support from both the host kernel (since Linux kernel 5621 4.15) and the filesystem of ``mem-path`` mounted with DAX 5622 option. 5623 5624 The ``readonly`` option specifies whether the backing file is opened 5625 read-only or read-write (default). 5626 5627 The ``rom`` option specifies whether to create Read Only Memory 5628 (ROM) that cannot be modified by the VM. Any write attempts to such 5629 ROM will be denied. Most use cases want proper RAM instead of ROM. 5630 However, selected use cases, like R/O NVDIMMs, can benefit from 5631 ROM. If set to ``on``, create ROM; if set to ``off``, create 5632 writable RAM; if set to ``auto`` (default), the value of the 5633 ``readonly`` option is used. This option is primarily helpful when 5634 we want to have writable RAM in configurations that would 5635 traditionally create ROM before the ``rom`` option was introduced: 5636 VM templating, where we want to open a file readonly 5637 (``readonly=on``) and mark the memory to be private for QEMU 5638 (``share=off``). For this use case, we need writable RAM instead 5639 of ROM, and want to also set ``rom=off``. 5640 5641 ``-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`` 5642 Creates a memory backend object, which can be used to back the 5643 guest RAM. Memory backend objects offer more control than the 5644 ``-m`` option that is traditionally used to define guest RAM. 5645 Please refer to ``memory-backend-file`` for a description of the 5646 options. 5647 5648 ``-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`` 5649 Creates an anonymous memory file backend object, which allows 5650 QEMU to share the memory with an external process (e.g. when 5651 using vhost-user). The memory is allocated with memfd and 5652 optional sealing. (Linux only) 5653 5654 The ``seal`` option creates a sealed-file, that will block 5655 further resizing the memory ('on' by default). 5656 5657 The ``hugetlb`` option specify the file to be created resides in 5658 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction 5659 with the ``hugetlb`` option, the ``hugetlbsize`` option specify 5660 the hugetlb page size on systems that support multiple hugetlb 5661 page sizes (it must be a power of 2 value supported by the 5662 system). 5663 5664 In some versions of Linux, the ``hugetlb`` option is 5665 incompatible with the ``seal`` option (requires at least Linux 5666 4.16). 5667 5668 Please refer to ``memory-backend-file`` for a description of the 5669 other options. 5670 5671 The ``share`` boolean option is on by default with memfd. 5672 5673 ``-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`` 5674 Creates a POSIX shared memory backend object, which allows 5675 QEMU to share the memory with an external process (e.g. when 5676 using vhost-user). 5677 5678 ``memory-backend-shm`` is a more portable and less featureful version 5679 of ``memory-backend-memfd``. It can then be used in any POSIX system, 5680 especially when memfd is not supported. 5681 5682 Please refer to ``memory-backend-file`` for a description of the 5683 options. 5684 5685 The ``share`` boolean option is on by default with shm. Setting it to 5686 off will cause a failure during allocation because it is not supported 5687 by this backend. 5688 5689 ``-object iommufd,id=id[,fd=fd]`` 5690 Creates an iommufd backend which allows control of DMA mapping 5691 through the ``/dev/iommu`` device. 5692 5693 The ``id`` parameter is a unique ID which frontends (such as 5694 vfio-pci of vdpa) will use to connect with the iommufd backend. 5695 5696 The ``fd`` parameter is an optional pre-opened file descriptor 5697 resulting from ``/dev/iommu`` opening. Usually the iommufd is shared 5698 across all subsystems, bringing the benefit of centralized 5699 reference counting. 5700 5701 ``-object rng-builtin,id=id`` 5702 Creates a random number generator backend which obtains entropy 5703 from QEMU builtin functions. The ``id`` parameter is a unique ID 5704 that will be used to reference this entropy backend from the 5705 ``virtio-rng`` device. By default, the ``virtio-rng`` device 5706 uses this RNG backend. 5707 5708 ``-object rng-random,id=id,filename=/dev/random`` 5709 Creates a random number generator backend which obtains entropy 5710 from a device on the host. The ``id`` parameter is a unique ID 5711 that will be used to reference this entropy backend from the 5712 ``virtio-rng`` device. The ``filename`` parameter specifies 5713 which file to obtain entropy from and if omitted defaults to 5714 ``/dev/urandom``. 5715 5716 ``-object rng-egd,id=id,chardev=chardevid`` 5717 Creates a random number generator backend which obtains entropy 5718 from an external daemon running on the host. The ``id`` 5719 parameter is a unique ID that will be used to reference this 5720 entropy backend from the ``virtio-rng`` device. The ``chardev`` 5721 parameter is the unique ID of a character device backend that 5722 provides the connection to the RNG daemon. 5723 5724 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off`` 5725 Creates a TLS anonymous credentials object, which can be used to 5726 provide TLS support on network backends. The ``id`` parameter is 5727 a unique ID which network backends will use to access the 5728 credentials. The ``endpoint`` is either ``server`` or ``client`` 5729 depending on whether the QEMU network backend that uses the 5730 credentials will be acting as a client or as a server. If 5731 ``verify-peer`` is enabled (the default) then once the handshake 5732 is completed, the peer credentials will be verified, though this 5733 is a no-op for anonymous credentials. 5734 5735 The dir parameter tells QEMU where to find the credential files. 5736 For server endpoints, this directory may contain a file 5737 dh-params.pem providing diffie-hellman parameters to use for the 5738 TLS server. If the file is missing, QEMU will generate a set of 5739 DH parameters at startup. This is a computationally expensive 5740 operation that consumes random pool entropy, so it is 5741 recommended that a persistent set of parameters be generated 5742 upfront and saved. 5743 5744 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]`` 5745 Creates a TLS Pre-Shared Keys (PSK) credentials object, which 5746 can be used to provide TLS support on network backends. The 5747 ``id`` parameter is a unique ID which network backends will use 5748 to access the credentials. The ``endpoint`` is either ``server`` 5749 or ``client`` depending on whether the QEMU network backend that 5750 uses the credentials will be acting as a client or as a server. 5751 For clients only, ``username`` is the username which will be 5752 sent to the server. If omitted it defaults to "qemu". 5753 5754 The dir parameter tells QEMU where to find the keys file. It is 5755 called "dir/keys.psk" and contains "username:key" pairs. This 5756 file can most easily be created using the GnuTLS ``psktool`` 5757 program. 5758 5759 For server endpoints, dir may also contain a file dh-params.pem 5760 providing diffie-hellman parameters to use for the TLS server. 5761 If the file is missing, QEMU will generate a set of DH 5762 parameters at startup. This is a computationally expensive 5763 operation that consumes random pool entropy, so it is 5764 recommended that a persistent set of parameters be generated up 5765 front and saved. 5766 5767 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id`` 5768 Creates a TLS anonymous credentials object, which can be used to 5769 provide TLS support on network backends. The ``id`` parameter is 5770 a unique ID which network backends will use to access the 5771 credentials. The ``endpoint`` is either ``server`` or ``client`` 5772 depending on whether the QEMU network backend that uses the 5773 credentials will be acting as a client or as a server. If 5774 ``verify-peer`` is enabled (the default) then once the handshake 5775 is completed, the peer credentials will be verified. With x509 5776 certificates, this implies that the clients must be provided 5777 with valid client certificates too. 5778 5779 The dir parameter tells QEMU where to find the credential files. 5780 For server endpoints, this directory may contain a file 5781 dh-params.pem providing diffie-hellman parameters to use for the 5782 TLS server. If the file is missing, QEMU will generate a set of 5783 DH parameters at startup. This is a computationally expensive 5784 operation that consumes random pool entropy, so it is 5785 recommended that a persistent set of parameters be generated 5786 upfront and saved. 5787 5788 For x509 certificate credentials the directory will contain 5789 further files providing the x509 certificates. The certificates 5790 must be stored in PEM format, in filenames ca-cert.pem, 5791 ca-crl.pem (optional), server-cert.pem (only servers), 5792 server-key.pem (only servers), client-cert.pem (only clients), 5793 and client-key.pem (only clients). 5794 5795 For the server-key.pem and client-key.pem files which contain 5796 sensitive private keys, it is possible to use an encrypted 5797 version by providing the passwordid parameter. This provides the 5798 ID of a previously created ``secret`` object containing the 5799 password for decryption. 5800 5801 The priority parameter allows to override the global default 5802 priority used by gnutls. This can be useful if the system 5803 administrator needs to use a weaker set of crypto priorities for 5804 QEMU without potentially forcing the weakness onto all 5805 applications. Or conversely if one wants wants a stronger 5806 default for QEMU than for all other applications, they can do 5807 this through this parameter. Its format is a gnutls priority 5808 string as described at 5809 https://gnutls.org/manual/html_node/Priority-Strings.html. 5810 5811 ``-object tls-cipher-suites,id=id,priority=priority`` 5812 Creates a TLS cipher suites object, which can be used to control 5813 the TLS cipher/protocol algorithms that applications are permitted 5814 to use. 5815 5816 The ``id`` parameter is a unique ID which frontends will use to 5817 access the ordered list of permitted TLS cipher suites from the 5818 host. 5819 5820 The ``priority`` parameter allows to override the global default 5821 priority used by gnutls. This can be useful if the system 5822 administrator needs to use a weaker set of crypto priorities for 5823 QEMU without potentially forcing the weakness onto all 5824 applications. Or conversely if one wants wants a stronger 5825 default for QEMU than for all other applications, they can do 5826 this through this parameter. Its format is a gnutls priority 5827 string as described at 5828 https://gnutls.org/manual/html_node/Priority-Strings.html. 5829 5830 An example of use of this object is to control UEFI HTTPS Boot. 5831 The tls-cipher-suites object exposes the ordered list of permitted 5832 TLS cipher suites from the host side to the guest firmware, via 5833 fw_cfg. The list is represented as an array of IANA_TLS_CIPHER 5834 objects. The firmware uses the IANA_TLS_CIPHER array for configuring 5835 guest-side TLS. 5836 5837 In the following example, the priority at which the host-side policy 5838 is retrieved is given by the ``priority`` property. 5839 Given that QEMU uses GNUTLS, ``priority=@SYSTEM`` may be used to 5840 refer to /etc/crypto-policies/back-ends/gnutls.config. 5841 5842 .. parsed-literal:: 5843 5844 # |qemu_system| \\ 5845 -object tls-cipher-suites,id=mysuite0,priority=@SYSTEM \\ 5846 -fw_cfg name=etc/edk2/https/ciphers,gen_id=mysuite0 5847 5848 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]`` 5849 Interval t can't be 0, this filter batches the packet delivery: 5850 all packets arriving in a given interval on netdev netdevid are 5851 delayed until the end of the interval. Interval is in 5852 microseconds. ``status`` is optional that indicate whether the 5853 netfilter is on (enabled) or off (disabled), the default status 5854 for netfilter will be 'on'. 5855 5856 queue all\|rx\|tx is an option that can be applied to any 5857 netfilter. 5858 5859 ``all``: the filter is attached both to the receive and the 5860 transmit queue of the netdev (default). 5861 5862 ``rx``: the filter is attached to the receive queue of the 5863 netdev, where it will receive packets sent to the netdev. 5864 5865 ``tx``: the filter is attached to the transmit queue of the 5866 netdev, where it will receive packets sent by the netdev. 5867 5868 position head\|tail\|id=<id> is an option to specify where the 5869 filter should be inserted in the filter list. It can be applied 5870 to any netfilter. 5871 5872 ``head``: the filter is inserted at the head of the filter list, 5873 before any existing filters. 5874 5875 ``tail``: the filter is inserted at the tail of the filter list, 5876 behind any existing filters (default). 5877 5878 ``id=<id>``: the filter is inserted before or behind the filter 5879 specified by <id>, see the insert option below. 5880 5881 insert behind\|before is an option to specify where to insert 5882 the new filter relative to the one specified with 5883 position=id=<id>. It can be applied to any netfilter. 5884 5885 ``before``: insert before the specified filter. 5886 5887 ``behind``: insert behind the specified filter (default). 5888 5889 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]`` 5890 filter-mirror on netdev netdevid,mirror net packet to 5891 chardevchardevid, if it has the vnet\_hdr\_support flag, 5892 filter-mirror will mirror packet with vnet\_hdr\_len. 5893 5894 ``-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]`` 5895 filter-redirector on netdev netdevid,redirect filter's net 5896 packet to chardev chardevid,and redirect indev's packet to 5897 filter.if it has the vnet\_hdr\_support flag, filter-redirector 5898 will redirect packet with vnet\_hdr\_len. Create a 5899 filter-redirector we need to differ outdev id from indev id, id 5900 can not be the same. we can just use indev or outdev, but at 5901 least one of indev or outdev need to be specified. 5902 5903 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]`` 5904 Filter-rewriter is a part of COLO project.It will rewrite tcp 5905 packet to secondary from primary to keep secondary tcp 5906 connection,and rewrite tcp packet to primary from secondary make 5907 tcp packet can be handled by client.if it has the 5908 vnet\_hdr\_support flag, we can parse packet with vnet header. 5909 5910 usage: colo secondary: -object 5911 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object 5912 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object 5913 filter-rewriter,id=rew0,netdev=hn0,queue=all 5914 5915 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]`` 5916 Dump the network traffic on netdev dev to the file specified by 5917 filename. At most len bytes (64k by default) per packet are 5918 stored. The file format is libpcap, so it can be analyzed with 5919 tools such as tcpdump or Wireshark. 5920 5921 ``-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}]`` 5922 Colo-compare gets packet from primary\_in chardevid and 5923 secondary\_in, then compare whether the payload of primary packet 5924 and secondary packet are the same. If same, it will output 5925 primary packet to out\_dev, else it will notify COLO-framework to do 5926 checkpoint and send primary packet to out\_dev. In order to 5927 improve efficiency, we need to put the task of comparison in 5928 another iothread. If it has the vnet\_hdr\_support flag, 5929 colo compare will send/recv packet with vnet\_hdr\_len. 5930 The compare\_timeout=@var{ms} determines the maximum time of the 5931 colo-compare hold the packet. The expired\_scan\_cycle=@var{ms} 5932 is to set the period of scanning expired primary node network packets. 5933 The max\_queue\_size=@var{size} is to set the max compare queue 5934 size depend on user environment. 5935 If user want to use Xen COLO, need to add the notify\_dev to 5936 notify Xen colo-frame to do checkpoint. 5937 5938 COLO-compare must be used with the help of filter-mirror, 5939 filter-redirector and filter-rewriter. 5940 5941 :: 5942 5943 KVM COLO 5944 5945 primary: 5946 -netdev tap,id=hn0,vhost=off 5947 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 5948 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off 5949 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off 5950 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off 5951 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001 5952 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off 5953 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005 5954 -object iothread,id=iothread1 5955 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0 5956 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out 5957 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0 5958 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1 5959 5960 secondary: 5961 -netdev tap,id=hn0,vhost=off 5962 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 5963 -chardev socket,id=red0,host=3.3.3.3,port=9003 5964 -chardev socket,id=red1,host=3.3.3.3,port=9004 5965 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 5966 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 5967 5968 5969 Xen COLO 5970 5971 primary: 5972 -netdev tap,id=hn0,vhost=off 5973 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66 5974 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off 5975 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off 5976 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off 5977 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001 5978 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off 5979 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005 5980 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server=on,wait=off 5981 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0 5982 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out 5983 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0 5984 -object iothread,id=iothread1 5985 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=notify_way,iothread=iothread1 5986 5987 secondary: 5988 -netdev tap,id=hn0,vhost=off 5989 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66 5990 -chardev socket,id=red0,host=3.3.3.3,port=9003 5991 -chardev socket,id=red1,host=3.3.3.3,port=9004 5992 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 5993 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 5994 5995 If you want to know the detail of above command line, you can 5996 read the colo-compare git log. 5997 5998 ``-object cryptodev-backend-builtin,id=id[,queues=queues]`` 5999 Creates a cryptodev backend which executes crypto operations from 6000 the QEMU cipher APIs. The id parameter is a unique ID that will 6001 be used to reference this cryptodev backend from the 6002 ``virtio-crypto`` device. The queues parameter is optional, 6003 which specify the queue number of cryptodev backend, the default 6004 of queues is 1. 6005 6006 .. parsed-literal:: 6007 6008 # |qemu_system| \\ 6009 [...] \\ 6010 -object cryptodev-backend-builtin,id=cryptodev0 \\ 6011 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\ 6012 [...] 6013 6014 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]`` 6015 Creates a vhost-user cryptodev backend, backed by a chardev 6016 chardevid. The id parameter is a unique ID that will be used to 6017 reference this cryptodev backend from the ``virtio-crypto`` 6018 device. The chardev should be a unix domain socket backed one. 6019 The vhost-user uses a specifically defined protocol to pass 6020 vhost ioctl replacement messages to an application on the other 6021 end of the socket. The queues parameter is optional, which 6022 specify the queue number of cryptodev backend for multiqueue 6023 vhost-user, the default of queues is 1. 6024 6025 .. parsed-literal:: 6026 6027 # |qemu_system| \\ 6028 [...] \\ 6029 -chardev socket,id=chardev0,path=/path/to/socket \\ 6030 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \\ 6031 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\ 6032 [...] 6033 6034 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]`` 6035 \ 6036 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]`` 6037 Defines a secret to store a password, encryption key, or some 6038 other sensitive data. The sensitive data can either be passed 6039 directly via the data parameter, or indirectly via the file 6040 parameter. Using the data parameter is insecure unless the 6041 sensitive data is encrypted. 6042 6043 The sensitive data can be provided in raw format (the default), 6044 or base64. When encoded as JSON, the raw format only supports 6045 valid UTF-8 characters, so base64 is recommended for sending 6046 binary data. QEMU will convert from which ever format is 6047 provided to the format it needs internally. eg, an RBD password 6048 can be provided in raw format, even though it will be base64 6049 encoded when passed onto the RBD sever. 6050 6051 For added protection, it is possible to encrypt the data 6052 associated with a secret using the AES-256-CBC cipher. Use of 6053 encryption is indicated by providing the keyid and iv 6054 parameters. The keyid parameter provides the ID of a previously 6055 defined secret that contains the AES-256 decryption key. This 6056 key should be 32-bytes long and be base64 encoded. The iv 6057 parameter provides the random initialization vector used for 6058 encryption of this particular secret and should be a base64 6059 encrypted string of the 16-byte IV. 6060 6061 The simplest (insecure) usage is to provide the secret inline 6062 6063 .. parsed-literal:: 6064 6065 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw 6066 6067 The simplest secure usage is to provide the secret via a file 6068 6069 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object 6070 secret,id=sec0,file=mypasswd.txt,format=raw 6071 6072 For greater security, AES-256-CBC should be used. To illustrate 6073 usage, consider the openssl command line tool which can encrypt 6074 the data. Note that when encrypting, the plaintext must be 6075 padded to the cipher block size (32 bytes) using the standard 6076 PKCS#5/6 compatible padding algorithm. 6077 6078 First a master key needs to be created in base64 encoding: 6079 6080 :: 6081 6082 # openssl rand -base64 32 > key.b64 6083 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"') 6084 6085 Each secret to be encrypted needs to have a random 6086 initialization vector generated. These do not need to be kept 6087 secret 6088 6089 :: 6090 6091 # openssl rand -base64 16 > iv.b64 6092 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"') 6093 6094 The secret to be defined can now be encrypted, in this case 6095 we're telling openssl to base64 encode the result, but it could 6096 be left as raw bytes if desired. 6097 6098 :: 6099 6100 # SECRET=$(printf "letmein" | 6101 openssl enc -aes-256-cbc -a -K $KEY -iv $IV) 6102 6103 When launching QEMU, create a master secret pointing to 6104 ``key.b64`` and specify that to be used to decrypt the user 6105 password. Pass the contents of ``iv.b64`` to the second secret 6106 6107 .. parsed-literal:: 6108 6109 # |qemu_system| \\ 6110 -object secret,id=secmaster0,format=base64,file=key.b64 \\ 6111 -object secret,id=sec0,keyid=secmaster0,format=base64,\\ 6112 data=$SECRET,iv=$(<iv.b64) 6113 6114 ``-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]`` 6115 Create a Secure Encrypted Virtualization (SEV) guest object, 6116 which can be used to provide the guest memory encryption support 6117 on AMD processors. 6118 6119 When memory encryption is enabled, one of the physical address 6120 bit (aka the C-bit) is utilized to mark if a memory page is 6121 protected. The ``cbitpos`` is used to provide the C-bit 6122 position. The C-bit position is Host family dependent hence user 6123 must provide this value. On EPYC, the value should be 47. 6124 6125 When memory encryption is enabled, we loose certain bits in 6126 physical address space. The ``reduced-phys-bits`` is used to 6127 provide the number of bits we loose in physical address space. 6128 Similar to C-bit, the value is Host family dependent. On EPYC, 6129 a guest will lose a maximum of 1 bit, so the value should be 1. 6130 6131 The ``sev-device`` provides the device file to use for 6132 communicating with the SEV firmware running inside AMD Secure 6133 Processor. The default device is '/dev/sev'. If hardware 6134 supports memory encryption then /dev/sev devices are created by 6135 CCP driver. 6136 6137 The ``policy`` provides the guest policy to be enforced by the 6138 SEV firmware and restrict what configuration and operational 6139 commands can be performed on this guest by the hypervisor. The 6140 policy should be provided by the guest owner and is bound to the 6141 guest and cannot be changed throughout the lifetime of the 6142 guest. The default is 0. 6143 6144 If guest ``policy`` allows sharing the key with another SEV 6145 guest then ``handle`` can be use to provide handle of the guest 6146 from which to share the key. 6147 6148 The ``dh-cert-file`` and ``session-file`` provides the guest 6149 owner's Public Diffie-Hillman key defined in SEV spec. The PDH 6150 and session parameters are used for establishing a cryptographic 6151 session with the guest owner to negotiate keys used for 6152 attestation. The file must be encoded in base64. 6153 6154 The ``kernel-hashes`` adds the hashes of given kernel/initrd/ 6155 cmdline to a designated guest firmware page for measured Linux 6156 boot with -kernel. The default is off. (Since 6.2) 6157 6158 e.g to launch a SEV guest 6159 6160 .. parsed-literal:: 6161 6162 # |qemu_system_x86| \\ 6163 ...... \\ 6164 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \\ 6165 -machine ...,memory-encryption=sev0 \\ 6166 ..... 6167 6168 ``-object igvm-cfg,file=file`` 6169 Create an IGVM configuration object that defines the initial state 6170 of the guest using a file in that conforms to the Independent Guest 6171 Virtual Machine (IGVM) file format. 6172 6173 This is currently only supported by ``-machine q35`` and 6174 ``-machine pc``. 6175 6176 The ``file`` parameter is used to specify the IGVM file to load. 6177 When provided, the IGVM file is used to populate the initial 6178 memory of the virtual machine and, depending on the platform, can 6179 define the initial processor state, memory map and parameters. 6180 6181 The IGVM file is expected to contain the firmware for the virtual 6182 machine, therefore an ``igvm-cfg`` object cannot be provided along 6183 with other ways of specifying firmware, such as the ``-bios`` 6184 parameter on x86 machines. 6185 6186 e.g to launch a machine providing the firmware in an IGVM file 6187 6188 .. parsed-literal:: 6189 6190 # |qemu_system_x86| \\ 6191 ...... \\ 6192 -object igvm-cfg,id=igvm0,file=bios.igvm \\ 6193 -machine ...,igvm-cfg=igvm0 \\ 6194 ..... 6195 6196 ``-object authz-simple,id=id,identity=string`` 6197 Create an authorization object that will control access to 6198 network services. 6199 6200 The ``identity`` parameter is identifies the user and its format 6201 depends on the network service that authorization object is 6202 associated with. For authorizing based on TLS x509 certificates, 6203 the identity must be the x509 distinguished name. Note that care 6204 must be taken to escape any commas in the distinguished name. 6205 6206 An example authorization object to validate a x509 distinguished 6207 name would look like: 6208 6209 .. parsed-literal:: 6210 6211 # |qemu_system| \\ 6212 ... \\ 6213 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \\ 6214 ... 6215 6216 Note the use of quotes due to the x509 distinguished name 6217 containing whitespace, and escaping of ','. 6218 6219 ``-object authz-listfile,id=id,filename=path,refresh=on|off`` 6220 Create an authorization object that will control access to 6221 network services. 6222 6223 The ``filename`` parameter is the fully qualified path to a file 6224 containing the access control list rules in JSON format. 6225 6226 An example set of rules that match against SASL usernames might 6227 look like: 6228 6229 :: 6230 6231 { 6232 "rules": [ 6233 { "match": "fred", "policy": "allow", "format": "exact" }, 6234 { "match": "bob", "policy": "allow", "format": "exact" }, 6235 { "match": "danb", "policy": "deny", "format": "glob" }, 6236 { "match": "dan*", "policy": "allow", "format": "exact" }, 6237 ], 6238 "policy": "deny" 6239 } 6240 6241 When checking access the object will iterate over all the rules 6242 and the first rule to match will have its ``policy`` value 6243 returned as the result. If no rules match, then the default 6244 ``policy`` value is returned. 6245 6246 The rules can either be an exact string match, or they can use 6247 the simple UNIX glob pattern matching to allow wildcards to be 6248 used. 6249 6250 If ``refresh`` is set to true the file will be monitored and 6251 automatically reloaded whenever its content changes. 6252 6253 As with the ``authz-simple`` object, the format of the identity 6254 strings being matched depends on the network service, but is 6255 usually a TLS x509 distinguished name, or a SASL username. 6256 6257 An example authorization object to validate a SASL username 6258 would look like: 6259 6260 .. parsed-literal:: 6261 6262 # |qemu_system| \\ 6263 ... \\ 6264 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=on \\ 6265 ... 6266 6267 ``-object authz-pam,id=id,service=string`` 6268 Create an authorization object that will control access to 6269 network services. 6270 6271 The ``service`` parameter provides the name of a PAM service to 6272 use for authorization. It requires that a file 6273 ``/etc/pam.d/service`` exist to provide the configuration for 6274 the ``account`` subsystem. 6275 6276 An example authorization object to validate a TLS x509 6277 distinguished name would look like: 6278 6279 .. parsed-literal:: 6280 6281 # |qemu_system| \\ 6282 ... \\ 6283 -object authz-pam,id=auth0,service=qemu-vnc \\ 6284 ... 6285 6286 There would then be a corresponding config file for PAM at 6287 ``/etc/pam.d/qemu-vnc`` that contains: 6288 6289 :: 6290 6291 account requisite pam_listfile.so item=user sense=allow \ 6292 file=/etc/qemu/vnc.allow 6293 6294 Finally the ``/etc/qemu/vnc.allow`` file would contain the list 6295 of x509 distinguished names that are permitted access 6296 6297 :: 6298 6299 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB 6300 6301 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink,aio-max-batch=aio-max-batch`` 6302 Creates a dedicated event loop thread that devices can be 6303 assigned to. This is known as an IOThread. By default device 6304 emulation happens in vCPU threads or the main event loop thread. 6305 This can become a scalability bottleneck. IOThreads allow device 6306 emulation and I/O to run on other host CPUs. 6307 6308 The ``id`` parameter is a unique ID that will be used to 6309 reference this IOThread from ``-device ...,iothread=id``. 6310 Multiple devices can be assigned to an IOThread. Note that not 6311 all devices support an ``iothread`` parameter. 6312 6313 The ``query-iothreads`` QMP command lists IOThreads and reports 6314 their thread IDs so that the user can configure host CPU 6315 pinning/affinity. 6316 6317 IOThreads use an adaptive polling algorithm to reduce event loop 6318 latency. Instead of entering a blocking system call to monitor 6319 file descriptors and then pay the cost of being woken up when an 6320 event occurs, the polling algorithm spins waiting for events for 6321 a short time. The algorithm's default parameters are suitable 6322 for many cases but can be adjusted based on knowledge of the 6323 workload and/or host device latency. 6324 6325 The ``poll-max-ns`` parameter is the maximum number of 6326 nanoseconds to busy wait for events. Polling can be disabled by 6327 setting this value to 0. 6328 6329 The ``poll-grow`` parameter is the multiplier used to increase 6330 the polling time when the algorithm detects it is missing events 6331 due to not polling long enough. 6332 6333 The ``poll-shrink`` parameter is the divisor used to decrease 6334 the polling time when the algorithm detects it is spending too 6335 long polling without encountering events. 6336 6337 The ``aio-max-batch`` parameter is the maximum number of requests 6338 in a batch for the AIO engine, 0 means that the engine will use 6339 its default. 6340 6341 The IOThread parameters can be modified at run-time using the 6342 ``qom-set`` command (where ``iothread1`` is the IOThread's 6343 ``id``): 6344 6345 :: 6346 6347 (qemu) qom-set /objects/iothread1 poll-max-ns 100000 6348ERST 6349 6350 6351HXCOMM This is the last statement. Insert new options before this line! 6352 6353#undef DEF 6354#undef DEFHEADING 6355#undef ARCHHEADING 6356