blob: 37b5c75cf2e91dbbd5fdde2f83e9d0e18ff5020c [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
451``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``; \ ``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``; \ ``-numa dist,src=source,dst=destination,val=distance``; \ ``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]``; \ ``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=tpye[,latency=lat][,bandwidth=bw]``; \ ``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]``
452 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA
453 distance from a source node to a destination node. Set the ACPI
454 Heterogeneous Memory Attributes for the given nodes.
455
456 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and
457 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a
458 contiguous range of CPU indexes (or a single VCPU if lastcpu is
459 omitted). A non-contiguous set of VCPUs can be represented by
460 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is
461 omitted on all nodes, VCPUs are automatically split between them.
462
463 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a
464 NUMA node:
465
466 ::
467
468 -numa node,cpus=0-2,cpus=5
469
470 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option
471 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to
472 assign CPU objects to a node using topology layout properties of
473 CPU. The set of properties is machine specific, and depends on used
474 machine type/'\ ``smp``\ ' options. It could be queried with
475 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ '
476 property specifies node to which CPU object will be assigned, it's
477 required for node to be declared with '\ ``node``\ ' option before
478 it's used with '\ ``cpu``\ ' option.
479
480 For example:
481
482 ::
483
484 -M pc \
485 -smp 1,sockets=2,maxcpus=2 \
486 -numa node,nodeid=0 -numa node,nodeid=1 \
487 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
488
489 '\ ``mem``\ ' assigns a given RAM amount to a node. '\ ``memdev``\ '
490 assigns RAM from a given memory backend device to a node. If
491 '\ ``mem``\ ' and '\ ``memdev``\ ' are omitted in all nodes, RAM is
492 split equally between them.
493
494 '\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive.
495 Furthermore, if one node uses '\ ``memdev``\ ', all of them have to
496 use it.
497
498 '\ ``initiator``\ ' is an additional option that points to an
499 initiator NUMA node that has best performance (the lowest latency or
500 largest bandwidth) to this NUMA node. Note that this option can be
501 set only when the machine property 'hmat' is set to 'on'.
502
503 Following example creates a machine with 2 NUMA nodes, node 0 has
504 CPU. node 1 has only memory, and its initiator is node 0. Note that
505 because node 0 has CPU, by default the initiator of node 0 is itself
506 and must be itself.
507
508 ::
509
510 -machine hmat=on \
511 -m 2G,slots=2,maxmem=4G \
512 -object memory-backend-ram,size=1G,id=m0 \
513 -object memory-backend-ram,size=1G,id=m1 \
514 -numa node,nodeid=0,memdev=m0 \
515 -numa node,nodeid=1,memdev=m1,initiator=0 \
516 -smp 2,sockets=2,maxcpus=2 \
517 -numa cpu,node-id=0,socket-id=0 \
518 -numa cpu,node-id=0,socket-id=1
519
520 source and destination are NUMA node IDs. distance is the NUMA
521 distance from source to destination. The distance from a node to
522 itself is always 10. If any pair of nodes is given a distance, then
523 all pairs must be given distances. Although, when distances are only
524 given in one direction for each pair of nodes, then the distances in
525 the opposite directions are assumed to be the same. If, however, an
526 asymmetrical pair of distances is given for even one node pair, then
527 all node pairs must be provided distance values for both directions,
528 even when they are symmetrical. When a node is unreachable from
529 another node, set the pair's distance to 255.
530
531 Note that the -``numa`` option doesn't allocate any of the specified
532 resources, it just assigns existing resources to NUMA nodes. This
533 means that one still has to use the ``-m``, ``-smp`` options to
534 allocate RAM and VCPUs respectively.
535
536 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth
537 Information between initiator and target NUMA nodes in ACPI
538 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can
539 create memory requests, usually it has one or more processors.
540 Target NUMA node contains addressable memory.
541
542 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is
543 the memory hierarchy of the target NUMA node: if hierarchy is
544 'memory', the structure represents the memory performance; if
545 hierarchy is 'first-level\|second-level\|third-level', this
546 structure represents aggregated performance of memory side caches
547 for each domain. type of 'data-type' is type of data represented by
548 this structure instance: if 'hierarchy' is 'memory', 'data-type' is
549 'access\|read\|write' latency or 'access\|read\|write' bandwidth of
550 the target memory; if 'hierarchy' is
551 'first-level\|second-level\|third-level', 'data-type' is
552 'access\|read\|write' hit latency or 'access\|read\|write' hit
553 bandwidth of the target memory side cache.
554
555 lat is latency value in nanoseconds. bw is bandwidth value, the
556 possible value and units are NUM[M\|G\|T], mean that the bandwidth
557 value are NUM byte per second (or MB/s, GB/s or TB/s depending on
558 used suffix). Note that if latency or bandwidth value is 0, means
559 the corresponding latency or bandwidth information is not provided.
560
561 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory
562 belongs. size is the size of memory side cache in bytes. level is
563 the cache level described in this structure, note that the cache
564 level 0 should not be used with '\ ``hmat-cache``\ ' option.
565 associativity is the cache associativity, the possible value is
566 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy
567 is the write policy. line is the cache Line size in bytes.
568
569 For example, the following options describe 2 NUMA nodes. Node 0 has
570 2 cpus and a ram, node 1 has only a ram. The processors in node 0
571 access memory in node 0 with access-latency 5 nanoseconds,
572 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access
573 memory in NUMA node 1 with access-latency 10 nanoseconds,
574 access-bandwidth is 100 MB/s. And for memory side cache information,
575 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB,
576 policy is write-back, the cache Line size is 8 bytes:
577
578 ::
579
580 -machine hmat=on \
581 -m 2G \
582 -object memory-backend-ram,size=1G,id=m0 \
583 -object memory-backend-ram,size=1G,id=m1 \
584 -smp 2 \
585 -numa node,nodeid=0,memdev=m0 \
586 -numa node,nodeid=1,memdev=m1,initiator=0 \
587 -numa cpu,node-id=0,socket-id=0 \
588 -numa cpu,node-id=0,socket-id=1 \
589 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
590 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
591 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
592 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
593 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
594 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
595ERST
aliguori268a3622009-04-21 22:30:27 +0000596
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100597DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd,
598 "-add-fd fd=fd,set=set[,opaque=opaque]\n"
599 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL)
600STEXI
601@item -add-fd fd=@var{fd},set=@var{set}[,opaque=@var{opaque}]
602@findex -add-fd
603
604Add a file descriptor to an fd set. Valid options are:
605
606@table @option
607@item fd=@var{fd}
608This option defines the file descriptor of which a duplicate is added to fd set.
609The file descriptor cannot be stdin, stdout, or stderr.
610@item set=@var{set}
611This option defines the ID of the fd set to add the file descriptor to.
612@item opaque=@var{opaque}
613This option defines a free-form string that can be used to describe @var{fd}.
614@end table
615
616You can open an image using pre-opened file descriptors from an fd set:
617@example
Thomas Huth664785a2019-07-30 17:08:26 +0200618@value{qemu_system} \
619 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
620 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
621 -drive file=/dev/fdset/2,index=0,media=disk
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100622@end example
623ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000624SRST
625``-add-fd fd=fd,set=set[,opaque=opaque]``
626 Add a file descriptor to an fd set. Valid options are:
627
628 ``fd=fd``
629 This option defines the file descriptor of which a duplicate is
630 added to fd set. The file descriptor cannot be stdin, stdout, or
631 stderr.
632
633 ``set=set``
634 This option defines the ID of the fd set to add the file
635 descriptor to.
636
637 ``opaque=opaque``
638 This option defines a free-form string that can be used to
639 describe fd.
640
641 You can open an image using pre-opened file descriptors from an fd
642 set:
643
644 .. parsed-literal::
645
646 |qemu_system| \
647 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
648 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
649 -drive file=/dev/fdset/2,index=0,media=disk
650ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100651
652DEF("set", HAS_ARG, QEMU_OPTION_set,
653 "-set group.id.arg=value\n"
654 " set <arg> parameter for item <id> of type <group>\n"
655 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL)
656STEXI
657@item -set @var{group}.@var{id}.@var{arg}=@var{value}
658@findex -set
Michael Tokareve1f3b972016-10-16 17:21:37 +0300659Set parameter @var{arg} for item @var{id} of type @var{group}
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100660ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000661SRST
662``-set group.id.arg=value``
663 Set parameter arg for item id of type group
664ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100665
666DEF("global", HAS_ARG, QEMU_OPTION_global,
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200667 "-global driver.property=value\n"
668 "-global driver=driver,property=property,value=value\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100669 " set a global default for a driver property\n",
670 QEMU_ARCH_ALL)
671STEXI
672@item -global @var{driver}.@var{prop}=@var{value}
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200673@itemx -global driver=@var{driver},property=@var{property},value=@var{value}
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100674@findex -global
675Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.:
676
677@example
Thomas Huth664785a2019-07-30 17:08:26 +0200678@value{qemu_system_x86} -global ide-hd.physical_block_size=4096 disk-image.img
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100679@end example
680
Michael Tokareva295d242017-09-23 19:31:59 +0300681In particular, you can use this to set driver properties for devices which are
682created automatically by the machine model. To create a device which is not
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100683created automatically and set properties on it, use -@option{device}.
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200684
Markus Armbrusterae08fd52015-06-15 14:35:58 +0200685-global @var{driver}.@var{prop}=@var{value} is shorthand for -global
686driver=@var{driver},property=@var{prop},value=@var{value}. The
687longhand syntax works even when @var{driver} contains a dot.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100688ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000689SRST
690``-global driver.prop=value``; \ ``-global driver=driver,property=property,value=value``
691 Set default value of driver's property prop to value, e.g.:
692
693 .. parsed-literal::
694
695 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img
696
697 In particular, you can use this to set driver properties for devices
698 which are created automatically by the machine model. To create a
699 device which is not created automatically and set properties on it,
700 use -``device``.
701
702 -global driver.prop=value is shorthand for -global
703 driver=driver,property=prop,value=value. The longhand syntax works
704 even when driver contains a dot.
705ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100706
707DEF("boot", HAS_ARG, QEMU_OPTION_boot,
708 "-boot [order=drives][,once=drives][,menu=on|off]\n"
Amos Kongc8a6ae82013-03-19 14:23:27 +0800709 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100710 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n"
711 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n"
712 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n"
713 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n",
714 QEMU_ARCH_ALL)
715STEXI
Amos Kongc8a6ae82013-03-19 14:23:27 +0800716@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 +0100717@findex -boot
718Specify boot order @var{drives} as a string of drive letters. Valid
Gongleid274e072015-07-03 17:50:57 +0800719drive letters depend on the target architecture. The x86 PC uses: a, b
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100720(floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot
721from network adapter 1-4), hard disk boot is the default. To apply a
722particular boot order only on the first startup, specify it via
Thomas Huthc0d9f7d2017-02-28 18:40:01 +0100723@option{once}. Note that the @option{order} or @option{once} parameter
724should not be used together with the @option{bootindex} property of
725devices, since the firmware implementations normally do not support both
726at the same time.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100727
728Interactive boot menus/prompts can be enabled via @option{menu=on} as far
729as firmware/BIOS supports them. The default is non-interactive boot.
730
731A splash picture could be passed to bios, enabling user to show it as logo,
732when option splash=@var{sp_name} is given and menu=on, If firmware/BIOS
733supports them. Currently Seabios for X86 system support it.
734limitation: The splash file could be a jpeg file or a BMP file in 24 BPP
735format(true color). The resolution should be supported by the SVGA mode, so
736the recommended is 320x240, 640x480, 800x640.
737
738A timeout could be passed to bios, guest will pause for @var{rb_timeout} ms
Han Han8937a392019-12-05 10:48:21 +0800739when boot failed, then reboot. If @var{rb_timeout} is '-1', guest will not
740reboot, qemu passes '-1' to bios by default. Currently Seabios for X86
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100741system support it.
742
Amos Kongc8a6ae82013-03-19 14:23:27 +0800743Do strict boot via @option{strict=on} as far as firmware/BIOS
744supports it. This only effects when boot priority is changed by
745bootindex options. The default is non-strict boot.
746
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100747@example
748# try to boot from network first, then from hard disk
Thomas Huth664785a2019-07-30 17:08:26 +0200749@value{qemu_system_x86} -boot order=nc
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100750# boot from CD-ROM first, switch back to default order after reboot
Thomas Huth664785a2019-07-30 17:08:26 +0200751@value{qemu_system_x86} -boot once=d
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100752# boot with a splash picture for 5 seconds.
Thomas Huth664785a2019-07-30 17:08:26 +0200753@value{qemu_system_x86} -boot menu=on,splash=/root/boot.bmp,splash-time=5000
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100754@end example
755
756Note: The legacy format '-boot @var{drives}' is still supported but its
757use is discouraged as it may be removed from future versions.
758ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000759SRST
760``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]``
761 Specify boot order drives as a string of drive letters. Valid drive
762 letters depend on the target architecture. The x86 PC uses: a, b
763 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p
764 (Etherboot from network adapter 1-4), hard disk boot is the default.
765 To apply a particular boot order only on the first startup, specify
766 it via ``once``. Note that the ``order`` or ``once`` parameter
767 should not be used together with the ``bootindex`` property of
768 devices, since the firmware implementations normally do not support
769 both at the same time.
770
771 Interactive boot menus/prompts can be enabled via ``menu=on`` as far
772 as firmware/BIOS supports them. The default is non-interactive boot.
773
774 A splash picture could be passed to bios, enabling user to show it
775 as logo, when option splash=sp\_name is given and menu=on, If
776 firmware/BIOS supports them. Currently Seabios for X86 system
777 support it. limitation: The splash file could be a jpeg file or a
778 BMP file in 24 BPP format(true color). The resolution should be
779 supported by the SVGA mode, so the recommended is 320x240, 640x480,
780 800x640.
781
782 A timeout could be passed to bios, guest will pause for rb\_timeout
783 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will
784 not reboot, qemu passes '-1' to bios by default. Currently Seabios
785 for X86 system support it.
786
787 Do strict boot via ``strict=on`` as far as firmware/BIOS supports
788 it. This only effects when boot priority is changed by bootindex
789 options. The default is non-strict boot.
790
791 ::
792
793 # try to boot from network first, then from hard disk
794 |qemu_system_x86| -boot order=nc
795 # boot from CD-ROM first, switch back to default order after reboot
796 |qemu_system_x86| -boot once=d
797 # boot with a splash picture for 5 seconds.
798 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000
799
800 Note: The legacy format '-boot drives' is still supported but its
801 use is discouraged as it may be removed from future versions.
802ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100803
804DEF("m", HAS_ARG, QEMU_OPTION_m,
Michael Tokarev89f3ea22016-11-10 17:51:32 +0300805 "-m [size=]megs[,slots=n,maxmem=size]\n"
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100806 " configure guest RAM\n"
Alexander Graf0daba1f2015-06-05 11:05:03 +0200807 " size: initial amount of guest memory\n"
Igor Mammedovc270fb92014-06-02 15:25:02 +0200808 " slots: number of hotplug slots (default: none)\n"
Matthew Rosatob6fe0122014-08-28 11:25:33 -0400809 " maxmem: maximum amount of guest memory (default: none)\n"
810 "NOTE: Some architectures might enforce a specific granularity\n",
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100811 QEMU_ARCH_ALL)
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100812STEXI
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500813@item -m [size=]@var{megs}[,slots=n,maxmem=size]
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100814@findex -m
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500815Sets guest startup RAM size to @var{megs} megabytes. Default is 128 MiB.
816Optionally, a suffix of ``M'' or ``G'' can be used to signify a value in
817megabytes or gigabytes respectively. Optional pair @var{slots}, @var{maxmem}
818could be used to set amount of hotpluggable memory slots and maximum amount of
819memory. Note that @var{maxmem} must be aligned to the page size.
820
821For example, the following command-line sets the guest startup RAM size to
8221GB, creates 3 slots to hotplug additional memory and sets the maximum
823memory the guest can reach to 4GB:
824
825@example
Thomas Huth664785a2019-07-30 17:08:26 +0200826@value{qemu_system} -m 1G,slots=3,maxmem=4G
Luiz Capitulino9fcc0792015-02-26 14:35:45 -0500827@end example
828
829If @var{slots} and @var{maxmem} are not specified, memory hotplug won't
830be enabled and the guest startup RAM will never increase.
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100831ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000832SRST
833``-m [size=]megs[,slots=n,maxmem=size]``
834 Sets guest startup RAM size to megs megabytes. Default is 128 MiB.
835 Optionally, a suffix of "M" or "G" can be used to signify a value in
836 megabytes or gigabytes respectively. Optional pair slots, maxmem
837 could be used to set amount of hotpluggable memory slots and maximum
838 amount of memory. Note that maxmem must be aligned to the page size.
839
840 For example, the following command-line sets the guest startup RAM
841 size to 1GB, creates 3 slots to hotplug additional memory and sets
842 the maximum memory the guest can reach to 4GB:
843
844 .. parsed-literal::
845
846 |qemu_system| -m 1G,slots=3,maxmem=4G
847
848 If slots and maxmem are not specified, memory hotplug won't be
849 enabled and the guest startup RAM will never increase.
850ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100851
852DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
853 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
854STEXI
855@item -mem-path @var{path}
856@findex -mem-path
857Allocate guest RAM from a temporarily created file in @var{path}.
858ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000859SRST
860``-mem-path path``
861 Allocate guest RAM from a temporarily created file in path.
862ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100863
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100864DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
865 "-mem-prealloc preallocate guest memory (use with -mem-path)\n",
866 QEMU_ARCH_ALL)
867STEXI
868@item -mem-prealloc
869@findex -mem-prealloc
870Preallocate memory when using -mem-path.
871ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000872SRST
873``-mem-prealloc``
874 Preallocate memory when using -mem-path.
875ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100876
877DEF("k", HAS_ARG, QEMU_OPTION_k,
878 "-k language use keyboard layout (for example 'fr' for French)\n",
879 QEMU_ARCH_ALL)
880STEXI
881@item -k @var{language}
882@findex -k
883Use keyboard layout @var{language} (for example @code{fr} for
884French). This option is only needed where it is not easy to get raw PC
Samuel Thibault32945472016-06-22 17:48:31 +0200885keycodes (e.g. on Macs, with some X11 servers or with a VNC or curses
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100886display). You don't normally need to use it on PC/Linux or PC/Windows
887hosts.
888
889The available layouts are:
890@example
891ar de-ch es fo fr-ca hu ja mk no pt-br sv
892da en-gb et fr fr-ch is lt nl pl ru th
893de en-us fi fr-be hr it lv nl-be pt sl tr
894@end example
895
896The default is @code{en-us}.
897ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000898SRST
899``-k language``
900 Use keyboard layout language (for example ``fr`` for French). This
901 option is only needed where it is not easy to get raw PC keycodes
902 (e.g. on Macs, with some X11 servers or with a VNC or curses
903 display). You don't normally need to use it on PC/Linux or
904 PC/Windows hosts.
905
906 The available layouts are:
907
908 ::
909
910 ar de-ch es fo fr-ca hu ja mk no pt-br sv
911 da en-gb et fr fr-ch is lt nl pl ru th
912 de en-us fi fr-be hr it lv nl-be pt sl tr
913
914 The default is ``en-us``.
915ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100916
917
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100918HXCOMM Deprecated by -audiodev
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100919DEF("audio-help", 0, QEMU_OPTION_audio_help,
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100920 "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100921 QEMU_ARCH_ALL)
922STEXI
923@item -audio-help
924@findex -audio-help
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100925Will show the -audiodev equivalent of the currently specified
926(deprecated) environment variables.
927ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000928SRST
929``-audio-help``
930 Will show the -audiodev equivalent of the currently specified
931 (deprecated) environment variables.
932ERST
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100933
934DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
935 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
936 " specifies the audio backend to use\n"
937 " id= identifier of the backend\n"
938 " timer-period= timer period in microseconds\n"
Kővágó, Zoltán8efac072019-10-13 21:57:58 +0200939 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100940 " in|out.fixed-settings= use fixed settings for host audio\n"
941 " in|out.frequency= frequency to use with fixed settings\n"
942 " in|out.channels= number of channels to use with fixed settings\n"
943 " in|out.format= sample format to use with fixed settings\n"
944 " valid values: s8, s16, s32, u8, u16, u32\n"
945 " in|out.voices= number of voices to use\n"
Stefan Hajnoczi86247252019-09-18 10:53:33 +0100946 " in|out.buffer-length= length of buffer in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100947 "-audiodev none,id=id,[,prop[=value][,...]]\n"
948 " dummy driver that discards all output\n"
949#ifdef CONFIG_AUDIO_ALSA
950 "-audiodev alsa,id=id[,prop[=value][,...]]\n"
951 " in|out.dev= name of the audio device to use\n"
Stefan Hajnoczidfc54342019-09-18 10:53:35 +0100952 " in|out.period-length= length of period in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100953 " in|out.try-poll= attempt to use poll mode\n"
954 " threshold= threshold (in microseconds) when playback starts\n"
955#endif
956#ifdef CONFIG_AUDIO_COREAUDIO
957 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
958 " in|out.buffer-count= number of buffers\n"
959#endif
960#ifdef CONFIG_AUDIO_DSOUND
961 "-audiodev dsound,id=id[,prop[=value][,...]]\n"
962 " latency= add extra latency to playback in microseconds\n"
963#endif
964#ifdef CONFIG_AUDIO_OSS
965 "-audiodev oss,id=id[,prop[=value][,...]]\n"
966 " in|out.dev= path of the audio device to use\n"
967 " in|out.buffer-count= number of buffers\n"
968 " in|out.try-poll= attempt to use poll mode\n"
969 " try-mmap= try using memory mapped access\n"
970 " exclusive= open device in exclusive mode\n"
971 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
972#endif
973#ifdef CONFIG_AUDIO_PA
974 "-audiodev pa,id=id[,prop[=value][,...]]\n"
975 " server= PulseAudio server address\n"
976 " in|out.name= source/sink device name\n"
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +0100977 " in|out.latency= desired latency in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100978#endif
979#ifdef CONFIG_AUDIO_SDL
980 "-audiodev sdl,id=id[,prop[=value][,...]]\n"
981#endif
982#ifdef CONFIG_SPICE
983 "-audiodev spice,id=id[,prop[=value][,...]]\n"
984#endif
985 "-audiodev wav,id=id[,prop[=value][,...]]\n"
986 " path= path of wav file to record\n",
987 QEMU_ARCH_ALL)
988STEXI
989@item -audiodev [driver=]@var{driver},id=@var{id}[,@var{prop}[=@var{value}][,...]]
990@findex -audiodev
991Adds a new audio backend @var{driver} identified by @var{id}. There are
992global and driver specific properties. Some values can be set
993differently for input and output, they're marked with @code{in|out.}.
994You can set the input's property with @code{in.@var{prop}} and the
995output's property with @code{out.@var{prop}}. For example:
996@example
997-audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
998-audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
999@end example
1000
Kővágó, Zoltán8efac072019-10-13 21:57:58 +02001001NOTE: parameter validation is known to be incomplete, in many cases
1002specifying an invalid option causes QEMU to print an error message and
1003continue emulation without sound.
1004
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001005Valid global options are:
1006
1007@table @option
1008@item id=@var{identifier}
1009Identifies the audio backend.
1010
1011@item timer-period=@var{period}
1012Sets the timer @var{period} used by the audio subsystem in microseconds.
1013Default is 10000 (10 ms).
1014
Kővágó, Zoltán8efac072019-10-13 21:57:58 +02001015@item in|out.mixing-engine=on|off
1016Use QEMU's mixing engine to mix all streams inside QEMU and convert
1017audio formats when not supported by the backend. When off,
1018@var{fixed-settings} must be off too. Note that disabling this option
1019means that the selected backend must support multiple streams and the
1020audio formats used by the virtual cards, otherwise you'll get no sound.
1021It's not recommended to disable this option unless you want to use 5.1
1022or 7.1 audio, as mixing engine only supports mono and stereo audio.
1023Default is on.
1024
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001025@item in|out.fixed-settings=on|off
1026Use fixed settings for host audio. When off, it will change based on
1027how the guest opens the sound card. In this case you must not specify
1028@var{frequency}, @var{channels} or @var{format}. Default is on.
1029
1030@item in|out.frequency=@var{frequency}
1031Specify the @var{frequency} to use when using @var{fixed-settings}.
1032Default is 44100Hz.
1033
1034@item in|out.channels=@var{channels}
1035Specify the number of @var{channels} to use when using
1036@var{fixed-settings}. Default is 2 (stereo).
1037
1038@item in|out.format=@var{format}
1039Specify the sample @var{format} to use when using @var{fixed-settings}.
1040Valid values are: @code{s8}, @code{s16}, @code{s32}, @code{u8},
1041@code{u16}, @code{u32}. Default is @code{s16}.
1042
1043@item in|out.voices=@var{voices}
1044Specify the number of @var{voices} to use. Default is 1.
1045
Stefan Hajnoczi86247252019-09-18 10:53:33 +01001046@item in|out.buffer-length=@var{usecs}
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001047Sets the size of the buffer in microseconds.
1048
1049@end table
1050
1051@item -audiodev none,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1052Creates a dummy backend that discards all outputs. This backend has no
1053backend specific properties.
1054
1055@item -audiodev alsa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1056Creates backend using the ALSA. This backend is only available on
1057Linux.
1058
1059ALSA specific options are:
1060
1061@table @option
1062
1063@item in|out.dev=@var{device}
1064Specify the ALSA @var{device} to use for input and/or output. Default
1065is @code{default}.
1066
Stefan Hajnoczidfc54342019-09-18 10:53:35 +01001067@item in|out.period-length=@var{usecs}
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001068Sets the period length in microseconds.
1069
1070@item in|out.try-poll=on|off
1071Attempt to use poll mode with the device. Default is on.
1072
1073@item threshold=@var{threshold}
1074Threshold (in microseconds) when playback starts. Default is 0.
1075
1076@end table
1077
1078@item -audiodev coreaudio,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1079Creates a backend using Apple's Core Audio. This backend is only
1080available on Mac OS and only supports playback.
1081
1082Core Audio specific options are:
1083
1084@table @option
1085
1086@item in|out.buffer-count=@var{count}
1087Sets the @var{count} of the buffers.
1088
1089@end table
1090
1091@item -audiodev dsound,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1092Creates a backend using Microsoft's DirectSound. This backend is only
1093available on Windows and only supports playback.
1094
1095DirectSound specific options are:
1096
1097@table @option
1098
1099@item latency=@var{usecs}
1100Add extra @var{usecs} microseconds latency to playback. Default is
110110000 (10 ms).
1102
1103@end table
1104
1105@item -audiodev oss,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1106Creates a backend using OSS. This backend is available on most
1107Unix-like systems.
1108
1109OSS specific options are:
1110
1111@table @option
1112
1113@item in|out.dev=@var{device}
1114Specify the file name of the OSS @var{device} to use. Default is
1115@code{/dev/dsp}.
1116
1117@item in|out.buffer-count=@var{count}
1118Sets the @var{count} of the buffers.
1119
1120@item in|out.try-poll=on|of
1121Attempt to use poll mode with the device. Default is on.
1122
1123@item try-mmap=on|off
1124Try using memory mapped device access. Default is off.
1125
1126@item exclusive=on|off
1127Open the device in exclusive mode (vmix won't work in this case).
1128Default is off.
1129
1130@item dsp-policy=@var{policy}
1131Sets the timing policy (between 0 and 10, where smaller number means
1132smaller latency but higher CPU usage). Use -1 to use buffer sizes
1133specified by @code{buffer} and @code{buffer-count}. This option is
1134ignored if you do not have OSS 4. Default is 5.
1135
1136@end table
1137
1138@item -audiodev pa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1139Creates a backend using PulseAudio. This backend is available on most
1140systems.
1141
1142PulseAudio specific options are:
1143
1144@table @option
1145
1146@item server=@var{server}
1147Sets the PulseAudio @var{server} to connect to.
1148
1149@item in|out.name=@var{sink}
1150Use the specified source/sink for recording/playback.
1151
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +01001152@item in|out.latency=@var{usecs}
1153Desired latency in microseconds. The PulseAudio server will try to honor this
1154value but actual latencies may be lower or higher.
1155
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +01001156@end table
1157
1158@item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1159Creates a backend using SDL. This backend is available on most systems,
1160but you should use your platform's native backend if possible. This
1161backend has no backend specific properties.
1162
1163@item -audiodev spice,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1164Creates a backend that sends audio through SPICE. This backend requires
1165@code{-spice} and automatically selected in that case, so usually you
1166can ignore this option. This backend has no backend specific
1167properties.
1168
1169@item -audiodev wav,id=@var{id}[,@var{prop}[=@var{value}][,...]]
1170Creates a backend that writes audio to a WAV file.
1171
1172Backend specific options are:
1173
1174@table @option
1175
1176@item path=@var{path}
1177Write recorded audio into the specified file. Default is
1178@code{qemu.wav}.
1179
1180@end table
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001181ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001182SRST
1183``-audiodev [driver=]driver,id=id[,prop[=value][,...]]``
1184 Adds a new audio backend driver identified by id. There are global
1185 and driver specific properties. Some values can be set differently
1186 for input and output, they're marked with ``in|out.``. You can set
1187 the input's property with ``in.prop`` and the output's property with
1188 ``out.prop``. For example:
1189
1190 ::
1191
1192 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
1193 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
1194
1195 NOTE: parameter validation is known to be incomplete, in many cases
1196 specifying an invalid option causes QEMU to print an error message
1197 and continue emulation without sound.
1198
1199 Valid global options are:
1200
1201 ``id=identifier``
1202 Identifies the audio backend.
1203
1204 ``timer-period=period``
1205 Sets the timer period used by the audio subsystem in
1206 microseconds. Default is 10000 (10 ms).
1207
1208 ``in|out.mixing-engine=on|off``
1209 Use QEMU's mixing engine to mix all streams inside QEMU and
1210 convert audio formats when not supported by the backend. When
1211 off, fixed-settings must be off too. Note that disabling this
1212 option means that the selected backend must support multiple
1213 streams and the audio formats used by the virtual cards,
1214 otherwise you'll get no sound. It's not recommended to disable
1215 this option unless you want to use 5.1 or 7.1 audio, as mixing
1216 engine only supports mono and stereo audio. Default is on.
1217
1218 ``in|out.fixed-settings=on|off``
1219 Use fixed settings for host audio. When off, it will change
1220 based on how the guest opens the sound card. In this case you
1221 must not specify frequency, channels or format. Default is on.
1222
1223 ``in|out.frequency=frequency``
1224 Specify the frequency to use when using fixed-settings. Default
1225 is 44100Hz.
1226
1227 ``in|out.channels=channels``
1228 Specify the number of channels to use when using fixed-settings.
1229 Default is 2 (stereo).
1230
1231 ``in|out.format=format``
1232 Specify the sample format to use when using fixed-settings.
1233 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``,
1234 ``u32``. Default is ``s16``.
1235
1236 ``in|out.voices=voices``
1237 Specify the number of voices to use. Default is 1.
1238
1239 ``in|out.buffer-length=usecs``
1240 Sets the size of the buffer in microseconds.
1241
1242``-audiodev none,id=id[,prop[=value][,...]]``
1243 Creates a dummy backend that discards all outputs. This backend has
1244 no backend specific properties.
1245
1246``-audiodev alsa,id=id[,prop[=value][,...]]``
1247 Creates backend using the ALSA. This backend is only available on
1248 Linux.
1249
1250 ALSA specific options are:
1251
1252 ``in|out.dev=device``
1253 Specify the ALSA device to use for input and/or output. Default
1254 is ``default``.
1255
1256 ``in|out.period-length=usecs``
1257 Sets the period length in microseconds.
1258
1259 ``in|out.try-poll=on|off``
1260 Attempt to use poll mode with the device. Default is on.
1261
1262 ``threshold=threshold``
1263 Threshold (in microseconds) when playback starts. Default is 0.
1264
1265``-audiodev coreaudio,id=id[,prop[=value][,...]]``
1266 Creates a backend using Apple's Core Audio. This backend is only
1267 available on Mac OS and only supports playback.
1268
1269 Core Audio specific options are:
1270
1271 ``in|out.buffer-count=count``
1272 Sets the count of the buffers.
1273
1274``-audiodev dsound,id=id[,prop[=value][,...]]``
1275 Creates a backend using Microsoft's DirectSound. This backend is
1276 only available on Windows and only supports playback.
1277
1278 DirectSound specific options are:
1279
1280 ``latency=usecs``
1281 Add extra usecs microseconds latency to playback. Default is
1282 10000 (10 ms).
1283
1284``-audiodev oss,id=id[,prop[=value][,...]]``
1285 Creates a backend using OSS. This backend is available on most
1286 Unix-like systems.
1287
1288 OSS specific options are:
1289
1290 ``in|out.dev=device``
1291 Specify the file name of the OSS device to use. Default is
1292 ``/dev/dsp``.
1293
1294 ``in|out.buffer-count=count``
1295 Sets the count of the buffers.
1296
1297 ``in|out.try-poll=on|of``
1298 Attempt to use poll mode with the device. Default is on.
1299
1300 ``try-mmap=on|off``
1301 Try using memory mapped device access. Default is off.
1302
1303 ``exclusive=on|off``
1304 Open the device in exclusive mode (vmix won't work in this
1305 case). Default is off.
1306
1307 ``dsp-policy=policy``
1308 Sets the timing policy (between 0 and 10, where smaller number
1309 means smaller latency but higher CPU usage). Use -1 to use
1310 buffer sizes specified by ``buffer`` and ``buffer-count``. This
1311 option is ignored if you do not have OSS 4. Default is 5.
1312
1313``-audiodev pa,id=id[,prop[=value][,...]]``
1314 Creates a backend using PulseAudio. This backend is available on
1315 most systems.
1316
1317 PulseAudio specific options are:
1318
1319 ``server=server``
1320 Sets the PulseAudio server to connect to.
1321
1322 ``in|out.name=sink``
1323 Use the specified source/sink for recording/playback.
1324
1325 ``in|out.latency=usecs``
1326 Desired latency in microseconds. The PulseAudio server will try
1327 to honor this value but actual latencies may be lower or higher.
1328
1329``-audiodev sdl,id=id[,prop[=value][,...]]``
1330 Creates a backend using SDL. This backend is available on most
1331 systems, but you should use your platform's native backend if
1332 possible. This backend has no backend specific properties.
1333
1334``-audiodev spice,id=id[,prop[=value][,...]]``
1335 Creates a backend that sends audio through SPICE. This backend
1336 requires ``-spice`` and automatically selected in that case, so
1337 usually you can ignore this option. This backend has no backend
1338 specific properties.
1339
1340``-audiodev wav,id=id[,prop[=value][,...]]``
1341 Creates a backend that writes audio to a WAV file.
1342
1343 Backend specific options are:
1344
1345 ``path=path``
1346 Write recorded audio into the specified file. Default is
1347 ``qemu.wav``.
1348ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001349
1350DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw,
1351 "-soundhw c1,... enable audio support\n"
1352 " and only specified sound cards (comma separated list)\n"
1353 " use '-soundhw help' to get the list of supported cards\n"
1354 " use '-soundhw all' to enable all of them\n", QEMU_ARCH_ALL)
1355STEXI
1356@item -soundhw @var{card1}[,@var{card2},...] or -soundhw all
1357@findex -soundhw
1358Enable audio and selected sound hardware. Use 'help' to print all
Thomas Huth664785a2019-07-30 17:08:26 +02001359available sound hardware. For example:
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001360
1361@example
Thomas Huth664785a2019-07-30 17:08:26 +02001362@value{qemu_system_x86} -soundhw sb16,adlib disk.img
1363@value{qemu_system_x86} -soundhw es1370 disk.img
1364@value{qemu_system_x86} -soundhw ac97 disk.img
1365@value{qemu_system_x86} -soundhw hda disk.img
1366@value{qemu_system_x86} -soundhw all disk.img
1367@value{qemu_system_x86} -soundhw help
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001368@end example
1369
1370Note that Linux's i810_audio OSS kernel (for AC97) module might
1371require manually specifying clocking.
1372
1373@example
1374modprobe i810_audio clocking=48000
1375@end example
1376ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001377SRST
1378``-soundhw card1[,card2,...] or -soundhw all``
1379 Enable audio and selected sound hardware. Use 'help' to print all
1380 available sound hardware. For example:
1381
1382 .. parsed-literal::
1383
1384 |qemu_system_x86| -soundhw sb16,adlib disk.img
1385 |qemu_system_x86| -soundhw es1370 disk.img
1386 |qemu_system_x86| -soundhw ac97 disk.img
1387 |qemu_system_x86| -soundhw hda disk.img
1388 |qemu_system_x86| -soundhw all disk.img
1389 |qemu_system_x86| -soundhw help
1390
1391 Note that Linux's i810\_audio OSS kernel (for AC97) module might
1392 require manually specifying clocking.
1393
1394 ::
1395
1396 modprobe i810_audio clocking=48000
1397ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001398
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001399DEF("device", HAS_ARG, QEMU_OPTION_device,
1400 "-device driver[,prop[=value][,...]]\n"
1401 " add device (based on driver)\n"
1402 " prop=value,... sets driver properties\n"
1403 " use '-device help' to print all possible drivers\n"
1404 " use '-device driver,help' to print all possible properties\n",
1405 QEMU_ARCH_ALL)
1406STEXI
1407@item -device @var{driver}[,@var{prop}[=@var{value}][,...]]
1408@findex -device
1409Add device @var{driver}. @var{prop}=@var{value} sets driver
1410properties. Valid properties depend on the driver. To get help on
1411possible drivers and properties, use @code{-device help} and
1412@code{-device @var{driver},help}.
Corey Minyardf8490452015-12-17 12:50:10 -06001413
1414Some drivers are:
Corey Minyard7b0cd782017-09-06 15:57:07 -05001415@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 -06001416
1417Add an IPMI BMC. This is a simulation of a hardware management
1418interface processor that normally sits on a system. It provides
1419a watchdog and the ability to reset and power control the system.
1420You need to connect this to an IPMI interface to make it useful
1421
1422The IPMI slave address to use for the BMC. The default is 0x20.
1423This address is the BMC's address on the I2C network of management
1424controllers. If you don't know what this means, it is safe to ignore
1425it.
1426
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001427@table @option
Corey Minyard7b0cd782017-09-06 15:57:07 -05001428@item id=@var{id}
1429The BMC id for interfaces to use this device.
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001430@item slave_addr=@var{val}
1431Define slave address to use for the BMC. The default is 0x20.
1432@item sdrfile=@var{file}
Cédric Le Goater540c07d2017-04-05 14:41:32 +02001433file containing raw Sensor Data Records (SDR) data. The default is none.
1434@item fruareasize=@var{val}
1435size of a Field Replaceable Unit (FRU) area. The default is 1024.
1436@item frudatafile=@var{file}
1437file containing raw Field Replaceable Unit (FRU) inventory data. The default is none.
Corey Minyard7b0cd782017-09-06 15:57:07 -05001438@item guid=@var{uuid}
1439value for the GUID for the BMC, in standard UUID format. If this is set,
1440get "Get GUID" command to the BMC will return it. Otherwise "Get GUID"
1441will return an error.
Cédric Le Goater8c6fd7f2017-04-05 14:41:31 +02001442@end table
1443
Corey Minyardf8490452015-12-17 12:50:10 -06001444@item -device ipmi-bmc-extern,id=@var{id},chardev=@var{id}[,slave_addr=@var{val}]
1445
1446Add a connection to an external IPMI BMC simulator. Instead of
1447locally emulating the BMC like the above item, instead connect
1448to an external entity that provides the IPMI services.
1449
1450A connection is made to an external BMC simulator. If you do this, it
1451is strongly recommended that you use the "reconnect=" chardev option
1452to reconnect to the simulator if the connection is lost. Note that if
1453this is not used carefully, it can be a security issue, as the
1454interface has the ability to send resets, NMIs, and power off the VM.
1455It's best if QEMU makes a connection to an external simulator running
1456on a secure port on localhost, so neither the simulator nor QEMU is
1457exposed to any outside network.
1458
1459See the "lanserv/README.vm" file in the OpenIPMI library for more
1460details on the external interface.
1461
1462@item -device isa-ipmi-kcs,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1463
1464Add a KCS IPMI interafce on the ISA bus. This also adds a
1465corresponding ACPI and SMBIOS entries, if appropriate.
1466
1467@table @option
1468@item bmc=@var{id}
1469The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above.
1470@item ioport=@var{val}
1471Define the I/O address of the interface. The default is 0xca0 for KCS.
1472@item irq=@var{val}
1473Define the interrupt to use. The default is 5. To disable interrupts,
1474set this to 0.
1475@end table
1476
1477@item -device isa-ipmi-bt,bmc=@var{id}[,ioport=@var{val}][,irq=@var{val}]
1478
1479Like the KCS interface, but defines a BT interface. The default port is
14800xe4 and the default interrupt is 5.
1481
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001482ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001483SRST
1484``-device driver[,prop[=value][,...]]``
1485 Add device driver. prop=value sets driver properties. Valid
1486 properties depend on the driver. To get help on possible drivers and
1487 properties, use ``-device help`` and ``-device driver,help``.
1488
1489 Some drivers are:
1490
1491``-device ipmi-bmc-sim,id=id[,slave_addr=val][,sdrfile=file][,furareasize=val][,furdatafile=file][,guid=uuid]``
1492 Add an IPMI BMC. This is a simulation of a hardware management
1493 interface processor that normally sits on a system. It provides a
1494 watchdog and the ability to reset and power control the system. You
1495 need to connect this to an IPMI interface to make it useful
1496
1497 The IPMI slave address to use for the BMC. The default is 0x20. This
1498 address is the BMC's address on the I2C network of management
1499 controllers. If you don't know what this means, it is safe to ignore
1500 it.
1501
1502 ``id=id``
1503 The BMC id for interfaces to use this device.
1504
1505 ``slave_addr=val``
1506 Define slave address to use for the BMC. The default is 0x20.
1507
1508 ``sdrfile=file``
1509 file containing raw Sensor Data Records (SDR) data. The default
1510 is none.
1511
1512 ``fruareasize=val``
1513 size of a Field Replaceable Unit (FRU) area. The default is
1514 1024.
1515
1516 ``frudatafile=file``
1517 file containing raw Field Replaceable Unit (FRU) inventory data.
1518 The default is none.
1519
1520 ``guid=uuid``
1521 value for the GUID for the BMC, in standard UUID format. If this
1522 is set, get "Get GUID" command to the BMC will return it.
1523 Otherwise "Get GUID" will return an error.
1524
1525``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]``
1526 Add a connection to an external IPMI BMC simulator. Instead of
1527 locally emulating the BMC like the above item, instead connect to an
1528 external entity that provides the IPMI services.
1529
1530 A connection is made to an external BMC simulator. If you do this,
1531 it is strongly recommended that you use the "reconnect=" chardev
1532 option to reconnect to the simulator if the connection is lost. Note
1533 that if this is not used carefully, it can be a security issue, as
1534 the interface has the ability to send resets, NMIs, and power off
1535 the VM. It's best if QEMU makes a connection to an external
1536 simulator running on a secure port on localhost, so neither the
1537 simulator nor QEMU is exposed to any outside network.
1538
1539 See the "lanserv/README.vm" file in the OpenIPMI library for more
1540 details on the external interface.
1541
1542``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]``
1543 Add a KCS IPMI interafce on the ISA bus. This also adds a
1544 corresponding ACPI and SMBIOS entries, if appropriate.
1545
1546 ``bmc=id``
1547 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern
1548 above.
1549
1550 ``ioport=val``
1551 Define the I/O address of the interface. The default is 0xca0
1552 for KCS.
1553
1554 ``irq=val``
1555 Define the interrupt to use. The default is 5. To disable
1556 interrupts, set this to 0.
1557
1558``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]``
1559 Like the KCS interface, but defines a BT interface. The default port
1560 is 0xe4 and the default interrupt is 5.
1561ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001562
1563DEF("name", HAS_ARG, QEMU_OPTION_name,
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001564 "-name string1[,process=string2][,debug-threads=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001565 " set the name of the guest\n"
Roman Bolshakov479a5742018-12-17 23:26:01 +03001566 " string1 sets the window title and string2 the process name\n"
1567 " When debug-threads is enabled, individual threads are given a separate name\n"
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001568 " NOTE: The thread names are for debugging and not a stable API.\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001569 QEMU_ARCH_ALL)
1570STEXI
1571@item -name @var{name}
1572@findex -name
1573Sets the @var{name} of the guest.
1574This name will be displayed in the SDL window caption.
1575The @var{name} will also be used for the VNC server.
1576Also optionally set the top visible process name in Linux.
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001577Naming of individual threads can also be enabled on Linux to aid debugging.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001578ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001579SRST
1580``-name name``
1581 Sets the name of the guest. This name will be displayed in the SDL
1582 window caption. The name will also be used for the VNC server. Also
1583 optionally set the top visible process name in Linux. Naming of
1584 individual threads can also be enabled on Linux to aid debugging.
1585ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001586
1587DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
1588 "-uuid %08x-%04x-%04x-%04x-%012x\n"
1589 " specify machine UUID\n", QEMU_ARCH_ALL)
1590STEXI
1591@item -uuid @var{uuid}
1592@findex -uuid
1593Set system UUID.
1594ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001595SRST
1596``-uuid uuid``
1597 Set system UUID.
1598ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001599
1600STEXI
1601@end table
1602ETEXI
1603DEFHEADING()
1604
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02001605DEFHEADING(Block device options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001606STEXI
1607@table @option
1608ETEXI
1609
blueswir15824d652009-03-28 06:44:27 +00001610DEF("fda", HAS_ARG, QEMU_OPTION_fda,
Blue Swirlad960902010-03-29 19:23:52 +00001611 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
1612DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001613STEXI
1614@item -fda @var{file}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02001615@itemx -fdb @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001616@findex -fda
1617@findex -fdb
Markus Armbruster92a539d2015-03-17 17:02:20 +01001618Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}).
blueswir15824d652009-03-28 06:44:27 +00001619ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001620SRST
1621``-fda file``; \ ``-fdb file``
1622 Use file as floppy disk 0/1 image (see
1623 :ref:`disk_005fimages`).
1624ERST
blueswir15824d652009-03-28 06:44:27 +00001625
1626DEF("hda", HAS_ARG, QEMU_OPTION_hda,
Blue Swirlad960902010-03-29 19:23:52 +00001627 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
1628DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001629DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
Blue Swirlad960902010-03-29 19:23:52 +00001630 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
1631DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001632STEXI
1633@item -hda @var{file}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02001634@itemx -hdb @var{file}
1635@itemx -hdc @var{file}
1636@itemx -hdd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001637@findex -hda
1638@findex -hdb
1639@findex -hdc
1640@findex -hdd
blueswir15824d652009-03-28 06:44:27 +00001641Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
1642ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001643SRST
1644``-hda file``; \ ``-hdb file``; \ ``-hdc file``; \ ``-hdd file``
1645 Use file as hard disk 0, 1, 2 or 3 image (see
1646 :ref:`disk_005fimages`).
1647ERST
blueswir15824d652009-03-28 06:44:27 +00001648
1649DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
Blue Swirlad960902010-03-29 19:23:52 +00001650 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
1651 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001652STEXI
1653@item -cdrom @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01001654@findex -cdrom
blueswir15824d652009-03-28 06:44:27 +00001655Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and
1656@option{-cdrom} at the same time). You can use the host CD-ROM by
Peter Maydellacab9232020-01-23 15:22:40 +00001657using @file{/dev/cdrom} as filename.
blueswir15824d652009-03-28 06:44:27 +00001658ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001659SRST
1660``-cdrom file``
1661 Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
1662 the same time). You can use the host CD-ROM by using ``/dev/cdrom``
1663 as filename.
1664ERST
blueswir15824d652009-03-28 06:44:27 +00001665
Markus Armbruster42e5f392017-02-28 22:27:07 +01001666DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
1667 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n"
1668 " [,cache.direct=on|off][,cache.no-flush=on|off]\n"
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001669 " [,read-only=on|off][,auto-read-only=on|off]\n"
1670 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
Markus Armbruster42e5f392017-02-28 22:27:07 +01001671 " [,driver specific parameters...]\n"
1672 " configure a block backend\n", QEMU_ARCH_ALL)
Kevin Wolfdfaca462016-09-22 16:53:24 +02001673STEXI
1674@item -blockdev @var{option}[,@var{option}[,@var{option}[,...]]]
1675@findex -blockdev
1676
Kevin Wolf370e8322016-09-22 17:24:38 +02001677Define a new block driver node. Some of the options apply to all block drivers,
1678other options are only accepted for a specific block driver. See below for a
1679list of generic options and options for the most common block drivers.
1680
1681Options that expect a reference to another node (e.g. @code{file}) can be
1682given in two ways. Either you specify the node name of an already existing node
1683(file=@var{node-name}), or you define a new node inline, adding options
1684for the referenced node after a dot (file.filename=@var{path},file.aio=native).
1685
1686A block driver node created with @option{-blockdev} can be used for a guest
1687device by specifying its node name for the @code{drive} property in a
1688@option{-device} argument that defines a block device.
Kevin Wolfdfaca462016-09-22 16:53:24 +02001689
1690@table @option
1691@item Valid options for any block driver node:
1692
1693@table @code
1694@item driver
1695Specifies the block driver to use for the given node.
1696@item node-name
1697This defines the name of the block driver node by which it will be referenced
1698later. The name must be unique, i.e. it must not match the name of a different
1699block driver node, or (if you use @option{-drive} as well) the ID of a drive.
1700
1701If no node name is specified, it is automatically generated. The generated node
1702name is not intended to be predictable and changes between QEMU invocations.
1703For the top level, an explicit node name must be specified.
1704@item read-only
1705Open the node read-only. Guest write attempts will fail.
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001706
1707Note that some block drivers support only read-only access, either generally or
1708in certain configurations. In this case, the default value
1709@option{read-only=off} does not work and the option must be specified
1710explicitly.
1711@item auto-read-only
1712If @option{auto-read-only=on} is set, QEMU may fall back to read-only usage
1713even when @option{read-only=off} is requested, or even switch between modes as
1714needed, e.g. depending on whether the image file is writable or whether a
1715writing user is attached to the node.
1716@item force-share
1717Override the image locking system of QEMU by forcing the node to utilize
1718weaker shared access for permissions where it would normally request exclusive
1719access. When there is the potential for multiple instances to have the same
1720file open (whether this invocation of QEMU is the first or the second
1721instance), both instances must permit shared access for the second instance to
1722succeed at opening the file.
1723
1724Enabling @option{force-share=on} requires @option{read-only=on}.
Kevin Wolfdfaca462016-09-22 16:53:24 +02001725@item cache.direct
1726The host page cache can be avoided with @option{cache.direct=on}. This will
1727attempt to do disk IO directly to the guest's memory. QEMU may still perform an
1728internal copy of the data.
1729@item cache.no-flush
1730In case you don't care about data integrity over host failures, you can use
1731@option{cache.no-flush=on}. This option tells QEMU that it never needs to write
1732any data to the disk but can instead keep things in cache. If anything goes
1733wrong, like your host losing power, the disk storage getting disconnected
1734accidentally, etc. your image will most probably be rendered unusable.
1735@item discard=@var{discard}
1736@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and controls
1737whether @code{discard} (also known as @code{trim} or @code{unmap}) requests are
1738ignored or passed to the filesystem. Some machine types may not support
1739discard requests.
1740@item detect-zeroes=@var{detect-zeroes}
1741@var{detect-zeroes} is "off", "on" or "unmap" and enables the automatic
1742conversion of plain zero writes by the OS to driver specific optimized
1743zero write commands. You may even choose "unmap" if @var{discard} is set
1744to "unmap" to allow a zero write to be converted to an @code{unmap} operation.
1745@end table
1746
Kevin Wolf370e8322016-09-22 17:24:38 +02001747@item Driver-specific options for @code{file}
1748
1749This is the protocol-level block driver for accessing regular files.
1750
1751@table @code
1752@item filename
1753The path to the image file in the local filesystem
1754@item aio
1755Specifies the AIO backend (threads/native, default: threads)
Fam Zheng1878eaf2017-11-24 16:53:51 +08001756@item locking
1757Specifies whether the image file is protected with Linux OFD / POSIX locks. The
1758default is to use the Linux Open File Descriptor API if available, otherwise no
1759lock is applied. (auto/on/off, default: auto)
Kevin Wolf370e8322016-09-22 17:24:38 +02001760@end table
1761Example:
1762@example
1763-blockdev driver=file,node-name=disk,filename=disk.img
1764@end example
1765
1766@item Driver-specific options for @code{raw}
1767
1768This is the image format block driver for raw images. It is usually
1769stacked on top of a protocol level block driver such as @code{file}.
1770
1771@table @code
1772@item file
1773Reference to or definition of the data source block driver node
1774(e.g. a @code{file} driver node)
1775@end table
1776Example 1:
1777@example
1778-blockdev driver=file,node-name=disk_file,filename=disk.img
1779-blockdev driver=raw,node-name=disk,file=disk_file
1780@end example
1781Example 2:
1782@example
1783-blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1784@end example
1785
1786@item Driver-specific options for @code{qcow2}
1787
1788This is the image format block driver for qcow2 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
1796@item backing
1797Reference to or definition of the backing file block device (default is taken
Max Reitz4f7be282018-02-24 16:40:33 +01001798from the image file). It is allowed to pass @code{null} here in order to disable
1799the default backing file.
Kevin Wolf370e8322016-09-22 17:24:38 +02001800
1801@item lazy-refcounts
1802Whether to enable the lazy refcounts feature (on/off; default is taken from the
1803image file)
1804
1805@item cache-size
1806The maximum total size of the L2 table and refcount block caches in bytes
Leonid Bloch40fb2152018-09-26 19:04:39 +03001807(default: the sum of l2-cache-size and refcount-cache-size)
Kevin Wolf370e8322016-09-22 17:24:38 +02001808
1809@item l2-cache-size
1810The maximum size of the L2 table cache in bytes
Leonid Bloch80668d02018-09-26 19:04:44 +03001811(default: if cache-size is not specified - 32M on Linux platforms, and 8M on
1812non-Linux platforms; otherwise, as large as possible within the cache-size,
1813while permitting the requested or the minimal refcount cache size)
Kevin Wolf370e8322016-09-22 17:24:38 +02001814
1815@item refcount-cache-size
1816The maximum size of the refcount block cache in bytes
Leonid Bloch40fb2152018-09-26 19:04:39 +03001817(default: 4 times the cluster size; or if cache-size is specified, the part of
1818it which is not used for the L2 cache)
Kevin Wolf370e8322016-09-22 17:24:38 +02001819
1820@item cache-clean-interval
1821Clean unused entries in the L2 and refcount caches. The interval is in seconds.
Leonid Bloche3a7b452018-09-29 12:54:54 +03001822The default value is 600 on supporting platforms, and 0 on other platforms.
1823Setting it to 0 disables this feature.
Kevin Wolf370e8322016-09-22 17:24:38 +02001824
1825@item pass-discard-request
1826Whether discard requests to the qcow2 device should be forwarded to the data
1827source (on/off; default: on if discard=unmap is specified, off otherwise)
1828
1829@item pass-discard-snapshot
1830Whether discard requests for the data source should be issued when a snapshot
1831operation (e.g. deleting a snapshot) frees clusters in the qcow2 file (on/off;
1832default: on)
1833
1834@item pass-discard-other
1835Whether discard requests for the data source should be issued on other
1836occasions where a cluster gets freed (on/off; default: off)
1837
1838@item overlap-check
1839Which overlap checks to perform for writes to the image
1840(none/constant/cached/all; default: cached). For details or finer
1841granularity control refer to the QAPI documentation of @code{blockdev-add}.
1842@end table
1843
1844Example 1:
1845@example
1846-blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
1847-blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
1848@end example
1849Example 2:
1850@example
1851-blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
1852@end example
1853
1854@item Driver-specific options for other drivers
1855Please refer to the QAPI documentation of the @code{blockdev-add} QMP command.
1856
Kevin Wolfdfaca462016-09-22 16:53:24 +02001857@end table
1858
1859ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001860SRST
1861``-blockdev option[,option[,option[,...]]]``
1862 Define a new block driver node. Some of the options apply to all
1863 block drivers, other options are only accepted for a specific block
1864 driver. See below for a list of generic options and options for the
1865 most common block drivers.
1866
1867 Options that expect a reference to another node (e.g. ``file``) can
1868 be given in two ways. Either you specify the node name of an already
1869 existing node (file=node-name), or you define a new node inline,
1870 adding options for the referenced node after a dot
1871 (file.filename=path,file.aio=native).
1872
1873 A block driver node created with ``-blockdev`` can be used for a
1874 guest device by specifying its node name for the ``drive`` property
1875 in a ``-device`` argument that defines a block device.
1876
1877 ``Valid options for any block driver node:``
1878 ``driver``
1879 Specifies the block driver to use for the given node.
1880
1881 ``node-name``
1882 This defines the name of the block driver node by which it
1883 will be referenced later. The name must be unique, i.e. it
1884 must not match the name of a different block driver node, or
1885 (if you use ``-drive`` as well) the ID of a drive.
1886
1887 If no node name is specified, it is automatically generated.
1888 The generated node name is not intended to be predictable
1889 and changes between QEMU invocations. For the top level, an
1890 explicit node name must be specified.
1891
1892 ``read-only``
1893 Open the node read-only. Guest write attempts will fail.
1894
1895 Note that some block drivers support only read-only access,
1896 either generally or in certain configurations. In this case,
1897 the default value ``read-only=off`` does not work and the
1898 option must be specified explicitly.
1899
1900 ``auto-read-only``
1901 If ``auto-read-only=on`` is set, QEMU may fall back to
1902 read-only usage even when ``read-only=off`` is requested, or
1903 even switch between modes as needed, e.g. depending on
1904 whether the image file is writable or whether a writing user
1905 is attached to the node.
1906
1907 ``force-share``
1908 Override the image locking system of QEMU by forcing the
1909 node to utilize weaker shared access for permissions where
1910 it would normally request exclusive access. When there is
1911 the potential for multiple instances to have the same file
1912 open (whether this invocation of QEMU is the first or the
1913 second instance), both instances must permit shared access
1914 for the second instance to succeed at opening the file.
1915
1916 Enabling ``force-share=on`` requires ``read-only=on``.
1917
1918 ``cache.direct``
1919 The host page cache can be avoided with ``cache.direct=on``.
1920 This will attempt to do disk IO directly to the guest's
1921 memory. QEMU may still perform an internal copy of the data.
1922
1923 ``cache.no-flush``
1924 In case you don't care about data integrity over host
1925 failures, you can use ``cache.no-flush=on``. This option
1926 tells QEMU that it never needs to write any data to the disk
1927 but can instead keep things in cache. If anything goes
1928 wrong, like your host losing power, the disk storage getting
1929 disconnected accidentally, etc. your image will most
1930 probably be rendered unusable.
1931
1932 ``discard=discard``
1933 discard is one of "ignore" (or "off") or "unmap" (or "on")
1934 and controls whether ``discard`` (also known as ``trim`` or
1935 ``unmap``) requests are ignored or passed to the filesystem.
1936 Some machine types may not support discard requests.
1937
1938 ``detect-zeroes=detect-zeroes``
1939 detect-zeroes is "off", "on" or "unmap" and enables the
1940 automatic conversion of plain zero writes by the OS to
1941 driver specific optimized zero write commands. You may even
1942 choose "unmap" if discard is set to "unmap" to allow a zero
1943 write to be converted to an ``unmap`` operation.
1944
1945 ``Driver-specific options for file``
1946 This is the protocol-level block driver for accessing regular
1947 files.
1948
1949 ``filename``
1950 The path to the image file in the local filesystem
1951
1952 ``aio``
1953 Specifies the AIO backend (threads/native, default: threads)
1954
1955 ``locking``
1956 Specifies whether the image file is protected with Linux OFD
1957 / POSIX locks. The default is to use the Linux Open File
1958 Descriptor API if available, otherwise no lock is applied.
1959 (auto/on/off, default: auto)
1960
1961 Example:
1962
1963 ::
1964
1965 -blockdev driver=file,node-name=disk,filename=disk.img
1966
1967 ``Driver-specific options for raw``
1968 This is the image format block driver for raw images. It is
1969 usually stacked on top of a protocol level block driver such as
1970 ``file``.
1971
1972 ``file``
1973 Reference to or definition of the data source block driver
1974 node (e.g. a ``file`` driver node)
1975
1976 Example 1:
1977
1978 ::
1979
1980 -blockdev driver=file,node-name=disk_file,filename=disk.img
1981 -blockdev driver=raw,node-name=disk,file=disk_file
1982
1983 Example 2:
1984
1985 ::
1986
1987 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1988
1989 ``Driver-specific options for qcow2``
1990 This is the image format block driver for qcow2 images. It is
1991 usually stacked on top of a protocol level block driver such as
1992 ``file``.
1993
1994 ``file``
1995 Reference to or definition of the data source block driver
1996 node (e.g. a ``file`` driver node)
1997
1998 ``backing``
1999 Reference to or definition of the backing file block device
2000 (default is taken from the image file). It is allowed to
2001 pass ``null`` here in order to disable the default backing
2002 file.
2003
2004 ``lazy-refcounts``
2005 Whether to enable the lazy refcounts feature (on/off;
2006 default is taken from the image file)
2007
2008 ``cache-size``
2009 The maximum total size of the L2 table and refcount block
2010 caches in bytes (default: the sum of l2-cache-size and
2011 refcount-cache-size)
2012
2013 ``l2-cache-size``
2014 The maximum size of the L2 table cache in bytes (default: if
2015 cache-size is not specified - 32M on Linux platforms, and 8M
2016 on non-Linux platforms; otherwise, as large as possible
2017 within the cache-size, while permitting the requested or the
2018 minimal refcount cache size)
2019
2020 ``refcount-cache-size``
2021 The maximum size of the refcount block cache in bytes
2022 (default: 4 times the cluster size; or if cache-size is
2023 specified, the part of it which is not used for the L2
2024 cache)
2025
2026 ``cache-clean-interval``
2027 Clean unused entries in the L2 and refcount caches. The
2028 interval is in seconds. The default value is 600 on
2029 supporting platforms, and 0 on other platforms. Setting it
2030 to 0 disables this feature.
2031
2032 ``pass-discard-request``
2033 Whether discard requests to the qcow2 device should be
2034 forwarded to the data source (on/off; default: on if
2035 discard=unmap is specified, off otherwise)
2036
2037 ``pass-discard-snapshot``
2038 Whether discard requests for the data source should be
2039 issued when a snapshot operation (e.g. deleting a snapshot)
2040 frees clusters in the qcow2 file (on/off; default: on)
2041
2042 ``pass-discard-other``
2043 Whether discard requests for the data source should be
2044 issued on other occasions where a cluster gets freed
2045 (on/off; default: off)
2046
2047 ``overlap-check``
2048 Which overlap checks to perform for writes to the image
2049 (none/constant/cached/all; default: cached). For details or
2050 finer granularity control refer to the QAPI documentation of
2051 ``blockdev-add``.
2052
2053 Example 1:
2054
2055 ::
2056
2057 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
2058 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
2059
2060 Example 2:
2061
2062 ::
2063
2064 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
2065
2066 ``Driver-specific options for other drivers``
2067 Please refer to the QAPI documentation of the ``blockdev-add``
2068 QMP command.
2069ERST
Markus Armbruster42e5f392017-02-28 22:27:07 +01002070
blueswir15824d652009-03-28 06:44:27 +00002071DEF("drive", HAS_ARG, QEMU_OPTION_drive,
2072 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
Stefan Hajnoczi92196b22011-08-04 12:26:52 +01002073 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
Kevin Wolf572023f2018-06-13 11:01:30 +02002074 " [,snapshot=on|off][,rerror=ignore|stop|report]\n"
Stefan Hajnoczid1db7602014-04-23 13:55:37 +02002075 " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n"
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002076 " [,readonly=on|off][,copy-on-read=on|off]\n"
Peter Lieven2f7133b2014-07-28 21:53:02 +02002077 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n"
Benoît Canet3e9fab62013-09-02 14:14:40 +02002078 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n"
2079 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n"
2080 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
2081 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n"
Benoît Canet2024c1d2013-09-02 14:14:41 +02002082 " [[,iops_size=is]]\n"
Alberto Garcia76f4afb2015-06-08 18:17:44 +02002083 " [[,group=g]]\n"
Blue Swirlad960902010-03-29 19:23:52 +00002084 " use 'file' as a drive image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002085STEXI
2086@item -drive @var{option}[,@var{option}[,@var{option}[,...]]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01002087@findex -drive
blueswir15824d652009-03-28 06:44:27 +00002088
Kevin Wolfdfaca462016-09-22 16:53:24 +02002089Define a new drive. This includes creating a block driver node (the backend) as
2090well as a guest device, and is mostly a shortcut for defining the corresponding
2091@option{-blockdev} and @option{-device} options.
2092
2093@option{-drive} accepts all options that are accepted by @option{-blockdev}. In
2094addition, it knows the following options:
blueswir15824d652009-03-28 06:44:27 +00002095
Kevin Wolfb3f046c2009-10-09 10:58:35 +02002096@table @option
blueswir15824d652009-03-28 06:44:27 +00002097@item file=@var{file}
2098This option defines which disk image (@pxref{disk_images}) to use with
2099this drive. If the filename contains comma, you must double it
2100(for instance, "file=my,,file" to use file "my,file").
Ronnie Sahlberg0f5314a2011-10-26 23:51:37 +11002101
2102Special files such as iSCSI devices can be specified using protocol
2103specific URLs. See the section for "Device URL Syntax" for more information.
blueswir15824d652009-03-28 06:44:27 +00002104@item if=@var{interface}
2105This option defines on which type on interface the drive is connected.
Craig Jellicked1fcd02017-03-17 08:49:55 -07002106Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none.
blueswir15824d652009-03-28 06:44:27 +00002107@item bus=@var{bus},unit=@var{unit}
2108These options define where is connected the drive by defining the bus number and
2109the unit id.
2110@item index=@var{index}
2111This option defines where is connected the drive by using an index in the list
2112of available connectors of a given interface type.
2113@item media=@var{media}
2114This option defines the type of the media: disk or cdrom.
blueswir15824d652009-03-28 06:44:27 +00002115@item snapshot=@var{snapshot}
Michael Tokarev9d85d552014-04-07 13:34:58 +04002116@var{snapshot} is "on" or "off" and controls snapshot mode for the given drive
2117(see @option{-snapshot}).
blueswir15824d652009-03-28 06:44:27 +00002118@item cache=@var{cache}
Kevin Wolfdfaca462016-09-22 16:53:24 +02002119@var{cache} is "none", "writeback", "unsafe", "directsync" or "writethrough"
2120and controls how the host cache is used to access block data. This is a
2121shortcut that sets the @option{cache.direct} and @option{cache.no-flush}
2122options (as in @option{-blockdev}), and additionally @option{cache.writeback},
2123which provides a default for the @option{write-cache} option of block guest
2124devices (as in @option{-device}). The modes correspond to the following
2125settings:
2126
2127@c Our texi2pod.pl script doesn't support @multitable, so fall back to using
2128@c plain ASCII art (well, UTF-8 art really). This looks okay both in the manpage
2129@c and the HTML output.
2130@example
2131@ │ cache.writeback cache.direct cache.no-flush
2132─────────────┼─────────────────────────────────────────────────
2133writeback │ on off off
2134none │ on on off
2135writethrough │ off off off
2136directsync │ off on off
2137unsafe │ on off on
2138@end example
2139
2140The default mode is @option{cache=writeback}.
2141
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002142@item aio=@var{aio}
2143@var{aio} is "threads", or "native" and selects between pthread based disk I/O and native Linux AIO.
blueswir15824d652009-03-28 06:44:27 +00002144@item format=@var{format}
2145Specify which disk @var{format} will be used rather than detecting
Michael Tokarevd33c8a72016-05-18 15:47:53 +03002146the format. Can be used to specify format=raw to avoid interpreting
blueswir15824d652009-03-28 06:44:27 +00002147an untrusted format header.
Luiz Capitulinoae73e592011-07-12 17:35:08 -03002148@item werror=@var{action},rerror=@var{action}
2149Specify which @var{action} to take on write and read errors. Valid actions are:
2150"ignore" (ignore the error and try to continue), "stop" (pause QEMU),
2151"report" (report the error to the guest), "enospc" (pause QEMU only if the
2152host disk is full; report the error to the guest otherwise).
2153The default setting is @option{werror=enospc} and @option{rerror=report}.
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002154@item copy-on-read=@var{copy-on-read}
2155@var{copy-on-read} is "on" or "off" and enables whether to copy read backing
2156file sectors into the image file.
Stefan Hajnoczi01f9cfa2017-03-01 11:50:24 +00002157@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
2158Specify bandwidth throttling limits in bytes per second, either for all request
2159types or for reads or writes only. Small values can lead to timeouts or hangs
2160inside the guest. A safe minimum for disks is 2 MB/s.
2161@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}
2162Specify bursts in bytes per second, either for all request types or for reads
2163or writes only. Bursts allow the guest I/O to spike above the limit
2164temporarily.
2165@item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}
2166Specify request rate limits in requests per second, either for all request
2167types or for reads or writes only.
2168@item iops_max=@var{bm},iops_rd_max=@var{rm},iops_wr_max=@var{wm}
2169Specify bursts in requests per second, either for all request types or for reads
2170or writes only. Bursts allow the guest I/O to spike above the limit
2171temporarily.
2172@item iops_size=@var{is}
2173Let every @var{is} bytes of a request count as a new request for iops
2174throttling purposes. Use this option to prevent guests from circumventing iops
2175limits by sending fewer but larger requests.
2176@item group=@var{g}
2177Join a throttling quota group with given name @var{g}. All drives that are
2178members of the same group are accounted for together. Use this option to
2179prevent guests from circumventing throttling limits by using many small disks
2180instead of a single larger disk.
blueswir15824d652009-03-28 06:44:27 +00002181@end table
2182
Kevin Wolfdfaca462016-09-22 16:53:24 +02002183By default, the @option{cache.writeback=on} mode is used. It will report data
Kevin Wolfa13e5e02012-11-21 12:26:56 +01002184writes as completed as soon as the data is present in the host page cache.
2185This is safe as long as your guest OS makes sure to correctly flush disk caches
2186where needed. If your guest OS does not handle volatile disk write caches
2187correctly and your host crashes or loses power, then the guest may experience
2188data corruption.
blueswir15824d652009-03-28 06:44:27 +00002189
Kevin Wolfdfaca462016-09-22 16:53:24 +02002190For such guests, you should consider using @option{cache.writeback=off}. This
Kevin Wolfa13e5e02012-11-21 12:26:56 +01002191means that the host page cache will be used to read and write data, but write
2192notification will be sent to the guest only after QEMU has made sure to flush
2193each write to the disk. Be aware that this has a major impact on performance.
blueswir15824d652009-03-28 06:44:27 +00002194
Kevin Wolfdfaca462016-09-22 16:53:24 +02002195When using the @option{-snapshot} option, unsafe caching is always used.
Alexander Graf016f5cf2010-05-26 17:51:49 +02002196
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00002197Copy-on-read avoids accessing the same backing file sectors repeatedly and is
2198useful when the backing file is over a slow network. By default copy-on-read
2199is off.
2200
blueswir15824d652009-03-28 06:44:27 +00002201Instead of @option{-cdrom} you can use:
2202@example
Thomas Huth664785a2019-07-30 17:08:26 +02002203@value{qemu_system} -drive file=file,index=2,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002204@end example
2205
2206Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can
2207use:
2208@example
Thomas Huth664785a2019-07-30 17:08:26 +02002209@value{qemu_system} -drive file=file,index=0,media=disk
2210@value{qemu_system} -drive file=file,index=1,media=disk
2211@value{qemu_system} -drive file=file,index=2,media=disk
2212@value{qemu_system} -drive file=file,index=3,media=disk
blueswir15824d652009-03-28 06:44:27 +00002213@end example
2214
Corey Bryant587ed6b2012-10-18 15:19:34 -04002215You can open an image using pre-opened file descriptors from an fd set:
2216@example
Thomas Huth664785a2019-07-30 17:08:26 +02002217@value{qemu_system} \
2218 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2219 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2220 -drive file=/dev/fdset/2,index=0,media=disk
Corey Bryant587ed6b2012-10-18 15:19:34 -04002221@end example
2222
blueswir15824d652009-03-28 06:44:27 +00002223You can connect a CDROM to the slave of ide0:
2224@example
Thomas Huth664785a2019-07-30 17:08:26 +02002225@value{qemu_system_x86} -drive file=file,if=ide,index=1,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002226@end example
2227
2228If you don't specify the "file=" argument, you define an empty drive:
2229@example
Thomas Huth664785a2019-07-30 17:08:26 +02002230@value{qemu_system_x86} -drive if=ide,index=1,media=cdrom
blueswir15824d652009-03-28 06:44:27 +00002231@end example
2232
blueswir15824d652009-03-28 06:44:27 +00002233Instead of @option{-fda}, @option{-fdb}, you can use:
2234@example
Thomas Huth664785a2019-07-30 17:08:26 +02002235@value{qemu_system_x86} -drive file=file,index=0,if=floppy
2236@value{qemu_system_x86} -drive file=file,index=1,if=floppy
blueswir15824d652009-03-28 06:44:27 +00002237@end example
2238
2239By default, @var{interface} is "ide" and @var{index} is automatically
2240incremented:
2241@example
Thomas Huth664785a2019-07-30 17:08:26 +02002242@value{qemu_system_x86} -drive file=a -drive file=b"
blueswir15824d652009-03-28 06:44:27 +00002243@end example
2244is interpreted like:
2245@example
Thomas Huth664785a2019-07-30 17:08:26 +02002246@value{qemu_system_x86} -hda a -hdb b
blueswir15824d652009-03-28 06:44:27 +00002247@end example
2248ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002249SRST
2250``-drive option[,option[,option[,...]]]``
2251 Define a new drive. This includes creating a block driver node (the
2252 backend) as well as a guest device, and is mostly a shortcut for
2253 defining the corresponding ``-blockdev`` and ``-device`` options.
2254
2255 ``-drive`` accepts all options that are accepted by ``-blockdev``.
2256 In addition, it knows the following options:
2257
2258 ``file=file``
2259 This option defines which disk image (see
2260 :ref:`disk_005fimages`) to use with this drive. If
2261 the filename contains comma, you must double it (for instance,
2262 "file=my,,file" to use file "my,file").
2263
2264 Special files such as iSCSI devices can be specified using
2265 protocol specific URLs. See the section for "Device URL Syntax"
2266 for more information.
2267
2268 ``if=interface``
2269 This option defines on which type on interface the drive is
2270 connected. Available types are: ide, scsi, sd, mtd, floppy,
2271 pflash, virtio, none.
2272
2273 ``bus=bus,unit=unit``
2274 These options define where is connected the drive by defining
2275 the bus number and the unit id.
2276
2277 ``index=index``
2278 This option defines where is connected the drive by using an
2279 index in the list of available connectors of a given interface
2280 type.
2281
2282 ``media=media``
2283 This option defines the type of the media: disk or cdrom.
2284
2285 ``snapshot=snapshot``
2286 snapshot is "on" or "off" and controls snapshot mode for the
2287 given drive (see ``-snapshot``).
2288
2289 ``cache=cache``
2290 cache is "none", "writeback", "unsafe", "directsync" or
2291 "writethrough" and controls how the host cache is used to access
2292 block data. This is a shortcut that sets the ``cache.direct``
2293 and ``cache.no-flush`` options (as in ``-blockdev``), and
2294 additionally ``cache.writeback``, which provides a default for
2295 the ``write-cache`` option of block guest devices (as in
2296 ``-device``). The modes correspond to the following settings:
2297
2298 ::
2299
2300   │ cache.writeback cache.direct cache.no-flush
2301 ─────────────┼─────────────────────────────────────────────────
2302 writeback │ on off off
2303 none │ on on off
2304 writethrough │ off off off
2305 directsync │ off on off
2306 unsafe │ on off on
2307
2308 The default mode is ``cache=writeback``.
2309
2310 ``aio=aio``
2311 aio is "threads", or "native" and selects between pthread based
2312 disk I/O and native Linux AIO.
2313
2314 ``format=format``
2315 Specify which disk format will be used rather than detecting the
2316 format. Can be used to specify format=raw to avoid interpreting
2317 an untrusted format header.
2318
2319 ``werror=action,rerror=action``
2320 Specify which action to take on write and read errors. Valid
2321 actions are: "ignore" (ignore the error and try to continue),
2322 "stop" (pause QEMU), "report" (report the error to the guest),
2323 "enospc" (pause QEMU only if the host disk is full; report the
2324 error to the guest otherwise). The default setting is
2325 ``werror=enospc`` and ``rerror=report``.
2326
2327 ``copy-on-read=copy-on-read``
2328 copy-on-read is "on" or "off" and enables whether to copy read
2329 backing file sectors into the image file.
2330
2331 ``bps=b,bps_rd=r,bps_wr=w``
2332 Specify bandwidth throttling limits in bytes per second, either
2333 for all request types or for reads or writes only. Small values
2334 can lead to timeouts or hangs inside the guest. A safe minimum
2335 for disks is 2 MB/s.
2336
2337 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm``
2338 Specify bursts in bytes per second, either for all request types
2339 or for reads or writes only. Bursts allow the guest I/O to spike
2340 above the limit temporarily.
2341
2342 ``iops=i,iops_rd=r,iops_wr=w``
2343 Specify request rate limits in requests per second, either for
2344 all request types or for reads or writes only.
2345
2346 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm``
2347 Specify bursts in requests per second, either for all request
2348 types or for reads or writes only. Bursts allow the guest I/O to
2349 spike above the limit temporarily.
2350
2351 ``iops_size=is``
2352 Let every is bytes of a request count as a new request for iops
2353 throttling purposes. Use this option to prevent guests from
2354 circumventing iops limits by sending fewer but larger requests.
2355
2356 ``group=g``
2357 Join a throttling quota group with given name g. All drives that
2358 are members of the same group are accounted for together. Use
2359 this option to prevent guests from circumventing throttling
2360 limits by using many small disks instead of a single larger
2361 disk.
2362
2363 By default, the ``cache.writeback=on`` mode is used. It will report
2364 data writes as completed as soon as the data is present in the host
2365 page cache. This is safe as long as your guest OS makes sure to
2366 correctly flush disk caches where needed. If your guest OS does not
2367 handle volatile disk write caches correctly and your host crashes or
2368 loses power, then the guest may experience data corruption.
2369
2370 For such guests, you should consider using ``cache.writeback=off``.
2371 This means that the host page cache will be used to read and write
2372 data, but write notification will be sent to the guest only after
2373 QEMU has made sure to flush each write to the disk. Be aware that
2374 this has a major impact on performance.
2375
2376 When using the ``-snapshot`` option, unsafe caching is always used.
2377
2378 Copy-on-read avoids accessing the same backing file sectors
2379 repeatedly and is useful when the backing file is over a slow
2380 network. By default copy-on-read is off.
2381
2382 Instead of ``-cdrom`` you can use:
2383
2384 .. parsed-literal::
2385
2386 |qemu_system| -drive file=file,index=2,media=cdrom
2387
2388 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use:
2389
2390 .. parsed-literal::
2391
2392 |qemu_system| -drive file=file,index=0,media=disk
2393 |qemu_system| -drive file=file,index=1,media=disk
2394 |qemu_system| -drive file=file,index=2,media=disk
2395 |qemu_system| -drive file=file,index=3,media=disk
2396
2397 You can open an image using pre-opened file descriptors from an fd
2398 set:
2399
2400 .. parsed-literal::
2401
2402 |qemu_system| \
2403 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \
2404 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \
2405 -drive file=/dev/fdset/2,index=0,media=disk
2406
2407 You can connect a CDROM to the slave of ide0:
2408
2409 .. parsed-literal::
2410
2411 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom
2412
2413 If you don't specify the "file=" argument, you define an empty
2414 drive:
2415
2416 .. parsed-literal::
2417
2418 |qemu_system_x86| -drive if=ide,index=1,media=cdrom
2419
2420 Instead of ``-fda``, ``-fdb``, you can use:
2421
2422 .. parsed-literal::
2423
2424 |qemu_system_x86| -drive file=file,index=0,if=floppy
2425 |qemu_system_x86| -drive file=file,index=1,if=floppy
2426
2427 By default, interface is "ide" and index is automatically
2428 incremented:
2429
2430 .. parsed-literal::
2431
2432 |qemu_system_x86| -drive file=a -drive file=b"
2433
2434 is interpreted like:
2435
2436 .. parsed-literal::
2437
2438 |qemu_system_x86| -hda a -hdb b
2439ERST
blueswir15824d652009-03-28 06:44:27 +00002440
2441DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
Blue Swirlad960902010-03-29 19:23:52 +00002442 "-mtdblock file use 'file' as on-board Flash memory image\n",
2443 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002444STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002445@item -mtdblock @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002446@findex -mtdblock
Kevin Wolf4e257e52009-10-09 10:58:36 +02002447Use @var{file} as on-board Flash memory image.
blueswir15824d652009-03-28 06:44:27 +00002448ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002449SRST
2450``-mtdblock file``
2451 Use file as on-board Flash memory image.
2452ERST
blueswir15824d652009-03-28 06:44:27 +00002453
2454DEF("sd", HAS_ARG, QEMU_OPTION_sd,
Blue Swirlad960902010-03-29 19:23:52 +00002455 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002456STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002457@item -sd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002458@findex -sd
Kevin Wolf4e257e52009-10-09 10:58:36 +02002459Use @var{file} as SecureDigital card image.
blueswir15824d652009-03-28 06:44:27 +00002460ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002461SRST
2462``-sd file``
2463 Use file as SecureDigital card image.
2464ERST
blueswir15824d652009-03-28 06:44:27 +00002465
2466DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
Blue Swirlad960902010-03-29 19:23:52 +00002467 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002468STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02002469@item -pflash @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01002470@findex -pflash
Kevin Wolf4e257e52009-10-09 10:58:36 +02002471Use @var{file} as a parallel flash image.
blueswir15824d652009-03-28 06:44:27 +00002472ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002473SRST
2474``-pflash file``
2475 Use file as a parallel flash image.
2476ERST
blueswir15824d652009-03-28 06:44:27 +00002477
blueswir15824d652009-03-28 06:44:27 +00002478DEF("snapshot", 0, QEMU_OPTION_snapshot,
Blue Swirlad960902010-03-29 19:23:52 +00002479 "-snapshot write to temporary files instead of disk image files\n",
2480 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00002481STEXI
2482@item -snapshot
Stefan Weil6616b2a2010-02-05 23:52:05 +01002483@findex -snapshot
blueswir15824d652009-03-28 06:44:27 +00002484Write to temporary files instead of disk image files. In this case,
2485the raw disk image you use is not written back. You can however force
2486the write back by pressing @key{C-a s} (@pxref{disk_images}).
2487ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002488SRST
2489``-snapshot``
2490 Write to temporary files instead of disk image files. In this case,
2491 the raw disk image you use is not written back. You can however
2492 force the write back by pressing C-a s (see
2493 :ref:`disk_005fimages`).
2494ERST
blueswir15824d652009-03-28 06:44:27 +00002495
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302496DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
Greg Kurzb44a6b02019-05-17 17:34:49 +02002497 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n"
2498 " [,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode]\n"
Pradeep Jagadeeshb8bbdb82017-02-28 10:31:46 +01002499 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n"
2500 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n"
2501 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n"
2502 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02002503 " [[,throttling.iops-size=is]]\n"
2504 "-fsdev proxy,id=id,socket=socket[,writeout=immediate][,readonly]\n"
2505 "-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=immediate][,readonly]\n"
2506 "-fsdev synth,id=id\n",
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302507 QEMU_ARCH_ALL)
2508
2509STEXI
2510
Greg Kurzb44a6b02019-05-17 17:34:49 +02002511@item -fsdev local,id=@var{id},path=@var{path},security_model=@var{security_model} [,writeout=@var{writeout}][,readonly][,fmode=@var{fmode}][,dmode=@var{dmode}] [,throttling.@var{option}=@var{value}[,throttling.@var{option}=@var{value}[,...]]]
2512@itemx -fsdev proxy,id=@var{id},socket=@var{socket}[,writeout=@var{writeout}][,readonly]
2513@itemx -fsdev proxy,id=@var{id},sock_fd=@var{sock_fd}[,writeout=@var{writeout}][,readonly]
2514@itemx -fsdev synth,id=@var{id}[,readonly]
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302515@findex -fsdev
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302516Define a new file system device. Valid options are:
2517@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002518@item local
2519Accesses to the filesystem are done by QEMU.
2520@item proxy
2521Accesses to the filesystem are done by virtfs-proxy-helper(1).
2522@item synth
2523Synthetic filesystem, only used by QTests.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302524@item id=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002525Specifies identifier for this device.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302526@item path=@var{path}
2527Specifies the export path for the file system device. Files under
2528this path will be available to the 9p client on the guest.
2529@item security_model=@var{security_model}
2530Specifies the security model to be used for this export path.
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302531Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302532In "passthrough" security model, files are stored using the same
Stefan Weilb65ee4f2012-05-11 22:25:50 +02002533credentials as they are created on the guest. This requires QEMU
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302534to run as root. In "mapped-xattr" security model, some of the file
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302535attributes like uid, gid, mode bits and link target are stored as
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302536file attributes. For "mapped-file" these attributes are stored in the
2537hidden .virtfs_metadata directory. Directories exported by this security model cannot
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302538interact with other unix tools. "none" security model is same as
2539passthrough except the sever won't report failures if it fails to
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302540set file attributes like ownership. Security model is mandatory
Greg Kurz93aee842018-12-12 14:18:10 +01002541only for local fsdriver. Other fsdrivers (like proxy) don't take
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302542security model as a parameter.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302543@item writeout=@var{writeout}
2544This is an optional argument. The only supported value is "immediate".
2545This means that host page cache will be used to read and write data but
2546write notification will be sent to the guest only when the data has been
2547reported as written by the storage subsystem.
M. Mohan Kumar2c74c2c2011-10-25 12:10:39 +05302548@item readonly
2549Enables exporting 9p share as a readonly mount for guests. By default
2550read-write access is given.
M. Mohan Kumar84a87cc2011-12-14 13:58:47 +05302551@item socket=@var{socket}
2552Enables proxy filesystem driver to use passed socket file for communicating
Greg Kurzb44a6b02019-05-17 17:34:49 +02002553with virtfs-proxy-helper(1).
M. Mohan Kumarf67e3ff2011-12-14 13:58:46 +05302554@item sock_fd=@var{sock_fd}
2555Enables proxy filesystem driver to use passed socket descriptor for
Greg Kurzb44a6b02019-05-17 17:34:49 +02002556communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2557will create socketpair and pass one of the fds as sock_fd.
Tobias Schrammb96feb22017-06-29 15:11:50 +02002558@item fmode=@var{fmode}
2559Specifies the default mode for newly created files on the host. Works only
2560with security models "mapped-xattr" and "mapped-file".
2561@item dmode=@var{dmode}
2562Specifies the default mode for newly created directories on the host. Works
2563only with security models "mapped-xattr" and "mapped-file".
Greg Kurzb44a6b02019-05-17 17:34:49 +02002564@item throttling.bps-total=@var{b},throttling.bps-read=@var{r},throttling.bps-write=@var{w}
2565Specify bandwidth throttling limits in bytes per second, either for all request
2566types or for reads or writes only.
2567@item throttling.bps-total-max=@var{bm},bps-read-max=@var{rm},bps-write-max=@var{wm}
2568Specify bursts in bytes per second, either for all request types or for reads
2569or writes only. Bursts allow the guest I/O to spike above the limit
2570temporarily.
2571@item throttling.iops-total=@var{i},throttling.iops-read=@var{r}, throttling.iops-write=@var{w}
2572Specify request rate limits in requests per second, either for all request
2573types or for reads or writes only.
2574@item throttling.iops-total-max=@var{im},throttling.iops-read-max=@var{irm}, throttling.iops-write-max=@var{iwm}
2575Specify bursts in requests per second, either for all request types or for reads
2576or writes only. Bursts allow the guest I/O to spike above the limit temporarily.
2577@item throttling.iops-size=@var{is}
2578Let every @var{is} bytes of a request count as a new request for iops
2579throttling purposes.
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302580@end table
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302581
Greg Kurzb44a6b02019-05-17 17:34:49 +02002582-fsdev option is used along with -device driver "virtio-9p-...".
2583@item -device virtio-9p-@var{type},fsdev=@var{id},mount_tag=@var{mount_tag}
2584Options for virtio-9p-... driver are:
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302585@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002586@item @var{type}
2587Specifies the variant to be used. Supported values are "pci", "ccw" or "device",
2588depending on the machine type.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302589@item fsdev=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002590Specifies the id value specified along with -fsdev option.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302591@item mount_tag=@var{mount_tag}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002592Specifies the tag name to be used by the guest to mount this export point.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302593@end table
2594
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302595ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002596SRST
2597``-fsdev local,id=id,path=path,security_model=security_model [,writeout=writeout][,readonly][,fmode=fmode][,dmode=dmode] [,throttling.option=value[,throttling.option=value[,...]]]``; \ ``-fsdev proxy,id=id,socket=socket[,writeout=writeout][,readonly]``; \ ``-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=writeout][,readonly]``; \ ``-fsdev synth,id=id[,readonly]``
2598 Define a new file system device. Valid options are:
2599
2600 ``local``
2601 Accesses to the filesystem are done by QEMU.
2602
2603 ``proxy``
2604 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2605
2606 ``synth``
2607 Synthetic filesystem, only used by QTests.
2608
2609 ``id=id``
2610 Specifies identifier for this device.
2611
2612 ``path=path``
2613 Specifies the export path for the file system device. Files
2614 under this path will be available to the 9p client on the guest.
2615
2616 ``security_model=security_model``
2617 Specifies the security model to be used for this export path.
2618 Supported security models are "passthrough", "mapped-xattr",
2619 "mapped-file" and "none". In "passthrough" security model, files
2620 are stored using the same credentials as they are created on the
2621 guest. This requires QEMU to run as root. In "mapped-xattr"
2622 security model, some of the file attributes like uid, gid, mode
2623 bits and link target are stored as file attributes. For
2624 "mapped-file" these attributes are stored in the hidden
2625 .virtfs\_metadata directory. Directories exported by this
2626 security model cannot interact with other unix tools. "none"
2627 security model is same as passthrough except the sever won't
2628 report failures if it fails to set file attributes like
2629 ownership. Security model is mandatory only for local fsdriver.
2630 Other fsdrivers (like proxy) don't take security model as a
2631 parameter.
2632
2633 ``writeout=writeout``
2634 This is an optional argument. The only supported value is
2635 "immediate". This means that host page cache will be used to
2636 read and write data but write notification will be sent to the
2637 guest only when the data has been reported as written by the
2638 storage subsystem.
2639
2640 ``readonly``
2641 Enables exporting 9p share as a readonly mount for guests. By
2642 default read-write access is given.
2643
2644 ``socket=socket``
2645 Enables proxy filesystem driver to use passed socket file for
2646 communicating with virtfs-proxy-helper(1).
2647
2648 ``sock_fd=sock_fd``
2649 Enables proxy filesystem driver to use passed socket descriptor
2650 for communicating with virtfs-proxy-helper(1). Usually a helper
2651 like libvirt will create socketpair and pass one of the fds as
2652 sock\_fd.
2653
2654 ``fmode=fmode``
2655 Specifies the default mode for newly created files on the host.
2656 Works only with security models "mapped-xattr" and
2657 "mapped-file".
2658
2659 ``dmode=dmode``
2660 Specifies the default mode for newly created directories on the
2661 host. Works only with security models "mapped-xattr" and
2662 "mapped-file".
2663
2664 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w``
2665 Specify bandwidth throttling limits in bytes per second, either
2666 for all request types or for reads or writes only.
2667
2668 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm``
2669 Specify bursts in bytes per second, either for all request types
2670 or for reads or writes only. Bursts allow the guest I/O to spike
2671 above the limit temporarily.
2672
2673 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w``
2674 Specify request rate limits in requests per second, either for
2675 all request types or for reads or writes only.
2676
2677 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm``
2678 Specify bursts in requests per second, either for all request
2679 types or for reads or writes only. Bursts allow the guest I/O to
2680 spike above the limit temporarily.
2681
2682 ``throttling.iops-size=is``
2683 Let every is bytes of a request count as a new request for iops
2684 throttling purposes.
2685
2686 -fsdev option is used along with -device driver "virtio-9p-...".
2687
2688``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag``
2689 Options for virtio-9p-... driver are:
2690
2691 ``type``
2692 Specifies the variant to be used. Supported values are "pci",
2693 "ccw" or "device", depending on the machine type.
2694
2695 ``fsdev=id``
2696 Specifies the id value specified along with -fsdev option.
2697
2698 ``mount_tag=mount_tag``
2699 Specifies the tag name to be used by the guest to mount this
2700 export point.
2701ERST
Gautham R Shenoy74db9202010-04-29 17:44:43 +05302702
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302703DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
Greg Kurzb44a6b02019-05-17 17:34:49 +02002704 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002705 " [,id=id][,writeout=immediate][,readonly][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02002706 "-virtfs proxy,mount_tag=tag,socket=socket[,id=id][,writeout=immediate][,readonly]\n"
2707 "-virtfs proxy,mount_tag=tag,sock_fd=sock_fd[,id=id][,writeout=immediate][,readonly]\n"
2708 "-virtfs synth,mount_tag=tag[,id=id][,readonly]\n",
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302709 QEMU_ARCH_ALL)
2710
2711STEXI
2712
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002713@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 +02002714@itemx -virtfs proxy,socket=@var{socket},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2715@itemx -virtfs proxy,sock_fd=@var{sock_fd},mount_tag=@var{mount_tag} [,writeout=@var{writeout}][,readonly]
2716@itemx -virtfs synth,mount_tag=@var{mount_tag}
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302717@findex -virtfs
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302718
Greg Kurzb44a6b02019-05-17 17:34:49 +02002719Define 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 +05302720@table @option
Greg Kurzb44a6b02019-05-17 17:34:49 +02002721@item local
2722Accesses to the filesystem are done by QEMU.
2723@item proxy
2724Accesses to the filesystem are done by virtfs-proxy-helper(1).
2725@item synth
2726Synthetic filesystem, only used by QTests.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302727@item id=@var{id}
Greg Kurzb44a6b02019-05-17 17:34:49 +02002728Specifies identifier for the filesystem device
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302729@item path=@var{path}
2730Specifies the export path for the file system device. Files under
2731this path will be available to the 9p client on the guest.
2732@item security_model=@var{security_model}
2733Specifies the security model to be used for this export path.
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302734Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302735In "passthrough" security model, files are stored using the same
Stefan Weilb65ee4f2012-05-11 22:25:50 +02002736credentials as they are created on the guest. This requires QEMU
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302737to run as root. In "mapped-xattr" security model, some of the file
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302738attributes like uid, gid, mode bits and link target are stored as
Aneesh Kumar K.V2c30dd72012-01-19 12:21:11 +05302739file attributes. For "mapped-file" these attributes are stored in the
2740hidden .virtfs_metadata directory. Directories exported by this security model cannot
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302741interact with other unix tools. "none" security model is same as
2742passthrough except the sever won't report failures if it fails to
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302743set file attributes like ownership. Security model is mandatory only
Greg Kurz93aee842018-12-12 14:18:10 +01002744for local fsdriver. Other fsdrivers (like proxy) don't take security
M. Mohan Kumard9b36a62011-10-14 12:59:37 +05302745model as a parameter.
Aneesh Kumar K.V7c92a3d2011-10-12 19:11:24 +05302746@item writeout=@var{writeout}
2747This is an optional argument. The only supported value is "immediate".
2748This means that host page cache will be used to read and write data but
2749write notification will be sent to the guest only when the data has been
2750reported as written by the storage subsystem.
M. Mohan Kumar2c74c2c2011-10-25 12:10:39 +05302751@item readonly
2752Enables exporting 9p share as a readonly mount for guests. By default
2753read-write access is given.
M. Mohan Kumar84a87cc2011-12-14 13:58:47 +05302754@item socket=@var{socket}
2755Enables proxy filesystem driver to use passed socket file for
Greg Kurzb44a6b02019-05-17 17:34:49 +02002756communicating with virtfs-proxy-helper(1). Usually a helper like libvirt
2757will create socketpair and pass one of the fds as sock_fd.
M. Mohan Kumarf67e3ff2011-12-14 13:58:46 +05302758@item sock_fd
2759Enables proxy filesystem driver to use passed 'sock_fd' as the socket
Greg Kurzb44a6b02019-05-17 17:34:49 +02002760descriptor for interfacing with virtfs-proxy-helper(1).
Tobias Schrammb96feb22017-06-29 15:11:50 +02002761@item fmode=@var{fmode}
2762Specifies the default mode for newly created files on the host. Works only
2763with security models "mapped-xattr" and "mapped-file".
2764@item dmode=@var{dmode}
2765Specifies the default mode for newly created directories on the host. Works
2766only with security models "mapped-xattr" and "mapped-file".
Greg Kurzb44a6b02019-05-17 17:34:49 +02002767@item mount_tag=@var{mount_tag}
2768Specifies the tag name to be used by the guest to mount this export point.
Antonios Motakis1a6ed332019-10-10 11:36:05 +02002769@item multidevs=@var{multidevs}
2770Specifies how to deal with multiple devices being shared with a 9p export.
2771Supported behaviours are either "remap", "forbid" or "warn". The latter is
2772the default behaviour on which virtfs 9p expects only one device to be
2773shared with the same export, and if more than one device is shared and
2774accessed via the same 9p export then only a warning message is logged
2775(once) by qemu on host side. In order to avoid file ID collisions on guest
2776you should either create a separate virtfs export for each device to be
2777shared with guests (recommended way) or you might use "remap" instead which
2778allows you to share multiple devices with only one export instead, which is
2779achieved by remapping the original inode numbers from host to guest in a
2780way that would prevent such collisions. Remapping inodes in such use cases
2781is required because the original device IDs from host are never passed and
2782exposed on guest. Instead all files of an export shared with virtfs always
2783share the same device id on guest. So two files with identical inode
2784numbers but from actually different devices on host would otherwise cause a
2785file ID collision and hence potential misbehaviours on guest. "forbid" on
2786the other hand assumes like "warn" that only one device is shared by the
2787same export, however it will not only log a warning message but also
2788deny access to additional devices on guest. Note though that "forbid" does
2789currently not block all possible file access operations (e.g. readdir()
2790would still return entries from other devices).
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302791@end table
2792ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002793SRST
2794``-virtfs local,path=path,mount_tag=mount_tag ,security_model=security_model[,writeout=writeout][,readonly] [,fmode=fmode][,dmode=dmode][,multidevs=multidevs]``; \ ``-virtfs proxy,socket=socket,mount_tag=mount_tag [,writeout=writeout][,readonly]``; \ ``-virtfs proxy,sock_fd=sock_fd,mount_tag=mount_tag [,writeout=writeout][,readonly]``; \ ``-virtfs synth,mount_tag=mount_tag``
2795 Define a new filesystem device and expose it to the guest using a
2796 virtio-9p-device. The general form of a Virtual File system
2797 pass-through options are:
2798
2799 ``local``
2800 Accesses to the filesystem are done by QEMU.
2801
2802 ``proxy``
2803 Accesses to the filesystem are done by virtfs-proxy-helper(1).
2804
2805 ``synth``
2806 Synthetic filesystem, only used by QTests.
2807
2808 ``id=id``
2809 Specifies identifier for the filesystem device
2810
2811 ``path=path``
2812 Specifies the export path for the file system device. Files
2813 under this path will be available to the 9p client on the guest.
2814
2815 ``security_model=security_model``
2816 Specifies the security model to be used for this export path.
2817 Supported security models are "passthrough", "mapped-xattr",
2818 "mapped-file" and "none". In "passthrough" security model, files
2819 are stored using the same credentials as they are created on the
2820 guest. This requires QEMU to run as root. In "mapped-xattr"
2821 security model, some of the file attributes like uid, gid, mode
2822 bits and link target are stored as file attributes. For
2823 "mapped-file" these attributes are stored in the hidden
2824 .virtfs\_metadata directory. Directories exported by this
2825 security model cannot interact with other unix tools. "none"
2826 security model is same as passthrough except the sever won't
2827 report failures if it fails to set file attributes like
2828 ownership. Security model is mandatory only for local fsdriver.
2829 Other fsdrivers (like proxy) don't take security model as a
2830 parameter.
2831
2832 ``writeout=writeout``
2833 This is an optional argument. The only supported value is
2834 "immediate". This means that host page cache will be used to
2835 read and write data but write notification will be sent to the
2836 guest only when the data has been reported as written by the
2837 storage subsystem.
2838
2839 ``readonly``
2840 Enables exporting 9p share as a readonly mount for guests. By
2841 default read-write access is given.
2842
2843 ``socket=socket``
2844 Enables proxy filesystem driver to use passed socket file for
2845 communicating with virtfs-proxy-helper(1). Usually a helper like
2846 libvirt will create socketpair and pass one of the fds as
2847 sock\_fd.
2848
2849 ``sock_fd``
2850 Enables proxy filesystem driver to use passed 'sock\_fd' as the
2851 socket descriptor for interfacing with virtfs-proxy-helper(1).
2852
2853 ``fmode=fmode``
2854 Specifies the default mode for newly created files on the host.
2855 Works only with security models "mapped-xattr" and
2856 "mapped-file".
2857
2858 ``dmode=dmode``
2859 Specifies the default mode for newly created directories on the
2860 host. Works only with security models "mapped-xattr" and
2861 "mapped-file".
2862
2863 ``mount_tag=mount_tag``
2864 Specifies the tag name to be used by the guest to mount this
2865 export point.
2866
2867 ``multidevs=multidevs``
2868 Specifies how to deal with multiple devices being shared with a
2869 9p export. Supported behaviours are either "remap", "forbid" or
2870 "warn". The latter is the default behaviour on which virtfs 9p
2871 expects only one device to be shared with the same export, and
2872 if more than one device is shared and accessed via the same 9p
2873 export then only a warning message is logged (once) by qemu on
2874 host side. In order to avoid file ID collisions on guest you
2875 should either create a separate virtfs export for each device to
2876 be shared with guests (recommended way) or you might use "remap"
2877 instead which allows you to share multiple devices with only one
2878 export instead, which is achieved by remapping the original
2879 inode numbers from host to guest in a way that would prevent
2880 such collisions. Remapping inodes in such use cases is required
2881 because the original device IDs from host are never passed and
2882 exposed on guest. Instead all files of an export shared with
2883 virtfs always share the same device id on guest. So two files
2884 with identical inode numbers but from actually different devices
2885 on host would otherwise cause a file ID collision and hence
2886 potential misbehaviours on guest. "forbid" on the other hand
2887 assumes like "warn" that only one device is shared by the same
2888 export, however it will not only log a warning message but also
2889 deny access to additional devices on guest. Note though that
2890 "forbid" does currently not block all possible file access
2891 operations (e.g. readdir() would still return entries from other
2892 devices).
2893ERST
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302894
Markus Armbruster61d70482017-10-02 16:03:03 +02002895DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi,
2896 "-iscsi [user=user][,password=password]\n"
2897 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE\n"
2898 " [,initiator-name=initiator-iqn][,id=target-iqn]\n"
2899 " [,timeout=timeout]\n"
2900 " iSCSI session parameters\n", QEMU_ARCH_ALL)
2901
blueswir15824d652009-03-28 06:44:27 +00002902STEXI
Markus Armbruster44743142017-10-02 16:03:04 +02002903@item -iscsi
2904@findex -iscsi
2905Configure iSCSI session parameters.
2906ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002907SRST
2908``-iscsi``
2909 Configure iSCSI session parameters.
2910ERST
Markus Armbruster44743142017-10-02 16:03:04 +02002911
2912STEXI
blueswir15824d652009-03-28 06:44:27 +00002913@end table
2914ETEXI
blueswir15824d652009-03-28 06:44:27 +00002915DEFHEADING()
2916
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002917DEFHEADING(USB options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002918STEXI
2919@table @option
2920ETEXI
2921
2922DEF("usb", 0, QEMU_OPTION_usb,
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01002923 "-usb enable on-board USB host controller (if not enabled by default)\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002924 QEMU_ARCH_ALL)
2925STEXI
2926@item -usb
2927@findex -usb
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01002928Enable USB emulation on machine types with an on-board USB host controller (if
2929not enabled by default). Note that on-board USB host controllers may not
2930support USB 3.0. In this case @option{-device qemu-xhci} can be used instead
2931on machines with PCI.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002932ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002933SRST
2934``-usb``
2935 Enable USB emulation on machine types with an on-board USB host
2936 controller (if not enabled by default). Note that on-board USB host
2937 controllers may not support USB 3.0. In this case
2938 ``-device qemu-xhci`` can be used instead on machines with PCI.
2939ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002940
2941DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
2942 "-usbdevice name add the host or guest USB device 'name'\n",
2943 QEMU_ARCH_ALL)
2944STEXI
2945
2946@item -usbdevice @var{devname}
2947@findex -usbdevice
Thomas Hutha358a3a2017-05-19 08:35:16 +02002948Add the USB device @var{devname}. Note that this option is deprecated,
2949please use @code{-device usb-...} instead. @xref{usb_devices}.
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002950
2951@table @option
2952
2953@item mouse
2954Virtual Mouse. This will override the PS/2 mouse emulation when activated.
2955
2956@item tablet
2957Pointer device that uses absolute coordinates (like a touchscreen). This
2958means QEMU is able to report the mouse position without having to grab the
2959mouse. Also overrides the PS/2 mouse emulation when activated.
2960
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002961@item braille
2962Braille device. This will use BrlAPI to display the braille output on a real
2963or fake device.
2964
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002965@end table
2966ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002967SRST
2968``-usbdevice devname``
2969 Add the USB device devname. Note that this option is deprecated,
2970 please use ``-device usb-...`` instead. See
2971 :ref:`usb_005fdevices`.
2972
2973 ``mouse``
2974 Virtual Mouse. This will override the PS/2 mouse emulation when
2975 activated.
2976
2977 ``tablet``
2978 Pointer device that uses absolute coordinates (like a
2979 touchscreen). This means QEMU is able to report the mouse
2980 position without having to grab the mouse. Also overrides the
2981 PS/2 mouse emulation when activated.
2982
2983 ``braille``
2984 Braille device. This will use BrlAPI to display the braille
2985 output on a real or fake device.
2986ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002987
2988STEXI
2989@end table
2990ETEXI
2991DEFHEADING()
2992
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002993DEFHEADING(Display options:)
blueswir15824d652009-03-28 06:44:27 +00002994STEXI
2995@table @option
2996ETEXI
2997
Jes Sorensen1472a952011-03-16 13:33:31 +01002998DEF("display", HAS_ARG, QEMU_OPTION_display,
Thomas Huth88b40c62019-10-23 14:01:28 +02002999#if defined(CONFIG_SPICE)
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01003000 "-display spice-app[,gl=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02003001#endif
3002#if defined(CONFIG_SDL)
3003 "-display sdl[,alt_grab=on|off][,ctrl_grab=on|off]\n"
Elie Tournier4867e472018-04-13 14:58:42 +01003004 " [,window_close=on|off][,gl=on|core|es|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02003005#endif
Robert Hof04ec5a2016-07-26 18:17:11 +08003006#if defined(CONFIG_GTK)
Thomas Huth88b40c62019-10-23 14:01:28 +02003007 "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n"
3008#endif
3009#if defined(CONFIG_VNC)
3010 "-display vnc=<display>[,<optargs>]\n"
3011#endif
3012#if defined(CONFIG_CURSES)
3013 "-display curses[,charset=<encoding>]\n"
3014#endif
3015#if defined(CONFIG_OPENGL)
3016 "-display egl-headless[,rendernode=<file>]\n"
3017#endif
3018 "-display none\n"
3019 " select display backend type\n"
3020 " The default display is equivalent to\n "
3021#if defined(CONFIG_GTK)
3022 "\"-display gtk\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003023#elif defined(CONFIG_SDL)
Thomas Huth88b40c62019-10-23 14:01:28 +02003024 "\"-display sdl\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003025#elif defined(CONFIG_COCOA)
Thomas Huth88b40c62019-10-23 14:01:28 +02003026 "\"-display cocoa\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003027#elif defined(CONFIG_VNC)
Thomas Huth88b40c62019-10-23 14:01:28 +02003028 "\"-vnc localhost:0,to=99,id=default\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003029#else
Thomas Huth88b40c62019-10-23 14:01:28 +02003030 "\"-display none\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08003031#endif
3032 , QEMU_ARCH_ALL)
Jes Sorensen1472a952011-03-16 13:33:31 +01003033STEXI
3034@item -display @var{type}
3035@findex -display
3036Select type of display to use. This option is a replacement for the
Thomas Huthc388f402020-01-08 15:47:02 +01003037old style -sdl/-curses/... options. Use @code{-display help} to list
3038the available display types. Valid values for @var{type} are
Jes Sorensen1472a952011-03-16 13:33:31 +01003039@table @option
3040@item sdl
3041Display video output via SDL (usually in a separate graphics
3042window; see the SDL documentation for other possibilities).
3043@item curses
3044Display video output via curses. For graphics device models which
3045support a text mode, QEMU can display this output using a
3046curses/ncurses interface. Nothing is displayed when the graphics
3047device is in graphical mode or if the graphics device does not support
3048a text mode. Generally only the VGA device models support text mode.
Samuel Thibault2f8b7cd2019-03-11 14:51:27 +01003049The font charset used by the guest can be specified with the
3050@code{charset} option, for example @code{charset=CP850} for IBM CP850
3051encoding. The default is @code{CP437}.
Jes Sorensen4171d322011-03-16 13:33:32 +01003052@item none
3053Do not display video output. The guest will still see an emulated
3054graphics card, but its output will not be displayed to the QEMU
3055user. This option differs from the -nographic option in that it
3056only affects what is done with video output; -nographic also changes
3057the destination of the serial and parallel port data.
Jan Kiszka881249c2014-03-12 08:33:50 +01003058@item gtk
3059Display video output in a GTK window. This interface provides drop-down
3060menus and other UI elements to configure and control the VM during
3061runtime.
Jes Sorensen3264ff12011-03-16 13:33:33 +01003062@item vnc
3063Start a VNC server on display <arg>
Erik Skultety144aaa92018-11-16 11:14:44 +01003064@item egl-headless
3065Offload all OpenGL operations to a local DRI device. For any graphical display,
3066this display needs to be paired with either VNC or SPICE displays.
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01003067@item spice-app
3068Start QEMU as a Spice server and launch the default Spice client
3069application. The Spice server will redirect the serial consoles and
3070QEMU monitors. (Since 4.0)
Jes Sorensen1472a952011-03-16 13:33:31 +01003071@end table
3072ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003073SRST
3074``-display type``
3075 Select type of display to use. This option is a replacement for the
3076 old style -sdl/-curses/... options. Use ``-display help`` to list
3077 the available display types. Valid values for type are
3078
3079 ``sdl``
3080 Display video output via SDL (usually in a separate graphics
3081 window; see the SDL documentation for other possibilities).
3082
3083 ``curses``
3084 Display video output via curses. For graphics device models
3085 which support a text mode, QEMU can display this output using a
3086 curses/ncurses interface. Nothing is displayed when the graphics
3087 device is in graphical mode or if the graphics device does not
3088 support a text mode. Generally only the VGA device models
3089 support text mode. The font charset used by the guest can be
3090 specified with the ``charset`` option, for example
3091 ``charset=CP850`` for IBM CP850 encoding. The default is
3092 ``CP437``.
3093
3094 ``none``
3095 Do not display video output. The guest will still see an
3096 emulated graphics card, but its output will not be displayed to
3097 the QEMU user. This option differs from the -nographic option in
3098 that it only affects what is done with video output; -nographic
3099 also changes the destination of the serial and parallel port
3100 data.
3101
3102 ``gtk``
3103 Display video output in a GTK window. This interface provides
3104 drop-down menus and other UI elements to configure and control
3105 the VM during runtime.
3106
3107 ``vnc``
3108 Start a VNC server on display <arg>
3109
3110 ``egl-headless``
3111 Offload all OpenGL operations to a local DRI device. For any
3112 graphical display, this display needs to be paired with either
3113 VNC or SPICE displays.
3114
3115 ``spice-app``
3116 Start QEMU as a Spice server and launch the default Spice client
3117 application. The Spice server will redirect the serial consoles
3118 and QEMU monitors. (Since 4.0)
3119ERST
Jes Sorensen1472a952011-03-16 13:33:31 +01003120
blueswir15824d652009-03-28 06:44:27 +00003121DEF("nographic", 0, QEMU_OPTION_nographic,
Blue Swirlad960902010-03-29 19:23:52 +00003122 "-nographic disable graphical output and redirect serial I/Os to console\n",
3123 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003124STEXI
3125@item -nographic
Stefan Weil6616b2a2010-02-05 23:52:05 +01003126@findex -nographic
Colin Lorddc0a3e42016-08-12 15:30:48 -04003127Normally, if QEMU is compiled with graphical window support, it displays
3128output such as guest graphics, guest console, and the QEMU monitor in a
3129window. With this option, you can totally disable graphical output so
3130that QEMU is a simple command line application. The emulated serial port
3131is redirected on the console and muxed with the monitor (unless
3132redirected elsewhere explicitly). Therefore, you can still use QEMU to
3133debug a Linux kernel with a serial console. Use @key{C-a h} for help on
3134switching between the console and monitor.
blueswir15824d652009-03-28 06:44:27 +00003135ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003136SRST
3137``-nographic``
3138 Normally, if QEMU is compiled with graphical window support, it
3139 displays output such as guest graphics, guest console, and the QEMU
3140 monitor in a window. With this option, you can totally disable
3141 graphical output so that QEMU is a simple command line application.
3142 The emulated serial port is redirected on the console and muxed with
3143 the monitor (unless redirected elsewhere explicitly). Therefore, you
3144 can still use QEMU to debug a Linux kernel with a serial console.
3145 Use C-a h for help on switching between the console and monitor.
3146ERST
blueswir15824d652009-03-28 06:44:27 +00003147
blueswir15824d652009-03-28 06:44:27 +00003148DEF("curses", 0, QEMU_OPTION_curses,
Robert Hof04ec5a2016-07-26 18:17:11 +08003149 "-curses shorthand for -display curses\n",
Blue Swirlad960902010-03-29 19:23:52 +00003150 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003151STEXI
3152@item -curses
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01003153@findex -curses
Colin Lorddc0a3e42016-08-12 15:30:48 -04003154Normally, if QEMU is compiled with graphical window support, it displays
3155output such as guest graphics, guest console, and the QEMU monitor in a
3156window. With this option, QEMU can display the VGA output when in text
3157mode using a curses/ncurses interface. Nothing is displayed in graphical
3158mode.
blueswir15824d652009-03-28 06:44:27 +00003159ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003160SRST
3161``-curses``
3162 Normally, if QEMU is compiled with graphical window support, it
3163 displays output such as guest graphics, guest console, and the QEMU
3164 monitor in a window. With this option, QEMU can display the VGA
3165 output when in text mode using a curses/ncurses interface. Nothing
3166 is displayed in graphical mode.
3167ERST
blueswir15824d652009-03-28 06:44:27 +00003168
blueswir15824d652009-03-28 06:44:27 +00003169DEF("alt-grab", 0, QEMU_OPTION_alt_grab,
Blue Swirlad960902010-03-29 19:23:52 +00003170 "-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n",
3171 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003172STEXI
3173@item -alt-grab
Stefan Weil6616b2a2010-02-05 23:52:05 +01003174@findex -alt-grab
Brad Hardsde1db2a2011-04-29 21:46:12 +10003175Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that this also
3176affects the special keys (for fullscreen, monitor-mode switching, etc).
blueswir15824d652009-03-28 06:44:27 +00003177ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003178SRST
3179``-alt-grab``
3180 Use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt). Note that
3181 this also affects the special keys (for fullscreen, monitor-mode
3182 switching, etc).
3183ERST
blueswir15824d652009-03-28 06:44:27 +00003184
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003185DEF("ctrl-grab", 0, QEMU_OPTION_ctrl_grab,
Blue Swirlad960902010-03-29 19:23:52 +00003186 "-ctrl-grab use Right-Ctrl to grab mouse (instead of Ctrl-Alt)\n",
3187 QEMU_ARCH_ALL)
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003188STEXI
3189@item -ctrl-grab
Stefan Weil6616b2a2010-02-05 23:52:05 +01003190@findex -ctrl-grab
Brad Hardsde1db2a2011-04-29 21:46:12 +10003191Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this also
3192affects the special keys (for fullscreen, monitor-mode switching, etc).
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003193ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003194SRST
3195``-ctrl-grab``
3196 Use Right-Ctrl to grab mouse (instead of Ctrl-Alt). Note that this
3197 also affects the special keys (for fullscreen, monitor-mode
3198 switching, etc).
3199ERST
Dustin Kirkland0ca9f8a2009-09-17 15:48:04 -05003200
blueswir15824d652009-03-28 06:44:27 +00003201DEF("no-quit", 0, QEMU_OPTION_no_quit,
Blue Swirlad960902010-03-29 19:23:52 +00003202 "-no-quit disable SDL window close capability\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003203STEXI
3204@item -no-quit
Stefan Weil6616b2a2010-02-05 23:52:05 +01003205@findex -no-quit
blueswir15824d652009-03-28 06:44:27 +00003206Disable SDL window close capability.
3207ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003208SRST
3209``-no-quit``
3210 Disable SDL window close capability.
3211ERST
blueswir15824d652009-03-28 06:44:27 +00003212
blueswir15824d652009-03-28 06:44:27 +00003213DEF("sdl", 0, QEMU_OPTION_sdl,
Robert Hof04ec5a2016-07-26 18:17:11 +08003214 "-sdl shorthand for -display sdl\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003215STEXI
3216@item -sdl
Stefan Weil6616b2a2010-02-05 23:52:05 +01003217@findex -sdl
blueswir15824d652009-03-28 06:44:27 +00003218Enable SDL.
3219ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003220SRST
3221``-sdl``
3222 Enable SDL.
3223ERST
blueswir15824d652009-03-28 06:44:27 +00003224
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003225DEF("spice", HAS_ARG, QEMU_OPTION_spice,
Yonit Halperin27af7782012-08-21 13:54:20 +03003226 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
3227 " [,x509-key-file=<file>][,x509-key-password=<file>]\n"
3228 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
Marc-André Lureaufe4831b2015-01-13 17:57:51 +01003229 " [,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6|unix]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03003230 " [,tls-ciphers=<list>]\n"
3231 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n"
3232 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n"
3233 " [,sasl][,password=<secret>][,disable-ticketing]\n"
3234 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n"
3235 " [,jpeg-wan-compression=[auto|never|always]]\n"
3236 " [,zlib-glz-wan-compression=[auto|never|always]]\n"
3237 " [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
Hans de Goede5ad24e52013-06-08 15:37:27 +02003238 " [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
3239 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
Marc-André Lureau7b525502017-02-12 15:21:18 +04003240 " [,gl=[on|off]][,rendernode=<file>]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03003241 " enable spice\n"
3242 " at least one of {port, tls-port} is mandatory\n",
3243 QEMU_ARCH_ALL)
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003244STEXI
3245@item -spice @var{option}[,@var{option}[,...]]
3246@findex -spice
3247Enable the spice remote desktop protocol. Valid options are
3248
3249@table @option
3250
3251@item port=<nr>
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003252Set the TCP port spice is listening on for plaintext channels.
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003253
Gerd Hoffmann333b0ee2010-08-27 14:29:16 +02003254@item addr=<addr>
3255Set the IP address spice is listening on. Default is any address.
3256
3257@item ipv4
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003258@itemx ipv6
3259@itemx unix
Gerd Hoffmann333b0ee2010-08-27 14:29:16 +02003260Force using the specified IP version.
3261
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003262@item password=<secret>
3263Set the password you need to authenticate.
3264
Marc-André Lureau48b3ed02011-05-17 10:40:33 +02003265@item sasl
3266Require that the client use SASL to authenticate with the spice.
3267The exact choice of authentication method used is controlled from the
3268system / user's SASL configuration file for the 'qemu' service. This
3269is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3270unprivileged user, an environment variable SASL_CONF_PATH can be used
3271to make it search alternate locations for the service config.
3272While some SASL auth methods can also provide data encryption (eg GSSAPI),
3273it is recommended that SASL always be combined with the 'tls' and
3274'x509' settings to enable use of SSL and server certificates. This
3275ensures a data encryption preventing compromise of authentication
3276credentials.
3277
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003278@item disable-ticketing
3279Allow client connects without authentication.
3280
Hans de Goeded4970b02011-03-27 16:43:54 +02003281@item disable-copy-paste
3282Disable copy paste between the client and the guest.
3283
Hans de Goede5ad24e52013-06-08 15:37:27 +02003284@item disable-agent-file-xfer
3285Disable spice-vdagent based file-xfer between the client and the guest.
3286
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003287@item tls-port=<nr>
3288Set the TCP port spice is listening on for encrypted channels.
3289
3290@item x509-dir=<dir>
3291Set the x509 file directory. Expects same filenames as -vnc $display,x509=$dir
3292
3293@item x509-key-file=<file>
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003294@itemx x509-key-password=<file>
3295@itemx x509-cert-file=<file>
3296@itemx x509-cacert-file=<file>
3297@itemx x509-dh-key-file=<file>
Gerd Hoffmannc448e852010-03-11 11:13:32 -03003298The x509 file names can also be configured individually.
3299
3300@item tls-ciphers=<list>
3301Specify which ciphers to use.
3302
Alon Levyd70d6b32011-12-20 13:05:18 +02003303@item tls-channel=[main|display|cursor|inputs|record|playback]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003304@itemx plaintext-channel=[main|display|cursor|inputs|record|playback]
Gerd Hoffmann17b6dea2010-08-27 14:09:56 +02003305Force specific channel to be used with or without TLS encryption. The
3306options can be specified multiple times to configure multiple
3307channels. The special name "default" can be used to set the default
3308mode. For channels which are not explicitly forced into one mode the
3309spice client is allowed to pick tls/plaintext as he pleases.
3310
Yonit Halperin9f04e092010-07-14 13:26:34 +03003311@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
3312Configure image compression (lossless).
3313Default is auto_glz.
3314
3315@item jpeg-wan-compression=[auto|never|always]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02003316@itemx zlib-glz-wan-compression=[auto|never|always]
Yonit Halperin9f04e092010-07-14 13:26:34 +03003317Configure wan image compression (lossy for slow links).
3318Default is auto.
3319
Gerd Hoffmann84a23f22010-08-30 16:36:53 +02003320@item streaming-video=[off|all|filter]
Li Zhijian93ca5192016-08-01 12:06:59 +08003321Configure video stream detection. Default is off.
Gerd Hoffmann84a23f22010-08-30 16:36:53 +02003322
3323@item agent-mouse=[on|off]
3324Enable/disable passing mouse events via vdagent. Default is on.
3325
3326@item playback-compression=[on|off]
3327Enable/disable audio stream compression (using celt 0.5.1). Default is on.
3328
Yonit Halperin8c957052012-08-21 11:51:59 +03003329@item seamless-migration=[on|off]
3330Enable/disable spice seamless migration. Default is off.
3331
Gerd Hoffmann474114b2015-10-13 15:39:34 +02003332@item gl=[on|off]
3333Enable/disable OpenGL context. Default is off.
3334
Marc-André Lureau7b525502017-02-12 15:21:18 +04003335@item rendernode=<file>
3336DRM render node for OpenGL rendering. If not specified, it will pick
3337the first available. (Since 2.9)
3338
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003339@end table
3340ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003341SRST
3342``-spice option[,option[,...]]``
3343 Enable the spice remote desktop protocol. Valid options are
3344
3345 ``port=<nr>``
3346 Set the TCP port spice is listening on for plaintext channels.
3347
3348 ``addr=<addr>``
3349 Set the IP address spice is listening on. Default is any
3350 address.
3351
3352 ``ipv4``; \ ``ipv6``; \ ``unix``
3353 Force using the specified IP version.
3354
3355 ``password=<secret>``
3356 Set the password you need to authenticate.
3357
3358 ``sasl``
3359 Require that the client use SASL to authenticate with the spice.
3360 The exact choice of authentication method used is controlled
3361 from the system / user's SASL configuration file for the 'qemu'
3362 service. This is typically found in /etc/sasl2/qemu.conf. If
3363 running QEMU as an unprivileged user, an environment variable
3364 SASL\_CONF\_PATH can be used to make it search alternate
3365 locations for the service config. While some SASL auth methods
3366 can also provide data encryption (eg GSSAPI), it is recommended
3367 that SASL always be combined with the 'tls' and 'x509' settings
3368 to enable use of SSL and server certificates. This ensures a
3369 data encryption preventing compromise of authentication
3370 credentials.
3371
3372 ``disable-ticketing``
3373 Allow client connects without authentication.
3374
3375 ``disable-copy-paste``
3376 Disable copy paste between the client and the guest.
3377
3378 ``disable-agent-file-xfer``
3379 Disable spice-vdagent based file-xfer between the client and the
3380 guest.
3381
3382 ``tls-port=<nr>``
3383 Set the TCP port spice is listening on for encrypted channels.
3384
3385 ``x509-dir=<dir>``
3386 Set the x509 file directory. Expects same filenames as -vnc
3387 $display,x509=$dir
3388
3389 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>``
3390 The x509 file names can also be configured individually.
3391
3392 ``tls-ciphers=<list>``
3393 Specify which ciphers to use.
3394
3395 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]``
3396 Force specific channel to be used with or without TLS
3397 encryption. The options can be specified multiple times to
3398 configure multiple channels. The special name "default" can be
3399 used to set the default mode. For channels which are not
3400 explicitly forced into one mode the spice client is allowed to
3401 pick tls/plaintext as he pleases.
3402
3403 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]``
3404 Configure image compression (lossless). Default is auto\_glz.
3405
3406 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]``
3407 Configure wan image compression (lossy for slow links). Default
3408 is auto.
3409
3410 ``streaming-video=[off|all|filter]``
3411 Configure video stream detection. Default is off.
3412
3413 ``agent-mouse=[on|off]``
3414 Enable/disable passing mouse events via vdagent. Default is on.
3415
3416 ``playback-compression=[on|off]``
3417 Enable/disable audio stream compression (using celt 0.5.1).
3418 Default is on.
3419
3420 ``seamless-migration=[on|off]``
3421 Enable/disable spice seamless migration. Default is off.
3422
3423 ``gl=[on|off]``
3424 Enable/disable OpenGL context. Default is off.
3425
3426 ``rendernode=<file>``
3427 DRM render node for OpenGL rendering. If not specified, it will
3428 pick the first available. (Since 2.9)
3429ERST
Gerd Hoffmann29b00402010-03-11 11:13:27 -03003430
blueswir15824d652009-03-28 06:44:27 +00003431DEF("portrait", 0, QEMU_OPTION_portrait,
Blue Swirlad960902010-03-29 19:23:52 +00003432 "-portrait rotate graphical output 90 deg left (only PXA LCD)\n",
3433 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003434STEXI
3435@item -portrait
Stefan Weil6616b2a2010-02-05 23:52:05 +01003436@findex -portrait
blueswir15824d652009-03-28 06:44:27 +00003437Rotate graphical output 90 deg left (only PXA LCD).
3438ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003439SRST
3440``-portrait``
3441 Rotate graphical output 90 deg left (only PXA LCD).
3442ERST
blueswir15824d652009-03-28 06:44:27 +00003443
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003444DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
3445 "-rotate <deg> rotate graphical output some deg left (only PXA LCD)\n",
3446 QEMU_ARCH_ALL)
3447STEXI
Markus Armbruster6265c432013-02-13 19:49:39 +01003448@item -rotate @var{deg}
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003449@findex -rotate
3450Rotate graphical output some deg left (only PXA LCD).
3451ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003452SRST
3453``-rotate deg``
3454 Rotate graphical output some deg left (only PXA LCD).
3455ERST
Vasily Khoruzhick93128052011-06-17 13:04:36 +03003456
blueswir15824d652009-03-28 06:44:27 +00003457DEF("vga", HAS_ARG, QEMU_OPTION_vga,
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02003458 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
Blue Swirlad960902010-03-29 19:23:52 +00003459 " select video card type\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003460STEXI
malce4558dc2012-08-27 18:33:21 +04003461@item -vga @var{type}
Stefan Weil6616b2a2010-02-05 23:52:05 +01003462@findex -vga
blueswir15824d652009-03-28 06:44:27 +00003463Select type of VGA card to emulate. Valid values for @var{type} are
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003464@table @option
blueswir15824d652009-03-28 06:44:27 +00003465@item cirrus
3466Cirrus Logic GD5446 Video card. All Windows versions starting from
3467Windows 95 should recognize and use this graphic card. For optimal
3468performances, use 16 bit color depth in the guest and the host OS.
Alberto Garcia41eeb0e2017-01-27 11:41:54 +02003469(This card was the default before QEMU 2.2)
blueswir15824d652009-03-28 06:44:27 +00003470@item std
3471Standard VGA card with Bochs VBE extensions. If your guest OS
3472supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if you want
3473to use high resolution modes (>= 1280x1024x16) then you should use
Alberto Garcia41eeb0e2017-01-27 11:41:54 +02003474this option. (This card is the default since QEMU 2.2)
blueswir15824d652009-03-28 06:44:27 +00003475@item vmware
3476VMWare SVGA-II compatible adapter. Use it if you have sufficiently
3477recent XFree86/XOrg server or Windows guest with a driver for this
3478card.
Gerd Hoffmanna19cbfb2010-04-27 11:50:11 +02003479@item qxl
3480QXL paravirtual graphic card. It is VGA compatible (including VESA
34812.0 VBE support). Works best with qxl guest drivers installed though.
3482Recommended choice when using the spice protocol.
Mark Cave-Ayland33632782014-03-17 21:46:25 +00003483@item tcx
3484(sun4m only) Sun TCX framebuffer. This is the default framebuffer for
3485sun4m machines and offers both 8-bit and 24-bit colour depths at a
3486fixed resolution of 1024x768.
3487@item cg3
3488(sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
3489for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
3490resolutions aimed at people wishing to run older Solaris versions.
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02003491@item virtio
3492Virtio VGA card.
blueswir15824d652009-03-28 06:44:27 +00003493@item none
3494Disable VGA card.
3495@end table
3496ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003497SRST
3498``-vga type``
3499 Select type of VGA card to emulate. Valid values for type are
3500
3501 ``cirrus``
3502 Cirrus Logic GD5446 Video card. All Windows versions starting
3503 from Windows 95 should recognize and use this graphic card. For
3504 optimal performances, use 16 bit color depth in the guest and
3505 the host OS. (This card was the default before QEMU 2.2)
3506
3507 ``std``
3508 Standard VGA card with Bochs VBE extensions. If your guest OS
3509 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
3510 you want to use high resolution modes (>= 1280x1024x16) then you
3511 should use this option. (This card is the default since QEMU
3512 2.2)
3513
3514 ``vmware``
3515 VMWare SVGA-II compatible adapter. Use it if you have
3516 sufficiently recent XFree86/XOrg server or Windows guest with a
3517 driver for this card.
3518
3519 ``qxl``
3520 QXL paravirtual graphic card. It is VGA compatible (including
3521 VESA 2.0 VBE support). Works best with qxl guest drivers
3522 installed though. Recommended choice when using the spice
3523 protocol.
3524
3525 ``tcx``
3526 (sun4m only) Sun TCX framebuffer. This is the default
3527 framebuffer for sun4m machines and offers both 8-bit and 24-bit
3528 colour depths at a fixed resolution of 1024x768.
3529
3530 ``cg3``
3531 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
3532 framebuffer for sun4m machines available in both 1024x768
3533 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
3534 wishing to run older Solaris versions.
3535
3536 ``virtio``
3537 Virtio VGA card.
3538
3539 ``none``
3540 Disable VGA card.
3541ERST
blueswir15824d652009-03-28 06:44:27 +00003542
3543DEF("full-screen", 0, QEMU_OPTION_full_screen,
Blue Swirlad960902010-03-29 19:23:52 +00003544 "-full-screen start in full screen\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003545STEXI
3546@item -full-screen
Stefan Weil6616b2a2010-02-05 23:52:05 +01003547@findex -full-screen
blueswir15824d652009-03-28 06:44:27 +00003548Start in full screen.
3549ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003550SRST
3551``-full-screen``
3552 Start in full screen.
3553ERST
blueswir15824d652009-03-28 06:44:27 +00003554
John Snow60f9a4e2020-02-04 11:56:38 -05003555DEF("g", HAS_ARG, QEMU_OPTION_g ,
Blue Swirlad960902010-03-29 19:23:52 +00003556 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
Laurent Vivier8ac919a2019-10-26 18:45:43 +02003557 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
blueswir15824d652009-03-28 06:44:27 +00003558STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01003559@item -g @var{width}x@var{height}[x@var{depth}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01003560@findex -g
Stefan Weil95d5f082010-01-20 22:25:27 +01003561Set the initial graphical resolution and depth (PPC, SPARC only).
Peter Maydell196afbb2020-02-28 15:36:10 +00003562
3563For PPC the default is 800x600x32.
3564
3565For SPARC with the TCX graphics device, the default is 1024x768x8 with the
3566option of 1024x768x24. For cgthree, the default is 1024x768x8 with the option
3567of 1152x900x8 for people who wish to use OBP.
3568
blueswir15824d652009-03-28 06:44:27 +00003569ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003570SRST
3571``-g widthxheight[xdepth]``
3572 Set the initial graphical resolution and depth (PPC, SPARC only).
3573
3574 For PPC the default is 800x600x32.
3575
3576 For SPARC with the TCX graphics device, the default is 1024x768x8
3577 with the option of 1024x768x24. For cgthree, the default is
3578 1024x768x8 with the option of 1152x900x8 for people who wish to use
3579 OBP.
3580ERST
blueswir15824d652009-03-28 06:44:27 +00003581
3582DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
Robert Hof04ec5a2016-07-26 18:17:11 +08003583 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00003584STEXI
3585@item -vnc @var{display}[,@var{option}[,@var{option}[,...]]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01003586@findex -vnc
Colin Lorddc0a3e42016-08-12 15:30:48 -04003587Normally, if QEMU is compiled with graphical window support, it displays
3588output such as guest graphics, guest console, and the QEMU monitor in a
3589window. With this option, you can have QEMU listen on VNC display
3590@var{display} and redirect the VGA display over the VNC session. It is
3591very useful to enable the usb tablet device when using this option
Thomas Hutha358a3a2017-05-19 08:35:16 +02003592(option @option{-device usb-tablet}). When using the VNC display, you
Colin Lorddc0a3e42016-08-12 15:30:48 -04003593must use the @option{-k} parameter to set the keyboard layout if you are
3594not using en-us. Valid syntax for the @var{display} is
blueswir15824d652009-03-28 06:44:27 +00003595
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003596@table @option
blueswir15824d652009-03-28 06:44:27 +00003597
Robert Ho99a9a522016-05-31 15:03:09 +08003598@item to=@var{L}
3599
3600With this option, QEMU will try next available VNC @var{display}s, until the
3601number @var{L}, if the origianlly defined "-vnc @var{display}" is not
3602available, e.g. port 5900+@var{display} is already used by another
3603application. By default, to=0.
3604
blueswir15824d652009-03-28 06:44:27 +00003605@item @var{host}:@var{d}
3606
3607TCP connections will only be allowed from @var{host} on display @var{d}.
3608By convention the TCP port is 5900+@var{d}. Optionally, @var{host} can
3609be omitted in which case the server will accept connections from any host.
3610
Kevin Wolf4e257e52009-10-09 10:58:36 +02003611@item unix:@var{path}
blueswir15824d652009-03-28 06:44:27 +00003612
3613Connections will be allowed over UNIX domain sockets where @var{path} is the
3614location of a unix socket to listen for connections on.
3615
3616@item none
3617
3618VNC is initialized but not started. The monitor @code{change} command
3619can be used to later start the VNC server.
3620
3621@end table
3622
3623Following the @var{display} value there may be one or more @var{option} flags
3624separated by commas. Valid options are
3625
Kevin Wolfb3f046c2009-10-09 10:58:35 +02003626@table @option
blueswir15824d652009-03-28 06:44:27 +00003627
3628@item reverse
3629
3630Connect to a listening VNC client via a ``reverse'' connection. The
3631client is specified by the @var{display}. For reverse network
3632connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument
3633is a TCP port number, not a display number.
3634
Tim Hardeck7536ee42013-01-21 11:04:44 +01003635@item websocket
3636
3637Opens an additional TCP listening port dedicated to VNC Websocket connections.
Daniel P. Berrange275e0d62017-02-03 12:06:45 +00003638If a bare @var{websocket} option is given, the Websocket port is
36395700+@var{display}. An alternative port can be specified with the
3640syntax @code{websocket}=@var{port}.
3641
3642If @var{host} is specified connections will only be allowed from this host.
3643It is possible to control the websocket listen address independently, using
3644the syntax @code{websocket}=@var{host}:@var{port}.
3645
Daniel P. Berrange3e305e42015-08-06 14:39:32 +01003646If no TLS credentials are provided, the websocket connection runs in
3647unencrypted mode. If TLS credentials are provided, the websocket connection
3648requires encrypted client connections.
Tim Hardeck7536ee42013-01-21 11:04:44 +01003649
blueswir15824d652009-03-28 06:44:27 +00003650@item password
3651
3652Require that password based authentication is used for client connections.
Michal Novotny86ee5bc2012-07-16 15:54:38 +02003653
3654The password must be set separately using the @code{set_password} command in
3655the @ref{pcsys_monitor}. The syntax to change your password is:
3656@code{set_password <protocol> <password>} where <protocol> could be either
3657"vnc" or "spice".
3658
3659If you would like to change <protocol> password expiration, you should use
3660@code{expire_password <protocol> <expiration-time>} where expiration time could
3661be one of the following options: now, never, +seconds or UNIX time of
3662expiration, e.g. +60 to make password expire in 60 seconds, or 1335196800
3663to make password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for this
3664date and time).
3665
3666You can also use keywords "now" or "never" for the expiration time to
3667allow <protocol> password to expire immediately or never expire.
blueswir15824d652009-03-28 06:44:27 +00003668
Daniel P. Berrange3e305e42015-08-06 14:39:32 +01003669@item tls-creds=@var{ID}
3670
3671Provides the ID of a set of TLS credentials to use to secure the
3672VNC server. They will apply to both the normal VNC server socket
3673and the websocket socket (if enabled). Setting TLS credentials
3674will cause the VNC server socket to enable the VeNCrypt auth
3675mechanism. The credentials should have been previously created
3676using the @option{-object tls-creds} argument.
3677
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003678@item tls-authz=@var{ID}
3679
3680Provides the ID of the QAuthZ authorization object against which
3681the client's x509 distinguished name will validated. This object is
3682only resolved at time of use, so can be deleted and recreated on the
3683fly while the VNC server is active. If missing, it will default
3684to denying access.
3685
blueswir15824d652009-03-28 06:44:27 +00003686@item sasl
3687
3688Require that the client use SASL to authenticate with the VNC server.
3689The exact choice of authentication method used is controlled from the
3690system / user's SASL configuration file for the 'qemu' service. This
3691is typically found in /etc/sasl2/qemu.conf. If running QEMU as an
3692unprivileged user, an environment variable SASL_CONF_PATH can be used
3693to make it search alternate locations for the service config.
3694While some SASL auth methods can also provide data encryption (eg GSSAPI),
3695it is recommended that SASL always be combined with the 'tls' and
3696'x509' settings to enable use of SSL and server certificates. This
3697ensures a data encryption preventing compromise of authentication
3698credentials. See the @ref{vnc_security} section for details on using
3699SASL authentication.
3700
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003701@item sasl-authz=@var{ID}
3702
3703Provides the ID of the QAuthZ authorization object against which
3704the client's SASL username will validated. This object is
3705only resolved at time of use, so can be deleted and recreated on the
3706fly while the VNC server is active. If missing, it will default
3707to denying access.
3708
blueswir15824d652009-03-28 06:44:27 +00003709@item acl
3710
Daniel P. Berrange55cf09a2019-02-27 14:57:54 +00003711Legacy method for enabling authorization of clients against the
3712x509 distinguished name and SASL username. It results in the creation
3713of two @code{authz-list} objects with IDs of @code{vnc.username} and
3714@code{vnc.x509dname}. The rules for these objects must be configured
3715with the HMP ACL commands.
3716
3717This option is deprecated and should no longer be used. The new
3718@option{sasl-authz} and @option{tls-authz} options are a
3719replacement.
blueswir15824d652009-03-28 06:44:27 +00003720
Corentin Chary6f9c78c2010-07-07 20:57:51 +02003721@item lossy
3722
3723Enable lossy compression methods (gradient, JPEG, ...). If this
3724option is set, VNC client may receive lossy framebuffer updates
3725depending on its encoding settings. Enabling this option can save
3726a lot of bandwidth at the expense of quality.
3727
Corentin Chary80e0c8c2011-02-04 09:06:08 +01003728@item non-adaptive
3729
3730Disable adaptive encodings. Adaptive encodings are enabled by default.
3731An adaptive encoding will try to detect frequently updated screen regions,
3732and send updates in these regions using a lossy encoding (like JPEG).
Stefan Weil61cc8702011-04-13 22:45:22 +02003733This can be really helpful to save bandwidth when playing videos. Disabling
Michael Tokarev9d85d552014-04-07 13:34:58 +04003734adaptive encodings restores the original static behavior of encodings
Corentin Chary80e0c8c2011-02-04 09:06:08 +01003735like Tight.
3736
Gerd Hoffmann8cf36482011-11-24 18:10:49 +01003737@item share=[allow-exclusive|force-shared|ignore]
3738
3739Set display sharing policy. 'allow-exclusive' allows clients to ask
3740for exclusive access. As suggested by the rfb spec this is
3741implemented by dropping other connections. Connecting multiple
3742clients in parallel requires all clients asking for a shared session
3743(vncviewer: -shared switch). This is the default. 'force-shared'
3744disables exclusive client access. Useful for shared desktop sessions,
3745where you don't want someone forgetting specify -shared disconnect
3746everybody else. 'ignore' completely ignores the shared flag and
3747allows everybody connect unconditionally. Doesn't conform to the rfb
Stefan Weilb65ee4f2012-05-11 22:25:50 +02003748spec but is traditional QEMU behavior.
Gerd Hoffmann8cf36482011-11-24 18:10:49 +01003749
Gerd Hoffmannc5ce8332016-06-01 08:22:30 +02003750@item key-delay-ms
3751
3752Set keyboard delay, for key down and key up events, in milliseconds.
Alexander Grafd3b0db62017-07-12 14:43:45 +02003753Default is 10. Keyboards are low-bandwidth devices, so this slowdown
Gerd Hoffmannc5ce8332016-06-01 08:22:30 +02003754can help the device and guest to keep up and not lose events in case
3755events are arriving in bulk. Possible causes for the latter are flaky
3756network connections, or scripts for automated testing.
3757
Kővágó, Zoltánf0b9f362019-08-19 01:06:48 +02003758@item audiodev=@var{audiodev}
3759
3760Use the specified @var{audiodev} when the VNC client requests audio
3761transmission. When not using an -audiodev argument, this option must
3762be omitted, otherwise is must be present and specify a valid audiodev.
3763
blueswir15824d652009-03-28 06:44:27 +00003764@end table
3765ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003766SRST
3767``-vnc display[,option[,option[,...]]]``
3768 Normally, if QEMU is compiled with graphical window support, it
3769 displays output such as guest graphics, guest console, and the QEMU
3770 monitor in a window. With this option, you can have QEMU listen on
3771 VNC display display and redirect the VGA display over the VNC
3772 session. It is very useful to enable the usb tablet device when
3773 using this option (option ``-device usb-tablet``). When using the
3774 VNC display, you must use the ``-k`` parameter to set the keyboard
3775 layout if you are not using en-us. Valid syntax for the display is
3776
3777 ``to=L``
3778 With this option, QEMU will try next available VNC displays,
3779 until the number L, if the origianlly defined "-vnc display" is
3780 not available, e.g. port 5900+display is already used by another
3781 application. By default, to=0.
3782
3783 ``host:d``
3784 TCP connections will only be allowed from host on display d. By
3785 convention the TCP port is 5900+d. Optionally, host can be
3786 omitted in which case the server will accept connections from
3787 any host.
3788
3789 ``unix:path``
3790 Connections will be allowed over UNIX domain sockets where path
3791 is the location of a unix socket to listen for connections on.
3792
3793 ``none``
3794 VNC is initialized but not started. The monitor ``change``
3795 command can be used to later start the VNC server.
3796
3797 Following the display value there may be one or more option flags
3798 separated by commas. Valid options are
3799
3800 ``reverse``
3801 Connect to a listening VNC client via a "reverse" connection.
3802 The client is specified by the display. For reverse network
3803 connections (host:d,``reverse``), the d argument is a TCP port
3804 number, not a display number.
3805
3806 ``websocket``
3807 Opens an additional TCP listening port dedicated to VNC
3808 Websocket connections. If a bare websocket option is given, the
3809 Websocket port is 5700+display. An alternative port can be
3810 specified with the syntax ``websocket``\ =port.
3811
3812 If host is specified connections will only be allowed from this
3813 host. It is possible to control the websocket listen address
3814 independently, using the syntax ``websocket``\ =host:port.
3815
3816 If no TLS credentials are provided, the websocket connection
3817 runs in unencrypted mode. If TLS credentials are provided, the
3818 websocket connection requires encrypted client connections.
3819
3820 ``password``
3821 Require that password based authentication is used for client
3822 connections.
3823
3824 The password must be set separately using the ``set_password``
3825 command in the :ref:`pcsys_005fmonitor`. The
3826 syntax to change your password is:
3827 ``set_password <protocol> <password>`` where <protocol> could be
3828 either "vnc" or "spice".
3829
3830 If you would like to change <protocol> password expiration, you
3831 should use ``expire_password <protocol> <expiration-time>``
3832 where expiration time could be one of the following options:
3833 now, never, +seconds or UNIX time of expiration, e.g. +60 to
3834 make password expire in 60 seconds, or 1335196800 to make
3835 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for
3836 this date and time).
3837
3838 You can also use keywords "now" or "never" for the expiration
3839 time to allow <protocol> password to expire immediately or never
3840 expire.
3841
3842 ``tls-creds=ID``
3843 Provides the ID of a set of TLS credentials to use to secure the
3844 VNC server. They will apply to both the normal VNC server socket
3845 and the websocket socket (if enabled). Setting TLS credentials
3846 will cause the VNC server socket to enable the VeNCrypt auth
3847 mechanism. The credentials should have been previously created
3848 using the ``-object tls-creds`` argument.
3849
3850 ``tls-authz=ID``
3851 Provides the ID of the QAuthZ authorization object against which
3852 the client's x509 distinguished name will validated. This object
3853 is only resolved at time of use, so can be deleted and recreated
3854 on the fly while the VNC server is active. If missing, it will
3855 default to denying access.
3856
3857 ``sasl``
3858 Require that the client use SASL to authenticate with the VNC
3859 server. The exact choice of authentication method used is
3860 controlled from the system / user's SASL configuration file for
3861 the 'qemu' service. This is typically found in
3862 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user,
3863 an environment variable SASL\_CONF\_PATH can be used to make it
3864 search alternate locations for the service config. While some
3865 SASL auth methods can also provide data encryption (eg GSSAPI),
3866 it is recommended that SASL always be combined with the 'tls'
3867 and 'x509' settings to enable use of SSL and server
3868 certificates. This ensures a data encryption preventing
3869 compromise of authentication credentials. See the
3870 :ref:`vnc_005fsecurity` section for details on
3871 using SASL authentication.
3872
3873 ``sasl-authz=ID``
3874 Provides the ID of the QAuthZ authorization object against which
3875 the client's SASL username will validated. This object is only
3876 resolved at time of use, so can be deleted and recreated on the
3877 fly while the VNC server is active. If missing, it will default
3878 to denying access.
3879
3880 ``acl``
3881 Legacy method for enabling authorization of clients against the
3882 x509 distinguished name and SASL username. It results in the
3883 creation of two ``authz-list`` objects with IDs of
3884 ``vnc.username`` and ``vnc.x509dname``. The rules for these
3885 objects must be configured with the HMP ACL commands.
3886
3887 This option is deprecated and should no longer be used. The new
3888 ``sasl-authz`` and ``tls-authz`` options are a replacement.
3889
3890 ``lossy``
3891 Enable lossy compression methods (gradient, JPEG, ...). If this
3892 option is set, VNC client may receive lossy framebuffer updates
3893 depending on its encoding settings. Enabling this option can
3894 save a lot of bandwidth at the expense of quality.
3895
3896 ``non-adaptive``
3897 Disable adaptive encodings. Adaptive encodings are enabled by
3898 default. An adaptive encoding will try to detect frequently
3899 updated screen regions, and send updates in these regions using
3900 a lossy encoding (like JPEG). This can be really helpful to save
3901 bandwidth when playing videos. Disabling adaptive encodings
3902 restores the original static behavior of encodings like Tight.
3903
3904 ``share=[allow-exclusive|force-shared|ignore]``
3905 Set display sharing policy. 'allow-exclusive' allows clients to
3906 ask for exclusive access. As suggested by the rfb spec this is
3907 implemented by dropping other connections. Connecting multiple
3908 clients in parallel requires all clients asking for a shared
3909 session (vncviewer: -shared switch). This is the default.
3910 'force-shared' disables exclusive client access. Useful for
3911 shared desktop sessions, where you don't want someone forgetting
3912 specify -shared disconnect everybody else. 'ignore' completely
3913 ignores the shared flag and allows everybody connect
3914 unconditionally. Doesn't conform to the rfb spec but is
3915 traditional QEMU behavior.
3916
3917 ``key-delay-ms``
3918 Set keyboard delay, for key down and key up events, in
3919 milliseconds. Default is 10. Keyboards are low-bandwidth
3920 devices, so this slowdown can help the device and guest to keep
3921 up and not lose events in case events are arriving in bulk.
3922 Possible causes for the latter are flaky network connections, or
3923 scripts for automated testing.
3924
3925 ``audiodev=audiodev``
3926 Use the specified audiodev when the VNC client requests audio
3927 transmission. When not using an -audiodev argument, this option
3928 must be omitted, otherwise is must be present and specify a
3929 valid audiodev.
3930ERST
blueswir15824d652009-03-28 06:44:27 +00003931
3932STEXI
3933@end table
3934ETEXI
Michael Ellermana3adb7a2011-12-19 17:19:31 +11003935ARCHHEADING(, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003936
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003937ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003938STEXI
3939@table @option
3940ETEXI
3941
blueswir15824d652009-03-28 06:44:27 +00003942DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack,
Blue Swirlad960902010-03-29 19:23:52 +00003943 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n",
3944 QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003945STEXI
3946@item -win2k-hack
Stefan Weil6616b2a2010-02-05 23:52:05 +01003947@findex -win2k-hack
blueswir15824d652009-03-28 06:44:27 +00003948Use it when installing Windows 2000 to avoid a disk full bug. After
3949Windows 2000 is installed, you no longer need this option (this option
3950slows down the IDE transfers).
3951ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003952SRST
3953``-win2k-hack``
3954 Use it when installing Windows 2000 to avoid a disk full bug. After
3955 Windows 2000 is installed, you no longer need this option (this
3956 option slows down the IDE transfers).
3957ERST
blueswir15824d652009-03-28 06:44:27 +00003958
blueswir15824d652009-03-28 06:44:27 +00003959DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
Blue Swirlad960902010-03-29 19:23:52 +00003960 "-no-fd-bootchk disable boot signature checking for floppy disks\n",
3961 QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003962STEXI
3963@item -no-fd-bootchk
Stefan Weil6616b2a2010-02-05 23:52:05 +01003964@findex -no-fd-bootchk
Markus Armbruster4eda32f2013-06-14 13:15:06 +02003965Disable boot signature checking for floppy disks in BIOS. May
blueswir15824d652009-03-28 06:44:27 +00003966be needed to boot from old floppy disks.
3967ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003968SRST
3969``-no-fd-bootchk``
3970 Disable boot signature checking for floppy disks in BIOS. May be
3971 needed to boot from old floppy disks.
3972ERST
blueswir15824d652009-03-28 06:44:27 +00003973
blueswir15824d652009-03-28 06:44:27 +00003974DEF("no-acpi", 0, QEMU_OPTION_no_acpi,
Shannon Zhaof5d8c8c2015-05-29 11:28:54 +01003975 "-no-acpi disable ACPI\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM)
blueswir15824d652009-03-28 06:44:27 +00003976STEXI
3977@item -no-acpi
Stefan Weil6616b2a2010-02-05 23:52:05 +01003978@findex -no-acpi
blueswir15824d652009-03-28 06:44:27 +00003979Disable ACPI (Advanced Configuration and Power Interface) support. Use
3980it if your guest OS complains about ACPI problems (PC target machine
3981only).
3982ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003983SRST
3984``-no-acpi``
3985 Disable ACPI (Advanced Configuration and Power Interface) support.
3986 Use it if your guest OS complains about ACPI problems (PC target
3987 machine only).
3988ERST
blueswir15824d652009-03-28 06:44:27 +00003989
blueswir15824d652009-03-28 06:44:27 +00003990DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
Blue Swirlad960902010-03-29 19:23:52 +00003991 "-no-hpet disable HPET\n", QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00003992STEXI
3993@item -no-hpet
Stefan Weil6616b2a2010-02-05 23:52:05 +01003994@findex -no-hpet
blueswir15824d652009-03-28 06:44:27 +00003995Disable HPET support.
3996ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003997SRST
3998``-no-hpet``
3999 Disable HPET support.
4000ERST
blueswir15824d652009-03-28 06:44:27 +00004001
blueswir15824d652009-03-28 06:44:27 +00004002DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
Michael Tokarev104bf022011-05-12 18:44:17 +04004003 "-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 +00004004 " ACPI table description\n", QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00004005STEXI
4006@item -acpitable [sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}][,data=@var{file1}[:@var{file2}]...]
Stefan Weil6616b2a2010-02-05 23:52:05 +01004007@findex -acpitable
blueswir15824d652009-03-28 06:44:27 +00004008Add ACPI table with specified header fields and context from specified files.
Michael Tokarev104bf022011-05-12 18:44:17 +04004009For file=, take whole ACPI table from the specified files, including all
4010ACPI headers (possible overridden by other options).
4011For data=, only data
4012portion of the table is used, all header information is specified in the
4013command line.
Laszlo Ersekae123742016-01-18 15:12:13 +01004014If a SLIC table is supplied to QEMU, then the SLIC's oem_id and oem_table_id
4015fields will override the same in the RSDT and the FADT (a.k.a. FACP), in order
4016to ensure the field matches required by the Microsoft SLIC spec and the ACPI
4017spec.
blueswir15824d652009-03-28 06:44:27 +00004018ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004019SRST
4020``-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n] [,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]``
4021 Add ACPI table with specified header fields and context from
4022 specified files. For file=, take whole ACPI table from the specified
4023 files, including all ACPI headers (possible overridden by other
4024 options). For data=, only data portion of the table is used, all
4025 header information is specified in the command line. If a SLIC table
4026 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id
4027 fields will override the same in the RSDT and the FADT (a.k.a.
4028 FACP), in order to ensure the field matches required by the
4029 Microsoft SLIC spec and the ACPI spec.
4030ERST
blueswir15824d652009-03-28 06:44:27 +00004031
aliguorib6f6e3d2009-04-17 18:59:56 +00004032DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
4033 "-smbios file=binary\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004034 " load SMBIOS entry from binary file\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004035 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
4036 " [,uefi=on|off]\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004037 " specify SMBIOS type 0 fields\n"
aliguorib6f6e3d2009-04-17 18:59:56 +00004038 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4039 " [,uuid=uuid][,sku=str][,family=str]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004040 " specify SMBIOS type 1 fields\n"
4041 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
4042 " [,asset=str][,location=str]\n"
4043 " specify SMBIOS type 2 fields\n"
4044 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n"
4045 " [,sku=str]\n"
4046 " specify SMBIOS type 3 fields\n"
4047 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
4048 " [,asset=str][,part=str]\n"
4049 " specify SMBIOS type 4 fields\n"
4050 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04004051 " [,asset=str][,part=str][,speed=%d]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004052 " specify SMBIOS type 17 fields\n",
Wei Huangc30e1562015-09-07 10:39:29 +01004053 QEMU_ARCH_I386 | QEMU_ARCH_ARM)
aliguorib6f6e3d2009-04-17 18:59:56 +00004054STEXI
4055@item -smbios file=@var{binary}
Stefan Weil6616b2a2010-02-05 23:52:05 +01004056@findex -smbios
aliguorib6f6e3d2009-04-17 18:59:56 +00004057Load SMBIOS entry from binary file.
4058
Gabriel L. Somlo84351842014-05-19 10:09:54 -04004059@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 +00004060Specify SMBIOS type 0 fields
4061
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004062@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 +00004063Specify SMBIOS type 1 fields
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05004064
Igor Mammedov3fdbd1d2019-05-21 16:23:31 +02004065@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 -05004066Specify SMBIOS type 2 fields
4067
4068@item -smbios type=3[,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,sku=@var{str}]
4069Specify SMBIOS type 3 fields
4070
4071@item -smbios type=4[,sock_pfx=@var{str}][,manufacturer=@var{str}][,version=@var{str}][,serial=@var{str}][,asset=@var{str}][,part=@var{str}]
4072Specify SMBIOS type 4 fields
4073
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04004074@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 -05004075Specify SMBIOS type 17 fields
aliguorib6f6e3d2009-04-17 18:59:56 +00004076ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004077SRST
4078``-smbios file=binary``
4079 Load SMBIOS entry from binary file.
4080
4081``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]``
4082 Specify SMBIOS type 0 fields
4083
4084``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]``
4085 Specify SMBIOS type 1 fields
4086
4087``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]``
4088 Specify SMBIOS type 2 fields
4089
4090``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
4091 Specify SMBIOS type 3 fields
4092
4093``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]``
4094 Specify SMBIOS type 4 fields
4095
4096``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]``
4097 Specify SMBIOS type 17 fields
4098ERST
aliguorib6f6e3d2009-04-17 18:59:56 +00004099
blueswir15824d652009-03-28 06:44:27 +00004100STEXI
4101@end table
4102ETEXI
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01004103DEFHEADING()
blueswir15824d652009-03-28 06:44:27 +00004104
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02004105DEFHEADING(Network options:)
blueswir15824d652009-03-28 06:44:27 +00004106STEXI
4107@table @option
4108ETEXI
4109
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004110DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
blueswir15824d652009-03-28 06:44:27 +00004111#ifdef CONFIG_SLIRP
Samuel Thibault0b11c032016-03-20 12:29:54 +01004112 "-netdev user,id=str[,ipv4[=on|off]][,net=addr[/mask]][,host=addr]\n"
4113 " [,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
4114 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
Benjamin Drungf18d1372018-02-27 17:06:01 +01004115 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n"
Fam Zheng0fca92b2018-09-14 15:26:16 +08004116 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
Jan Kiszkaad196a92009-06-24 14:42:28 +02004117#ifndef _WIN32
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004118 "[,smb=dir[,smbserver=addr]]\n"
Jan Kiszkaad196a92009-06-24 14:42:28 +02004119#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004120 " configure a user mode network backend with ID 'str',\n"
4121 " its DHCP server and optional services\n"
blueswir15824d652009-03-28 06:44:27 +00004122#endif
4123#ifdef _WIN32
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004124 "-netdev tap,id=str,ifname=name\n"
4125 " configure a host TAP network backend with ID 'str'\n"
blueswir15824d652009-03-28 06:44:27 +00004126#else
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004127 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004128 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004129 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
Jason Wang69e87b32016-07-06 09:57:55 +08004130 " [,poll-us=n]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004131 " configure a host TAP network backend with ID 'str'\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004132 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004133 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
4134 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
4135 " to deconfigure it\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004136 " use '[down]script=no' to disable script execution\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004137 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
4138 " configure it\n"
blueswir15824d652009-03-28 06:44:27 +00004139 " use 'fd=h' to connect to an already opened TAP interface\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08004140 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004141 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
Michael S. Tsirkinf157ed22011-02-01 14:25:40 +02004142 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07004143 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
4144 " use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02004145 " use vhost=on to enable experimental in kernel accelerator\n"
mst@redhat.com5430a282011-02-01 22:13:42 +02004146 " (only has effect for virtio guests which use MSIX)\n"
4147 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02004148 " use 'vhostfd=h' to connect to an already opened vhost net device\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08004149 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
Jason Wangec396012013-02-22 22:57:52 +08004150 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
Jason Wang69e87b32016-07-06 09:57:55 +08004151 " use 'poll-us=n' to speciy the maximum number of microseconds that could be\n"
4152 " spent on busy polling for vhost net\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004153 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
4154 " configure a host TAP network backend with ID 'str' that is\n"
4155 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
4156 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
Mark McLoughlin0df0ff62009-06-18 18:21:34 +01004157#endif
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004158#ifdef __linux__
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004159 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"
4160 " [,rxsession=rxsession],txsession=txsession[,ipv6=on/off][,udp=on/off]\n"
4161 " [,cookie64=on/off][,counter][,pincounter][,txcookie=txcookie]\n"
4162 " [,rxcookie=rxcookie][,offset=offset]\n"
4163 " configure a network backend with ID 'str' connected to\n"
4164 " an Ethernet over L2TPv3 pseudowire.\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004165 " Linux kernel 3.3+ as well as most routers can talk\n"
Michael Tokarev2f47b402014-07-24 20:10:17 +04004166 " L2TPv3. This transport allows connecting a VM to a VM,\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004167 " VM to a router and even VM to Host. It is a nearly-universal\n"
Stefan Hajnoczi21843dc2020-02-29 11:17:27 +00004168 " standard (RFC3931). Note - this implementation uses static\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004169 " pre-configured tunnels (same as the Linux kernel).\n"
4170 " use 'src=' to specify source address\n"
4171 " use 'dst=' to specify destination address\n"
4172 " use 'udp=on' to specify udp encapsulation\n"
Gonglei39526512014-08-14 14:35:48 +08004173 " use 'srcport=' to specify source udp port\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004174 " use 'dstport=' to specify destination udp port\n"
4175 " use 'ipv6=on' to force v6\n"
4176 " L2TPv3 uses cookies to prevent misconfiguration as\n"
4177 " well as a weak security measure\n"
4178 " use 'rxcookie=0x012345678' to specify a rxcookie\n"
4179 " use 'txcookie=0x012345678' to specify a txcookie\n"
4180 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n"
4181 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n"
4182 " use 'pincounter=on' to work around broken counter handling in peer\n"
4183 " use 'offset=X' to add an extra offset between header and data\n"
4184#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004185 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n"
4186 " configure a network backend to connect to another network\n"
4187 " using a socket connection\n"
4188 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
4189 " configure a network backend to connect to a multicast maddr and port\n"
Mike Ryan3a75e742010-12-01 11:16:47 -08004190 " use 'localaddr=addr' to specify the host address to send packets from\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004191 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
4192 " configure a network backend to connect to another network\n"
4193 " using an UDP tunnel\n"
blueswir15824d652009-03-28 06:44:27 +00004194#ifdef CONFIG_VDE
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004195 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
4196 " configure a network backend to connect to port 'n' of a vde switch\n"
4197 " running on host and listening for incoming connections on 'socketpath'.\n"
blueswir15824d652009-03-28 06:44:27 +00004198 " Use group 'groupname' and mode 'octalmode' to change default\n"
4199 " ownership and permissions for communication port.\n"
4200#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01004201#ifdef CONFIG_NETMAP
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004202 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n"
Vincenzo Maffione58952132013-11-06 11:44:06 +01004203 " attach to the existing netmap-enabled network interface 'name', or to a\n"
4204 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n"
4205 " netmap device, defaults to '/dev/netmap')\n"
4206#endif
Thomas Huth253dc142018-02-21 11:18:32 +01004207#ifdef CONFIG_POSIX
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004208 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
4209 " configure a vhost-user network, backed by a chardev 'dev'\n"
Thomas Huth253dc142018-02-21 11:18:32 +01004210#endif
Thomas Huth18d65d22018-01-15 20:50:55 +01004211 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004212 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL)
Thomas Huth78cd6f72018-02-21 11:18:36 +01004213DEF("nic", HAS_ARG, QEMU_OPTION_nic,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004214 "-nic [tap|bridge|"
Thomas Huth78cd6f72018-02-21 11:18:36 +01004215#ifdef CONFIG_SLIRP
4216 "user|"
4217#endif
4218#ifdef __linux__
4219 "l2tpv3|"
4220#endif
4221#ifdef CONFIG_VDE
4222 "vde|"
4223#endif
4224#ifdef CONFIG_NETMAP
4225 "netmap|"
4226#endif
4227#ifdef CONFIG_POSIX
4228 "vhost-user|"
4229#endif
4230 "socket][,option][,...][mac=macaddr]\n"
4231 " initialize an on-board / default host NIC (using MAC address\n"
4232 " macaddr) and connect it to the given host network backend\n"
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004233 "-nic none use it alone to have zero network devices (the default is to\n"
Thomas Huth78cd6f72018-02-21 11:18:36 +01004234 " provided a 'user' network connection)\n",
4235 QEMU_ARCH_ALL)
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004236DEF("net", HAS_ARG, QEMU_OPTION_net,
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004237 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
Thomas Huth0e60a822017-12-19 16:28:55 +01004238 " configure or create an on-board (or machine default) NIC and\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004239 " connect it to hub 0 (please use -nic unless you need a hub)\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004240 "-net ["
Mark McLoughlina1ea4582009-10-08 19:58:26 +01004241#ifdef CONFIG_SLIRP
4242 "user|"
4243#endif
4244 "tap|"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004245 "bridge|"
Mark McLoughlina1ea4582009-10-08 19:58:26 +01004246#ifdef CONFIG_VDE
4247 "vde|"
4248#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01004249#ifdef CONFIG_NETMAP
4250 "netmap|"
4251#endif
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004252 "socket][,option][,option][,...]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02004253 " old way to initialize a host network interface\n"
4254 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004255STEXI
Thomas Huthabbbb032018-03-12 13:20:50 +01004256@item -nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]
4257@findex -nic
4258This option is a shortcut for configuring both the on-board (default) guest
4259NIC hardware and the host network backend in one go. The host backend options
4260are the same as with the corresponding @option{-netdev} options below.
4261The guest NIC model can be set with @option{model=@var{modelname}}.
4262Use @option{model=help} to list the available device types.
4263The hardware MAC address can be set with @option{mac=@var{macaddr}}.
4264
4265The following two example do exactly the same, to show how @option{-nic} can
Daniel P. Berrangé416b7192020-01-09 12:24:05 +00004266be used to shorten the command line length:
Thomas Huthabbbb032018-03-12 13:20:50 +01004267@example
Thomas Huth664785a2019-07-30 17:08:26 +02004268@value{qemu_system} -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4269@value{qemu_system} -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
Thomas Huthabbbb032018-03-12 13:20:50 +01004270@end example
4271
4272@item -nic none
4273Indicate that no network devices should be configured. It is used to override
4274the default configuration (default NIC with ``user'' host network backend)
4275which is activated if no other networking options are provided.
blueswir15824d652009-03-28 06:44:27 +00004276
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004277@item -netdev user,id=@var{id}[,@var{option}][,@var{option}][,...]
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01004278@findex -netdev
Thomas Huthabbbb032018-03-12 13:20:50 +01004279Configure user mode host network backend which requires no administrator
Jan Kiszkaad196a92009-06-24 14:42:28 +02004280privilege to run. Valid options are:
blueswir15824d652009-03-28 06:44:27 +00004281
Kevin Wolfb3f046c2009-10-09 10:58:35 +02004282@table @option
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004283@item id=@var{id}
Jan Kiszkaad196a92009-06-24 14:42:28 +02004284Assign symbolic name for use in monitor commands.
4285
Thomas Huthabbbb032018-03-12 13:20:50 +01004286@item ipv4=on|off and ipv6=on|off
4287Specify that either IPv4 or IPv6 must be enabled. If neither is specified
4288both protocols are enabled.
Samuel Thibault0b11c032016-03-20 12:29:54 +01004289
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004290@item net=@var{addr}[/@var{mask}]
4291Set IP network address the guest will see. Optionally specify the netmask,
4292either in the form a.b.c.d or as number of valid top-most bits. Default is
Brad Hardsb0b36e52011-04-24 17:19:56 +1000429310.0.2.0/24.
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004294
4295@item host=@var{addr}
4296Specify the guest-visible address of the host. Default is the 2nd IP in the
4297guest network, i.e. x.x.x.2.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004298
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004299@item ipv6-net=@var{addr}[/@var{int}]
4300Set IPv6 network address the guest will see (default is fec0::/64). The
4301network prefix is given in the usual hexadecimal IPv6 address
4302notation. The prefix size is optional, and is given as the number of
4303valid top-most bits (default is 64).
Yann Bordenave7aac5312016-03-15 10:31:22 +01004304
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004305@item ipv6-host=@var{addr}
Yann Bordenave7aac5312016-03-15 10:31:22 +01004306Specify the guest-visible IPv6 address of the host. Default is the 2nd IPv6 in
4307the guest network, i.e. xxxx::2.
4308
Jan Kiszkac54ed5b2011-07-20 12:20:14 +02004309@item restrict=on|off
Brad Hardscaef55e2011-06-09 07:50:43 +10004310If this option is enabled, the guest will be isolated, i.e. it will not be
Jan Kiszkaad196a92009-06-24 14:42:28 +02004311able to contact the host and no guest IP packets will be routed over the host
Brad Hardscaef55e2011-06-09 07:50:43 +10004312to the outside. This option does not affect any explicitly set forwarding rules.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004313
4314@item hostname=@var{name}
Klaus Stengel63d29602012-10-27 19:53:39 +02004315Specifies the client hostname reported by the built-in DHCP server.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004316
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004317@item dhcpstart=@var{addr}
4318Specify the first of the 16 IPs the built-in DHCP server can assign. Default
Brad Hardsb0b36e52011-04-24 17:19:56 +10004319is 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 +02004320
4321@item dns=@var{addr}
4322Specify the guest-visible address of the virtual nameserver. The address must
4323be different from the host address. Default is the 3rd IP in the guest network,
4324i.e. x.x.x.3.
4325
Samuel Thibaultd8eb3862016-03-25 00:02:58 +01004326@item ipv6-dns=@var{addr}
Yann Bordenave7aac5312016-03-15 10:31:22 +01004327Specify the guest-visible address of the IPv6 virtual nameserver. The address
4328must be different from the host address. Default is the 3rd IP in the guest
4329network, i.e. xxxx::3.
4330
Klaus Stengel63d29602012-10-27 19:53:39 +02004331@item dnssearch=@var{domain}
4332Provides an entry for the domain-search list sent by the built-in
4333DHCP server. More than one domain suffix can be transmitted by specifying
4334this option multiple times. If supported, this will cause the guest to
4335automatically try to append the given domain suffix(es) in case a domain name
4336can not be resolved.
4337
4338Example:
4339@example
Thomas Huth664785a2019-07-30 17:08:26 +02004340@value{qemu_system} -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
Klaus Stengel63d29602012-10-27 19:53:39 +02004341@end example
4342
Benjamin Drungf18d1372018-02-27 17:06:01 +01004343@item domainname=@var{domain}
4344Specifies the client domain name reported by the built-in DHCP server.
4345
Jan Kiszkaad196a92009-06-24 14:42:28 +02004346@item tftp=@var{dir}
4347When using the user mode network stack, activate a built-in TFTP
4348server. The files in @var{dir} will be exposed as the root of a TFTP server.
4349The TFTP client on the guest must be configured in binary mode (use the command
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004350@code{bin} of the Unix TFTP client).
Jan Kiszkaad196a92009-06-24 14:42:28 +02004351
Fam Zheng0fca92b2018-09-14 15:26:16 +08004352@item tftp-server-name=@var{name}
4353In BOOTP reply, broadcast @var{name} as the "TFTP server name" (RFC2132 option
435466). This can be used to advise the guest to load boot files or configurations
4355from a different server than the host address.
4356
Jan Kiszkaad196a92009-06-24 14:42:28 +02004357@item bootfile=@var{file}
4358When using the user mode network stack, broadcast @var{file} as the BOOTP
4359filename. In conjunction with @option{tftp}, this can be used to network boot
4360a guest from a local directory.
4361
4362Example (using pxelinux):
4363@example
Thomas Huth664785a2019-07-30 17:08:26 +02004364@value{qemu_system} -hda linux.img -boot n -device e1000,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004365 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
Jan Kiszkaad196a92009-06-24 14:42:28 +02004366@end example
4367
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004368@item smb=@var{dir}[,smbserver=@var{addr}]
Jan Kiszkaad196a92009-06-24 14:42:28 +02004369When using the user mode network stack, activate a built-in SMB
4370server so that Windows OSes can access to the host files in @file{@var{dir}}
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004371transparently. The IP address of the SMB server can be set to @var{addr}. By
4372default the 4th IP in the guest network is used, i.e. x.x.x.4.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004373
4374In the guest Windows OS, the line:
4375@example
437610.0.2.4 smbserver
4377@end example
4378must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
4379or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
4380
4381Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
4382
Brade2d88302011-09-02 16:53:28 -04004383Note that a SAMBA server must be installed on the host OS.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004384
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004385@item hostfwd=[tcp|udp]:[@var{hostaddr}]:@var{hostport}-[@var{guestaddr}]:@var{guestport}
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004386Redirect incoming TCP or UDP connections to the host port @var{hostport} to
4387the guest IP address @var{guestaddr} on guest port @var{guestport}. If
4388@var{guestaddr} is not specified, its value is x.x.x.15 (default first address
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004389given by the built-in DHCP server). By specifying @var{hostaddr}, the rule can
4390be bound to a specific host interface. If no connection type is set, TCP is
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004391used. This option can be given multiple times.
Jan Kiszkaad196a92009-06-24 14:42:28 +02004392
4393For example, to redirect host X11 connection from screen 1 to guest
4394screen 0, use the following:
4395
4396@example
4397# on the host
Thomas Huth664785a2019-07-30 17:08:26 +02004398@value{qemu_system} -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
Jan Kiszkaad196a92009-06-24 14:42:28 +02004399# this host xterm should open in the guest X11 server
4400xterm -display :1
4401@end example
4402
4403To redirect telnet connections from host port 5555 to telnet port on
4404the guest, use the following:
4405
4406@example
4407# on the host
Thomas Huth664785a2019-07-30 17:08:26 +02004408@value{qemu_system} -nic user,hostfwd=tcp::5555-:23
Jan Kiszkaad196a92009-06-24 14:42:28 +02004409telnet localhost 5555
4410@end example
4411
4412Then when you use on the host @code{telnet localhost 5555}, you
4413connect to the guest telnet server.
4414
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02004415@item guestfwd=[tcp]:@var{server}:@var{port}-@var{dev}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02004416@itemx guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command}
Jan Kiszka3c6a0582009-06-24 14:42:28 +02004417Forward guest TCP connections to the IP address @var{server} on port @var{port}
Alexander Grafb412eb62012-06-03 09:45:01 +02004418to the character device @var{dev} or to a program executed by @var{cmd:command}
4419which gets spawned for each connection. This option can be given multiple times.
4420
Stefan Weil43ffe612012-07-20 23:26:02 +02004421You can either use a chardev directly and have that one used throughout QEMU's
Alexander Grafb412eb62012-06-03 09:45:01 +02004422lifetime, like in the following example:
4423
4424@example
4425# open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4426# the guest accesses it
Thomas Huth664785a2019-07-30 17:08:26 +02004427@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 +02004428@end example
4429
4430Or you can execute a command on every TCP connection established by the guest,
Stefan Weil43ffe612012-07-20 23:26:02 +02004431so that QEMU behaves similar to an inetd process for that virtual server:
Alexander Grafb412eb62012-06-03 09:45:01 +02004432
4433@example
4434# call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4435# and connect the TCP stream to its stdin/stdout
Thomas Huth664785a2019-07-30 17:08:26 +02004436@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 +02004437@end example
Jan Kiszkaad196a92009-06-24 14:42:28 +02004438
4439@end table
4440
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004441@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 +01004442Configure a host TAP network backend with ID @var{id}.
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004443
4444Use the network script @var{file} to configure it and the network script
blueswir15824d652009-03-28 06:44:27 +00004445@var{dfile} to deconfigure it. If @var{name} is not provided, the OS
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004446automatically provides one. The default network configure script is
4447@file{/etc/qemu-ifup} and the default network deconfigure script is
4448@file{/etc/qemu-ifdown}. Use @option{script=no} or @option{downscript=no}
4449to disable script execution.
4450
4451If running QEMU as an unprivileged user, use the network helper
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10004452@var{helper} to configure the TAP interface and attach it to the bridge.
4453The default network helper executable is @file{/path/to/qemu-bridge-helper}
4454and the default bridge device is @file{br0}.
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004455
4456@option{fd}=@var{h} can be used to specify the handle of an already
4457opened host TAP interface.
4458
4459Examples:
blueswir15824d652009-03-28 06:44:27 +00004460
4461@example
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004462#launch a QEMU instance with the default network script
Thomas Huth664785a2019-07-30 17:08:26 +02004463@value{qemu_system} linux.img -nic tap
blueswir15824d652009-03-28 06:44:27 +00004464@end example
4465
blueswir15824d652009-03-28 06:44:27 +00004466@example
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004467#launch a QEMU instance with two NICs, each one connected
4468#to a TAP device
Thomas Huth664785a2019-07-30 17:08:26 +02004469@value{qemu_system} linux.img \
Thomas Huth74f78b92018-01-15 08:40:17 +01004470 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4471 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
blueswir15824d652009-03-28 06:44:27 +00004472@end example
4473
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004474@example
4475#launch a QEMU instance with the default network helper to
4476#connect a TAP device to bridge br0
Thomas Huth664785a2019-07-30 17:08:26 +02004477@value{qemu_system} linux.img -device virtio-net-pci,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004478 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004479@end example
4480
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004481@item -netdev bridge,id=@var{id}[,br=@var{bridge}][,helper=@var{helper}]
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004482Connect a host TAP network interface to a host bridge device.
4483
4484Use the network helper @var{helper} to configure the TAP interface and
4485attach it to the bridge. The default network helper executable is
Amos Kong420508f2013-10-23 04:49:28 +08004486@file{/path/to/qemu-bridge-helper} and the default bridge
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004487device is @file{br0}.
4488
4489Examples:
4490
4491@example
4492#launch a QEMU instance with the default network helper to
4493#connect a TAP device to bridge br0
Thomas Huth664785a2019-07-30 17:08:26 +02004494@value{qemu_system} linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004495@end example
4496
4497@example
4498#launch a QEMU instance with the default network helper to
4499#connect a TAP device to bridge qemubr0
Thomas Huth664785a2019-07-30 17:08:26 +02004500@value{qemu_system} linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
Corey Bryanta7c36ee2012-01-26 09:42:27 -05004501@end example
4502
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004503@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 +00004504
Thomas Huthabbbb032018-03-12 13:20:50 +01004505This host network backend can be used to connect the guest's network to
4506another QEMU virtual machine using a TCP socket connection. If @option{listen}
4507is specified, QEMU waits for incoming connections on @var{port}
blueswir15824d652009-03-28 06:44:27 +00004508(@var{host} is optional). @option{connect} is used to connect to
4509another QEMU instance using the @option{listen} option. @option{fd}=@var{h}
4510specifies an already opened TCP socket.
4511
4512Example:
4513@example
4514# launch a first QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004515@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004516 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4517 -netdev socket,id=n1,listen=:1234
4518# connect the network of this instance to the network of the first instance
Thomas Huth664785a2019-07-30 17:08:26 +02004519@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004520 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4521 -netdev socket,id=n2,connect=127.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004522@end example
4523
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004524@item -netdev socket,id=@var{id}[,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]]
blueswir15824d652009-03-28 06:44:27 +00004525
Thomas Huthabbbb032018-03-12 13:20:50 +01004526Configure a socket host network backend to share the guest's network traffic
4527with another QEMU virtual machines using a UDP multicast socket, effectively
4528making a bus for every QEMU with same multicast address @var{maddr} and @var{port}.
blueswir15824d652009-03-28 06:44:27 +00004529NOTES:
4530@enumerate
4531@item
4532Several QEMU can be running on different hosts and share same bus (assuming
4533correct multicast setup for these hosts).
4534@item
4535mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
4536@url{http://user-mode-linux.sf.net}.
4537@item
4538Use @option{fd=h} to specify an already opened UDP multicast socket.
4539@end enumerate
4540
4541Example:
4542@example
4543# launch one QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004544@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004545 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4546 -netdev socket,id=n1,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004547# launch another QEMU instance on same "bus"
Thomas Huth664785a2019-07-30 17:08:26 +02004548@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004549 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4550 -netdev socket,id=n2,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004551# launch yet another QEMU instance on same "bus"
Thomas Huth664785a2019-07-30 17:08:26 +02004552@value{qemu_system} linux.img \
Thomas Huth37a44422018-08-13 13:51:44 +02004553 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004554 -netdev socket,id=n3,mcast=230.0.0.1:1234
blueswir15824d652009-03-28 06:44:27 +00004555@end example
4556
4557Example (User Mode Linux compat.):
4558@example
Thomas Huthabbbb032018-03-12 13:20:50 +01004559# launch QEMU instance (note mcast address selected is UML's default)
Thomas Huth664785a2019-07-30 17:08:26 +02004560@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004561 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4562 -netdev socket,id=n1,mcast=239.192.168.1:1102
blueswir15824d652009-03-28 06:44:27 +00004563# launch UML
4564/path/to/linux ubd0=/path/to/root_fs eth0=mcast
4565@end example
4566
Mike Ryan3a75e742010-12-01 11:16:47 -08004567Example (send packets from host's 1.2.3.4):
4568@example
Thomas Huth664785a2019-07-30 17:08:26 +02004569@value{qemu_system} linux.img \
Thomas Huthabbbb032018-03-12 13:20:50 +01004570 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4571 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
Mike Ryan3a75e742010-12-01 11:16:47 -08004572@end example
4573
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004574@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 +00004575Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) is a
Thomas Huthabbbb032018-03-12 13:20:50 +01004576popular protocol to transport Ethernet (and other Layer 2) data frames between
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004577two systems. It is present in routers, firewalls and the Linux kernel
4578(from version 3.3 onwards).
4579
4580This transport allows a VM to communicate to another VM, router or firewall directly.
4581
Markus Armbruster1e9a7372017-10-02 16:03:01 +02004582@table @option
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004583@item src=@var{srcaddr}
4584 source address (mandatory)
4585@item dst=@var{dstaddr}
4586 destination address (mandatory)
4587@item udp
4588 select udp encapsulation (default is ip).
4589@item srcport=@var{srcport}
4590 source udp port.
4591@item dstport=@var{dstport}
4592 destination udp port.
4593@item ipv6
4594 force v6, otherwise defaults to v4.
4595@item rxcookie=@var{rxcookie}
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02004596@itemx txcookie=@var{txcookie}
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004597 Cookies are a weak form of security in the l2tpv3 specification.
4598Their function is mostly to prevent misconfiguration. By default they are 32
4599bit.
4600@item cookie64
4601 Set cookie size to 64 bit instead of the default 32
4602@item counter=off
4603 Force a 'cut-down' L2TPv3 with no counter as in
4604draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
4605@item pincounter=on
4606 Work around broken counter handling in peer. This may also help on
4607networks which have packet reorder.
4608@item offset=@var{offset}
4609 Add an extra offset between header and data
Markus Armbruster1e9a7372017-10-02 16:03:01 +02004610@end table
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01004611
4612For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to the bridge br-lan
4613on the remote Linux host 1.2.3.4:
4614@example
4615# Setup tunnel on linux host using raw ip as encapsulation
4616# on 1.2.3.4
4617ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
4618 encap udp udp_sport 16384 udp_dport 16384
4619ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
4620 0xFFFFFFFF peer_session_id 0xFFFFFFFF
4621ifconfig vmtunnel0 mtu 1500
4622ifconfig vmtunnel0 up
4623brctl addif br-lan vmtunnel0
4624
4625
4626# on 4.3.2.1
4627# launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
4628
Thomas Huth664785a2019-07-30 17:08:26 +02004629@value{qemu_system} linux.img -device e1000,netdev=n1 \
Thomas Huthabbbb032018-03-12 13:20:50 +01004630 -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 +01004631
4632@end example
4633
Stefan Hajnoczi08d12022012-08-14 14:14:27 +01004634@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 +01004635Configure VDE backend to connect to PORT @var{n} of a vde switch running on host and
blueswir15824d652009-03-28 06:44:27 +00004636listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname}
4637and MODE @var{octalmode} to change default ownership and permissions for
Stefan Weilc1ba4e02011-09-05 18:13:03 +02004638communication port. This option is only available if QEMU has been compiled
blueswir15824d652009-03-28 06:44:27 +00004639with vde support enabled.
4640
4641Example:
4642@example
4643# launch vde switch
4644vde_switch -F -sock /tmp/myswitch
4645# launch QEMU instance
Thomas Huth664785a2019-07-30 17:08:26 +02004646@value{qemu_system} linux.img -nic vde,sock=/tmp/myswitch
blueswir15824d652009-03-28 06:44:27 +00004647@end example
4648
Changchun Ouyangb931bfb2015-09-23 12:20:00 +08004649@item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004650
4651Establish a vhost-user netdev, backed by a chardev @var{id}. The chardev should
4652be a unix domain socket backed one. The vhost-user uses a specifically defined
4653protocol to pass vhost ioctl replacement messages to an application on the other
4654end of the socket. On non-MSIX guests, the feature can be forced with
Changchun Ouyangb931bfb2015-09-23 12:20:00 +08004655@var{vhostforce}. Use 'queues=@var{n}' to specify the number of queues to
4656be created for multiqueue vhost-user.
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004657
4658Example:
4659@example
4660qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
4661 -numa node,memdev=mem \
Vincenzo Maffione79cad2f2017-02-20 17:45:09 +01004662 -chardev socket,id=chr0,path=/path/to/socket \
Nikolay Nikolaev03ce5742014-06-10 13:02:16 +03004663 -netdev type=vhost-user,id=net0,chardev=chr0 \
4664 -device virtio-net-pci,netdev=net0
4665@end example
4666
Thomas Huthabbbb032018-03-12 13:20:50 +01004667@item -netdev hubport,id=@var{id},hubid=@var{hubid}[,netdev=@var{nd}]
Thomas Huth78cd6f72018-02-21 11:18:36 +01004668
Thomas Huthabbbb032018-03-12 13:20:50 +01004669Create a hub port on the emulated hub with ID @var{hubid}.
Thomas Huth78cd6f72018-02-21 11:18:36 +01004670
Thomas Huthabbbb032018-03-12 13:20:50 +01004671The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004672single netdev. Alternatively, you can also connect the hubport to another
4673netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option.
Thomas Huthabbbb032018-03-12 13:20:50 +01004674
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004675@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 +01004676@findex -net
4677Legacy option to configure or create an on-board (or machine default) Network
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004678Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e.
4679the default hub), or to the netdev @var{nd}.
Daniel P. Berrangé416b7192020-01-09 12:24:05 +00004680If @var{model} is omitted, then the default NIC model associated with
4681the machine type is used. Note that the default NIC model may change in
4682future QEMU releases, so it is highly recommended to always specify a model.
4683Optionally, the MAC address can be changed to @var{mac}, the device
4684address set to @var{addr} (PCI cards only), and a @var{name} can be
4685assigned for use in monitor commands.
Thomas Huthabbbb032018-03-12 13:20:50 +01004686Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors
4687that the card should have; this option currently only affects virtio cards; set
4688@var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
4689NIC is created. QEMU can emulate several different models of network card.
4690Use @code{-net nic,model=help} for a list of available devices for your target.
4691
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004692@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=@var{name}]
Thomas Huthabbbb032018-03-12 13:20:50 +01004693Configure a host network backend (with the options corresponding to the same
Thomas Huthaf1a5c32018-04-30 20:02:23 +02004694@option{-netdev} option) and connect it to the emulated hub 0 (the default
4695hub). Use @var{name} to specify the name of the hub port.
blueswir15824d652009-03-28 06:44:27 +00004696ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004697SRST
4698``-nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]``
4699 This option is a shortcut for configuring both the on-board
4700 (default) guest NIC hardware and the host network backend in one go.
4701 The host backend options are the same as with the corresponding
4702 ``-netdev`` options below. The guest NIC model can be set with
4703 ``model=modelname``. Use ``model=help`` to list the available device
4704 types. The hardware MAC address can be set with ``mac=macaddr``.
4705
4706 The following two example do exactly the same, to show how ``-nic``
4707 can be used to shorten the command line length:
4708
4709 .. parsed-literal::
4710
4711 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
4712 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
4713
4714``-nic none``
4715 Indicate that no network devices should be configured. It is used to
4716 override the default configuration (default NIC with "user" host
4717 network backend) which is activated if no other networking options
4718 are provided.
4719
4720``-netdev user,id=id[,option][,option][,...]``
4721 Configure user mode host network backend which requires no
4722 administrator privilege to run. Valid options are:
4723
4724 ``id=id``
4725 Assign symbolic name for use in monitor commands.
4726
4727 ``ipv4=on|off and ipv6=on|off``
4728 Specify that either IPv4 or IPv6 must be enabled. If neither is
4729 specified both protocols are enabled.
4730
4731 ``net=addr[/mask]``
4732 Set IP network address the guest will see. Optionally specify
4733 the netmask, either in the form a.b.c.d or as number of valid
4734 top-most bits. Default is 10.0.2.0/24.
4735
4736 ``host=addr``
4737 Specify the guest-visible address of the host. Default is the
4738 2nd IP in the guest network, i.e. x.x.x.2.
4739
4740 ``ipv6-net=addr[/int]``
4741 Set IPv6 network address the guest will see (default is
4742 fec0::/64). The network prefix is given in the usual hexadecimal
4743 IPv6 address notation. The prefix size is optional, and is given
4744 as the number of valid top-most bits (default is 64).
4745
4746 ``ipv6-host=addr``
4747 Specify the guest-visible IPv6 address of the host. Default is
4748 the 2nd IPv6 in the guest network, i.e. xxxx::2.
4749
4750 ``restrict=on|off``
4751 If this option is enabled, the guest will be isolated, i.e. it
4752 will not be able to contact the host and no guest IP packets
4753 will be routed over the host to the outside. This option does
4754 not affect any explicitly set forwarding rules.
4755
4756 ``hostname=name``
4757 Specifies the client hostname reported by the built-in DHCP
4758 server.
4759
4760 ``dhcpstart=addr``
4761 Specify the first of the 16 IPs the built-in DHCP server can
4762 assign. Default is the 15th to 31st IP in the guest network,
4763 i.e. x.x.x.15 to x.x.x.31.
4764
4765 ``dns=addr``
4766 Specify the guest-visible address of the virtual nameserver. The
4767 address must be different from the host address. Default is the
4768 3rd IP in the guest network, i.e. x.x.x.3.
4769
4770 ``ipv6-dns=addr``
4771 Specify the guest-visible address of the IPv6 virtual
4772 nameserver. The address must be different from the host address.
4773 Default is the 3rd IP in the guest network, i.e. xxxx::3.
4774
4775 ``dnssearch=domain``
4776 Provides an entry for the domain-search list sent by the
4777 built-in DHCP server. More than one domain suffix can be
4778 transmitted by specifying this option multiple times. If
4779 supported, this will cause the guest to automatically try to
4780 append the given domain suffix(es) in case a domain name can not
4781 be resolved.
4782
4783 Example:
4784
4785 .. parsed-literal::
4786
4787 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
4788
4789 ``domainname=domain``
4790 Specifies the client domain name reported by the built-in DHCP
4791 server.
4792
4793 ``tftp=dir``
4794 When using the user mode network stack, activate a built-in TFTP
4795 server. The files in dir will be exposed as the root of a TFTP
4796 server. The TFTP client on the guest must be configured in
4797 binary mode (use the command ``bin`` of the Unix TFTP client).
4798
4799 ``tftp-server-name=name``
4800 In BOOTP reply, broadcast name as the "TFTP server name"
4801 (RFC2132 option 66). This can be used to advise the guest to
4802 load boot files or configurations from a different server than
4803 the host address.
4804
4805 ``bootfile=file``
4806 When using the user mode network stack, broadcast file as the
4807 BOOTP filename. In conjunction with ``tftp``, this can be used
4808 to network boot a guest from a local directory.
4809
4810 Example (using pxelinux):
4811
4812 .. parsed-literal::
4813
4814 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \
4815 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
4816
4817 ``smb=dir[,smbserver=addr]``
4818 When using the user mode network stack, activate a built-in SMB
4819 server so that Windows OSes can access to the host files in
4820 ``dir`` transparently. The IP address of the SMB server can be
4821 set to addr. By default the 4th IP in the guest network is used,
4822 i.e. x.x.x.4.
4823
4824 In the guest Windows OS, the line:
4825
4826 ::
4827
4828 10.0.2.4 smbserver
4829
4830 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows
4831 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows
4832 NT/2000).
4833
4834 Then ``dir`` can be accessed in ``\\smbserver\qemu``.
4835
4836 Note that a SAMBA server must be installed on the host OS.
4837
4838 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport``
4839 Redirect incoming TCP or UDP connections to the host port
4840 hostport to the guest IP address guestaddr on guest port
4841 guestport. If guestaddr is not specified, its value is x.x.x.15
4842 (default first address given by the built-in DHCP server). By
4843 specifying hostaddr, the rule can be bound to a specific host
4844 interface. If no connection type is set, TCP is used. This
4845 option can be given multiple times.
4846
4847 For example, to redirect host X11 connection from screen 1 to
4848 guest screen 0, use the following:
4849
4850 ::
4851
4852 # on the host
4853 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
4854 # this host xterm should open in the guest X11 server
4855 xterm -display :1
4856
4857 To redirect telnet connections from host port 5555 to telnet
4858 port on the guest, use the following:
4859
4860 ::
4861
4862 # on the host
4863 |qemu_system| -nic user,hostfwd=tcp::5555-:23
4864 telnet localhost 5555
4865
4866 Then when you use on the host ``telnet localhost 5555``, you
4867 connect to the guest telnet server.
4868
4869 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command``
4870 Forward guest TCP connections to the IP address server on port
4871 port to the character device dev or to a program executed by
4872 cmd:command which gets spawned for each connection. This option
4873 can be given multiple times.
4874
4875 You can either use a chardev directly and have that one used
4876 throughout QEMU's lifetime, like in the following example:
4877
4878 ::
4879
4880 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
4881 # the guest accesses it
4882 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
4883
4884 Or you can execute a command on every TCP connection established
4885 by the guest, so that QEMU behaves similar to an inetd process
4886 for that virtual server:
4887
4888 ::
4889
4890 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
4891 # and connect the TCP stream to its stdin/stdout
4892 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
4893
4894``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
4895 Configure a host TAP network backend with ID id.
4896
4897 Use the network script file to configure it and the network script
4898 dfile to deconfigure it. If name is not provided, the OS
4899 automatically provides one. The default network configure script is
4900 ``/etc/qemu-ifup`` and the default network deconfigure script is
4901 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to
4902 disable script execution.
4903
4904 If running QEMU as an unprivileged user, use the network helper
4905 helper to configure the TAP interface and attach it to the bridge.
4906 The default network helper executable is
4907 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4908 ``br0``.
4909
4910 ``fd``\ =h can be used to specify the handle of an already opened
4911 host TAP interface.
4912
4913 Examples:
4914
4915 ::
4916
4917 #launch a QEMU instance with the default network script
4918 |qemu_system| linux.img -nic tap
4919
4920 ::
4921
4922 #launch a QEMU instance with two NICs, each one connected
4923 #to a TAP device
4924 |qemu_system| linux.img \
4925 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \
4926 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
4927
4928 ::
4929
4930 #launch a QEMU instance with the default network helper to
4931 #connect a TAP device to bridge br0
4932 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \
4933 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
4934
4935``-netdev bridge,id=id[,br=bridge][,helper=helper]``
4936 Connect a host TAP network interface to a host bridge device.
4937
4938 Use the network helper helper to configure the TAP interface and
4939 attach it to the bridge. The default network helper executable is
4940 ``/path/to/qemu-bridge-helper`` and the default bridge device is
4941 ``br0``.
4942
4943 Examples:
4944
4945 ::
4946
4947 #launch a QEMU instance with the default network helper to
4948 #connect a TAP device to bridge br0
4949 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
4950
4951 ::
4952
4953 #launch a QEMU instance with the default network helper to
4954 #connect a TAP device to bridge qemubr0
4955 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
4956
4957``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]``
4958 This host network backend can be used to connect the guest's network
4959 to another QEMU virtual machine using a TCP socket connection. If
4960 ``listen`` is specified, QEMU waits for incoming connections on port
4961 (host is optional). ``connect`` is used to connect to another QEMU
4962 instance using the ``listen`` option. ``fd``\ =h specifies an
4963 already opened TCP socket.
4964
4965 Example:
4966
4967 ::
4968
4969 # launch a first QEMU instance
4970 |qemu_system| linux.img \
4971 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4972 -netdev socket,id=n1,listen=:1234
4973 # connect the network of this instance to the network of the first instance
4974 |qemu_system| linux.img \
4975 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
4976 -netdev socket,id=n2,connect=127.0.0.1:1234
4977
4978``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]``
4979 Configure a socket host network backend to share the guest's network
4980 traffic with another QEMU virtual machines using a UDP multicast
4981 socket, effectively making a bus for every QEMU with same multicast
4982 address maddr and port. NOTES:
4983
4984 1. Several QEMU can be running on different hosts and share same bus
4985 (assuming correct multicast setup for these hosts).
4986
4987 2. mcast support is compatible with User Mode Linux (argument
4988 ``ethN=mcast``), see http://user-mode-linux.sf.net.
4989
4990 3. Use ``fd=h`` to specify an already opened UDP multicast socket.
4991
4992 Example:
4993
4994 ::
4995
4996 # launch one QEMU instance
4997 |qemu_system| linux.img \
4998 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
4999 -netdev socket,id=n1,mcast=230.0.0.1:1234
5000 # launch another QEMU instance on same "bus"
5001 |qemu_system| linux.img \
5002 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \
5003 -netdev socket,id=n2,mcast=230.0.0.1:1234
5004 # launch yet another QEMU instance on same "bus"
5005 |qemu_system| linux.img \
5006 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \
5007 -netdev socket,id=n3,mcast=230.0.0.1:1234
5008
5009 Example (User Mode Linux compat.):
5010
5011 ::
5012
5013 # launch QEMU instance (note mcast address selected is UML's default)
5014 |qemu_system| linux.img \
5015 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5016 -netdev socket,id=n1,mcast=239.192.168.1:1102
5017 # launch UML
5018 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
5019
5020 Example (send packets from host's 1.2.3.4):
5021
5022 .. parsed-literal::
5023
5024 |qemu_system| linux.img \
5025 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \
5026 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
5027
5028``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6][,udp][,cookie64][,counter][,pincounter][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
5029 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
5030 is a popular protocol to transport Ethernet (and other Layer 2) data
5031 frames between two systems. It is present in routers, firewalls and
5032 the Linux kernel (from version 3.3 onwards).
5033
5034 This transport allows a VM to communicate to another VM, router or
5035 firewall directly.
5036
5037 ``src=srcaddr``
5038 source address (mandatory)
5039
5040 ``dst=dstaddr``
5041 destination address (mandatory)
5042
5043 ``udp``
5044 select udp encapsulation (default is ip).
5045
5046 ``srcport=srcport``
5047 source udp port.
5048
5049 ``dstport=dstport``
5050 destination udp port.
5051
5052 ``ipv6``
5053 force v6, otherwise defaults to v4.
5054
5055 ``rxcookie=rxcookie``; \ ``txcookie=txcookie``
5056 Cookies are a weak form of security in the l2tpv3 specification.
5057 Their function is mostly to prevent misconfiguration. By default
5058 they are 32 bit.
5059
5060 ``cookie64``
5061 Set cookie size to 64 bit instead of the default 32
5062
5063 ``counter=off``
5064 Force a 'cut-down' L2TPv3 with no counter as in
5065 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
5066
5067 ``pincounter=on``
5068 Work around broken counter handling in peer. This may also help
5069 on networks which have packet reorder.
5070
5071 ``offset=offset``
5072 Add an extra offset between header and data
5073
5074 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to
5075 the bridge br-lan on the remote Linux host 1.2.3.4:
5076
5077 ::
5078
5079 # Setup tunnel on linux host using raw ip as encapsulation
5080 # on 1.2.3.4
5081 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \
5082 encap udp udp_sport 16384 udp_dport 16384
5083 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \
5084 0xFFFFFFFF peer_session_id 0xFFFFFFFF
5085 ifconfig vmtunnel0 mtu 1500
5086 ifconfig vmtunnel0 up
5087 brctl addif br-lan vmtunnel0
5088
5089
5090 # on 4.3.2.1
5091 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
5092
5093 |qemu_system| linux.img -device e1000,netdev=n1 \
5094 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
5095
5096``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
5097 Configure VDE backend to connect to PORT n of a vde switch running
5098 on host and listening for incoming connections on socketpath. Use
5099 GROUP groupname and MODE octalmode to change default ownership and
5100 permissions for communication port. This option is only available if
5101 QEMU has been compiled with vde support enabled.
5102
5103 Example:
5104
5105 ::
5106
5107 # launch vde switch
5108 vde_switch -F -sock /tmp/myswitch
5109 # launch QEMU instance
5110 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch
5111
5112``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
5113 Establish a vhost-user netdev, backed by a chardev id. The chardev
5114 should be a unix domain socket backed one. The vhost-user uses a
5115 specifically defined protocol to pass vhost ioctl replacement
5116 messages to an application on the other end of the socket. On
5117 non-MSIX guests, the feature can be forced with vhostforce. Use
5118 'queues=n' to specify the number of queues to be created for
5119 multiqueue vhost-user.
5120
5121 Example:
5122
5123 ::
5124
5125 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
5126 -numa node,memdev=mem \
5127 -chardev socket,id=chr0,path=/path/to/socket \
5128 -netdev type=vhost-user,id=net0,chardev=chr0 \
5129 -device virtio-net-pci,netdev=net0
5130
5131``-netdev hubport,id=id,hubid=hubid[,netdev=nd]``
5132 Create a hub port on the emulated hub with ID hubid.
5133
5134 The hubport netdev lets you connect a NIC to a QEMU emulated hub
5135 instead of a single netdev. Alternatively, you can also connect the
5136 hubport to another netdev with ID nd by using the ``netdev=nd``
5137 option.
5138
5139``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]``
5140 Legacy option to configure or create an on-board (or machine
5141 default) Network Interface Card(NIC) and connect it either to the
5142 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.
5143 If model is omitted, then the default NIC model associated with the
5144 machine type is used. Note that the default NIC model may change in
5145 future QEMU releases, so it is highly recommended to always specify
5146 a model. Optionally, the MAC address can be changed to mac, the
5147 device address set to addr (PCI cards only), and a name can be
5148 assigned for use in monitor commands. Optionally, for PCI cards, you
5149 can specify the number v of MSI-X vectors that the card should have;
5150 this option currently only affects virtio cards; set v = 0 to
5151 disable MSI-X. If no ``-net`` option is specified, a single NIC is
5152 created. QEMU can emulate several different models of network card.
5153 Use ``-net nic,model=help`` for a list of available devices for your
5154 target.
5155
5156``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]``
5157 Configure a host network backend (with the options corresponding to
5158 the same ``-netdev`` option) and connect it to the emulated hub 0
5159 (the default hub). Use name to specify the name of the hub port.
5160ERST
blueswir15824d652009-03-28 06:44:27 +00005161
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01005162STEXI
5163@end table
5164ETEXI
Matthew Booth7273a2d2009-10-30 13:41:12 +00005165DEFHEADING()
5166
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005167DEFHEADING(Character device options:)
Matthew Booth7273a2d2009-10-30 13:41:12 +00005168
5169DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
Lin Ma517b3d42016-08-17 01:13:52 +08005170 "-chardev help\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005171 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Corey Minyard5dd1f022014-10-02 11:17:37 -05005172 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4][,ipv6][,nodelay][,reconnect=seconds]\n"
Julia Suvorova981b06e2018-10-19 01:35:00 +03005173 " [,server][,nowait][,telnet][,websocket][,reconnect=seconds][,mux=on|off]\n"
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005174 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n"
Julia Suvorova981b06e2018-10-19 01:35:00 +03005175 "-chardev socket,id=id,path=path[,server][,nowait][,telnet][,websocket][,reconnect=seconds]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005176 " [,mux=on|off][,logfile=PATH][,logappend=on|off] (unix)\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005177 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
Jan Kiszka97331282010-04-06 16:55:54 +02005178 " [,localport=localport][,ipv4][,ipv6][,mux=on|off]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005179 " [,logfile=PATH][,logappend=on|off]\n"
5180 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005181 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005182 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5183 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
5184 "-chardev file,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5185 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005186#ifdef _WIN32
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005187 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5188 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005189#else
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005190 "-chardev pty,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5191 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005192#endif
5193#ifdef CONFIG_BRLAPI
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005194 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005195#endif
5196#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
5197 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005198 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5199 "-chardev tty,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005200#endif
5201#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005202 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
5203 "-chardev parport,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00005204#endif
Alon Levycbcc6332011-01-19 10:49:50 +02005205#if defined(CONFIG_SPICE)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005206 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
5207 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
Alon Levycbcc6332011-01-19 10:49:50 +02005208#endif
Blue Swirlad960902010-03-29 19:23:52 +00005209 , QEMU_ARCH_ALL
Matthew Booth7273a2d2009-10-30 13:41:12 +00005210)
5211
5212STEXI
Markus Armbrusterdddba062017-10-02 16:03:06 +02005213
5214The general form of a character device option is:
5215@table @option
Thomas Huth16fdc562018-01-30 10:36:21 +01005216@item -chardev @var{backend},id=@var{id}[,mux=on|off][,@var{options}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01005217@findex -chardev
Matthew Booth7273a2d2009-10-30 13:41:12 +00005218Backend is one of:
5219@option{null},
5220@option{socket},
5221@option{udp},
5222@option{msmouse},
5223@option{vc},
Markus Armbruster4f573782013-07-26 16:44:32 +02005224@option{ringbuf},
Matthew Booth7273a2d2009-10-30 13:41:12 +00005225@option{file},
5226@option{pipe},
5227@option{console},
5228@option{serial},
5229@option{pty},
5230@option{stdio},
5231@option{braille},
5232@option{tty},
Gerd Hoffmann88a946d2013-01-10 14:20:58 +01005233@option{parallel},
Alon Levycbcc6332011-01-19 10:49:50 +02005234@option{parport},
Thomas Huth16fdc562018-01-30 10:36:21 +01005235@option{spicevmc},
Marc-André Lureau5a49d3e2012-12-05 16:15:34 +01005236@option{spiceport}.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005237The specific backend will determine the applicable options.
5238
Markus Armbrusterdddba062017-10-02 16:03:06 +02005239Use @code{-chardev help} to print all available chardev backend types.
Lin Ma517b3d42016-08-17 01:13:52 +08005240
Matthew Booth7273a2d2009-10-30 13:41:12 +00005241All devices must have an id, which can be any string up to 127 characters long.
5242It is used to uniquely identify this device in other command line directives.
5243
Jan Kiszka97331282010-04-06 16:55:54 +02005244A character device may be used in multiplexing mode by multiple front-ends.
Peter Maydella40db1b2016-02-16 17:28:58 +00005245Specify @option{mux=on} to enable this mode.
5246A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
5247backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
5248If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
5249create a multiplexer with your specified ID, and you can then configure multiple
5250front ends to use that chardev ID for their input/output. Up to four different
5251front ends can be connected to a single multiplexed chardev. (Without
5252multiplexing enabled, a chardev can only be used by a single front end.)
5253For instance you could use this to allow a single stdio chardev to be used by
5254two serial ports and the QEMU monitor:
5255
5256@example
5257-chardev stdio,mux=on,id=char0 \
Marc-André Lureaubdbcb542016-10-11 21:41:21 +04005258-mon chardev=char0,mode=readline \
Peter Maydella40db1b2016-02-16 17:28:58 +00005259-serial chardev:char0 \
5260-serial chardev:char0
5261@end example
5262
5263You can have more than one multiplexer in a system configuration; for instance
5264you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
5265multiplexed between the QEMU monitor and a parallel port:
5266
5267@example
5268-chardev stdio,mux=on,id=char0 \
Marc-André Lureaubdbcb542016-10-11 21:41:21 +04005269-mon chardev=char0,mode=readline \
Peter Maydella40db1b2016-02-16 17:28:58 +00005270-parallel chardev:char0 \
5271-chardev tcp,...,mux=on,id=char1 \
5272-serial chardev:char1 \
5273-serial chardev:char1
5274@end example
5275
5276When you're using a multiplexed character device, some escape sequences are
5277interpreted in the input. @xref{mux_keys, Keys in the character backend
5278multiplexer}.
5279
5280Note that some other command line options may implicitly create multiplexed
5281character backends; for instance @option{-serial mon:stdio} creates a
5282multiplexed stdio backend connected to the serial port and the QEMU monitor,
5283and @option{-nographic} also multiplexes the console and the monitor to
5284stdio.
5285
5286There is currently no support for multiplexing in the other direction
5287(where a single QEMU front end takes input and output from multiple chardevs).
Jan Kiszka97331282010-04-06 16:55:54 +02005288
Daniel P. Berranged0d77082016-01-11 12:44:41 +00005289Every backend supports the @option{logfile} option, which supplies the path
5290to a file to record all data transmitted via the backend. The @option{logappend}
5291option controls whether the log file will be truncated or appended to when
5292opened.
5293
Markus Armbrusterdddba062017-10-02 16:03:06 +02005294@end table
Matthew Booth7273a2d2009-10-30 13:41:12 +00005295
Markus Armbrusterdddba062017-10-02 16:03:06 +02005296The available backends are:
5297
5298@table @option
Thomas Huth16fdc562018-01-30 10:36:21 +01005299@item -chardev null,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005300A void device. This device will not emit any data, and will drop any data it
5301receives. The null backend does not take any options.
5302
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005303@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 +00005304
5305Create a two-way stream socket, which can be either a TCP or a unix socket. A
5306unix socket will be created if @option{path} is specified. Behaviour is
5307undefined if TCP options are specified for a unix socket.
5308
5309@option{server} specifies that the socket shall be a listening socket.
5310
5311@option{nowait} specifies that QEMU should not block waiting for a client to
5312connect to a listening socket.
5313
5314@option{telnet} specifies that traffic on the socket should interpret telnet
5315escape sequences.
5316
Julia Suvorova981b06e2018-10-19 01:35:00 +03005317@option{websocket} specifies that the socket uses WebSocket protocol for
5318communication.
5319
Corey Minyard5dd1f022014-10-02 11:17:37 -05005320@option{reconnect} sets the timeout for reconnecting on non-server sockets when
5321the remote end goes away. qemu will delay this many seconds and then attempt
5322to reconnect. Zero disables reconnecting, and is the default.
5323
Daniel P. Berrangea8fb5422016-01-19 11:14:31 +00005324@option{tls-creds} requests enablement of the TLS protocol for encryption,
5325and specifies the id of the TLS credentials to use for the handshake. The
5326credentials must be previously created with the @option{-object tls-creds}
5327argument.
5328
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00005329@option{tls-auth} provides the ID of the QAuthZ authorization object against
5330which the client's x509 distinguished name will be validated. This object is
5331only resolved at time of use, so can be deleted and recreated on the fly
5332while the chardev server is active. If missing, it will default to denying
5333access.
5334
Matthew Booth7273a2d2009-10-30 13:41:12 +00005335TCP and unix socket options are given below:
5336
5337@table @option
5338
Thomas Huth16fdc562018-01-30 10:36:21 +01005339@item TCP options: port=@var{port}[,host=@var{host}][,to=@var{to}][,ipv4][,ipv6][,nodelay]
Matthew Booth7273a2d2009-10-30 13:41:12 +00005340
5341@option{host} for a listening socket specifies the local address to be bound.
5342For a connecting socket species the remote host to connect to. @option{host} is
5343optional for listening sockets. If not specified it defaults to @code{0.0.0.0}.
5344
5345@option{port} for a listening socket specifies the local port to be bound. For a
5346connecting socket specifies the port on the remote host to connect to.
5347@option{port} can be given as either a port number or a service name.
5348@option{port} is required.
5349
5350@option{to} is only relevant to listening sockets. If it is specified, and
5351@option{port} cannot be bound, QEMU will attempt to bind to subsequent ports up
5352to and including @option{to} until it succeeds. @option{to} must be specified
5353as a port number.
5354
5355@option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5356If neither is specified the socket may use either protocol.
5357
5358@option{nodelay} disables the Nagle algorithm.
5359
5360@item unix options: path=@var{path}
5361
5362@option{path} specifies the local path of the unix socket. @option{path} is
5363required.
5364
5365@end table
5366
Thomas Huth16fdc562018-01-30 10:36:21 +01005367@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 +00005368
5369Sends all traffic from the guest to a remote host over UDP.
5370
5371@option{host} specifies the remote host to connect to. If not specified it
5372defaults to @code{localhost}.
5373
5374@option{port} specifies the port on the remote host to connect to. @option{port}
5375is required.
5376
5377@option{localaddr} specifies the local address to bind to. If not specified it
5378defaults to @code{0.0.0.0}.
5379
5380@option{localport} specifies the local port to bind to. If not specified any
5381available local port will be used.
5382
5383@option{ipv4} and @option{ipv6} specify that either IPv4 or IPv6 must be used.
5384If neither is specified the device may use either protocol.
5385
Thomas Huth16fdc562018-01-30 10:36:21 +01005386@item -chardev msmouse,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005387
5388Forward QEMU's emulated msmouse events to the guest. @option{msmouse} does not
5389take any options.
5390
Thomas Huth16fdc562018-01-30 10:36:21 +01005391@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 +00005392
5393Connect to a QEMU text console. @option{vc} may optionally be given a specific
5394size.
5395
5396@option{width} and @option{height} specify the width and height respectively of
5397the console, in pixels.
5398
5399@option{cols} and @option{rows} specify that the console be sized to fit a text
5400console with the given dimensions.
5401
Thomas Huth16fdc562018-01-30 10:36:21 +01005402@item -chardev ringbuf,id=@var{id}[,size=@var{size}]
Lei Li51767e72013-01-25 00:03:19 +08005403
Markus Armbruster3949e592013-02-06 21:27:24 +01005404Create a ring buffer with fixed size @option{size}.
Stefan Hajnoczie69f7d22016-09-19 11:56:26 +01005405@var{size} must be a power of two and defaults to @code{64K}.
Lei Li51767e72013-01-25 00:03:19 +08005406
Thomas Huth16fdc562018-01-30 10:36:21 +01005407@item -chardev file,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005408
5409Log all traffic received from the guest to a file.
5410
5411@option{path} specifies the path of the file to be opened. This file will be
5412created if it does not already exist, and overwritten if it does. @option{path}
5413is required.
5414
Thomas Huth16fdc562018-01-30 10:36:21 +01005415@item -chardev pipe,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005416
5417Create a two-way connection to the guest. The behaviour differs slightly between
5418Windows hosts and other hosts:
5419
5420On Windows, a single duplex pipe will be created at
5421@file{\\.pipe\@option{path}}.
5422
5423On other hosts, 2 pipes will be created called @file{@option{path}.in} and
5424@file{@option{path}.out}. Data written to @file{@option{path}.in} will be
5425received by the guest. Data written by the guest can be read from
5426@file{@option{path}.out}. QEMU will not create these fifos, and requires them to
5427be present.
5428
5429@option{path} forms part of the pipe path as described above. @option{path} is
5430required.
5431
Thomas Huth16fdc562018-01-30 10:36:21 +01005432@item -chardev console,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005433
5434Send traffic from the guest to QEMU's standard output. @option{console} does not
5435take any options.
5436
5437@option{console} is only available on Windows hosts.
5438
Thomas Huth16fdc562018-01-30 10:36:21 +01005439@item -chardev serial,id=@var{id},path=@option{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005440
5441Send traffic from the guest to a serial device on the host.
5442
Gerd Hoffmannd59044e2012-12-19 13:50:29 +01005443On Unix hosts serial will actually accept any tty device,
5444not only serial lines.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005445
5446@option{path} specifies the name of the serial device to open.
5447
Thomas Huth16fdc562018-01-30 10:36:21 +01005448@item -chardev pty,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005449
5450Create a new pseudo-terminal on the host and connect to it. @option{pty} does
5451not take any options.
5452
5453@option{pty} is not available on Windows hosts.
5454
Thomas Huth16fdc562018-01-30 10:36:21 +01005455@item -chardev stdio,id=@var{id}[,signal=on|off]
Stefan Weilb65ee4f2012-05-11 22:25:50 +02005456Connect to standard input and standard output of the QEMU process.
Aurelien Jarnob7fdb3a2010-07-13 21:13:12 +02005457
5458@option{signal} controls if signals are enabled on the terminal, that includes
5459exiting QEMU with the key sequence @key{Control-c}. This option is enabled by
5460default, use @option{signal=off} to disable it.
5461
Thomas Huth16fdc562018-01-30 10:36:21 +01005462@item -chardev braille,id=@var{id}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005463
5464Connect to a local BrlAPI server. @option{braille} does not take any options.
5465
Thomas Huth16fdc562018-01-30 10:36:21 +01005466@item -chardev tty,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005467
Matthew Booth7273a2d2009-10-30 13:41:12 +00005468@option{tty} is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD and
Markus Armbrusterd037d6b2013-02-13 15:54:15 +01005469DragonFlyBSD hosts. It is an alias for @option{serial}.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005470
5471@option{path} specifies the path to the tty. @option{path} is required.
5472
Thomas Huth16fdc562018-01-30 10:36:21 +01005473@item -chardev parallel,id=@var{id},path=@var{path}
5474@itemx -chardev parport,id=@var{id},path=@var{path}
Matthew Booth7273a2d2009-10-30 13:41:12 +00005475
Gerd Hoffmann88a946d2013-01-10 14:20:58 +01005476@option{parallel} is only available on Linux, FreeBSD and DragonFlyBSD hosts.
Matthew Booth7273a2d2009-10-30 13:41:12 +00005477
5478Connect to a local parallel port.
5479
5480@option{path} specifies the path to the parallel port device. @option{path} is
5481required.
5482
Thomas Huth16fdc562018-01-30 10:36:21 +01005483@item -chardev spicevmc,id=@var{id},debug=@var{debug},name=@var{name}
Alon Levycbcc6332011-01-19 10:49:50 +02005484
Stefan Hajnoczi3a846902011-10-06 11:24:12 +01005485@option{spicevmc} is only available when spice support is built in.
5486
Alon Levycbcc6332011-01-19 10:49:50 +02005487@option{debug} debug level for spicevmc
5488
5489@option{name} name of spice channel to connect to
5490
5491Connect to a spice virtual machine channel, such as vdiport.
Alon Levycbcc6332011-01-19 10:49:50 +02005492
Thomas Huth16fdc562018-01-30 10:36:21 +01005493@item -chardev spiceport,id=@var{id},debug=@var{debug},name=@var{name}
Marc-André Lureau5a49d3e2012-12-05 16:15:34 +01005494
5495@option{spiceport} is only available when spice support is built in.
5496
5497@option{debug} debug level for spicevmc
5498
5499@option{name} name of spice port to connect to
5500
5501Connect to a spice port, allowing a Spice client to handle the traffic
5502identified by a name (preferably a fqdn).
Matthew Booth7273a2d2009-10-30 13:41:12 +00005503ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005504SRST
5505The general form of a character device option is:
5506
5507``-chardev backend,id=id[,mux=on|off][,options]``
5508 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
5509 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
5510 ``pty``, ``stdio``, ``braille``, ``tty``, ``parallel``, ``parport``,
5511 ``spicevmc``, ``spiceport``. The specific backend will determine the
5512 applicable options.
5513
5514 Use ``-chardev help`` to print all available chardev backend types.
5515
5516 All devices must have an id, which can be any string up to 127
5517 characters long. It is used to uniquely identify this device in
5518 other command line directives.
5519
5520 A character device may be used in multiplexing mode by multiple
5521 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is
5522 a "1:N" device, and here the "1" end is your specified chardev
5523 backend, and the "N" end is the various parts of QEMU that can talk
5524 to a chardev. If you create a chardev with ``id=myid`` and
5525 ``mux=on``, QEMU will create a multiplexer with your specified ID,
5526 and you can then configure multiple front ends to use that chardev
5527 ID for their input/output. Up to four different front ends can be
5528 connected to a single multiplexed chardev. (Without multiplexing
5529 enabled, a chardev can only be used by a single front end.) For
5530 instance you could use this to allow a single stdio chardev to be
5531 used by two serial ports and the QEMU monitor:
5532
5533 ::
5534
5535 -chardev stdio,mux=on,id=char0 \
5536 -mon chardev=char0,mode=readline \
5537 -serial chardev:char0 \
5538 -serial chardev:char0
5539
5540 You can have more than one multiplexer in a system configuration;
5541 for instance you could have a TCP port multiplexed between UART 0
5542 and UART 1, and stdio multiplexed between the QEMU monitor and a
5543 parallel port:
5544
5545 ::
5546
5547 -chardev stdio,mux=on,id=char0 \
5548 -mon chardev=char0,mode=readline \
5549 -parallel chardev:char0 \
5550 -chardev tcp,...,mux=on,id=char1 \
5551 -serial chardev:char1 \
5552 -serial chardev:char1
5553
5554 When you're using a multiplexed character device, some escape
5555 sequences are interpreted in the input. See :ref:`mux_005fkeys`.
5556
5557 Note that some other command line options may implicitly create
5558 multiplexed character backends; for instance ``-serial mon:stdio``
5559 creates a multiplexed stdio backend connected to the serial port and
5560 the QEMU monitor, and ``-nographic`` also multiplexes the console
5561 and the monitor to stdio.
5562
5563 There is currently no support for multiplexing in the other
5564 direction (where a single QEMU front end takes input and output from
5565 multiple chardevs).
5566
5567 Every backend supports the ``logfile`` option, which supplies the
5568 path to a file to record all data transmitted via the backend. The
5569 ``logappend`` option controls whether the log file will be truncated
5570 or appended to when opened.
5571
5572The available backends are:
5573
5574``-chardev null,id=id``
5575 A void device. This device will not emit any data, and will drop any
5576 data it receives. The null backend does not take any options.
5577
5578``-chardev socket,id=id[,TCP options or unix options][,server][,nowait][,telnet][,websocket][,reconnect=seconds][,tls-creds=id][,tls-authz=id]``
5579 Create a two-way stream socket, which can be either a TCP or a unix
5580 socket. A unix socket will be created if ``path`` is specified.
5581 Behaviour is undefined if TCP options are specified for a unix
5582 socket.
5583
5584 ``server`` specifies that the socket shall be a listening socket.
5585
5586 ``nowait`` specifies that QEMU should not block waiting for a client
5587 to connect to a listening socket.
5588
5589 ``telnet`` specifies that traffic on the socket should interpret
5590 telnet escape sequences.
5591
5592 ``websocket`` specifies that the socket uses WebSocket protocol for
5593 communication.
5594
5595 ``reconnect`` sets the timeout for reconnecting on non-server
5596 sockets when the remote end goes away. qemu will delay this many
5597 seconds and then attempt to reconnect. Zero disables reconnecting,
5598 and is the default.
5599
5600 ``tls-creds`` requests enablement of the TLS protocol for
5601 encryption, and specifies the id of the TLS credentials to use for
5602 the handshake. The credentials must be previously created with the
5603 ``-object tls-creds`` argument.
5604
5605 ``tls-auth`` provides the ID of the QAuthZ authorization object
5606 against which the client's x509 distinguished name will be
5607 validated. This object is only resolved at time of use, so can be
5608 deleted and recreated on the fly while the chardev server is active.
5609 If missing, it will default to denying access.
5610
5611 TCP and unix socket options are given below:
5612
5613 ``TCP options: port=port[,host=host][,to=to][,ipv4][,ipv6][,nodelay]``
5614 ``host`` for a listening socket specifies the local address to
5615 be bound. For a connecting socket species the remote host to
5616 connect to. ``host`` is optional for listening sockets. If not
5617 specified it defaults to ``0.0.0.0``.
5618
5619 ``port`` for a listening socket specifies the local port to be
5620 bound. For a connecting socket specifies the port on the remote
5621 host to connect to. ``port`` can be given as either a port
5622 number or a service name. ``port`` is required.
5623
5624 ``to`` is only relevant to listening sockets. If it is
5625 specified, and ``port`` cannot be bound, QEMU will attempt to
5626 bind to subsequent ports up to and including ``to`` until it
5627 succeeds. ``to`` must be specified as a port number.
5628
5629 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be
5630 used. If neither is specified the socket may use either
5631 protocol.
5632
5633 ``nodelay`` disables the Nagle algorithm.
5634
5635 ``unix options: path=path``
5636 ``path`` specifies the local path of the unix socket. ``path``
5637 is required.
5638
5639``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4][,ipv6]``
5640 Sends all traffic from the guest to a remote host over UDP.
5641
5642 ``host`` specifies the remote host to connect to. If not specified
5643 it defaults to ``localhost``.
5644
5645 ``port`` specifies the port on the remote host to connect to.
5646 ``port`` is required.
5647
5648 ``localaddr`` specifies the local address to bind to. If not
5649 specified it defaults to ``0.0.0.0``.
5650
5651 ``localport`` specifies the local port to bind to. If not specified
5652 any available local port will be used.
5653
5654 ``ipv4`` and ``ipv6`` specify that either IPv4 or IPv6 must be used.
5655 If neither is specified the device may use either protocol.
5656
5657``-chardev msmouse,id=id``
5658 Forward QEMU's emulated msmouse events to the guest. ``msmouse``
5659 does not take any options.
5660
5661``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]``
5662 Connect to a QEMU text console. ``vc`` may optionally be given a
5663 specific size.
5664
5665 ``width`` and ``height`` specify the width and height respectively
5666 of the console, in pixels.
5667
5668 ``cols`` and ``rows`` specify that the console be sized to fit a
5669 text console with the given dimensions.
5670
5671``-chardev ringbuf,id=id[,size=size]``
5672 Create a ring buffer with fixed size ``size``. size must be a power
5673 of two and defaults to ``64K``.
5674
5675``-chardev file,id=id,path=path``
5676 Log all traffic received from the guest to a file.
5677
5678 ``path`` specifies the path of the file to be opened. This file will
5679 be created if it does not already exist, and overwritten if it does.
5680 ``path`` is required.
5681
5682``-chardev pipe,id=id,path=path``
5683 Create a two-way connection to the guest. The behaviour differs
5684 slightly between Windows hosts and other hosts:
5685
5686 On Windows, a single duplex pipe will be created at
5687 ``\\.pipe\path``.
5688
5689 On other hosts, 2 pipes will be created called ``path.in`` and
5690 ``path.out``. Data written to ``path.in`` will be received by the
5691 guest. Data written by the guest can be read from ``path.out``. QEMU
5692 will not create these fifos, and requires them to be present.
5693
5694 ``path`` forms part of the pipe path as described above. ``path`` is
5695 required.
5696
5697``-chardev console,id=id``
5698 Send traffic from the guest to QEMU's standard output. ``console``
5699 does not take any options.
5700
5701 ``console`` is only available on Windows hosts.
5702
5703``-chardev serial,id=id,path=path``
5704 Send traffic from the guest to a serial device on the host.
5705
5706 On Unix hosts serial will actually accept any tty device, not only
5707 serial lines.
5708
5709 ``path`` specifies the name of the serial device to open.
5710
5711``-chardev pty,id=id``
5712 Create a new pseudo-terminal on the host and connect to it. ``pty``
5713 does not take any options.
5714
5715 ``pty`` is not available on Windows hosts.
5716
5717``-chardev stdio,id=id[,signal=on|off]``
5718 Connect to standard input and standard output of the QEMU process.
5719
5720 ``signal`` controls if signals are enabled on the terminal, that
5721 includes exiting QEMU with the key sequence Control-c. This option
5722 is enabled by default, use ``signal=off`` to disable it.
5723
5724``-chardev braille,id=id``
5725 Connect to a local BrlAPI server. ``braille`` does not take any
5726 options.
5727
5728``-chardev tty,id=id,path=path``
5729 ``tty`` is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD
5730 and DragonFlyBSD hosts. It is an alias for ``serial``.
5731
5732 ``path`` specifies the path to the tty. ``path`` is required.
5733
5734``-chardev parallel,id=id,path=path``; \ ``-chardev parport,id=id,path=path``
5735 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
5736 hosts.
5737
5738 Connect to a local parallel port.
5739
5740 ``path`` specifies the path to the parallel port device. ``path`` is
5741 required.
5742
5743``-chardev spicevmc,id=id,debug=debug,name=name``
5744 ``spicevmc`` is only available when spice support is built in.
5745
5746 ``debug`` debug level for spicevmc
5747
5748 ``name`` name of spice channel to connect to
5749
5750 Connect to a spice virtual machine channel, such as vdiport.
5751
5752``-chardev spiceport,id=id,debug=debug,name=name``
5753 ``spiceport`` is only available when spice support is built in.
5754
5755 ``debug`` debug level for spicevmc
5756
5757 ``name`` name of spice port to connect to
5758
5759 Connect to a spice port, allowing a Spice client to handle the
5760 traffic identified by a name (preferably a fqdn).
5761ERST
Matthew Booth7273a2d2009-10-30 13:41:12 +00005762
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01005763STEXI
5764@end table
5765ETEXI
Matthew Booth7273a2d2009-10-30 13:41:12 +00005766DEFHEADING()
5767
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005768#ifdef CONFIG_TPM
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005769DEFHEADING(TPM device options:)
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005770
5771DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
Stefan Berger92dcc232013-02-27 12:47:54 -05005772 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
5773 " use path to provide path to a character device; default is /dev/tpm0\n"
5774 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
Amarnath Vallurif4ede812017-09-29 14:10:20 +03005775 " not provided it will be searched for in /sys/class/misc/tpm?/device\n"
5776 "-tpmdev emulator,id=id,chardev=dev\n"
5777 " configure the TPM device using chardev backend\n",
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005778 QEMU_ARCH_ALL)
5779STEXI
5780
5781The general form of a TPM device option is:
5782@table @option
5783
Thomas Huth16fdc562018-01-30 10:36:21 +01005784@item -tpmdev @var{backend},id=@var{id}[,@var{options}]
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005785@findex -tpmdev
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005786
5787The specific backend type will determine the applicable options.
Corey Bryant28c4fa32013-03-20 12:34:49 -04005788The @code{-tpmdev} option creates the TPM backend and requires a
5789@code{-device} option that specifies the TPM frontend interface model.
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005790
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005791Use @code{-tpmdev help} to print all available TPM backend types.
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005792
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005793@end table
5794
5795The available backends are:
5796
5797@table @option
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005798
Thomas Huth16fdc562018-01-30 10:36:21 +01005799@item -tpmdev passthrough,id=@var{id},path=@var{path},cancel-path=@var{cancel-path}
Stefan Berger4549a8b2013-02-27 12:47:53 -05005800
5801(Linux-host only) Enable access to the host's TPM using the passthrough
5802driver.
5803
5804@option{path} specifies the path to the host's TPM device, i.e., on
5805a Linux host this would be @code{/dev/tpm0}.
5806@option{path} is optional and by default @code{/dev/tpm0} is used.
5807
Stefan Berger92dcc232013-02-27 12:47:54 -05005808@option{cancel-path} specifies the path to the host TPM device's sysfs
5809entry allowing for cancellation of an ongoing TPM command.
5810@option{cancel-path} is optional and by default QEMU will search for the
5811sysfs entry to use.
5812
Stefan Berger4549a8b2013-02-27 12:47:53 -05005813Some notes about using the host's TPM with the passthrough driver:
5814
5815The TPM device accessed by the passthrough driver must not be
5816used by any other application on the host.
5817
5818Since the host's firmware (BIOS/UEFI) has already initialized the TPM,
5819the VM's firmware (BIOS/UEFI) will not be able to initialize the
5820TPM again and may therefore not show a TPM-specific menu that would
5821otherwise allow the user to configure the TPM, e.g., allow the user to
5822enable/disable or activate/deactivate the TPM.
5823Further, if TPM ownership is released from within a VM then the host's TPM
5824will get disabled and deactivated. To enable and activate the
5825TPM again afterwards, the host has to be rebooted and the user is
5826required to enter the firmware's menu to enable and activate the TPM.
5827If the TPM is left disabled and/or deactivated most TPM commands will fail.
5828
5829To create a passthrough TPM use the following two options:
5830@example
5831-tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5832@end example
5833Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
5834@code{tpmdev=tpm0} in the device option.
5835
Thomas Huth16fdc562018-01-30 10:36:21 +01005836@item -tpmdev emulator,id=@var{id},chardev=@var{dev}
Amarnath Vallurif4ede812017-09-29 14:10:20 +03005837
5838(Linux-host only) Enable access to a TPM emulator using Unix domain socket based
5839chardev backend.
5840
5841@option{chardev} specifies the unique ID of a character device backend that provides connection to the software TPM server.
5842
5843To create a TPM emulator backend device with chardev socket backend:
5844@example
5845
5846-chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5847
5848@end example
5849
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005850ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005851SRST
5852The general form of a TPM device option is:
5853
5854``-tpmdev backend,id=id[,options]``
5855 The specific backend type will determine the applicable options. The
5856 ``-tpmdev`` option creates the TPM backend and requires a
5857 ``-device`` option that specifies the TPM frontend interface model.
5858
5859 Use ``-tpmdev help`` to print all available TPM backend types.
5860
5861The available backends are:
5862
5863``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path``
5864 (Linux-host only) Enable access to the host's TPM using the
5865 passthrough driver.
5866
5867 ``path`` specifies the path to the host's TPM device, i.e., on a
5868 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by
5869 default ``/dev/tpm0`` is used.
5870
5871 ``cancel-path`` specifies the path to the host TPM device's sysfs
5872 entry allowing for cancellation of an ongoing TPM command.
5873 ``cancel-path`` is optional and by default QEMU will search for the
5874 sysfs entry to use.
5875
5876 Some notes about using the host's TPM with the passthrough driver:
5877
5878 The TPM device accessed by the passthrough driver must not be used
5879 by any other application on the host.
5880
5881 Since the host's firmware (BIOS/UEFI) has already initialized the
5882 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize
5883 the TPM again and may therefore not show a TPM-specific menu that
5884 would otherwise allow the user to configure the TPM, e.g., allow the
5885 user to enable/disable or activate/deactivate the TPM. Further, if
5886 TPM ownership is released from within a VM then the host's TPM will
5887 get disabled and deactivated. To enable and activate the TPM again
5888 afterwards, the host has to be rebooted and the user is required to
5889 enter the firmware's menu to enable and activate the TPM. If the TPM
5890 is left disabled and/or deactivated most TPM commands will fail.
5891
5892 To create a passthrough TPM use the following two options:
5893
5894 ::
5895
5896 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
5897
5898 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by
5899 ``tpmdev=tpm0`` in the device option.
5900
5901``-tpmdev emulator,id=id,chardev=dev``
5902 (Linux-host only) Enable access to a TPM emulator using Unix domain
5903 socket based chardev backend.
5904
5905 ``chardev`` specifies the unique ID of a character device backend
5906 that provides connection to the software TPM server.
5907
5908 To create a TPM emulator backend device with chardev socket backend:
5909
5910 ::
5911
5912 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
5913ERST
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005914
Markus Armbruster2252aaf2017-10-02 16:03:05 +02005915STEXI
5916@end table
5917ETEXI
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05005918DEFHEADING()
5919
5920#endif
5921
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005922DEFHEADING(Linux/Multiboot boot specific:)
blueswir15824d652009-03-28 06:44:27 +00005923STEXI
Alexander Graf7677f052009-06-28 16:55:55 +02005924
5925When using these options, you can use a given Linux or Multiboot
5926kernel without installing it in the disk image. It can be useful
blueswir15824d652009-03-28 06:44:27 +00005927for easier testing of various kernels.
5928
5929@table @option
5930ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005931SRST
5932When using these options, you can use a given Linux or Multiboot kernel
5933without installing it in the disk image. It can be useful for easier
5934testing of various kernels.
5935
5936
5937ERST
blueswir15824d652009-03-28 06:44:27 +00005938
5939DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
Blue Swirlad960902010-03-29 19:23:52 +00005940 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00005941STEXI
5942@item -kernel @var{bzImage}
Stefan Weil6616b2a2010-02-05 23:52:05 +01005943@findex -kernel
Alexander Graf7677f052009-06-28 16:55:55 +02005944Use @var{bzImage} as kernel image. The kernel can be either a Linux kernel
5945or in multiboot format.
blueswir15824d652009-03-28 06:44:27 +00005946ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005947SRST
5948``-kernel bzImage``
5949 Use bzImage as kernel image. The kernel can be either a Linux kernel
5950 or in multiboot format.
5951ERST
blueswir15824d652009-03-28 06:44:27 +00005952
5953DEF("append", HAS_ARG, QEMU_OPTION_append, \
Blue Swirlad960902010-03-29 19:23:52 +00005954 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00005955STEXI
5956@item -append @var{cmdline}
Stefan Weil6616b2a2010-02-05 23:52:05 +01005957@findex -append
blueswir15824d652009-03-28 06:44:27 +00005958Use @var{cmdline} as kernel command line
5959ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005960SRST
5961``-append cmdline``
5962 Use cmdline as kernel command line
5963ERST
blueswir15824d652009-03-28 06:44:27 +00005964
5965DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
Blue Swirlad960902010-03-29 19:23:52 +00005966 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00005967STEXI
5968@item -initrd @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01005969@findex -initrd
blueswir15824d652009-03-28 06:44:27 +00005970Use @var{file} as initial ram disk.
Alexander Graf7677f052009-06-28 16:55:55 +02005971
5972@item -initrd "@var{file1} arg=foo,@var{file2}"
5973
5974This syntax is only available with multiboot.
5975
5976Use @var{file1} and @var{file2} as modules and pass arg=foo as parameter to the
5977first module.
blueswir15824d652009-03-28 06:44:27 +00005978ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005979SRST
5980``-initrd file``
5981 Use file as initial ram disk.
5982
5983``-initrd "file1 arg=foo,file2"``
5984 This syntax is only available with multiboot.
5985
5986 Use file1 and file2 as modules and pass arg=foo as parameter to the
5987 first module.
5988ERST
blueswir15824d652009-03-28 06:44:27 +00005989
Grant Likely412beee2012-03-02 11:56:38 +00005990DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \
Peter A. G. Crosthwaite379b5c72012-03-04 21:03:54 +10005991 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL)
Grant Likely412beee2012-03-02 11:56:38 +00005992STEXI
5993@item -dtb @var{file}
5994@findex -dtb
5995Use @var{file} as a device tree binary (dtb) image and pass it to the kernel
5996on boot.
5997ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005998SRST
5999``-dtb file``
6000 Use file as a device tree binary (dtb) image and pass it to the
6001 kernel on boot.
6002ERST
Grant Likely412beee2012-03-02 11:56:38 +00006003
blueswir15824d652009-03-28 06:44:27 +00006004STEXI
6005@end table
6006ETEXI
blueswir15824d652009-03-28 06:44:27 +00006007DEFHEADING()
6008
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02006009DEFHEADING(Debug/Expert options:)
blueswir15824d652009-03-28 06:44:27 +00006010STEXI
6011@table @option
6012ETEXI
6013
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006014DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
6015 "-fw_cfg [name=]<name>,file=<file>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02006016 " add named fw_cfg entry with contents from file\n"
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04006017 "-fw_cfg [name=]<name>,string=<str>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02006018 " add named fw_cfg entry with contents from string\n",
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006019 QEMU_ARCH_ALL)
6020STEXI
Markus Armbruster63d31452016-04-18 18:29:50 +02006021
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006022@item -fw_cfg [name=]@var{name},file=@var{file}
6023@findex -fw_cfg
Markus Armbruster63d31452016-04-18 18:29:50 +02006024Add named fw_cfg entry with contents from file @var{file}.
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04006025
6026@item -fw_cfg [name=]@var{name},string=@var{str}
Markus Armbruster63d31452016-04-18 18:29:50 +02006027Add named fw_cfg entry with contents from string @var{str}.
6028
6029The terminating NUL character of the contents of @var{str} will not be
6030included as part of the fw_cfg item data. To insert contents with
6031embedded NUL characters, you have to use the @var{file} parameter.
6032
6033The fw_cfg entries are passed by QEMU through to the guest.
6034
6035Example:
6036@example
6037 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6038@end example
6039creates an fw_cfg entry named opt/com.mycompany/blob with contents
6040from ./my_blob.bin.
6041
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006042ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006043SRST
6044``-fw_cfg [name=]name,file=file``
6045 Add named fw\_cfg entry with contents from file file.
6046
6047``-fw_cfg [name=]name,string=str``
6048 Add named fw\_cfg entry with contents from string str.
6049
6050 The terminating NUL character of the contents of str will not be
6051 included as part of the fw\_cfg item data. To insert contents with
6052 embedded NUL characters, you have to use the file parameter.
6053
6054 The fw\_cfg entries are passed by QEMU through to the guest.
6055
6056 Example:
6057
6058 ::
6059
6060 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
6061
6062 creates an fw\_cfg entry named opt/com.mycompany/blob with contents
6063 from ./my\_blob.bin.
6064ERST
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04006065
blueswir15824d652009-03-28 06:44:27 +00006066DEF("serial", HAS_ARG, QEMU_OPTION_serial, \
Blue Swirlad960902010-03-29 19:23:52 +00006067 "-serial dev redirect the serial port to char device 'dev'\n",
6068 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006069STEXI
6070@item -serial @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006071@findex -serial
blueswir15824d652009-03-28 06:44:27 +00006072Redirect the virtual serial port to host character device
6073@var{dev}. The default device is @code{vc} in graphical mode and
6074@code{stdio} in non graphical mode.
6075
6076This option can be used several times to simulate up to 4 serial
6077ports.
6078
6079Use @code{-serial none} to disable all serial ports.
6080
6081Available character devices are:
Kevin Wolfb3f046c2009-10-09 10:58:35 +02006082@table @option
Kevin Wolf4e257e52009-10-09 10:58:36 +02006083@item vc[:@var{W}x@var{H}]
blueswir15824d652009-03-28 06:44:27 +00006084Virtual console. Optionally, a width and height can be given in pixel with
6085@example
6086vc:800x600
6087@end example
6088It is also possible to specify width or height in characters:
6089@example
6090vc:80Cx24C
6091@end example
6092@item pty
6093[Linux only] Pseudo TTY (a new PTY is automatically allocated)
6094@item none
6095No device is allocated.
6096@item null
6097void device
Ingo van Lil88e020e2013-12-20 14:44:53 +01006098@item chardev:@var{id}
6099Use a named character device defined with the @code{-chardev} option.
blueswir15824d652009-03-28 06:44:27 +00006100@item /dev/XXX
6101[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
6102parameters are set according to the emulated ones.
6103@item /dev/parport@var{N}
6104[Linux only, parallel port only] Use host parallel port
6105@var{N}. Currently SPP and EPP parallel port features can be used.
6106@item file:@var{filename}
6107Write output to @var{filename}. No character can be read.
6108@item stdio
6109[Unix only] standard input/output
6110@item pipe:@var{filename}
6111name pipe @var{filename}
6112@item COM@var{n}
6113[Windows only] Use host serial port @var{n}
6114@item udp:[@var{remote_host}]:@var{remote_port}[@@[@var{src_ip}]:@var{src_port}]
6115This implements UDP Net Console.
6116When @var{remote_host} or @var{src_ip} are not specified
6117they default to @code{0.0.0.0}.
6118When not using a specified @var{src_port} a random port is automatically chosen.
blueswir15824d652009-03-28 06:44:27 +00006119
6120If you just want a simple readonly console you can use @code{netcat} or
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006121@code{nc}, by starting QEMU with: @code{-serial udp::4555} and nc as:
6122@code{nc -u -l -p 4555}. Any time QEMU writes something to that port it
blueswir15824d652009-03-28 06:44:27 +00006123will appear in the netconsole session.
6124
6125If you plan to send characters back via netconsole or you want to stop
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006126and start QEMU a lot of times, you should have QEMU use the same
blueswir15824d652009-03-28 06:44:27 +00006127source port each time by using something like @code{-serial
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006128udp::4555@@:4556} to QEMU. Another approach is to use a patched
blueswir15824d652009-03-28 06:44:27 +00006129version of netcat which can listen to a TCP port and send and receive
6130characters via udp. If you have a patched version of netcat which
6131activates telnet remote echo and single char transfer, then you can
Marc-André Lureaubd1caa32016-12-22 18:56:38 +04006132use the following options to set up a netcat redirector to allow
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006133telnet on port 5555 to access the QEMU port.
blueswir15824d652009-03-28 06:44:27 +00006134@table @code
Stefan Weil071c9392012-04-07 09:23:36 +02006135@item QEMU Options:
blueswir15824d652009-03-28 06:44:27 +00006136-serial udp::4555@@:4556
6137@item netcat options:
6138-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6139@item telnet options:
6140localhost 5555
6141@end table
6142
Corey Minyard5dd1f022014-10-02 11:17:37 -05006143@item tcp:[@var{host}]:@var{port}[,@var{server}][,nowait][,nodelay][,reconnect=@var{seconds}]
blueswir15824d652009-03-28 06:44:27 +00006144The TCP Net Console has two modes of operation. It can send the serial
6145I/O to a location or wait for a connection from a location. By default
6146the TCP Net Console is sent to @var{host} at the @var{port}. If you use
6147the @var{server} option QEMU will wait for a client socket application
6148to connect to the port before continuing, unless the @code{nowait}
6149option was specified. The @code{nodelay} option disables the Nagle buffering
Corey Minyard5dd1f022014-10-02 11:17:37 -05006150algorithm. The @code{reconnect} option only applies if @var{noserver} is
6151set, if the connection goes down it will attempt to reconnect at the
6152given interval. If @var{host} is omitted, 0.0.0.0 is assumed. Only
blueswir15824d652009-03-28 06:44:27 +00006153one TCP connection at a time is accepted. You can use @code{telnet} to
6154connect to the corresponding character device.
6155@table @code
6156@item Example to send tcp console to 192.168.0.2 port 4444
6157-serial tcp:192.168.0.2:4444
6158@item Example to listen and wait on port 4444 for connection
6159-serial tcp::4444,server
6160@item Example to not wait and listen on ip 192.168.0.100 port 4444
6161-serial tcp:192.168.0.100:4444,server,nowait
6162@end table
6163
6164@item telnet:@var{host}:@var{port}[,server][,nowait][,nodelay]
6165The telnet protocol is used instead of raw tcp sockets. The options
6166work the same as if you had specified @code{-serial tcp}. The
6167difference is that the port acts like a telnet server or client using
6168telnet option negotiation. This will also allow you to send the
6169MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
6170sequence. Typically in unix telnet you do it with Control-] and then
6171type "send break" followed by pressing the enter key.
6172
Julia Suvorova981b06e2018-10-19 01:35:00 +03006173@item websocket:@var{host}:@var{port},server[,nowait][,nodelay]
6174The WebSocket protocol is used instead of raw tcp socket. The port acts as
6175a WebSocket server. Client mode is not supported.
6176
Corey Minyard5dd1f022014-10-02 11:17:37 -05006177@item unix:@var{path}[,server][,nowait][,reconnect=@var{seconds}]
blueswir15824d652009-03-28 06:44:27 +00006178A unix domain socket is used instead of a tcp socket. The option works the
6179same as if you had specified @code{-serial tcp} except the unix domain socket
6180@var{path} is used for connections.
6181
6182@item mon:@var{dev_string}
6183This is a special option to allow the monitor to be multiplexed onto
6184another serial port. The monitor is accessed with key sequence of
Paolo Bonzini02c4bdf2013-07-03 20:29:45 +04006185@key{Control-a} and then pressing @key{c}.
blueswir15824d652009-03-28 06:44:27 +00006186@var{dev_string} should be any one of the serial devices specified
6187above. An example to multiplex the monitor onto a telnet server
6188listening on port 4444 would be:
6189@table @code
6190@item -serial mon:telnet::4444,server,nowait
6191@end table
Michael Tokarevbe022d62013-07-11 12:55:50 +04006192When the monitor is multiplexed to stdio in this way, Ctrl+C will not terminate
6193QEMU any more but will be passed to the guest instead.
blueswir15824d652009-03-28 06:44:27 +00006194
6195@item braille
6196Braille device. This will use BrlAPI to display the braille output on a real
6197or fake device.
6198
Kevin Wolfbe8b28a2009-10-09 10:58:37 +02006199@item msmouse
6200Three button serial mouse. Configure the guest to use Microsoft protocol.
blueswir15824d652009-03-28 06:44:27 +00006201@end table
6202ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006203SRST
6204``-serial dev``
6205 Redirect the virtual serial port to host character device dev. The
6206 default device is ``vc`` in graphical mode and ``stdio`` in non
6207 graphical mode.
6208
6209 This option can be used several times to simulate up to 4 serial
6210 ports.
6211
6212 Use ``-serial none`` to disable all serial ports.
6213
6214 Available character devices are:
6215
6216 ``vc[:WxH]``
6217 Virtual console. Optionally, a width and height can be given in
6218 pixel with
6219
6220 ::
6221
6222 vc:800x600
6223
6224 It is also possible to specify width or height in characters:
6225
6226 ::
6227
6228 vc:80Cx24C
6229
6230 ``pty``
6231 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
6232
6233 ``none``
6234 No device is allocated.
6235
6236 ``null``
6237 void device
6238
6239 ``chardev:id``
6240 Use a named character device defined with the ``-chardev``
6241 option.
6242
6243 ``/dev/XXX``
6244 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial
6245 port parameters are set according to the emulated ones.
6246
6247 ``/dev/parportN``
6248 [Linux only, parallel port only] Use host parallel port N.
6249 Currently SPP and EPP parallel port features can be used.
6250
6251 ``file:filename``
6252 Write output to filename. No character can be read.
6253
6254 ``stdio``
6255 [Unix only] standard input/output
6256
6257 ``pipe:filename``
6258 name pipe filename
6259
6260 ``COMn``
6261 [Windows only] Use host serial port n
6262
6263 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]``
6264 This implements UDP Net Console. When remote\_host or src\_ip
6265 are not specified they default to ``0.0.0.0``. When not using a
6266 specified src\_port a random port is automatically chosen.
6267
6268 If you just want a simple readonly console you can use
6269 ``netcat`` or ``nc``, by starting QEMU with:
6270 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time
6271 QEMU writes something to that port it will appear in the
6272 netconsole session.
6273
6274 If you plan to send characters back via netconsole or you want
6275 to stop and start QEMU a lot of times, you should have QEMU use
6276 the same source port each time by using something like ``-serial
6277 udp::4555@:4556`` to QEMU. Another approach is to use a patched
6278 version of netcat which can listen to a TCP port and send and
6279 receive characters via udp. If you have a patched version of
6280 netcat which activates telnet remote echo and single char
6281 transfer, then you can use the following options to set up a
6282 netcat redirector to allow telnet on port 5555 to access the
6283 QEMU port.
6284
6285 ``QEMU Options:``
6286 -serial udp::4555@:4556
6287
6288 ``netcat options:``
6289 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
6290
6291 ``telnet options:``
6292 localhost 5555
6293
6294 ``tcp:[host]:port[,server][,nowait][,nodelay][,reconnect=seconds]``
6295 The TCP Net Console has two modes of operation. It can send the
6296 serial I/O to a location or wait for a connection from a
6297 location. By default the TCP Net Console is sent to host at the
6298 port. If you use the server option QEMU will wait for a client
6299 socket application to connect to the port before continuing,
6300 unless the ``nowait`` option was specified. The ``nodelay``
6301 option disables the Nagle buffering algorithm. The ``reconnect``
6302 option only applies if noserver is set, if the connection goes
6303 down it will attempt to reconnect at the given interval. If host
6304 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a
6305 time is accepted. You can use ``telnet`` to connect to the
6306 corresponding character device.
6307
6308 ``Example to send tcp console to 192.168.0.2 port 4444``
6309 -serial tcp:192.168.0.2:4444
6310
6311 ``Example to listen and wait on port 4444 for connection``
6312 -serial tcp::4444,server
6313
6314 ``Example to not wait and listen on ip 192.168.0.100 port 4444``
6315 -serial tcp:192.168.0.100:4444,server,nowait
6316
6317 ``telnet:host:port[,server][,nowait][,nodelay]``
6318 The telnet protocol is used instead of raw tcp sockets. The
6319 options work the same as if you had specified ``-serial tcp``.
6320 The difference is that the port acts like a telnet server or
6321 client using telnet option negotiation. This will also allow you
6322 to send the MAGIC\_SYSRQ sequence if you use a telnet that
6323 supports sending the break sequence. Typically in unix telnet
6324 you do it with Control-] and then type "send break" followed by
6325 pressing the enter key.
6326
6327 ``websocket:host:port,server[,nowait][,nodelay]``
6328 The WebSocket protocol is used instead of raw tcp socket. The
6329 port acts as a WebSocket server. Client mode is not supported.
6330
6331 ``unix:path[,server][,nowait][,reconnect=seconds]``
6332 A unix domain socket is used instead of a tcp socket. The option
6333 works the same as if you had specified ``-serial tcp`` except
6334 the unix domain socket path is used for connections.
6335
6336 ``mon:dev_string``
6337 This is a special option to allow the monitor to be multiplexed
6338 onto another serial port. The monitor is accessed with key
6339 sequence of Control-a and then pressing c. dev\_string should be
6340 any one of the serial devices specified above. An example to
6341 multiplex the monitor onto a telnet server listening on port
6342 4444 would be:
6343
6344 ``-serial mon:telnet::4444,server,nowait``
6345
6346 When the monitor is multiplexed to stdio in this way, Ctrl+C
6347 will not terminate QEMU any more but will be passed to the guest
6348 instead.
6349
6350 ``braille``
6351 Braille device. This will use BrlAPI to display the braille
6352 output on a real or fake device.
6353
6354 ``msmouse``
6355 Three button serial mouse. Configure the guest to use Microsoft
6356 protocol.
6357ERST
blueswir15824d652009-03-28 06:44:27 +00006358
6359DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
Blue Swirlad960902010-03-29 19:23:52 +00006360 "-parallel dev redirect the parallel port to char device 'dev'\n",
6361 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006362STEXI
6363@item -parallel @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006364@findex -parallel
blueswir15824d652009-03-28 06:44:27 +00006365Redirect the virtual parallel port to host device @var{dev} (same
6366devices as the serial port). On Linux hosts, @file{/dev/parportN} can
6367be used to use hardware devices connected on the corresponding host
6368parallel port.
6369
6370This option can be used several times to simulate up to 3 parallel
6371ports.
6372
6373Use @code{-parallel none} to disable all parallel ports.
6374ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006375SRST
6376``-parallel dev``
6377 Redirect the virtual parallel port to host device dev (same devices
6378 as the serial port). On Linux hosts, ``/dev/parportN`` can be used
6379 to use hardware devices connected on the corresponding host parallel
6380 port.
6381
6382 This option can be used several times to simulate up to 3 parallel
6383 ports.
6384
6385 Use ``-parallel none`` to disable all parallel ports.
6386ERST
blueswir15824d652009-03-28 06:44:27 +00006387
6388DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
Blue Swirlad960902010-03-29 19:23:52 +00006389 "-monitor dev redirect the monitor to char device 'dev'\n",
6390 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006391STEXI
Gerd Hoffmann4e307fc2009-12-08 13:11:37 +01006392@item -monitor @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006393@findex -monitor
blueswir15824d652009-03-28 06:44:27 +00006394Redirect the monitor to host device @var{dev} (same devices as the
6395serial port).
6396The default device is @code{vc} in graphical mode and @code{stdio} in
6397non graphical mode.
Luiz Capitulino70e098a2013-05-16 12:02:55 -04006398Use @code{-monitor none} to disable the default monitor.
blueswir15824d652009-03-28 06:44:27 +00006399ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006400SRST
6401``-monitor dev``
6402 Redirect the monitor to host device dev (same devices as the serial
6403 port). The default device is ``vc`` in graphical mode and ``stdio``
6404 in non graphical mode. Use ``-monitor none`` to disable the default
6405 monitor.
6406ERST
Gerd Hoffmann6ca55822009-12-08 13:11:52 +01006407DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
Blue Swirlad960902010-03-29 19:23:52 +00006408 "-qmp dev like -monitor but opens in 'control' mode\n",
6409 QEMU_ARCH_ALL)
Stefan Weil95d5f082010-01-20 22:25:27 +01006410STEXI
6411@item -qmp @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006412@findex -qmp
Stefan Weil95d5f082010-01-20 22:25:27 +01006413Like -monitor but opens in 'control' mode.
6414ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006415SRST
6416``-qmp dev``
6417 Like -monitor but opens in 'control' mode.
6418ERST
Max Reitz4821cd42014-11-17 13:31:04 +01006419DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
6420 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
6421 QEMU_ARCH_ALL)
6422STEXI
6423@item -qmp-pretty @var{dev}
6424@findex -qmp-pretty
6425Like -qmp but uses pretty JSON formatting.
6426ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006427SRST
6428``-qmp-pretty dev``
6429 Like -qmp but uses pretty JSON formatting.
6430ERST
blueswir15824d652009-03-28 06:44:27 +00006431
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006432DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006433 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL)
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006434STEXI
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006435@item -mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006436@findex -mon
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01006437Setup monitor on chardev @var{name}. @code{pretty} turns on JSON pretty printing
6438easing human reading and debugging.
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006439ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006440SRST
6441``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]``
6442 Setup monitor on chardev name. ``pretty`` turns on JSON pretty
6443 printing easing human reading and debugging.
6444ERST
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01006445
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006446DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
Blue Swirlad960902010-03-29 19:23:52 +00006447 "-debugcon dev redirect the debug console to char device 'dev'\n",
6448 QEMU_ARCH_ALL)
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006449STEXI
6450@item -debugcon @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006451@findex -debugcon
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006452Redirect the debug console to host device @var{dev} (same devices as the
6453serial port). The debug console is an I/O port which is typically port
64540xe9; writing to that I/O port sends output to this device.
6455The default device is @code{vc} in graphical mode and @code{stdio} in
6456non graphical mode.
6457ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006458SRST
6459``-debugcon dev``
6460 Redirect the debug console to host device dev (same devices as the
6461 serial port). The debug console is an I/O port which is typically
6462 port 0xe9; writing to that I/O port sends output to this device. The
6463 default device is ``vc`` in graphical mode and ``stdio`` in non
6464 graphical mode.
6465ERST
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08006466
blueswir15824d652009-03-28 06:44:27 +00006467DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
Blue Swirlad960902010-03-29 19:23:52 +00006468 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006469STEXI
6470@item -pidfile @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006471@findex -pidfile
blueswir15824d652009-03-28 06:44:27 +00006472Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
6473from a script.
6474ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006475SRST
6476``-pidfile file``
6477 Store the QEMU process PID in file. It is useful if you launch QEMU
6478 from a script.
6479ERST
blueswir15824d652009-03-28 06:44:27 +00006480
aurel321b530a62009-04-05 20:08:59 +00006481DEF("singlestep", 0, QEMU_OPTION_singlestep, \
Blue Swirlad960902010-03-29 19:23:52 +00006482 "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL)
aurel321b530a62009-04-05 20:08:59 +00006483STEXI
6484@item -singlestep
Stefan Weil6616b2a2010-02-05 23:52:05 +01006485@findex -singlestep
aurel321b530a62009-04-05 20:08:59 +00006486Run the emulation in single step mode.
6487ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006488SRST
6489``-singlestep``
6490 Run the emulation in single step mode.
6491ERST
aurel321b530a62009-04-05 20:08:59 +00006492
Igor Mammedov047f7032018-05-11 19:24:43 +02006493DEF("preconfig", 0, QEMU_OPTION_preconfig, \
Markus Armbruster361ac942018-07-05 11:14:02 +02006494 "--preconfig pause QEMU before machine is initialized (experimental)\n",
Igor Mammedov047f7032018-05-11 19:24:43 +02006495 QEMU_ARCH_ALL)
6496STEXI
6497@item --preconfig
6498@findex --preconfig
6499Pause QEMU for interactive configuration before the machine is created,
6500which allows querying and configuring properties that will affect
Markus Armbruster361ac942018-07-05 11:14:02 +02006501machine initialization. Use QMP command 'x-exit-preconfig' to exit
6502the preconfig state and move to the next state (i.e. run guest if -S
6503isn't used or pause the second time if -S is used). This option is
6504experimental.
Igor Mammedov047f7032018-05-11 19:24:43 +02006505ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006506SRST
6507``--preconfig``
6508 Pause QEMU for interactive configuration before the machine is
6509 created, which allows querying and configuring properties that will
6510 affect machine initialization. Use QMP command 'x-exit-preconfig' to
6511 exit the preconfig state and move to the next state (i.e. run guest
6512 if -S isn't used or pause the second time if -S is used). This
6513 option is experimental.
6514ERST
Igor Mammedov047f7032018-05-11 19:24:43 +02006515
blueswir15824d652009-03-28 06:44:27 +00006516DEF("S", 0, QEMU_OPTION_S, \
Blue Swirlad960902010-03-29 19:23:52 +00006517 "-S freeze CPU at startup (use 'c' to start execution)\n",
6518 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006519STEXI
6520@item -S
Stefan Weil6616b2a2010-02-05 23:52:05 +01006521@findex -S
blueswir15824d652009-03-28 06:44:27 +00006522Do not start CPU at startup (you must type 'c' in the monitor).
6523ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006524SRST
6525``-S``
6526 Do not start CPU at startup (you must type 'c' in the monitor).
6527ERST
blueswir15824d652009-03-28 06:44:27 +00006528
Satoru Moriya888a6bc2013-04-19 16:42:06 +02006529DEF("realtime", HAS_ARG, QEMU_OPTION_realtime,
6530 "-realtime [mlock=on|off]\n"
6531 " run qemu with realtime features\n"
6532 " mlock=on|off controls mlock support (default: on)\n",
6533 QEMU_ARCH_ALL)
6534STEXI
6535@item -realtime mlock=on|off
6536@findex -realtime
6537Run qemu with realtime features.
6538mlocking qemu and guest memory can be enabled via @option{mlock=on}
6539(enabled by default).
6540ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006541SRST
6542``-realtime mlock=on|off``
6543 Run qemu with realtime features. mlocking qemu and guest memory can
6544 be enabled via ``mlock=on`` (enabled by default).
6545ERST
Satoru Moriya888a6bc2013-04-19 16:42:06 +02006546
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006547DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02006548 "-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006549 " run qemu with overcommit hints\n"
6550 " mem-lock=on|off controls memory lock support (default: off)\n"
6551 " cpu-pm=on|off controls cpu power management (default: off)\n",
6552 QEMU_ARCH_ALL)
6553STEXI
6554@item -overcommit mem-lock=on|off
6555@item -overcommit cpu-pm=on|off
6556@findex -overcommit
6557Run qemu with hints about host resource overcommit. The default is
6558to assume that host overcommits all resources.
6559
6560Locking qemu and guest memory can be enabled via @option{mem-lock=on} (disabled
6561by default). This works when host memory is not overcommitted and reduces the
6562worst-case latency for guest. This is equivalent to @option{realtime}.
6563
6564Guest ability to manage power state of host cpus (increasing latency for other
6565processes on the same host cpu, but decreasing latency for guest) can be
6566enabled via @option{cpu-pm=on} (disabled by default). This works best when
6567host CPU is not overcommitted. When used, host estimates of CPU cycle and power
6568utilization will be incorrect, not taking into account guest idle time.
6569ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006570SRST
6571``-overcommit mem-lock=on|off``
6572``-overcommit cpu-pm=on|off``
6573 Run qemu with hints about host resource overcommit. The default is
6574 to assume that host overcommits all resources.
6575
6576 Locking qemu and guest memory can be enabled via ``mem-lock=on``
6577 (disabled by default). This works when host memory is not
6578 overcommitted and reduces the worst-case latency for guest. This is
6579 equivalent to ``realtime``.
6580
6581 Guest ability to manage power state of host cpus (increasing latency
6582 for other processes on the same host cpu, but decreasing latency for
6583 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This
6584 works best when host CPU is not overcommitted. When used, host
6585 estimates of CPU cycle and power utilization will be incorrect, not
6586 taking into account guest idle time.
6587ERST
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03006588
aliguori59030a82009-04-05 18:43:41 +00006589DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
Blue Swirlad960902010-03-29 19:23:52 +00006590 "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006591STEXI
aliguori59030a82009-04-05 18:43:41 +00006592@item -gdb @var{dev}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006593@findex -gdb
aliguori59030a82009-04-05 18:43:41 +00006594Wait for gdb connection on device @var{dev} (@pxref{gdb_usage}). Typical
6595connections will likely be TCP-based, but also UDP, pseudo TTY, or even
Stefan Weilb65ee4f2012-05-11 22:25:50 +02006596stdio are reasonable use case. The latter is allowing to start QEMU from
aliguori59030a82009-04-05 18:43:41 +00006597within gdb and establish the connection via a pipe:
6598@example
Thomas Huth664785a2019-07-30 17:08:26 +02006599(gdb) target remote | exec @value{qemu_system} -gdb stdio ...
aliguori59030a82009-04-05 18:43:41 +00006600@end example
blueswir15824d652009-03-28 06:44:27 +00006601ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006602SRST
6603``-gdb dev``
6604 Wait for gdb connection on device dev (see
6605 :ref:`gdb_005fusage`). Typical connections will likely be
6606 TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable
6607 use case. The latter is allowing to start QEMU from within gdb and
6608 establish the connection via a pipe:
6609
6610 ::
6611
6612 (gdb) target remote | exec |qemu_system| -gdb stdio ...
6613ERST
blueswir15824d652009-03-28 06:44:27 +00006614
aliguori59030a82009-04-05 18:43:41 +00006615DEF("s", 0, QEMU_OPTION_s, \
Blue Swirlad960902010-03-29 19:23:52 +00006616 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n",
6617 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006618STEXI
aliguori59030a82009-04-05 18:43:41 +00006619@item -s
Stefan Weil6616b2a2010-02-05 23:52:05 +01006620@findex -s
aliguori59030a82009-04-05 18:43:41 +00006621Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6622(@pxref{gdb_usage}).
blueswir15824d652009-03-28 06:44:27 +00006623ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006624SRST
6625``-s``
6626 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
6627 (see :ref:`gdb_005fusage`).
6628ERST
blueswir15824d652009-03-28 06:44:27 +00006629
6630DEF("d", HAS_ARG, QEMU_OPTION_d, \
Peter Maydell989b6972013-02-26 17:52:40 +00006631 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n",
Blue Swirlad960902010-03-29 19:23:52 +00006632 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006633STEXI
Peter Maydell989b6972013-02-26 17:52:40 +00006634@item -d @var{item1}[,...]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006635@findex -d
Peter Maydell989b6972013-02-26 17:52:40 +00006636Enable logging of specified items. Use '-d help' for a list of log items.
blueswir15824d652009-03-28 06:44:27 +00006637ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006638SRST
6639``-d item1[,...]``
6640 Enable logging of specified items. Use '-d help' for a list of log
6641 items.
6642ERST
blueswir15824d652009-03-28 06:44:27 +00006643
Matthew Fernandezc235d732011-06-07 16:32:40 +00006644DEF("D", HAS_ARG, QEMU_OPTION_D, \
Peter Maydell989b6972013-02-26 17:52:40 +00006645 "-D logfile output log to logfile (default stderr)\n",
Matthew Fernandezc235d732011-06-07 16:32:40 +00006646 QEMU_ARCH_ALL)
6647STEXI
Stefan Weil8bd383b2012-05-11 22:40:50 +02006648@item -D @var{logfile}
Matthew Fernandezc235d732011-06-07 16:32:40 +00006649@findex -D
Peter Maydell989b6972013-02-26 17:52:40 +00006650Output log in @var{logfile} instead of to stderr
Matthew Fernandezc235d732011-06-07 16:32:40 +00006651ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006652SRST
6653``-D logfile``
6654 Output log in logfile instead of to stderr
6655ERST
Matthew Fernandezc235d732011-06-07 16:32:40 +00006656
Alex Bennée35145522016-03-15 14:30:20 +00006657DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \
6658 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n",
6659 QEMU_ARCH_ALL)
6660STEXI
6661@item -dfilter @var{range1}[,...]
6662@findex -dfilter
6663Filter debug output to that relevant to a range of target addresses. The filter
6664spec can be either @var{start}+@var{size}, @var{start}-@var{size} or
6665@var{start}..@var{end} where @var{start} @var{end} and @var{size} are the
6666addresses and sizes required. For example:
6667@example
6668 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6669@end example
6670Will dump output for any code in the 0x1000 sized block starting at 0x8000 and
6671the 0x200 sized block starting at 0xffffffc000080000 and another 0x1000 sized
6672block starting at 0xffffffc00005f000.
6673ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006674SRST
6675``-dfilter range1[,...]``
6676 Filter debug output to that relevant to a range of target addresses.
6677 The filter spec can be either start+size, start-size or start..end
6678 where start end and size are the addresses and sizes required. For
6679 example:
6680
6681 ::
6682
6683 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
6684
6685 Will dump output for any code in the 0x1000 sized block starting at
6686 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and
6687 another 0x1000 sized block starting at 0xffffffc00005f000.
6688ERST
Alex Bennée35145522016-03-15 14:30:20 +00006689
Richard Henderson9c09a252019-03-14 13:06:29 -07006690DEF("seed", HAS_ARG, QEMU_OPTION_seed, \
6691 "-seed number seed the pseudo-random number generator\n",
6692 QEMU_ARCH_ALL)
6693STEXI
6694@item -seed @var{number}
6695@findex -seed
6696Force the guest to use a deterministic pseudo-random number generator, seeded
6697with @var{number}. This does not affect crypto routines within the host.
6698ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006699SRST
6700``-seed number``
6701 Force the guest to use a deterministic pseudo-random number
6702 generator, seeded with number. This does not affect crypto routines
6703 within the host.
6704ERST
Richard Henderson9c09a252019-03-14 13:06:29 -07006705
blueswir15824d652009-03-28 06:44:27 +00006706DEF("L", HAS_ARG, QEMU_OPTION_L, \
Blue Swirlad960902010-03-29 19:23:52 +00006707 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n",
6708 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006709STEXI
6710@item -L @var{path}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006711@findex -L
blueswir15824d652009-03-28 06:44:27 +00006712Set the directory for the BIOS, VGA BIOS and keymaps.
Richard W.M. Jones37146e72016-05-16 17:34:35 +01006713
6714To list all the data directories, use @code{-L help}.
blueswir15824d652009-03-28 06:44:27 +00006715ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006716SRST
6717``-L path``
6718 Set the directory for the BIOS, VGA BIOS and keymaps.
6719
6720 To list all the data directories, use ``-L help``.
6721ERST
blueswir15824d652009-03-28 06:44:27 +00006722
6723DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
Blue Swirlad960902010-03-29 19:23:52 +00006724 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006725STEXI
6726@item -bios @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006727@findex -bios
blueswir15824d652009-03-28 06:44:27 +00006728Set the filename for the BIOS.
6729ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006730SRST
6731``-bios file``
6732 Set the filename for the BIOS.
6733ERST
blueswir15824d652009-03-28 06:44:27 +00006734
blueswir15824d652009-03-28 06:44:27 +00006735DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
Blue Swirlad960902010-03-29 19:23:52 +00006736 "-enable-kvm enable KVM full virtualization support\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006737STEXI
6738@item -enable-kvm
Stefan Weil6616b2a2010-02-05 23:52:05 +01006739@findex -enable-kvm
blueswir15824d652009-03-28 06:44:27 +00006740Enable KVM full virtualization support. This option is only available
6741if KVM support is enabled when compiling.
6742ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006743SRST
6744``-enable-kvm``
6745 Enable KVM full virtualization support. This option is only
6746 available if KVM support is enabled when compiling.
6747ERST
blueswir15824d652009-03-28 06:44:27 +00006748
aliguorie37630c2009-04-22 15:19:10 +00006749DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
Blue Swirlad960902010-03-29 19:23:52 +00006750 "-xen-domid id specify xen guest domain id\n", QEMU_ARCH_ALL)
aliguorie37630c2009-04-22 15:19:10 +00006751DEF("xen-attach", 0, QEMU_OPTION_xen_attach,
6752 "-xen-attach attach to existing xen domain\n"
Anthony PERARD1077bca2018-09-14 12:18:30 +01006753 " libxl will use this when starting QEMU\n",
Blue Swirlad960902010-03-29 19:23:52 +00006754 QEMU_ARCH_ALL)
Paul Durrant1c599472017-03-22 09:39:15 +00006755DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict,
6756 "-xen-domid-restrict restrict set of available xen operations\n"
6757 " to specified domain id. (Does not affect\n"
6758 " xenpv machine type).\n",
6759 QEMU_ARCH_ALL)
Stefan Weil95d5f082010-01-20 22:25:27 +01006760STEXI
6761@item -xen-domid @var{id}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006762@findex -xen-domid
Stefan Weil95d5f082010-01-20 22:25:27 +01006763Specify xen guest domain @var{id} (XEN only).
Stefan Weil95d5f082010-01-20 22:25:27 +01006764@item -xen-attach
Stefan Weil6616b2a2010-02-05 23:52:05 +01006765@findex -xen-attach
Stefan Weil95d5f082010-01-20 22:25:27 +01006766Attach to existing xen domain.
Anthony PERARD1077bca2018-09-14 12:18:30 +01006767libxl will use this when starting QEMU (XEN only).
Paul Durrant1c599472017-03-22 09:39:15 +00006768@findex -xen-domid-restrict
6769Restrict set of available xen operations to specified domain id (XEN only).
Stefan Weil95d5f082010-01-20 22:25:27 +01006770ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006771SRST
6772``-xen-domid id``
6773 Specify xen guest domain id (XEN only).
6774
6775``-xen-attach``
6776 Attach to existing xen domain. libxl will use this when starting
6777 QEMU (XEN only). Restrict set of available xen operations to
6778 specified domain id (XEN only).
6779ERST
aliguorie37630c2009-04-22 15:19:10 +00006780
blueswir15824d652009-03-28 06:44:27 +00006781DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
Blue Swirlad960902010-03-29 19:23:52 +00006782 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006783STEXI
6784@item -no-reboot
Stefan Weil6616b2a2010-02-05 23:52:05 +01006785@findex -no-reboot
blueswir15824d652009-03-28 06:44:27 +00006786Exit instead of rebooting.
6787ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006788SRST
6789``-no-reboot``
6790 Exit instead of rebooting.
6791ERST
blueswir15824d652009-03-28 06:44:27 +00006792
6793DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \
Blue Swirlad960902010-03-29 19:23:52 +00006794 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006795STEXI
6796@item -no-shutdown
Stefan Weil6616b2a2010-02-05 23:52:05 +01006797@findex -no-shutdown
blueswir15824d652009-03-28 06:44:27 +00006798Don't exit QEMU on guest shutdown, but instead only stop the emulation.
6799This allows for instance switching to monitor to commit changes to the
6800disk image.
6801ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006802SRST
6803``-no-shutdown``
6804 Don't exit QEMU on guest shutdown, but instead only stop the
6805 emulation. This allows for instance switching to monitor to commit
6806 changes to the disk image.
6807ERST
blueswir15824d652009-03-28 06:44:27 +00006808
6809DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \
6810 "-loadvm [tag|id]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00006811 " start right away with a saved state (loadvm in monitor)\n",
6812 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006813STEXI
6814@item -loadvm @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006815@findex -loadvm
blueswir15824d652009-03-28 06:44:27 +00006816Start right away with a saved state (@code{loadvm} in monitor)
6817ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006818SRST
6819``-loadvm file``
6820 Start right away with a saved state (``loadvm`` in monitor)
6821ERST
blueswir15824d652009-03-28 06:44:27 +00006822
6823#ifndef _WIN32
6824DEF("daemonize", 0, QEMU_OPTION_daemonize, \
Blue Swirlad960902010-03-29 19:23:52 +00006825 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006826#endif
6827STEXI
6828@item -daemonize
Stefan Weil6616b2a2010-02-05 23:52:05 +01006829@findex -daemonize
blueswir15824d652009-03-28 06:44:27 +00006830Daemonize the QEMU process after initialization. QEMU will not detach from
6831standard IO until it is ready to receive connections on any of its devices.
6832This option is a useful way for external programs to launch QEMU without having
6833to cope with initialization race conditions.
6834ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006835SRST
6836``-daemonize``
6837 Daemonize the QEMU process after initialization. QEMU will not
6838 detach from standard IO until it is ready to receive connections on
6839 any of its devices. This option is a useful way for external
6840 programs to launch QEMU without having to cope with initialization
6841 race conditions.
6842ERST
blueswir15824d652009-03-28 06:44:27 +00006843
6844DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \
Blue Swirlad960902010-03-29 19:23:52 +00006845 "-option-rom rom load a file, rom, into the option ROM space\n",
6846 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006847STEXI
6848@item -option-rom @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01006849@findex -option-rom
blueswir15824d652009-03-28 06:44:27 +00006850Load the contents of @var{file} as an option ROM.
6851This option is useful to load things like EtherBoot.
6852ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006853SRST
6854``-option-rom file``
6855 Load the contents of file as an option ROM. This option is useful to
6856 load things like EtherBoot.
6857ERST
blueswir15824d652009-03-28 06:44:27 +00006858
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006859DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
Artem Pisarenko238d1242018-10-18 13:12:52 +06006860 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00006861 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
6862 QEMU_ARCH_ALL)
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006863
blueswir15824d652009-03-28 06:44:27 +00006864STEXI
6865
Artem Pisarenko238d1242018-10-18 13:12:52 +06006866@item -rtc [base=utc|localtime|@var{datetime}][,clock=host|rt|vm][,driftfix=none|slew]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006867@findex -rtc
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006868Specify @option{base} as @code{utc} or @code{localtime} to let the RTC start at the current
6869UTC or local time, respectively. @code{localtime} is required for correct date in
Artem Pisarenko238d1242018-10-18 13:12:52 +06006870MS-DOS or Windows. To start at a specific point in time, provide @var{datetime} in the
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006871format @code{2006-06-17T16:01:21} or @code{2006-06-17}. The default base is UTC.
6872
Michael Tokarev9d85d552014-04-07 13:34:58 +04006873By default the RTC is driven by the host system time. This allows using of the
Jan Kiszka68752042009-09-15 13:36:04 +02006874RTC as accurate reference clock inside the guest, specifically if the host
6875time is smoothly following an accurate external reference clock, e.g. via NTP.
Paolo Bonzini78808142012-03-30 10:31:21 +00006876If you want to isolate the guest time from the host, you can set @option{clock}
Artem Pisarenko238d1242018-10-18 13:12:52 +06006877to @code{rt} instead, which provides a host monotonic clock if host support it.
6878To even prevent the RTC from progressing during suspension, you can set @option{clock}
6879to @code{vm} (virtual clock). @samp{clock=vm} is recommended especially in
6880icount mode in order to preserve determinism; however, note that in icount mode
6881the speed of the virtual clock is variable and can in general differ from the
6882host clock.
Jan Kiszka68752042009-09-15 13:36:04 +02006883
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02006884Enable @option{driftfix} (i386 targets only) if you experience time drift problems,
6885specifically with Windows' ACPI HAL. This option will try to figure out how
6886many timer interrupts were not processed by the Windows guest and will
6887re-inject them.
blueswir15824d652009-03-28 06:44:27 +00006888ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006889SRST
6890``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]``
6891 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at
6892 the current UTC or local time, respectively. ``localtime`` is
6893 required for correct date in MS-DOS or Windows. To start at a
6894 specific point in time, provide datetime in the format
6895 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC.
6896
6897 By default the RTC is driven by the host system time. This allows
6898 using of the RTC as accurate reference clock inside the guest,
6899 specifically if the host time is smoothly following an accurate
6900 external reference clock, e.g. via NTP. If you want to isolate the
6901 guest time from the host, you can set ``clock`` to ``rt`` instead,
6902 which provides a host monotonic clock if host support it. To even
6903 prevent the RTC from progressing during suspension, you can set
6904 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is
6905 recommended especially in icount mode in order to preserve
6906 determinism; however, note that in icount mode the speed of the
6907 virtual clock is variable and can in general differ from the host
6908 clock.
6909
6910 Enable ``driftfix`` (i386 targets only) if you experience time drift
6911 problems, specifically with Windows' ACPI HAL. This option will try
6912 to figure out how many timer interrupts were not processed by the
6913 Windows guest and will re-inject them.
6914ERST
blueswir15824d652009-03-28 06:44:27 +00006915
6916DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006917 "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=<filename>,rrsnapshot=<snapshot>]\n" \
aliguoribc14ca22009-04-05 18:43:37 +00006918 " enable virtual instruction counter with 2^N clock ticks per\n" \
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006919 " instruction, enable aligning the host and virtual clocks\n" \
6920 " or disable real time cpu sleeping\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00006921STEXI
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006922@item -icount [shift=@var{N}|auto][,rr=record|replay,rrfile=@var{filename},rrsnapshot=@var{snapshot}]
Stefan Weil6616b2a2010-02-05 23:52:05 +01006923@findex -icount
blueswir15824d652009-03-28 06:44:27 +00006924Enable virtual instruction counter. The virtual cpu will execute one
Kevin Wolf4e257e52009-10-09 10:58:36 +02006925instruction every 2^@var{N} ns of virtual time. If @code{auto} is specified
blueswir15824d652009-03-28 06:44:27 +00006926then the virtual cpu speed will be automatically adjusted to keep virtual
6927time within a few seconds of real time.
6928
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006929When the virtual cpu is sleeping, the virtual time will advance at default
Pranith Kumar778d9f92016-02-26 10:16:51 -05006930speed unless @option{sleep=on|off} is specified.
6931With @option{sleep=on|off}, the virtual time will jump to the next timer deadline
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02006932instantly whenever the virtual cpu goes to sleep mode and will not advance
6933if no timer is enabled. This behavior give deterministic execution times from
6934the guest point of view.
6935
blueswir15824d652009-03-28 06:44:27 +00006936Note that while this option can give deterministic behavior, it does not
6937provide cycle accurate emulation. Modern CPUs contain superscalar out of
6938order cores with complex cache hierarchies. The number of instructions
6939executed often has little or no correlation with actual performance.
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006940
Daniel P. Berrangeb6af0972015-08-26 12:17:13 +01006941@option{align=on} will activate the delay algorithm which will try
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006942to synchronise the host clock and the virtual clock. The goal is to
6943have a guest running at the real frequency imposed by the shift option.
6944Whenever the guest clock is behind the host clock and if
Michael Tokarev82597612015-04-27 11:12:49 +03006945@option{align=on} is specified then we print a message to the user
Sebastian Tanasea8bfac32014-07-25 11:56:29 +02006946to inform about the delay.
6947Currently this option does not work when @option{shift} is @code{auto}.
6948Note: The sync algorithm will work for those shift values for which
6949the guest clock runs ahead of the host clock. Typically this happens
6950when the shift value is high (how high depends on the host machine).
Pavel Dovgalyuk4c27b852015-09-17 19:25:18 +03006951
6952When @option{rr} option is specified deterministic record/replay is enabled.
6953Replay log is written into @var{filename} file in record mode and
6954read from this file in replay mode.
Pavel Dovgalyuk9c2037d2017-01-24 10:17:47 +03006955
6956Option rrsnapshot is used to create new vm snapshot named @var{snapshot}
6957at the start of execution recording. In replay mode this option is used
6958to load the initial VM state.
blueswir15824d652009-03-28 06:44:27 +00006959ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006960SRST
6961``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]``
6962 Enable virtual instruction counter. The virtual cpu will execute one
6963 instruction every 2^N ns of virtual time. If ``auto`` is specified
6964 then the virtual cpu speed will be automatically adjusted to keep
6965 virtual time within a few seconds of real time.
6966
6967 When the virtual cpu is sleeping, the virtual time will advance at
6968 default speed unless ``sleep=on|off`` is specified. With
6969 ``sleep=on|off``, the virtual time will jump to the next timer
6970 deadline instantly whenever the virtual cpu goes to sleep mode and
6971 will not advance if no timer is enabled. This behavior give
6972 deterministic execution times from the guest point of view.
6973
6974 Note that while this option can give deterministic behavior, it does
6975 not provide cycle accurate emulation. Modern CPUs contain
6976 superscalar out of order cores with complex cache hierarchies. The
6977 number of instructions executed often has little or no correlation
6978 with actual performance.
6979
6980 ``align=on`` will activate the delay algorithm which will try to
6981 synchronise the host clock and the virtual clock. The goal is to
6982 have a guest running at the real frequency imposed by the shift
6983 option. Whenever the guest clock is behind the host clock and if
6984 ``align=on`` is specified then we print a message to the user to
6985 inform about the delay. Currently this option does not work when
6986 ``shift`` is ``auto``. Note: The sync algorithm will work for those
6987 shift values for which the guest clock runs ahead of the host clock.
6988 Typically this happens when the shift value is high (how high
6989 depends on the host machine).
6990
6991 When ``rr`` option is specified deterministic record/replay is
6992 enabled. Replay log is written into filename file in record mode and
6993 read from this file in replay mode.
6994
6995 Option rrsnapshot is used to create new vm snapshot named snapshot
6996 at the start of execution recording. In replay mode this option is
6997 used to load the initial VM state.
6998ERST
blueswir15824d652009-03-28 06:44:27 +00006999
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007000DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \
Xu Wangd7933ef2015-06-11 17:32:05 +02007001 "-watchdog model\n" \
Blue Swirlad960902010-03-29 19:23:52 +00007002 " enable virtual hardware watchdog [default=none]\n",
7003 QEMU_ARCH_ALL)
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007004STEXI
7005@item -watchdog @var{model}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007006@findex -watchdog
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007007Create a virtual hardware watchdog device. Once enabled (by a guest
7008action), the watchdog must be periodically polled by an agent inside
Xu Wangd7933ef2015-06-11 17:32:05 +02007009the guest or else the guest will be restarted. Choose a model for
7010which your guest has drivers.
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007011
Xu Wangd7933ef2015-06-11 17:32:05 +02007012The @var{model} is the model of hardware watchdog to emulate. Use
7013@code{-watchdog help} to list available hardware models. Only one
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007014watchdog can be enabled for a guest.
Xu Wangd7933ef2015-06-11 17:32:05 +02007015
7016The following models may be available:
7017@table @option
7018@item ib700
7019iBASE 700 is a very simple ISA watchdog with a single timer.
7020@item i6300esb
7021Intel 6300ESB I/O controller hub is a much more featureful PCI-based
7022dual-timer watchdog.
Xu Wang188f24c2015-02-05 18:28:32 +08007023@item diag288
7024A virtual watchdog for s390x backed by the diagnose 288 hypercall
7025(currently KVM only).
Xu Wangd7933ef2015-06-11 17:32:05 +02007026@end table
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007027ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007028SRST
7029``-watchdog model``
7030 Create a virtual hardware watchdog device. Once enabled (by a guest
7031 action), the watchdog must be periodically polled by an agent inside
7032 the guest or else the guest will be restarted. Choose a model for
7033 which your guest has drivers.
7034
7035 The model is the model of hardware watchdog to emulate. Use
7036 ``-watchdog help`` to list available hardware models. Only one
7037 watchdog can be enabled for a guest.
7038
7039 The following models may be available:
7040
7041 ``ib700``
7042 iBASE 700 is a very simple ISA watchdog with a single timer.
7043
7044 ``i6300esb``
7045 Intel 6300ESB I/O controller hub is a much more featureful
7046 PCI-based dual-timer watchdog.
7047
7048 ``diag288``
7049 A virtual watchdog for s390x backed by the diagnose 288
7050 hypercall (currently KVM only).
7051ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007052
7053DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \
Markus Armbruster7ad92702017-10-02 16:03:07 +02007054 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \
Blue Swirlad960902010-03-29 19:23:52 +00007055 " action when watchdog fires [default=reset]\n",
7056 QEMU_ARCH_ALL)
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007057STEXI
7058@item -watchdog-action @var{action}
Markus Armbrusterb8f490e2013-02-13 19:49:38 +01007059@findex -watchdog-action
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007060
7061The @var{action} controls what QEMU will do when the watchdog timer
7062expires.
7063The default is
7064@code{reset} (forcefully reset the guest).
7065Other possible actions are:
7066@code{shutdown} (attempt to gracefully shutdown the guest),
7067@code{poweroff} (forcefully poweroff the guest),
Markus Armbruster7ad92702017-10-02 16:03:07 +02007068@code{inject-nmi} (inject a NMI into the guest),
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007069@code{pause} (pause the guest),
7070@code{debug} (print a debug message and continue), or
7071@code{none} (do nothing).
7072
7073Note that the @code{shutdown} action requires that the guest responds
7074to ACPI signals, which it may not be able to do in the sort of
7075situations where the watchdog would have expired, and thus
7076@code{-watchdog-action shutdown} is not recommended for production use.
7077
7078Examples:
7079
7080@table @code
7081@item -watchdog i6300esb -watchdog-action pause
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007082@itemx -watchdog ib700
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007083@end table
7084ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007085SRST
7086``-watchdog-action action``
7087 The action controls what QEMU will do when the watchdog timer
7088 expires. The default is ``reset`` (forcefully reset the guest).
7089 Other possible actions are: ``shutdown`` (attempt to gracefully
7090 shutdown the guest), ``poweroff`` (forcefully poweroff the guest),
7091 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the
7092 guest), ``debug`` (print a debug message and continue), or ``none``
7093 (do nothing).
7094
7095 Note that the ``shutdown`` action requires that the guest responds
7096 to ACPI signals, which it may not be able to do in the sort of
7097 situations where the watchdog would have expired, and thus
7098 ``-watchdog-action shutdown`` is not recommended for production use.
7099
7100 Examples:
7101
7102 ``-watchdog i6300esb -watchdog-action pause``; \ ``-watchdog ib700``
7103
7104ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01007105
blueswir15824d652009-03-28 06:44:27 +00007106DEF("echr", HAS_ARG, QEMU_OPTION_echr, \
Blue Swirlad960902010-03-29 19:23:52 +00007107 "-echr chr set terminal escape character instead of ctrl-a\n",
7108 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007109STEXI
7110
Kevin Wolf4e257e52009-10-09 10:58:36 +02007111@item -echr @var{numeric_ascii_value}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007112@findex -echr
blueswir15824d652009-03-28 06:44:27 +00007113Change the escape character used for switching to the monitor when using
7114monitor and serial sharing. The default is @code{0x01} when using the
7115@code{-nographic} option. @code{0x01} is equal to pressing
7116@code{Control-a}. You can select a different character from the ascii
7117control keys where 1 through 26 map to Control-a through Control-z. For
7118instance you could use the either of the following to change the escape
7119character to Control-t.
7120@table @code
7121@item -echr 0x14
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007122@itemx -echr 20
blueswir15824d652009-03-28 06:44:27 +00007123@end table
7124ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007125SRST
7126``-echr numeric_ascii_value``
7127 Change the escape character used for switching to the monitor when
7128 using monitor and serial sharing. The default is ``0x01`` when using
7129 the ``-nographic`` option. ``0x01`` is equal to pressing
7130 ``Control-a``. You can select a different character from the ascii
7131 control keys where 1 through 26 map to Control-a through Control-z.
7132 For instance you could use the either of the following to change the
7133 escape character to Control-t.
7134
7135 ``-echr 0x14``; \ ``-echr 20``
7136
7137ERST
blueswir15824d652009-03-28 06:44:27 +00007138
blueswir15824d652009-03-28 06:44:27 +00007139DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \
Blue Swirlad960902010-03-29 19:23:52 +00007140 "-show-cursor show cursor\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007141STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01007142@item -show-cursor
Stefan Weil6616b2a2010-02-05 23:52:05 +01007143@findex -show-cursor
Stefan Weil95d5f082010-01-20 22:25:27 +01007144Show cursor.
blueswir15824d652009-03-28 06:44:27 +00007145ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007146SRST
7147``-show-cursor``
7148 Show cursor.
7149ERST
blueswir15824d652009-03-28 06:44:27 +00007150
7151DEF("tb-size", HAS_ARG, QEMU_OPTION_tb_size, \
Blue Swirlad960902010-03-29 19:23:52 +00007152 "-tb-size n set TB size\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007153STEXI
Stefan Weil95d5f082010-01-20 22:25:27 +01007154@item -tb-size @var{n}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007155@findex -tb-size
Paolo Bonzinife174132019-11-13 15:16:44 +01007156Set TCG translation block cache size. Deprecated, use @samp{-accel tcg,tb-size=@var{n}}
7157instead.
blueswir15824d652009-03-28 06:44:27 +00007158ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007159SRST
7160``-tb-size n``
7161 Set TCG translation block cache size. Deprecated, use
7162 '\ ``-accel tcg,tb-size=n``\ ' instead.
7163ERST
blueswir15824d652009-03-28 06:44:27 +00007164
7165DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
Michael Tokarev7c601802015-02-10 22:40:47 +03007166 "-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]\n" \
7167 "-incoming rdma:host:port[,ipv4][,ipv6]\n" \
7168 "-incoming unix:socketpath\n" \
7169 " prepare for incoming migration, listen on\n" \
7170 " specified protocol and socket address\n" \
7171 "-incoming fd:fd\n" \
7172 "-incoming exec:cmdline\n" \
7173 " accept incoming migration on given file descriptor\n" \
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01007174 " or from given external command\n" \
7175 "-incoming defer\n" \
7176 " wait for the URI to be specified via migrate_incoming\n",
Blue Swirlad960902010-03-29 19:23:52 +00007177 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007178STEXI
Michael Tokarev7c601802015-02-10 22:40:47 +03007179@item -incoming tcp:[@var{host}]:@var{port}[,to=@var{maxport}][,ipv4][,ipv6]
Markus Armbrusterf9cfd652015-06-15 14:35:59 +02007180@itemx -incoming rdma:@var{host}:@var{port}[,ipv4][,ipv6]
Stefan Weil6616b2a2010-02-05 23:52:05 +01007181@findex -incoming
Michael Tokarev7c601802015-02-10 22:40:47 +03007182Prepare for incoming migration, listen on a given tcp port.
7183
7184@item -incoming unix:@var{socketpath}
7185Prepare for incoming migration, listen on a given unix socket.
7186
7187@item -incoming fd:@var{fd}
7188Accept incoming migration from a given filedescriptor.
7189
7190@item -incoming exec:@var{cmdline}
7191Accept incoming migration as an output from specified external command.
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01007192
7193@item -incoming defer
7194Wait for the URI to be specified via migrate_incoming. The monitor can
7195be used to change settings (such as migration parameters) prior to issuing
7196the migrate_incoming to allow the migration to begin.
blueswir15824d652009-03-28 06:44:27 +00007197ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007198SRST
7199``-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]``; \ ``-incoming rdma:host:port[,ipv4][,ipv6]``
7200 Prepare for incoming migration, listen on a given tcp port.
7201
7202``-incoming unix:socketpath``
7203 Prepare for incoming migration, listen on a given unix socket.
7204
7205``-incoming fd:fd``
7206 Accept incoming migration from a given filedescriptor.
7207
7208``-incoming exec:cmdline``
7209 Accept incoming migration as an output from specified external
7210 command.
7211
7212``-incoming defer``
7213 Wait for the URI to be specified via migrate\_incoming. The monitor
7214 can be used to change settings (such as migration parameters) prior
7215 to issuing the migrate\_incoming to allow the migration to begin.
7216ERST
blueswir15824d652009-03-28 06:44:27 +00007217
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05307218DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \
7219 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL)
7220STEXI
7221@item -only-migratable
7222@findex -only-migratable
7223Only allow migratable devices. Devices will not be allowed to enter an
7224unmigratable state.
7225ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007226SRST
7227``-only-migratable``
7228 Only allow migratable devices. Devices will not be allowed to enter
7229 an unmigratable state.
7230ERST
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05307231
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007232DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
Blue Swirlad960902010-03-29 19:23:52 +00007233 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL)
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007234STEXI
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007235@item -nodefaults
Stefan Weil6616b2a2010-02-05 23:52:05 +01007236@findex -nodefaults
Michal Novotny66c19bf2012-07-16 14:35:10 +02007237Don't create default devices. Normally, QEMU sets the default devices like serial
7238port, parallel port, virtual console, monitor device, VGA adapter, floppy and
7239CD-ROM drive and others. The @code{-nodefaults} option will disable all those
7240default devices.
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007241ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007242SRST
7243``-nodefaults``
7244 Don't create default devices. Normally, QEMU sets the default
7245 devices like serial port, parallel port, virtual console, monitor
7246 device, VGA adapter, floppy and CD-ROM drive and others. The
7247 ``-nodefaults`` option will disable all those default devices.
7248ERST
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01007249
blueswir15824d652009-03-28 06:44:27 +00007250#ifndef _WIN32
7251DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \
Blue Swirlad960902010-03-29 19:23:52 +00007252 "-chroot dir chroot to dir just before starting the VM\n",
7253 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007254#endif
7255STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02007256@item -chroot @var{dir}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007257@findex -chroot
blueswir15824d652009-03-28 06:44:27 +00007258Immediately before starting guest execution, chroot to the specified
7259directory. Especially useful in combination with -runas.
7260ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007261SRST
7262``-chroot dir``
7263 Immediately before starting guest execution, chroot to the specified
7264 directory. Especially useful in combination with -runas.
7265ERST
blueswir15824d652009-03-28 06:44:27 +00007266
7267#ifndef _WIN32
7268DEF("runas", HAS_ARG, QEMU_OPTION_runas, \
Ian Jackson2c42f1e2017-09-15 18:10:44 +01007269 "-runas user change to user id user just before starting the VM\n" \
7270 " user can be numeric uid:gid instead\n",
Blue Swirlad960902010-03-29 19:23:52 +00007271 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00007272#endif
7273STEXI
Kevin Wolf4e257e52009-10-09 10:58:36 +02007274@item -runas @var{user}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007275@findex -runas
blueswir15824d652009-03-28 06:44:27 +00007276Immediately before starting guest execution, drop root privileges, switching
7277to the specified user.
7278ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007279SRST
7280``-runas user``
7281 Immediately before starting guest execution, drop root privileges,
7282 switching to the specified user.
7283ERST
blueswir15824d652009-03-28 06:44:27 +00007284
blueswir15824d652009-03-28 06:44:27 +00007285DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env,
7286 "-prom-env variable=value\n"
Blue Swirlad960902010-03-29 19:23:52 +00007287 " set OpenBIOS nvram variables\n",
7288 QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
Stefan Weil95d5f082010-01-20 22:25:27 +01007289STEXI
7290@item -prom-env @var{variable}=@var{value}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007291@findex -prom-env
Stefan Weil95d5f082010-01-20 22:25:27 +01007292Set OpenBIOS nvram @var{variable} to given @var{value} (PPC, SPARC only).
Peter Maydell196afbb2020-02-28 15:36:10 +00007293
7294@example
7295qemu-system-sparc -prom-env 'auto-boot?=false' \
7296 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7297@end example
7298
7299@example
7300qemu-system-ppc -prom-env 'auto-boot?=false' \
7301 -prom-env 'boot-device=hd:2,\yaboot' \
7302 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7303@end example
7304
Stefan Weil95d5f082010-01-20 22:25:27 +01007305ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007306SRST
7307``-prom-env variable=value``
7308 Set OpenBIOS nvram variable to given value (PPC, SPARC only).
7309
7310 ::
7311
7312 qemu-system-sparc -prom-env 'auto-boot?=false' \
7313 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
7314
7315 ::
7316
7317 qemu-system-ppc -prom-env 'auto-boot?=false' \
7318 -prom-env 'boot-device=hd:2,\yaboot' \
7319 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
7320ERST
blueswir15824d652009-03-28 06:44:27 +00007321DEF("semihosting", 0, QEMU_OPTION_semihosting,
Michael Wallef7bbcfb2014-04-22 20:18:42 +02007322 "-semihosting semihosting mode\n",
Leon Alrae3b3c1692015-06-19 11:08:43 +01007323 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007324 QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
Stefan Weil95d5f082010-01-20 22:25:27 +01007325STEXI
7326@item -semihosting
Stefan Weil6616b2a2010-02-05 23:52:05 +01007327@findex -semihosting
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007328Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
Peter Maydell44d79a62020-02-28 15:36:09 +00007329
7330Note that this allows guest direct access to the host filesystem, so
7331should only be used with a trusted guest OS.
7332
7333See the -semihosting-config option documentation for further information
7334about the facilities this enables.
Liviu Ionescua38bb072014-12-11 12:07:48 +00007335ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007336SRST
7337``-semihosting``
7338 Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II only).
7339
7340 Note that this allows guest direct access to the host filesystem, so
7341 should only be used with a trusted guest OS.
7342
7343 See the -semihosting-config option documentation for further
7344 information about the facilities this enables.
7345ERST
Liviu Ionescua38bb072014-12-11 12:07:48 +00007346DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config,
Alex Bennée4e7f9032019-05-14 15:30:14 +01007347 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]\n" \
Leon Alraea59d31a2015-06-19 14:17:45 +01007348 " semihosting configuration\n",
Leon Alrae3b3c1692015-06-19 11:08:43 +01007349QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32 |
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007350QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2)
Liviu Ionescua38bb072014-12-11 12:07:48 +00007351STEXI
Alex Bennée4e7f9032019-05-14 15:30:14 +01007352@item -semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]
Liviu Ionescua38bb072014-12-11 12:07:48 +00007353@findex -semihosting-config
Sandra Loosemore413a99a2019-04-03 13:53:05 -06007354Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II only).
Peter Maydell44d79a62020-02-28 15:36:09 +00007355
7356Note that this allows guest direct access to the host filesystem, so
7357should only be used with a trusted guest OS.
7358
7359On Arm this implements the standard semihosting API, version 2.0.
7360
7361On M68K this implements the "ColdFire GDB" interface used by libgloss.
7362
7363Xtensa semihosting provides basic file IO calls, such as
7364open/read/write/seek/select. Tensilica baremetal libc for ISS and
7365linux platform "sim" use this interface.
7366
Leon Alraea59d31a2015-06-19 14:17:45 +01007367@table @option
7368@item target=@code{native|gdb|auto}
7369Defines where the semihosting calls will be addressed, to QEMU (@code{native})
7370or to GDB (@code{gdb}). The default is @code{auto}, which means @code{gdb}
7371during debug sessions and @code{native} otherwise.
Alex Bennée4e7f9032019-05-14 15:30:14 +01007372@item chardev=@var{str1}
7373Send the output to a chardev backend output for native or auto output when not in gdb
Leon Alraea59d31a2015-06-19 14:17:45 +01007374@item arg=@var{str1},arg=@var{str2},...
7375Allows the user to pass input arguments, and can be used multiple times to build
7376up a list. The old-style @code{-kernel}/@code{-append} method of passing a
7377command line is still supported for backward compatibility. If both the
7378@code{--semihosting-config arg} and the @code{-kernel}/@code{-append} are
7379specified, the former is passed to semihosting as it always takes precedence.
7380@end table
Stefan Weil95d5f082010-01-20 22:25:27 +01007381ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007382SRST
7383``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]]``
7384 Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II
7385 only).
7386
7387 Note that this allows guest direct access to the host filesystem, so
7388 should only be used with a trusted guest OS.
7389
7390 On Arm this implements the standard semihosting API, version 2.0.
7391
7392 On M68K this implements the "ColdFire GDB" interface used by
7393 libgloss.
7394
7395 Xtensa semihosting provides basic file IO calls, such as
7396 open/read/write/seek/select. Tensilica baremetal libc for ISS and
7397 linux platform "sim" use this interface.
7398
7399 ``target=native|gdb|auto``
7400 Defines where the semihosting calls will be addressed, to QEMU
7401 (``native``) or to GDB (``gdb``). The default is ``auto``, which
7402 means ``gdb`` during debug sessions and ``native`` otherwise.
7403
7404 ``chardev=str1``
7405 Send the output to a chardev backend output for native or auto
7406 output when not in gdb
7407
7408 ``arg=str1,arg=str2,...``
7409 Allows the user to pass input arguments, and can be used
7410 multiple times to build up a list. The old-style
7411 ``-kernel``/``-append`` method of passing a command line is
7412 still supported for backward compatibility. If both the
7413 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are
7414 specified, the former is passed to semihosting as it always
7415 takes precedence.
7416ERST
blueswir15824d652009-03-28 06:44:27 +00007417DEF("old-param", 0, QEMU_OPTION_old_param,
Blue Swirlad960902010-03-29 19:23:52 +00007418 "-old-param old param mode\n", QEMU_ARCH_ARM)
Stefan Weil95d5f082010-01-20 22:25:27 +01007419STEXI
7420@item -old-param
Stefan Weil6616b2a2010-02-05 23:52:05 +01007421@findex -old-param (ARM)
Stefan Weil95d5f082010-01-20 22:25:27 +01007422Old param mode (ARM only).
7423ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007424SRST
7425``-old-param``
7426 Old param mode (ARM only).
7427ERST
Stefan Weil95d5f082010-01-20 22:25:27 +01007428
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007429DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007430 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007431 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007432 " Enable seccomp mode 2 system call filter (default 'off').\n" \
7433 " use 'obsolete' to allow obsolete system calls that are provided\n" \
7434 " by the kernel, but typically no longer used by modern\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007435 " C library implementations.\n" \
7436 " use 'elevateprivileges' to allow or deny QEMU process to elevate\n" \
7437 " its privileges by blacklisting all set*uid|gid system calls.\n" \
7438 " The value 'children' will deny set*uid|gid system calls for\n" \
Eduardo Otubo995a2262017-03-13 22:16:01 +01007439 " main QEMU process but will allow forks and execves to run unprivileged\n" \
7440 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007441 " blacklisting *fork and execve\n" \
7442 " use 'resourcecontrol' to disable process affinity and schedular priority\n",
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007443 QEMU_ARCH_ALL)
7444STEXI
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007445@item -sandbox @var{arg}[,obsolete=@var{string}][,elevateprivileges=@var{string}][,spawn=@var{string}][,resourcecontrol=@var{string}]
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007446@findex -sandbox
7447Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will
7448disable it. The default is 'off'.
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007449@table @option
7450@item obsolete=@var{string}
7451Enable Obsolete system calls
Eduardo Otubo73a1e642017-03-13 22:13:27 +01007452@item elevateprivileges=@var{string}
7453Disable set*uid|gid system calls
Eduardo Otubo995a2262017-03-13 22:16:01 +01007454@item spawn=@var{string}
7455Disable *fork and execve
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01007456@item resourcecontrol=@var{string}
7457Disable process affinity and schedular priority
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01007458@end table
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007459ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007460SRST
7461``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]``
7462 Enable Seccomp mode 2 system call filter. 'on' will enable syscall
7463 filtering and 'off' will disable it. The default is 'off'.
7464
7465 ``obsolete=string``
7466 Enable Obsolete system calls
7467
7468 ``elevateprivileges=string``
7469 Disable set\*uid\|gid system calls
7470
7471 ``spawn=string``
7472 Disable \*fork and execve
7473
7474 ``resourcecontrol=string``
7475 Disable process affinity and schedular priority
7476ERST
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03007477
Gerd Hoffmann715a6642009-10-14 10:39:28 +02007478DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
Blue Swirlad960902010-03-29 19:23:52 +00007479 "-readconfig <file>\n", QEMU_ARCH_ALL)
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007480STEXI
7481@item -readconfig @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007482@findex -readconfig
Michal Novotnyed24cfa2012-07-16 14:28:32 +02007483Read device configuration from @var{file}. This approach is useful when you want to spawn
7484QEMU process with many command line options but you don't want to exceed the command line
7485character limit.
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007486ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007487SRST
7488``-readconfig file``
7489 Read device configuration from file. This approach is useful when
7490 you want to spawn QEMU process with many command line options but
7491 you don't want to exceed the command line character limit.
7492ERST
Gerd Hoffmann715a6642009-10-14 10:39:28 +02007493DEF("writeconfig", HAS_ARG, QEMU_OPTION_writeconfig,
7494 "-writeconfig <file>\n"
Blue Swirlad960902010-03-29 19:23:52 +00007495 " read/write config file\n", QEMU_ARCH_ALL)
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007496STEXI
7497@item -writeconfig @var{file}
Stefan Weil6616b2a2010-02-05 23:52:05 +01007498@findex -writeconfig
Michal Novotnyed24cfa2012-07-16 14:28:32 +02007499Write device configuration to @var{file}. The @var{file} can be either filename to save
7500command line and device configuration into file or dash @code{-}) character to print the
7501output to stdout. This can be later used as input file for @code{-readconfig} option.
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007502ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007503SRST
7504``-writeconfig file``
7505 Write device configuration to file. The file can be either filename
7506 to save command line and device configuration into file or dash
7507 ``-``) character to print the output to stdout. This can be later
7508 used as input file for ``-readconfig`` option.
7509ERST
Thomas Huth2feac452018-08-21 12:59:56 +02007510
Eduardo Habkostf29a5612012-05-02 13:07:29 -03007511DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
7512 "-no-user-config\n"
Eduardo Habkost3478eae2017-10-04 00:00:25 -03007513 " do not load default user-provided config files at startup\n",
Eduardo Habkostf29a5612012-05-02 13:07:29 -03007514 QEMU_ARCH_ALL)
7515STEXI
7516@item -no-user-config
7517@findex -no-user-config
7518The @code{-no-user-config} option makes QEMU not load any of the user-provided
Eduardo Habkost3478eae2017-10-04 00:00:25 -03007519config files on @var{sysconfdir}.
Anthony Liguori292444c2010-01-21 10:57:58 -06007520ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007521SRST
7522``-no-user-config``
7523 The ``-no-user-config`` option makes QEMU not load any of the
7524 user-provided config files on sysconfdir.
7525ERST
Thomas Huth2feac452018-08-21 12:59:56 +02007526
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007527DEF("trace", HAS_ARG, QEMU_OPTION_trace,
Paolo Bonzini10578a22016-01-07 16:55:26 +03007528 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
Lluís23d15e82011-08-31 20:31:31 +02007529 " specify tracing options\n",
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007530 QEMU_ARCH_ALL)
7531STEXI
Lluís23d15e82011-08-31 20:31:31 +02007532HXCOMM This line is not accurate, as some sub-options are backend-specific but
7533HXCOMM HX does not support conditional compilation of text.
Denis V. Luneve370ad92016-06-17 17:44:08 +03007534@item -trace [[enable=]@var{pattern}][,events=@var{file}][,file=@var{file}]
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007535@findex -trace
Paolo Bonziniabcd92d2020-02-28 15:35:57 +00007536@include docs/system/qemu-option-trace.texi
Prerna Saxenaab6540d2010-08-09 11:48:32 +01007537ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007538SRST
7539``-trace [[enable=]pattern][,events=file][,file=file]``
7540 Specify tracing options.
7541
7542 ``[enable=]pattern``
7543 Immediately enable events matching pattern (either event name or
7544 a globbing pattern). This option is only available if QEMU has
7545 been compiled with the simple, log or ftrace tracing backend. To
7546 specify multiple events or patterns, specify the ``-trace``
7547 option multiple times.
7548
7549 Use ``-trace help`` to print a list of names of trace points.
7550
7551 ``events=file``
7552 Immediately enable events listed in file. The file must contain
7553 one event name (as listed in the ``trace-events-all`` file) per
7554 line; globbing patterns are accepted too. This option is only
7555 available if QEMU has been compiled with the simple, log or
7556 ftrace tracing backend.
7557
7558 ``file=file``
7559 Log output traces to file. This option is only available if QEMU
7560 has been compiled with the simple tracing backend.
7561ERST
Lluís Vilanova42229a72017-07-24 17:28:22 +03007562DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
7563 "-plugin [file=]<file>[,arg=<string>]\n"
7564 " load a plugin\n",
7565 QEMU_ARCH_ALL)
7566STEXI
7567@item -plugin file=@var{file}[,arg=@var{string}]
7568@findex -plugin
7569
7570Load a plugin.
7571
7572@table @option
7573@item file=@var{file}
7574Load the given plugin from a shared library file.
7575@item arg=@var{string}
7576Argument string passed to the plugin. (Can be given multiple times.)
7577@end table
7578ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007579SRST
7580``-plugin file=file[,arg=string]``
7581 Load a plugin.
7582
7583 ``file=file``
7584 Load the given plugin from a shared library file.
7585
7586 ``arg=string``
7587 Argument string passed to the plugin. (Can be given multiple
7588 times.)
7589ERST
Stefan Weil3dbf2c72010-01-16 18:19:44 +01007590
Markus Armbruster31e70d62013-02-13 19:49:37 +01007591HXCOMM Internal use
7592DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
7593DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL)
Anthony Liguoric7f0f3b2012-03-28 15:42:02 +02007594
Paul Moore0f669982012-08-03 14:39:21 -04007595#ifdef __linux__
7596DEF("enable-fips", 0, QEMU_OPTION_enablefips,
7597 "-enable-fips enable FIPS 140-2 compliance\n",
7598 QEMU_ARCH_ALL)
7599#endif
7600STEXI
7601@item -enable-fips
7602@findex -enable-fips
7603Enable FIPS 140-2 compliance mode.
7604ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007605SRST
7606``-enable-fips``
7607 Enable FIPS 140-2 compliance mode.
7608ERST
Paul Moore0f669982012-08-03 14:39:21 -04007609
Thomas Huth976e8c52019-09-04 07:27:39 +02007610HXCOMM Deprecated by -accel tcg
Bruce Rogersc6e88b32012-11-20 07:11:21 -07007611DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386)
Jan Kiszkaa0dac022012-10-05 14:51:45 -03007612
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007613DEF("msg", HAS_ARG, QEMU_OPTION_msg,
7614 "-msg timestamp[=on|off]\n"
Markus Armbrusterdeda4972019-10-10 10:15:08 +02007615 " control error message format\n"
7616 " timestamp=on enables timestamps (default: off)\n",
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007617 QEMU_ARCH_ALL)
7618STEXI
7619@item -msg timestamp[=on|off]
7620@findex -msg
Markus Armbrusterdeda4972019-10-10 10:15:08 +02007621Control error message format.
7622@table @option
7623@item timestamp=on|off
7624Prefix messages with a timestamp. Default is off.
7625@end table
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007626ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007627SRST
7628``-msg timestamp[=on|off]``
7629 Control error message format.
7630
7631 ``timestamp=on|off``
7632 Prefix messages with a timestamp. Default is off.
7633ERST
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04007634
Amit Shahabfd9ce2014-06-20 18:56:08 +05307635DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
7636 "-dump-vmstate <file>\n"
7637 " Output vmstate information in JSON format to file.\n"
7638 " Use the scripts/vmstate-static-checker.py file to\n"
7639 " check for possible regressions in migration code\n"
Laurent Vivier23820532015-09-04 21:30:04 +02007640 " by comparing two such vmstate dumps.\n",
Amit Shahabfd9ce2014-06-20 18:56:08 +05307641 QEMU_ARCH_ALL)
7642STEXI
7643@item -dump-vmstate @var{file}
7644@findex -dump-vmstate
7645Dump json-encoded vmstate information for current machine type to file
7646in @var{file}
7647ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007648SRST
7649``-dump-vmstate file``
7650 Dump json-encoded vmstate information for current machine type to
7651 file in file
7652ERST
Amit Shahabfd9ce2014-06-20 18:56:08 +05307653
Emilio G. Cota12df1892018-08-15 11:42:49 -04007654DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile,
7655 "-enable-sync-profile\n"
7656 " enable synchronization profiling\n",
7657 QEMU_ARCH_ALL)
7658STEXI
7659@item -enable-sync-profile
7660@findex -enable-sync-profile
7661Enable synchronization profiling.
7662ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00007663SRST
7664``-enable-sync-profile``
7665 Enable synchronization profiling.
7666ERST
Emilio G. Cota12df1892018-08-15 11:42:49 -04007667
Paolo Bonzini43f187a2017-01-04 13:50:37 +01007668STEXI
7669@end table
7670ETEXI
7671DEFHEADING()
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02007672
7673DEFHEADING(Generic object creation:)
Paolo Bonzini43f187a2017-01-04 13:50:37 +01007674STEXI
7675@table @option
7676ETEXI
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007677
7678DEF("object", HAS_ARG, QEMU_OPTION_object,
7679 "-object TYPENAME[,PROP1=VALUE1,...]\n"
7680 " create a new object of type TYPENAME setting properties\n"
7681 " in the order they are specified. Note that the 'id'\n"
7682 " property must be set. These objects are placed in the\n"
7683 " '/objects' path.\n",
7684 QEMU_ARCH_ALL)
7685STEXI
7686@item -object @var{typename}[,@var{prop1}=@var{value1},...]
7687@findex -object
7688Create a new object of type @var{typename} setting properties
7689in the order they are specified. Note that the 'id'
7690property must be set. These objects are placed in the
7691'/objects' path.
7692
7693@table @option
7694
Haozhong Zhang98376842017-12-11 15:28:04 +08007695@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 +01007696
7697Creates a memory file backend object, which can be used to back
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007698the guest RAM with huge pages.
7699
7700The @option{id} parameter is a unique ID that will be used to reference this
7701memory region when configuring the @option{-numa} argument.
7702
7703The @option{size} option provides the size of the memory region, and accepts
7704common suffixes, eg @option{500M}.
7705
7706The @option{mem-path} provides the path to either a shared memory or huge page
7707filesystem mount.
7708
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007709The @option{share} boolean option determines whether the memory
7710region is marked as private to QEMU, or shared. The latter allows
7711a co-operating external process to access the QEMU memory region.
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007712
Marcel Apfelbaum06329cc2017-12-13 16:37:37 +02007713The @option{share} is also required for pvrdma devices due to
7714limitations in the RDMA API provided by Linux.
7715
7716Setting share=on might affect the ability to configure NUMA
7717bindings for the memory backend under some circumstances, see
7718Documentation/vm/numa_memory_policy.txt on the Linux kernel
7719source tree for additional details.
7720
Eduardo Habkost11ae6ed2017-08-24 16:23:15 -03007721Setting the @option{discard-data} boolean option to @var{on}
7722indicates that file contents can be destroyed when QEMU exits,
7723to avoid unnecessarily flushing data to the backing file. Note
7724that @option{discard-data} is only an optimization, and QEMU
7725might not discard file contents if it aborts unexpectedly or is
7726terminated using SIGKILL.
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007727
Stefan Hajnoczic7cddce2017-11-28 16:15:28 +00007728The @option{merge} boolean option enables memory merge, also known as
7729MADV_MERGEABLE, so that Kernel Samepage Merging will consider the pages for
7730memory deduplication.
7731
7732Setting the @option{dump} boolean option to @var{off} excludes the memory from
7733core dumps. This feature is also known as MADV_DONTDUMP.
7734
7735The @option{prealloc} boolean option enables memory preallocation.
7736
7737The @option{host-nodes} option binds the memory range to a list of NUMA host
7738nodes.
7739
7740The @option{policy} option sets the NUMA policy to one of the following values:
7741
7742@table @option
7743@item @var{default}
7744default host policy
7745
7746@item @var{preferred}
7747prefer the given host node list for allocation
7748
7749@item @var{bind}
7750restrict memory allocation to the given host node list
7751
7752@item @var{interleave}
7753interleave memory allocations across the given host node list
7754@end table
7755
Haozhong Zhang98376842017-12-11 15:28:04 +08007756The @option{align} option specifies the base address alignment when
7757QEMU mmap(2) @option{mem-path}, and accepts common suffixes, eg
7758@option{2M}. Some backend store specified by @option{mem-path}
7759requires an alignment different than the default one used by QEMU, eg
7760the device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
7761such cases, users can specify the required alignment via this option.
7762
Junyan Hea4de8552018-07-18 15:48:00 +08007763The @option{pmem} option specifies whether the backing file specified
7764by @option{mem-path} is in host persistent memory that can be accessed
7765using the SNIA NVM programming model (e.g. Intel NVDIMM).
7766If @option{pmem} is set to 'on', QEMU will take necessary operations to
7767guarantee the persistence of its own writes to @option{mem-path}
7768(e.g. in vNVDIMM label emulation and live migration).
Zhang Yi119906af2019-04-22 08:48:48 +08007769Also, we will map the backend-file with MAP_SYNC flag, which ensures the
7770file metadata is in sync for @option{mem-path} in case of host crash
7771or a power failure. MAP_SYNC requires support from both the host kernel
7772(since Linux kernel 4.15) and the filesystem of @option{mem-path} mounted
7773with DAX option.
Junyan Hea4de8552018-07-18 15:48:00 +08007774
Marcel Apfelbaum06329cc2017-12-13 16:37:37 +02007775@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 +00007776
7777Creates a memory backend object, which can be used to back the guest RAM.
7778Memory backend objects offer more control than the @option{-m} option that is
7779traditionally used to define guest RAM. Please refer to
7780@option{memory-backend-file} for a description of the options.
7781
Marc-André Lureau36ea3972018-08-28 17:38:40 +02007782@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 +01007783
7784Creates an anonymous memory file backend object, which allows QEMU to
7785share the memory with an external process (e.g. when using
7786vhost-user). The memory is allocated with memfd and optional
7787sealing. (Linux only)
7788
7789The @option{seal} option creates a sealed-file, that will block
7790further resizing the memory ('on' by default).
7791
7792The @option{hugetlb} option specify the file to be created resides in
7793the hugetlbfs filesystem (since Linux 4.14). Used in conjunction with
7794the @option{hugetlb} option, the @option{hugetlbsize} option specify
7795the hugetlb page size on systems that support multiple hugetlb page
7796sizes (it must be a power of 2 value supported by the system).
7797
7798In some versions of Linux, the @option{hugetlb} option is incompatible
7799with the @option{seal} option (requires at least Linux 4.16).
7800
7801Please refer to @option{memory-backend-file} for a description of the
7802other options.
7803
Marc-André Lureau36ea3972018-08-28 17:38:40 +02007804The @option{share} boolean option is @var{on} by default with memfd.
7805
Laurent Vivier6c4e9d42019-08-20 18:06:13 +02007806@item -object rng-builtin,id=@var{id}
7807
7808Creates a random number generator backend which obtains entropy from
7809QEMU builtin functions. The @option{id} parameter is a unique ID that
7810will be used to reference this entropy backend from the @option{virtio-rng}
Laurent Vivier0198c262019-08-20 18:06:15 +02007811device. By default, the @option{virtio-rng} device uses this RNG backend.
Laurent Vivier6c4e9d42019-08-20 18:06:13 +02007812
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007813@item -object rng-random,id=@var{id},filename=@var{/dev/random}
7814
7815Creates a random number generator backend which obtains entropy from
7816a device on the host. The @option{id} parameter is a unique ID that
7817will be used to reference this entropy backend from the @option{virtio-rng}
7818device. The @option{filename} parameter specifies which file to obtain
Kashyap Chamarthya2230bd2019-05-29 16:31:03 +02007819entropy from and if omitted defaults to @option{/dev/urandom}.
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01007820
7821@item -object rng-egd,id=@var{id},chardev=@var{chardevid}
7822
7823Creates a random number generator backend which obtains entropy from
7824an external daemon running on the host. The @option{id} parameter is
7825a unique ID that will be used to reference this entropy backend from
7826the @option{virtio-rng} device. The @option{chardev} parameter is
7827the unique ID of a character device backend that provides the connection
7828to the RNG daemon.
7829
Daniel P. Berrangee00adf62015-03-13 17:39:26 +00007830@item -object tls-creds-anon,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/cred/dir},verify-peer=@var{on|off}
7831
7832Creates a TLS anonymous credentials object, which can be used to provide
7833TLS support on network backends. The @option{id} parameter is a unique
7834ID which network backends will use to access the credentials. The
7835@option{endpoint} is either @option{server} or @option{client} depending
7836on whether the QEMU network backend that uses the credentials will be
7837acting as a client or as a server. If @option{verify-peer} is enabled
7838(the default) then once the handshake is completed, the peer credentials
7839will be verified, though this is a no-op for anonymous credentials.
7840
7841The @var{dir} parameter tells QEMU where to find the credential
7842files. For server endpoints, this directory may contain a file
7843@var{dh-params.pem} providing diffie-hellman parameters to use
7844for the TLS server. If the file is missing, QEMU will generate
7845a set of DH parameters at startup. This is a computationally
7846expensive operation that consumes random pool entropy, so it is
7847recommended that a persistent set of parameters be generated
7848upfront and saved.
7849
Richard W.M. Jonese1a6dc92018-07-03 09:03:03 +01007850@item -object tls-creds-psk,id=@var{id},endpoint=@var{endpoint},dir=@var{/path/to/keys/dir}[,username=@var{username}]
7851
7852Creates a TLS Pre-Shared Keys (PSK) credentials object, which can be used to provide
7853TLS support on network backends. The @option{id} parameter is a unique
7854ID which network backends will use to access the credentials. The
7855@option{endpoint} is either @option{server} or @option{client} depending
7856on whether the QEMU network backend that uses the credentials will be
7857acting as a client or as a server. For clients only, @option{username}
7858is the username which will be sent to the server. If omitted
7859it defaults to ``qemu''.
7860
7861The @var{dir} parameter tells QEMU where to find the keys file.
7862It is called ``@var{dir}/keys.psk'' and contains ``username:key''
7863pairs. This file can most easily be created using the GnuTLS
7864@code{psktool} program.
7865
7866For server endpoints, @var{dir} may also contain a file
7867@var{dh-params.pem} providing diffie-hellman parameters to use
7868for the TLS server. If the file is missing, QEMU will generate
7869a set of DH parameters at startup. This is a computationally
7870expensive operation that consumes random pool entropy, so it is
7871recommended that a persistent set of parameters be generated
7872up front and saved.
7873
Christophe Fergeau00e5e9d2017-12-08 15:14:30 +01007874@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 +00007875
7876Creates a TLS anonymous credentials object, which can be used to provide
7877TLS support on network backends. The @option{id} parameter is a unique
7878ID which network backends will use to access the credentials. The
7879@option{endpoint} is either @option{server} or @option{client} depending
7880on whether the QEMU network backend that uses the credentials will be
7881acting as a client or as a server. If @option{verify-peer} is enabled
7882(the default) then once the handshake is completed, the peer credentials
7883will be verified. With x509 certificates, this implies that the clients
7884must be provided with valid client certificates too.
7885
7886The @var{dir} parameter tells QEMU where to find the credential
7887files. For server endpoints, this directory may contain a file
7888@var{dh-params.pem} providing diffie-hellman parameters to use
7889for the TLS server. If the file is missing, QEMU will generate
7890a set of DH parameters at startup. This is a computationally
7891expensive operation that consumes random pool entropy, so it is
7892recommended that a persistent set of parameters be generated
7893upfront and saved.
7894
7895For x509 certificate credentials the directory will contain further files
7896providing the x509 certificates. The certificates must be stored
7897in PEM format, in filenames @var{ca-cert.pem}, @var{ca-crl.pem} (optional),
7898@var{server-cert.pem} (only servers), @var{server-key.pem} (only servers),
7899@var{client-cert.pem} (only clients), and @var{client-key.pem} (only clients).
7900
Daniel P. Berrange1d7b5b42015-10-15 16:14:42 +01007901For the @var{server-key.pem} and @var{client-key.pem} files which
7902contain sensitive private keys, it is possible to use an encrypted
7903version by providing the @var{passwordid} parameter. This provides
7904the ID of a previously created @code{secret} object containing the
7905password for decryption.
7906
Christophe Fergeau00e5e9d2017-12-08 15:14:30 +01007907The @var{priority} parameter allows to override the global default
7908priority used by gnutls. This can be useful if the system administrator
7909needs to use a weaker set of crypto priorities for QEMU without
7910potentially forcing the weakness onto all applications. Or conversely
7911if one wants wants a stronger default for QEMU than for all other
7912applications, they can do this through this parameter. Its format is
7913a gnutls priority string as described at
7914@url{https://gnutls.org/manual/html_node/Priority-Strings.html}.
7915
Lukas Straub19731362019-10-24 16:25:48 +02007916@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 +08007917
7918Interval @var{t} can't be 0, this filter batches the packet delivery: all
7919packets arriving in a given interval on netdev @var{netdevid} are delayed
7920until the end of the interval. Interval is in microseconds.
zhanghailiang338d3f42016-03-01 13:37:02 +08007921@option{status} is optional that indicate whether the netfilter is
7922on (enabled) or off (disabled), the default status for netfilter will be 'on'.
Yang Hongyang7dbb11c2015-10-07 11:52:21 +08007923
7924queue @var{all|rx|tx} is an option that can be applied to any netfilter.
7925
7926@option{all}: the filter is attached both to the receive and the transmit
7927 queue of the netdev (default).
7928
7929@option{rx}: the filter is attached to the receive queue of the netdev,
7930 where it will receive packets sent to the netdev.
7931
7932@option{tx}: the filter is attached to the transmit queue of the netdev,
7933 where it will receive packets sent by the netdev.
7934
Lukas Straub19731362019-10-24 16:25:48 +02007935position @var{head|tail|id=<id>} is an option to specify where the
7936filter should be inserted in the filter list. It can be applied to any
7937netfilter.
7938
7939@option{head}: the filter is inserted at the head of the filter
7940 list, before any existing filters.
7941
7942@option{tail}: the filter is inserted at the tail of the filter
7943 list, behind any existing filters (default).
7944
7945@option{id=<id>}: the filter is inserted before or behind the filter
7946 specified by <id>, see the insert option below.
7947
7948insert @var{behind|before} is an option to specify where to insert the
7949new filter relative to the one specified with position=id=<id>. It can
7950be applied to any netfilter.
7951
7952@option{before}: insert before the specified filter.
7953
7954@option{behind}: insert behind the specified filter (default).
7955
7956@item -object filter-mirror,id=@var{id},netdev=@var{netdevid},outdev=@var{chardevid},queue=@var{all|rx|tx}[,vnet_hdr_support][,position=@var{head|tail|id=<id>}][,insert=@var{behind|before}]
Zhang Chenf6d3afb2016-03-15 15:41:33 +08007957
Zhang Chene2521f02017-07-04 14:53:48 +08007958filter-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 +08007959
Lukas Straub19731362019-10-24 16:25:48 +02007960@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 +08007961
7962filter-redirector on netdev @var{netdevid},redirect filter's net packet to chardev
Zhang Chen00d5c242017-07-04 14:53:49 +08007963@var{chardevid},and redirect indev's packet to filter.if it has the vnet_hdr_support flag,
7964filter-redirector will redirect packet with vnet_hdr_len.
Zhang Chend46f75b2016-03-17 16:16:26 +08007965Create a filter-redirector we need to differ outdev id from indev id, id can not
7966be the same. we can just use indev or outdev, but at least one of indev or outdev
7967need to be specified.
7968
Lukas Straub19731362019-10-24 16:25:48 +02007969@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 +08007970
7971Filter-rewriter is a part of COLO project.It will rewrite tcp packet to
7972secondary from primary to keep secondary tcp connection,and rewrite
7973tcp packet to primary from secondary make tcp packet can be handled by
Zhang Chen4b39bdc2017-07-04 14:53:55 +08007974client.if it has the vnet_hdr_support flag, we can parse packet with vnet header.
Zhang Chene6eee8a2016-09-27 10:22:32 +08007975
7976usage:
7977colo secondary:
7978-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
7979-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
7980-object filter-rewriter,id=rew0,netdev=hn0,queue=all
7981
Lukas Straub19731362019-10-24 16:25:48 +02007982@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 +02007983
7984Dump the network traffic on netdev @var{dev} to the file specified by
7985@var{filename}. At most @var{len} bytes (64k by default) per packet are stored.
7986The file format is libpcap, so it can be analyzed with tools such as tcpdump
7987or Wireshark.
7988
Zhang Chencf6af762019-06-10 00:44:29 +08007989@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 +08007990
7991Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
7992secondary packet. If the packets are same, we will output primary
7993packet to outdev@var{chardevid}, else we will notify colo-frame
7994do checkpoint and send primary packet to outdev@var{chardevid}.
Zhang Chen5aede7f2019-04-26 17:07:30 +08007995In order to improve efficiency, we need to put the task of comparison
7996in another thread. If it has the vnet_hdr_support flag, colo compare
7997will send/recv packet with vnet_hdr_len.
Zhang Chencf6af762019-06-10 00:44:29 +08007998If you want to use Xen COLO, will need the notify_dev to notify Xen
7999colo-frame to do checkpoint.
Zhang Chen7dce4e62016-09-27 10:22:26 +08008000
8001we must use it with the help of filter-mirror and filter-redirector.
8002
8003@example
8004
Zhang Chencf6af762019-06-10 00:44:29 +08008005KVM COLO
8006
Zhang Chen7dce4e62016-09-27 10:22:26 +08008007primary:
8008-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8009-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8010-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8011-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8012-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8013-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8014-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8015-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
Zhang Chen5aede7f2019-04-26 17:07:30 +08008016-object iothread,id=iothread1
Zhang Chen7dce4e62016-09-27 10:22:26 +08008017-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8018-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8019-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
Zhang Chen5aede7f2019-04-26 17:07:30 +08008020-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
Zhang Chen7dce4e62016-09-27 10:22:26 +08008021
8022secondary:
8023-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8024-device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8025-chardev socket,id=red0,host=3.3.3.3,port=9003
8026-chardev socket,id=red1,host=3.3.3.3,port=9004
8027-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8028-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8029
Zhang Chencf6af762019-06-10 00:44:29 +08008030
8031Xen COLO
8032
8033primary:
8034-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8035-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8036-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8037-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8038-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8039-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8040-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8041-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8042-chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8043-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8044-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8045-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8046-object iothread,id=iothread1
8047-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8048
8049secondary:
8050-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8051-device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8052-chardev socket,id=red0,host=3.3.3.3,port=9003
8053-chardev socket,id=red1,host=3.3.3.3,port=9004
8054-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8055-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8056
Zhang Chen7dce4e62016-09-27 10:22:26 +08008057@end example
8058
8059If you want to know the detail of above command line, you can read
8060the colo-compare git log.
8061
Gonglei1653a5f2016-10-28 16:33:23 +08008062@item -object cryptodev-backend-builtin,id=@var{id}[,queues=@var{queues}]
8063
8064Creates a cryptodev backend which executes crypto opreation from
8065the QEMU cipher APIS. The @var{id} parameter is
8066a unique ID that will be used to reference this cryptodev backend from
8067the @option{virtio-crypto} device. The @var{queues} parameter is optional,
8068which specify the queue number of cryptodev backend, the default of
8069@var{queues} is 1.
8070
8071@example
8072
Thomas Huth664785a2019-07-30 17:08:26 +02008073 # @value{qemu_system} \
Gonglei1653a5f2016-10-28 16:33:23 +08008074 [...] \
8075 -object cryptodev-backend-builtin,id=cryptodev0 \
8076 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8077 [...]
8078@end example
8079
Gonglei042cea22018-03-01 21:46:28 +08008080@item -object cryptodev-vhost-user,id=@var{id},chardev=@var{chardevid}[,queues=@var{queues}]
8081
8082Creates a vhost-user cryptodev backend, backed by a chardev @var{chardevid}.
8083The @var{id} parameter is a unique ID that will be used to reference this
8084cryptodev backend from the @option{virtio-crypto} device.
8085The chardev should be a unix domain socket backed one. The vhost-user uses
8086a specifically defined protocol to pass vhost ioctl replacement messages
8087to an application on the other end of the socket.
8088The @var{queues} parameter is optional, which specify the queue number
8089of cryptodev backend for multiqueue vhost-user, the default of @var{queues} is 1.
8090
8091@example
8092
Thomas Huth664785a2019-07-30 17:08:26 +02008093 # @value{qemu_system} \
Gonglei042cea22018-03-01 21:46:28 +08008094 [...] \
8095 -chardev socket,id=chardev0,path=/path/to/socket \
8096 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8097 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8098 [...]
8099@end example
8100
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008101@item -object secret,id=@var{id},data=@var{string},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8102@item -object secret,id=@var{id},file=@var{filename},format=@var{raw|base64}[,keyid=@var{secretid},iv=@var{string}]
8103
8104Defines a secret to store a password, encryption key, or some other sensitive
8105data. The sensitive data can either be passed directly via the @var{data}
8106parameter, or indirectly via the @var{file} parameter. Using the @var{data}
8107parameter is insecure unless the sensitive data is encrypted.
8108
8109The sensitive data can be provided in raw format (the default), or base64.
8110When encoded as JSON, the raw format only supports valid UTF-8 characters,
8111so base64 is recommended for sending binary data. QEMU will convert from
8112which ever format is provided to the format it needs internally. eg, an
8113RBD password can be provided in raw format, even though it will be base64
8114encoded when passed onto the RBD sever.
8115
8116For added protection, it is possible to encrypt the data associated with
8117a secret using the AES-256-CBC cipher. Use of encryption is indicated
8118by providing the @var{keyid} and @var{iv} parameters. The @var{keyid}
8119parameter provides the ID of a previously defined secret that contains
8120the AES-256 decryption key. This key should be 32-bytes long and be
8121base64 encoded. The @var{iv} parameter provides the random initialization
8122vector used for encryption of this particular secret and should be a
Daniel P. Berrange69c0b272016-04-04 10:33:55 +01008123base64 encrypted string of the 16-byte IV.
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008124
8125The simplest (insecure) usage is to provide the secret inline
8126
8127@example
8128
Thomas Huth664785a2019-07-30 17:08:26 +02008129 # @value{qemu_system} -object secret,id=sec0,data=letmein,format=raw
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008130
8131@end example
8132
8133The simplest secure usage is to provide the secret via a file
8134
Eric Blakeb43671f2017-07-03 13:09:50 -05008135 # printf "letmein" > mypasswd.txt
Thomas Huth664785a2019-07-30 17:08:26 +02008136 # @value{qemu_system} -object secret,id=sec0,file=mypasswd.txt,format=raw
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008137
8138For greater security, AES-256-CBC should be used. To illustrate usage,
8139consider the openssl command line tool which can encrypt the data. Note
8140that when encrypting, the plaintext must be padded to the cipher block
8141size (32 bytes) using the standard PKCS#5/6 compatible padding algorithm.
8142
8143First a master key needs to be created in base64 encoding:
8144
8145@example
8146 # openssl rand -base64 32 > key.b64
8147 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8148@end example
8149
8150Each secret to be encrypted needs to have a random initialization vector
8151generated. These do not need to be kept secret
8152
8153@example
8154 # openssl rand -base64 16 > iv.b64
8155 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8156@end example
8157
8158The secret to be defined can now be encrypted, in this case we're
8159telling openssl to base64 encode the result, but it could be left
8160as raw bytes if desired.
8161
8162@example
Eric Blakeb43671f2017-07-03 13:09:50 -05008163 # SECRET=$(printf "letmein" |
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008164 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8165@end example
8166
8167When launching QEMU, create a master secret pointing to @code{key.b64}
8168and specify that to be used to decrypt the user password. Pass the
8169contents of @code{iv.b64} to the second secret
8170
8171@example
Thomas Huth664785a2019-07-30 17:08:26 +02008172 # @value{qemu_system} \
Daniel P. Berrangeac1d8872015-10-14 09:58:38 +01008173 -object secret,id=secmaster0,format=base64,file=key.b64 \
8174 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8175 data=$SECRET,iv=$(<iv.b64)
8176@end example
8177
Brijesh Singha9b49422018-03-08 06:48:41 -06008178@item -object sev-guest,id=@var{id},cbitpos=@var{cbitpos},reduced-phys-bits=@var{val},[sev-device=@var{string},policy=@var{policy},handle=@var{handle},dh-cert-file=@var{file},session-file=@var{file}]
8179
8180Create a Secure Encrypted Virtualization (SEV) guest object, which can be used
8181to provide the guest memory encryption support on AMD processors.
8182
8183When memory encryption is enabled, one of the physical address bit (aka the
8184C-bit) is utilized to mark if a memory page is protected. The @option{cbitpos}
8185is used to provide the C-bit position. The C-bit position is Host family dependent
8186hence user must provide this value. On EPYC, the value should be 47.
8187
8188When memory encryption is enabled, we loose certain bits in physical address space.
8189The @option{reduced-phys-bits} is used to provide the number of bits we loose in
8190physical address space. Similar to C-bit, the value is Host family dependent.
8191On EPYC, the value should be 5.
8192
8193The @option{sev-device} provides the device file to use for communicating with
8194the SEV firmware running inside AMD Secure Processor. The default device is
8195'/dev/sev'. If hardware supports memory encryption then /dev/sev devices are
8196created by CCP driver.
8197
8198The @option{policy} provides the guest policy to be enforced by the SEV firmware
8199and restrict what configuration and operational commands can be performed on this
8200guest by the hypervisor. The policy should be provided by the guest owner and is
8201bound to the guest and cannot be changed throughout the lifetime of the guest.
8202The default is 0.
8203
8204If guest @option{policy} allows sharing the key with another SEV guest then
8205@option{handle} can be use to provide handle of the guest from which to share
8206the key.
8207
8208The @option{dh-cert-file} and @option{session-file} provides the guest owner's
8209Public Diffie-Hillman key defined in SEV spec. The PDH and session parameters
8210are used for establishing a cryptographic session with the guest owner to
8211negotiate keys used for attestation. The file must be encoded in base64.
8212
8213e.g to launch a SEV guest
8214@example
Thomas Huth664785a2019-07-30 17:08:26 +02008215 # @value{qemu_system_x86} \
Brijesh Singha9b49422018-03-08 06:48:41 -06008216 ......
8217 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8218 -machine ...,memory-encryption=sev0
8219 .....
8220
8221@end example
Daniel P. Berrangéfb5c4eb2018-05-02 15:40:33 +01008222
8223
8224@item -object authz-simple,id=@var{id},identity=@var{string}
8225
8226Create an authorization object that will control access to network services.
8227
8228The @option{identity} parameter is identifies the user and its format
8229depends on the network service that authorization object is associated
8230with. For authorizing based on TLS x509 certificates, the identity must
8231be the x509 distinguished name. Note that care must be taken to escape
8232any commas in the distinguished name.
8233
8234An example authorization object to validate a x509 distinguished name
8235would look like:
8236@example
Thomas Huth664785a2019-07-30 17:08:26 +02008237 # @value{qemu_system} \
Daniel P. Berrangéfb5c4eb2018-05-02 15:40:33 +01008238 ...
8239 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8240 ...
8241@end example
8242
8243Note the use of quotes due to the x509 distinguished name containing
8244whitespace, and escaping of ','.
8245
Daniel P. Berrangé55d86982018-05-11 12:19:59 +01008246@item -object authz-listfile,id=@var{id},filename=@var{path},refresh=@var{yes|no}
8247
8248Create an authorization object that will control access to network services.
8249
8250The @option{filename} parameter is the fully qualified path to a file
8251containing the access control list rules in JSON format.
8252
8253An example set of rules that match against SASL usernames might look
8254like:
8255
8256@example
8257 @{
8258 "rules": [
8259 @{ "match": "fred", "policy": "allow", "format": "exact" @},
8260 @{ "match": "bob", "policy": "allow", "format": "exact" @},
8261 @{ "match": "danb", "policy": "deny", "format": "glob" @},
8262 @{ "match": "dan*", "policy": "allow", "format": "exact" @},
8263 ],
8264 "policy": "deny"
8265 @}
8266@end example
8267
8268When checking access the object will iterate over all the rules and
8269the first rule to match will have its @option{policy} value returned
8270as the result. If no rules match, then the default @option{policy}
8271value is returned.
8272
8273The rules can either be an exact string match, or they can use the
8274simple UNIX glob pattern matching to allow wildcards to be used.
8275
8276If @option{refresh} is set to true the file will be monitored
8277and automatically reloaded whenever its content changes.
8278
8279As with the @code{authz-simple} object, the format of the identity
8280strings being matched depends on the network service, but is usually
8281a TLS x509 distinguished name, or a SASL username.
8282
8283An example authorization object to validate a SASL username
8284would look like:
8285@example
Thomas Huth664785a2019-07-30 17:08:26 +02008286 # @value{qemu_system} \
Daniel P. Berrangé55d86982018-05-11 12:19:59 +01008287 ...
8288 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8289 ...
8290@end example
8291
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008292@item -object authz-pam,id=@var{id},service=@var{string}
8293
8294Create an authorization object that will control access to network services.
8295
8296The @option{service} parameter provides the name of a PAM service to use
8297for authorization. It requires that a file @code{/etc/pam.d/@var{service}}
8298exist to provide the configuration for the @code{account} subsystem.
8299
8300An example authorization object to validate a TLS x509 distinguished
8301name would look like:
8302
8303@example
Thomas Huth664785a2019-07-30 17:08:26 +02008304 # @value{qemu_system} \
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008305 ...
8306 -object authz-pam,id=auth0,service=qemu-vnc
8307 ...
8308@end example
8309
8310There would then be a corresponding config file for PAM at
8311@code{/etc/pam.d/qemu-vnc} that contains:
8312
8313@example
8314account requisite pam_listfile.so item=user sense=allow \
8315 file=/etc/qemu/vnc.allow
8316@end example
8317
8318Finally the @code{/etc/qemu/vnc.allow} file would contain
8319the list of x509 distingished names that are permitted
8320access
8321
8322@example
8323CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
8324@end example
8325
Stefan Hajnoczi86d2a492019-10-25 14:22:36 +02008326@item -object iothread,id=@var{id},poll-max-ns=@var{poll-max-ns},poll-grow=@var{poll-grow},poll-shrink=@var{poll-shrink}
8327
8328Creates a dedicated event loop thread that devices can be assigned to. This is
8329known as an IOThread. By default device emulation happens in vCPU threads or
8330the main event loop thread. This can become a scalability bottleneck.
8331IOThreads allow device emulation and I/O to run on other host CPUs.
8332
8333The @option{id} parameter is a unique ID that will be used to reference this
8334IOThread from @option{-device ...,iothread=@var{id}}. Multiple devices can be
8335assigned to an IOThread. Note that not all devices support an
8336@option{iothread} parameter.
8337
8338The @code{query-iothreads} QMP command lists IOThreads and reports their thread
8339IDs so that the user can configure host CPU pinning/affinity.
8340
8341IOThreads use an adaptive polling algorithm to reduce event loop latency.
8342Instead of entering a blocking system call to monitor file descriptors and then
8343pay the cost of being woken up when an event occurs, the polling algorithm
8344spins waiting for events for a short time. The algorithm's default parameters
8345are suitable for many cases but can be adjusted based on knowledge of the
8346workload and/or host device latency.
8347
8348The @option{poll-max-ns} parameter is the maximum number of nanoseconds to busy
8349wait for events. Polling can be disabled by setting this value to 0.
8350
8351The @option{poll-grow} parameter is the multiplier used to increase the polling
8352time when the algorithm detects it is missing events due to not polling long
8353enough.
8354
8355The @option{poll-shrink} parameter is the divisor used to decrease the polling
8356time when the algorithm detects it is spending too long polling without
8357encountering events.
8358
8359The polling parameters can be modified at run-time using the @code{qom-set} command (where @code{iothread1} is the IOThread's @code{id}):
8360
8361@example
8362(qemu) qom-set /objects/iothread1 poll-max-ns 100000
8363@end example
Daniel P. Berrange8953caf2016-07-27 14:13:56 +01008364
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01008365@end table
8366
8367ETEXI
Peter Maydelle2fcbf42020-03-06 10:07:14 +00008368SRST
8369``-object typename[,prop1=value1,...]``
8370 Create a new object of type typename setting properties in the order
8371 they are specified. Note that the 'id' property must be set. These
8372 objects are placed in the '/objects' path.
8373
8374 ``-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align``
8375 Creates a memory file backend object, which can be used to back
8376 the guest RAM with huge pages.
8377
8378 The ``id`` parameter is a unique ID that will be used to
8379 reference this memory region when configuring the ``-numa``
8380 argument.
8381
8382 The ``size`` option provides the size of the memory region, and
8383 accepts common suffixes, eg ``500M``.
8384
8385 The ``mem-path`` provides the path to either a shared memory or
8386 huge page filesystem mount.
8387
8388 The ``share`` boolean option determines whether the memory
8389 region is marked as private to QEMU, or shared. The latter
8390 allows a co-operating external process to access the QEMU memory
8391 region.
8392
8393 The ``share`` is also required for pvrdma devices due to
8394 limitations in the RDMA API provided by Linux.
8395
8396 Setting share=on might affect the ability to configure NUMA
8397 bindings for the memory backend under some circumstances, see
8398 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel
8399 source tree for additional details.
8400
8401 Setting the ``discard-data`` boolean option to on indicates that
8402 file contents can be destroyed when QEMU exits, to avoid
8403 unnecessarily flushing data to the backing file. Note that
8404 ``discard-data`` is only an optimization, and QEMU might not
8405 discard file contents if it aborts unexpectedly or is terminated
8406 using SIGKILL.
8407
8408 The ``merge`` boolean option enables memory merge, also known as
8409 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider
8410 the pages for memory deduplication.
8411
8412 Setting the ``dump`` boolean option to off excludes the memory
8413 from core dumps. This feature is also known as MADV\_DONTDUMP.
8414
8415 The ``prealloc`` boolean option enables memory preallocation.
8416
8417 The ``host-nodes`` option binds the memory range to a list of
8418 NUMA host nodes.
8419
8420 The ``policy`` option sets the NUMA policy to one of the
8421 following values:
8422
8423 ``default``
8424 default host policy
8425
8426 ``preferred``
8427 prefer the given host node list for allocation
8428
8429 ``bind``
8430 restrict memory allocation to the given host node list
8431
8432 ``interleave``
8433 interleave memory allocations across the given host node
8434 list
8435
8436 The ``align`` option specifies the base address alignment when
8437 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg
8438 ``2M``. Some backend store specified by ``mem-path`` requires an
8439 alignment different than the default one used by QEMU, eg the
8440 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
8441 such cases, users can specify the required alignment via this
8442 option.
8443
8444 The ``pmem`` option specifies whether the backing file specified
8445 by ``mem-path`` is in host persistent memory that can be
8446 accessed using the SNIA NVM programming model (e.g. Intel
8447 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary
8448 operations to guarantee the persistence of its own writes to
8449 ``mem-path`` (e.g. in vNVDIMM label emulation and live
8450 migration). Also, we will map the backend-file with MAP\_SYNC
8451 flag, which ensures the file metadata is in sync for
8452 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC
8453 requires support from both the host kernel (since Linux kernel
8454 4.15) and the filesystem of ``mem-path`` mounted with DAX
8455 option.
8456
8457 ``-object memory-backend-ram,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave``
8458 Creates a memory backend object, which can be used to back the
8459 guest RAM. Memory backend objects offer more control than the
8460 ``-m`` option that is traditionally used to define guest RAM.
8461 Please refer to ``memory-backend-file`` for a description of the
8462 options.
8463
8464 ``-object memory-backend-memfd,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave,seal=on|off,hugetlb=on|off,hugetlbsize=size``
8465 Creates an anonymous memory file backend object, which allows
8466 QEMU to share the memory with an external process (e.g. when
8467 using vhost-user). The memory is allocated with memfd and
8468 optional sealing. (Linux only)
8469
8470 The ``seal`` option creates a sealed-file, that will block
8471 further resizing the memory ('on' by default).
8472
8473 The ``hugetlb`` option specify the file to be created resides in
8474 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction
8475 with the ``hugetlb`` option, the ``hugetlbsize`` option specify
8476 the hugetlb page size on systems that support multiple hugetlb
8477 page sizes (it must be a power of 2 value supported by the
8478 system).
8479
8480 In some versions of Linux, the ``hugetlb`` option is
8481 incompatible with the ``seal`` option (requires at least Linux
8482 4.16).
8483
8484 Please refer to ``memory-backend-file`` for a description of the
8485 other options.
8486
8487 The ``share`` boolean option is on by default with memfd.
8488
8489 ``-object rng-builtin,id=id``
8490 Creates a random number generator backend which obtains entropy
8491 from QEMU builtin functions. The ``id`` parameter is a unique ID
8492 that will be used to reference this entropy backend from the
8493 ``virtio-rng`` device. By default, the ``virtio-rng`` device
8494 uses this RNG backend.
8495
8496 ``-object rng-random,id=id,filename=/dev/random``
8497 Creates a random number generator backend which obtains entropy
8498 from a device on the host. The ``id`` parameter is a unique ID
8499 that will be used to reference this entropy backend from the
8500 ``virtio-rng`` device. The ``filename`` parameter specifies
8501 which file to obtain entropy from and if omitted defaults to
8502 ``/dev/urandom``.
8503
8504 ``-object rng-egd,id=id,chardev=chardevid``
8505 Creates a random number generator backend which obtains entropy
8506 from an external daemon running on the host. The ``id``
8507 parameter is a unique ID that will be used to reference this
8508 entropy backend from the ``virtio-rng`` device. The ``chardev``
8509 parameter is the unique ID of a character device backend that
8510 provides the connection to the RNG daemon.
8511
8512 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off``
8513 Creates a TLS anonymous credentials object, which can be used to
8514 provide TLS support on network backends. The ``id`` parameter is
8515 a unique ID which network backends will use to access the
8516 credentials. The ``endpoint`` is either ``server`` or ``client``
8517 depending on whether the QEMU network backend that uses the
8518 credentials will be acting as a client or as a server. If
8519 ``verify-peer`` is enabled (the default) then once the handshake
8520 is completed, the peer credentials will be verified, though this
8521 is a no-op for anonymous credentials.
8522
8523 The dir parameter tells QEMU where to find the credential files.
8524 For server endpoints, this directory may contain a file
8525 dh-params.pem providing diffie-hellman parameters to use for the
8526 TLS server. If the file is missing, QEMU will generate a set of
8527 DH parameters at startup. This is a computationally expensive
8528 operation that consumes random pool entropy, so it is
8529 recommended that a persistent set of parameters be generated
8530 upfront and saved.
8531
8532 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]``
8533 Creates a TLS Pre-Shared Keys (PSK) credentials object, which
8534 can be used to provide TLS support on network backends. The
8535 ``id`` parameter is a unique ID which network backends will use
8536 to access the credentials. The ``endpoint`` is either ``server``
8537 or ``client`` depending on whether the QEMU network backend that
8538 uses the credentials will be acting as a client or as a server.
8539 For clients only, ``username`` is the username which will be
8540 sent to the server. If omitted it defaults to "qemu".
8541
8542 The dir parameter tells QEMU where to find the keys file. It is
8543 called "dir/keys.psk" and contains "username:key" pairs. This
8544 file can most easily be created using the GnuTLS ``psktool``
8545 program.
8546
8547 For server endpoints, dir may also contain a file dh-params.pem
8548 providing diffie-hellman parameters to use for the TLS server.
8549 If the file is missing, QEMU will generate a set of DH
8550 parameters at startup. This is a computationally expensive
8551 operation that consumes random pool entropy, so it is
8552 recommended that a persistent set of parameters be generated up
8553 front and saved.
8554
8555 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id``
8556 Creates a TLS anonymous credentials object, which can be used to
8557 provide TLS support on network backends. The ``id`` parameter is
8558 a unique ID which network backends will use to access the
8559 credentials. The ``endpoint`` is either ``server`` or ``client``
8560 depending on whether the QEMU network backend that uses the
8561 credentials will be acting as a client or as a server. If
8562 ``verify-peer`` is enabled (the default) then once the handshake
8563 is completed, the peer credentials will be verified. With x509
8564 certificates, this implies that the clients must be provided
8565 with valid client certificates too.
8566
8567 The dir parameter tells QEMU where to find the credential files.
8568 For server endpoints, this directory may contain a file
8569 dh-params.pem providing diffie-hellman parameters to use for the
8570 TLS server. If the file is missing, QEMU will generate a set of
8571 DH parameters at startup. This is a computationally expensive
8572 operation that consumes random pool entropy, so it is
8573 recommended that a persistent set of parameters be generated
8574 upfront and saved.
8575
8576 For x509 certificate credentials the directory will contain
8577 further files providing the x509 certificates. The certificates
8578 must be stored in PEM format, in filenames ca-cert.pem,
8579 ca-crl.pem (optional), server-cert.pem (only servers),
8580 server-key.pem (only servers), client-cert.pem (only clients),
8581 and client-key.pem (only clients).
8582
8583 For the server-key.pem and client-key.pem files which contain
8584 sensitive private keys, it is possible to use an encrypted
8585 version by providing the passwordid parameter. This provides the
8586 ID of a previously created ``secret`` object containing the
8587 password for decryption.
8588
8589 The priority parameter allows to override the global default
8590 priority used by gnutls. This can be useful if the system
8591 administrator needs to use a weaker set of crypto priorities for
8592 QEMU without potentially forcing the weakness onto all
8593 applications. Or conversely if one wants wants a stronger
8594 default for QEMU than for all other applications, they can do
8595 this through this parameter. Its format is a gnutls priority
8596 string as described at
8597 https://gnutls.org/manual/html_node/Priority-Strings.html.
8598
8599 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]``
8600 Interval t can't be 0, this filter batches the packet delivery:
8601 all packets arriving in a given interval on netdev netdevid are
8602 delayed until the end of the interval. Interval is in
8603 microseconds. ``status`` is optional that indicate whether the
8604 netfilter is on (enabled) or off (disabled), the default status
8605 for netfilter will be 'on'.
8606
8607 queue all\|rx\|tx is an option that can be applied to any
8608 netfilter.
8609
8610 ``all``: the filter is attached both to the receive and the
8611 transmit queue of the netdev (default).
8612
8613 ``rx``: the filter is attached to the receive queue of the
8614 netdev, where it will receive packets sent to the netdev.
8615
8616 ``tx``: the filter is attached to the transmit queue of the
8617 netdev, where it will receive packets sent by the netdev.
8618
8619 position head\|tail\|id=<id> is an option to specify where the
8620 filter should be inserted in the filter list. It can be applied
8621 to any netfilter.
8622
8623 ``head``: the filter is inserted at the head of the filter list,
8624 before any existing filters.
8625
8626 ``tail``: the filter is inserted at the tail of the filter list,
8627 behind any existing filters (default).
8628
8629 ``id=<id>``: the filter is inserted before or behind the filter
8630 specified by <id>, see the insert option below.
8631
8632 insert behind\|before is an option to specify where to insert
8633 the new filter relative to the one specified with
8634 position=id=<id>. It can be applied to any netfilter.
8635
8636 ``before``: insert before the specified filter.
8637
8638 ``behind``: insert behind the specified filter (default).
8639
8640 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8641 filter-mirror on netdev netdevid,mirror net packet to
8642 chardevchardevid, if it has the vnet\_hdr\_support flag,
8643 filter-mirror will mirror packet with vnet\_hdr\_len.
8644
8645 ``-object filter-redirector,id=id,netdev=netdevid,indev=chardevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8646 filter-redirector on netdev netdevid,redirect filter's net
8647 packet to chardev chardevid,and redirect indev's packet to
8648 filter.if it has the vnet\_hdr\_support flag, filter-redirector
8649 will redirect packet with vnet\_hdr\_len. Create a
8650 filter-redirector we need to differ outdev id from indev id, id
8651 can not be the same. we can just use indev or outdev, but at
8652 least one of indev or outdev need to be specified.
8653
8654 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
8655 Filter-rewriter is a part of COLO project.It will rewrite tcp
8656 packet to secondary from primary to keep secondary tcp
8657 connection,and rewrite tcp packet to primary from secondary make
8658 tcp packet can be handled by client.if it has the
8659 vnet\_hdr\_support flag, we can parse packet with vnet header.
8660
8661 usage: colo secondary: -object
8662 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object
8663 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object
8664 filter-rewriter,id=rew0,netdev=hn0,queue=all
8665
8666 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]``
8667 Dump the network traffic on netdev dev to the file specified by
8668 filename. At most len bytes (64k by default) per packet are
8669 stored. The file format is libpcap, so it can be analyzed with
8670 tools such as tcpdump or Wireshark.
8671
8672 ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id]``
8673 Colo-compare gets packet from primary\_inchardevid and
8674 secondary\_inchardevid, than compare primary packet with
8675 secondary packet. If the packets are same, we will output
8676 primary packet to outdevchardevid, else we will notify
8677 colo-frame do checkpoint and send primary packet to
8678 outdevchardevid. In order to improve efficiency, we need to put
8679 the task of comparison in another thread. If it has the
8680 vnet\_hdr\_support flag, colo compare will send/recv packet with
8681 vnet\_hdr\_len. If you want to use Xen COLO, will need the
8682 notify\_dev to notify Xen colo-frame to do checkpoint.
8683
8684 we must use it with the help of filter-mirror and
8685 filter-redirector.
8686
8687 ::
8688
8689 KVM COLO
8690
8691 primary:
8692 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8693 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8694 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8695 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8696 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8697 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8698 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8699 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8700 -object iothread,id=iothread1
8701 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8702 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8703 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8704 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
8705
8706 secondary:
8707 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8708 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8709 -chardev socket,id=red0,host=3.3.3.3,port=9003
8710 -chardev socket,id=red1,host=3.3.3.3,port=9004
8711 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8712 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8713
8714
8715 Xen COLO
8716
8717 primary:
8718 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
8719 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
8720 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
8721 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
8722 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
8723 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
8724 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
8725 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
8726 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
8727 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
8728 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
8729 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
8730 -object iothread,id=iothread1
8731 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
8732
8733 secondary:
8734 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
8735 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
8736 -chardev socket,id=red0,host=3.3.3.3,port=9003
8737 -chardev socket,id=red1,host=3.3.3.3,port=9004
8738 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
8739 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
8740
8741 If you want to know the detail of above command line, you can
8742 read the colo-compare git log.
8743
8744 ``-object cryptodev-backend-builtin,id=id[,queues=queues]``
8745 Creates a cryptodev backend which executes crypto opreation from
8746 the QEMU cipher APIS. The id parameter is a unique ID that will
8747 be used to reference this cryptodev backend from the
8748 ``virtio-crypto`` device. The queues parameter is optional,
8749 which specify the queue number of cryptodev backend, the default
8750 of queues is 1.
8751
8752 ::
8753
8754 # |qemu_system| \
8755 [...] \
8756 -object cryptodev-backend-builtin,id=cryptodev0 \
8757 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8758 [...]
8759
8760 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]``
8761 Creates a vhost-user cryptodev backend, backed by a chardev
8762 chardevid. The id parameter is a unique ID that will be used to
8763 reference this cryptodev backend from the ``virtio-crypto``
8764 device. The chardev should be a unix domain socket backed one.
8765 The vhost-user uses a specifically defined protocol to pass
8766 vhost ioctl replacement messages to an application on the other
8767 end of the socket. The queues parameter is optional, which
8768 specify the queue number of cryptodev backend for multiqueue
8769 vhost-user, the default of queues is 1.
8770
8771 ::
8772
8773 # |qemu_system| \
8774 [...] \
8775 -chardev socket,id=chardev0,path=/path/to/socket \
8776 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \
8777 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \
8778 [...]
8779
8780 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]``
8781 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]``
8782 Defines a secret to store a password, encryption key, or some
8783 other sensitive data. The sensitive data can either be passed
8784 directly via the data parameter, or indirectly via the file
8785 parameter. Using the data parameter is insecure unless the
8786 sensitive data is encrypted.
8787
8788 The sensitive data can be provided in raw format (the default),
8789 or base64. When encoded as JSON, the raw format only supports
8790 valid UTF-8 characters, so base64 is recommended for sending
8791 binary data. QEMU will convert from which ever format is
8792 provided to the format it needs internally. eg, an RBD password
8793 can be provided in raw format, even though it will be base64
8794 encoded when passed onto the RBD sever.
8795
8796 For added protection, it is possible to encrypt the data
8797 associated with a secret using the AES-256-CBC cipher. Use of
8798 encryption is indicated by providing the keyid and iv
8799 parameters. The keyid parameter provides the ID of a previously
8800 defined secret that contains the AES-256 decryption key. This
8801 key should be 32-bytes long and be base64 encoded. The iv
8802 parameter provides the random initialization vector used for
8803 encryption of this particular secret and should be a base64
8804 encrypted string of the 16-byte IV.
8805
8806 The simplest (insecure) usage is to provide the secret inline
8807
8808 ::
8809
8810 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw
8811
8812 The simplest secure usage is to provide the secret via a file
8813
8814 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object
8815 secret,id=sec0,file=mypasswd.txt,format=raw
8816
8817 For greater security, AES-256-CBC should be used. To illustrate
8818 usage, consider the openssl command line tool which can encrypt
8819 the data. Note that when encrypting, the plaintext must be
8820 padded to the cipher block size (32 bytes) using the standard
8821 PKCS#5/6 compatible padding algorithm.
8822
8823 First a master key needs to be created in base64 encoding:
8824
8825 ::
8826
8827 # openssl rand -base64 32 > key.b64
8828 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
8829
8830 Each secret to be encrypted needs to have a random
8831 initialization vector generated. These do not need to be kept
8832 secret
8833
8834 ::
8835
8836 # openssl rand -base64 16 > iv.b64
8837 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
8838
8839 The secret to be defined can now be encrypted, in this case
8840 we're telling openssl to base64 encode the result, but it could
8841 be left as raw bytes if desired.
8842
8843 ::
8844
8845 # SECRET=$(printf "letmein" |
8846 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
8847
8848 When launching QEMU, create a master secret pointing to
8849 ``key.b64`` and specify that to be used to decrypt the user
8850 password. Pass the contents of ``iv.b64`` to the second secret
8851
8852 ::
8853
8854 # |qemu_system| \
8855 -object secret,id=secmaster0,format=base64,file=key.b64 \
8856 -object secret,id=sec0,keyid=secmaster0,format=base64,\
8857 data=$SECRET,iv=$(<iv.b64)
8858
8859 ``-object sev-guest,id=id,cbitpos=cbitpos,reduced-phys-bits=val,[sev-device=string,policy=policy,handle=handle,dh-cert-file=file,session-file=file]``
8860 Create a Secure Encrypted Virtualization (SEV) guest object,
8861 which can be used to provide the guest memory encryption support
8862 on AMD processors.
8863
8864 When memory encryption is enabled, one of the physical address
8865 bit (aka the C-bit) is utilized to mark if a memory page is
8866 protected. The ``cbitpos`` is used to provide the C-bit
8867 position. The C-bit position is Host family dependent hence user
8868 must provide this value. On EPYC, the value should be 47.
8869
8870 When memory encryption is enabled, we loose certain bits in
8871 physical address space. The ``reduced-phys-bits`` is used to
8872 provide the number of bits we loose in physical address space.
8873 Similar to C-bit, the value is Host family dependent. On EPYC,
8874 the value should be 5.
8875
8876 The ``sev-device`` provides the device file to use for
8877 communicating with the SEV firmware running inside AMD Secure
8878 Processor. The default device is '/dev/sev'. If hardware
8879 supports memory encryption then /dev/sev devices are created by
8880 CCP driver.
8881
8882 The ``policy`` provides the guest policy to be enforced by the
8883 SEV firmware and restrict what configuration and operational
8884 commands can be performed on this guest by the hypervisor. The
8885 policy should be provided by the guest owner and is bound to the
8886 guest and cannot be changed throughout the lifetime of the
8887 guest. The default is 0.
8888
8889 If guest ``policy`` allows sharing the key with another SEV
8890 guest then ``handle`` can be use to provide handle of the guest
8891 from which to share the key.
8892
8893 The ``dh-cert-file`` and ``session-file`` provides the guest
8894 owner's Public Diffie-Hillman key defined in SEV spec. The PDH
8895 and session parameters are used for establishing a cryptographic
8896 session with the guest owner to negotiate keys used for
8897 attestation. The file must be encoded in base64.
8898
8899 e.g to launch a SEV guest
8900
8901 ::
8902
8903 # |qemu_system_x86| \
8904 ......
8905 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=5 \
8906 -machine ...,memory-encryption=sev0
8907 .....
8908
8909 ``-object authz-simple,id=id,identity=string``
8910 Create an authorization object that will control access to
8911 network services.
8912
8913 The ``identity`` parameter is identifies the user and its format
8914 depends on the network service that authorization object is
8915 associated with. For authorizing based on TLS x509 certificates,
8916 the identity must be the x509 distinguished name. Note that care
8917 must be taken to escape any commas in the distinguished name.
8918
8919 An example authorization object to validate a x509 distinguished
8920 name would look like:
8921
8922 ::
8923
8924 # |qemu_system| \
8925 ...
8926 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \
8927 ...
8928
8929 Note the use of quotes due to the x509 distinguished name
8930 containing whitespace, and escaping of ','.
8931
8932 ``-object authz-listfile,id=id,filename=path,refresh=yes|no``
8933 Create an authorization object that will control access to
8934 network services.
8935
8936 The ``filename`` parameter is the fully qualified path to a file
8937 containing the access control list rules in JSON format.
8938
8939 An example set of rules that match against SASL usernames might
8940 look like:
8941
8942 ::
8943
8944 {
8945 "rules": [
8946 { "match": "fred", "policy": "allow", "format": "exact" },
8947 { "match": "bob", "policy": "allow", "format": "exact" },
8948 { "match": "danb", "policy": "deny", "format": "glob" },
8949 { "match": "dan*", "policy": "allow", "format": "exact" },
8950 ],
8951 "policy": "deny"
8952 }
8953
8954 When checking access the object will iterate over all the rules
8955 and the first rule to match will have its ``policy`` value
8956 returned as the result. If no rules match, then the default
8957 ``policy`` value is returned.
8958
8959 The rules can either be an exact string match, or they can use
8960 the simple UNIX glob pattern matching to allow wildcards to be
8961 used.
8962
8963 If ``refresh`` is set to true the file will be monitored and
8964 automatically reloaded whenever its content changes.
8965
8966 As with the ``authz-simple`` object, the format of the identity
8967 strings being matched depends on the network service, but is
8968 usually a TLS x509 distinguished name, or a SASL username.
8969
8970 An example authorization object to validate a SASL username
8971 would look like:
8972
8973 ::
8974
8975 # |qemu_system| \
8976 ...
8977 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=yes
8978 ...
8979
8980 ``-object authz-pam,id=id,service=string``
8981 Create an authorization object that will control access to
8982 network services.
8983
8984 The ``service`` parameter provides the name of a PAM service to
8985 use for authorization. It requires that a file
8986 ``/etc/pam.d/service`` exist to provide the configuration for
8987 the ``account`` subsystem.
8988
8989 An example authorization object to validate a TLS x509
8990 distinguished name would look like:
8991
8992 ::
8993
8994 # |qemu_system| \
8995 ...
8996 -object authz-pam,id=auth0,service=qemu-vnc
8997 ...
8998
8999 There would then be a corresponding config file for PAM at
9000 ``/etc/pam.d/qemu-vnc`` that contains:
9001
9002 ::
9003
9004 account requisite pam_listfile.so item=user sense=allow \
9005 file=/etc/qemu/vnc.allow
9006
9007 Finally the ``/etc/qemu/vnc.allow`` file would contain the list
9008 of x509 distingished names that are permitted access
9009
9010 ::
9011
9012 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
9013
9014 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink``
9015 Creates a dedicated event loop thread that devices can be
9016 assigned to. This is known as an IOThread. By default device
9017 emulation happens in vCPU threads or the main event loop thread.
9018 This can become a scalability bottleneck. IOThreads allow device
9019 emulation and I/O to run on other host CPUs.
9020
9021 The ``id`` parameter is a unique ID that will be used to
9022 reference this IOThread from ``-device ...,iothread=id``.
9023 Multiple devices can be assigned to an IOThread. Note that not
9024 all devices support an ``iothread`` parameter.
9025
9026 The ``query-iothreads`` QMP command lists IOThreads and reports
9027 their thread IDs so that the user can configure host CPU
9028 pinning/affinity.
9029
9030 IOThreads use an adaptive polling algorithm to reduce event loop
9031 latency. Instead of entering a blocking system call to monitor
9032 file descriptors and then pay the cost of being woken up when an
9033 event occurs, the polling algorithm spins waiting for events for
9034 a short time. The algorithm's default parameters are suitable
9035 for many cases but can be adjusted based on knowledge of the
9036 workload and/or host device latency.
9037
9038 The ``poll-max-ns`` parameter is the maximum number of
9039 nanoseconds to busy wait for events. Polling can be disabled by
9040 setting this value to 0.
9041
9042 The ``poll-grow`` parameter is the multiplier used to increase
9043 the polling time when the algorithm detects it is missing events
9044 due to not polling long enough.
9045
9046 The ``poll-shrink`` parameter is the divisor used to decrease
9047 the polling time when the algorithm detects it is spending too
9048 long polling without encountering events.
9049
9050 The polling parameters can be modified at run-time using the
9051 ``qom-set`` command (where ``iothread1`` is the IOThread's
9052 ``id``):
9053
9054 ::
9055
9056 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
9057ERST
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01009058
9059
Stefan Weil3dbf2c72010-01-16 18:19:44 +01009060HXCOMM This is the last statement. Insert new options before this line!
9061STEXI
9062@end table
9063ETEXI