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