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