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