]> git.ipfire.org Git - thirdparty/qemu.git/blob - qemu-options.hx
qemu-options.hx: Add rST documentation fragments
[thirdparty/qemu.git] / qemu-options.hx
1 HXCOMM Use DEFHEADING() to define headings in both help text and texi
2 HXCOMM Text between STEXI and ETEXI are copied to texi version and
3 HXCOMM discarded from C version
4 HXCOMM DEF(option, HAS_ARG/0, opt_enum, opt_help, arch_mask) is used to
5 HXCOMM construct option structures, enums and help message for specified
6 HXCOMM architectures.
7 HXCOMM HXCOMM can be used for comments, discarded from both texi and C
8
9 DEFHEADING(Standard options:)
10 STEXI
11 @table @option
12 ETEXI
13
14 DEF("help", 0, QEMU_OPTION_h,
15 "-h or -help display this help and exit\n", QEMU_ARCH_ALL)
16 STEXI
17 @item -h
18 @findex -h
19 Display help and exit
20 ETEXI
21 SRST
22 ``-h``
23 Display help and exit
24 ERST
25
26 DEF("version", 0, QEMU_OPTION_version,
27 "-version display version information and exit\n", QEMU_ARCH_ALL)
28 STEXI
29 @item -version
30 @findex -version
31 Display version information and exit
32 ETEXI
33 SRST
34 ``-version``
35 Display version information and exit
36 ERST
37
38 DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
39 "-machine [type=]name[,prop[=value][,...]]\n"
40 " selects emulated machine ('-machine help' for list)\n"
41 " property accel=accel1[:accel2[:...]] selects accelerator\n"
42 " supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)\n"
43 " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
44 " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
45 " mem-merge=on|off controls memory merge support (default: on)\n"
46 " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
47 " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
48 " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
49 " nvdimm=on|off controls NVDIMM support (default=off)\n"
50 " enforce-config-section=on|off enforce configuration section migration (default=off)\n"
51 " memory-encryption=@var{} memory encryption object to use (default=none)\n"
52 " hmat=on|off controls ACPI HMAT support (default=off)\n",
53 QEMU_ARCH_ALL)
54 STEXI
55 @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
56 @findex -machine
57 Select the emulated machine by @var{name}. Use @code{-machine help} to list
58 available machines.
59
60 For architectures which aim to support live migration compatibility
61 across releases, each release will introduce a new versioned machine
62 type. For example, the 2.8.0 release introduced machine types
63 ``pc-i440fx-2.8'' and ``pc-q35-2.8'' for the x86_64/i686 architectures.
64
65 To allow live migration of guests from QEMU version 2.8.0, to QEMU
66 version 2.9.0, the 2.9.0 version must support the ``pc-i440fx-2.8''
67 and ``pc-q35-2.8'' machines too. To allow users live migrating VMs
68 to skip multiple intermediate releases when upgrading, new releases
69 of QEMU will support machine types from many previous versions.
70
71 Supported machine properties are:
72 @table @option
73 @item accel=@var{accels1}[:@var{accels2}[:...]]
74 This is used to enable an accelerator. Depending on the target architecture,
75 kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If there is
76 more than one accelerator specified, the next one is used if the previous one
77 fails to initialize.
78 @item vmport=on|off|auto
79 Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the
80 value based on accel. For accel=xen the default is off otherwise the default
81 is on.
82 @item dump-guest-core=on|off
83 Include guest memory in a core dump. The default is on.
84 @item mem-merge=on|off
85 Enables or disables memory merge support. This feature, when supported by
86 the host, de-duplicates identical memory pages among VMs instances
87 (enabled by default).
88 @item aes-key-wrap=on|off
89 Enables or disables AES key wrapping support on s390-ccw hosts. This feature
90 controls whether AES wrapping keys will be created to allow
91 execution of AES cryptographic functions. The default is on.
92 @item dea-key-wrap=on|off
93 Enables or disables DEA key wrapping support on s390-ccw hosts. This feature
94 controls whether DEA wrapping keys will be created to allow
95 execution of DEA cryptographic functions. The default is on.
96 @item nvdimm=on|off
97 Enables or disables NVDIMM support. The default is off.
98 @item enforce-config-section=on|off
99 If @option{enforce-config-section} is set to @var{on}, force migration
100 code to send configuration section even if the machine-type sets the
101 @option{migration.send-configuration} property to @var{off}.
102 NOTE: this parameter is deprecated. Please use @option{-global}
103 @option{migration.send-configuration}=@var{on|off} instead.
104 @item memory-encryption=@var{}
105 Memory encryption object to use. The default is none.
106 @item hmat=on|off
107 Enables or disables ACPI Heterogeneous Memory Attribute Table (HMAT) support.
108 The default is off.
109 @end table
110 ETEXI
111 SRST
112 ``-machine [type=]name[,prop=value[,...]]``
113 Select the emulated machine by name. Use ``-machine help`` to list
114 available machines.
115
116 For architectures which aim to support live migration compatibility
117 across releases, each release will introduce a new versioned machine
118 type. For example, the 2.8.0 release introduced machine types
119 "pc-i440fx-2.8" and "pc-q35-2.8" for the x86\_64/i686 architectures.
120
121 To allow live migration of guests from QEMU version 2.8.0, to QEMU
122 version 2.9.0, the 2.9.0 version must support the "pc-i440fx-2.8"
123 and "pc-q35-2.8" machines too. To allow users live migrating VMs to
124 skip multiple intermediate releases when upgrading, new releases of
125 QEMU will support machine types from many previous versions.
126
127 Supported machine properties are:
128
129 ``accel=accels1[:accels2[:...]]``
130 This is used to enable an accelerator. Depending on the target
131 architecture, kvm, xen, hax, hvf, whpx or tcg can be available.
132 By default, tcg is used. If there is more than one accelerator
133 specified, the next one is used if the previous one fails to
134 initialize.
135
136 ``vmport=on|off|auto``
137 Enables emulation of VMWare IO port, for vmmouse etc. auto says
138 to select the value based on accel. For accel=xen the default is
139 off otherwise the default is on.
140
141 ``dump-guest-core=on|off``
142 Include guest memory in a core dump. The default is on.
143
144 ``mem-merge=on|off``
145 Enables or disables memory merge support. This feature, when
146 supported by the host, de-duplicates identical memory pages
147 among VMs instances (enabled by default).
148
149 ``aes-key-wrap=on|off``
150 Enables or disables AES key wrapping support on s390-ccw hosts.
151 This feature controls whether AES wrapping keys will be created
152 to allow execution of AES cryptographic functions. The default
153 is on.
154
155 ``dea-key-wrap=on|off``
156 Enables or disables DEA key wrapping support on s390-ccw hosts.
157 This feature controls whether DEA wrapping keys will be created
158 to allow execution of DEA cryptographic functions. The default
159 is on.
160
161 ``nvdimm=on|off``
162 Enables or disables NVDIMM support. The default is off.
163
164 ``enforce-config-section=on|off``
165 If ``enforce-config-section`` is set to on, force migration code
166 to send configuration section even if the machine-type sets the
167 ``migration.send-configuration`` property to off. NOTE: this
168 parameter is deprecated. Please use ``-global``
169 ``migration.send-configuration``\ =on\|off instead.
170
171 ``memory-encryption=``
172 Memory encryption object to use. The default is none.
173
174 ``hmat=on|off``
175 Enables or disables ACPI Heterogeneous Memory Attribute Table
176 (HMAT) support. The default is off.
177 ERST
178
179 HXCOMM Deprecated by -machine
180 DEF("M", HAS_ARG, QEMU_OPTION_M, "", QEMU_ARCH_ALL)
181
182 DEF("cpu", HAS_ARG, QEMU_OPTION_cpu,
183 "-cpu cpu select CPU ('-cpu help' for list)\n", QEMU_ARCH_ALL)
184 STEXI
185 @item -cpu @var{model}
186 @findex -cpu
187 Select CPU model (@code{-cpu help} for list and additional feature selection)
188 ETEXI
189 SRST
190 ``-cpu model``
191 Select CPU model (``-cpu help`` for list and additional feature
192 selection)
193 ERST
194
195 DEF("accel", HAS_ARG, QEMU_OPTION_accel,
196 "-accel [accel=]accelerator[,prop[=value][,...]]\n"
197 " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n"
198 " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
199 " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
200 " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
201 " tb-size=n (TCG translation block cache size)\n"
202 " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL)
203 STEXI
204 @item -accel @var{name}[,prop=@var{value}[,...]]
205 @findex -accel
206 This is used to enable an accelerator. Depending on the target architecture,
207 kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If there is
208 more than one accelerator specified, the next one is used if the previous one
209 fails to initialize.
210 @table @option
211 @item igd-passthru=on|off
212 When Xen is in use, this option controls whether Intel integrated graphics
213 devices can be passed through to the guest (default=off)
214 @item kernel-irqchip=on|off|split
215 Controls KVM in-kernel irqchip support. The default is full acceleration of the
216 interrupt controllers. On x86, split irqchip reduces the kernel attack
217 surface, at a performance cost for non-MSI interrupts. Disabling the in-kernel
218 irqchip completely is not recommended except for debugging purposes.
219 @item kvm-shadow-mem=size
220 Defines the size of the KVM shadow MMU.
221 @item tb-size=@var{n}
222 Controls the size (in MiB) of the TCG translation block cache.
223 @item thread=single|multi
224 Controls number of TCG threads. When the TCG is multi-threaded there will be one
225 thread per vCPU therefor taking advantage of additional host cores. The default
226 is to enable multi-threading where both the back-end and front-ends support it and
227 no incompatible TCG features have been enabled (e.g. icount/replay).
228 @end table
229 ETEXI
230 SRST
231 ``-accel name[,prop=value[,...]]``
232 This is used to enable an accelerator. Depending on the target
233 architecture, kvm, xen, hax, hvf, whpx or tcg can be available. By
234 default, tcg is used. If there is more than one accelerator
235 specified, the next one is used if the previous one fails to
236 initialize.
237
238 ``igd-passthru=on|off``
239 When Xen is in use, this option controls whether Intel
240 integrated graphics devices can be passed through to the guest
241 (default=off)
242
243 ``kernel-irqchip=on|off|split``
244 Controls KVM in-kernel irqchip support. The default is full
245 acceleration of the interrupt controllers. On x86, split irqchip
246 reduces the kernel attack surface, at a performance cost for
247 non-MSI interrupts. Disabling the in-kernel irqchip completely
248 is not recommended except for debugging purposes.
249
250 ``kvm-shadow-mem=size``
251 Defines the size of the KVM shadow MMU.
252
253 ``tb-size=n``
254 Controls the size (in MiB) of the TCG translation block cache.
255
256 ``thread=single|multi``
257 Controls number of TCG threads. When the TCG is multi-threaded
258 there will be one thread per vCPU therefor taking advantage of
259 additional host cores. The default is to enable multi-threading
260 where both the back-end and front-ends support it and no
261 incompatible TCG features have been enabled (e.g.
262 icount/replay).
263 ERST
264
265 DEF("smp", HAS_ARG, QEMU_OPTION_smp,
266 "-smp [cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,dies=dies][,sockets=sockets]\n"
267 " set the number of CPUs to 'n' [default=1]\n"
268 " maxcpus= maximum number of total cpus, including\n"
269 " offline CPUs for hotplug, etc\n"
270 " cores= number of CPU cores on one socket (for PC, it's on one die)\n"
271 " threads= number of threads on one CPU core\n"
272 " dies= number of CPU dies on one socket (for PC only)\n"
273 " sockets= number of discrete sockets in the system\n",
274 QEMU_ARCH_ALL)
275 STEXI
276 @item -smp [cpus=]@var{n}[,cores=@var{cores}][,threads=@var{threads}][,dies=dies][,sockets=@var{sockets}][,maxcpus=@var{maxcpus}]
277 @findex -smp
278 Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
279 CPUs are supported. On Sparc32 target, Linux limits the number of usable CPUs
280 to 4.
281 For the PC target, the number of @var{cores} per die, the number of @var{threads}
282 per cores, the number of @var{dies} per packages and the total number of
283 @var{sockets} can be specified. Missing values will be computed.
284 If any on the three values is given, the total number of CPUs @var{n} can be omitted.
285 @var{maxcpus} specifies the maximum number of hotpluggable CPUs.
286 ETEXI
287 SRST
288 ``-smp [cpus=]n[,cores=cores][,threads=threads][,dies=dies][,sockets=sockets][,maxcpus=maxcpus]``
289 Simulate an SMP system with n CPUs. On the PC target, up to 255 CPUs
290 are supported. On Sparc32 target, Linux limits the number of usable
291 CPUs to 4. For the PC target, the number of cores per die, the
292 number of threads per cores, the number of dies per packages and the
293 total number of sockets can be specified. Missing values will be
294 computed. If any on the three values is given, the total number of
295 CPUs n can be omitted. maxcpus specifies the maximum number of
296 hotpluggable CPUs.
297 ERST
298
299 DEF("numa", HAS_ARG, QEMU_OPTION_numa,
300 "-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
301 "-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
302 "-numa dist,src=source,dst=destination,val=distance\n"
303 "-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]\n"
304 "-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"
305 "-numa hmat-cache,node-id=node,size=size,level=level[,associativity=none|direct|complex][,policy=none|write-back|write-through][,line=size]\n",
306 QEMU_ARCH_ALL)
307 STEXI
308 @item -numa node[,mem=@var{size}][,cpus=@var{firstcpu}[-@var{lastcpu}]][,nodeid=@var{node}][,initiator=@var{initiator}]
309 @itemx -numa node[,memdev=@var{id}][,cpus=@var{firstcpu}[-@var{lastcpu}]][,nodeid=@var{node}][,initiator=@var{initiator}]
310 @itemx -numa dist,src=@var{source},dst=@var{destination},val=@var{distance}
311 @itemx -numa cpu,node-id=@var{node}[,socket-id=@var{x}][,core-id=@var{y}][,thread-id=@var{z}]
312 @itemx -numa hmat-lb,initiator=@var{node},target=@var{node},hierarchy=@var{hierarchy},data-type=@var{tpye}[,latency=@var{lat}][,bandwidth=@var{bw}]
313 @itemx -numa hmat-cache,node-id=@var{node},size=@var{size},level=@var{level}[,associativity=@var{str}][,policy=@var{str}][,line=@var{size}]
314 @findex -numa
315 Define a NUMA node and assign RAM and VCPUs to it.
316 Set the NUMA distance from a source node to a destination node.
317 Set the ACPI Heterogeneous Memory Attributes for the given nodes.
318
319 Legacy VCPU assignment uses @samp{cpus} option where
320 @var{firstcpu} and @var{lastcpu} are CPU indexes. Each
321 @samp{cpus} option represent a contiguous range of CPU indexes
322 (or a single VCPU if @var{lastcpu} is omitted). A non-contiguous
323 set of VCPUs can be represented by providing multiple @samp{cpus}
324 options. If @samp{cpus} is omitted on all nodes, VCPUs are automatically
325 split between them.
326
327 For example, the following option assigns VCPUs 0, 1, 2 and 5 to
328 a NUMA node:
329 @example
330 -numa node,cpus=0-2,cpus=5
331 @end example
332
333 @samp{cpu} option is a new alternative to @samp{cpus} option
334 which uses @samp{socket-id|core-id|thread-id} properties to assign
335 CPU objects to a @var{node} using topology layout properties of CPU.
336 The set of properties is machine specific, and depends on used
337 machine type/@samp{smp} options. It could be queried with
338 @samp{hotpluggable-cpus} monitor command.
339 @samp{node-id} property specifies @var{node} to which CPU object
340 will be assigned, it's required for @var{node} to be declared
341 with @samp{node} option before it's used with @samp{cpu} option.
342
343 For example:
344 @example
345 -M pc \
346 -smp 1,sockets=2,maxcpus=2 \
347 -numa node,nodeid=0 -numa node,nodeid=1 \
348 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
349 @end example
350
351 @samp{mem} assigns a given RAM amount to a node. @samp{memdev}
352 assigns RAM from a given memory backend device to a node. If
353 @samp{mem} and @samp{memdev} are omitted in all nodes, RAM is
354 split equally between them.
355
356 @samp{mem} and @samp{memdev} are mutually exclusive. Furthermore,
357 if one node uses @samp{memdev}, all of them have to use it.
358
359 @samp{initiator} is an additional option that points to an @var{initiator}
360 NUMA node that has best performance (the lowest latency or largest bandwidth)
361 to this NUMA @var{node}. Note that this option can be set only when
362 the machine property 'hmat' is set to 'on'.
363
364 Following example creates a machine with 2 NUMA nodes, node 0 has CPU.
365 node 1 has only memory, and its initiator is node 0. Note that because
366 node 0 has CPU, by default the initiator of node 0 is itself and must be
367 itself.
368 @example
369 -machine hmat=on \
370 -m 2G,slots=2,maxmem=4G \
371 -object memory-backend-ram,size=1G,id=m0 \
372 -object memory-backend-ram,size=1G,id=m1 \
373 -numa node,nodeid=0,memdev=m0 \
374 -numa node,nodeid=1,memdev=m1,initiator=0 \
375 -smp 2,sockets=2,maxcpus=2 \
376 -numa cpu,node-id=0,socket-id=0 \
377 -numa cpu,node-id=0,socket-id=1
378 @end example
379
380 @var{source} and @var{destination} are NUMA node IDs.
381 @var{distance} is the NUMA distance from @var{source} to @var{destination}.
382 The distance from a node to itself is always 10. If any pair of nodes is
383 given a distance, then all pairs must be given distances. Although, when
384 distances are only given in one direction for each pair of nodes, then
385 the distances in the opposite directions are assumed to be the same. If,
386 however, an asymmetrical pair of distances is given for even one node
387 pair, then all node pairs must be provided distance values for both
388 directions, even when they are symmetrical. When a node is unreachable
389 from another node, set the pair's distance to 255.
390
391 Note that the -@option{numa} option doesn't allocate any of the
392 specified resources, it just assigns existing resources to NUMA
393 nodes. This means that one still has to use the @option{-m},
394 @option{-smp} options to allocate RAM and VCPUs respectively.
395
396 Use @samp{hmat-lb} to set System Locality Latency and Bandwidth Information
397 between initiator and target NUMA nodes in ACPI Heterogeneous Attribute Memory Table (HMAT).
398 Initiator NUMA node can create memory requests, usually it has one or more processors.
399 Target NUMA node contains addressable memory.
400
401 In @samp{hmat-lb} option, @var{node} are NUMA node IDs. @var{hierarchy} is the memory
402 hierarchy of the target NUMA node: if @var{hierarchy} is 'memory', the structure
403 represents the memory performance; if @var{hierarchy} is 'first-level|second-level|third-level',
404 this structure represents aggregated performance of memory side caches for each domain.
405 @var{type} of 'data-type' is type of data represented by this structure instance:
406 if 'hierarchy' is 'memory', 'data-type' is 'access|read|write' latency or 'access|read|write'
407 bandwidth of the target memory; if 'hierarchy' is 'first-level|second-level|third-level',
408 'data-type' is 'access|read|write' hit latency or 'access|read|write' hit bandwidth of the
409 target memory side cache.
410
411 @var{lat} is latency value in nanoseconds. @var{bw} is bandwidth value,
412 the possible value and units are NUM[M|G|T], mean that the bandwidth value are
413 NUM byte per second (or MB/s, GB/s or TB/s depending on used suffix).
414 Note that if latency or bandwidth value is 0, means the corresponding latency or
415 bandwidth information is not provided.
416
417 In @samp{hmat-cache} option, @var{node-id} is the NUMA-id of the memory belongs.
418 @var{size} is the size of memory side cache in bytes. @var{level} is the cache
419 level described in this structure, note that the cache level 0 should not be used
420 with @samp{hmat-cache} option. @var{associativity} is the cache associativity,
421 the possible value is 'none/direct(direct-mapped)/complex(complex cache indexing)'.
422 @var{policy} is the write policy. @var{line} is the cache Line size in bytes.
423
424 For example, the following options describe 2 NUMA nodes. Node 0 has 2 cpus and
425 a ram, node 1 has only a ram. The processors in node 0 access memory in node
426 0 with access-latency 5 nanoseconds, access-bandwidth is 200 MB/s;
427 The processors in NUMA node 0 access memory in NUMA node 1 with access-latency 10
428 nanoseconds, access-bandwidth is 100 MB/s.
429 And for memory side cache information, NUMA node 0 and 1 both have 1 level memory
430 cache, size is 10KB, policy is write-back, the cache Line size is 8 bytes:
431 @example
432 -machine hmat=on \
433 -m 2G \
434 -object memory-backend-ram,size=1G,id=m0 \
435 -object memory-backend-ram,size=1G,id=m1 \
436 -smp 2 \
437 -numa node,nodeid=0,memdev=m0 \
438 -numa node,nodeid=1,memdev=m1,initiator=0 \
439 -numa cpu,node-id=0,socket-id=0 \
440 -numa cpu,node-id=0,socket-id=1 \
441 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
442 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
443 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
444 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
445 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
446 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
447 @end example
448
449 ETEXI
450 SRST
451 ``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``; \ ``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``; \ ``-numa dist,src=source,dst=destination,val=distance``; \ ``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]``; \ ``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=tpye[,latency=lat][,bandwidth=bw]``; \ ``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]``
452 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA
453 distance from a source node to a destination node. Set the ACPI
454 Heterogeneous Memory Attributes for the given nodes.
455
456 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and
457 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a
458 contiguous range of CPU indexes (or a single VCPU if lastcpu is
459 omitted). A non-contiguous set of VCPUs can be represented by
460 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is
461 omitted on all nodes, VCPUs are automatically split between them.
462
463 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a
464 NUMA node:
465
466 ::
467
468 -numa node,cpus=0-2,cpus=5
469
470 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option
471 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to
472 assign CPU objects to a node using topology layout properties of
473 CPU. The set of properties is machine specific, and depends on used
474 machine type/'\ ``smp``\ ' options. It could be queried with
475 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ '
476 property specifies node to which CPU object will be assigned, it's
477 required for node to be declared with '\ ``node``\ ' option before
478 it's used with '\ ``cpu``\ ' option.
479
480 For example:
481
482 ::
483
484 -M pc \
485 -smp 1,sockets=2,maxcpus=2 \
486 -numa node,nodeid=0 -numa node,nodeid=1 \
487 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
488
489 '\ ``mem``\ ' assigns a given RAM amount to a node. '\ ``memdev``\ '
490 assigns RAM from a given memory backend device to a node. If
491 '\ ``mem``\ ' and '\ ``memdev``\ ' are omitted in all nodes, RAM is
492 split equally between them.
493
494 '\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive.
495 Furthermore, if one node uses '\ ``memdev``\ ', all of them have to
496 use it.
497
498 '\ ``initiator``\ ' is an additional option that points to an
499 initiator NUMA node that has best performance (the lowest latency or
500 largest bandwidth) to this NUMA node. Note that this option can be
501 set only when the machine property 'hmat' is set to 'on'.
502
503 Following example creates a machine with 2 NUMA nodes, node 0 has
504 CPU. node 1 has only memory, and its initiator is node 0. Note that
505 because node 0 has CPU, by default the initiator of node 0 is itself
506 and must be itself.
507
508 ::
509
510 -machine hmat=on \
511 -m 2G,slots=2,maxmem=4G \
512 -object memory-backend-ram,size=1G,id=m0 \
513 -object memory-backend-ram,size=1G,id=m1 \
514 -numa node,nodeid=0,memdev=m0 \
515 -numa node,nodeid=1,memdev=m1,initiator=0 \
516 -smp 2,sockets=2,maxcpus=2 \
517 -numa cpu,node-id=0,socket-id=0 \
518 -numa cpu,node-id=0,socket-id=1
519
520 source and destination are NUMA node IDs. distance is the NUMA
521 distance from source to destination. The distance from a node to
522 itself is always 10. If any pair of nodes is given a distance, then
523 all pairs must be given distances. Although, when distances are only
524 given in one direction for each pair of nodes, then the distances in
525 the opposite directions are assumed to be the same. If, however, an
526 asymmetrical pair of distances is given for even one node pair, then
527 all node pairs must be provided distance values for both directions,
528 even when they are symmetrical. When a node is unreachable from
529 another node, set the pair's distance to 255.
530
531 Note that the -``numa`` option doesn't allocate any of the specified
532 resources, it just assigns existing resources to NUMA nodes. This
533 means that one still has to use the ``-m``, ``-smp`` options to
534 allocate RAM and VCPUs respectively.
535
536 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth
537 Information between initiator and target NUMA nodes in ACPI
538 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can
539 create memory requests, usually it has one or more processors.
540 Target NUMA node contains addressable memory.
541
542 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is
543 the memory hierarchy of the target NUMA node: if hierarchy is
544 'memory', the structure represents the memory performance; if
545 hierarchy is 'first-level\|second-level\|third-level', this
546 structure represents aggregated performance of memory side caches
547 for each domain. type of 'data-type' is type of data represented by
548 this structure instance: if 'hierarchy' is 'memory', 'data-type' is
549 'access\|read\|write' latency or 'access\|read\|write' bandwidth of
550 the target memory; if 'hierarchy' is
551 'first-level\|second-level\|third-level', 'data-type' is
552 'access\|read\|write' hit latency or 'access\|read\|write' hit
553 bandwidth of the target memory side cache.
554
555 lat is latency value in nanoseconds. bw is bandwidth value, the
556 possible value and units are NUM[M\|G\|T], mean that the bandwidth
557 value are NUM byte per second (or MB/s, GB/s or TB/s depending on
558 used suffix). Note that if latency or bandwidth value is 0, means
559 the corresponding latency or bandwidth information is not provided.
560
561 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory
562 belongs. size is the size of memory side cache in bytes. level is
563 the cache level described in this structure, note that the cache
564 level 0 should not be used with '\ ``hmat-cache``\ ' option.
565 associativity is the cache associativity, the possible value is
566 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy
567 is the write policy. line is the cache Line size in bytes.
568
569 For example, the following options describe 2 NUMA nodes. Node 0 has
570 2 cpus and a ram, node 1 has only a ram. The processors in node 0
571 access memory in node 0 with access-latency 5 nanoseconds,
572 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access
573 memory in NUMA node 1 with access-latency 10 nanoseconds,
574 access-bandwidth is 100 MB/s. And for memory side cache information,
575 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB,
576 policy is write-back, the cache Line size is 8 bytes:
577
578 ::
579
580 -machine hmat=on \
581 -m 2G \
582 -object memory-backend-ram,size=1G,id=m0 \
583 -object memory-backend-ram,size=1G,id=m1 \
584 -smp 2 \
585 -numa node,nodeid=0,memdev=m0 \
586 -numa node,nodeid=1,memdev=m1,initiator=0 \
587 -numa cpu,node-id=0,socket-id=0 \
588 -numa cpu,node-id=0,socket-id=1 \
589 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
590 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
591 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
592 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
593 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
594 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
595 ERST
596
597 DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd,
598 "-add-fd fd=fd,set=set[,opaque=opaque]\n"
599 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL)
600 STEXI
601 @item -add-fd fd=@var{fd},set=@var{set}[,opaque=@var{opaque}]
602 @findex -add-fd
603
604 Add a file descriptor to an fd set. Valid options are:
605
606 @table @option
607 @item fd=@var{fd}
608 This option defines the file descriptor of which a duplicate is added to fd set.
609 The file descriptor cannot be stdin, stdout, or stderr.
610 @item set=@var{set}
611 This option defines the ID of the fd set to add the file descriptor to.
612 @item opaque=@var{opaque}
613 This option defines a free-form string that can be used to describe @var{fd}.
614 @end table
615
616 You can open an image using pre-opened file descriptors from an fd set:
617 @example
618 @value{qemu_system} \
619 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
620 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
621 -drive file=/dev/fdset/2,index=0,media=disk
622 @end example
623 ETEXI
624 SRST
625 ``-add-fd fd=fd,set=set[,opaque=opaque]``
626 Add a file descriptor to an fd set. Valid options are:
627
628 ``fd=fd``
629 This option defines the file descriptor of which a duplicate is
630 added to fd set. The file descriptor cannot be stdin, stdout, or
631 stderr.
632
633 ``set=set``
634 This option defines the ID of the fd set to add the file
635 descriptor to.
636
637 ``opaque=opaque``
638 This option defines a free-form string that can be used to
639 describe fd.
640
641 You can open an image using pre-opened file descriptors from an fd
642 set:
643
644 .. parsed-literal::
645
646 |qemu_system| \
647 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
648 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
649 -drive file=/dev/fdset/2,index=0,media=disk
650 ERST
651
652 DEF("set", HAS_ARG, QEMU_OPTION_set,
653 "-set group.id.arg=value\n"
654 " set <arg> parameter for item <id> of type <group>\n"
655 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL)
656 STEXI
657 @item -set @var{group}.@var{id}.@var{arg}=@var{value}
658 @findex -set
659 Set parameter @var{arg} for item @var{id} of type @var{group}
660 ETEXI
661 SRST
662 ``-set group.id.arg=value``
663 Set parameter arg for item id of type group
664 ERST
665
666 DEF("global", HAS_ARG, QEMU_OPTION_global,
667 "-global driver.property=value\n"
668 "-global driver=driver,property=property,value=value\n"
669 " set a global default for a driver property\n",
670 QEMU_ARCH_ALL)
671 STEXI
672 @item -global @var{driver}.@var{prop}=@var{value}
673 @itemx -global driver=@var{driver},property=@var{property},value=@var{value}
674 @findex -global
675 Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.:
676
677 @example
678 @value{qemu_system_x86} -global ide-hd.physical_block_size=4096 disk-image.img
679 @end example
680
681 In particular, you can use this to set driver properties for devices which are
682 created automatically by the machine model. To create a device which is not
683 created automatically and set properties on it, use -@option{device}.
684
685 -global @var{driver}.@var{prop}=@var{value} is shorthand for -global
686 driver=@var{driver},property=@var{prop},value=@var{value}. The
687 longhand syntax works even when @var{driver} contains a dot.
688 ETEXI
689 SRST
690 ``-global driver.prop=value``; \ ``-global driver=driver,property=property,value=value``
691 Set default value of driver's property prop to value, e.g.:
692
693 .. parsed-literal::
694
695 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img
696
697 In particular, you can use this to set driver properties for devices
698 which are created automatically by the machine model. To create a
699 device which is not created automatically and set properties on it,
700 use -``device``.
701
702 -global driver.prop=value is shorthand for -global
703 driver=driver,property=prop,value=value. The longhand syntax works
704 even when driver contains a dot.
705 ERST
706
707 DEF("boot", HAS_ARG, QEMU_OPTION_boot,
708 "-boot [order=drives][,once=drives][,menu=on|off]\n"
709 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n"
710 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n"
711 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n"
712 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n"
713 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n",
714 QEMU_ARCH_ALL)
715 STEXI
716 @item -boot [order=@var{drives}][,once=@var{drives}][,menu=on|off][,splash=@var{sp_name}][,splash-time=@var{sp_time}][,reboot-timeout=@var{rb_timeout}][,strict=on|off]
717 @findex -boot
718 Specify boot order @var{drives} as a string of drive letters. Valid
719 drive letters depend on the target architecture. The x86 PC uses: a, b
720 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot
721 from network adapter 1-4), hard disk boot is the default. To apply a
722 particular boot order only on the first startup, specify it via
723 @option{once}. Note that the @option{order} or @option{once} parameter
724 should not be used together with the @option{bootindex} property of
725 devices, since the firmware implementations normally do not support both
726 at the same time.
727
728 Interactive boot menus/prompts can be enabled via @option{menu=on} as far
729 as firmware/BIOS supports them. The default is non-interactive boot.
730
731 A splash picture could be passed to bios, enabling user to show it as logo,
732 when option splash=@var{sp_name} is given and menu=on, If firmware/BIOS
733 supports them. Currently Seabios for X86 system support it.
734 limitation: The splash file could be a jpeg file or a BMP file in 24 BPP
735 format(true color). The resolution should be supported by the SVGA mode, so
736 the recommended is 320x240, 640x480, 800x640.
737
738 A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms
739 when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not
740 reboot, qemu passes '-1' to bios by default. Currently Seabios for X86
741 system support it.
742
743 Do strict boot via @option{strict=on} as far as firmware/BIOS
744 supports it. This only effects when boot priority is changed by
745 bootindex options. The default is non-strict boot.
746
747 @example
748 # try to boot from network first, then from hard disk
749 @value{qemu_system_x86} -boot order=nc
750 # boot from CD-ROM first, switch back to default order after reboot
751 @value{qemu_system_x86} -boot once=d
752 # boot with a splash picture for 5 seconds.
753 @value{qemu_system_x86} -boot menu=on,splash=/root/boot.bmp,splash-time=5000
754 @end example
755
756 Note: The legacy format '-boot @var{drives}' is still supported but its
757 use is discouraged as it may be removed from future versions.
758 ETEXI
759 SRST
760 ``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]``
761 Specify boot order drives as a string of drive letters. Valid drive
762 letters depend on the target architecture. The x86 PC uses: a, b
763 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p
764 (Etherboot from network adapter 1-4), hard disk boot is the default.
765 To apply a particular boot order only on the first startup, specify
766 it via ``once``. Note that the ``order`` or ``once`` parameter
767 should not be used together with the ``bootindex`` property of
768 devices, since the firmware implementations normally do not support
769 both at the same time.
770
771 Interactive boot menus/prompts can be enabled via ``menu=on`` as far
772 as firmware/BIOS supports them. The default is non-interactive boot.
773
774 A splash picture could be passed to bios, enabling user to show it
775 as logo, when option splash=sp\_name is given and menu=on, If
776 firmware/BIOS supports them. Currently Seabios for X86 system
777 support it. limitation: The splash file could be a jpeg file or a
778 BMP file in 24 BPP format(true color). The resolution should be
779 supported by the SVGA mode, so the recommended is 320x240, 640x480,
780 800x640.
781
782 A timeout could be passed to bios, guest will pause for rb\_timeout
783 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will
784 not reboot, qemu passes '-1' to bios by default. Currently Seabios
785 for X86 system support it.
786
787 Do strict boot via ``strict=on`` as far as firmware/BIOS supports
788 it. This only effects when boot priority is changed by bootindex
789 options. The default is non-strict boot.
790
791 ::
792
793 # try to boot from network first, then from hard disk
794 |qemu_system_x86| -boot order=nc
795 # boot from CD-ROM first, switch back to default order after reboot
796 |qemu_system_x86| -boot once=d
797 # boot with a splash picture for 5 seconds.
798 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000
799
800 Note: The legacy format '-boot drives' is still supported but its
801 use is discouraged as it may be removed from future versions.
802 ERST
803
804 DEF("m", HAS_ARG, QEMU_OPTION_m,
805 "-m [size=]megs[,slots=n,maxmem=size]\n"
806 " configure guest RAM\n"
807 " size: initial amount of guest memory\n"
808 " slots: number of hotplug slots (default: none)\n"
809 " maxmem: maximum amount of guest memory (default: none)\n"
810 "NOTE: Some architectures might enforce a specific granularity\n",
811 QEMU_ARCH_ALL)
812 STEXI
813 @item -m [size=]@var{megs}[,slots=n,maxmem=size]
814 @findex -m
815 Sets guest startup RAM size to @var{megs} megabytes. Default is 128 MiB.
816 Optionally, a suffix of ``M'' or ``G'' can be used to signify a value in
817 megabytes or gigabytes respectively. Optional pair @var{slots}, @var{maxmem}
818 could be used to set amount of hotpluggable memory slots and maximum amount of
819 memory. Note that @var{maxmem} must be aligned to the page size.
820
821 For example, the following command-line sets the guest startup RAM size to
822 1GB, creates 3 slots to hotplug additional memory and sets the maximum
823 memory the guest can reach to 4GB:
824
825 @example
826 @value{qemu_system} -m 1G,slots=3,maxmem=4G
827 @end example
828
829 If @var{slots} and @var{maxmem} are not specified, memory hotplug won't
830 be enabled and the guest startup RAM will never increase.
831 ETEXI
832 SRST
833 ``-m [size=]megs[,slots=n,maxmem=size]``
834 Sets guest startup RAM size to megs megabytes. Default is 128 MiB.
835 Optionally, a suffix of "M" or "G" can be used to signify a value in
836 megabytes or gigabytes respectively. Optional pair slots, maxmem
837 could be used to set amount of hotpluggable memory slots and maximum
838 amount of memory. Note that maxmem must be aligned to the page size.
839
840 For example, the following command-line sets the guest startup RAM
841 size to 1GB, creates 3 slots to hotplug additional memory and sets
842 the maximum memory the guest can reach to 4GB:
843
844 .. parsed-literal::
845
846 |qemu_system| -m 1G,slots=3,maxmem=4G
847
848 If slots and maxmem are not specified, memory hotplug won't be
849 enabled and the guest startup RAM will never increase.
850 ERST
851
852 DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
853 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
854 STEXI
855 @item -mem-path @var{path}
856 @findex -mem-path
857 Allocate guest RAM from a temporarily created file in @var{path}.
858 ETEXI
859 SRST
860 ``-mem-path path``
861 Allocate guest RAM from a temporarily created file in path.
862 ERST
863
864 DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
865 "-mem-prealloc preallocate guest memory (use with -mem-path)\n",
866 QEMU_ARCH_ALL)
867 STEXI
868 @item -mem-prealloc
869 @findex -mem-prealloc
870 Preallocate memory when using -mem-path.
871 ETEXI
872 SRST
873 ``-mem-prealloc``
874 Preallocate memory when using -mem-path.
875 ERST
876
877 DEF("k", HAS_ARG, QEMU_OPTION_k,
878 "-k language use keyboard layout (for example 'fr' for French)\n",
879 QEMU_ARCH_ALL)
880 STEXI
881 @item -k @var{language}
882 @findex -k
883 Use keyboard layout @var{language} (for example @code{fr} for
884 French). This option is only needed where it is not easy to get raw PC
885 keycodes (e.g. on Macs, with some X11 servers or with a VNC or curses
886 display). You don't normally need to use it on PC/Linux or PC/Windows
887 hosts.
888
889 The available layouts are:
890 @example
891 ar de-ch es fo fr-ca hu ja mk no pt-br sv
892 da en-gb et fr fr-ch is lt nl pl ru th
893 de en-us fi fr-be hr it lv nl-be pt sl tr
894 @end example
895
896 The default is @code{en-us}.
897 ETEXI
898 SRST
899 ``-k language``
900 Use keyboard layout language (for example ``fr`` for French). This
901 option is only needed where it is not easy to get raw PC keycodes
902 (e.g. on Macs, with some X11 servers or with a VNC or curses
903 display). You don't normally need to use it on PC/Linux or
904 PC/Windows hosts.
905
906 The available layouts are:
907
908 ::
909
910 ar de-ch es fo fr-ca hu ja mk no pt-br sv
911 da en-gb et fr fr-ch is lt nl pl ru th
912 de en-us fi fr-be hr it lv nl-be pt sl tr
913
914 The default is ``en-us``.
915 ERST
916
917
918 HXCOMM Deprecated by -audiodev
919 DEF("audio-help", 0, QEMU_OPTION_audio_help,
920 "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
921 QEMU_ARCH_ALL)
922 STEXI
923 @item -audio-help
924 @findex -audio-help
925 Will show the -audiodev equivalent of the currently specified
926 (deprecated) environment variables.
927 ETEXI
928 SRST
929 ``-audio-help``
930 Will show the -audiodev equivalent of the currently specified
931 (deprecated) environment variables.
932 ERST
933
934 DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
935 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
936 " specifies the audio backend to use\n"
937 " id= identifier of the backend\n"
938 " timer-period= timer period in microseconds\n"
939 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n"
940 " in|out.fixed-settings= use fixed settings for host audio\n"
941 " in|out.frequency= frequency to use with fixed settings\n"
942 " in|out.channels= number of channels to use with fixed settings\n"
943 " in|out.format= sample format to use with fixed settings\n"
944 " valid values: s8, s16, s32, u8, u16, u32\n"
945 " in|out.voices= number of voices to use\n"
946 " in|out.buffer-length= length of buffer in microseconds\n"
947 "-audiodev none,id=id,[,prop[=value][,...]]\n"
948 " dummy driver that discards all output\n"
949 #ifdef CONFIG_AUDIO_ALSA
950 "-audiodev alsa,id=id[,prop[=value][,...]]\n"
951 " in|out.dev= name of the audio device to use\n"
952 " in|out.period-length= length of period in microseconds\n"
953 " in|out.try-poll= attempt to use poll mode\n"
954 " threshold= threshold (in microseconds) when playback starts\n"
955 #endif
956 #ifdef CONFIG_AUDIO_COREAUDIO
957 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
958 " in|out.buffer-count= number of buffers\n"
959 #endif
960 #ifdef CONFIG_AUDIO_DSOUND
961 "-audiodev dsound,id=id[,prop[=value][,...]]\n"
962 " latency= add extra latency to playback in microseconds\n"
963 #endif
964 #ifdef CONFIG_AUDIO_OSS
965 "-audiodev oss,id=id[,prop[=value][,...]]\n"
966 " in|out.dev= path of the audio device to use\n"
967 " in|out.buffer-count= number of buffers\n"
968 " in|out.try-poll= attempt to use poll mode\n"
969 " try-mmap= try using memory mapped access\n"
970 " exclusive= open device in exclusive mode\n"
971 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
972 #endif
973 #ifdef CONFIG_AUDIO_PA
974 "-audiodev pa,id=id[,prop[=value][,...]]\n"
975 " server= PulseAudio server address\n"
976 " in|out.name= source/sink device name\n"
977 " in|out.latency= desired latency in microseconds\n"
978 #endif
979 #ifdef CONFIG_AUDIO_SDL
980 "-audiodev sdl,id=id[,prop[=value][,...]]\n"
981 #endif
982 #ifdef CONFIG_SPICE
983 "-audiodev spice,id=id[,prop[=value][,...]]\n"
984 #endif
985 "-audiodev wav,id=id[,prop[=value][,...]]\n"
986 " path= path of wav file to record\n",
987 QEMU_ARCH_ALL)
988 STEXI
989 @item -audiodev [driver=]@var{driver},id=@var{id}[,@var{prop}[=@var{value}][,...]]
990 @findex -audiodev
991 Adds a new audio backend @var{driver} identified by @var{id}. There are
992 global and driver specific properties. Some values can be set
993 differently for input and output, they're marked with @code{in|out.}.
994 You can set the input's property with @code{in.@var{prop}} and the
995 output's property with @code{out.@var{prop}}. For example:
996 @example
997 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
998 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
999 @end example
1000
1001 NOTE: parameter validation is known to be incomplete, in many cases
1002 specifying an invalid option causes QEMU to print an error message and
1003 continue emulation without sound.
1004
1005 Valid global options are:
1006
1007 @table @option
1008 @item id=@var{identifier}
1009 Identifies the audio backend.
1010
1011 @item timer-period=@var{period}
1012 Sets the timer @var{period} used by the audio subsystem in microseconds.
1013 Default is 10000 (10 ms).
1014
1015 @item in|out.mixing-engine=on|off
1016 Use QEMU's mixing engine to mix all streams inside QEMU and convert
1017 audio formats when not supported by the backend. When off,
1018 @var{fixed-settings} must be off too. Note that disabling this option
1019 means that the selected backend must support multiple streams and the
1020 audio formats used by the virtual cards, otherwise you'll get no sound.
1021 It's not recommended to disable this option unless you want to use 5.1
1022 or 7.1 audio, as mixing engine only supports mono and stereo audio.
1023 Default is on.
1024
1025 @item in|out.fixed-settings=on|off
1026 Use fixed settings for host audio. When off, it will change based on
1027 how the guest opens the sound card. In this case you must not specify
1028 @var{frequency}, @var{channels} or @var{format}. Default is on.
1029
1030 @item in|out.frequency=@var{frequency}
1031 Specify the @var{frequency} to use when using @var{fixed-settings}.
1032 Default is 44100Hz.
1033
1034 @item in|out.channels=@var{channels}
1035 Specify the number of @var{channels} to use when using
1036 @var{fixed-settings}. Default is 2 (stereo).
1037
1038 @item in|out.format=@var{format}
1039 Specify the sample @var{format} to use when using @var{fixed-settings}.
1040 Valid values are: @code{s8}, @code{s16}, @code{s32}, @code{u8},
1041 @code{u16}, @code{u32}. Default is @code{s16}.
1042
1043 @item in|out.voices=@var{voices}
1044 Specify the number of @var{voices} to use. Default is 1.
1045
1046 @item in|out.buffer-length=@var{usecs}
1047 Sets the size of the buffer in microseconds.
1048
1049 @end table
1050
1051 @item -audiodev none,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1052 Creates a dummy backend that discards all outputs. This backend has no
1053 backend specific properties.
1054
1055 @item -audiodev alsa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1056 Creates backend using the ALSA. This backend is only available on
1057 Linux.
1058
1059 ALSA specific options are:
1060
1061 @table @option
1062
1063 @item in|out.dev=@var{device}
1064 Specify the ALSA @var{device} to use for input and/or output. Default
1065 is @code{default}.
1066
1067 @item in|out.period-length=@var{usecs}
1068 Sets the period length in microseconds.
1069
1070 @item in|out.try-poll=on|off
1071 Attempt to use poll mode with the device. Default is on.
1072
1073 @item threshold=@var{threshold}
1074 Threshold (in microseconds) when playback starts. Default is 0.
1075
1076 @end table
1077
1078 @item -audiodev coreaudio,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1079 Creates a backend using Apple's Core Audio. This backend is only
1080 available on Mac OS and only supports playback.
1081
1082 Core Audio specific options are:
1083
1084 @table @option
1085
1086 @item in|out.buffer-count=@var{count}
1087 Sets the @var{count} of the buffers.
1088
1089 @end table
1090
1091 @item -audiodev dsound,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1092 Creates a backend using Microsoft's DirectSound. This backend is only
1093 available on Windows and only supports playback.
1094
1095 DirectSound specific options are:
1096
1097 @table @option
1098
1099 @item latency=@var{usecs}
1100 Add extra @var{usecs} microseconds latency to playback. Default is
1101 10000 (10 ms).
1102
1103 @end table
1104
1105 @item -audiodev oss,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1106 Creates a backend using OSS. This backend is available on most
1107 Unix-like systems.
1108
1109 OSS specific options are:
1110
1111 @table @option
1112
1113 @item in|out.dev=@var{device}
1114 Specify the file name of the OSS @var{device} to use. Default is
1115 @code{/dev/dsp}.
1116
1117 @item in|out.buffer-count=@var{count}
1118 Sets the @var{count} of the buffers.
1119
1120 @item in|out.try-poll=on|of
1121 Attempt to use poll mode with the device. Default is on.
1122
1123 @item try-mmap=on|off
1124 Try using memory mapped device access. Default is off.
1125
1126 @item exclusive=on|off
1127 Open the device in exclusive mode (vmix won't work in this case).
1128 Default is off.
1129
1130 @item dsp-policy=@var{policy}
1131 Sets the timing policy (between 0 and 10, where smaller number means
1132 smaller latency but higher CPU usage). Use -1 to use buffer sizes
1133 specified by @code{buffer} and @code{buffer-count}. This option is
1134 ignored if you do not have OSS 4. Default is 5.
1135
1136 @end table
1137
1138 @item -audiodev pa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1139 Creates a backend using PulseAudio. This backend is available on most
1140 systems.
1141
1142 PulseAudio specific options are:
1143
1144 @table @option
1145
1146 @item server=@var{server}
1147 Sets the PulseAudio @var{server} to connect to.
1148
1149 @item in|out.name=@var{sink}
1150 Use the specified source/sink for recording/playback.
1151
1152 @item in|out.latency=@var{usecs}
1153 Desired latency in microseconds. The PulseAudio server will try to honor this
1154 value but actual latencies may be lower or higher.
1155
1156 @end table
1157
1158 @item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1159 Creates a backend using SDL. This backend is available on most systems,
1160 but you should use your platform's native backend if possible. This
1161 backend has no backend specific properties.
1162
1163 @item -audiodev spice,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1164 Creates a backend that sends audio through SPICE. This backend requires
1165 @code{-spice} and automatically selected in that case, so usually you
1166 can ignore this option. This backend has no backend specific
1167 properties.
1168
1169 @item -audiodev wav,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1170 Creates a backend that writes audio to a WAV file.
1171
1172 Backend specific options are:
1173
1174 @table @option
1175
1176 @item path=@var{path}
1177 Write recorded audio into the specified file. Default is
1178 @code{qemu.wav}.
1179
1180 @end table
1181 ETEXI
1182 SRST
1183 ``-audiodev [driver=]driver,id=id[,prop[=value][,...]]``
1184 Adds a new audio backend driver identified by id. There are global
1185 and driver specific properties. Some values can be set differently
1186 for input and output, they're marked with ``in|out.``. You can set
1187 the input's property with ``in.prop`` and the output's property with
1188 ``out.prop``. For example:
1189
1190 ::
1191
1192 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
1193 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
1194
1195 NOTE: parameter validation is known to be incomplete, in many cases
1196 specifying an invalid option causes QEMU to print an error message
1197 and continue emulation without sound.
1198
1199 Valid global options are:
1200
1201 ``id=identifier``
1202 Identifies the audio backend.
1203
1204 ``timer-period=period``
1205 Sets the timer period used by the audio subsystem in
1206 microseconds. Default is 10000 (10 ms).
1207
1208 ``in|out.mixing-engine=on|off``
1209 Use QEMU's mixing engine to mix all streams inside QEMU and
1210 convert audio formats when not supported by the backend. When
1211 off, fixed-settings must be off too. Note that disabling this
1212 option means that the selected backend must support multiple
1213 streams and the audio formats used by the virtual cards,
1214 otherwise you'll get no sound. It's not recommended to disable
1215 this option unless you want to use 5.1 or 7.1 audio, as mixing
1216 engine only supports mono and stereo audio. Default is on.
1217
1218 ``in|out.fixed-settings=on|off``
1219 Use fixed settings for host audio. When off, it will change
1220 based on how the guest opens the sound card. In this case you
1221 must not specify frequency, channels or format. Default is on.
1222
1223 ``in|out.frequency=frequency``
1224 Specify the frequency to use when using fixed-settings. Default
1225 is 44100Hz.
1226
1227 ``in|out.channels=channels``
1228 Specify the number of channels to use when using fixed-settings.
1229 Default is 2 (stereo).
1230
1231 ``in|out.format=format``
1232 Specify the sample format to use when using fixed-settings.
1233 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``,
1234 ``u32``. Default is ``s16``.
1235
1236 ``in|out.voices=voices``
1237 Specify the number of voices to use. Default is 1.
1238
1239 ``in|out.buffer-length=usecs``
1240 Sets the size of the buffer in microseconds.
1241
1242 ``-audiodev none,id=id[,prop[=value][,...]]``
1243 Creates a dummy backend that discards all outputs. This backend has
1244 no backend specific properties.
1245
1246 ``-audiodev alsa,id=id[,prop[=value][,...]]``
1247 Creates backend using the ALSA. This backend is only available on
1248 Linux.
1249
1250 ALSA specific options are:
1251
1252 ``in|out.dev=device``
1253 Specify the ALSA device to use for input and/or output. Default
1254 is ``default``.
1255
1256 ``in|out.period-length=usecs``
1257 Sets the period length in microseconds.
1258
1259 ``in|out.try-poll=on|off``
1260 Attempt to use poll mode with the device. Default is on.
1261
1262 ``threshold=threshold``
1263 Threshold (in microseconds) when playback starts. Default is 0.
1264
1265 ``-audiodev coreaudio,id=id[,prop[=value][,...]]``
1266 Creates a backend using Apple's Core Audio. This backend is only
1267 available on Mac OS and only supports playback.
1268
1269 Core Audio specific options are:
1270
1271 ``in|out.buffer-count=count``
1272 Sets the count of the buffers.
1273
1274 ``-audiodev dsound,id=id[,prop[=value][,...]]``
1275 Creates a backend using Microsoft's DirectSound. This backend is
1276 only available on Windows and only supports playback.
1277
1278 DirectSound specific options are:
1279
1280 ``latency=usecs``
1281 Add extra usecs microseconds latency to playback. Default is
1282 10000 (10 ms).
1283
1284 ``-audiodev oss,id=id[,prop[=value][,...]]``
1285 Creates a backend using OSS. This backend is available on most
1286 Unix-like systems.
1287
1288 OSS specific options are:
1289
1290 ``in|out.dev=device``
1291 Specify the file name of the OSS device to use. Default is
1292 ``/dev/dsp``.
1293
1294 ``in|out.buffer-count=count``
1295 Sets the count of the buffers.
1296
1297 ``in|out.try-poll=on|of``
1298 Attempt to use poll mode with the device. Default is on.
1299
1300 ``try-mmap=on|off``
1301 Try using memory mapped device access. Default is off.
1302
1303 ``exclusive=on|off``
1304 Open the device in exclusive mode (vmix won't work in this
1305 case). Default is off.
1306
1307 ``dsp-policy=policy``
1308 Sets the timing policy (between 0 and 10, where smaller number
1309 means smaller latency but higher CPU usage). Use -1 to use
1310 buffer sizes specified by ``buffer`` and ``buffer-count``. This
1311 option is ignored if you do not have OSS 4. Default is 5.
1312
1313 ``-audiodev pa,id=id[,prop[=value][,...]]``
1314 Creates a backend using PulseAudio. This backend is available on
1315 most systems.
1316
1317 PulseAudio specific options are:
1318
1319 ``server=server``
1320 Sets the PulseAudio server to connect to.
1321
1322 ``in|out.name=sink``
1323 Use the specified source/sink for recording/playback.
1324
1325 ``in|out.latency=usecs``
1326 Desired latency in microseconds. The PulseAudio server will try
1327 to honor this value but actual latencies may be lower or higher.
1328
1329 ``-audiodev sdl,id=id[,prop[=value][,...]]``
1330 Creates a backend using SDL. This backend is available on most
1331 systems, but you should use your platform's native backend if
1332 possible. This backend has no backend specific properties.
1333
1334 ``-audiodev spice,id=id[,prop[=value][,...]]``
1335 Creates a backend that sends audio through SPICE. This backend
1336 requires ``-spice`` and automatically selected in that case, so
1337 usually you can ignore this option. This backend has no backend
1338 specific properties.
1339
1340 ``-audiodev wav,id=id[,prop[=value][,...]]``
1341 Creates a backend that writes audio to a WAV file.
1342
1343 Backend specific options are:
1344
1345 ``path=path``
1346 Write recorded audio into the specified file. Default is
1347 ``qemu.wav``.
1348 ERST
1349
1350 DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw,
1351 "-soundhw c1,... enable audio support\n"
1352 " and only specified sound cards (comma separated list)\n"
1353 " use '-soundhw help' to get the list of supported cards\n"
1354 " use '-soundhw all' to enable all of them\n", QEMU_ARCH_ALL)
1355 STEXI
1356 @item -soundhw @var{card1}[,@var{card2},...] or -soundhw all
1357 @findex -soundhw
1358 Enable audio and selected sound hardware. Use 'help' to print all
1359 available sound hardware. For example:
1360
1361 @example
1362 @value{qemu_system_x86} -soundhw sb16,adlib disk.img
1363 @value{qemu_system_x86} -soundhw es1370 disk.img
1364 @value{qemu_system_x86} -soundhw ac97 disk.img
1365 @value{qemu_system_x86} -soundhw hda disk.img
1366 @value{qemu_system_x86} -soundhw all disk.img
1367 @value{qemu_system_x86} -soundhw help
1368 @end example
1369
1370 Note that Linux's i810_audio OSS kernel (for AC97) module might
1371 require manually specifying clocking.
1372
1373 @example
1374 modprobe i810_audio clocking=48000
1375 @end example
1376 ETEXI
1377 SRST
1378 ``-soundhw card1[,card2,...] or -soundhw all``
1379 Enable audio and selected sound hardware. Use 'help' to print all
1380 available sound hardware. For example:
1381
1382 .. parsed-literal::
1383
1384 |qemu_system_x86| -soundhw sb16,adlib disk.img
1385 |qemu_system_x86| -soundhw es1370 disk.img
1386 |qemu_system_x86| -soundhw ac97 disk.img
1387 |qemu_system_x86| -soundhw hda disk.img
1388 |qemu_system_x86| -soundhw all disk.img
1389 |qemu_system_x86| -soundhw help
1390
1391 Note that Linux's i810\_audio OSS kernel (for AC97) module might
1392 require manually specifying clocking.
1393
1394 ::
1395
1396 modprobe i810_audio clocking=48000
1397 ERST
1398
1399 DEF("device", HAS_ARG, QEMU_OPTION_device,
1400 "-device driver[,prop[=value][,...]]\n"
1401 " add device (based on driver)\n"
1402 " prop=value,... sets driver properties\n"
1403 " use '-device help' to print all possible drivers\n"
1404 " use '-device driver,help' to print all possible properties\n",
1405 QEMU_ARCH_ALL)
1406 STEXI
1407 @item -device @var{driver}[,@var{prop}[=@var{value}][,...]]
1408 @findex -device
1409 Add device @var{driver}. @var{prop}=@var{value} sets driver
1410 properties. Valid properties depend on the driver. To get help on
1411 possible drivers and properties, use @code{-device help} and
1412 @code{-device @var{driver},help}.
1413
1414 Some drivers are:
1415 @item -device ipmi-bmc-sim,id=@var{id}[,slave_addr=@var{val}][,sdrfile=@var{file}][,furareasize=@var{val}][,furdatafile=@var{file}][,guid=@var{uuid}]
1416
1417 Add an IPMI BMC. This is a simulation of a hardware management
1418 interface processor that normally sits on a system. It provides
1419 a watchdog and the ability to reset and power control the system.
1420 You need to connect this to an IPMI interface to make it useful
1421
1422 The IPMI slave address to use for the BMC. The default is 0x20.
1423 This address is the BMC's address on the I2C network of management
1424 controllers. If you don't know what this means, it is safe to ignore
1425 it.
1426
1427 @table @option
1428 @item id=@var{id}
1429 The BMC id for interfaces to use this device.
1430 @item slave_addr=@var{val}
1431 Define slave address to use for the BMC. The default is 0x20.
1432 @item sdrfile=@var{file}
1433 file containing raw Sensor Data Records (SDR) data. The default is none.
1434 @item fruareasize=@var{val}
1435 size of a Field Replaceable Unit (FRU) area. The default is 1024.
1436 @item frudatafile=@var{file}
1437 file containing raw Field Replaceable Unit (FRU) inventory data. The default is none.
1438 @item guid=@var{uuid}
1439 value for the GUID for the BMC, in standard UUID format. If this is set,
1440 get "Get GUID" command to the BMC will return it. Otherwise "Get GUID"
1441 will return an error.
1442 @end table
1443
1444 @item -device ipmi-bmc-extern,id=@var{id},chardev=@var{id}[,slave_addr=@var{val}]
1445
1446 Add a connection to an external IPMI BMC simulator. Instead of
1447 locally emulating the BMC like the above item, instead connect
1448 to an external entity that provides the IPMI services.
1449
1450 A connection is made to an external BMC simulator. If you do this, it
1451 is strongly recommended that you use the "reconnect=" chardev option
1452 to reconnect to the simulator if the connection is lost. Note that if
1453 this is not used carefully, it can be a security issue, as the
1454 interface has the ability to send resets, NMIs, and power off the VM.
1455 It's best if QEMU makes a connection to an external simulator running
1456 on a secure port on localhost, so neither the simulator nor QEMU is
1457 exposed to any outside network.
1458
1459 See the "lanserv/README.vm" file in the OpenIPMI library for more
1460 details on the external interface.
1461
1462 @item -device isa-ipmi-kcs,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1463
1464 Add a KCS IPMI interafce on the ISA bus. This also adds a
1465 corresponding ACPI and SMBIOS entries, if appropriate.
1466
1467 @table @option
1468 @item bmc=@var{id}
1469 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above.
1470 @item ioport=@var{val}
1471 Define the I/O address of the interface. The default is 0xca0 for KCS.
1472 @item irq=@var{val}
1473 Define the interrupt to use. The default is 5. To disable interrupts,
1474 set this to 0.
1475 @end table
1476
1477 @item -device isa-ipmi-bt,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1478
1479 Like the KCS interface, but defines a BT interface. The default port is
1480 0xe4 and the default interrupt is 5.
1481
1482 ETEXI
1483 SRST
1484 ``-device driver[,prop[=value][,...]]``
1485 Add device driver. prop=value sets driver properties. Valid
1486 properties depend on the driver. To get help on possible drivers and
1487 properties, use ``-device help`` and ``-device driver,help``.
1488
1489 Some drivers are:
1490
1491 ``-device ipmi-bmc-sim,id=id[,slave_addr=val][,sdrfile=file][,furareasize=val][,furdatafile=file][,guid=uuid]``
1492 Add an IPMI BMC. This is a simulation of a hardware management
1493 interface processor that normally sits on a system. It provides a
1494 watchdog and the ability to reset and power control the system. You
1495 need to connect this to an IPMI interface to make it useful
1496
1497 The IPMI slave address to use for the BMC. The default is 0x20. This
1498 address is the BMC's address on the I2C network of management
1499 controllers. If you don't know what this means, it is safe to ignore
1500 it.
1501
1502 ``id=id``
1503 The BMC id for interfaces to use this device.
1504
1505 ``slave_addr=val``
1506 Define slave address to use for the BMC. The default is 0x20.
1507
1508 ``sdrfile=file``
1509 file containing raw Sensor Data Records (SDR) data. The default
1510 is none.
1511
1512 ``fruareasize=val``
1513 size of a Field Replaceable Unit (FRU) area. The default is
1514 1024.
1515
1516 ``frudatafile=file``
1517 file containing raw Field Replaceable Unit (FRU) inventory data.
1518 The default is none.
1519
1520 ``guid=uuid``
1521 value for the GUID for the BMC, in standard UUID format. If this
1522 is set, get "Get GUID" command to the BMC will return it.
1523 Otherwise "Get GUID" will return an error.
1524
1525 ``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]``
1526 Add a connection to an external IPMI BMC simulator. Instead of
1527 locally emulating the BMC like the above item, instead connect to an
1528 external entity that provides the IPMI services.
1529
1530 A connection is made to an external BMC simulator. If you do this,
1531 it is strongly recommended that you use the "reconnect=" chardev
1532 option to reconnect to the simulator if the connection is lost. Note
1533 that if this is not used carefully, it can be a security issue, as
1534 the interface has the ability to send resets, NMIs, and power off
1535 the VM. It's best if QEMU makes a connection to an external
1536 simulator running on a secure port on localhost, so neither the
1537 simulator nor QEMU is exposed to any outside network.
1538
1539 See the "lanserv/README.vm" file in the OpenIPMI library for more
1540 details on the external interface.
1541
1542 ``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]``
1543 Add a KCS IPMI interafce on the ISA bus. This also adds a
1544 corresponding ACPI and SMBIOS entries, if appropriate.
1545
1546 ``bmc=id``
1547 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern
1548 above.
1549
1550 ``ioport=val``
1551 Define the I/O address of the interface. The default is 0xca0
1552 for KCS.
1553
1554 ``irq=val``
1555 Define the interrupt to use. The default is 5. To disable
1556 interrupts, set this to 0.
1557
1558 ``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]``
1559 Like the KCS interface, but defines a BT interface. The default port
1560 is 0xe4 and the default interrupt is 5.
1561 ERST
1562
1563 DEF("name", HAS_ARG, QEMU_OPTION_name,
1564 "-name string1[,process=string2][,debug-threads=on|off]\n"
1565 " set the name of the guest\n"
1566 " string1 sets the window title and string2 the process name\n"
1567 " When debug-threads is enabled, individual threads are given a separate name\n"
1568 " NOTE: The thread names are for debugging and not a stable API.\n",
1569 QEMU_ARCH_ALL)
1570 STEXI
1571 @item -name @var{name}
1572 @findex -name
1573 Sets the @var{name} of the guest.
1574 This name will be displayed in the SDL window caption.
1575 The @var{name} will also be used for the VNC server.
1576 Also optionally set the top visible process name in Linux.
1577 Naming of individual threads can also be enabled on Linux to aid debugging.
1578 ETEXI
1579 SRST
1580 ``-name name``
1581 Sets the name of the guest. This name will be displayed in the SDL
1582 window caption. The name will also be used for the VNC server. Also
1583 optionally set the top visible process name in Linux. Naming of
1584 individual threads can also be enabled on Linux to aid debugging.
1585 ERST
1586
1587 DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
1588 "-uuid %08x-%04x-%04x-%04x-%012x\n"
1589 " specify machine UUID\n", QEMU_ARCH_ALL)
1590 STEXI
1591 @item -uuid @var{uuid}
1592 @findex -uuid
1593 Set system UUID.
1594 ETEXI
1595 SRST
1596 ``-uuid uuid``
1597 Set system UUID.
1598 ERST
1599
1600 STEXI
1601 @end table
1602 ETEXI
1603 DEFHEADING()
1604
1605 DEFHEADING(Block device options:)
1606 STEXI
1607 @table @option
1608 ETEXI
1609
1610 DEF("fda", HAS_ARG, QEMU_OPTION_fda,
1611 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
1612 DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
1613 STEXI
1614 @item -fda @var{file}
1615 @itemx -fdb @var{file}
1616 @findex -fda
1617 @findex -fdb
1618 Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}).
1619 ETEXI
1620 SRST
1621 ``-fda file``; \ ``-fdb file``
1622 Use file as floppy disk 0/1 image (see
1623 :ref:`disk_005fimages`).
1624 ERST
1625
1626 DEF("hda", HAS_ARG, QEMU_OPTION_hda,
1627 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
1628 DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
1629 DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
1630 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
1631 DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
1632 STEXI
1633 @item -hda @var{file}
1634 @itemx -hdb @var{file}
1635 @itemx -hdc @var{file}
1636 @itemx -hdd @var{file}
1637 @findex -hda
1638 @findex -hdb
1639 @findex -hdc
1640 @findex -hdd
1641 Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
1642 ETEXI
1643 SRST
1644 ``-hda file``; \ ``-hdb file``; \ ``-hdc file``; \ ``-hdd file``
1645 Use file as hard disk 0, 1, 2 or 3 image (see
1646 :ref:`disk_005fimages`).
1647 ERST
1648
1649 DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
1650 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
1651 QEMU_ARCH_ALL)
1652 STEXI
1653 @item -cdrom @var{file}
1654 @findex -cdrom
1655 Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and
1656 @option{-cdrom} at the same time). You can use the host CD-ROM by
1657 using @file{/dev/cdrom} as filename.
1658 ETEXI
1659 SRST
1660 ``-cdrom file``
1661 Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
1662 the same time). You can use the host CD-ROM by using ``/dev/cdrom``
1663 as filename.
1664 ERST
1665
1666 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
1667 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n"
1668 " [,cache.direct=on|off][,cache.no-flush=on|off]\n"
1669 " [,read-only=on|off][,auto-read-only=on|off]\n"
1670 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
1671 " [,driver specific parameters...]\n"
1672 " configure a block backend\n", QEMU_ARCH_ALL)
1673 STEXI
1674 @item -blockdev @var{option}[,@var{option}[,@var{option}[,...]]]
1675 @findex -blockdev
1676
1677 Define a new block driver node. Some of the options apply to all block drivers,
1678 other options are only accepted for a specific block driver. See below for a
1679 list of generic options and options for the most common block drivers.
1680
1681 Options that expect a reference to another node (e.g. @code{file}) can be
1682 given in two ways. Either you specify the node name of an already existing node
1683 (file=@var{node-name}), or you define a new node inline, adding options
1684 for the referenced node after a dot (file.filename=@var{path},file.aio=native).
1685
1686 A block driver node created with @option{-blockdev} can be used for a guest
1687 device by specifying its node name for the @code{drive} property in a
1688 @option{-device} argument that defines a block device.
1689
1690 @table @option
1691 @item Valid options for any block driver node:
1692
1693 @table @code
1694 @item driver
1695 Specifies the block driver to use for the given node.
1696 @item node-name
1697 This defines the name of the block driver node by which it will be referenced
1698 later. The name must be unique, i.e. it must not match the name of a different
1699 block driver node, or (if you use @option{-drive} as well) the ID of a drive.
1700
1701 If no node name is specified, it is automatically generated. The generated node
1702 name is not intended to be predictable and changes between QEMU invocations.
1703 For the top level, an explicit node name must be specified.
1704 @item read-only
1705 Open the node read-only. Guest write attempts will fail.
1706
1707 Note that some block drivers support only read-only access, either generally or
1708 in certain configurations. In this case, the default value
1709 @option{read-only=off} does not work and the option must be specified
1710 explicitly.
1711 @item auto-read-only
1712 If @option{auto-read-only=on} is set, QEMU may fall back to read-only usage
1713 even when @option{read-only=off} is requested, or even switch between modes as
1714 needed, e.g. depending on whether the image file is writable or whether a
1715 writing user is attached to the node.
1716 @item force-share
1717 Override the image locking system of QEMU by forcing the node to utilize
1718 weaker shared access for permissions where it would normally request exclusive
1719 access. When there is the potential for multiple instances to have the same
1720 file open (whether this invocation of QEMU is the first or the second
1721 instance), both instances must permit shared access for the second instance to
1722 succeed at opening the file.
1723
1724 Enabling @option{force-share=on} requires @option{read-only=on}.
1725 @item cache.direct
1726 The host page cache can be avoided with @option{cache.direct=on}. This will
1727 attempt to do disk IO directly to the guest's memory. QEMU may still perform an
1728 internal copy of the data.
1729 @item cache.no-flush
1730 In case you don't care about data integrity over host failures, you can use
1731 @option{cache.no-flush=on}. This option tells QEMU that it never needs to write
1732 any data to the disk but can instead keep things in cache. If anything goes
1733 wrong, like your host losing power, the disk storage getting disconnected
1734 accidentally, etc. your image will most probably be rendered unusable.
1735 @item discard=@var{discard}
1736 @var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and controls
1737 whether @code{discard} (also known as @code{trim} or @code{unmap}) requests are
1738 ignored or passed to the filesystem. Some machine types may not support
1739 discard requests.
1740 @item detect-zeroes=@var{detect-zeroes}
1741 @var{detect-zeroes} is "off", "on" or "unmap" and enables the automatic
1742 conversion of plain zero writes by the OS to driver specific optimized
1743 zero write commands. You may even choose "unmap" if @var{discard} is set
1744 to "unmap" to allow a zero write to be converted to an @code{unmap} operation.
1745 @end table
1746
1747 @item Driver-specific options for @code{file}
1748
1749 This is the protocol-level block driver for accessing regular files.
1750
1751 @table @code
1752 @item filename
1753 The path to the image file in the local filesystem
1754 @item aio
1755 Specifies the AIO backend (threads/native, default: threads)
1756 @item locking
1757 Specifies whether the image file is protected with Linux OFD / POSIX locks. The
1758 default is to use the Linux Open File Descriptor API if available, otherwise no
1759 lock is applied. (auto/on/off, default: auto)
1760 @end table
1761 Example:
1762 @example
1763 -blockdev driver=file,node-name=disk,filename=disk.img
1764 @end example
1765
1766 @item Driver-specific options for @code{raw}
1767
1768 This is the image format block driver for raw images. It is usually
1769 stacked on top of a protocol level block driver such as @code{file}.
1770
1771 @table @code
1772 @item file
1773 Reference to or definition of the data source block driver node
1774 (e.g. a @code{file} driver node)
1775 @end table
1776 Example 1:
1777 @example
1778 -blockdev driver=file,node-name=disk_file,filename=disk.img
1779 -blockdev driver=raw,node-name=disk,file=disk_file
1780 @end example
1781 Example 2:
1782 @example
1783 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1784 @end example
1785
1786 @item Driver-specific options for @code{qcow2}
1787
1788 This is the image format block driver for qcow2 images. It is usually
1789 stacked on top of a protocol level block driver such as @code{file}.
1790
1791 @table @code
1792 @item file
1793 Reference to or definition of the data source block driver node
1794 (e.g. a @code{file} driver node)
1795
1796 @item backing
1797 Reference to or definition of the backing file block device (default is taken
1798 from the image file). It is allowed to pass @code{null} here in order to disable
1799 the default backing file.
1800
1801 @item lazy-refcounts
1802 Whether to enable the lazy refcounts feature (on/off; default is taken from the
1803 image file)
1804
1805 @item cache-size
1806 The maximum total size of the L2 table and refcount block caches in bytes
1807 (default: the sum of l2-cache-size and refcount-cache-size)
1808
1809 @item l2-cache-size
1810 The maximum size of the L2 table cache in bytes
1811 (default: if cache-size is not specified - 32M on Linux platforms, and 8M on
1812 non-Linux platforms; otherwise, as large as possible within the cache-size,
1813 while permitting the requested or the minimal refcount cache size)
1814
1815 @item refcount-cache-size
1816 The maximum size of the refcount block cache in bytes
1817 (default: 4 times the cluster size; or if cache-size is specified, the part of
1818 it which is not used for the L2 cache)
1819
1820 @item cache-clean-interval
1821 Clean unused entries in the L2 and refcount caches. The interval is in seconds.
1822 The default value is 600 on supporting platforms, and 0 on other platforms.
1823 Setting it to 0 disables this feature.
1824
1825 @item pass-discard-request
1826 Whether discard requests to the qcow2 device should be forwarded to the data
1827 source (on/off; default: on if discard=unmap is specified, off otherwise)
1828
1829 @item pass-discard-snapshot
1830 Whether discard requests for the data source should be issued when a snapshot
1831 operation (e.g. deleting a snapshot) frees clusters in the qcow2 file (on/off;
1832 default: on)
1833
1834 @item pass-discard-other
1835 Whether discard requests for the data source should be issued on other
1836 occasions where a cluster gets freed (on/off; default: off)
1837
1838 @item overlap-check
1839 Which overlap checks to perform for writes to the image
1840 (none/constant/cached/all; default: cached). For details or finer
1841 granularity control refer to the QAPI documentation of @code{blockdev-add}.
1842 @end table
1843
1844 Example 1:
1845 @example
1846 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
1847 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
1848 @end example
1849 Example 2:
1850 @example
1851 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
1852 @end example
1853
1854 @item Driver-specific options for other drivers
1855 Please refer to the QAPI documentation of the @code{blockdev-add} QMP command.
1856
1857 @end table
1858
1859 ETEXI
1860 SRST
1861 ``-blockdev option[,option[,option[,...]]]``
1862 Define a new block driver node. Some of the options apply to all
1863 block drivers, other options are only accepted for a specific block
1864 driver. See below for a list of generic options and options for the
1865 most common block drivers.
1866
1867 Options that expect a reference to another node (e.g. ``file``) can
1868 be given in two ways. Either you specify the node name of an already
1869 existing node (file=node-name), or you define a new node inline,
1870 adding options for the referenced node after a dot
1871 (file.filename=path,file.aio=native).
1872
1873 A block driver node created with ``-blockdev`` can be used for a
1874 guest device by specifying its node name for the ``drive`` property
1875 in a ``-device`` argument that defines a block device.
1876
1877 ``Valid options for any block driver node:``
1878 ``driver``
1879 Specifies the block driver to use for the given node.
1880
1881 ``node-name``
1882 This defines the name of the block driver node by which it
1883 will be referenced later. The name must be unique, i.e. it
1884 must not match the name of a different block driver node, or
1885 (if you use ``-drive`` as well) the ID of a drive.
1886
1887 If no node name is specified, it is automatically generated.
1888 The generated node name is not intended to be predictable
1889 and changes between QEMU invocations. For the top level, an
1890 explicit node name must be specified.
1891
1892 ``read-only``
1893 Open the node read-only. Guest write attempts will fail.
1894
1895 Note that some block drivers support only read-only access,
1896 either generally or in certain configurations. In this case,
1897 the default value ``read-only=off`` does not work and the
1898 option must be specified explicitly.
1899
1900 ``auto-read-only``
1901 If ``auto-read-only=on`` is set, QEMU may fall back to
1902 read-only usage even when ``read-only=off`` is requested, or
1903 even switch between modes as needed, e.g. depending on
1904 whether the image file is writable or whether a writing user
1905 is attached to the node.
1906
1907 ``force-share``
1908 Override the image locking system of QEMU by forcing the
1909 node to utilize weaker shared access for permissions where
1910 it would normally request exclusive access. When there is
1911 the potential for multiple instances to have the same file
1912 open (whether this invocation of QEMU is the first or the
1913 second instance), both instances must permit shared access
1914 for the second instance to succeed at opening the file.
1915
1916 Enabling ``force-share=on`` requires ``read-only=on``.
1917
1918 ``cache.direct``
1919 The host page cache can be avoided with ``cache.direct=on``.
1920 This will attempt to do disk IO directly to the guest's
1921 memory. QEMU may still perform an internal copy of the data.
1922
1923 ``cache.no-flush``
1924 In case you don't care about data integrity over host
1925 failures, you can use ``cache.no-flush=on``. This option
1926 tells QEMU that it never needs to write any data to the disk
1927 but can instead keep things in cache. If anything goes
1928 wrong, like your host losing power, the disk storage getting
1929 disconnected accidentally, etc. your image will most
1930 probably be rendered unusable.
1931
1932 ``discard=discard``
1933 discard is one of "ignore" (or "off") or "unmap" (or "on")
1934 and controls whether ``discard`` (also known as ``trim`` or
1935 ``unmap``) requests are ignored or passed to the filesystem.
1936 Some machine types may not support discard requests.
1937
1938 ``detect-zeroes=detect-zeroes``
1939 detect-zeroes is "off", "on" or "unmap" and enables the
1940 automatic conversion of plain zero writes by the OS to
1941 driver specific optimized zero write commands. You may even
1942 choose "unmap" if discard is set to "unmap" to allow a zero
1943 write to be converted to an ``unmap`` operation.
1944
1945 ``Driver-specific options for file``
1946 This is the protocol-level block driver for accessing regular
1947 files.
1948
1949 ``filename``
1950 The path to the image file in the local filesystem
1951
1952 ``aio``
1953 Specifies the AIO backend (threads/native, default: threads)
1954
1955 ``locking``
1956 Specifies whether the image file is protected with Linux OFD
1957 / POSIX locks. The default is to use the Linux Open File
1958 Descriptor API if available, otherwise no lock is applied.
1959 (auto/on/off, default: auto)
1960
1961 Example:
1962
1963 ::
1964
1965 -blockdev driver=file,node-name=disk,filename=disk.img
1966
1967 ``Driver-specific options for raw``
1968 This is the image format block driver for raw images. It is
1969 usually stacked on top of a protocol level block driver such as
1970 ``file``.
1971
1972 ``file``
1973 Reference to or definition of the data source block driver
1974 node (e.g. a ``file`` driver node)
1975
1976 Example 1:
1977
1978 ::
1979
1980 -blockdev driver=file,node-name=disk_file,filename=disk.img
1981 -blockdev driver=raw,node-name=disk,file=disk_file
1982
1983 Example 2:
1984
1985 ::
1986
1987 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1988
1989 ``Driver-specific options for qcow2``
1990 This is the image format block driver for qcow2 images. It is
1991 usually stacked on top of a protocol level block driver such as
1992 ``file``.
1993
1994 ``file``
1995 Reference to or definition of the data source block driver
1996 node (e.g. a ``file`` driver node)
1997
1998 ``backing``
1999 Reference to or definition of the backing file block device
2000 (default is taken from the image file). It is allowed to
2001 pass ``null`` here in order to disable the default backing
2002 file.
2003
2004 ``lazy-refcounts``
2005 Whether to enable the lazy refcounts feature (on/off;
2006 default is taken from the image file)
2007
2008 ``cache-size``
2009 The maximum total size of the L2 table and refcount block
2010 caches in bytes (default: the sum of l2-cache-size and
2011 refcount-cache-size)
2012
2013 ``l2-cache-size``
2014 The maximum size of the L2 table cache in bytes (default: if
2015 cache-size is not specified - 32M on Linux platforms, and 8M
2016 on non-Linux platforms; otherwise, as large as possible
2017 within the cache-size, while permitting the requested or the
2018 minimal refcount cache size)
2019
2020 ``refcount-cache-size``
2021 The maximum size of the refcount block cache in bytes
2022 (default: 4 times the cluster size; or if cache-size is
2023 specified, the part of it which is not used for the L2
2024 cache)
2025
2026 ``cache-clean-interval``
2027 Clean unused entries in the L2 and refcount caches. The
2028 interval is in seconds. The default value is 600 on
2029 supporting platforms, and 0 on other platforms. Setting it
2030 to 0 disables this feature.
2031
2032 ``pass-discard-request``
2033 Whether discard requests to the qcow2 device should be
2034 forwarded to the data source (on/off; default: on if
2035 discard=unmap is specified, off otherwise)
2036
2037 ``pass-discard-snapshot``
2038 Whether discard requests for the data source should be
2039 issued when a snapshot operation (e.g. deleting a snapshot)
2040 frees clusters in the qcow2 file (on/off; default: on)
2041
2042 ``pass-discard-other``
2043 Whether discard requests for the data source should be
2044 issued on other occasions where a cluster gets freed
2045 (on/off; default: off)
2046
2047 ``overlap-check``
2048 Which overlap checks to perform for writes to the image
2049 (none/constant/cached/all; default: cached). For details or
2050 finer granularity control refer to the QAPI documentation of
2051 ``blockdev-add``.
2052
2053 Example 1:
2054
2055 ::
2056
2057 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
2058 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
2059
2060 Example 2:
2061
2062 ::
2063
2064 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
2065
2066 ``Driver-specific options for other drivers``
2067 Please refer to the QAPI documentation of the ``blockdev-add``
2068 QMP command.
2069 ERST
2070
2071 DEF("drive", HAS_ARG, QEMU_OPTION_drive,
2072 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
2073 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
2074 " [,snapshot=on|off][,rerror=ignore|stop|report]\n"
2075 " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n"
2076 " [,readonly=on|off][,copy-on-read=on|off]\n"
2077 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n"
2078 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n"
2079 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n"
2080 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
2081 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n"
2082 " [[,iops_size=is]]\n"
2083 " [[,group=g]]\n"
2084 " use 'file' as a drive image\n", QEMU_ARCH_ALL)
2085 STEXI
2086 @item -drive @var{option}[,@var{option}[,@var{option}[,...]]]
2087 @findex -drive
2088
2089 Define a new drive. This includes creating a block driver node (the backend) as
2090 well as a guest device, and is mostly a shortcut for defining the corresponding
2091 @option{-blockdev} and @option{-device} options.
2092
2093 @option{-drive} accepts all options that are accepted by @option{-blockdev}. In
2094 addition, it knows the following options:
2095
2096 @table @option
2097 @item file=@var{file}
2098 This option defines which disk image (@pxref{disk_images}) to use with
2099 this drive. If the filename contains comma, you must double it
2100 (for instance, "file=my,,file" to use file "my,file").
2101
2102 Special files such as iSCSI devices can be specified using protocol
2103 specific URLs. See the section for "Device URL Syntax" for more information.
2104 @item if=@var{interface}
2105 This option defines on which type on interface the drive is connected.
2106 Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none.
2107 @item bus=@var{bus},unit=@var{unit}
2108 These options define where is connected the drive by defining the bus number and
2109 the unit id.
2110 @item index=@var{index}
2111 This option defines where is connected the drive by using an index in the list
2112 of available connectors of a given interface type.
2113 @item media=@var{media}
2114 This option defines the type of the media: disk or cdrom.
2115 @item snapshot=@var{snapshot}
2116 @var{snapshot} is "on" or "off" and controls snapshot mode for the given drive
2117 (see @option{-snapshot}).
2118 @item cache=@var{cache}
2119 @var{cache} is "none", "writeback", "unsafe", "directsync" or "writethrough"
2120 and controls how the host cache is used to access block data. This is a
2121 shortcut that sets the @option{cache.direct} and @option{cache.no-flush}
2122 options (as in @option{-blockdev}), and additionally @option{cache.writeback},
2123 which provides a default for the @option{write-cache} option of block guest
2124 devices (as in @option{-device}). The modes correspond to the following
2125 settings:
2126
2127 @c Our texi2pod.pl script doesn't support @multitable, so fall back to using
2128 @c plain ASCII art (well, UTF-8 art really). This looks okay both in the manpage
2129 @c and the HTML output.
2130 @example
2131 @ │ cache.writeback cache.direct cache.no-flush
2132 ─────────────┼─────────────────────────────────────────────────
2133 writeback │ on off off
2134 none │ on on off
2135 writethrough │ off off off
2136 directsync │ off on off
2137 unsafe │ on off on
2138 @end example
2139
2140 The default mode is @option{cache=writeback}.
2141
2142 @item aio=@var{aio}
2143 @var{aio} is "threads", or "native" and selects between pthread based disk I/O and native Linux AIO.
2144 @item format=@var{format}
2145 Specify which disk @var{format} will be used rather than detecting
2146 the format. Can be used to specify format=raw to avoid interpreting
2147 an untrusted format header.
2148 @item werror=@var{action},rerror=@var{action}
2149 Specify which @var{action} to take on write and read errors. Valid actions are:
2150 "ignore" (ignore the error and try to continue), "stop" (pause QEMU),
2151 "report" (report the error to the guest), "enospc" (pause QEMU only if the
2152 host disk is full; report the error to the guest otherwise).
2153 The default setting is @option{werror=enospc} and @option{rerror=report}.
2154 @item copy-on-read=@var{copy-on-read}
2155 @var{copy-on-read} is "on" or "off" and enables whether to copy read backing
2156 file sectors into the image file.
2157 @item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
2158 Specify bandwidth throttling limits in bytes per second, either for all request
2159 types or for reads or writes only. Small values can lead to timeouts or hangs
2160 inside the guest. A safe minimum for disks is 2 MB/s.
2161 @item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}
2162 Specify bursts in bytes per second, either for all request types or for reads
2163 or writes only. Bursts allow the guest I/O to spike above the limit
2164 temporarily.
2165 @item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}
2166 Specify request rate limits in requests per second, either for all request
2167 types or for reads or writes only.
2168 @item iops_max=@var{bm},iops_rd_max=@var{rm},iops_wr_max=@var{wm}
2169 Specify bursts in requests per second, either for all request types or for reads
2170 or writes only. Bursts allow the guest I/O to spike above the limit
2171 temporarily.
2172 @item iops_size=@var{is}
2173 Let every @var{is} bytes of a request count as a new request for iops
2174 throttling purposes. Use this option to prevent guests from circumventing iops
2175 limits by sending fewer but larger requests.
2176 @item group=@var{g}
2177 Join a throttling quota group with given name @var{g}. All drives that are
2178 members of the same group are accounted for together. Use this option to
2179 prevent guests from circumventing throttling limits by using many small disks
2180 instead of a single larger disk.
2181 @end table
2182
2183 By default, the @option{cache.writeback=on} mode is used. It will report data
2184 writes as completed as soon as the data is present in the host page cache.
2185 This is safe as long as your guest OS makes sure to correctly flush disk caches
2186 where needed. If your guest OS does not handle volatile disk write caches
2187 correctly and your host crashes or loses power, then the guest may experience
2188 data corruption.
2189
2190 For such guests, you should consider using @option{cache.writeback=off}. This
2191 means that the host page cache will be used to read and write data, but write
2192 notification will be sent to the guest only after QEMU has made sure to flush
2193 each write to the disk. Be aware that this has a major impact on performance.
2194
2195 When using the @option{-snapshot} option, unsafe caching is always used.
2196
2197 Copy-on-read avoids accessing the same backing file sectors repeatedly and is
2198 useful when the backing file is over a slow network. By default copy-on-read
2199 is off.
2200
2201 Instead of @option{-cdrom} you can use:
2202 @example
2203 @value{qemu_system} -drive file=file,index=2,media=cdrom
2204 @end example
2205
2206 Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can
2207 use:
2208 @example
2209 @value{qemu_system} -drive file=file,index=0,media=disk
2210 @value{qemu_system} -drive file=file,index=1,media=disk
2211 @value{qemu_system} -drive file=file,index=2,media=disk
2212 @value{qemu_system} -drive file=file,index=3,media=disk
2213 @end example
2214
2215 You can open an image using pre-opened file descriptors from an fd set:
2216 @example
2217 @value{qemu_system} \
2218 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2219 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2220 -drive file=/dev/fdset/2,index=0,media=disk
2221 @end example
2222
2223 You can connect a CDROM to the slave of ide0:
2224 @example
2225 @value{qemu_system_x86} -drive file=file,if=ide,index=1,media=cdrom
2226 @end example
2227
2228 If you don't specify the "file=" argument, you define an empty drive:
2229 @example
2230 @value{qemu_system_x86} -drive if=ide,index=1,media=cdrom
2231 @end example
2232
2233 Instead of @option{-fda}, @option{-fdb}, you can use:
2234 @example
2235 @value{qemu_system_x86} -drive file=file,index=0,if=floppy
2236 @value{qemu_system_x86} -drive file=file,index=1,if=floppy
2237 @end example
2238
2239 By default, @var{interface} is "ide" and @var{index} is automatically
2240 incremented:
2241 @example
2242 @value{qemu_system_x86} -drive file=a -drive file=b"
2243 @end example
2244 is interpreted like:
2245 @example
2246 @value{qemu_system_x86} -hda a -hdb b
2247 @end example
2248 ETEXI
2249 SRST
2250 ``-drive option[,option[,option[,...]]]``
2251 Define a new drive. This includes creating a block driver node (the
2252 backend) as well as a guest device, and is mostly a shortcut for
2253 defining the corresponding ``-blockdev`` and ``-device`` options.
2254
2255 ``-drive`` accepts all options that are accepted by ``-blockdev``.
2256 In addition, it knows the following options:
2257
2258 ``file=file``
2259 This option defines which disk image (see
2260 :ref:`disk_005fimages`) to use with this drive. If
2261 the filename contains comma, you must double it (for instance,
2262 "file=my,,file" to use file "my,file").
2263
2264 Special files such as iSCSI devices can be specified using
2265 protocol specific URLs. See the section for "Device URL Syntax"
2266 for more information.
2267
2268 ``if=interface``
2269 This option defines on which type on interface the drive is
2270 connected. Available types are: ide, scsi, sd, mtd, floppy,
2271 pflash, virtio, none.
2272
2273 ``bus=bus,unit=unit``
2274 These options define where is connected the drive by defining
2275 the bus number and the unit id.
2276
2277 ``index=index``
2278 This option defines where is connected the drive by using an
2279 index in the list of available connectors of a given interface
2280 type.
2281
2282 ``media=media``
2283 This option defines the type of the media: disk or cdrom.
2284
2285 ``snapshot=snapshot``
2286 snapshot is "on" or "off" and controls snapshot mode for the
2287 given drive (see ``-snapshot``).
2288
2289 ``cache=cache``
2290 cache is "none", "writeback", "unsafe", "directsync" or
2291 "writethrough" and controls how the host cache is used to access
2292 block data. This is a shortcut that sets the ``cache.direct``
2293 and ``cache.no-flush`` options (as in ``-blockdev``), and
2294 additionally ``cache.writeback``, which provides a default for
2295 the ``write-cache`` option of block guest devices (as in
2296 ``-device``). The modes correspond to the following settings:
2297
2298 ::
2299
2300   â\94\82 cache.writeback cache.direct cache.no-flush
2301 ─────────────┼─────────────────────────────────────────────────
2302 writeback │ on off off
2303 none │ on on off
2304 writethrough │ off off off
2305 directsync │ off on off
2306 unsafe │ on off on
2307
2308 The default mode is ``cache=writeback``.
2309
2310 ``aio=aio``
2311 aio is "threads", or "native" and selects between pthread based
2312 disk I/O and native Linux AIO.
2313
2314 ``format=format``
2315 Specify which disk format will be used rather than detecting the
2316 format. Can be used to specify format=raw to avoid interpreting
2317 an untrusted format header.
2318
2319 ``werror=action,rerror=action``
2320 Specify which action to take on write and read errors. Valid
2321 actions are: "ignore" (ignore the error and try to continue),
2322 "stop" (pause QEMU), "report" (report the error to the guest),
2323 "enospc" (pause QEMU only if the host disk is full; report the
2324 error to the guest otherwise). The default setting is
2325 ``werror=enospc`` and ``rerror=report``.
2326
2327 ``copy-on-read=copy-on-read``
2328 copy-on-read is "on" or "off" and enables whether to copy read
2329 backing file sectors into the image file.
2330
2331 ``bps=b,bps_rd=r,bps_wr=w``
2332 Specify bandwidth throttling limits in bytes per second, either
2333 for all request types or for reads or writes only. Small values
2334 can lead to timeouts or hangs inside the guest. A safe minimum
2335 for disks is 2 MB/s.
2336
2337 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm``
2338 Specify bursts in bytes per second, either for all request types
2339 or for reads or writes only. Bursts allow the guest I/O to spike
2340 above the limit temporarily.
2341
2342 ``iops=i,iops_rd=r,iops_wr=w``
2343 Specify request rate limits in requests per second, either for
2344 all request types or for reads or writes only.
2345
2346 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm``
2347 Specify bursts in requests per second, either for all request
2348 types or for reads or writes only. Bursts allow the guest I/O to
2349 spike above the limit temporarily.
2350
2351 ``iops_size=is``
2352 Let every is bytes of a request count as a new request for iops
2353 throttling purposes. Use this option to prevent guests from
2354 circumventing iops limits by sending fewer but larger requests.
2355
2356 ``group=g``
2357 Join a throttling quota group with given name g. All drives that
2358 are members of the same group are accounted for together. Use
2359 this option to prevent guests from circumventing throttling
2360 limits by using many small disks instead of a single larger
2361 disk.
2362
2363 By default, the ``cache.writeback=on`` mode is used. It will report
2364 data writes as completed as soon as the data is present in the host
2365 page cache. This is safe as long as your guest OS makes sure to
2366 correctly flush disk caches where needed. If your guest OS does not
2367 handle volatile disk write caches correctly and your host crashes or
2368 loses power, then the guest may experience data corruption.
2369
2370 For such guests, you should consider using ``cache.writeback=off``.
2371 This means that the host page cache will be used to read and write
2372 data, but write notification will be sent to the guest only after
2373 QEMU has made sure to flush each write to the disk. Be aware that
2374 this has a major impact on performance.
2375
2376 When using the ``-snapshot`` option, unsafe caching is always used.
2377
2378 Copy-on-read avoids accessing the same backing file sectors
2379 repeatedly and is useful when the backing file is over a slow
2380 network. By default copy-on-read is off.
2381
2382 Instead of ``-cdrom`` you can use:
2383
2384 .. parsed-literal::
2385
2386 |qemu_system| -drive file=file,index=2,media=cdrom
2387
2388 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use:
2389
2390 .. parsed-literal::
2391
2392 |qemu_system| -drive file=file,index=0,media=disk
2393 |qemu_system| -drive file=file,index=1,media=disk
2394 |qemu_system| -drive file=file,index=2,media=disk
2395 |qemu_system| -drive file=file,index=3,media=disk
2396
2397 You can open an image using pre-opened file descriptors from an fd
2398 set:
2399
2400 .. parsed-literal::
2401
2402 |qemu_system| \
2403 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2404 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2405 -drive file=/dev/fdset/2,index=0,media=disk
2406
2407 You can connect a CDROM to the slave of ide0:
2408
2409 .. parsed-literal::
2410
2411 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom
2412
2413 If you don't specify the "file=" argument, you define an empty
2414 drive:
2415
2416 .. parsed-literal::
2417
2418 |qemu_system_x86| -drive if=ide,index=1,media=cdrom
2419
2420 Instead of ``-fda``, ``-fdb``, you can use:
2421
2422 .. parsed-literal::
2423
2424 |qemu_system_x86| -drive file=file,index=0,if=floppy
2425 |qemu_system_x86| -drive file=file,index=1,if=floppy
2426
2427 By default, interface is "ide" and index is automatically
2428 incremented:
2429
2430 .. parsed-literal::
2431
2432 |qemu_system_x86| -drive file=a -drive file=b"
2433
2434 is interpreted like:
2435
2436 .. parsed-literal::
2437
2438 |qemu_system_x86| -hda a -hdb b
2439 ERST
2440
2441 DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
2442 "-mtdblock file use 'file' as on-board Flash memory image\n",
2443 QEMU_ARCH_ALL)
2444 STEXI
2445 @item -mtdblock @var{file}
2446 @findex -mtdblock
2447 Use @var{file} as on-board Flash memory image.
2448 ETEXI
2449 SRST
2450 ``-mtdblock file``
2451 Use file as on-board Flash memory image.
2452 ERST
2453
2454 DEF("sd", HAS_ARG, QEMU_OPTION_sd,
2455 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL)
2456 STEXI
2457 @item -sd @var{file}
2458 @findex -sd
2459 Use @var{file} as SecureDigital card image.
2460 ETEXI
2461 SRST
2462 ``-sd file``
2463 Use file as SecureDigital card image.
2464 ERST
2465
2466 DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
2467 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
2468 STEXI
2469 @item -pflash @var{file}
2470 @findex -pflash
2471 Use @var{file} as a parallel flash image.
2472 ETEXI
2473 SRST
2474 ``-pflash file``
2475 Use file as a parallel flash image.
2476 ERST
2477
2478 DEF("snapshot", 0, QEMU_OPTION_snapshot,
2479 "-snapshot write to temporary files instead of disk image files\n",
2480 QEMU_ARCH_ALL)
2481 STEXI
2482 @item -snapshot
2483 @findex -snapshot
2484 Write to temporary files instead of disk image files. In this case,
2485 the raw disk image you use is not written back. You can however force
2486 the write back by pressing @key{C-a s} (@pxref{disk_images}).
2487 ETEXI
2488 SRST
2489 ``-snapshot``
2490 Write to temporary files instead of disk image files. In this case,
2491 the raw disk image you use is not written back. You can however
2492 force the write back by pressing C-a s (see
2493 :ref:`disk_005fimages`).
2494 ERST
2495
2496 DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
2497 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n"
2498 " [,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode]\n"
2499 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n"
2500 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n"
2501 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n"
2502 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n"
2503 " [[,throttling.iops-size=is]]\n"
2504 "-fsdev proxy,id=id,socket=socket[,writeout=immediate][,readonly]\n"
2505 "-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=immediate][,readonly]\n"
2506 "-fsdev synth,id=id\n",
2507 QEMU_ARCH_ALL)
2508
2509 STEXI
2510
2511 @item -fsdev local,id=@var{id},path=@var{path},security_model=@var{security_model} [,writeout=@var{writeout}][,readonly][,fmode=@var{fmode}][,dmode=@var{dmode}] [,throttling.@var{option}=@var{value}[,throttling.@var{option}=@var{value}[,...]]]
2512 @itemx -fsdev proxy,id=@var{id},socket=@var{socket}[,writeout=@var{writeout}][,readonly]
2513 @itemx -fsdev proxy,id=@var{id},sock_fd=@var{sock_fd}[,writeout=@var{writeout}][,readonly]
2514 @itemx -fsdev synth,id=@var{id}[,readonly]
2515 @findex -fsdev
2516 Define a new file system device. Valid options are:
2517 @table @option
2518 @item local
2519 Accesses to the filesystem are done by QEMU.
2520 @item proxy
2521 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2522 @item synth
2523 Synthetic filesystem, only used by QTests.
2524 @item id=@var{id}
2525 Specifies identifier for this device.
2526 @item path=@var{path}
2527 Specifies the export path for the file system device. Files under
2528 this path will be available to the 9p client on the guest.
2529 @item security_model=@var{security_model}
2530 Specifies the security model to be used for this export path.
2531 Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
2532 In "passthrough" security model, files are stored using the same
2533 credentials as they are created on the guest. This requires QEMU
2534 to run as root. In "mapped-xattr" security model, some of the file
2535 attributes like uid, gid, mode bits and link target are stored as
2536 file attributes. For "mapped-file" these attributes are stored in the
2537 hidden .virtfs_metadata directory. Directories exported by this security model cannot
2538 interact with other unix tools. "none" security model is same as
2539 passthrough except the sever won't report failures if it fails to
2540 set file attributes like ownership. Security model is mandatory
2541 only for local fsdriver. Other fsdrivers (like proxy) don't take
2542 security model as a parameter.
2543 @item writeout=@var{writeout}
2544 This is an optional argument. The only supported value is "immediate".
2545 This means that host page cache will be used to read and write data but
2546 write notification will be sent to the guest only when the data has been
2547 reported as written by the storage subsystem.
2548 @item readonly
2549 Enables exporting 9p share as a readonly mount for guests. By default
2550 read-write access is given.
2551 @item socket=@var{socket}
2552 Enables proxy filesystem driver to use passed socket file for communicating
2553 with virtfs-proxy-helper(1).
2554 @item sock_fd=@var{sock_fd}
2555 Enables proxy filesystem driver to use passed socket descriptor for
2556 communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2557 will create socketpair and pass one of the fds as sock_fd.
2558 @item fmode=@var{fmode}
2559 Specifies the default mode for newly created files on the host. Works only
2560 with security models "mapped-xattr" and "mapped-file".
2561 @item dmode=@var{dmode}
2562 Specifies the default mode for newly created directories on the host. Works
2563 only with security models "mapped-xattr" and "mapped-file".
2564 @item throttling.bps-total=@var{b},throttling.bps-read=@var{r},throttling.bps-write=@var{w}
2565 Specify bandwidth throttling limits in bytes per second, either for all request
2566 types or for reads or writes only.
2567 @item throttling.bps-total-max=@var{bm},bps-read-max=@var{rm},bps-write-max=@var{wm}
2568 Specify bursts in bytes per second, either for all request types or for reads
2569 or writes only. Bursts allow the guest I/O to spike above the limit
2570 temporarily.
2571 @item throttling.iops-total=@var{i},throttling.iops-read=@var{r}, throttling.iops-write=@var{w}
2572 Specify request rate limits in requests per second, either for all request
2573 types or for reads or writes only.
2574 @item throttling.iops-total-max=@var{im},throttling.iops-read-max=@var{irm}, throttling.iops-write-max=@var{iwm}
2575 Specify bursts in requests per second, either for all request types or for reads
2576 or writes only. Bursts allow the guest I/O to spike above the limit temporarily.
2577 @item throttling.iops-size=@var{is}
2578 Let every @var{is} bytes of a request count as a new request for iops
2579 throttling purposes.
2580 @end table
2581
2582 -fsdev option is used along with -device driver "virtio-9p-...".
2583 @item -device virtio-9p-@var{type},fsdev=@var{id},mount_tag=@var{mount_tag}
2584 Options for virtio-9p-... driver are:
2585 @table @option
2586 @item @var{type}
2587 Specifies the variant to be used. Supported values are "pci", "ccw" or "device",
2588 depending on the machine type.
2589 @item fsdev=@var{id}
2590 Specifies the id value specified along with -fsdev option.
2591 @item mount_tag=@var{mount_tag}
2592 Specifies the tag name to be used by the guest to mount this export point.
2593 @end table
2594
2595 ETEXI
2596 SRST
2597 ``-fsdev local,id=id,path=path,security_model=security_model [,writeout=writeout][,readonly][,fmode=fmode][,dmode=dmode] [,throttling.option=value[,throttling.option=value[,...]]]``; \ ``-fsdev proxy,id=id,socket=socket[,writeout=writeout][,readonly]``; \ ``-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=writeout][,readonly]``; \ ``-fsdev synth,id=id[,readonly]``
2598 Define a new file system device. Valid options are:
2599
2600 ``local``
2601 Accesses to the filesystem are done by QEMU.
2602
2603 ``proxy``
2604 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2605
2606 ``synth``
2607 Synthetic filesystem, only used by QTests.
2608
2609 ``id=id``
2610 Specifies identifier for this device.
2611
2612 ``path=path``
2613 Specifies the export path for the file system device. Files
2614 under this path will be available to the 9p client on the guest.
2615
2616 ``security_model=security_model``
2617 Specifies the security model to be used for this export path.
2618 Supported security models are "passthrough", "mapped-xattr",
2619 "mapped-file" and "none". In "passthrough" security model, files
2620 are stored using the same credentials as they are created on the
2621 guest. This requires QEMU to run as root. In "mapped-xattr"
2622 security model, some of the file attributes like uid, gid, mode
2623 bits and link target are stored as file attributes. For
2624 "mapped-file" these attributes are stored in the hidden
2625 .virtfs\_metadata directory. Directories exported by this
2626 security model cannot interact with other unix tools. "none"
2627 security model is same as passthrough except the sever won't
2628 report failures if it fails to set file attributes like
2629 ownership. Security model is mandatory only for local fsdriver.
2630 Other fsdrivers (like proxy) don't take security model as a
2631 parameter.
2632
2633 ``writeout=writeout``
2634 This is an optional argument. The only supported value is
2635 "immediate". This means that host page cache will be used to
2636 read and write data but write notification will be sent to the
2637 guest only when the data has been reported as written by the
2638 storage subsystem.
2639
2640 ``readonly``
2641 Enables exporting 9p share as a readonly mount for guests. By
2642 default read-write access is given.
2643
2644 ``socket=socket``
2645 Enables proxy filesystem driver to use passed socket file for
2646 communicating with virtfs-proxy-helper(1).
2647
2648 ``sock_fd=sock_fd``
2649 Enables proxy filesystem driver to use passed socket descriptor
2650 for communicating with virtfs-proxy-helper(1). Usually a helper
2651 like libvirt will create socketpair and pass one of the fds as
2652 sock\_fd.
2653
2654 ``fmode=fmode``
2655 Specifies the default mode for newly created files on the host.
2656 Works only with security models "mapped-xattr" and
2657 "mapped-file".
2658
2659 ``dmode=dmode``
2660 Specifies the default mode for newly created directories on the
2661 host. Works only with security models "mapped-xattr" and
2662 "mapped-file".
2663
2664 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w``
2665 Specify bandwidth throttling limits in bytes per second, either
2666 for all request types or for reads or writes only.
2667
2668 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm``
2669 Specify bursts in bytes per second, either for all request types
2670 or for reads or writes only. Bursts allow the guest I/O to spike
2671 above the limit temporarily.
2672
2673 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w``
2674 Specify request rate limits in requests per second, either for
2675 all request types or for reads or writes only.
2676
2677 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm``
2678 Specify bursts in requests per second, either for all request
2679 types or for reads or writes only. Bursts allow the guest I/O to
2680 spike above the limit temporarily.
2681
2682 ``throttling.iops-size=is``
2683 Let every is bytes of a request count as a new request for iops
2684 throttling purposes.
2685
2686 -fsdev option is used along with -device driver "virtio-9p-...".
2687
2688 ``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag``
2689 Options for virtio-9p-... driver are:
2690
2691 ``type``
2692 Specifies the variant to be used. Supported values are "pci",
2693 "ccw" or "device", depending on the machine type.
2694
2695 ``fsdev=id``
2696 Specifies the id value specified along with -fsdev option.
2697
2698 ``mount_tag=mount_tag``
2699 Specifies the tag name to be used by the guest to mount this
2700 export point.
2701 ERST
2702
2703 DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
2704 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n"
2705 " [,id=id][,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n"
2706 "-virtfs proxy,mount_tag=tag,socket=socket[,id=id][,writeout=immediate][,readonly]\n"
2707 "-virtfs proxy,mount_tag=tag,sock_fd=sock_fd[,id=id][,writeout=immediate][,readonly]\n"
2708 "-virtfs synth,mount_tag=tag[,id=id][,readonly]\n",
2709 QEMU_ARCH_ALL)
2710
2711 STEXI
2712
2713 @item -virtfs local,path=@var{path},mount_tag=@var{mount_tag} ,security_model=@var{security_model}[,writeout=@var{writeout}][,readonly] [,fmode=@var{fmode}][,dmode=@var{dmode}][,multidevs=@var{multidevs}]
2714 @itemx -virtfs proxy,socket=@var{socket},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2715 @itemx -virtfs proxy,sock_fd=@var{sock_fd},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2716 @itemx -virtfs synth,mount_tag=@var{mount_tag}
2717 @findex -virtfs
2718
2719 Define a new filesystem device and expose it to the guest using a virtio-9p-device. The general form of a Virtual File system pass-through options are:
2720 @table @option
2721 @item local
2722 Accesses to the filesystem are done by QEMU.
2723 @item proxy
2724 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2725 @item synth
2726 Synthetic filesystem, only used by QTests.
2727 @item id=@var{id}
2728 Specifies identifier for the filesystem device
2729 @item path=@var{path}
2730 Specifies the export path for the file system device. Files under
2731 this path will be available to the 9p client on the guest.
2732 @item security_model=@var{security_model}
2733 Specifies the security model to be used for this export path.
2734 Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
2735 In "passthrough" security model, files are stored using the same
2736 credentials as they are created on the guest. This requires QEMU
2737 to run as root. In "mapped-xattr" security model, some of the file
2738 attributes like uid, gid, mode bits and link target are stored as
2739 file attributes. For "mapped-file" these attributes are stored in the
2740 hidden .virtfs_metadata directory. Directories exported by this security model cannot
2741 interact with other unix tools. "none" security model is same as
2742 passthrough except the sever won't report failures if it fails to
2743 set file attributes like ownership. Security model is mandatory only
2744 for local fsdriver. Other fsdrivers (like proxy) don't take security
2745 model as a parameter.
2746 @item writeout=@var{writeout}
2747 This is an optional argument. The only supported value is "immediate".
2748 This means that host page cache will be used to read and write data but
2749 write notification will be sent to the guest only when the data has been
2750 reported as written by the storage subsystem.
2751 @item readonly
2752 Enables exporting 9p share as a readonly mount for guests. By default
2753 read-write access is given.
2754 @item socket=@var{socket}
2755 Enables proxy filesystem driver to use passed socket file for
2756 communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2757 will create socketpair and pass one of the fds as sock_fd.
2758 @item sock_fd
2759 Enables proxy filesystem driver to use passed 'sock_fd' as the socket
2760 descriptor for interfacing with virtfs-proxy-helper(1).
2761 @item fmode=@var{fmode}
2762 Specifies the default mode for newly created files on the host. Works only
2763 with security models "mapped-xattr" and "mapped-file".
2764 @item dmode=@var{dmode}
2765 Specifies the default mode for newly created directories on the host. Works
2766 only with security models "mapped-xattr" and "mapped-file".
2767 @item mount_tag=@var{mount_tag}
2768 Specifies the tag name to be used by the guest to mount this export point.
2769 @item multidevs=@var{multidevs}
2770 Specifies how to deal with multiple devices being shared with a 9p export.
2771 Supported behaviours are either "remap", "forbid" or "warn". The latter is
2772 the default behaviour on which virtfs 9p expects only one device to be
2773 shared with the same export, and if more than one device is shared and
2774 accessed via the same 9p export then only a warning message is logged
2775 (once) by qemu on host side. In order to avoid file ID collisions on guest
2776 you should either create a separate virtfs export for each device to be
2777 shared with guests (recommended way) or you might use "remap" instead which
2778 allows you to share multiple devices with only one export instead, which is
2779 achieved by remapping the original inode numbers from host to guest in a
2780 way that would prevent such collisions. Remapping inodes in such use cases
2781 is required because the original device IDs from host are never passed and
2782 exposed on guest. Instead all files of an export shared with virtfs always
2783 share the same device id on guest. So two files with identical inode
2784 numbers but from actually different devices on host would otherwise cause a
2785 file ID collision and hence potential misbehaviours on guest. "forbid" on
2786 the other hand assumes like "warn" that only one device is shared by the
2787 same export, however it will not only log a warning message but also
2788 deny access to additional devices on guest. Note though that "forbid" does
2789 currently not block all possible file access operations (e.g. readdir()
2790 would still return entries from other devices).
2791 @end table
2792 ETEXI
2793 SRST
2794 ``-virtfs local,path=path,mount_tag=mount_tag ,security_model=security_model[,writeout=writeout][,readonly] [,fmode=fmode][,dmode=dmode][,multidevs=multidevs]``; \ ``-virtfs proxy,socket=socket,mount_tag=mount_tag [,writeout=writeout][,readonly]``; \ ``-virtfs proxy,sock_fd=sock_fd,mount_tag=mount_tag [,writeout=writeout][,readonly]``; \ ``-virtfs synth,mount_tag=mount_tag``
2795 Define a new filesystem device and expose it to the guest using a
2796 virtio-9p-device. The general form of a Virtual File system
2797 pass-through options are:
2798
2799 ``local``
2800 Accesses to the filesystem are done by QEMU.
2801
2802 ``proxy``
2803 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2804
2805 ``synth``
2806 Synthetic filesystem, only used by QTests.
2807
2808 ``id=id``
2809 Specifies identifier for the filesystem device
2810
2811 ``path=path``
2812 Specifies the export path for the file system device. Files
2813 under this path will be available to the 9p client on the guest.
2814
2815 ``security_model=security_model``
2816 Specifies the security model to be used for this export path.
2817 Supported security models are "passthrough", "mapped-xattr",
2818 "mapped-file" and "none". In "passthrough" security model, files
2819 are stored using the same credentials as they are created on the
2820 guest. This requires QEMU to run as root. In "mapped-xattr"
2821 security model, some of the file attributes like uid, gid, mode
2822 bits and link target are stored as file attributes. For
2823 "mapped-file" these attributes are stored in the hidden
2824 .virtfs\_metadata directory. Directories exported by this
2825 security model cannot interact with other unix tools. "none"
2826 security model is same as passthrough except the sever won't
2827 report failures if it fails to set file attributes like
2828 ownership. Security model is mandatory only for local fsdriver.
2829 Other fsdrivers (like proxy) don't take security model as a
2830 parameter.
2831
2832 ``writeout=writeout``
2833 This is an optional argument. The only supported value is
2834 "immediate". This means that host page cache will be used to
2835 read and write data but write notification will be sent to the
2836 guest only when the data has been reported as written by the
2837 storage subsystem.
2838
2839 ``readonly``
2840 Enables exporting 9p share as a readonly mount for guests. By
2841 default read-write access is given.
2842
2843 ``socket=socket``
2844 Enables proxy filesystem driver to use passed socket file for
2845 communicating with virtfs-proxy-helper(1). Usually a helper like
2846 libvirt will create socketpair and pass one of the fds as
2847 sock\_fd.
2848
2849 ``sock_fd``
2850 Enables proxy filesystem driver to use passed 'sock\_fd' as the
2851 socket descriptor for interfacing with virtfs-proxy-helper(1).
2852
2853 ``fmode=fmode``
2854 Specifies the default mode for newly created files on the host.
2855 Works only with security models "mapped-xattr" and
2856 "mapped-file".
2857
2858 ``dmode=dmode``
2859 Specifies the default mode for newly created directories on the
2860 host. Works only with security models "mapped-xattr" and
2861 "mapped-file".
2862
2863 ``mount_tag=mount_tag``
2864 Specifies the tag name to be used by the guest to mount this
2865 export point.
2866
2867 ``multidevs=multidevs``
2868 Specifies how to deal with multiple devices being shared with a
2869 9p export. Supported behaviours are either "remap", "forbid" or
2870 "warn". The latter is the default behaviour on which virtfs 9p
2871 expects only one device to be shared with the same export, and
2872 if more than one device is shared and accessed via the same 9p
2873 export then only a warning message is logged (once) by qemu on
2874 host side. In order to avoid file ID collisions on guest you
2875 should either create a separate virtfs export for each device to
2876 be shared with guests (recommended way) or you might use "remap"
2877 instead which allows you to share multiple devices with only one
2878 export instead, which is achieved by remapping the original
2879 inode numbers from host to guest in a way that would prevent
2880 such collisions. Remapping inodes in such use cases is required
2881 because the original device IDs from host are never passed and
2882 exposed on guest. Instead all files of an export shared with
2883 virtfs always share the same device id on guest. So two files
2884 with identical inode numbers but from actually different devices
2885 on host would otherwise cause a file ID collision and hence
2886 potential misbehaviours on guest. "forbid" on the other hand
2887 assumes like "warn" that only one device is shared by the same
2888 export, however it will not only log a warning message but also
2889 deny access to additional devices on guest. Note though that
2890 "forbid" does currently not block all possible file access
2891 operations (e.g. readdir() would still return entries from other
2892 devices).
2893 ERST
2894
2895 DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi,
2896 "-iscsi [user=user][,password=password]\n"
2897 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE\n"
2898 " [,initiator-name=initiator-iqn][,id=target-iqn]\n"
2899 " [,timeout=timeout]\n"
2900 " iSCSI session parameters\n", QEMU_ARCH_ALL)
2901
2902 STEXI
2903 @item -iscsi
2904 @findex -iscsi
2905 Configure iSCSI session parameters.
2906 ETEXI
2907 SRST
2908 ``-iscsi``
2909 Configure iSCSI session parameters.
2910 ERST
2911
2912 STEXI
2913 @end table
2914 ETEXI
2915 DEFHEADING()
2916
2917 DEFHEADING(USB options:)
2918 STEXI
2919 @table @option
2920 ETEXI
2921
2922 DEF("usb", 0, QEMU_OPTION_usb,
2923 "-usb enable on-board USB host controller (if not enabled by default)\n",
2924 QEMU_ARCH_ALL)
2925 STEXI
2926 @item -usb
2927 @findex -usb
2928 Enable USB emulation on machine types with an on-board USB host controller (if
2929 not enabled by default). Note that on-board USB host controllers may not
2930 support USB 3.0. In this case @option{-device qemu-xhci} can be used instead
2931 on machines with PCI.
2932 ETEXI
2933 SRST
2934 ``-usb``
2935 Enable USB emulation on machine types with an on-board USB host
2936 controller (if not enabled by default). Note that on-board USB host
2937 controllers may not support USB 3.0. In this case
2938 ``-device qemu-xhci`` can be used instead on machines with PCI.
2939 ERST
2940
2941 DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
2942 "-usbdevice name add the host or guest USB device 'name'\n",
2943 QEMU_ARCH_ALL)
2944 STEXI
2945
2946 @item -usbdevice @var{devname}
2947 @findex -usbdevice
2948 Add the USB device @var{devname}. Note that this option is deprecated,
2949 please use @code{-device usb-...} instead. @xref{usb_devices}.
2950
2951 @table @option
2952
2953 @item mouse
2954 Virtual Mouse. This will override the PS/2 mouse emulation when activated.
2955
2956 @item tablet
2957 Pointer device that uses absolute coordinates (like a touchscreen). This
2958 means QEMU is able to report the mouse position without having to grab the
2959 mouse. Also overrides the PS/2 mouse emulation when activated.
2960
2961 @item braille
2962 Braille device. This will use BrlAPI to display the braille output on a real
2963 or fake device.
2964
2965 @end table
2966 ETEXI
2967 SRST
2968 ``-usbdevice devname``
2969 Add the USB device devname. Note that this option is deprecated,
2970 please use ``-device usb-...`` instead. See
2971 :ref:`usb_005fdevices`.
2972
2973 ``mouse``
2974 Virtual Mouse. This will override the PS/2 mouse emulation when
2975 activated.
2976
2977 ``tablet``
2978 Pointer device that uses absolute coordinates (like a
2979 touchscreen). This means QEMU is able to report the mouse
2980 position without having to grab the mouse. Also overrides the
2981 PS/2 mouse emulation when activated.
2982
2983 ``braille``
2984 Braille device. This will use BrlAPI to display the braille
2985 output on a real or fake device.
2986 ERST
2987
2988 STEXI
2989 @end table
2990 ETEXI
2991 DEFHEADING()
2992
2993 DEFHEADING(Display options:)
2994 STEXI
2995 @table @option
2996 ETEXI
2997
2998 DEF("display", HAS_ARG, QEMU_OPTION_display,
2999 #if defined(CONFIG_SPICE)
3000 "-display spice-app[,gl=on|off]\n"
3001 #endif
3002 #if defined(CONFIG_SDL)
3003 "-display sdl[,alt_grab=on|off][,ctrl_grab=on|off]\n"
3004 " [,window_close=on|off][,gl=on|core|es|off]\n"
3005 #endif
3006 #if defined(CONFIG_GTK)
3007 "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
3008 #endif
3009 #if defined(CONFIG_VNC)
3010 "-display vnc=<display>[,<optargs>]\n"
3011 #endif
3012 #if defined(CONFIG_CURSES)
3013 "-display curses[,charset=<encoding>]\n"
3014 #endif
3015 #if defined(CONFIG_OPENGL)
3016 "-display egl-headless[,rendernode=<file>]\n"
3017 #endif
3018 "-display none\n"
3019 " select display backend type\n"
3020 " The default display is equivalent to\n "
3021 #if defined(CONFIG_GTK)
3022 "\"-display gtk\"\n"
3023 #elif defined(CONFIG_SDL)
3024 "\"-display sdl\"\n"
3025 #elif defined(CONFIG_COCOA)
3026 "\"-display cocoa\"\n"
3027 #elif defined(CONFIG_VNC)
3028 "\"-vnc localhost:0,to=99,id=default\"\n"
3029 #else
3030 "\"-display none\"\n"
3031 #endif
3032 , QEMU_ARCH_ALL)
3033 STEXI
3034 @item -display @var{type}
3035 @findex -display
3036 Select type of display to use. This option is a replacement for the
3037 old style -sdl/-curses/... options. Use @code{-display help} to list
3038 the available display types. Valid values for @var{type} are
3039 @table @option
3040 @item sdl
3041 Display video output via SDL (usually in a separate graphics
3042 window; see the SDL documentation for other possibilities).
3043 @item curses
3044 Display video output via curses. For graphics device models which
3045 support a text mode, QEMU can display this output using a
3046 curses/ncurses interface. Nothing is displayed when the graphics
3047 device is in graphical mode or if the graphics device does not support
3048 a text mode. Generally only the VGA device models support text mode.
3049 The font charset used by the guest can be specified with the
3050 @code{charset} option, for example @code{charset=CP850} for IBM CP850
3051 encoding. The default is @code{CP437}.
3052 @item none
3053 Do not display video output. The guest will still see an emulated
3054 graphics card, but its output will not be displayed to the QEMU
3055 user. This option differs from the -nographic option in that it
3056 only affects what is done with video output; -nographic also changes
3057 the destination of the serial and parallel port data.
3058 @item gtk
3059 Display video output in a GTK window. This interface provides drop-down
3060 menus and other UI elements to configure and control the VM during
3061 runtime.
3062 @item vnc
3063 Start a VNC server on display <arg>
3064 @item egl-headless
3065 Offload all OpenGL operations to a local DRI device. For any graphical display,
3066 this display needs to be paired with either VNC or SPICE displays.
3067 @item spice-app
3068 Start QEMU as a Spice server and launch the default Spice client
3069 application. The Spice server will redirect the serial consoles and
3070 QEMU monitors. (Since 4.0)
3071 @end table
3072 ETEXI
3073 SRST
3074 ``-display type``
3075 Select type of display to use. This option is a replacement for the
3076 old style -sdl/-curses/... options. Use ``-display help`` to list
3077 the available display types. Valid values for type are
3078
3079 ``sdl``
3080 Display video output via SDL (usually in a separate graphics
3081 window; see the SDL documentation for other possibilities).
3082
3083 ``curses``
3084 Display video output via curses. For graphics device models
3085 which support a text mode, QEMU can display this output using a
3086 curses/ncurses interface. Nothing is displayed when the graphics
3087 device is in graphical mode or if the graphics device does not
3088 support a text mode. Generally only the VGA device models
3089 support text mode. The font charset used by the guest can be
3090 specified with the ``charset`` option, for example
3091 ``charset=CP850`` for IBM CP850 encoding. The default is
3092 ``CP437``.
3093
3094 ``none``
3095 Do not display video output. The guest will still see an
3096 emulated graphics card, but its output will not be displayed to
3097 the QEMU user. This option differs from the -nographic option in
3098 that it only affects what is done with video output; -nographic
3099 also changes the destination of the serial and parallel port
3100 data.
3101
3102 ``gtk``
3103 Display video output in a GTK window. This interface provides
3104 drop-down menus and other UI elements to configure and control
3105 the VM during runtime.
3106
3107 ``vnc``
3108 Start a VNC server on display <arg>
3109
3110 ``egl-headless``
3111 Offload all OpenGL operations to a local DRI device. For any
3112 graphical display, this display needs to be paired with either
3113 VNC or SPICE displays.
3114
3115 ``spice-app``
3116 Start QEMU as a Spice server and launch the default Spice client
3117 application. The Spice server will redirect the serial consoles
3118 and QEMU monitors. (Since 4.0)
3119 ERST
3120
3121 DEF("nographic", 0, QEMU_OPTION_nographic,
3122 "-nographic disable graphical output and redirect serial I/Os to console\n",
3123 QEMU_ARCH_ALL)
3124 STEXI
3125 @item -nographic
3126 @findex -nographic
3127 Normally, if QEMU is compiled with graphical window support, it displays
3128 output such as guest graphics, guest console, and the QEMU monitor in a
3129 window. With this option, you can totally disable graphical output so
3130 that QEMU is a simple command line application. The emulated serial port
3131 is redirected on the console and muxed with the monitor (unless
3132 redirected elsewhere explicitly). Therefore, you can still use QEMU to
3133 debug a Linux kernel with a serial console. Use @key{C-a h} for help on
3134 switching between the console and monitor.
3135 ETEXI
3136 SRST
3137 ``-nographic``
3138 Normally, if QEMU is compiled with graphical window support, it
3139 displays output such as guest graphics, guest console, and the QEMU
3140 monitor in a window. With this option, you can totally disable
3141 graphical output so that QEMU is a simple command line application.
3142 The emulated serial port is redirected on the console and muxed with
3143 the monitor (unless redirected elsewhere explicitly). Therefore, you
3144 can still use QEMU to debug a Linux kernel with a serial console.
3145 Use C-a h for help on switching between the console and monitor.
3146 ERST
3147
3148 DEF("curses", 0, QEMU_OPTION_curses,
3149 "-curses shorthand for -display curses\n",
3150 QEMU_ARCH_ALL)
3151 STEXI
3152 @item -curses
3153 @findex -curses
3154 Normally, if QEMU is compiled with graphical window support, it displays
3155 output such as guest graphics, guest console, and the QEMU monitor in a
3156 window. With this option, QEMU can display the VGA output when in text
3157 mode using a curses/ncurses interface. Nothing is displayed in graphical
3158 mode.
3159 ETEXI
3160 SRST
3161 ``-curses``
3162 Normally, if QEMU is compiled with graphical window support, it
3163 displays output such as guest graphics, guest console, and the QEMU
3164 monitor in a window. With this option, QEMU can display the VGA
3165 output when in text mode using a curses/ncurses interface. Nothing
3166 is displayed in graphical mode.
3167 ERST
3168
3169 DEF("alt-grab", 0, QEMU_OPTION_alt_grab,
3170 "-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n",
3171 QEMU_ARCH_ALL)
3172 STEXI
3173 @item -alt-grab
3174 @findex -alt-grab
3175 Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that this also
3176 affects the special keys (for fullscreen, monitor-mode switching, etc).
3177 ETEXI
3178 SRST
3179 ``-alt-grab``
3180 Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that
3181 this also affects the special keys (for fullscreen, monitor-mode
3182 switching, etc).
3183 ERST
3184
3185 DEF("ctrl-grab", 0, QEMU_OPTION_ctrl_grab,
3186 "-ctrl-grab use Right-Ctrl to grab mouse (instead of Ctrl-Alt)\n",
3187 QEMU_ARCH_ALL)
3188 STEXI
3189 @item -ctrl-grab
3190 @findex -ctrl-grab
3191 Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this also
3192 affects the special keys (for fullscreen, monitor-mode switching, etc).
3193 ETEXI
3194 SRST
3195 ``-ctrl-grab``
3196 Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this
3197 also affects the special keys (for fullscreen, monitor-mode
3198 switching, etc).
3199 ERST
3200
3201 DEF("no-quit", 0, QEMU_OPTION_no_quit,
3202 "-no-quit disable SDL window close capability\n", QEMU_ARCH_ALL)
3203 STEXI
3204 @item -no-quit
3205 @findex -no-quit
3206 Disable SDL window close capability.
3207 ETEXI
3208 SRST
3209 ``-no-quit``
3210 Disable SDL window close capability.
3211 ERST
3212
3213 DEF("sdl", 0, QEMU_OPTION_sdl,
3214 "-sdl shorthand for -display sdl\n", QEMU_ARCH_ALL)
3215 STEXI
3216 @item -sdl
3217 @findex -sdl
3218 Enable SDL.
3219 ETEXI
3220 SRST
3221 ``-sdl``
3222 Enable SDL.
3223 ERST
3224
3225 DEF("spice", HAS_ARG, QEMU_OPTION_spice,
3226 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
3227 " [,x509-key-file=<file>][,x509-key-password=<file>]\n"
3228 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
3229 " [,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6|unix]\n"
3230 " [,tls-ciphers=<list>]\n"
3231 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n"
3232 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n"
3233 " [,sasl][,password=<secret>][,disable-ticketing]\n"
3234 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n"
3235 " [,jpeg-wan-compression=[auto|never|always]]\n"
3236 " [,zlib-glz-wan-compression=[auto|never|always]]\n"
3237 " [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
3238 " [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
3239 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
3240 " [,gl=[on|off]][,rendernode=<file>]\n"
3241 " enable spice\n"
3242 " at least one of {port, tls-port} is mandatory\n",
3243 QEMU_ARCH_ALL)
3244 STEXI
3245 @item -spice @var{option}[,@var{option}[,...]]
3246 @findex -spice
3247 Enable the spice remote desktop protocol. Valid options are
3248
3249 @table @option
3250
3251 @item port=<nr>
3252 Set the TCP port spice is listening on for plaintext channels.
3253
3254 @item addr=<addr>
3255 Set the IP address spice is listening on. Default is any address.
3256
3257 @item ipv4
3258 @itemx ipv6
3259 @itemx unix
3260 Force using the specified IP version.
3261
3262 @item password=<secret>
3263 Set the password you need to authenticate.
3264
3265 @item sasl
3266 Require that the client use SASL to authenticate with the spice.
3267 The exact choice of authentication method used is controlled from the
3268 system / user's SASL configuration file for the 'qemu' service. This
3269 is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3270 unprivileged user, an environment variable SASL_CONF_PATH can be used
3271 to make it search alternate locations for the service config.
3272 While some SASL auth methods can also provide data encryption (eg GSSAPI),
3273 it is recommended that SASL always be combined with the 'tls' and
3274 'x509' settings to enable use of SSL and server certificates. This
3275 ensures a data encryption preventing compromise of authentication
3276 credentials.
3277
3278 @item disable-ticketing
3279 Allow client connects without authentication.
3280
3281 @item disable-copy-paste
3282 Disable copy paste between the client and the guest.
3283
3284 @item disable-agent-file-xfer
3285 Disable spice-vdagent based file-xfer between the client and the guest.
3286
3287 @item tls-port=<nr>
3288 Set the TCP port spice is listening on for encrypted channels.
3289
3290 @item x509-dir=<dir>
3291 Set the x509 file directory. Expects same filenames as -vnc $display,x509=$dir
3292
3293 @item x509-key-file=<file>
3294 @itemx x509-key-password=<file>
3295 @itemx x509-cert-file=<file>
3296 @itemx x509-cacert-file=<file>
3297 @itemx x509-dh-key-file=<file>
3298 The x509 file names can also be configured individually.
3299
3300 @item tls-ciphers=<list>
3301 Specify which ciphers to use.
3302
3303 @item tls-channel=[main|display|cursor|inputs|record|playback]
3304 @itemx plaintext-channel=[main|display|cursor|inputs|record|playback]
3305 Force specific channel to be used with or without TLS encryption. The
3306 options can be specified multiple times to configure multiple
3307 channels. The special name "default" can be used to set the default
3308 mode. For channels which are not explicitly forced into one mode the
3309 spice client is allowed to pick tls/plaintext as he pleases.
3310
3311 @item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
3312 Configure image compression (lossless).
3313 Default is auto_glz.
3314
3315 @item jpeg-wan-compression=[auto|never|always]
3316 @itemx zlib-glz-wan-compression=[auto|never|always]
3317 Configure wan image compression (lossy for slow links).
3318 Default is auto.
3319
3320 @item streaming-video=[off|all|filter]
3321 Configure video stream detection. Default is off.
3322
3323 @item agent-mouse=[on|off]
3324 Enable/disable passing mouse events via vdagent. Default is on.
3325
3326 @item playback-compression=[on|off]
3327 Enable/disable audio stream compression (using celt 0.5.1). Default is on.
3328
3329 @item seamless-migration=[on|off]
3330 Enable/disable spice seamless migration. Default is off.
3331
3332 @item gl=[on|off]
3333 Enable/disable OpenGL context. Default is off.
3334
3335 @item rendernode=<file>
3336 DRM render node for OpenGL rendering. If not specified, it will pick
3337 the first available. (Since 2.9)
3338
3339 @end table
3340 ETEXI
3341 SRST
3342 ``-spice option[,option[,...]]``
3343 Enable the spice remote desktop protocol. Valid options are
3344
3345 ``port=<nr>``
3346 Set the TCP port spice is listening on for plaintext channels.
3347
3348 ``addr=<addr>``
3349 Set the IP address spice is listening on. Default is any
3350 address.
3351
3352 ``ipv4``; \ ``ipv6``; \ ``unix``
3353 Force using the specified IP version.
3354
3355 ``password=<secret>``
3356 Set the password you need to authenticate.
3357
3358 ``sasl``
3359 Require that the client use SASL to authenticate with the spice.
3360 The exact choice of authentication method used is controlled
3361 from the system / user's SASL configuration file for the 'qemu'
3362 service. This is typically found in /etc/sasl2/qemu.conf. If
3363 running QEMU as an unprivileged user, an environment variable
3364 SASL\_CONF\_PATH can be used to make it search alternate
3365 locations for the service config. While some SASL auth methods
3366 can also provide data encryption (eg GSSAPI), it is recommended
3367 that SASL always be combined with the 'tls' and 'x509' settings
3368 to enable use of SSL and server certificates. This ensures a
3369 data encryption preventing compromise of authentication
3370 credentials.
3371
3372 ``disable-ticketing``
3373 Allow client connects without authentication.
3374
3375 ``disable-copy-paste``
3376 Disable copy paste between the client and the guest.
3377
3378 ``disable-agent-file-xfer``
3379 Disable spice-vdagent based file-xfer between the client and the
3380 guest.
3381
3382 ``tls-port=<nr>``
3383 Set the TCP port spice is listening on for encrypted channels.
3384
3385 ``x509-dir=<dir>``
3386 Set the x509 file directory. Expects same filenames as -vnc
3387 $display,x509=$dir
3388
3389 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>``
3390 The x509 file names can also be configured individually.
3391
3392 ``tls-ciphers=<list>``
3393 Specify which ciphers to use.
3394
3395 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]``
3396 Force specific channel to be used with or without TLS
3397 encryption. The options can be specified multiple times to
3398 configure multiple channels. The special name "default" can be
3399 used to set the default mode. For channels which are not
3400 explicitly forced into one mode the spice client is allowed to
3401 pick tls/plaintext as he pleases.
3402
3403 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]``
3404 Configure image compression (lossless). Default is auto\_glz.
3405
3406 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]``
3407 Configure wan image compression (lossy for slow links). Default
3408 is auto.
3409
3410 ``streaming-video=[off|all|filter]``
3411 Configure video stream detection. Default is off.
3412
3413 ``agent-mouse=[on|off]``
3414 Enable/disable passing mouse events via vdagent. Default is on.
3415
3416 ``playback-compression=[on|off]``
3417 Enable/disable audio stream compression (using celt 0.5.1).
3418 Default is on.
3419
3420 ``seamless-migration=[on|off]``
3421 Enable/disable spice seamless migration. Default is off.
3422
3423 ``gl=[on|off]``
3424 Enable/disable OpenGL context. Default is off.
3425
3426 ``rendernode=<file>``
3427 DRM render node for OpenGL rendering. If not specified, it will
3428 pick the first available. (Since 2.9)
3429 ERST
3430
3431 DEF("portrait", 0, QEMU_OPTION_portrait,
3432 "-portrait rotate graphical output 90 deg left (only PXA LCD)\n",
3433 QEMU_ARCH_ALL)
3434 STEXI
3435 @item -portrait
3436 @findex -portrait
3437 Rotate graphical output 90 deg left (only PXA LCD).
3438 ETEXI
3439 SRST
3440 ``-portrait``
3441 Rotate graphical output 90 deg left (only PXA LCD).
3442 ERST
3443
3444 DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
3445 "-rotate <deg> rotate graphical output some deg left (only PXA LCD)\n",
3446 QEMU_ARCH_ALL)
3447 STEXI
3448 @item -rotate @var{deg}
3449 @findex -rotate
3450 Rotate graphical output some deg left (only PXA LCD).
3451 ETEXI
3452 SRST
3453 ``-rotate deg``
3454 Rotate graphical output some deg left (only PXA LCD).
3455 ERST
3456
3457 DEF("vga", HAS_ARG, QEMU_OPTION_vga,
3458 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
3459 " select video card type\n", QEMU_ARCH_ALL)
3460 STEXI
3461 @item -vga @var{type}
3462 @findex -vga
3463 Select type of VGA card to emulate. Valid values for @var{type} are
3464 @table @option
3465 @item cirrus
3466 Cirrus Logic GD5446 Video card. All Windows versions starting from
3467 Windows 95 should recognize and use this graphic card. For optimal
3468 performances, use 16 bit color depth in the guest and the host OS.
3469 (This card was the default before QEMU 2.2)
3470 @item std
3471 Standard VGA card with Bochs VBE extensions. If your guest OS
3472 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if you want
3473 to use high resolution modes (>= 1280x1024x16) then you should use
3474 this option. (This card is the default since QEMU 2.2)
3475 @item vmware
3476 VMWare SVGA-II compatible adapter. Use it if you have sufficiently
3477 recent XFree86/XOrg server or Windows guest with a driver for this
3478 card.
3479 @item qxl
3480 QXL paravirtual graphic card. It is VGA compatible (including VESA
3481 2.0 VBE support). Works best with qxl guest drivers installed though.
3482 Recommended choice when using the spice protocol.
3483 @item tcx
3484 (sun4m only) Sun TCX framebuffer. This is the default framebuffer for
3485 sun4m machines and offers both 8-bit and 24-bit colour depths at a
3486 fixed resolution of 1024x768.
3487 @item cg3
3488 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
3489 for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
3490 resolutions aimed at people wishing to run older Solaris versions.
3491 @item virtio
3492 Virtio VGA card.
3493 @item none
3494 Disable VGA card.
3495 @end table
3496 ETEXI
3497 SRST
3498 ``-vga type``
3499 Select type of VGA card to emulate. Valid values for type are
3500
3501 ``cirrus``
3502 Cirrus Logic GD5446 Video card. All Windows versions starting
3503 from Windows 95 should recognize and use this graphic card. For
3504 optimal performances, use 16 bit color depth in the guest and
3505 the host OS. (This card was the default before QEMU 2.2)
3506
3507 ``std``
3508 Standard VGA card with Bochs VBE extensions. If your guest OS
3509 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
3510 you want to use high resolution modes (>= 1280x1024x16) then you
3511 should use this option. (This card is the default since QEMU
3512 2.2)
3513
3514 ``vmware``
3515 VMWare SVGA-II compatible adapter. Use it if you have
3516 sufficiently recent XFree86/XOrg server or Windows guest with a
3517 driver for this card.
3518
3519 ``qxl``
3520 QXL paravirtual graphic card. It is VGA compatible (including
3521 VESA 2.0 VBE support). Works best with qxl guest drivers
3522 installed though. Recommended choice when using the spice
3523 protocol.
3524
3525 ``tcx``
3526 (sun4m only) Sun TCX framebuffer. This is the default
3527 framebuffer for sun4m machines and offers both 8-bit and 24-bit
3528 colour depths at a fixed resolution of 1024x768.
3529
3530 ``cg3``
3531 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
3532 framebuffer for sun4m machines available in both 1024x768
3533 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
3534 wishing to run older Solaris versions.
3535
3536 ``virtio``
3537 Virtio VGA card.
3538
3539 ``none``
3540 Disable VGA card.
3541 ERST
3542
3543 DEF("full-screen", 0, QEMU_OPTION_full_screen,
3544 "-full-screen start in full screen\n", QEMU_ARCH_ALL)
3545 STEXI
3546 @item -full-screen
3547 @findex -full-screen
3548 Start in full screen.
3549 ETEXI
3550 SRST
3551 ``-full-screen``
3552 Start in full screen.
3553 ERST
3554
3555 DEF("g", HAS_ARG, QEMU_OPTION_g ,
3556 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
3557 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
3558 STEXI
3559 @item -g @var{width}x@var{height}[x@var{depth}]
3560 @findex -g
3561 Set the initial graphical resolution and depth (PPC, SPARC only).
3562
3563 For PPC the default is 800x600x32.
3564
3565 For SPARC with the TCX graphics device, the default is 1024x768x8 with the
3566 option of 1024x768x24. For cgthree, the default is 1024x768x8 with the option
3567 of 1152x900x8 for people who wish to use OBP.
3568
3569 ETEXI
3570 SRST
3571 ``-g widthxheight[xdepth]``
3572 Set the initial graphical resolution and depth (PPC, SPARC only).
3573
3574 For PPC the default is 800x600x32.
3575
3576 For SPARC with the TCX graphics device, the default is 1024x768x8
3577 with the option of 1024x768x24. For cgthree, the default is
3578 1024x768x8 with the option of 1152x900x8 for people who wish to use
3579 OBP.
3580 ERST
3581
3582 DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
3583 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL)
3584 STEXI
3585 @item -vnc @var{display}[,@var{option}[,@var{option}[,...]]]
3586 @findex -vnc
3587 Normally, if QEMU is compiled with graphical window support, it displays
3588 output such as guest graphics, guest console, and the QEMU monitor in a
3589 window. With this option, you can have QEMU listen on VNC display
3590 @var{display} and redirect the VGA display over the VNC session. It is
3591 very useful to enable the usb tablet device when using this option
3592 (option @option{-device usb-tablet}). When using the VNC display, you
3593 must use the @option{-k} parameter to set the keyboard layout if you are
3594 not using en-us. Valid syntax for the @var{display} is
3595
3596 @table @option
3597
3598 @item to=@var{L}
3599
3600 With this option, QEMU will try next available VNC @var{display}s, until the
3601 number @var{L}, if the origianlly defined "-vnc @var{display}" is not
3602 available, e.g. port 5900+@var{display} is already used by another
3603 application. By default, to=0.
3604
3605 @item @var{host}:@var{d}
3606
3607 TCP connections will only be allowed from @var{host} on display @var{d}.
3608 By convention the TCP port is 5900+@var{d}. Optionally, @var{host} can
3609 be omitted in which case the server will accept connections from any host.
3610
3611 @item unix:@var{path}
3612
3613 Connections will be allowed over UNIX domain sockets where @var{path} is the
3614 location of a unix socket to listen for connections on.
3615
3616 @item none
3617
3618 VNC is initialized but not started. The monitor @code{change} command
3619 can be used to later start the VNC server.
3620
3621 @end table
3622
3623 Following the @var{display} value there may be one or more @var{option} flags
3624 separated by commas. Valid options are
3625
3626 @table @option
3627
3628 @item reverse
3629
3630 Connect to a listening VNC client via a ``reverse'' connection. The
3631 client is specified by the @var{display}. For reverse network
3632 connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument
3633 is a TCP port number, not a display number.
3634
3635 @item websocket
3636
3637 Opens an additional TCP listening port dedicated to VNC Websocket connections.
3638 If a bare @var{websocket} option is given, the Websocket port is
3639 5700+@var{display}. An alternative port can be specified with the
3640 syntax @code{websocket}=@var{port}.
3641
3642 If @var{host} is specified connections will only be allowed from this host.
3643 It is possible to control the websocket listen address independently, using
3644 the syntax @code{websocket}=@var{host}:@var{port}.
3645
3646 If no TLS credentials are provided, the websocket connection runs in
3647 unencrypted mode. If TLS credentials are provided, the websocket connection
3648 requires encrypted client connections.
3649
3650 @item password
3651
3652 Require that password based authentication is used for client connections.
3653
3654 The password must be set separately using the @code{set_password} command in
3655 the @ref{pcsys_monitor}. The syntax to change your password is:
3656 @code{set_password <protocol> <password>} where <protocol> could be either
3657 "vnc" or "spice".
3658
3659 If you would like to change <protocol> password expiration, you should use
3660 @code{expire_password <protocol> <expiration-time>} where expiration time could
3661 be one of the following options: now, never, +seconds or UNIX time of
3662 expiration, e.g. +60 to make password expire in 60 seconds, or 1335196800
3663 to make password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for this
3664 date and time).
3665
3666 You can also use keywords "now" or "never" for the expiration time to
3667 allow <protocol> password to expire immediately or never expire.
3668
3669 @item tls-creds=@var{ID}
3670
3671 Provides the ID of a set of TLS credentials to use to secure the
3672 VNC server. They will apply to both the normal VNC server socket
3673 and the websocket socket (if enabled). Setting TLS credentials
3674 will cause the VNC server socket to enable the VeNCrypt auth
3675 mechanism. The credentials should have been previously created
3676 using the @option{-object tls-creds} argument.
3677
3678 @item tls-authz=@var{ID}
3679
3680 Provides the ID of the QAuthZ authorization object against which
3681 the client's x509 distinguished name will validated. This object is
3682 only resolved at time of use, so can be deleted and recreated on the
3683 fly while the VNC server is active. If missing, it will default
3684 to denying access.
3685
3686 @item sasl
3687
3688 Require that the client use SASL to authenticate with the VNC server.
3689 The exact choice of authentication method used is controlled from the
3690 system / user's SASL configuration file for the 'qemu' service. This
3691 is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3692 unprivileged user, an environment variable SASL_CONF_PATH can be used
3693 to make it search alternate locations for the service config.
3694 While some SASL auth methods can also provide data encryption (eg GSSAPI),
3695 it is recommended that SASL always be combined with the 'tls' and
3696 'x509' settings to enable use of SSL and server certificates. This
3697 ensures a data encryption preventing compromise of authentication
3698 credentials. See the @ref{vnc_security} section for details on using
3699 SASL authentication.
3700
3701 @item sasl-authz=@var{ID}
3702
3703 Provides the ID of the QAuthZ authorization object against which
3704 the client's SASL username will validated. This object is
3705 only resolved at time of use, so can be deleted and recreated on the
3706 fly while the VNC server is active. If missing, it will default
3707 to denying access.
3708
3709 @item acl
3710
3711 Legacy method for enabling authorization of clients against the
3712 x509 distinguished name and SASL username. It results in the creation
3713 of two @code{authz-list} objects with IDs of @code{vnc.username} and
3714 @code{vnc.x509dname}. The rules for these objects must be configured
3715 with the HMP ACL commands.
3716
3717 This option is deprecated and should no longer be used. The new
3718 @option{sasl-authz} and @option{tls-authz} options are a
3719 replacement.
3720
3721 @item lossy
3722
3723 Enable lossy compression methods (gradient, JPEG, ...). If this
3724 option is set, VNC client may receive lossy framebuffer updates
3725 depending on its encoding settings. Enabling this option can save
3726 a lot of bandwidth at the expense of quality.
3727
3728 @item non-adaptive
3729
3730 Disable adaptive encodings. Adaptive encodings are enabled by default.
3731 An adaptive encoding will try to detect frequently updated screen regions,
3732 and send updates in these regions using a lossy encoding (like JPEG).
3733 This can be really helpful to save bandwidth when playing videos. Disabling
3734 adaptive encodings restores the original static behavior of encodings
3735 like Tight.
3736
3737 @item share=[allow-exclusive|force-shared|ignore]
3738
3739 Set display sharing policy. 'allow-exclusive' allows clients to ask
3740 for exclusive access. As suggested by the rfb spec this is
3741 implemented by dropping other connections. Connecting multiple
3742 clients in parallel requires all clients asking for a shared session
3743 (vncviewer: -shared switch). This is the default. 'force-shared'
3744 disables exclusive client access. Useful for shared desktop sessions,
3745 where you don't want someone forgetting specify -shared disconnect
3746 everybody else. 'ignore' completely ignores the shared flag and
3747 allows everybody connect unconditionally. Doesn't conform to the rfb
3748 spec but is traditional QEMU behavior.
3749
3750 @item key-delay-ms
3751
3752 Set keyboard delay, for key down and key up events, in milliseconds.
3753 Default is 10. Keyboards are low-bandwidth devices, so this slowdown
3754 can help the device and guest to keep up and not lose events in case
3755 events are arriving in bulk. Possible causes for the latter are flaky
3756 network connections, or scripts for automated testing.
3757
3758 @item audiodev=@var{audiodev}
3759
3760 Use the specified @var{audiodev} when the VNC client requests audio
3761 transmission. When not using an -audiodev argument, this option must
3762 be omitted, otherwise is must be present and specify a valid audiodev.
3763
3764 @end table
3765 ETEXI
3766 SRST
3767 ``-vnc display[,option[,option[,...]]]``
3768 Normally, if QEMU is compiled with graphical window support, it
3769 displays output such as guest graphics, guest console, and the QEMU
3770 monitor in a window. With this option, you can have QEMU listen on
3771 VNC display display and redirect the VGA display over the VNC
3772 session. It is very useful to enable the usb tablet device when
3773 using this option (option ``-device usb-tablet``). When using the
3774 VNC display, you must use the ``-k`` parameter to set the keyboard
3775 layout if you are not using en-us. Valid syntax for the display is
3776
3777 ``to=L``
3778 With this option, QEMU will try next available VNC displays,
3779 until the number L, if the origianlly defined "-vnc display" is
3780 not available, e.g. port 5900+display is already used by another
3781 application. By default, to=0.
3782
3783 ``host:d``
3784 TCP connections will only be allowed from host on display d. By
3785 convention the TCP port is 5900+d. Optionally, host can be
3786 omitted in which case the server will accept connections from
3787 any host.
3788
3789 ``unix:path``
3790 Connections will be allowed over UNIX domain sockets where path
3791 is the location of a unix socket to listen for connections on.
3792
3793 ``none``
3794 VNC is initialized but not started. The monitor ``change``
3795 command can be used to later start the VNC server.
3796
3797 Following the display value there may be one or more option flags
3798 separated by commas. Valid options are
3799
3800 ``reverse``
3801 Connect to a listening VNC client via a "reverse" connection.
3802 The client is specified by the display. For reverse network
3803 connections (host:d,``reverse``), the d argument is a TCP port
3804 number, not a display number.
3805
3806 ``websocket``
3807 Opens an additional TCP listening port dedicated to VNC
3808 Websocket connections. If a bare websocket option is given, the
3809 Websocket port is 5700+display. An alternative port can be
3810 specified with the syntax ``websocket``\ =port.
3811
3812 If host is specified connections will only be allowed from this
3813 host. It is possible to control the websocket listen address
3814 independently, using the syntax ``websocket``\ =host:port.
3815
3816 If no TLS credentials are provided, the websocket connection
3817 runs in unencrypted mode. If TLS credentials are provided, the
3818 websocket connection requires encrypted client connections.
3819
3820 ``password``
3821 Require that password based authentication is used for client
3822 connections.
3823
3824 The password must be set separately using the ``set_password``
3825 command in the :ref:`pcsys_005fmonitor`. The
3826 syntax to change your password is:
3827 ``set_password <protocol> <password>`` where <protocol> could be
3828 either "vnc" or "spice".
3829
3830 If you would like to change <protocol> password expiration, you
3831 should use ``expire_password <protocol> <expiration-time>``
3832 where expiration time could be one of the following options:
3833 now, never, +seconds or UNIX time of expiration, e.g. +60 to
3834 make password expire in 60 seconds, or 1335196800 to make
3835 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for
3836 this date and time).
3837
3838 You can also use keywords "now" or "never" for the expiration
3839 time to allow <protocol> password to expire immediately or never
3840 expire.
3841
3842 ``tls-creds=ID``
3843 Provides the ID of a set of TLS credentials to use to secure the
3844 VNC server. They will apply to both the normal VNC server socket
3845 and the websocket socket (if enabled). Setting TLS credentials
3846 will cause the VNC server socket to enable the VeNCrypt auth
3847 mechanism. The credentials should have been previously created
3848 using the ``-object tls-creds`` argument.
3849
3850 ``tls-authz=ID``
3851 Provides the ID of the QAuthZ authorization object against which
3852 the client's x509 distinguished name will validated. This object
3853 is only resolved at time of use, so can be deleted and recreated
3854 on the fly while the VNC server is active. If missing, it will
3855 default to denying access.
3856
3857 ``sasl``
3858 Require that the client use SASL to authenticate with the VNC
3859 server. The exact choice of authentication method used is
3860 controlled from the system / user's SASL configuration file for
3861 the 'qemu' service. This is typically found in
3862 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user,
3863 an environment variable SASL\_CONF\_PATH can be used to make it
3864 search alternate locations for the service config. While some
3865 SASL auth methods can also provide data encryption (eg GSSAPI),
3866 it is recommended that SASL always be combined with the 'tls'
3867 and 'x509' settings to enable use of SSL and server
3868 certificates. This ensures a data encryption preventing
3869 compromise of authentication credentials. See the
3870 :ref:`vnc_005fsecurity` section for details on
3871 using SASL authentication.
3872
3873 ``sasl-authz=ID``
3874 Provides the ID of the QAuthZ authorization object against which
3875 the client's SASL username will validated. This object is only
3876 resolved at time of use, so can be deleted and recreated on the
3877 fly while the VNC server is active. If missing, it will default
3878 to denying access.
3879
3880 ``acl``
3881 Legacy method for enabling authorization of clients against the
3882 x509 distinguished name and SASL username. It results in the
3883 creation of two ``authz-list`` objects with IDs of
3884 ``vnc.username`` and ``vnc.x509dname``. The rules for these
3885 objects must be configured with the HMP ACL commands.
3886
3887 This option is deprecated and should no longer be used. The new
3888 ``sasl-authz`` and ``tls-authz`` options are a replacement.
3889
3890 ``lossy``
3891 Enable lossy compression methods (gradient, JPEG, ...). If this
3892 option is set, VNC client may receive lossy framebuffer updates
3893 depending on its encoding settings. Enabling this option can
3894 save a lot of bandwidth at the expense of quality.
3895
3896 ``non-adaptive``
3897 Disable adaptive encodings. Adaptive encodings are enabled by
3898 default. An adaptive encoding will try to detect frequently
3899 updated screen regions, and send updates in these regions using
3900 a lossy encoding (like JPEG). This can be really helpful to save
3901 bandwidth when playing videos. Disabling adaptive encodings
3902 restores the original static behavior of encodings like Tight.
3903
3904 ``share=[allow-exclusive|force-shared|ignore]``
3905 Set display sharing policy. 'allow-exclusive' allows clients to
3906 ask for exclusive access. As suggested by the rfb spec this is
3907 implemented by dropping other connections. Connecting multiple
3908 clients in parallel requires all clients asking for a shared
3909 session (vncviewer: -shared switch). This is the default.
3910 'force-shared' disables exclusive client access. Useful for
3911 shared desktop sessions, where you don't want someone forgetting
3912 specify -shared disconnect everybody else. 'ignore' completely
3913 ignores the shared flag and allows everybody connect
3914 unconditionally. Doesn't conform to the rfb spec but is
3915 traditional QEMU behavior.
3916
3917 ``key-delay-ms``
3918 Set keyboard delay, for key down and key up events, in
3919 milliseconds. Default is 10. Keyboards are low-bandwidth
3920 devices, so this slowdown can help the device and guest to keep
3921 up and not lose events in case events are arriving in bulk.
3922 Possible causes for the latter are flaky network connections, or
3923 scripts for automated testing.
3924
3925 ``audiodev=audiodev``
3926 Use the specified audiodev when the VNC client requests audio
3927 transmission. When not using an -audiodev argument, this option
3928 must be omitted, otherwise is must be present and specify a
3929 valid audiodev.
3930 ERST
3931
3932 STEXI
3933 @end table
3934 ETEXI
3935 ARCHHEADING(, QEMU_ARCH_I386)
3936
3937 ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
3938 STEXI
3939 @table @option
3940 ETEXI
3941
3942 DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack,
3943 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n",
3944 QEMU_ARCH_I386)
3945 STEXI
3946 @item -win2k-hack
3947 @findex -win2k-hack
3948 Use it when installing Windows 2000 to avoid a disk full bug. After
3949 Windows 2000 is installed, you no longer need this option (this option
3950 slows down the IDE transfers).
3951 ETEXI
3952 SRST
3953 ``-win2k-hack``
3954 Use it when installing Windows 2000 to avoid a disk full bug. After
3955 Windows 2000 is installed, you no longer need this option (this
3956 option slows down the IDE transfers).
3957 ERST
3958
3959 DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
3960 "-no-fd-bootchk disable boot signature checking for floppy disks\n",
3961 QEMU_ARCH_I386)
3962 STEXI
3963 @item -no-fd-bootchk
3964 @findex -no-fd-bootchk
3965 Disable boot signature checking for floppy disks in BIOS. May
3966 be needed to boot from old floppy disks.
3967 ETEXI
3968 SRST
3969 ``-no-fd-bootchk``
3970 Disable boot signature checking for floppy disks in BIOS. May be
3971 needed to boot from old floppy disks.
3972 ERST
3973
3974 DEF("no-acpi", 0, QEMU_OPTION_no_acpi,
3975 "-no-acpi disable ACPI\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM)
3976 STEXI
3977 @item -no-acpi
3978 @findex -no-acpi
3979 Disable ACPI (Advanced Configuration and Power Interface) support. Use
3980 it if your guest OS complains about ACPI problems (PC target machine
3981 only).
3982 ETEXI
3983 SRST
3984 ``-no-acpi``
3985 Disable ACPI (Advanced Configuration and Power Interface) support.
3986 Use it if your guest OS complains about ACPI problems (PC target
3987 machine only).
3988 ERST
3989
3990 DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
3991 "-no-hpet disable HPET\n", QEMU_ARCH_I386)
3992 STEXI
3993 @item -no-hpet
3994 @findex -no-hpet
3995 Disable HPET support.
3996 ETEXI
3997 SRST
3998 ``-no-hpet``
3999 Disable HPET support.
4000 ERST
4001
4002 DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
4003 "-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"
4004 " ACPI table description\n", QEMU_ARCH_I386)
4005 STEXI
4006 @item -acpitable [sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}][,data=@var{file1}[:@var{file2}]...]
4007 @findex -acpitable
4008 Add ACPI table with specified header fields and context from specified files.
4009 For file=, take whole ACPI table from the specified files, including all
4010 ACPI headers (possible overridden by other options).
4011 For data=, only data
4012 portion of the table is used, all header information is specified in the
4013 command line.
4014 If a SLIC table is supplied to QEMU, then the SLIC's oem_id and oem_table_id
4015 fields will override the same in the RSDT and the FADT (a.k.a. FACP), in order
4016 to ensure the field matches required by the Microsoft SLIC spec and the ACPI
4017 spec.
4018 ETEXI
4019 SRST
4020 ``-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]...]``
4021 Add ACPI table with specified header fields and context from
4022 specified files. For file=, take whole ACPI table from the specified
4023 files, including all ACPI headers (possible overridden by other
4024 options). For data=, only data portion of the table is used, all
4025 header information is specified in the command line. If a SLIC table
4026 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id
4027 fields will override the same in the RSDT and the FADT (a.k.a.
4028 FACP), in order to ensure the field matches required by the
4029 Microsoft SLIC spec and the ACPI spec.
4030 ERST
4031
4032 DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
4033 "-smbios file=binary\n"
4034 " load SMBIOS entry from binary file\n"
4035 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
4036 " [,uefi=on|off]\n"
4037 " specify SMBIOS type 0 fields\n"
4038 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4039 " [,uuid=uuid][,sku=str][,family=str]\n"
4040 " specify SMBIOS type 1 fields\n"
4041 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4042 " [,asset=str][,location=str]\n"
4043 " specify SMBIOS type 2 fields\n"
4044 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n"
4045 " [,sku=str]\n"
4046 " specify SMBIOS type 3 fields\n"
4047 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
4048 " [,asset=str][,part=str]\n"
4049 " specify SMBIOS type 4 fields\n"
4050 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
4051 " [,asset=str][,part=str][,speed=%d]\n"
4052 " specify SMBIOS type 17 fields\n",
4053 QEMU_ARCH_I386 | QEMU_ARCH_ARM)
4054 STEXI
4055 @item -smbios file=@var{binary}
4056 @findex -smbios
4057 Load SMBIOS entry from binary file.
4058
4059 @item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}][,uefi=on|off]
4060 Specify SMBIOS type 0 fields
4061
4062 @item -smbios type=1[,manufacturer=@var{str}][,product=@var{str}][,version=@var{str}][,serial=@var{str}][,uuid=@var{uuid}][,sku=@var{str}][,family=@var{str}]
4063 Specify SMBIOS type 1 fields
4064
4065 @item -smbios type=2[,manufacturer=@var{str}][,product=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,location=@var{str}]
4066 Specify SMBIOS type 2 fields
4067
4068 @item -smbios type=3[,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,sku=@var{str}]
4069 Specify SMBIOS type 3 fields
4070
4071 @item -smbios type=4[,sock_pfx=@var{str}][,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,part=@var{str}]
4072 Specify SMBIOS type 4 fields
4073
4074 @item -smbios type=17[,loc_pfx=@var{str}][,bank=@var{str}][,manufacturer=@var{str}][,serial=@var{str}][,asset=@var{str}][,part=@var{str}][,speed=@var{%d}]
4075 Specify SMBIOS type 17 fields
4076 ETEXI
4077 SRST
4078 ``-smbios file=binary``
4079 Load SMBIOS entry from binary file.
4080
4081 ``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]``
4082 Specify SMBIOS type 0 fields
4083
4084 ``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]``
4085 Specify SMBIOS type 1 fields
4086
4087 ``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]``
4088 Specify SMBIOS type 2 fields
4089
4090 ``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
4091 Specify SMBIOS type 3 fields
4092
4093 ``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]``
4094 Specify SMBIOS type 4 fields
4095
4096 ``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]``
4097 Specify SMBIOS type 17 fields
4098 ERST
4099
4100 STEXI
4101 @end table
4102 ETEXI
4103 DEFHEADING()
4104
4105 DEFHEADING(Network options:)
4106 STEXI
4107 @table @option
4108 ETEXI
4109
4110 DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
4111 #ifdef CONFIG_SLIRP
4112 "-netdev user,id=str[,ipv4[=on|off]][,net=addr[/mask]][,host=addr]\n"
4113 " [,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
4114 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
4115 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n"
4116 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
4117 #ifndef _WIN32
4118 "[,smb=dir[,smbserver=addr]]\n"
4119 #endif
4120 " configure a user mode network backend with ID 'str',\n"
4121 " its DHCP server and optional services\n"
4122 #endif
4123 #ifdef _WIN32
4124 "-netdev tap,id=str,ifname=name\n"
4125 " configure a host TAP network backend with ID 'str'\n"
4126 #else
4127 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
4128 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
4129 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
4130 " [,poll-us=n]\n"
4131 " configure a host TAP network backend with ID 'str'\n"
4132 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
4133 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
4134 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
4135 " to deconfigure it\n"
4136 " use '[down]script=no' to disable script execution\n"
4137 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
4138 " configure it\n"
4139 " use 'fd=h' to connect to an already opened TAP interface\n"
4140 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
4141 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
4142 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
4143 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
4144 " use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
4145 " use vhost=on to enable experimental in kernel accelerator\n"
4146 " (only has effect for virtio guests which use MSIX)\n"
4147 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
4148 " use 'vhostfd=h' to connect to an already opened vhost net device\n"
4149 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
4150 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
4151 " use 'poll-us=n' to speciy the maximum number of microseconds that could be\n"
4152 " spent on busy polling for vhost net\n"
4153 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
4154 " configure a host TAP network backend with ID 'str' that is\n"
4155 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
4156 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
4157 #endif
4158 #ifdef __linux__
4159 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"
4160 " [,rxsession=rxsession],txsession=txsession[,ipv6=on/off][,udp=on/off]\n"
4161 " [,cookie64=on/off][,counter][,pincounter][,txcookie=txcookie]\n"
4162 " [,rxcookie=rxcookie][,offset=offset]\n"
4163 " configure a network backend with ID 'str' connected to\n"
4164 " an Ethernet over L2TPv3 pseudowire.\n"
4165 " Linux kernel 3.3+ as well as most routers can talk\n"
4166 " L2TPv3. This transport allows connecting a VM to a VM,\n"
4167 " VM to a router and even VM to Host. It is a nearly-universal\n"
4168 " standard (RFC3931). Note - this implementation uses static\n"
4169 " pre-configured tunnels (same as the Linux kernel).\n"
4170 " use 'src=' to specify source address\n"
4171 " use 'dst=' to specify destination address\n"
4172 " use 'udp=on' to specify udp encapsulation\n"
4173 " use 'srcport=' to specify source udp port\n"
4174 " use 'dstport=' to specify destination udp port\n"
4175 " use 'ipv6=on' to force v6\n"
4176 " L2TPv3 uses cookies to prevent misconfiguration as\n"
4177 " well as a weak security measure\n"
4178 " use 'rxcookie=0x012345678' to specify a rxcookie\n"
4179 " use 'txcookie=0x012345678' to specify a txcookie\n"
4180 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n"
4181 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n"
4182 " use 'pincounter=on' to work around broken counter handling in peer\n"
4183 " use 'offset=X' to add an extra offset between header and data\n"
4184 #endif
4185 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n"
4186 " configure a network backend to connect to another network\n"
4187 " using a socket connection\n"
4188 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
4189 " configure a network backend to connect to a multicast maddr and port\n"
4190 " use 'localaddr=addr' to specify the host address to send packets from\n"
4191 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
4192 " configure a network backend to connect to another network\n"
4193 " using an UDP tunnel\n"
4194 #ifdef CONFIG_VDE
4195 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
4196 " configure a network backend to connect to port 'n' of a vde switch\n"
4197 " running on host and listening for incoming connections on 'socketpath'.\n"
4198 " Use group 'groupname' and mode 'octalmode' to change default\n"
4199 " ownership and permissions for communication port.\n"
4200 #endif
4201 #ifdef CONFIG_NETMAP
4202 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n"
4203 " attach to the existing netmap-enabled network interface 'name', or to a\n"
4204 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n"
4205 " netmap device, defaults to '/dev/netmap')\n"
4206 #endif
4207 #ifdef CONFIG_POSIX
4208 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
4209 " configure a vhost-user network, backed by a chardev 'dev'\n"
4210 #endif
4211 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n"
4212 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL)
4213 DEF("nic", HAS_ARG, QEMU_OPTION_nic,
4214 "-nic [tap|bridge|"
4215 #ifdef CONFIG_SLIRP
4216 "user|"
4217 #endif
4218 #ifdef __linux__
4219 "l2tpv3|"
4220 #endif
4221 #ifdef CONFIG_VDE
4222 "vde|"
4223 #endif
4224 #ifdef CONFIG_NETMAP
4225 "netmap|"
4226 #endif
4227 #ifdef CONFIG_POSIX
4228 "vhost-user|"
4229 #endif
4230 "socket][,option][,...][mac=macaddr]\n"
4231 " initialize an on-board / default host NIC (using MAC address\n"
4232 " macaddr) and connect it to the given host network backend\n"
4233 "-nic none use it alone to have zero network devices (the default is to\n"
4234 " provided a 'user' network connection)\n",
4235 QEMU_ARCH_ALL)
4236 DEF("net", HAS_ARG, QEMU_OPTION_net,
4237 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
4238 " configure or create an on-board (or machine default) NIC and\n"
4239 " connect it to hub 0 (please use -nic unless you need a hub)\n"
4240 "-net ["
4241 #ifdef CONFIG_SLIRP
4242 "user|"
4243 #endif
4244 "tap|"
4245 "bridge|"
4246 #ifdef CONFIG_VDE
4247 "vde|"
4248 #endif
4249 #ifdef CONFIG_NETMAP
4250 "netmap|"
4251 #endif
4252 "socket][,option][,option][,...]\n"
4253 " old way to initialize a host network interface\n"
4254 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
4255 STEXI
4256 @item -nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]
4257 @findex -nic
4258 This option is a shortcut for configuring both the on-board (default) guest
4259 NIC hardware and the host network backend in one go. The host backend options
4260 are the same as with the corresponding @option{-netdev} options below.
4261 The guest NIC model can be set with @option{model=@var{modelname}}.
4262 Use @option{model=help} to list the available device types.
4263 The hardware MAC address can be set with @option{mac=@var{macaddr}}.
4264
4265 The following two example do exactly the same, to show how @option{-nic} can
4266 be used to shorten the command line length:
4267 @example
4268 @value{qemu_system} -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4269 @value{qemu_system} -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
4270 @end example
4271
4272 @item -nic none
4273 Indicate that no network devices should be configured. It is used to override
4274 the default configuration (default NIC with ``user'' host network backend)
4275 which is activated if no other networking options are provided.
4276
4277 @item -netdev user,id=@var{id}[,@var{option}][,@var{option}][,...]
4278 @findex -netdev
4279 Configure user mode host network backend which requires no administrator
4280 privilege to run. Valid options are:
4281
4282 @table @option
4283 @item id=@var{id}
4284 Assign symbolic name for use in monitor commands.
4285
4286 @item ipv4=on|off and ipv6=on|off
4287 Specify that either IPv4 or IPv6 must be enabled. If neither is specified
4288 both protocols are enabled.
4289
4290 @item net=@var{addr}[/@var{mask}]
4291 Set IP network address the guest will see. Optionally specify the netmask,
4292 either in the form a.b.c.d or as number of valid top-most bits. Default is
4293 10.0.2.0/24.
4294
4295 @item host=@var{addr}
4296 Specify the guest-visible address of the host. Default is the 2nd IP in the
4297 guest network, i.e. x.x.x.2.
4298
4299 @item ipv6-net=@var{addr}[/@var{int}]
4300 Set IPv6 network address the guest will see (default is fec0::/64). The
4301 network prefix is given in the usual hexadecimal IPv6 address
4302 notation. The prefix size is optional, and is given as the number of
4303 valid top-most bits (default is 64).
4304
4305 @item ipv6-host=@var{addr}
4306 Specify the guest-visible IPv6 address of the host. Default is the 2nd IPv6 in
4307 the guest network, i.e. xxxx::2.
4308
4309 @item restrict=on|off
4310 If this option is enabled, the guest will be isolated, i.e. it will not be
4311 able to contact the host and no guest IP packets will be routed over the host
4312 to the outside. This option does not affect any explicitly set forwarding rules.
4313
4314 @item hostname=@var{name}
4315 Specifies the client hostname reported by the built-in DHCP server.
4316
4317 @item dhcpstart=@var{addr}
4318 Specify the first of the 16 IPs the built-in DHCP server can assign. Default
4319 is the 15th to 31st IP in the guest network, i.e. x.x.x.15 to x.x.x.31.
4320
4321 @item dns=@var{addr}
4322 Specify the guest-visible address of the virtual nameserver. The address must
4323 be different from the host address. Default is the 3rd IP in the guest network,
4324 i.e. x.x.x.3.
4325
4326 @item ipv6-dns=@var{addr}
4327 Specify the guest-visible address of the IPv6 virtual nameserver. The address
4328 must be different from the host address. Default is the 3rd IP in the guest
4329 network, i.e. xxxx::3.
4330
4331 @item dnssearch=@var{domain}
4332 Provides an entry for the domain-search list sent by the built-in
4333 DHCP server. More than one domain suffix can be transmitted by specifying
4334 this option multiple times. If supported, this will cause the guest to
4335 automatically try to append the given domain suffix(es) in case a domain name
4336 can not be resolved.
4337
4338 Example:
4339 @example
4340 @value{qemu_system} -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
4341 @end example
4342
4343 @item domainname=@var{domain}
4344 Specifies the client domain name reported by the built-in DHCP server.
4345
4346 @item tftp=@var{dir}
4347 When using the user mode network stack, activate a built-in TFTP
4348 server. The files in @var{dir} will be exposed as the root of a TFTP server.
4349 The TFTP client on the guest must be configured in binary mode (use the command
4350 @code{bin} of the Unix TFTP client).
4351
4352 @item tftp-server-name=@var{name}
4353 In BOOTP reply, broadcast @var{name} as the "TFTP server name" (RFC2132 option
4354 66). This can be used to advise the guest to load boot files or configurations
4355 from a different server than the host address.
4356
4357 @item bootfile=@var{file}
4358 When using the user mode network stack, broadcast @var{file} as the BOOTP
4359 filename. In conjunction with @option{tftp}, this can be used to network boot
4360 a guest from a local directory.
4361
4362 Example (using pxelinux):
4363 @example
4364 @value{qemu_system} -hda linux.img -boot n -device e1000,netdev=n1 \
4365 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
4366 @end example
4367
4368 @item smb=@var{dir}[,smbserver=@var{addr}]
4369 When using the user mode network stack, activate a built-in SMB
4370 server so that Windows OSes can access to the host files in @file{@var{dir}}
4371 transparently. The IP address of the SMB server can be set to @var{addr}. By
4372 default the 4th IP in the guest network is used, i.e. x.x.x.4.
4373
4374 In the guest Windows OS, the line:
4375 @example
4376 10.0.2.4 smbserver
4377 @end example
4378 must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
4379 or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
4380
4381 Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
4382
4383 Note that a SAMBA server must be installed on the host OS.
4384
4385 @item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport}
4386 Redirect incoming TCP or UDP connections to the host port @var{hostport} to
4387 the guest IP address @var{guestaddr} on guest port @var{guestport}. If
4388 @var{guestaddr} is not specified, its value is x.x.x.15 (default first address
4389 given by the built-in DHCP server). By specifying @var{hostaddr}, the rule can
4390 be bound to a specific host interface. If no connection type is set, TCP is
4391 used. This option can be given multiple times.
4392
4393 For example, to redirect host X11 connection from screen 1 to guest
4394 screen 0, use the following:
4395
4396 @example
4397 # on the host
4398 @value{qemu_system} -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
4399 # this host xterm should open in the guest X11 server
4400 xterm -display :1
4401 @end example
4402
4403 To redirect telnet connections from host port 5555 to telnet port on
4404 the guest, use the following:
4405
4406 @example
4407 # on the host
4408 @value{qemu_system} -nic user,hostfwd=tcp::5555-:23
4409 telnet localhost 5555
4410 @end example
4411
4412 Then when you use on the host @code{telnet localhost 5555}, you
4413 connect to the guest telnet server.
4414
4415 @item guestfwd=[tcp]:@var{server}:@var{port}-@var{dev}
4416 @itemx guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command}
4417 Forward guest TCP connections to the IP address @var{server} on port @var{port}
4418 to the character device @var{dev} or to a program executed by @var{cmd:command}
4419 which gets spawned for each connection. This option can be given multiple times.
4420
4421 You can either use a chardev directly and have that one used throughout QEMU's
4422 lifetime, like in the following example:
4423
4424 @example
4425 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4426 # the guest accesses it
4427 @value{qemu_system} -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
4428 @end example
4429
4430 Or you can execute a command on every TCP connection established by the guest,
4431 so that QEMU behaves similar to an inetd process for that virtual server:
4432
4433 @example
4434 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4435 # and connect the TCP stream to its stdin/stdout
4436 @value{qemu_system} -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
4437 @end example
4438
4439 @end table
4440
4441 @item -netdev tap,id=@var{id}[,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,br=@var{bridge}][,helper=@var{helper}]
4442 Configure a host TAP network backend with ID @var{id}.
4443
4444 Use the network script @var{file} to configure it and the network script
4445 @var{dfile} to deconfigure it. If @var{name} is not provided, the OS
4446 automatically provides one. The default network configure script is
4447 @file{/etc/qemu-ifup} and the default network deconfigure script is
4448 @file{/etc/qemu-ifdown}. Use @option{script=no} or @option{downscript=no}
4449 to disable script execution.
4450
4451 If running QEMU as an unprivileged user, use the network helper
4452 @var{helper} to configure the TAP interface and attach it to the bridge.
4453 The default network helper executable is @file{/path/to/qemu-bridge-helper}
4454 and the default bridge device is @file{br0}.
4455
4456 @option{fd}=@var{h} can be used to specify the handle of an already
4457 opened host TAP interface.
4458
4459 Examples:
4460
4461 @example
4462 #launch a QEMU instance with the default network script
4463 @value{qemu_system} linux.img -nic tap
4464 @end example
4465
4466 @example
4467 #launch a QEMU instance with two NICs, each one connected
4468 #to a TAP device
4469 @value{qemu_system} linux.img \
4470 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4471 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
4472 @end example
4473
4474 @example
4475 #launch a QEMU instance with the default network helper to
4476 #connect a TAP device to bridge br0
4477 @value{qemu_system} linux.img -device virtio-net-pci,netdev=n1 \
4478 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
4479 @end example
4480
4481 @item -netdev bridge,id=@var{id}[,br=@var{bridge}][,helper=@var{helper}]
4482 Connect a host TAP network interface to a host bridge device.
4483
4484 Use the network helper @var{helper} to configure the TAP interface and
4485 attach it to the bridge. The default network helper executable is
4486 @file{/path/to/qemu-bridge-helper} and the default bridge
4487 device is @file{br0}.
4488
4489 Examples:
4490
4491 @example
4492 #launch a QEMU instance with the default network helper to
4493 #connect a TAP device to bridge br0
4494 @value{qemu_system} linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
4495 @end example
4496
4497 @example
4498 #launch a QEMU instance with the default network helper to
4499 #connect a TAP device to bridge qemubr0
4500 @value{qemu_system} linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
4501 @end example
4502
4503 @item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
4504
4505 This host network backend can be used to connect the guest's network to
4506 another QEMU virtual machine using a TCP socket connection. If @option{listen}
4507 is specified, QEMU waits for incoming connections on @var{port}
4508 (@var{host} is optional). @option{connect} is used to connect to
4509 another QEMU instance using the @option{listen} option. @option{fd}=@var{h}
4510 specifies an already opened TCP socket.
4511
4512 Example:
4513 @example
4514 # launch a first QEMU instance
4515 @value{qemu_system} linux.img \
4516 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4517 -netdev socket,id=n1,listen=:1234
4518 # connect the network of this instance to the network of the first instance
4519 @value{qemu_system} linux.img \
4520 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4521 -netdev socket,id=n2,connect=127.0.0.1:1234
4522 @end example
4523
4524 @item -netdev socket,id=@var{id}[,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]]
4525
4526 Configure a socket host network backend to share the guest's network traffic
4527 with another QEMU virtual machines using a UDP multicast socket, effectively
4528 making a bus for every QEMU with same multicast address @var{maddr} and @var{port}.
4529 NOTES:
4530 @enumerate
4531 @item
4532 Several QEMU can be running on different hosts and share same bus (assuming
4533 correct multicast setup for these hosts).
4534 @item
4535 mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
4536 @url{http://user-mode-linux.sf.net}.
4537 @item
4538 Use @option{fd=h} to specify an already opened UDP multicast socket.
4539 @end enumerate
4540
4541 Example:
4542 @example
4543 # launch one QEMU instance
4544 @value{qemu_system} linux.img \
4545 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4546 -netdev socket,id=n1,mcast=230.0.0.1:1234
4547 # launch another QEMU instance on same "bus"
4548 @value{qemu_system} linux.img \
4549 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4550 -netdev socket,id=n2,mcast=230.0.0.1:1234
4551 # launch yet another QEMU instance on same "bus"
4552 @value{qemu_system} linux.img \
4553 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
4554 -netdev socket,id=n3,mcast=230.0.0.1:1234
4555 @end example
4556
4557 Example (User Mode Linux compat.):
4558 @example
4559 # launch QEMU instance (note mcast address selected is UML's default)
4560 @value{qemu_system} linux.img \
4561 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4562 -netdev socket,id=n1,mcast=239.192.168.1:1102
4563 # launch UML
4564 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
4565 @end example
4566
4567 Example (send packets from host's 1.2.3.4):
4568 @example
4569 @value{qemu_system} linux.img \
4570 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4571 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
4572 @end example
4573
4574 @item -netdev l2tpv3,id=@var{id},src=@var{srcaddr},dst=@var{dstaddr}[,srcport=@var{srcport}][,dstport=@var{dstport}],txsession=@var{txsession}[,rxsession=@var{rxsession}][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=@var{txcookie}][,rxcookie=@var{rxcookie}][,offset=@var{offset}]
4575 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) is a
4576 popular protocol to transport Ethernet (and other Layer 2) data frames between
4577 two systems. It is present in routers, firewalls and the Linux kernel
4578 (from version 3.3 onwards).
4579
4580 This transport allows a VM to communicate to another VM, router or firewall directly.
4581
4582 @table @option
4583 @item src=@var{srcaddr}
4584 source address (mandatory)
4585 @item dst=@var{dstaddr}
4586 destination address (mandatory)
4587 @item udp
4588 select udp encapsulation (default is ip).
4589 @item srcport=@var{srcport}
4590 source udp port.
4591 @item dstport=@var{dstport}
4592 destination udp port.
4593 @item ipv6
4594 force v6, otherwise defaults to v4.
4595 @item rxcookie=@var{rxcookie}
4596 @itemx txcookie=@var{txcookie}
4597 Cookies are a weak form of security in the l2tpv3 specification.
4598 Their function is mostly to prevent misconfiguration. By default they are 32
4599 bit.
4600 @item cookie64
4601 Set cookie size to 64 bit instead of the default 32
4602 @item counter=off
4603 Force a 'cut-down' L2TPv3 with no counter as in
4604 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
4605 @item pincounter=on
4606 Work around broken counter handling in peer. This may also help on
4607 networks which have packet reorder.
4608 @item offset=@var{offset}
4609 Add an extra offset between header and data
4610 @end table
4611
4612 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to the bridge br-lan
4613 on the remote Linux host 1.2.3.4:
4614 @example
4615 # Setup tunnel on linux host using raw ip as encapsulation
4616 # on 1.2.3.4
4617 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
4618 encap udp udp_sport 16384 udp_dport 16384
4619 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
4620 0xFFFFFFFF peer_session_id 0xFFFFFFFF
4621 ifconfig vmtunnel0 mtu 1500
4622 ifconfig vmtunnel0 up
4623 brctl addif br-lan vmtunnel0
4624
4625
4626 # on 4.3.2.1
4627 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
4628
4629 @value{qemu_system} linux.img -device e1000,netdev=n1 \
4630 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
4631
4632 @end example
4633
4634 @item -netdev vde,id=@var{id}[,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}]
4635 Configure VDE backend to connect to PORT @var{n} of a vde switch running on host and
4636 listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname}
4637 and MODE @var{octalmode} to change default ownership and permissions for
4638 communication port. This option is only available if QEMU has been compiled
4639 with vde support enabled.
4640
4641 Example:
4642 @example
4643 # launch vde switch
4644 vde_switch -F -sock /tmp/myswitch
4645 # launch QEMU instance
4646 @value{qemu_system} linux.img -nic vde,sock=/tmp/myswitch
4647 @end example
4648
4649 @item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
4650
4651 Establish a vhost-user netdev, backed by a chardev @var{id}. The chardev should
4652 be a unix domain socket backed one. The vhost-user uses a specifically defined
4653 protocol to pass vhost ioctl replacement messages to an application on the other
4654 end of the socket. On non-MSIX guests, the feature can be forced with
4655 @var{vhostforce}. Use 'queues=@var{n}' to specify the number of queues to
4656 be created for multiqueue vhost-user.
4657
4658 Example:
4659 @example
4660 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
4661 -numa node,memdev=mem \
4662 -chardev socket,id=chr0,path=/path/to/socket \
4663 -netdev type=vhost-user,id=net0,chardev=chr0 \
4664 -device virtio-net-pci,netdev=net0
4665 @end example
4666
4667 @item -netdev hubport,id=@var{id},hubid=@var{hubid}[,netdev=@var{nd}]
4668
4669 Create a hub port on the emulated hub with ID @var{hubid}.
4670
4671 The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a
4672 single netdev. Alternatively, you can also connect the hubport to another
4673 netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option.
4674
4675 @item -net nic[,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}]
4676 @findex -net
4677 Legacy option to configure or create an on-board (or machine default) Network
4678 Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e.
4679 the default hub), or to the netdev @var{nd}.
4680 If @var{model} is omitted, then the default NIC model associated with
4681 the machine type is used. Note that the default NIC model may change in
4682 future QEMU releases, so it is highly recommended to always specify a model.
4683 Optionally, the MAC address can be changed to @var{mac}, the device
4684 address set to @var{addr} (PCI cards only), and a @var{name} can be
4685 assigned for use in monitor commands.
4686 Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors
4687 that the card should have; this option currently only affects virtio cards; set
4688 @var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
4689 NIC is created. QEMU can emulate several different models of network card.
4690 Use @code{-net nic,model=help} for a list of available devices for your target.
4691
4692 @item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=@var{name}]
4693 Configure a host network backend (with the options corresponding to the same
4694 @option{-netdev} option) and connect it to the emulated hub 0 (the default
4695 hub). Use @var{name} to specify the name of the hub port.
4696 ETEXI
4697 SRST
4698 ``-nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]``
4699 This option is a shortcut for configuring both the on-board
4700 (default) guest NIC hardware and the host network backend in one go.
4701 The host backend options are the same as with the corresponding
4702 ``-netdev`` options below. The guest NIC model can be set with
4703 ``model=modelname``. Use ``model=help`` to list the available device
4704 types. The hardware MAC address can be set with ``mac=macaddr``.
4705
4706 The following two example do exactly the same, to show how ``-nic``
4707 can be used to shorten the command line length:
4708
4709 .. parsed-literal::
4710
4711 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4712 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
4713
4714 ``-nic none``
4715 Indicate that no network devices should be configured. It is used to
4716 override the default configuration (default NIC with "user" host
4717 network backend) which is activated if no other networking options
4718 are provided.
4719
4720 ``-netdev user,id=id[,option][,option][,...]``
4721 Configure user mode host network backend which requires no
4722 administrator privilege to run. Valid options are:
4723
4724 ``id=id``
4725 Assign symbolic name for use in monitor commands.
4726
4727 ``ipv4=on|off and ipv6=on|off``
4728 Specify that either IPv4 or IPv6 must be enabled. If neither is
4729 specified both protocols are enabled.
4730
4731 ``net=addr[/mask]``
4732 Set IP network address the guest will see. Optionally specify
4733 the netmask, either in the form a.b.c.d or as number of valid
4734 top-most bits. Default is 10.0.2.0/24.
4735
4736 ``host=addr``
4737 Specify the guest-visible address of the host. Default is the
4738 2nd IP in the guest network, i.e. x.x.x.2.
4739
4740 ``ipv6-net=addr[/int]``
4741 Set IPv6 network address the guest will see (default is
4742 fec0::/64). The network prefix is given in the usual hexadecimal
4743 IPv6 address notation. The prefix size is optional, and is given
4744 as the number of valid top-most bits (default is 64).
4745
4746 ``ipv6-host=addr``
4747 Specify the guest-visible IPv6 address of the host. Default is
4748 the 2nd IPv6 in the guest network, i.e. xxxx::2.
4749
4750 ``restrict=on|off``
4751 If this option is enabled, the guest will be isolated, i.e. it
4752 will not be able to contact the host and no guest IP packets
4753 will be routed over the host to the outside. This option does
4754 not affect any explicitly set forwarding rules.
4755
4756 ``hostname=name``
4757 Specifies the client hostname reported by the built-in DHCP
4758 server.
4759
4760 ``dhcpstart=addr``
4761 Specify the first of the 16 IPs the built-in DHCP server can
4762 assign. Default is the 15th to 31st IP in the guest network,
4763 i.e. x.x.x.15 to x.x.x.31.
4764
4765 ``dns=addr``
4766 Specify the guest-visible address of the virtual nameserver. The
4767 address must be different from the host address. Default is the
4768 3rd IP in the guest network, i.e. x.x.x.3.
4769
4770 ``ipv6-dns=addr``
4771 Specify the guest-visible address of the IPv6 virtual
4772 nameserver. The address must be different from the host address.
4773 Default is the 3rd IP in the guest network, i.e. xxxx::3.
4774
4775 ``dnssearch=domain``
4776 Provides an entry for the domain-search list sent by the
4777 built-in DHCP server. More than one domain suffix can be
4778 transmitted by specifying this option multiple times. If
4779 supported, this will cause the guest to automatically try to
4780 append the given domain suffix(es) in case a domain name can not
4781 be resolved.
4782
4783 Example:
4784
4785 .. parsed-literal::
4786
4787 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
4788
4789 ``domainname=domain``
4790 Specifies the client domain name reported by the built-in DHCP
4791 server.
4792
4793 ``tftp=dir``
4794 When using the user mode network stack, activate a built-in TFTP
4795 server. The files in dir will be exposed as the root of a TFTP
4796 server. The TFTP client on the guest must be configured in
4797 binary mode (use the command ``bin`` of the Unix TFTP client).
4798
4799 ``tftp-server-name=name``
4800 In BOOTP reply, broadcast name as the "TFTP server name"
4801 (RFC2132 option 66). This can be used to advise the guest to
4802 load boot files or configurations from a different server than
4803 the host address.
4804
4805 ``bootfile=file``
4806 When using the user mode network stack, broadcast file as the
4807 BOOTP filename. In conjunction with ``tftp``, this can be used
4808 to network boot a guest from a local directory.
4809
4810 Example (using pxelinux):
4811
4812 .. parsed-literal::
4813
4814 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \
4815 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
4816
4817 ``smb=dir[,smbserver=addr]``
4818 When using the user mode network stack, activate a built-in SMB
4819 server so that Windows OSes can access to the host files in
4820 ``dir`` transparently. The IP address of the SMB server can be
4821 set to addr. By default the 4th IP in the guest network is used,
4822 i.e. x.x.x.4.
4823
4824 In the guest Windows OS, the line:
4825
4826 ::
4827
4828 10.0.2.4 smbserver
4829
4830 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows
4831 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows
4832 NT/2000).
4833
4834 Then ``dir`` can be accessed in ``\\smbserver\qemu``.
4835
4836 Note that a SAMBA server must be installed on the host OS.
4837
4838 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport``
4839 Redirect incoming TCP or UDP connections to the host port
4840 hostport to the guest IP address guestaddr on guest port
4841 guestport. If guestaddr is not specified, its value is x.x.x.15
4842 (default first address given by the built-in DHCP server). By
4843 specifying hostaddr, the rule can be bound to a specific host
4844 interface. If no connection type is set, TCP is used. This
4845 option can be given multiple times.
4846
4847 For example, to redirect host X11 connection from screen 1 to
4848 guest screen 0, use the following:
4849
4850 ::
4851
4852 # on the host
4853 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
4854 # this host xterm should open in the guest X11 server
4855 xterm -display :1
4856
4857 To redirect telnet connections from host port 5555 to telnet
4858 port on the guest, use the following:
4859
4860 ::
4861
4862 # on the host
4863 |qemu_system| -nic user,hostfwd=tcp::5555-:23
4864 telnet localhost 5555
4865
4866 Then when you use on the host ``telnet localhost 5555``, you
4867 connect to the guest telnet server.
4868
4869 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command``
4870 Forward guest TCP connections to the IP address server on port
4871 port to the character device dev or to a program executed by
4872 cmd:command which gets spawned for each connection. This option
4873 can be given multiple times.
4874
4875 You can either use a chardev directly and have that one used
4876 throughout QEMU's lifetime, like in the following example:
4877
4878 ::
4879
4880 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4881 # the guest accesses it
4882 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
4883
4884 Or you can execute a command on every TCP connection established
4885 by the guest, so that QEMU behaves similar to an inetd process
4886 for that virtual server:
4887
4888 ::
4889
4890 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4891 # and connect the TCP stream to its stdin/stdout
4892 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
4893
4894 ``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
4895 Configure a host TAP network backend with ID id.
4896
4897 Use the network script file to configure it and the network script
4898 dfile to deconfigure it. If name is not provided, the OS
4899 automatically provides one. The default network configure script is
4900 ``/etc/qemu-ifup`` and the default network deconfigure script is
4901 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to
4902 disable script execution.
4903
4904 If running QEMU as an unprivileged user, use the network helper
4905 helper to configure the TAP interface and attach it to the bridge.
4906 The default network helper executable is
4907 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4908 ``br0``.
4909
4910 ``fd``\ =h can be used to specify the handle of an already opened
4911 host TAP interface.
4912
4913 Examples:
4914
4915 ::
4916
4917 #launch a QEMU instance with the default network script
4918 |qemu_system| linux.img -nic tap
4919
4920 ::
4921
4922 #launch a QEMU instance with two NICs, each one connected
4923 #to a TAP device
4924 |qemu_system| linux.img \
4925 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4926 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
4927
4928 ::
4929
4930 #launch a QEMU instance with the default network helper to
4931 #connect a TAP device to bridge br0
4932 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \
4933 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
4934
4935 ``-netdev bridge,id=id[,br=bridge][,helper=helper]``
4936 Connect a host TAP network interface to a host bridge device.
4937
4938 Use the network helper helper to configure the TAP interface and
4939 attach it to the bridge. The default network helper executable is
4940 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4941 ``br0``.
4942
4943 Examples:
4944
4945 ::
4946
4947 #launch a QEMU instance with the default network helper to
4948 #connect a TAP device to bridge br0
4949 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
4950
4951 ::
4952
4953 #launch a QEMU instance with the default network helper to
4954 #connect a TAP device to bridge qemubr0
4955 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
4956
4957 ``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]``
4958 This host network backend can be used to connect the guest's network
4959 to another QEMU virtual machine using a TCP socket connection. If
4960 ``listen`` is specified, QEMU waits for incoming connections on port
4961 (host is optional). ``connect`` is used to connect to another QEMU
4962 instance using the ``listen`` option. ``fd``\ =h specifies an
4963 already opened TCP socket.
4964
4965 Example:
4966
4967 ::
4968
4969 # launch a first QEMU instance
4970 |qemu_system| linux.img \
4971 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4972 -netdev socket,id=n1,listen=:1234
4973 # connect the network of this instance to the network of the first instance
4974 |qemu_system| linux.img \
4975 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4976 -netdev socket,id=n2,connect=127.0.0.1:1234
4977
4978 ``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]``
4979 Configure a socket host network backend to share the guest's network
4980 traffic with another QEMU virtual machines using a UDP multicast
4981 socket, effectively making a bus for every QEMU with same multicast
4982 address maddr and port. NOTES:
4983
4984 1. Several QEMU can be running on different hosts and share same bus
4985 (assuming correct multicast setup for these hosts).
4986
4987 2. mcast support is compatible with User Mode Linux (argument
4988 ``ethN=mcast``), see http://user-mode-linux.sf.net.
4989
4990 3. Use ``fd=h`` to specify an already opened UDP multicast socket.
4991
4992 Example:
4993
4994 ::
4995
4996 # launch one QEMU instance
4997 |qemu_system| linux.img \
4998 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4999 -netdev socket,id=n1,mcast=230.0.0.1:1234
5000 # launch another QEMU instance on same "bus"
5001 |qemu_system| linux.img \
5002 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
5003 -netdev socket,id=n2,mcast=230.0.0.1:1234
5004 # launch yet another QEMU instance on same "bus"
5005 |qemu_system| linux.img \
5006 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
5007 -netdev socket,id=n3,mcast=230.0.0.1:1234
5008
5009 Example (User Mode Linux compat.):
5010
5011 ::
5012
5013 # launch QEMU instance (note mcast address selected is UML's default)
5014 |qemu_system| linux.img \
5015 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5016 -netdev socket,id=n1,mcast=239.192.168.1:1102
5017 # launch UML
5018 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
5019
5020 Example (send packets from host's 1.2.3.4):
5021
5022 .. parsed-literal::
5023
5024 |qemu_system| linux.img \
5025 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5026 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
5027
5028 ``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
5029 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
5030 is a popular protocol to transport Ethernet (and other Layer 2) data
5031 frames between two systems. It is present in routers, firewalls and
5032 the Linux kernel (from version 3.3 onwards).
5033
5034 This transport allows a VM to communicate to another VM, router or
5035 firewall directly.
5036
5037 ``src=srcaddr``
5038 source address (mandatory)
5039
5040 ``dst=dstaddr``
5041 destination address (mandatory)
5042
5043 ``udp``
5044 select udp encapsulation (default is ip).
5045
5046 ``srcport=srcport``
5047 source udp port.
5048
5049 ``dstport=dstport``
5050 destination udp port.
5051
5052 ``ipv6``
5053 force v6, otherwise defaults to v4.
5054
5055 ``rxcookie=rxcookie``; \ ``txcookie=txcookie``
5056 Cookies are a weak form of security in the l2tpv3 specification.
5057 Their function is mostly to prevent misconfiguration. By default
5058 they are 32 bit.
5059
5060 ``cookie64``
5061 Set cookie size to 64 bit instead of the default 32
5062
5063 ``counter=off``
5064 Force a 'cut-down' L2TPv3 with no counter as in
5065 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
5066
5067 ``pincounter=on``
5068 Work around broken counter handling in peer. This may also help
5069 on networks which have packet reorder.
5070
5071 ``offset=offset``
5072 Add an extra offset between header and data
5073
5074 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to
5075 the bridge br-lan on the remote Linux host 1.2.3.4:
5076
5077 ::
5078
5079 # Setup tunnel on linux host using raw ip as encapsulation
5080 # on 1.2.3.4
5081 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
5082 encap udp udp_sport 16384 udp_dport 16384
5083 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
5084 0xFFFFFFFF peer_session_id 0xFFFFFFFF
5085 ifconfig vmtunnel0 mtu 1500
5086 ifconfig vmtunnel0 up
5087 brctl addif br-lan vmtunnel0
5088
5089
5090 # on 4.3.2.1
5091 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
5092
5093 |qemu_system| linux.img -device e1000,netdev=n1 \
5094 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
5095
5096 ``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
5097 Configure VDE backend to connect to PORT n of a vde switch running
5098 on host and listening for incoming connections on socketpath. Use
5099 GROUP groupname and MODE octalmode to change default ownership and
5100 permissions for communication port. This option is only available if
5101 QEMU has been compiled with vde support enabled.
5102
5103 Example:
5104
5105 ::
5106
5107 # launch vde switch
5108 vde_switch -F -sock /tmp/myswitch
5109 # launch QEMU instance
5110 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch
5111
5112 ``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
5113 Establish a vhost-user netdev, backed by a chardev id. The chardev
5114 should be a unix domain socket backed one. The vhost-user uses a
5115 specifically defined protocol to pass vhost ioctl replacement
5116 messages to an application on the other end of the socket. On
5117 non-MSIX guests, the feature can be forced with vhostforce. Use
5118 'queues=n' to specify the number of queues to be created for
5119 multiqueue vhost-user.
5120
5121 Example:
5122
5123 ::
5124
5125 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
5126 -numa node,memdev=mem \
5127 -chardev socket,id=chr0,path=/path/to/socket \
5128 -netdev type=vhost-user,id=net0,chardev=chr0 \
5129 -device virtio-net-pci,netdev=net0
5130
5131 ``-netdev hubport,id=id,hubid=hubid[,netdev=nd]``
5132 Create a hub port on the emulated hub with ID hubid.
5133
5134 The hubport netdev lets you connect a NIC to a QEMU emulated hub
5135 instead of a single netdev. Alternatively, you can also connect the
5136 hubport to another netdev with ID nd by using the ``netdev=nd``
5137 option.
5138
5139 ``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]``
5140 Legacy option to configure or create an on-board (or machine
5141 default) Network Interface Card(NIC) and connect it either to the
5142 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.
5143 If model is omitted, then the default NIC model associated with the
5144 machine type is used. Note that the default NIC model may change in
5145 future QEMU releases, so it is highly recommended to always specify
5146 a model. Optionally, the MAC address can be changed to mac, the
5147 device address set to addr (PCI cards only), and a name can be
5148 assigned for use in monitor commands. Optionally, for PCI cards, you
5149 can specify the number v of MSI-X vectors that the card should have;
5150 this option currently only affects virtio cards; set v = 0 to
5151 disable MSI-X. If no ``-net`` option is specified, a single NIC is
5152 created. QEMU can emulate several different models of network card.
5153 Use ``-net nic,model=help`` for a list of available devices for your
5154 target.
5155
5156 ``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]``
5157 Configure a host network backend (with the options corresponding to
5158 the same ``-netdev`` option) and connect it to the emulated hub 0
5159 (the default hub). Use name to specify the name of the hub port.
5160 ERST
5161
5162 STEXI
5163 @end table
5164 ETEXI
5165 DEFHEADING()
5166
5167 DEFHEADING(Character device options:)
5168
5169 DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
5170 "-chardev help\n"
5171 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5172 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4][,ipv6][,nodelay][,reconnect=seconds]\n"
5173 " [,server][,nowait][,telnet][,websocket][,reconnect=seconds][,mux=on|off]\n"
5174 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n"
5175 "-chardev socket,id=id,path=path[,server][,nowait][,telnet][,websocket][,reconnect=seconds]\n"
5176 " [,mux=on|off][,logfile=PATH][,logappend=on|off] (unix)\n"
5177 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
5178 " [,localport=localport][,ipv4][,ipv6][,mux=on|off]\n"
5179 " [,logfile=PATH][,logappend=on|off]\n"
5180 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5181 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
5182 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5183 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
5184 "-chardev file,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5185 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5186 #ifdef _WIN32
5187 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5188 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5189 #else
5190 "-chardev pty,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5191 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n"
5192 #endif
5193 #ifdef CONFIG_BRLAPI
5194 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5195 #endif
5196 #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
5197 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
5198 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5199 "-chardev tty,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5200 #endif
5201 #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
5202 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5203 "-chardev parport,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5204 #endif
5205 #if defined(CONFIG_SPICE)
5206 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
5207 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
5208 #endif
5209 , QEMU_ARCH_ALL
5210 )
5211
5212 STEXI
5213
5214 The general form of a character device option is:
5215 @table @option
5216 @item -chardev @var{backend},id=@var{id}[,mux=on|off][,@var{options}]
5217 @findex -chardev
5218 Backend is one of:
5219 @option{null},
5220 @option{socket},
5221 @option{udp},
5222 @option{msmouse},
5223 @option{vc},
5224 @option{ringbuf},
5225 @option{file},
5226 @option{pipe},
5227 @option{console},
5228 @option{serial},
5229 @option{pty},
5230 @option{stdio},
5231 @option{braille},
5232 @option{tty},
5233 @option{parallel},
5234 @option{parport},
5235 @option{spicevmc},
5236 @option{spiceport}.
5237 The specific backend will determine the applicable options.
5238
5239 Use @code{-chardev help} to print all available chardev backend types.
5240
5241 All devices must have an id, which can be any string up to 127 characters long.
5242 It is used to uniquely identify this device in other command line directives.
5243
5244 A character device may be used in multiplexing mode by multiple front-ends.
5245 Specify @option{mux=on} to enable this mode.
5246 A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
5247 backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
5248 If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
5249 create a multiplexer with your specified ID, and you can then configure multiple
5250 front ends to use that chardev ID for their input/output. Up to four different
5251 front ends can be connected to a single multiplexed chardev. (Without
5252 multiplexing enabled, a chardev can only be used by a single front end.)
5253 For instance you could use this to allow a single stdio chardev to be used by
5254 two serial ports and the QEMU monitor:
5255
5256 @example
5257 -chardev stdio,mux=on,id=char0 \
5258 -mon chardev=char0,mode=readline \
5259 -serial chardev:char0 \
5260 -serial chardev:char0
5261 @end example
5262
5263 You can have more than one multiplexer in a system configuration; for instance
5264 you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
5265 multiplexed between the QEMU monitor and a parallel port:
5266
5267 @example
5268 -chardev stdio,mux=on,id=char0 \
5269 -mon chardev=char0,mode=readline \
5270 -parallel chardev:char0 \
5271 -chardev tcp,...,mux=on,id=char1 \
5272 -serial chardev:char1 \
5273 -serial chardev:char1
5274 @end example
5275
5276 When you're using a multiplexed character device, some escape sequences are
5277 interpreted in the input. @xref{mux_keys, Keys in the character backend
5278 multiplexer}.
5279
5280 Note that some other command line options may implicitly create multiplexed
5281 character backends; for instance @option{-serial mon:stdio} creates a
5282 multiplexed stdio backend connected to the serial port and the QEMU monitor,
5283 and @option{-nographic} also multiplexes the console and the monitor to
5284 stdio.
5285
5286 There is currently no support for multiplexing in the other direction
5287 (where a single QEMU front end takes input and output from multiple chardevs).
5288
5289 Every backend supports the @option{logfile} option, which supplies the path
5290 to a file to record all data transmitted via the backend. The @option{logappend}
5291 option controls whether the log file will be truncated or appended to when
5292 opened.
5293
5294 @end table
5295
5296 The available backends are:
5297
5298 @table @option
5299 @item -chardev null,id=@var{id}
5300 A void device. This device will not emit any data, and will drop any data it
5301 receives. The null backend does not take any options.
5302
5303 @item -chardev socket,id=@var{id}[,@var{TCP options} or @var{unix options}][,server][,nowait][,telnet][,websocket][,reconnect=@var{seconds}][,tls-creds=@var{id}][,tls-authz=@var{id}]
5304
5305 Create a two-way stream socket, which can be either a TCP or a unix socket. A
5306 unix socket will be created if @option{path} is specified. Behaviour is
5307 undefined if TCP options are specified for a unix socket.
5308
5309 @option{server} specifies that the socket shall be a listening socket.
5310
5311 @option{nowait} specifies that QEMU should not block waiting for a client to
5312 connect to a listening socket.
5313
5314 @option{telnet} specifies that traffic on the socket should interpret telnet
5315 escape sequences.
5316
5317 @option{websocket} specifies that the socket uses WebSocket protocol for
5318 communication.
5319
5320 @option{reconnect} sets the timeout for reconnecting on non-server sockets when
5321 the remote end goes away. qemu will delay this many seconds and then attempt
5322 to reconnect. Zero disables reconnecting, and is the default.
5323
5324 @option{tls-creds} requests enablement of the TLS protocol for encryption,
5325 and specifies the id of the TLS credentials to use for the handshake. The
5326 credentials must be previously created with the @option{-object tls-creds}
5327 argument.
5328
5329 @option{tls-auth} provides the ID of the QAuthZ authorization object against
5330 which the client's x509 distinguished name will be validated. This object is
5331 only resolved at time of use, so can be deleted and recreated on the fly
5332 while the chardev server is active. If missing, it will default to denying
5333 access.
5334
5335 TCP and unix socket options are given below:
5336
5337 @table @option
5338
5339 @item TCP options: port=@var{port}[,host=@var{host}][,to=@var{to}][,ipv4][,ipv6][,nodelay]
5340
5341 @option{host} for a listening socket specifies the local address to be bound.
5342 For a connecting socket species the remote host to connect to. @option{host} is
5343 optional for listening sockets. If not specified it defaults to @code{0.0.0.0}.
5344
5345 @option{port} for a listening socket specifies the local port to be bound. For a
5346 connecting socket specifies the port on the remote host to connect to.
5347 @option{port} can be given as either a port number or a service name.
5348 @option{port} is required.
5349
5350 @option{to} is only relevant to listening sockets. If it is specified, and
5351 @option{port} cannot be bound, QEMU will attempt to bind to subsequent ports up
5352 to and including @option{to} until it succeeds. @option{to} must be specified
5353 as a port number.
5354
5355 @option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5356 If neither is specified the socket may use either protocol.
5357
5358 @option{nodelay} disables the Nagle algorithm.
5359
5360 @item unix options: path=@var{path}
5361
5362 @option{path} specifies the local path of the unix socket. @option{path} is
5363 required.
5364
5365 @end table
5366
5367 @item -chardev udp,id=@var{id}[,host=@var{host}],port=@var{port}[,localaddr=@var{localaddr}][,localport=@var{localport}][,ipv4][,ipv6]
5368
5369 Sends all traffic from the guest to a remote host over UDP.
5370
5371 @option{host} specifies the remote host to connect to. If not specified it
5372 defaults to @code{localhost}.
5373
5374 @option{port} specifies the port on the remote host to connect to. @option{port}
5375 is required.
5376
5377 @option{localaddr} specifies the local address to bind to. If not specified it
5378 defaults to @code{0.0.0.0}.
5379
5380 @option{localport} specifies the local port to bind to. If not specified any
5381 available local port will be used.
5382
5383 @option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5384 If neither is specified the device may use either protocol.
5385
5386 @item -chardev msmouse,id=@var{id}
5387
5388 Forward QEMU's emulated msmouse events to the guest. @option{msmouse} does not
5389 take any options.
5390
5391 @item -chardev vc,id=@var{id}[[,width=@var{width}][,height=@var{height}]][[,cols=@var{cols}][,rows=@var{rows}]]
5392
5393 Connect to a QEMU text console. @option{vc} may optionally be given a specific
5394 size.
5395
5396 @option{width} and @option{height} specify the width and height respectively of
5397 the console, in pixels.
5398
5399 @option{cols} and @option{rows} specify that the console be sized to fit a text
5400 console with the given dimensions.
5401
5402 @item -chardev ringbuf,id=@var{id}[,size=@var{size}]
5403
5404 Create a ring buffer with fixed size @option{size}.
5405 @var{size} must be a power of two and defaults to @code{64K}.
5406
5407 @item -chardev file,id=@var{id},path=@var{path}
5408
5409 Log all traffic received from the guest to a file.
5410
5411 @option{path} specifies the path of the file to be opened. This file will be
5412 created if it does not already exist, and overwritten if it does. @option{path}
5413 is required.
5414
5415 @item -chardev pipe,id=@var{id},path=@var{path}
5416
5417 Create a two-way connection to the guest. The behaviour differs slightly between
5418 Windows hosts and other hosts:
5419
5420 On Windows, a single duplex pipe will be created at
5421 @file{\\.pipe\@option{path}}.
5422
5423 On other hosts, 2 pipes will be created called @file{@option{path}.in} and
5424 @file{@option{path}.out}. Data written to @file{@option{path}.in} will be
5425 received by the guest. Data written by the guest can be read from
5426 @file{@option{path}.out}. QEMU will not create these fifos, and requires them to
5427 be present.
5428
5429 @option{path} forms part of the pipe path as described above. @option{path} is
5430 required.
5431
5432 @item -chardev console,id=@var{id}
5433
5434 Send traffic from the guest to QEMU's standard output. @option{console} does not
5435 take any options.
5436
5437 @option{console} is only available on Windows hosts.
5438
5439 @item -chardev serial,id=@var{id},path=@option{path}
5440
5441 Send traffic from the guest to a serial device on the host.
5442
5443 On Unix hosts serial will actually accept any tty device,
5444 not only serial lines.
5445
5446 @option{path} specifies the name of the serial device to open.
5447
5448 @item -chardev pty,id=@var{id}
5449
5450 Create a new pseudo-terminal on the host and connect to it. @option{pty} does
5451 not take any options.
5452
5453 @option{pty} is not available on Windows hosts.
5454
5455 @item -chardev stdio,id=@var{id}[,signal=on|off]
5456 Connect to standard input and standard output of the QEMU process.
5457
5458 @option{signal} controls if signals are enabled on the terminal, that includes
5459 exiting QEMU with the key sequence @key{Control-c}. This option is enabled by
5460 default, use @option{signal=off} to disable it.
5461
5462 @item -chardev braille,id=@var{id}
5463
5464 Connect to a local BrlAPI server. @option{braille} does not take any options.
5465
5466 @item -chardev tty,id=@var{id},path=@var{path}
5467
5468 @option{tty} is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD and
5469 DragonFlyBSD hosts. It is an alias for @option{serial}.
5470
5471 @option{path} specifies the path to the tty. @option{path} is required.
5472
5473 @item -chardev parallel,id=@var{id},path=@var{path}
5474 @itemx -chardev parport,id=@var{id},path=@var{path}
5475
5476 @option{parallel} is only available on Linux, FreeBSD and DragonFlyBSD hosts.
5477
5478 Connect to a local parallel port.
5479
5480 @option{path} specifies the path to the parallel port device. @option{path} is
5481 required.
5482
5483 @item -chardev spicevmc,id=@var{id},debug=@var{debug},name=@var{name}
5484
5485 @option{spicevmc} is only available when spice support is built in.
5486
5487 @option{debug} debug level for spicevmc
5488
5489 @option{name} name of spice channel to connect to
5490
5491 Connect to a spice virtual machine channel, such as vdiport.
5492
5493 @item -chardev spiceport,id=@var{id},debug=@var{debug},name=@var{name}
5494
5495 @option{spiceport} is only available when spice support is built in.
5496
5497 @option{debug} debug level for spicevmc
5498
5499 @option{name} name of spice port to connect to
5500
5501 Connect to a spice port, allowing a Spice client to handle the traffic
5502 identified by a name (preferably a fqdn).
5503 ETEXI
5504 SRST
5505 The general form of a character device option is:
5506
5507 ``-chardev backend,id=id[,mux=on|off][,options]``
5508 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
5509 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
5510 ``pty``, ``stdio``, ``braille``, ``tty``, ``parallel``, ``parport``,
5511 ``spicevmc``, ``spiceport``. The specific backend will determine the
5512 applicable options.
5513
5514 Use ``-chardev help`` to print all available chardev backend types.
5515
5516 All devices must have an id, which can be any string up to 127
5517 characters long. It is used to uniquely identify this device in
5518 other command line directives.
5519
5520 A character device may be used in multiplexing mode by multiple
5521 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is
5522 a "1:N" device, and here the "1" end is your specified chardev
5523 backend, and the "N" end is the various parts of QEMU that can talk
5524 to a chardev. If you create a chardev with ``id=myid`` and
5525 ``mux=on``, QEMU will create a multiplexer with your specified ID,
5526 and you can then configure multiple front ends to use that chardev
5527 ID for their input/output. Up to four different front ends can be
5528 connected to a single multiplexed chardev. (Without multiplexing
5529 enabled, a chardev can only be used by a single front end.) For
5530 instance you could use this to allow a single stdio chardev to be
5531 used by two serial ports and the QEMU monitor:
5532
5533 ::
5534
5535 -chardev stdio,mux=on,id=char0 \
5536 -mon chardev=char0,mode=readline \
5537 -serial chardev:char0 \
5538 -serial chardev:char0
5539
5540 You can have more than one multiplexer in a system configuration;
5541 for instance you could have a TCP port multiplexed between UART 0
5542 and UART 1, and stdio multiplexed between the QEMU monitor and a
5543 parallel port:
5544
5545 ::
5546
5547 -chardev stdio,mux=on,id=char0 \
5548 -mon chardev=char0,mode=readline \
5549 -parallel chardev:char0 \
5550 -chardev tcp,...,mux=on,id=char1 \
5551 -serial chardev:char1 \
5552 -serial chardev:char1
5553
5554 When you're using a multiplexed character device, some escape
5555 sequences are interpreted in the input. See :ref:`mux_005fkeys`.
5556
5557 Note that some other command line options may implicitly create
5558 multiplexed character backends; for instance ``-serial mon:stdio``
5559 creates a multiplexed stdio backend connected to the serial port and
5560 the QEMU monitor, and ``-nographic`` also multiplexes the console
5561 and the monitor to stdio.
5562
5563 There is currently no support for multiplexing in the other
5564 direction (where a single QEMU front end takes input and output from
5565 multiple chardevs).
5566
5567 Every backend supports the ``logfile`` option, which supplies the
5568 path to a file to record all data transmitted via the backend. The
5569 ``logappend`` option controls whether the log file will be truncated
5570 or appended to when opened.
5571
5572 The available backends are:
5573
5574 ``-chardev null,id=id``
5575 A void device. This device will not emit any data, and will drop any
5576 data it receives. The null backend does not take any options.
5577
5578 ``-chardev socket,id=id[,TCP options or unix options][,server][,nowait][,telnet][,websocket][,reconnect=seconds][,tls-creds=id][,tls-authz=id]``
5579 Create a two-way stream socket, which can be either a TCP or a unix
5580 socket. A unix socket will be created if ``path`` is specified.
5581 Behaviour is undefined if TCP options are specified for a unix
5582 socket.
5583
5584 ``server`` specifies that the socket shall be a listening socket.
5585
5586 ``nowait`` specifies that QEMU should not block waiting for a client
5587 to connect to a listening socket.
5588
5589 ``telnet`` specifies that traffic on the socket should interpret
5590 telnet escape sequences.
5591
5592 ``websocket`` specifies that the socket uses WebSocket protocol for
5593 communication.
5594
5595 ``reconnect`` sets the timeout for reconnecting on non-server
5596 sockets when the remote end goes away. qemu will delay this many
5597 seconds and then attempt to reconnect. Zero disables reconnecting,
5598 and is the default.
5599
5600 ``tls-creds`` requests enablement of the TLS protocol for
5601 encryption, and specifies the id of the TLS credentials to use for
5602 the handshake. The credentials must be previously created with the
5603 ``-object tls-creds`` argument.
5604
5605 ``tls-auth`` provides the ID of the QAuthZ authorization object
5606 against which the client's x509 distinguished name will be
5607 validated. This object is only resolved at time of use, so can be
5608 deleted and recreated on the fly while the chardev server is active.
5609 If missing, it will default to denying access.
5610
5611 TCP and unix socket options are given below:
5612
5613 ``TCP options: port=port[,host=host][,to=to][,ipv4][,ipv6][,nodelay]``
5614 ``host`` for a listening socket specifies the local address to
5615 be bound. For a connecting socket species the remote host to
5616 connect to. ``host`` is optional for listening sockets. If not
5617 specified it defaults to ``0.0.0.0``.
5618
5619 ``port`` for a listening socket specifies the local port to be
5620 bound. For a connecting socket specifies the port on the remote
5621 host to connect to. ``port`` can be given as either a port
5622 number or a service name. ``port`` is required.
5623
5624 ``to`` is only relevant to listening sockets. If it is
5625 specified, and ``port`` cannot be bound, QEMU will attempt to
5626 bind to subsequent ports up to and including ``to`` until it
5627 succeeds. ``to`` must be specified as a port number.
5628
5629 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be
5630 used. If neither is specified the socket may use either
5631 protocol.
5632
5633 ``nodelay`` disables the Nagle algorithm.
5634
5635 ``unix options: path=path``
5636 ``path`` specifies the local path of the unix socket. ``path``
5637 is required.
5638
5639 ``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4][,ipv6]``
5640 Sends all traffic from the guest to a remote host over UDP.
5641
5642 ``host`` specifies the remote host to connect to. If not specified
5643 it defaults to ``localhost``.
5644
5645 ``port`` specifies the port on the remote host to connect to.
5646 ``port`` is required.
5647
5648 ``localaddr`` specifies the local address to bind to. If not
5649 specified it defaults to ``0.0.0.0``.
5650
5651 ``localport`` specifies the local port to bind to. If not specified
5652 any available local port will be used.
5653
5654 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be used.
5655 If neither is specified the device may use either protocol.
5656
5657 ``-chardev msmouse,id=id``
5658 Forward QEMU's emulated msmouse events to the guest. ``msmouse``
5659 does not take any options.
5660
5661 ``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]``
5662 Connect to a QEMU text console. ``vc`` may optionally be given a
5663 specific size.
5664
5665 ``width`` and ``height`` specify the width and height respectively
5666 of the console, in pixels.
5667
5668 ``cols`` and ``rows`` specify that the console be sized to fit a
5669 text console with the given dimensions.
5670
5671 ``-chardev ringbuf,id=id[,size=size]``
5672 Create a ring buffer with fixed size ``size``. size must be a power
5673 of two and defaults to ``64K``.
5674
5675 ``-chardev file,id=id,path=path``
5676 Log all traffic received from the guest to a file.
5677
5678 ``path`` specifies the path of the file to be opened. This file will
5679 be created if it does not already exist, and overwritten if it does.
5680 ``path`` is required.
5681
5682 ``-chardev pipe,id=id,path=path``
5683 Create a two-way connection to the guest. The behaviour differs
5684 slightly between Windows hosts and other hosts:
5685
5686 On Windows, a single duplex pipe will be created at
5687 ``\\.pipe\path``.
5688
5689 On other hosts, 2 pipes will be created called ``path.in`` and
5690 ``path.out``. Data written to ``path.in`` will be received by the
5691 guest. Data written by the guest can be read from ``path.out``. QEMU
5692 will not create these fifos, and requires them to be present.
5693
5694 ``path`` forms part of the pipe path as described above. ``path`` is
5695 required.
5696
5697 ``-chardev console,id=id``
5698 Send traffic from the guest to QEMU's standard output. ``console``
5699 does not take any options.
5700
5701 ``console`` is only available on Windows hosts.
5702
5703 ``-chardev serial,id=id,path=path``
5704 Send traffic from the guest to a serial device on the host.
5705
5706 On Unix hosts serial will actually accept any tty device, not only
5707 serial lines.
5708
5709 ``path`` specifies the name of the serial device to open.
5710
5711 ``-chardev pty,id=id``
5712 Create a new pseudo-terminal on the host and connect to it. ``pty``
5713 does not take any options.
5714
5715 ``pty`` is not available on Windows hosts.
5716
5717 ``-chardev stdio,id=id[,signal=on|off]``
5718 Connect to standard input and standard output of the QEMU process.
5719
5720 ``signal`` controls if signals are enabled on the terminal, that
5721 includes exiting QEMU with the key sequence Control-c. This option
5722 is enabled by default, use ``signal=off`` to disable it.
5723
5724 ``-chardev braille,id=id``
5725 Connect to a local BrlAPI server. ``braille`` does not take any
5726 options.
5727
5728 ``-chardev tty,id=id,path=path``
5729 ``tty`` is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD
5730 and DragonFlyBSD hosts. It is an alias for ``serial``.
5731
5732 ``path`` specifies the path to the tty. ``path`` is required.
5733
5734 ``-chardev parallel,id=id,path=path``; \ ``-chardev parport,id=id,path=path``
5735 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
5736 hosts.
5737
5738 Connect to a local parallel port.
5739
5740 ``path`` specifies the path to the parallel port device. ``path`` is
5741 required.
5742
5743 ``-chardev spicevmc,id=id,debug=debug,name=name``
5744 ``spicevmc`` is only available when spice support is built in.
5745
5746 ``debug`` debug level for spicevmc
5747
5748 ``name`` name of spice channel to connect to
5749
5750 Connect to a spice virtual machine channel, such as vdiport.
5751
5752 ``-chardev spiceport,id=id,debug=debug,name=name``
5753 ``spiceport`` is only available when spice support is built in.
5754
5755 ``debug`` debug level for spicevmc
5756
5757 ``name`` name of spice port to connect to
5758
5759 Connect to a spice port, allowing a Spice client to handle the
5760 traffic identified by a name (preferably a fqdn).
5761 ERST
5762
5763 STEXI
5764 @end table
5765 ETEXI
5766 DEFHEADING()
5767
5768 #ifdef CONFIG_TPM
5769 DEFHEADING(TPM device options:)
5770
5771 DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
5772 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
5773 " use path to provide path to a character device; default is /dev/tpm0\n"
5774 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
5775 " not provided it will be searched for in /sys/class/misc/tpm?/device\n"
5776 "-tpmdev emulator,id=id,chardev=dev\n"
5777 " configure the TPM device using chardev backend\n",
5778 QEMU_ARCH_ALL)
5779 STEXI
5780
5781 The general form of a TPM device option is:
5782 @table @option
5783
5784 @item -tpmdev @var{backend},id=@var{id}[,@var{options}]
5785 @findex -tpmdev
5786
5787 The specific backend type will determine the applicable options.
5788 The @code{-tpmdev} option creates the TPM backend and requires a
5789 @code{-device} option that specifies the TPM frontend interface model.
5790
5791 Use @code{-tpmdev help} to print all available TPM backend types.
5792
5793 @end table
5794
5795 The available backends are:
5796
5797 @table @option
5798
5799 @item -tpmdev passthrough,id=@var{id},path=@var{path},cancel-path=@var{cancel-path}
5800
5801 (Linux-host only) Enable access to the host's TPM using the passthrough
5802 driver.
5803
5804 @option{path} specifies the path to the host's TPM device, i.e., on
5805 a Linux host this would be @code{/dev/tpm0}.
5806 @option{path} is optional and by default @code{/dev/tpm0} is used.
5807
5808 @option{cancel-path} specifies the path to the host TPM device's sysfs
5809 entry allowing for cancellation of an ongoing TPM command.
5810 @option{cancel-path} is optional and by default QEMU will search for the
5811 sysfs entry to use.
5812
5813 Some notes about using the host's TPM with the passthrough driver:
5814
5815 The TPM device accessed by the passthrough driver must not be
5816 used by any other application on the host.
5817
5818 Since the host's firmware (BIOS/UEFI) has already initialized the TPM,
5819 the VM's firmware (BIOS/UEFI) will not be able to initialize the
5820 TPM again and may therefore not show a TPM-specific menu that would
5821 otherwise allow the user to configure the TPM, e.g., allow the user to
5822 enable/disable or activate/deactivate the TPM.
5823 Further, if TPM ownership is released from within a VM then the host's TPM
5824 will get disabled and deactivated. To enable and activate the
5825 TPM again afterwards, the host has to be rebooted and the user is
5826 required to enter the firmware's menu to enable and activate the TPM.
5827 If the TPM is left disabled and/or deactivated most TPM commands will fail.
5828
5829 To create a passthrough TPM use the following two options:
5830 @example
5831 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5832 @end example
5833 Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
5834 @code{tpmdev=tpm0} in the device option.
5835
5836 @item -tpmdev emulator,id=@var{id},chardev=@var{dev}
5837
5838 (Linux-host only) Enable access to a TPM emulator using Unix domain socket based
5839 chardev backend.
5840
5841 @option{chardev} specifies the unique ID of a character device backend that provides connection to the software TPM server.
5842
5843 To create a TPM emulator backend device with chardev socket backend:
5844 @example
5845
5846 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5847
5848 @end example
5849
5850 ETEXI
5851 SRST
5852 The general form of a TPM device option is:
5853
5854 ``-tpmdev backend,id=id[,options]``
5855 The specific backend type will determine the applicable options. The
5856 ``-tpmdev`` option creates the TPM backend and requires a
5857 ``-device`` option that specifies the TPM frontend interface model.
5858
5859 Use ``-tpmdev help`` to print all available TPM backend types.
5860
5861 The available backends are:
5862
5863 ``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path``
5864 (Linux-host only) Enable access to the host's TPM using the
5865 passthrough driver.
5866
5867 ``path`` specifies the path to the host's TPM device, i.e., on a
5868 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by
5869 default ``/dev/tpm0`` is used.
5870
5871 ``cancel-path`` specifies the path to the host TPM device's sysfs
5872 entry allowing for cancellation of an ongoing TPM command.
5873 ``cancel-path`` is optional and by default QEMU will search for the
5874 sysfs entry to use.
5875
5876 Some notes about using the host's TPM with the passthrough driver:
5877
5878 The TPM device accessed by the passthrough driver must not be used
5879 by any other application on the host.
5880
5881 Since the host's firmware (BIOS/UEFI) has already initialized the
5882 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize
5883 the TPM again and may therefore not show a TPM-specific menu that
5884 would otherwise allow the user to configure the TPM, e.g., allow the
5885 user to enable/disable or activate/deactivate the TPM. Further, if
5886 TPM ownership is released from within a VM then the host's TPM will
5887 get disabled and deactivated. To enable and activate the TPM again
5888 afterwards, the host has to be rebooted and the user is required to
5889 enter the firmware's menu to enable and activate the TPM. If the TPM
5890 is left disabled and/or deactivated most TPM commands will fail.
5891
5892 To create a passthrough TPM use the following two options:
5893
5894 ::
5895
5896 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5897
5898 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by
5899 ``tpmdev=tpm0`` in the device option.
5900
5901 ``-tpmdev emulator,id=id,chardev=dev``
5902 (Linux-host only) Enable access to a TPM emulator using Unix domain
5903 socket based chardev backend.
5904
5905 ``chardev`` specifies the unique ID of a character device backend
5906 that provides connection to the software TPM server.
5907
5908 To create a TPM emulator backend device with chardev socket backend:
5909
5910 ::
5911
5912 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5913 ERST
5914
5915 STEXI
5916 @end table
5917 ETEXI
5918 DEFHEADING()
5919
5920 #endif
5921
5922 DEFHEADING(Linux/Multiboot boot specific:)
5923 STEXI
5924
5925 When using these options, you can use a given Linux or Multiboot
5926 kernel without installing it in the disk image. It can be useful
5927 for easier testing of various kernels.
5928
5929 @table @option
5930 ETEXI
5931 SRST
5932 When using these options, you can use a given Linux or Multiboot kernel
5933 without installing it in the disk image. It can be useful for easier
5934 testing of various kernels.
5935
5936
5937 ERST
5938
5939 DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
5940 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL)
5941 STEXI
5942 @item -kernel @var{bzImage}
5943 @findex -kernel
5944 Use @var{bzImage} as kernel image. The kernel can be either a Linux kernel
5945 or in multiboot format.
5946 ETEXI
5947 SRST
5948 ``-kernel bzImage``
5949 Use bzImage as kernel image. The kernel can be either a Linux kernel
5950 or in multiboot format.
5951 ERST
5952
5953 DEF("append", HAS_ARG, QEMU_OPTION_append, \
5954 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL)
5955 STEXI
5956 @item -append @var{cmdline}
5957 @findex -append
5958 Use @var{cmdline} as kernel command line
5959 ETEXI
5960 SRST
5961 ``-append cmdline``
5962 Use cmdline as kernel command line
5963 ERST
5964
5965 DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
5966 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL)
5967 STEXI
5968 @item -initrd @var{file}
5969 @findex -initrd
5970 Use @var{file} as initial ram disk.
5971
5972 @item -initrd "@var{file1} arg=foo,@var{file2}"
5973
5974 This syntax is only available with multiboot.
5975
5976 Use @var{file1} and @var{file2} as modules and pass arg=foo as parameter to the
5977 first module.
5978 ETEXI
5979 SRST
5980 ``-initrd file``
5981 Use file as initial ram disk.
5982
5983 ``-initrd "file1 arg=foo,file2"``
5984 This syntax is only available with multiboot.
5985
5986 Use file1 and file2 as modules and pass arg=foo as parameter to the
5987 first module.
5988 ERST
5989
5990 DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \
5991 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL)
5992 STEXI
5993 @item -dtb @var{file}
5994 @findex -dtb
5995 Use @var{file} as a device tree binary (dtb) image and pass it to the kernel
5996 on boot.
5997 ETEXI
5998 SRST
5999 ``-dtb file``
6000 Use file as a device tree binary (dtb) image and pass it to the
6001 kernel on boot.
6002 ERST
6003
6004 STEXI
6005 @end table
6006 ETEXI
6007 DEFHEADING()
6008
6009 DEFHEADING(Debug/Expert options:)
6010 STEXI
6011 @table @option
6012 ETEXI
6013
6014 DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
6015 "-fw_cfg [name=]<name>,file=<file>\n"
6016 " add named fw_cfg entry with contents from file\n"
6017 "-fw_cfg [name=]<name>,string=<str>\n"
6018 " add named fw_cfg entry with contents from string\n",
6019 QEMU_ARCH_ALL)
6020 STEXI
6021
6022 @item -fw_cfg [name=]@var{name},file=@var{file}
6023 @findex -fw_cfg
6024 Add named fw_cfg entry with contents from file @var{file}.
6025
6026 @item -fw_cfg [name=]@var{name},string=@var{str}
6027 Add named fw_cfg entry with contents from string @var{str}.
6028
6029 The terminating NUL character of the contents of @var{str} will not be
6030 included as part of the fw_cfg item data. To insert contents with
6031 embedded NUL characters, you have to use the @var{file} parameter.
6032
6033 The fw_cfg entries are passed by QEMU through to the guest.
6034
6035 Example:
6036 @example
6037 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6038 @end example
6039 creates an fw_cfg entry named opt/com.mycompany/blob with contents
6040 from ./my_blob.bin.
6041
6042 ETEXI
6043 SRST
6044 ``-fw_cfg [name=]name,file=file``
6045 Add named fw\_cfg entry with contents from file file.
6046
6047 ``-fw_cfg [name=]name,string=str``
6048 Add named fw\_cfg entry with contents from string str.
6049
6050 The terminating NUL character of the contents of str will not be
6051 included as part of the fw\_cfg item data. To insert contents with
6052 embedded NUL characters, you have to use the file parameter.
6053
6054 The fw\_cfg entries are passed by QEMU through to the guest.
6055
6056 Example:
6057
6058 ::
6059
6060 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6061
6062 creates an fw\_cfg entry named opt/com.mycompany/blob with contents
6063 from ./my\_blob.bin.
6064 ERST
6065
6066 DEF("serial", HAS_ARG, QEMU_OPTION_serial, \
6067 "-serial dev redirect the serial port to char device 'dev'\n",
6068 QEMU_ARCH_ALL)
6069 STEXI
6070 @item -serial @var{dev}
6071 @findex -serial
6072 Redirect the virtual serial port to host character device
6073 @var{dev}. The default device is @code{vc} in graphical mode and
6074 @code{stdio} in non graphical mode.
6075
6076 This option can be used several times to simulate up to 4 serial
6077 ports.
6078
6079 Use @code{-serial none} to disable all serial ports.
6080
6081 Available character devices are:
6082 @table @option
6083 @item vc[:@var{W}x@var{H}]
6084 Virtual console. Optionally, a width and height can be given in pixel with
6085 @example
6086 vc:800x600
6087 @end example
6088 It is also possible to specify width or height in characters:
6089 @example
6090 vc:80Cx24C
6091 @end example
6092 @item pty
6093 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
6094 @item none
6095 No device is allocated.
6096 @item null
6097 void device
6098 @item chardev:@var{id}
6099 Use a named character device defined with the @code{-chardev} option.
6100 @item /dev/XXX
6101 [Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
6102 parameters are set according to the emulated ones.
6103 @item /dev/parport@var{N}
6104 [Linux only, parallel port only] Use host parallel port
6105 @var{N}. Currently SPP and EPP parallel port features can be used.
6106 @item file:@var{filename}
6107 Write output to @var{filename}. No character can be read.
6108 @item stdio
6109 [Unix only] standard input/output
6110 @item pipe:@var{filename}
6111 name pipe @var{filename}
6112 @item COM@var{n}
6113 [Windows only] Use host serial port @var{n}
6114 @item udp:[@var{remote_host}]:@var{remote_port}[@@[@var{src_ip}]:@var{src_port}]
6115 This implements UDP Net Console.
6116 When @var{remote_host} or @var{src_ip} are not specified
6117 they default to @code{0.0.0.0}.
6118 When not using a specified @var{src_port} a random port is automatically chosen.
6119
6120 If you just want a simple readonly console you can use @code{netcat} or
6121 @code{nc}, by starting QEMU with: @code{-serial udp::4555} and nc as:
6122 @code{nc -u -l -p 4555}. Any time QEMU writes something to that port it
6123 will appear in the netconsole session.
6124
6125 If you plan to send characters back via netconsole or you want to stop
6126 and start QEMU a lot of times, you should have QEMU use the same
6127 source port each time by using something like @code{-serial
6128 udp::4555@@:4556} to QEMU. Another approach is to use a patched
6129 version of netcat which can listen to a TCP port and send and receive
6130 characters via udp. If you have a patched version of netcat which
6131 activates telnet remote echo and single char transfer, then you can
6132 use the following options to set up a netcat redirector to allow
6133 telnet on port 5555 to access the QEMU port.
6134 @table @code
6135 @item QEMU Options:
6136 -serial udp::4555@@:4556
6137 @item netcat options:
6138 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6139 @item telnet options:
6140 localhost 5555
6141 @end table
6142
6143 @item tcp:[@var{host}]:@var{port}[,@var{server}][,nowait][,nodelay][,reconnect=@var{seconds}]
6144 The TCP Net Console has two modes of operation. It can send the serial
6145 I/O to a location or wait for a connection from a location. By default
6146 the TCP Net Console is sent to @var{host} at the @var{port}. If you use
6147 the @var{server} option QEMU will wait for a client socket application
6148 to connect to the port before continuing, unless the @code{nowait}
6149 option was specified. The @code{nodelay} option disables the Nagle buffering
6150 algorithm. The @code{reconnect} option only applies if @var{noserver} is
6151 set, if the connection goes down it will attempt to reconnect at the
6152 given interval. If @var{host} is omitted, 0.0.0.0 is assumed. Only
6153 one TCP connection at a time is accepted. You can use @code{telnet} to
6154 connect to the corresponding character device.
6155 @table @code
6156 @item Example to send tcp console to 192.168.0.2 port 4444
6157 -serial tcp:192.168.0.2:4444
6158 @item Example to listen and wait on port 4444 for connection
6159 -serial tcp::4444,server
6160 @item Example to not wait and listen on ip 192.168.0.100 port 4444
6161 -serial tcp:192.168.0.100:4444,server,nowait
6162 @end table
6163
6164 @item telnet:@var{host}:@var{port}[,server][,nowait][,nodelay]
6165 The telnet protocol is used instead of raw tcp sockets. The options
6166 work the same as if you had specified @code{-serial tcp}. The
6167 difference is that the port acts like a telnet server or client using
6168 telnet option negotiation. This will also allow you to send the
6169 MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
6170 sequence. Typically in unix telnet you do it with Control-] and then
6171 type "send break" followed by pressing the enter key.
6172
6173 @item websocket:@var{host}:@var{port},server[,nowait][,nodelay]
6174 The WebSocket protocol is used instead of raw tcp socket. The port acts as
6175 a WebSocket server. Client mode is not supported.
6176
6177 @item unix:@var{path}[,server][,nowait][,reconnect=@var{seconds}]
6178 A unix domain socket is used instead of a tcp socket. The option works the
6179 same as if you had specified @code{-serial tcp} except the unix domain socket
6180 @var{path} is used for connections.
6181
6182 @item mon:@var{dev_string}
6183 This is a special option to allow the monitor to be multiplexed onto
6184 another serial port. The monitor is accessed with key sequence of
6185 @key{Control-a} and then pressing @key{c}.
6186 @var{dev_string} should be any one of the serial devices specified
6187 above. An example to multiplex the monitor onto a telnet server
6188 listening on port 4444 would be:
6189 @table @code
6190 @item -serial mon:telnet::4444,server,nowait
6191 @end table
6192 When the monitor is multiplexed to stdio in this way, Ctrl+C will not terminate
6193 QEMU any more but will be passed to the guest instead.
6194
6195 @item braille
6196 Braille device. This will use BrlAPI to display the braille output on a real
6197 or fake device.
6198
6199 @item msmouse
6200 Three button serial mouse. Configure the guest to use Microsoft protocol.
6201 @end table
6202 ETEXI
6203 SRST
6204 ``-serial dev``
6205 Redirect the virtual serial port to host character device dev. The
6206 default device is ``vc`` in graphical mode and ``stdio`` in non
6207 graphical mode.
6208
6209 This option can be used several times to simulate up to 4 serial
6210 ports.
6211
6212 Use ``-serial none`` to disable all serial ports.
6213
6214 Available character devices are:
6215
6216 ``vc[:WxH]``
6217 Virtual console. Optionally, a width and height can be given in
6218 pixel with
6219
6220 ::
6221
6222 vc:800x600
6223
6224 It is also possible to specify width or height in characters:
6225
6226 ::
6227
6228 vc:80Cx24C
6229
6230 ``pty``
6231 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
6232
6233 ``none``
6234 No device is allocated.
6235
6236 ``null``
6237 void device
6238
6239 ``chardev:id``
6240 Use a named character device defined with the ``-chardev``
6241 option.
6242
6243 ``/dev/XXX``
6244 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial
6245 port parameters are set according to the emulated ones.
6246
6247 ``/dev/parportN``
6248 [Linux only, parallel port only] Use host parallel port N.
6249 Currently SPP and EPP parallel port features can be used.
6250
6251 ``file:filename``
6252 Write output to filename. No character can be read.
6253
6254 ``stdio``
6255 [Unix only] standard input/output
6256
6257 ``pipe:filename``
6258 name pipe filename
6259
6260 ``COMn``
6261 [Windows only] Use host serial port n
6262
6263 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]``
6264 This implements UDP Net Console. When remote\_host or src\_ip
6265 are not specified they default to ``0.0.0.0``. When not using a
6266 specified src\_port a random port is automatically chosen.
6267
6268 If you just want a simple readonly console you can use
6269 ``netcat`` or ``nc``, by starting QEMU with:
6270 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time
6271 QEMU writes something to that port it will appear in the
6272 netconsole session.
6273
6274 If you plan to send characters back via netconsole or you want
6275 to stop and start QEMU a lot of times, you should have QEMU use
6276 the same source port each time by using something like ``-serial
6277 udp::4555@:4556`` to QEMU. Another approach is to use a patched
6278 version of netcat which can listen to a TCP port and send and
6279 receive characters via udp. If you have a patched version of
6280 netcat which activates telnet remote echo and single char
6281 transfer, then you can use the following options to set up a
6282 netcat redirector to allow telnet on port 5555 to access the
6283 QEMU port.
6284
6285 ``QEMU Options:``
6286 -serial udp::4555@:4556
6287
6288 ``netcat options:``
6289 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6290
6291 ``telnet options:``
6292 localhost 5555
6293
6294 ``tcp:[host]:port[,server][,nowait][,nodelay][,reconnect=seconds]``
6295 The TCP Net Console has two modes of operation. It can send the
6296 serial I/O to a location or wait for a connection from a
6297 location. By default the TCP Net Console is sent to host at the
6298 port. If you use the server option QEMU will wait for a client
6299 socket application to connect to the port before continuing,
6300 unless the ``nowait`` option was specified. The ``nodelay``
6301 option disables the Nagle buffering algorithm. The ``reconnect``
6302 option only applies if noserver is set, if the connection goes
6303 down it will attempt to reconnect at the given interval. If host
6304 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a
6305 time is accepted. You can use ``telnet`` to connect to the
6306 corresponding character device.
6307
6308 ``Example to send tcp console to 192.168.0.2 port 4444``
6309 -serial tcp:192.168.0.2:4444
6310
6311 ``Example to listen and wait on port 4444 for connection``
6312 -serial tcp::4444,server
6313
6314 ``Example to not wait and listen on ip 192.168.0.100 port 4444``
6315 -serial tcp:192.168.0.100:4444,server,nowait
6316
6317 ``telnet:host:port[,server][,nowait][,nodelay]``
6318 The telnet protocol is used instead of raw tcp sockets. The
6319 options work the same as if you had specified ``-serial tcp``.
6320 The difference is that the port acts like a telnet server or
6321 client using telnet option negotiation. This will also allow you
6322 to send the MAGIC\_SYSRQ sequence if you use a telnet that
6323 supports sending the break sequence. Typically in unix telnet
6324 you do it with Control-] and then type "send break" followed by
6325 pressing the enter key.
6326
6327 ``websocket:host:port,server[,nowait][,nodelay]``
6328 The WebSocket protocol is used instead of raw tcp socket. The
6329 port acts as a WebSocket server. Client mode is not supported.
6330
6331 ``unix:path[,server][,nowait][,reconnect=seconds]``
6332 A unix domain socket is used instead of a tcp socket. The option
6333 works the same as if you had specified ``-serial tcp`` except
6334 the unix domain socket path is used for connections.
6335
6336 ``mon:dev_string``
6337 This is a special option to allow the monitor to be multiplexed
6338 onto another serial port. The monitor is accessed with key
6339 sequence of Control-a and then pressing c. dev\_string should be
6340 any one of the serial devices specified above. An example to
6341 multiplex the monitor onto a telnet server listening on port
6342 4444 would be:
6343
6344 ``-serial mon:telnet::4444,server,nowait``
6345
6346 When the monitor is multiplexed to stdio in this way, Ctrl+C
6347 will not terminate QEMU any more but will be passed to the guest
6348 instead.
6349
6350 ``braille``
6351 Braille device. This will use BrlAPI to display the braille
6352 output on a real or fake device.
6353
6354 ``msmouse``
6355 Three button serial mouse. Configure the guest to use Microsoft
6356 protocol.
6357 ERST
6358
6359 DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
6360 "-parallel dev redirect the parallel port to char device 'dev'\n",
6361 QEMU_ARCH_ALL)
6362 STEXI
6363 @item -parallel @var{dev}
6364 @findex -parallel
6365 Redirect the virtual parallel port to host device @var{dev} (same
6366 devices as the serial port). On Linux hosts, @file{/dev/parportN} can
6367 be used to use hardware devices connected on the corresponding host
6368 parallel port.
6369
6370 This option can be used several times to simulate up to 3 parallel
6371 ports.
6372
6373 Use @code{-parallel none} to disable all parallel ports.
6374 ETEXI
6375 SRST
6376 ``-parallel dev``
6377 Redirect the virtual parallel port to host device dev (same devices
6378 as the serial port). On Linux hosts, ``/dev/parportN`` can be used
6379 to use hardware devices connected on the corresponding host parallel
6380 port.
6381
6382 This option can be used several times to simulate up to 3 parallel
6383 ports.
6384
6385 Use ``-parallel none`` to disable all parallel ports.
6386 ERST
6387
6388 DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
6389 "-monitor dev redirect the monitor to char device 'dev'\n",
6390 QEMU_ARCH_ALL)
6391 STEXI
6392 @item -monitor @var{dev}
6393 @findex -monitor
6394 Redirect the monitor to host device @var{dev} (same devices as the
6395 serial port).
6396 The default device is @code{vc} in graphical mode and @code{stdio} in
6397 non graphical mode.
6398 Use @code{-monitor none} to disable the default monitor.
6399 ETEXI
6400 SRST
6401 ``-monitor dev``
6402 Redirect the monitor to host device dev (same devices as the serial
6403 port). The default device is ``vc`` in graphical mode and ``stdio``
6404 in non graphical mode. Use ``-monitor none`` to disable the default
6405 monitor.
6406 ERST
6407 DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
6408 "-qmp dev like -monitor but opens in 'control' mode\n",
6409 QEMU_ARCH_ALL)
6410 STEXI
6411 @item -qmp @var{dev}
6412 @findex -qmp
6413 Like -monitor but opens in 'control' mode.
6414 ETEXI
6415 SRST
6416 ``-qmp dev``
6417 Like -monitor but opens in 'control' mode.
6418 ERST
6419 DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
6420 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
6421 QEMU_ARCH_ALL)
6422 STEXI
6423 @item -qmp-pretty @var{dev}
6424 @findex -qmp-pretty
6425 Like -qmp but uses pretty JSON formatting.
6426 ETEXI
6427 SRST
6428 ``-qmp-pretty dev``
6429 Like -qmp but uses pretty JSON formatting.
6430 ERST
6431
6432 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
6433 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL)
6434 STEXI
6435 @item -mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]
6436 @findex -mon
6437 Setup monitor on chardev @var{name}. @code{pretty} turns on JSON pretty printing
6438 easing human reading and debugging.
6439 ETEXI
6440 SRST
6441 ``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]``
6442 Setup monitor on chardev name. ``pretty`` turns on JSON pretty
6443 printing easing human reading and debugging.
6444 ERST
6445
6446 DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
6447 "-debugcon dev redirect the debug console to char device 'dev'\n",
6448 QEMU_ARCH_ALL)
6449 STEXI
6450 @item -debugcon @var{dev}
6451 @findex -debugcon
6452 Redirect the debug console to host device @var{dev} (same devices as the
6453 serial port). The debug console is an I/O port which is typically port
6454 0xe9; writing to that I/O port sends output to this device.
6455 The default device is @code{vc} in graphical mode and @code{stdio} in
6456 non graphical mode.
6457 ETEXI
6458 SRST
6459 ``-debugcon dev``
6460 Redirect the debug console to host device dev (same devices as the
6461 serial port). The debug console is an I/O port which is typically
6462 port 0xe9; writing to that I/O port sends output to this device. The
6463 default device is ``vc`` in graphical mode and ``stdio`` in non
6464 graphical mode.
6465 ERST
6466
6467 DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
6468 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL)
6469 STEXI
6470 @item -pidfile @var{file}
6471 @findex -pidfile
6472 Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
6473 from a script.
6474 ETEXI
6475 SRST
6476 ``-pidfile file``
6477 Store the QEMU process PID in file. It is useful if you launch QEMU
6478 from a script.
6479 ERST
6480
6481 DEF("singlestep", 0, QEMU_OPTION_singlestep, \
6482 "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL)
6483 STEXI
6484 @item -singlestep
6485 @findex -singlestep
6486 Run the emulation in single step mode.
6487 ETEXI
6488 SRST
6489 ``-singlestep``
6490 Run the emulation in single step mode.
6491 ERST
6492
6493 DEF("preconfig", 0, QEMU_OPTION_preconfig, \
6494 "--preconfig pause QEMU before machine is initialized (experimental)\n",
6495 QEMU_ARCH_ALL)
6496 STEXI
6497 @item --preconfig
6498 @findex --preconfig
6499 Pause QEMU for interactive configuration before the machine is created,
6500 which allows querying and configuring properties that will affect
6501 machine initialization. Use QMP command 'x-exit-preconfig' to exit
6502 the preconfig state and move to the next state (i.e. run guest if -S
6503 isn't used or pause the second time if -S is used). This option is
6504 experimental.
6505 ETEXI
6506 SRST
6507 ``--preconfig``
6508 Pause QEMU for interactive configuration before the machine is
6509 created, which allows querying and configuring properties that will
6510 affect machine initialization. Use QMP command 'x-exit-preconfig' to
6511 exit the preconfig state and move to the next state (i.e. run guest
6512 if -S isn't used or pause the second time if -S is used). This
6513 option is experimental.
6514 ERST
6515
6516 DEF("S", 0, QEMU_OPTION_S, \
6517 "-S freeze CPU at startup (use 'c' to start execution)\n",
6518 QEMU_ARCH_ALL)
6519 STEXI
6520 @item -S
6521 @findex -S
6522 Do not start CPU at startup (you must type 'c' in the monitor).
6523 ETEXI
6524 SRST
6525 ``-S``
6526 Do not start CPU at startup (you must type 'c' in the monitor).
6527 ERST
6528
6529 DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
6530 "-realtime [mlock=on|off]\n"
6531 " run qemu with realtime features\n"
6532 " mlock=on|off controls mlock support (default: on)\n",
6533 QEMU_ARCH_ALL)
6534 STEXI
6535 @item -realtime mlock=on|off
6536 @findex -realtime
6537 Run qemu with realtime features.
6538 mlocking qemu and guest memory can be enabled via @option{mlock=on}
6539 (enabled by default).
6540 ETEXI
6541 SRST
6542 ``-realtime mlock=on|off``
6543 Run qemu with realtime features. mlocking qemu and guest memory can
6544 be enabled via ``mlock=on`` (enabled by default).
6545 ERST
6546
6547 DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
6548 "-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
6549 " run qemu with overcommit hints\n"
6550 " mem-lock=on|off controls memory lock support (default: off)\n"
6551 " cpu-pm=on|off controls cpu power management (default: off)\n",
6552 QEMU_ARCH_ALL)
6553 STEXI
6554 @item -overcommit mem-lock=on|off
6555 @item -overcommit cpu-pm=on|off
6556 @findex -overcommit
6557 Run qemu with hints about host resource overcommit. The default is
6558 to assume that host overcommits all resources.
6559
6560 Locking qemu and guest memory can be enabled via @option{mem-lock=on} (disabled
6561 by default). This works when host memory is not overcommitted and reduces the
6562 worst-case latency for guest. This is equivalent to @option{realtime}.
6563
6564 Guest ability to manage power state of host cpus (increasing latency for other
6565 processes on the same host cpu, but decreasing latency for guest) can be
6566 enabled via @option{cpu-pm=on} (disabled by default). This works best when
6567 host CPU is not overcommitted. When used, host estimates of CPU cycle and power
6568 utilization will be incorrect, not taking into account guest idle time.
6569 ETEXI
6570 SRST
6571 ``-overcommit mem-lock=on|off``
6572 ``-overcommit cpu-pm=on|off``
6573 Run qemu with hints about host resource overcommit. The default is
6574 to assume that host overcommits all resources.
6575
6576 Locking qemu and guest memory can be enabled via ``mem-lock=on``
6577 (disabled by default). This works when host memory is not
6578 overcommitted and reduces the worst-case latency for guest. This is
6579 equivalent to ``realtime``.
6580
6581 Guest ability to manage power state of host cpus (increasing latency
6582 for other processes on the same host cpu, but decreasing latency for
6583 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This
6584 works best when host CPU is not overcommitted. When used, host
6585 estimates of CPU cycle and power utilization will be incorrect, not
6586 taking into account guest idle time.
6587 ERST
6588
6589 DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
6590 "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
6591 STEXI
6592 @item -gdb @var{dev}
6593 @findex -gdb
6594 Wait for gdb connection on device @var{dev} (@pxref{gdb_usage}). Typical
6595 connections will likely be TCP-based, but also UDP, pseudo TTY, or even
6596 stdio are reasonable use case. The latter is allowing to start QEMU from
6597 within gdb and establish the connection via a pipe:
6598 @example
6599 (gdb) target remote | exec @value{qemu_system} -gdb stdio ...
6600 @end example
6601 ETEXI
6602 SRST
6603 ``-gdb dev``
6604 Wait for gdb connection on device dev (see
6605 :ref:`gdb_005fusage`). Typical connections will likely be
6606 TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable
6607 use case. The latter is allowing to start QEMU from within gdb and
6608 establish the connection via a pipe:
6609
6610 ::
6611
6612 (gdb) target remote | exec |qemu_system| -gdb stdio ...
6613 ERST
6614
6615 DEF("s", 0, QEMU_OPTION_s, \
6616 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n",
6617 QEMU_ARCH_ALL)
6618 STEXI
6619 @item -s
6620 @findex -s
6621 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6622 (@pxref{gdb_usage}).
6623 ETEXI
6624 SRST
6625 ``-s``
6626 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6627 (see :ref:`gdb_005fusage`).
6628 ERST
6629
6630 DEF("d", HAS_ARG, QEMU_OPTION_d, \
6631 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n",
6632 QEMU_ARCH_ALL)
6633 STEXI
6634 @item -d @var{item1}[,...]
6635 @findex -d
6636 Enable logging of specified items. Use '-d help' for a list of log items.
6637 ETEXI
6638 SRST
6639 ``-d item1[,...]``
6640 Enable logging of specified items. Use '-d help' for a list of log
6641 items.
6642 ERST
6643
6644 DEF("D", HAS_ARG, QEMU_OPTION_D, \
6645 "-D logfile output log to logfile (default stderr)\n",
6646 QEMU_ARCH_ALL)
6647 STEXI
6648 @item -D @var{logfile}
6649 @findex -D
6650 Output log in @var{logfile} instead of to stderr
6651 ETEXI
6652 SRST
6653 ``-D logfile``
6654 Output log in logfile instead of to stderr
6655 ERST
6656
6657 DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \
6658 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n",
6659 QEMU_ARCH_ALL)
6660 STEXI
6661 @item -dfilter @var{range1}[,...]
6662 @findex -dfilter
6663 Filter debug output to that relevant to a range of target addresses. The filter
6664 spec can be either @var{start}+@var{size}, @var{start}-@var{size} or
6665 @var{start}..@var{end} where @var{start} @var{end} and @var{size} are the
6666 addresses and sizes required. For example:
6667 @example
6668 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6669 @end example
6670 Will dump output for any code in the 0x1000 sized block starting at 0x8000 and
6671 the 0x200 sized block starting at 0xffffffc000080000 and another 0x1000 sized
6672 block starting at 0xffffffc00005f000.
6673 ETEXI
6674 SRST
6675 ``-dfilter range1[,...]``
6676 Filter debug output to that relevant to a range of target addresses.
6677 The filter spec can be either start+size, start-size or start..end
6678 where start end and size are the addresses and sizes required. For
6679 example:
6680
6681 ::
6682
6683 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6684
6685 Will dump output for any code in the 0x1000 sized block starting at
6686 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and
6687 another 0x1000 sized block starting at 0xffffffc00005f000.
6688 ERST
6689
6690 DEF("seed", HAS_ARG, QEMU_OPTION_seed, \
6691 "-seed number seed the pseudo-random number generator\n",
6692 QEMU_ARCH_ALL)
6693 STEXI
6694 @item -seed @var{number}
6695 @findex -seed
6696 Force the guest to use a deterministic pseudo-random number generator, seeded
6697 with @var{number}. This does not affect crypto routines within the host.
6698 ETEXI
6699 SRST
6700 ``-seed number``
6701 Force the guest to use a deterministic pseudo-random number
6702 generator, seeded with number. This does not affect crypto routines
6703 within the host.
6704 ERST
6705
6706 DEF("L", HAS_ARG, QEMU_OPTION_L, \
6707 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n",
6708 QEMU_ARCH_ALL)
6709 STEXI
6710 @item -L @var{path}
6711 @findex -L
6712 Set the directory for the BIOS, VGA BIOS and keymaps.
6713
6714 To list all the data directories, use @code{-L help}.
6715 ETEXI
6716 SRST
6717 ``-L path``
6718 Set the directory for the BIOS, VGA BIOS and keymaps.
6719
6720 To list all the data directories, use ``-L help``.
6721 ERST
6722
6723 DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
6724 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL)
6725 STEXI
6726 @item -bios @var{file}
6727 @findex -bios
6728 Set the filename for the BIOS.
6729 ETEXI
6730 SRST
6731 ``-bios file``
6732 Set the filename for the BIOS.
6733 ERST
6734
6735 DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
6736 "-enable-kvm enable KVM full virtualization support\n", QEMU_ARCH_ALL)
6737 STEXI
6738 @item -enable-kvm
6739 @findex -enable-kvm
6740 Enable KVM full virtualization support. This option is only available
6741 if KVM support is enabled when compiling.
6742 ETEXI
6743 SRST
6744 ``-enable-kvm``
6745 Enable KVM full virtualization support. This option is only
6746 available if KVM support is enabled when compiling.
6747 ERST
6748
6749 DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
6750 "-xen-domid id specify xen guest domain id\n", QEMU_ARCH_ALL)
6751 DEF("xen-attach", 0, QEMU_OPTION_xen_attach,
6752 "-xen-attach attach to existing xen domain\n"
6753 " libxl will use this when starting QEMU\n",
6754 QEMU_ARCH_ALL)
6755 DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict,
6756 "-xen-domid-restrict restrict set of available xen operations\n"
6757 " to specified domain id. (Does not affect\n"
6758 " xenpv machine type).\n",
6759 QEMU_ARCH_ALL)
6760 STEXI
6761 @item -xen-domid @var{id}
6762 @findex -xen-domid
6763 Specify xen guest domain @var{id} (XEN only).
6764 @item -xen-attach
6765 @findex -xen-attach
6766 Attach to existing xen domain.
6767 libxl will use this when starting QEMU (XEN only).
6768 @findex -xen-domid-restrict
6769 Restrict set of available xen operations to specified domain id (XEN only).
6770 ETEXI
6771 SRST
6772 ``-xen-domid id``
6773 Specify xen guest domain id (XEN only).
6774
6775 ``-xen-attach``
6776 Attach to existing xen domain. libxl will use this when starting
6777 QEMU (XEN only). Restrict set of available xen operations to
6778 specified domain id (XEN only).
6779 ERST
6780
6781 DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
6782 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL)
6783 STEXI
6784 @item -no-reboot
6785 @findex -no-reboot
6786 Exit instead of rebooting.
6787 ETEXI
6788 SRST
6789 ``-no-reboot``
6790 Exit instead of rebooting.
6791 ERST
6792
6793 DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \
6794 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL)
6795 STEXI
6796 @item -no-shutdown
6797 @findex -no-shutdown
6798 Don't exit QEMU on guest shutdown, but instead only stop the emulation.
6799 This allows for instance switching to monitor to commit changes to the
6800 disk image.
6801 ETEXI
6802 SRST
6803 ``-no-shutdown``
6804 Don't exit QEMU on guest shutdown, but instead only stop the
6805 emulation. This allows for instance switching to monitor to commit
6806 changes to the disk image.
6807 ERST
6808
6809 DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \
6810 "-loadvm [tag|id]\n" \
6811 " start right away with a saved state (loadvm in monitor)\n",
6812 QEMU_ARCH_ALL)
6813 STEXI
6814 @item -loadvm @var{file}
6815 @findex -loadvm
6816 Start right away with a saved state (@code{loadvm} in monitor)
6817 ETEXI
6818 SRST
6819 ``-loadvm file``
6820 Start right away with a saved state (``loadvm`` in monitor)
6821 ERST
6822
6823 #ifndef _WIN32
6824 DEF("daemonize", 0, QEMU_OPTION_daemonize, \
6825 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
6826 #endif
6827 STEXI
6828 @item -daemonize
6829 @findex -daemonize
6830 Daemonize the QEMU process after initialization. QEMU will not detach from
6831 standard IO until it is ready to receive connections on any of its devices.
6832 This option is a useful way for external programs to launch QEMU without having
6833 to cope with initialization race conditions.
6834 ETEXI
6835 SRST
6836 ``-daemonize``
6837 Daemonize the QEMU process after initialization. QEMU will not
6838 detach from standard IO until it is ready to receive connections on
6839 any of its devices. This option is a useful way for external
6840 programs to launch QEMU without having to cope with initialization
6841 race conditions.
6842 ERST
6843
6844 DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \
6845 "-option-rom rom load a file, rom, into the option ROM space\n",
6846 QEMU_ARCH_ALL)
6847 STEXI
6848 @item -option-rom @var{file}
6849 @findex -option-rom
6850 Load the contents of @var{file} as an option ROM.
6851 This option is useful to load things like EtherBoot.
6852 ETEXI
6853 SRST
6854 ``-option-rom file``
6855 Load the contents of file as an option ROM. This option is useful to
6856 load things like EtherBoot.
6857 ERST
6858
6859 DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
6860 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
6861 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
6862 QEMU_ARCH_ALL)
6863
6864 STEXI
6865
6866 @item -rtc [base=utc|localtime|@var{datetime}][,clock=host|rt|vm][,driftfix=none|slew]
6867 @findex -rtc
6868 Specify @option{base} as @code{utc} or @code{localtime} to let the RTC start at the current
6869 UTC or local time, respectively. @code{localtime} is required for correct date in
6870 MS-DOS or Windows. To start at a specific point in time, provide @var{datetime} in the
6871 format @code{2006-06-17T16:01:21} or @code{2006-06-17}. The default base is UTC.
6872
6873 By default the RTC is driven by the host system time. This allows using of the
6874 RTC as accurate reference clock inside the guest, specifically if the host
6875 time is smoothly following an accurate external reference clock, e.g. via NTP.
6876 If you want to isolate the guest time from the host, you can set @option{clock}
6877 to @code{rt} instead, which provides a host monotonic clock if host support it.
6878 To even prevent the RTC from progressing during suspension, you can set @option{clock}
6879 to @code{vm} (virtual clock). @samp{clock=vm} is recommended especially in
6880 icount mode in order to preserve determinism; however, note that in icount mode
6881 the speed of the virtual clock is variable and can in general differ from the
6882 host clock.
6883
6884 Enable @option{driftfix} (i386 targets only) if you experience time drift problems,
6885 specifically with Windows' ACPI HAL. This option will try to figure out how
6886 many timer interrupts were not processed by the Windows guest and will
6887 re-inject them.
6888 ETEXI
6889 SRST
6890 ``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]``
6891 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at
6892 the current UTC or local time, respectively. ``localtime`` is
6893 required for correct date in MS-DOS or Windows. To start at a
6894 specific point in time, provide datetime in the format
6895 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC.
6896
6897 By default the RTC is driven by the host system time. This allows
6898 using of the RTC as accurate reference clock inside the guest,
6899 specifically if the host time is smoothly following an accurate
6900 external reference clock, e.g. via NTP. If you want to isolate the
6901 guest time from the host, you can set ``clock`` to ``rt`` instead,
6902 which provides a host monotonic clock if host support it. To even
6903 prevent the RTC from progressing during suspension, you can set
6904 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is
6905 recommended especially in icount mode in order to preserve
6906 determinism; however, note that in icount mode the speed of the
6907 virtual clock is variable and can in general differ from the host
6908 clock.
6909
6910 Enable ``driftfix`` (i386 targets only) if you experience time drift
6911 problems, specifically with Windows' ACPI HAL. This option will try
6912 to figure out how many timer interrupts were not processed by the
6913 Windows guest and will re-inject them.
6914 ERST
6915
6916 DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
6917 "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=<filename>,rrsnapshot=<snapshot>]\n" \
6918 " enable virtual instruction counter with 2^N clock ticks per\n" \
6919 " instruction, enable aligning the host and virtual clocks\n" \
6920 " or disable real time cpu sleeping\n", QEMU_ARCH_ALL)
6921 STEXI
6922 @item -icount [shift=@var{N}|auto][,rr=record|replay,rrfile=@var{filename},rrsnapshot=@var{snapshot}]
6923 @findex -icount
6924 Enable virtual instruction counter. The virtual cpu will execute one
6925 instruction every 2^@var{N} ns of virtual time. If @code{auto} is specified
6926 then the virtual cpu speed will be automatically adjusted to keep virtual
6927 time within a few seconds of real time.
6928
6929 When the virtual cpu is sleeping, the virtual time will advance at default
6930 speed unless @option{sleep=on|off} is specified.
6931 With @option{sleep=on|off}, the virtual time will jump to the next timer deadline
6932 instantly whenever the virtual cpu goes to sleep mode and will not advance
6933 if no timer is enabled. This behavior give deterministic execution times from
6934 the guest point of view.
6935
6936 Note that while this option can give deterministic behavior, it does not
6937 provide cycle accurate emulation. Modern CPUs contain superscalar out of
6938 order cores with complex cache hierarchies. The number of instructions
6939 executed often has little or no correlation with actual performance.
6940
6941 @option{align=on} will activate the delay algorithm which will try
6942 to synchronise the host clock and the virtual clock. The goal is to
6943 have a guest running at the real frequency imposed by the shift option.
6944 Whenever the guest clock is behind the host clock and if
6945 @option{align=on} is specified then we print a message to the user
6946 to inform about the delay.
6947 Currently this option does not work when @option{shift} is @code{auto}.
6948 Note: The sync algorithm will work for those shift values for which
6949 the guest clock runs ahead of the host clock. Typically this happens
6950 when the shift value is high (how high depends on the host machine).
6951
6952 When @option{rr} option is specified deterministic record/replay is enabled.
6953 Replay log is written into @var{filename} file in record mode and
6954 read from this file in replay mode.
6955
6956 Option rrsnapshot is used to create new vm snapshot named @var{snapshot}
6957 at the start of execution recording. In replay mode this option is used
6958 to load the initial VM state.
6959 ETEXI
6960 SRST
6961 ``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]``
6962 Enable virtual instruction counter. The virtual cpu will execute one
6963 instruction every 2^N ns of virtual time. If ``auto`` is specified
6964 then the virtual cpu speed will be automatically adjusted to keep
6965 virtual time within a few seconds of real time.
6966
6967 When the virtual cpu is sleeping, the virtual time will advance at
6968 default speed unless ``sleep=on|off`` is specified. With
6969 ``sleep=on|off``, the virtual time will jump to the next timer
6970 deadline instantly whenever the virtual cpu goes to sleep mode and
6971 will not advance if no timer is enabled. This behavior give
6972 deterministic execution times from the guest point of view.
6973
6974 Note that while this option can give deterministic behavior, it does
6975 not provide cycle accurate emulation. Modern CPUs contain
6976 superscalar out of order cores with complex cache hierarchies. The
6977 number of instructions executed often has little or no correlation
6978 with actual performance.
6979
6980 ``align=on`` will activate the delay algorithm which will try to
6981 synchronise the host clock and the virtual clock. The goal is to
6982 have a guest running at the real frequency imposed by the shift
6983 option. Whenever the guest clock is behind the host clock and if
6984 ``align=on`` is specified then we print a message to the user to
6985 inform about the delay. Currently this option does not work when
6986 ``shift`` is ``auto``. Note: The sync algorithm will work for those
6987 shift values for which the guest clock runs ahead of the host clock.
6988 Typically this happens when the shift value is high (how high
6989 depends on the host machine).
6990
6991 When ``rr`` option is specified deterministic record/replay is
6992 enabled. Replay log is written into filename file in record mode and
6993 read from this file in replay mode.
6994
6995 Option rrsnapshot is used to create new vm snapshot named snapshot
6996 at the start of execution recording. In replay mode this option is
6997 used to load the initial VM state.
6998 ERST
6999
7000 DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \
7001 "-watchdog model\n" \
7002 " enable virtual hardware watchdog [default=none]\n",
7003 QEMU_ARCH_ALL)
7004 STEXI
7005 @item -watchdog @var{model}
7006 @findex -watchdog
7007 Create a virtual hardware watchdog device. Once enabled (by a guest
7008 action), the watchdog must be periodically polled by an agent inside
7009 the guest or else the guest will be restarted. Choose a model for
7010 which your guest has drivers.
7011
7012 The @var{model} is the model of hardware watchdog to emulate. Use
7013 @code{-watchdog help} to list available hardware models. Only one
7014 watchdog can be enabled for a guest.
7015
7016 The following models may be available:
7017 @table @option
7018 @item ib700
7019 iBASE 700 is a very simple ISA watchdog with a single timer.
7020 @item i6300esb
7021 Intel 6300ESB I/O controller hub is a much more featureful PCI-based
7022 dual-timer watchdog.
7023 @item diag288
7024 A virtual watchdog for s390x backed by the diagnose 288 hypercall
7025 (currently KVM only).
7026 @end table
7027 ETEXI
7028 SRST
7029 ``-watchdog model``
7030 Create a virtual hardware watchdog device. Once enabled (by a guest
7031 action), the watchdog must be periodically polled by an agent inside
7032 the guest or else the guest will be restarted. Choose a model for
7033 which your guest has drivers.
7034
7035 The model is the model of hardware watchdog to emulate. Use
7036 ``-watchdog help`` to list available hardware models. Only one
7037 watchdog can be enabled for a guest.
7038
7039 The following models may be available:
7040
7041 ``ib700``
7042 iBASE 700 is a very simple ISA watchdog with a single timer.
7043
7044 ``i6300esb``
7045 Intel 6300ESB I/O controller hub is a much more featureful
7046 PCI-based dual-timer watchdog.
7047
7048 ``diag288``
7049 A virtual watchdog for s390x backed by the diagnose 288
7050 hypercall (currently KVM only).
7051 ERST
7052
7053 DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \
7054 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \
7055 " action when watchdog fires [default=reset]\n",
7056 QEMU_ARCH_ALL)
7057 STEXI
7058 @item -watchdog-action @var{action}
7059 @findex -watchdog-action
7060
7061 The @var{action} controls what QEMU will do when the watchdog timer
7062 expires.
7063 The default is
7064 @code{reset} (forcefully reset the guest).
7065 Other possible actions are:
7066 @code{shutdown} (attempt to gracefully shutdown the guest),
7067 @code{poweroff} (forcefully poweroff the guest),
7068 @code{inject-nmi} (inject a NMI into the guest),
7069 @code{pause} (pause the guest),
7070 @code{debug} (print a debug message and continue), or
7071 @code{none} (do nothing).
7072
7073 Note that the @code{shutdown} action requires that the guest responds
7074 to ACPI signals, which it may not be able to do in the sort of
7075 situations where the watchdog would have expired, and thus
7076 @code{-watchdog-action shutdown} is not recommended for production use.
7077
7078 Examples:
7079
7080 @table @code
7081 @item -watchdog i6300esb -watchdog-action pause
7082 @itemx -watchdog ib700
7083 @end table
7084 ETEXI
7085 SRST
7086 ``-watchdog-action action``
7087 The action controls what QEMU will do when the watchdog timer
7088 expires. The default is ``reset`` (forcefully reset the guest).
7089 Other possible actions are: ``shutdown`` (attempt to gracefully
7090 shutdown the guest), ``poweroff`` (forcefully poweroff the guest),
7091 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the
7092 guest), ``debug`` (print a debug message and continue), or ``none``
7093 (do nothing).
7094
7095 Note that the ``shutdown`` action requires that the guest responds
7096 to ACPI signals, which it may not be able to do in the sort of
7097 situations where the watchdog would have expired, and thus
7098 ``-watchdog-action shutdown`` is not recommended for production use.
7099
7100 Examples:
7101
7102 ``-watchdog i6300esb -watchdog-action pause``; \ ``-watchdog ib700``
7103
7104 ERST
7105
7106 DEF("echr", HAS_ARG, QEMU_OPTION_echr, \
7107 "-echr chr set terminal escape character instead of ctrl-a\n",
7108 QEMU_ARCH_ALL)
7109 STEXI
7110
7111 @item -echr @var{numeric_ascii_value}
7112 @findex -echr
7113 Change the escape character used for switching to the monitor when using
7114 monitor and serial sharing. The default is @code{0x01} when using the
7115 @code{-nographic} option. @code{0x01} is equal to pressing
7116 @code{Control-a}. You can select a different character from the ascii
7117 control keys where 1 through 26 map to Control-a through Control-z. For
7118 instance you could use the either of the following to change the escape
7119 character to Control-t.
7120 @table @code
7121 @item -echr 0x14
7122 @itemx -echr 20
7123 @end table
7124 ETEXI
7125 SRST
7126 ``-echr numeric_ascii_value``
7127 Change the escape character used for switching to the monitor when
7128 using monitor and serial sharing. The default is ``0x01`` when using
7129 the ``-nographic`` option. ``0x01`` is equal to pressing
7130 ``Control-a``. You can select a different character from the ascii
7131 control keys where 1 through 26 map to Control-a through Control-z.
7132 For instance you could use the either of the following to change the
7133 escape character to Control-t.
7134
7135 ``-echr 0x14``; \ ``-echr 20``
7136
7137 ERST
7138
7139 DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \
7140 "-show-cursor show cursor\n", QEMU_ARCH_ALL)
7141 STEXI
7142 @item -show-cursor
7143 @findex -show-cursor
7144 Show cursor.
7145 ETEXI
7146 SRST
7147 ``-show-cursor``
7148 Show cursor.
7149 ERST
7150
7151 DEF("tb-size", HAS_ARG, QEMU_OPTION_tb_size, \
7152 "-tb-size n set TB size\n", QEMU_ARCH_ALL)
7153 STEXI
7154 @item -tb-size @var{n}
7155 @findex -tb-size
7156 Set TCG translation block cache size. Deprecated, use @samp{-accel tcg,tb-size=@var{n}}
7157 instead.
7158 ETEXI
7159 SRST
7160 ``-tb-size n``
7161 Set TCG translation block cache size. Deprecated, use
7162 '\ ``-accel tcg,tb-size=n``\ ' instead.
7163 ERST
7164
7165 DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
7166 "-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]\n" \
7167 "-incoming rdma:host:port[,ipv4][,ipv6]\n" \
7168 "-incoming unix:socketpath\n" \
7169 " prepare for incoming migration, listen on\n" \
7170 " specified protocol and socket address\n" \
7171 "-incoming fd:fd\n" \
7172 "-incoming exec:cmdline\n" \
7173 " accept incoming migration on given file descriptor\n" \
7174 " or from given external command\n" \
7175 "-incoming defer\n" \
7176 " wait for the URI to be specified via migrate_incoming\n",
7177 QEMU_ARCH_ALL)
7178 STEXI
7179 @item -incoming tcp:[@var{host}]:@var{port}[,to=@var{maxport}][,ipv4][,ipv6]
7180 @itemx -incoming rdma:@var{host}:@var{port}[,ipv4][,ipv6]
7181 @findex -incoming
7182 Prepare for incoming migration, listen on a given tcp port.
7183
7184 @item -incoming unix:@var{socketpath}
7185 Prepare for incoming migration, listen on a given unix socket.
7186
7187 @item -incoming fd:@var{fd}
7188 Accept incoming migration from a given filedescriptor.
7189
7190 @item -incoming exec:@var{cmdline}
7191 Accept incoming migration as an output from specified external command.
7192
7193 @item -incoming defer
7194 Wait for the URI to be specified via migrate_incoming. The monitor can
7195 be used to change settings (such as migration parameters) prior to issuing
7196 the migrate_incoming to allow the migration to begin.
7197 ETEXI
7198 SRST
7199 ``-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]``; \ ``-incoming rdma:host:port[,ipv4][,ipv6]``
7200 Prepare for incoming migration, listen on a given tcp port.
7201
7202 ``-incoming unix:socketpath``
7203 Prepare for incoming migration, listen on a given unix socket.
7204
7205 ``-incoming fd:fd``
7206 Accept incoming migration from a given filedescriptor.
7207
7208 ``-incoming exec:cmdline``
7209 Accept incoming migration as an output from specified external
7210 command.
7211
7212 ``-incoming defer``
7213 Wait for the URI to be specified via migrate\_incoming. The monitor
7214 can be used to change settings (such as migration parameters) prior
7215 to issuing the migrate\_incoming to allow the migration to begin.
7216 ERST
7217
7218 DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \
7219 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL)
7220 STEXI
7221 @item -only-migratable
7222 @findex -only-migratable
7223 Only allow migratable devices. Devices will not be allowed to enter an
7224 unmigratable state.
7225 ETEXI
7226 SRST
7227 ``-only-migratable``
7228 Only allow migratable devices. Devices will not be allowed to enter
7229 an unmigratable state.
7230 ERST
7231
7232 DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
7233 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL)
7234 STEXI
7235 @item -nodefaults
7236 @findex -nodefaults
7237 Don't create default devices. Normally, QEMU sets the default devices like serial
7238 port, parallel port, virtual console, monitor device, VGA adapter, floppy and
7239 CD-ROM drive and others. The @code{-nodefaults} option will disable all those
7240 default devices.
7241 ETEXI
7242 SRST
7243 ``-nodefaults``
7244 Don't create default devices. Normally, QEMU sets the default
7245 devices like serial port, parallel port, virtual console, monitor
7246 device, VGA adapter, floppy and CD-ROM drive and others. The
7247 ``-nodefaults`` option will disable all those default devices.
7248 ERST
7249
7250 #ifndef _WIN32
7251 DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \
7252 "-chroot dir chroot to dir just before starting the VM\n",
7253 QEMU_ARCH_ALL)
7254 #endif
7255 STEXI
7256 @item -chroot @var{dir}
7257 @findex -chroot
7258 Immediately before starting guest execution, chroot to the specified
7259 directory. Especially useful in combination with -runas.
7260 ETEXI
7261 SRST
7262 ``-chroot dir``
7263 Immediately before starting guest execution, chroot to the specified
7264 directory. Especially useful in combination with -runas.
7265 ERST
7266
7267 #ifndef _WIN32
7268 DEF("runas", HAS_ARG, QEMU_OPTION_runas, \
7269 "-runas user change to user id user just before starting the VM\n" \
7270 " user can be numeric uid:gid instead\n",
7271 QEMU_ARCH_ALL)
7272 #endif
7273 STEXI
7274 @item -runas @var{user}
7275 @findex -runas
7276 Immediately before starting guest execution, drop root privileges, switching
7277 to the specified user.
7278 ETEXI
7279 SRST
7280 ``-runas user``
7281 Immediately before starting guest execution, drop root privileges,
7282 switching to the specified user.
7283 ERST
7284
7285 DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env,
7286 "-prom-env variable=value\n"
7287 " set OpenBIOS nvram variables\n",
7288 QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
7289 STEXI
7290 @item -prom-env @var{variable}=@var{value}
7291 @findex -prom-env
7292 Set OpenBIOS nvram @var{variable} to given @var{value} (PPC, SPARC only).
7293
7294 @example
7295 qemu-system-sparc -prom-env 'auto-boot?=false' \
7296 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7297 @end example
7298
7299 @example
7300 qemu-system-ppc -prom-env 'auto-boot?=false' \
7301 -prom-env 'boot-device=hd:2,\yaboot' \
7302 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7303 @end example
7304
7305 ETEXI
7306 SRST
7307 ``-prom-env variable=value``
7308 Set OpenBIOS nvram variable to given value (PPC, SPARC only).
7309
7310 ::
7311
7312 qemu-system-sparc -prom-env 'auto-boot?=false' \
7313 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7314
7315 ::
7316
7317 qemu-system-ppc -prom-env 'auto-boot?=false' \
7318 -prom-env 'boot-device=hd:2,\yaboot' \
7319 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7320 ERST
7321 DEF("semihosting", 0, QEMU_OPTION_semihosting,
7322 "-semihosting semihosting mode\n",
7323 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
7324 QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
7325 STEXI
7326 @item -semihosting
7327 @findex -semihosting
7328 Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
7329
7330 Note that this allows guest direct access to the host filesystem, so
7331 should only be used with a trusted guest OS.
7332
7333 See the -semihosting-config option documentation for further information
7334 about the facilities this enables.
7335 ETEXI
7336 SRST
7337 ``-semihosting``
7338 Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
7339
7340 Note that this allows guest direct access to the host filesystem, so
7341 should only be used with a trusted guest OS.
7342
7343 See the -semihosting-config option documentation for further
7344 information about the facilities this enables.
7345 ERST
7346 DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config,
7347 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]\n" \
7348 " semihosting configuration\n",
7349 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
7350 QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
7351 STEXI
7352 @item -semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]
7353 @findex -semihosting-config
7354 Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II only).
7355
7356 Note that this allows guest direct access to the host filesystem, so
7357 should only be used with a trusted guest OS.
7358
7359 On Arm this implements the standard semihosting API, version 2.0.
7360
7361 On M68K this implements the "ColdFire GDB" interface used by libgloss.
7362
7363 Xtensa semihosting provides basic file IO calls, such as
7364 open/read/write/seek/select. Tensilica baremetal libc for ISS and
7365 linux platform "sim" use this interface.
7366
7367 @table @option
7368 @item target=@code{native|gdb|auto}
7369 Defines where the semihosting calls will be addressed, to QEMU (@code{native})
7370 or to GDB (@code{gdb}). The default is @code{auto}, which means @code{gdb}
7371 during debug sessions and @code{native} otherwise.
7372 @item chardev=@var{str1}
7373 Send the output to a chardev backend output for native or auto output when not in gdb
7374 @item arg=@var{str1},arg=@var{str2},...
7375 Allows the user to pass input arguments, and can be used multiple times to build
7376 up a list. The old-style @code{-kernel}/@code{-append} method of passing a
7377 command line is still supported for backward compatibility. If both the
7378 @code{--semihosting-config arg} and the @code{-kernel}/@code{-append} are
7379 specified, the former is passed to semihosting as it always takes precedence.
7380 @end table
7381 ETEXI
7382 SRST
7383 ``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]``
7384 Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II
7385 only).
7386
7387 Note that this allows guest direct access to the host filesystem, so
7388 should only be used with a trusted guest OS.
7389
7390 On Arm this implements the standard semihosting API, version 2.0.
7391
7392 On M68K this implements the "ColdFire GDB" interface used by
7393 libgloss.
7394
7395 Xtensa semihosting provides basic file IO calls, such as
7396 open/read/write/seek/select. Tensilica baremetal libc for ISS and
7397 linux platform "sim" use this interface.
7398
7399 ``target=native|gdb|auto``
7400 Defines where the semihosting calls will be addressed, to QEMU
7401 (``native``) or to GDB (``gdb``). The default is ``auto``, which
7402 means ``gdb`` during debug sessions and ``native`` otherwise.
7403
7404 ``chardev=str1``
7405 Send the output to a chardev backend output for native or auto
7406 output when not in gdb
7407
7408 ``arg=str1,arg=str2,...``
7409 Allows the user to pass input arguments, and can be used
7410 multiple times to build up a list. The old-style
7411 ``-kernel``/``-append`` method of passing a command line is
7412 still supported for backward compatibility. If both the
7413 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are
7414 specified, the former is passed to semihosting as it always
7415 takes precedence.
7416 ERST
7417 DEF("old-param", 0, QEMU_OPTION_old_param,
7418 "-old-param old param mode\n", QEMU_ARCH_ARM)
7419 STEXI
7420 @item -old-param
7421 @findex -old-param (ARM)
7422 Old param mode (ARM only).
7423 ETEXI
7424 SRST
7425 ``-old-param``
7426 Old param mode (ARM only).
7427 ERST
7428
7429 DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
7430 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
7431 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
7432 " Enable seccomp mode 2 system call filter (default 'off').\n" \
7433 " use 'obsolete' to allow obsolete system calls that are provided\n" \
7434 " by the kernel, but typically no longer used by modern\n" \
7435 " C library implementations.\n" \
7436 " use 'elevateprivileges' to allow or deny QEMU process to elevate\n" \
7437 " its privileges by blacklisting all set*uid|gid system calls.\n" \
7438 " The value 'children' will deny set*uid|gid system calls for\n" \
7439 " main QEMU process but will allow forks and execves to run unprivileged\n" \
7440 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
7441 " blacklisting *fork and execve\n" \
7442 " use 'resourcecontrol' to disable process affinity and schedular priority\n",
7443 QEMU_ARCH_ALL)
7444 STEXI
7445 @item -sandbox @var{arg}[,obsolete=@var{string}][,elevateprivileges=@var{string}][,spawn=@var{string}][,resourcecontrol=@var{string}]
7446 @findex -sandbox
7447 Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will
7448 disable it. The default is 'off'.
7449 @table @option
7450 @item obsolete=@var{string}
7451 Enable Obsolete system calls
7452 @item elevateprivileges=@var{string}
7453 Disable set*uid|gid system calls
7454 @item spawn=@var{string}
7455 Disable *fork and execve
7456 @item resourcecontrol=@var{string}
7457 Disable process affinity and schedular priority
7458 @end table
7459 ETEXI
7460 SRST
7461 ``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]``
7462 Enable Seccomp mode 2 system call filter. 'on' will enable syscall
7463 filtering and 'off' will disable it. The default is 'off'.
7464
7465 ``obsolete=string``
7466 Enable Obsolete system calls
7467
7468 ``elevateprivileges=string``
7469 Disable set\*uid\|gid system calls
7470
7471 ``spawn=string``
7472 Disable \*fork and execve
7473
7474 ``resourcecontrol=string``
7475 Disable process affinity and schedular priority
7476 ERST
7477
7478 DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
7479 "-readconfig <file>\n", QEMU_ARCH_ALL)
7480 STEXI
7481 @item -readconfig @var{file}
7482 @findex -readconfig
7483 Read device configuration from @var{file}. This approach is useful when you want to spawn
7484 QEMU process with many command line options but you don't want to exceed the command line
7485 character limit.
7486 ETEXI
7487 SRST
7488 ``-readconfig file``
7489 Read device configuration from file. This approach is useful when
7490 you want to spawn QEMU process with many command line options but
7491 you don't want to exceed the command line character limit.
7492 ERST
7493 DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig,
7494 "-writeconfig <file>\n"
7495 " read/write config file\n", QEMU_ARCH_ALL)
7496 STEXI
7497 @item -writeconfig @var{file}
7498 @findex -writeconfig
7499 Write device configuration to @var{file}. The @var{file} can be either filename to save
7500 command line and device configuration into file or dash @code{-}) character to print the
7501 output to stdout. This can be later used as input file for @code{-readconfig} option.
7502 ETEXI
7503 SRST
7504 ``-writeconfig file``
7505 Write device configuration to file. The file can be either filename
7506 to save command line and device configuration into file or dash
7507 ``-``) character to print the output to stdout. This can be later
7508 used as input file for ``-readconfig`` option.
7509 ERST
7510
7511 DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
7512 "-no-user-config\n"
7513 " do not load default user-provided config files at startup\n",
7514 QEMU_ARCH_ALL)
7515 STEXI
7516 @item -no-user-config
7517 @findex -no-user-config
7518 The @code{-no-user-config} option makes QEMU not load any of the user-provided
7519 config files on @var{sysconfdir}.
7520 ETEXI
7521 SRST
7522 ``-no-user-config``
7523 The ``-no-user-config`` option makes QEMU not load any of the
7524 user-provided config files on sysconfdir.
7525 ERST
7526
7527 DEF("trace", HAS_ARG, QEMU_OPTION_trace,
7528 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
7529 " specify tracing options\n",
7530 QEMU_ARCH_ALL)
7531 STEXI
7532 HXCOMM This line is not accurate, as some sub-options are backend-specific but
7533 HXCOMM HX does not support conditional compilation of text.
7534 @item -trace [[enable=]@var{pattern}][,events=@var{file}][,file=@var{file}]
7535 @findex -trace
7536 @include docs/system/qemu-option-trace.texi
7537 ETEXI
7538 SRST
7539 ``-trace [[enable=]pattern][,events=file][,file=file]``
7540 Specify tracing options.
7541
7542 ``[enable=]pattern``
7543 Immediately enable events matching pattern (either event name or
7544 a globbing pattern). This option is only available if QEMU has
7545 been compiled with the simple, log or ftrace tracing backend. To
7546 specify multiple events or patterns, specify the ``-trace``
7547 option multiple times.
7548
7549 Use ``-trace help`` to print a list of names of trace points.
7550
7551 ``events=file``
7552 Immediately enable events listed in file. The file must contain
7553 one event name (as listed in the ``trace-events-all`` file) per
7554 line; globbing patterns are accepted too. This option is only
7555 available if QEMU has been compiled with the simple, log or
7556 ftrace tracing backend.
7557
7558 ``file=file``
7559 Log output traces to file. This option is only available if QEMU
7560 has been compiled with the simple tracing backend.
7561 ERST
7562 DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
7563 "-plugin [file=]<file>[,arg=<string>]\n"
7564 " load a plugin\n",
7565 QEMU_ARCH_ALL)
7566 STEXI
7567 @item -plugin file=@var{file}[,arg=@var{string}]
7568 @findex -plugin
7569
7570 Load a plugin.
7571
7572 @table @option
7573 @item file=@var{file}
7574 Load the given plugin from a shared library file.
7575 @item arg=@var{string}
7576 Argument string passed to the plugin. (Can be given multiple times.)
7577 @end table
7578 ETEXI
7579 SRST
7580 ``-plugin file=file[,arg=string]``
7581 Load a plugin.
7582
7583 ``file=file``
7584 Load the given plugin from a shared library file.
7585
7586 ``arg=string``
7587 Argument string passed to the plugin. (Can be given multiple
7588 times.)
7589 ERST
7590
7591 HXCOMM Internal use
7592 DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
7593 DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL)
7594
7595 #ifdef __linux__
7596 DEF("enable-fips", 0, QEMU_OPTION_enablefips,
7597 "-enable-fips enable FIPS 140-2 compliance\n",
7598 QEMU_ARCH_ALL)
7599 #endif
7600 STEXI
7601 @item -enable-fips
7602 @findex -enable-fips
7603 Enable FIPS 140-2 compliance mode.
7604 ETEXI
7605 SRST
7606 ``-enable-fips``
7607 Enable FIPS 140-2 compliance mode.
7608 ERST
7609
7610 HXCOMM Deprecated by -accel tcg
7611 DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
7612
7613 DEF("msg", HAS_ARG, QEMU_OPTION_msg,
7614 "-msg timestamp[=on|off]\n"
7615 " control error message format\n"
7616 " timestamp=on enables timestamps (default: off)\n",
7617 QEMU_ARCH_ALL)
7618 STEXI
7619 @item -msg timestamp[=on|off]
7620 @findex -msg
7621 Control error message format.
7622 @table @option
7623 @item timestamp=on|off
7624 Prefix messages with a timestamp. Default is off.
7625 @end table
7626 ETEXI
7627 SRST
7628 ``-msg timestamp[=on|off]``
7629 Control error message format.
7630
7631 ``timestamp=on|off``
7632 Prefix messages with a timestamp. Default is off.
7633 ERST
7634
7635 DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
7636 "-dump-vmstate <file>\n"
7637 " Output vmstate information in JSON format to file.\n"
7638 " Use the scripts/vmstate-static-checker.py file to\n"
7639 " check for possible regressions in migration code\n"
7640 " by comparing two such vmstate dumps.\n",
7641 QEMU_ARCH_ALL)
7642 STEXI
7643 @item -dump-vmstate @var{file}
7644 @findex -dump-vmstate
7645 Dump json-encoded vmstate information for current machine type to file
7646 in @var{file}
7647 ETEXI
7648 SRST
7649 ``-dump-vmstate file``
7650 Dump json-encoded vmstate information for current machine type to
7651 file in file
7652 ERST
7653
7654 DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile,
7655 "-enable-sync-profile\n"
7656 " enable synchronization profiling\n",
7657 QEMU_ARCH_ALL)
7658 STEXI
7659 @item -enable-sync-profile
7660 @findex -enable-sync-profile
7661 Enable synchronization profiling.
7662 ETEXI
7663 SRST
7664 ``-enable-sync-profile``
7665 Enable synchronization profiling.
7666 ERST
7667
7668 STEXI
7669 @end table
7670 ETEXI
7671 DEFHEADING()
7672
7673 DEFHEADING(Generic object creation:)
7674 STEXI
7675 @table @option
7676 ETEXI
7677
7678 DEF("object", HAS_ARG, QEMU_OPTION_object,
7679 "-object TYPENAME[,PROP1=VALUE1,...]\n"
7680 " create a new object of type TYPENAME setting properties\n"
7681 " in the order they are specified. Note that the 'id'\n"
7682 " property must be set. These objects are placed in the\n"
7683 " '/objects' path.\n",
7684 QEMU_ARCH_ALL)
7685 STEXI
7686 @item -object @var{typename}[,@var{prop1}=@var{value1},...]
7687 @findex -object
7688 Create a new object of type @var{typename} setting properties
7689 in the order they are specified. Note that the 'id'
7690 property must be set. These objects are placed in the
7691 '/objects' path.
7692
7693 @table @option
7694
7695 @item -object memory-backend-file,id=@var{id},size=@var{size},mem-path=@var{dir},share=@var{on|off},discard-data=@var{on|off},merge=@var{on|off},dump=@var{on|off},prealloc=@var{on|off},host-nodes=@var{host-nodes},policy=@var{default|preferred|bind|interleave},align=@var{align}
7696
7697 Creates a memory file backend object, which can be used to back
7698 the guest RAM with huge pages.
7699
7700 The @option{id} parameter is a unique ID that will be used to reference this
7701 memory region when configuring the @option{-numa} argument.
7702
7703 The @option{size} option provides the size of the memory region, and accepts
7704 common suffixes, eg @option{500M}.
7705
7706 The @option{mem-path} provides the path to either a shared memory or huge page
7707 filesystem mount.
7708
7709 The @option{share} boolean option determines whether the memory
7710 region is marked as private to QEMU, or shared. The latter allows
7711 a co-operating external process to access the QEMU memory region.
7712
7713 The @option{share} is also required for pvrdma devices due to
7714 limitations in the RDMA API provided by Linux.
7715
7716 Setting share=on might affect the ability to configure NUMA
7717 bindings for the memory backend under some circumstances, see
7718 Documentation/vm/numa_memory_policy.txt on the Linux kernel
7719 source tree for additional details.
7720
7721 Setting the @option{discard-data} boolean option to @var{on}
7722 indicates that file contents can be destroyed when QEMU exits,
7723 to avoid unnecessarily flushing data to the backing file. Note
7724 that @option{discard-data} is only an optimization, and QEMU
7725 might not discard file contents if it aborts unexpectedly or is
7726 terminated using SIGKILL.
7727
7728 The @option{merge} boolean option enables memory merge, also known as
7729 MADV_MERGEABLE, so that Kernel Samepage Merging will consider the pages for
7730 memory deduplication.
7731
7732 Setting the @option{dump} boolean option to @var{off} excludes the memory from
7733 core dumps. This feature is also known as MADV_DONTDUMP.
7734
7735 The @option{prealloc} boolean option enables memory preallocation.
7736
7737 The @option{host-nodes} option binds the memory range to a list of NUMA host
7738 nodes.
7739
7740 The @option{policy} option sets the NUMA policy to one of the following values:
7741
7742 @table @option
7743 @item @var{default}
7744 default host policy
7745
7746 @item @var{preferred}
7747 prefer the given host node list for allocation
7748
7749 @item @var{bind}
7750 restrict memory allocation to the given host node list
7751
7752 @item @var{interleave}
7753 interleave memory allocations across the given host node list
7754 @end table
7755
7756 The @option{align} option specifies the base address alignment when
7757 QEMU mmap(2) @option{mem-path}, and accepts common suffixes, eg
7758 @option{2M}. Some backend store specified by @option{mem-path}
7759 requires an alignment different than the default one used by QEMU, eg
7760 the device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
7761 such cases, users can specify the required alignment via this option.
7762
7763 The @option{pmem} option specifies whether the backing file specified
7764 by @option{mem-path} is in host persistent memory that can be accessed
7765 using the SNIA NVM programming model (e.g. Intel NVDIMM).
7766 If @option{pmem} is set to 'on', QEMU will take necessary operations to
7767 guarantee the persistence of its own writes to @option{mem-path}
7768 (e.g. in vNVDIMM label emulation and live migration).
7769 Also, we will map the backend-file with MAP_SYNC flag, which ensures the
7770 file metadata is in sync for @option{mem-path} in case of host crash
7771 or a power failure. MAP_SYNC requires support from both the host kernel
7772 (since Linux kernel 4.15) and the filesystem of @option{mem-path} mounted
7773 with DAX option.
7774
7775 @item -object memory-backend-ram,id=@var{id},merge=@var{on|off},dump=@var{on|off},share=@var{on|off},prealloc=@var{on|off},size=@var{size},host-nodes=@var{host-nodes},policy=@var{default|preferred|bind|interleave}
7776
7777 Creates a memory backend object, which can be used to back the guest RAM.
7778 Memory backend objects offer more control than the @option{-m} option that is
7779 traditionally used to define guest RAM. Please refer to
7780 @option{memory-backend-file} for a description of the options.
7781
7782 @item -object memory-backend-memfd,id=@var{id},merge=@var{on|off},dump=@var{on|off},share=@var{on|off},prealloc=@var{on|off},size=@var{size},host-nodes=@var{host-nodes},policy=@var{default|preferred|bind|interleave},seal=@var{on|off},hugetlb=@var{on|off},hugetlbsize=@var{size}
7783
7784 Creates an anonymous memory file backend object, which allows QEMU to
7785 share the memory with an external process (e.g. when using
7786 vhost-user). The memory is allocated with memfd and optional
7787 sealing. (Linux only)
7788
7789 The @option{seal} option creates a sealed-file, that will block
7790 further resizing the memory ('on' by default).
7791
7792 The @option{hugetlb} option specify the file to be created resides in
7793 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction with
7794 the @option{hugetlb} option, the @option{hugetlbsize} option specify
7795 the hugetlb page size on systems that support multiple hugetlb page
7796 sizes (it must be a power of 2 value supported by the system).
7797
7798 In some versions of Linux, the @option{hugetlb} option is incompatible
7799 with the @option{seal} option (requires at least Linux 4.16).
7800
7801 Please refer to @option{memory-backend-file} for a description of the
7802 other options.
7803
7804 The @option{share} boolean option is @var{on} by default with memfd.
7805
7806 @item -object rng-builtin,id=@var{id}
7807
7808 Creates a random number generator backend which obtains entropy from
7809 QEMU builtin functions. The @option{id} parameter is a unique ID that
7810 will be used to reference this entropy backend from the @option{virtio-rng}
7811 device. By default, the @option{virtio-rng} device uses this RNG backend.
7812
7813 @item -object rng-random,id=@var{id},filename=@var{/dev/random}
7814
7815 Creates a random number generator backend which obtains entropy from
7816 a device on the host. The @option{id} parameter is a unique ID that
7817 will be used to reference this entropy backend from the @option{virtio-rng}
7818 device. The @option{filename} parameter specifies which file to obtain
7819 entropy from and if omitted defaults to @option{/dev/urandom}.
7820
7821 @item -object rng-egd,id=@var{id},chardev=@var{chardevid}
7822
7823 Creates a random number generator backend which obtains entropy from
7824 an external daemon running on the host. The @option{id} parameter is
7825 a unique ID that will be used to reference this entropy backend from
7826 the @option{virtio-rng} device. The @option{chardev} parameter is
7827 the unique ID of a character device backend that provides the connection
7828 to the RNG daemon.
7829
7830 @item -object tls-creds-anon,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/cred/dir},verify-peer=@var{on|off}
7831
7832 Creates a TLS anonymous credentials object, which can be used to provide
7833 TLS support on network backends. The @option{id} parameter is a unique
7834 ID which network backends will use to access the credentials. The
7835 @option{endpoint} is either @option{server} or @option{client} depending
7836 on whether the QEMU network backend that uses the credentials will be
7837 acting as a client or as a server. If @option{verify-peer} is enabled
7838 (the default) then once the handshake is completed, the peer credentials
7839 will be verified, though this is a no-op for anonymous credentials.
7840
7841 The @var{dir} parameter tells QEMU where to find the credential
7842 files. For server endpoints, this directory may contain a file
7843 @var{dh-params.pem} providing diffie-hellman parameters to use
7844 for the TLS server. If the file is missing, QEMU will generate
7845 a set of DH parameters at startup. This is a computationally
7846 expensive operation that consumes random pool entropy, so it is
7847 recommended that a persistent set of parameters be generated
7848 upfront and saved.
7849
7850 @item -object tls-creds-psk,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/keys/dir}[,username=@var{username}]
7851
7852 Creates a TLS Pre-Shared Keys (PSK) credentials object, which can be used to provide
7853 TLS support on network backends. The @option{id} parameter is a unique
7854 ID which network backends will use to access the credentials. The
7855 @option{endpoint} is either @option{server} or @option{client} depending
7856 on whether the QEMU network backend that uses the credentials will be
7857 acting as a client or as a server. For clients only, @option{username}
7858 is the username which will be sent to the server. If omitted
7859 it defaults to ``qemu''.
7860
7861 The @var{dir} parameter tells QEMU where to find the keys file.
7862 It is called ``@var{dir}/keys.psk'' and contains ``username:key''
7863 pairs. This file can most easily be created using the GnuTLS
7864 @code{psktool} program.
7865
7866 For server endpoints, @var{dir} may also contain a file
7867 @var{dh-params.pem} providing diffie-hellman parameters to use
7868 for the TLS server. If the file is missing, QEMU will generate
7869 a set of DH parameters at startup. This is a computationally
7870 expensive operation that consumes random pool entropy, so it is
7871 recommended that a persistent set of parameters be generated
7872 up front and saved.
7873
7874 @item -object tls-creds-x509,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/cred/dir},priority=@var{priority},verify-peer=@var{on|off},passwordid=@var{id}
7875
7876 Creates a TLS anonymous credentials object, which can be used to provide
7877 TLS support on network backends. The @option{id} parameter is a unique
7878 ID which network backends will use to access the credentials. The
7879 @option{endpoint} is either @option{server} or @option{client} depending
7880 on whether the QEMU network backend that uses the credentials will be
7881 acting as a client or as a server. If @option{verify-peer} is enabled
7882 (the default) then once the handshake is completed, the peer credentials
7883 will be verified. With x509 certificates, this implies that the clients
7884 must be provided with valid client certificates too.
7885
7886 The @var{dir} parameter tells QEMU where to find the credential
7887 files. For server endpoints, this directory may contain a file
7888 @var{dh-params.pem} providing diffie-hellman parameters to use
7889 for the TLS server. If the file is missing, QEMU will generate
7890 a set of DH parameters at startup. This is a computationally
7891 expensive operation that consumes random pool entropy, so it is
7892 recommended that a persistent set of parameters be generated
7893 upfront and saved.
7894
7895 For x509 certificate credentials the directory will contain further files
7896 providing the x509 certificates. The certificates must be stored
7897 in PEM format, in filenames @var{ca-cert.pem}, @var{ca-crl.pem} (optional),
7898 @var{server-cert.pem} (only servers), @var{server-key.pem} (only servers),
7899 @var{client-cert.pem} (only clients), and @var{client-key.pem} (only clients).
7900
7901 For the @var{server-key.pem} and @var{client-key.pem} files which
7902 contain sensitive private keys, it is possible to use an encrypted
7903 version by providing the @var{passwordid} parameter. This provides
7904 the ID of a previously created @code{secret} object containing the
7905 password for decryption.
7906
7907 The @var{priority} parameter allows to override the global default
7908 priority used by gnutls. This can be useful if the system administrator
7909 needs to use a weaker set of crypto priorities for QEMU without
7910 potentially forcing the weakness onto all applications. Or conversely
7911 if one wants wants a stronger default for QEMU than for all other
7912 applications, they can do this through this parameter. Its format is
7913 a gnutls priority string as described at
7914 @url{https://gnutls.org/manual/html_node/Priority-Strings.html}.
7915
7916 @item -object filter-buffer,id=@var{id},netdev=@var{netdevid},interval=@var{t}[,queue=@var{all|rx|tx}][,status=@var{on|off}][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
7917
7918 Interval @var{t} can't be 0, this filter batches the packet delivery: all
7919 packets arriving in a given interval on netdev @var{netdevid} are delayed
7920 until the end of the interval. Interval is in microseconds.
7921 @option{status} is optional that indicate whether the netfilter is
7922 on (enabled) or off (disabled), the default status for netfilter will be 'on'.
7923
7924 queue @var{all|rx|tx} is an option that can be applied to any netfilter.
7925
7926 @option{all}: the filter is attached both to the receive and the transmit
7927 queue of the netdev (default).
7928
7929 @option{rx}: the filter is attached to the receive queue of the netdev,
7930 where it will receive packets sent to the netdev.
7931
7932 @option{tx}: the filter is attached to the transmit queue of the netdev,
7933 where it will receive packets sent by the netdev.
7934
7935 position @var{head|tail|id=<id>} is an option to specify where the
7936 filter should be inserted in the filter list. It can be applied to any
7937 netfilter.
7938
7939 @option{head}: the filter is inserted at the head of the filter
7940 list, before any existing filters.
7941
7942 @option{tail}: the filter is inserted at the tail of the filter
7943 list, behind any existing filters (default).
7944
7945 @option{id=<id>}: the filter is inserted before or behind the filter
7946 specified by <id>, see the insert option below.
7947
7948 insert @var{behind|before} is an option to specify where to insert the
7949 new filter relative to the one specified with position=id=<id>. It can
7950 be applied to any netfilter.
7951
7952 @option{before}: insert before the specified filter.
7953
7954 @option{behind}: insert behind the specified filter (default).
7955
7956 @item -object filter-mirror,id=@var{id},netdev=@var{netdevid},outdev=@var{chardevid},queue=@var{all|rx|tx}[,vnet_hdr_support][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
7957
7958 filter-mirror on netdev @var{netdevid},mirror net packet to chardev@var{chardevid}, if it has the vnet_hdr_support flag, filter-mirror will mirror packet with vnet_hdr_len.
7959
7960 @item -object filter-redirector,id=@var{id},netdev=@var{netdevid},indev=@var{chardevid},outdev=@var{chardevid},queue=@var{all|rx|tx}[,vnet_hdr_support][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
7961
7962 filter-redirector on netdev @var{netdevid},redirect filter's net packet to chardev
7963 @var{chardevid},and redirect indev's packet to filter.if it has the vnet_hdr_support flag,
7964 filter-redirector will redirect packet with vnet_hdr_len.
7965 Create a filter-redirector we need to differ outdev id from indev id, id can not
7966 be the same. we can just use indev or outdev, but at least one of indev or outdev
7967 need to be specified.
7968
7969 @item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},queue=@var{all|rx|tx},[vnet_hdr_support][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
7970
7971 Filter-rewriter is a part of COLO project.It will rewrite tcp packet to
7972 secondary from primary to keep secondary tcp connection,and rewrite
7973 tcp packet to primary from secondary make tcp packet can be handled by
7974 client.if it has the vnet_hdr_support flag, we can parse packet with vnet header.
7975
7976 usage:
7977 colo secondary:
7978 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
7979 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
7980 -object filter-rewriter,id=rew0,netdev=hn0,queue=all
7981
7982 @item -object filter-dump,id=@var{id},netdev=@var{dev}[,file=@var{filename}][,maxlen=@var{len}][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
7983
7984 Dump the network traffic on netdev @var{dev} to the file specified by
7985 @var{filename}. At most @var{len} bytes (64k by default) per packet are stored.
7986 The file format is libpcap, so it can be analyzed with tools such as tcpdump
7987 or Wireshark.
7988
7989 @item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid},iothread=@var{id}[,vnet_hdr_support][,notify_dev=@var{id}]
7990
7991 Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
7992 secondary packet. If the packets are same, we will output primary
7993 packet to outdev@var{chardevid}, else we will notify colo-frame
7994 do checkpoint and send primary packet to outdev@var{chardevid}.
7995 In order to improve efficiency, we need to put the task of comparison
7996 in another thread. If it has the vnet_hdr_support flag, colo compare
7997 will send/recv packet with vnet_hdr_len.
7998 If you want to use Xen COLO, will need the notify_dev to notify Xen
7999 colo-frame to do checkpoint.
8000
8001 we must use it with the help of filter-mirror and filter-redirector.
8002
8003 @example
8004
8005 KVM COLO
8006
8007 primary:
8008 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8009 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8010 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8011 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8012 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8013 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8014 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8015 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8016 -object iothread,id=iothread1
8017 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8018 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8019 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8020 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
8021
8022 secondary:
8023 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8024 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8025 -chardev socket,id=red0,host=3.3.3.3,port=9003
8026 -chardev socket,id=red1,host=3.3.3.3,port=9004
8027 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8028 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8029
8030
8031 Xen COLO
8032
8033 primary:
8034 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8035 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8036 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8037 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8038 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8039 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8040 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8041 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8042 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8043 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8044 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8045 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8046 -object iothread,id=iothread1
8047 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8048
8049 secondary:
8050 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8051 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8052 -chardev socket,id=red0,host=3.3.3.3,port=9003
8053 -chardev socket,id=red1,host=3.3.3.3,port=9004
8054 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8055 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8056
8057 @end example
8058
8059 If you want to know the detail of above command line, you can read
8060 the colo-compare git log.
8061
8062 @item -object cryptodev-backend-builtin,id=@var{id}[,queues=@var{queues}]
8063
8064 Creates a cryptodev backend which executes crypto opreation from
8065 the QEMU cipher APIS. The @var{id} parameter is
8066 a unique ID that will be used to reference this cryptodev backend from
8067 the @option{virtio-crypto} device. The @var{queues} parameter is optional,
8068 which specify the queue number of cryptodev backend, the default of
8069 @var{queues} is 1.
8070
8071 @example
8072
8073 # @value{qemu_system} \
8074 [...] \
8075 -object cryptodev-backend-builtin,id=cryptodev0 \
8076 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8077 [...]
8078 @end example
8079
8080 @item -object cryptodev-vhost-user,id=@var{id},chardev=@var{chardevid}[,queues=@var{queues}]
8081
8082 Creates a vhost-user cryptodev backend, backed by a chardev @var{chardevid}.
8083 The @var{id} parameter is a unique ID that will be used to reference this
8084 cryptodev backend from the @option{virtio-crypto} device.
8085 The chardev should be a unix domain socket backed one. The vhost-user uses
8086 a specifically defined protocol to pass vhost ioctl replacement messages
8087 to an application on the other end of the socket.
8088 The @var{queues} parameter is optional, which specify the queue number
8089 of cryptodev backend for multiqueue vhost-user, the default of @var{queues} is 1.
8090
8091 @example
8092
8093 # @value{qemu_system} \
8094 [...] \
8095 -chardev socket,id=chardev0,path=/path/to/socket \
8096 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8097 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8098 [...]
8099 @end example
8100
8101 @item -object secret,id=@var{id},data=@var{string},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8102 @item -object secret,id=@var{id},file=@var{filename},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8103
8104 Defines a secret to store a password, encryption key, or some other sensitive
8105 data. The sensitive data can either be passed directly via the @var{data}
8106 parameter, or indirectly via the @var{file} parameter. Using the @var{data}
8107 parameter is insecure unless the sensitive data is encrypted.
8108
8109 The sensitive data can be provided in raw format (the default), or base64.
8110 When encoded as JSON, the raw format only supports valid UTF-8 characters,
8111 so base64 is recommended for sending binary data. QEMU will convert from
8112 which ever format is provided to the format it needs internally. eg, an
8113 RBD password can be provided in raw format, even though it will be base64
8114 encoded when passed onto the RBD sever.
8115
8116 For added protection, it is possible to encrypt the data associated with
8117 a secret using the AES-256-CBC cipher. Use of encryption is indicated
8118 by providing the @var{keyid} and @var{iv} parameters. The @var{keyid}
8119 parameter provides the ID of a previously defined secret that contains
8120 the AES-256 decryption key. This key should be 32-bytes long and be
8121 base64 encoded. The @var{iv} parameter provides the random initialization
8122 vector used for encryption of this particular secret and should be a
8123 base64 encrypted string of the 16-byte IV.
8124
8125 The simplest (insecure) usage is to provide the secret inline
8126
8127 @example
8128
8129 # @value{qemu_system} -object secret,id=sec0,data=letmein,format=raw
8130
8131 @end example
8132
8133 The simplest secure usage is to provide the secret via a file
8134
8135 # printf "letmein" > mypasswd.txt
8136 # @value{qemu_system} -object secret,id=sec0,file=mypasswd.txt,format=raw
8137
8138 For greater security, AES-256-CBC should be used. To illustrate usage,
8139 consider the openssl command line tool which can encrypt the data. Note
8140 that when encrypting, the plaintext must be padded to the cipher block
8141 size (32 bytes) using the standard PKCS#5/6 compatible padding algorithm.
8142
8143 First a master key needs to be created in base64 encoding:
8144
8145 @example
8146 # openssl rand -base64 32 > key.b64
8147 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8148 @end example
8149
8150 Each secret to be encrypted needs to have a random initialization vector
8151 generated. These do not need to be kept secret
8152
8153 @example
8154 # openssl rand -base64 16 > iv.b64
8155 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8156 @end example
8157
8158 The secret to be defined can now be encrypted, in this case we're
8159 telling openssl to base64 encode the result, but it could be left
8160 as raw bytes if desired.
8161
8162 @example
8163 # SECRET=$(printf "letmein" |
8164 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8165 @end example
8166
8167 When launching QEMU, create a master secret pointing to @code{key.b64}
8168 and specify that to be used to decrypt the user password. Pass the
8169 contents of @code{iv.b64} to the second secret
8170
8171 @example
8172 # @value{qemu_system} \
8173 -object secret,id=secmaster0,format=base64,file=key.b64 \
8174 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8175 data=$SECRET,iv=$(<iv.b64)
8176 @end example
8177
8178 @item -object sev-guest,id=@var{id},cbitpos=@var{cbitpos},reduced-phys-bits=@var{val},[sev-device=@var{string},policy=@var{policy},handle=@var{handle},dh-cert-file=@var{file},session-file=@var{file}]
8179
8180 Create a Secure Encrypted Virtualization (SEV) guest object, which can be used
8181 to provide the guest memory encryption support on AMD processors.
8182
8183 When memory encryption is enabled, one of the physical address bit (aka the
8184 C-bit) is utilized to mark if a memory page is protected. The @option{cbitpos}
8185 is used to provide the C-bit position. The C-bit position is Host family dependent
8186 hence user must provide this value. On EPYC, the value should be 47.
8187
8188 When memory encryption is enabled, we loose certain bits in physical address space.
8189 The @option{reduced-phys-bits} is used to provide the number of bits we loose in
8190 physical address space. Similar to C-bit, the value is Host family dependent.
8191 On EPYC, the value should be 5.
8192
8193 The @option{sev-device} provides the device file to use for communicating with
8194 the SEV firmware running inside AMD Secure Processor. The default device is
8195 '/dev/sev'. If hardware supports memory encryption then /dev/sev devices are
8196 created by CCP driver.
8197
8198 The @option{policy} provides the guest policy to be enforced by the SEV firmware
8199 and restrict what configuration and operational commands can be performed on this
8200 guest by the hypervisor. The policy should be provided by the guest owner and is
8201 bound to the guest and cannot be changed throughout the lifetime of the guest.
8202 The default is 0.
8203
8204 If guest @option{policy} allows sharing the key with another SEV guest then
8205 @option{handle} can be use to provide handle of the guest from which to share
8206 the key.
8207
8208 The @option{dh-cert-file} and @option{session-file} provides the guest owner's
8209 Public Diffie-Hillman key defined in SEV spec. The PDH and session parameters
8210 are used for establishing a cryptographic session with the guest owner to
8211 negotiate keys used for attestation. The file must be encoded in base64.
8212
8213 e.g to launch a SEV guest
8214 @example
8215 # @value{qemu_system_x86} \
8216 ......
8217 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8218 -machine ...,memory-encryption=sev0
8219 .....
8220
8221 @end example
8222
8223
8224 @item -object authz-simple,id=@var{id},identity=@var{string}
8225
8226 Create an authorization object that will control access to network services.
8227
8228 The @option{identity} parameter is identifies the user and its format
8229 depends on the network service that authorization object is associated
8230 with. For authorizing based on TLS x509 certificates, the identity must
8231 be the x509 distinguished name. Note that care must be taken to escape
8232 any commas in the distinguished name.
8233
8234 An example authorization object to validate a x509 distinguished name
8235 would look like:
8236 @example
8237 # @value{qemu_system} \
8238 ...
8239 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8240 ...
8241 @end example
8242
8243 Note the use of quotes due to the x509 distinguished name containing
8244 whitespace, and escaping of ','.
8245
8246 @item -object authz-listfile,id=@var{id},filename=@var{path},refresh=@var{yes|no}
8247
8248 Create an authorization object that will control access to network services.
8249
8250 The @option{filename} parameter is the fully qualified path to a file
8251 containing the access control list rules in JSON format.
8252
8253 An example set of rules that match against SASL usernames might look
8254 like:
8255
8256 @example
8257 @{
8258 "rules": [
8259 @{ "match": "fred", "policy": "allow", "format": "exact" @},
8260 @{ "match": "bob", "policy": "allow", "format": "exact" @},
8261 @{ "match": "danb", "policy": "deny", "format": "glob" @},
8262 @{ "match": "dan*", "policy": "allow", "format": "exact" @},
8263 ],
8264 "policy": "deny"
8265 @}
8266 @end example
8267
8268 When checking access the object will iterate over all the rules and
8269 the first rule to match will have its @option{policy} value returned
8270 as the result. If no rules match, then the default @option{policy}
8271 value is returned.
8272
8273 The rules can either be an exact string match, or they can use the
8274 simple UNIX glob pattern matching to allow wildcards to be used.
8275
8276 If @option{refresh} is set to true the file will be monitored
8277 and automatically reloaded whenever its content changes.
8278
8279 As with the @code{authz-simple} object, the format of the identity
8280 strings being matched depends on the network service, but is usually
8281 a TLS x509 distinguished name, or a SASL username.
8282
8283 An example authorization object to validate a SASL username
8284 would look like:
8285 @example
8286 # @value{qemu_system} \
8287 ...
8288 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8289 ...
8290 @end example
8291
8292 @item -object authz-pam,id=@var{id},service=@var{string}
8293
8294 Create an authorization object that will control access to network services.
8295
8296 The @option{service} parameter provides the name of a PAM service to use
8297 for authorization. It requires that a file @code{/etc/pam.d/@var{service}}
8298 exist to provide the configuration for the @code{account} subsystem.
8299
8300 An example authorization object to validate a TLS x509 distinguished
8301 name would look like:
8302
8303 @example
8304 # @value{qemu_system} \
8305 ...
8306 -object authz-pam,id=auth0,service=qemu-vnc
8307 ...
8308 @end example
8309
8310 There would then be a corresponding config file for PAM at
8311 @code{/etc/pam.d/qemu-vnc} that contains:
8312
8313 @example
8314 account requisite pam_listfile.so item=user sense=allow \
8315 file=/etc/qemu/vnc.allow
8316 @end example
8317
8318 Finally the @code{/etc/qemu/vnc.allow} file would contain
8319 the list of x509 distingished names that are permitted
8320 access
8321
8322 @example
8323 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
8324 @end example
8325
8326 @item -object iothread,id=@var{id},poll-max-ns=@var{poll-max-ns},poll-grow=@var{poll-grow},poll-shrink=@var{poll-shrink}
8327
8328 Creates a dedicated event loop thread that devices can be assigned to. This is
8329 known as an IOThread. By default device emulation happens in vCPU threads or
8330 the main event loop thread. This can become a scalability bottleneck.
8331 IOThreads allow device emulation and I/O to run on other host CPUs.
8332
8333 The @option{id} parameter is a unique ID that will be used to reference this
8334 IOThread from @option{-device ...,iothread=@var{id}}. Multiple devices can be
8335 assigned to an IOThread. Note that not all devices support an
8336 @option{iothread} parameter.
8337
8338 The @code{query-iothreads} QMP command lists IOThreads and reports their thread
8339 IDs so that the user can configure host CPU pinning/affinity.
8340
8341 IOThreads use an adaptive polling algorithm to reduce event loop latency.
8342 Instead of entering a blocking system call to monitor file descriptors and then
8343 pay the cost of being woken up when an event occurs, the polling algorithm
8344 spins waiting for events for a short time. The algorithm's default parameters
8345 are suitable for many cases but can be adjusted based on knowledge of the
8346 workload and/or host device latency.
8347
8348 The @option{poll-max-ns} parameter is the maximum number of nanoseconds to busy
8349 wait for events. Polling can be disabled by setting this value to 0.
8350
8351 The @option{poll-grow} parameter is the multiplier used to increase the polling
8352 time when the algorithm detects it is missing events due to not polling long
8353 enough.
8354
8355 The @option{poll-shrink} parameter is the divisor used to decrease the polling
8356 time when the algorithm detects it is spending too long polling without
8357 encountering events.
8358
8359 The polling parameters can be modified at run-time using the @code{qom-set} command (where @code{iothread1} is the IOThread's @code{id}):
8360
8361 @example
8362 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
8363 @end example
8364
8365 @end table
8366
8367 ETEXI
8368 SRST
8369 ``-object typename[,prop1=value1,...]``
8370 Create a new object of type typename setting properties in the order
8371 they are specified. Note that the 'id' property must be set. These
8372 objects are placed in the '/objects' path.
8373
8374 ``-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``
8375 Creates a memory file backend object, which can be used to back
8376 the guest RAM with huge pages.
8377
8378 The ``id`` parameter is a unique ID that will be used to
8379 reference this memory region when configuring the ``-numa``
8380 argument.
8381
8382 The ``size`` option provides the size of the memory region, and
8383 accepts common suffixes, eg ``500M``.
8384
8385 The ``mem-path`` provides the path to either a shared memory or
8386 huge page filesystem mount.
8387
8388 The ``share`` boolean option determines whether the memory
8389 region is marked as private to QEMU, or shared. The latter
8390 allows a co-operating external process to access the QEMU memory
8391 region.
8392
8393 The ``share`` is also required for pvrdma devices due to
8394 limitations in the RDMA API provided by Linux.
8395
8396 Setting share=on might affect the ability to configure NUMA
8397 bindings for the memory backend under some circumstances, see
8398 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel
8399 source tree for additional details.
8400
8401 Setting the ``discard-data`` boolean option to on indicates that
8402 file contents can be destroyed when QEMU exits, to avoid
8403 unnecessarily flushing data to the backing file. Note that
8404 ``discard-data`` is only an optimization, and QEMU might not
8405 discard file contents if it aborts unexpectedly or is terminated
8406 using SIGKILL.
8407
8408 The ``merge`` boolean option enables memory merge, also known as
8409 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider
8410 the pages for memory deduplication.
8411
8412 Setting the ``dump`` boolean option to off excludes the memory
8413 from core dumps. This feature is also known as MADV\_DONTDUMP.
8414
8415 The ``prealloc`` boolean option enables memory preallocation.
8416
8417 The ``host-nodes`` option binds the memory range to a list of
8418 NUMA host nodes.
8419
8420 The ``policy`` option sets the NUMA policy to one of the
8421 following values:
8422
8423 ``default``
8424 default host policy
8425
8426 ``preferred``
8427 prefer the given host node list for allocation
8428
8429 ``bind``
8430 restrict memory allocation to the given host node list
8431
8432 ``interleave``
8433 interleave memory allocations across the given host node
8434 list
8435
8436 The ``align`` option specifies the base address alignment when
8437 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg
8438 ``2M``. Some backend store specified by ``mem-path`` requires an
8439 alignment different than the default one used by QEMU, eg the
8440 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
8441 such cases, users can specify the required alignment via this
8442 option.
8443
8444 The ``pmem`` option specifies whether the backing file specified
8445 by ``mem-path`` is in host persistent memory that can be
8446 accessed using the SNIA NVM programming model (e.g. Intel
8447 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary
8448 operations to guarantee the persistence of its own writes to
8449 ``mem-path`` (e.g. in vNVDIMM label emulation and live
8450 migration). Also, we will map the backend-file with MAP\_SYNC
8451 flag, which ensures the file metadata is in sync for
8452 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC
8453 requires support from both the host kernel (since Linux kernel
8454 4.15) and the filesystem of ``mem-path`` mounted with DAX
8455 option.
8456
8457 ``-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``
8458 Creates a memory backend object, which can be used to back the
8459 guest RAM. Memory backend objects offer more control than the
8460 ``-m`` option that is traditionally used to define guest RAM.
8461 Please refer to ``memory-backend-file`` for a description of the
8462 options.
8463
8464 ``-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``
8465 Creates an anonymous memory file backend object, which allows
8466 QEMU to share the memory with an external process (e.g. when
8467 using vhost-user). The memory is allocated with memfd and
8468 optional sealing. (Linux only)
8469
8470 The ``seal`` option creates a sealed-file, that will block
8471 further resizing the memory ('on' by default).
8472
8473 The ``hugetlb`` option specify the file to be created resides in
8474 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction
8475 with the ``hugetlb`` option, the ``hugetlbsize`` option specify
8476 the hugetlb page size on systems that support multiple hugetlb
8477 page sizes (it must be a power of 2 value supported by the
8478 system).
8479
8480 In some versions of Linux, the ``hugetlb`` option is
8481 incompatible with the ``seal`` option (requires at least Linux
8482 4.16).
8483
8484 Please refer to ``memory-backend-file`` for a description of the
8485 other options.
8486
8487 The ``share`` boolean option is on by default with memfd.
8488
8489 ``-object rng-builtin,id=id``
8490 Creates a random number generator backend which obtains entropy
8491 from QEMU builtin functions. The ``id`` parameter is a unique ID
8492 that will be used to reference this entropy backend from the
8493 ``virtio-rng`` device. By default, the ``virtio-rng`` device
8494 uses this RNG backend.
8495
8496 ``-object rng-random,id=id,filename=/dev/random``
8497 Creates a random number generator backend which obtains entropy
8498 from a device on the host. The ``id`` parameter is a unique ID
8499 that will be used to reference this entropy backend from the
8500 ``virtio-rng`` device. The ``filename`` parameter specifies
8501 which file to obtain entropy from and if omitted defaults to
8502 ``/dev/urandom``.
8503
8504 ``-object rng-egd,id=id,chardev=chardevid``
8505 Creates a random number generator backend which obtains entropy
8506 from an external daemon running on the host. The ``id``
8507 parameter is a unique ID that will be used to reference this
8508 entropy backend from the ``virtio-rng`` device. The ``chardev``
8509 parameter is the unique ID of a character device backend that
8510 provides the connection to the RNG daemon.
8511
8512 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off``
8513 Creates a TLS anonymous credentials object, which can be used to
8514 provide TLS support on network backends. The ``id`` parameter is
8515 a unique ID which network backends will use to access the
8516 credentials. The ``endpoint`` is either ``server`` or ``client``
8517 depending on whether the QEMU network backend that uses the
8518 credentials will be acting as a client or as a server. If
8519 ``verify-peer`` is enabled (the default) then once the handshake
8520 is completed, the peer credentials will be verified, though this
8521 is a no-op for anonymous credentials.
8522
8523 The dir parameter tells QEMU where to find the credential files.
8524 For server endpoints, this directory may contain a file
8525 dh-params.pem providing diffie-hellman parameters to use for the
8526 TLS server. If the file is missing, QEMU will generate a set of
8527 DH parameters at startup. This is a computationally expensive
8528 operation that consumes random pool entropy, so it is
8529 recommended that a persistent set of parameters be generated
8530 upfront and saved.
8531
8532 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]``
8533 Creates a TLS Pre-Shared Keys (PSK) credentials object, which
8534 can be used to provide TLS support on network backends. The
8535 ``id`` parameter is a unique ID which network backends will use
8536 to access the credentials. The ``endpoint`` is either ``server``
8537 or ``client`` depending on whether the QEMU network backend that
8538 uses the credentials will be acting as a client or as a server.
8539 For clients only, ``username`` is the username which will be
8540 sent to the server. If omitted it defaults to "qemu".
8541
8542 The dir parameter tells QEMU where to find the keys file. It is
8543 called "dir/keys.psk" and contains "username:key" pairs. This
8544 file can most easily be created using the GnuTLS ``psktool``
8545 program.
8546
8547 For server endpoints, dir may also contain a file dh-params.pem
8548 providing diffie-hellman parameters to use for the TLS server.
8549 If the file is missing, QEMU will generate a set of DH
8550 parameters at startup. This is a computationally expensive
8551 operation that consumes random pool entropy, so it is
8552 recommended that a persistent set of parameters be generated up
8553 front and saved.
8554
8555 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id``
8556 Creates a TLS anonymous credentials object, which can be used to
8557 provide TLS support on network backends. The ``id`` parameter is
8558 a unique ID which network backends will use to access the
8559 credentials. The ``endpoint`` is either ``server`` or ``client``
8560 depending on whether the QEMU network backend that uses the
8561 credentials will be acting as a client or as a server. If
8562 ``verify-peer`` is enabled (the default) then once the handshake
8563 is completed, the peer credentials will be verified. With x509
8564 certificates, this implies that the clients must be provided
8565 with valid client certificates too.
8566
8567 The dir parameter tells QEMU where to find the credential files.
8568 For server endpoints, this directory may contain a file
8569 dh-params.pem providing diffie-hellman parameters to use for the
8570 TLS server. If the file is missing, QEMU will generate a set of
8571 DH parameters at startup. This is a computationally expensive
8572 operation that consumes random pool entropy, so it is
8573 recommended that a persistent set of parameters be generated
8574 upfront and saved.
8575
8576 For x509 certificate credentials the directory will contain
8577 further files providing the x509 certificates. The certificates
8578 must be stored in PEM format, in filenames ca-cert.pem,
8579 ca-crl.pem (optional), server-cert.pem (only servers),
8580 server-key.pem (only servers), client-cert.pem (only clients),
8581 and client-key.pem (only clients).
8582
8583 For the server-key.pem and client-key.pem files which contain
8584 sensitive private keys, it is possible to use an encrypted
8585 version by providing the passwordid parameter. This provides the
8586 ID of a previously created ``secret`` object containing the
8587 password for decryption.
8588
8589 The priority parameter allows to override the global default
8590 priority used by gnutls. This can be useful if the system
8591 administrator needs to use a weaker set of crypto priorities for
8592 QEMU without potentially forcing the weakness onto all
8593 applications. Or conversely if one wants wants a stronger
8594 default for QEMU than for all other applications, they can do
8595 this through this parameter. Its format is a gnutls priority
8596 string as described at
8597 https://gnutls.org/manual/html_node/Priority-Strings.html.
8598
8599 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]``
8600 Interval t can't be 0, this filter batches the packet delivery:
8601 all packets arriving in a given interval on netdev netdevid are
8602 delayed until the end of the interval. Interval is in
8603 microseconds. ``status`` is optional that indicate whether the
8604 netfilter is on (enabled) or off (disabled), the default status
8605 for netfilter will be 'on'.
8606
8607 queue all\|rx\|tx is an option that can be applied to any
8608 netfilter.
8609
8610 ``all``: the filter is attached both to the receive and the
8611 transmit queue of the netdev (default).
8612
8613 ``rx``: the filter is attached to the receive queue of the
8614 netdev, where it will receive packets sent to the netdev.
8615
8616 ``tx``: the filter is attached to the transmit queue of the
8617 netdev, where it will receive packets sent by the netdev.
8618
8619 position head\|tail\|id=<id> is an option to specify where the
8620 filter should be inserted in the filter list. It can be applied
8621 to any netfilter.
8622
8623 ``head``: the filter is inserted at the head of the filter list,
8624 before any existing filters.
8625
8626 ``tail``: the filter is inserted at the tail of the filter list,
8627 behind any existing filters (default).
8628
8629 ``id=<id>``: the filter is inserted before or behind the filter
8630 specified by <id>, see the insert option below.
8631
8632 insert behind\|before is an option to specify where to insert
8633 the new filter relative to the one specified with
8634 position=id=<id>. It can be applied to any netfilter.
8635
8636 ``before``: insert before the specified filter.
8637
8638 ``behind``: insert behind the specified filter (default).
8639
8640 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8641 filter-mirror on netdev netdevid,mirror net packet to
8642 chardevchardevid, if it has the vnet\_hdr\_support flag,
8643 filter-mirror will mirror packet with vnet\_hdr\_len.
8644
8645 ``-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]``
8646 filter-redirector on netdev netdevid,redirect filter's net
8647 packet to chardev chardevid,and redirect indev's packet to
8648 filter.if it has the vnet\_hdr\_support flag, filter-redirector
8649 will redirect packet with vnet\_hdr\_len. Create a
8650 filter-redirector we need to differ outdev id from indev id, id
8651 can not be the same. we can just use indev or outdev, but at
8652 least one of indev or outdev need to be specified.
8653
8654 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8655 Filter-rewriter is a part of COLO project.It will rewrite tcp
8656 packet to secondary from primary to keep secondary tcp
8657 connection,and rewrite tcp packet to primary from secondary make
8658 tcp packet can be handled by client.if it has the
8659 vnet\_hdr\_support flag, we can parse packet with vnet header.
8660
8661 usage: colo secondary: -object
8662 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object
8663 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object
8664 filter-rewriter,id=rew0,netdev=hn0,queue=all
8665
8666 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]``
8667 Dump the network traffic on netdev dev to the file specified by
8668 filename. At most len bytes (64k by default) per packet are
8669 stored. The file format is libpcap, so it can be analyzed with
8670 tools such as tcpdump or Wireshark.
8671
8672 ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id]``
8673 Colo-compare gets packet from primary\_inchardevid and
8674 secondary\_inchardevid, than compare primary packet with
8675 secondary packet. If the packets are same, we will output
8676 primary packet to outdevchardevid, else we will notify
8677 colo-frame do checkpoint and send primary packet to
8678 outdevchardevid. In order to improve efficiency, we need to put
8679 the task of comparison in another thread. If it has the
8680 vnet\_hdr\_support flag, colo compare will send/recv packet with
8681 vnet\_hdr\_len. If you want to use Xen COLO, will need the
8682 notify\_dev to notify Xen colo-frame to do checkpoint.
8683
8684 we must use it with the help of filter-mirror and
8685 filter-redirector.
8686
8687 ::
8688
8689 KVM COLO
8690
8691 primary:
8692 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8693 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8694 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8695 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8696 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8697 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8698 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8699 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8700 -object iothread,id=iothread1
8701 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8702 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8703 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8704 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
8705
8706 secondary:
8707 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8708 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8709 -chardev socket,id=red0,host=3.3.3.3,port=9003
8710 -chardev socket,id=red1,host=3.3.3.3,port=9004
8711 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8712 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8713
8714
8715 Xen COLO
8716
8717 primary:
8718 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8719 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8720 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8721 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8722 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8723 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8724 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8725 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8726 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8727 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8728 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8729 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8730 -object iothread,id=iothread1
8731 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8732
8733 secondary:
8734 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8735 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8736 -chardev socket,id=red0,host=3.3.3.3,port=9003
8737 -chardev socket,id=red1,host=3.3.3.3,port=9004
8738 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8739 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8740
8741 If you want to know the detail of above command line, you can
8742 read the colo-compare git log.
8743
8744 ``-object cryptodev-backend-builtin,id=id[,queues=queues]``
8745 Creates a cryptodev backend which executes crypto opreation from
8746 the QEMU cipher APIS. The id parameter is a unique ID that will
8747 be used to reference this cryptodev backend from the
8748 ``virtio-crypto`` device. The queues parameter is optional,
8749 which specify the queue number of cryptodev backend, the default
8750 of queues is 1.
8751
8752 ::
8753
8754 # |qemu_system| \
8755 [...] \
8756 -object cryptodev-backend-builtin,id=cryptodev0 \
8757 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8758 [...]
8759
8760 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]``
8761 Creates a vhost-user cryptodev backend, backed by a chardev
8762 chardevid. The id parameter is a unique ID that will be used to
8763 reference this cryptodev backend from the ``virtio-crypto``
8764 device. The chardev should be a unix domain socket backed one.
8765 The vhost-user uses a specifically defined protocol to pass
8766 vhost ioctl replacement messages to an application on the other
8767 end of the socket. The queues parameter is optional, which
8768 specify the queue number of cryptodev backend for multiqueue
8769 vhost-user, the default of queues is 1.
8770
8771 ::
8772
8773 # |qemu_system| \
8774 [...] \
8775 -chardev socket,id=chardev0,path=/path/to/socket \
8776 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8777 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8778 [...]
8779
8780 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]``
8781 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]``
8782 Defines a secret to store a password, encryption key, or some
8783 other sensitive data. The sensitive data can either be passed
8784 directly via the data parameter, or indirectly via the file
8785 parameter. Using the data parameter is insecure unless the
8786 sensitive data is encrypted.
8787
8788 The sensitive data can be provided in raw format (the default),
8789 or base64. When encoded as JSON, the raw format only supports
8790 valid UTF-8 characters, so base64 is recommended for sending
8791 binary data. QEMU will convert from which ever format is
8792 provided to the format it needs internally. eg, an RBD password
8793 can be provided in raw format, even though it will be base64
8794 encoded when passed onto the RBD sever.
8795
8796 For added protection, it is possible to encrypt the data
8797 associated with a secret using the AES-256-CBC cipher. Use of
8798 encryption is indicated by providing the keyid and iv
8799 parameters. The keyid parameter provides the ID of a previously
8800 defined secret that contains the AES-256 decryption key. This
8801 key should be 32-bytes long and be base64 encoded. The iv
8802 parameter provides the random initialization vector used for
8803 encryption of this particular secret and should be a base64
8804 encrypted string of the 16-byte IV.
8805
8806 The simplest (insecure) usage is to provide the secret inline
8807
8808 ::
8809
8810 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw
8811
8812 The simplest secure usage is to provide the secret via a file
8813
8814 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object
8815 secret,id=sec0,file=mypasswd.txt,format=raw
8816
8817 For greater security, AES-256-CBC should be used. To illustrate
8818 usage, consider the openssl command line tool which can encrypt
8819 the data. Note that when encrypting, the plaintext must be
8820 padded to the cipher block size (32 bytes) using the standard
8821 PKCS#5/6 compatible padding algorithm.
8822
8823 First a master key needs to be created in base64 encoding:
8824
8825 ::
8826
8827 # openssl rand -base64 32 > key.b64
8828 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8829
8830 Each secret to be encrypted needs to have a random
8831 initialization vector generated. These do not need to be kept
8832 secret
8833
8834 ::
8835
8836 # openssl rand -base64 16 > iv.b64
8837 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8838
8839 The secret to be defined can now be encrypted, in this case
8840 we're telling openssl to base64 encode the result, but it could
8841 be left as raw bytes if desired.
8842
8843 ::
8844
8845 # SECRET=$(printf "letmein" |
8846 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8847
8848 When launching QEMU, create a master secret pointing to
8849 ``key.b64`` and specify that to be used to decrypt the user
8850 password. Pass the contents of ``iv.b64`` to the second secret
8851
8852 ::
8853
8854 # |qemu_system| \
8855 -object secret,id=secmaster0,format=base64,file=key.b64 \
8856 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8857 data=$SECRET,iv=$(<iv.b64)
8858
8859 ``-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]``
8860 Create a Secure Encrypted Virtualization (SEV) guest object,
8861 which can be used to provide the guest memory encryption support
8862 on AMD processors.
8863
8864 When memory encryption is enabled, one of the physical address
8865 bit (aka the C-bit) is utilized to mark if a memory page is
8866 protected. The ``cbitpos`` is used to provide the C-bit
8867 position. The C-bit position is Host family dependent hence user
8868 must provide this value. On EPYC, the value should be 47.
8869
8870 When memory encryption is enabled, we loose certain bits in
8871 physical address space. The ``reduced-phys-bits`` is used to
8872 provide the number of bits we loose in physical address space.
8873 Similar to C-bit, the value is Host family dependent. On EPYC,
8874 the value should be 5.
8875
8876 The ``sev-device`` provides the device file to use for
8877 communicating with the SEV firmware running inside AMD Secure
8878 Processor. The default device is '/dev/sev'. If hardware
8879 supports memory encryption then /dev/sev devices are created by
8880 CCP driver.
8881
8882 The ``policy`` provides the guest policy to be enforced by the
8883 SEV firmware and restrict what configuration and operational
8884 commands can be performed on this guest by the hypervisor. The
8885 policy should be provided by the guest owner and is bound to the
8886 guest and cannot be changed throughout the lifetime of the
8887 guest. The default is 0.
8888
8889 If guest ``policy`` allows sharing the key with another SEV
8890 guest then ``handle`` can be use to provide handle of the guest
8891 from which to share the key.
8892
8893 The ``dh-cert-file`` and ``session-file`` provides the guest
8894 owner's Public Diffie-Hillman key defined in SEV spec. The PDH
8895 and session parameters are used for establishing a cryptographic
8896 session with the guest owner to negotiate keys used for
8897 attestation. The file must be encoded in base64.
8898
8899 e.g to launch a SEV guest
8900
8901 ::
8902
8903 # |qemu_system_x86| \
8904 ......
8905 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8906 -machine ...,memory-encryption=sev0
8907 .....
8908
8909 ``-object authz-simple,id=id,identity=string``
8910 Create an authorization object that will control access to
8911 network services.
8912
8913 The ``identity`` parameter is identifies the user and its format
8914 depends on the network service that authorization object is
8915 associated with. For authorizing based on TLS x509 certificates,
8916 the identity must be the x509 distinguished name. Note that care
8917 must be taken to escape any commas in the distinguished name.
8918
8919 An example authorization object to validate a x509 distinguished
8920 name would look like:
8921
8922 ::
8923
8924 # |qemu_system| \
8925 ...
8926 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8927 ...
8928
8929 Note the use of quotes due to the x509 distinguished name
8930 containing whitespace, and escaping of ','.
8931
8932 ``-object authz-listfile,id=id,filename=path,refresh=yes|no``
8933 Create an authorization object that will control access to
8934 network services.
8935
8936 The ``filename`` parameter is the fully qualified path to a file
8937 containing the access control list rules in JSON format.
8938
8939 An example set of rules that match against SASL usernames might
8940 look like:
8941
8942 ::
8943
8944 {
8945 "rules": [
8946 { "match": "fred", "policy": "allow", "format": "exact" },
8947 { "match": "bob", "policy": "allow", "format": "exact" },
8948 { "match": "danb", "policy": "deny", "format": "glob" },
8949 { "match": "dan*", "policy": "allow", "format": "exact" },
8950 ],
8951 "policy": "deny"
8952 }
8953
8954 When checking access the object will iterate over all the rules
8955 and the first rule to match will have its ``policy`` value
8956 returned as the result. If no rules match, then the default
8957 ``policy`` value is returned.
8958
8959 The rules can either be an exact string match, or they can use
8960 the simple UNIX glob pattern matching to allow wildcards to be
8961 used.
8962
8963 If ``refresh`` is set to true the file will be monitored and
8964 automatically reloaded whenever its content changes.
8965
8966 As with the ``authz-simple`` object, the format of the identity
8967 strings being matched depends on the network service, but is
8968 usually a TLS x509 distinguished name, or a SASL username.
8969
8970 An example authorization object to validate a SASL username
8971 would look like:
8972
8973 ::
8974
8975 # |qemu_system| \
8976 ...
8977 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8978 ...
8979
8980 ``-object authz-pam,id=id,service=string``
8981 Create an authorization object that will control access to
8982 network services.
8983
8984 The ``service`` parameter provides the name of a PAM service to
8985 use for authorization. It requires that a file
8986 ``/etc/pam.d/service`` exist to provide the configuration for
8987 the ``account`` subsystem.
8988
8989 An example authorization object to validate a TLS x509
8990 distinguished name would look like:
8991
8992 ::
8993
8994 # |qemu_system| \
8995 ...
8996 -object authz-pam,id=auth0,service=qemu-vnc
8997 ...
8998
8999 There would then be a corresponding config file for PAM at
9000 ``/etc/pam.d/qemu-vnc`` that contains:
9001
9002 ::
9003
9004 account requisite pam_listfile.so item=user sense=allow \
9005 file=/etc/qemu/vnc.allow
9006
9007 Finally the ``/etc/qemu/vnc.allow`` file would contain the list
9008 of x509 distingished names that are permitted access
9009
9010 ::
9011
9012 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
9013
9014 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink``
9015 Creates a dedicated event loop thread that devices can be
9016 assigned to. This is known as an IOThread. By default device
9017 emulation happens in vCPU threads or the main event loop thread.
9018 This can become a scalability bottleneck. IOThreads allow device
9019 emulation and I/O to run on other host CPUs.
9020
9021 The ``id`` parameter is a unique ID that will be used to
9022 reference this IOThread from ``-device ...,iothread=id``.
9023 Multiple devices can be assigned to an IOThread. Note that not
9024 all devices support an ``iothread`` parameter.
9025
9026 The ``query-iothreads`` QMP command lists IOThreads and reports
9027 their thread IDs so that the user can configure host CPU
9028 pinning/affinity.
9029
9030 IOThreads use an adaptive polling algorithm to reduce event loop
9031 latency. Instead of entering a blocking system call to monitor
9032 file descriptors and then pay the cost of being woken up when an
9033 event occurs, the polling algorithm spins waiting for events for
9034 a short time. The algorithm's default parameters are suitable
9035 for many cases but can be adjusted based on knowledge of the
9036 workload and/or host device latency.
9037
9038 The ``poll-max-ns`` parameter is the maximum number of
9039 nanoseconds to busy wait for events. Polling can be disabled by
9040 setting this value to 0.
9041
9042 The ``poll-grow`` parameter is the multiplier used to increase
9043 the polling time when the algorithm detects it is missing events
9044 due to not polling long enough.
9045
9046 The ``poll-shrink`` parameter is the divisor used to decrease
9047 the polling time when the algorithm detects it is spending too
9048 long polling without encountering events.
9049
9050 The polling parameters can be modified at run-time using the
9051 ``qom-set`` command (where ``iothread1`` is the IOThread's
9052 ``id``):
9053
9054 ::
9055
9056 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
9057 ERST
9058
9059
9060 HXCOMM This is the last statement. Insert new options before this line!
9061 STEXI
9062 @end table
9063 ETEXI