blob: 62b7f3b38a612e4095bba9ca5010094b76b3fcd9 [file] [log] [blame]
blueswir15824d652009-03-28 06:44:27 +00001HXCOMM Use DEFHEADING() to define headings in both help text and texi
2HXCOMM Text between STEXI and ETEXI are copied to texi version and
3HXCOMM discarded from C version
Blue Swirlad960902010-03-29 19:23:52 +00004HXCOMM DEF(option, HAS_ARG/0, opt_enum, opt_help, arch_mask) is used to
5HXCOMM construct option structures, enums and help message for specified
6HXCOMM architectures.
blueswir15824d652009-03-28 06:44:27 +00007HXCOMM HXCOMM can be used for comments, discarded from both texi and C
8
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02009DEFHEADING(Standard options:)
blueswir15824d652009-03-28 06:44:27 +000010STEXI
11@table @option
12ETEXI
13
14DEF("help", 0, QEMU_OPTION_h,
Blue Swirlad960902010-03-29 19:23:52 +000015 "-h or -help display this help and exit\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +000016STEXI
17@item -h
Stefan Weil6616b2a2010-02-05 23:52:05 +010018@findex -h
blueswir15824d652009-03-28 06:44:27 +000019Display help and exit
20ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +000021SRST
22``-h``
23 Display help and exit
24ERST
blueswir15824d652009-03-28 06:44:27 +000025
pbrook9bd7e6d2009-04-07 22:58:45 +000026DEF("version", 0, QEMU_OPTION_version,
Blue Swirlad960902010-03-29 19:23:52 +000027 "-version display version information and exit\n", QEMU_ARCH_ALL)
pbrook9bd7e6d2009-04-07 22:58:45 +000028STEXI
29@item -version
Stefan Weil6616b2a2010-02-05 23:52:05 +010030@findex -version
pbrook9bd7e6d2009-04-07 22:58:45 +000031Display version information and exit
32ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +000033SRST
34``-version``
35 Display version information and exit
36ERST
pbrook9bd7e6d2009-04-07 22:58:45 +000037
Jan Kiszka80f52a62011-07-23 12:39:46 +020038DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
39 "-machine [type=]name[,prop[=value][,...]]\n"
Peter Maydell585f6032012-10-04 16:22:01 +010040 " selects emulated machine ('-machine help' for list)\n"
Jan Kiszka80f52a62011-07-23 12:39:46 +020041 " property accel=accel1[:accel2[:...]] selects accelerator\n"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -080042 " supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)\n"
Don Slutzd1048be2014-11-21 11:18:52 -050043 " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
Luiz Capitulino8490fc72012-09-05 16:50:16 -030044 " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
Le Tana52a7fd2014-08-16 13:55:40 +080045 " mem-merge=on|off controls memory merge support (default: on)\n"
Tony Krowiak2eb1cd02015-03-12 13:53:51 +010046 " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
Alexander Graf9850c602015-02-23 13:56:42 +010047 " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
Xiao Guangrong87252e12015-12-02 15:20:58 +080048 " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
Greg Kurz902c0532016-02-18 12:32:25 +010049 " nvdimm=on|off controls NVDIMM support (default=off)\n"
Xiao Feng Ren274250c2017-05-17 02:48:03 +020050 " enforce-config-section=on|off enforce configuration section migration (default=off)\n"
Tao Xu244b3f42019-12-13 09:19:22 +080051 " memory-encryption=@var{} memory encryption object to use (default=none)\n"
52 " hmat=on|off controls ACPI HMAT support (default=off)\n",
Jan Kiszka80f52a62011-07-23 12:39:46 +020053 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +000054STEXI
Jan Kiszka80f52a62011-07-23 12:39:46 +020055@item -machine [type=]@var{name}[,prop=@var{value}[,...]]
56@findex -machine
Peter Maydell585f6032012-10-04 16:22:01 +010057Select the emulated machine by @var{name}. Use @code{-machine help} to list
Daniel P. Berrange8bfce832017-07-25 15:10:41 +010058available machines.
59
60For architectures which aim to support live migration compatibility
61across releases, each release will introduce a new versioned machine
62type. 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
65To allow live migration of guests from QEMU version 2.8.0, to QEMU
66version 2.9.0, the 2.9.0 version must support the ``pc-i440fx-2.8''
67and ``pc-q35-2.8'' machines too. To allow users live migrating VMs
68to skip multiple intermediate releases when upgrading, new releases
69of QEMU will support machine types from many previous versions.
70
71Supported machine properties are:
Jan Kiszka80f52a62011-07-23 12:39:46 +020072@table @option
73@item accel=@var{accels1}[:@var{accels2}[:...]]
74This is used to enable an accelerator. Depending on the target architecture,
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -080075kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If there is
Thomas Huthbde4d922017-05-04 07:24:41 +020076more than one accelerator specified, the next one is used if the previous one
77fails to initialize.
Don Slutzd1048be2014-11-21 11:18:52 -050078@item vmport=on|off|auto
79Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the
80value based on accel. For accel=xen the default is off otherwise the default
81is on.
Jason Baronddb97f12012-08-02 15:44:16 -040082@item dump-guest-core=on|off
83Include guest memory in a core dump. The default is on.
Luiz Capitulino8490fc72012-09-05 16:50:16 -030084@item mem-merge=on|off
85Enables or disables memory merge support. This feature, when supported by
86the host, de-duplicates identical memory pages among VMs instances
87(enabled by default).
Tony Krowiak2eb1cd02015-03-12 13:53:51 +010088@item aes-key-wrap=on|off
89Enables or disables AES key wrapping support on s390-ccw hosts. This feature
90controls whether AES wrapping keys will be created to allow
91execution of AES cryptographic functions. The default is on.
92@item dea-key-wrap=on|off
93Enables or disables DEA key wrapping support on s390-ccw hosts. This feature
94controls whether DEA wrapping keys will be created to allow
95execution of DEA cryptographic functions. The default is on.
Xiao Guangrong87252e12015-12-02 15:20:58 +080096@item nvdimm=on|off
97Enables or disables NVDIMM support. The default is off.
Peter Xu16f72442017-07-07 10:54:08 +080098@item enforce-config-section=on|off
99If @option{enforce-config-section} is set to @var{on}, force migration
100code to send configuration section even if the machine-type sets the
101@option{migration.send-configuration} property to @var{off}.
102NOTE: this parameter is deprecated. Please use @option{-global}
103@option{migration.send-configuration}=@var{on|off} instead.
Brijesh Singhdb588192018-03-08 06:48:38 -0600104@item memory-encryption=@var{}
105Memory encryption object to use. The default is none.
Tao Xu244b3f42019-12-13 09:19:22 +0800106@item hmat=on|off
107Enables or disables ACPI Heterogeneous Memory Attribute Table (HMAT) support.
108The default is off.
Jan Kiszka80f52a62011-07-23 12:39:46 +0200109@end table
blueswir15824d652009-03-28 06:44:27 +0000110ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000111SRST
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.
177ERST
blueswir15824d652009-03-28 06:44:27 +0000178
Jan Kiszka80f52a62011-07-23 12:39:46 +0200179HXCOMM Deprecated by -machine
180DEF("M", HAS_ARG, QEMU_OPTION_M, "", QEMU_ARCH_ALL)
181
blueswir15824d652009-03-28 06:44:27 +0000182DEF("cpu", HAS_ARG, QEMU_OPTION_cpu,
Peter Maydell585f6032012-10-04 16:22:01 +0100183 "-cpu cpu select CPU ('-cpu help' for list)\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +0000184STEXI
185@item -cpu @var{model}
Stefan Weil6616b2a2010-02-05 23:52:05 +0100186@findex -cpu
Peter Maydell585f6032012-10-04 16:22:01 +0100187Select CPU model (@code{-cpu help} for list and additional feature selection)
blueswir15824d652009-03-28 06:44:27 +0000188ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000189SRST
190``-cpu model``
191 Select CPU model (``-cpu help`` for list and additional feature
192 selection)
193ERST
blueswir15824d652009-03-28 06:44:27 +0000194
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000195DEF("accel", HAS_ARG, QEMU_OPTION_accel,
Paolo Bonzinife174132019-11-13 15:16:44 +0100196 "-accel [accel=]accelerator[,prop[=value][,...]]\n"
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800197 " select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)\n"
Paolo Bonzini46472d82019-11-13 10:56:53 +0100198 " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
Paolo Bonzini11bc4a12019-11-13 10:56:53 +0100199 " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
Paolo Bonzini23b08982019-11-13 10:56:53 +0100200 " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
Paolo Bonzinife174132019-11-13 15:16:44 +0100201 " tb-size=n (TCG translation block cache size)\n"
Eduardo Habkost0b3c5c82018-06-11 16:56:07 -0300202 " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL)
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000203STEXI
204@item -accel @var{name}[,prop=@var{value}[,...]]
205@findex -accel
206This is used to enable an accelerator. Depending on the target architecture,
Justin Terry (VM)d661d9a2018-01-22 13:07:46 -0800207kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used. If there is
Thomas Huthbde4d922017-05-04 07:24:41 +0200208more than one accelerator specified, the next one is used if the previous one
209fails to initialize.
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000210@table @option
Paolo Bonzini46472d82019-11-13 10:56:53 +0100211@item igd-passthru=on|off
212When Xen is in use, this option controls whether Intel integrated graphics
213devices can be passed through to the guest (default=off)
Paolo Bonzini11bc4a12019-11-13 10:56:53 +0100214@item kernel-irqchip=on|off|split
215Controls KVM in-kernel irqchip support. The default is full acceleration of the
216interrupt controllers. On x86, split irqchip reduces the kernel attack
217surface, at a performance cost for non-MSI interrupts. Disabling the in-kernel
218irqchip completely is not recommended except for debugging purposes.
Paolo Bonzini23b08982019-11-13 10:56:53 +0100219@item kvm-shadow-mem=size
220Defines the size of the KVM shadow MMU.
Paolo Bonzinife174132019-11-13 15:16:44 +0100221@item tb-size=@var{n}
222Controls the size (in MiB) of the TCG translation block cache.
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000223@item thread=single|multi
224Controls number of TCG threads. When the TCG is multi-threaded there will be one
225thread per vCPU therefor taking advantage of additional host cores. The default
226is to enable multi-threading where both the back-end and front-ends support it and
227no incompatible TCG features have been enabled (e.g. icount/replay).
228@end table
229ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000230SRST
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).
263ERST
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000264
blueswir15824d652009-03-28 06:44:27 +0000265DEF("smp", HAS_ARG, QEMU_OPTION_smp,
Like Xu1b458422019-06-20 13:45:25 +0800266 "-smp [cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,dies=dies][,sockets=sockets]\n"
Jes Sorensen6be68d72009-07-23 17:03:42 +0200267 " set the number of CPUs to 'n' [default=1]\n"
268 " maxcpus= maximum number of total cpus, including\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -0700269 " offline CPUs for hotplug, etc\n"
Like Xu1b458422019-06-20 13:45:25 +0800270 " cores= number of CPU cores on one socket (for PC, it's on one die)\n"
Andre Przywara58a04db2009-08-28 10:49:57 +0200271 " threads= number of threads on one CPU core\n"
Like Xu1b458422019-06-20 13:45:25 +0800272 " dies= number of CPU dies on one socket (for PC only)\n"
Blue Swirlad960902010-03-29 19:23:52 +0000273 " sockets= number of discrete sockets in the system\n",
274 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +0000275STEXI
Like Xu1b458422019-06-20 13:45:25 +0800276@item -smp [cpus=]@var{n}[,cores=@var{cores}][,threads=@var{threads}][,dies=dies][,sockets=@var{sockets}][,maxcpus=@var{maxcpus}]
Stefan Weil6616b2a2010-02-05 23:52:05 +0100277@findex -smp
blueswir15824d652009-03-28 06:44:27 +0000278Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
279CPUs are supported. On Sparc32 target, Linux limits the number of usable CPUs
280to 4.
Like Xu1b458422019-06-20 13:45:25 +0800281For the PC target, the number of @var{cores} per die, the number of @var{threads}
282per cores, the number of @var{dies} per packages and the total number of
283@var{sockets} can be specified. Missing values will be computed.
284If 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.
blueswir15824d652009-03-28 06:44:27 +0000286ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000287SRST
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.
297ERST
blueswir15824d652009-03-28 06:44:27 +0000298
aliguori268a3622009-04-21 22:30:27 +0000299DEF("numa", HAS_ARG, QEMU_OPTION_numa,
Tao Xu244b3f42019-12-13 09:19:22 +0800300 "-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"
Igor Mammedov2d19c652017-11-28 15:53:58 +0100302 "-numa dist,src=source,dst=destination,val=distance\n"
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800303 "-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]\n"
Liu Jingqic412a482019-12-13 09:19:24 +0800304 "-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",
Igor Mammedov2d19c652017-11-28 15:53:58 +0100306 QEMU_ARCH_ALL)
aliguori268a3622009-04-21 22:30:27 +0000307STEXI
Tao Xu244b3f42019-12-13 09:19:22 +0800308@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}]
He Chen0f203432017-04-27 10:35:58 +0800310@itemx -numa dist,src=@var{source},dst=@var{destination},val=@var{distance}
Igor Mammedov419fcde2017-05-10 13:30:01 +0200311@itemx -numa cpu,node-id=@var{node}[,socket-id=@var{x}][,core-id=@var{y}][,thread-id=@var{z}]
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800312@itemx -numa hmat-lb,initiator=@var{node},target=@var{node},hierarchy=@var{hierarchy},data-type=@var{tpye}[,latency=@var{lat}][,bandwidth=@var{bw}]
Liu Jingqic412a482019-12-13 09:19:24 +0800313@itemx -numa hmat-cache,node-id=@var{node},size=@var{size},level=@var{level}[,associativity=@var{str}][,policy=@var{str}][,line=@var{size}]
Stefan Weil6616b2a2010-02-05 23:52:05 +0100314@findex -numa
Eduardo Habkost4b9a5dd2017-01-23 16:06:32 -0200315Define a NUMA node and assign RAM and VCPUs to it.
He Chen0f203432017-04-27 10:35:58 +0800316Set the NUMA distance from a source node to a destination node.
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800317Set the ACPI Heterogeneous Memory Attributes for the given nodes.
Paolo Bonzini7febe362014-05-14 17:43:17 +0800318
Igor Mammedov419fcde2017-05-10 13:30:01 +0200319Legacy VCPU assignment uses @samp{cpus} option where
Eduardo Habkost4b9a5dd2017-01-23 16:06:32 -0200320@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
323set of VCPUs can be represented by providing multiple @samp{cpus}
324options. If @samp{cpus} is omitted on all nodes, VCPUs are automatically
325split between them.
326
327For example, the following option assigns VCPUs 0, 1, 2 and 5 to
328a NUMA node:
329@example
330-numa node,cpus=0-2,cpus=5
331@end example
332
Igor Mammedov419fcde2017-05-10 13:30:01 +0200333@samp{cpu} option is a new alternative to @samp{cpus} option
334which uses @samp{socket-id|core-id|thread-id} properties to assign
335CPU objects to a @var{node} using topology layout properties of CPU.
336The set of properties is machine specific, and depends on used
337machine 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
340will be assigned, it's required for @var{node} to be declared
341with @samp{node} option before it's used with @samp{cpu} option.
342
343For 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
Eduardo Habkost4b9a5dd2017-01-23 16:06:32 -0200351@samp{mem} assigns a given RAM amount to a node. @samp{memdev}
352assigns RAM from a given memory backend device to a node. If
353@samp{mem} and @samp{memdev} are omitted in all nodes, RAM is
354split equally between them.
355
356@samp{mem} and @samp{memdev} are mutually exclusive. Furthermore,
357if one node uses @samp{memdev}, all of them have to use it.
358
Tao Xu244b3f42019-12-13 09:19:22 +0800359@samp{initiator} is an additional option that points to an @var{initiator}
360NUMA node that has best performance (the lowest latency or largest bandwidth)
361to this NUMA @var{node}. Note that this option can be set only when
362the machine property 'hmat' is set to 'on'.
363
364Following example creates a machine with 2 NUMA nodes, node 0 has CPU.
365node 1 has only memory, and its initiator is node 0. Note that because
366node 0 has CPU, by default the initiator of node 0 is itself and must be
367itself.
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
He Chen0f203432017-04-27 10:35:58 +0800380@var{source} and @var{destination} are NUMA node IDs.
381@var{distance} is the NUMA distance from @var{source} to @var{destination}.
382The distance from a node to itself is always 10. If any pair of nodes is
383given a distance, then all pairs must be given distances. Although, when
384distances are only given in one direction for each pair of nodes, then
385the distances in the opposite directions are assumed to be the same. If,
386however, an asymmetrical pair of distances is given for even one node
387pair, then all node pairs must be provided distance values for both
388directions, even when they are symmetrical. When a node is unreachable
389from another node, set the pair's distance to 255.
390
Eduardo Habkost4b9a5dd2017-01-23 16:06:32 -0200391Note that the -@option{numa} option doesn't allocate any of the
392specified resources, it just assigns existing resources to NUMA
393nodes. This means that one still has to use the @option{-m},
394@option{-smp} options to allocate RAM and VCPUs respectively.
395
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800396Use @samp{hmat-lb} to set System Locality Latency and Bandwidth Information
397between initiator and target NUMA nodes in ACPI Heterogeneous Attribute Memory Table (HMAT).
398Initiator NUMA node can create memory requests, usually it has one or more processors.
399Target NUMA node contains addressable memory.
400
401In @samp{hmat-lb} option, @var{node} are NUMA node IDs. @var{hierarchy} is the memory
402hierarchy of the target NUMA node: if @var{hierarchy} is 'memory', the structure
403represents the memory performance; if @var{hierarchy} is 'first-level|second-level|third-level',
404this 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:
406if 'hierarchy' is 'memory', 'data-type' is 'access|read|write' latency or 'access|read|write'
407bandwidth 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
409target memory side cache.
410
411@var{lat} is latency value in nanoseconds. @var{bw} is bandwidth value,
412the possible value and units are NUM[M|G|T], mean that the bandwidth value are
413NUM byte per second (or MB/s, GB/s or TB/s depending on used suffix).
414Note that if latency or bandwidth value is 0, means the corresponding latency or
415bandwidth information is not provided.
416
Liu Jingqic412a482019-12-13 09:19:24 +0800417In @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
419level described in this structure, note that the cache level 0 should not be used
420with @samp{hmat-cache} option. @var{associativity} is the cache associativity,
421the 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
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800424For example, the following options describe 2 NUMA nodes. Node 0 has 2 cpus and
425a ram, node 1 has only a ram. The processors in node 0 access memory in node
4260 with access-latency 5 nanoseconds, access-bandwidth is 200 MB/s;
427The processors in NUMA node 0 access memory in NUMA node 1 with access-latency 10
428nanoseconds, access-bandwidth is 100 MB/s.
Liu Jingqic412a482019-12-13 09:19:24 +0800429And for memory side cache information, NUMA node 0 and 1 both have 1 level memory
430cache, size is 10KB, policy is write-back, the cache Line size is 8 bytes:
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800431@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 \
Liu Jingqic412a482019-12-13 09:19:24 +0800444-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
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800447@end example
448
aliguori268a3622009-04-21 22:30:27 +0000449ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000450SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000451``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
452 \
453``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
454 \
455``-numa dist,src=source,dst=destination,val=distance``
456 \
457``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]``
458 \
459``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=tpye[,latency=lat][,bandwidth=bw]``
460 \
461``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000462 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA
463 distance from a source node to a destination node. Set the ACPI
464 Heterogeneous Memory Attributes for the given nodes.
465
466 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and
467 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a
468 contiguous range of CPU indexes (or a single VCPU if lastcpu is
469 omitted). A non-contiguous set of VCPUs can be represented by
470 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is
471 omitted on all nodes, VCPUs are automatically split between them.
472
473 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a
474 NUMA node:
475
476 ::
477
478 -numa node,cpus=0-2,cpus=5
479
480 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option
481 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to
482 assign CPU objects to a node using topology layout properties of
483 CPU. The set of properties is machine specific, and depends on used
484 machine type/'\ ``smp``\ ' options. It could be queried with
485 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ '
486 property specifies node to which CPU object will be assigned, it's
487 required for node to be declared with '\ ``node``\ ' option before
488 it's used with '\ ``cpu``\ ' option.
489
490 For example:
491
492 ::
493
494 -M pc \
495 -smp 1,sockets=2,maxcpus=2 \
496 -numa node,nodeid=0 -numa node,nodeid=1 \
497 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
498
499 '\ ``mem``\ ' assigns a given RAM amount to a node. '\ ``memdev``\ '
500 assigns RAM from a given memory backend device to a node. If
501 '\ ``mem``\ ' and '\ ``memdev``\ ' are omitted in all nodes, RAM is
502 split equally between them.
503
504 '\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive.
505 Furthermore, if one node uses '\ ``memdev``\ ', all of them have to
506 use it.
507
508 '\ ``initiator``\ ' is an additional option that points to an
509 initiator NUMA node that has best performance (the lowest latency or
510 largest bandwidth) to this NUMA node. Note that this option can be
511 set only when the machine property 'hmat' is set to 'on'.
512
513 Following example creates a machine with 2 NUMA nodes, node 0 has
514 CPU. node 1 has only memory, and its initiator is node 0. Note that
515 because node 0 has CPU, by default the initiator of node 0 is itself
516 and must be itself.
517
518 ::
519
520 -machine hmat=on \
521 -m 2G,slots=2,maxmem=4G \
522 -object memory-backend-ram,size=1G,id=m0 \
523 -object memory-backend-ram,size=1G,id=m1 \
524 -numa node,nodeid=0,memdev=m0 \
525 -numa node,nodeid=1,memdev=m1,initiator=0 \
526 -smp 2,sockets=2,maxcpus=2 \
527 -numa cpu,node-id=0,socket-id=0 \
528 -numa cpu,node-id=0,socket-id=1
529
530 source and destination are NUMA node IDs. distance is the NUMA
531 distance from source to destination. The distance from a node to
532 itself is always 10. If any pair of nodes is given a distance, then
533 all pairs must be given distances. Although, when distances are only
534 given in one direction for each pair of nodes, then the distances in
535 the opposite directions are assumed to be the same. If, however, an
536 asymmetrical pair of distances is given for even one node pair, then
537 all node pairs must be provided distance values for both directions,
538 even when they are symmetrical. When a node is unreachable from
539 another node, set the pair's distance to 255.
540
541 Note that the -``numa`` option doesn't allocate any of the specified
542 resources, it just assigns existing resources to NUMA nodes. This
543 means that one still has to use the ``-m``, ``-smp`` options to
544 allocate RAM and VCPUs respectively.
545
546 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth
547 Information between initiator and target NUMA nodes in ACPI
548 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can
549 create memory requests, usually it has one or more processors.
550 Target NUMA node contains addressable memory.
551
552 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is
553 the memory hierarchy of the target NUMA node: if hierarchy is
554 'memory', the structure represents the memory performance; if
555 hierarchy is 'first-level\|second-level\|third-level', this
556 structure represents aggregated performance of memory side caches
557 for each domain. type of 'data-type' is type of data represented by
558 this structure instance: if 'hierarchy' is 'memory', 'data-type' is
559 'access\|read\|write' latency or 'access\|read\|write' bandwidth of
560 the target memory; if 'hierarchy' is
561 'first-level\|second-level\|third-level', 'data-type' is
562 'access\|read\|write' hit latency or 'access\|read\|write' hit
563 bandwidth of the target memory side cache.
564
565 lat is latency value in nanoseconds. bw is bandwidth value, the
566 possible value and units are NUM[M\|G\|T], mean that the bandwidth
567 value are NUM byte per second (or MB/s, GB/s or TB/s depending on
568 used suffix). Note that if latency or bandwidth value is 0, means
569 the corresponding latency or bandwidth information is not provided.
570
571 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory
572 belongs. size is the size of memory side cache in bytes. level is
573 the cache level described in this structure, note that the cache
574 level 0 should not be used with '\ ``hmat-cache``\ ' option.
575 associativity is the cache associativity, the possible value is
576 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy
577 is the write policy. line is the cache Line size in bytes.
578
579 For example, the following options describe 2 NUMA nodes. Node 0 has
580 2 cpus and a ram, node 1 has only a ram. The processors in node 0
581 access memory in node 0 with access-latency 5 nanoseconds,
582 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access
583 memory in NUMA node 1 with access-latency 10 nanoseconds,
584 access-bandwidth is 100 MB/s. And for memory side cache information,
585 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB,
586 policy is write-back, the cache Line size is 8 bytes:
587
588 ::
589
590 -machine hmat=on \
591 -m 2G \
592 -object memory-backend-ram,size=1G,id=m0 \
593 -object memory-backend-ram,size=1G,id=m1 \
594 -smp 2 \
595 -numa node,nodeid=0,memdev=m0 \
596 -numa node,nodeid=1,memdev=m1,initiator=0 \
597 -numa cpu,node-id=0,socket-id=0 \
598 -numa cpu,node-id=0,socket-id=1 \
599 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
600 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
601 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
602 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
603 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
604 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
605ERST
aliguori268a3622009-04-21 22:30:27 +0000606
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100607DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd,
608 "-add-fd fd=fd,set=set[,opaque=opaque]\n"
609 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL)
610STEXI
611@item -add-fd fd=@var{fd},set=@var{set}[,opaque=@var{opaque}]
612@findex -add-fd
613
614Add a file descriptor to an fd set. Valid options are:
615
616@table @option
617@item fd=@var{fd}
618This option defines the file descriptor of which a duplicate is added to fd set.
619The file descriptor cannot be stdin, stdout, or stderr.
620@item set=@var{set}
621This option defines the ID of the fd set to add the file descriptor to.
622@item opaque=@var{opaque}
623This option defines a free-form string that can be used to describe @var{fd}.
624@end table
625
626You can open an image using pre-opened file descriptors from an fd set:
627@example
Thomas Huth664785a2019-07-30 17:08:26 +0200628@value{qemu_system} \
629 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
630 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
631 -drive file=/dev/fdset/2,index=0,media=disk
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100632@end example
633ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000634SRST
635``-add-fd fd=fd,set=set[,opaque=opaque]``
636 Add a file descriptor to an fd set. Valid options are:
637
638 ``fd=fd``
639 This option defines the file descriptor of which a duplicate is
640 added to fd set. The file descriptor cannot be stdin, stdout, or
641 stderr.
642
643 ``set=set``
644 This option defines the ID of the fd set to add the file
645 descriptor to.
646
647 ``opaque=opaque``
648 This option defines a free-form string that can be used to
649 describe fd.
650
651 You can open an image using pre-opened file descriptors from an fd
652 set:
653
654 .. parsed-literal::
655
656 |qemu_system| \
657 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
658 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
659 -drive file=/dev/fdset/2,index=0,media=disk
660ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100661
662DEF("set", HAS_ARG, QEMU_OPTION_set,
663 "-set group.id.arg=value\n"
664 " set <arg> parameter for item <id> of type <group>\n"
665 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL)
666STEXI
667@item -set @var{group}.@var{id}.@var{arg}=@var{value}
668@findex -set
Michael Tokareve1f3b972016-10-16 17:21:37 +0300669Set parameter @var{arg} for item @var{id} of type @var{group}
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100670ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000671SRST
672``-set group.id.arg=value``
673 Set parameter arg for item id of type group
674ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100675
676DEF("global", HAS_ARG, QEMU_OPTION_global,
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200677 "-global driver.property=value\n"
678 "-global driver=driver,property=property,value=value\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100679 " set a global default for a driver property\n",
680 QEMU_ARCH_ALL)
681STEXI
682@item -global @var{driver}.@var{prop}=@var{value}
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200683@itemx -global driver=@var{driver},property=@var{property},value=@var{value}
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100684@findex -global
685Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.:
686
687@example
Thomas Huth664785a2019-07-30 17:08:26 +0200688@value{qemu_system_x86} -global ide-hd.physical_block_size=4096 disk-image.img
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100689@end example
690
Michael Tokareva295d242017-09-23 19:31:59 +0300691In particular, you can use this to set driver properties for devices which are
692created automatically by the machine model. To create a device which is not
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100693created automatically and set properties on it, use -@option{device}.
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200694
Markus Armbrusterae08fd52015-06-15 14:35:58 +0200695-global @var{driver}.@var{prop}=@var{value} is shorthand for -global
696driver=@var{driver},property=@var{prop},value=@var{value}. The
697longhand syntax works even when @var{driver} contains a dot.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100698ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000699SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000700``-global driver.prop=value``
701 \
702``-global driver=driver,property=property,value=value``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000703 Set default value of driver's property prop to value, e.g.:
704
705 .. parsed-literal::
706
707 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img
708
709 In particular, you can use this to set driver properties for devices
710 which are created automatically by the machine model. To create a
711 device which is not created automatically and set properties on it,
712 use -``device``.
713
714 -global driver.prop=value is shorthand for -global
715 driver=driver,property=prop,value=value. The longhand syntax works
716 even when driver contains a dot.
717ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100718
719DEF("boot", HAS_ARG, QEMU_OPTION_boot,
720 "-boot [order=drives][,once=drives][,menu=on|off]\n"
Amos Kongc8a6ae82013-03-19 14:23:27 +0800721 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100722 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n"
723 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n"
724 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n"
725 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n",
726 QEMU_ARCH_ALL)
727STEXI
Amos Kongc8a6ae82013-03-19 14:23:27 +0800728@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]
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100729@findex -boot
730Specify boot order @var{drives} as a string of drive letters. Valid
Gongleid274e072015-07-03 17:50:57 +0800731drive letters depend on the target architecture. The x86 PC uses: a, b
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100732(floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot
733from network adapter 1-4), hard disk boot is the default. To apply a
734particular boot order only on the first startup, specify it via
Thomas Huthc0d9f7d2017-02-28 18:40:01 +0100735@option{once}. Note that the @option{order} or @option{once} parameter
736should not be used together with the @option{bootindex} property of
737devices, since the firmware implementations normally do not support both
738at the same time.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100739
740Interactive boot menus/prompts can be enabled via @option{menu=on} as far
741as firmware/BIOS supports them. The default is non-interactive boot.
742
743A splash picture could be passed to bios, enabling user to show it as logo,
744when option splash=@var{sp_name} is given and menu=on, If firmware/BIOS
745supports them. Currently Seabios for X86 system support it.
746limitation: The splash file could be a jpeg file or a BMP file in 24 BPP
747format(true color). The resolution should be supported by the SVGA mode, so
748the recommended is 320x240, 640x480, 800x640.
749
750A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms
Han Han8937a392019-12-05 10:48:21 +0800751when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not
752reboot, qemu passes '-1' to bios by default. Currently Seabios for X86
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100753system support it.
754
Amos Kongc8a6ae82013-03-19 14:23:27 +0800755Do strict boot via @option{strict=on} as far as firmware/BIOS
756supports it. This only effects when boot priority is changed by
757bootindex options. The default is non-strict boot.
758
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100759@example
760# try to boot from network first, then from hard disk
Thomas Huth664785a2019-07-30 17:08:26 +0200761@value{qemu_system_x86} -boot order=nc
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100762# boot from CD-ROM first, switch back to default order after reboot
Thomas Huth664785a2019-07-30 17:08:26 +0200763@value{qemu_system_x86} -boot once=d
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100764# boot with a splash picture for 5 seconds.
Thomas Huth664785a2019-07-30 17:08:26 +0200765@value{qemu_system_x86} -boot menu=on,splash=/root/boot.bmp,splash-time=5000
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100766@end example
767
768Note: The legacy format '-boot @var{drives}' is still supported but its
769use is discouraged as it may be removed from future versions.
770ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000771SRST
772``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]``
773 Specify boot order drives as a string of drive letters. Valid drive
774 letters depend on the target architecture. The x86 PC uses: a, b
775 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p
776 (Etherboot from network adapter 1-4), hard disk boot is the default.
777 To apply a particular boot order only on the first startup, specify
778 it via ``once``. Note that the ``order`` or ``once`` parameter
779 should not be used together with the ``bootindex`` property of
780 devices, since the firmware implementations normally do not support
781 both at the same time.
782
783 Interactive boot menus/prompts can be enabled via ``menu=on`` as far
784 as firmware/BIOS supports them. The default is non-interactive boot.
785
786 A splash picture could be passed to bios, enabling user to show it
787 as logo, when option splash=sp\_name is given and menu=on, If
788 firmware/BIOS supports them. Currently Seabios for X86 system
789 support it. limitation: The splash file could be a jpeg file or a
790 BMP file in 24 BPP format(true color). The resolution should be
791 supported by the SVGA mode, so the recommended is 320x240, 640x480,
792 800x640.
793
794 A timeout could be passed to bios, guest will pause for rb\_timeout
795 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will
796 not reboot, qemu passes '-1' to bios by default. Currently Seabios
797 for X86 system support it.
798
799 Do strict boot via ``strict=on`` as far as firmware/BIOS supports
800 it. This only effects when boot priority is changed by bootindex
801 options. The default is non-strict boot.
802
Peter Maydell09ce5f22020-02-28 15:36:13 +0000803 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000804
805 # try to boot from network first, then from hard disk
806 |qemu_system_x86| -boot order=nc
807 # boot from CD-ROM first, switch back to default order after reboot
808 |qemu_system_x86| -boot once=d
809 # boot with a splash picture for 5 seconds.
810 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000
811
812 Note: The legacy format '-boot drives' is still supported but its
813 use is discouraged as it may be removed from future versions.
814ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100815
816DEF("m", HAS_ARG, QEMU_OPTION_m,
Michael Tokarev89f3ea22016-11-10 17:51:32 +0300817 "-m [size=]megs[,slots=n,maxmem=size]\n"
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100818 " configure guest RAM\n"
Alexander Graf0daba1f2015-06-05 11:05:03 +0200819 " size: initial amount of guest memory\n"
Igor Mammedovc270fb92014-06-02 15:25:02 +0200820 " slots: number of hotplug slots (default: none)\n"
Matthew Rosatob6fe0122014-08-28 11:25:33 -0400821 " maxmem: maximum amount of guest memory (default: none)\n"
822 "NOTE: Some architectures might enforce a specific granularity\n",
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100823 QEMU_ARCH_ALL)
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100824STEXI
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500825@item -m [size=]@var{megs}[,slots=n,maxmem=size]
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100826@findex -m
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500827Sets guest startup RAM size to @var{megs} megabytes. Default is 128 MiB.
828Optionally, a suffix of ``M'' or ``G'' can be used to signify a value in
829megabytes or gigabytes respectively. Optional pair @var{slots}, @var{maxmem}
830could be used to set amount of hotpluggable memory slots and maximum amount of
831memory. Note that @var{maxmem} must be aligned to the page size.
832
833For example, the following command-line sets the guest startup RAM size to
8341GB, creates 3 slots to hotplug additional memory and sets the maximum
835memory the guest can reach to 4GB:
836
837@example
Thomas Huth664785a2019-07-30 17:08:26 +0200838@value{qemu_system} -m 1G,slots=3,maxmem=4G
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500839@end example
840
841If @var{slots} and @var{maxmem} are not specified, memory hotplug won't
842be enabled and the guest startup RAM will never increase.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100843ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000844SRST
845``-m [size=]megs[,slots=n,maxmem=size]``
846 Sets guest startup RAM size to megs megabytes. Default is 128 MiB.
847 Optionally, a suffix of "M" or "G" can be used to signify a value in
848 megabytes or gigabytes respectively. Optional pair slots, maxmem
849 could be used to set amount of hotpluggable memory slots and maximum
850 amount of memory. Note that maxmem must be aligned to the page size.
851
852 For example, the following command-line sets the guest startup RAM
853 size to 1GB, creates 3 slots to hotplug additional memory and sets
854 the maximum memory the guest can reach to 4GB:
855
856 .. parsed-literal::
857
858 |qemu_system| -m 1G,slots=3,maxmem=4G
859
860 If slots and maxmem are not specified, memory hotplug won't be
861 enabled and the guest startup RAM will never increase.
862ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100863
864DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
865 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
866STEXI
867@item -mem-path @var{path}
868@findex -mem-path
869Allocate guest RAM from a temporarily created file in @var{path}.
870ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000871SRST
872``-mem-path path``
873 Allocate guest RAM from a temporarily created file in path.
874ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100875
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100876DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
877 "-mem-prealloc preallocate guest memory (use with -mem-path)\n",
878 QEMU_ARCH_ALL)
879STEXI
880@item -mem-prealloc
881@findex -mem-prealloc
882Preallocate memory when using -mem-path.
883ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000884SRST
885``-mem-prealloc``
886 Preallocate memory when using -mem-path.
887ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100888
889DEF("k", HAS_ARG, QEMU_OPTION_k,
890 "-k language use keyboard layout (for example 'fr' for French)\n",
891 QEMU_ARCH_ALL)
892STEXI
893@item -k @var{language}
894@findex -k
895Use keyboard layout @var{language} (for example @code{fr} for
896French). This option is only needed where it is not easy to get raw PC
Samuel Thibault32945472016-06-22 17:48:31 +0200897keycodes (e.g. on Macs, with some X11 servers or with a VNC or curses
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100898display). You don't normally need to use it on PC/Linux or PC/Windows
899hosts.
900
901The available layouts are:
902@example
903ar de-ch es fo fr-ca hu ja mk no pt-br sv
904da en-gb et fr fr-ch is lt nl pl ru th
905de en-us fi fr-be hr it lv nl-be pt sl tr
906@end example
907
908The default is @code{en-us}.
909ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000910SRST
911``-k language``
912 Use keyboard layout language (for example ``fr`` for French). This
913 option is only needed where it is not easy to get raw PC keycodes
914 (e.g. on Macs, with some X11 servers or with a VNC or curses
915 display). You don't normally need to use it on PC/Linux or
916 PC/Windows hosts.
917
918 The available layouts are:
919
920 ::
921
922 ar de-ch es fo fr-ca hu ja mk no pt-br sv
923 da en-gb et fr fr-ch is lt nl pl ru th
924 de en-us fi fr-be hr it lv nl-be pt sl tr
925
926 The default is ``en-us``.
927ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100928
929
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100930HXCOMM Deprecated by -audiodev
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100931DEF("audio-help", 0, QEMU_OPTION_audio_help,
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100932 "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100933 QEMU_ARCH_ALL)
934STEXI
935@item -audio-help
936@findex -audio-help
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100937Will show the -audiodev equivalent of the currently specified
938(deprecated) environment variables.
939ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000940SRST
941``-audio-help``
942 Will show the -audiodev equivalent of the currently specified
943 (deprecated) environment variables.
944ERST
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100945
946DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
947 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
948 " specifies the audio backend to use\n"
949 " id= identifier of the backend\n"
950 " timer-period= timer period in microseconds\n"
Kővágó, Zoltán8efac072019-10-13 21:57:58 +0200951 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100952 " in|out.fixed-settings= use fixed settings for host audio\n"
953 " in|out.frequency= frequency to use with fixed settings\n"
954 " in|out.channels= number of channels to use with fixed settings\n"
955 " in|out.format= sample format to use with fixed settings\n"
956 " valid values: s8, s16, s32, u8, u16, u32\n"
957 " in|out.voices= number of voices to use\n"
Stefan Hajnoczi86247252019-09-18 10:53:33 +0100958 " in|out.buffer-length= length of buffer in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100959 "-audiodev none,id=id,[,prop[=value][,...]]\n"
960 " dummy driver that discards all output\n"
961#ifdef CONFIG_AUDIO_ALSA
962 "-audiodev alsa,id=id[,prop[=value][,...]]\n"
963 " in|out.dev= name of the audio device to use\n"
Stefan Hajnoczidfc54342019-09-18 10:53:35 +0100964 " in|out.period-length= length of period in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100965 " in|out.try-poll= attempt to use poll mode\n"
966 " threshold= threshold (in microseconds) when playback starts\n"
967#endif
968#ifdef CONFIG_AUDIO_COREAUDIO
969 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
970 " in|out.buffer-count= number of buffers\n"
971#endif
972#ifdef CONFIG_AUDIO_DSOUND
973 "-audiodev dsound,id=id[,prop[=value][,...]]\n"
974 " latency= add extra latency to playback in microseconds\n"
975#endif
976#ifdef CONFIG_AUDIO_OSS
977 "-audiodev oss,id=id[,prop[=value][,...]]\n"
978 " in|out.dev= path of the audio device to use\n"
979 " in|out.buffer-count= number of buffers\n"
980 " in|out.try-poll= attempt to use poll mode\n"
981 " try-mmap= try using memory mapped access\n"
982 " exclusive= open device in exclusive mode\n"
983 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
984#endif
985#ifdef CONFIG_AUDIO_PA
986 "-audiodev pa,id=id[,prop[=value][,...]]\n"
987 " server= PulseAudio server address\n"
988 " in|out.name= source/sink device name\n"
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +0100989 " in|out.latency= desired latency in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100990#endif
991#ifdef CONFIG_AUDIO_SDL
992 "-audiodev sdl,id=id[,prop[=value][,...]]\n"
993#endif
994#ifdef CONFIG_SPICE
995 "-audiodev spice,id=id[,prop[=value][,...]]\n"
996#endif
997 "-audiodev wav,id=id[,prop[=value][,...]]\n"
998 " path= path of wav file to record\n",
999 QEMU_ARCH_ALL)
1000STEXI
1001@item -audiodev [driver=]@var{driver},id=@var{id}[,@var{prop}[=@var{value}][,...]]
1002@findex -audiodev
1003Adds a new audio backend @var{driver} identified by @var{id}. There are
1004global and driver specific properties. Some values can be set
1005differently for input and output, they're marked with @code{in|out.}.
1006You can set the input's property with @code{in.@var{prop}} and the
1007output's property with @code{out.@var{prop}}. For example:
1008@example
1009-audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
1010-audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
1011@end example
1012
Kővágó, Zoltán8efac072019-10-13 21:57:58 +02001013NOTE: parameter validation is known to be incomplete, in many cases
1014specifying an invalid option causes QEMU to print an error message and
1015continue emulation without sound.
1016
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001017Valid global options are:
1018
1019@table @option
1020@item id=@var{identifier}
1021Identifies the audio backend.
1022
1023@item timer-period=@var{period}
1024Sets the timer @var{period} used by the audio subsystem in microseconds.
1025Default is 10000 (10 ms).
1026
Kővágó, Zoltán8efac072019-10-13 21:57:58 +02001027@item in|out.mixing-engine=on|off
1028Use QEMU's mixing engine to mix all streams inside QEMU and convert
1029audio formats when not supported by the backend. When off,
1030@var{fixed-settings} must be off too. Note that disabling this option
1031means that the selected backend must support multiple streams and the
1032audio formats used by the virtual cards, otherwise you'll get no sound.
1033It's not recommended to disable this option unless you want to use 5.1
1034or 7.1 audio, as mixing engine only supports mono and stereo audio.
1035Default is on.
1036
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001037@item in|out.fixed-settings=on|off
1038Use fixed settings for host audio. When off, it will change based on
1039how the guest opens the sound card. In this case you must not specify
1040@var{frequency}, @var{channels} or @var{format}. Default is on.
1041
1042@item in|out.frequency=@var{frequency}
1043Specify the @var{frequency} to use when using @var{fixed-settings}.
1044Default is 44100Hz.
1045
1046@item in|out.channels=@var{channels}
1047Specify the number of @var{channels} to use when using
1048@var{fixed-settings}. Default is 2 (stereo).
1049
1050@item in|out.format=@var{format}
1051Specify the sample @var{format} to use when using @var{fixed-settings}.
1052Valid values are: @code{s8}, @code{s16}, @code{s32}, @code{u8},
1053@code{u16}, @code{u32}. Default is @code{s16}.
1054
1055@item in|out.voices=@var{voices}
1056Specify the number of @var{voices} to use. Default is 1.
1057
Stefan Hajnoczi86247252019-09-18 10:53:33 +01001058@item in|out.buffer-length=@var{usecs}
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001059Sets the size of the buffer in microseconds.
1060
1061@end table
1062
1063@item -audiodev none,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1064Creates a dummy backend that discards all outputs. This backend has no
1065backend specific properties.
1066
1067@item -audiodev alsa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1068Creates backend using the ALSA. This backend is only available on
1069Linux.
1070
1071ALSA specific options are:
1072
1073@table @option
1074
1075@item in|out.dev=@var{device}
1076Specify the ALSA @var{device} to use for input and/or output. Default
1077is @code{default}.
1078
Stefan Hajnoczidfc54342019-09-18 10:53:35 +01001079@item in|out.period-length=@var{usecs}
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001080Sets the period length in microseconds.
1081
1082@item in|out.try-poll=on|off
1083Attempt to use poll mode with the device. Default is on.
1084
1085@item threshold=@var{threshold}
1086Threshold (in microseconds) when playback starts. Default is 0.
1087
1088@end table
1089
1090@item -audiodev coreaudio,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1091Creates a backend using Apple's Core Audio. This backend is only
1092available on Mac OS and only supports playback.
1093
1094Core Audio specific options are:
1095
1096@table @option
1097
1098@item in|out.buffer-count=@var{count}
1099Sets the @var{count} of the buffers.
1100
1101@end table
1102
1103@item -audiodev dsound,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1104Creates a backend using Microsoft's DirectSound. This backend is only
1105available on Windows and only supports playback.
1106
1107DirectSound specific options are:
1108
1109@table @option
1110
1111@item latency=@var{usecs}
1112Add extra @var{usecs} microseconds latency to playback. Default is
111310000 (10 ms).
1114
1115@end table
1116
1117@item -audiodev oss,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1118Creates a backend using OSS. This backend is available on most
1119Unix-like systems.
1120
1121OSS specific options are:
1122
1123@table @option
1124
1125@item in|out.dev=@var{device}
1126Specify the file name of the OSS @var{device} to use. Default is
1127@code{/dev/dsp}.
1128
1129@item in|out.buffer-count=@var{count}
1130Sets the @var{count} of the buffers.
1131
1132@item in|out.try-poll=on|of
1133Attempt to use poll mode with the device. Default is on.
1134
1135@item try-mmap=on|off
1136Try using memory mapped device access. Default is off.
1137
1138@item exclusive=on|off
1139Open the device in exclusive mode (vmix won't work in this case).
1140Default is off.
1141
1142@item dsp-policy=@var{policy}
1143Sets the timing policy (between 0 and 10, where smaller number means
1144smaller latency but higher CPU usage). Use -1 to use buffer sizes
1145specified by @code{buffer} and @code{buffer-count}. This option is
1146ignored if you do not have OSS 4. Default is 5.
1147
1148@end table
1149
1150@item -audiodev pa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1151Creates a backend using PulseAudio. This backend is available on most
1152systems.
1153
1154PulseAudio specific options are:
1155
1156@table @option
1157
1158@item server=@var{server}
1159Sets the PulseAudio @var{server} to connect to.
1160
1161@item in|out.name=@var{sink}
1162Use the specified source/sink for recording/playback.
1163
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +01001164@item in|out.latency=@var{usecs}
1165Desired latency in microseconds. The PulseAudio server will try to honor this
1166value but actual latencies may be lower or higher.
1167
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001168@end table
1169
1170@item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1171Creates a backend using SDL. This backend is available on most systems,
1172but you should use your platform's native backend if possible. This
1173backend has no backend specific properties.
1174
1175@item -audiodev spice,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1176Creates a backend that sends audio through SPICE. This backend requires
1177@code{-spice} and automatically selected in that case, so usually you
1178can ignore this option. This backend has no backend specific
1179properties.
1180
1181@item -audiodev wav,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1182Creates a backend that writes audio to a WAV file.
1183
1184Backend specific options are:
1185
1186@table @option
1187
1188@item path=@var{path}
1189Write recorded audio into the specified file. Default is
1190@code{qemu.wav}.
1191
1192@end table
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001193ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001194SRST
1195``-audiodev [driver=]driver,id=id[,prop[=value][,...]]``
1196 Adds a new audio backend driver identified by id. There are global
1197 and driver specific properties. Some values can be set differently
1198 for input and output, they're marked with ``in|out.``. You can set
1199 the input's property with ``in.prop`` and the output's property with
1200 ``out.prop``. For example:
1201
1202 ::
1203
1204 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
1205 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
1206
1207 NOTE: parameter validation is known to be incomplete, in many cases
1208 specifying an invalid option causes QEMU to print an error message
1209 and continue emulation without sound.
1210
1211 Valid global options are:
1212
1213 ``id=identifier``
1214 Identifies the audio backend.
1215
1216 ``timer-period=period``
1217 Sets the timer period used by the audio subsystem in
1218 microseconds. Default is 10000 (10 ms).
1219
1220 ``in|out.mixing-engine=on|off``
1221 Use QEMU's mixing engine to mix all streams inside QEMU and
1222 convert audio formats when not supported by the backend. When
1223 off, fixed-settings must be off too. Note that disabling this
1224 option means that the selected backend must support multiple
1225 streams and the audio formats used by the virtual cards,
1226 otherwise you'll get no sound. It's not recommended to disable
1227 this option unless you want to use 5.1 or 7.1 audio, as mixing
1228 engine only supports mono and stereo audio. Default is on.
1229
1230 ``in|out.fixed-settings=on|off``
1231 Use fixed settings for host audio. When off, it will change
1232 based on how the guest opens the sound card. In this case you
1233 must not specify frequency, channels or format. Default is on.
1234
1235 ``in|out.frequency=frequency``
1236 Specify the frequency to use when using fixed-settings. Default
1237 is 44100Hz.
1238
1239 ``in|out.channels=channels``
1240 Specify the number of channels to use when using fixed-settings.
1241 Default is 2 (stereo).
1242
1243 ``in|out.format=format``
1244 Specify the sample format to use when using fixed-settings.
1245 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``,
1246 ``u32``. Default is ``s16``.
1247
1248 ``in|out.voices=voices``
1249 Specify the number of voices to use. Default is 1.
1250
1251 ``in|out.buffer-length=usecs``
1252 Sets the size of the buffer in microseconds.
1253
1254``-audiodev none,id=id[,prop[=value][,...]]``
1255 Creates a dummy backend that discards all outputs. This backend has
1256 no backend specific properties.
1257
1258``-audiodev alsa,id=id[,prop[=value][,...]]``
1259 Creates backend using the ALSA. This backend is only available on
1260 Linux.
1261
1262 ALSA specific options are:
1263
1264 ``in|out.dev=device``
1265 Specify the ALSA device to use for input and/or output. Default
1266 is ``default``.
1267
1268 ``in|out.period-length=usecs``
1269 Sets the period length in microseconds.
1270
1271 ``in|out.try-poll=on|off``
1272 Attempt to use poll mode with the device. Default is on.
1273
1274 ``threshold=threshold``
1275 Threshold (in microseconds) when playback starts. Default is 0.
1276
1277``-audiodev coreaudio,id=id[,prop[=value][,...]]``
1278 Creates a backend using Apple's Core Audio. This backend is only
1279 available on Mac OS and only supports playback.
1280
1281 Core Audio specific options are:
1282
1283 ``in|out.buffer-count=count``
1284 Sets the count of the buffers.
1285
1286``-audiodev dsound,id=id[,prop[=value][,...]]``
1287 Creates a backend using Microsoft's DirectSound. This backend is
1288 only available on Windows and only supports playback.
1289
1290 DirectSound specific options are:
1291
1292 ``latency=usecs``
1293 Add extra usecs microseconds latency to playback. Default is
1294 10000 (10 ms).
1295
1296``-audiodev oss,id=id[,prop[=value][,...]]``
1297 Creates a backend using OSS. This backend is available on most
1298 Unix-like systems.
1299
1300 OSS specific options are:
1301
1302 ``in|out.dev=device``
1303 Specify the file name of the OSS device to use. Default is
1304 ``/dev/dsp``.
1305
1306 ``in|out.buffer-count=count``
1307 Sets the count of the buffers.
1308
1309 ``in|out.try-poll=on|of``
1310 Attempt to use poll mode with the device. Default is on.
1311
1312 ``try-mmap=on|off``
1313 Try using memory mapped device access. Default is off.
1314
1315 ``exclusive=on|off``
1316 Open the device in exclusive mode (vmix won't work in this
1317 case). Default is off.
1318
1319 ``dsp-policy=policy``
1320 Sets the timing policy (between 0 and 10, where smaller number
1321 means smaller latency but higher CPU usage). Use -1 to use
1322 buffer sizes specified by ``buffer`` and ``buffer-count``. This
1323 option is ignored if you do not have OSS 4. Default is 5.
1324
1325``-audiodev pa,id=id[,prop[=value][,...]]``
1326 Creates a backend using PulseAudio. This backend is available on
1327 most systems.
1328
1329 PulseAudio specific options are:
1330
1331 ``server=server``
1332 Sets the PulseAudio server to connect to.
1333
1334 ``in|out.name=sink``
1335 Use the specified source/sink for recording/playback.
1336
1337 ``in|out.latency=usecs``
1338 Desired latency in microseconds. The PulseAudio server will try
1339 to honor this value but actual latencies may be lower or higher.
1340
1341``-audiodev sdl,id=id[,prop[=value][,...]]``
1342 Creates a backend using SDL. This backend is available on most
1343 systems, but you should use your platform's native backend if
1344 possible. This backend has no backend specific properties.
1345
1346``-audiodev spice,id=id[,prop[=value][,...]]``
1347 Creates a backend that sends audio through SPICE. This backend
1348 requires ``-spice`` and automatically selected in that case, so
1349 usually you can ignore this option. This backend has no backend
1350 specific properties.
1351
1352``-audiodev wav,id=id[,prop[=value][,...]]``
1353 Creates a backend that writes audio to a WAV file.
1354
1355 Backend specific options are:
1356
1357 ``path=path``
1358 Write recorded audio into the specified file. Default is
1359 ``qemu.wav``.
1360ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001361
1362DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw,
1363 "-soundhw c1,... enable audio support\n"
1364 " and only specified sound cards (comma separated list)\n"
1365 " use '-soundhw help' to get the list of supported cards\n"
1366 " use '-soundhw all' to enable all of them\n", QEMU_ARCH_ALL)
1367STEXI
1368@item -soundhw @var{card1}[,@var{card2},...] or -soundhw all
1369@findex -soundhw
1370Enable audio and selected sound hardware. Use 'help' to print all
Thomas Huth664785a2019-07-30 17:08:26 +02001371available sound hardware. For example:
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001372
1373@example
Thomas Huth664785a2019-07-30 17:08:26 +02001374@value{qemu_system_x86} -soundhw sb16,adlib disk.img
1375@value{qemu_system_x86} -soundhw es1370 disk.img
1376@value{qemu_system_x86} -soundhw ac97 disk.img
1377@value{qemu_system_x86} -soundhw hda disk.img
1378@value{qemu_system_x86} -soundhw all disk.img
1379@value{qemu_system_x86} -soundhw help
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001380@end example
1381
1382Note that Linux's i810_audio OSS kernel (for AC97) module might
1383require manually specifying clocking.
1384
1385@example
1386modprobe i810_audio clocking=48000
1387@end example
1388ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001389SRST
1390``-soundhw card1[,card2,...] or -soundhw all``
1391 Enable audio and selected sound hardware. Use 'help' to print all
1392 available sound hardware. For example:
1393
1394 .. parsed-literal::
1395
1396 |qemu_system_x86| -soundhw sb16,adlib disk.img
1397 |qemu_system_x86| -soundhw es1370 disk.img
1398 |qemu_system_x86| -soundhw ac97 disk.img
1399 |qemu_system_x86| -soundhw hda disk.img
1400 |qemu_system_x86| -soundhw all disk.img
1401 |qemu_system_x86| -soundhw help
1402
1403 Note that Linux's i810\_audio OSS kernel (for AC97) module might
1404 require manually specifying clocking.
1405
1406 ::
1407
1408 modprobe i810_audio clocking=48000
1409ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001410
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001411DEF("device", HAS_ARG, QEMU_OPTION_device,
1412 "-device driver[,prop[=value][,...]]\n"
1413 " add device (based on driver)\n"
1414 " prop=value,... sets driver properties\n"
1415 " use '-device help' to print all possible drivers\n"
1416 " use '-device driver,help' to print all possible properties\n",
1417 QEMU_ARCH_ALL)
1418STEXI
1419@item -device @var{driver}[,@var{prop}[=@var{value}][,...]]
1420@findex -device
1421Add device @var{driver}. @var{prop}=@var{value} sets driver
1422properties. Valid properties depend on the driver. To get help on
1423possible drivers and properties, use @code{-device help} and
1424@code{-device @var{driver},help}.
Corey Minyardf8490452015-12-17 12:50:10 -06001425
1426Some drivers are:
Corey Minyard7b0cd782017-09-06 15:57:07 -05001427@item -device ipmi-bmc-sim,id=@var{id}[,slave_addr=@var{val}][,sdrfile=@var{file}][,furareasize=@var{val}][,furdatafile=@var{file}][,guid=@var{uuid}]
Corey Minyardf8490452015-12-17 12:50:10 -06001428
1429Add an IPMI BMC. This is a simulation of a hardware management
1430interface processor that normally sits on a system. It provides
1431a watchdog and the ability to reset and power control the system.
1432You need to connect this to an IPMI interface to make it useful
1433
1434The IPMI slave address to use for the BMC. The default is 0x20.
1435This address is the BMC's address on the I2C network of management
1436controllers. If you don't know what this means, it is safe to ignore
1437it.
1438
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001439@table @option
Corey Minyard7b0cd782017-09-06 15:57:07 -05001440@item id=@var{id}
1441The BMC id for interfaces to use this device.
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001442@item slave_addr=@var{val}
1443Define slave address to use for the BMC. The default is 0x20.
1444@item sdrfile=@var{file}
Cédric Le Goater540c07d2017-04-05 14:41:32 +02001445file containing raw Sensor Data Records (SDR) data. The default is none.
1446@item fruareasize=@var{val}
1447size of a Field Replaceable Unit (FRU) area. The default is 1024.
1448@item frudatafile=@var{file}
1449file containing raw Field Replaceable Unit (FRU) inventory data. The default is none.
Corey Minyard7b0cd782017-09-06 15:57:07 -05001450@item guid=@var{uuid}
1451value for the GUID for the BMC, in standard UUID format. If this is set,
1452get "Get GUID" command to the BMC will return it. Otherwise "Get GUID"
1453will return an error.
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001454@end table
1455
Corey Minyardf8490452015-12-17 12:50:10 -06001456@item -device ipmi-bmc-extern,id=@var{id},chardev=@var{id}[,slave_addr=@var{val}]
1457
1458Add a connection to an external IPMI BMC simulator. Instead of
1459locally emulating the BMC like the above item, instead connect
1460to an external entity that provides the IPMI services.
1461
1462A connection is made to an external BMC simulator. If you do this, it
1463is strongly recommended that you use the "reconnect=" chardev option
1464to reconnect to the simulator if the connection is lost. Note that if
1465this is not used carefully, it can be a security issue, as the
1466interface has the ability to send resets, NMIs, and power off the VM.
1467It's best if QEMU makes a connection to an external simulator running
1468on a secure port on localhost, so neither the simulator nor QEMU is
1469exposed to any outside network.
1470
1471See the "lanserv/README.vm" file in the OpenIPMI library for more
1472details on the external interface.
1473
1474@item -device isa-ipmi-kcs,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1475
1476Add a KCS IPMI interafce on the ISA bus. This also adds a
1477corresponding ACPI and SMBIOS entries, if appropriate.
1478
1479@table @option
1480@item bmc=@var{id}
1481The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above.
1482@item ioport=@var{val}
1483Define the I/O address of the interface. The default is 0xca0 for KCS.
1484@item irq=@var{val}
1485Define the interrupt to use. The default is 5. To disable interrupts,
1486set this to 0.
1487@end table
1488
1489@item -device isa-ipmi-bt,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1490
1491Like the KCS interface, but defines a BT interface. The default port is
14920xe4 and the default interrupt is 5.
1493
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001494ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001495SRST
1496``-device driver[,prop[=value][,...]]``
1497 Add device driver. prop=value sets driver properties. Valid
1498 properties depend on the driver. To get help on possible drivers and
1499 properties, use ``-device help`` and ``-device driver,help``.
1500
1501 Some drivers are:
1502
1503``-device ipmi-bmc-sim,id=id[,slave_addr=val][,sdrfile=file][,furareasize=val][,furdatafile=file][,guid=uuid]``
1504 Add an IPMI BMC. This is a simulation of a hardware management
1505 interface processor that normally sits on a system. It provides a
1506 watchdog and the ability to reset and power control the system. You
1507 need to connect this to an IPMI interface to make it useful
1508
1509 The IPMI slave address to use for the BMC. The default is 0x20. This
1510 address is the BMC's address on the I2C network of management
1511 controllers. If you don't know what this means, it is safe to ignore
1512 it.
1513
1514 ``id=id``
1515 The BMC id for interfaces to use this device.
1516
1517 ``slave_addr=val``
1518 Define slave address to use for the BMC. The default is 0x20.
1519
1520 ``sdrfile=file``
1521 file containing raw Sensor Data Records (SDR) data. The default
1522 is none.
1523
1524 ``fruareasize=val``
1525 size of a Field Replaceable Unit (FRU) area. The default is
1526 1024.
1527
1528 ``frudatafile=file``
1529 file containing raw Field Replaceable Unit (FRU) inventory data.
1530 The default is none.
1531
1532 ``guid=uuid``
1533 value for the GUID for the BMC, in standard UUID format. If this
1534 is set, get "Get GUID" command to the BMC will return it.
1535 Otherwise "Get GUID" will return an error.
1536
1537``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]``
1538 Add a connection to an external IPMI BMC simulator. Instead of
1539 locally emulating the BMC like the above item, instead connect to an
1540 external entity that provides the IPMI services.
1541
1542 A connection is made to an external BMC simulator. If you do this,
1543 it is strongly recommended that you use the "reconnect=" chardev
1544 option to reconnect to the simulator if the connection is lost. Note
1545 that if this is not used carefully, it can be a security issue, as
1546 the interface has the ability to send resets, NMIs, and power off
1547 the VM. It's best if QEMU makes a connection to an external
1548 simulator running on a secure port on localhost, so neither the
1549 simulator nor QEMU is exposed to any outside network.
1550
1551 See the "lanserv/README.vm" file in the OpenIPMI library for more
1552 details on the external interface.
1553
1554``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]``
1555 Add a KCS IPMI interafce on the ISA bus. This also adds a
1556 corresponding ACPI and SMBIOS entries, if appropriate.
1557
1558 ``bmc=id``
1559 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern
1560 above.
1561
1562 ``ioport=val``
1563 Define the I/O address of the interface. The default is 0xca0
1564 for KCS.
1565
1566 ``irq=val``
1567 Define the interrupt to use. The default is 5. To disable
1568 interrupts, set this to 0.
1569
1570``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]``
1571 Like the KCS interface, but defines a BT interface. The default port
1572 is 0xe4 and the default interrupt is 5.
1573ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001574
1575DEF("name", HAS_ARG, QEMU_OPTION_name,
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001576 "-name string1[,process=string2][,debug-threads=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001577 " set the name of the guest\n"
Roman Bolshakov479a5742018-12-17 23:26:01 +03001578 " string1 sets the window title and string2 the process name\n"
1579 " When debug-threads is enabled, individual threads are given a separate name\n"
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001580 " NOTE: The thread names are for debugging and not a stable API.\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001581 QEMU_ARCH_ALL)
1582STEXI
1583@item -name @var{name}
1584@findex -name
1585Sets the @var{name} of the guest.
1586This name will be displayed in the SDL window caption.
1587The @var{name} will also be used for the VNC server.
1588Also optionally set the top visible process name in Linux.
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001589Naming of individual threads can also be enabled on Linux to aid debugging.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001590ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001591SRST
1592``-name name``
1593 Sets the name of the guest. This name will be displayed in the SDL
1594 window caption. The name will also be used for the VNC server. Also
1595 optionally set the top visible process name in Linux. Naming of
1596 individual threads can also be enabled on Linux to aid debugging.
1597ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001598
1599DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
1600 "-uuid %08x-%04x-%04x-%04x-%012x\n"
1601 " specify machine UUID\n", QEMU_ARCH_ALL)
1602STEXI
1603@item -uuid @var{uuid}
1604@findex -uuid
1605Set system UUID.
1606ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001607SRST
1608``-uuid uuid``
1609 Set system UUID.
1610ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001611
1612STEXI
1613@end table
1614ETEXI
1615DEFHEADING()
1616
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02001617DEFHEADING(Block device options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001618STEXI
1619@table @option
1620ETEXI
1621
blueswir15824d652009-03-28 06:44:27 +00001622DEF("fda", HAS_ARG, QEMU_OPTION_fda,
Blue Swirlad960902010-03-29 19:23:52 +00001623 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
1624DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001625STEXI
1626@item -fda @var{file}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02001627@itemx -fdb @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001628@findex -fda
1629@findex -fdb
Markus Armbruster92a539d2015-03-17 17:02:20 +01001630Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}).
blueswir15824d652009-03-28 06:44:27 +00001631ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001632SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001633``-fda file``
1634 \
1635``-fdb file``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001636 Use file as floppy disk 0/1 image (see
1637 :ref:`disk_005fimages`).
1638ERST
blueswir15824d652009-03-28 06:44:27 +00001639
1640DEF("hda", HAS_ARG, QEMU_OPTION_hda,
Blue Swirlad960902010-03-29 19:23:52 +00001641 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
1642DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001643DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
Blue Swirlad960902010-03-29 19:23:52 +00001644 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
1645DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001646STEXI
1647@item -hda @var{file}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02001648@itemx -hdb @var{file}
1649@itemx -hdc @var{file}
1650@itemx -hdd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001651@findex -hda
1652@findex -hdb
1653@findex -hdc
1654@findex -hdd
blueswir15824d652009-03-28 06:44:27 +00001655Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
1656ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001657SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001658``-hda file``
1659 \
1660``-hdb file``
1661 \
1662``-hdc file``
1663 \
1664``-hdd file``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001665 Use file as hard disk 0, 1, 2 or 3 image (see
1666 :ref:`disk_005fimages`).
1667ERST
blueswir15824d652009-03-28 06:44:27 +00001668
1669DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
Blue Swirlad960902010-03-29 19:23:52 +00001670 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
1671 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001672STEXI
1673@item -cdrom @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001674@findex -cdrom
blueswir15824d652009-03-28 06:44:27 +00001675Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and
1676@option{-cdrom} at the same time). You can use the host CD-ROM by
Peter Maydellacab9232020-01-23 15:22:40 +00001677using @file{/dev/cdrom} as filename.
blueswir15824d652009-03-28 06:44:27 +00001678ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001679SRST
1680``-cdrom file``
1681 Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
1682 the same time). You can use the host CD-ROM by using ``/dev/cdrom``
1683 as filename.
1684ERST
blueswir15824d652009-03-28 06:44:27 +00001685
Markus Armbruster42e5f392017-02-28 22:27:07 +01001686DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
1687 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n"
1688 " [,cache.direct=on|off][,cache.no-flush=on|off]\n"
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001689 " [,read-only=on|off][,auto-read-only=on|off]\n"
1690 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
Markus Armbruster42e5f392017-02-28 22:27:07 +01001691 " [,driver specific parameters...]\n"
1692 " configure a block backend\n", QEMU_ARCH_ALL)
Kevin Wolfdfaca462016-09-22 16:53:24 +02001693STEXI
1694@item -blockdev @var{option}[,@var{option}[,@var{option}[,...]]]
1695@findex -blockdev
1696
Kevin Wolf370e8322016-09-22 17:24:38 +02001697Define a new block driver node. Some of the options apply to all block drivers,
1698other options are only accepted for a specific block driver. See below for a
1699list of generic options and options for the most common block drivers.
1700
1701Options that expect a reference to another node (e.g. @code{file}) can be
1702given in two ways. Either you specify the node name of an already existing node
1703(file=@var{node-name}), or you define a new node inline, adding options
1704for the referenced node after a dot (file.filename=@var{path},file.aio=native).
1705
1706A block driver node created with @option{-blockdev} can be used for a guest
1707device by specifying its node name for the @code{drive} property in a
1708@option{-device} argument that defines a block device.
Kevin Wolfdfaca462016-09-22 16:53:24 +02001709
1710@table @option
1711@item Valid options for any block driver node:
1712
1713@table @code
1714@item driver
1715Specifies the block driver to use for the given node.
1716@item node-name
1717This defines the name of the block driver node by which it will be referenced
1718later. The name must be unique, i.e. it must not match the name of a different
1719block driver node, or (if you use @option{-drive} as well) the ID of a drive.
1720
1721If no node name is specified, it is automatically generated. The generated node
1722name is not intended to be predictable and changes between QEMU invocations.
1723For the top level, an explicit node name must be specified.
1724@item read-only
1725Open the node read-only. Guest write attempts will fail.
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001726
1727Note that some block drivers support only read-only access, either generally or
1728in certain configurations. In this case, the default value
1729@option{read-only=off} does not work and the option must be specified
1730explicitly.
1731@item auto-read-only
1732If @option{auto-read-only=on} is set, QEMU may fall back to read-only usage
1733even when @option{read-only=off} is requested, or even switch between modes as
1734needed, e.g. depending on whether the image file is writable or whether a
1735writing user is attached to the node.
1736@item force-share
1737Override the image locking system of QEMU by forcing the node to utilize
1738weaker shared access for permissions where it would normally request exclusive
1739access. When there is the potential for multiple instances to have the same
1740file open (whether this invocation of QEMU is the first or the second
1741instance), both instances must permit shared access for the second instance to
1742succeed at opening the file.
1743
1744Enabling @option{force-share=on} requires @option{read-only=on}.
Kevin Wolfdfaca462016-09-22 16:53:24 +02001745@item cache.direct
1746The host page cache can be avoided with @option{cache.direct=on}. This will
1747attempt to do disk IO directly to the guest's memory. QEMU may still perform an
1748internal copy of the data.
1749@item cache.no-flush
1750In case you don't care about data integrity over host failures, you can use
1751@option{cache.no-flush=on}. This option tells QEMU that it never needs to write
1752any data to the disk but can instead keep things in cache. If anything goes
1753wrong, like your host losing power, the disk storage getting disconnected
1754accidentally, etc. your image will most probably be rendered unusable.
1755@item discard=@var{discard}
1756@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and controls
1757whether @code{discard} (also known as @code{trim} or @code{unmap}) requests are
1758ignored or passed to the filesystem. Some machine types may not support
1759discard requests.
1760@item detect-zeroes=@var{detect-zeroes}
1761@var{detect-zeroes} is "off", "on" or "unmap" and enables the automatic
1762conversion of plain zero writes by the OS to driver specific optimized
1763zero write commands. You may even choose "unmap" if @var{discard} is set
1764to "unmap" to allow a zero write to be converted to an @code{unmap} operation.
1765@end table
1766
Kevin Wolf370e8322016-09-22 17:24:38 +02001767@item Driver-specific options for @code{file}
1768
1769This is the protocol-level block driver for accessing regular files.
1770
1771@table @code
1772@item filename
1773The path to the image file in the local filesystem
1774@item aio
1775Specifies the AIO backend (threads/native, default: threads)
Fam Zheng1878eaf2017-11-24 16:53:51 +08001776@item locking
1777Specifies whether the image file is protected with Linux OFD / POSIX locks. The
1778default is to use the Linux Open File Descriptor API if available, otherwise no
1779lock is applied. (auto/on/off, default: auto)
Kevin Wolf370e8322016-09-22 17:24:38 +02001780@end table
1781Example:
1782@example
1783-blockdev driver=file,node-name=disk,filename=disk.img
1784@end example
1785
1786@item Driver-specific options for @code{raw}
1787
1788This is the image format block driver for raw images. It is usually
1789stacked on top of a protocol level block driver such as @code{file}.
1790
1791@table @code
1792@item file
1793Reference to or definition of the data source block driver node
1794(e.g. a @code{file} driver node)
1795@end table
1796Example 1:
1797@example
1798-blockdev driver=file,node-name=disk_file,filename=disk.img
1799-blockdev driver=raw,node-name=disk,file=disk_file
1800@end example
1801Example 2:
1802@example
1803-blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1804@end example
1805
1806@item Driver-specific options for @code{qcow2}
1807
1808This is the image format block driver for qcow2 images. It is usually
1809stacked on top of a protocol level block driver such as @code{file}.
1810
1811@table @code
1812@item file
1813Reference to or definition of the data source block driver node
1814(e.g. a @code{file} driver node)
1815
1816@item backing
1817Reference to or definition of the backing file block device (default is taken
Max Reitz4f7be282018-02-24 16:40:33 +01001818from the image file). It is allowed to pass @code{null} here in order to disable
1819the default backing file.
Kevin Wolf370e8322016-09-22 17:24:38 +02001820
1821@item lazy-refcounts
1822Whether to enable the lazy refcounts feature (on/off; default is taken from the
1823image file)
1824
1825@item cache-size
1826The maximum total size of the L2 table and refcount block caches in bytes
Leonid Bloch40fb2152018-09-26 19:04:39 +03001827(default: the sum of l2-cache-size and refcount-cache-size)
Kevin Wolf370e8322016-09-22 17:24:38 +02001828
1829@item l2-cache-size
1830The maximum size of the L2 table cache in bytes
Leonid Bloch80668d02018-09-26 19:04:44 +03001831(default: if cache-size is not specified - 32M on Linux platforms, and 8M on
1832non-Linux platforms; otherwise, as large as possible within the cache-size,
1833while permitting the requested or the minimal refcount cache size)
Kevin Wolf370e8322016-09-22 17:24:38 +02001834
1835@item refcount-cache-size
1836The maximum size of the refcount block cache in bytes
Leonid Bloch40fb2152018-09-26 19:04:39 +03001837(default: 4 times the cluster size; or if cache-size is specified, the part of
1838it which is not used for the L2 cache)
Kevin Wolf370e8322016-09-22 17:24:38 +02001839
1840@item cache-clean-interval
1841Clean unused entries in the L2 and refcount caches. The interval is in seconds.
Leonid Bloche3a7b452018-09-29 12:54:54 +03001842The default value is 600 on supporting platforms, and 0 on other platforms.
1843Setting it to 0 disables this feature.
Kevin Wolf370e8322016-09-22 17:24:38 +02001844
1845@item pass-discard-request
1846Whether discard requests to the qcow2 device should be forwarded to the data
1847source (on/off; default: on if discard=unmap is specified, off otherwise)
1848
1849@item pass-discard-snapshot
1850Whether discard requests for the data source should be issued when a snapshot
1851operation (e.g. deleting a snapshot) frees clusters in the qcow2 file (on/off;
1852default: on)
1853
1854@item pass-discard-other
1855Whether discard requests for the data source should be issued on other
1856occasions where a cluster gets freed (on/off; default: off)
1857
1858@item overlap-check
1859Which overlap checks to perform for writes to the image
1860(none/constant/cached/all; default: cached). For details or finer
1861granularity control refer to the QAPI documentation of @code{blockdev-add}.
1862@end table
1863
1864Example 1:
1865@example
1866-blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
1867-blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
1868@end example
1869Example 2:
1870@example
1871-blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
1872@end example
1873
1874@item Driver-specific options for other drivers
1875Please refer to the QAPI documentation of the @code{blockdev-add} QMP command.
1876
Kevin Wolfdfaca462016-09-22 16:53:24 +02001877@end table
1878
1879ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001880SRST
1881``-blockdev option[,option[,option[,...]]]``
1882 Define a new block driver node. Some of the options apply to all
1883 block drivers, other options are only accepted for a specific block
1884 driver. See below for a list of generic options and options for the
1885 most common block drivers.
1886
1887 Options that expect a reference to another node (e.g. ``file``) can
1888 be given in two ways. Either you specify the node name of an already
1889 existing node (file=node-name), or you define a new node inline,
1890 adding options for the referenced node after a dot
1891 (file.filename=path,file.aio=native).
1892
1893 A block driver node created with ``-blockdev`` can be used for a
1894 guest device by specifying its node name for the ``drive`` property
1895 in a ``-device`` argument that defines a block device.
1896
1897 ``Valid options for any block driver node:``
1898 ``driver``
1899 Specifies the block driver to use for the given node.
1900
1901 ``node-name``
1902 This defines the name of the block driver node by which it
1903 will be referenced later. The name must be unique, i.e. it
1904 must not match the name of a different block driver node, or
1905 (if you use ``-drive`` as well) the ID of a drive.
1906
1907 If no node name is specified, it is automatically generated.
1908 The generated node name is not intended to be predictable
1909 and changes between QEMU invocations. For the top level, an
1910 explicit node name must be specified.
1911
1912 ``read-only``
1913 Open the node read-only. Guest write attempts will fail.
1914
1915 Note that some block drivers support only read-only access,
1916 either generally or in certain configurations. In this case,
1917 the default value ``read-only=off`` does not work and the
1918 option must be specified explicitly.
1919
1920 ``auto-read-only``
1921 If ``auto-read-only=on`` is set, QEMU may fall back to
1922 read-only usage even when ``read-only=off`` is requested, or
1923 even switch between modes as needed, e.g. depending on
1924 whether the image file is writable or whether a writing user
1925 is attached to the node.
1926
1927 ``force-share``
1928 Override the image locking system of QEMU by forcing the
1929 node to utilize weaker shared access for permissions where
1930 it would normally request exclusive access. When there is
1931 the potential for multiple instances to have the same file
1932 open (whether this invocation of QEMU is the first or the
1933 second instance), both instances must permit shared access
1934 for the second instance to succeed at opening the file.
1935
1936 Enabling ``force-share=on`` requires ``read-only=on``.
1937
1938 ``cache.direct``
1939 The host page cache can be avoided with ``cache.direct=on``.
1940 This will attempt to do disk IO directly to the guest's
1941 memory. QEMU may still perform an internal copy of the data.
1942
1943 ``cache.no-flush``
1944 In case you don't care about data integrity over host
1945 failures, you can use ``cache.no-flush=on``. This option
1946 tells QEMU that it never needs to write any data to the disk
1947 but can instead keep things in cache. If anything goes
1948 wrong, like your host losing power, the disk storage getting
1949 disconnected accidentally, etc. your image will most
1950 probably be rendered unusable.
1951
1952 ``discard=discard``
1953 discard is one of "ignore" (or "off") or "unmap" (or "on")
1954 and controls whether ``discard`` (also known as ``trim`` or
1955 ``unmap``) requests are ignored or passed to the filesystem.
1956 Some machine types may not support discard requests.
1957
1958 ``detect-zeroes=detect-zeroes``
1959 detect-zeroes is "off", "on" or "unmap" and enables the
1960 automatic conversion of plain zero writes by the OS to
1961 driver specific optimized zero write commands. You may even
1962 choose "unmap" if discard is set to "unmap" to allow a zero
1963 write to be converted to an ``unmap`` operation.
1964
1965 ``Driver-specific options for file``
1966 This is the protocol-level block driver for accessing regular
1967 files.
1968
1969 ``filename``
1970 The path to the image file in the local filesystem
1971
1972 ``aio``
1973 Specifies the AIO backend (threads/native, default: threads)
1974
1975 ``locking``
1976 Specifies whether the image file is protected with Linux OFD
1977 / POSIX locks. The default is to use the Linux Open File
1978 Descriptor API if available, otherwise no lock is applied.
1979 (auto/on/off, default: auto)
1980
1981 Example:
1982
1983 ::
1984
1985 -blockdev driver=file,node-name=disk,filename=disk.img
1986
1987 ``Driver-specific options for raw``
1988 This is the image format block driver for raw images. It is
1989 usually stacked on top of a protocol level block driver such as
1990 ``file``.
1991
1992 ``file``
1993 Reference to or definition of the data source block driver
1994 node (e.g. a ``file`` driver node)
1995
1996 Example 1:
1997
1998 ::
1999
2000 -blockdev driver=file,node-name=disk_file,filename=disk.img
2001 -blockdev driver=raw,node-name=disk,file=disk_file
2002
2003 Example 2:
2004
2005 ::
2006
2007 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
2008
2009 ``Driver-specific options for qcow2``
2010 This is the image format block driver for qcow2 images. It is
2011 usually stacked on top of a protocol level block driver such as
2012 ``file``.
2013
2014 ``file``
2015 Reference to or definition of the data source block driver
2016 node (e.g. a ``file`` driver node)
2017
2018 ``backing``
2019 Reference to or definition of the backing file block device
2020 (default is taken from the image file). It is allowed to
2021 pass ``null`` here in order to disable the default backing
2022 file.
2023
2024 ``lazy-refcounts``
2025 Whether to enable the lazy refcounts feature (on/off;
2026 default is taken from the image file)
2027
2028 ``cache-size``
2029 The maximum total size of the L2 table and refcount block
2030 caches in bytes (default: the sum of l2-cache-size and
2031 refcount-cache-size)
2032
2033 ``l2-cache-size``
2034 The maximum size of the L2 table cache in bytes (default: if
2035 cache-size is not specified - 32M on Linux platforms, and 8M
2036 on non-Linux platforms; otherwise, as large as possible
2037 within the cache-size, while permitting the requested or the
2038 minimal refcount cache size)
2039
2040 ``refcount-cache-size``
2041 The maximum size of the refcount block cache in bytes
2042 (default: 4 times the cluster size; or if cache-size is
2043 specified, the part of it which is not used for the L2
2044 cache)
2045
2046 ``cache-clean-interval``
2047 Clean unused entries in the L2 and refcount caches. The
2048 interval is in seconds. The default value is 600 on
2049 supporting platforms, and 0 on other platforms. Setting it
2050 to 0 disables this feature.
2051
2052 ``pass-discard-request``
2053 Whether discard requests to the qcow2 device should be
2054 forwarded to the data source (on/off; default: on if
2055 discard=unmap is specified, off otherwise)
2056
2057 ``pass-discard-snapshot``
2058 Whether discard requests for the data source should be
2059 issued when a snapshot operation (e.g. deleting a snapshot)
2060 frees clusters in the qcow2 file (on/off; default: on)
2061
2062 ``pass-discard-other``
2063 Whether discard requests for the data source should be
2064 issued on other occasions where a cluster gets freed
2065 (on/off; default: off)
2066
2067 ``overlap-check``
2068 Which overlap checks to perform for writes to the image
2069 (none/constant/cached/all; default: cached). For details or
2070 finer granularity control refer to the QAPI documentation of
2071 ``blockdev-add``.
2072
2073 Example 1:
2074
2075 ::
2076
2077 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
2078 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
2079
2080 Example 2:
2081
2082 ::
2083
2084 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
2085
2086 ``Driver-specific options for other drivers``
2087 Please refer to the QAPI documentation of the ``blockdev-add``
2088 QMP command.
2089ERST
Markus Armbruster42e5f392017-02-28 22:27:07 +01002090
blueswir15824d652009-03-28 06:44:27 +00002091DEF("drive", HAS_ARG, QEMU_OPTION_drive,
2092 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
Stefan Hajnoczi92196b22011-08-04 12:26:52 +01002093 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
Kevin Wolf572023f2018-06-13 11:01:30 +02002094 " [,snapshot=on|off][,rerror=ignore|stop|report]\n"
Stefan Hajnoczid1db7602014-04-23 13:55:37 +02002095 " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n"
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002096 " [,readonly=on|off][,copy-on-read=on|off]\n"
Peter Lieven2f7133b2014-07-28 21:53:02 +02002097 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n"
Benoît Canet3e9fab62013-09-02 14:14:40 +02002098 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n"
2099 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n"
2100 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
2101 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n"
Benoît Canet2024c1d2013-09-02 14:14:41 +02002102 " [[,iops_size=is]]\n"
Alberto Garcia76f4afb2015-06-08 18:17:44 +02002103 " [[,group=g]]\n"
Blue Swirlad960902010-03-29 19:23:52 +00002104 " use 'file' as a drive image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002105STEXI
2106@item -drive @var{option}[,@var{option}[,@var{option}[,...]]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01002107@findex -drive
blueswir15824d652009-03-28 06:44:27 +00002108
Kevin Wolfdfaca462016-09-22 16:53:24 +02002109Define a new drive. This includes creating a block driver node (the backend) as
2110well as a guest device, and is mostly a shortcut for defining the corresponding
2111@option{-blockdev} and @option{-device} options.
2112
2113@option{-drive} accepts all options that are accepted by @option{-blockdev}. In
2114addition, it knows the following options:
blueswir15824d652009-03-28 06:44:27 +00002115
Kevin Wolfb3f046c2009-10-09 10:58:35 +02002116@table @option
blueswir15824d652009-03-28 06:44:27 +00002117@item file=@var{file}
2118This option defines which disk image (@pxref{disk_images}) to use with
2119this drive. If the filename contains comma, you must double it
2120(for instance, "file=my,,file" to use file "my,file").
Ronnie Sahlberg0f5314a2011-10-26 23:51:37 +11002121
2122Special files such as iSCSI devices can be specified using protocol
2123specific URLs. See the section for "Device URL Syntax" for more information.
blueswir15824d652009-03-28 06:44:27 +00002124@item if=@var{interface}
2125This option defines on which type on interface the drive is connected.
Craig Jellicked1fcd02017-03-17 08:49:55 -07002126Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none.
blueswir15824d652009-03-28 06:44:27 +00002127@item bus=@var{bus},unit=@var{unit}
2128These options define where is connected the drive by defining the bus number and
2129the unit id.
2130@item index=@var{index}
2131This option defines where is connected the drive by using an index in the list
2132of available connectors of a given interface type.
2133@item media=@var{media}
2134This option defines the type of the media: disk or cdrom.
blueswir15824d652009-03-28 06:44:27 +00002135@item snapshot=@var{snapshot}
Michael Tokarev9d85d552014-04-07 13:34:58 +04002136@var{snapshot} is "on" or "off" and controls snapshot mode for the given drive
2137(see @option{-snapshot}).
blueswir15824d652009-03-28 06:44:27 +00002138@item cache=@var{cache}
Kevin Wolfdfaca462016-09-22 16:53:24 +02002139@var{cache} is "none", "writeback", "unsafe", "directsync" or "writethrough"
2140and controls how the host cache is used to access block data. This is a
2141shortcut that sets the @option{cache.direct} and @option{cache.no-flush}
2142options (as in @option{-blockdev}), and additionally @option{cache.writeback},
2143which provides a default for the @option{write-cache} option of block guest
2144devices (as in @option{-device}). The modes correspond to the following
2145settings:
2146
2147@c Our texi2pod.pl script doesn't support @multitable, so fall back to using
2148@c plain ASCII art (well, UTF-8 art really). This looks okay both in the manpage
2149@c and the HTML output.
2150@example
2151@ │ cache.writeback cache.direct cache.no-flush
2152─────────────┼─────────────────────────────────────────────────
2153writeback │ on off off
2154none │ on on off
2155writethrough │ off off off
2156directsync │ off on off
2157unsafe │ on off on
2158@end example
2159
2160The default mode is @option{cache=writeback}.
2161
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002162@item aio=@var{aio}
2163@var{aio} is "threads", or "native" and selects between pthread based disk I/O and native Linux AIO.
blueswir15824d652009-03-28 06:44:27 +00002164@item format=@var{format}
2165Specify which disk @var{format} will be used rather than detecting
Michael Tokarevd33c8a72016-05-18 15:47:53 +03002166the format. Can be used to specify format=raw to avoid interpreting
blueswir15824d652009-03-28 06:44:27 +00002167an untrusted format header.
Luiz Capitulinoae73e592011-07-12 17:35:08 -03002168@item werror=@var{action},rerror=@var{action}
2169Specify which @var{action} to take on write and read errors. Valid actions are:
2170"ignore" (ignore the error and try to continue), "stop" (pause QEMU),
2171"report" (report the error to the guest), "enospc" (pause QEMU only if the
2172host disk is full; report the error to the guest otherwise).
2173The default setting is @option{werror=enospc} and @option{rerror=report}.
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002174@item copy-on-read=@var{copy-on-read}
2175@var{copy-on-read} is "on" or "off" and enables whether to copy read backing
2176file sectors into the image file.
Stefan Hajnoczi01f9cfa2017-03-01 11:50:24 +00002177@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
2178Specify bandwidth throttling limits in bytes per second, either for all request
2179types or for reads or writes only. Small values can lead to timeouts or hangs
2180inside the guest. A safe minimum for disks is 2 MB/s.
2181@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}
2182Specify bursts in bytes per second, either for all request types or for reads
2183or writes only. Bursts allow the guest I/O to spike above the limit
2184temporarily.
2185@item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}
2186Specify request rate limits in requests per second, either for all request
2187types or for reads or writes only.
2188@item iops_max=@var{bm},iops_rd_max=@var{rm},iops_wr_max=@var{wm}
2189Specify bursts in requests per second, either for all request types or for reads
2190or writes only. Bursts allow the guest I/O to spike above the limit
2191temporarily.
2192@item iops_size=@var{is}
2193Let every @var{is} bytes of a request count as a new request for iops
2194throttling purposes. Use this option to prevent guests from circumventing iops
2195limits by sending fewer but larger requests.
2196@item group=@var{g}
2197Join a throttling quota group with given name @var{g}. All drives that are
2198members of the same group are accounted for together. Use this option to
2199prevent guests from circumventing throttling limits by using many small disks
2200instead of a single larger disk.
blueswir15824d652009-03-28 06:44:27 +00002201@end table
2202
Kevin Wolfdfaca462016-09-22 16:53:24 +02002203By default, the @option{cache.writeback=on} mode is used. It will report data
Kevin Wolfa13e5e02012-11-21 12:26:56 +01002204writes as completed as soon as the data is present in the host page cache.
2205This is safe as long as your guest OS makes sure to correctly flush disk caches
2206where needed. If your guest OS does not handle volatile disk write caches
2207correctly and your host crashes or loses power, then the guest may experience
2208data corruption.
blueswir15824d652009-03-28 06:44:27 +00002209
Kevin Wolfdfaca462016-09-22 16:53:24 +02002210For such guests, you should consider using @option{cache.writeback=off}. This
Kevin Wolfa13e5e02012-11-21 12:26:56 +01002211means that the host page cache will be used to read and write data, but write
2212notification will be sent to the guest only after QEMU has made sure to flush
2213each write to the disk. Be aware that this has a major impact on performance.
blueswir15824d652009-03-28 06:44:27 +00002214
Kevin Wolfdfaca462016-09-22 16:53:24 +02002215When using the @option{-snapshot} option, unsafe caching is always used.
Alexander Graf016f5cf2010-05-26 17:51:49 +02002216
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002217Copy-on-read avoids accessing the same backing file sectors repeatedly and is
2218useful when the backing file is over a slow network. By default copy-on-read
2219is off.
2220
blueswir15824d652009-03-28 06:44:27 +00002221Instead of @option{-cdrom} you can use:
2222@example
Thomas Huth664785a2019-07-30 17:08:26 +02002223@value{qemu_system} -drive file=file,index=2,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002224@end example
2225
2226Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can
2227use:
2228@example
Thomas Huth664785a2019-07-30 17:08:26 +02002229@value{qemu_system} -drive file=file,index=0,media=disk
2230@value{qemu_system} -drive file=file,index=1,media=disk
2231@value{qemu_system} -drive file=file,index=2,media=disk
2232@value{qemu_system} -drive file=file,index=3,media=disk
blueswir15824d652009-03-28 06:44:27 +00002233@end example
2234
Corey Bryant587ed6b2012-10-18 15:19:34 -04002235You can open an image using pre-opened file descriptors from an fd set:
2236@example
Thomas Huth664785a2019-07-30 17:08:26 +02002237@value{qemu_system} \
2238 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2239 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2240 -drive file=/dev/fdset/2,index=0,media=disk
Corey Bryant587ed6b2012-10-18 15:19:34 -04002241@end example
2242
blueswir15824d652009-03-28 06:44:27 +00002243You can connect a CDROM to the slave of ide0:
2244@example
Thomas Huth664785a2019-07-30 17:08:26 +02002245@value{qemu_system_x86} -drive file=file,if=ide,index=1,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002246@end example
2247
2248If you don't specify the "file=" argument, you define an empty drive:
2249@example
Thomas Huth664785a2019-07-30 17:08:26 +02002250@value{qemu_system_x86} -drive if=ide,index=1,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002251@end example
2252
blueswir15824d652009-03-28 06:44:27 +00002253Instead of @option{-fda}, @option{-fdb}, you can use:
2254@example
Thomas Huth664785a2019-07-30 17:08:26 +02002255@value{qemu_system_x86} -drive file=file,index=0,if=floppy
2256@value{qemu_system_x86} -drive file=file,index=1,if=floppy
blueswir15824d652009-03-28 06:44:27 +00002257@end example
2258
2259By default, @var{interface} is "ide" and @var{index} is automatically
2260incremented:
2261@example
Thomas Huth664785a2019-07-30 17:08:26 +02002262@value{qemu_system_x86} -drive file=a -drive file=b"
blueswir15824d652009-03-28 06:44:27 +00002263@end example
2264is interpreted like:
2265@example
Thomas Huth664785a2019-07-30 17:08:26 +02002266@value{qemu_system_x86} -hda a -hdb b
blueswir15824d652009-03-28 06:44:27 +00002267@end example
2268ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002269SRST
2270``-drive option[,option[,option[,...]]]``
2271 Define a new drive. This includes creating a block driver node (the
2272 backend) as well as a guest device, and is mostly a shortcut for
2273 defining the corresponding ``-blockdev`` and ``-device`` options.
2274
2275 ``-drive`` accepts all options that are accepted by ``-blockdev``.
2276 In addition, it knows the following options:
2277
2278 ``file=file``
2279 This option defines which disk image (see
2280 :ref:`disk_005fimages`) to use with this drive. If
2281 the filename contains comma, you must double it (for instance,
2282 "file=my,,file" to use file "my,file").
2283
2284 Special files such as iSCSI devices can be specified using
2285 protocol specific URLs. See the section for "Device URL Syntax"
2286 for more information.
2287
2288 ``if=interface``
2289 This option defines on which type on interface the drive is
2290 connected. Available types are: ide, scsi, sd, mtd, floppy,
2291 pflash, virtio, none.
2292
2293 ``bus=bus,unit=unit``
2294 These options define where is connected the drive by defining
2295 the bus number and the unit id.
2296
2297 ``index=index``
2298 This option defines where is connected the drive by using an
2299 index in the list of available connectors of a given interface
2300 type.
2301
2302 ``media=media``
2303 This option defines the type of the media: disk or cdrom.
2304
2305 ``snapshot=snapshot``
2306 snapshot is "on" or "off" and controls snapshot mode for the
2307 given drive (see ``-snapshot``).
2308
2309 ``cache=cache``
2310 cache is "none", "writeback", "unsafe", "directsync" or
2311 "writethrough" and controls how the host cache is used to access
2312 block data. This is a shortcut that sets the ``cache.direct``
2313 and ``cache.no-flush`` options (as in ``-blockdev``), and
2314 additionally ``cache.writeback``, which provides a default for
2315 the ``write-cache`` option of block guest devices (as in
2316 ``-device``). The modes correspond to the following settings:
2317
Peter Maydell09ce5f22020-02-28 15:36:13 +00002318 ============= =============== ============ ==============
2319 \ cache.writeback cache.direct cache.no-flush
2320 ============= =============== ============ ==============
2321 writeback on off off
2322 none on on off
2323 writethrough off off off
2324 directsync off on off
2325 unsafe on off on
2326 ============= =============== ============ ==============
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002327
2328 The default mode is ``cache=writeback``.
2329
2330 ``aio=aio``
2331 aio is "threads", or "native" and selects between pthread based
2332 disk I/O and native Linux AIO.
2333
2334 ``format=format``
2335 Specify which disk format will be used rather than detecting the
2336 format. Can be used to specify format=raw to avoid interpreting
2337 an untrusted format header.
2338
2339 ``werror=action,rerror=action``
2340 Specify which action to take on write and read errors. Valid
2341 actions are: "ignore" (ignore the error and try to continue),
2342 "stop" (pause QEMU), "report" (report the error to the guest),
2343 "enospc" (pause QEMU only if the host disk is full; report the
2344 error to the guest otherwise). The default setting is
2345 ``werror=enospc`` and ``rerror=report``.
2346
2347 ``copy-on-read=copy-on-read``
2348 copy-on-read is "on" or "off" and enables whether to copy read
2349 backing file sectors into the image file.
2350
2351 ``bps=b,bps_rd=r,bps_wr=w``
2352 Specify bandwidth throttling limits in bytes per second, either
2353 for all request types or for reads or writes only. Small values
2354 can lead to timeouts or hangs inside the guest. A safe minimum
2355 for disks is 2 MB/s.
2356
2357 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm``
2358 Specify bursts in bytes per second, either for all request types
2359 or for reads or writes only. Bursts allow the guest I/O to spike
2360 above the limit temporarily.
2361
2362 ``iops=i,iops_rd=r,iops_wr=w``
2363 Specify request rate limits in requests per second, either for
2364 all request types or for reads or writes only.
2365
2366 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm``
2367 Specify bursts in requests per second, either for all request
2368 types or for reads or writes only. Bursts allow the guest I/O to
2369 spike above the limit temporarily.
2370
2371 ``iops_size=is``
2372 Let every is bytes of a request count as a new request for iops
2373 throttling purposes. Use this option to prevent guests from
2374 circumventing iops limits by sending fewer but larger requests.
2375
2376 ``group=g``
2377 Join a throttling quota group with given name g. All drives that
2378 are members of the same group are accounted for together. Use
2379 this option to prevent guests from circumventing throttling
2380 limits by using many small disks instead of a single larger
2381 disk.
2382
2383 By default, the ``cache.writeback=on`` mode is used. It will report
2384 data writes as completed as soon as the data is present in the host
2385 page cache. This is safe as long as your guest OS makes sure to
2386 correctly flush disk caches where needed. If your guest OS does not
2387 handle volatile disk write caches correctly and your host crashes or
2388 loses power, then the guest may experience data corruption.
2389
2390 For such guests, you should consider using ``cache.writeback=off``.
2391 This means that the host page cache will be used to read and write
2392 data, but write notification will be sent to the guest only after
2393 QEMU has made sure to flush each write to the disk. Be aware that
2394 this has a major impact on performance.
2395
2396 When using the ``-snapshot`` option, unsafe caching is always used.
2397
2398 Copy-on-read avoids accessing the same backing file sectors
2399 repeatedly and is useful when the backing file is over a slow
2400 network. By default copy-on-read is off.
2401
2402 Instead of ``-cdrom`` you can use:
2403
2404 .. parsed-literal::
2405
2406 |qemu_system| -drive file=file,index=2,media=cdrom
2407
2408 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use:
2409
2410 .. parsed-literal::
2411
2412 |qemu_system| -drive file=file,index=0,media=disk
2413 |qemu_system| -drive file=file,index=1,media=disk
2414 |qemu_system| -drive file=file,index=2,media=disk
2415 |qemu_system| -drive file=file,index=3,media=disk
2416
2417 You can open an image using pre-opened file descriptors from an fd
2418 set:
2419
2420 .. parsed-literal::
2421
2422 |qemu_system| \
2423 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2424 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2425 -drive file=/dev/fdset/2,index=0,media=disk
2426
2427 You can connect a CDROM to the slave of ide0:
2428
2429 .. parsed-literal::
2430
2431 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom
2432
2433 If you don't specify the "file=" argument, you define an empty
2434 drive:
2435
2436 .. parsed-literal::
2437
2438 |qemu_system_x86| -drive if=ide,index=1,media=cdrom
2439
2440 Instead of ``-fda``, ``-fdb``, you can use:
2441
2442 .. parsed-literal::
2443
2444 |qemu_system_x86| -drive file=file,index=0,if=floppy
2445 |qemu_system_x86| -drive file=file,index=1,if=floppy
2446
2447 By default, interface is "ide" and index is automatically
2448 incremented:
2449
2450 .. parsed-literal::
2451
2452 |qemu_system_x86| -drive file=a -drive file=b"
2453
2454 is interpreted like:
2455
2456 .. parsed-literal::
2457
2458 |qemu_system_x86| -hda a -hdb b
2459ERST
blueswir15824d652009-03-28 06:44:27 +00002460
2461DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
Blue Swirlad960902010-03-29 19:23:52 +00002462 "-mtdblock file use 'file' as on-board Flash memory image\n",
2463 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002464STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002465@item -mtdblock @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002466@findex -mtdblock
Kevin Wolf4e257e52009-10-09 10:58:36 +02002467Use @var{file} as on-board Flash memory image.
blueswir15824d652009-03-28 06:44:27 +00002468ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002469SRST
2470``-mtdblock file``
2471 Use file as on-board Flash memory image.
2472ERST
blueswir15824d652009-03-28 06:44:27 +00002473
2474DEF("sd", HAS_ARG, QEMU_OPTION_sd,
Blue Swirlad960902010-03-29 19:23:52 +00002475 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002476STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002477@item -sd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002478@findex -sd
Kevin Wolf4e257e52009-10-09 10:58:36 +02002479Use @var{file} as SecureDigital card image.
blueswir15824d652009-03-28 06:44:27 +00002480ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002481SRST
2482``-sd file``
2483 Use file as SecureDigital card image.
2484ERST
blueswir15824d652009-03-28 06:44:27 +00002485
2486DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
Blue Swirlad960902010-03-29 19:23:52 +00002487 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002488STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002489@item -pflash @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002490@findex -pflash
Kevin Wolf4e257e52009-10-09 10:58:36 +02002491Use @var{file} as a parallel flash image.
blueswir15824d652009-03-28 06:44:27 +00002492ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002493SRST
2494``-pflash file``
2495 Use file as a parallel flash image.
2496ERST
blueswir15824d652009-03-28 06:44:27 +00002497
blueswir15824d652009-03-28 06:44:27 +00002498DEF("snapshot", 0, QEMU_OPTION_snapshot,
Blue Swirlad960902010-03-29 19:23:52 +00002499 "-snapshot write to temporary files instead of disk image files\n",
2500 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002501STEXI
2502@item -snapshot
Stefan Weil6616b2a2010-02-05 23:52:05 +01002503@findex -snapshot
blueswir15824d652009-03-28 06:44:27 +00002504Write to temporary files instead of disk image files. In this case,
2505the raw disk image you use is not written back. You can however force
2506the write back by pressing @key{C-a s} (@pxref{disk_images}).
2507ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002508SRST
2509``-snapshot``
2510 Write to temporary files instead of disk image files. In this case,
2511 the raw disk image you use is not written back. You can however
2512 force the write back by pressing C-a s (see
2513 :ref:`disk_005fimages`).
2514ERST
blueswir15824d652009-03-28 06:44:27 +00002515
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302516DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
Greg Kurzb44a6b02019-05-17 17:34:49 +02002517 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n"
2518 " [,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode]\n"
Pradeep Jagadeeshb8bbdb82017-02-28 10:31:46 +01002519 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n"
2520 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n"
2521 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n"
2522 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02002523 " [[,throttling.iops-size=is]]\n"
2524 "-fsdev proxy,id=id,socket=socket[,writeout=immediate][,readonly]\n"
2525 "-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=immediate][,readonly]\n"
2526 "-fsdev synth,id=id\n",
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302527 QEMU_ARCH_ALL)
2528
2529STEXI
2530
Greg Kurzb44a6b02019-05-17 17:34:49 +02002531@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}[,...]]]
2532@itemx -fsdev proxy,id=@var{id},socket=@var{socket}[,writeout=@var{writeout}][,readonly]
2533@itemx -fsdev proxy,id=@var{id},sock_fd=@var{sock_fd}[,writeout=@var{writeout}][,readonly]
2534@itemx -fsdev synth,id=@var{id}[,readonly]
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302535@findex -fsdev
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302536Define a new file system device. Valid options are:
2537@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002538@item local
2539Accesses to the filesystem are done by QEMU.
2540@item proxy
2541Accesses to the filesystem are done by virtfs-proxy-helper(1).
2542@item synth
2543Synthetic filesystem, only used by QTests.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302544@item id=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002545Specifies identifier for this device.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302546@item path=@var{path}
2547Specifies the export path for the file system device. Files under
2548this path will be available to the 9p client on the guest.
2549@item security_model=@var{security_model}
2550Specifies the security model to be used for this export path.
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302551Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302552In "passthrough" security model, files are stored using the same
Stefan Weilb65ee4f2012-05-11 22:25:50 +02002553credentials as they are created on the guest. This requires QEMU
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302554to run as root. In "mapped-xattr" security model, some of the file
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302555attributes like uid, gid, mode bits and link target are stored as
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302556file attributes. For "mapped-file" these attributes are stored in the
2557hidden .virtfs_metadata directory. Directories exported by this security model cannot
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302558interact with other unix tools. "none" security model is same as
2559passthrough except the sever won't report failures if it fails to
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302560set file attributes like ownership. Security model is mandatory
Greg Kurz93aee842018-12-12 14:18:10 +01002561only for local fsdriver. Other fsdrivers (like proxy) don't take
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302562security model as a parameter.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302563@item writeout=@var{writeout}
2564This is an optional argument. The only supported value is "immediate".
2565This means that host page cache will be used to read and write data but
2566write notification will be sent to the guest only when the data has been
2567reported as written by the storage subsystem.
M. Mohan Kumar2c74c2c2011-10-25 12:10:39 +05302568@item readonly
2569Enables exporting 9p share as a readonly mount for guests. By default
2570read-write access is given.
M. Mohan Kumar84a87cc2011-12-14 13:58:47 +05302571@item socket=@var{socket}
2572Enables proxy filesystem driver to use passed socket file for communicating
Greg Kurzb44a6b02019-05-17 17:34:49 +02002573with virtfs-proxy-helper(1).
M. Mohan Kumarf67e3ff2011-12-14 13:58:46 +05302574@item sock_fd=@var{sock_fd}
2575Enables proxy filesystem driver to use passed socket descriptor for
Greg Kurzb44a6b02019-05-17 17:34:49 +02002576communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2577will create socketpair and pass one of the fds as sock_fd.
Tobias Schrammb96feb22017-06-29 15:11:50 +02002578@item fmode=@var{fmode}
2579Specifies the default mode for newly created files on the host. Works only
2580with security models "mapped-xattr" and "mapped-file".
2581@item dmode=@var{dmode}
2582Specifies the default mode for newly created directories on the host. Works
2583only with security models "mapped-xattr" and "mapped-file".
Greg Kurzb44a6b02019-05-17 17:34:49 +02002584@item throttling.bps-total=@var{b},throttling.bps-read=@var{r},throttling.bps-write=@var{w}
2585Specify bandwidth throttling limits in bytes per second, either for all request
2586types or for reads or writes only.
2587@item throttling.bps-total-max=@var{bm},bps-read-max=@var{rm},bps-write-max=@var{wm}
2588Specify bursts in bytes per second, either for all request types or for reads
2589or writes only. Bursts allow the guest I/O to spike above the limit
2590temporarily.
2591@item throttling.iops-total=@var{i},throttling.iops-read=@var{r}, throttling.iops-write=@var{w}
2592Specify request rate limits in requests per second, either for all request
2593types or for reads or writes only.
2594@item throttling.iops-total-max=@var{im},throttling.iops-read-max=@var{irm}, throttling.iops-write-max=@var{iwm}
2595Specify bursts in requests per second, either for all request types or for reads
2596or writes only. Bursts allow the guest I/O to spike above the limit temporarily.
2597@item throttling.iops-size=@var{is}
2598Let every @var{is} bytes of a request count as a new request for iops
2599throttling purposes.
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302600@end table
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302601
Greg Kurzb44a6b02019-05-17 17:34:49 +02002602-fsdev option is used along with -device driver "virtio-9p-...".
2603@item -device virtio-9p-@var{type},fsdev=@var{id},mount_tag=@var{mount_tag}
2604Options for virtio-9p-... driver are:
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302605@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002606@item @var{type}
2607Specifies the variant to be used. Supported values are "pci", "ccw" or "device",
2608depending on the machine type.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302609@item fsdev=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002610Specifies the id value specified along with -fsdev option.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302611@item mount_tag=@var{mount_tag}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002612Specifies the tag name to be used by the guest to mount this export point.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302613@end table
2614
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302615ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002616SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00002617``-fsdev local,id=id,path=path,security_model=security_model [,writeout=writeout][,readonly][,fmode=fmode][,dmode=dmode] [,throttling.option=value[,throttling.option=value[,...]]]``
2618 \
2619``-fsdev proxy,id=id,socket=socket[,writeout=writeout][,readonly]``
2620 \
2621``-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=writeout][,readonly]``
2622 \
2623``-fsdev synth,id=id[,readonly]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002624 Define a new file system device. Valid options are:
2625
2626 ``local``
2627 Accesses to the filesystem are done by QEMU.
2628
2629 ``proxy``
2630 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2631
2632 ``synth``
2633 Synthetic filesystem, only used by QTests.
2634
2635 ``id=id``
2636 Specifies identifier for this device.
2637
2638 ``path=path``
2639 Specifies the export path for the file system device. Files
2640 under this path will be available to the 9p client on the guest.
2641
2642 ``security_model=security_model``
2643 Specifies the security model to be used for this export path.
2644 Supported security models are "passthrough", "mapped-xattr",
2645 "mapped-file" and "none". In "passthrough" security model, files
2646 are stored using the same credentials as they are created on the
2647 guest. This requires QEMU to run as root. In "mapped-xattr"
2648 security model, some of the file attributes like uid, gid, mode
2649 bits and link target are stored as file attributes. For
2650 "mapped-file" these attributes are stored in the hidden
2651 .virtfs\_metadata directory. Directories exported by this
2652 security model cannot interact with other unix tools. "none"
2653 security model is same as passthrough except the sever won't
2654 report failures if it fails to set file attributes like
2655 ownership. Security model is mandatory only for local fsdriver.
2656 Other fsdrivers (like proxy) don't take security model as a
2657 parameter.
2658
2659 ``writeout=writeout``
2660 This is an optional argument. The only supported value is
2661 "immediate". This means that host page cache will be used to
2662 read and write data but write notification will be sent to the
2663 guest only when the data has been reported as written by the
2664 storage subsystem.
2665
2666 ``readonly``
2667 Enables exporting 9p share as a readonly mount for guests. By
2668 default read-write access is given.
2669
2670 ``socket=socket``
2671 Enables proxy filesystem driver to use passed socket file for
2672 communicating with virtfs-proxy-helper(1).
2673
2674 ``sock_fd=sock_fd``
2675 Enables proxy filesystem driver to use passed socket descriptor
2676 for communicating with virtfs-proxy-helper(1). Usually a helper
2677 like libvirt will create socketpair and pass one of the fds as
2678 sock\_fd.
2679
2680 ``fmode=fmode``
2681 Specifies the default mode for newly created files on the host.
2682 Works only with security models "mapped-xattr" and
2683 "mapped-file".
2684
2685 ``dmode=dmode``
2686 Specifies the default mode for newly created directories on the
2687 host. Works only with security models "mapped-xattr" and
2688 "mapped-file".
2689
2690 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w``
2691 Specify bandwidth throttling limits in bytes per second, either
2692 for all request types or for reads or writes only.
2693
2694 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm``
2695 Specify bursts in bytes per second, either for all request types
2696 or for reads or writes only. Bursts allow the guest I/O to spike
2697 above the limit temporarily.
2698
2699 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w``
2700 Specify request rate limits in requests per second, either for
2701 all request types or for reads or writes only.
2702
2703 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm``
2704 Specify bursts in requests per second, either for all request
2705 types or for reads or writes only. Bursts allow the guest I/O to
2706 spike above the limit temporarily.
2707
2708 ``throttling.iops-size=is``
2709 Let every is bytes of a request count as a new request for iops
2710 throttling purposes.
2711
2712 -fsdev option is used along with -device driver "virtio-9p-...".
2713
2714``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag``
2715 Options for virtio-9p-... driver are:
2716
2717 ``type``
2718 Specifies the variant to be used. Supported values are "pci",
2719 "ccw" or "device", depending on the machine type.
2720
2721 ``fsdev=id``
2722 Specifies the id value specified along with -fsdev option.
2723
2724 ``mount_tag=mount_tag``
2725 Specifies the tag name to be used by the guest to mount this
2726 export point.
2727ERST
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302728
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302729DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
Greg Kurzb44a6b02019-05-17 17:34:49 +02002730 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002731 " [,id=id][,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02002732 "-virtfs proxy,mount_tag=tag,socket=socket[,id=id][,writeout=immediate][,readonly]\n"
2733 "-virtfs proxy,mount_tag=tag,sock_fd=sock_fd[,id=id][,writeout=immediate][,readonly]\n"
2734 "-virtfs synth,mount_tag=tag[,id=id][,readonly]\n",
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302735 QEMU_ARCH_ALL)
2736
2737STEXI
2738
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002739@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}]
Greg Kurzb44a6b02019-05-17 17:34:49 +02002740@itemx -virtfs proxy,socket=@var{socket},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2741@itemx -virtfs proxy,sock_fd=@var{sock_fd},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2742@itemx -virtfs synth,mount_tag=@var{mount_tag}
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302743@findex -virtfs
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302744
Greg Kurzb44a6b02019-05-17 17:34:49 +02002745Define 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:
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302746@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002747@item local
2748Accesses to the filesystem are done by QEMU.
2749@item proxy
2750Accesses to the filesystem are done by virtfs-proxy-helper(1).
2751@item synth
2752Synthetic filesystem, only used by QTests.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302753@item id=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002754Specifies identifier for the filesystem device
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302755@item path=@var{path}
2756Specifies the export path for the file system device. Files under
2757this path will be available to the 9p client on the guest.
2758@item security_model=@var{security_model}
2759Specifies the security model to be used for this export path.
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302760Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302761In "passthrough" security model, files are stored using the same
Stefan Weilb65ee4f2012-05-11 22:25:50 +02002762credentials as they are created on the guest. This requires QEMU
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302763to run as root. In "mapped-xattr" security model, some of the file
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302764attributes like uid, gid, mode bits and link target are stored as
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302765file attributes. For "mapped-file" these attributes are stored in the
2766hidden .virtfs_metadata directory. Directories exported by this security model cannot
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302767interact with other unix tools. "none" security model is same as
2768passthrough except the sever won't report failures if it fails to
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302769set file attributes like ownership. Security model is mandatory only
Greg Kurz93aee842018-12-12 14:18:10 +01002770for local fsdriver. Other fsdrivers (like proxy) don't take security
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302771model as a parameter.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302772@item writeout=@var{writeout}
2773This is an optional argument. The only supported value is "immediate".
2774This means that host page cache will be used to read and write data but
2775write notification will be sent to the guest only when the data has been
2776reported as written by the storage subsystem.
M. Mohan Kumar2c74c2c2011-10-25 12:10:39 +05302777@item readonly
2778Enables exporting 9p share as a readonly mount for guests. By default
2779read-write access is given.
M. Mohan Kumar84a87cc2011-12-14 13:58:47 +05302780@item socket=@var{socket}
2781Enables proxy filesystem driver to use passed socket file for
Greg Kurzb44a6b02019-05-17 17:34:49 +02002782communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2783will create socketpair and pass one of the fds as sock_fd.
M. Mohan Kumarf67e3ff2011-12-14 13:58:46 +05302784@item sock_fd
2785Enables proxy filesystem driver to use passed 'sock_fd' as the socket
Greg Kurzb44a6b02019-05-17 17:34:49 +02002786descriptor for interfacing with virtfs-proxy-helper(1).
Tobias Schrammb96feb22017-06-29 15:11:50 +02002787@item fmode=@var{fmode}
2788Specifies the default mode for newly created files on the host. Works only
2789with security models "mapped-xattr" and "mapped-file".
2790@item dmode=@var{dmode}
2791Specifies the default mode for newly created directories on the host. Works
2792only with security models "mapped-xattr" and "mapped-file".
Greg Kurzb44a6b02019-05-17 17:34:49 +02002793@item mount_tag=@var{mount_tag}
2794Specifies the tag name to be used by the guest to mount this export point.
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002795@item multidevs=@var{multidevs}
2796Specifies how to deal with multiple devices being shared with a 9p export.
2797Supported behaviours are either "remap", "forbid" or "warn". The latter is
2798the default behaviour on which virtfs 9p expects only one device to be
2799shared with the same export, and if more than one device is shared and
2800accessed via the same 9p export then only a warning message is logged
2801(once) by qemu on host side. In order to avoid file ID collisions on guest
2802you should either create a separate virtfs export for each device to be
2803shared with guests (recommended way) or you might use "remap" instead which
2804allows you to share multiple devices with only one export instead, which is
2805achieved by remapping the original inode numbers from host to guest in a
2806way that would prevent such collisions. Remapping inodes in such use cases
2807is required because the original device IDs from host are never passed and
2808exposed on guest. Instead all files of an export shared with virtfs always
2809share the same device id on guest. So two files with identical inode
2810numbers but from actually different devices on host would otherwise cause a
2811file ID collision and hence potential misbehaviours on guest. "forbid" on
2812the other hand assumes like "warn" that only one device is shared by the
2813same export, however it will not only log a warning message but also
2814deny access to additional devices on guest. Note though that "forbid" does
2815currently not block all possible file access operations (e.g. readdir()
2816would still return entries from other devices).
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302817@end table
2818ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002819SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00002820``-virtfs local,path=path,mount_tag=mount_tag ,security_model=security_model[,writeout=writeout][,readonly] [,fmode=fmode][,dmode=dmode][,multidevs=multidevs]``
2821 \
2822``-virtfs proxy,socket=socket,mount_tag=mount_tag [,writeout=writeout][,readonly]``
2823 \
2824``-virtfs proxy,sock_fd=sock_fd,mount_tag=mount_tag [,writeout=writeout][,readonly]``
2825 \
2826``-virtfs synth,mount_tag=mount_tag``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002827 Define a new filesystem device and expose it to the guest using a
2828 virtio-9p-device. The general form of a Virtual File system
2829 pass-through options are:
2830
2831 ``local``
2832 Accesses to the filesystem are done by QEMU.
2833
2834 ``proxy``
2835 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2836
2837 ``synth``
2838 Synthetic filesystem, only used by QTests.
2839
2840 ``id=id``
2841 Specifies identifier for the filesystem device
2842
2843 ``path=path``
2844 Specifies the export path for the file system device. Files
2845 under this path will be available to the 9p client on the guest.
2846
2847 ``security_model=security_model``
2848 Specifies the security model to be used for this export path.
2849 Supported security models are "passthrough", "mapped-xattr",
2850 "mapped-file" and "none". In "passthrough" security model, files
2851 are stored using the same credentials as they are created on the
2852 guest. This requires QEMU to run as root. In "mapped-xattr"
2853 security model, some of the file attributes like uid, gid, mode
2854 bits and link target are stored as file attributes. For
2855 "mapped-file" these attributes are stored in the hidden
2856 .virtfs\_metadata directory. Directories exported by this
2857 security model cannot interact with other unix tools. "none"
2858 security model is same as passthrough except the sever won't
2859 report failures if it fails to set file attributes like
2860 ownership. Security model is mandatory only for local fsdriver.
2861 Other fsdrivers (like proxy) don't take security model as a
2862 parameter.
2863
2864 ``writeout=writeout``
2865 This is an optional argument. The only supported value is
2866 "immediate". This means that host page cache will be used to
2867 read and write data but write notification will be sent to the
2868 guest only when the data has been reported as written by the
2869 storage subsystem.
2870
2871 ``readonly``
2872 Enables exporting 9p share as a readonly mount for guests. By
2873 default read-write access is given.
2874
2875 ``socket=socket``
2876 Enables proxy filesystem driver to use passed socket file for
2877 communicating with virtfs-proxy-helper(1). Usually a helper like
2878 libvirt will create socketpair and pass one of the fds as
2879 sock\_fd.
2880
2881 ``sock_fd``
2882 Enables proxy filesystem driver to use passed 'sock\_fd' as the
2883 socket descriptor for interfacing with virtfs-proxy-helper(1).
2884
2885 ``fmode=fmode``
2886 Specifies the default mode for newly created files on the host.
2887 Works only with security models "mapped-xattr" and
2888 "mapped-file".
2889
2890 ``dmode=dmode``
2891 Specifies the default mode for newly created directories on the
2892 host. Works only with security models "mapped-xattr" and
2893 "mapped-file".
2894
2895 ``mount_tag=mount_tag``
2896 Specifies the tag name to be used by the guest to mount this
2897 export point.
2898
2899 ``multidevs=multidevs``
2900 Specifies how to deal with multiple devices being shared with a
2901 9p export. Supported behaviours are either "remap", "forbid" or
2902 "warn". The latter is the default behaviour on which virtfs 9p
2903 expects only one device to be shared with the same export, and
2904 if more than one device is shared and accessed via the same 9p
2905 export then only a warning message is logged (once) by qemu on
2906 host side. In order to avoid file ID collisions on guest you
2907 should either create a separate virtfs export for each device to
2908 be shared with guests (recommended way) or you might use "remap"
2909 instead which allows you to share multiple devices with only one
2910 export instead, which is achieved by remapping the original
2911 inode numbers from host to guest in a way that would prevent
2912 such collisions. Remapping inodes in such use cases is required
2913 because the original device IDs from host are never passed and
2914 exposed on guest. Instead all files of an export shared with
2915 virtfs always share the same device id on guest. So two files
2916 with identical inode numbers but from actually different devices
2917 on host would otherwise cause a file ID collision and hence
2918 potential misbehaviours on guest. "forbid" on the other hand
2919 assumes like "warn" that only one device is shared by the same
2920 export, however it will not only log a warning message but also
2921 deny access to additional devices on guest. Note though that
2922 "forbid" does currently not block all possible file access
2923 operations (e.g. readdir() would still return entries from other
2924 devices).
2925ERST
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302926
Markus Armbruster61d70482017-10-02 16:03:03 +02002927DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi,
2928 "-iscsi [user=user][,password=password]\n"
2929 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE\n"
2930 " [,initiator-name=initiator-iqn][,id=target-iqn]\n"
2931 " [,timeout=timeout]\n"
2932 " iSCSI session parameters\n", QEMU_ARCH_ALL)
2933
blueswir15824d652009-03-28 06:44:27 +00002934STEXI
Markus Armbruster44743142017-10-02 16:03:04 +02002935@item -iscsi
2936@findex -iscsi
2937Configure iSCSI session parameters.
2938ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002939SRST
2940``-iscsi``
2941 Configure iSCSI session parameters.
2942ERST
Markus Armbruster44743142017-10-02 16:03:04 +02002943
2944STEXI
blueswir15824d652009-03-28 06:44:27 +00002945@end table
2946ETEXI
blueswir15824d652009-03-28 06:44:27 +00002947DEFHEADING()
2948
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002949DEFHEADING(USB options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002950STEXI
2951@table @option
2952ETEXI
2953
2954DEF("usb", 0, QEMU_OPTION_usb,
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01002955 "-usb enable on-board USB host controller (if not enabled by default)\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002956 QEMU_ARCH_ALL)
2957STEXI
2958@item -usb
2959@findex -usb
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01002960Enable USB emulation on machine types with an on-board USB host controller (if
2961not enabled by default). Note that on-board USB host controllers may not
2962support USB 3.0. In this case @option{-device qemu-xhci} can be used instead
2963on machines with PCI.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002964ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002965SRST
2966``-usb``
2967 Enable USB emulation on machine types with an on-board USB host
2968 controller (if not enabled by default). Note that on-board USB host
2969 controllers may not support USB 3.0. In this case
2970 ``-device qemu-xhci`` can be used instead on machines with PCI.
2971ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002972
2973DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
2974 "-usbdevice name add the host or guest USB device 'name'\n",
2975 QEMU_ARCH_ALL)
2976STEXI
2977
2978@item -usbdevice @var{devname}
2979@findex -usbdevice
Thomas Hutha358a3a2017-05-19 08:35:16 +02002980Add the USB device @var{devname}. Note that this option is deprecated,
2981please use @code{-device usb-...} instead. @xref{usb_devices}.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002982
2983@table @option
2984
2985@item mouse
2986Virtual Mouse. This will override the PS/2 mouse emulation when activated.
2987
2988@item tablet
2989Pointer device that uses absolute coordinates (like a touchscreen). This
2990means QEMU is able to report the mouse position without having to grab the
2991mouse. Also overrides the PS/2 mouse emulation when activated.
2992
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002993@item braille
2994Braille device. This will use BrlAPI to display the braille output on a real
2995or fake device.
2996
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002997@end table
2998ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002999SRST
3000``-usbdevice devname``
3001 Add the USB device devname. Note that this option is deprecated,
3002 please use ``-device usb-...`` instead. See
3003 :ref:`usb_005fdevices`.
3004
3005 ``mouse``
3006 Virtual Mouse. This will override the PS/2 mouse emulation when
3007 activated.
3008
3009 ``tablet``
3010 Pointer device that uses absolute coordinates (like a
3011 touchscreen). This means QEMU is able to report the mouse
3012 position without having to grab the mouse. Also overrides the
3013 PS/2 mouse emulation when activated.
3014
3015 ``braille``
3016 Braille device. This will use BrlAPI to display the braille
3017 output on a real or fake device.
3018ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01003019
3020STEXI
3021@end table
3022ETEXI
3023DEFHEADING()
3024
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003025DEFHEADING(Display options:)
blueswir15824d652009-03-28 06:44:27 +00003026STEXI
3027@table @option
3028ETEXI
3029
Jes Sorensen1472a952011-03-16 13:33:31 +01003030DEF("display", HAS_ARG, QEMU_OPTION_display,
Thomas Huth88b40c62019-10-23 14:01:28 +02003031#if defined(CONFIG_SPICE)
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01003032 "-display spice-app[,gl=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02003033#endif
3034#if defined(CONFIG_SDL)
3035 "-display sdl[,alt_grab=on|off][,ctrl_grab=on|off]\n"
Elie Tournier4867e472018-04-13 14:58:42 +01003036 " [,window_close=on|off][,gl=on|core|es|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02003037#endif
Robert Hof04ec5a2016-07-26 18:17:11 +08003038#if defined(CONFIG_GTK)
Thomas Huth88b40c62019-10-23 14:01:28 +02003039 "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
3040#endif
3041#if defined(CONFIG_VNC)
3042 "-display vnc=<display>[,<optargs>]\n"
3043#endif
3044#if defined(CONFIG_CURSES)
3045 "-display curses[,charset=<encoding>]\n"
3046#endif
3047#if defined(CONFIG_OPENGL)
3048 "-display egl-headless[,rendernode=<file>]\n"
3049#endif
3050 "-display none\n"
3051 " select display backend type\n"
3052 " The default display is equivalent to\n "
3053#if defined(CONFIG_GTK)
3054 "\"-display gtk\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003055#elif defined(CONFIG_SDL)
Thomas Huth88b40c62019-10-23 14:01:28 +02003056 "\"-display sdl\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003057#elif defined(CONFIG_COCOA)
Thomas Huth88b40c62019-10-23 14:01:28 +02003058 "\"-display cocoa\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003059#elif defined(CONFIG_VNC)
Thomas Huth88b40c62019-10-23 14:01:28 +02003060 "\"-vnc localhost:0,to=99,id=default\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003061#else
Thomas Huth88b40c62019-10-23 14:01:28 +02003062 "\"-display none\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003063#endif
3064 , QEMU_ARCH_ALL)
Jes Sorensen1472a952011-03-16 13:33:31 +01003065STEXI
3066@item -display @var{type}
3067@findex -display
3068Select type of display to use. This option is a replacement for the
Thomas Huthc388f402020-01-08 15:47:02 +01003069old style -sdl/-curses/... options. Use @code{-display help} to list
3070the available display types. Valid values for @var{type} are
Jes Sorensen1472a952011-03-16 13:33:31 +01003071@table @option
3072@item sdl
3073Display video output via SDL (usually in a separate graphics
3074window; see the SDL documentation for other possibilities).
3075@item curses
3076Display video output via curses. For graphics device models which
3077support a text mode, QEMU can display this output using a
3078curses/ncurses interface. Nothing is displayed when the graphics
3079device is in graphical mode or if the graphics device does not support
3080a text mode. Generally only the VGA device models support text mode.
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003081The font charset used by the guest can be specified with the
3082@code{charset} option, for example @code{charset=CP850} for IBM CP850
3083encoding. The default is @code{CP437}.
Jes Sorensen4171d322011-03-16 13:33:32 +01003084@item none
3085Do not display video output. The guest will still see an emulated
3086graphics card, but its output will not be displayed to the QEMU
3087user. This option differs from the -nographic option in that it
3088only affects what is done with video output; -nographic also changes
3089the destination of the serial and parallel port data.
Jan Kiszka881249c2014-03-12 08:33:50 +01003090@item gtk
3091Display video output in a GTK window. This interface provides drop-down
3092menus and other UI elements to configure and control the VM during
3093runtime.
Jes Sorensen3264ff12011-03-16 13:33:33 +01003094@item vnc
3095Start a VNC server on display <arg>
Erik Skultety144aaa92018-11-16 11:14:44 +01003096@item egl-headless
3097Offload all OpenGL operations to a local DRI device. For any graphical display,
3098this display needs to be paired with either VNC or SPICE displays.
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01003099@item spice-app
3100Start QEMU as a Spice server and launch the default Spice client
3101application. The Spice server will redirect the serial consoles and
3102QEMU monitors. (Since 4.0)
Jes Sorensen1472a952011-03-16 13:33:31 +01003103@end table
3104ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003105SRST
3106``-display type``
3107 Select type of display to use. This option is a replacement for the
3108 old style -sdl/-curses/... options. Use ``-display help`` to list
3109 the available display types. Valid values for type are
3110
3111 ``sdl``
3112 Display video output via SDL (usually in a separate graphics
3113 window; see the SDL documentation for other possibilities).
3114
3115 ``curses``
3116 Display video output via curses. For graphics device models
3117 which support a text mode, QEMU can display this output using a
3118 curses/ncurses interface. Nothing is displayed when the graphics
3119 device is in graphical mode or if the graphics device does not
3120 support a text mode. Generally only the VGA device models
3121 support text mode. The font charset used by the guest can be
3122 specified with the ``charset`` option, for example
3123 ``charset=CP850`` for IBM CP850 encoding. The default is
3124 ``CP437``.
3125
3126 ``none``
3127 Do not display video output. The guest will still see an
3128 emulated graphics card, but its output will not be displayed to
3129 the QEMU user. This option differs from the -nographic option in
3130 that it only affects what is done with video output; -nographic
3131 also changes the destination of the serial and parallel port
3132 data.
3133
3134 ``gtk``
3135 Display video output in a GTK window. This interface provides
3136 drop-down menus and other UI elements to configure and control
3137 the VM during runtime.
3138
3139 ``vnc``
3140 Start a VNC server on display <arg>
3141
3142 ``egl-headless``
3143 Offload all OpenGL operations to a local DRI device. For any
3144 graphical display, this display needs to be paired with either
3145 VNC or SPICE displays.
3146
3147 ``spice-app``
3148 Start QEMU as a Spice server and launch the default Spice client
3149 application. The Spice server will redirect the serial consoles
3150 and QEMU monitors. (Since 4.0)
3151ERST
Jes Sorensen1472a952011-03-16 13:33:31 +01003152
blueswir15824d652009-03-28 06:44:27 +00003153DEF("nographic", 0, QEMU_OPTION_nographic,
Blue Swirlad960902010-03-29 19:23:52 +00003154 "-nographic disable graphical output and redirect serial I/Os to console\n",
3155 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003156STEXI
3157@item -nographic
Stefan Weil6616b2a2010-02-05 23:52:05 +01003158@findex -nographic
Colin Lorddc0a3e42016-08-12 15:30:48 -04003159Normally, if QEMU is compiled with graphical window support, it displays
3160output such as guest graphics, guest console, and the QEMU monitor in a
3161window. With this option, you can totally disable graphical output so
3162that QEMU is a simple command line application. The emulated serial port
3163is redirected on the console and muxed with the monitor (unless
3164redirected elsewhere explicitly). Therefore, you can still use QEMU to
3165debug a Linux kernel with a serial console. Use @key{C-a h} for help on
3166switching between the console and monitor.
blueswir15824d652009-03-28 06:44:27 +00003167ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003168SRST
3169``-nographic``
3170 Normally, if QEMU is compiled with graphical window support, it
3171 displays output such as guest graphics, guest console, and the QEMU
3172 monitor in a window. With this option, you can totally disable
3173 graphical output so that QEMU is a simple command line application.
3174 The emulated serial port is redirected on the console and muxed with
3175 the monitor (unless redirected elsewhere explicitly). Therefore, you
3176 can still use QEMU to debug a Linux kernel with a serial console.
3177 Use C-a h for help on switching between the console and monitor.
3178ERST
blueswir15824d652009-03-28 06:44:27 +00003179
blueswir15824d652009-03-28 06:44:27 +00003180DEF("curses", 0, QEMU_OPTION_curses,
Robert Hof04ec5a2016-07-26 18:17:11 +08003181 "-curses shorthand for -display curses\n",
Blue Swirlad960902010-03-29 19:23:52 +00003182 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003183STEXI
3184@item -curses
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01003185@findex -curses
Colin Lorddc0a3e42016-08-12 15:30:48 -04003186Normally, if QEMU is compiled with graphical window support, it displays
3187output such as guest graphics, guest console, and the QEMU monitor in a
3188window. With this option, QEMU can display the VGA output when in text
3189mode using a curses/ncurses interface. Nothing is displayed in graphical
3190mode.
blueswir15824d652009-03-28 06:44:27 +00003191ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003192SRST
3193``-curses``
3194 Normally, if QEMU is compiled with graphical window support, it
3195 displays output such as guest graphics, guest console, and the QEMU
3196 monitor in a window. With this option, QEMU can display the VGA
3197 output when in text mode using a curses/ncurses interface. Nothing
3198 is displayed in graphical mode.
3199ERST
blueswir15824d652009-03-28 06:44:27 +00003200
blueswir15824d652009-03-28 06:44:27 +00003201DEF("alt-grab", 0, QEMU_OPTION_alt_grab,
Blue Swirlad960902010-03-29 19:23:52 +00003202 "-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n",
3203 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003204STEXI
3205@item -alt-grab
Stefan Weil6616b2a2010-02-05 23:52:05 +01003206@findex -alt-grab
Brad Hardsde1db2a2011-04-29 21:46:12 +10003207Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that this also
3208affects the special keys (for fullscreen, monitor-mode switching, etc).
blueswir15824d652009-03-28 06:44:27 +00003209ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003210SRST
3211``-alt-grab``
3212 Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that
3213 this also affects the special keys (for fullscreen, monitor-mode
3214 switching, etc).
3215ERST
blueswir15824d652009-03-28 06:44:27 +00003216
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003217DEF("ctrl-grab", 0, QEMU_OPTION_ctrl_grab,
Blue Swirlad960902010-03-29 19:23:52 +00003218 "-ctrl-grab use Right-Ctrl to grab mouse (instead of Ctrl-Alt)\n",
3219 QEMU_ARCH_ALL)
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003220STEXI
3221@item -ctrl-grab
Stefan Weil6616b2a2010-02-05 23:52:05 +01003222@findex -ctrl-grab
Brad Hardsde1db2a2011-04-29 21:46:12 +10003223Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this also
3224affects the special keys (for fullscreen, monitor-mode switching, etc).
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003225ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003226SRST
3227``-ctrl-grab``
3228 Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this
3229 also affects the special keys (for fullscreen, monitor-mode
3230 switching, etc).
3231ERST
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003232
blueswir15824d652009-03-28 06:44:27 +00003233DEF("no-quit", 0, QEMU_OPTION_no_quit,
Blue Swirlad960902010-03-29 19:23:52 +00003234 "-no-quit disable SDL window close capability\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003235STEXI
3236@item -no-quit
Stefan Weil6616b2a2010-02-05 23:52:05 +01003237@findex -no-quit
blueswir15824d652009-03-28 06:44:27 +00003238Disable SDL window close capability.
3239ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003240SRST
3241``-no-quit``
3242 Disable SDL window close capability.
3243ERST
blueswir15824d652009-03-28 06:44:27 +00003244
blueswir15824d652009-03-28 06:44:27 +00003245DEF("sdl", 0, QEMU_OPTION_sdl,
Robert Hof04ec5a2016-07-26 18:17:11 +08003246 "-sdl shorthand for -display sdl\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003247STEXI
3248@item -sdl
Stefan Weil6616b2a2010-02-05 23:52:05 +01003249@findex -sdl
blueswir15824d652009-03-28 06:44:27 +00003250Enable SDL.
3251ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003252SRST
3253``-sdl``
3254 Enable SDL.
3255ERST
blueswir15824d652009-03-28 06:44:27 +00003256
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003257DEF("spice", HAS_ARG, QEMU_OPTION_spice,
Yonit Halperin27af7782012-08-21 13:54:20 +03003258 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
3259 " [,x509-key-file=<file>][,x509-key-password=<file>]\n"
3260 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
Marc-André Lureaufe4831b2015-01-13 17:57:51 +01003261 " [,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6|unix]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03003262 " [,tls-ciphers=<list>]\n"
3263 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n"
3264 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n"
3265 " [,sasl][,password=<secret>][,disable-ticketing]\n"
3266 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n"
3267 " [,jpeg-wan-compression=[auto|never|always]]\n"
3268 " [,zlib-glz-wan-compression=[auto|never|always]]\n"
3269 " [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
Hans de Goede5ad24e52013-06-08 15:37:27 +02003270 " [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
3271 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
Marc-André Lureau7b525502017-02-12 15:21:18 +04003272 " [,gl=[on|off]][,rendernode=<file>]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03003273 " enable spice\n"
3274 " at least one of {port, tls-port} is mandatory\n",
3275 QEMU_ARCH_ALL)
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003276STEXI
3277@item -spice @var{option}[,@var{option}[,...]]
3278@findex -spice
3279Enable the spice remote desktop protocol. Valid options are
3280
3281@table @option
3282
3283@item port=<nr>
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003284Set the TCP port spice is listening on for plaintext channels.
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003285
Gerd Hoffmann333b0ee2010-08-27 14:29:16 +02003286@item addr=<addr>
3287Set the IP address spice is listening on. Default is any address.
3288
3289@item ipv4
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003290@itemx ipv6
3291@itemx unix
Gerd Hoffmann333b0ee2010-08-27 14:29:16 +02003292Force using the specified IP version.
3293
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003294@item password=<secret>
3295Set the password you need to authenticate.
3296
Marc-André Lureau48b3ed02011-05-17 10:40:33 +02003297@item sasl
3298Require that the client use SASL to authenticate with the spice.
3299The exact choice of authentication method used is controlled from the
3300system / user's SASL configuration file for the 'qemu' service. This
3301is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3302unprivileged user, an environment variable SASL_CONF_PATH can be used
3303to make it search alternate locations for the service config.
3304While some SASL auth methods can also provide data encryption (eg GSSAPI),
3305it is recommended that SASL always be combined with the 'tls' and
3306'x509' settings to enable use of SSL and server certificates. This
3307ensures a data encryption preventing compromise of authentication
3308credentials.
3309
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003310@item disable-ticketing
3311Allow client connects without authentication.
3312
Hans de Goeded4970b02011-03-27 16:43:54 +02003313@item disable-copy-paste
3314Disable copy paste between the client and the guest.
3315
Hans de Goede5ad24e52013-06-08 15:37:27 +02003316@item disable-agent-file-xfer
3317Disable spice-vdagent based file-xfer between the client and the guest.
3318
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003319@item tls-port=<nr>
3320Set the TCP port spice is listening on for encrypted channels.
3321
3322@item x509-dir=<dir>
3323Set the x509 file directory. Expects same filenames as -vnc $display,x509=$dir
3324
3325@item x509-key-file=<file>
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003326@itemx x509-key-password=<file>
3327@itemx x509-cert-file=<file>
3328@itemx x509-cacert-file=<file>
3329@itemx x509-dh-key-file=<file>
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003330The x509 file names can also be configured individually.
3331
3332@item tls-ciphers=<list>
3333Specify which ciphers to use.
3334
Alon Levyd70d6b32011-12-20 13:05:18 +02003335@item tls-channel=[main|display|cursor|inputs|record|playback]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003336@itemx plaintext-channel=[main|display|cursor|inputs|record|playback]
Gerd Hoffmann17b6dea2010-08-27 14:09:56 +02003337Force specific channel to be used with or without TLS encryption. The
3338options can be specified multiple times to configure multiple
3339channels. The special name "default" can be used to set the default
3340mode. For channels which are not explicitly forced into one mode the
3341spice client is allowed to pick tls/plaintext as he pleases.
3342
Yonit Halperin9f04e092010-07-14 13:26:34 +03003343@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
3344Configure image compression (lossless).
3345Default is auto_glz.
3346
3347@item jpeg-wan-compression=[auto|never|always]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003348@itemx zlib-glz-wan-compression=[auto|never|always]
Yonit Halperin9f04e092010-07-14 13:26:34 +03003349Configure wan image compression (lossy for slow links).
3350Default is auto.
3351
Gerd Hoffmann84a23f22010-08-30 16:36:53 +02003352@item streaming-video=[off|all|filter]
Li Zhijian93ca5192016-08-01 12:06:59 +08003353Configure video stream detection. Default is off.
Gerd Hoffmann84a23f22010-08-30 16:36:53 +02003354
3355@item agent-mouse=[on|off]
3356Enable/disable passing mouse events via vdagent. Default is on.
3357
3358@item playback-compression=[on|off]
3359Enable/disable audio stream compression (using celt 0.5.1). Default is on.
3360
Yonit Halperin8c957052012-08-21 11:51:59 +03003361@item seamless-migration=[on|off]
3362Enable/disable spice seamless migration. Default is off.
3363
Gerd Hoffmann474114b2015-10-13 15:39:34 +02003364@item gl=[on|off]
3365Enable/disable OpenGL context. Default is off.
3366
Marc-André Lureau7b525502017-02-12 15:21:18 +04003367@item rendernode=<file>
3368DRM render node for OpenGL rendering. If not specified, it will pick
3369the first available. (Since 2.9)
3370
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003371@end table
3372ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003373SRST
3374``-spice option[,option[,...]]``
3375 Enable the spice remote desktop protocol. Valid options are
3376
3377 ``port=<nr>``
3378 Set the TCP port spice is listening on for plaintext channels.
3379
3380 ``addr=<addr>``
3381 Set the IP address spice is listening on. Default is any
3382 address.
3383
3384 ``ipv4``; \ ``ipv6``; \ ``unix``
3385 Force using the specified IP version.
3386
3387 ``password=<secret>``
3388 Set the password you need to authenticate.
3389
3390 ``sasl``
3391 Require that the client use SASL to authenticate with the spice.
3392 The exact choice of authentication method used is controlled
3393 from the system / user's SASL configuration file for the 'qemu'
3394 service. This is typically found in /etc/sasl2/qemu.conf. If
3395 running QEMU as an unprivileged user, an environment variable
3396 SASL\_CONF\_PATH can be used to make it search alternate
3397 locations for the service config. While some SASL auth methods
3398 can also provide data encryption (eg GSSAPI), it is recommended
3399 that SASL always be combined with the 'tls' and 'x509' settings
3400 to enable use of SSL and server certificates. This ensures a
3401 data encryption preventing compromise of authentication
3402 credentials.
3403
3404 ``disable-ticketing``
3405 Allow client connects without authentication.
3406
3407 ``disable-copy-paste``
3408 Disable copy paste between the client and the guest.
3409
3410 ``disable-agent-file-xfer``
3411 Disable spice-vdagent based file-xfer between the client and the
3412 guest.
3413
3414 ``tls-port=<nr>``
3415 Set the TCP port spice is listening on for encrypted channels.
3416
3417 ``x509-dir=<dir>``
3418 Set the x509 file directory. Expects same filenames as -vnc
3419 $display,x509=$dir
3420
3421 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>``
3422 The x509 file names can also be configured individually.
3423
3424 ``tls-ciphers=<list>``
3425 Specify which ciphers to use.
3426
3427 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]``
3428 Force specific channel to be used with or without TLS
3429 encryption. The options can be specified multiple times to
3430 configure multiple channels. The special name "default" can be
3431 used to set the default mode. For channels which are not
3432 explicitly forced into one mode the spice client is allowed to
3433 pick tls/plaintext as he pleases.
3434
3435 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]``
3436 Configure image compression (lossless). Default is auto\_glz.
3437
3438 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]``
3439 Configure wan image compression (lossy for slow links). Default
3440 is auto.
3441
3442 ``streaming-video=[off|all|filter]``
3443 Configure video stream detection. Default is off.
3444
3445 ``agent-mouse=[on|off]``
3446 Enable/disable passing mouse events via vdagent. Default is on.
3447
3448 ``playback-compression=[on|off]``
3449 Enable/disable audio stream compression (using celt 0.5.1).
3450 Default is on.
3451
3452 ``seamless-migration=[on|off]``
3453 Enable/disable spice seamless migration. Default is off.
3454
3455 ``gl=[on|off]``
3456 Enable/disable OpenGL context. Default is off.
3457
3458 ``rendernode=<file>``
3459 DRM render node for OpenGL rendering. If not specified, it will
3460 pick the first available. (Since 2.9)
3461ERST
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003462
blueswir15824d652009-03-28 06:44:27 +00003463DEF("portrait", 0, QEMU_OPTION_portrait,
Blue Swirlad960902010-03-29 19:23:52 +00003464 "-portrait rotate graphical output 90 deg left (only PXA LCD)\n",
3465 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003466STEXI
3467@item -portrait
Stefan Weil6616b2a2010-02-05 23:52:05 +01003468@findex -portrait
blueswir15824d652009-03-28 06:44:27 +00003469Rotate graphical output 90 deg left (only PXA LCD).
3470ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003471SRST
3472``-portrait``
3473 Rotate graphical output 90 deg left (only PXA LCD).
3474ERST
blueswir15824d652009-03-28 06:44:27 +00003475
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003476DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
3477 "-rotate <deg> rotate graphical output some deg left (only PXA LCD)\n",
3478 QEMU_ARCH_ALL)
3479STEXI
Markus Armbruster6265c432013-02-13 19:49:39 +01003480@item -rotate @var{deg}
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003481@findex -rotate
3482Rotate graphical output some deg left (only PXA LCD).
3483ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003484SRST
3485``-rotate deg``
3486 Rotate graphical output some deg left (only PXA LCD).
3487ERST
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003488
blueswir15824d652009-03-28 06:44:27 +00003489DEF("vga", HAS_ARG, QEMU_OPTION_vga,
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02003490 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
Blue Swirlad960902010-03-29 19:23:52 +00003491 " select video card type\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003492STEXI
malce4558dc2012-08-27 18:33:21 +04003493@item -vga @var{type}
Stefan Weil6616b2a2010-02-05 23:52:05 +01003494@findex -vga
blueswir15824d652009-03-28 06:44:27 +00003495Select type of VGA card to emulate. Valid values for @var{type} are
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003496@table @option
blueswir15824d652009-03-28 06:44:27 +00003497@item cirrus
3498Cirrus Logic GD5446 Video card. All Windows versions starting from
3499Windows 95 should recognize and use this graphic card. For optimal
3500performances, use 16 bit color depth in the guest and the host OS.
Alberto Garcia41eeb0e2017-01-27 11:41:54 +02003501(This card was the default before QEMU 2.2)
blueswir15824d652009-03-28 06:44:27 +00003502@item std
3503Standard VGA card with Bochs VBE extensions. If your guest OS
3504supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if you want
3505to use high resolution modes (>= 1280x1024x16) then you should use
Alberto Garcia41eeb0e2017-01-27 11:41:54 +02003506this option. (This card is the default since QEMU 2.2)
blueswir15824d652009-03-28 06:44:27 +00003507@item vmware
3508VMWare SVGA-II compatible adapter. Use it if you have sufficiently
3509recent XFree86/XOrg server or Windows guest with a driver for this
3510card.
Gerd Hoffmanna19cbfb2010-04-27 11:50:11 +02003511@item qxl
3512QXL paravirtual graphic card. It is VGA compatible (including VESA
35132.0 VBE support). Works best with qxl guest drivers installed though.
3514Recommended choice when using the spice protocol.
Mark Cave-Ayland33632782014-03-17 21:46:25 +00003515@item tcx
3516(sun4m only) Sun TCX framebuffer. This is the default framebuffer for
3517sun4m machines and offers both 8-bit and 24-bit colour depths at a
3518fixed resolution of 1024x768.
3519@item cg3
3520(sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
3521for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
3522resolutions aimed at people wishing to run older Solaris versions.
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02003523@item virtio
3524Virtio VGA card.
blueswir15824d652009-03-28 06:44:27 +00003525@item none
3526Disable VGA card.
3527@end table
3528ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003529SRST
3530``-vga type``
3531 Select type of VGA card to emulate. Valid values for type are
3532
3533 ``cirrus``
3534 Cirrus Logic GD5446 Video card. All Windows versions starting
3535 from Windows 95 should recognize and use this graphic card. For
3536 optimal performances, use 16 bit color depth in the guest and
3537 the host OS. (This card was the default before QEMU 2.2)
3538
3539 ``std``
3540 Standard VGA card with Bochs VBE extensions. If your guest OS
3541 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
3542 you want to use high resolution modes (>= 1280x1024x16) then you
3543 should use this option. (This card is the default since QEMU
3544 2.2)
3545
3546 ``vmware``
3547 VMWare SVGA-II compatible adapter. Use it if you have
3548 sufficiently recent XFree86/XOrg server or Windows guest with a
3549 driver for this card.
3550
3551 ``qxl``
3552 QXL paravirtual graphic card. It is VGA compatible (including
3553 VESA 2.0 VBE support). Works best with qxl guest drivers
3554 installed though. Recommended choice when using the spice
3555 protocol.
3556
3557 ``tcx``
3558 (sun4m only) Sun TCX framebuffer. This is the default
3559 framebuffer for sun4m machines and offers both 8-bit and 24-bit
3560 colour depths at a fixed resolution of 1024x768.
3561
3562 ``cg3``
3563 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
3564 framebuffer for sun4m machines available in both 1024x768
3565 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
3566 wishing to run older Solaris versions.
3567
3568 ``virtio``
3569 Virtio VGA card.
3570
3571 ``none``
3572 Disable VGA card.
3573ERST
blueswir15824d652009-03-28 06:44:27 +00003574
3575DEF("full-screen", 0, QEMU_OPTION_full_screen,
Blue Swirlad960902010-03-29 19:23:52 +00003576 "-full-screen start in full screen\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003577STEXI
3578@item -full-screen
Stefan Weil6616b2a2010-02-05 23:52:05 +01003579@findex -full-screen
blueswir15824d652009-03-28 06:44:27 +00003580Start in full screen.
3581ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003582SRST
3583``-full-screen``
3584 Start in full screen.
3585ERST
blueswir15824d652009-03-28 06:44:27 +00003586
John Snow60f9a4e2020-02-04 11:56:38 -05003587DEF("g", HAS_ARG, QEMU_OPTION_g ,
Blue Swirlad960902010-03-29 19:23:52 +00003588 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
Laurent Vivier8ac919a2019-10-26 18:45:43 +02003589 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
blueswir15824d652009-03-28 06:44:27 +00003590STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01003591@item -g @var{width}x@var{height}[x@var{depth}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01003592@findex -g
Stefan Weil95d5f082010-01-20 22:25:27 +01003593Set the initial graphical resolution and depth (PPC, SPARC only).
Peter Maydell196afbb2020-02-28 15:36:10 +00003594
3595For PPC the default is 800x600x32.
3596
3597For SPARC with the TCX graphics device, the default is 1024x768x8 with the
3598option of 1024x768x24. For cgthree, the default is 1024x768x8 with the option
3599of 1152x900x8 for people who wish to use OBP.
3600
blueswir15824d652009-03-28 06:44:27 +00003601ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003602SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00003603``-g`` *width*\ ``x``\ *height*\ ``[x``\ *depth*\ ``]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003604 Set the initial graphical resolution and depth (PPC, SPARC only).
3605
3606 For PPC the default is 800x600x32.
3607
3608 For SPARC with the TCX graphics device, the default is 1024x768x8
3609 with the option of 1024x768x24. For cgthree, the default is
3610 1024x768x8 with the option of 1152x900x8 for people who wish to use
3611 OBP.
3612ERST
blueswir15824d652009-03-28 06:44:27 +00003613
3614DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
Robert Hof04ec5a2016-07-26 18:17:11 +08003615 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003616STEXI
3617@item -vnc @var{display}[,@var{option}[,@var{option}[,...]]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01003618@findex -vnc
Colin Lorddc0a3e42016-08-12 15:30:48 -04003619Normally, if QEMU is compiled with graphical window support, it displays
3620output such as guest graphics, guest console, and the QEMU monitor in a
3621window. With this option, you can have QEMU listen on VNC display
3622@var{display} and redirect the VGA display over the VNC session. It is
3623very useful to enable the usb tablet device when using this option
Thomas Hutha358a3a2017-05-19 08:35:16 +02003624(option @option{-device usb-tablet}). When using the VNC display, you
Colin Lorddc0a3e42016-08-12 15:30:48 -04003625must use the @option{-k} parameter to set the keyboard layout if you are
3626not using en-us. Valid syntax for the @var{display} is
blueswir15824d652009-03-28 06:44:27 +00003627
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003628@table @option
blueswir15824d652009-03-28 06:44:27 +00003629
Robert Ho99a9a522016-05-31 15:03:09 +08003630@item to=@var{L}
3631
3632With this option, QEMU will try next available VNC @var{display}s, until the
3633number @var{L}, if the origianlly defined "-vnc @var{display}" is not
3634available, e.g. port 5900+@var{display} is already used by another
3635application. By default, to=0.
3636
blueswir15824d652009-03-28 06:44:27 +00003637@item @var{host}:@var{d}
3638
3639TCP connections will only be allowed from @var{host} on display @var{d}.
3640By convention the TCP port is 5900+@var{d}. Optionally, @var{host} can
3641be omitted in which case the server will accept connections from any host.
3642
Kevin Wolf4e257e52009-10-09 10:58:36 +02003643@item unix:@var{path}
blueswir15824d652009-03-28 06:44:27 +00003644
3645Connections will be allowed over UNIX domain sockets where @var{path} is the
3646location of a unix socket to listen for connections on.
3647
3648@item none
3649
3650VNC is initialized but not started. The monitor @code{change} command
3651can be used to later start the VNC server.
3652
3653@end table
3654
3655Following the @var{display} value there may be one or more @var{option} flags
3656separated by commas. Valid options are
3657
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003658@table @option
blueswir15824d652009-03-28 06:44:27 +00003659
3660@item reverse
3661
3662Connect to a listening VNC client via a ``reverse'' connection. The
3663client is specified by the @var{display}. For reverse network
3664connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument
3665is a TCP port number, not a display number.
3666
Tim Hardeck7536ee42013-01-21 11:04:44 +01003667@item websocket
3668
3669Opens an additional TCP listening port dedicated to VNC Websocket connections.
Daniel P. Berrange275e0d62017-02-03 12:06:45 +00003670If a bare @var{websocket} option is given, the Websocket port is
36715700+@var{display}. An alternative port can be specified with the
3672syntax @code{websocket}=@var{port}.
3673
3674If @var{host} is specified connections will only be allowed from this host.
3675It is possible to control the websocket listen address independently, using
3676the syntax @code{websocket}=@var{host}:@var{port}.
3677
Daniel P. Berrange3e305e42015-08-06 14:39:32 +01003678If no TLS credentials are provided, the websocket connection runs in
3679unencrypted mode. If TLS credentials are provided, the websocket connection
3680requires encrypted client connections.
Tim Hardeck7536ee42013-01-21 11:04:44 +01003681
blueswir15824d652009-03-28 06:44:27 +00003682@item password
3683
3684Require that password based authentication is used for client connections.
Michal Novotny86ee5bc2012-07-16 15:54:38 +02003685
3686The password must be set separately using the @code{set_password} command in
3687the @ref{pcsys_monitor}. The syntax to change your password is:
3688@code{set_password <protocol> <password>} where <protocol> could be either
3689"vnc" or "spice".
3690
3691If you would like to change <protocol> password expiration, you should use
3692@code{expire_password <protocol> <expiration-time>} where expiration time could
3693be one of the following options: now, never, +seconds or UNIX time of
3694expiration, e.g. +60 to make password expire in 60 seconds, or 1335196800
3695to make password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for this
3696date and time).
3697
3698You can also use keywords "now" or "never" for the expiration time to
3699allow <protocol> password to expire immediately or never expire.
blueswir15824d652009-03-28 06:44:27 +00003700
Daniel P. Berrange3e305e42015-08-06 14:39:32 +01003701@item tls-creds=@var{ID}
3702
3703Provides the ID of a set of TLS credentials to use to secure the
3704VNC server. They will apply to both the normal VNC server socket
3705and the websocket socket (if enabled). Setting TLS credentials
3706will cause the VNC server socket to enable the VeNCrypt auth
3707mechanism. The credentials should have been previously created
3708using the @option{-object tls-creds} argument.
3709
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003710@item tls-authz=@var{ID}
3711
3712Provides the ID of the QAuthZ authorization object against which
3713the client's x509 distinguished name will validated. This object is
3714only resolved at time of use, so can be deleted and recreated on the
3715fly while the VNC server is active. If missing, it will default
3716to denying access.
3717
blueswir15824d652009-03-28 06:44:27 +00003718@item sasl
3719
3720Require that the client use SASL to authenticate with the VNC server.
3721The exact choice of authentication method used is controlled from the
3722system / user's SASL configuration file for the 'qemu' service. This
3723is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3724unprivileged user, an environment variable SASL_CONF_PATH can be used
3725to make it search alternate locations for the service config.
3726While some SASL auth methods can also provide data encryption (eg GSSAPI),
3727it is recommended that SASL always be combined with the 'tls' and
3728'x509' settings to enable use of SSL and server certificates. This
3729ensures a data encryption preventing compromise of authentication
3730credentials. See the @ref{vnc_security} section for details on using
3731SASL authentication.
3732
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003733@item sasl-authz=@var{ID}
3734
3735Provides the ID of the QAuthZ authorization object against which
3736the client's SASL username will validated. This object is
3737only resolved at time of use, so can be deleted and recreated on the
3738fly while the VNC server is active. If missing, it will default
3739to denying access.
3740
blueswir15824d652009-03-28 06:44:27 +00003741@item acl
3742
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003743Legacy method for enabling authorization of clients against the
3744x509 distinguished name and SASL username. It results in the creation
3745of two @code{authz-list} objects with IDs of @code{vnc.username} and
3746@code{vnc.x509dname}. The rules for these objects must be configured
3747with the HMP ACL commands.
3748
3749This option is deprecated and should no longer be used. The new
3750@option{sasl-authz} and @option{tls-authz} options are a
3751replacement.
blueswir15824d652009-03-28 06:44:27 +00003752
Corentin Chary6f9c78c2010-07-07 20:57:51 +02003753@item lossy
3754
3755Enable lossy compression methods (gradient, JPEG, ...). If this
3756option is set, VNC client may receive lossy framebuffer updates
3757depending on its encoding settings. Enabling this option can save
3758a lot of bandwidth at the expense of quality.
3759
Corentin Chary80e0c8c2011-02-04 09:06:08 +01003760@item non-adaptive
3761
3762Disable adaptive encodings. Adaptive encodings are enabled by default.
3763An adaptive encoding will try to detect frequently updated screen regions,
3764and send updates in these regions using a lossy encoding (like JPEG).
Stefan Weil61cc8702011-04-13 22:45:22 +02003765This can be really helpful to save bandwidth when playing videos. Disabling
Michael Tokarev9d85d552014-04-07 13:34:58 +04003766adaptive encodings restores the original static behavior of encodings
Corentin Chary80e0c8c2011-02-04 09:06:08 +01003767like Tight.
3768
Gerd Hoffmann8cf36482011-11-24 18:10:49 +01003769@item share=[allow-exclusive|force-shared|ignore]
3770
3771Set display sharing policy. 'allow-exclusive' allows clients to ask
3772for exclusive access. As suggested by the rfb spec this is
3773implemented by dropping other connections. Connecting multiple
3774clients in parallel requires all clients asking for a shared session
3775(vncviewer: -shared switch). This is the default. 'force-shared'
3776disables exclusive client access. Useful for shared desktop sessions,
3777where you don't want someone forgetting specify -shared disconnect
3778everybody else. 'ignore' completely ignores the shared flag and
3779allows everybody connect unconditionally. Doesn't conform to the rfb
Stefan Weilb65ee4f2012-05-11 22:25:50 +02003780spec but is traditional QEMU behavior.
Gerd Hoffmann8cf36482011-11-24 18:10:49 +01003781
Gerd Hoffmannc5ce8332016-06-01 08:22:30 +02003782@item key-delay-ms
3783
3784Set keyboard delay, for key down and key up events, in milliseconds.
Alexander Grafd3b0db62017-07-12 14:43:45 +02003785Default is 10. Keyboards are low-bandwidth devices, so this slowdown
Gerd Hoffmannc5ce8332016-06-01 08:22:30 +02003786can help the device and guest to keep up and not lose events in case
3787events are arriving in bulk. Possible causes for the latter are flaky
3788network connections, or scripts for automated testing.
3789
Kővágó, Zoltánf0b9f362019-08-19 01:06:48 +02003790@item audiodev=@var{audiodev}
3791
3792Use the specified @var{audiodev} when the VNC client requests audio
3793transmission. When not using an -audiodev argument, this option must
3794be omitted, otherwise is must be present and specify a valid audiodev.
3795
blueswir15824d652009-03-28 06:44:27 +00003796@end table
3797ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003798SRST
3799``-vnc display[,option[,option[,...]]]``
3800 Normally, if QEMU is compiled with graphical window support, it
3801 displays output such as guest graphics, guest console, and the QEMU
3802 monitor in a window. With this option, you can have QEMU listen on
3803 VNC display display and redirect the VGA display over the VNC
3804 session. It is very useful to enable the usb tablet device when
3805 using this option (option ``-device usb-tablet``). When using the
3806 VNC display, you must use the ``-k`` parameter to set the keyboard
3807 layout if you are not using en-us. Valid syntax for the display is
3808
3809 ``to=L``
3810 With this option, QEMU will try next available VNC displays,
3811 until the number L, if the origianlly defined "-vnc display" is
3812 not available, e.g. port 5900+display is already used by another
3813 application. By default, to=0.
3814
3815 ``host:d``
3816 TCP connections will only be allowed from host on display d. By
3817 convention the TCP port is 5900+d. Optionally, host can be
3818 omitted in which case the server will accept connections from
3819 any host.
3820
3821 ``unix:path``
3822 Connections will be allowed over UNIX domain sockets where path
3823 is the location of a unix socket to listen for connections on.
3824
3825 ``none``
3826 VNC is initialized but not started. The monitor ``change``
3827 command can be used to later start the VNC server.
3828
3829 Following the display value there may be one or more option flags
3830 separated by commas. Valid options are
3831
3832 ``reverse``
3833 Connect to a listening VNC client via a "reverse" connection.
3834 The client is specified by the display. For reverse network
3835 connections (host:d,``reverse``), the d argument is a TCP port
3836 number, not a display number.
3837
3838 ``websocket``
3839 Opens an additional TCP listening port dedicated to VNC
3840 Websocket connections. If a bare websocket option is given, the
3841 Websocket port is 5700+display. An alternative port can be
3842 specified with the syntax ``websocket``\ =port.
3843
3844 If host is specified connections will only be allowed from this
3845 host. It is possible to control the websocket listen address
3846 independently, using the syntax ``websocket``\ =host:port.
3847
3848 If no TLS credentials are provided, the websocket connection
3849 runs in unencrypted mode. If TLS credentials are provided, the
3850 websocket connection requires encrypted client connections.
3851
3852 ``password``
3853 Require that password based authentication is used for client
3854 connections.
3855
3856 The password must be set separately using the ``set_password``
3857 command in the :ref:`pcsys_005fmonitor`. The
3858 syntax to change your password is:
3859 ``set_password <protocol> <password>`` where <protocol> could be
3860 either "vnc" or "spice".
3861
3862 If you would like to change <protocol> password expiration, you
3863 should use ``expire_password <protocol> <expiration-time>``
3864 where expiration time could be one of the following options:
3865 now, never, +seconds or UNIX time of expiration, e.g. +60 to
3866 make password expire in 60 seconds, or 1335196800 to make
3867 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for
3868 this date and time).
3869
3870 You can also use keywords "now" or "never" for the expiration
3871 time to allow <protocol> password to expire immediately or never
3872 expire.
3873
3874 ``tls-creds=ID``
3875 Provides the ID of a set of TLS credentials to use to secure the
3876 VNC server. They will apply to both the normal VNC server socket
3877 and the websocket socket (if enabled). Setting TLS credentials
3878 will cause the VNC server socket to enable the VeNCrypt auth
3879 mechanism. The credentials should have been previously created
3880 using the ``-object tls-creds`` argument.
3881
3882 ``tls-authz=ID``
3883 Provides the ID of the QAuthZ authorization object against which
3884 the client's x509 distinguished name will validated. This object
3885 is only resolved at time of use, so can be deleted and recreated
3886 on the fly while the VNC server is active. If missing, it will
3887 default to denying access.
3888
3889 ``sasl``
3890 Require that the client use SASL to authenticate with the VNC
3891 server. The exact choice of authentication method used is
3892 controlled from the system / user's SASL configuration file for
3893 the 'qemu' service. This is typically found in
3894 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user,
3895 an environment variable SASL\_CONF\_PATH can be used to make it
3896 search alternate locations for the service config. While some
3897 SASL auth methods can also provide data encryption (eg GSSAPI),
3898 it is recommended that SASL always be combined with the 'tls'
3899 and 'x509' settings to enable use of SSL and server
3900 certificates. This ensures a data encryption preventing
3901 compromise of authentication credentials. See the
3902 :ref:`vnc_005fsecurity` section for details on
3903 using SASL authentication.
3904
3905 ``sasl-authz=ID``
3906 Provides the ID of the QAuthZ authorization object against which
3907 the client's SASL username will validated. This object is only
3908 resolved at time of use, so can be deleted and recreated on the
3909 fly while the VNC server is active. If missing, it will default
3910 to denying access.
3911
3912 ``acl``
3913 Legacy method for enabling authorization of clients against the
3914 x509 distinguished name and SASL username. It results in the
3915 creation of two ``authz-list`` objects with IDs of
3916 ``vnc.username`` and ``vnc.x509dname``. The rules for these
3917 objects must be configured with the HMP ACL commands.
3918
3919 This option is deprecated and should no longer be used. The new
3920 ``sasl-authz`` and ``tls-authz`` options are a replacement.
3921
3922 ``lossy``
3923 Enable lossy compression methods (gradient, JPEG, ...). If this
3924 option is set, VNC client may receive lossy framebuffer updates
3925 depending on its encoding settings. Enabling this option can
3926 save a lot of bandwidth at the expense of quality.
3927
3928 ``non-adaptive``
3929 Disable adaptive encodings. Adaptive encodings are enabled by
3930 default. An adaptive encoding will try to detect frequently
3931 updated screen regions, and send updates in these regions using
3932 a lossy encoding (like JPEG). This can be really helpful to save
3933 bandwidth when playing videos. Disabling adaptive encodings
3934 restores the original static behavior of encodings like Tight.
3935
3936 ``share=[allow-exclusive|force-shared|ignore]``
3937 Set display sharing policy. 'allow-exclusive' allows clients to
3938 ask for exclusive access. As suggested by the rfb spec this is
3939 implemented by dropping other connections. Connecting multiple
3940 clients in parallel requires all clients asking for a shared
3941 session (vncviewer: -shared switch). This is the default.
3942 'force-shared' disables exclusive client access. Useful for
3943 shared desktop sessions, where you don't want someone forgetting
3944 specify -shared disconnect everybody else. 'ignore' completely
3945 ignores the shared flag and allows everybody connect
3946 unconditionally. Doesn't conform to the rfb spec but is
3947 traditional QEMU behavior.
3948
3949 ``key-delay-ms``
3950 Set keyboard delay, for key down and key up events, in
3951 milliseconds. Default is 10. Keyboards are low-bandwidth
3952 devices, so this slowdown can help the device and guest to keep
3953 up and not lose events in case events are arriving in bulk.
3954 Possible causes for the latter are flaky network connections, or
3955 scripts for automated testing.
3956
3957 ``audiodev=audiodev``
3958 Use the specified audiodev when the VNC client requests audio
3959 transmission. When not using an -audiodev argument, this option
3960 must be omitted, otherwise is must be present and specify a
3961 valid audiodev.
3962ERST
blueswir15824d652009-03-28 06:44:27 +00003963
3964STEXI
3965@end table
3966ETEXI
Michael Ellermana3adb7a2011-12-19 17:19:31 +11003967ARCHHEADING(, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003968
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003969ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003970STEXI
3971@table @option
3972ETEXI
3973
blueswir15824d652009-03-28 06:44:27 +00003974DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack,
Blue Swirlad960902010-03-29 19:23:52 +00003975 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n",
3976 QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003977STEXI
3978@item -win2k-hack
Stefan Weil6616b2a2010-02-05 23:52:05 +01003979@findex -win2k-hack
blueswir15824d652009-03-28 06:44:27 +00003980Use it when installing Windows 2000 to avoid a disk full bug. After
3981Windows 2000 is installed, you no longer need this option (this option
3982slows down the IDE transfers).
3983ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003984SRST
3985``-win2k-hack``
3986 Use it when installing Windows 2000 to avoid a disk full bug. After
3987 Windows 2000 is installed, you no longer need this option (this
3988 option slows down the IDE transfers).
3989ERST
blueswir15824d652009-03-28 06:44:27 +00003990
blueswir15824d652009-03-28 06:44:27 +00003991DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
Blue Swirlad960902010-03-29 19:23:52 +00003992 "-no-fd-bootchk disable boot signature checking for floppy disks\n",
3993 QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003994STEXI
3995@item -no-fd-bootchk
Stefan Weil6616b2a2010-02-05 23:52:05 +01003996@findex -no-fd-bootchk
Markus Armbruster4eda32f2013-06-14 13:15:06 +02003997Disable boot signature checking for floppy disks in BIOS. May
blueswir15824d652009-03-28 06:44:27 +00003998be needed to boot from old floppy disks.
3999ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004000SRST
4001``-no-fd-bootchk``
4002 Disable boot signature checking for floppy disks in BIOS. May be
4003 needed to boot from old floppy disks.
4004ERST
blueswir15824d652009-03-28 06:44:27 +00004005
blueswir15824d652009-03-28 06:44:27 +00004006DEF("no-acpi", 0, QEMU_OPTION_no_acpi,
Shannon Zhaof5d8c8c2015-05-29 11:28:54 +01004007 "-no-acpi disable ACPI\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM)
blueswir15824d652009-03-28 06:44:27 +00004008STEXI
4009@item -no-acpi
Stefan Weil6616b2a2010-02-05 23:52:05 +01004010@findex -no-acpi
blueswir15824d652009-03-28 06:44:27 +00004011Disable ACPI (Advanced Configuration and Power Interface) support. Use
4012it if your guest OS complains about ACPI problems (PC target machine
4013only).
4014ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004015SRST
4016``-no-acpi``
4017 Disable ACPI (Advanced Configuration and Power Interface) support.
4018 Use it if your guest OS complains about ACPI problems (PC target
4019 machine only).
4020ERST
blueswir15824d652009-03-28 06:44:27 +00004021
blueswir15824d652009-03-28 06:44:27 +00004022DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
Blue Swirlad960902010-03-29 19:23:52 +00004023 "-no-hpet disable HPET\n", QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00004024STEXI
4025@item -no-hpet
Stefan Weil6616b2a2010-02-05 23:52:05 +01004026@findex -no-hpet
blueswir15824d652009-03-28 06:44:27 +00004027Disable HPET support.
4028ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004029SRST
4030``-no-hpet``
4031 Disable HPET support.
4032ERST
blueswir15824d652009-03-28 06:44:27 +00004033
blueswir15824d652009-03-28 06:44:27 +00004034DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
Michael Tokarev104bf022011-05-12 18:44:17 +04004035 "-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"
Blue Swirlad960902010-03-29 19:23:52 +00004036 " ACPI table description\n", QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00004037STEXI
4038@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}]...]
Stefan Weil6616b2a2010-02-05 23:52:05 +01004039@findex -acpitable
blueswir15824d652009-03-28 06:44:27 +00004040Add ACPI table with specified header fields and context from specified files.
Michael Tokarev104bf022011-05-12 18:44:17 +04004041For file=, take whole ACPI table from the specified files, including all
4042ACPI headers (possible overridden by other options).
4043For data=, only data
4044portion of the table is used, all header information is specified in the
4045command line.
Laszlo Ersekae123742016-01-18 15:12:13 +01004046If a SLIC table is supplied to QEMU, then the SLIC's oem_id and oem_table_id
4047fields will override the same in the RSDT and the FADT (a.k.a. FACP), in order
4048to ensure the field matches required by the Microsoft SLIC spec and the ACPI
4049spec.
blueswir15824d652009-03-28 06:44:27 +00004050ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004051SRST
4052``-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]...]``
4053 Add ACPI table with specified header fields and context from
4054 specified files. For file=, take whole ACPI table from the specified
4055 files, including all ACPI headers (possible overridden by other
4056 options). For data=, only data portion of the table is used, all
4057 header information is specified in the command line. If a SLIC table
4058 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id
4059 fields will override the same in the RSDT and the FADT (a.k.a.
4060 FACP), in order to ensure the field matches required by the
4061 Microsoft SLIC spec and the ACPI spec.
4062ERST
blueswir15824d652009-03-28 06:44:27 +00004063
aliguorib6f6e3d2009-04-17 18:59:56 +00004064DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
4065 "-smbios file=binary\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004066 " load SMBIOS entry from binary file\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004067 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
4068 " [,uefi=on|off]\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004069 " specify SMBIOS type 0 fields\n"
aliguorib6f6e3d2009-04-17 18:59:56 +00004070 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4071 " [,uuid=uuid][,sku=str][,family=str]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004072 " specify SMBIOS type 1 fields\n"
4073 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4074 " [,asset=str][,location=str]\n"
4075 " specify SMBIOS type 2 fields\n"
4076 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n"
4077 " [,sku=str]\n"
4078 " specify SMBIOS type 3 fields\n"
4079 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
4080 " [,asset=str][,part=str]\n"
4081 " specify SMBIOS type 4 fields\n"
4082 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04004083 " [,asset=str][,part=str][,speed=%d]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004084 " specify SMBIOS type 17 fields\n",
Wei Huangc30e1562015-09-07 10:39:29 +01004085 QEMU_ARCH_I386 | QEMU_ARCH_ARM)
aliguorib6f6e3d2009-04-17 18:59:56 +00004086STEXI
4087@item -smbios file=@var{binary}
Stefan Weil6616b2a2010-02-05 23:52:05 +01004088@findex -smbios
aliguorib6f6e3d2009-04-17 18:59:56 +00004089Load SMBIOS entry from binary file.
4090
Gabriel L. Somlo84351842014-05-19 10:09:54 -04004091@item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}][,uefi=on|off]
aliguorib6f6e3d2009-04-17 18:59:56 +00004092Specify SMBIOS type 0 fields
4093
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004094@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}]
aliguorib6f6e3d2009-04-17 18:59:56 +00004095Specify SMBIOS type 1 fields
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004096
Igor Mammedov3fdbd1d2019-05-21 16:23:31 +02004097@item -smbios type=2[,manufacturer=@var{str}][,product=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,location=@var{str}]
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004098Specify SMBIOS type 2 fields
4099
4100@item -smbios type=3[,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,sku=@var{str}]
4101Specify SMBIOS type 3 fields
4102
4103@item -smbios type=4[,sock_pfx=@var{str}][,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,part=@var{str}]
4104Specify SMBIOS type 4 fields
4105
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04004106@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}]
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004107Specify SMBIOS type 17 fields
aliguorib6f6e3d2009-04-17 18:59:56 +00004108ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004109SRST
4110``-smbios file=binary``
4111 Load SMBIOS entry from binary file.
4112
4113``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]``
4114 Specify SMBIOS type 0 fields
4115
4116``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]``
4117 Specify SMBIOS type 1 fields
4118
4119``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]``
4120 Specify SMBIOS type 2 fields
4121
4122``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
4123 Specify SMBIOS type 3 fields
4124
4125``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]``
4126 Specify SMBIOS type 4 fields
4127
4128``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]``
4129 Specify SMBIOS type 17 fields
4130ERST
aliguorib6f6e3d2009-04-17 18:59:56 +00004131
blueswir15824d652009-03-28 06:44:27 +00004132STEXI
4133@end table
4134ETEXI
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01004135DEFHEADING()
blueswir15824d652009-03-28 06:44:27 +00004136
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02004137DEFHEADING(Network options:)
blueswir15824d652009-03-28 06:44:27 +00004138STEXI
4139@table @option
4140ETEXI
4141
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004142DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
blueswir15824d652009-03-28 06:44:27 +00004143#ifdef CONFIG_SLIRP
Samuel Thibault0b11c032016-03-20 12:29:54 +01004144 "-netdev user,id=str[,ipv4[=on|off]][,net=addr[/mask]][,host=addr]\n"
4145 " [,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
4146 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
Benjamin Drungf18d1372018-02-27 17:06:01 +01004147 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n"
Fam Zheng0fca92b2018-09-14 15:26:16 +08004148 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
Jan Kiszkaad196a92009-06-24 14:42:28 +02004149#ifndef _WIN32
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004150 "[,smb=dir[,smbserver=addr]]\n"
Jan Kiszkaad196a92009-06-24 14:42:28 +02004151#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004152 " configure a user mode network backend with ID 'str',\n"
4153 " its DHCP server and optional services\n"
blueswir15824d652009-03-28 06:44:27 +00004154#endif
4155#ifdef _WIN32
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004156 "-netdev tap,id=str,ifname=name\n"
4157 " configure a host TAP network backend with ID 'str'\n"
blueswir15824d652009-03-28 06:44:27 +00004158#else
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004159 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004160 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004161 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
Jason Wang69e87b32016-07-06 09:57:55 +08004162 " [,poll-us=n]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004163 " configure a host TAP network backend with ID 'str'\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004164 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004165 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
4166 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
4167 " to deconfigure it\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004168 " use '[down]script=no' to disable script execution\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004169 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
4170 " configure it\n"
blueswir15824d652009-03-28 06:44:27 +00004171 " use 'fd=h' to connect to an already opened TAP interface\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08004172 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004173 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
Michael S. Tsirkinf157ed22011-02-01 14:25:40 +02004174 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004175 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
4176 " use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02004177 " use vhost=on to enable experimental in kernel accelerator\n"
mst@redhat.com5430a282011-02-01 22:13:42 +02004178 " (only has effect for virtio guests which use MSIX)\n"
4179 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02004180 " use 'vhostfd=h' to connect to an already opened vhost net device\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08004181 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
Jason Wangec396012013-02-22 22:57:52 +08004182 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
Jason Wang69e87b32016-07-06 09:57:55 +08004183 " use 'poll-us=n' to speciy the maximum number of microseconds that could be\n"
4184 " spent on busy polling for vhost net\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004185 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
4186 " configure a host TAP network backend with ID 'str' that is\n"
4187 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
4188 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
Mark McLoughlin0df0ff62009-06-18 18:21:34 +01004189#endif
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004190#ifdef __linux__
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004191 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"
4192 " [,rxsession=rxsession],txsession=txsession[,ipv6=on/off][,udp=on/off]\n"
4193 " [,cookie64=on/off][,counter][,pincounter][,txcookie=txcookie]\n"
4194 " [,rxcookie=rxcookie][,offset=offset]\n"
4195 " configure a network backend with ID 'str' connected to\n"
4196 " an Ethernet over L2TPv3 pseudowire.\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004197 " Linux kernel 3.3+ as well as most routers can talk\n"
Michael Tokarev2f47b402014-07-24 20:10:17 +04004198 " L2TPv3. This transport allows connecting a VM to a VM,\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004199 " VM to a router and even VM to Host. It is a nearly-universal\n"
Stefan Hajnoczi21843dc2020-02-29 11:17:27 +00004200 " standard (RFC3931). Note - this implementation uses static\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004201 " pre-configured tunnels (same as the Linux kernel).\n"
4202 " use 'src=' to specify source address\n"
4203 " use 'dst=' to specify destination address\n"
4204 " use 'udp=on' to specify udp encapsulation\n"
Gonglei39526512014-08-14 14:35:48 +08004205 " use 'srcport=' to specify source udp port\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004206 " use 'dstport=' to specify destination udp port\n"
4207 " use 'ipv6=on' to force v6\n"
4208 " L2TPv3 uses cookies to prevent misconfiguration as\n"
4209 " well as a weak security measure\n"
4210 " use 'rxcookie=0x012345678' to specify a rxcookie\n"
4211 " use 'txcookie=0x012345678' to specify a txcookie\n"
4212 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n"
4213 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n"
4214 " use 'pincounter=on' to work around broken counter handling in peer\n"
4215 " use 'offset=X' to add an extra offset between header and data\n"
4216#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004217 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n"
4218 " configure a network backend to connect to another network\n"
4219 " using a socket connection\n"
4220 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
4221 " configure a network backend to connect to a multicast maddr and port\n"
Mike Ryan3a75e742010-12-01 11:16:47 -08004222 " use 'localaddr=addr' to specify the host address to send packets from\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004223 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
4224 " configure a network backend to connect to another network\n"
4225 " using an UDP tunnel\n"
blueswir15824d652009-03-28 06:44:27 +00004226#ifdef CONFIG_VDE
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004227 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
4228 " configure a network backend to connect to port 'n' of a vde switch\n"
4229 " running on host and listening for incoming connections on 'socketpath'.\n"
blueswir15824d652009-03-28 06:44:27 +00004230 " Use group 'groupname' and mode 'octalmode' to change default\n"
4231 " ownership and permissions for communication port.\n"
4232#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01004233#ifdef CONFIG_NETMAP
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004234 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n"
Vincenzo Maffione58952132013-11-06 11:44:06 +01004235 " attach to the existing netmap-enabled network interface 'name', or to a\n"
4236 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n"
4237 " netmap device, defaults to '/dev/netmap')\n"
4238#endif
Thomas Huth253dc142018-02-21 11:18:32 +01004239#ifdef CONFIG_POSIX
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004240 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
4241 " configure a vhost-user network, backed by a chardev 'dev'\n"
Thomas Huth253dc142018-02-21 11:18:32 +01004242#endif
Thomas Huth18d65d22018-01-15 20:50:55 +01004243 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004244 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL)
Thomas Huth78cd6f72018-02-21 11:18:36 +01004245DEF("nic", HAS_ARG, QEMU_OPTION_nic,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004246 "-nic [tap|bridge|"
Thomas Huth78cd6f72018-02-21 11:18:36 +01004247#ifdef CONFIG_SLIRP
4248 "user|"
4249#endif
4250#ifdef __linux__
4251 "l2tpv3|"
4252#endif
4253#ifdef CONFIG_VDE
4254 "vde|"
4255#endif
4256#ifdef CONFIG_NETMAP
4257 "netmap|"
4258#endif
4259#ifdef CONFIG_POSIX
4260 "vhost-user|"
4261#endif
4262 "socket][,option][,...][mac=macaddr]\n"
4263 " initialize an on-board / default host NIC (using MAC address\n"
4264 " macaddr) and connect it to the given host network backend\n"
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004265 "-nic none use it alone to have zero network devices (the default is to\n"
Thomas Huth78cd6f72018-02-21 11:18:36 +01004266 " provided a 'user' network connection)\n",
4267 QEMU_ARCH_ALL)
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004268DEF("net", HAS_ARG, QEMU_OPTION_net,
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004269 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
Thomas Huth0e60a822017-12-19 16:28:55 +01004270 " configure or create an on-board (or machine default) NIC and\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004271 " connect it to hub 0 (please use -nic unless you need a hub)\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004272 "-net ["
Mark McLoughlina1ea4582009-10-08 19:58:26 +01004273#ifdef CONFIG_SLIRP
4274 "user|"
4275#endif
4276 "tap|"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004277 "bridge|"
Mark McLoughlina1ea4582009-10-08 19:58:26 +01004278#ifdef CONFIG_VDE
4279 "vde|"
4280#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01004281#ifdef CONFIG_NETMAP
4282 "netmap|"
4283#endif
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004284 "socket][,option][,option][,...]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004285 " old way to initialize a host network interface\n"
4286 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004287STEXI
Thomas Huthabbbb032018-03-12 13:20:50 +01004288@item -nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]
4289@findex -nic
4290This option is a shortcut for configuring both the on-board (default) guest
4291NIC hardware and the host network backend in one go. The host backend options
4292are the same as with the corresponding @option{-netdev} options below.
4293The guest NIC model can be set with @option{model=@var{modelname}}.
4294Use @option{model=help} to list the available device types.
4295The hardware MAC address can be set with @option{mac=@var{macaddr}}.
4296
4297The following two example do exactly the same, to show how @option{-nic} can
Daniel P. Berrangé416b7192020-01-09 12:24:05 +00004298be used to shorten the command line length:
Thomas Huthabbbb032018-03-12 13:20:50 +01004299@example
Thomas Huth664785a2019-07-30 17:08:26 +02004300@value{qemu_system} -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4301@value{qemu_system} -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
Thomas Huthabbbb032018-03-12 13:20:50 +01004302@end example
4303
4304@item -nic none
4305Indicate that no network devices should be configured. It is used to override
4306the default configuration (default NIC with ``user'' host network backend)
4307which is activated if no other networking options are provided.
blueswir15824d652009-03-28 06:44:27 +00004308
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004309@item -netdev user,id=@var{id}[,@var{option}][,@var{option}][,...]
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01004310@findex -netdev
Thomas Huthabbbb032018-03-12 13:20:50 +01004311Configure user mode host network backend which requires no administrator
Jan Kiszkaad196a92009-06-24 14:42:28 +02004312privilege to run. Valid options are:
blueswir15824d652009-03-28 06:44:27 +00004313
Kevin Wolfb3f046c2009-10-09 10:58:35 +02004314@table @option
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004315@item id=@var{id}
Jan Kiszkaad196a92009-06-24 14:42:28 +02004316Assign symbolic name for use in monitor commands.
4317
Thomas Huthabbbb032018-03-12 13:20:50 +01004318@item ipv4=on|off and ipv6=on|off
4319Specify that either IPv4 or IPv6 must be enabled. If neither is specified
4320both protocols are enabled.
Samuel Thibault0b11c032016-03-20 12:29:54 +01004321
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004322@item net=@var{addr}[/@var{mask}]
4323Set IP network address the guest will see. Optionally specify the netmask,
4324either in the form a.b.c.d or as number of valid top-most bits. Default is
Brad Hardsb0b36e52011-04-24 17:19:56 +1000432510.0.2.0/24.
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004326
4327@item host=@var{addr}
4328Specify the guest-visible address of the host. Default is the 2nd IP in the
4329guest network, i.e. x.x.x.2.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004330
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004331@item ipv6-net=@var{addr}[/@var{int}]
4332Set IPv6 network address the guest will see (default is fec0::/64). The
4333network prefix is given in the usual hexadecimal IPv6 address
4334notation. The prefix size is optional, and is given as the number of
4335valid top-most bits (default is 64).
Yann Bordenave7aac5312016-03-15 10:31:22 +01004336
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004337@item ipv6-host=@var{addr}
Yann Bordenave7aac5312016-03-15 10:31:22 +01004338Specify the guest-visible IPv6 address of the host. Default is the 2nd IPv6 in
4339the guest network, i.e. xxxx::2.
4340
Jan Kiszkac54ed5b2011-07-20 12:20:14 +02004341@item restrict=on|off
Brad Hardscaef55e2011-06-09 07:50:43 +10004342If this option is enabled, the guest will be isolated, i.e. it will not be
Jan Kiszkaad196a92009-06-24 14:42:28 +02004343able to contact the host and no guest IP packets will be routed over the host
Brad Hardscaef55e2011-06-09 07:50:43 +10004344to the outside. This option does not affect any explicitly set forwarding rules.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004345
4346@item hostname=@var{name}
Klaus Stengel63d29602012-10-27 19:53:39 +02004347Specifies the client hostname reported by the built-in DHCP server.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004348
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004349@item dhcpstart=@var{addr}
4350Specify the first of the 16 IPs the built-in DHCP server can assign. Default
Brad Hardsb0b36e52011-04-24 17:19:56 +10004351is the 15th to 31st IP in the guest network, i.e. x.x.x.15 to x.x.x.31.
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004352
4353@item dns=@var{addr}
4354Specify the guest-visible address of the virtual nameserver. The address must
4355be different from the host address. Default is the 3rd IP in the guest network,
4356i.e. x.x.x.3.
4357
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004358@item ipv6-dns=@var{addr}
Yann Bordenave7aac5312016-03-15 10:31:22 +01004359Specify the guest-visible address of the IPv6 virtual nameserver. The address
4360must be different from the host address. Default is the 3rd IP in the guest
4361network, i.e. xxxx::3.
4362
Klaus Stengel63d29602012-10-27 19:53:39 +02004363@item dnssearch=@var{domain}
4364Provides an entry for the domain-search list sent by the built-in
4365DHCP server. More than one domain suffix can be transmitted by specifying
4366this option multiple times. If supported, this will cause the guest to
4367automatically try to append the given domain suffix(es) in case a domain name
4368can not be resolved.
4369
4370Example:
4371@example
Thomas Huth664785a2019-07-30 17:08:26 +02004372@value{qemu_system} -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
Klaus Stengel63d29602012-10-27 19:53:39 +02004373@end example
4374
Benjamin Drungf18d1372018-02-27 17:06:01 +01004375@item domainname=@var{domain}
4376Specifies the client domain name reported by the built-in DHCP server.
4377
Jan Kiszkaad196a92009-06-24 14:42:28 +02004378@item tftp=@var{dir}
4379When using the user mode network stack, activate a built-in TFTP
4380server. The files in @var{dir} will be exposed as the root of a TFTP server.
4381The TFTP client on the guest must be configured in binary mode (use the command
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004382@code{bin} of the Unix TFTP client).
Jan Kiszkaad196a92009-06-24 14:42:28 +02004383
Fam Zheng0fca92b2018-09-14 15:26:16 +08004384@item tftp-server-name=@var{name}
4385In BOOTP reply, broadcast @var{name} as the "TFTP server name" (RFC2132 option
438666). This can be used to advise the guest to load boot files or configurations
4387from a different server than the host address.
4388
Jan Kiszkaad196a92009-06-24 14:42:28 +02004389@item bootfile=@var{file}
4390When using the user mode network stack, broadcast @var{file} as the BOOTP
4391filename. In conjunction with @option{tftp}, this can be used to network boot
4392a guest from a local directory.
4393
4394Example (using pxelinux):
4395@example
Thomas Huth664785a2019-07-30 17:08:26 +02004396@value{qemu_system} -hda linux.img -boot n -device e1000,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004397 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
Jan Kiszkaad196a92009-06-24 14:42:28 +02004398@end example
4399
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004400@item smb=@var{dir}[,smbserver=@var{addr}]
Jan Kiszkaad196a92009-06-24 14:42:28 +02004401When using the user mode network stack, activate a built-in SMB
4402server so that Windows OSes can access to the host files in @file{@var{dir}}
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004403transparently. The IP address of the SMB server can be set to @var{addr}. By
4404default the 4th IP in the guest network is used, i.e. x.x.x.4.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004405
4406In the guest Windows OS, the line:
4407@example
440810.0.2.4 smbserver
4409@end example
4410must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
4411or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
4412
4413Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
4414
Brade2d88302011-09-02 16:53:28 -04004415Note that a SAMBA server must be installed on the host OS.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004416
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004417@item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport}
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004418Redirect incoming TCP or UDP connections to the host port @var{hostport} to
4419the guest IP address @var{guestaddr} on guest port @var{guestport}. If
4420@var{guestaddr} is not specified, its value is x.x.x.15 (default first address
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004421given by the built-in DHCP server). By specifying @var{hostaddr}, the rule can
4422be bound to a specific host interface. If no connection type is set, TCP is
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004423used. This option can be given multiple times.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004424
4425For example, to redirect host X11 connection from screen 1 to guest
4426screen 0, use the following:
4427
4428@example
4429# on the host
Thomas Huth664785a2019-07-30 17:08:26 +02004430@value{qemu_system} -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
Jan Kiszkaad196a92009-06-24 14:42:28 +02004431# this host xterm should open in the guest X11 server
4432xterm -display :1
4433@end example
4434
4435To redirect telnet connections from host port 5555 to telnet port on
4436the guest, use the following:
4437
4438@example
4439# on the host
Thomas Huth664785a2019-07-30 17:08:26 +02004440@value{qemu_system} -nic user,hostfwd=tcp::5555-:23
Jan Kiszkaad196a92009-06-24 14:42:28 +02004441telnet localhost 5555
4442@end example
4443
4444Then when you use on the host @code{telnet localhost 5555}, you
4445connect to the guest telnet server.
4446
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004447@item guestfwd=[tcp]:@var{server}:@var{port}-@var{dev}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02004448@itemx guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command}
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004449Forward guest TCP connections to the IP address @var{server} on port @var{port}
Alexander Grafb412eb62012-06-03 09:45:01 +02004450to the character device @var{dev} or to a program executed by @var{cmd:command}
4451which gets spawned for each connection. This option can be given multiple times.
4452
Stefan Weil43ffe612012-07-20 23:26:02 +02004453You can either use a chardev directly and have that one used throughout QEMU's
Alexander Grafb412eb62012-06-03 09:45:01 +02004454lifetime, like in the following example:
4455
4456@example
4457# open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4458# the guest accesses it
Thomas Huth664785a2019-07-30 17:08:26 +02004459@value{qemu_system} -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
Alexander Grafb412eb62012-06-03 09:45:01 +02004460@end example
4461
4462Or you can execute a command on every TCP connection established by the guest,
Stefan Weil43ffe612012-07-20 23:26:02 +02004463so that QEMU behaves similar to an inetd process for that virtual server:
Alexander Grafb412eb62012-06-03 09:45:01 +02004464
4465@example
4466# call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4467# and connect the TCP stream to its stdin/stdout
Thomas Huth664785a2019-07-30 17:08:26 +02004468@value{qemu_system} -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
Alexander Grafb412eb62012-06-03 09:45:01 +02004469@end example
Jan Kiszkaad196a92009-06-24 14:42:28 +02004470
4471@end table
4472
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004473@item -netdev tap,id=@var{id}[,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,br=@var{bridge}][,helper=@var{helper}]
Thomas Huthabbbb032018-03-12 13:20:50 +01004474Configure a host TAP network backend with ID @var{id}.
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004475
4476Use the network script @var{file} to configure it and the network script
blueswir15824d652009-03-28 06:44:27 +00004477@var{dfile} to deconfigure it. If @var{name} is not provided, the OS
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004478automatically provides one. The default network configure script is
4479@file{/etc/qemu-ifup} and the default network deconfigure script is
4480@file{/etc/qemu-ifdown}. Use @option{script=no} or @option{downscript=no}
4481to disable script execution.
4482
4483If running QEMU as an unprivileged user, use the network helper
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004484@var{helper} to configure the TAP interface and attach it to the bridge.
4485The default network helper executable is @file{/path/to/qemu-bridge-helper}
4486and the default bridge device is @file{br0}.
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004487
4488@option{fd}=@var{h} can be used to specify the handle of an already
4489opened host TAP interface.
4490
4491Examples:
blueswir15824d652009-03-28 06:44:27 +00004492
4493@example
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004494#launch a QEMU instance with the default network script
Thomas Huth664785a2019-07-30 17:08:26 +02004495@value{qemu_system} linux.img -nic tap
blueswir15824d652009-03-28 06:44:27 +00004496@end example
4497
blueswir15824d652009-03-28 06:44:27 +00004498@example
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004499#launch a QEMU instance with two NICs, each one connected
4500#to a TAP device
Thomas Huth664785a2019-07-30 17:08:26 +02004501@value{qemu_system} linux.img \
Thomas Huth74f78b92018-01-15 08:40:17 +01004502 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4503 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
blueswir15824d652009-03-28 06:44:27 +00004504@end example
4505
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004506@example
4507#launch a QEMU instance with the default network helper to
4508#connect a TAP device to bridge br0
Thomas Huth664785a2019-07-30 17:08:26 +02004509@value{qemu_system} linux.img -device virtio-net-pci,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004510 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004511@end example
4512
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004513@item -netdev bridge,id=@var{id}[,br=@var{bridge}][,helper=@var{helper}]
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004514Connect a host TAP network interface to a host bridge device.
4515
4516Use the network helper @var{helper} to configure the TAP interface and
4517attach it to the bridge. The default network helper executable is
Amos Kong420508f2013-10-23 04:49:28 +08004518@file{/path/to/qemu-bridge-helper} and the default bridge
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004519device is @file{br0}.
4520
4521Examples:
4522
4523@example
4524#launch a QEMU instance with the default network helper to
4525#connect a TAP device to bridge br0
Thomas Huth664785a2019-07-30 17:08:26 +02004526@value{qemu_system} linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004527@end example
4528
4529@example
4530#launch a QEMU instance with the default network helper to
4531#connect a TAP device to bridge qemubr0
Thomas Huth664785a2019-07-30 17:08:26 +02004532@value{qemu_system} linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004533@end example
4534
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004535@item -netdev socket,id=@var{id}[,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
blueswir15824d652009-03-28 06:44:27 +00004536
Thomas Huthabbbb032018-03-12 13:20:50 +01004537This host network backend can be used to connect the guest's network to
4538another QEMU virtual machine using a TCP socket connection. If @option{listen}
4539is specified, QEMU waits for incoming connections on @var{port}
blueswir15824d652009-03-28 06:44:27 +00004540(@var{host} is optional). @option{connect} is used to connect to
4541another QEMU instance using the @option{listen} option. @option{fd}=@var{h}
4542specifies an already opened TCP socket.
4543
4544Example:
4545@example
4546# launch a first QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004547@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004548 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4549 -netdev socket,id=n1,listen=:1234
4550# connect the network of this instance to the network of the first instance
Thomas Huth664785a2019-07-30 17:08:26 +02004551@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004552 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4553 -netdev socket,id=n2,connect=127.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004554@end example
4555
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004556@item -netdev socket,id=@var{id}[,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]]
blueswir15824d652009-03-28 06:44:27 +00004557
Thomas Huthabbbb032018-03-12 13:20:50 +01004558Configure a socket host network backend to share the guest's network traffic
4559with another QEMU virtual machines using a UDP multicast socket, effectively
4560making a bus for every QEMU with same multicast address @var{maddr} and @var{port}.
blueswir15824d652009-03-28 06:44:27 +00004561NOTES:
4562@enumerate
4563@item
4564Several QEMU can be running on different hosts and share same bus (assuming
4565correct multicast setup for these hosts).
4566@item
4567mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
4568@url{http://user-mode-linux.sf.net}.
4569@item
4570Use @option{fd=h} to specify an already opened UDP multicast socket.
4571@end enumerate
4572
4573Example:
4574@example
4575# launch one QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004576@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004577 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4578 -netdev socket,id=n1,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004579# launch another QEMU instance on same "bus"
Thomas Huth664785a2019-07-30 17:08:26 +02004580@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004581 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4582 -netdev socket,id=n2,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004583# launch yet another QEMU instance on same "bus"
Thomas Huth664785a2019-07-30 17:08:26 +02004584@value{qemu_system} linux.img \
Thomas Huth37a44422018-08-13 13:51:44 +02004585 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004586 -netdev socket,id=n3,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004587@end example
4588
4589Example (User Mode Linux compat.):
4590@example
Thomas Huthabbbb032018-03-12 13:20:50 +01004591# launch QEMU instance (note mcast address selected is UML's default)
Thomas Huth664785a2019-07-30 17:08:26 +02004592@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004593 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4594 -netdev socket,id=n1,mcast=239.192.168.1:1102
blueswir15824d652009-03-28 06:44:27 +00004595# launch UML
4596/path/to/linux ubd0=/path/to/root_fs eth0=mcast
4597@end example
4598
Mike Ryan3a75e742010-12-01 11:16:47 -08004599Example (send packets from host's 1.2.3.4):
4600@example
Thomas Huth664785a2019-07-30 17:08:26 +02004601@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004602 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4603 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
Mike Ryan3a75e742010-12-01 11:16:47 -08004604@end example
4605
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004606@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}]
Stefan Hajnoczi21843dc2020-02-29 11:17:27 +00004607Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) is a
Thomas Huthabbbb032018-03-12 13:20:50 +01004608popular protocol to transport Ethernet (and other Layer 2) data frames between
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004609two systems. It is present in routers, firewalls and the Linux kernel
4610(from version 3.3 onwards).
4611
4612This transport allows a VM to communicate to another VM, router or firewall directly.
4613
Markus Armbruster1e9a7372017-10-02 16:03:01 +02004614@table @option
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004615@item src=@var{srcaddr}
4616 source address (mandatory)
4617@item dst=@var{dstaddr}
4618 destination address (mandatory)
4619@item udp
4620 select udp encapsulation (default is ip).
4621@item srcport=@var{srcport}
4622 source udp port.
4623@item dstport=@var{dstport}
4624 destination udp port.
4625@item ipv6
4626 force v6, otherwise defaults to v4.
4627@item rxcookie=@var{rxcookie}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02004628@itemx txcookie=@var{txcookie}
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004629 Cookies are a weak form of security in the l2tpv3 specification.
4630Their function is mostly to prevent misconfiguration. By default they are 32
4631bit.
4632@item cookie64
4633 Set cookie size to 64 bit instead of the default 32
4634@item counter=off
4635 Force a 'cut-down' L2TPv3 with no counter as in
4636draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
4637@item pincounter=on
4638 Work around broken counter handling in peer. This may also help on
4639networks which have packet reorder.
4640@item offset=@var{offset}
4641 Add an extra offset between header and data
Markus Armbruster1e9a7372017-10-02 16:03:01 +02004642@end table
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004643
4644For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to the bridge br-lan
4645on the remote Linux host 1.2.3.4:
4646@example
4647# Setup tunnel on linux host using raw ip as encapsulation
4648# on 1.2.3.4
4649ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
4650 encap udp udp_sport 16384 udp_dport 16384
4651ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
4652 0xFFFFFFFF peer_session_id 0xFFFFFFFF
4653ifconfig vmtunnel0 mtu 1500
4654ifconfig vmtunnel0 up
4655brctl addif br-lan vmtunnel0
4656
4657
4658# on 4.3.2.1
4659# launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
4660
Thomas Huth664785a2019-07-30 17:08:26 +02004661@value{qemu_system} linux.img -device e1000,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004662 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004663
4664@end example
4665
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004666@item -netdev vde,id=@var{id}[,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}]
Thomas Huthabbbb032018-03-12 13:20:50 +01004667Configure VDE backend to connect to PORT @var{n} of a vde switch running on host and
blueswir15824d652009-03-28 06:44:27 +00004668listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname}
4669and MODE @var{octalmode} to change default ownership and permissions for
Stefan Weilc1ba4e02011-09-05 18:13:03 +02004670communication port. This option is only available if QEMU has been compiled
blueswir15824d652009-03-28 06:44:27 +00004671with vde support enabled.
4672
4673Example:
4674@example
4675# launch vde switch
4676vde_switch -F -sock /tmp/myswitch
4677# launch QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004678@value{qemu_system} linux.img -nic vde,sock=/tmp/myswitch
blueswir15824d652009-03-28 06:44:27 +00004679@end example
4680
Changchun Ouyangb931bfb2015-09-23 12:20:00 +08004681@item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004682
4683Establish a vhost-user netdev, backed by a chardev @var{id}. The chardev should
4684be a unix domain socket backed one. The vhost-user uses a specifically defined
4685protocol to pass vhost ioctl replacement messages to an application on the other
4686end of the socket. On non-MSIX guests, the feature can be forced with
Changchun Ouyangb931bfb2015-09-23 12:20:00 +08004687@var{vhostforce}. Use 'queues=@var{n}' to specify the number of queues to
4688be created for multiqueue vhost-user.
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004689
4690Example:
4691@example
4692qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
4693 -numa node,memdev=mem \
Vincenzo Maffione79cad2f2017-02-20 17:45:09 +01004694 -chardev socket,id=chr0,path=/path/to/socket \
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004695 -netdev type=vhost-user,id=net0,chardev=chr0 \
4696 -device virtio-net-pci,netdev=net0
4697@end example
4698
Thomas Huthabbbb032018-03-12 13:20:50 +01004699@item -netdev hubport,id=@var{id},hubid=@var{hubid}[,netdev=@var{nd}]
Thomas Huth78cd6f72018-02-21 11:18:36 +01004700
Thomas Huthabbbb032018-03-12 13:20:50 +01004701Create a hub port on the emulated hub with ID @var{hubid}.
Thomas Huth78cd6f72018-02-21 11:18:36 +01004702
Thomas Huthabbbb032018-03-12 13:20:50 +01004703The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004704single netdev. Alternatively, you can also connect the hubport to another
4705netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option.
Thomas Huthabbbb032018-03-12 13:20:50 +01004706
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004707@item -net nic[,netdev=@var{nd}][,macaddr=@var{mac}][,model=@var{type}] [,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}]
Thomas Huthabbbb032018-03-12 13:20:50 +01004708@findex -net
4709Legacy option to configure or create an on-board (or machine default) Network
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004710Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e.
4711the default hub), or to the netdev @var{nd}.
Daniel P. Berrangé416b7192020-01-09 12:24:05 +00004712If @var{model} is omitted, then the default NIC model associated with
4713the machine type is used. Note that the default NIC model may change in
4714future QEMU releases, so it is highly recommended to always specify a model.
4715Optionally, the MAC address can be changed to @var{mac}, the device
4716address set to @var{addr} (PCI cards only), and a @var{name} can be
4717assigned for use in monitor commands.
Thomas Huthabbbb032018-03-12 13:20:50 +01004718Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors
4719that the card should have; this option currently only affects virtio cards; set
4720@var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
4721NIC is created. QEMU can emulate several different models of network card.
4722Use @code{-net nic,model=help} for a list of available devices for your target.
4723
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004724@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=@var{name}]
Thomas Huthabbbb032018-03-12 13:20:50 +01004725Configure a host network backend (with the options corresponding to the same
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004726@option{-netdev} option) and connect it to the emulated hub 0 (the default
4727hub). Use @var{name} to specify the name of the hub port.
blueswir15824d652009-03-28 06:44:27 +00004728ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004729SRST
4730``-nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]``
4731 This option is a shortcut for configuring both the on-board
4732 (default) guest NIC hardware and the host network backend in one go.
4733 The host backend options are the same as with the corresponding
4734 ``-netdev`` options below. The guest NIC model can be set with
4735 ``model=modelname``. Use ``model=help`` to list the available device
4736 types. The hardware MAC address can be set with ``mac=macaddr``.
4737
4738 The following two example do exactly the same, to show how ``-nic``
4739 can be used to shorten the command line length:
4740
4741 .. parsed-literal::
4742
4743 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4744 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
4745
4746``-nic none``
4747 Indicate that no network devices should be configured. It is used to
4748 override the default configuration (default NIC with "user" host
4749 network backend) which is activated if no other networking options
4750 are provided.
4751
4752``-netdev user,id=id[,option][,option][,...]``
4753 Configure user mode host network backend which requires no
4754 administrator privilege to run. Valid options are:
4755
4756 ``id=id``
4757 Assign symbolic name for use in monitor commands.
4758
4759 ``ipv4=on|off and ipv6=on|off``
4760 Specify that either IPv4 or IPv6 must be enabled. If neither is
4761 specified both protocols are enabled.
4762
4763 ``net=addr[/mask]``
4764 Set IP network address the guest will see. Optionally specify
4765 the netmask, either in the form a.b.c.d or as number of valid
4766 top-most bits. Default is 10.0.2.0/24.
4767
4768 ``host=addr``
4769 Specify the guest-visible address of the host. Default is the
4770 2nd IP in the guest network, i.e. x.x.x.2.
4771
4772 ``ipv6-net=addr[/int]``
4773 Set IPv6 network address the guest will see (default is
4774 fec0::/64). The network prefix is given in the usual hexadecimal
4775 IPv6 address notation. The prefix size is optional, and is given
4776 as the number of valid top-most bits (default is 64).
4777
4778 ``ipv6-host=addr``
4779 Specify the guest-visible IPv6 address of the host. Default is
4780 the 2nd IPv6 in the guest network, i.e. xxxx::2.
4781
4782 ``restrict=on|off``
4783 If this option is enabled, the guest will be isolated, i.e. it
4784 will not be able to contact the host and no guest IP packets
4785 will be routed over the host to the outside. This option does
4786 not affect any explicitly set forwarding rules.
4787
4788 ``hostname=name``
4789 Specifies the client hostname reported by the built-in DHCP
4790 server.
4791
4792 ``dhcpstart=addr``
4793 Specify the first of the 16 IPs the built-in DHCP server can
4794 assign. Default is the 15th to 31st IP in the guest network,
4795 i.e. x.x.x.15 to x.x.x.31.
4796
4797 ``dns=addr``
4798 Specify the guest-visible address of the virtual nameserver. The
4799 address must be different from the host address. Default is the
4800 3rd IP in the guest network, i.e. x.x.x.3.
4801
4802 ``ipv6-dns=addr``
4803 Specify the guest-visible address of the IPv6 virtual
4804 nameserver. The address must be different from the host address.
4805 Default is the 3rd IP in the guest network, i.e. xxxx::3.
4806
4807 ``dnssearch=domain``
4808 Provides an entry for the domain-search list sent by the
4809 built-in DHCP server. More than one domain suffix can be
4810 transmitted by specifying this option multiple times. If
4811 supported, this will cause the guest to automatically try to
4812 append the given domain suffix(es) in case a domain name can not
4813 be resolved.
4814
4815 Example:
4816
4817 .. parsed-literal::
4818
4819 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
4820
4821 ``domainname=domain``
4822 Specifies the client domain name reported by the built-in DHCP
4823 server.
4824
4825 ``tftp=dir``
4826 When using the user mode network stack, activate a built-in TFTP
4827 server. The files in dir will be exposed as the root of a TFTP
4828 server. The TFTP client on the guest must be configured in
4829 binary mode (use the command ``bin`` of the Unix TFTP client).
4830
4831 ``tftp-server-name=name``
4832 In BOOTP reply, broadcast name as the "TFTP server name"
4833 (RFC2132 option 66). This can be used to advise the guest to
4834 load boot files or configurations from a different server than
4835 the host address.
4836
4837 ``bootfile=file``
4838 When using the user mode network stack, broadcast file as the
4839 BOOTP filename. In conjunction with ``tftp``, this can be used
4840 to network boot a guest from a local directory.
4841
4842 Example (using pxelinux):
4843
4844 .. parsed-literal::
4845
4846 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \
4847 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
4848
4849 ``smb=dir[,smbserver=addr]``
4850 When using the user mode network stack, activate a built-in SMB
4851 server so that Windows OSes can access to the host files in
4852 ``dir`` transparently. The IP address of the SMB server can be
4853 set to addr. By default the 4th IP in the guest network is used,
4854 i.e. x.x.x.4.
4855
4856 In the guest Windows OS, the line:
4857
4858 ::
4859
4860 10.0.2.4 smbserver
4861
4862 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows
4863 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows
4864 NT/2000).
4865
4866 Then ``dir`` can be accessed in ``\\smbserver\qemu``.
4867
4868 Note that a SAMBA server must be installed on the host OS.
4869
4870 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport``
4871 Redirect incoming TCP or UDP connections to the host port
4872 hostport to the guest IP address guestaddr on guest port
4873 guestport. If guestaddr is not specified, its value is x.x.x.15
4874 (default first address given by the built-in DHCP server). By
4875 specifying hostaddr, the rule can be bound to a specific host
4876 interface. If no connection type is set, TCP is used. This
4877 option can be given multiple times.
4878
4879 For example, to redirect host X11 connection from screen 1 to
4880 guest screen 0, use the following:
4881
Peter Maydell09ce5f22020-02-28 15:36:13 +00004882 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004883
4884 # on the host
4885 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
4886 # this host xterm should open in the guest X11 server
4887 xterm -display :1
4888
4889 To redirect telnet connections from host port 5555 to telnet
4890 port on the guest, use the following:
4891
Peter Maydell09ce5f22020-02-28 15:36:13 +00004892 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004893
4894 # on the host
4895 |qemu_system| -nic user,hostfwd=tcp::5555-:23
4896 telnet localhost 5555
4897
4898 Then when you use on the host ``telnet localhost 5555``, you
4899 connect to the guest telnet server.
4900
4901 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command``
4902 Forward guest TCP connections to the IP address server on port
4903 port to the character device dev or to a program executed by
4904 cmd:command which gets spawned for each connection. This option
4905 can be given multiple times.
4906
4907 You can either use a chardev directly and have that one used
4908 throughout QEMU's lifetime, like in the following example:
4909
Peter Maydell09ce5f22020-02-28 15:36:13 +00004910 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004911
4912 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4913 # the guest accesses it
4914 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
4915
4916 Or you can execute a command on every TCP connection established
4917 by the guest, so that QEMU behaves similar to an inetd process
4918 for that virtual server:
4919
Peter Maydell09ce5f22020-02-28 15:36:13 +00004920 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004921
4922 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4923 # and connect the TCP stream to its stdin/stdout
4924 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
4925
4926``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
4927 Configure a host TAP network backend with ID id.
4928
4929 Use the network script file to configure it and the network script
4930 dfile to deconfigure it. If name is not provided, the OS
4931 automatically provides one. The default network configure script is
4932 ``/etc/qemu-ifup`` and the default network deconfigure script is
4933 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to
4934 disable script execution.
4935
4936 If running QEMU as an unprivileged user, use the network helper
4937 helper to configure the TAP interface and attach it to the bridge.
4938 The default network helper executable is
4939 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4940 ``br0``.
4941
4942 ``fd``\ =h can be used to specify the handle of an already opened
4943 host TAP interface.
4944
4945 Examples:
4946
Peter Maydell09ce5f22020-02-28 15:36:13 +00004947 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004948
4949 #launch a QEMU instance with the default network script
4950 |qemu_system| linux.img -nic tap
4951
Peter Maydell09ce5f22020-02-28 15:36:13 +00004952 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004953
4954 #launch a QEMU instance with two NICs, each one connected
4955 #to a TAP device
4956 |qemu_system| linux.img \
4957 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4958 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
4959
Peter Maydell09ce5f22020-02-28 15:36:13 +00004960 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004961
4962 #launch a QEMU instance with the default network helper to
4963 #connect a TAP device to bridge br0
4964 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \
4965 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
4966
4967``-netdev bridge,id=id[,br=bridge][,helper=helper]``
4968 Connect a host TAP network interface to a host bridge device.
4969
4970 Use the network helper helper to configure the TAP interface and
4971 attach it to the bridge. The default network helper executable is
4972 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4973 ``br0``.
4974
4975 Examples:
4976
Peter Maydell09ce5f22020-02-28 15:36:13 +00004977 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004978
4979 #launch a QEMU instance with the default network helper to
4980 #connect a TAP device to bridge br0
4981 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
4982
Peter Maydell09ce5f22020-02-28 15:36:13 +00004983 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004984
4985 #launch a QEMU instance with the default network helper to
4986 #connect a TAP device to bridge qemubr0
4987 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
4988
4989``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]``
4990 This host network backend can be used to connect the guest's network
4991 to another QEMU virtual machine using a TCP socket connection. If
4992 ``listen`` is specified, QEMU waits for incoming connections on port
4993 (host is optional). ``connect`` is used to connect to another QEMU
4994 instance using the ``listen`` option. ``fd``\ =h specifies an
4995 already opened TCP socket.
4996
4997 Example:
4998
Peter Maydell09ce5f22020-02-28 15:36:13 +00004999 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005000
5001 # launch a first QEMU instance
5002 |qemu_system| linux.img \
5003 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5004 -netdev socket,id=n1,listen=:1234
5005 # connect the network of this instance to the network of the first instance
5006 |qemu_system| linux.img \
5007 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
5008 -netdev socket,id=n2,connect=127.0.0.1:1234
5009
5010``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]``
5011 Configure a socket host network backend to share the guest's network
5012 traffic with another QEMU virtual machines using a UDP multicast
5013 socket, effectively making a bus for every QEMU with same multicast
5014 address maddr and port. NOTES:
5015
5016 1. Several QEMU can be running on different hosts and share same bus
5017 (assuming correct multicast setup for these hosts).
5018
5019 2. mcast support is compatible with User Mode Linux (argument
5020 ``ethN=mcast``), see http://user-mode-linux.sf.net.
5021
5022 3. Use ``fd=h`` to specify an already opened UDP multicast socket.
5023
5024 Example:
5025
Peter Maydell09ce5f22020-02-28 15:36:13 +00005026 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005027
5028 # launch one QEMU instance
5029 |qemu_system| linux.img \
5030 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5031 -netdev socket,id=n1,mcast=230.0.0.1:1234
5032 # launch another QEMU instance on same "bus"
5033 |qemu_system| linux.img \
5034 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
5035 -netdev socket,id=n2,mcast=230.0.0.1:1234
5036 # launch yet another QEMU instance on same "bus"
5037 |qemu_system| linux.img \
5038 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
5039 -netdev socket,id=n3,mcast=230.0.0.1:1234
5040
5041 Example (User Mode Linux compat.):
5042
Peter Maydell09ce5f22020-02-28 15:36:13 +00005043 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005044
5045 # launch QEMU instance (note mcast address selected is UML's default)
5046 |qemu_system| linux.img \
5047 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5048 -netdev socket,id=n1,mcast=239.192.168.1:1102
5049 # launch UML
5050 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
5051
5052 Example (send packets from host's 1.2.3.4):
5053
5054 .. parsed-literal::
5055
5056 |qemu_system| linux.img \
5057 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5058 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
5059
5060``-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]``
5061 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
5062 is a popular protocol to transport Ethernet (and other Layer 2) data
5063 frames between two systems. It is present in routers, firewalls and
5064 the Linux kernel (from version 3.3 onwards).
5065
5066 This transport allows a VM to communicate to another VM, router or
5067 firewall directly.
5068
5069 ``src=srcaddr``
5070 source address (mandatory)
5071
5072 ``dst=dstaddr``
5073 destination address (mandatory)
5074
5075 ``udp``
5076 select udp encapsulation (default is ip).
5077
5078 ``srcport=srcport``
5079 source udp port.
5080
5081 ``dstport=dstport``
5082 destination udp port.
5083
5084 ``ipv6``
5085 force v6, otherwise defaults to v4.
5086
5087 ``rxcookie=rxcookie``; \ ``txcookie=txcookie``
5088 Cookies are a weak form of security in the l2tpv3 specification.
5089 Their function is mostly to prevent misconfiguration. By default
5090 they are 32 bit.
5091
5092 ``cookie64``
5093 Set cookie size to 64 bit instead of the default 32
5094
5095 ``counter=off``
5096 Force a 'cut-down' L2TPv3 with no counter as in
5097 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
5098
5099 ``pincounter=on``
5100 Work around broken counter handling in peer. This may also help
5101 on networks which have packet reorder.
5102
5103 ``offset=offset``
5104 Add an extra offset between header and data
5105
5106 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to
5107 the bridge br-lan on the remote Linux host 1.2.3.4:
5108
Peter Maydell09ce5f22020-02-28 15:36:13 +00005109 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005110
5111 # Setup tunnel on linux host using raw ip as encapsulation
5112 # on 1.2.3.4
5113 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
5114 encap udp udp_sport 16384 udp_dport 16384
5115 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
5116 0xFFFFFFFF peer_session_id 0xFFFFFFFF
5117 ifconfig vmtunnel0 mtu 1500
5118 ifconfig vmtunnel0 up
5119 brctl addif br-lan vmtunnel0
5120
5121
5122 # on 4.3.2.1
5123 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
5124
5125 |qemu_system| linux.img -device e1000,netdev=n1 \
5126 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
5127
5128``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
5129 Configure VDE backend to connect to PORT n of a vde switch running
5130 on host and listening for incoming connections on socketpath. Use
5131 GROUP groupname and MODE octalmode to change default ownership and
5132 permissions for communication port. This option is only available if
5133 QEMU has been compiled with vde support enabled.
5134
5135 Example:
5136
Peter Maydell09ce5f22020-02-28 15:36:13 +00005137 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005138
5139 # launch vde switch
5140 vde_switch -F -sock /tmp/myswitch
5141 # launch QEMU instance
5142 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch
5143
5144``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
5145 Establish a vhost-user netdev, backed by a chardev id. The chardev
5146 should be a unix domain socket backed one. The vhost-user uses a
5147 specifically defined protocol to pass vhost ioctl replacement
5148 messages to an application on the other end of the socket. On
5149 non-MSIX guests, the feature can be forced with vhostforce. Use
5150 'queues=n' to specify the number of queues to be created for
5151 multiqueue vhost-user.
5152
5153 Example:
5154
5155 ::
5156
5157 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
5158 -numa node,memdev=mem \
5159 -chardev socket,id=chr0,path=/path/to/socket \
5160 -netdev type=vhost-user,id=net0,chardev=chr0 \
5161 -device virtio-net-pci,netdev=net0
5162
5163``-netdev hubport,id=id,hubid=hubid[,netdev=nd]``
5164 Create a hub port on the emulated hub with ID hubid.
5165
5166 The hubport netdev lets you connect a NIC to a QEMU emulated hub
5167 instead of a single netdev. Alternatively, you can also connect the
5168 hubport to another netdev with ID nd by using the ``netdev=nd``
5169 option.
5170
5171``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]``
5172 Legacy option to configure or create an on-board (or machine
5173 default) Network Interface Card(NIC) and connect it either to the
5174 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.
5175 If model is omitted, then the default NIC model associated with the
5176 machine type is used. Note that the default NIC model may change in
5177 future QEMU releases, so it is highly recommended to always specify
5178 a model. Optionally, the MAC address can be changed to mac, the
5179 device address set to addr (PCI cards only), and a name can be
5180 assigned for use in monitor commands. Optionally, for PCI cards, you
5181 can specify the number v of MSI-X vectors that the card should have;
5182 this option currently only affects virtio cards; set v = 0 to
5183 disable MSI-X. If no ``-net`` option is specified, a single NIC is
5184 created. QEMU can emulate several different models of network card.
5185 Use ``-net nic,model=help`` for a list of available devices for your
5186 target.
5187
5188``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]``
5189 Configure a host network backend (with the options corresponding to
5190 the same ``-netdev`` option) and connect it to the emulated hub 0
5191 (the default hub). Use name to specify the name of the hub port.
5192ERST
blueswir15824d652009-03-28 06:44:27 +00005193
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01005194STEXI
5195@end table
5196ETEXI
Matthew Booth7273a2d2009-10-30 13:41:12 +00005197DEFHEADING()
5198
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005199DEFHEADING(Character device options:)
Matthew Booth7273a2d2009-10-30 13:41:12 +00005200
5201DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
Lin Ma517b3d42016-08-17 01:13:52 +08005202 "-chardev help\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005203 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Corey Minyard5dd1f022014-10-02 11:17:37 -05005204 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4][,ipv6][,nodelay][,reconnect=seconds]\n"
Julia Suvorova981b06e2018-10-19 01:35:00 +03005205 " [,server][,nowait][,telnet][,websocket][,reconnect=seconds][,mux=on|off]\n"
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005206 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n"
Julia Suvorova981b06e2018-10-19 01:35:00 +03005207 "-chardev socket,id=id,path=path[,server][,nowait][,telnet][,websocket][,reconnect=seconds]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005208 " [,mux=on|off][,logfile=PATH][,logappend=on|off] (unix)\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005209 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
Jan Kiszka97331282010-04-06 16:55:54 +02005210 " [,localport=localport][,ipv4][,ipv6][,mux=on|off]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005211 " [,logfile=PATH][,logappend=on|off]\n"
5212 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005213 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005214 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5215 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
5216 "-chardev file,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5217 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005218#ifdef _WIN32
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005219 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5220 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005221#else
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005222 "-chardev pty,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5223 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005224#endif
5225#ifdef CONFIG_BRLAPI
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005226 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005227#endif
5228#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
5229 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005230 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5231 "-chardev tty,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005232#endif
5233#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005234 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5235 "-chardev parport,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005236#endif
Alon Levycbcc6332011-01-19 10:49:50 +02005237#if defined(CONFIG_SPICE)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005238 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
5239 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
Alon Levycbcc6332011-01-19 10:49:50 +02005240#endif
Blue Swirlad960902010-03-29 19:23:52 +00005241 , QEMU_ARCH_ALL
Matthew Booth7273a2d2009-10-30 13:41:12 +00005242)
5243
5244STEXI
Markus Armbrusterdddba062017-10-02 16:03:06 +02005245
5246The general form of a character device option is:
5247@table @option
Thomas Huth16fdc562018-01-30 10:36:21 +01005248@item -chardev @var{backend},id=@var{id}[,mux=on|off][,@var{options}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01005249@findex -chardev
Matthew Booth7273a2d2009-10-30 13:41:12 +00005250Backend is one of:
5251@option{null},
5252@option{socket},
5253@option{udp},
5254@option{msmouse},
5255@option{vc},
Markus Armbruster4f573782013-07-26 16:44:32 +02005256@option{ringbuf},
Matthew Booth7273a2d2009-10-30 13:41:12 +00005257@option{file},
5258@option{pipe},
5259@option{console},
5260@option{serial},
5261@option{pty},
5262@option{stdio},
5263@option{braille},
5264@option{tty},
Gerd Hoffmann88a946d2013-01-10 14:20:58 +01005265@option{parallel},
Alon Levycbcc6332011-01-19 10:49:50 +02005266@option{parport},
Thomas Huth16fdc562018-01-30 10:36:21 +01005267@option{spicevmc},
Marc-André Lureau5a49d3e2012-12-05 16:15:34 +01005268@option{spiceport}.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005269The specific backend will determine the applicable options.
5270
Markus Armbrusterdddba062017-10-02 16:03:06 +02005271Use @code{-chardev help} to print all available chardev backend types.
Lin Ma517b3d42016-08-17 01:13:52 +08005272
Matthew Booth7273a2d2009-10-30 13:41:12 +00005273All devices must have an id, which can be any string up to 127 characters long.
5274It is used to uniquely identify this device in other command line directives.
5275
Jan Kiszka97331282010-04-06 16:55:54 +02005276A character device may be used in multiplexing mode by multiple front-ends.
Peter Maydella40db1b2016-02-16 17:28:58 +00005277Specify @option{mux=on} to enable this mode.
5278A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
5279backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
5280If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
5281create a multiplexer with your specified ID, and you can then configure multiple
5282front ends to use that chardev ID for their input/output. Up to four different
5283front ends can be connected to a single multiplexed chardev. (Without
5284multiplexing enabled, a chardev can only be used by a single front end.)
5285For instance you could use this to allow a single stdio chardev to be used by
5286two serial ports and the QEMU monitor:
5287
5288@example
5289-chardev stdio,mux=on,id=char0 \
Marc-André Lureaubdbcb542016-10-11 21:41:21 +04005290-mon chardev=char0,mode=readline \
Peter Maydella40db1b2016-02-16 17:28:58 +00005291-serial chardev:char0 \
5292-serial chardev:char0
5293@end example
5294
5295You can have more than one multiplexer in a system configuration; for instance
5296you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
5297multiplexed between the QEMU monitor and a parallel port:
5298
5299@example
5300-chardev stdio,mux=on,id=char0 \
Marc-André Lureaubdbcb542016-10-11 21:41:21 +04005301-mon chardev=char0,mode=readline \
Peter Maydella40db1b2016-02-16 17:28:58 +00005302-parallel chardev:char0 \
5303-chardev tcp,...,mux=on,id=char1 \
5304-serial chardev:char1 \
5305-serial chardev:char1
5306@end example
5307
5308When you're using a multiplexed character device, some escape sequences are
5309interpreted in the input. @xref{mux_keys, Keys in the character backend
5310multiplexer}.
5311
5312Note that some other command line options may implicitly create multiplexed
5313character backends; for instance @option{-serial mon:stdio} creates a
5314multiplexed stdio backend connected to the serial port and the QEMU monitor,
5315and @option{-nographic} also multiplexes the console and the monitor to
5316stdio.
5317
5318There is currently no support for multiplexing in the other direction
5319(where a single QEMU front end takes input and output from multiple chardevs).
Jan Kiszka97331282010-04-06 16:55:54 +02005320
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005321Every backend supports the @option{logfile} option, which supplies the path
5322to a file to record all data transmitted via the backend. The @option{logappend}
5323option controls whether the log file will be truncated or appended to when
5324opened.
5325
Markus Armbrusterdddba062017-10-02 16:03:06 +02005326@end table
Matthew Booth7273a2d2009-10-30 13:41:12 +00005327
Markus Armbrusterdddba062017-10-02 16:03:06 +02005328The available backends are:
5329
5330@table @option
Thomas Huth16fdc562018-01-30 10:36:21 +01005331@item -chardev null,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005332A void device. This device will not emit any data, and will drop any data it
5333receives. The null backend does not take any options.
5334
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005335@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}]
Matthew Booth7273a2d2009-10-30 13:41:12 +00005336
5337Create a two-way stream socket, which can be either a TCP or a unix socket. A
5338unix socket will be created if @option{path} is specified. Behaviour is
5339undefined if TCP options are specified for a unix socket.
5340
5341@option{server} specifies that the socket shall be a listening socket.
5342
5343@option{nowait} specifies that QEMU should not block waiting for a client to
5344connect to a listening socket.
5345
5346@option{telnet} specifies that traffic on the socket should interpret telnet
5347escape sequences.
5348
Julia Suvorova981b06e2018-10-19 01:35:00 +03005349@option{websocket} specifies that the socket uses WebSocket protocol for
5350communication.
5351
Corey Minyard5dd1f022014-10-02 11:17:37 -05005352@option{reconnect} sets the timeout for reconnecting on non-server sockets when
5353the remote end goes away. qemu will delay this many seconds and then attempt
5354to reconnect. Zero disables reconnecting, and is the default.
5355
Daniel P. Berrangea8fb5422016-01-19 11:14:31 +00005356@option{tls-creds} requests enablement of the TLS protocol for encryption,
5357and specifies the id of the TLS credentials to use for the handshake. The
5358credentials must be previously created with the @option{-object tls-creds}
5359argument.
5360
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005361@option{tls-auth} provides the ID of the QAuthZ authorization object against
5362which the client's x509 distinguished name will be validated. This object is
5363only resolved at time of use, so can be deleted and recreated on the fly
5364while the chardev server is active. If missing, it will default to denying
5365access.
5366
Matthew Booth7273a2d2009-10-30 13:41:12 +00005367TCP and unix socket options are given below:
5368
5369@table @option
5370
Thomas Huth16fdc562018-01-30 10:36:21 +01005371@item TCP options: port=@var{port}[,host=@var{host}][,to=@var{to}][,ipv4][,ipv6][,nodelay]
Matthew Booth7273a2d2009-10-30 13:41:12 +00005372
5373@option{host} for a listening socket specifies the local address to be bound.
5374For a connecting socket species the remote host to connect to. @option{host} is
5375optional for listening sockets. If not specified it defaults to @code{0.0.0.0}.
5376
5377@option{port} for a listening socket specifies the local port to be bound. For a
5378connecting socket specifies the port on the remote host to connect to.
5379@option{port} can be given as either a port number or a service name.
5380@option{port} is required.
5381
5382@option{to} is only relevant to listening sockets. If it is specified, and
5383@option{port} cannot be bound, QEMU will attempt to bind to subsequent ports up
5384to and including @option{to} until it succeeds. @option{to} must be specified
5385as a port number.
5386
5387@option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5388If neither is specified the socket may use either protocol.
5389
5390@option{nodelay} disables the Nagle algorithm.
5391
5392@item unix options: path=@var{path}
5393
5394@option{path} specifies the local path of the unix socket. @option{path} is
5395required.
5396
5397@end table
5398
Thomas Huth16fdc562018-01-30 10:36:21 +01005399@item -chardev udp,id=@var{id}[,host=@var{host}],port=@var{port}[,localaddr=@var{localaddr}][,localport=@var{localport}][,ipv4][,ipv6]
Matthew Booth7273a2d2009-10-30 13:41:12 +00005400
5401Sends all traffic from the guest to a remote host over UDP.
5402
5403@option{host} specifies the remote host to connect to. If not specified it
5404defaults to @code{localhost}.
5405
5406@option{port} specifies the port on the remote host to connect to. @option{port}
5407is required.
5408
5409@option{localaddr} specifies the local address to bind to. If not specified it
5410defaults to @code{0.0.0.0}.
5411
5412@option{localport} specifies the local port to bind to. If not specified any
5413available local port will be used.
5414
5415@option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5416If neither is specified the device may use either protocol.
5417
Thomas Huth16fdc562018-01-30 10:36:21 +01005418@item -chardev msmouse,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005419
5420Forward QEMU's emulated msmouse events to the guest. @option{msmouse} does not
5421take any options.
5422
Thomas Huth16fdc562018-01-30 10:36:21 +01005423@item -chardev vc,id=@var{id}[[,width=@var{width}][,height=@var{height}]][[,cols=@var{cols}][,rows=@var{rows}]]
Matthew Booth7273a2d2009-10-30 13:41:12 +00005424
5425Connect to a QEMU text console. @option{vc} may optionally be given a specific
5426size.
5427
5428@option{width} and @option{height} specify the width and height respectively of
5429the console, in pixels.
5430
5431@option{cols} and @option{rows} specify that the console be sized to fit a text
5432console with the given dimensions.
5433
Thomas Huth16fdc562018-01-30 10:36:21 +01005434@item -chardev ringbuf,id=@var{id}[,size=@var{size}]
Lei Li51767e72013-01-25 00:03:19 +08005435
Markus Armbruster3949e592013-02-06 21:27:24 +01005436Create a ring buffer with fixed size @option{size}.
Stefan Hajnoczie69f7d22016-09-19 11:56:26 +01005437@var{size} must be a power of two and defaults to @code{64K}.
Lei Li51767e72013-01-25 00:03:19 +08005438
Thomas Huth16fdc562018-01-30 10:36:21 +01005439@item -chardev file,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005440
5441Log all traffic received from the guest to a file.
5442
5443@option{path} specifies the path of the file to be opened. This file will be
5444created if it does not already exist, and overwritten if it does. @option{path}
5445is required.
5446
Thomas Huth16fdc562018-01-30 10:36:21 +01005447@item -chardev pipe,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005448
5449Create a two-way connection to the guest. The behaviour differs slightly between
5450Windows hosts and other hosts:
5451
5452On Windows, a single duplex pipe will be created at
5453@file{\\.pipe\@option{path}}.
5454
5455On other hosts, 2 pipes will be created called @file{@option{path}.in} and
5456@file{@option{path}.out}. Data written to @file{@option{path}.in} will be
5457received by the guest. Data written by the guest can be read from
5458@file{@option{path}.out}. QEMU will not create these fifos, and requires them to
5459be present.
5460
5461@option{path} forms part of the pipe path as described above. @option{path} is
5462required.
5463
Thomas Huth16fdc562018-01-30 10:36:21 +01005464@item -chardev console,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005465
5466Send traffic from the guest to QEMU's standard output. @option{console} does not
5467take any options.
5468
5469@option{console} is only available on Windows hosts.
5470
Thomas Huth16fdc562018-01-30 10:36:21 +01005471@item -chardev serial,id=@var{id},path=@option{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005472
5473Send traffic from the guest to a serial device on the host.
5474
Gerd Hoffmannd59044e2012-12-19 13:50:29 +01005475On Unix hosts serial will actually accept any tty device,
5476not only serial lines.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005477
5478@option{path} specifies the name of the serial device to open.
5479
Thomas Huth16fdc562018-01-30 10:36:21 +01005480@item -chardev pty,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005481
5482Create a new pseudo-terminal on the host and connect to it. @option{pty} does
5483not take any options.
5484
5485@option{pty} is not available on Windows hosts.
5486
Thomas Huth16fdc562018-01-30 10:36:21 +01005487@item -chardev stdio,id=@var{id}[,signal=on|off]
Stefan Weilb65ee4f2012-05-11 22:25:50 +02005488Connect to standard input and standard output of the QEMU process.
Aurelien Jarnob7fdb3a2010-07-13 21:13:12 +02005489
5490@option{signal} controls if signals are enabled on the terminal, that includes
5491exiting QEMU with the key sequence @key{Control-c}. This option is enabled by
5492default, use @option{signal=off} to disable it.
5493
Thomas Huth16fdc562018-01-30 10:36:21 +01005494@item -chardev braille,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005495
5496Connect to a local BrlAPI server. @option{braille} does not take any options.
5497
Thomas Huth16fdc562018-01-30 10:36:21 +01005498@item -chardev tty,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005499
Matthew Booth7273a2d2009-10-30 13:41:12 +00005500@option{tty} is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD and
Markus Armbrusterd037d6b2013-02-13 15:54:15 +01005501DragonFlyBSD hosts. It is an alias for @option{serial}.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005502
5503@option{path} specifies the path to the tty. @option{path} is required.
5504
Thomas Huth16fdc562018-01-30 10:36:21 +01005505@item -chardev parallel,id=@var{id},path=@var{path}
5506@itemx -chardev parport,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005507
Gerd Hoffmann88a946d2013-01-10 14:20:58 +01005508@option{parallel} is only available on Linux, FreeBSD and DragonFlyBSD hosts.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005509
5510Connect to a local parallel port.
5511
5512@option{path} specifies the path to the parallel port device. @option{path} is
5513required.
5514
Thomas Huth16fdc562018-01-30 10:36:21 +01005515@item -chardev spicevmc,id=@var{id},debug=@var{debug},name=@var{name}
Alon Levycbcc6332011-01-19 10:49:50 +02005516
Stefan Hajnoczi3a846902011-10-06 11:24:12 +01005517@option{spicevmc} is only available when spice support is built in.
5518
Alon Levycbcc6332011-01-19 10:49:50 +02005519@option{debug} debug level for spicevmc
5520
5521@option{name} name of spice channel to connect to
5522
5523Connect to a spice virtual machine channel, such as vdiport.
Alon Levycbcc6332011-01-19 10:49:50 +02005524
Thomas Huth16fdc562018-01-30 10:36:21 +01005525@item -chardev spiceport,id=@var{id},debug=@var{debug},name=@var{name}
Marc-André Lureau5a49d3e2012-12-05 16:15:34 +01005526
5527@option{spiceport} is only available when spice support is built in.
5528
5529@option{debug} debug level for spicevmc
5530
5531@option{name} name of spice port to connect to
5532
5533Connect to a spice port, allowing a Spice client to handle the traffic
5534identified by a name (preferably a fqdn).
Matthew Booth7273a2d2009-10-30 13:41:12 +00005535ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005536SRST
5537The general form of a character device option is:
5538
5539``-chardev backend,id=id[,mux=on|off][,options]``
5540 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
5541 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
5542 ``pty``, ``stdio``, ``braille``, ``tty``, ``parallel``, ``parport``,
5543 ``spicevmc``, ``spiceport``. The specific backend will determine the
5544 applicable options.
5545
5546 Use ``-chardev help`` to print all available chardev backend types.
5547
5548 All devices must have an id, which can be any string up to 127
5549 characters long. It is used to uniquely identify this device in
5550 other command line directives.
5551
5552 A character device may be used in multiplexing mode by multiple
5553 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is
5554 a "1:N" device, and here the "1" end is your specified chardev
5555 backend, and the "N" end is the various parts of QEMU that can talk
5556 to a chardev. If you create a chardev with ``id=myid`` and
5557 ``mux=on``, QEMU will create a multiplexer with your specified ID,
5558 and you can then configure multiple front ends to use that chardev
5559 ID for their input/output. Up to four different front ends can be
5560 connected to a single multiplexed chardev. (Without multiplexing
5561 enabled, a chardev can only be used by a single front end.) For
5562 instance you could use this to allow a single stdio chardev to be
5563 used by two serial ports and the QEMU monitor:
5564
5565 ::
5566
5567 -chardev stdio,mux=on,id=char0 \
5568 -mon chardev=char0,mode=readline \
5569 -serial chardev:char0 \
5570 -serial chardev:char0
5571
5572 You can have more than one multiplexer in a system configuration;
5573 for instance you could have a TCP port multiplexed between UART 0
5574 and UART 1, and stdio multiplexed between the QEMU monitor and a
5575 parallel port:
5576
5577 ::
5578
5579 -chardev stdio,mux=on,id=char0 \
5580 -mon chardev=char0,mode=readline \
5581 -parallel chardev:char0 \
5582 -chardev tcp,...,mux=on,id=char1 \
5583 -serial chardev:char1 \
5584 -serial chardev:char1
5585
5586 When you're using a multiplexed character device, some escape
5587 sequences are interpreted in the input. See :ref:`mux_005fkeys`.
5588
5589 Note that some other command line options may implicitly create
5590 multiplexed character backends; for instance ``-serial mon:stdio``
5591 creates a multiplexed stdio backend connected to the serial port and
5592 the QEMU monitor, and ``-nographic`` also multiplexes the console
5593 and the monitor to stdio.
5594
5595 There is currently no support for multiplexing in the other
5596 direction (where a single QEMU front end takes input and output from
5597 multiple chardevs).
5598
5599 Every backend supports the ``logfile`` option, which supplies the
5600 path to a file to record all data transmitted via the backend. The
5601 ``logappend`` option controls whether the log file will be truncated
5602 or appended to when opened.
5603
5604The available backends are:
5605
5606``-chardev null,id=id``
5607 A void device. This device will not emit any data, and will drop any
5608 data it receives. The null backend does not take any options.
5609
5610``-chardev socket,id=id[,TCP options or unix options][,server][,nowait][,telnet][,websocket][,reconnect=seconds][,tls-creds=id][,tls-authz=id]``
5611 Create a two-way stream socket, which can be either a TCP or a unix
5612 socket. A unix socket will be created if ``path`` is specified.
5613 Behaviour is undefined if TCP options are specified for a unix
5614 socket.
5615
5616 ``server`` specifies that the socket shall be a listening socket.
5617
5618 ``nowait`` specifies that QEMU should not block waiting for a client
5619 to connect to a listening socket.
5620
5621 ``telnet`` specifies that traffic on the socket should interpret
5622 telnet escape sequences.
5623
5624 ``websocket`` specifies that the socket uses WebSocket protocol for
5625 communication.
5626
5627 ``reconnect`` sets the timeout for reconnecting on non-server
5628 sockets when the remote end goes away. qemu will delay this many
5629 seconds and then attempt to reconnect. Zero disables reconnecting,
5630 and is the default.
5631
5632 ``tls-creds`` requests enablement of the TLS protocol for
5633 encryption, and specifies the id of the TLS credentials to use for
5634 the handshake. The credentials must be previously created with the
5635 ``-object tls-creds`` argument.
5636
5637 ``tls-auth`` provides the ID of the QAuthZ authorization object
5638 against which the client's x509 distinguished name will be
5639 validated. This object is only resolved at time of use, so can be
5640 deleted and recreated on the fly while the chardev server is active.
5641 If missing, it will default to denying access.
5642
5643 TCP and unix socket options are given below:
5644
5645 ``TCP options: port=port[,host=host][,to=to][,ipv4][,ipv6][,nodelay]``
5646 ``host`` for a listening socket specifies the local address to
5647 be bound. For a connecting socket species the remote host to
5648 connect to. ``host`` is optional for listening sockets. If not
5649 specified it defaults to ``0.0.0.0``.
5650
5651 ``port`` for a listening socket specifies the local port to be
5652 bound. For a connecting socket specifies the port on the remote
5653 host to connect to. ``port`` can be given as either a port
5654 number or a service name. ``port`` is required.
5655
5656 ``to`` is only relevant to listening sockets. If it is
5657 specified, and ``port`` cannot be bound, QEMU will attempt to
5658 bind to subsequent ports up to and including ``to`` until it
5659 succeeds. ``to`` must be specified as a port number.
5660
5661 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be
5662 used. If neither is specified the socket may use either
5663 protocol.
5664
5665 ``nodelay`` disables the Nagle algorithm.
5666
5667 ``unix options: path=path``
5668 ``path`` specifies the local path of the unix socket. ``path``
5669 is required.
5670
5671``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4][,ipv6]``
5672 Sends all traffic from the guest to a remote host over UDP.
5673
5674 ``host`` specifies the remote host to connect to. If not specified
5675 it defaults to ``localhost``.
5676
5677 ``port`` specifies the port on the remote host to connect to.
5678 ``port`` is required.
5679
5680 ``localaddr`` specifies the local address to bind to. If not
5681 specified it defaults to ``0.0.0.0``.
5682
5683 ``localport`` specifies the local port to bind to. If not specified
5684 any available local port will be used.
5685
5686 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be used.
5687 If neither is specified the device may use either protocol.
5688
5689``-chardev msmouse,id=id``
5690 Forward QEMU's emulated msmouse events to the guest. ``msmouse``
5691 does not take any options.
5692
5693``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]``
5694 Connect to a QEMU text console. ``vc`` may optionally be given a
5695 specific size.
5696
5697 ``width`` and ``height`` specify the width and height respectively
5698 of the console, in pixels.
5699
5700 ``cols`` and ``rows`` specify that the console be sized to fit a
5701 text console with the given dimensions.
5702
5703``-chardev ringbuf,id=id[,size=size]``
5704 Create a ring buffer with fixed size ``size``. size must be a power
5705 of two and defaults to ``64K``.
5706
5707``-chardev file,id=id,path=path``
5708 Log all traffic received from the guest to a file.
5709
5710 ``path`` specifies the path of the file to be opened. This file will
5711 be created if it does not already exist, and overwritten if it does.
5712 ``path`` is required.
5713
5714``-chardev pipe,id=id,path=path``
5715 Create a two-way connection to the guest. The behaviour differs
5716 slightly between Windows hosts and other hosts:
5717
5718 On Windows, a single duplex pipe will be created at
5719 ``\\.pipe\path``.
5720
5721 On other hosts, 2 pipes will be created called ``path.in`` and
5722 ``path.out``. Data written to ``path.in`` will be received by the
5723 guest. Data written by the guest can be read from ``path.out``. QEMU
5724 will not create these fifos, and requires them to be present.
5725
5726 ``path`` forms part of the pipe path as described above. ``path`` is
5727 required.
5728
5729``-chardev console,id=id``
5730 Send traffic from the guest to QEMU's standard output. ``console``
5731 does not take any options.
5732
5733 ``console`` is only available on Windows hosts.
5734
5735``-chardev serial,id=id,path=path``
5736 Send traffic from the guest to a serial device on the host.
5737
5738 On Unix hosts serial will actually accept any tty device, not only
5739 serial lines.
5740
5741 ``path`` specifies the name of the serial device to open.
5742
5743``-chardev pty,id=id``
5744 Create a new pseudo-terminal on the host and connect to it. ``pty``
5745 does not take any options.
5746
5747 ``pty`` is not available on Windows hosts.
5748
5749``-chardev stdio,id=id[,signal=on|off]``
5750 Connect to standard input and standard output of the QEMU process.
5751
5752 ``signal`` controls if signals are enabled on the terminal, that
5753 includes exiting QEMU with the key sequence Control-c. This option
5754 is enabled by default, use ``signal=off`` to disable it.
5755
5756``-chardev braille,id=id``
5757 Connect to a local BrlAPI server. ``braille`` does not take any
5758 options.
5759
5760``-chardev tty,id=id,path=path``
5761 ``tty`` is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD
5762 and DragonFlyBSD hosts. It is an alias for ``serial``.
5763
5764 ``path`` specifies the path to the tty. ``path`` is required.
5765
Peter Maydell09ce5f22020-02-28 15:36:13 +00005766``-chardev parallel,id=id,path=path``
5767 \
5768``-chardev parport,id=id,path=path``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005769 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
5770 hosts.
5771
5772 Connect to a local parallel port.
5773
5774 ``path`` specifies the path to the parallel port device. ``path`` is
5775 required.
5776
5777``-chardev spicevmc,id=id,debug=debug,name=name``
5778 ``spicevmc`` is only available when spice support is built in.
5779
5780 ``debug`` debug level for spicevmc
5781
5782 ``name`` name of spice channel to connect to
5783
5784 Connect to a spice virtual machine channel, such as vdiport.
5785
5786``-chardev spiceport,id=id,debug=debug,name=name``
5787 ``spiceport`` is only available when spice support is built in.
5788
5789 ``debug`` debug level for spicevmc
5790
5791 ``name`` name of spice port to connect to
5792
5793 Connect to a spice port, allowing a Spice client to handle the
5794 traffic identified by a name (preferably a fqdn).
5795ERST
Matthew Booth7273a2d2009-10-30 13:41:12 +00005796
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01005797STEXI
5798@end table
5799ETEXI
Matthew Booth7273a2d2009-10-30 13:41:12 +00005800DEFHEADING()
5801
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005802#ifdef CONFIG_TPM
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005803DEFHEADING(TPM device options:)
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005804
5805DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
Stefan Berger92dcc232013-02-27 12:47:54 -05005806 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
5807 " use path to provide path to a character device; default is /dev/tpm0\n"
5808 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
Amarnath Vallurif4ede812017-09-29 14:10:20 +03005809 " not provided it will be searched for in /sys/class/misc/tpm?/device\n"
5810 "-tpmdev emulator,id=id,chardev=dev\n"
5811 " configure the TPM device using chardev backend\n",
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005812 QEMU_ARCH_ALL)
5813STEXI
5814
5815The general form of a TPM device option is:
5816@table @option
5817
Thomas Huth16fdc562018-01-30 10:36:21 +01005818@item -tpmdev @var{backend},id=@var{id}[,@var{options}]
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005819@findex -tpmdev
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005820
5821The specific backend type will determine the applicable options.
Corey Bryant28c4fa32013-03-20 12:34:49 -04005822The @code{-tpmdev} option creates the TPM backend and requires a
5823@code{-device} option that specifies the TPM frontend interface model.
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005824
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005825Use @code{-tpmdev help} to print all available TPM backend types.
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005826
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005827@end table
5828
5829The available backends are:
5830
5831@table @option
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005832
Thomas Huth16fdc562018-01-30 10:36:21 +01005833@item -tpmdev passthrough,id=@var{id},path=@var{path},cancel-path=@var{cancel-path}
Stefan Berger4549a8b2013-02-27 12:47:53 -05005834
5835(Linux-host only) Enable access to the host's TPM using the passthrough
5836driver.
5837
5838@option{path} specifies the path to the host's TPM device, i.e., on
5839a Linux host this would be @code{/dev/tpm0}.
5840@option{path} is optional and by default @code{/dev/tpm0} is used.
5841
Stefan Berger92dcc232013-02-27 12:47:54 -05005842@option{cancel-path} specifies the path to the host TPM device's sysfs
5843entry allowing for cancellation of an ongoing TPM command.
5844@option{cancel-path} is optional and by default QEMU will search for the
5845sysfs entry to use.
5846
Stefan Berger4549a8b2013-02-27 12:47:53 -05005847Some notes about using the host's TPM with the passthrough driver:
5848
5849The TPM device accessed by the passthrough driver must not be
5850used by any other application on the host.
5851
5852Since the host's firmware (BIOS/UEFI) has already initialized the TPM,
5853the VM's firmware (BIOS/UEFI) will not be able to initialize the
5854TPM again and may therefore not show a TPM-specific menu that would
5855otherwise allow the user to configure the TPM, e.g., allow the user to
5856enable/disable or activate/deactivate the TPM.
5857Further, if TPM ownership is released from within a VM then the host's TPM
5858will get disabled and deactivated. To enable and activate the
5859TPM again afterwards, the host has to be rebooted and the user is
5860required to enter the firmware's menu to enable and activate the TPM.
5861If the TPM is left disabled and/or deactivated most TPM commands will fail.
5862
5863To create a passthrough TPM use the following two options:
5864@example
5865-tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5866@end example
5867Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
5868@code{tpmdev=tpm0} in the device option.
5869
Thomas Huth16fdc562018-01-30 10:36:21 +01005870@item -tpmdev emulator,id=@var{id},chardev=@var{dev}
Amarnath Vallurif4ede812017-09-29 14:10:20 +03005871
5872(Linux-host only) Enable access to a TPM emulator using Unix domain socket based
5873chardev backend.
5874
5875@option{chardev} specifies the unique ID of a character device backend that provides connection to the software TPM server.
5876
5877To create a TPM emulator backend device with chardev socket backend:
5878@example
5879
5880-chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5881
5882@end example
5883
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005884ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005885SRST
5886The general form of a TPM device option is:
5887
5888``-tpmdev backend,id=id[,options]``
5889 The specific backend type will determine the applicable options. The
5890 ``-tpmdev`` option creates the TPM backend and requires a
5891 ``-device`` option that specifies the TPM frontend interface model.
5892
5893 Use ``-tpmdev help`` to print all available TPM backend types.
5894
5895The available backends are:
5896
5897``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path``
5898 (Linux-host only) Enable access to the host's TPM using the
5899 passthrough driver.
5900
5901 ``path`` specifies the path to the host's TPM device, i.e., on a
5902 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by
5903 default ``/dev/tpm0`` is used.
5904
5905 ``cancel-path`` specifies the path to the host TPM device's sysfs
5906 entry allowing for cancellation of an ongoing TPM command.
5907 ``cancel-path`` is optional and by default QEMU will search for the
5908 sysfs entry to use.
5909
5910 Some notes about using the host's TPM with the passthrough driver:
5911
5912 The TPM device accessed by the passthrough driver must not be used
5913 by any other application on the host.
5914
5915 Since the host's firmware (BIOS/UEFI) has already initialized the
5916 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize
5917 the TPM again and may therefore not show a TPM-specific menu that
5918 would otherwise allow the user to configure the TPM, e.g., allow the
5919 user to enable/disable or activate/deactivate the TPM. Further, if
5920 TPM ownership is released from within a VM then the host's TPM will
5921 get disabled and deactivated. To enable and activate the TPM again
5922 afterwards, the host has to be rebooted and the user is required to
5923 enter the firmware's menu to enable and activate the TPM. If the TPM
5924 is left disabled and/or deactivated most TPM commands will fail.
5925
5926 To create a passthrough TPM use the following two options:
5927
5928 ::
5929
5930 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5931
5932 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by
5933 ``tpmdev=tpm0`` in the device option.
5934
5935``-tpmdev emulator,id=id,chardev=dev``
5936 (Linux-host only) Enable access to a TPM emulator using Unix domain
5937 socket based chardev backend.
5938
5939 ``chardev`` specifies the unique ID of a character device backend
5940 that provides connection to the software TPM server.
5941
5942 To create a TPM emulator backend device with chardev socket backend:
5943
5944 ::
5945
5946 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5947ERST
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005948
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005949STEXI
5950@end table
5951ETEXI
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005952DEFHEADING()
5953
5954#endif
5955
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005956DEFHEADING(Linux/Multiboot boot specific:)
blueswir15824d652009-03-28 06:44:27 +00005957STEXI
Alexander Graf7677f052009-06-28 16:55:55 +02005958
5959When using these options, you can use a given Linux or Multiboot
5960kernel without installing it in the disk image. It can be useful
blueswir15824d652009-03-28 06:44:27 +00005961for easier testing of various kernels.
5962
5963@table @option
5964ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005965SRST
5966When using these options, you can use a given Linux or Multiboot kernel
5967without installing it in the disk image. It can be useful for easier
5968testing of various kernels.
5969
5970
5971ERST
blueswir15824d652009-03-28 06:44:27 +00005972
5973DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
Blue Swirlad960902010-03-29 19:23:52 +00005974 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00005975STEXI
5976@item -kernel @var{bzImage}
Stefan Weil6616b2a2010-02-05 23:52:05 +01005977@findex -kernel
Alexander Graf7677f052009-06-28 16:55:55 +02005978Use @var{bzImage} as kernel image. The kernel can be either a Linux kernel
5979or in multiboot format.
blueswir15824d652009-03-28 06:44:27 +00005980ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005981SRST
5982``-kernel bzImage``
5983 Use bzImage as kernel image. The kernel can be either a Linux kernel
5984 or in multiboot format.
5985ERST
blueswir15824d652009-03-28 06:44:27 +00005986
5987DEF("append", HAS_ARG, QEMU_OPTION_append, \
Blue Swirlad960902010-03-29 19:23:52 +00005988 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00005989STEXI
5990@item -append @var{cmdline}
Stefan Weil6616b2a2010-02-05 23:52:05 +01005991@findex -append
blueswir15824d652009-03-28 06:44:27 +00005992Use @var{cmdline} as kernel command line
5993ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005994SRST
5995``-append cmdline``
5996 Use cmdline as kernel command line
5997ERST
blueswir15824d652009-03-28 06:44:27 +00005998
5999DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
Blue Swirlad960902010-03-29 19:23:52 +00006000 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006001STEXI
6002@item -initrd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006003@findex -initrd
blueswir15824d652009-03-28 06:44:27 +00006004Use @var{file} as initial ram disk.
Alexander Graf7677f052009-06-28 16:55:55 +02006005
6006@item -initrd "@var{file1} arg=foo,@var{file2}"
6007
6008This syntax is only available with multiboot.
6009
6010Use @var{file1} and @var{file2} as modules and pass arg=foo as parameter to the
6011first module.
blueswir15824d652009-03-28 06:44:27 +00006012ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006013SRST
6014``-initrd file``
6015 Use file as initial ram disk.
6016
6017``-initrd "file1 arg=foo,file2"``
6018 This syntax is only available with multiboot.
6019
6020 Use file1 and file2 as modules and pass arg=foo as parameter to the
6021 first module.
6022ERST
blueswir15824d652009-03-28 06:44:27 +00006023
Grant Likely412beee2012-03-02 11:56:38 +00006024DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \
Peter A. G. Crosthwaite379b5c72012-03-04 21:03:54 +10006025 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL)
Grant Likely412beee2012-03-02 11:56:38 +00006026STEXI
6027@item -dtb @var{file}
6028@findex -dtb
6029Use @var{file} as a device tree binary (dtb) image and pass it to the kernel
6030on boot.
6031ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006032SRST
6033``-dtb file``
6034 Use file as a device tree binary (dtb) image and pass it to the
6035 kernel on boot.
6036ERST
Grant Likely412beee2012-03-02 11:56:38 +00006037
blueswir15824d652009-03-28 06:44:27 +00006038STEXI
6039@end table
6040ETEXI
blueswir15824d652009-03-28 06:44:27 +00006041DEFHEADING()
6042
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02006043DEFHEADING(Debug/Expert options:)
blueswir15824d652009-03-28 06:44:27 +00006044STEXI
6045@table @option
6046ETEXI
6047
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006048DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
6049 "-fw_cfg [name=]<name>,file=<file>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02006050 " add named fw_cfg entry with contents from file\n"
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04006051 "-fw_cfg [name=]<name>,string=<str>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02006052 " add named fw_cfg entry with contents from string\n",
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006053 QEMU_ARCH_ALL)
6054STEXI
Markus Armbruster63d31452016-04-18 18:29:50 +02006055
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006056@item -fw_cfg [name=]@var{name},file=@var{file}
6057@findex -fw_cfg
Markus Armbruster63d31452016-04-18 18:29:50 +02006058Add named fw_cfg entry with contents from file @var{file}.
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04006059
6060@item -fw_cfg [name=]@var{name},string=@var{str}
Markus Armbruster63d31452016-04-18 18:29:50 +02006061Add named fw_cfg entry with contents from string @var{str}.
6062
6063The terminating NUL character of the contents of @var{str} will not be
6064included as part of the fw_cfg item data. To insert contents with
6065embedded NUL characters, you have to use the @var{file} parameter.
6066
6067The fw_cfg entries are passed by QEMU through to the guest.
6068
6069Example:
6070@example
6071 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6072@end example
6073creates an fw_cfg entry named opt/com.mycompany/blob with contents
6074from ./my_blob.bin.
6075
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006076ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006077SRST
6078``-fw_cfg [name=]name,file=file``
6079 Add named fw\_cfg entry with contents from file file.
6080
6081``-fw_cfg [name=]name,string=str``
6082 Add named fw\_cfg entry with contents from string str.
6083
6084 The terminating NUL character of the contents of str will not be
6085 included as part of the fw\_cfg item data. To insert contents with
6086 embedded NUL characters, you have to use the file parameter.
6087
6088 The fw\_cfg entries are passed by QEMU through to the guest.
6089
6090 Example:
6091
6092 ::
6093
6094 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6095
6096 creates an fw\_cfg entry named opt/com.mycompany/blob with contents
6097 from ./my\_blob.bin.
6098ERST
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006099
blueswir15824d652009-03-28 06:44:27 +00006100DEF("serial", HAS_ARG, QEMU_OPTION_serial, \
Blue Swirlad960902010-03-29 19:23:52 +00006101 "-serial dev redirect the serial port to char device 'dev'\n",
6102 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006103STEXI
6104@item -serial @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006105@findex -serial
blueswir15824d652009-03-28 06:44:27 +00006106Redirect the virtual serial port to host character device
6107@var{dev}. The default device is @code{vc} in graphical mode and
6108@code{stdio} in non graphical mode.
6109
6110This option can be used several times to simulate up to 4 serial
6111ports.
6112
6113Use @code{-serial none} to disable all serial ports.
6114
6115Available character devices are:
Kevin Wolfb3f046c2009-10-09 10:58:35 +02006116@table @option
Kevin Wolf4e257e52009-10-09 10:58:36 +02006117@item vc[:@var{W}x@var{H}]
blueswir15824d652009-03-28 06:44:27 +00006118Virtual console. Optionally, a width and height can be given in pixel with
6119@example
6120vc:800x600
6121@end example
6122It is also possible to specify width or height in characters:
6123@example
6124vc:80Cx24C
6125@end example
6126@item pty
6127[Linux only] Pseudo TTY (a new PTY is automatically allocated)
6128@item none
6129No device is allocated.
6130@item null
6131void device
Ingo van Lil88e020e2013-12-20 14:44:53 +01006132@item chardev:@var{id}
6133Use a named character device defined with the @code{-chardev} option.
blueswir15824d652009-03-28 06:44:27 +00006134@item /dev/XXX
6135[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
6136parameters are set according to the emulated ones.
6137@item /dev/parport@var{N}
6138[Linux only, parallel port only] Use host parallel port
6139@var{N}. Currently SPP and EPP parallel port features can be used.
6140@item file:@var{filename}
6141Write output to @var{filename}. No character can be read.
6142@item stdio
6143[Unix only] standard input/output
6144@item pipe:@var{filename}
6145name pipe @var{filename}
6146@item COM@var{n}
6147[Windows only] Use host serial port @var{n}
6148@item udp:[@var{remote_host}]:@var{remote_port}[@@[@var{src_ip}]:@var{src_port}]
6149This implements UDP Net Console.
6150When @var{remote_host} or @var{src_ip} are not specified
6151they default to @code{0.0.0.0}.
6152When not using a specified @var{src_port} a random port is automatically chosen.
blueswir15824d652009-03-28 06:44:27 +00006153
6154If you just want a simple readonly console you can use @code{netcat} or
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006155@code{nc}, by starting QEMU with: @code{-serial udp::4555} and nc as:
6156@code{nc -u -l -p 4555}. Any time QEMU writes something to that port it
blueswir15824d652009-03-28 06:44:27 +00006157will appear in the netconsole session.
6158
6159If you plan to send characters back via netconsole or you want to stop
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006160and start QEMU a lot of times, you should have QEMU use the same
blueswir15824d652009-03-28 06:44:27 +00006161source port each time by using something like @code{-serial
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006162udp::4555@@:4556} to QEMU. Another approach is to use a patched
blueswir15824d652009-03-28 06:44:27 +00006163version of netcat which can listen to a TCP port and send and receive
6164characters via udp. If you have a patched version of netcat which
6165activates telnet remote echo and single char transfer, then you can
Marc-André Lureaubd1caa32016-12-22 18:56:38 +04006166use the following options to set up a netcat redirector to allow
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006167telnet on port 5555 to access the QEMU port.
blueswir15824d652009-03-28 06:44:27 +00006168@table @code
Stefan Weil071c9392012-04-07 09:23:36 +02006169@item QEMU Options:
blueswir15824d652009-03-28 06:44:27 +00006170-serial udp::4555@@:4556
6171@item netcat options:
6172-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6173@item telnet options:
6174localhost 5555
6175@end table
6176
Corey Minyard5dd1f022014-10-02 11:17:37 -05006177@item tcp:[@var{host}]:@var{port}[,@var{server}][,nowait][,nodelay][,reconnect=@var{seconds}]
blueswir15824d652009-03-28 06:44:27 +00006178The TCP Net Console has two modes of operation. It can send the serial
6179I/O to a location or wait for a connection from a location. By default
6180the TCP Net Console is sent to @var{host} at the @var{port}. If you use
6181the @var{server} option QEMU will wait for a client socket application
6182to connect to the port before continuing, unless the @code{nowait}
6183option was specified. The @code{nodelay} option disables the Nagle buffering
Corey Minyard5dd1f022014-10-02 11:17:37 -05006184algorithm. The @code{reconnect} option only applies if @var{noserver} is
6185set, if the connection goes down it will attempt to reconnect at the
6186given interval. If @var{host} is omitted, 0.0.0.0 is assumed. Only
blueswir15824d652009-03-28 06:44:27 +00006187one TCP connection at a time is accepted. You can use @code{telnet} to
6188connect to the corresponding character device.
6189@table @code
6190@item Example to send tcp console to 192.168.0.2 port 4444
6191-serial tcp:192.168.0.2:4444
6192@item Example to listen and wait on port 4444 for connection
6193-serial tcp::4444,server
6194@item Example to not wait and listen on ip 192.168.0.100 port 4444
6195-serial tcp:192.168.0.100:4444,server,nowait
6196@end table
6197
6198@item telnet:@var{host}:@var{port}[,server][,nowait][,nodelay]
6199The telnet protocol is used instead of raw tcp sockets. The options
6200work the same as if you had specified @code{-serial tcp}. The
6201difference is that the port acts like a telnet server or client using
6202telnet option negotiation. This will also allow you to send the
6203MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
6204sequence. Typically in unix telnet you do it with Control-] and then
6205type "send break" followed by pressing the enter key.
6206
Julia Suvorova981b06e2018-10-19 01:35:00 +03006207@item websocket:@var{host}:@var{port},server[,nowait][,nodelay]
6208The WebSocket protocol is used instead of raw tcp socket. The port acts as
6209a WebSocket server. Client mode is not supported.
6210
Corey Minyard5dd1f022014-10-02 11:17:37 -05006211@item unix:@var{path}[,server][,nowait][,reconnect=@var{seconds}]
blueswir15824d652009-03-28 06:44:27 +00006212A unix domain socket is used instead of a tcp socket. The option works the
6213same as if you had specified @code{-serial tcp} except the unix domain socket
6214@var{path} is used for connections.
6215
6216@item mon:@var{dev_string}
6217This is a special option to allow the monitor to be multiplexed onto
6218another serial port. The monitor is accessed with key sequence of
Paolo Bonzini02c4bdf2013-07-03 20:29:45 +04006219@key{Control-a} and then pressing @key{c}.
blueswir15824d652009-03-28 06:44:27 +00006220@var{dev_string} should be any one of the serial devices specified
6221above. An example to multiplex the monitor onto a telnet server
6222listening on port 4444 would be:
6223@table @code
6224@item -serial mon:telnet::4444,server,nowait
6225@end table
Michael Tokarevbe022d62013-07-11 12:55:50 +04006226When the monitor is multiplexed to stdio in this way, Ctrl+C will not terminate
6227QEMU any more but will be passed to the guest instead.
blueswir15824d652009-03-28 06:44:27 +00006228
6229@item braille
6230Braille device. This will use BrlAPI to display the braille output on a real
6231or fake device.
6232
Kevin Wolfbe8b28a2009-10-09 10:58:37 +02006233@item msmouse
6234Three button serial mouse. Configure the guest to use Microsoft protocol.
blueswir15824d652009-03-28 06:44:27 +00006235@end table
6236ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006237SRST
6238``-serial dev``
6239 Redirect the virtual serial port to host character device dev. The
6240 default device is ``vc`` in graphical mode and ``stdio`` in non
6241 graphical mode.
6242
6243 This option can be used several times to simulate up to 4 serial
6244 ports.
6245
6246 Use ``-serial none`` to disable all serial ports.
6247
6248 Available character devices are:
6249
6250 ``vc[:WxH]``
6251 Virtual console. Optionally, a width and height can be given in
6252 pixel with
6253
6254 ::
6255
6256 vc:800x600
6257
6258 It is also possible to specify width or height in characters:
6259
6260 ::
6261
6262 vc:80Cx24C
6263
6264 ``pty``
6265 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
6266
6267 ``none``
6268 No device is allocated.
6269
6270 ``null``
6271 void device
6272
6273 ``chardev:id``
6274 Use a named character device defined with the ``-chardev``
6275 option.
6276
6277 ``/dev/XXX``
6278 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial
6279 port parameters are set according to the emulated ones.
6280
6281 ``/dev/parportN``
6282 [Linux only, parallel port only] Use host parallel port N.
6283 Currently SPP and EPP parallel port features can be used.
6284
6285 ``file:filename``
6286 Write output to filename. No character can be read.
6287
6288 ``stdio``
6289 [Unix only] standard input/output
6290
6291 ``pipe:filename``
6292 name pipe filename
6293
6294 ``COMn``
6295 [Windows only] Use host serial port n
6296
6297 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]``
6298 This implements UDP Net Console. When remote\_host or src\_ip
6299 are not specified they default to ``0.0.0.0``. When not using a
6300 specified src\_port a random port is automatically chosen.
6301
6302 If you just want a simple readonly console you can use
6303 ``netcat`` or ``nc``, by starting QEMU with:
6304 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time
6305 QEMU writes something to that port it will appear in the
6306 netconsole session.
6307
6308 If you plan to send characters back via netconsole or you want
6309 to stop and start QEMU a lot of times, you should have QEMU use
6310 the same source port each time by using something like ``-serial
6311 udp::4555@:4556`` to QEMU. Another approach is to use a patched
6312 version of netcat which can listen to a TCP port and send and
6313 receive characters via udp. If you have a patched version of
6314 netcat which activates telnet remote echo and single char
6315 transfer, then you can use the following options to set up a
6316 netcat redirector to allow telnet on port 5555 to access the
6317 QEMU port.
6318
6319 ``QEMU Options:``
6320 -serial udp::4555@:4556
6321
6322 ``netcat options:``
6323 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6324
6325 ``telnet options:``
6326 localhost 5555
6327
6328 ``tcp:[host]:port[,server][,nowait][,nodelay][,reconnect=seconds]``
6329 The TCP Net Console has two modes of operation. It can send the
6330 serial I/O to a location or wait for a connection from a
6331 location. By default the TCP Net Console is sent to host at the
6332 port. If you use the server option QEMU will wait for a client
6333 socket application to connect to the port before continuing,
6334 unless the ``nowait`` option was specified. The ``nodelay``
6335 option disables the Nagle buffering algorithm. The ``reconnect``
6336 option only applies if noserver is set, if the connection goes
6337 down it will attempt to reconnect at the given interval. If host
6338 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a
6339 time is accepted. You can use ``telnet`` to connect to the
6340 corresponding character device.
6341
6342 ``Example to send tcp console to 192.168.0.2 port 4444``
6343 -serial tcp:192.168.0.2:4444
6344
6345 ``Example to listen and wait on port 4444 for connection``
6346 -serial tcp::4444,server
6347
6348 ``Example to not wait and listen on ip 192.168.0.100 port 4444``
6349 -serial tcp:192.168.0.100:4444,server,nowait
6350
6351 ``telnet:host:port[,server][,nowait][,nodelay]``
6352 The telnet protocol is used instead of raw tcp sockets. The
6353 options work the same as if you had specified ``-serial tcp``.
6354 The difference is that the port acts like a telnet server or
6355 client using telnet option negotiation. This will also allow you
6356 to send the MAGIC\_SYSRQ sequence if you use a telnet that
6357 supports sending the break sequence. Typically in unix telnet
6358 you do it with Control-] and then type "send break" followed by
6359 pressing the enter key.
6360
6361 ``websocket:host:port,server[,nowait][,nodelay]``
6362 The WebSocket protocol is used instead of raw tcp socket. The
6363 port acts as a WebSocket server. Client mode is not supported.
6364
6365 ``unix:path[,server][,nowait][,reconnect=seconds]``
6366 A unix domain socket is used instead of a tcp socket. The option
6367 works the same as if you had specified ``-serial tcp`` except
6368 the unix domain socket path is used for connections.
6369
6370 ``mon:dev_string``
6371 This is a special option to allow the monitor to be multiplexed
6372 onto another serial port. The monitor is accessed with key
6373 sequence of Control-a and then pressing c. dev\_string should be
6374 any one of the serial devices specified above. An example to
6375 multiplex the monitor onto a telnet server listening on port
6376 4444 would be:
6377
6378 ``-serial mon:telnet::4444,server,nowait``
6379
6380 When the monitor is multiplexed to stdio in this way, Ctrl+C
6381 will not terminate QEMU any more but will be passed to the guest
6382 instead.
6383
6384 ``braille``
6385 Braille device. This will use BrlAPI to display the braille
6386 output on a real or fake device.
6387
6388 ``msmouse``
6389 Three button serial mouse. Configure the guest to use Microsoft
6390 protocol.
6391ERST
blueswir15824d652009-03-28 06:44:27 +00006392
6393DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
Blue Swirlad960902010-03-29 19:23:52 +00006394 "-parallel dev redirect the parallel port to char device 'dev'\n",
6395 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006396STEXI
6397@item -parallel @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006398@findex -parallel
blueswir15824d652009-03-28 06:44:27 +00006399Redirect the virtual parallel port to host device @var{dev} (same
6400devices as the serial port). On Linux hosts, @file{/dev/parportN} can
6401be used to use hardware devices connected on the corresponding host
6402parallel port.
6403
6404This option can be used several times to simulate up to 3 parallel
6405ports.
6406
6407Use @code{-parallel none} to disable all parallel ports.
6408ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006409SRST
6410``-parallel dev``
6411 Redirect the virtual parallel port to host device dev (same devices
6412 as the serial port). On Linux hosts, ``/dev/parportN`` can be used
6413 to use hardware devices connected on the corresponding host parallel
6414 port.
6415
6416 This option can be used several times to simulate up to 3 parallel
6417 ports.
6418
6419 Use ``-parallel none`` to disable all parallel ports.
6420ERST
blueswir15824d652009-03-28 06:44:27 +00006421
6422DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
Blue Swirlad960902010-03-29 19:23:52 +00006423 "-monitor dev redirect the monitor to char device 'dev'\n",
6424 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006425STEXI
Gerd Hoffmann4e307fc2009-12-08 13:11:37 +01006426@item -monitor @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006427@findex -monitor
blueswir15824d652009-03-28 06:44:27 +00006428Redirect the monitor to host device @var{dev} (same devices as the
6429serial port).
6430The default device is @code{vc} in graphical mode and @code{stdio} in
6431non graphical mode.
Luiz Capitulino70e098a2013-05-16 12:02:55 -04006432Use @code{-monitor none} to disable the default monitor.
blueswir15824d652009-03-28 06:44:27 +00006433ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006434SRST
6435``-monitor dev``
6436 Redirect the monitor to host device dev (same devices as the serial
6437 port). The default device is ``vc`` in graphical mode and ``stdio``
6438 in non graphical mode. Use ``-monitor none`` to disable the default
6439 monitor.
6440ERST
Gerd Hoffmann6ca55822009-12-08 13:11:52 +01006441DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
Blue Swirlad960902010-03-29 19:23:52 +00006442 "-qmp dev like -monitor but opens in 'control' mode\n",
6443 QEMU_ARCH_ALL)
Stefan Weil95d5f082010-01-20 22:25:27 +01006444STEXI
6445@item -qmp @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006446@findex -qmp
Stefan Weil95d5f082010-01-20 22:25:27 +01006447Like -monitor but opens in 'control' mode.
6448ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006449SRST
6450``-qmp dev``
6451 Like -monitor but opens in 'control' mode.
6452ERST
Max Reitz4821cd42014-11-17 13:31:04 +01006453DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
6454 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
6455 QEMU_ARCH_ALL)
6456STEXI
6457@item -qmp-pretty @var{dev}
6458@findex -qmp-pretty
6459Like -qmp but uses pretty JSON formatting.
6460ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006461SRST
6462``-qmp-pretty dev``
6463 Like -qmp but uses pretty JSON formatting.
6464ERST
blueswir15824d652009-03-28 06:44:27 +00006465
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006466DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006467 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL)
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006468STEXI
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006469@item -mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006470@findex -mon
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006471Setup monitor on chardev @var{name}. @code{pretty} turns on JSON pretty printing
6472easing human reading and debugging.
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006473ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006474SRST
6475``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]``
6476 Setup monitor on chardev name. ``pretty`` turns on JSON pretty
6477 printing easing human reading and debugging.
6478ERST
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006479
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006480DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
Blue Swirlad960902010-03-29 19:23:52 +00006481 "-debugcon dev redirect the debug console to char device 'dev'\n",
6482 QEMU_ARCH_ALL)
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006483STEXI
6484@item -debugcon @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006485@findex -debugcon
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006486Redirect the debug console to host device @var{dev} (same devices as the
6487serial port). The debug console is an I/O port which is typically port
64880xe9; writing to that I/O port sends output to this device.
6489The default device is @code{vc} in graphical mode and @code{stdio} in
6490non graphical mode.
6491ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006492SRST
6493``-debugcon dev``
6494 Redirect the debug console to host device dev (same devices as the
6495 serial port). The debug console is an I/O port which is typically
6496 port 0xe9; writing to that I/O port sends output to this device. The
6497 default device is ``vc`` in graphical mode and ``stdio`` in non
6498 graphical mode.
6499ERST
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006500
blueswir15824d652009-03-28 06:44:27 +00006501DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
Blue Swirlad960902010-03-29 19:23:52 +00006502 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006503STEXI
6504@item -pidfile @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006505@findex -pidfile
blueswir15824d652009-03-28 06:44:27 +00006506Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
6507from a script.
6508ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006509SRST
6510``-pidfile file``
6511 Store the QEMU process PID in file. It is useful if you launch QEMU
6512 from a script.
6513ERST
blueswir15824d652009-03-28 06:44:27 +00006514
aurel321b530a62009-04-05 20:08:59 +00006515DEF("singlestep", 0, QEMU_OPTION_singlestep, \
Blue Swirlad960902010-03-29 19:23:52 +00006516 "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL)
aurel321b530a62009-04-05 20:08:59 +00006517STEXI
6518@item -singlestep
Stefan Weil6616b2a2010-02-05 23:52:05 +01006519@findex -singlestep
aurel321b530a62009-04-05 20:08:59 +00006520Run the emulation in single step mode.
6521ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006522SRST
6523``-singlestep``
6524 Run the emulation in single step mode.
6525ERST
aurel321b530a62009-04-05 20:08:59 +00006526
Igor Mammedov047f7032018-05-11 19:24:43 +02006527DEF("preconfig", 0, QEMU_OPTION_preconfig, \
Markus Armbruster361ac942018-07-05 11:14:02 +02006528 "--preconfig pause QEMU before machine is initialized (experimental)\n",
Igor Mammedov047f7032018-05-11 19:24:43 +02006529 QEMU_ARCH_ALL)
6530STEXI
6531@item --preconfig
6532@findex --preconfig
6533Pause QEMU for interactive configuration before the machine is created,
6534which allows querying and configuring properties that will affect
Markus Armbruster361ac942018-07-05 11:14:02 +02006535machine initialization. Use QMP command 'x-exit-preconfig' to exit
6536the preconfig state and move to the next state (i.e. run guest if -S
6537isn't used or pause the second time if -S is used). This option is
6538experimental.
Igor Mammedov047f7032018-05-11 19:24:43 +02006539ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006540SRST
6541``--preconfig``
6542 Pause QEMU for interactive configuration before the machine is
6543 created, which allows querying and configuring properties that will
6544 affect machine initialization. Use QMP command 'x-exit-preconfig' to
6545 exit the preconfig state and move to the next state (i.e. run guest
6546 if -S isn't used or pause the second time if -S is used). This
6547 option is experimental.
6548ERST
Igor Mammedov047f7032018-05-11 19:24:43 +02006549
blueswir15824d652009-03-28 06:44:27 +00006550DEF("S", 0, QEMU_OPTION_S, \
Blue Swirlad960902010-03-29 19:23:52 +00006551 "-S freeze CPU at startup (use 'c' to start execution)\n",
6552 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006553STEXI
6554@item -S
Stefan Weil6616b2a2010-02-05 23:52:05 +01006555@findex -S
blueswir15824d652009-03-28 06:44:27 +00006556Do not start CPU at startup (you must type 'c' in the monitor).
6557ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006558SRST
6559``-S``
6560 Do not start CPU at startup (you must type 'c' in the monitor).
6561ERST
blueswir15824d652009-03-28 06:44:27 +00006562
Satoru Moriya888a6bc2013-04-19 16:42:06 +02006563DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
6564 "-realtime [mlock=on|off]\n"
6565 " run qemu with realtime features\n"
6566 " mlock=on|off controls mlock support (default: on)\n",
6567 QEMU_ARCH_ALL)
6568STEXI
6569@item -realtime mlock=on|off
6570@findex -realtime
6571Run qemu with realtime features.
6572mlocking qemu and guest memory can be enabled via @option{mlock=on}
6573(enabled by default).
6574ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006575SRST
6576``-realtime mlock=on|off``
6577 Run qemu with realtime features. mlocking qemu and guest memory can
6578 be enabled via ``mlock=on`` (enabled by default).
6579ERST
Satoru Moriya888a6bc2013-04-19 16:42:06 +02006580
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006581DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02006582 "-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006583 " run qemu with overcommit hints\n"
6584 " mem-lock=on|off controls memory lock support (default: off)\n"
6585 " cpu-pm=on|off controls cpu power management (default: off)\n",
6586 QEMU_ARCH_ALL)
6587STEXI
6588@item -overcommit mem-lock=on|off
6589@item -overcommit cpu-pm=on|off
6590@findex -overcommit
6591Run qemu with hints about host resource overcommit. The default is
6592to assume that host overcommits all resources.
6593
6594Locking qemu and guest memory can be enabled via @option{mem-lock=on} (disabled
6595by default). This works when host memory is not overcommitted and reduces the
6596worst-case latency for guest. This is equivalent to @option{realtime}.
6597
6598Guest ability to manage power state of host cpus (increasing latency for other
6599processes on the same host cpu, but decreasing latency for guest) can be
6600enabled via @option{cpu-pm=on} (disabled by default). This works best when
6601host CPU is not overcommitted. When used, host estimates of CPU cycle and power
6602utilization will be incorrect, not taking into account guest idle time.
6603ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006604SRST
6605``-overcommit mem-lock=on|off``
Peter Maydell09ce5f22020-02-28 15:36:13 +00006606 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006607``-overcommit cpu-pm=on|off``
6608 Run qemu with hints about host resource overcommit. The default is
6609 to assume that host overcommits all resources.
6610
6611 Locking qemu and guest memory can be enabled via ``mem-lock=on``
6612 (disabled by default). This works when host memory is not
6613 overcommitted and reduces the worst-case latency for guest. This is
6614 equivalent to ``realtime``.
6615
6616 Guest ability to manage power state of host cpus (increasing latency
6617 for other processes on the same host cpu, but decreasing latency for
6618 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This
6619 works best when host CPU is not overcommitted. When used, host
6620 estimates of CPU cycle and power utilization will be incorrect, not
6621 taking into account guest idle time.
6622ERST
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006623
aliguori59030a82009-04-05 18:43:41 +00006624DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
Blue Swirlad960902010-03-29 19:23:52 +00006625 "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006626STEXI
aliguori59030a82009-04-05 18:43:41 +00006627@item -gdb @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006628@findex -gdb
aliguori59030a82009-04-05 18:43:41 +00006629Wait for gdb connection on device @var{dev} (@pxref{gdb_usage}). Typical
6630connections will likely be TCP-based, but also UDP, pseudo TTY, or even
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006631stdio are reasonable use case. The latter is allowing to start QEMU from
aliguori59030a82009-04-05 18:43:41 +00006632within gdb and establish the connection via a pipe:
6633@example
Thomas Huth664785a2019-07-30 17:08:26 +02006634(gdb) target remote | exec @value{qemu_system} -gdb stdio ...
aliguori59030a82009-04-05 18:43:41 +00006635@end example
blueswir15824d652009-03-28 06:44:27 +00006636ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006637SRST
6638``-gdb dev``
6639 Wait for gdb connection on device dev (see
6640 :ref:`gdb_005fusage`). Typical connections will likely be
6641 TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable
6642 use case. The latter is allowing to start QEMU from within gdb and
6643 establish the connection via a pipe:
6644
Peter Maydell09ce5f22020-02-28 15:36:13 +00006645 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006646
6647 (gdb) target remote | exec |qemu_system| -gdb stdio ...
6648ERST
blueswir15824d652009-03-28 06:44:27 +00006649
aliguori59030a82009-04-05 18:43:41 +00006650DEF("s", 0, QEMU_OPTION_s, \
Blue Swirlad960902010-03-29 19:23:52 +00006651 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n",
6652 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006653STEXI
aliguori59030a82009-04-05 18:43:41 +00006654@item -s
Stefan Weil6616b2a2010-02-05 23:52:05 +01006655@findex -s
aliguori59030a82009-04-05 18:43:41 +00006656Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6657(@pxref{gdb_usage}).
blueswir15824d652009-03-28 06:44:27 +00006658ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006659SRST
6660``-s``
6661 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6662 (see :ref:`gdb_005fusage`).
6663ERST
blueswir15824d652009-03-28 06:44:27 +00006664
6665DEF("d", HAS_ARG, QEMU_OPTION_d, \
Peter Maydell989b6972013-02-26 17:52:40 +00006666 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n",
Blue Swirlad960902010-03-29 19:23:52 +00006667 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006668STEXI
Peter Maydell989b6972013-02-26 17:52:40 +00006669@item -d @var{item1}[,...]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006670@findex -d
Peter Maydell989b6972013-02-26 17:52:40 +00006671Enable logging of specified items. Use '-d help' for a list of log items.
blueswir15824d652009-03-28 06:44:27 +00006672ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006673SRST
6674``-d item1[,...]``
6675 Enable logging of specified items. Use '-d help' for a list of log
6676 items.
6677ERST
blueswir15824d652009-03-28 06:44:27 +00006678
Matthew Fernandezc235d732011-06-07 16:32:40 +00006679DEF("D", HAS_ARG, QEMU_OPTION_D, \
Peter Maydell989b6972013-02-26 17:52:40 +00006680 "-D logfile output log to logfile (default stderr)\n",
Matthew Fernandezc235d732011-06-07 16:32:40 +00006681 QEMU_ARCH_ALL)
6682STEXI
Stefan Weil8bd383b2012-05-11 22:40:50 +02006683@item -D @var{logfile}
Matthew Fernandezc235d732011-06-07 16:32:40 +00006684@findex -D
Peter Maydell989b6972013-02-26 17:52:40 +00006685Output log in @var{logfile} instead of to stderr
Matthew Fernandezc235d732011-06-07 16:32:40 +00006686ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006687SRST
6688``-D logfile``
6689 Output log in logfile instead of to stderr
6690ERST
Matthew Fernandezc235d732011-06-07 16:32:40 +00006691
Alex Bennée35145522016-03-15 14:30:20 +00006692DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \
6693 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n",
6694 QEMU_ARCH_ALL)
6695STEXI
6696@item -dfilter @var{range1}[,...]
6697@findex -dfilter
6698Filter debug output to that relevant to a range of target addresses. The filter
6699spec can be either @var{start}+@var{size}, @var{start}-@var{size} or
6700@var{start}..@var{end} where @var{start} @var{end} and @var{size} are the
6701addresses and sizes required. For example:
6702@example
6703 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6704@end example
6705Will dump output for any code in the 0x1000 sized block starting at 0x8000 and
6706the 0x200 sized block starting at 0xffffffc000080000 and another 0x1000 sized
6707block starting at 0xffffffc00005f000.
6708ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006709SRST
6710``-dfilter range1[,...]``
6711 Filter debug output to that relevant to a range of target addresses.
6712 The filter spec can be either start+size, start-size or start..end
6713 where start end and size are the addresses and sizes required. For
6714 example:
6715
6716 ::
6717
6718 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6719
6720 Will dump output for any code in the 0x1000 sized block starting at
6721 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and
6722 another 0x1000 sized block starting at 0xffffffc00005f000.
6723ERST
Alex Bennée35145522016-03-15 14:30:20 +00006724
Richard Henderson9c09a252019-03-14 13:06:29 -07006725DEF("seed", HAS_ARG, QEMU_OPTION_seed, \
6726 "-seed number seed the pseudo-random number generator\n",
6727 QEMU_ARCH_ALL)
6728STEXI
6729@item -seed @var{number}
6730@findex -seed
6731Force the guest to use a deterministic pseudo-random number generator, seeded
6732with @var{number}. This does not affect crypto routines within the host.
6733ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006734SRST
6735``-seed number``
6736 Force the guest to use a deterministic pseudo-random number
6737 generator, seeded with number. This does not affect crypto routines
6738 within the host.
6739ERST
Richard Henderson9c09a252019-03-14 13:06:29 -07006740
blueswir15824d652009-03-28 06:44:27 +00006741DEF("L", HAS_ARG, QEMU_OPTION_L, \
Blue Swirlad960902010-03-29 19:23:52 +00006742 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n",
6743 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006744STEXI
6745@item -L @var{path}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006746@findex -L
blueswir15824d652009-03-28 06:44:27 +00006747Set the directory for the BIOS, VGA BIOS and keymaps.
Richard W.M. Jones37146e72016-05-16 17:34:35 +01006748
6749To list all the data directories, use @code{-L help}.
blueswir15824d652009-03-28 06:44:27 +00006750ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006751SRST
6752``-L path``
6753 Set the directory for the BIOS, VGA BIOS and keymaps.
6754
6755 To list all the data directories, use ``-L help``.
6756ERST
blueswir15824d652009-03-28 06:44:27 +00006757
6758DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
Blue Swirlad960902010-03-29 19:23:52 +00006759 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006760STEXI
6761@item -bios @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006762@findex -bios
blueswir15824d652009-03-28 06:44:27 +00006763Set the filename for the BIOS.
6764ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006765SRST
6766``-bios file``
6767 Set the filename for the BIOS.
6768ERST
blueswir15824d652009-03-28 06:44:27 +00006769
blueswir15824d652009-03-28 06:44:27 +00006770DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
Blue Swirlad960902010-03-29 19:23:52 +00006771 "-enable-kvm enable KVM full virtualization support\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006772STEXI
6773@item -enable-kvm
Stefan Weil6616b2a2010-02-05 23:52:05 +01006774@findex -enable-kvm
blueswir15824d652009-03-28 06:44:27 +00006775Enable KVM full virtualization support. This option is only available
6776if KVM support is enabled when compiling.
6777ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006778SRST
6779``-enable-kvm``
6780 Enable KVM full virtualization support. This option is only
6781 available if KVM support is enabled when compiling.
6782ERST
blueswir15824d652009-03-28 06:44:27 +00006783
aliguorie37630c2009-04-22 15:19:10 +00006784DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
Blue Swirlad960902010-03-29 19:23:52 +00006785 "-xen-domid id specify xen guest domain id\n", QEMU_ARCH_ALL)
aliguorie37630c2009-04-22 15:19:10 +00006786DEF("xen-attach", 0, QEMU_OPTION_xen_attach,
6787 "-xen-attach attach to existing xen domain\n"
Anthony PERARD1077bca2018-09-14 12:18:30 +01006788 " libxl will use this when starting QEMU\n",
Blue Swirlad960902010-03-29 19:23:52 +00006789 QEMU_ARCH_ALL)
Paul Durrant1c599472017-03-22 09:39:15 +00006790DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict,
6791 "-xen-domid-restrict restrict set of available xen operations\n"
6792 " to specified domain id. (Does not affect\n"
6793 " xenpv machine type).\n",
6794 QEMU_ARCH_ALL)
Stefan Weil95d5f082010-01-20 22:25:27 +01006795STEXI
6796@item -xen-domid @var{id}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006797@findex -xen-domid
Stefan Weil95d5f082010-01-20 22:25:27 +01006798Specify xen guest domain @var{id} (XEN only).
Stefan Weil95d5f082010-01-20 22:25:27 +01006799@item -xen-attach
Stefan Weil6616b2a2010-02-05 23:52:05 +01006800@findex -xen-attach
Stefan Weil95d5f082010-01-20 22:25:27 +01006801Attach to existing xen domain.
Anthony PERARD1077bca2018-09-14 12:18:30 +01006802libxl will use this when starting QEMU (XEN only).
Paul Durrant1c599472017-03-22 09:39:15 +00006803@findex -xen-domid-restrict
6804Restrict set of available xen operations to specified domain id (XEN only).
Stefan Weil95d5f082010-01-20 22:25:27 +01006805ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006806SRST
6807``-xen-domid id``
6808 Specify xen guest domain id (XEN only).
6809
6810``-xen-attach``
6811 Attach to existing xen domain. libxl will use this when starting
6812 QEMU (XEN only). Restrict set of available xen operations to
6813 specified domain id (XEN only).
6814ERST
aliguorie37630c2009-04-22 15:19:10 +00006815
blueswir15824d652009-03-28 06:44:27 +00006816DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
Blue Swirlad960902010-03-29 19:23:52 +00006817 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006818STEXI
6819@item -no-reboot
Stefan Weil6616b2a2010-02-05 23:52:05 +01006820@findex -no-reboot
blueswir15824d652009-03-28 06:44:27 +00006821Exit instead of rebooting.
6822ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006823SRST
6824``-no-reboot``
6825 Exit instead of rebooting.
6826ERST
blueswir15824d652009-03-28 06:44:27 +00006827
6828DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \
Blue Swirlad960902010-03-29 19:23:52 +00006829 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006830STEXI
6831@item -no-shutdown
Stefan Weil6616b2a2010-02-05 23:52:05 +01006832@findex -no-shutdown
blueswir15824d652009-03-28 06:44:27 +00006833Don't exit QEMU on guest shutdown, but instead only stop the emulation.
6834This allows for instance switching to monitor to commit changes to the
6835disk image.
6836ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006837SRST
6838``-no-shutdown``
6839 Don't exit QEMU on guest shutdown, but instead only stop the
6840 emulation. This allows for instance switching to monitor to commit
6841 changes to the disk image.
6842ERST
blueswir15824d652009-03-28 06:44:27 +00006843
6844DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \
6845 "-loadvm [tag|id]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00006846 " start right away with a saved state (loadvm in monitor)\n",
6847 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006848STEXI
6849@item -loadvm @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006850@findex -loadvm
blueswir15824d652009-03-28 06:44:27 +00006851Start right away with a saved state (@code{loadvm} in monitor)
6852ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006853SRST
6854``-loadvm file``
6855 Start right away with a saved state (``loadvm`` in monitor)
6856ERST
blueswir15824d652009-03-28 06:44:27 +00006857
6858#ifndef _WIN32
6859DEF("daemonize", 0, QEMU_OPTION_daemonize, \
Blue Swirlad960902010-03-29 19:23:52 +00006860 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006861#endif
6862STEXI
6863@item -daemonize
Stefan Weil6616b2a2010-02-05 23:52:05 +01006864@findex -daemonize
blueswir15824d652009-03-28 06:44:27 +00006865Daemonize the QEMU process after initialization. QEMU will not detach from
6866standard IO until it is ready to receive connections on any of its devices.
6867This option is a useful way for external programs to launch QEMU without having
6868to cope with initialization race conditions.
6869ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006870SRST
6871``-daemonize``
6872 Daemonize the QEMU process after initialization. QEMU will not
6873 detach from standard IO until it is ready to receive connections on
6874 any of its devices. This option is a useful way for external
6875 programs to launch QEMU without having to cope with initialization
6876 race conditions.
6877ERST
blueswir15824d652009-03-28 06:44:27 +00006878
6879DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \
Blue Swirlad960902010-03-29 19:23:52 +00006880 "-option-rom rom load a file, rom, into the option ROM space\n",
6881 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006882STEXI
6883@item -option-rom @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006884@findex -option-rom
blueswir15824d652009-03-28 06:44:27 +00006885Load the contents of @var{file} as an option ROM.
6886This option is useful to load things like EtherBoot.
6887ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006888SRST
6889``-option-rom file``
6890 Load the contents of file as an option ROM. This option is useful to
6891 load things like EtherBoot.
6892ERST
blueswir15824d652009-03-28 06:44:27 +00006893
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006894DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
Artem Pisarenko238d1242018-10-18 13:12:52 +06006895 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00006896 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
6897 QEMU_ARCH_ALL)
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006898
blueswir15824d652009-03-28 06:44:27 +00006899STEXI
6900
Artem Pisarenko238d1242018-10-18 13:12:52 +06006901@item -rtc [base=utc|localtime|@var{datetime}][,clock=host|rt|vm][,driftfix=none|slew]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006902@findex -rtc
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006903Specify @option{base} as @code{utc} or @code{localtime} to let the RTC start at the current
6904UTC or local time, respectively. @code{localtime} is required for correct date in
Artem Pisarenko238d1242018-10-18 13:12:52 +06006905MS-DOS or Windows. To start at a specific point in time, provide @var{datetime} in the
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006906format @code{2006-06-17T16:01:21} or @code{2006-06-17}. The default base is UTC.
6907
Michael Tokarev9d85d552014-04-07 13:34:58 +04006908By default the RTC is driven by the host system time. This allows using of the
Jan Kiszka68752042009-09-15 13:36:04 +02006909RTC as accurate reference clock inside the guest, specifically if the host
6910time is smoothly following an accurate external reference clock, e.g. via NTP.
Paolo Bonzini78808142012-03-30 10:31:21 +00006911If you want to isolate the guest time from the host, you can set @option{clock}
Artem Pisarenko238d1242018-10-18 13:12:52 +06006912to @code{rt} instead, which provides a host monotonic clock if host support it.
6913To even prevent the RTC from progressing during suspension, you can set @option{clock}
6914to @code{vm} (virtual clock). @samp{clock=vm} is recommended especially in
6915icount mode in order to preserve determinism; however, note that in icount mode
6916the speed of the virtual clock is variable and can in general differ from the
6917host clock.
Jan Kiszka68752042009-09-15 13:36:04 +02006918
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006919Enable @option{driftfix} (i386 targets only) if you experience time drift problems,
6920specifically with Windows' ACPI HAL. This option will try to figure out how
6921many timer interrupts were not processed by the Windows guest and will
6922re-inject them.
blueswir15824d652009-03-28 06:44:27 +00006923ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006924SRST
6925``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]``
6926 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at
6927 the current UTC or local time, respectively. ``localtime`` is
6928 required for correct date in MS-DOS or Windows. To start at a
6929 specific point in time, provide datetime in the format
6930 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC.
6931
6932 By default the RTC is driven by the host system time. This allows
6933 using of the RTC as accurate reference clock inside the guest,
6934 specifically if the host time is smoothly following an accurate
6935 external reference clock, e.g. via NTP. If you want to isolate the
6936 guest time from the host, you can set ``clock`` to ``rt`` instead,
6937 which provides a host monotonic clock if host support it. To even
6938 prevent the RTC from progressing during suspension, you can set
6939 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is
6940 recommended especially in icount mode in order to preserve
6941 determinism; however, note that in icount mode the speed of the
6942 virtual clock is variable and can in general differ from the host
6943 clock.
6944
6945 Enable ``driftfix`` (i386 targets only) if you experience time drift
6946 problems, specifically with Windows' ACPI HAL. This option will try
6947 to figure out how many timer interrupts were not processed by the
6948 Windows guest and will re-inject them.
6949ERST
blueswir15824d652009-03-28 06:44:27 +00006950
6951DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006952 "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=<filename>,rrsnapshot=<snapshot>]\n" \
aliguoribc14ca22009-04-05 18:43:37 +00006953 " enable virtual instruction counter with 2^N clock ticks per\n" \
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006954 " instruction, enable aligning the host and virtual clocks\n" \
6955 " or disable real time cpu sleeping\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006956STEXI
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006957@item -icount [shift=@var{N}|auto][,rr=record|replay,rrfile=@var{filename},rrsnapshot=@var{snapshot}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006958@findex -icount
blueswir15824d652009-03-28 06:44:27 +00006959Enable virtual instruction counter. The virtual cpu will execute one
Kevin Wolf4e257e52009-10-09 10:58:36 +02006960instruction every 2^@var{N} ns of virtual time. If @code{auto} is specified
blueswir15824d652009-03-28 06:44:27 +00006961then the virtual cpu speed will be automatically adjusted to keep virtual
6962time within a few seconds of real time.
6963
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006964When the virtual cpu is sleeping, the virtual time will advance at default
Pranith Kumar778d9f92016-02-26 10:16:51 -05006965speed unless @option{sleep=on|off} is specified.
6966With @option{sleep=on|off}, the virtual time will jump to the next timer deadline
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006967instantly whenever the virtual cpu goes to sleep mode and will not advance
6968if no timer is enabled. This behavior give deterministic execution times from
6969the guest point of view.
6970
blueswir15824d652009-03-28 06:44:27 +00006971Note that while this option can give deterministic behavior, it does not
6972provide cycle accurate emulation. Modern CPUs contain superscalar out of
6973order cores with complex cache hierarchies. The number of instructions
6974executed often has little or no correlation with actual performance.
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006975
Daniel P. Berrangeb6af0972015-08-26 12:17:13 +01006976@option{align=on} will activate the delay algorithm which will try
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006977to synchronise the host clock and the virtual clock. The goal is to
6978have a guest running at the real frequency imposed by the shift option.
6979Whenever the guest clock is behind the host clock and if
Michael Tokarev82597612015-04-27 11:12:49 +03006980@option{align=on} is specified then we print a message to the user
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006981to inform about the delay.
6982Currently this option does not work when @option{shift} is @code{auto}.
6983Note: The sync algorithm will work for those shift values for which
6984the guest clock runs ahead of the host clock. Typically this happens
6985when the shift value is high (how high depends on the host machine).
Pavel Dovgalyuk4c27b852015-09-17 19:25:18 +03006986
6987When @option{rr} option is specified deterministic record/replay is enabled.
6988Replay log is written into @var{filename} file in record mode and
6989read from this file in replay mode.
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006990
6991Option rrsnapshot is used to create new vm snapshot named @var{snapshot}
6992at the start of execution recording. In replay mode this option is used
6993to load the initial VM state.
blueswir15824d652009-03-28 06:44:27 +00006994ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006995SRST
6996``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]``
6997 Enable virtual instruction counter. The virtual cpu will execute one
6998 instruction every 2^N ns of virtual time. If ``auto`` is specified
6999 then the virtual cpu speed will be automatically adjusted to keep
7000 virtual time within a few seconds of real time.
7001
7002 When the virtual cpu is sleeping, the virtual time will advance at
7003 default speed unless ``sleep=on|off`` is specified. With
7004 ``sleep=on|off``, the virtual time will jump to the next timer
7005 deadline instantly whenever the virtual cpu goes to sleep mode and
7006 will not advance if no timer is enabled. This behavior give
7007 deterministic execution times from the guest point of view.
7008
7009 Note that while this option can give deterministic behavior, it does
7010 not provide cycle accurate emulation. Modern CPUs contain
7011 superscalar out of order cores with complex cache hierarchies. The
7012 number of instructions executed often has little or no correlation
7013 with actual performance.
7014
7015 ``align=on`` will activate the delay algorithm which will try to
7016 synchronise the host clock and the virtual clock. The goal is to
7017 have a guest running at the real frequency imposed by the shift
7018 option. Whenever the guest clock is behind the host clock and if
7019 ``align=on`` is specified then we print a message to the user to
7020 inform about the delay. Currently this option does not work when
7021 ``shift`` is ``auto``. Note: The sync algorithm will work for those
7022 shift values for which the guest clock runs ahead of the host clock.
7023 Typically this happens when the shift value is high (how high
7024 depends on the host machine).
7025
7026 When ``rr`` option is specified deterministic record/replay is
7027 enabled. Replay log is written into filename file in record mode and
7028 read from this file in replay mode.
7029
7030 Option rrsnapshot is used to create new vm snapshot named snapshot
7031 at the start of execution recording. In replay mode this option is
7032 used to load the initial VM state.
7033ERST
blueswir15824d652009-03-28 06:44:27 +00007034
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007035DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \
Xu Wangd7933ef2015-06-11 17:32:05 +02007036 "-watchdog model\n" \
Blue Swirlad960902010-03-29 19:23:52 +00007037 " enable virtual hardware watchdog [default=none]\n",
7038 QEMU_ARCH_ALL)
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007039STEXI
7040@item -watchdog @var{model}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007041@findex -watchdog
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007042Create a virtual hardware watchdog device. Once enabled (by a guest
7043action), the watchdog must be periodically polled by an agent inside
Xu Wangd7933ef2015-06-11 17:32:05 +02007044the guest or else the guest will be restarted. Choose a model for
7045which your guest has drivers.
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007046
Xu Wangd7933ef2015-06-11 17:32:05 +02007047The @var{model} is the model of hardware watchdog to emulate. Use
7048@code{-watchdog help} to list available hardware models. Only one
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007049watchdog can be enabled for a guest.
Xu Wangd7933ef2015-06-11 17:32:05 +02007050
7051The following models may be available:
7052@table @option
7053@item ib700
7054iBASE 700 is a very simple ISA watchdog with a single timer.
7055@item i6300esb
7056Intel 6300ESB I/O controller hub is a much more featureful PCI-based
7057dual-timer watchdog.
Xu Wang188f24c2015-02-05 18:28:32 +08007058@item diag288
7059A virtual watchdog for s390x backed by the diagnose 288 hypercall
7060(currently KVM only).
Xu Wangd7933ef2015-06-11 17:32:05 +02007061@end table
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007062ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007063SRST
7064``-watchdog model``
7065 Create a virtual hardware watchdog device. Once enabled (by a guest
7066 action), the watchdog must be periodically polled by an agent inside
7067 the guest or else the guest will be restarted. Choose a model for
7068 which your guest has drivers.
7069
7070 The model is the model of hardware watchdog to emulate. Use
7071 ``-watchdog help`` to list available hardware models. Only one
7072 watchdog can be enabled for a guest.
7073
7074 The following models may be available:
7075
7076 ``ib700``
7077 iBASE 700 is a very simple ISA watchdog with a single timer.
7078
7079 ``i6300esb``
7080 Intel 6300ESB I/O controller hub is a much more featureful
7081 PCI-based dual-timer watchdog.
7082
7083 ``diag288``
7084 A virtual watchdog for s390x backed by the diagnose 288
7085 hypercall (currently KVM only).
7086ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007087
7088DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \
Markus Armbruster7ad92702017-10-02 16:03:07 +02007089 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \
Blue Swirlad960902010-03-29 19:23:52 +00007090 " action when watchdog fires [default=reset]\n",
7091 QEMU_ARCH_ALL)
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007092STEXI
7093@item -watchdog-action @var{action}
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01007094@findex -watchdog-action
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007095
7096The @var{action} controls what QEMU will do when the watchdog timer
7097expires.
7098The default is
7099@code{reset} (forcefully reset the guest).
7100Other possible actions are:
7101@code{shutdown} (attempt to gracefully shutdown the guest),
7102@code{poweroff} (forcefully poweroff the guest),
Markus Armbruster7ad92702017-10-02 16:03:07 +02007103@code{inject-nmi} (inject a NMI into the guest),
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007104@code{pause} (pause the guest),
7105@code{debug} (print a debug message and continue), or
7106@code{none} (do nothing).
7107
7108Note that the @code{shutdown} action requires that the guest responds
7109to ACPI signals, which it may not be able to do in the sort of
7110situations where the watchdog would have expired, and thus
7111@code{-watchdog-action shutdown} is not recommended for production use.
7112
7113Examples:
7114
7115@table @code
7116@item -watchdog i6300esb -watchdog-action pause
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007117@itemx -watchdog ib700
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007118@end table
7119ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007120SRST
7121``-watchdog-action action``
7122 The action controls what QEMU will do when the watchdog timer
7123 expires. The default is ``reset`` (forcefully reset the guest).
7124 Other possible actions are: ``shutdown`` (attempt to gracefully
7125 shutdown the guest), ``poweroff`` (forcefully poweroff the guest),
7126 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the
7127 guest), ``debug`` (print a debug message and continue), or ``none``
7128 (do nothing).
7129
7130 Note that the ``shutdown`` action requires that the guest responds
7131 to ACPI signals, which it may not be able to do in the sort of
7132 situations where the watchdog would have expired, and thus
7133 ``-watchdog-action shutdown`` is not recommended for production use.
7134
7135 Examples:
7136
7137 ``-watchdog i6300esb -watchdog-action pause``; \ ``-watchdog ib700``
7138
7139ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007140
blueswir15824d652009-03-28 06:44:27 +00007141DEF("echr", HAS_ARG, QEMU_OPTION_echr, \
Blue Swirlad960902010-03-29 19:23:52 +00007142 "-echr chr set terminal escape character instead of ctrl-a\n",
7143 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007144STEXI
7145
Kevin Wolf4e257e52009-10-09 10:58:36 +02007146@item -echr @var{numeric_ascii_value}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007147@findex -echr
blueswir15824d652009-03-28 06:44:27 +00007148Change the escape character used for switching to the monitor when using
7149monitor and serial sharing. The default is @code{0x01} when using the
7150@code{-nographic} option. @code{0x01} is equal to pressing
7151@code{Control-a}. You can select a different character from the ascii
7152control keys where 1 through 26 map to Control-a through Control-z. For
7153instance you could use the either of the following to change the escape
7154character to Control-t.
7155@table @code
7156@item -echr 0x14
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007157@itemx -echr 20
blueswir15824d652009-03-28 06:44:27 +00007158@end table
7159ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007160SRST
7161``-echr numeric_ascii_value``
7162 Change the escape character used for switching to the monitor when
7163 using monitor and serial sharing. The default is ``0x01`` when using
7164 the ``-nographic`` option. ``0x01`` is equal to pressing
7165 ``Control-a``. You can select a different character from the ascii
7166 control keys where 1 through 26 map to Control-a through Control-z.
7167 For instance you could use the either of the following to change the
7168 escape character to Control-t.
7169
7170 ``-echr 0x14``; \ ``-echr 20``
7171
7172ERST
blueswir15824d652009-03-28 06:44:27 +00007173
blueswir15824d652009-03-28 06:44:27 +00007174DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \
Blue Swirlad960902010-03-29 19:23:52 +00007175 "-show-cursor show cursor\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007176STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01007177@item -show-cursor
Stefan Weil6616b2a2010-02-05 23:52:05 +01007178@findex -show-cursor
Stefan Weil95d5f082010-01-20 22:25:27 +01007179Show cursor.
blueswir15824d652009-03-28 06:44:27 +00007180ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007181SRST
7182``-show-cursor``
7183 Show cursor.
7184ERST
blueswir15824d652009-03-28 06:44:27 +00007185
7186DEF("tb-size", HAS_ARG, QEMU_OPTION_tb_size, \
Blue Swirlad960902010-03-29 19:23:52 +00007187 "-tb-size n set TB size\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007188STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01007189@item -tb-size @var{n}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007190@findex -tb-size
Paolo Bonzinife174132019-11-13 15:16:44 +01007191Set TCG translation block cache size. Deprecated, use @samp{-accel tcg,tb-size=@var{n}}
7192instead.
blueswir15824d652009-03-28 06:44:27 +00007193ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007194SRST
7195``-tb-size n``
7196 Set TCG translation block cache size. Deprecated, use
7197 '\ ``-accel tcg,tb-size=n``\ ' instead.
7198ERST
blueswir15824d652009-03-28 06:44:27 +00007199
7200DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
Michael Tokarev7c601802015-02-10 22:40:47 +03007201 "-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]\n" \
7202 "-incoming rdma:host:port[,ipv4][,ipv6]\n" \
7203 "-incoming unix:socketpath\n" \
7204 " prepare for incoming migration, listen on\n" \
7205 " specified protocol and socket address\n" \
7206 "-incoming fd:fd\n" \
7207 "-incoming exec:cmdline\n" \
7208 " accept incoming migration on given file descriptor\n" \
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01007209 " or from given external command\n" \
7210 "-incoming defer\n" \
7211 " wait for the URI to be specified via migrate_incoming\n",
Blue Swirlad960902010-03-29 19:23:52 +00007212 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007213STEXI
Michael Tokarev7c601802015-02-10 22:40:47 +03007214@item -incoming tcp:[@var{host}]:@var{port}[,to=@var{maxport}][,ipv4][,ipv6]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007215@itemx -incoming rdma:@var{host}:@var{port}[,ipv4][,ipv6]
Stefan Weil6616b2a2010-02-05 23:52:05 +01007216@findex -incoming
Michael Tokarev7c601802015-02-10 22:40:47 +03007217Prepare for incoming migration, listen on a given tcp port.
7218
7219@item -incoming unix:@var{socketpath}
7220Prepare for incoming migration, listen on a given unix socket.
7221
7222@item -incoming fd:@var{fd}
7223Accept incoming migration from a given filedescriptor.
7224
7225@item -incoming exec:@var{cmdline}
7226Accept incoming migration as an output from specified external command.
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01007227
7228@item -incoming defer
7229Wait for the URI to be specified via migrate_incoming. The monitor can
7230be used to change settings (such as migration parameters) prior to issuing
7231the migrate_incoming to allow the migration to begin.
blueswir15824d652009-03-28 06:44:27 +00007232ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007233SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00007234``-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]``
7235 \
7236``-incoming rdma:host:port[,ipv4][,ipv6]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007237 Prepare for incoming migration, listen on a given tcp port.
7238
7239``-incoming unix:socketpath``
7240 Prepare for incoming migration, listen on a given unix socket.
7241
7242``-incoming fd:fd``
7243 Accept incoming migration from a given filedescriptor.
7244
7245``-incoming exec:cmdline``
7246 Accept incoming migration as an output from specified external
7247 command.
7248
7249``-incoming defer``
7250 Wait for the URI to be specified via migrate\_incoming. The monitor
7251 can be used to change settings (such as migration parameters) prior
7252 to issuing the migrate\_incoming to allow the migration to begin.
7253ERST
blueswir15824d652009-03-28 06:44:27 +00007254
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05307255DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \
7256 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL)
7257STEXI
7258@item -only-migratable
7259@findex -only-migratable
7260Only allow migratable devices. Devices will not be allowed to enter an
7261unmigratable state.
7262ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007263SRST
7264``-only-migratable``
7265 Only allow migratable devices. Devices will not be allowed to enter
7266 an unmigratable state.
7267ERST
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05307268
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007269DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
Blue Swirlad960902010-03-29 19:23:52 +00007270 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL)
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007271STEXI
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007272@item -nodefaults
Stefan Weil6616b2a2010-02-05 23:52:05 +01007273@findex -nodefaults
Michal Novotny66c19bf2012-07-16 14:35:10 +02007274Don't create default devices. Normally, QEMU sets the default devices like serial
7275port, parallel port, virtual console, monitor device, VGA adapter, floppy and
7276CD-ROM drive and others. The @code{-nodefaults} option will disable all those
7277default devices.
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007278ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007279SRST
7280``-nodefaults``
7281 Don't create default devices. Normally, QEMU sets the default
7282 devices like serial port, parallel port, virtual console, monitor
7283 device, VGA adapter, floppy and CD-ROM drive and others. The
7284 ``-nodefaults`` option will disable all those default devices.
7285ERST
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007286
blueswir15824d652009-03-28 06:44:27 +00007287#ifndef _WIN32
7288DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \
Blue Swirlad960902010-03-29 19:23:52 +00007289 "-chroot dir chroot to dir just before starting the VM\n",
7290 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007291#endif
7292STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02007293@item -chroot @var{dir}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007294@findex -chroot
blueswir15824d652009-03-28 06:44:27 +00007295Immediately before starting guest execution, chroot to the specified
7296directory. Especially useful in combination with -runas.
7297ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007298SRST
7299``-chroot dir``
7300 Immediately before starting guest execution, chroot to the specified
7301 directory. Especially useful in combination with -runas.
7302ERST
blueswir15824d652009-03-28 06:44:27 +00007303
7304#ifndef _WIN32
7305DEF("runas", HAS_ARG, QEMU_OPTION_runas, \
Ian Jackson2c42f1e2017-09-15 18:10:44 +01007306 "-runas user change to user id user just before starting the VM\n" \
7307 " user can be numeric uid:gid instead\n",
Blue Swirlad960902010-03-29 19:23:52 +00007308 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007309#endif
7310STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02007311@item -runas @var{user}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007312@findex -runas
blueswir15824d652009-03-28 06:44:27 +00007313Immediately before starting guest execution, drop root privileges, switching
7314to the specified user.
7315ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007316SRST
7317``-runas user``
7318 Immediately before starting guest execution, drop root privileges,
7319 switching to the specified user.
7320ERST
blueswir15824d652009-03-28 06:44:27 +00007321
blueswir15824d652009-03-28 06:44:27 +00007322DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env,
7323 "-prom-env variable=value\n"
Blue Swirlad960902010-03-29 19:23:52 +00007324 " set OpenBIOS nvram variables\n",
7325 QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
Stefan Weil95d5f082010-01-20 22:25:27 +01007326STEXI
7327@item -prom-env @var{variable}=@var{value}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007328@findex -prom-env
Stefan Weil95d5f082010-01-20 22:25:27 +01007329Set OpenBIOS nvram @var{variable} to given @var{value} (PPC, SPARC only).
Peter Maydell196afbb2020-02-28 15:36:10 +00007330
7331@example
7332qemu-system-sparc -prom-env 'auto-boot?=false' \
7333 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7334@end example
7335
7336@example
7337qemu-system-ppc -prom-env 'auto-boot?=false' \
7338 -prom-env 'boot-device=hd:2,\yaboot' \
7339 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7340@end example
7341
Stefan Weil95d5f082010-01-20 22:25:27 +01007342ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007343SRST
7344``-prom-env variable=value``
7345 Set OpenBIOS nvram variable to given value (PPC, SPARC only).
7346
7347 ::
7348
7349 qemu-system-sparc -prom-env 'auto-boot?=false' \
7350 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7351
7352 ::
7353
7354 qemu-system-ppc -prom-env 'auto-boot?=false' \
7355 -prom-env 'boot-device=hd:2,\yaboot' \
7356 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7357ERST
blueswir15824d652009-03-28 06:44:27 +00007358DEF("semihosting", 0, QEMU_OPTION_semihosting,
Michael Wallef7bbcfb2014-04-22 20:18:42 +02007359 "-semihosting semihosting mode\n",
Leon Alrae3b3c1692015-06-19 11:08:43 +01007360 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007361 QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
Stefan Weil95d5f082010-01-20 22:25:27 +01007362STEXI
7363@item -semihosting
Stefan Weil6616b2a2010-02-05 23:52:05 +01007364@findex -semihosting
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007365Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
Peter Maydell44d79a62020-02-28 15:36:09 +00007366
7367Note that this allows guest direct access to the host filesystem, so
7368should only be used with a trusted guest OS.
7369
7370See the -semihosting-config option documentation for further information
7371about the facilities this enables.
Liviu Ionescua38bb072014-12-11 12:07:48 +00007372ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007373SRST
7374``-semihosting``
7375 Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
7376
7377 Note that this allows guest direct access to the host filesystem, so
7378 should only be used with a trusted guest OS.
7379
7380 See the -semihosting-config option documentation for further
7381 information about the facilities this enables.
7382ERST
Liviu Ionescua38bb072014-12-11 12:07:48 +00007383DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config,
Alex Bennée4e7f9032019-05-14 15:30:14 +01007384 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]\n" \
Leon Alraea59d31a2015-06-19 14:17:45 +01007385 " semihosting configuration\n",
Leon Alrae3b3c1692015-06-19 11:08:43 +01007386QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007387QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
Liviu Ionescua38bb072014-12-11 12:07:48 +00007388STEXI
Alex Bennée4e7f9032019-05-14 15:30:14 +01007389@item -semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]
Liviu Ionescua38bb072014-12-11 12:07:48 +00007390@findex -semihosting-config
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007391Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II only).
Peter Maydell44d79a62020-02-28 15:36:09 +00007392
7393Note that this allows guest direct access to the host filesystem, so
7394should only be used with a trusted guest OS.
7395
7396On Arm this implements the standard semihosting API, version 2.0.
7397
7398On M68K this implements the "ColdFire GDB" interface used by libgloss.
7399
7400Xtensa semihosting provides basic file IO calls, such as
7401open/read/write/seek/select. Tensilica baremetal libc for ISS and
7402linux platform "sim" use this interface.
7403
Leon Alraea59d31a2015-06-19 14:17:45 +01007404@table @option
7405@item target=@code{native|gdb|auto}
7406Defines where the semihosting calls will be addressed, to QEMU (@code{native})
7407or to GDB (@code{gdb}). The default is @code{auto}, which means @code{gdb}
7408during debug sessions and @code{native} otherwise.
Alex Bennée4e7f9032019-05-14 15:30:14 +01007409@item chardev=@var{str1}
7410Send the output to a chardev backend output for native or auto output when not in gdb
Leon Alraea59d31a2015-06-19 14:17:45 +01007411@item arg=@var{str1},arg=@var{str2},...
7412Allows the user to pass input arguments, and can be used multiple times to build
7413up a list. The old-style @code{-kernel}/@code{-append} method of passing a
7414command line is still supported for backward compatibility. If both the
7415@code{--semihosting-config arg} and the @code{-kernel}/@code{-append} are
7416specified, the former is passed to semihosting as it always takes precedence.
7417@end table
Stefan Weil95d5f082010-01-20 22:25:27 +01007418ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007419SRST
7420``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]``
7421 Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II
7422 only).
7423
7424 Note that this allows guest direct access to the host filesystem, so
7425 should only be used with a trusted guest OS.
7426
7427 On Arm this implements the standard semihosting API, version 2.0.
7428
7429 On M68K this implements the "ColdFire GDB" interface used by
7430 libgloss.
7431
7432 Xtensa semihosting provides basic file IO calls, such as
7433 open/read/write/seek/select. Tensilica baremetal libc for ISS and
7434 linux platform "sim" use this interface.
7435
7436 ``target=native|gdb|auto``
7437 Defines where the semihosting calls will be addressed, to QEMU
7438 (``native``) or to GDB (``gdb``). The default is ``auto``, which
7439 means ``gdb`` during debug sessions and ``native`` otherwise.
7440
7441 ``chardev=str1``
7442 Send the output to a chardev backend output for native or auto
7443 output when not in gdb
7444
7445 ``arg=str1,arg=str2,...``
7446 Allows the user to pass input arguments, and can be used
7447 multiple times to build up a list. The old-style
7448 ``-kernel``/``-append`` method of passing a command line is
7449 still supported for backward compatibility. If both the
7450 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are
7451 specified, the former is passed to semihosting as it always
7452 takes precedence.
7453ERST
blueswir15824d652009-03-28 06:44:27 +00007454DEF("old-param", 0, QEMU_OPTION_old_param,
Blue Swirlad960902010-03-29 19:23:52 +00007455 "-old-param old param mode\n", QEMU_ARCH_ARM)
Stefan Weil95d5f082010-01-20 22:25:27 +01007456STEXI
7457@item -old-param
Stefan Weil6616b2a2010-02-05 23:52:05 +01007458@findex -old-param (ARM)
Stefan Weil95d5f082010-01-20 22:25:27 +01007459Old param mode (ARM only).
7460ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007461SRST
7462``-old-param``
7463 Old param mode (ARM only).
7464ERST
Stefan Weil95d5f082010-01-20 22:25:27 +01007465
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007466DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007467 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007468 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007469 " Enable seccomp mode 2 system call filter (default 'off').\n" \
7470 " use 'obsolete' to allow obsolete system calls that are provided\n" \
7471 " by the kernel, but typically no longer used by modern\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007472 " C library implementations.\n" \
7473 " use 'elevateprivileges' to allow or deny QEMU process to elevate\n" \
7474 " its privileges by blacklisting all set*uid|gid system calls.\n" \
7475 " The value 'children' will deny set*uid|gid system calls for\n" \
Eduardo Otubo995a2262017-03-13 22:16:01 +01007476 " main QEMU process but will allow forks and execves to run unprivileged\n" \
7477 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007478 " blacklisting *fork and execve\n" \
7479 " use 'resourcecontrol' to disable process affinity and schedular priority\n",
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007480 QEMU_ARCH_ALL)
7481STEXI
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007482@item -sandbox @var{arg}[,obsolete=@var{string}][,elevateprivileges=@var{string}][,spawn=@var{string}][,resourcecontrol=@var{string}]
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007483@findex -sandbox
7484Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will
7485disable it. The default is 'off'.
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007486@table @option
7487@item obsolete=@var{string}
7488Enable Obsolete system calls
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007489@item elevateprivileges=@var{string}
7490Disable set*uid|gid system calls
Eduardo Otubo995a2262017-03-13 22:16:01 +01007491@item spawn=@var{string}
7492Disable *fork and execve
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007493@item resourcecontrol=@var{string}
7494Disable process affinity and schedular priority
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007495@end table
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007496ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007497SRST
7498``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]``
7499 Enable Seccomp mode 2 system call filter. 'on' will enable syscall
7500 filtering and 'off' will disable it. The default is 'off'.
7501
7502 ``obsolete=string``
7503 Enable Obsolete system calls
7504
7505 ``elevateprivileges=string``
7506 Disable set\*uid\|gid system calls
7507
7508 ``spawn=string``
7509 Disable \*fork and execve
7510
7511 ``resourcecontrol=string``
7512 Disable process affinity and schedular priority
7513ERST
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007514
Gerd Hoffmann715a6642009-10-14 10:39:28 +02007515DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
Blue Swirlad960902010-03-29 19:23:52 +00007516 "-readconfig <file>\n", QEMU_ARCH_ALL)
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007517STEXI
7518@item -readconfig @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007519@findex -readconfig
Michal Novotnyed24cfa2012-07-16 14:28:32 +02007520Read device configuration from @var{file}. This approach is useful when you want to spawn
7521QEMU process with many command line options but you don't want to exceed the command line
7522character limit.
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007523ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007524SRST
7525``-readconfig file``
7526 Read device configuration from file. This approach is useful when
7527 you want to spawn QEMU process with many command line options but
7528 you don't want to exceed the command line character limit.
7529ERST
Gerd Hoffmann715a6642009-10-14 10:39:28 +02007530DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig,
7531 "-writeconfig <file>\n"
Blue Swirlad960902010-03-29 19:23:52 +00007532 " read/write config file\n", QEMU_ARCH_ALL)
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007533STEXI
7534@item -writeconfig @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007535@findex -writeconfig
Michal Novotnyed24cfa2012-07-16 14:28:32 +02007536Write device configuration to @var{file}. The @var{file} can be either filename to save
7537command line and device configuration into file or dash @code{-}) character to print the
7538output to stdout. This can be later used as input file for @code{-readconfig} option.
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007539ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007540SRST
7541``-writeconfig file``
7542 Write device configuration to file. The file can be either filename
7543 to save command line and device configuration into file or dash
7544 ``-``) character to print the output to stdout. This can be later
7545 used as input file for ``-readconfig`` option.
7546ERST
Thomas Huth2feac452018-08-21 12:59:56 +02007547
Eduardo Habkostf29a5612012-05-02 13:07:29 -03007548DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
7549 "-no-user-config\n"
Eduardo Habkost3478eae2017-10-04 00:00:25 -03007550 " do not load default user-provided config files at startup\n",
Eduardo Habkostf29a5612012-05-02 13:07:29 -03007551 QEMU_ARCH_ALL)
7552STEXI
7553@item -no-user-config
7554@findex -no-user-config
7555The @code{-no-user-config} option makes QEMU not load any of the user-provided
Eduardo Habkost3478eae2017-10-04 00:00:25 -03007556config files on @var{sysconfdir}.
Anthony Liguori292444c2010-01-21 10:57:58 -06007557ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007558SRST
7559``-no-user-config``
7560 The ``-no-user-config`` option makes QEMU not load any of the
7561 user-provided config files on sysconfdir.
7562ERST
Thomas Huth2feac452018-08-21 12:59:56 +02007563
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007564DEF("trace", HAS_ARG, QEMU_OPTION_trace,
Paolo Bonzini10578a22016-01-07 16:55:26 +03007565 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
Lluís23d15e82011-08-31 20:31:31 +02007566 " specify tracing options\n",
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007567 QEMU_ARCH_ALL)
7568STEXI
Lluís23d15e82011-08-31 20:31:31 +02007569HXCOMM This line is not accurate, as some sub-options are backend-specific but
7570HXCOMM HX does not support conditional compilation of text.
Denis V. Luneve370ad92016-06-17 17:44:08 +03007571@item -trace [[enable=]@var{pattern}][,events=@var{file}][,file=@var{file}]
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007572@findex -trace
Paolo Bonziniabcd92d2020-02-28 15:35:57 +00007573@include docs/system/qemu-option-trace.texi
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007574ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007575SRST
7576``-trace [[enable=]pattern][,events=file][,file=file]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00007577 .. include:: ../qemu-option-trace.rst.inc
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007578
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007579ERST
Lluís Vilanova42229a72017-07-24 17:28:22 +03007580DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
7581 "-plugin [file=]<file>[,arg=<string>]\n"
7582 " load a plugin\n",
7583 QEMU_ARCH_ALL)
7584STEXI
7585@item -plugin file=@var{file}[,arg=@var{string}]
7586@findex -plugin
7587
7588Load a plugin.
7589
7590@table @option
7591@item file=@var{file}
7592Load the given plugin from a shared library file.
7593@item arg=@var{string}
7594Argument string passed to the plugin. (Can be given multiple times.)
7595@end table
7596ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007597SRST
7598``-plugin file=file[,arg=string]``
7599 Load a plugin.
7600
7601 ``file=file``
7602 Load the given plugin from a shared library file.
7603
7604 ``arg=string``
7605 Argument string passed to the plugin. (Can be given multiple
7606 times.)
7607ERST
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007608
Markus Armbruster31e70d62013-02-13 19:49:37 +01007609HXCOMM Internal use
7610DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
7611DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL)
Anthony Liguoric7f0f3b2012-03-28 15:42:02 +02007612
Paul Moore0f669982012-08-03 14:39:21 -04007613#ifdef __linux__
7614DEF("enable-fips", 0, QEMU_OPTION_enablefips,
7615 "-enable-fips enable FIPS 140-2 compliance\n",
7616 QEMU_ARCH_ALL)
7617#endif
7618STEXI
7619@item -enable-fips
7620@findex -enable-fips
7621Enable FIPS 140-2 compliance mode.
7622ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007623SRST
7624``-enable-fips``
7625 Enable FIPS 140-2 compliance mode.
7626ERST
Paul Moore0f669982012-08-03 14:39:21 -04007627
Thomas Huth976e8c52019-09-04 07:27:39 +02007628HXCOMM Deprecated by -accel tcg
Bruce Rogersc6e88b32012-11-20 07:11:21 -07007629DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
Jan Kiszkaa0dac022012-10-05 14:51:45 -03007630
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007631DEF("msg", HAS_ARG, QEMU_OPTION_msg,
7632 "-msg timestamp[=on|off]\n"
Markus Armbrusterdeda4972019-10-10 10:15:08 +02007633 " control error message format\n"
7634 " timestamp=on enables timestamps (default: off)\n",
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007635 QEMU_ARCH_ALL)
7636STEXI
7637@item -msg timestamp[=on|off]
7638@findex -msg
Markus Armbrusterdeda4972019-10-10 10:15:08 +02007639Control error message format.
7640@table @option
7641@item timestamp=on|off
7642Prefix messages with a timestamp. Default is off.
7643@end table
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007644ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007645SRST
7646``-msg timestamp[=on|off]``
7647 Control error message format.
7648
7649 ``timestamp=on|off``
7650 Prefix messages with a timestamp. Default is off.
7651ERST
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007652
Amit Shahabfd9ce2014-06-20 18:56:08 +05307653DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
7654 "-dump-vmstate <file>\n"
7655 " Output vmstate information in JSON format to file.\n"
7656 " Use the scripts/vmstate-static-checker.py file to\n"
7657 " check for possible regressions in migration code\n"
Laurent Vivier23820532015-09-04 21:30:04 +02007658 " by comparing two such vmstate dumps.\n",
Amit Shahabfd9ce2014-06-20 18:56:08 +05307659 QEMU_ARCH_ALL)
7660STEXI
7661@item -dump-vmstate @var{file}
7662@findex -dump-vmstate
7663Dump json-encoded vmstate information for current machine type to file
7664in @var{file}
7665ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007666SRST
7667``-dump-vmstate file``
7668 Dump json-encoded vmstate information for current machine type to
7669 file in file
7670ERST
Amit Shahabfd9ce2014-06-20 18:56:08 +05307671
Emilio G. Cota12df1892018-08-15 11:42:49 -04007672DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile,
7673 "-enable-sync-profile\n"
7674 " enable synchronization profiling\n",
7675 QEMU_ARCH_ALL)
7676STEXI
7677@item -enable-sync-profile
7678@findex -enable-sync-profile
7679Enable synchronization profiling.
7680ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007681SRST
7682``-enable-sync-profile``
7683 Enable synchronization profiling.
7684ERST
Emilio G. Cota12df1892018-08-15 11:42:49 -04007685
Paolo Bonzini43f187a2017-01-04 13:50:37 +01007686STEXI
7687@end table
7688ETEXI
7689DEFHEADING()
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02007690
7691DEFHEADING(Generic object creation:)
Paolo Bonzini43f187a2017-01-04 13:50:37 +01007692STEXI
7693@table @option
7694ETEXI
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007695
7696DEF("object", HAS_ARG, QEMU_OPTION_object,
7697 "-object TYPENAME[,PROP1=VALUE1,...]\n"
7698 " create a new object of type TYPENAME setting properties\n"
7699 " in the order they are specified. Note that the 'id'\n"
7700 " property must be set. These objects are placed in the\n"
7701 " '/objects' path.\n",
7702 QEMU_ARCH_ALL)
7703STEXI
7704@item -object @var{typename}[,@var{prop1}=@var{value1},...]
7705@findex -object
7706Create a new object of type @var{typename} setting properties
7707in the order they are specified. Note that the 'id'
7708property must be set. These objects are placed in the
7709'/objects' path.
7710
7711@table @option
7712
Haozhong Zhang98376842017-12-11 15:28:04 +08007713@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}
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007714
7715Creates a memory file backend object, which can be used to back
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007716the guest RAM with huge pages.
7717
7718The @option{id} parameter is a unique ID that will be used to reference this
7719memory region when configuring the @option{-numa} argument.
7720
7721The @option{size} option provides the size of the memory region, and accepts
7722common suffixes, eg @option{500M}.
7723
7724The @option{mem-path} provides the path to either a shared memory or huge page
7725filesystem mount.
7726
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007727The @option{share} boolean option determines whether the memory
7728region is marked as private to QEMU, or shared. The latter allows
7729a co-operating external process to access the QEMU memory region.
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007730
Marcel Apfelbaum06329cc2017-12-13 16:37:37 +02007731The @option{share} is also required for pvrdma devices due to
7732limitations in the RDMA API provided by Linux.
7733
7734Setting share=on might affect the ability to configure NUMA
7735bindings for the memory backend under some circumstances, see
7736Documentation/vm/numa_memory_policy.txt on the Linux kernel
7737source tree for additional details.
7738
Eduardo Habkost11ae6ed2017-08-24 16:23:15 -03007739Setting the @option{discard-data} boolean option to @var{on}
7740indicates that file contents can be destroyed when QEMU exits,
7741to avoid unnecessarily flushing data to the backing file. Note
7742that @option{discard-data} is only an optimization, and QEMU
7743might not discard file contents if it aborts unexpectedly or is
7744terminated using SIGKILL.
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007745
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007746The @option{merge} boolean option enables memory merge, also known as
7747MADV_MERGEABLE, so that Kernel Samepage Merging will consider the pages for
7748memory deduplication.
7749
7750Setting the @option{dump} boolean option to @var{off} excludes the memory from
7751core dumps. This feature is also known as MADV_DONTDUMP.
7752
7753The @option{prealloc} boolean option enables memory preallocation.
7754
7755The @option{host-nodes} option binds the memory range to a list of NUMA host
7756nodes.
7757
7758The @option{policy} option sets the NUMA policy to one of the following values:
7759
7760@table @option
7761@item @var{default}
7762default host policy
7763
7764@item @var{preferred}
7765prefer the given host node list for allocation
7766
7767@item @var{bind}
7768restrict memory allocation to the given host node list
7769
7770@item @var{interleave}
7771interleave memory allocations across the given host node list
7772@end table
7773
Haozhong Zhang98376842017-12-11 15:28:04 +08007774The @option{align} option specifies the base address alignment when
7775QEMU mmap(2) @option{mem-path}, and accepts common suffixes, eg
7776@option{2M}. Some backend store specified by @option{mem-path}
7777requires an alignment different than the default one used by QEMU, eg
7778the device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
7779such cases, users can specify the required alignment via this option.
7780
Junyan Hea4de8552018-07-18 15:48:00 +08007781The @option{pmem} option specifies whether the backing file specified
7782by @option{mem-path} is in host persistent memory that can be accessed
7783using the SNIA NVM programming model (e.g. Intel NVDIMM).
7784If @option{pmem} is set to 'on', QEMU will take necessary operations to
7785guarantee the persistence of its own writes to @option{mem-path}
7786(e.g. in vNVDIMM label emulation and live migration).
Zhang Yi119906af2019-04-22 08:48:48 +08007787Also, we will map the backend-file with MAP_SYNC flag, which ensures the
7788file metadata is in sync for @option{mem-path} in case of host crash
7789or a power failure. MAP_SYNC requires support from both the host kernel
7790(since Linux kernel 4.15) and the filesystem of @option{mem-path} mounted
7791with DAX option.
Junyan Hea4de8552018-07-18 15:48:00 +08007792
Marcel Apfelbaum06329cc2017-12-13 16:37:37 +02007793@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}
Stefan Hajnoczicd194912017-11-28 16:15:29 +00007794
7795Creates a memory backend object, which can be used to back the guest RAM.
7796Memory backend objects offer more control than the @option{-m} option that is
7797traditionally used to define guest RAM. Please refer to
7798@option{memory-backend-file} for a description of the options.
7799
Marc-André Lureau36ea3972018-08-28 17:38:40 +02007800@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}
Marc-André Lureaudbb9e0f2018-02-01 14:27:54 +01007801
7802Creates an anonymous memory file backend object, which allows QEMU to
7803share the memory with an external process (e.g. when using
7804vhost-user). The memory is allocated with memfd and optional
7805sealing. (Linux only)
7806
7807The @option{seal} option creates a sealed-file, that will block
7808further resizing the memory ('on' by default).
7809
7810The @option{hugetlb} option specify the file to be created resides in
7811the hugetlbfs filesystem (since Linux 4.14). Used in conjunction with
7812the @option{hugetlb} option, the @option{hugetlbsize} option specify
7813the hugetlb page size on systems that support multiple hugetlb page
7814sizes (it must be a power of 2 value supported by the system).
7815
7816In some versions of Linux, the @option{hugetlb} option is incompatible
7817with the @option{seal} option (requires at least Linux 4.16).
7818
7819Please refer to @option{memory-backend-file} for a description of the
7820other options.
7821
Marc-André Lureau36ea3972018-08-28 17:38:40 +02007822The @option{share} boolean option is @var{on} by default with memfd.
7823
Laurent Vivier6c4e9d42019-08-20 18:06:13 +02007824@item -object rng-builtin,id=@var{id}
7825
7826Creates a random number generator backend which obtains entropy from
7827QEMU builtin functions. The @option{id} parameter is a unique ID that
7828will be used to reference this entropy backend from the @option{virtio-rng}
Laurent Vivier0198c262019-08-20 18:06:15 +02007829device. By default, the @option{virtio-rng} device uses this RNG backend.
Laurent Vivier6c4e9d42019-08-20 18:06:13 +02007830
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007831@item -object rng-random,id=@var{id},filename=@var{/dev/random}
7832
7833Creates a random number generator backend which obtains entropy from
7834a device on the host. The @option{id} parameter is a unique ID that
7835will be used to reference this entropy backend from the @option{virtio-rng}
7836device. The @option{filename} parameter specifies which file to obtain
Kashyap Chamarthya2230bd2019-05-29 16:31:03 +02007837entropy from and if omitted defaults to @option{/dev/urandom}.
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007838
7839@item -object rng-egd,id=@var{id},chardev=@var{chardevid}
7840
7841Creates a random number generator backend which obtains entropy from
7842an external daemon running on the host. The @option{id} parameter is
7843a unique ID that will be used to reference this entropy backend from
7844the @option{virtio-rng} device. The @option{chardev} parameter is
7845the unique ID of a character device backend that provides the connection
7846to the RNG daemon.
7847
Daniel P. Berrangee00adf62015-03-13 17:39:26 +00007848@item -object tls-creds-anon,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/cred/dir},verify-peer=@var{on|off}
7849
7850Creates a TLS anonymous credentials object, which can be used to provide
7851TLS support on network backends. The @option{id} parameter is a unique
7852ID which network backends will use to access the credentials. The
7853@option{endpoint} is either @option{server} or @option{client} depending
7854on whether the QEMU network backend that uses the credentials will be
7855acting as a client or as a server. If @option{verify-peer} is enabled
7856(the default) then once the handshake is completed, the peer credentials
7857will be verified, though this is a no-op for anonymous credentials.
7858
7859The @var{dir} parameter tells QEMU where to find the credential
7860files. For server endpoints, this directory may contain a file
7861@var{dh-params.pem} providing diffie-hellman parameters to use
7862for the TLS server. If the file is missing, QEMU will generate
7863a set of DH parameters at startup. This is a computationally
7864expensive operation that consumes random pool entropy, so it is
7865recommended that a persistent set of parameters be generated
7866upfront and saved.
7867
Richard W.M. Jonese1a6dc92018-07-03 09:03:03 +01007868@item -object tls-creds-psk,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/keys/dir}[,username=@var{username}]
7869
7870Creates a TLS Pre-Shared Keys (PSK) credentials object, which can be used to provide
7871TLS support on network backends. The @option{id} parameter is a unique
7872ID which network backends will use to access the credentials. The
7873@option{endpoint} is either @option{server} or @option{client} depending
7874on whether the QEMU network backend that uses the credentials will be
7875acting as a client or as a server. For clients only, @option{username}
7876is the username which will be sent to the server. If omitted
7877it defaults to ``qemu''.
7878
7879The @var{dir} parameter tells QEMU where to find the keys file.
7880It is called ``@var{dir}/keys.psk'' and contains ``username:key''
7881pairs. This file can most easily be created using the GnuTLS
7882@code{psktool} program.
7883
7884For server endpoints, @var{dir} may also contain a file
7885@var{dh-params.pem} providing diffie-hellman parameters to use
7886for the TLS server. If the file is missing, QEMU will generate
7887a set of DH parameters at startup. This is a computationally
7888expensive operation that consumes random pool entropy, so it is
7889recommended that a persistent set of parameters be generated
7890up front and saved.
7891
Christophe Fergeau00e5e9d2017-12-08 15:14:30 +01007892@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}
Daniel P. Berrange85bcbc72015-03-13 17:39:26 +00007893
7894Creates a TLS anonymous credentials object, which can be used to provide
7895TLS support on network backends. The @option{id} parameter is a unique
7896ID which network backends will use to access the credentials. The
7897@option{endpoint} is either @option{server} or @option{client} depending
7898on whether the QEMU network backend that uses the credentials will be
7899acting as a client or as a server. If @option{verify-peer} is enabled
7900(the default) then once the handshake is completed, the peer credentials
7901will be verified. With x509 certificates, this implies that the clients
7902must be provided with valid client certificates too.
7903
7904The @var{dir} parameter tells QEMU where to find the credential
7905files. For server endpoints, this directory may contain a file
7906@var{dh-params.pem} providing diffie-hellman parameters to use
7907for the TLS server. If the file is missing, QEMU will generate
7908a set of DH parameters at startup. This is a computationally
7909expensive operation that consumes random pool entropy, so it is
7910recommended that a persistent set of parameters be generated
7911upfront and saved.
7912
7913For x509 certificate credentials the directory will contain further files
7914providing the x509 certificates. The certificates must be stored
7915in PEM format, in filenames @var{ca-cert.pem}, @var{ca-crl.pem} (optional),
7916@var{server-cert.pem} (only servers), @var{server-key.pem} (only servers),
7917@var{client-cert.pem} (only clients), and @var{client-key.pem} (only clients).
7918
Daniel P. Berrange1d7b5b42015-10-15 16:14:42 +01007919For the @var{server-key.pem} and @var{client-key.pem} files which
7920contain sensitive private keys, it is possible to use an encrypted
7921version by providing the @var{passwordid} parameter. This provides
7922the ID of a previously created @code{secret} object containing the
7923password for decryption.
7924
Christophe Fergeau00e5e9d2017-12-08 15:14:30 +01007925The @var{priority} parameter allows to override the global default
7926priority used by gnutls. This can be useful if the system administrator
7927needs to use a weaker set of crypto priorities for QEMU without
7928potentially forcing the weakness onto all applications. Or conversely
7929if one wants wants a stronger default for QEMU than for all other
7930applications, they can do this through this parameter. Its format is
7931a gnutls priority string as described at
7932@url{https://gnutls.org/manual/html_node/Priority-Strings.html}.
7933
Lukas Straub19731362019-10-24 16:25:48 +02007934@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}]
Yang Hongyang7dbb11c2015-10-07 11:52:21 +08007935
7936Interval @var{t} can't be 0, this filter batches the packet delivery: all
7937packets arriving in a given interval on netdev @var{netdevid} are delayed
7938until the end of the interval. Interval is in microseconds.
zhanghailiang338d3f42016-03-01 13:37:02 +08007939@option{status} is optional that indicate whether the netfilter is
7940on (enabled) or off (disabled), the default status for netfilter will be 'on'.
Yang Hongyang7dbb11c2015-10-07 11:52:21 +08007941
7942queue @var{all|rx|tx} is an option that can be applied to any netfilter.
7943
7944@option{all}: the filter is attached both to the receive and the transmit
7945 queue of the netdev (default).
7946
7947@option{rx}: the filter is attached to the receive queue of the netdev,
7948 where it will receive packets sent to the netdev.
7949
7950@option{tx}: the filter is attached to the transmit queue of the netdev,
7951 where it will receive packets sent by the netdev.
7952
Lukas Straub19731362019-10-24 16:25:48 +02007953position @var{head|tail|id=<id>} is an option to specify where the
7954filter should be inserted in the filter list. It can be applied to any
7955netfilter.
7956
7957@option{head}: the filter is inserted at the head of the filter
7958 list, before any existing filters.
7959
7960@option{tail}: the filter is inserted at the tail of the filter
7961 list, behind any existing filters (default).
7962
7963@option{id=<id>}: the filter is inserted before or behind the filter
7964 specified by <id>, see the insert option below.
7965
7966insert @var{behind|before} is an option to specify where to insert the
7967new filter relative to the one specified with position=id=<id>. It can
7968be applied to any netfilter.
7969
7970@option{before}: insert before the specified filter.
7971
7972@option{behind}: insert behind the specified filter (default).
7973
7974@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}]
Zhang Chenf6d3afb2016-03-15 15:41:33 +08007975
Zhang Chene2521f02017-07-04 14:53:48 +08007976filter-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.
Zhang Chenf6d3afb2016-03-15 15:41:33 +08007977
Lukas Straub19731362019-10-24 16:25:48 +02007978@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}]
Zhang Chend46f75b2016-03-17 16:16:26 +08007979
7980filter-redirector on netdev @var{netdevid},redirect filter's net packet to chardev
Zhang Chen00d5c242017-07-04 14:53:49 +08007981@var{chardevid},and redirect indev's packet to filter.if it has the vnet_hdr_support flag,
7982filter-redirector will redirect packet with vnet_hdr_len.
Zhang Chend46f75b2016-03-17 16:16:26 +08007983Create a filter-redirector we need to differ outdev id from indev id, id can not
7984be the same. we can just use indev or outdev, but at least one of indev or outdev
7985need to be specified.
7986
Lukas Straub19731362019-10-24 16:25:48 +02007987@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}]
Zhang Chene6eee8a2016-09-27 10:22:32 +08007988
7989Filter-rewriter is a part of COLO project.It will rewrite tcp packet to
7990secondary from primary to keep secondary tcp connection,and rewrite
7991tcp packet to primary from secondary make tcp packet can be handled by
Zhang Chen4b39bdc2017-07-04 14:53:55 +08007992client.if it has the vnet_hdr_support flag, we can parse packet with vnet header.
Zhang Chene6eee8a2016-09-27 10:22:32 +08007993
7994usage:
7995colo secondary:
7996-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
7997-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
7998-object filter-rewriter,id=rew0,netdev=hn0,queue=all
7999
Lukas Straub19731362019-10-24 16:25:48 +02008000@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}]
Thomas Huthd3e0c032015-10-13 12:40:02 +02008001
8002Dump the network traffic on netdev @var{dev} to the file specified by
8003@var{filename}. At most @var{len} bytes (64k by default) per packet are stored.
8004The file format is libpcap, so it can be analyzed with tools such as tcpdump
8005or Wireshark.
8006
Zhang Chencf6af762019-06-10 00:44:29 +08008007@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}]
Zhang Chen7dce4e62016-09-27 10:22:26 +08008008
8009Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
8010secondary packet. If the packets are same, we will output primary
8011packet to outdev@var{chardevid}, else we will notify colo-frame
8012do checkpoint and send primary packet to outdev@var{chardevid}.
Zhang Chen5aede7f2019-04-26 17:07:30 +08008013In order to improve efficiency, we need to put the task of comparison
8014in another thread. If it has the vnet_hdr_support flag, colo compare
8015will send/recv packet with vnet_hdr_len.
Zhang Chencf6af762019-06-10 00:44:29 +08008016If you want to use Xen COLO, will need the notify_dev to notify Xen
8017colo-frame to do checkpoint.
Zhang Chen7dce4e62016-09-27 10:22:26 +08008018
8019we must use it with the help of filter-mirror and filter-redirector.
8020
8021@example
8022
Zhang Chencf6af762019-06-10 00:44:29 +08008023KVM COLO
8024
Zhang Chen7dce4e62016-09-27 10:22:26 +08008025primary:
8026-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8027-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8028-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8029-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8030-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8031-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8032-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8033-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
Zhang Chen5aede7f2019-04-26 17:07:30 +08008034-object iothread,id=iothread1
Zhang Chen7dce4e62016-09-27 10:22:26 +08008035-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8036-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8037-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
Zhang Chen5aede7f2019-04-26 17:07:30 +08008038-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
Zhang Chen7dce4e62016-09-27 10:22:26 +08008039
8040secondary:
8041-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8042-device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8043-chardev socket,id=red0,host=3.3.3.3,port=9003
8044-chardev socket,id=red1,host=3.3.3.3,port=9004
8045-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8046-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8047
Zhang Chencf6af762019-06-10 00:44:29 +08008048
8049Xen COLO
8050
8051primary:
8052-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8053-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8054-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8055-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8056-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8057-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8058-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8059-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8060-chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8061-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8062-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8063-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8064-object iothread,id=iothread1
8065-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8066
8067secondary:
8068-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8069-device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8070-chardev socket,id=red0,host=3.3.3.3,port=9003
8071-chardev socket,id=red1,host=3.3.3.3,port=9004
8072-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8073-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8074
Zhang Chen7dce4e62016-09-27 10:22:26 +08008075@end example
8076
8077If you want to know the detail of above command line, you can read
8078the colo-compare git log.
8079
Gonglei1653a5f2016-10-28 16:33:23 +08008080@item -object cryptodev-backend-builtin,id=@var{id}[,queues=@var{queues}]
8081
8082Creates a cryptodev backend which executes crypto opreation from
8083the QEMU cipher APIS. The @var{id} parameter is
8084a unique ID that will be used to reference this cryptodev backend from
8085the @option{virtio-crypto} device. The @var{queues} parameter is optional,
8086which specify the queue number of cryptodev backend, the default of
8087@var{queues} is 1.
8088
8089@example
8090
Thomas Huth664785a2019-07-30 17:08:26 +02008091 # @value{qemu_system} \
Gonglei1653a5f2016-10-28 16:33:23 +08008092 [...] \
8093 -object cryptodev-backend-builtin,id=cryptodev0 \
8094 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8095 [...]
8096@end example
8097
Gonglei042cea22018-03-01 21:46:28 +08008098@item -object cryptodev-vhost-user,id=@var{id},chardev=@var{chardevid}[,queues=@var{queues}]
8099
8100Creates a vhost-user cryptodev backend, backed by a chardev @var{chardevid}.
8101The @var{id} parameter is a unique ID that will be used to reference this
8102cryptodev backend from the @option{virtio-crypto} device.
8103The chardev should be a unix domain socket backed one. The vhost-user uses
8104a specifically defined protocol to pass vhost ioctl replacement messages
8105to an application on the other end of the socket.
8106The @var{queues} parameter is optional, which specify the queue number
8107of cryptodev backend for multiqueue vhost-user, the default of @var{queues} is 1.
8108
8109@example
8110
Thomas Huth664785a2019-07-30 17:08:26 +02008111 # @value{qemu_system} \
Gonglei042cea22018-03-01 21:46:28 +08008112 [...] \
8113 -chardev socket,id=chardev0,path=/path/to/socket \
8114 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8115 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8116 [...]
8117@end example
8118
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008119@item -object secret,id=@var{id},data=@var{string},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8120@item -object secret,id=@var{id},file=@var{filename},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8121
8122Defines a secret to store a password, encryption key, or some other sensitive
8123data. The sensitive data can either be passed directly via the @var{data}
8124parameter, or indirectly via the @var{file} parameter. Using the @var{data}
8125parameter is insecure unless the sensitive data is encrypted.
8126
8127The sensitive data can be provided in raw format (the default), or base64.
8128When encoded as JSON, the raw format only supports valid UTF-8 characters,
8129so base64 is recommended for sending binary data. QEMU will convert from
8130which ever format is provided to the format it needs internally. eg, an
8131RBD password can be provided in raw format, even though it will be base64
8132encoded when passed onto the RBD sever.
8133
8134For added protection, it is possible to encrypt the data associated with
8135a secret using the AES-256-CBC cipher. Use of encryption is indicated
8136by providing the @var{keyid} and @var{iv} parameters. The @var{keyid}
8137parameter provides the ID of a previously defined secret that contains
8138the AES-256 decryption key. This key should be 32-bytes long and be
8139base64 encoded. The @var{iv} parameter provides the random initialization
8140vector used for encryption of this particular secret and should be a
Daniel P. Berrange69c0b272016-04-04 10:33:55 +01008141base64 encrypted string of the 16-byte IV.
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008142
8143The simplest (insecure) usage is to provide the secret inline
8144
8145@example
8146
Thomas Huth664785a2019-07-30 17:08:26 +02008147 # @value{qemu_system} -object secret,id=sec0,data=letmein,format=raw
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008148
8149@end example
8150
8151The simplest secure usage is to provide the secret via a file
8152
Eric Blakeb43671f2017-07-03 13:09:50 -05008153 # printf "letmein" > mypasswd.txt
Thomas Huth664785a2019-07-30 17:08:26 +02008154 # @value{qemu_system} -object secret,id=sec0,file=mypasswd.txt,format=raw
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008155
8156For greater security, AES-256-CBC should be used. To illustrate usage,
8157consider the openssl command line tool which can encrypt the data. Note
8158that when encrypting, the plaintext must be padded to the cipher block
8159size (32 bytes) using the standard PKCS#5/6 compatible padding algorithm.
8160
8161First a master key needs to be created in base64 encoding:
8162
8163@example
8164 # openssl rand -base64 32 > key.b64
8165 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8166@end example
8167
8168Each secret to be encrypted needs to have a random initialization vector
8169generated. These do not need to be kept secret
8170
8171@example
8172 # openssl rand -base64 16 > iv.b64
8173 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8174@end example
8175
8176The secret to be defined can now be encrypted, in this case we're
8177telling openssl to base64 encode the result, but it could be left
8178as raw bytes if desired.
8179
8180@example
Eric Blakeb43671f2017-07-03 13:09:50 -05008181 # SECRET=$(printf "letmein" |
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008182 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8183@end example
8184
8185When launching QEMU, create a master secret pointing to @code{key.b64}
8186and specify that to be used to decrypt the user password. Pass the
8187contents of @code{iv.b64} to the second secret
8188
8189@example
Thomas Huth664785a2019-07-30 17:08:26 +02008190 # @value{qemu_system} \
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008191 -object secret,id=secmaster0,format=base64,file=key.b64 \
8192 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8193 data=$SECRET,iv=$(<iv.b64)
8194@end example
8195
Brijesh Singha9b49422018-03-08 06:48:41 -06008196@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}]
8197
8198Create a Secure Encrypted Virtualization (SEV) guest object, which can be used
8199to provide the guest memory encryption support on AMD processors.
8200
8201When memory encryption is enabled, one of the physical address bit (aka the
8202C-bit) is utilized to mark if a memory page is protected. The @option{cbitpos}
8203is used to provide the C-bit position. The C-bit position is Host family dependent
8204hence user must provide this value. On EPYC, the value should be 47.
8205
8206When memory encryption is enabled, we loose certain bits in physical address space.
8207The @option{reduced-phys-bits} is used to provide the number of bits we loose in
8208physical address space. Similar to C-bit, the value is Host family dependent.
8209On EPYC, the value should be 5.
8210
8211The @option{sev-device} provides the device file to use for communicating with
8212the SEV firmware running inside AMD Secure Processor. The default device is
8213'/dev/sev'. If hardware supports memory encryption then /dev/sev devices are
8214created by CCP driver.
8215
8216The @option{policy} provides the guest policy to be enforced by the SEV firmware
8217and restrict what configuration and operational commands can be performed on this
8218guest by the hypervisor. The policy should be provided by the guest owner and is
8219bound to the guest and cannot be changed throughout the lifetime of the guest.
8220The default is 0.
8221
8222If guest @option{policy} allows sharing the key with another SEV guest then
8223@option{handle} can be use to provide handle of the guest from which to share
8224the key.
8225
8226The @option{dh-cert-file} and @option{session-file} provides the guest owner's
8227Public Diffie-Hillman key defined in SEV spec. The PDH and session parameters
8228are used for establishing a cryptographic session with the guest owner to
8229negotiate keys used for attestation. The file must be encoded in base64.
8230
8231e.g to launch a SEV guest
8232@example
Thomas Huth664785a2019-07-30 17:08:26 +02008233 # @value{qemu_system_x86} \
Brijesh Singha9b49422018-03-08 06:48:41 -06008234 ......
8235 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8236 -machine ...,memory-encryption=sev0
8237 .....
8238
8239@end example
Daniel P. Berrangéfb5c4eb2018-05-02 15:40:33 +01008240
8241
8242@item -object authz-simple,id=@var{id},identity=@var{string}
8243
8244Create an authorization object that will control access to network services.
8245
8246The @option{identity} parameter is identifies the user and its format
8247depends on the network service that authorization object is associated
8248with. For authorizing based on TLS x509 certificates, the identity must
8249be the x509 distinguished name. Note that care must be taken to escape
8250any commas in the distinguished name.
8251
8252An example authorization object to validate a x509 distinguished name
8253would look like:
8254@example
Thomas Huth664785a2019-07-30 17:08:26 +02008255 # @value{qemu_system} \
Daniel P. Berrangéfb5c4eb2018-05-02 15:40:33 +01008256 ...
8257 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8258 ...
8259@end example
8260
8261Note the use of quotes due to the x509 distinguished name containing
8262whitespace, and escaping of ','.
8263
Daniel P. Berrangé55d86982018-05-11 12:19:59 +01008264@item -object authz-listfile,id=@var{id},filename=@var{path},refresh=@var{yes|no}
8265
8266Create an authorization object that will control access to network services.
8267
8268The @option{filename} parameter is the fully qualified path to a file
8269containing the access control list rules in JSON format.
8270
8271An example set of rules that match against SASL usernames might look
8272like:
8273
8274@example
8275 @{
8276 "rules": [
8277 @{ "match": "fred", "policy": "allow", "format": "exact" @},
8278 @{ "match": "bob", "policy": "allow", "format": "exact" @},
8279 @{ "match": "danb", "policy": "deny", "format": "glob" @},
8280 @{ "match": "dan*", "policy": "allow", "format": "exact" @},
8281 ],
8282 "policy": "deny"
8283 @}
8284@end example
8285
8286When checking access the object will iterate over all the rules and
8287the first rule to match will have its @option{policy} value returned
8288as the result. If no rules match, then the default @option{policy}
8289value is returned.
8290
8291The rules can either be an exact string match, or they can use the
8292simple UNIX glob pattern matching to allow wildcards to be used.
8293
8294If @option{refresh} is set to true the file will be monitored
8295and automatically reloaded whenever its content changes.
8296
8297As with the @code{authz-simple} object, the format of the identity
8298strings being matched depends on the network service, but is usually
8299a TLS x509 distinguished name, or a SASL username.
8300
8301An example authorization object to validate a SASL username
8302would look like:
8303@example
Thomas Huth664785a2019-07-30 17:08:26 +02008304 # @value{qemu_system} \
Daniel P. Berrangé55d86982018-05-11 12:19:59 +01008305 ...
8306 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8307 ...
8308@end example
8309
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008310@item -object authz-pam,id=@var{id},service=@var{string}
8311
8312Create an authorization object that will control access to network services.
8313
8314The @option{service} parameter provides the name of a PAM service to use
8315for authorization. It requires that a file @code{/etc/pam.d/@var{service}}
8316exist to provide the configuration for the @code{account} subsystem.
8317
8318An example authorization object to validate a TLS x509 distinguished
8319name would look like:
8320
8321@example
Thomas Huth664785a2019-07-30 17:08:26 +02008322 # @value{qemu_system} \
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008323 ...
8324 -object authz-pam,id=auth0,service=qemu-vnc
8325 ...
8326@end example
8327
8328There would then be a corresponding config file for PAM at
8329@code{/etc/pam.d/qemu-vnc} that contains:
8330
8331@example
8332account requisite pam_listfile.so item=user sense=allow \
8333 file=/etc/qemu/vnc.allow
8334@end example
8335
8336Finally the @code{/etc/qemu/vnc.allow} file would contain
8337the list of x509 distingished names that are permitted
8338access
8339
8340@example
8341CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
8342@end example
8343
Stefan Hajnoczi86d2a492019-10-25 14:22:36 +02008344@item -object iothread,id=@var{id},poll-max-ns=@var{poll-max-ns},poll-grow=@var{poll-grow},poll-shrink=@var{poll-shrink}
8345
8346Creates a dedicated event loop thread that devices can be assigned to. This is
8347known as an IOThread. By default device emulation happens in vCPU threads or
8348the main event loop thread. This can become a scalability bottleneck.
8349IOThreads allow device emulation and I/O to run on other host CPUs.
8350
8351The @option{id} parameter is a unique ID that will be used to reference this
8352IOThread from @option{-device ...,iothread=@var{id}}. Multiple devices can be
8353assigned to an IOThread. Note that not all devices support an
8354@option{iothread} parameter.
8355
8356The @code{query-iothreads} QMP command lists IOThreads and reports their thread
8357IDs so that the user can configure host CPU pinning/affinity.
8358
8359IOThreads use an adaptive polling algorithm to reduce event loop latency.
8360Instead of entering a blocking system call to monitor file descriptors and then
8361pay the cost of being woken up when an event occurs, the polling algorithm
8362spins waiting for events for a short time. The algorithm's default parameters
8363are suitable for many cases but can be adjusted based on knowledge of the
8364workload and/or host device latency.
8365
8366The @option{poll-max-ns} parameter is the maximum number of nanoseconds to busy
8367wait for events. Polling can be disabled by setting this value to 0.
8368
8369The @option{poll-grow} parameter is the multiplier used to increase the polling
8370time when the algorithm detects it is missing events due to not polling long
8371enough.
8372
8373The @option{poll-shrink} parameter is the divisor used to decrease the polling
8374time when the algorithm detects it is spending too long polling without
8375encountering events.
8376
8377The polling parameters can be modified at run-time using the @code{qom-set} command (where @code{iothread1} is the IOThread's @code{id}):
8378
8379@example
8380(qemu) qom-set /objects/iothread1 poll-max-ns 100000
8381@end example
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008382
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01008383@end table
8384
8385ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008386SRST
8387``-object typename[,prop1=value1,...]``
8388 Create a new object of type typename setting properties in the order
8389 they are specified. Note that the 'id' property must be set. These
8390 objects are placed in the '/objects' path.
8391
8392 ``-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``
8393 Creates a memory file backend object, which can be used to back
8394 the guest RAM with huge pages.
8395
8396 The ``id`` parameter is a unique ID that will be used to
8397 reference this memory region when configuring the ``-numa``
8398 argument.
8399
8400 The ``size`` option provides the size of the memory region, and
8401 accepts common suffixes, eg ``500M``.
8402
8403 The ``mem-path`` provides the path to either a shared memory or
8404 huge page filesystem mount.
8405
8406 The ``share`` boolean option determines whether the memory
8407 region is marked as private to QEMU, or shared. The latter
8408 allows a co-operating external process to access the QEMU memory
8409 region.
8410
8411 The ``share`` is also required for pvrdma devices due to
8412 limitations in the RDMA API provided by Linux.
8413
8414 Setting share=on might affect the ability to configure NUMA
8415 bindings for the memory backend under some circumstances, see
8416 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel
8417 source tree for additional details.
8418
8419 Setting the ``discard-data`` boolean option to on indicates that
8420 file contents can be destroyed when QEMU exits, to avoid
8421 unnecessarily flushing data to the backing file. Note that
8422 ``discard-data`` is only an optimization, and QEMU might not
8423 discard file contents if it aborts unexpectedly or is terminated
8424 using SIGKILL.
8425
8426 The ``merge`` boolean option enables memory merge, also known as
8427 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider
8428 the pages for memory deduplication.
8429
8430 Setting the ``dump`` boolean option to off excludes the memory
8431 from core dumps. This feature is also known as MADV\_DONTDUMP.
8432
8433 The ``prealloc`` boolean option enables memory preallocation.
8434
8435 The ``host-nodes`` option binds the memory range to a list of
8436 NUMA host nodes.
8437
8438 The ``policy`` option sets the NUMA policy to one of the
8439 following values:
8440
8441 ``default``
8442 default host policy
8443
8444 ``preferred``
8445 prefer the given host node list for allocation
8446
8447 ``bind``
8448 restrict memory allocation to the given host node list
8449
8450 ``interleave``
8451 interleave memory allocations across the given host node
8452 list
8453
8454 The ``align`` option specifies the base address alignment when
8455 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg
8456 ``2M``. Some backend store specified by ``mem-path`` requires an
8457 alignment different than the default one used by QEMU, eg the
8458 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
8459 such cases, users can specify the required alignment via this
8460 option.
8461
8462 The ``pmem`` option specifies whether the backing file specified
8463 by ``mem-path`` is in host persistent memory that can be
8464 accessed using the SNIA NVM programming model (e.g. Intel
8465 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary
8466 operations to guarantee the persistence of its own writes to
8467 ``mem-path`` (e.g. in vNVDIMM label emulation and live
8468 migration). Also, we will map the backend-file with MAP\_SYNC
8469 flag, which ensures the file metadata is in sync for
8470 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC
8471 requires support from both the host kernel (since Linux kernel
8472 4.15) and the filesystem of ``mem-path`` mounted with DAX
8473 option.
8474
8475 ``-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``
8476 Creates a memory backend object, which can be used to back the
8477 guest RAM. Memory backend objects offer more control than the
8478 ``-m`` option that is traditionally used to define guest RAM.
8479 Please refer to ``memory-backend-file`` for a description of the
8480 options.
8481
8482 ``-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``
8483 Creates an anonymous memory file backend object, which allows
8484 QEMU to share the memory with an external process (e.g. when
8485 using vhost-user). The memory is allocated with memfd and
8486 optional sealing. (Linux only)
8487
8488 The ``seal`` option creates a sealed-file, that will block
8489 further resizing the memory ('on' by default).
8490
8491 The ``hugetlb`` option specify the file to be created resides in
8492 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction
8493 with the ``hugetlb`` option, the ``hugetlbsize`` option specify
8494 the hugetlb page size on systems that support multiple hugetlb
8495 page sizes (it must be a power of 2 value supported by the
8496 system).
8497
8498 In some versions of Linux, the ``hugetlb`` option is
8499 incompatible with the ``seal`` option (requires at least Linux
8500 4.16).
8501
8502 Please refer to ``memory-backend-file`` for a description of the
8503 other options.
8504
8505 The ``share`` boolean option is on by default with memfd.
8506
8507 ``-object rng-builtin,id=id``
8508 Creates a random number generator backend which obtains entropy
8509 from QEMU builtin functions. The ``id`` parameter is a unique ID
8510 that will be used to reference this entropy backend from the
8511 ``virtio-rng`` device. By default, the ``virtio-rng`` device
8512 uses this RNG backend.
8513
8514 ``-object rng-random,id=id,filename=/dev/random``
8515 Creates a random number generator backend which obtains entropy
8516 from a device on the host. The ``id`` parameter is a unique ID
8517 that will be used to reference this entropy backend from the
8518 ``virtio-rng`` device. The ``filename`` parameter specifies
8519 which file to obtain entropy from and if omitted defaults to
8520 ``/dev/urandom``.
8521
8522 ``-object rng-egd,id=id,chardev=chardevid``
8523 Creates a random number generator backend which obtains entropy
8524 from an external daemon running on the host. The ``id``
8525 parameter is a unique ID that will be used to reference this
8526 entropy backend from the ``virtio-rng`` device. The ``chardev``
8527 parameter is the unique ID of a character device backend that
8528 provides the connection to the RNG daemon.
8529
8530 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off``
8531 Creates a TLS anonymous credentials object, which can be used to
8532 provide TLS support on network backends. The ``id`` parameter is
8533 a unique ID which network backends will use to access the
8534 credentials. The ``endpoint`` is either ``server`` or ``client``
8535 depending on whether the QEMU network backend that uses the
8536 credentials will be acting as a client or as a server. If
8537 ``verify-peer`` is enabled (the default) then once the handshake
8538 is completed, the peer credentials will be verified, though this
8539 is a no-op for anonymous credentials.
8540
8541 The dir parameter tells QEMU where to find the credential files.
8542 For server endpoints, this directory may contain a file
8543 dh-params.pem providing diffie-hellman parameters to use for the
8544 TLS server. If the file is missing, QEMU will generate a set of
8545 DH parameters at startup. This is a computationally expensive
8546 operation that consumes random pool entropy, so it is
8547 recommended that a persistent set of parameters be generated
8548 upfront and saved.
8549
8550 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]``
8551 Creates a TLS Pre-Shared Keys (PSK) credentials object, which
8552 can be used to provide TLS support on network backends. The
8553 ``id`` parameter is a unique ID which network backends will use
8554 to access the credentials. The ``endpoint`` is either ``server``
8555 or ``client`` depending on whether the QEMU network backend that
8556 uses the credentials will be acting as a client or as a server.
8557 For clients only, ``username`` is the username which will be
8558 sent to the server. If omitted it defaults to "qemu".
8559
8560 The dir parameter tells QEMU where to find the keys file. It is
8561 called "dir/keys.psk" and contains "username:key" pairs. This
8562 file can most easily be created using the GnuTLS ``psktool``
8563 program.
8564
8565 For server endpoints, dir may also contain a file dh-params.pem
8566 providing diffie-hellman parameters to use for the TLS server.
8567 If the file is missing, QEMU will generate a set of DH
8568 parameters at startup. This is a computationally expensive
8569 operation that consumes random pool entropy, so it is
8570 recommended that a persistent set of parameters be generated up
8571 front and saved.
8572
8573 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id``
8574 Creates a TLS anonymous credentials object, which can be used to
8575 provide TLS support on network backends. The ``id`` parameter is
8576 a unique ID which network backends will use to access the
8577 credentials. The ``endpoint`` is either ``server`` or ``client``
8578 depending on whether the QEMU network backend that uses the
8579 credentials will be acting as a client or as a server. If
8580 ``verify-peer`` is enabled (the default) then once the handshake
8581 is completed, the peer credentials will be verified. With x509
8582 certificates, this implies that the clients must be provided
8583 with valid client certificates too.
8584
8585 The dir parameter tells QEMU where to find the credential files.
8586 For server endpoints, this directory may contain a file
8587 dh-params.pem providing diffie-hellman parameters to use for the
8588 TLS server. If the file is missing, QEMU will generate a set of
8589 DH parameters at startup. This is a computationally expensive
8590 operation that consumes random pool entropy, so it is
8591 recommended that a persistent set of parameters be generated
8592 upfront and saved.
8593
8594 For x509 certificate credentials the directory will contain
8595 further files providing the x509 certificates. The certificates
8596 must be stored in PEM format, in filenames ca-cert.pem,
8597 ca-crl.pem (optional), server-cert.pem (only servers),
8598 server-key.pem (only servers), client-cert.pem (only clients),
8599 and client-key.pem (only clients).
8600
8601 For the server-key.pem and client-key.pem files which contain
8602 sensitive private keys, it is possible to use an encrypted
8603 version by providing the passwordid parameter. This provides the
8604 ID of a previously created ``secret`` object containing the
8605 password for decryption.
8606
8607 The priority parameter allows to override the global default
8608 priority used by gnutls. This can be useful if the system
8609 administrator needs to use a weaker set of crypto priorities for
8610 QEMU without potentially forcing the weakness onto all
8611 applications. Or conversely if one wants wants a stronger
8612 default for QEMU than for all other applications, they can do
8613 this through this parameter. Its format is a gnutls priority
8614 string as described at
8615 https://gnutls.org/manual/html_node/Priority-Strings.html.
8616
8617 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]``
8618 Interval t can't be 0, this filter batches the packet delivery:
8619 all packets arriving in a given interval on netdev netdevid are
8620 delayed until the end of the interval. Interval is in
8621 microseconds. ``status`` is optional that indicate whether the
8622 netfilter is on (enabled) or off (disabled), the default status
8623 for netfilter will be 'on'.
8624
8625 queue all\|rx\|tx is an option that can be applied to any
8626 netfilter.
8627
8628 ``all``: the filter is attached both to the receive and the
8629 transmit queue of the netdev (default).
8630
8631 ``rx``: the filter is attached to the receive queue of the
8632 netdev, where it will receive packets sent to the netdev.
8633
8634 ``tx``: the filter is attached to the transmit queue of the
8635 netdev, where it will receive packets sent by the netdev.
8636
8637 position head\|tail\|id=<id> is an option to specify where the
8638 filter should be inserted in the filter list. It can be applied
8639 to any netfilter.
8640
8641 ``head``: the filter is inserted at the head of the filter list,
8642 before any existing filters.
8643
8644 ``tail``: the filter is inserted at the tail of the filter list,
8645 behind any existing filters (default).
8646
8647 ``id=<id>``: the filter is inserted before or behind the filter
8648 specified by <id>, see the insert option below.
8649
8650 insert behind\|before is an option to specify where to insert
8651 the new filter relative to the one specified with
8652 position=id=<id>. It can be applied to any netfilter.
8653
8654 ``before``: insert before the specified filter.
8655
8656 ``behind``: insert behind the specified filter (default).
8657
8658 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8659 filter-mirror on netdev netdevid,mirror net packet to
8660 chardevchardevid, if it has the vnet\_hdr\_support flag,
8661 filter-mirror will mirror packet with vnet\_hdr\_len.
8662
8663 ``-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]``
8664 filter-redirector on netdev netdevid,redirect filter's net
8665 packet to chardev chardevid,and redirect indev's packet to
8666 filter.if it has the vnet\_hdr\_support flag, filter-redirector
8667 will redirect packet with vnet\_hdr\_len. Create a
8668 filter-redirector we need to differ outdev id from indev id, id
8669 can not be the same. we can just use indev or outdev, but at
8670 least one of indev or outdev need to be specified.
8671
8672 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8673 Filter-rewriter is a part of COLO project.It will rewrite tcp
8674 packet to secondary from primary to keep secondary tcp
8675 connection,and rewrite tcp packet to primary from secondary make
8676 tcp packet can be handled by client.if it has the
8677 vnet\_hdr\_support flag, we can parse packet with vnet header.
8678
8679 usage: colo secondary: -object
8680 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object
8681 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object
8682 filter-rewriter,id=rew0,netdev=hn0,queue=all
8683
8684 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]``
8685 Dump the network traffic on netdev dev to the file specified by
8686 filename. At most len bytes (64k by default) per packet are
8687 stored. The file format is libpcap, so it can be analyzed with
8688 tools such as tcpdump or Wireshark.
8689
8690 ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id]``
8691 Colo-compare gets packet from primary\_inchardevid and
8692 secondary\_inchardevid, than compare primary packet with
8693 secondary packet. If the packets are same, we will output
8694 primary packet to outdevchardevid, else we will notify
8695 colo-frame do checkpoint and send primary packet to
8696 outdevchardevid. In order to improve efficiency, we need to put
8697 the task of comparison in another thread. If it has the
8698 vnet\_hdr\_support flag, colo compare will send/recv packet with
8699 vnet\_hdr\_len. If you want to use Xen COLO, will need the
8700 notify\_dev to notify Xen colo-frame to do checkpoint.
8701
8702 we must use it with the help of filter-mirror and
8703 filter-redirector.
8704
8705 ::
8706
8707 KVM COLO
8708
8709 primary:
8710 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8711 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8712 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8713 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8714 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8715 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8716 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8717 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8718 -object iothread,id=iothread1
8719 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8720 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8721 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8722 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
8723
8724 secondary:
8725 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8726 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8727 -chardev socket,id=red0,host=3.3.3.3,port=9003
8728 -chardev socket,id=red1,host=3.3.3.3,port=9004
8729 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8730 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8731
8732
8733 Xen COLO
8734
8735 primary:
8736 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8737 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8738 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8739 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8740 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8741 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8742 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8743 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8744 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8745 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8746 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8747 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8748 -object iothread,id=iothread1
8749 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8750
8751 secondary:
8752 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8753 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8754 -chardev socket,id=red0,host=3.3.3.3,port=9003
8755 -chardev socket,id=red1,host=3.3.3.3,port=9004
8756 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8757 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8758
8759 If you want to know the detail of above command line, you can
8760 read the colo-compare git log.
8761
8762 ``-object cryptodev-backend-builtin,id=id[,queues=queues]``
8763 Creates a cryptodev backend which executes crypto opreation from
8764 the QEMU cipher APIS. The id parameter is a unique ID that will
8765 be used to reference this cryptodev backend from the
8766 ``virtio-crypto`` device. The queues parameter is optional,
8767 which specify the queue number of cryptodev backend, the default
8768 of queues is 1.
8769
Peter Maydell09ce5f22020-02-28 15:36:13 +00008770 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008771
8772 # |qemu_system| \
8773 [...] \
8774 -object cryptodev-backend-builtin,id=cryptodev0 \
8775 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8776 [...]
8777
8778 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]``
8779 Creates a vhost-user cryptodev backend, backed by a chardev
8780 chardevid. The id parameter is a unique ID that will be used to
8781 reference this cryptodev backend from the ``virtio-crypto``
8782 device. The chardev should be a unix domain socket backed one.
8783 The vhost-user uses a specifically defined protocol to pass
8784 vhost ioctl replacement messages to an application on the other
8785 end of the socket. The queues parameter is optional, which
8786 specify the queue number of cryptodev backend for multiqueue
8787 vhost-user, the default of queues is 1.
8788
Peter Maydell09ce5f22020-02-28 15:36:13 +00008789 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008790
8791 # |qemu_system| \
8792 [...] \
8793 -chardev socket,id=chardev0,path=/path/to/socket \
8794 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8795 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8796 [...]
8797
8798 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00008799 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008800 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]``
8801 Defines a secret to store a password, encryption key, or some
8802 other sensitive data. The sensitive data can either be passed
8803 directly via the data parameter, or indirectly via the file
8804 parameter. Using the data parameter is insecure unless the
8805 sensitive data is encrypted.
8806
8807 The sensitive data can be provided in raw format (the default),
8808 or base64. When encoded as JSON, the raw format only supports
8809 valid UTF-8 characters, so base64 is recommended for sending
8810 binary data. QEMU will convert from which ever format is
8811 provided to the format it needs internally. eg, an RBD password
8812 can be provided in raw format, even though it will be base64
8813 encoded when passed onto the RBD sever.
8814
8815 For added protection, it is possible to encrypt the data
8816 associated with a secret using the AES-256-CBC cipher. Use of
8817 encryption is indicated by providing the keyid and iv
8818 parameters. The keyid parameter provides the ID of a previously
8819 defined secret that contains the AES-256 decryption key. This
8820 key should be 32-bytes long and be base64 encoded. The iv
8821 parameter provides the random initialization vector used for
8822 encryption of this particular secret and should be a base64
8823 encrypted string of the 16-byte IV.
8824
8825 The simplest (insecure) usage is to provide the secret inline
8826
Peter Maydell09ce5f22020-02-28 15:36:13 +00008827 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008828
8829 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw
8830
8831 The simplest secure usage is to provide the secret via a file
8832
8833 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object
8834 secret,id=sec0,file=mypasswd.txt,format=raw
8835
8836 For greater security, AES-256-CBC should be used. To illustrate
8837 usage, consider the openssl command line tool which can encrypt
8838 the data. Note that when encrypting, the plaintext must be
8839 padded to the cipher block size (32 bytes) using the standard
8840 PKCS#5/6 compatible padding algorithm.
8841
8842 First a master key needs to be created in base64 encoding:
8843
8844 ::
8845
8846 # openssl rand -base64 32 > key.b64
8847 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8848
8849 Each secret to be encrypted needs to have a random
8850 initialization vector generated. These do not need to be kept
8851 secret
8852
8853 ::
8854
8855 # openssl rand -base64 16 > iv.b64
8856 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8857
8858 The secret to be defined can now be encrypted, in this case
8859 we're telling openssl to base64 encode the result, but it could
8860 be left as raw bytes if desired.
8861
8862 ::
8863
8864 # SECRET=$(printf "letmein" |
8865 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8866
8867 When launching QEMU, create a master secret pointing to
8868 ``key.b64`` and specify that to be used to decrypt the user
8869 password. Pass the contents of ``iv.b64`` to the second secret
8870
Peter Maydell09ce5f22020-02-28 15:36:13 +00008871 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008872
8873 # |qemu_system| \
8874 -object secret,id=secmaster0,format=base64,file=key.b64 \
8875 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8876 data=$SECRET,iv=$(<iv.b64)
8877
8878 ``-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]``
8879 Create a Secure Encrypted Virtualization (SEV) guest object,
8880 which can be used to provide the guest memory encryption support
8881 on AMD processors.
8882
8883 When memory encryption is enabled, one of the physical address
8884 bit (aka the C-bit) is utilized to mark if a memory page is
8885 protected. The ``cbitpos`` is used to provide the C-bit
8886 position. The C-bit position is Host family dependent hence user
8887 must provide this value. On EPYC, the value should be 47.
8888
8889 When memory encryption is enabled, we loose certain bits in
8890 physical address space. The ``reduced-phys-bits`` is used to
8891 provide the number of bits we loose in physical address space.
8892 Similar to C-bit, the value is Host family dependent. On EPYC,
8893 the value should be 5.
8894
8895 The ``sev-device`` provides the device file to use for
8896 communicating with the SEV firmware running inside AMD Secure
8897 Processor. The default device is '/dev/sev'. If hardware
8898 supports memory encryption then /dev/sev devices are created by
8899 CCP driver.
8900
8901 The ``policy`` provides the guest policy to be enforced by the
8902 SEV firmware and restrict what configuration and operational
8903 commands can be performed on this guest by the hypervisor. The
8904 policy should be provided by the guest owner and is bound to the
8905 guest and cannot be changed throughout the lifetime of the
8906 guest. The default is 0.
8907
8908 If guest ``policy`` allows sharing the key with another SEV
8909 guest then ``handle`` can be use to provide handle of the guest
8910 from which to share the key.
8911
8912 The ``dh-cert-file`` and ``session-file`` provides the guest
8913 owner's Public Diffie-Hillman key defined in SEV spec. The PDH
8914 and session parameters are used for establishing a cryptographic
8915 session with the guest owner to negotiate keys used for
8916 attestation. The file must be encoded in base64.
8917
8918 e.g to launch a SEV guest
8919
Peter Maydell09ce5f22020-02-28 15:36:13 +00008920 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008921
8922 # |qemu_system_x86| \
8923 ......
8924 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8925 -machine ...,memory-encryption=sev0
8926 .....
8927
8928 ``-object authz-simple,id=id,identity=string``
8929 Create an authorization object that will control access to
8930 network services.
8931
8932 The ``identity`` parameter is identifies the user and its format
8933 depends on the network service that authorization object is
8934 associated with. For authorizing based on TLS x509 certificates,
8935 the identity must be the x509 distinguished name. Note that care
8936 must be taken to escape any commas in the distinguished name.
8937
8938 An example authorization object to validate a x509 distinguished
8939 name would look like:
8940
Peter Maydell09ce5f22020-02-28 15:36:13 +00008941 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008942
8943 # |qemu_system| \
8944 ...
8945 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8946 ...
8947
8948 Note the use of quotes due to the x509 distinguished name
8949 containing whitespace, and escaping of ','.
8950
8951 ``-object authz-listfile,id=id,filename=path,refresh=yes|no``
8952 Create an authorization object that will control access to
8953 network services.
8954
8955 The ``filename`` parameter is the fully qualified path to a file
8956 containing the access control list rules in JSON format.
8957
8958 An example set of rules that match against SASL usernames might
8959 look like:
8960
8961 ::
8962
8963 {
8964 "rules": [
8965 { "match": "fred", "policy": "allow", "format": "exact" },
8966 { "match": "bob", "policy": "allow", "format": "exact" },
8967 { "match": "danb", "policy": "deny", "format": "glob" },
8968 { "match": "dan*", "policy": "allow", "format": "exact" },
8969 ],
8970 "policy": "deny"
8971 }
8972
8973 When checking access the object will iterate over all the rules
8974 and the first rule to match will have its ``policy`` value
8975 returned as the result. If no rules match, then the default
8976 ``policy`` value is returned.
8977
8978 The rules can either be an exact string match, or they can use
8979 the simple UNIX glob pattern matching to allow wildcards to be
8980 used.
8981
8982 If ``refresh`` is set to true the file will be monitored and
8983 automatically reloaded whenever its content changes.
8984
8985 As with the ``authz-simple`` object, the format of the identity
8986 strings being matched depends on the network service, but is
8987 usually a TLS x509 distinguished name, or a SASL username.
8988
8989 An example authorization object to validate a SASL username
8990 would look like:
8991
Peter Maydell09ce5f22020-02-28 15:36:13 +00008992 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008993
8994 # |qemu_system| \
8995 ...
8996 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8997 ...
8998
8999 ``-object authz-pam,id=id,service=string``
9000 Create an authorization object that will control access to
9001 network services.
9002
9003 The ``service`` parameter provides the name of a PAM service to
9004 use for authorization. It requires that a file
9005 ``/etc/pam.d/service`` exist to provide the configuration for
9006 the ``account`` subsystem.
9007
9008 An example authorization object to validate a TLS x509
9009 distinguished name would look like:
9010
Peter Maydell09ce5f22020-02-28 15:36:13 +00009011 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00009012
9013 # |qemu_system| \
9014 ...
9015 -object authz-pam,id=auth0,service=qemu-vnc
9016 ...
9017
9018 There would then be a corresponding config file for PAM at
9019 ``/etc/pam.d/qemu-vnc`` that contains:
9020
9021 ::
9022
9023 account requisite pam_listfile.so item=user sense=allow \
9024 file=/etc/qemu/vnc.allow
9025
9026 Finally the ``/etc/qemu/vnc.allow`` file would contain the list
9027 of x509 distingished names that are permitted access
9028
9029 ::
9030
9031 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
9032
9033 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink``
9034 Creates a dedicated event loop thread that devices can be
9035 assigned to. This is known as an IOThread. By default device
9036 emulation happens in vCPU threads or the main event loop thread.
9037 This can become a scalability bottleneck. IOThreads allow device
9038 emulation and I/O to run on other host CPUs.
9039
9040 The ``id`` parameter is a unique ID that will be used to
9041 reference this IOThread from ``-device ...,iothread=id``.
9042 Multiple devices can be assigned to an IOThread. Note that not
9043 all devices support an ``iothread`` parameter.
9044
9045 The ``query-iothreads`` QMP command lists IOThreads and reports
9046 their thread IDs so that the user can configure host CPU
9047 pinning/affinity.
9048
9049 IOThreads use an adaptive polling algorithm to reduce event loop
9050 latency. Instead of entering a blocking system call to monitor
9051 file descriptors and then pay the cost of being woken up when an
9052 event occurs, the polling algorithm spins waiting for events for
9053 a short time. The algorithm's default parameters are suitable
9054 for many cases but can be adjusted based on knowledge of the
9055 workload and/or host device latency.
9056
9057 The ``poll-max-ns`` parameter is the maximum number of
9058 nanoseconds to busy wait for events. Polling can be disabled by
9059 setting this value to 0.
9060
9061 The ``poll-grow`` parameter is the multiplier used to increase
9062 the polling time when the algorithm detects it is missing events
9063 due to not polling long enough.
9064
9065 The ``poll-shrink`` parameter is the divisor used to decrease
9066 the polling time when the algorithm detects it is spending too
9067 long polling without encountering events.
9068
9069 The polling parameters can be modified at run-time using the
9070 ``qom-set`` command (where ``iothread1`` is the IOThread's
9071 ``id``):
9072
9073 ::
9074
9075 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
9076ERST
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01009077
9078
Stefan Weil3dbf2c72010-01-16 18:19:44 +01009079HXCOMM This is the last statement. Insert new options before this line!
9080STEXI
9081@end table
9082ETEXI