blob: 93d106aa9cb50e2a5ed6b4e275fe4f4d96e5a705 [file] [log] [blame]
Peter Maydell3c95fde2020-03-06 17:17:44 +00001HXCOMM Use DEFHEADING() to define headings in both help text and rST.
2HXCOMM Text between SRST and ERST is copied to the rST 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.
Peter Maydell3c95fde2020-03-06 17:17:44 +00007HXCOMM HXCOMM can be used for comments, discarded from both rST and C.
blueswir15824d652009-03-28 06:44:27 +00008
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02009DEFHEADING(Standard options:)
blueswir15824d652009-03-28 06:44:27 +000010
11DEF("help", 0, QEMU_OPTION_h,
Blue Swirlad960902010-03-29 19:23:52 +000012 "-h or -help display this help and exit\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000013SRST
14``-h``
15 Display help and exit
16ERST
blueswir15824d652009-03-28 06:44:27 +000017
pbrook9bd7e6d2009-04-07 22:58:45 +000018DEF("version", 0, QEMU_OPTION_version,
Blue Swirlad960902010-03-29 19:23:52 +000019 "-version display version information and exit\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000020SRST
21``-version``
22 Display version information and exit
23ERST
pbrook9bd7e6d2009-04-07 22:58:45 +000024
Jan Kiszka80f52a62011-07-23 12:39:46 +020025DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
26 "-machine [type=]name[,prop[=value][,...]]\n"
Peter Maydell585f6032012-10-04 16:22:01 +010027 " selects emulated machine ('-machine help' for list)\n"
Jan Kiszka80f52a62011-07-23 12:39:46 +020028 " property accel=accel1[:accel2[:...]] selects accelerator\n"
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +020029 " supported accelerators are kvm, xen, hvf, nvmm, whpx or tcg (default: tcg)\n"
Don Slutzd1048be2014-11-21 11:18:52 -050030 " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
Luiz Capitulino8490fc72012-09-05 16:50:16 -030031 " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
Le Tana52a7fd2014-08-16 13:55:40 +080032 " mem-merge=on|off controls memory merge support (default: on)\n"
Tony Krowiak2eb1cd02015-03-12 13:53:51 +010033 " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
Alexander Graf9850c602015-02-23 13:56:42 +010034 " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
Xiao Guangrong87252e12015-12-02 15:20:58 +080035 " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
Greg Kurz902c0532016-02-18 12:32:25 +010036 " nvdimm=on|off controls NVDIMM support (default=off)\n"
Tao Xu244b3f42019-12-13 09:19:22 +080037 " memory-encryption=@var{} memory encryption object to use (default=none)\n"
Igor Mammedov8db0b202021-01-21 11:15:04 -050038 " hmat=on|off controls ACPI HMAT support (default=off)\n"
Jonathan Cameron03b39fc2022-06-08 15:54:33 +010039 " memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n"
Cédric Le Goater57702892022-11-07 17:13:48 +010040 " cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]\n",
Jan Kiszka80f52a62011-07-23 12:39:46 +020041 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000042SRST
43``-machine [type=]name[,prop=value[,...]]``
44 Select the emulated machine by name. Use ``-machine help`` to list
45 available machines.
46
47 For architectures which aim to support live migration compatibility
48 across releases, each release will introduce a new versioned machine
49 type. For example, the 2.8.0 release introduced machine types
50 "pc-i440fx-2.8" and "pc-q35-2.8" for the x86\_64/i686 architectures.
51
52 To allow live migration of guests from QEMU version 2.8.0, to QEMU
53 version 2.9.0, the 2.9.0 version must support the "pc-i440fx-2.8"
54 and "pc-q35-2.8" machines too. To allow users live migrating VMs to
55 skip multiple intermediate releases when upgrading, new releases of
56 QEMU will support machine types from many previous versions.
57
58 Supported machine properties are:
59
60 ``accel=accels1[:accels2[:...]]``
61 This is used to enable an accelerator. Depending on the target
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +020062 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available.
Peter Maydelle2fcbf42020-03-06 10:07:14 +000063 By default, tcg is used. If there is more than one accelerator
64 specified, the next one is used if the previous one fails to
65 initialize.
66
67 ``vmport=on|off|auto``
68 Enables emulation of VMWare IO port, for vmmouse etc. auto says
69 to select the value based on accel. For accel=xen the default is
70 off otherwise the default is on.
71
72 ``dump-guest-core=on|off``
73 Include guest memory in a core dump. The default is on.
74
75 ``mem-merge=on|off``
76 Enables or disables memory merge support. This feature, when
77 supported by the host, de-duplicates identical memory pages
78 among VMs instances (enabled by default).
79
80 ``aes-key-wrap=on|off``
81 Enables or disables AES key wrapping support on s390-ccw hosts.
82 This feature controls whether AES wrapping keys will be created
83 to allow execution of AES cryptographic functions. The default
84 is on.
85
86 ``dea-key-wrap=on|off``
87 Enables or disables DEA key wrapping support on s390-ccw hosts.
88 This feature controls whether DEA wrapping keys will be created
89 to allow execution of DEA cryptographic functions. The default
90 is on.
91
92 ``nvdimm=on|off``
93 Enables or disables NVDIMM support. The default is off.
94
Peter Maydelle2fcbf42020-03-06 10:07:14 +000095 ``memory-encryption=``
96 Memory encryption object to use. The default is none.
97
98 ``hmat=on|off``
99 Enables or disables ACPI Heterogeneous Memory Attribute Table
100 (HMAT) support. The default is off.
Igor Mammedov8db0b202021-01-21 11:15:04 -0500101
Peter Maydell95355822021-07-19 11:52:57 +0100102 ``memory-backend='id'``
Igor Mammedov8db0b202021-01-21 11:15:04 -0500103 An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options.
104 Allows to use a memory backend as main RAM.
105
106 For example:
107 ::
Peter Maydell95355822021-07-19 11:52:57 +0100108
109 -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on
110 -machine memory-backend=pc.ram
111 -m 512M
Igor Mammedov8db0b202021-01-21 11:15:04 -0500112
113 Migration compatibility note:
Peter Maydell95355822021-07-19 11:52:57 +0100114
115 * as backend id one shall use value of 'default-ram-id', advertised by
116 machine type (available via ``query-machines`` QMP command), if migration
117 to/from old QEMU (<5.0) is expected.
118 * for machine types 4.0 and older, user shall
119 use ``x-use-canonical-path-for-ramblock-id=off`` backend option
120 if migration to/from old QEMU (<5.0) is expected.
121
Igor Mammedov8db0b202021-01-21 11:15:04 -0500122 For example:
123 ::
Peter Maydell95355822021-07-19 11:52:57 +0100124
125 -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off
126 -machine memory-backend=pc.ram
127 -m 512M
Jonathan Cameron03b39fc2022-06-08 15:54:33 +0100128
129 ``cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]``
130 Define a CXL Fixed Memory Window (CFMW).
131
132 Described in the CXL 2.0 ECN: CEDT CFMWS & QTG _DSM.
133
134 They are regions of Host Physical Addresses (HPA) on a system which
135 may be interleaved across one or more CXL host bridges. The system
136 software will assign particular devices into these windows and
137 configure the downstream Host-managed Device Memory (HDM) decoders
138 in root ports, switch ports and devices appropriately to meet the
139 interleave requirements before enabling the memory devices.
140
141 ``targets.X=target`` provides the mapping to CXL host bridges
Stefan Weil2cb40d42022-11-10 20:08:25 +0100142 which may be identified by the id provided in the -device entry.
Jonathan Cameron03b39fc2022-06-08 15:54:33 +0100143 Multiple entries are needed to specify all the targets when
144 the fixed memory window represents interleaved memory. X is the
145 target index from 0.
146
147 ``size=size`` sets the size of the CFMW. This must be a multiple of
148 256MiB. The region will be aligned to 256MiB but the location is
149 platform and configuration dependent.
150
151 ``interleave-granularity=granularity`` sets the granularity of
152 interleave. Default 256KiB. Only 256KiB, 512KiB, 1024KiB, 2048KiB
153 4096KiB, 8192KiB and 16384KiB granularities supported.
154
155 Example:
156
157 ::
158
159 -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512k
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000160ERST
blueswir15824d652009-03-28 06:44:27 +0000161
Sean Christophersondfce81f2021-09-28 10:40:58 +0200162DEF("M", HAS_ARG, QEMU_OPTION_M,
Yang Zhong11058122021-11-01 12:20:05 -0400163 " sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n",
Sean Christophersondfce81f2021-09-28 10:40:58 +0200164 QEMU_ARCH_ALL)
165
166SRST
Yang Zhong11058122021-11-01 12:20:05 -0400167``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}``
Sean Christophersondfce81f2021-09-28 10:40:58 +0200168 Define an SGX EPC section.
169ERST
Jan Kiszka80f52a62011-07-23 12:39:46 +0200170
blueswir15824d652009-03-28 06:44:27 +0000171DEF("cpu", HAS_ARG, QEMU_OPTION_cpu,
Peter Maydell585f6032012-10-04 16:22:01 +0100172 "-cpu cpu select CPU ('-cpu help' for list)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000173SRST
174``-cpu model``
175 Select CPU model (``-cpu help`` for list and additional feature
176 selection)
177ERST
blueswir15824d652009-03-28 06:44:27 +0000178
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000179DEF("accel", HAS_ARG, QEMU_OPTION_accel,
Paolo Bonzinife174132019-11-13 15:16:44 +0100180 "-accel [accel=]accelerator[,prop[=value][,...]]\n"
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +0200181 " select accelerator (kvm, xen, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
Paolo Bonzini46472d82019-11-13 10:56:53 +0100182 " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
Paolo Bonzini11bc4a12019-11-13 10:56:53 +0100183 " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
Paolo Bonzini23b08982019-11-13 10:56:53 +0100184 " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
Peter Maydell3cfb0452023-04-17 17:40:32 +0100185 " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n"
Richard Hendersona35b3e12020-10-28 20:50:29 -0700186 " split-wx=on|off (enable TCG split w^x mapping)\n"
Paolo Bonzinife174132019-11-13 15:16:44 +0100187 " tb-size=n (TCG translation block cache size)\n"
Peter Xu2ea5cb02021-05-06 12:05:47 -0400188 " dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n"
Shameer Kolothumc8f2eb52023-09-05 10:12:46 +0100189 " eager-split-size=n (KVM Eager Page Split chunk size, default 0, disabled. ARM only)\n"
Chenyi Qiange2e69f62022-09-29 15:20:14 +0800190 " notify-vmexit=run|internal-error|disable,notify-window=n (enable notify VM exit and set notify window, x86 only)\n"
Eduardo Habkost0b3c5c82018-06-11 16:56:07 -0300191 " thread=single|multi (enable multi-threaded TCG)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000192SRST
193``-accel name[,prop=value[,...]]``
194 This is used to enable an accelerator. Depending on the target
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +0200195 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available. By
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000196 default, tcg is used. If there is more than one accelerator
197 specified, the next one is used if the previous one fails to
198 initialize.
199
200 ``igd-passthru=on|off``
201 When Xen is in use, this option controls whether Intel
202 integrated graphics devices can be passed through to the guest
203 (default=off)
204
205 ``kernel-irqchip=on|off|split``
206 Controls KVM in-kernel irqchip support. The default is full
207 acceleration of the interrupt controllers. On x86, split irqchip
208 reduces the kernel attack surface, at a performance cost for
209 non-MSI interrupts. Disabling the in-kernel irqchip completely
210 is not recommended except for debugging purposes.
211
212 ``kvm-shadow-mem=size``
213 Defines the size of the KVM shadow MMU.
214
Peter Maydell3cfb0452023-04-17 17:40:32 +0100215 ``one-insn-per-tb=on|off``
216 Makes the TCG accelerator put only one guest instruction into
217 each translation block. This slows down emulation a lot, but
218 can be useful in some situations, such as when trying to analyse
219 the logs produced by the ``-d`` option.
220
Richard Hendersona35b3e12020-10-28 20:50:29 -0700221 ``split-wx=on|off``
222 Controls the use of split w^x mapping for the TCG code generation
223 buffer. Some operating systems require this to be enabled, and in
224 such a case this will default on. On other operating systems, this
225 will default off, but one may enable this for testing or debugging.
226
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000227 ``tb-size=n``
228 Controls the size (in MiB) of the TCG translation block cache.
229
230 ``thread=single|multi``
231 Controls number of TCG threads. When the TCG is multi-threaded
Michael Tokarevcba42d62021-03-09 14:15:10 +0300232 there will be one thread per vCPU therefore taking advantage of
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000233 additional host cores. The default is to enable multi-threading
234 where both the back-end and front-ends support it and no
235 incompatible TCG features have been enabled (e.g.
236 icount/replay).
Peter Xu2ea5cb02021-05-06 12:05:47 -0400237
238 ``dirty-ring-size=n``
239 When the KVM accelerator is used, it controls the size of the per-vCPU
240 dirty page ring buffer (number of entries for each vCPU). It should
241 be a value that is power of two, and it should be 1024 or bigger (but
242 still less than the maximum value that the kernel supports). 4096
243 could be a good initial value if you have no idea which is the best.
244 Set this value to 0 to disable the feature. By default, this feature
245 is disabled (dirty-ring-size=0). When enabled, KVM will instead
246 record dirty pages in a bitmap.
247
Shameer Kolothumc8f2eb52023-09-05 10:12:46 +0100248 ``eager-split-size=n``
249 KVM implements dirty page logging at the PAGE_SIZE granularity and
250 enabling dirty-logging on a huge-page requires breaking it into
251 PAGE_SIZE pages in the first place. KVM on ARM does this splitting
252 lazily by default. There are performance benefits in doing huge-page
253 split eagerly, especially in situations where TLBI costs associated
254 with break-before-make sequences are considerable and also if guest
255 workloads are read intensive. The size here specifies how many pages
256 to break at a time and needs to be a valid block size which is
257 1GB/2MB/4KB, 32MB/16KB and 512MB/64KB for 4KB/16KB/64KB PAGE_SIZE
258 respectively. Be wary of specifying a higher size as it will have an
259 impact on the memory. By default, this feature is disabled
260 (eager-split-size=0).
261
Chenyi Qiange2e69f62022-09-29 15:20:14 +0800262 ``notify-vmexit=run|internal-error|disable,notify-window=n``
263 Enables or disables notify VM exit support on x86 host and specify
264 the corresponding notify window to trigger the VM exit if enabled.
265 ``run`` option enables the feature. It does nothing and continue
266 if the exit happens. ``internal-error`` option enables the feature.
267 It raises a internal error. ``disable`` option doesn't enable the feature.
268 This feature can mitigate the CPU stuck issue due to event windows don't
269 open up for a specified of time (i.e. notify-window).
270 Default: notify-vmexit=run,notify-window=0.
271
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000272ERST
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000273
blueswir15824d652009-03-28 06:44:27 +0000274DEF("smp", HAS_ARG, QEMU_OPTION_smp,
Yanan Wang864c3b52021-12-28 17:22:09 +0800275 "-smp [[cpus=]n][,maxcpus=maxcpus][,sockets=sockets][,dies=dies][,clusters=clusters][,cores=cores][,threads=threads]\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800276 " set the number of initial CPUs to 'n' [default=1]\n"
Daniel P. Berrangéce8ee7c2021-06-22 15:30:43 +0100277 " maxcpus= maximum number of total CPUs, including\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -0700278 " offline CPUs for hotplug, etc\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800279 " sockets= number of sockets on the machine board\n"
280 " dies= number of dies in one socket\n"
Yanan Wang864c3b52021-12-28 17:22:09 +0800281 " clusters= number of clusters in one die\n"
282 " cores= number of cores in one cluster\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800283 " threads= number of threads in one core\n"
284 "Note: Different machines may have different subsets of the CPU topology\n"
285 " parameters supported, so the actual meaning of the supported parameters\n"
286 " will vary accordingly. For example, for a machine type that supports a\n"
287 " three-level CPU hierarchy of sockets/cores/threads, the parameters will\n"
288 " sequentially mean as below:\n"
289 " sockets means the number of sockets on the machine board\n"
290 " cores means the number of cores in one socket\n"
291 " threads means the number of threads in one core\n"
292 " For a particular machine type board, an expected CPU topology hierarchy\n"
293 " can be defined through the supported sub-option. Unsupported parameters\n"
294 " can also be provided in addition to the sub-option, but their values\n"
295 " must be set as 1 in the purpose of correct parsing.\n",
296 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000297SRST
Yanan Wang864c3b52021-12-28 17:22:09 +0800298``-smp [[cpus=]n][,maxcpus=maxcpus][,sockets=sockets][,dies=dies][,clusters=clusters][,cores=cores][,threads=threads]``
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100299 Simulate a SMP system with '\ ``n``\ ' CPUs initially present on
300 the machine type board. On boards supporting CPU hotplug, the optional
301 '\ ``maxcpus``\ ' parameter can be set to enable further CPUs to be
Yanan Wang7d8c5a32021-09-29 10:58:05 +0800302 added at runtime. When both parameters are omitted, the maximum number
303 of CPUs will be calculated from the provided topology members and the
304 initial CPU count will match the maximum number. When only one of them
305 is given then the omitted one will be set to its counterpart's value.
306 Both parameters may be specified, but the maximum number of CPUs must
Yanan Wang0d871782021-12-28 17:22:08 +0800307 be equal to or greater than the initial CPU count. Product of the
308 CPU topology hierarchy must be equal to the maximum number of CPUs.
309 Both parameters are subject to an upper limit that is determined by
310 the specific machine type chosen.
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100311
Yanan Wang0d871782021-12-28 17:22:08 +0800312 To control reporting of CPU topology information, values of the topology
313 parameters can be specified. Machines may only support a subset of the
314 parameters and different machines may have different subsets supported
315 which vary depending on capacity of the corresponding CPU targets. So
316 for a particular machine type board, an expected topology hierarchy can
317 be defined through the supported sub-option. Unsupported parameters can
318 also be provided in addition to the sub-option, but their values must be
319 set as 1 in the purpose of correct parsing.
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100320
321 Either the initial CPU count, or at least one of the topology parameters
Yanan Wangc2511b12021-09-29 10:58:02 +0800322 must be specified. The specified parameters must be greater than zero,
323 explicit configuration like "cpus=0" is not allowed. Values for any
324 omitted parameters will be computed from those which are given.
Yanan Wang0d871782021-12-28 17:22:08 +0800325
326 For example, the following sub-option defines a CPU topology hierarchy
327 (2 sockets totally on the machine, 2 cores per socket, 2 threads per
328 core) for a machine that only supports sockets/cores/threads.
329 Some members of the option can be omitted but their values will be
330 automatically computed:
331
332 ::
333
334 -smp 8,sockets=2,cores=2,threads=2,maxcpus=8
335
336 The following sub-option defines a CPU topology hierarchy (2 sockets
337 totally on the machine, 2 dies per socket, 2 cores per die, 2 threads
338 per core) for PC machines which support sockets/dies/cores/threads.
339 Some members of the option can be omitted but their values will be
340 automatically computed:
341
342 ::
343
344 -smp 16,sockets=2,dies=2,cores=2,threads=2,maxcpus=16
345
Yanan Wangd55c3162022-01-07 16:32:27 +0800346 The following sub-option defines a CPU topology hierarchy (2 sockets
347 totally on the machine, 2 clusters per socket, 2 cores per cluster,
348 2 threads per core) for ARM virt machines which support sockets/clusters
349 /cores/threads. Some members of the option can be omitted but their values
350 will be automatically computed:
351
352 ::
353
354 -smp 16,sockets=2,clusters=2,cores=2,threads=2,maxcpus=16
355
Yanan Wangc2511b12021-09-29 10:58:02 +0800356 Historically preference was given to the coarsest topology parameters
357 when computing missing values (ie sockets preferred over cores, which
358 were preferred over threads), however, this behaviour is considered
Yanan Wang4a0af292021-09-29 10:58:09 +0800359 liable to change. Prior to 6.2 the preference was sockets over cores
360 over threads. Since 6.2 the preference is cores over sockets over threads.
Yanan Wang0d871782021-12-28 17:22:08 +0800361
362 For example, the following option defines a machine board with 2 sockets
363 of 1 core before 6.2 and 1 socket of 2 cores after 6.2:
364
365 ::
366
367 -smp 2
Yicong Yang97f4eff2022-12-29 14:55:09 +0800368
369 Note: The cluster topology will only be generated in ACPI and exposed
370 to guest if it's explicitly specified in -smp.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000371ERST
blueswir15824d652009-03-28 06:44:27 +0000372
aliguori268a3622009-04-21 22:30:27 +0000373DEF("numa", HAS_ARG, QEMU_OPTION_numa,
Tao Xu244b3f42019-12-13 09:19:22 +0800374 "-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
375 "-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
Igor Mammedov2d19c652017-11-28 15:53:58 +0100376 "-numa dist,src=source,dst=destination,val=distance\n"
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800377 "-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]\n"
Liu Jingqic412a482019-12-13 09:19:24 +0800378 "-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"
379 "-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 +0100380 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000381SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000382``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
383 \
384``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
385 \
386``-numa dist,src=source,dst=destination,val=distance``
387 \
388``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]``
389 \
Stefan Weil2cb40d42022-11-10 20:08:25 +0100390``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=type[,latency=lat][,bandwidth=bw]``
Peter Maydell09ce5f22020-02-28 15:36:13 +0000391 \
392``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000393 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA
394 distance from a source node to a destination node. Set the ACPI
395 Heterogeneous Memory Attributes for the given nodes.
396
397 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and
398 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a
399 contiguous range of CPU indexes (or a single VCPU if lastcpu is
400 omitted). A non-contiguous set of VCPUs can be represented by
401 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is
402 omitted on all nodes, VCPUs are automatically split between them.
403
404 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a
405 NUMA node:
406
407 ::
408
409 -numa node,cpus=0-2,cpus=5
410
411 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option
412 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to
413 assign CPU objects to a node using topology layout properties of
414 CPU. The set of properties is machine specific, and depends on used
415 machine type/'\ ``smp``\ ' options. It could be queried with
416 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ '
417 property specifies node to which CPU object will be assigned, it's
418 required for node to be declared with '\ ``node``\ ' option before
419 it's used with '\ ``cpu``\ ' option.
420
421 For example:
422
423 ::
424
425 -M pc \
426 -smp 1,sockets=2,maxcpus=2 \
427 -numa node,nodeid=0 -numa node,nodeid=1 \
428 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
429
Yohei Kojima4f513982023-04-24 10:22:45 +0100430 '\ ``memdev``\ ' option assigns RAM from a given memory backend
431 device to a node. It is recommended to use '\ ``memdev``\ ' option
432 over legacy '\ ``mem``\ ' option. This is because '\ ``memdev``\ '
433 option provides better performance and more control over the
434 backend's RAM (e.g. '\ ``prealloc``\ ' parameter of
435 '\ ``-memory-backend-ram``\ ' allows memory preallocation).
Igor Mammedov32a354d2020-06-09 09:56:35 -0400436
Yohei Kojima4f513982023-04-24 10:22:45 +0100437 For compatibility reasons, legacy '\ ``mem``\ ' option is
438 supported in 5.0 and older machine types. Note that '\ ``mem``\ '
439 and '\ ``memdev``\ ' are mutually exclusive. If one node uses
440 '\ ``memdev``\ ', the rest nodes have to use '\ ``memdev``\ '
441 option, and vice versa.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000442
Yohei Kojima4f513982023-04-24 10:22:45 +0100443 Users must specify memory for all NUMA nodes by '\ ``memdev``\ '
444 (or legacy '\ ``mem``\ ' if available). In QEMU 5.2, the support
445 for '\ ``-numa node``\ ' without memory specified was removed.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000446
447 '\ ``initiator``\ ' is an additional option that points to an
448 initiator NUMA node that has best performance (the lowest latency or
449 largest bandwidth) to this NUMA node. Note that this option can be
450 set only when the machine property 'hmat' is set to 'on'.
451
452 Following example creates a machine with 2 NUMA nodes, node 0 has
453 CPU. node 1 has only memory, and its initiator is node 0. Note that
454 because node 0 has CPU, by default the initiator of node 0 is itself
455 and must be itself.
456
457 ::
458
459 -machine hmat=on \
460 -m 2G,slots=2,maxmem=4G \
461 -object memory-backend-ram,size=1G,id=m0 \
462 -object memory-backend-ram,size=1G,id=m1 \
463 -numa node,nodeid=0,memdev=m0 \
464 -numa node,nodeid=1,memdev=m1,initiator=0 \
465 -smp 2,sockets=2,maxcpus=2 \
466 -numa cpu,node-id=0,socket-id=0 \
467 -numa cpu,node-id=0,socket-id=1
468
469 source and destination are NUMA node IDs. distance is the NUMA
470 distance from source to destination. The distance from a node to
471 itself is always 10. If any pair of nodes is given a distance, then
472 all pairs must be given distances. Although, when distances are only
473 given in one direction for each pair of nodes, then the distances in
474 the opposite directions are assumed to be the same. If, however, an
475 asymmetrical pair of distances is given for even one node pair, then
476 all node pairs must be provided distance values for both directions,
477 even when they are symmetrical. When a node is unreachable from
478 another node, set the pair's distance to 255.
479
480 Note that the -``numa`` option doesn't allocate any of the specified
481 resources, it just assigns existing resources to NUMA nodes. This
482 means that one still has to use the ``-m``, ``-smp`` options to
483 allocate RAM and VCPUs respectively.
484
485 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth
486 Information between initiator and target NUMA nodes in ACPI
487 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can
488 create memory requests, usually it has one or more processors.
489 Target NUMA node contains addressable memory.
490
491 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is
492 the memory hierarchy of the target NUMA node: if hierarchy is
493 'memory', the structure represents the memory performance; if
494 hierarchy is 'first-level\|second-level\|third-level', this
495 structure represents aggregated performance of memory side caches
496 for each domain. type of 'data-type' is type of data represented by
497 this structure instance: if 'hierarchy' is 'memory', 'data-type' is
498 'access\|read\|write' latency or 'access\|read\|write' bandwidth of
499 the target memory; if 'hierarchy' is
500 'first-level\|second-level\|third-level', 'data-type' is
501 'access\|read\|write' hit latency or 'access\|read\|write' hit
502 bandwidth of the target memory side cache.
503
504 lat is latency value in nanoseconds. bw is bandwidth value, the
505 possible value and units are NUM[M\|G\|T], mean that the bandwidth
506 value are NUM byte per second (or MB/s, GB/s or TB/s depending on
507 used suffix). Note that if latency or bandwidth value is 0, means
508 the corresponding latency or bandwidth information is not provided.
509
510 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory
511 belongs. size is the size of memory side cache in bytes. level is
512 the cache level described in this structure, note that the cache
513 level 0 should not be used with '\ ``hmat-cache``\ ' option.
514 associativity is the cache associativity, the possible value is
515 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy
516 is the write policy. line is the cache Line size in bytes.
517
518 For example, the following options describe 2 NUMA nodes. Node 0 has
519 2 cpus and a ram, node 1 has only a ram. The processors in node 0
520 access memory in node 0 with access-latency 5 nanoseconds,
521 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access
522 memory in NUMA node 1 with access-latency 10 nanoseconds,
523 access-bandwidth is 100 MB/s. And for memory side cache information,
524 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB,
525 policy is write-back, the cache Line size is 8 bytes:
526
527 ::
528
529 -machine hmat=on \
530 -m 2G \
531 -object memory-backend-ram,size=1G,id=m0 \
532 -object memory-backend-ram,size=1G,id=m1 \
Yanan Wang848dd262021-09-28 20:11:34 +0800533 -smp 2,sockets=2,maxcpus=2 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000534 -numa node,nodeid=0,memdev=m0 \
535 -numa node,nodeid=1,memdev=m1,initiator=0 \
536 -numa cpu,node-id=0,socket-id=0 \
537 -numa cpu,node-id=0,socket-id=1 \
538 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
539 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
540 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
541 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
542 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
543 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
544ERST
aliguori268a3622009-04-21 22:30:27 +0000545
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100546DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd,
547 "-add-fd fd=fd,set=set[,opaque=opaque]\n"
548 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000549SRST
550``-add-fd fd=fd,set=set[,opaque=opaque]``
551 Add a file descriptor to an fd set. Valid options are:
552
553 ``fd=fd``
554 This option defines the file descriptor of which a duplicate is
555 added to fd set. The file descriptor cannot be stdin, stdout, or
556 stderr.
557
558 ``set=set``
559 This option defines the ID of the fd set to add the file
560 descriptor to.
561
562 ``opaque=opaque``
563 This option defines a free-form string that can be used to
564 describe fd.
565
566 You can open an image using pre-opened file descriptors from an fd
567 set:
568
569 .. parsed-literal::
570
Laszlo Ersek353a06b2020-09-08 19:21:11 +0200571 |qemu_system| \\
572 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\
573 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000574 -drive file=/dev/fdset/2,index=0,media=disk
575ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100576
577DEF("set", HAS_ARG, QEMU_OPTION_set,
578 "-set group.id.arg=value\n"
579 " set <arg> parameter for item <id> of type <group>\n"
580 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000581SRST
582``-set group.id.arg=value``
583 Set parameter arg for item id of type group
584ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100585
586DEF("global", HAS_ARG, QEMU_OPTION_global,
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200587 "-global driver.property=value\n"
588 "-global driver=driver,property=property,value=value\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100589 " set a global default for a driver property\n",
590 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000591SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000592``-global driver.prop=value``
593 \
594``-global driver=driver,property=property,value=value``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000595 Set default value of driver's property prop to value, e.g.:
596
597 .. parsed-literal::
598
599 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img
600
601 In particular, you can use this to set driver properties for devices
602 which are created automatically by the machine model. To create a
603 device which is not created automatically and set properties on it,
604 use -``device``.
605
606 -global driver.prop=value is shorthand for -global
607 driver=driver,property=prop,value=value. The longhand syntax works
608 even when driver contains a dot.
609ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100610
611DEF("boot", HAS_ARG, QEMU_OPTION_boot,
612 "-boot [order=drives][,once=drives][,menu=on|off]\n"
Amos Kongc8a6ae82013-03-19 14:23:27 +0800613 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100614 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n"
615 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n"
616 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n"
617 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n",
618 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000619SRST
620``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]``
621 Specify boot order drives as a string of drive letters. Valid drive
622 letters depend on the target architecture. The x86 PC uses: a, b
623 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p
624 (Etherboot from network adapter 1-4), hard disk boot is the default.
625 To apply a particular boot order only on the first startup, specify
626 it via ``once``. Note that the ``order`` or ``once`` parameter
627 should not be used together with the ``bootindex`` property of
628 devices, since the firmware implementations normally do not support
629 both at the same time.
630
631 Interactive boot menus/prompts can be enabled via ``menu=on`` as far
632 as firmware/BIOS supports them. The default is non-interactive boot.
633
634 A splash picture could be passed to bios, enabling user to show it
635 as logo, when option splash=sp\_name is given and menu=on, If
636 firmware/BIOS supports them. Currently Seabios for X86 system
637 support it. limitation: The splash file could be a jpeg file or a
638 BMP file in 24 BPP format(true color). The resolution should be
639 supported by the SVGA mode, so the recommended is 320x240, 640x480,
640 800x640.
641
642 A timeout could be passed to bios, guest will pause for rb\_timeout
643 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will
644 not reboot, qemu passes '-1' to bios by default. Currently Seabios
645 for X86 system support it.
646
647 Do strict boot via ``strict=on`` as far as firmware/BIOS supports
648 it. This only effects when boot priority is changed by bootindex
649 options. The default is non-strict boot.
650
Peter Maydell09ce5f22020-02-28 15:36:13 +0000651 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000652
653 # try to boot from network first, then from hard disk
654 |qemu_system_x86| -boot order=nc
655 # boot from CD-ROM first, switch back to default order after reboot
656 |qemu_system_x86| -boot once=d
657 # boot with a splash picture for 5 seconds.
658 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000
659
660 Note: The legacy format '-boot drives' is still supported but its
661 use is discouraged as it may be removed from future versions.
662ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100663
664DEF("m", HAS_ARG, QEMU_OPTION_m,
Michael Tokarev89f3ea22016-11-10 17:51:32 +0300665 "-m [size=]megs[,slots=n,maxmem=size]\n"
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100666 " configure guest RAM\n"
Alexander Graf0daba1f2015-06-05 11:05:03 +0200667 " size: initial amount of guest memory\n"
Igor Mammedovc270fb92014-06-02 15:25:02 +0200668 " slots: number of hotplug slots (default: none)\n"
Matthew Rosatob6fe0122014-08-28 11:25:33 -0400669 " maxmem: maximum amount of guest memory (default: none)\n"
Thomas Hutha635bcf2023-07-03 09:56:46 +0200670 " Note: Some architectures might enforce a specific granularity\n",
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100671 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000672SRST
673``-m [size=]megs[,slots=n,maxmem=size]``
674 Sets guest startup RAM size to megs megabytes. Default is 128 MiB.
675 Optionally, a suffix of "M" or "G" can be used to signify a value in
676 megabytes or gigabytes respectively. Optional pair slots, maxmem
677 could be used to set amount of hotpluggable memory slots and maximum
678 amount of memory. Note that maxmem must be aligned to the page size.
679
680 For example, the following command-line sets the guest startup RAM
681 size to 1GB, creates 3 slots to hotplug additional memory and sets
682 the maximum memory the guest can reach to 4GB:
683
684 .. parsed-literal::
685
686 |qemu_system| -m 1G,slots=3,maxmem=4G
687
688 If slots and maxmem are not specified, memory hotplug won't be
689 enabled and the guest startup RAM will never increase.
690ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100691
692DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
693 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000694SRST
695``-mem-path path``
696 Allocate guest RAM from a temporarily created file in path.
697ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100698
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100699DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
700 "-mem-prealloc preallocate guest memory (use with -mem-path)\n",
701 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000702SRST
703``-mem-prealloc``
704 Preallocate memory when using -mem-path.
705ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100706
707DEF("k", HAS_ARG, QEMU_OPTION_k,
708 "-k language use keyboard layout (for example 'fr' for French)\n",
709 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000710SRST
711``-k language``
712 Use keyboard layout language (for example ``fr`` for French). This
713 option is only needed where it is not easy to get raw PC keycodes
714 (e.g. on Macs, with some X11 servers or with a VNC or curses
715 display). You don't normally need to use it on PC/Linux or
716 PC/Windows hosts.
717
718 The available layouts are:
719
720 ::
721
722 ar de-ch es fo fr-ca hu ja mk no pt-br sv
723 da en-gb et fr fr-ch is lt nl pl ru th
724 de en-us fi fr-be hr it lv nl-be pt sl tr
725
726 The default is ``en-us``.
727ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100728
729
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100730HXCOMM Deprecated by -audiodev
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100731DEF("audio-help", 0, QEMU_OPTION_audio_help,
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100732 "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100733 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000734SRST
735``-audio-help``
736 Will show the -audiodev equivalent of the currently specified
737 (deprecated) environment variables.
738ERST
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100739
Paolo Bonzini039a6832022-04-27 12:27:46 +0200740DEF("audio", HAS_ARG, QEMU_OPTION_audio,
741 "-audio [driver=]driver,model=value[,prop[=value][,...]]\n"
742 " specifies the audio backend and device to use;\n"
743 " apart from 'model', options are the same as for -audiodev.\n"
744 " use '-audio model=help' to show possible devices.\n",
745 QEMU_ARCH_ALL)
746SRST
747``-audio [driver=]driver,model=value[,prop[=value][,...]]``
748 This option is a shortcut for configuring both the guest audio
749 hardware and the host audio backend in one go.
Claudio Fontana5e03b6d2022-09-08 10:14:41 +0200750 The driver option is the same as with the corresponding ``-audiodev`` option below.
751 The guest hardware model can be set with ``model=modelname``.
752
753 Use ``driver=help`` to list the available drivers,
754 and ``model=help`` to list the available device types.
Paolo Bonzini039a6832022-04-27 12:27:46 +0200755
756 The following two example do exactly the same, to show how ``-audio``
757 can be used to shorten the command line length:
758
759 .. parsed-literal::
760
761 |qemu_system| -audiodev pa,id=pa -device sb16,audiodev=pa
762 |qemu_system| -audio pa,model=sb16
763ERST
764
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100765DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
766 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
767 " specifies the audio backend to use\n"
Claudio Fontana5e03b6d2022-09-08 10:14:41 +0200768 " Use ``-audiodev help`` to list the available drivers\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100769 " id= identifier of the backend\n"
770 " timer-period= timer period in microseconds\n"
Kővágó, Zoltán8efac072019-10-13 21:57:58 +0200771 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100772 " in|out.fixed-settings= use fixed settings for host audio\n"
773 " in|out.frequency= frequency to use with fixed settings\n"
774 " in|out.channels= number of channels to use with fixed settings\n"
775 " in|out.format= sample format to use with fixed settings\n"
Volker Rümelin49f77e62020-03-08 20:33:21 +0100776 " valid values: s8, s16, s32, u8, u16, u32, f32\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100777 " in|out.voices= number of voices to use\n"
Stefan Hajnoczi86247252019-09-18 10:53:33 +0100778 " in|out.buffer-length= length of buffer in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100779 "-audiodev none,id=id,[,prop[=value][,...]]\n"
780 " dummy driver that discards all output\n"
781#ifdef CONFIG_AUDIO_ALSA
782 "-audiodev alsa,id=id[,prop[=value][,...]]\n"
783 " in|out.dev= name of the audio device to use\n"
Stefan Hajnoczidfc54342019-09-18 10:53:35 +0100784 " in|out.period-length= length of period in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100785 " in|out.try-poll= attempt to use poll mode\n"
786 " threshold= threshold (in microseconds) when playback starts\n"
787#endif
788#ifdef CONFIG_AUDIO_COREAUDIO
789 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
790 " in|out.buffer-count= number of buffers\n"
791#endif
792#ifdef CONFIG_AUDIO_DSOUND
793 "-audiodev dsound,id=id[,prop[=value][,...]]\n"
794 " latency= add extra latency to playback in microseconds\n"
795#endif
796#ifdef CONFIG_AUDIO_OSS
797 "-audiodev oss,id=id[,prop[=value][,...]]\n"
798 " in|out.dev= path of the audio device to use\n"
799 " in|out.buffer-count= number of buffers\n"
800 " in|out.try-poll= attempt to use poll mode\n"
801 " try-mmap= try using memory mapped access\n"
802 " exclusive= open device in exclusive mode\n"
803 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
804#endif
805#ifdef CONFIG_AUDIO_PA
806 "-audiodev pa,id=id[,prop[=value][,...]]\n"
807 " server= PulseAudio server address\n"
808 " in|out.name= source/sink device name\n"
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +0100809 " in|out.latency= desired latency in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100810#endif
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200811#ifdef CONFIG_AUDIO_PIPEWIRE
812 "-audiodev pipewire,id=id[,prop[=value][,...]]\n"
813 " in|out.name= source/sink device name\n"
814 " in|out.stream-name= name of pipewire stream\n"
815 " in|out.latency= desired latency in microseconds\n"
816#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100817#ifdef CONFIG_AUDIO_SDL
818 "-audiodev sdl,id=id[,prop[=value][,...]]\n"
Volker Rümelin5a0926c2021-01-10 11:02:19 +0100819 " in|out.buffer-count= number of buffers\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100820#endif
Alexandre Ratchov663df1c2022-09-07 15:23:42 +0200821#ifdef CONFIG_AUDIO_SNDIO
822 "-audiodev sndio,id=id[,prop[=value][,...]]\n"
823#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100824#ifdef CONFIG_SPICE
825 "-audiodev spice,id=id[,prop[=value][,...]]\n"
826#endif
Marc-André Lureau739362d2021-03-09 17:15:28 +0400827#ifdef CONFIG_DBUS_DISPLAY
828 "-audiodev dbus,id=id[,prop[=value][,...]]\n"
829#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100830 "-audiodev wav,id=id[,prop[=value][,...]]\n"
831 " path= path of wav file to record\n",
832 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000833SRST
834``-audiodev [driver=]driver,id=id[,prop[=value][,...]]``
835 Adds a new audio backend driver identified by id. There are global
836 and driver specific properties. Some values can be set differently
837 for input and output, they're marked with ``in|out.``. You can set
838 the input's property with ``in.prop`` and the output's property with
839 ``out.prop``. For example:
840
841 ::
842
843 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
844 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
845
846 NOTE: parameter validation is known to be incomplete, in many cases
847 specifying an invalid option causes QEMU to print an error message
848 and continue emulation without sound.
849
850 Valid global options are:
851
852 ``id=identifier``
853 Identifies the audio backend.
854
855 ``timer-period=period``
856 Sets the timer period used by the audio subsystem in
857 microseconds. Default is 10000 (10 ms).
858
859 ``in|out.mixing-engine=on|off``
860 Use QEMU's mixing engine to mix all streams inside QEMU and
861 convert audio formats when not supported by the backend. When
862 off, fixed-settings must be off too. Note that disabling this
863 option means that the selected backend must support multiple
864 streams and the audio formats used by the virtual cards,
865 otherwise you'll get no sound. It's not recommended to disable
866 this option unless you want to use 5.1 or 7.1 audio, as mixing
867 engine only supports mono and stereo audio. Default is on.
868
869 ``in|out.fixed-settings=on|off``
870 Use fixed settings for host audio. When off, it will change
871 based on how the guest opens the sound card. In this case you
872 must not specify frequency, channels or format. Default is on.
873
874 ``in|out.frequency=frequency``
875 Specify the frequency to use when using fixed-settings. Default
876 is 44100Hz.
877
878 ``in|out.channels=channels``
879 Specify the number of channels to use when using fixed-settings.
880 Default is 2 (stereo).
881
882 ``in|out.format=format``
883 Specify the sample format to use when using fixed-settings.
884 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``,
Volker Rümelin49f77e62020-03-08 20:33:21 +0100885 ``u32``, ``f32``. Default is ``s16``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000886
887 ``in|out.voices=voices``
888 Specify the number of voices to use. Default is 1.
889
890 ``in|out.buffer-length=usecs``
891 Sets the size of the buffer in microseconds.
892
893``-audiodev none,id=id[,prop[=value][,...]]``
894 Creates a dummy backend that discards all outputs. This backend has
895 no backend specific properties.
896
897``-audiodev alsa,id=id[,prop[=value][,...]]``
898 Creates backend using the ALSA. This backend is only available on
899 Linux.
900
901 ALSA specific options are:
902
903 ``in|out.dev=device``
904 Specify the ALSA device to use for input and/or output. Default
905 is ``default``.
906
907 ``in|out.period-length=usecs``
908 Sets the period length in microseconds.
909
910 ``in|out.try-poll=on|off``
911 Attempt to use poll mode with the device. Default is on.
912
913 ``threshold=threshold``
914 Threshold (in microseconds) when playback starts. Default is 0.
915
916``-audiodev coreaudio,id=id[,prop[=value][,...]]``
917 Creates a backend using Apple's Core Audio. This backend is only
918 available on Mac OS and only supports playback.
919
920 Core Audio specific options are:
921
922 ``in|out.buffer-count=count``
923 Sets the count of the buffers.
924
925``-audiodev dsound,id=id[,prop[=value][,...]]``
926 Creates a backend using Microsoft's DirectSound. This backend is
927 only available on Windows and only supports playback.
928
929 DirectSound specific options are:
930
931 ``latency=usecs``
932 Add extra usecs microseconds latency to playback. Default is
933 10000 (10 ms).
934
935``-audiodev oss,id=id[,prop[=value][,...]]``
936 Creates a backend using OSS. This backend is available on most
937 Unix-like systems.
938
939 OSS specific options are:
940
941 ``in|out.dev=device``
942 Specify the file name of the OSS device to use. Default is
943 ``/dev/dsp``.
944
945 ``in|out.buffer-count=count``
946 Sets the count of the buffers.
947
948 ``in|out.try-poll=on|of``
949 Attempt to use poll mode with the device. Default is on.
950
951 ``try-mmap=on|off``
952 Try using memory mapped device access. Default is off.
953
954 ``exclusive=on|off``
955 Open the device in exclusive mode (vmix won't work in this
956 case). Default is off.
957
958 ``dsp-policy=policy``
959 Sets the timing policy (between 0 and 10, where smaller number
960 means smaller latency but higher CPU usage). Use -1 to use
961 buffer sizes specified by ``buffer`` and ``buffer-count``. This
962 option is ignored if you do not have OSS 4. Default is 5.
963
964``-audiodev pa,id=id[,prop[=value][,...]]``
965 Creates a backend using PulseAudio. This backend is available on
966 most systems.
967
968 PulseAudio specific options are:
969
970 ``server=server``
971 Sets the PulseAudio server to connect to.
972
973 ``in|out.name=sink``
974 Use the specified source/sink for recording/playback.
975
976 ``in|out.latency=usecs``
977 Desired latency in microseconds. The PulseAudio server will try
978 to honor this value but actual latencies may be lower or higher.
979
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200980``-audiodev pipewire,id=id[,prop[=value][,...]]``
Marc-André Lureau20c51242023-05-06 20:37:26 +0400981 Creates a backend using PipeWire. This backend is available on
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200982 most systems.
983
Marc-André Lureau20c51242023-05-06 20:37:26 +0400984 PipeWire specific options are:
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200985
986 ``in|out.latency=usecs``
987 Desired latency in microseconds.
988
989 ``in|out.name=sink``
990 Use the specified source/sink for recording/playback.
991
992 ``in|out.stream-name``
993 Specify the name of pipewire stream.
994
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000995``-audiodev sdl,id=id[,prop[=value][,...]]``
996 Creates a backend using SDL. This backend is available on most
997 systems, but you should use your platform's native backend if
Volker Rümelin5a0926c2021-01-10 11:02:19 +0100998 possible.
999
1000 SDL specific options are:
1001
1002 ``in|out.buffer-count=count``
1003 Sets the count of the buffers.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001004
Alexandre Ratchov663df1c2022-09-07 15:23:42 +02001005``-audiodev sndio,id=id[,prop[=value][,...]]``
1006 Creates a backend using SNDIO. This backend is available on
1007 OpenBSD and most other Unix-like systems.
1008
1009 Sndio specific options are:
1010
1011 ``in|out.dev=device``
1012 Specify the sndio device to use for input and/or output. Default
1013 is ``default``.
1014
1015 ``in|out.latency=usecs``
1016 Sets the desired period length in microseconds.
1017
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001018``-audiodev spice,id=id[,prop[=value][,...]]``
1019 Creates a backend that sends audio through SPICE. This backend
1020 requires ``-spice`` and automatically selected in that case, so
1021 usually you can ignore this option. This backend has no backend
1022 specific properties.
1023
1024``-audiodev wav,id=id[,prop[=value][,...]]``
1025 Creates a backend that writes audio to a WAV file.
1026
1027 Backend specific options are:
1028
1029 ``path=path``
1030 Write recorded audio into the specified file. Default is
1031 ``qemu.wav``.
1032ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001033
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001034DEF("device", HAS_ARG, QEMU_OPTION_device,
1035 "-device driver[,prop[=value][,...]]\n"
1036 " add device (based on driver)\n"
1037 " prop=value,... sets driver properties\n"
1038 " use '-device help' to print all possible drivers\n"
1039 " use '-device driver,help' to print all possible properties\n",
1040 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001041SRST
1042``-device driver[,prop[=value][,...]]``
1043 Add device driver. prop=value sets driver properties. Valid
1044 properties depend on the driver. To get help on possible drivers and
1045 properties, use ``-device help`` and ``-device driver,help``.
1046
1047 Some drivers are:
1048
Corey Minyard789101b2020-07-17 11:37:02 -05001049``-device ipmi-bmc-sim,id=id[,prop[=value][,...]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001050 Add an IPMI BMC. This is a simulation of a hardware management
1051 interface processor that normally sits on a system. It provides a
1052 watchdog and the ability to reset and power control the system. You
1053 need to connect this to an IPMI interface to make it useful
1054
1055 The IPMI slave address to use for the BMC. The default is 0x20. This
1056 address is the BMC's address on the I2C network of management
1057 controllers. If you don't know what this means, it is safe to ignore
1058 it.
1059
1060 ``id=id``
1061 The BMC id for interfaces to use this device.
1062
1063 ``slave_addr=val``
1064 Define slave address to use for the BMC. The default is 0x20.
1065
1066 ``sdrfile=file``
1067 file containing raw Sensor Data Records (SDR) data. The default
1068 is none.
1069
1070 ``fruareasize=val``
1071 size of a Field Replaceable Unit (FRU) area. The default is
1072 1024.
1073
1074 ``frudatafile=file``
1075 file containing raw Field Replaceable Unit (FRU) inventory data.
1076 The default is none.
1077
1078 ``guid=uuid``
1079 value for the GUID for the BMC, in standard UUID format. If this
1080 is set, get "Get GUID" command to the BMC will return it.
1081 Otherwise "Get GUID" will return an error.
1082
1083``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]``
1084 Add a connection to an external IPMI BMC simulator. Instead of
1085 locally emulating the BMC like the above item, instead connect to an
1086 external entity that provides the IPMI services.
1087
1088 A connection is made to an external BMC simulator. If you do this,
1089 it is strongly recommended that you use the "reconnect=" chardev
1090 option to reconnect to the simulator if the connection is lost. Note
1091 that if this is not used carefully, it can be a security issue, as
1092 the interface has the ability to send resets, NMIs, and power off
1093 the VM. It's best if QEMU makes a connection to an external
1094 simulator running on a secure port on localhost, so neither the
1095 simulator nor QEMU is exposed to any outside network.
1096
1097 See the "lanserv/README.vm" file in the OpenIPMI library for more
1098 details on the external interface.
1099
1100``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]``
Stefan Weil1e458f12022-10-30 11:59:44 +01001101 Add a KCS IPMI interface on the ISA bus. This also adds a
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001102 corresponding ACPI and SMBIOS entries, if appropriate.
1103
1104 ``bmc=id``
1105 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern
1106 above.
1107
1108 ``ioport=val``
1109 Define the I/O address of the interface. The default is 0xca0
1110 for KCS.
1111
1112 ``irq=val``
1113 Define the interrupt to use. The default is 5. To disable
1114 interrupts, set this to 0.
1115
1116``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]``
1117 Like the KCS interface, but defines a BT interface. The default port
1118 is 0xe4 and the default interrupt is 5.
Corey Minyard323679d2019-09-23 13:50:33 -05001119
1120``-device pci-ipmi-kcs,bmc=id``
Stefan Weil1e458f12022-10-30 11:59:44 +01001121 Add a KCS IPMI interface on the PCI bus.
Corey Minyard323679d2019-09-23 13:50:33 -05001122
1123 ``bmc=id``
1124 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above.
1125
1126``-device pci-ipmi-bt,bmc=id``
1127 Like the KCS interface, but defines a BT interface on the PCI bus.
Peter Xu7395b3e2021-07-07 11:41:14 -04001128
1129``-device intel-iommu[,option=...]``
1130 This is only supported by ``-machine q35``, which will enable Intel VT-d
1131 emulation within the guest. It supports below options:
1132
1133 ``intremap=on|off`` (default: auto)
1134 This enables interrupt remapping feature. It's required to enable
1135 complete x2apic. Currently it only supports kvm kernel-irqchip modes
1136 ``off`` or ``split``, while full kernel-irqchip is not yet supported.
1137 The default value is "auto", which will be decided by the mode of
1138 kernel-irqchip.
1139
1140 ``caching-mode=on|off`` (default: off)
1141 This enables caching mode for the VT-d emulated device. When
1142 caching-mode is enabled, each guest DMA buffer mapping will generate an
1143 IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
1144 a synchronous way. It is required for ``-device vfio-pci`` to work
1145 with the VT-d device, because host assigned devices requires to setup
1146 the DMA mapping on the host before guest DMA starts.
1147
1148 ``device-iotlb=on|off`` (default: off)
1149 This enables device-iotlb capability for the emulated VT-d device. So
1150 far virtio/vhost should be the only real user for this parameter,
1151 paired with ats=on configured for the device.
1152
1153 ``aw-bits=39|48`` (default: 39)
1154 This decides the address width of IOVA address space. The address
1155 space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
1156 4-level IOMMU page tables.
1157
1158 Please also refer to the wiki page for general scenarios of VT-d
1159 emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
1160
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001161ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001162
1163DEF("name", HAS_ARG, QEMU_OPTION_name,
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001164 "-name string1[,process=string2][,debug-threads=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001165 " set the name of the guest\n"
Roman Bolshakov479a5742018-12-17 23:26:01 +03001166 " string1 sets the window title and string2 the process name\n"
1167 " When debug-threads is enabled, individual threads are given a separate name\n"
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001168 " NOTE: The thread names are for debugging and not a stable API.\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001169 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001170SRST
1171``-name name``
1172 Sets the name of the guest. This name will be displayed in the SDL
1173 window caption. The name will also be used for the VNC server. Also
1174 optionally set the top visible process name in Linux. Naming of
1175 individual threads can also be enabled on Linux to aid debugging.
1176ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001177
1178DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
1179 "-uuid %08x-%04x-%04x-%04x-%012x\n"
1180 " specify machine UUID\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001181SRST
1182``-uuid uuid``
1183 Set system UUID.
1184ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001185
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001186DEFHEADING()
1187
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02001188DEFHEADING(Block device options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001189
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001190SRST
1191The QEMU block device handling options have a long history and
1192have gone through several iterations as the feature set and complexity
1193of the block layer have grown. Many online guides to QEMU often
1194reference older and deprecated options, which can lead to confusion.
1195
Alex Bennéec1654c32023-04-24 10:22:37 +01001196The most explicit way to describe disks is to use a combination of
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001197``-device`` to specify the hardware device and ``-blockdev`` to
1198describe the backend. The device defines what the guest sees and the
Alex Bennéec1654c32023-04-24 10:22:37 +01001199backend describes how QEMU handles the data. It is the only guaranteed
1200stable interface for describing block devices and as such is
1201recommended for management tools and scripting.
1202
1203The ``-drive`` option combines the device and backend into a single
1204command line option which is a more human friendly. There is however no
1205interface stability guarantee although some older board models still
1206need updating to work with the modern blockdev forms.
1207
1208Older options like ``-hda`` are essentially macros which expand into
1209``-drive`` options for various drive interfaces. The original forms
1210bake in a lot of assumptions from the days when QEMU was emulating a
1211legacy PC, they are not recommended for modern configurations.
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001212
1213ERST
1214
blueswir15824d652009-03-28 06:44:27 +00001215DEF("fda", HAS_ARG, QEMU_OPTION_fda,
Blue Swirlad960902010-03-29 19:23:52 +00001216 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
1217DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001218SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001219``-fda file``
1220 \
1221``-fdb file``
Thomas Huth923e9312020-11-16 15:47:36 +01001222 Use file as floppy disk 0/1 image (see the :ref:`disk images` chapter in
1223 the System Emulation Users Guide).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001224ERST
blueswir15824d652009-03-28 06:44:27 +00001225
1226DEF("hda", HAS_ARG, QEMU_OPTION_hda,
Blue Swirlad960902010-03-29 19:23:52 +00001227 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
1228DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001229DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
Blue Swirlad960902010-03-29 19:23:52 +00001230 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
1231DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001232SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001233``-hda file``
1234 \
1235``-hdb file``
1236 \
1237``-hdc file``
1238 \
1239``-hdd file``
Thomas Huth923e9312020-11-16 15:47:36 +01001240 Use file as hard disk 0, 1, 2 or 3 image (see the :ref:`disk images`
1241 chapter in the System Emulation Users Guide).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001242ERST
blueswir15824d652009-03-28 06:44:27 +00001243
1244DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
Blue Swirlad960902010-03-29 19:23:52 +00001245 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
1246 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001247SRST
1248``-cdrom file``
1249 Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
1250 the same time). You can use the host CD-ROM by using ``/dev/cdrom``
1251 as filename.
1252ERST
blueswir15824d652009-03-28 06:44:27 +00001253
Markus Armbruster42e5f392017-02-28 22:27:07 +01001254DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
1255 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n"
1256 " [,cache.direct=on|off][,cache.no-flush=on|off]\n"
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001257 " [,read-only=on|off][,auto-read-only=on|off]\n"
1258 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
Markus Armbruster42e5f392017-02-28 22:27:07 +01001259 " [,driver specific parameters...]\n"
1260 " configure a block backend\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001261SRST
1262``-blockdev option[,option[,option[,...]]]``
1263 Define a new block driver node. Some of the options apply to all
1264 block drivers, other options are only accepted for a specific block
1265 driver. See below for a list of generic options and options for the
1266 most common block drivers.
1267
1268 Options that expect a reference to another node (e.g. ``file``) can
1269 be given in two ways. Either you specify the node name of an already
1270 existing node (file=node-name), or you define a new node inline,
1271 adding options for the referenced node after a dot
1272 (file.filename=path,file.aio=native).
1273
1274 A block driver node created with ``-blockdev`` can be used for a
1275 guest device by specifying its node name for the ``drive`` property
1276 in a ``-device`` argument that defines a block device.
1277
1278 ``Valid options for any block driver node:``
1279 ``driver``
1280 Specifies the block driver to use for the given node.
1281
1282 ``node-name``
1283 This defines the name of the block driver node by which it
1284 will be referenced later. The name must be unique, i.e. it
1285 must not match the name of a different block driver node, or
1286 (if you use ``-drive`` as well) the ID of a drive.
1287
1288 If no node name is specified, it is automatically generated.
1289 The generated node name is not intended to be predictable
1290 and changes between QEMU invocations. For the top level, an
1291 explicit node name must be specified.
1292
1293 ``read-only``
1294 Open the node read-only. Guest write attempts will fail.
1295
1296 Note that some block drivers support only read-only access,
1297 either generally or in certain configurations. In this case,
1298 the default value ``read-only=off`` does not work and the
1299 option must be specified explicitly.
1300
1301 ``auto-read-only``
1302 If ``auto-read-only=on`` is set, QEMU may fall back to
1303 read-only usage even when ``read-only=off`` is requested, or
1304 even switch between modes as needed, e.g. depending on
1305 whether the image file is writable or whether a writing user
1306 is attached to the node.
1307
1308 ``force-share``
1309 Override the image locking system of QEMU by forcing the
1310 node to utilize weaker shared access for permissions where
1311 it would normally request exclusive access. When there is
1312 the potential for multiple instances to have the same file
1313 open (whether this invocation of QEMU is the first or the
1314 second instance), both instances must permit shared access
1315 for the second instance to succeed at opening the file.
1316
1317 Enabling ``force-share=on`` requires ``read-only=on``.
1318
1319 ``cache.direct``
1320 The host page cache can be avoided with ``cache.direct=on``.
1321 This will attempt to do disk IO directly to the guest's
1322 memory. QEMU may still perform an internal copy of the data.
1323
1324 ``cache.no-flush``
1325 In case you don't care about data integrity over host
1326 failures, you can use ``cache.no-flush=on``. This option
1327 tells QEMU that it never needs to write any data to the disk
1328 but can instead keep things in cache. If anything goes
1329 wrong, like your host losing power, the disk storage getting
1330 disconnected accidentally, etc. your image will most
1331 probably be rendered unusable.
1332
1333 ``discard=discard``
1334 discard is one of "ignore" (or "off") or "unmap" (or "on")
1335 and controls whether ``discard`` (also known as ``trim`` or
1336 ``unmap``) requests are ignored or passed to the filesystem.
1337 Some machine types may not support discard requests.
1338
1339 ``detect-zeroes=detect-zeroes``
1340 detect-zeroes is "off", "on" or "unmap" and enables the
1341 automatic conversion of plain zero writes by the OS to
1342 driver specific optimized zero write commands. You may even
1343 choose "unmap" if discard is set to "unmap" to allow a zero
1344 write to be converted to an ``unmap`` operation.
1345
1346 ``Driver-specific options for file``
1347 This is the protocol-level block driver for accessing regular
1348 files.
1349
1350 ``filename``
1351 The path to the image file in the local filesystem
1352
1353 ``aio``
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001354 Specifies the AIO backend (threads/native/io_uring,
1355 default: threads)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001356
1357 ``locking``
1358 Specifies whether the image file is protected with Linux OFD
1359 / POSIX locks. The default is to use the Linux Open File
1360 Descriptor API if available, otherwise no lock is applied.
1361 (auto/on/off, default: auto)
1362
1363 Example:
1364
1365 ::
1366
1367 -blockdev driver=file,node-name=disk,filename=disk.img
1368
1369 ``Driver-specific options for raw``
1370 This is the image format block driver for raw images. It is
1371 usually stacked on top of a protocol level block driver such as
1372 ``file``.
1373
1374 ``file``
1375 Reference to or definition of the data source block driver
1376 node (e.g. a ``file`` driver node)
1377
1378 Example 1:
1379
1380 ::
1381
1382 -blockdev driver=file,node-name=disk_file,filename=disk.img
1383 -blockdev driver=raw,node-name=disk,file=disk_file
1384
1385 Example 2:
1386
1387 ::
1388
1389 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1390
1391 ``Driver-specific options for qcow2``
1392 This is the image format block driver for qcow2 images. It is
1393 usually stacked on top of a protocol level block driver such as
1394 ``file``.
1395
1396 ``file``
1397 Reference to or definition of the data source block driver
1398 node (e.g. a ``file`` driver node)
1399
1400 ``backing``
1401 Reference to or definition of the backing file block device
1402 (default is taken from the image file). It is allowed to
1403 pass ``null`` here in order to disable the default backing
1404 file.
1405
1406 ``lazy-refcounts``
1407 Whether to enable the lazy refcounts feature (on/off;
1408 default is taken from the image file)
1409
1410 ``cache-size``
1411 The maximum total size of the L2 table and refcount block
1412 caches in bytes (default: the sum of l2-cache-size and
1413 refcount-cache-size)
1414
1415 ``l2-cache-size``
1416 The maximum size of the L2 table cache in bytes (default: if
1417 cache-size is not specified - 32M on Linux platforms, and 8M
1418 on non-Linux platforms; otherwise, as large as possible
1419 within the cache-size, while permitting the requested or the
1420 minimal refcount cache size)
1421
1422 ``refcount-cache-size``
1423 The maximum size of the refcount block cache in bytes
1424 (default: 4 times the cluster size; or if cache-size is
1425 specified, the part of it which is not used for the L2
1426 cache)
1427
1428 ``cache-clean-interval``
1429 Clean unused entries in the L2 and refcount caches. The
1430 interval is in seconds. The default value is 600 on
1431 supporting platforms, and 0 on other platforms. Setting it
1432 to 0 disables this feature.
1433
1434 ``pass-discard-request``
1435 Whether discard requests to the qcow2 device should be
1436 forwarded to the data source (on/off; default: on if
1437 discard=unmap is specified, off otherwise)
1438
1439 ``pass-discard-snapshot``
1440 Whether discard requests for the data source should be
1441 issued when a snapshot operation (e.g. deleting a snapshot)
1442 frees clusters in the qcow2 file (on/off; default: on)
1443
1444 ``pass-discard-other``
1445 Whether discard requests for the data source should be
1446 issued on other occasions where a cluster gets freed
1447 (on/off; default: off)
1448
Jean-Louis Dupond42a28902023-06-05 10:45:24 +02001449 ``discard-no-unref``
1450 When enabled, discards from the guest will not cause cluster
1451 allocations to be relinquished. This prevents qcow2 fragmentation
1452 that would be caused by such discards. Besides potential
1453 performance degradation, such fragmentation can lead to increased
1454 allocation of clusters past the end of the image file,
1455 resulting in image files whose file length can grow much larger
1456 than their guest disk size would suggest.
1457 If image file length is of concern (e.g. when storing qcow2
1458 images directly on block devices), you should consider enabling
1459 this option.
1460
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001461 ``overlap-check``
1462 Which overlap checks to perform for writes to the image
1463 (none/constant/cached/all; default: cached). For details or
1464 finer granularity control refer to the QAPI documentation of
1465 ``blockdev-add``.
1466
1467 Example 1:
1468
1469 ::
1470
1471 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
1472 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
1473
1474 Example 2:
1475
1476 ::
1477
1478 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
1479
1480 ``Driver-specific options for other drivers``
1481 Please refer to the QAPI documentation of the ``blockdev-add``
1482 QMP command.
1483ERST
Markus Armbruster42e5f392017-02-28 22:27:07 +01001484
blueswir15824d652009-03-28 06:44:27 +00001485DEF("drive", HAS_ARG, QEMU_OPTION_drive,
1486 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
Stefan Hajnoczi92196b22011-08-04 12:26:52 +01001487 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
Kevin Wolf572023f2018-06-13 11:01:30 +02001488 " [,snapshot=on|off][,rerror=ignore|stop|report]\n"
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001489 " [,werror=ignore|stop|report|enospc][,id=name]\n"
1490 " [,aio=threads|native|io_uring]\n"
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00001491 " [,readonly=on|off][,copy-on-read=on|off]\n"
Peter Lieven2f7133b2014-07-28 21:53:02 +02001492 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n"
Benoît Canet3e9fab62013-09-02 14:14:40 +02001493 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n"
1494 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n"
1495 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
1496 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n"
Benoît Canet2024c1d2013-09-02 14:14:41 +02001497 " [[,iops_size=is]]\n"
Alberto Garcia76f4afb2015-06-08 18:17:44 +02001498 " [[,group=g]]\n"
Blue Swirlad960902010-03-29 19:23:52 +00001499 " use 'file' as a drive image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001500SRST
1501``-drive option[,option[,option[,...]]]``
1502 Define a new drive. This includes creating a block driver node (the
1503 backend) as well as a guest device, and is mostly a shortcut for
1504 defining the corresponding ``-blockdev`` and ``-device`` options.
1505
1506 ``-drive`` accepts all options that are accepted by ``-blockdev``.
1507 In addition, it knows the following options:
1508
1509 ``file=file``
Thomas Huth923e9312020-11-16 15:47:36 +01001510 This option defines which disk image (see the :ref:`disk images`
1511 chapter in the System Emulation Users Guide) to use with this drive.
1512 If the filename contains comma, you must double it (for instance,
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001513 "file=my,,file" to use file "my,file").
1514
1515 Special files such as iSCSI devices can be specified using
1516 protocol specific URLs. See the section for "Device URL Syntax"
1517 for more information.
1518
1519 ``if=interface``
1520 This option defines on which type on interface the drive is
1521 connected. Available types are: ide, scsi, sd, mtd, floppy,
1522 pflash, virtio, none.
1523
1524 ``bus=bus,unit=unit``
1525 These options define where is connected the drive by defining
1526 the bus number and the unit id.
1527
1528 ``index=index``
Laurent Vivier35aab302022-02-02 15:34:22 +01001529 This option defines where the drive is connected by using an
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001530 index in the list of available connectors of a given interface
1531 type.
1532
1533 ``media=media``
1534 This option defines the type of the media: disk or cdrom.
1535
1536 ``snapshot=snapshot``
1537 snapshot is "on" or "off" and controls snapshot mode for the
1538 given drive (see ``-snapshot``).
1539
1540 ``cache=cache``
1541 cache is "none", "writeback", "unsafe", "directsync" or
1542 "writethrough" and controls how the host cache is used to access
1543 block data. This is a shortcut that sets the ``cache.direct``
1544 and ``cache.no-flush`` options (as in ``-blockdev``), and
1545 additionally ``cache.writeback``, which provides a default for
1546 the ``write-cache`` option of block guest devices (as in
1547 ``-device``). The modes correspond to the following settings:
1548
Peter Maydell09ce5f22020-02-28 15:36:13 +00001549 ============= =============== ============ ==============
1550 \ cache.writeback cache.direct cache.no-flush
1551 ============= =============== ============ ==============
1552 writeback on off off
1553 none on on off
1554 writethrough off off off
1555 directsync off on off
1556 unsafe on off on
1557 ============= =============== ============ ==============
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001558
1559 The default mode is ``cache=writeback``.
1560
1561 ``aio=aio``
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001562 aio is "threads", "native", or "io_uring" and selects between pthread
1563 based disk I/O, native Linux AIO, or Linux io_uring API.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001564
1565 ``format=format``
1566 Specify which disk format will be used rather than detecting the
1567 format. Can be used to specify format=raw to avoid interpreting
1568 an untrusted format header.
1569
1570 ``werror=action,rerror=action``
1571 Specify which action to take on write and read errors. Valid
1572 actions are: "ignore" (ignore the error and try to continue),
1573 "stop" (pause QEMU), "report" (report the error to the guest),
1574 "enospc" (pause QEMU only if the host disk is full; report the
1575 error to the guest otherwise). The default setting is
1576 ``werror=enospc`` and ``rerror=report``.
1577
1578 ``copy-on-read=copy-on-read``
1579 copy-on-read is "on" or "off" and enables whether to copy read
1580 backing file sectors into the image file.
1581
1582 ``bps=b,bps_rd=r,bps_wr=w``
1583 Specify bandwidth throttling limits in bytes per second, either
1584 for all request types or for reads or writes only. Small values
1585 can lead to timeouts or hangs inside the guest. A safe minimum
1586 for disks is 2 MB/s.
1587
1588 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm``
1589 Specify bursts in bytes per second, either for all request types
1590 or for reads or writes only. Bursts allow the guest I/O to spike
1591 above the limit temporarily.
1592
1593 ``iops=i,iops_rd=r,iops_wr=w``
1594 Specify request rate limits in requests per second, either for
1595 all request types or for reads or writes only.
1596
1597 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm``
1598 Specify bursts in requests per second, either for all request
1599 types or for reads or writes only. Bursts allow the guest I/O to
1600 spike above the limit temporarily.
1601
1602 ``iops_size=is``
1603 Let every is bytes of a request count as a new request for iops
1604 throttling purposes. Use this option to prevent guests from
1605 circumventing iops limits by sending fewer but larger requests.
1606
1607 ``group=g``
1608 Join a throttling quota group with given name g. All drives that
1609 are members of the same group are accounted for together. Use
1610 this option to prevent guests from circumventing throttling
1611 limits by using many small disks instead of a single larger
1612 disk.
1613
1614 By default, the ``cache.writeback=on`` mode is used. It will report
1615 data writes as completed as soon as the data is present in the host
1616 page cache. This is safe as long as your guest OS makes sure to
1617 correctly flush disk caches where needed. If your guest OS does not
1618 handle volatile disk write caches correctly and your host crashes or
1619 loses power, then the guest may experience data corruption.
1620
1621 For such guests, you should consider using ``cache.writeback=off``.
1622 This means that the host page cache will be used to read and write
1623 data, but write notification will be sent to the guest only after
1624 QEMU has made sure to flush each write to the disk. Be aware that
1625 this has a major impact on performance.
1626
1627 When using the ``-snapshot`` option, unsafe caching is always used.
1628
1629 Copy-on-read avoids accessing the same backing file sectors
1630 repeatedly and is useful when the backing file is over a slow
1631 network. By default copy-on-read is off.
1632
1633 Instead of ``-cdrom`` you can use:
1634
1635 .. parsed-literal::
1636
1637 |qemu_system| -drive file=file,index=2,media=cdrom
1638
1639 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use:
1640
1641 .. parsed-literal::
1642
1643 |qemu_system| -drive file=file,index=0,media=disk
1644 |qemu_system| -drive file=file,index=1,media=disk
1645 |qemu_system| -drive file=file,index=2,media=disk
1646 |qemu_system| -drive file=file,index=3,media=disk
1647
1648 You can open an image using pre-opened file descriptors from an fd
1649 set:
1650
1651 .. parsed-literal::
1652
Laszlo Ersek353a06b2020-09-08 19:21:11 +02001653 |qemu_system| \\
1654 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\
1655 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001656 -drive file=/dev/fdset/2,index=0,media=disk
1657
1658 You can connect a CDROM to the slave of ide0:
1659
1660 .. parsed-literal::
1661
1662 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom
1663
1664 If you don't specify the "file=" argument, you define an empty
1665 drive:
1666
1667 .. parsed-literal::
1668
1669 |qemu_system_x86| -drive if=ide,index=1,media=cdrom
1670
1671 Instead of ``-fda``, ``-fdb``, you can use:
1672
1673 .. parsed-literal::
1674
1675 |qemu_system_x86| -drive file=file,index=0,if=floppy
1676 |qemu_system_x86| -drive file=file,index=1,if=floppy
1677
1678 By default, interface is "ide" and index is automatically
1679 incremented:
1680
1681 .. parsed-literal::
1682
John Snowa234ec32023-02-02 17:31:21 -05001683 |qemu_system_x86| -drive file=a -drive file=b
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001684
1685 is interpreted like:
1686
1687 .. parsed-literal::
1688
1689 |qemu_system_x86| -hda a -hdb b
1690ERST
blueswir15824d652009-03-28 06:44:27 +00001691
1692DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
Blue Swirlad960902010-03-29 19:23:52 +00001693 "-mtdblock file use 'file' as on-board Flash memory image\n",
1694 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001695SRST
1696``-mtdblock file``
1697 Use file as on-board Flash memory image.
1698ERST
blueswir15824d652009-03-28 06:44:27 +00001699
1700DEF("sd", HAS_ARG, QEMU_OPTION_sd,
Blue Swirlad960902010-03-29 19:23:52 +00001701 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001702SRST
1703``-sd file``
1704 Use file as SecureDigital card image.
1705ERST
blueswir15824d652009-03-28 06:44:27 +00001706
blueswir15824d652009-03-28 06:44:27 +00001707DEF("snapshot", 0, QEMU_OPTION_snapshot,
Blue Swirlad960902010-03-29 19:23:52 +00001708 "-snapshot write to temporary files instead of disk image files\n",
1709 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001710SRST
1711``-snapshot``
1712 Write to temporary files instead of disk image files. In this case,
1713 the raw disk image you use is not written back. You can however
Thomas Huth923e9312020-11-16 15:47:36 +01001714 force the write back by pressing C-a s (see the :ref:`disk images`
1715 chapter in the System Emulation Users Guide).
Alex Bennéec1654c32023-04-24 10:22:37 +01001716
1717 .. warning::
1718 snapshot is incompatible with ``-blockdev`` (instead use qemu-img
1719 to manually create snapshot images to attach to your blockdev).
1720 If you have mixed ``-blockdev`` and ``-drive`` declarations you
1721 can use the 'snapshot' property on your drive declarations
1722 instead of this global option.
1723
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001724ERST
blueswir15824d652009-03-28 06:44:27 +00001725
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301726DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
Greg Kurzb44a6b02019-05-17 17:34:49 +02001727 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001728 " [,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode]\n"
Pradeep Jagadeeshb8bbdb82017-02-28 10:31:46 +01001729 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n"
1730 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n"
1731 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n"
1732 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02001733 " [[,throttling.iops-size=is]]\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001734 "-fsdev proxy,id=id,socket=socket[,writeout=immediate][,readonly=on]\n"
1735 "-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=immediate][,readonly=on]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02001736 "-fsdev synth,id=id\n",
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301737 QEMU_ARCH_ALL)
1738
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001739SRST
Paolo Bonzini991c1802020-11-13 03:10:52 -05001740``-fsdev local,id=id,path=path,security_model=security_model [,writeout=writeout][,readonly=on][,fmode=fmode][,dmode=dmode] [,throttling.option=value[,throttling.option=value[,...]]]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001741 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001742``-fsdev proxy,id=id,socket=socket[,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001743 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001744``-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001745 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001746``-fsdev synth,id=id[,readonly=on]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001747 Define a new file system device. Valid options are:
1748
1749 ``local``
1750 Accesses to the filesystem are done by QEMU.
1751
1752 ``proxy``
Christian Schoenebeck71d72ec2023-06-26 13:49:06 +02001753 Accesses to the filesystem are done by virtfs-proxy-helper(1). This
1754 option is deprecated (since QEMU 8.1) and will be removed in a future
1755 version of QEMU. Use ``local`` instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001756
1757 ``synth``
1758 Synthetic filesystem, only used by QTests.
1759
1760 ``id=id``
1761 Specifies identifier for this device.
1762
1763 ``path=path``
1764 Specifies the export path for the file system device. Files
1765 under this path will be available to the 9p client on the guest.
1766
1767 ``security_model=security_model``
1768 Specifies the security model to be used for this export path.
1769 Supported security models are "passthrough", "mapped-xattr",
1770 "mapped-file" and "none". In "passthrough" security model, files
1771 are stored using the same credentials as they are created on the
1772 guest. This requires QEMU to run as root. In "mapped-xattr"
1773 security model, some of the file attributes like uid, gid, mode
1774 bits and link target are stored as file attributes. For
1775 "mapped-file" these attributes are stored in the hidden
1776 .virtfs\_metadata directory. Directories exported by this
1777 security model cannot interact with other unix tools. "none"
1778 security model is same as passthrough except the sever won't
1779 report failures if it fails to set file attributes like
1780 ownership. Security model is mandatory only for local fsdriver.
1781 Other fsdrivers (like proxy) don't take security model as a
1782 parameter.
1783
1784 ``writeout=writeout``
1785 This is an optional argument. The only supported value is
1786 "immediate". This means that host page cache will be used to
1787 read and write data but write notification will be sent to the
1788 guest only when the data has been reported as written by the
1789 storage subsystem.
1790
Paolo Bonzini991c1802020-11-13 03:10:52 -05001791 ``readonly=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001792 Enables exporting 9p share as a readonly mount for guests. By
1793 default read-write access is given.
1794
1795 ``socket=socket``
1796 Enables proxy filesystem driver to use passed socket file for
1797 communicating with virtfs-proxy-helper(1).
1798
1799 ``sock_fd=sock_fd``
1800 Enables proxy filesystem driver to use passed socket descriptor
1801 for communicating with virtfs-proxy-helper(1). Usually a helper
1802 like libvirt will create socketpair and pass one of the fds as
1803 sock\_fd.
1804
1805 ``fmode=fmode``
1806 Specifies the default mode for newly created files on the host.
1807 Works only with security models "mapped-xattr" and
1808 "mapped-file".
1809
1810 ``dmode=dmode``
1811 Specifies the default mode for newly created directories on the
1812 host. Works only with security models "mapped-xattr" and
1813 "mapped-file".
1814
1815 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w``
1816 Specify bandwidth throttling limits in bytes per second, either
1817 for all request types or for reads or writes only.
1818
1819 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm``
1820 Specify bursts in bytes per second, either for all request types
1821 or for reads or writes only. Bursts allow the guest I/O to spike
1822 above the limit temporarily.
1823
1824 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w``
1825 Specify request rate limits in requests per second, either for
1826 all request types or for reads or writes only.
1827
1828 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm``
1829 Specify bursts in requests per second, either for all request
1830 types or for reads or writes only. Bursts allow the guest I/O to
1831 spike above the limit temporarily.
1832
1833 ``throttling.iops-size=is``
1834 Let every is bytes of a request count as a new request for iops
1835 throttling purposes.
1836
1837 -fsdev option is used along with -device driver "virtio-9p-...".
1838
1839``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag``
1840 Options for virtio-9p-... driver are:
1841
1842 ``type``
1843 Specifies the variant to be used. Supported values are "pci",
1844 "ccw" or "device", depending on the machine type.
1845
1846 ``fsdev=id``
1847 Specifies the id value specified along with -fsdev option.
1848
1849 ``mount_tag=mount_tag``
1850 Specifies the tag name to be used by the guest to mount this
1851 export point.
1852ERST
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301853
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05301854DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
Greg Kurzb44a6b02019-05-17 17:34:49 +02001855 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001856 " [,id=id][,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n"
1857 "-virtfs proxy,mount_tag=tag,socket=socket[,id=id][,writeout=immediate][,readonly=on]\n"
1858 "-virtfs proxy,mount_tag=tag,sock_fd=sock_fd[,id=id][,writeout=immediate][,readonly=on]\n"
1859 "-virtfs synth,mount_tag=tag[,id=id][,readonly=on]\n",
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05301860 QEMU_ARCH_ALL)
1861
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001862SRST
Paolo Bonzini991c1802020-11-13 03:10:52 -05001863``-virtfs local,path=path,mount_tag=mount_tag ,security_model=security_model[,writeout=writeout][,readonly=on] [,fmode=fmode][,dmode=dmode][,multidevs=multidevs]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001864 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001865``-virtfs proxy,socket=socket,mount_tag=mount_tag [,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001866 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001867``-virtfs proxy,sock_fd=sock_fd,mount_tag=mount_tag [,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001868 \
1869``-virtfs synth,mount_tag=mount_tag``
Christian Schoenebeck65abaa02020-05-14 08:06:43 +02001870 Define a new virtual filesystem device and expose it to the guest using
1871 a virtio-9p-device (a.k.a. 9pfs), which essentially means that a certain
1872 directory on host is made directly accessible by guest as a pass-through
1873 file system by using the 9P network protocol for communication between
1874 host and guests, if desired even accessible, shared by several guests
Stefan Weil2cb40d42022-11-10 20:08:25 +01001875 simultaneously.
Christian Schoenebeck65abaa02020-05-14 08:06:43 +02001876
1877 Note that ``-virtfs`` is actually just a convenience shortcut for its
1878 generalized form ``-fsdev -device virtio-9p-pci``.
1879
1880 The general form of pass-through file system options are:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001881
1882 ``local``
1883 Accesses to the filesystem are done by QEMU.
1884
1885 ``proxy``
1886 Accesses to the filesystem are done by virtfs-proxy-helper(1).
Christian Schoenebeck71d72ec2023-06-26 13:49:06 +02001887 This option is deprecated (since QEMU 8.1) and will be removed in a
1888 future version of QEMU. Use ``local`` instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001889
1890 ``synth``
1891 Synthetic filesystem, only used by QTests.
1892
1893 ``id=id``
1894 Specifies identifier for the filesystem device
1895
1896 ``path=path``
1897 Specifies the export path for the file system device. Files
1898 under this path will be available to the 9p client on the guest.
1899
1900 ``security_model=security_model``
1901 Specifies the security model to be used for this export path.
1902 Supported security models are "passthrough", "mapped-xattr",
1903 "mapped-file" and "none". In "passthrough" security model, files
1904 are stored using the same credentials as they are created on the
1905 guest. This requires QEMU to run as root. In "mapped-xattr"
1906 security model, some of the file attributes like uid, gid, mode
1907 bits and link target are stored as file attributes. For
1908 "mapped-file" these attributes are stored in the hidden
1909 .virtfs\_metadata directory. Directories exported by this
1910 security model cannot interact with other unix tools. "none"
1911 security model is same as passthrough except the sever won't
1912 report failures if it fails to set file attributes like
1913 ownership. Security model is mandatory only for local fsdriver.
1914 Other fsdrivers (like proxy) don't take security model as a
1915 parameter.
1916
1917 ``writeout=writeout``
1918 This is an optional argument. The only supported value is
1919 "immediate". This means that host page cache will be used to
1920 read and write data but write notification will be sent to the
1921 guest only when the data has been reported as written by the
1922 storage subsystem.
1923
Paolo Bonzini991c1802020-11-13 03:10:52 -05001924 ``readonly=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001925 Enables exporting 9p share as a readonly mount for guests. By
1926 default read-write access is given.
1927
1928 ``socket=socket``
1929 Enables proxy filesystem driver to use passed socket file for
1930 communicating with virtfs-proxy-helper(1). Usually a helper like
1931 libvirt will create socketpair and pass one of the fds as
1932 sock\_fd.
1933
1934 ``sock_fd``
1935 Enables proxy filesystem driver to use passed 'sock\_fd' as the
1936 socket descriptor for interfacing with virtfs-proxy-helper(1).
1937
1938 ``fmode=fmode``
1939 Specifies the default mode for newly created files on the host.
1940 Works only with security models "mapped-xattr" and
1941 "mapped-file".
1942
1943 ``dmode=dmode``
1944 Specifies the default mode for newly created directories on the
1945 host. Works only with security models "mapped-xattr" and
1946 "mapped-file".
1947
1948 ``mount_tag=mount_tag``
1949 Specifies the tag name to be used by the guest to mount this
1950 export point.
1951
1952 ``multidevs=multidevs``
1953 Specifies how to deal with multiple devices being shared with a
1954 9p export. Supported behaviours are either "remap", "forbid" or
1955 "warn". The latter is the default behaviour on which virtfs 9p
1956 expects only one device to be shared with the same export, and
1957 if more than one device is shared and accessed via the same 9p
1958 export then only a warning message is logged (once) by qemu on
1959 host side. In order to avoid file ID collisions on guest you
1960 should either create a separate virtfs export for each device to
1961 be shared with guests (recommended way) or you might use "remap"
1962 instead which allows you to share multiple devices with only one
1963 export instead, which is achieved by remapping the original
1964 inode numbers from host to guest in a way that would prevent
1965 such collisions. Remapping inodes in such use cases is required
1966 because the original device IDs from host are never passed and
1967 exposed on guest. Instead all files of an export shared with
1968 virtfs always share the same device id on guest. So two files
1969 with identical inode numbers but from actually different devices
1970 on host would otherwise cause a file ID collision and hence
1971 potential misbehaviours on guest. "forbid" on the other hand
1972 assumes like "warn" that only one device is shared by the same
1973 export, however it will not only log a warning message but also
1974 deny access to additional devices on guest. Note though that
1975 "forbid" does currently not block all possible file access
1976 operations (e.g. readdir() would still return entries from other
1977 devices).
1978ERST
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05301979
Markus Armbruster61d70482017-10-02 16:03:03 +02001980DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi,
Daniel P. Berrangéc3b3a6c2022-12-01 04:25:05 -05001981 "-iscsi [user=user][,password=password][,password-secret=secret-id]\n"
1982 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE]\n"
Markus Armbruster61d70482017-10-02 16:03:03 +02001983 " [,initiator-name=initiator-iqn][,id=target-iqn]\n"
1984 " [,timeout=timeout]\n"
1985 " iSCSI session parameters\n", QEMU_ARCH_ALL)
1986
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001987SRST
1988``-iscsi``
1989 Configure iSCSI session parameters.
1990ERST
Markus Armbruster44743142017-10-02 16:03:04 +02001991
blueswir15824d652009-03-28 06:44:27 +00001992DEFHEADING()
1993
Thomas Huthc2a34ab2021-03-10 18:33:23 +01001994DEFHEADING(USB convenience options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001995
1996DEF("usb", 0, QEMU_OPTION_usb,
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01001997 "-usb enable on-board USB host controller (if not enabled by default)\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001998 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001999SRST
2000``-usb``
2001 Enable USB emulation on machine types with an on-board USB host
2002 controller (if not enabled by default). Note that on-board USB host
2003 controllers may not support USB 3.0. In this case
2004 ``-device qemu-xhci`` can be used instead on machines with PCI.
2005ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002006
2007DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
2008 "-usbdevice name add the host or guest USB device 'name'\n",
2009 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002010SRST
2011``-usbdevice devname``
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002012 Add the USB device devname, and enable an on-board USB controller
2013 if possible and necessary (just like it can be done via
2014 ``-machine usb=on``). Note that this option is mainly intended for
2015 the user's convenience only. More fine-grained control can be
2016 achieved by selecting a USB host controller (if necessary) and the
2017 desired USB device via the ``-device`` option instead. For example,
2018 instead of using ``-usbdevice mouse`` it is possible to use
2019 ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse
2020 to a USB 3.0 controller instead (at least on machines that support
2021 PCI and do not have an USB controller enabled by default yet).
2022 For more details, see the chapter about
Thomas Huth923e9312020-11-16 15:47:36 +01002023 :ref:`Connecting USB devices` in the System Emulation Users Guide.
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002024 Possible devices for devname are:
2025
2026 ``braille``
2027 Braille device. This will use BrlAPI to display the braille
2028 output on a real or fake device (i.e. it also creates a
2029 corresponding ``braille`` chardev automatically beside the
2030 ``usb-braille`` USB device).
2031
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002032 ``keyboard``
2033 Standard USB keyboard. Will override the PS/2 keyboard (if present).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002034
2035 ``mouse``
2036 Virtual Mouse. This will override the PS/2 mouse emulation when
2037 activated.
2038
2039 ``tablet``
2040 Pointer device that uses absolute coordinates (like a
2041 touchscreen). This means QEMU is able to report the mouse
2042 position without having to grab the mouse. Also overrides the
2043 PS/2 mouse emulation when activated.
2044
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002045 ``wacom-tablet``
2046 Wacom PenPartner USB tablet.
2047
2048
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002049ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002050
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002051DEFHEADING()
2052
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002053DEFHEADING(Display options:)
blueswir15824d652009-03-28 06:44:27 +00002054
Jes Sorensen1472a952011-03-16 13:33:31 +01002055DEF("display", HAS_ARG, QEMU_OPTION_display,
Thomas Huth88b40c62019-10-23 14:01:28 +02002056#if defined(CONFIG_SPICE)
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01002057 "-display spice-app[,gl=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002058#endif
2059#if defined(CONFIG_SDL)
Thomas Hutha743d602022-05-19 17:56:23 +02002060 "-display sdl[,gl=on|core|es|off][,grab-mod=<mod>][,show-cursor=on|off]\n"
2061 " [,window-close=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002062#endif
Robert Hof04ec5a2016-07-26 18:17:11 +08002063#if defined(CONFIG_GTK)
Thomas Huth95f439b2021-06-30 18:32:31 +02002064 "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
Felix xq Queißnerc34a9332022-07-12 15:37:53 +02002065 " [,show-tabs=on|off][,show-cursor=on|off][,window-close=on|off]\n"
Bryce Millsdbccb1a2022-10-11 13:58:21 +00002066 " [,show-menubar=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002067#endif
2068#if defined(CONFIG_VNC)
2069 "-display vnc=<display>[,<optargs>]\n"
2070#endif
2071#if defined(CONFIG_CURSES)
2072 "-display curses[,charset=<encoding>]\n"
2073#endif
Gustavo Noronha Silvaf844cdb2022-03-06 21:11:18 +09002074#if defined(CONFIG_COCOA)
Gustavo Noronha Silva4797adc2022-03-06 21:11:19 +09002075 "-display cocoa[,full-grab=on|off][,swap-opt-cmd=on|off]\n"
Gustavo Noronha Silvaf844cdb2022-03-06 21:11:18 +09002076#endif
Thomas Huth88b40c62019-10-23 14:01:28 +02002077#if defined(CONFIG_OPENGL)
2078 "-display egl-headless[,rendernode=<file>]\n"
2079#endif
Marc-André Lureau142ca622021-07-15 11:53:53 +04002080#if defined(CONFIG_DBUS_DISPLAY)
2081 "-display dbus[,addr=<dbusaddr>]\n"
2082 " [,gl=on|core|es|off][,rendernode=<file>]\n"
2083#endif
Carwyn Ellis48941a52022-01-02 17:41:52 +00002084#if defined(CONFIG_COCOA)
2085 "-display cocoa[,show-cursor=on|off][,left-command-key=on|off]\n"
2086#endif
Thomas Huth88b40c62019-10-23 14:01:28 +02002087 "-display none\n"
2088 " select display backend type\n"
2089 " The default display is equivalent to\n "
2090#if defined(CONFIG_GTK)
2091 "\"-display gtk\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002092#elif defined(CONFIG_SDL)
Thomas Huth88b40c62019-10-23 14:01:28 +02002093 "\"-display sdl\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002094#elif defined(CONFIG_COCOA)
Thomas Huth88b40c62019-10-23 14:01:28 +02002095 "\"-display cocoa\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002096#elif defined(CONFIG_VNC)
Thomas Huth88b40c62019-10-23 14:01:28 +02002097 "\"-vnc localhost:0,to=99,id=default\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002098#else
Thomas Huth88b40c62019-10-23 14:01:28 +02002099 "\"-display none\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002100#endif
2101 , QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002102SRST
2103``-display type``
Thomas Huth707d93d2022-05-19 17:56:25 +02002104 Select type of display to use. Use ``-display help`` to list the available
2105 display types. Valid values for type are
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002106
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002107 ``spice-app[,gl=on|off]``
2108 Start QEMU as a Spice server and launch the default Spice client
2109 application. The Spice server will redirect the serial consoles
2110 and QEMU monitors. (Since 4.0)
2111
Marc-André Lureau142ca622021-07-15 11:53:53 +04002112 ``dbus``
2113 Export the display over D-Bus interfaces. (Since 7.0)
2114
2115 The connection is registered with the "org.qemu" name (and queued when
2116 already owned).
2117
2118 ``addr=<dbusaddr>`` : D-Bus bus address to connect to.
2119
Marc-André Lureau99997822021-10-10 00:16:57 +04002120 ``p2p=yes|no`` : Use peer-to-peer connection, accepted via QMP ``add_client``.
2121
2122 ``gl=on|off|core|es`` : Use OpenGL for rendering (the D-Bus interface
2123 will share framebuffers with DMABUF file descriptors).
Marc-André Lureau142ca622021-07-15 11:53:53 +04002124
Thomas Huth95f439b2021-06-30 18:32:31 +02002125 ``sdl``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002126 Display video output via SDL (usually in a separate graphics
2127 window; see the SDL documentation for other possibilities).
Thomas Huth95f439b2021-06-30 18:32:31 +02002128 Valid parameters are:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002129
Thomas Huth8e8e8442021-08-25 11:20:21 +02002130 ``grab-mod=<mods>`` : Used to select the modifier keys for toggling
John Snow450e0f22021-10-04 17:52:36 -04002131 the mouse grabbing in conjunction with the "g" key. ``<mods>`` can be
2132 either ``lshift-lctrl-lalt`` or ``rctrl``.
Thomas Huth8e8e8442021-08-25 11:20:21 +02002133
Thomas Huth95f439b2021-06-30 18:32:31 +02002134 ``gl=on|off|core|es`` : Use OpenGL for displaying
2135
2136 ``show-cursor=on|off`` : Force showing the mouse cursor
2137
2138 ``window-close=on|off`` : Allow to quit qemu with window close button
2139
2140 ``gtk``
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002141 Display video output in a GTK window. This interface provides
2142 drop-down menus and other UI elements to configure and control
Thomas Huth95f439b2021-06-30 18:32:31 +02002143 the VM during runtime. Valid parameters are:
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002144
Thomas Huth95f439b2021-06-30 18:32:31 +02002145 ``full-screen=on|off`` : Start in fullscreen mode
2146
2147 ``gl=on|off`` : Use OpenGL for displaying
2148
2149 ``grab-on-hover=on|off`` : Grab keyboard input on mouse hover
2150
Felix xq Queißnerc34a9332022-07-12 15:37:53 +02002151 ``show-tabs=on|off`` : Display the tab bar for switching between the
2152 various graphical interfaces (e.g. VGA and
2153 virtual console character devices) by default.
2154
Thomas Huth95f439b2021-06-30 18:32:31 +02002155 ``show-cursor=on|off`` : Force showing the mouse cursor
2156
2157 ``window-close=on|off`` : Allow to quit qemu with window close button
2158
Bryce Millsdbccb1a2022-10-11 13:58:21 +00002159 ``show-menubar=on|off`` : Display the main window menubar, defaults to "on"
2160
Jan Kratochvilc35d9372023-06-28 18:23:36 +08002161 ``zoom-to-fit=on|off`` : Expand video output to the window size,
2162 defaults to "off"
2163
Thomas Huth95f439b2021-06-30 18:32:31 +02002164 ``curses[,charset=<encoding>]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002165 Display video output via curses. For graphics device models
2166 which support a text mode, QEMU can display this output using a
2167 curses/ncurses interface. Nothing is displayed when the graphics
2168 device is in graphical mode or if the graphics device does not
2169 support a text mode. Generally only the VGA device models
2170 support text mode. The font charset used by the guest can be
2171 specified with the ``charset`` option, for example
2172 ``charset=CP850`` for IBM CP850 encoding. The default is
2173 ``CP437``.
2174
Carwyn Ellis48941a52022-01-02 17:41:52 +00002175 ``cocoa``
2176 Display video output in a Cocoa window. Mac only. This interface
2177 provides drop-down menus and other UI elements to configure and
2178 control the VM during runtime. Valid parameters are:
2179
2180 ``show-cursor=on|off`` : Force showing the mouse cursor
2181
2182 ``left-command-key=on|off`` : Disable forwarding left command key to host
2183
Thomas Huth95f439b2021-06-30 18:32:31 +02002184 ``egl-headless[,rendernode=<file>]``
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002185 Offload all OpenGL operations to a local DRI device. For any
2186 graphical display, this display needs to be paired with either
2187 VNC or SPICE displays.
2188
Thomas Huth95f439b2021-06-30 18:32:31 +02002189 ``vnc=<display>``
2190 Start a VNC server on display <display>
2191
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002192 ``none``
2193 Do not display video output. The guest will still see an
2194 emulated graphics card, but its output will not be displayed to
2195 the QEMU user. This option differs from the -nographic option in
2196 that it only affects what is done with video output; -nographic
2197 also changes the destination of the serial and parallel port
2198 data.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002199ERST
Jes Sorensen1472a952011-03-16 13:33:31 +01002200
blueswir15824d652009-03-28 06:44:27 +00002201DEF("nographic", 0, QEMU_OPTION_nographic,
Blue Swirlad960902010-03-29 19:23:52 +00002202 "-nographic disable graphical output and redirect serial I/Os to console\n",
2203 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002204SRST
2205``-nographic``
2206 Normally, if QEMU is compiled with graphical window support, it
2207 displays output such as guest graphics, guest console, and the QEMU
2208 monitor in a window. With this option, you can totally disable
2209 graphical output so that QEMU is a simple command line application.
2210 The emulated serial port is redirected on the console and muxed with
2211 the monitor (unless redirected elsewhere explicitly). Therefore, you
2212 can still use QEMU to debug a Linux kernel with a serial console.
2213 Use C-a h for help on switching between the console and monitor.
2214ERST
blueswir15824d652009-03-28 06:44:27 +00002215
Marc-André Lureau5324e3e2021-09-09 12:44:11 +04002216#ifdef CONFIG_SPICE
Gerd Hoffmann29b00402010-03-11 11:13:27 -03002217DEF("spice", HAS_ARG, QEMU_OPTION_spice,
Yonit Halperin27af7782012-08-21 13:54:20 +03002218 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
2219 " [,x509-key-file=<file>][,x509-key-password=<file>]\n"
2220 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002221 " [,x509-dh-key-file=<file>][,addr=addr]\n"
2222 " [,ipv4=on|off][,ipv6=on|off][,unix=on|off]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03002223 " [,tls-ciphers=<list>]\n"
2224 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n"
2225 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n"
Daniel P. Berrangé99522f62021-03-11 11:43:42 +00002226 " [,sasl=on|off][,disable-ticketing=on|off]\n"
Daniel P. Berrangé36debaf2022-12-01 04:22:11 -05002227 " [,password-secret=<secret-id>]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03002228 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n"
2229 " [,jpeg-wan-compression=[auto|never|always]]\n"
2230 " [,zlib-glz-wan-compression=[auto|never|always]]\n"
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002231 " [,streaming-video=[off|all|filter]][,disable-copy-paste=on|off]\n"
2232 " [,disable-agent-file-xfer=on|off][,agent-mouse=[on|off]]\n"
Hans de Goede5ad24e52013-06-08 15:37:27 +02002233 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
Marc-André Lureau7b525502017-02-12 15:21:18 +04002234 " [,gl=[on|off]][,rendernode=<file>]\n"
Thomas Hutha635bcf2023-07-03 09:56:46 +02002235 " enable spice\n"
2236 " at least one of {port, tls-port} is mandatory\n",
Yonit Halperin27af7782012-08-21 13:54:20 +03002237 QEMU_ARCH_ALL)
Marc-André Lureau5324e3e2021-09-09 12:44:11 +04002238#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002239SRST
2240``-spice option[,option[,...]]``
2241 Enable the spice remote desktop protocol. Valid options are
2242
2243 ``port=<nr>``
2244 Set the TCP port spice is listening on for plaintext channels.
2245
2246 ``addr=<addr>``
2247 Set the IP address spice is listening on. Default is any
2248 address.
2249
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002250 ``ipv4=on|off``; \ ``ipv6=on|off``; \ ``unix=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002251 Force using the specified IP version.
2252
Daniel P. Berrangé99522f62021-03-11 11:43:42 +00002253 ``password-secret=<secret-id>``
2254 Set the ID of the ``secret`` object containing the password
2255 you need to authenticate.
2256
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002257 ``sasl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002258 Require that the client use SASL to authenticate with the spice.
2259 The exact choice of authentication method used is controlled
2260 from the system / user's SASL configuration file for the 'qemu'
2261 service. This is typically found in /etc/sasl2/qemu.conf. If
2262 running QEMU as an unprivileged user, an environment variable
2263 SASL\_CONF\_PATH can be used to make it search alternate
2264 locations for the service config. While some SASL auth methods
2265 can also provide data encryption (eg GSSAPI), it is recommended
2266 that SASL always be combined with the 'tls' and 'x509' settings
2267 to enable use of SSL and server certificates. This ensures a
2268 data encryption preventing compromise of authentication
2269 credentials.
2270
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002271 ``disable-ticketing=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002272 Allow client connects without authentication.
2273
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002274 ``disable-copy-paste=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002275 Disable copy paste between the client and the guest.
2276
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002277 ``disable-agent-file-xfer=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002278 Disable spice-vdagent based file-xfer between the client and the
2279 guest.
2280
2281 ``tls-port=<nr>``
2282 Set the TCP port spice is listening on for encrypted channels.
2283
2284 ``x509-dir=<dir>``
2285 Set the x509 file directory. Expects same filenames as -vnc
2286 $display,x509=$dir
2287
2288 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>``
2289 The x509 file names can also be configured individually.
2290
2291 ``tls-ciphers=<list>``
2292 Specify which ciphers to use.
2293
2294 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]``
2295 Force specific channel to be used with or without TLS
2296 encryption. The options can be specified multiple times to
2297 configure multiple channels. The special name "default" can be
2298 used to set the default mode. For channels which are not
2299 explicitly forced into one mode the spice client is allowed to
2300 pick tls/plaintext as he pleases.
2301
2302 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]``
2303 Configure image compression (lossless). Default is auto\_glz.
2304
2305 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]``
2306 Configure wan image compression (lossy for slow links). Default
2307 is auto.
2308
2309 ``streaming-video=[off|all|filter]``
2310 Configure video stream detection. Default is off.
2311
2312 ``agent-mouse=[on|off]``
2313 Enable/disable passing mouse events via vdagent. Default is on.
2314
2315 ``playback-compression=[on|off]``
2316 Enable/disable audio stream compression (using celt 0.5.1).
2317 Default is on.
2318
2319 ``seamless-migration=[on|off]``
2320 Enable/disable spice seamless migration. Default is off.
2321
2322 ``gl=[on|off]``
2323 Enable/disable OpenGL context. Default is off.
2324
2325 ``rendernode=<file>``
2326 DRM render node for OpenGL rendering. If not specified, it will
2327 pick the first available. (Since 2.9)
2328ERST
Gerd Hoffmann29b00402010-03-11 11:13:27 -03002329
blueswir15824d652009-03-28 06:44:27 +00002330DEF("portrait", 0, QEMU_OPTION_portrait,
Blue Swirlad960902010-03-29 19:23:52 +00002331 "-portrait rotate graphical output 90 deg left (only PXA LCD)\n",
2332 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002333SRST
2334``-portrait``
2335 Rotate graphical output 90 deg left (only PXA LCD).
2336ERST
blueswir15824d652009-03-28 06:44:27 +00002337
Vasily Khoruzhick93128052011-06-17 13:04:36 +03002338DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
2339 "-rotate <deg> rotate graphical output some deg left (only PXA LCD)\n",
2340 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002341SRST
2342``-rotate deg``
2343 Rotate graphical output some deg left (only PXA LCD).
2344ERST
Vasily Khoruzhick93128052011-06-17 13:04:36 +03002345
blueswir15824d652009-03-28 06:44:27 +00002346DEF("vga", HAS_ARG, QEMU_OPTION_vga,
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02002347 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
Blue Swirlad960902010-03-29 19:23:52 +00002348 " select video card type\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002349SRST
2350``-vga type``
2351 Select type of VGA card to emulate. Valid values for type are
2352
2353 ``cirrus``
2354 Cirrus Logic GD5446 Video card. All Windows versions starting
2355 from Windows 95 should recognize and use this graphic card. For
2356 optimal performances, use 16 bit color depth in the guest and
2357 the host OS. (This card was the default before QEMU 2.2)
2358
2359 ``std``
2360 Standard VGA card with Bochs VBE extensions. If your guest OS
2361 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
2362 you want to use high resolution modes (>= 1280x1024x16) then you
2363 should use this option. (This card is the default since QEMU
2364 2.2)
2365
2366 ``vmware``
2367 VMWare SVGA-II compatible adapter. Use it if you have
2368 sufficiently recent XFree86/XOrg server or Windows guest with a
2369 driver for this card.
2370
2371 ``qxl``
2372 QXL paravirtual graphic card. It is VGA compatible (including
2373 VESA 2.0 VBE support). Works best with qxl guest drivers
2374 installed though. Recommended choice when using the spice
2375 protocol.
2376
2377 ``tcx``
2378 (sun4m only) Sun TCX framebuffer. This is the default
2379 framebuffer for sun4m machines and offers both 8-bit and 24-bit
2380 colour depths at a fixed resolution of 1024x768.
2381
2382 ``cg3``
2383 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
2384 framebuffer for sun4m machines available in both 1024x768
2385 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
2386 wishing to run older Solaris versions.
2387
2388 ``virtio``
2389 Virtio VGA card.
2390
2391 ``none``
2392 Disable VGA card.
2393ERST
blueswir15824d652009-03-28 06:44:27 +00002394
2395DEF("full-screen", 0, QEMU_OPTION_full_screen,
Blue Swirlad960902010-03-29 19:23:52 +00002396 "-full-screen start in full screen\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002397SRST
2398``-full-screen``
2399 Start in full screen.
2400ERST
blueswir15824d652009-03-28 06:44:27 +00002401
John Snow60f9a4e2020-02-04 11:56:38 -05002402DEF("g", HAS_ARG, QEMU_OPTION_g ,
Blue Swirlad960902010-03-29 19:23:52 +00002403 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
Laurent Vivier8ac919a2019-10-26 18:45:43 +02002404 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002405SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00002406``-g`` *width*\ ``x``\ *height*\ ``[x``\ *depth*\ ``]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002407 Set the initial graphical resolution and depth (PPC, SPARC only).
2408
2409 For PPC the default is 800x600x32.
2410
2411 For SPARC with the TCX graphics device, the default is 1024x768x8
2412 with the option of 1024x768x24. For cgthree, the default is
2413 1024x768x8 with the option of 1152x900x8 for people who wish to use
2414 OBP.
2415ERST
blueswir15824d652009-03-28 06:44:27 +00002416
2417DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
Robert Hof04ec5a2016-07-26 18:17:11 +08002418 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002419SRST
2420``-vnc display[,option[,option[,...]]]``
2421 Normally, if QEMU is compiled with graphical window support, it
2422 displays output such as guest graphics, guest console, and the QEMU
2423 monitor in a window. With this option, you can have QEMU listen on
2424 VNC display display and redirect the VGA display over the VNC
2425 session. It is very useful to enable the usb tablet device when
2426 using this option (option ``-device usb-tablet``). When using the
2427 VNC display, you must use the ``-k`` parameter to set the keyboard
2428 layout if you are not using en-us. Valid syntax for the display is
2429
2430 ``to=L``
2431 With this option, QEMU will try next available VNC displays,
2432 until the number L, if the origianlly defined "-vnc display" is
2433 not available, e.g. port 5900+display is already used by another
2434 application. By default, to=0.
2435
2436 ``host:d``
2437 TCP connections will only be allowed from host on display d. By
2438 convention the TCP port is 5900+d. Optionally, host can be
2439 omitted in which case the server will accept connections from
2440 any host.
2441
2442 ``unix:path``
2443 Connections will be allowed over UNIX domain sockets where path
2444 is the location of a unix socket to listen for connections on.
2445
2446 ``none``
2447 VNC is initialized but not started. The monitor ``change``
2448 command can be used to later start the VNC server.
2449
2450 Following the display value there may be one or more option flags
2451 separated by commas. Valid options are
2452
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002453 ``reverse=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002454 Connect to a listening VNC client via a "reverse" connection.
2455 The client is specified by the display. For reverse network
2456 connections (host:d,``reverse``), the d argument is a TCP port
2457 number, not a display number.
2458
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002459 ``websocket=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002460 Opens an additional TCP listening port dedicated to VNC
2461 Websocket connections. If a bare websocket option is given, the
2462 Websocket port is 5700+display. An alternative port can be
2463 specified with the syntax ``websocket``\ =port.
2464
2465 If host is specified connections will only be allowed from this
2466 host. It is possible to control the websocket listen address
2467 independently, using the syntax ``websocket``\ =host:port.
2468
2469 If no TLS credentials are provided, the websocket connection
2470 runs in unencrypted mode. If TLS credentials are provided, the
2471 websocket connection requires encrypted client connections.
2472
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002473 ``password=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002474 Require that password based authentication is used for client
2475 connections.
2476
2477 The password must be set separately using the ``set_password``
Thomas Huth923e9312020-11-16 15:47:36 +01002478 command in the :ref:`QEMU monitor`. The
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002479 syntax to change your password is:
2480 ``set_password <protocol> <password>`` where <protocol> could be
2481 either "vnc" or "spice".
2482
2483 If you would like to change <protocol> password expiration, you
2484 should use ``expire_password <protocol> <expiration-time>``
2485 where expiration time could be one of the following options:
2486 now, never, +seconds or UNIX time of expiration, e.g. +60 to
2487 make password expire in 60 seconds, or 1335196800 to make
2488 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for
2489 this date and time).
2490
2491 You can also use keywords "now" or "never" for the expiration
2492 time to allow <protocol> password to expire immediately or never
2493 expire.
2494
Daniel P. Berrangé6c6840e2021-03-11 11:43:41 +00002495 ``password-secret=<secret-id>``
2496 Require that password based authentication is used for client
2497 connections, using the password provided by the ``secret``
2498 object identified by ``secret-id``.
2499
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002500 ``tls-creds=ID``
2501 Provides the ID of a set of TLS credentials to use to secure the
2502 VNC server. They will apply to both the normal VNC server socket
2503 and the websocket socket (if enabled). Setting TLS credentials
2504 will cause the VNC server socket to enable the VeNCrypt auth
2505 mechanism. The credentials should have been previously created
2506 using the ``-object tls-creds`` argument.
2507
2508 ``tls-authz=ID``
2509 Provides the ID of the QAuthZ authorization object against which
2510 the client's x509 distinguished name will validated. This object
2511 is only resolved at time of use, so can be deleted and recreated
2512 on the fly while the VNC server is active. If missing, it will
2513 default to denying access.
2514
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002515 ``sasl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002516 Require that the client use SASL to authenticate with the VNC
2517 server. The exact choice of authentication method used is
2518 controlled from the system / user's SASL configuration file for
2519 the 'qemu' service. This is typically found in
2520 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user,
2521 an environment variable SASL\_CONF\_PATH can be used to make it
2522 search alternate locations for the service config. While some
2523 SASL auth methods can also provide data encryption (eg GSSAPI),
2524 it is recommended that SASL always be combined with the 'tls'
2525 and 'x509' settings to enable use of SSL and server
2526 certificates. This ensures a data encryption preventing
2527 compromise of authentication credentials. See the
Thomas Huth923e9312020-11-16 15:47:36 +01002528 :ref:`VNC security` section in the System Emulation Users Guide
2529 for details on using SASL authentication.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002530
2531 ``sasl-authz=ID``
2532 Provides the ID of the QAuthZ authorization object against which
2533 the client's SASL username will validated. This object is only
2534 resolved at time of use, so can be deleted and recreated on the
2535 fly while the VNC server is active. If missing, it will default
2536 to denying access.
2537
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002538 ``acl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002539 Legacy method for enabling authorization of clients against the
2540 x509 distinguished name and SASL username. It results in the
2541 creation of two ``authz-list`` objects with IDs of
2542 ``vnc.username`` and ``vnc.x509dname``. The rules for these
2543 objects must be configured with the HMP ACL commands.
2544
2545 This option is deprecated and should no longer be used. The new
2546 ``sasl-authz`` and ``tls-authz`` options are a replacement.
2547
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002548 ``lossy=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002549 Enable lossy compression methods (gradient, JPEG, ...). If this
2550 option is set, VNC client may receive lossy framebuffer updates
2551 depending on its encoding settings. Enabling this option can
2552 save a lot of bandwidth at the expense of quality.
2553
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002554 ``non-adaptive=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002555 Disable adaptive encodings. Adaptive encodings are enabled by
2556 default. An adaptive encoding will try to detect frequently
2557 updated screen regions, and send updates in these regions using
2558 a lossy encoding (like JPEG). This can be really helpful to save
2559 bandwidth when playing videos. Disabling adaptive encodings
2560 restores the original static behavior of encodings like Tight.
2561
2562 ``share=[allow-exclusive|force-shared|ignore]``
2563 Set display sharing policy. 'allow-exclusive' allows clients to
2564 ask for exclusive access. As suggested by the rfb spec this is
2565 implemented by dropping other connections. Connecting multiple
2566 clients in parallel requires all clients asking for a shared
2567 session (vncviewer: -shared switch). This is the default.
2568 'force-shared' disables exclusive client access. Useful for
2569 shared desktop sessions, where you don't want someone forgetting
2570 specify -shared disconnect everybody else. 'ignore' completely
2571 ignores the shared flag and allows everybody connect
2572 unconditionally. Doesn't conform to the rfb spec but is
2573 traditional QEMU behavior.
2574
2575 ``key-delay-ms``
2576 Set keyboard delay, for key down and key up events, in
2577 milliseconds. Default is 10. Keyboards are low-bandwidth
2578 devices, so this slowdown can help the device and guest to keep
2579 up and not lose events in case events are arriving in bulk.
2580 Possible causes for the latter are flaky network connections, or
2581 scripts for automated testing.
2582
2583 ``audiodev=audiodev``
2584 Use the specified audiodev when the VNC client requests audio
2585 transmission. When not using an -audiodev argument, this option
2586 must be omitted, otherwise is must be present and specify a
2587 valid audiodev.
Daniel P. Berrangé7b5fa0b2020-12-11 16:08:25 +00002588
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002589 ``power-control=on|off``
Daniel P. Berrangé7b5fa0b2020-12-11 16:08:25 +00002590 Permit the remote client to issue shutdown, reboot or reset power
2591 control requests.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002592ERST
blueswir15824d652009-03-28 06:44:27 +00002593
Michael Ellermana3adb7a2011-12-19 17:19:31 +11002594ARCHHEADING(, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00002595
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002596ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00002597
blueswir15824d652009-03-28 06:44:27 +00002598DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack,
Blue Swirlad960902010-03-29 19:23:52 +00002599 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n",
2600 QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002601SRST
2602``-win2k-hack``
2603 Use it when installing Windows 2000 to avoid a disk full bug. After
2604 Windows 2000 is installed, you no longer need this option (this
2605 option slows down the IDE transfers).
2606ERST
blueswir15824d652009-03-28 06:44:27 +00002607
blueswir15824d652009-03-28 06:44:27 +00002608DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
Blue Swirlad960902010-03-29 19:23:52 +00002609 "-no-fd-bootchk disable boot signature checking for floppy disks\n",
2610 QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002611SRST
2612``-no-fd-bootchk``
2613 Disable boot signature checking for floppy disks in BIOS. May be
2614 needed to boot from old floppy disks.
2615ERST
blueswir15824d652009-03-28 06:44:27 +00002616
blueswir15824d652009-03-28 06:44:27 +00002617DEF("no-acpi", 0, QEMU_OPTION_no_acpi,
Shannon Zhaof5d8c8c2015-05-29 11:28:54 +01002618 "-no-acpi disable ACPI\n", QEMU_ARCH_I386 | QEMU_ARCH_ARM)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002619SRST
2620``-no-acpi``
2621 Disable ACPI (Advanced Configuration and Power Interface) support.
2622 Use it if your guest OS complains about ACPI problems (PC target
2623 machine only).
2624ERST
blueswir15824d652009-03-28 06:44:27 +00002625
blueswir15824d652009-03-28 06:44:27 +00002626DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
Blue Swirlad960902010-03-29 19:23:52 +00002627 "-no-hpet disable HPET\n", QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002628SRST
2629``-no-hpet``
Thomas Huthdf373302022-12-29 12:49:13 +01002630 Disable HPET support. Deprecated, use '-machine hpet=off' instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002631ERST
blueswir15824d652009-03-28 06:44:27 +00002632
blueswir15824d652009-03-28 06:44:27 +00002633DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
Michael Tokarev104bf022011-05-12 18:44:17 +04002634 "-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 +00002635 " ACPI table description\n", QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002636SRST
2637``-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]...]``
2638 Add ACPI table with specified header fields and context from
2639 specified files. For file=, take whole ACPI table from the specified
2640 files, including all ACPI headers (possible overridden by other
2641 options). For data=, only data portion of the table is used, all
2642 header information is specified in the command line. If a SLIC table
2643 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id
2644 fields will override the same in the RSDT and the FADT (a.k.a.
2645 FACP), in order to ensure the field matches required by the
2646 Microsoft SLIC spec and the ACPI spec.
2647ERST
blueswir15824d652009-03-28 06:44:27 +00002648
aliguorib6f6e3d2009-04-17 18:59:56 +00002649DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
2650 "-smbios file=binary\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002651 " load SMBIOS entry from binary file\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002652 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
2653 " [,uefi=on|off]\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002654 " specify SMBIOS type 0 fields\n"
aliguorib6f6e3d2009-04-17 18:59:56 +00002655 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
2656 " [,uuid=uuid][,sku=str][,family=str]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002657 " specify SMBIOS type 1 fields\n"
2658 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
2659 " [,asset=str][,location=str]\n"
2660 " specify SMBIOS type 2 fields\n"
2661 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n"
2662 " [,sku=str]\n"
2663 " specify SMBIOS type 3 fields\n"
2664 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
Ying Fangc906e032020-08-06 11:56:33 +08002665 " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n"
Patrick Venturecb5fb042022-01-25 08:31:18 -08002666 " [,processor-id=%d]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002667 " specify SMBIOS type 4 fields\n"
Hal Martinfd8caa22022-08-12 15:51:53 +02002668 "-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n"
2669 " specify SMBIOS type 8 fields\n"
Daniel P. Berrangé48a7ff42020-09-23 14:38:04 +01002670 "-smbios type=11[,value=str][,path=filename]\n"
2671 " specify SMBIOS type 11 fields\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002672 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04002673 " [,asset=str][,part=str][,speed=%d]\n"
Vincent Bernat05dfb442021-04-01 19:11:38 +02002674 " specify SMBIOS type 17 fields\n"
2675 "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n"
2676 " specify SMBIOS type 41 fields\n",
Song Gao4934cc52023-02-07 17:04:06 +08002677 QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002678SRST
2679``-smbios file=binary``
2680 Load SMBIOS entry from binary file.
2681
2682``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]``
2683 Specify SMBIOS type 0 fields
2684
2685``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]``
2686 Specify SMBIOS type 1 fields
2687
2688``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]``
2689 Specify SMBIOS type 2 fields
2690
2691``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
2692 Specify SMBIOS type 3 fields
2693
Patrick Venturecb5fb042022-01-25 08:31:18 -08002694``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-id=%d]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002695 Specify SMBIOS type 4 fields
2696
Daniel P. Berrangé48a7ff42020-09-23 14:38:04 +01002697``-smbios type=11[,value=str][,path=filename]``
2698 Specify SMBIOS type 11 fields
2699
2700 This argument can be repeated multiple times, and values are added in the order they are parsed.
2701 Applications intending to use OEM strings data are encouraged to use their application name as
2702 a prefix for the value string. This facilitates passing information for multiple applications
2703 concurrently.
2704
2705 The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax
2706 loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes.
2707
2708 Both the ``value`` and ``path`` options can be repeated multiple times and will be added to
2709 the SMBIOS table in the order in which they appear.
2710
2711 Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535
2712 bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the
2713 guest. Instead it should be used as a indicator to inform the guest where to locate the real
2714 data set, for example, by specifying the serial ID of a block device.
2715
2716 An example passing three strings is
2717
2718 .. parsed-literal::
2719
2720 -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\
2721 value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\
2722 path=/some/file/with/oemstringsdata.txt
2723
2724 In the guest OS this is visible with the ``dmidecode`` command
2725
2726 .. parsed-literal::
2727
2728 $ dmidecode -t 11
2729 Handle 0x0E00, DMI type 11, 5 bytes
2730 OEM Strings
2731 String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/
2732 String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os
2733 String 3: myapp:some extra data
2734
2735
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002736``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]``
2737 Specify SMBIOS type 17 fields
Vincent Bernat05dfb442021-04-01 19:11:38 +02002738
2739``-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]``
2740 Specify SMBIOS type 41 fields
2741
2742 This argument can be repeated multiple times. Its main use is to allow network interfaces be created
2743 as ``enoX`` on Linux, with X being the instance number, instead of the name depending on the interface
2744 position on the PCI bus.
2745
2746 Here is an example of use:
2747
2748 .. parsed-literal::
2749
2750 -netdev user,id=internet \\
2751 -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \\
2752 -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev
2753
2754 In the guest OS, the device should then appear as ``eno1``:
2755
2756 ..parsed-literal::
2757
2758 $ ip -brief l
2759 lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
2760 eno1 UP 50:54:00:00:00:42 <BROADCAST,MULTICAST,UP,LOWER_UP>
2761
2762 Currently, the PCI device has to be attached to the root bus.
2763
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002764ERST
aliguorib6f6e3d2009-04-17 18:59:56 +00002765
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01002766DEFHEADING()
blueswir15824d652009-03-28 06:44:27 +00002767
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002768DEFHEADING(Network options:)
blueswir15824d652009-03-28 06:44:27 +00002769
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002770DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
blueswir15824d652009-03-28 06:44:27 +00002771#ifdef CONFIG_SLIRP
Daniel P. Berrangé8b0dc242021-02-16 19:10:21 +00002772 "-netdev user,id=str[,ipv4=on|off][,net=addr[/mask]][,host=addr]\n"
2773 " [,ipv6=on|off][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
Samuel Thibault0b11c032016-03-20 12:29:54 +01002774 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
Benjamin Drungf18d1372018-02-27 17:06:01 +01002775 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n"
Fam Zheng0fca92b2018-09-14 15:26:16 +08002776 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
Jan Kiszkaad196a92009-06-24 14:42:28 +02002777#ifndef _WIN32
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02002778 "[,smb=dir[,smbserver=addr]]\n"
Jan Kiszkaad196a92009-06-24 14:42:28 +02002779#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002780 " configure a user mode network backend with ID 'str',\n"
2781 " its DHCP server and optional services\n"
blueswir15824d652009-03-28 06:44:27 +00002782#endif
2783#ifdef _WIN32
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002784 "-netdev tap,id=str,ifname=name\n"
2785 " configure a host TAP network backend with ID 'str'\n"
blueswir15824d652009-03-28 06:44:27 +00002786#else
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002787 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10002788 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002789 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
Jason Wang69e87b32016-07-06 09:57:55 +08002790 " [,poll-us=n]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002791 " configure a host TAP network backend with ID 'str'\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10002792 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002793 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
2794 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
2795 " to deconfigure it\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002796 " use '[down]script=no' to disable script execution\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002797 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
2798 " configure it\n"
blueswir15824d652009-03-28 06:44:27 +00002799 " use 'fd=h' to connect to an already opened TAP interface\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08002800 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002801 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
Michael S. Tsirkinf157ed22011-02-01 14:25:40 +02002802 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002803 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
2804 " 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 +02002805 " use vhost=on to enable experimental in kernel accelerator\n"
mst@redhat.com5430a282011-02-01 22:13:42 +02002806 " (only has effect for virtio guests which use MSIX)\n"
2807 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02002808 " use 'vhostfd=h' to connect to an already opened vhost net device\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08002809 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
Jason Wangec396012013-02-22 22:57:52 +08002810 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
Michael Tokarevcba42d62021-03-09 14:15:10 +03002811 " use 'poll-us=n' to specify the maximum number of microseconds that could be\n"
Jason Wang69e87b32016-07-06 09:57:55 +08002812 " spent on busy polling for vhost net\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002813 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
2814 " configure a host TAP network backend with ID 'str' that is\n"
2815 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
2816 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
Mark McLoughlin0df0ff62009-06-18 18:21:34 +01002817#endif
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002818#ifdef __linux__
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002819 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"
Daniel P. Berrangé8b0dc242021-02-16 19:10:21 +00002820 " [,rxsession=rxsession],txsession=txsession[,ipv6=on|off][,udp=on|off]\n"
2821 " [,cookie64=on|off][,counter][,pincounter][,txcookie=txcookie]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002822 " [,rxcookie=rxcookie][,offset=offset]\n"
2823 " configure a network backend with ID 'str' connected to\n"
2824 " an Ethernet over L2TPv3 pseudowire.\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002825 " Linux kernel 3.3+ as well as most routers can talk\n"
Michael Tokarev2f47b402014-07-24 20:10:17 +04002826 " L2TPv3. This transport allows connecting a VM to a VM,\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002827 " VM to a router and even VM to Host. It is a nearly-universal\n"
Stefan Hajnoczi21843dc2020-02-29 11:17:27 +00002828 " standard (RFC3931). Note - this implementation uses static\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002829 " pre-configured tunnels (same as the Linux kernel).\n"
2830 " use 'src=' to specify source address\n"
2831 " use 'dst=' to specify destination address\n"
2832 " use 'udp=on' to specify udp encapsulation\n"
Gonglei39526512014-08-14 14:35:48 +08002833 " use 'srcport=' to specify source udp port\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002834 " use 'dstport=' to specify destination udp port\n"
2835 " use 'ipv6=on' to force v6\n"
2836 " L2TPv3 uses cookies to prevent misconfiguration as\n"
2837 " well as a weak security measure\n"
2838 " use 'rxcookie=0x012345678' to specify a rxcookie\n"
2839 " use 'txcookie=0x012345678' to specify a txcookie\n"
2840 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n"
2841 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n"
2842 " use 'pincounter=on' to work around broken counter handling in peer\n"
2843 " use 'offset=X' to add an extra offset between header and data\n"
2844#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002845 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n"
2846 " configure a network backend to connect to another network\n"
2847 " using a socket connection\n"
2848 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
2849 " configure a network backend to connect to a multicast maddr and port\n"
Mike Ryan3a75e742010-12-01 11:16:47 -08002850 " use 'localaddr=addr' to specify the host address to send packets from\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002851 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
2852 " configure a network backend to connect to another network\n"
2853 " using an UDP tunnel\n"
Laurent Vivier148fbf02023-01-19 11:16:45 +01002854 "-netdev stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port[,to=maxport][,numeric=on|off][,keep-alive=on|off][,mptcp=on|off][,addr.ipv4=on|off][,addr.ipv6=on|off][,reconnect=seconds]\n"
2855 "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect=seconds]\n"
2856 "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect=seconds]\n"
Laurent Vivier5166fe02022-10-21 11:09:11 +02002857 " configure a network backend to connect to another network\n"
2858 " using a socket connection in stream mode.\n"
2859 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]\n"
2860 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]\n"
2861 " configure a network backend to connect to a multicast maddr and port\n"
2862 " use ``local.host=addr`` to specify the host address to send packets from\n"
2863 "-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]\n"
Laurent Vivier784e7a22022-10-21 11:09:17 +02002864 "-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]\n"
Laurent Vivier5166fe02022-10-21 11:09:11 +02002865 "-netdev dgram,id=str,local.type=fd,local.str=file-descriptor\n"
2866 " configure a network backend to connect to another network\n"
2867 " using an UDP tunnel\n"
blueswir15824d652009-03-28 06:44:27 +00002868#ifdef CONFIG_VDE
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002869 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
2870 " configure a network backend to connect to port 'n' of a vde switch\n"
2871 " running on host and listening for incoming connections on 'socketpath'.\n"
blueswir15824d652009-03-28 06:44:27 +00002872 " Use group 'groupname' and mode 'octalmode' to change default\n"
2873 " ownership and permissions for communication port.\n"
2874#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002875#ifdef CONFIG_NETMAP
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002876 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n"
Vincenzo Maffione58952132013-11-06 11:44:06 +01002877 " attach to the existing netmap-enabled network interface 'name', or to a\n"
2878 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n"
2879 " netmap device, defaults to '/dev/netmap')\n"
2880#endif
Thomas Huth253dc142018-02-21 11:18:32 +01002881#ifdef CONFIG_POSIX
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002882 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
2883 " configure a vhost-user network, backed by a chardev 'dev'\n"
Thomas Huth253dc142018-02-21 11:18:32 +01002884#endif
Cindy Lu108a6482020-07-01 22:55:37 +08002885#ifdef __linux__
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07002886 "-netdev vhost-vdpa,id=str[,vhostdev=/path/to/dev][,vhostfd=h]\n"
Cindy Lu108a6482020-07-01 22:55:37 +08002887 " configure a vhost-vdpa network,Establish a vhost-vdpa netdev\n"
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07002888 " use 'vhostdev=/path/to/dev' to open a vhost vdpa device\n"
2889 " use 'vhostfd=h' to connect to an already opened vhost vdpa device\n"
Cindy Lu108a6482020-07-01 22:55:37 +08002890#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03002891#ifdef CONFIG_VMNET
2892 "-netdev vmnet-host,id=str[,isolated=on|off][,net-uuid=uuid]\n"
2893 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n"
2894 " configure a vmnet network backend in host mode with ID 'str',\n"
2895 " isolate this interface from others with 'isolated',\n"
2896 " configure the address range and choose a subnet mask,\n"
2897 " specify network UUID 'uuid' to disable DHCP and interact with\n"
2898 " vmnet-host interfaces within this isolated network\n"
2899 "-netdev vmnet-shared,id=str[,isolated=on|off][,nat66-prefix=addr]\n"
2900 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n"
2901 " configure a vmnet network backend in shared mode with ID 'str',\n"
2902 " configure the address range and choose a subnet mask,\n"
2903 " set IPv6 ULA prefix (of length 64) to use for internal network,\n"
2904 " isolate this interface from others with 'isolated'\n"
2905 "-netdev vmnet-bridged,id=str,ifname=name[,isolated=on|off]\n"
2906 " configure a vmnet network backend in bridged mode with ID 'str',\n"
2907 " use 'ifname=name' to select a physical network interface to be bridged,\n"
2908 " isolate this interface from others with 'isolated'\n"
2909#endif
Thomas Huth18d65d22018-01-15 20:50:55 +01002910 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002911 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL)
Thomas Huth78cd6f72018-02-21 11:18:36 +01002912DEF("nic", HAS_ARG, QEMU_OPTION_nic,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02002913 "-nic [tap|bridge|"
Thomas Huth78cd6f72018-02-21 11:18:36 +01002914#ifdef CONFIG_SLIRP
2915 "user|"
2916#endif
2917#ifdef __linux__
2918 "l2tpv3|"
2919#endif
2920#ifdef CONFIG_VDE
2921 "vde|"
2922#endif
2923#ifdef CONFIG_NETMAP
2924 "netmap|"
2925#endif
2926#ifdef CONFIG_POSIX
2927 "vhost-user|"
2928#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03002929#ifdef CONFIG_VMNET
2930 "vmnet-host|vmnet-shared|vmnet-bridged|"
2931#endif
Thomas Huth78cd6f72018-02-21 11:18:36 +01002932 "socket][,option][,...][mac=macaddr]\n"
2933 " initialize an on-board / default host NIC (using MAC address\n"
2934 " macaddr) and connect it to the given host network backend\n"
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02002935 "-nic none use it alone to have zero network devices (the default is to\n"
Thomas Huth78cd6f72018-02-21 11:18:36 +01002936 " provided a 'user' network connection)\n",
2937 QEMU_ARCH_ALL)
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002938DEF("net", HAS_ARG, QEMU_OPTION_net,
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002939 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
Thomas Huth0e60a822017-12-19 16:28:55 +01002940 " configure or create an on-board (or machine default) NIC and\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002941 " connect it to hub 0 (please use -nic unless you need a hub)\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002942 "-net ["
Mark McLoughlina1ea4582009-10-08 19:58:26 +01002943#ifdef CONFIG_SLIRP
2944 "user|"
2945#endif
2946 "tap|"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002947 "bridge|"
Mark McLoughlina1ea4582009-10-08 19:58:26 +01002948#ifdef CONFIG_VDE
2949 "vde|"
2950#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002951#ifdef CONFIG_NETMAP
2952 "netmap|"
2953#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03002954#ifdef CONFIG_VMNET
2955 "vmnet-host|vmnet-shared|vmnet-bridged|"
2956#endif
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002957 "socket][,option][,option][,...]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002958 " old way to initialize a host network interface\n"
2959 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002960SRST
2961``-nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]``
2962 This option is a shortcut for configuring both the on-board
2963 (default) guest NIC hardware and the host network backend in one go.
2964 The host backend options are the same as with the corresponding
2965 ``-netdev`` options below. The guest NIC model can be set with
2966 ``model=modelname``. Use ``model=help`` to list the available device
2967 types. The hardware MAC address can be set with ``mac=macaddr``.
2968
2969 The following two example do exactly the same, to show how ``-nic``
2970 can be used to shorten the command line length:
2971
2972 .. parsed-literal::
2973
2974 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
2975 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
2976
2977``-nic none``
2978 Indicate that no network devices should be configured. It is used to
2979 override the default configuration (default NIC with "user" host
2980 network backend) which is activated if no other networking options
2981 are provided.
2982
2983``-netdev user,id=id[,option][,option][,...]``
2984 Configure user mode host network backend which requires no
2985 administrator privilege to run. Valid options are:
2986
2987 ``id=id``
2988 Assign symbolic name for use in monitor commands.
2989
2990 ``ipv4=on|off and ipv6=on|off``
2991 Specify that either IPv4 or IPv6 must be enabled. If neither is
2992 specified both protocols are enabled.
2993
2994 ``net=addr[/mask]``
2995 Set IP network address the guest will see. Optionally specify
2996 the netmask, either in the form a.b.c.d or as number of valid
2997 top-most bits. Default is 10.0.2.0/24.
2998
2999 ``host=addr``
3000 Specify the guest-visible address of the host. Default is the
3001 2nd IP in the guest network, i.e. x.x.x.2.
3002
3003 ``ipv6-net=addr[/int]``
3004 Set IPv6 network address the guest will see (default is
3005 fec0::/64). The network prefix is given in the usual hexadecimal
3006 IPv6 address notation. The prefix size is optional, and is given
3007 as the number of valid top-most bits (default is 64).
3008
3009 ``ipv6-host=addr``
3010 Specify the guest-visible IPv6 address of the host. Default is
3011 the 2nd IPv6 in the guest network, i.e. xxxx::2.
3012
3013 ``restrict=on|off``
3014 If this option is enabled, the guest will be isolated, i.e. it
3015 will not be able to contact the host and no guest IP packets
3016 will be routed over the host to the outside. This option does
3017 not affect any explicitly set forwarding rules.
3018
3019 ``hostname=name``
3020 Specifies the client hostname reported by the built-in DHCP
3021 server.
3022
3023 ``dhcpstart=addr``
3024 Specify the first of the 16 IPs the built-in DHCP server can
3025 assign. Default is the 15th to 31st IP in the guest network,
3026 i.e. x.x.x.15 to x.x.x.31.
3027
3028 ``dns=addr``
3029 Specify the guest-visible address of the virtual nameserver. The
3030 address must be different from the host address. Default is the
3031 3rd IP in the guest network, i.e. x.x.x.3.
3032
3033 ``ipv6-dns=addr``
3034 Specify the guest-visible address of the IPv6 virtual
3035 nameserver. The address must be different from the host address.
3036 Default is the 3rd IP in the guest network, i.e. xxxx::3.
3037
3038 ``dnssearch=domain``
3039 Provides an entry for the domain-search list sent by the
3040 built-in DHCP server. More than one domain suffix can be
3041 transmitted by specifying this option multiple times. If
3042 supported, this will cause the guest to automatically try to
3043 append the given domain suffix(es) in case a domain name can not
3044 be resolved.
3045
3046 Example:
3047
3048 .. parsed-literal::
3049
3050 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
3051
3052 ``domainname=domain``
3053 Specifies the client domain name reported by the built-in DHCP
3054 server.
3055
3056 ``tftp=dir``
3057 When using the user mode network stack, activate a built-in TFTP
3058 server. The files in dir will be exposed as the root of a TFTP
3059 server. The TFTP client on the guest must be configured in
3060 binary mode (use the command ``bin`` of the Unix TFTP client).
3061
3062 ``tftp-server-name=name``
3063 In BOOTP reply, broadcast name as the "TFTP server name"
3064 (RFC2132 option 66). This can be used to advise the guest to
3065 load boot files or configurations from a different server than
3066 the host address.
3067
3068 ``bootfile=file``
3069 When using the user mode network stack, broadcast file as the
3070 BOOTP filename. In conjunction with ``tftp``, this can be used
3071 to network boot a guest from a local directory.
3072
3073 Example (using pxelinux):
3074
3075 .. parsed-literal::
3076
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003077 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003078 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
3079
3080 ``smb=dir[,smbserver=addr]``
3081 When using the user mode network stack, activate a built-in SMB
3082 server so that Windows OSes can access to the host files in
3083 ``dir`` transparently. The IP address of the SMB server can be
3084 set to addr. By default the 4th IP in the guest network is used,
3085 i.e. x.x.x.4.
3086
3087 In the guest Windows OS, the line:
3088
3089 ::
3090
3091 10.0.2.4 smbserver
3092
3093 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows
3094 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows
3095 NT/2000).
3096
3097 Then ``dir`` can be accessed in ``\\smbserver\qemu``.
3098
3099 Note that a SAMBA server must be installed on the host OS.
3100
3101 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport``
3102 Redirect incoming TCP or UDP connections to the host port
3103 hostport to the guest IP address guestaddr on guest port
3104 guestport. If guestaddr is not specified, its value is x.x.x.15
3105 (default first address given by the built-in DHCP server). By
3106 specifying hostaddr, the rule can be bound to a specific host
3107 interface. If no connection type is set, TCP is used. This
3108 option can be given multiple times.
3109
3110 For example, to redirect host X11 connection from screen 1 to
3111 guest screen 0, use the following:
3112
Peter Maydell09ce5f22020-02-28 15:36:13 +00003113 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003114
3115 # on the host
3116 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
3117 # this host xterm should open in the guest X11 server
3118 xterm -display :1
3119
3120 To redirect telnet connections from host port 5555 to telnet
3121 port on the guest, use the following:
3122
Peter Maydell09ce5f22020-02-28 15:36:13 +00003123 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003124
3125 # on the host
3126 |qemu_system| -nic user,hostfwd=tcp::5555-:23
3127 telnet localhost 5555
3128
3129 Then when you use on the host ``telnet localhost 5555``, you
3130 connect to the guest telnet server.
3131
3132 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command``
3133 Forward guest TCP connections to the IP address server on port
3134 port to the character device dev or to a program executed by
3135 cmd:command which gets spawned for each connection. This option
3136 can be given multiple times.
3137
3138 You can either use a chardev directly and have that one used
3139 throughout QEMU's lifetime, like in the following example:
3140
Peter Maydell09ce5f22020-02-28 15:36:13 +00003141 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003142
3143 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
3144 # the guest accesses it
3145 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
3146
3147 Or you can execute a command on every TCP connection established
3148 by the guest, so that QEMU behaves similar to an inetd process
3149 for that virtual server:
3150
Peter Maydell09ce5f22020-02-28 15:36:13 +00003151 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003152
3153 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
3154 # and connect the TCP stream to its stdin/stdout
3155 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
3156
3157``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
3158 Configure a host TAP network backend with ID id.
3159
3160 Use the network script file to configure it and the network script
3161 dfile to deconfigure it. If name is not provided, the OS
3162 automatically provides one. The default network configure script is
3163 ``/etc/qemu-ifup`` and the default network deconfigure script is
3164 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to
3165 disable script execution.
3166
3167 If running QEMU as an unprivileged user, use the network helper
Tianjia Zhang8d73ec82020-07-27 12:59:25 +08003168 to configure the TAP interface and attach it to the bridge.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003169 The default network helper executable is
3170 ``/path/to/qemu-bridge-helper`` and the default bridge device is
3171 ``br0``.
3172
3173 ``fd``\ =h can be used to specify the handle of an already opened
3174 host TAP interface.
3175
3176 Examples:
3177
Peter Maydell09ce5f22020-02-28 15:36:13 +00003178 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003179
3180 #launch a QEMU instance with the default network script
3181 |qemu_system| linux.img -nic tap
3182
Peter Maydell09ce5f22020-02-28 15:36:13 +00003183 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003184
3185 #launch a QEMU instance with two NICs, each one connected
3186 #to a TAP device
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003187 |qemu_system| linux.img \\
3188 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003189 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
3190
Peter Maydell09ce5f22020-02-28 15:36:13 +00003191 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003192
3193 #launch a QEMU instance with the default network helper to
3194 #connect a TAP device to bridge br0
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003195 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003196 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
3197
3198``-netdev bridge,id=id[,br=bridge][,helper=helper]``
3199 Connect a host TAP network interface to a host bridge device.
3200
3201 Use the network helper helper to configure the TAP interface and
3202 attach it to the bridge. The default network helper executable is
3203 ``/path/to/qemu-bridge-helper`` and the default bridge device is
3204 ``br0``.
3205
3206 Examples:
3207
Peter Maydell09ce5f22020-02-28 15:36:13 +00003208 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003209
3210 #launch a QEMU instance with the default network helper to
3211 #connect a TAP device to bridge br0
3212 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
3213
Peter Maydell09ce5f22020-02-28 15:36:13 +00003214 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003215
3216 #launch a QEMU instance with the default network helper to
3217 #connect a TAP device to bridge qemubr0
3218 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
3219
3220``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]``
3221 This host network backend can be used to connect the guest's network
3222 to another QEMU virtual machine using a TCP socket connection. If
3223 ``listen`` is specified, QEMU waits for incoming connections on port
3224 (host is optional). ``connect`` is used to connect to another QEMU
3225 instance using the ``listen`` option. ``fd``\ =h specifies an
3226 already opened TCP socket.
3227
3228 Example:
3229
Peter Maydell09ce5f22020-02-28 15:36:13 +00003230 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003231
3232 # launch a first QEMU instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003233 |qemu_system| linux.img \\
3234 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003235 -netdev socket,id=n1,listen=:1234
3236 # connect the network of this instance to the network of the first instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003237 |qemu_system| linux.img \\
3238 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003239 -netdev socket,id=n2,connect=127.0.0.1:1234
3240
3241``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]``
3242 Configure a socket host network backend to share the guest's network
3243 traffic with another QEMU virtual machines using a UDP multicast
3244 socket, effectively making a bus for every QEMU with same multicast
3245 address maddr and port. NOTES:
3246
3247 1. Several QEMU can be running on different hosts and share same bus
3248 (assuming correct multicast setup for these hosts).
3249
3250 2. mcast support is compatible with User Mode Linux (argument
3251 ``ethN=mcast``), see http://user-mode-linux.sf.net.
3252
3253 3. Use ``fd=h`` to specify an already opened UDP multicast socket.
3254
3255 Example:
3256
Peter Maydell09ce5f22020-02-28 15:36:13 +00003257 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003258
3259 # launch one QEMU instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003260 |qemu_system| linux.img \\
3261 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003262 -netdev socket,id=n1,mcast=230.0.0.1:1234
3263 # launch another QEMU instance on same "bus"
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003264 |qemu_system| linux.img \\
3265 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003266 -netdev socket,id=n2,mcast=230.0.0.1:1234
3267 # launch yet another QEMU instance on same "bus"
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003268 |qemu_system| linux.img \\
3269 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003270 -netdev socket,id=n3,mcast=230.0.0.1:1234
3271
3272 Example (User Mode Linux compat.):
3273
Peter Maydell09ce5f22020-02-28 15:36:13 +00003274 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003275
3276 # launch QEMU instance (note mcast address selected is UML's default)
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003277 |qemu_system| linux.img \\
3278 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003279 -netdev socket,id=n1,mcast=239.192.168.1:1102
3280 # launch UML
3281 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
3282
3283 Example (send packets from host's 1.2.3.4):
3284
3285 .. parsed-literal::
3286
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003287 |qemu_system| linux.img \\
3288 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003289 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
3290
Daniel P. Berrangé8b0dc242021-02-16 19:10:21 +00003291``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64][,counter][,pincounter][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003292 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
3293 is a popular protocol to transport Ethernet (and other Layer 2) data
3294 frames between two systems. It is present in routers, firewalls and
3295 the Linux kernel (from version 3.3 onwards).
3296
3297 This transport allows a VM to communicate to another VM, router or
3298 firewall directly.
3299
3300 ``src=srcaddr``
3301 source address (mandatory)
3302
3303 ``dst=dstaddr``
3304 destination address (mandatory)
3305
3306 ``udp``
3307 select udp encapsulation (default is ip).
3308
3309 ``srcport=srcport``
3310 source udp port.
3311
3312 ``dstport=dstport``
3313 destination udp port.
3314
3315 ``ipv6``
3316 force v6, otherwise defaults to v4.
3317
3318 ``rxcookie=rxcookie``; \ ``txcookie=txcookie``
3319 Cookies are a weak form of security in the l2tpv3 specification.
3320 Their function is mostly to prevent misconfiguration. By default
3321 they are 32 bit.
3322
3323 ``cookie64``
3324 Set cookie size to 64 bit instead of the default 32
3325
3326 ``counter=off``
3327 Force a 'cut-down' L2TPv3 with no counter as in
3328 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
3329
3330 ``pincounter=on``
3331 Work around broken counter handling in peer. This may also help
3332 on networks which have packet reorder.
3333
3334 ``offset=offset``
3335 Add an extra offset between header and data
3336
3337 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to
3338 the bridge br-lan on the remote Linux host 1.2.3.4:
3339
Peter Maydell09ce5f22020-02-28 15:36:13 +00003340 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003341
3342 # Setup tunnel on linux host using raw ip as encapsulation
3343 # on 1.2.3.4
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003344 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003345 encap udp udp_sport 16384 udp_dport 16384
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003346 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003347 0xFFFFFFFF peer_session_id 0xFFFFFFFF
3348 ifconfig vmtunnel0 mtu 1500
3349 ifconfig vmtunnel0 up
3350 brctl addif br-lan vmtunnel0
3351
3352
3353 # on 4.3.2.1
3354 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
3355
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003356 |qemu_system| linux.img -device e1000,netdev=n1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003357 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
3358
3359``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
3360 Configure VDE backend to connect to PORT n of a vde switch running
3361 on host and listening for incoming connections on socketpath. Use
3362 GROUP groupname and MODE octalmode to change default ownership and
3363 permissions for communication port. This option is only available if
3364 QEMU has been compiled with vde support enabled.
3365
3366 Example:
3367
Peter Maydell09ce5f22020-02-28 15:36:13 +00003368 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003369
3370 # launch vde switch
3371 vde_switch -F -sock /tmp/myswitch
3372 # launch QEMU instance
3373 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch
3374
3375``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
3376 Establish a vhost-user netdev, backed by a chardev id. The chardev
3377 should be a unix domain socket backed one. The vhost-user uses a
3378 specifically defined protocol to pass vhost ioctl replacement
3379 messages to an application on the other end of the socket. On
3380 non-MSIX guests, the feature can be forced with vhostforce. Use
3381 'queues=n' to specify the number of queues to be created for
3382 multiqueue vhost-user.
3383
3384 Example:
3385
3386 ::
3387
3388 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
3389 -numa node,memdev=mem \
3390 -chardev socket,id=chr0,path=/path/to/socket \
3391 -netdev type=vhost-user,id=net0,chardev=chr0 \
3392 -device virtio-net-pci,netdev=net0
3393
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07003394``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]``
Cindy Lu108a6482020-07-01 22:55:37 +08003395 Establish a vhost-vdpa netdev.
3396
3397 vDPA device is a device that uses a datapath which complies with
3398 the virtio specifications with a vendor specific control path.
3399 vDPA devices can be both physically located on the hardware or
3400 emulated by software.
3401
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003402``-netdev hubport,id=id,hubid=hubid[,netdev=nd]``
3403 Create a hub port on the emulated hub with ID hubid.
3404
3405 The hubport netdev lets you connect a NIC to a QEMU emulated hub
3406 instead of a single netdev. Alternatively, you can also connect the
3407 hubport to another netdev with ID nd by using the ``netdev=nd``
3408 option.
3409
3410``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]``
3411 Legacy option to configure or create an on-board (or machine
3412 default) Network Interface Card(NIC) and connect it either to the
3413 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.
3414 If model is omitted, then the default NIC model associated with the
3415 machine type is used. Note that the default NIC model may change in
3416 future QEMU releases, so it is highly recommended to always specify
3417 a model. Optionally, the MAC address can be changed to mac, the
3418 device address set to addr (PCI cards only), and a name can be
3419 assigned for use in monitor commands. Optionally, for PCI cards, you
3420 can specify the number v of MSI-X vectors that the card should have;
3421 this option currently only affects virtio cards; set v = 0 to
3422 disable MSI-X. If no ``-net`` option is specified, a single NIC is
3423 created. QEMU can emulate several different models of network card.
3424 Use ``-net nic,model=help`` for a list of available devices for your
3425 target.
3426
3427``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]``
3428 Configure a host network backend (with the options corresponding to
3429 the same ``-netdev`` option) and connect it to the emulated hub 0
3430 (the default hub). Use name to specify the name of the hub port.
3431ERST
blueswir15824d652009-03-28 06:44:27 +00003432
Matthew Booth7273a2d2009-10-30 13:41:12 +00003433DEFHEADING()
3434
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003435DEFHEADING(Character device options:)
Matthew Booth7273a2d2009-10-30 13:41:12 +00003436
3437DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
Lin Ma517b3d42016-08-17 01:13:52 +08003438 "-chardev help\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003439 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Markus Armbrusterba858d12021-09-28 09:14:49 +02003440 "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]\n"
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003441 " [,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect=seconds][,mux=on|off]\n"
Daniel P. Berrangefd4a5fd2019-03-08 15:21:50 +00003442 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n"
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003443 "-chardev socket,id=id,path=path[,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect=seconds]\n"
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003444 " [,mux=on|off][,logfile=PATH][,logappend=on|off][,abstract=on|off][,tight=on|off] (unix)\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003445 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003446 " [,localport=localport][,ipv4=on|off][,ipv6=on|off][,mux=on|off]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003447 " [,logfile=PATH][,logappend=on|off]\n"
3448 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003449 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003450 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3451 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003452 "-chardev file,id=id,path=path[,input-path=input-file][,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003453 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003454#ifdef _WIN32
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003455 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3456 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003457#else
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003458 "-chardev pty,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3459 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003460#endif
3461#ifdef CONFIG_BRLAPI
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003462 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003463#endif
3464#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
3465 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003466 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003467#endif
3468#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003469 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003470#endif
Alon Levycbcc6332011-01-19 10:49:50 +02003471#if defined(CONFIG_SPICE)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003472 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
3473 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
Alon Levycbcc6332011-01-19 10:49:50 +02003474#endif
Blue Swirlad960902010-03-29 19:23:52 +00003475 , QEMU_ARCH_ALL
Matthew Booth7273a2d2009-10-30 13:41:12 +00003476)
3477
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003478SRST
3479The general form of a character device option is:
3480
3481``-chardev backend,id=id[,mux=on|off][,options]``
3482 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
3483 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
Paolo Bonzini6f9f6302022-12-16 10:56:53 +01003484 ``pty``, ``stdio``, ``braille``, ``parallel``,
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003485 ``spicevmc``, ``spiceport``. The specific backend will determine the
3486 applicable options.
3487
3488 Use ``-chardev help`` to print all available chardev backend types.
3489
3490 All devices must have an id, which can be any string up to 127
3491 characters long. It is used to uniquely identify this device in
3492 other command line directives.
3493
3494 A character device may be used in multiplexing mode by multiple
3495 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is
3496 a "1:N" device, and here the "1" end is your specified chardev
3497 backend, and the "N" end is the various parts of QEMU that can talk
3498 to a chardev. If you create a chardev with ``id=myid`` and
3499 ``mux=on``, QEMU will create a multiplexer with your specified ID,
3500 and you can then configure multiple front ends to use that chardev
3501 ID for their input/output. Up to four different front ends can be
3502 connected to a single multiplexed chardev. (Without multiplexing
3503 enabled, a chardev can only be used by a single front end.) For
3504 instance you could use this to allow a single stdio chardev to be
3505 used by two serial ports and the QEMU monitor:
3506
3507 ::
3508
3509 -chardev stdio,mux=on,id=char0 \
3510 -mon chardev=char0,mode=readline \
3511 -serial chardev:char0 \
3512 -serial chardev:char0
3513
3514 You can have more than one multiplexer in a system configuration;
3515 for instance you could have a TCP port multiplexed between UART 0
3516 and UART 1, and stdio multiplexed between the QEMU monitor and a
3517 parallel port:
3518
3519 ::
3520
3521 -chardev stdio,mux=on,id=char0 \
3522 -mon chardev=char0,mode=readline \
3523 -parallel chardev:char0 \
3524 -chardev tcp,...,mux=on,id=char1 \
3525 -serial chardev:char1 \
3526 -serial chardev:char1
3527
3528 When you're using a multiplexed character device, some escape
Thomas Huth923e9312020-11-16 15:47:36 +01003529 sequences are interpreted in the input. See the chapter about
3530 :ref:`keys in the character backend multiplexer` in the
3531 System Emulation Users Guide for more details.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003532
3533 Note that some other command line options may implicitly create
3534 multiplexed character backends; for instance ``-serial mon:stdio``
3535 creates a multiplexed stdio backend connected to the serial port and
3536 the QEMU monitor, and ``-nographic`` also multiplexes the console
3537 and the monitor to stdio.
3538
3539 There is currently no support for multiplexing in the other
3540 direction (where a single QEMU front end takes input and output from
3541 multiple chardevs).
3542
3543 Every backend supports the ``logfile`` option, which supplies the
3544 path to a file to record all data transmitted via the backend. The
3545 ``logappend`` option controls whether the log file will be truncated
3546 or appended to when opened.
3547
3548The available backends are:
3549
3550``-chardev null,id=id``
3551 A void device. This device will not emit any data, and will drop any
3552 data it receives. The null backend does not take any options.
3553
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003554``-chardev socket,id=id[,TCP options or unix options][,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect=seconds][,tls-creds=id][,tls-authz=id]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003555 Create a two-way stream socket, which can be either a TCP or a unix
3556 socket. A unix socket will be created if ``path`` is specified.
3557 Behaviour is undefined if TCP options are specified for a unix
3558 socket.
3559
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003560 ``server=on|off`` specifies that the socket shall be a listening socket.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003561
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003562 ``wait=on|off`` specifies that QEMU should not block waiting for a client
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003563 to connect to a listening socket.
3564
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003565 ``telnet=on|off`` specifies that traffic on the socket should interpret
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003566 telnet escape sequences.
3567
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003568 ``websocket=on|off`` specifies that the socket uses WebSocket protocol for
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003569 communication.
3570
3571 ``reconnect`` sets the timeout for reconnecting on non-server
3572 sockets when the remote end goes away. qemu will delay this many
3573 seconds and then attempt to reconnect. Zero disables reconnecting,
3574 and is the default.
3575
3576 ``tls-creds`` requests enablement of the TLS protocol for
3577 encryption, and specifies the id of the TLS credentials to use for
3578 the handshake. The credentials must be previously created with the
3579 ``-object tls-creds`` argument.
3580
3581 ``tls-auth`` provides the ID of the QAuthZ authorization object
3582 against which the client's x509 distinguished name will be
3583 validated. This object is only resolved at time of use, so can be
3584 deleted and recreated on the fly while the chardev server is active.
3585 If missing, it will default to denying access.
3586
3587 TCP and unix socket options are given below:
3588
Paolo Bonzinia9b13152021-02-25 11:47:52 +01003589 ``TCP options: port=port[,host=host][,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003590 ``host`` for a listening socket specifies the local address to
3591 be bound. For a connecting socket species the remote host to
3592 connect to. ``host`` is optional for listening sockets. If not
3593 specified it defaults to ``0.0.0.0``.
3594
3595 ``port`` for a listening socket specifies the local port to be
3596 bound. For a connecting socket specifies the port on the remote
3597 host to connect to. ``port`` can be given as either a port
3598 number or a service name. ``port`` is required.
3599
3600 ``to`` is only relevant to listening sockets. If it is
3601 specified, and ``port`` cannot be bound, QEMU will attempt to
3602 bind to subsequent ports up to and including ``to`` until it
3603 succeeds. ``to`` must be specified as a port number.
3604
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003605 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4
3606 or IPv6 must be used. If neither is specified the socket may
3607 use either protocol.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003608
Paolo Bonzinia9b13152021-02-25 11:47:52 +01003609 ``nodelay=on|off`` disables the Nagle algorithm.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003610
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003611 ``unix options: path=path[,abstract=on|off][,tight=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003612 ``path`` specifies the local path of the unix socket. ``path``
3613 is required.
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003614 ``abstract=on|off`` specifies the use of the abstract socket namespace,
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003615 rather than the filesystem. Optional, defaults to false.
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003616 ``tight=on|off`` sets the socket length of abstract sockets to their minimum,
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003617 rather than the full sun_path length. Optional, defaults to true.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003618
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003619``-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4=on|off][,ipv6=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003620 Sends all traffic from the guest to a remote host over UDP.
3621
3622 ``host`` specifies the remote host to connect to. If not specified
3623 it defaults to ``localhost``.
3624
3625 ``port`` specifies the port on the remote host to connect to.
3626 ``port`` is required.
3627
3628 ``localaddr`` specifies the local address to bind to. If not
3629 specified it defaults to ``0.0.0.0``.
3630
3631 ``localport`` specifies the local port to bind to. If not specified
3632 any available local port will be used.
3633
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003634 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 or IPv6 must be used.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003635 If neither is specified the device may use either protocol.
3636
3637``-chardev msmouse,id=id``
3638 Forward QEMU's emulated msmouse events to the guest. ``msmouse``
3639 does not take any options.
3640
3641``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]``
3642 Connect to a QEMU text console. ``vc`` may optionally be given a
3643 specific size.
3644
3645 ``width`` and ``height`` specify the width and height respectively
3646 of the console, in pixels.
3647
3648 ``cols`` and ``rows`` specify that the console be sized to fit a
3649 text console with the given dimensions.
3650
3651``-chardev ringbuf,id=id[,size=size]``
3652 Create a ring buffer with fixed size ``size``. size must be a power
3653 of two and defaults to ``64K``.
3654
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003655``-chardev file,id=id,path=path[,input-path=input-path]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003656 Log all traffic received from the guest to a file.
3657
3658 ``path`` specifies the path of the file to be opened. This file will
3659 be created if it does not already exist, and overwritten if it does.
3660 ``path`` is required.
3661
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003662 If ``input-path`` is specified, this is the path of a second file
3663 which will be used for input. If ``input-path`` is not specified,
3664 no input will be available from the chardev.
3665
3666 Note that ``input-path`` is not supported on Windows hosts.
3667
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003668``-chardev pipe,id=id,path=path``
3669 Create a two-way connection to the guest. The behaviour differs
3670 slightly between Windows hosts and other hosts:
3671
3672 On Windows, a single duplex pipe will be created at
3673 ``\\.pipe\path``.
3674
3675 On other hosts, 2 pipes will be created called ``path.in`` and
3676 ``path.out``. Data written to ``path.in`` will be received by the
3677 guest. Data written by the guest can be read from ``path.out``. QEMU
3678 will not create these fifos, and requires them to be present.
3679
3680 ``path`` forms part of the pipe path as described above. ``path`` is
3681 required.
3682
3683``-chardev console,id=id``
3684 Send traffic from the guest to QEMU's standard output. ``console``
3685 does not take any options.
3686
3687 ``console`` is only available on Windows hosts.
3688
3689``-chardev serial,id=id,path=path``
3690 Send traffic from the guest to a serial device on the host.
3691
3692 On Unix hosts serial will actually accept any tty device, not only
3693 serial lines.
3694
3695 ``path`` specifies the name of the serial device to open.
3696
3697``-chardev pty,id=id``
3698 Create a new pseudo-terminal on the host and connect to it. ``pty``
3699 does not take any options.
3700
3701 ``pty`` is not available on Windows hosts.
3702
3703``-chardev stdio,id=id[,signal=on|off]``
3704 Connect to standard input and standard output of the QEMU process.
3705
3706 ``signal`` controls if signals are enabled on the terminal, that
3707 includes exiting QEMU with the key sequence Control-c. This option
3708 is enabled by default, use ``signal=off`` to disable it.
3709
3710``-chardev braille,id=id``
3711 Connect to a local BrlAPI server. ``braille`` does not take any
3712 options.
3713
Peter Maydell09ce5f22020-02-28 15:36:13 +00003714``-chardev parallel,id=id,path=path``
3715 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003716 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
3717 hosts.
3718
3719 Connect to a local parallel port.
3720
3721 ``path`` specifies the path to the parallel port device. ``path`` is
3722 required.
3723
3724``-chardev spicevmc,id=id,debug=debug,name=name``
3725 ``spicevmc`` is only available when spice support is built in.
3726
3727 ``debug`` debug level for spicevmc
3728
3729 ``name`` name of spice channel to connect to
3730
3731 Connect to a spice virtual machine channel, such as vdiport.
3732
3733``-chardev spiceport,id=id,debug=debug,name=name``
3734 ``spiceport`` is only available when spice support is built in.
3735
3736 ``debug`` debug level for spicevmc
3737
3738 ``name`` name of spice port to connect to
3739
3740 Connect to a spice port, allowing a Spice client to handle the
3741 traffic identified by a name (preferably a fqdn).
3742ERST
Matthew Booth7273a2d2009-10-30 13:41:12 +00003743
3744DEFHEADING()
3745
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003746#ifdef CONFIG_TPM
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003747DEFHEADING(TPM device options:)
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003748
3749DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
Stefan Berger92dcc232013-02-27 12:47:54 -05003750 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
3751 " use path to provide path to a character device; default is /dev/tpm0\n"
3752 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
Amarnath Vallurif4ede812017-09-29 14:10:20 +03003753 " not provided it will be searched for in /sys/class/misc/tpm?/device\n"
3754 "-tpmdev emulator,id=id,chardev=dev\n"
3755 " configure the TPM device using chardev backend\n",
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003756 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003757SRST
3758The general form of a TPM device option is:
3759
3760``-tpmdev backend,id=id[,options]``
3761 The specific backend type will determine the applicable options. The
3762 ``-tpmdev`` option creates the TPM backend and requires a
3763 ``-device`` option that specifies the TPM frontend interface model.
3764
3765 Use ``-tpmdev help`` to print all available TPM backend types.
3766
3767The available backends are:
3768
3769``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path``
3770 (Linux-host only) Enable access to the host's TPM using the
3771 passthrough driver.
3772
3773 ``path`` specifies the path to the host's TPM device, i.e., on a
3774 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by
3775 default ``/dev/tpm0`` is used.
3776
3777 ``cancel-path`` specifies the path to the host TPM device's sysfs
3778 entry allowing for cancellation of an ongoing TPM command.
3779 ``cancel-path`` is optional and by default QEMU will search for the
3780 sysfs entry to use.
3781
3782 Some notes about using the host's TPM with the passthrough driver:
3783
3784 The TPM device accessed by the passthrough driver must not be used
3785 by any other application on the host.
3786
3787 Since the host's firmware (BIOS/UEFI) has already initialized the
3788 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize
3789 the TPM again and may therefore not show a TPM-specific menu that
3790 would otherwise allow the user to configure the TPM, e.g., allow the
3791 user to enable/disable or activate/deactivate the TPM. Further, if
3792 TPM ownership is released from within a VM then the host's TPM will
3793 get disabled and deactivated. To enable and activate the TPM again
3794 afterwards, the host has to be rebooted and the user is required to
3795 enter the firmware's menu to enable and activate the TPM. If the TPM
3796 is left disabled and/or deactivated most TPM commands will fail.
3797
3798 To create a passthrough TPM use the following two options:
3799
3800 ::
3801
3802 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
3803
3804 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by
3805 ``tpmdev=tpm0`` in the device option.
3806
3807``-tpmdev emulator,id=id,chardev=dev``
3808 (Linux-host only) Enable access to a TPM emulator using Unix domain
3809 socket based chardev backend.
3810
3811 ``chardev`` specifies the unique ID of a character device backend
3812 that provides connection to the software TPM server.
3813
3814 To create a TPM emulator backend device with chardev socket backend:
3815
3816 ::
3817
3818 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
3819ERST
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003820
3821DEFHEADING()
3822
3823#endif
3824
Alex Bennée1235cf72022-07-25 15:05:20 +01003825DEFHEADING(Boot Image or Kernel specific:)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003826SRST
Alex Bennée1235cf72022-07-25 15:05:20 +01003827There are broadly 4 ways you can boot a system with QEMU.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003828
Alex Bennée1235cf72022-07-25 15:05:20 +01003829 - specify a firmware and let it control finding a kernel
3830 - specify a firmware and pass a hint to the kernel to boot
3831 - direct kernel image boot
3832 - manually load files into the guest's address space
3833
3834The third method is useful for quickly testing kernels but as there is
3835no firmware to pass configuration information to the kernel the
3836hardware must either be probeable, the kernel built for the exact
3837configuration or passed some configuration data (e.g. a DTB blob)
3838which tells the kernel what drivers it needs. This exact details are
3839often hardware specific.
3840
3841The final method is the most generic way of loading images into the
3842guest address space and used mostly for ``bare metal`` type
3843development where the reset vectors of the processor are taken into
3844account.
3845
3846ERST
3847
3848SRST
3849
3850For x86 machines and some other architectures ``-bios`` will generally
3851do the right thing with whatever it is given. For other machines the
3852more strict ``-pflash`` option needs an image that is sized for the
3853flash device for the given machine type.
3854
3855Please see the :ref:`system-targets-ref` section of the manual for
3856more detailed documentation.
3857
3858ERST
3859
3860DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
3861 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL)
3862SRST
3863``-bios file``
3864 Set the filename for the BIOS.
3865ERST
3866
3867DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
3868 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
3869SRST
3870``-pflash file``
3871 Use file as a parallel flash image.
3872ERST
3873
3874SRST
3875
3876The kernel options were designed to work with Linux kernels although
3877other things (like hypervisors) can be packaged up as a kernel
3878executable image. The exact format of a executable image is usually
3879architecture specific.
3880
3881The way in which the kernel is started (what address it is loaded at,
3882what if any information is passed to it via CPU registers, the state
3883of the hardware when it is started, and so on) is also architecture
3884specific. Typically it follows the specification laid down by the
3885Linux kernel for how kernels for that architecture must be started.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003886
3887ERST
blueswir15824d652009-03-28 06:44:27 +00003888
3889DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
Blue Swirlad960902010-03-29 19:23:52 +00003890 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003891SRST
3892``-kernel bzImage``
3893 Use bzImage as kernel image. The kernel can be either a Linux kernel
3894 or in multiboot format.
3895ERST
blueswir15824d652009-03-28 06:44:27 +00003896
3897DEF("append", HAS_ARG, QEMU_OPTION_append, \
Blue Swirlad960902010-03-29 19:23:52 +00003898 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003899SRST
3900``-append cmdline``
3901 Use cmdline as kernel command line
3902ERST
blueswir15824d652009-03-28 06:44:27 +00003903
3904DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
Blue Swirlad960902010-03-29 19:23:52 +00003905 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003906SRST
3907``-initrd file``
3908 Use file as initial ram disk.
3909
3910``-initrd "file1 arg=foo,file2"``
3911 This syntax is only available with multiboot.
3912
3913 Use file1 and file2 as modules and pass arg=foo as parameter to the
3914 first module.
3915ERST
blueswir15824d652009-03-28 06:44:27 +00003916
Grant Likely412beee2012-03-02 11:56:38 +00003917DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \
Peter A. G. Crosthwaite379b5c72012-03-04 21:03:54 +10003918 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003919SRST
3920``-dtb file``
3921 Use file as a device tree binary (dtb) image and pass it to the
3922 kernel on boot.
3923ERST
Grant Likely412beee2012-03-02 11:56:38 +00003924
Alex Bennée1235cf72022-07-25 15:05:20 +01003925SRST
3926
3927Finally you can also manually load images directly into the address
3928space of the guest. This is most useful for developers who already
3929know the layout of their guest and take care to ensure something sane
3930will happen when the reset vector executes.
3931
3932The generic loader can be invoked by using the loader device:
3933
3934``-device loader,addr=<addr>,data=<data>,data-len=<data-len>[,data-be=<data-be>][,cpu-num=<cpu-num>]``
3935
3936there is also the guest loader which operates in a similar way but
3937tweaks the DTB so a hypervisor loaded via ``-kernel`` can find where
3938the guest image is:
3939
3940``-device guest-loader,addr=<addr>[,kernel=<path>,[bootargs=<arguments>]][,initrd=<path>]``
3941
3942ERST
3943
blueswir15824d652009-03-28 06:44:27 +00003944DEFHEADING()
3945
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003946DEFHEADING(Debug/Expert options:)
blueswir15824d652009-03-28 06:44:27 +00003947
Markus Armbruster6dd75472021-03-18 16:55:10 +01003948DEF("compat", HAS_ARG, QEMU_OPTION_compat,
Markus Armbrusterdbb675c2021-03-18 16:55:19 +01003949 "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n"
Markus Armbruster57df0df2021-10-28 12:25:20 +02003950 " Policy for handling deprecated management interfaces\n"
3951 "-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n"
3952 " Policy for handling unstable management interfaces\n",
Markus Armbruster6dd75472021-03-18 16:55:10 +01003953 QEMU_ARCH_ALL)
3954SRST
3955``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]``
3956 Set policy for handling deprecated management interfaces (experimental):
3957
3958 ``deprecated-input=accept`` (default)
3959 Accept deprecated commands and arguments
3960 ``deprecated-input=reject``
3961 Reject deprecated commands and arguments
Markus Armbrusterdbb675c2021-03-18 16:55:19 +01003962 ``deprecated-input=crash``
3963 Crash on deprecated commands and arguments
Markus Armbruster6dd75472021-03-18 16:55:10 +01003964 ``deprecated-output=accept`` (default)
3965 Emit deprecated command results and events
3966 ``deprecated-output=hide``
3967 Suppress deprecated command results and events
3968
3969 Limitation: covers only syntactic aspects of QMP.
Markus Armbruster57df0df2021-10-28 12:25:20 +02003970
3971``-compat [unstable-input=@var{input-policy}][,unstable-output=@var{output-policy}]``
3972 Set policy for handling unstable management interfaces (experimental):
3973
3974 ``unstable-input=accept`` (default)
3975 Accept unstable commands and arguments
3976 ``unstable-input=reject``
3977 Reject unstable commands and arguments
3978 ``unstable-input=crash``
3979 Crash on unstable commands and arguments
3980 ``unstable-output=accept`` (default)
3981 Emit unstable command results and events
3982 ``unstable-output=hide``
3983 Suppress unstable command results and events
3984
3985 Limitation: covers only syntactic aspects of QMP.
Markus Armbruster6dd75472021-03-18 16:55:10 +01003986ERST
3987
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04003988DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
3989 "-fw_cfg [name=]<name>,file=<file>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02003990 " add named fw_cfg entry with contents from file\n"
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04003991 "-fw_cfg [name=]<name>,string=<str>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02003992 " add named fw_cfg entry with contents from string\n",
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04003993 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003994SRST
3995``-fw_cfg [name=]name,file=file``
3996 Add named fw\_cfg entry with contents from file file.
3997
3998``-fw_cfg [name=]name,string=str``
3999 Add named fw\_cfg entry with contents from string str.
4000
4001 The terminating NUL character of the contents of str will not be
4002 included as part of the fw\_cfg item data. To insert contents with
4003 embedded NUL characters, you have to use the file parameter.
4004
4005 The fw\_cfg entries are passed by QEMU through to the guest.
4006
4007 Example:
4008
4009 ::
4010
4011 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
4012
4013 creates an fw\_cfg entry named opt/com.mycompany/blob with contents
4014 from ./my\_blob.bin.
4015ERST
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04004016
blueswir15824d652009-03-28 06:44:27 +00004017DEF("serial", HAS_ARG, QEMU_OPTION_serial, \
Blue Swirlad960902010-03-29 19:23:52 +00004018 "-serial dev redirect the serial port to char device 'dev'\n",
4019 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004020SRST
4021``-serial dev``
4022 Redirect the virtual serial port to host character device dev. The
4023 default device is ``vc`` in graphical mode and ``stdio`` in non
4024 graphical mode.
4025
4026 This option can be used several times to simulate up to 4 serial
4027 ports.
4028
4029 Use ``-serial none`` to disable all serial ports.
4030
4031 Available character devices are:
4032
4033 ``vc[:WxH]``
4034 Virtual console. Optionally, a width and height can be given in
4035 pixel with
4036
4037 ::
4038
4039 vc:800x600
4040
4041 It is also possible to specify width or height in characters:
4042
4043 ::
4044
4045 vc:80Cx24C
4046
4047 ``pty``
4048 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
4049
4050 ``none``
4051 No device is allocated.
4052
4053 ``null``
4054 void device
4055
4056 ``chardev:id``
4057 Use a named character device defined with the ``-chardev``
4058 option.
4059
4060 ``/dev/XXX``
4061 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial
4062 port parameters are set according to the emulated ones.
4063
4064 ``/dev/parportN``
4065 [Linux only, parallel port only] Use host parallel port N.
4066 Currently SPP and EPP parallel port features can be used.
4067
4068 ``file:filename``
4069 Write output to filename. No character can be read.
4070
4071 ``stdio``
4072 [Unix only] standard input/output
4073
4074 ``pipe:filename``
4075 name pipe filename
4076
4077 ``COMn``
4078 [Windows only] Use host serial port n
4079
4080 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]``
4081 This implements UDP Net Console. When remote\_host or src\_ip
4082 are not specified they default to ``0.0.0.0``. When not using a
4083 specified src\_port a random port is automatically chosen.
4084
4085 If you just want a simple readonly console you can use
4086 ``netcat`` or ``nc``, by starting QEMU with:
4087 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time
4088 QEMU writes something to that port it will appear in the
4089 netconsole session.
4090
4091 If you plan to send characters back via netconsole or you want
4092 to stop and start QEMU a lot of times, you should have QEMU use
4093 the same source port each time by using something like ``-serial
4094 udp::4555@:4556`` to QEMU. Another approach is to use a patched
4095 version of netcat which can listen to a TCP port and send and
4096 receive characters via udp. If you have a patched version of
4097 netcat which activates telnet remote echo and single char
4098 transfer, then you can use the following options to set up a
4099 netcat redirector to allow telnet on port 5555 to access the
4100 QEMU port.
4101
4102 ``QEMU Options:``
4103 -serial udp::4555@:4556
4104
4105 ``netcat options:``
4106 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
4107
4108 ``telnet options:``
4109 localhost 5555
4110
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004111 ``tcp:[host]:port[,server=on|off][,wait=on|off][,nodelay=on|off][,reconnect=seconds]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004112 The TCP Net Console has two modes of operation. It can send the
4113 serial I/O to a location or wait for a connection from a
4114 location. By default the TCP Net Console is sent to host at the
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004115 port. If you use the ``server=on`` option QEMU will wait for a client
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004116 socket application to connect to the port before continuing,
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004117 unless the ``wait=on|off`` option was specified. The ``nodelay=on|off``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004118 option disables the Nagle buffering algorithm. The ``reconnect=on``
4119 option only applies if ``server=no`` is set, if the connection goes
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004120 down it will attempt to reconnect at the given interval. If host
4121 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004122 time is accepted. You can use ``telnet=on`` to connect to the
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004123 corresponding character device.
4124
4125 ``Example to send tcp console to 192.168.0.2 port 4444``
4126 -serial tcp:192.168.0.2:4444
4127
4128 ``Example to listen and wait on port 4444 for connection``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004129 -serial tcp::4444,server=on
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004130
4131 ``Example to not wait and listen on ip 192.168.0.100 port 4444``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004132 -serial tcp:192.168.0.100:4444,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004133
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004134 ``telnet:host:port[,server=on|off][,wait=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004135 The telnet protocol is used instead of raw tcp sockets. The
4136 options work the same as if you had specified ``-serial tcp``.
4137 The difference is that the port acts like a telnet server or
4138 client using telnet option negotiation. This will also allow you
4139 to send the MAGIC\_SYSRQ sequence if you use a telnet that
4140 supports sending the break sequence. Typically in unix telnet
4141 you do it with Control-] and then type "send break" followed by
4142 pressing the enter key.
4143
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004144 ``websocket:host:port,server=on[,wait=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004145 The WebSocket protocol is used instead of raw tcp socket. The
4146 port acts as a WebSocket server. Client mode is not supported.
4147
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004148 ``unix:path[,server=on|off][,wait=on|off][,reconnect=seconds]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004149 A unix domain socket is used instead of a tcp socket. The option
4150 works the same as if you had specified ``-serial tcp`` except
4151 the unix domain socket path is used for connections.
4152
4153 ``mon:dev_string``
4154 This is a special option to allow the monitor to be multiplexed
4155 onto another serial port. The monitor is accessed with key
4156 sequence of Control-a and then pressing c. dev\_string should be
4157 any one of the serial devices specified above. An example to
4158 multiplex the monitor onto a telnet server listening on port
4159 4444 would be:
4160
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004161 ``-serial mon:telnet::4444,server=on,wait=off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004162
4163 When the monitor is multiplexed to stdio in this way, Ctrl+C
4164 will not terminate QEMU any more but will be passed to the guest
4165 instead.
4166
4167 ``braille``
4168 Braille device. This will use BrlAPI to display the braille
4169 output on a real or fake device.
4170
4171 ``msmouse``
4172 Three button serial mouse. Configure the guest to use Microsoft
4173 protocol.
4174ERST
blueswir15824d652009-03-28 06:44:27 +00004175
4176DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
Blue Swirlad960902010-03-29 19:23:52 +00004177 "-parallel dev redirect the parallel port to char device 'dev'\n",
4178 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004179SRST
4180``-parallel dev``
4181 Redirect the virtual parallel port to host device dev (same devices
4182 as the serial port). On Linux hosts, ``/dev/parportN`` can be used
4183 to use hardware devices connected on the corresponding host parallel
4184 port.
4185
4186 This option can be used several times to simulate up to 3 parallel
4187 ports.
4188
4189 Use ``-parallel none`` to disable all parallel ports.
4190ERST
blueswir15824d652009-03-28 06:44:27 +00004191
4192DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
Blue Swirlad960902010-03-29 19:23:52 +00004193 "-monitor dev redirect the monitor to char device 'dev'\n",
4194 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004195SRST
4196``-monitor dev``
4197 Redirect the monitor to host device dev (same devices as the serial
4198 port). The default device is ``vc`` in graphical mode and ``stdio``
4199 in non graphical mode. Use ``-monitor none`` to disable the default
4200 monitor.
4201ERST
Gerd Hoffmann6ca55822009-12-08 13:11:52 +01004202DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
Blue Swirlad960902010-03-29 19:23:52 +00004203 "-qmp dev like -monitor but opens in 'control' mode\n",
4204 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004205SRST
4206``-qmp dev``
Peter Maydell0ec44682023-05-15 17:22:45 +01004207 Like ``-monitor`` but opens in 'control' mode. For example, to make
4208 QMP available on localhost port 4444::
4209
4210 -qmp tcp:localhost:4444,server=on,wait=off
4211
4212 Not all options are configurable via this syntax; for maximum
4213 flexibility use the ``-mon`` option and an accompanying ``-chardev``.
4214
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004215ERST
Max Reitz4821cd42014-11-17 13:31:04 +01004216DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
4217 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
4218 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004219SRST
4220``-qmp-pretty dev``
Peter Maydell0ec44682023-05-15 17:22:45 +01004221 Like ``-qmp`` but uses pretty JSON formatting.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004222ERST
blueswir15824d652009-03-28 06:44:27 +00004223
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01004224DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01004225 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004226SRST
4227``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]``
Peter Maydell0ec44682023-05-15 17:22:45 +01004228 Set up a monitor connected to the chardev ``name``.
4229 QEMU supports two monitors: the Human Monitor Protocol
4230 (HMP; for human interaction), and the QEMU Monitor Protocol
4231 (QMP; a JSON RPC-style protocol).
4232 The default is HMP; ``mode=control`` selects QMP instead.
4233 ``pretty`` is only valid when ``mode=control``,
Ali Shirvani16b3f3b2021-05-19 11:41:45 +04304234 turning on JSON pretty printing to ease
Daniel P. Berrangé283d8452021-02-19 17:56:13 +00004235 human reading and debugging.
Peter Maydell0ec44682023-05-15 17:22:45 +01004236
4237 For example::
4238
4239 -chardev socket,id=mon1,host=localhost,port=4444,server=on,wait=off \
4240 -mon chardev=mon1,mode=control,pretty=on
4241
4242 enables the QMP monitor on localhost port 4444 with pretty-printing.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004243ERST
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01004244
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08004245DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
Blue Swirlad960902010-03-29 19:23:52 +00004246 "-debugcon dev redirect the debug console to char device 'dev'\n",
4247 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004248SRST
4249``-debugcon dev``
4250 Redirect the debug console to host device dev (same devices as the
4251 serial port). The debug console is an I/O port which is typically
4252 port 0xe9; writing to that I/O port sends output to this device. The
4253 default device is ``vc`` in graphical mode and ``stdio`` in non
4254 graphical mode.
4255ERST
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08004256
blueswir15824d652009-03-28 06:44:27 +00004257DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
Blue Swirlad960902010-03-29 19:23:52 +00004258 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004259SRST
4260``-pidfile file``
4261 Store the QEMU process PID in file. It is useful if you launch QEMU
4262 from a script.
4263ERST
blueswir15824d652009-03-28 06:44:27 +00004264
aurel321b530a62009-04-05 20:08:59 +00004265DEF("singlestep", 0, QEMU_OPTION_singlestep, \
Peter Maydell12fd0f42023-04-17 17:40:37 +01004266 "-singlestep deprecated synonym for -accel tcg,one-insn-per-tb=on\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004267SRST
4268``-singlestep``
Peter Maydell12fd0f42023-04-17 17:40:37 +01004269 This is a deprecated synonym for the TCG accelerator property
4270 ``one-insn-per-tb``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004271ERST
aurel321b530a62009-04-05 20:08:59 +00004272
Igor Mammedov047f7032018-05-11 19:24:43 +02004273DEF("preconfig", 0, QEMU_OPTION_preconfig, \
Markus Armbruster361ac942018-07-05 11:14:02 +02004274 "--preconfig pause QEMU before machine is initialized (experimental)\n",
Igor Mammedov047f7032018-05-11 19:24:43 +02004275 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004276SRST
4277``--preconfig``
4278 Pause QEMU for interactive configuration before the machine is
4279 created, which allows querying and configuring properties that will
4280 affect machine initialization. Use QMP command 'x-exit-preconfig' to
4281 exit the preconfig state and move to the next state (i.e. run guest
4282 if -S isn't used or pause the second time if -S is used). This
4283 option is experimental.
4284ERST
Igor Mammedov047f7032018-05-11 19:24:43 +02004285
blueswir15824d652009-03-28 06:44:27 +00004286DEF("S", 0, QEMU_OPTION_S, \
Blue Swirlad960902010-03-29 19:23:52 +00004287 "-S freeze CPU at startup (use 'c' to start execution)\n",
4288 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004289SRST
4290``-S``
4291 Do not start CPU at startup (you must type 'c' in the monitor).
4292ERST
blueswir15824d652009-03-28 06:44:27 +00004293
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004294DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004295 "-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004296 " run qemu with overcommit hints\n"
4297 " mem-lock=on|off controls memory lock support (default: off)\n"
4298 " cpu-pm=on|off controls cpu power management (default: off)\n",
4299 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004300SRST
4301``-overcommit mem-lock=on|off``
Peter Maydell09ce5f22020-02-28 15:36:13 +00004302 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004303``-overcommit cpu-pm=on|off``
4304 Run qemu with hints about host resource overcommit. The default is
4305 to assume that host overcommits all resources.
4306
4307 Locking qemu and guest memory can be enabled via ``mem-lock=on``
4308 (disabled by default). This works when host memory is not
Thomas Huthc8c9dc42020-12-10 16:58:07 +01004309 overcommitted and reduces the worst-case latency for guest.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004310
4311 Guest ability to manage power state of host cpus (increasing latency
4312 for other processes on the same host cpu, but decreasing latency for
4313 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This
4314 works best when host CPU is not overcommitted. When used, host
4315 estimates of CPU cycle and power utilization will be incorrect, not
4316 taking into account guest idle time.
4317ERST
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004318
aliguori59030a82009-04-05 18:43:41 +00004319DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
Peter Maydelle5910d42020-04-03 10:40:14 +01004320 "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n"
4321 " the guest without waiting for gdb to connect; use -S too\n"
4322 " if you want it to not start execution.)\n",
4323 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004324SRST
4325``-gdb dev``
Thomas Huth923e9312020-11-16 15:47:36 +01004326 Accept a gdb connection on device dev (see the :ref:`GDB usage` chapter
4327 in the System Emulation Users Guide). Note that this option does not pause QEMU
Peter Maydelle5910d42020-04-03 10:40:14 +01004328 execution -- if you want QEMU to not start the guest until you
4329 connect with gdb and issue a ``continue`` command, you will need to
4330 also pass the ``-S`` option to QEMU.
4331
4332 The most usual configuration is to listen on a local TCP socket::
4333
4334 -gdb tcp::3117
4335
4336 but you can specify other backends; UDP, pseudo TTY, or even stdio
4337 are all reasonable use cases. For example, a stdio connection
4338 allows you to start QEMU from within gdb and establish the
4339 connection via a pipe:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004340
Peter Maydell09ce5f22020-02-28 15:36:13 +00004341 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004342
4343 (gdb) target remote | exec |qemu_system| -gdb stdio ...
4344ERST
blueswir15824d652009-03-28 06:44:27 +00004345
aliguori59030a82009-04-05 18:43:41 +00004346DEF("s", 0, QEMU_OPTION_s, \
Blue Swirlad960902010-03-29 19:23:52 +00004347 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n",
4348 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004349SRST
4350``-s``
4351 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
Thomas Huth923e9312020-11-16 15:47:36 +01004352 (see the :ref:`GDB usage` chapter in the System Emulation Users Guide).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004353ERST
blueswir15824d652009-03-28 06:44:27 +00004354
4355DEF("d", HAS_ARG, QEMU_OPTION_d, \
Peter Maydell989b6972013-02-26 17:52:40 +00004356 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n",
Blue Swirlad960902010-03-29 19:23:52 +00004357 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004358SRST
4359``-d item1[,...]``
4360 Enable logging of specified items. Use '-d help' for a list of log
4361 items.
4362ERST
blueswir15824d652009-03-28 06:44:27 +00004363
Matthew Fernandezc235d732011-06-07 16:32:40 +00004364DEF("D", HAS_ARG, QEMU_OPTION_D, \
Peter Maydell989b6972013-02-26 17:52:40 +00004365 "-D logfile output log to logfile (default stderr)\n",
Matthew Fernandezc235d732011-06-07 16:32:40 +00004366 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004367SRST
4368``-D logfile``
4369 Output log in logfile instead of to stderr
4370ERST
Matthew Fernandezc235d732011-06-07 16:32:40 +00004371
Alex Bennée35145522016-03-15 14:30:20 +00004372DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \
4373 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n",
4374 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004375SRST
4376``-dfilter range1[,...]``
4377 Filter debug output to that relevant to a range of target addresses.
4378 The filter spec can be either start+size, start-size or start..end
4379 where start end and size are the addresses and sizes required. For
4380 example:
4381
4382 ::
4383
4384 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
4385
4386 Will dump output for any code in the 0x1000 sized block starting at
4387 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and
4388 another 0x1000 sized block starting at 0xffffffc00005f000.
4389ERST
Alex Bennée35145522016-03-15 14:30:20 +00004390
Richard Henderson9c09a252019-03-14 13:06:29 -07004391DEF("seed", HAS_ARG, QEMU_OPTION_seed, \
4392 "-seed number seed the pseudo-random number generator\n",
4393 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004394SRST
4395``-seed number``
4396 Force the guest to use a deterministic pseudo-random number
4397 generator, seeded with number. This does not affect crypto routines
4398 within the host.
4399ERST
Richard Henderson9c09a252019-03-14 13:06:29 -07004400
blueswir15824d652009-03-28 06:44:27 +00004401DEF("L", HAS_ARG, QEMU_OPTION_L, \
Blue Swirlad960902010-03-29 19:23:52 +00004402 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n",
4403 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004404SRST
4405``-L path``
4406 Set the directory for the BIOS, VGA BIOS and keymaps.
4407
4408 To list all the data directories, use ``-L help``.
4409ERST
blueswir15824d652009-03-28 06:44:27 +00004410
blueswir15824d652009-03-28 06:44:27 +00004411DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
Thomas Huth21abf012022-04-27 15:49:06 +02004412 "-enable-kvm enable KVM full virtualization support\n",
4413 QEMU_ARCH_ARM | QEMU_ARCH_I386 | QEMU_ARCH_MIPS | QEMU_ARCH_PPC |
4414 QEMU_ARCH_RISCV | QEMU_ARCH_S390X)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004415SRST
4416``-enable-kvm``
4417 Enable KVM full virtualization support. This option is only
4418 available if KVM support is enabled when compiling.
4419ERST
blueswir15824d652009-03-28 06:44:27 +00004420
aliguorie37630c2009-04-22 15:19:10 +00004421DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
Thomas Hutheeb36472022-04-27 15:31:56 +02004422 "-xen-domid id specify xen guest domain id\n",
4423 QEMU_ARCH_ARM | QEMU_ARCH_I386)
aliguorie37630c2009-04-22 15:19:10 +00004424DEF("xen-attach", 0, QEMU_OPTION_xen_attach,
4425 "-xen-attach attach to existing xen domain\n"
Anthony PERARD1077bca2018-09-14 12:18:30 +01004426 " libxl will use this when starting QEMU\n",
Thomas Hutheeb36472022-04-27 15:31:56 +02004427 QEMU_ARCH_ARM | QEMU_ARCH_I386)
Paul Durrant1c599472017-03-22 09:39:15 +00004428DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict,
4429 "-xen-domid-restrict restrict set of available xen operations\n"
4430 " to specified domain id. (Does not affect\n"
4431 " xenpv machine type).\n",
Thomas Hutheeb36472022-04-27 15:31:56 +02004432 QEMU_ARCH_ARM | QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004433SRST
4434``-xen-domid id``
4435 Specify xen guest domain id (XEN only).
4436
4437``-xen-attach``
4438 Attach to existing xen domain. libxl will use this when starting
4439 QEMU (XEN only). Restrict set of available xen operations to
4440 specified domain id (XEN only).
4441ERST
aliguorie37630c2009-04-22 15:19:10 +00004442
blueswir15824d652009-03-28 06:44:27 +00004443DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
Blue Swirlad960902010-03-29 19:23:52 +00004444 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004445SRST
4446``-no-reboot``
4447 Exit instead of rebooting.
4448ERST
blueswir15824d652009-03-28 06:44:27 +00004449
4450DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \
Blue Swirlad960902010-03-29 19:23:52 +00004451 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004452SRST
4453``-no-shutdown``
4454 Don't exit QEMU on guest shutdown, but instead only stop the
4455 emulation. This allows for instance switching to monitor to commit
4456 changes to the disk image.
4457ERST
blueswir15824d652009-03-28 06:44:27 +00004458
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004459DEF("action", HAS_ARG, QEMU_OPTION_action,
Paolo Bonzinic27025e2021-01-20 14:30:27 +01004460 "-action reboot=reset|shutdown\n"
4461 " action when guest reboots [default=reset]\n"
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004462 "-action shutdown=poweroff|pause\n"
4463 " action when guest shuts down [default=poweroff]\n"
Ilya Leoshkevich0882caf2022-07-26 00:37:45 +02004464 "-action panic=pause|shutdown|exit-failure|none\n"
Paolo Bonzinic27025e2021-01-20 14:30:27 +01004465 " action when guest panics [default=shutdown]\n"
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004466 "-action watchdog=reset|shutdown|poweroff|inject-nmi|pause|debug|none\n"
4467 " action when watchdog fires [default=reset]\n",
4468 QEMU_ARCH_ALL)
4469SRST
4470``-action event=action``
4471 The action parameter serves to modify QEMU's default behavior when
4472 certain guest events occur. It provides a generic method for specifying the
4473 same behaviors that are modified by the ``-no-reboot`` and ``-no-shutdown``
4474 parameters.
4475
4476 Examples:
4477
Alejandro Jimenezc753e8e2020-12-11 17:31:52 -05004478 ``-action panic=none``
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004479 ``-action reboot=shutdown,shutdown=pause``
Paolo Bonzini5433af72022-09-10 13:44:47 +02004480 ``-device i6300esb -action watchdog=pause``
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004481
4482ERST
4483
blueswir15824d652009-03-28 06:44:27 +00004484DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \
4485 "-loadvm [tag|id]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004486 " start right away with a saved state (loadvm in monitor)\n",
4487 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004488SRST
4489``-loadvm file``
4490 Start right away with a saved state (``loadvm`` in monitor)
4491ERST
blueswir15824d652009-03-28 06:44:27 +00004492
4493#ifndef _WIN32
4494DEF("daemonize", 0, QEMU_OPTION_daemonize, \
Blue Swirlad960902010-03-29 19:23:52 +00004495 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004496#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004497SRST
4498``-daemonize``
4499 Daemonize the QEMU process after initialization. QEMU will not
4500 detach from standard IO until it is ready to receive connections on
4501 any of its devices. This option is a useful way for external
4502 programs to launch QEMU without having to cope with initialization
4503 race conditions.
4504ERST
blueswir15824d652009-03-28 06:44:27 +00004505
4506DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \
Blue Swirlad960902010-03-29 19:23:52 +00004507 "-option-rom rom load a file, rom, into the option ROM space\n",
4508 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004509SRST
4510``-option-rom file``
4511 Load the contents of file as an option ROM. This option is useful to
4512 load things like EtherBoot.
4513ERST
blueswir15824d652009-03-28 06:44:27 +00004514
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02004515DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
Artem Pisarenko238d1242018-10-18 13:12:52 +06004516 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004517 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
4518 QEMU_ARCH_ALL)
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02004519
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004520SRST
4521``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]``
4522 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at
4523 the current UTC or local time, respectively. ``localtime`` is
4524 required for correct date in MS-DOS or Windows. To start at a
4525 specific point in time, provide datetime in the format
4526 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC.
4527
4528 By default the RTC is driven by the host system time. This allows
4529 using of the RTC as accurate reference clock inside the guest,
4530 specifically if the host time is smoothly following an accurate
4531 external reference clock, e.g. via NTP. If you want to isolate the
4532 guest time from the host, you can set ``clock`` to ``rt`` instead,
4533 which provides a host monotonic clock if host support it. To even
4534 prevent the RTC from progressing during suspension, you can set
4535 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is
4536 recommended especially in icount mode in order to preserve
4537 determinism; however, note that in icount mode the speed of the
4538 virtual clock is variable and can in general differ from the host
4539 clock.
4540
4541 Enable ``driftfix`` (i386 targets only) if you experience time drift
4542 problems, specifically with Windows' ACPI HAL. This option will try
4543 to figure out how many timer interrupts were not processed by the
4544 Windows guest and will re-inject them.
4545ERST
blueswir15824d652009-03-28 06:44:27 +00004546
4547DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
Peter Maydellfa647902020-11-21 21:35:06 +00004548 "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=<filename>[,rrsnapshot=<snapshot>]]\n" \
aliguoribc14ca22009-04-05 18:43:37 +00004549 " enable virtual instruction counter with 2^N clock ticks per\n" \
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02004550 " instruction, enable aligning the host and virtual clocks\n" \
Peter Maydellfa647902020-11-21 21:35:06 +00004551 " or disable real time cpu sleeping, and optionally enable\n" \
4552 " record-and-replay mode\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004553SRST
Peter Maydellfa647902020-11-21 21:35:06 +00004554``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004555 Enable virtual instruction counter. The virtual cpu will execute one
4556 instruction every 2^N ns of virtual time. If ``auto`` is specified
4557 then the virtual cpu speed will be automatically adjusted to keep
4558 virtual time within a few seconds of real time.
4559
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004560 Note that while this option can give deterministic behavior, it does
4561 not provide cycle accurate emulation. Modern CPUs contain
4562 superscalar out of order cores with complex cache hierarchies. The
4563 number of instructions executed often has little or no correlation
4564 with actual performance.
4565
Peter Maydellfa647902020-11-21 21:35:06 +00004566 When the virtual cpu is sleeping, the virtual time will advance at
4567 default speed unless ``sleep=on`` is specified. With
4568 ``sleep=on``, the virtual time will jump to the next timer
4569 deadline instantly whenever the virtual cpu goes to sleep mode and
4570 will not advance if no timer is enabled. This behavior gives
4571 deterministic execution times from the guest point of view.
4572 The default if icount is enabled is ``sleep=off``.
4573 ``sleep=on`` cannot be used together with either ``shift=auto``
4574 or ``align=on``.
4575
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004576 ``align=on`` will activate the delay algorithm which will try to
4577 synchronise the host clock and the virtual clock. The goal is to
4578 have a guest running at the real frequency imposed by the shift
4579 option. Whenever the guest clock is behind the host clock and if
4580 ``align=on`` is specified then we print a message to the user to
4581 inform about the delay. Currently this option does not work when
4582 ``shift`` is ``auto``. Note: The sync algorithm will work for those
4583 shift values for which the guest clock runs ahead of the host clock.
4584 Typically this happens when the shift value is high (how high
Peter Maydellfa647902020-11-21 21:35:06 +00004585 depends on the host machine). The default if icount is enabled
4586 is ``align=off``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004587
Peter Maydellfa647902020-11-21 21:35:06 +00004588 When the ``rr`` option is specified deterministic record/replay is
4589 enabled. The ``rrfile=`` option must also be provided to
4590 specify the path to the replay log. In record mode data is written
4591 to this file, and in replay mode it is read back.
4592 If the ``rrsnapshot`` option is given then it specifies a VM snapshot
4593 name. In record mode, a new VM snapshot with the given name is created
4594 at the start of execution recording. In replay mode this option
4595 specifies the snapshot name used to load the initial VM state.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004596ERST
blueswir15824d652009-03-28 06:44:27 +00004597
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01004598DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \
Markus Armbruster7ad92702017-10-02 16:03:07 +02004599 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004600 " action when watchdog fires [default=reset]\n",
4601 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004602SRST
4603``-watchdog-action action``
4604 The action controls what QEMU will do when the watchdog timer
4605 expires. The default is ``reset`` (forcefully reset the guest).
4606 Other possible actions are: ``shutdown`` (attempt to gracefully
4607 shutdown the guest), ``poweroff`` (forcefully poweroff the guest),
4608 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the
4609 guest), ``debug`` (print a debug message and continue), or ``none``
4610 (do nothing).
4611
4612 Note that the ``shutdown`` action requires that the guest responds
4613 to ACPI signals, which it may not be able to do in the sort of
4614 situations where the watchdog would have expired, and thus
4615 ``-watchdog-action shutdown`` is not recommended for production use.
4616
4617 Examples:
4618
Paolo Bonzini5433af72022-09-10 13:44:47 +02004619 ``-device i6300esb -watchdog-action pause``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004620
4621ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01004622
blueswir15824d652009-03-28 06:44:27 +00004623DEF("echr", HAS_ARG, QEMU_OPTION_echr, \
Blue Swirlad960902010-03-29 19:23:52 +00004624 "-echr chr set terminal escape character instead of ctrl-a\n",
4625 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004626SRST
4627``-echr numeric_ascii_value``
4628 Change the escape character used for switching to the monitor when
4629 using monitor and serial sharing. The default is ``0x01`` when using
4630 the ``-nographic`` option. ``0x01`` is equal to pressing
4631 ``Control-a``. You can select a different character from the ascii
4632 control keys where 1 through 26 map to Control-a through Control-z.
4633 For instance you could use the either of the following to change the
4634 escape character to Control-t.
4635
4636 ``-echr 0x14``; \ ``-echr 20``
4637
4638ERST
blueswir15824d652009-03-28 06:44:27 +00004639
blueswir15824d652009-03-28 06:44:27 +00004640DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004641 "-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]\n" \
4642 "-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]\n" \
Michael Tokarev7c601802015-02-10 22:40:47 +03004643 "-incoming unix:socketpath\n" \
4644 " prepare for incoming migration, listen on\n" \
4645 " specified protocol and socket address\n" \
4646 "-incoming fd:fd\n" \
4647 "-incoming exec:cmdline\n" \
4648 " accept incoming migration on given file descriptor\n" \
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01004649 " or from given external command\n" \
4650 "-incoming defer\n" \
4651 " wait for the URI to be specified via migrate_incoming\n",
Blue Swirlad960902010-03-29 19:23:52 +00004652 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004653SRST
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004654``-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00004655 \
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004656``-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004657 Prepare for incoming migration, listen on a given tcp port.
4658
4659``-incoming unix:socketpath``
4660 Prepare for incoming migration, listen on a given unix socket.
4661
4662``-incoming fd:fd``
4663 Accept incoming migration from a given filedescriptor.
4664
4665``-incoming exec:cmdline``
4666 Accept incoming migration as an output from specified external
4667 command.
4668
4669``-incoming defer``
4670 Wait for the URI to be specified via migrate\_incoming. The monitor
4671 can be used to change settings (such as migration parameters) prior
4672 to issuing the migrate\_incoming to allow the migration to begin.
4673ERST
blueswir15824d652009-03-28 06:44:27 +00004674
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05304675DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \
4676 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004677SRST
4678``-only-migratable``
4679 Only allow migratable devices. Devices will not be allowed to enter
4680 an unmigratable state.
4681ERST
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05304682
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01004683DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
Blue Swirlad960902010-03-29 19:23:52 +00004684 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004685SRST
4686``-nodefaults``
4687 Don't create default devices. Normally, QEMU sets the default
4688 devices like serial port, parallel port, virtual console, monitor
4689 device, VGA adapter, floppy and CD-ROM drive and others. The
4690 ``-nodefaults`` option will disable all those default devices.
4691ERST
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01004692
blueswir15824d652009-03-28 06:44:27 +00004693#ifndef _WIN32
4694DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004695 "-chroot dir chroot to dir just before starting the VM (deprecated)\n",
Blue Swirlad960902010-03-29 19:23:52 +00004696 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004697#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004698SRST
4699``-chroot dir``
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004700 Deprecated, use '-run-with chroot=...' instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004701 Immediately before starting guest execution, chroot to the specified
4702 directory. Especially useful in combination with -runas.
4703ERST
blueswir15824d652009-03-28 06:44:27 +00004704
4705#ifndef _WIN32
4706DEF("runas", HAS_ARG, QEMU_OPTION_runas, \
Ian Jackson2c42f1e2017-09-15 18:10:44 +01004707 "-runas user change to user id user just before starting the VM\n" \
4708 " user can be numeric uid:gid instead\n",
Blue Swirlad960902010-03-29 19:23:52 +00004709 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004710#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004711SRST
4712``-runas user``
4713 Immediately before starting guest execution, drop root privileges,
4714 switching to the specified user.
4715ERST
blueswir15824d652009-03-28 06:44:27 +00004716
blueswir15824d652009-03-28 06:44:27 +00004717DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env,
4718 "-prom-env variable=value\n"
Blue Swirlad960902010-03-29 19:23:52 +00004719 " set OpenBIOS nvram variables\n",
4720 QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004721SRST
4722``-prom-env variable=value``
4723 Set OpenBIOS nvram variable to given value (PPC, SPARC only).
4724
4725 ::
4726
4727 qemu-system-sparc -prom-env 'auto-boot?=false' \
4728 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
4729
4730 ::
4731
4732 qemu-system-ppc -prom-env 'auto-boot?=false' \
4733 -prom-env 'boot-device=hd:2,\yaboot' \
4734 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
4735ERST
blueswir15824d652009-03-28 06:44:27 +00004736DEF("semihosting", 0, QEMU_OPTION_semihosting,
Michael Wallef7bbcfb2014-04-22 20:18:42 +02004737 "-semihosting semihosting mode\n",
Markus Armbruster9d49bcf2021-05-03 10:40:33 +02004738 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA |
Keith Packarda10b9d92021-01-08 22:42:52 +00004739 QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004740SRST
4741``-semihosting``
Alex Bennée2da9d212023-01-24 18:01:13 +00004742 Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004743
Alex Bennée2da9d212023-01-24 18:01:13 +00004744 .. warning::
4745 Note that this allows guest direct access to the host filesystem, so
4746 should only be used with a trusted guest OS.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004747
4748 See the -semihosting-config option documentation for further
4749 information about the facilities this enables.
4750ERST
Liviu Ionescua38bb072014-12-11 12:07:48 +00004751DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config,
Peter Maydell52028612022-08-22 15:12:24 +01004752 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]\n" \
Leon Alraea59d31a2015-06-19 14:17:45 +01004753 " semihosting configuration\n",
Markus Armbruster9d49bcf2021-05-03 10:40:33 +02004754QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA |
Keith Packarda10b9d92021-01-08 22:42:52 +00004755QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004756SRST
Peter Maydell52028612022-08-22 15:12:24 +01004757``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]``
Alex Bennée2da9d212023-01-24 18:01:13 +00004758 Enable and configure :ref:`Semihosting` (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004759 only).
4760
Alex Bennée2da9d212023-01-24 18:01:13 +00004761 .. warning::
4762 Note that this allows guest direct access to the host filesystem, so
4763 should only be used with a trusted guest OS.
Keith Packarda10b9d92021-01-08 22:42:52 +00004764
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004765 ``target=native|gdb|auto``
4766 Defines where the semihosting calls will be addressed, to QEMU
4767 (``native``) or to GDB (``gdb``). The default is ``auto``, which
4768 means ``gdb`` during debug sessions and ``native`` otherwise.
4769
4770 ``chardev=str1``
4771 Send the output to a chardev backend output for native or auto
4772 output when not in gdb
4773
Peter Maydell52028612022-08-22 15:12:24 +01004774 ``userspace=on|off``
4775 Allows code running in guest userspace to access the semihosting
4776 interface. The default is that only privileged guest code can
4777 make semihosting calls. Note that setting ``userspace=on`` should
4778 only be used if all guest code is trusted (for example, in
4779 bare-metal test case code).
4780
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004781 ``arg=str1,arg=str2,...``
4782 Allows the user to pass input arguments, and can be used
4783 multiple times to build up a list. The old-style
4784 ``-kernel``/``-append`` method of passing a command line is
4785 still supported for backward compatibility. If both the
4786 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are
4787 specified, the former is passed to semihosting as it always
4788 takes precedence.
4789ERST
blueswir15824d652009-03-28 06:44:27 +00004790DEF("old-param", 0, QEMU_OPTION_old_param,
Blue Swirlad960902010-03-29 19:23:52 +00004791 "-old-param old param mode\n", QEMU_ARCH_ARM)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004792SRST
4793``-old-param``
4794 Old param mode (ARM only).
4795ERST
Stefan Weil95d5f082010-01-20 22:25:27 +01004796
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03004797DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01004798 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01004799 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01004800 " Enable seccomp mode 2 system call filter (default 'off').\n" \
4801 " use 'obsolete' to allow obsolete system calls that are provided\n" \
4802 " by the kernel, but typically no longer used by modern\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01004803 " C library implementations.\n" \
Philippe Mathieu-Daudéd42304b2021-03-03 19:46:43 +01004804 " use 'elevateprivileges' to allow or deny the QEMU process ability\n" \
4805 " to elevate privileges using set*uid|gid system calls.\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01004806 " The value 'children' will deny set*uid|gid system calls for\n" \
Eduardo Otubo995a2262017-03-13 22:16:01 +01004807 " main QEMU process but will allow forks and execves to run unprivileged\n" \
4808 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
Philippe Mathieu-Daudéd42304b2021-03-03 19:46:43 +01004809 " blocking *fork and execve\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01004810 " use 'resourcecontrol' to disable process affinity and schedular priority\n",
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03004811 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004812SRST
4813``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]``
4814 Enable Seccomp mode 2 system call filter. 'on' will enable syscall
4815 filtering and 'off' will disable it. The default is 'off'.
4816
4817 ``obsolete=string``
4818 Enable Obsolete system calls
4819
4820 ``elevateprivileges=string``
4821 Disable set\*uid\|gid system calls
4822
4823 ``spawn=string``
4824 Disable \*fork and execve
4825
4826 ``resourcecontrol=string``
4827 Disable process affinity and schedular priority
4828ERST
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03004829
Gerd Hoffmann715a6642009-10-14 10:39:28 +02004830DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
Paolo Bonzinie960a7e2022-04-14 10:57:21 -04004831 "-readconfig <file>\n"
4832 " read config file\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004833SRST
4834``-readconfig file``
4835 Read device configuration from file. This approach is useful when
4836 you want to spawn QEMU process with many command line options but
4837 you don't want to exceed the command line character limit.
4838ERST
Thomas Huth2feac452018-08-21 12:59:56 +02004839
Eduardo Habkostf29a5612012-05-02 13:07:29 -03004840DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
4841 "-no-user-config\n"
Eduardo Habkost3478eae2017-10-04 00:00:25 -03004842 " do not load default user-provided config files at startup\n",
Eduardo Habkostf29a5612012-05-02 13:07:29 -03004843 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004844SRST
4845``-no-user-config``
4846 The ``-no-user-config`` option makes QEMU not load any of the
4847 user-provided config files on sysconfdir.
4848ERST
Thomas Huth2feac452018-08-21 12:59:56 +02004849
Prerna Saxenaab6540d2010-08-09 11:48:32 +01004850DEF("trace", HAS_ARG, QEMU_OPTION_trace,
Paolo Bonzini10578a22016-01-07 16:55:26 +03004851 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
Lluís23d15e82011-08-31 20:31:31 +02004852 " specify tracing options\n",
Prerna Saxenaab6540d2010-08-09 11:48:32 +01004853 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004854SRST
4855``-trace [[enable=]pattern][,events=file][,file=file]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00004856 .. include:: ../qemu-option-trace.rst.inc
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004857
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004858ERST
Lluís Vilanova42229a72017-07-24 17:28:22 +03004859DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02004860 "-plugin [file=]<file>[,<argname>=<argvalue>]\n"
Lluís Vilanova42229a72017-07-24 17:28:22 +03004861 " load a plugin\n",
4862 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004863SRST
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02004864``-plugin file=file[,argname=argvalue]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004865 Load a plugin.
4866
4867 ``file=file``
4868 Load the given plugin from a shared library file.
4869
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02004870 ``argname=argvalue``
4871 Argument passed to the plugin. (Can be given multiple times.)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004872ERST
Stefan Weil3dbf2c72010-01-16 18:19:44 +01004873
Markus Armbruster31e70d62013-02-13 19:49:37 +01004874HXCOMM Internal use
4875DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
4876DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL)
Anthony Liguoric7f0f3b2012-03-28 15:42:02 +02004877
Claudio Imbrendac891c242022-08-12 15:34:53 +02004878#ifdef __linux__
4879DEF("async-teardown", 0, QEMU_OPTION_asyncteardown,
4880 "-async-teardown enable asynchronous teardown\n",
4881 QEMU_ARCH_ALL)
Claudio Imbrendac891c242022-08-12 15:34:53 +02004882SRST
4883``-async-teardown``
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02004884 This option is deprecated and should no longer be used. The new option
4885 ``-run-with async-teardown=on`` is a replacement.
Claudio Imbrendac891c242022-08-12 15:34:53 +02004886ERST
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004887#endif
4888#ifdef CONFIG_POSIX
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02004889DEF("run-with", HAS_ARG, QEMU_OPTION_run_with,
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004890 "-run-with [async-teardown=on|off][,chroot=dir]\n"
4891 " Set miscellaneous QEMU process lifecycle options:\n"
4892 " async-teardown=on enables asynchronous teardown (Linux only)\n"
4893 " chroot=dir chroot to dir just before starting the VM\n",
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02004894 QEMU_ARCH_ALL)
4895SRST
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004896``-run-with [async-teardown=on|off][,chroot=dir]``
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02004897 Set QEMU process lifecycle options.
4898
4899 ``async-teardown=on`` enables asynchronous teardown. A new process called
4900 "cleanup/<QEMU_PID>" will be created at startup sharing the address
4901 space with the main QEMU process, using clone. It will wait for the
4902 main QEMU process to terminate completely, and then exit. This allows
4903 QEMU to terminate very quickly even if the guest was huge, leaving the
4904 teardown of the address space to the cleanup process. Since the cleanup
4905 process shares the same cgroups as the main QEMU process, accounting is
4906 performed correctly. This only works if the cleanup process is not
4907 forcefully killed with SIGKILL before the main QEMU process has
4908 terminated completely.
Thomas Huth9ffcbe22023-07-03 09:44:47 +02004909
4910 ``chroot=dir`` can be used for doing a chroot to the specified directory
4911 immediately before starting the guest execution. This is especially useful
4912 in combination with -runas.
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02004913ERST
4914#endif
Claudio Imbrendac891c242022-08-12 15:34:53 +02004915
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04004916DEF("msg", HAS_ARG, QEMU_OPTION_msg,
Mario Smarduch2880ffb2020-06-26 13:19:00 -07004917 "-msg [timestamp[=on|off]][,guest-name=[on|off]]\n"
Markus Armbrusterdeda4972019-10-10 10:15:08 +02004918 " control error message format\n"
Mario Smarduch2880ffb2020-06-26 13:19:00 -07004919 " timestamp=on enables timestamps (default: off)\n"
4920 " guest-name=on enables guest name prefix but only if\n"
4921 " -name guest option is set (default: off)\n",
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04004922 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004923SRST
Mario Smarduch2880ffb2020-06-26 13:19:00 -07004924``-msg [timestamp[=on|off]][,guest-name[=on|off]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004925 Control error message format.
4926
4927 ``timestamp=on|off``
4928 Prefix messages with a timestamp. Default is off.
Mario Smarduch2880ffb2020-06-26 13:19:00 -07004929
4930 ``guest-name=on|off``
4931 Prefix messages with guest name but only if -name guest option is set
4932 otherwise the option is ignored. Default is off.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004933ERST
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04004934
Amit Shahabfd9ce2014-06-20 18:56:08 +05304935DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
4936 "-dump-vmstate <file>\n"
4937 " Output vmstate information in JSON format to file.\n"
4938 " Use the scripts/vmstate-static-checker.py file to\n"
4939 " check for possible regressions in migration code\n"
Laurent Vivier23820532015-09-04 21:30:04 +02004940 " by comparing two such vmstate dumps.\n",
Amit Shahabfd9ce2014-06-20 18:56:08 +05304941 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004942SRST
4943``-dump-vmstate file``
4944 Dump json-encoded vmstate information for current machine type to
4945 file in file
4946ERST
Amit Shahabfd9ce2014-06-20 18:56:08 +05304947
Emilio G. Cota12df1892018-08-15 11:42:49 -04004948DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile,
4949 "-enable-sync-profile\n"
4950 " enable synchronization profiling\n",
4951 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004952SRST
4953``-enable-sync-profile``
4954 Enable synchronization profiling.
4955ERST
Emilio G. Cota12df1892018-08-15 11:42:49 -04004956
Ilya Leoshkevich5584e2d2023-01-12 16:20:13 +01004957#if defined(CONFIG_TCG) && defined(CONFIG_LINUX)
4958DEF("perfmap", 0, QEMU_OPTION_perfmap,
4959 "-perfmap generate a /tmp/perf-${pid}.map file for perf\n",
4960 QEMU_ARCH_ALL)
4961SRST
4962``-perfmap``
4963 Generate a map file for Linux perf tools that will allow basic profiling
4964 information to be broken down into basic blocks.
4965ERST
4966
4967DEF("jitdump", 0, QEMU_OPTION_jitdump,
4968 "-jitdump generate a jit-${pid}.dump file for perf\n",
4969 QEMU_ARCH_ALL)
4970SRST
4971``-jitdump``
4972 Generate a dump file for Linux perf tools that maps basic blocks to symbol
4973 names, line numbers and JITted code.
4974ERST
4975#endif
4976
Paolo Bonzini43f187a2017-01-04 13:50:37 +01004977DEFHEADING()
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02004978
4979DEFHEADING(Generic object creation:)
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01004980
4981DEF("object", HAS_ARG, QEMU_OPTION_object,
4982 "-object TYPENAME[,PROP1=VALUE1,...]\n"
4983 " create a new object of type TYPENAME setting properties\n"
4984 " in the order they are specified. Note that the 'id'\n"
4985 " property must be set. These objects are placed in the\n"
4986 " '/objects' path.\n",
4987 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004988SRST
4989``-object typename[,prop1=value1,...]``
4990 Create a new object of type typename setting properties in the order
4991 they are specified. Note that the 'id' property must be set. These
4992 objects are placed in the '/objects' path.
4993
Alexander Graf4b870dc2023-04-03 22:14:21 +00004994 ``-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align,offset=offset,readonly=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004995 Creates a memory file backend object, which can be used to back
4996 the guest RAM with huge pages.
4997
4998 The ``id`` parameter is a unique ID that will be used to
Robert Hoo56c9f002021-04-22 16:42:02 +08004999 reference this memory region in other parameters, e.g. ``-numa``,
5000 ``-device nvdimm``, etc.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005001
5002 The ``size`` option provides the size of the memory region, and
Robert Hoo56c9f002021-04-22 16:42:02 +08005003 accepts common suffixes, e.g. ``500M``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005004
5005 The ``mem-path`` provides the path to either a shared memory or
5006 huge page filesystem mount.
5007
5008 The ``share`` boolean option determines whether the memory
5009 region is marked as private to QEMU, or shared. The latter
5010 allows a co-operating external process to access the QEMU memory
5011 region.
5012
5013 The ``share`` is also required for pvrdma devices due to
5014 limitations in the RDMA API provided by Linux.
5015
5016 Setting share=on might affect the ability to configure NUMA
5017 bindings for the memory backend under some circumstances, see
5018 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel
5019 source tree for additional details.
5020
5021 Setting the ``discard-data`` boolean option to on indicates that
5022 file contents can be destroyed when QEMU exits, to avoid
5023 unnecessarily flushing data to the backing file. Note that
5024 ``discard-data`` is only an optimization, and QEMU might not
5025 discard file contents if it aborts unexpectedly or is terminated
5026 using SIGKILL.
5027
5028 The ``merge`` boolean option enables memory merge, also known as
5029 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider
5030 the pages for memory deduplication.
5031
5032 Setting the ``dump`` boolean option to off excludes the memory
5033 from core dumps. This feature is also known as MADV\_DONTDUMP.
5034
5035 The ``prealloc`` boolean option enables memory preallocation.
5036
5037 The ``host-nodes`` option binds the memory range to a list of
5038 NUMA host nodes.
5039
5040 The ``policy`` option sets the NUMA policy to one of the
5041 following values:
5042
5043 ``default``
5044 default host policy
5045
5046 ``preferred``
5047 prefer the given host node list for allocation
5048
5049 ``bind``
5050 restrict memory allocation to the given host node list
5051
5052 ``interleave``
5053 interleave memory allocations across the given host node
5054 list
5055
5056 The ``align`` option specifies the base address alignment when
5057 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg
5058 ``2M``. Some backend store specified by ``mem-path`` requires an
5059 alignment different than the default one used by QEMU, eg the
5060 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
5061 such cases, users can specify the required alignment via this
5062 option.
5063
Alexander Graf4b870dc2023-04-03 22:14:21 +00005064 The ``offset`` option specifies the offset into the target file
5065 that the region starts at. You can use this parameter to back
5066 multiple regions with a single file.
5067
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005068 The ``pmem`` option specifies whether the backing file specified
5069 by ``mem-path`` is in host persistent memory that can be
5070 accessed using the SNIA NVM programming model (e.g. Intel
5071 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary
5072 operations to guarantee the persistence of its own writes to
5073 ``mem-path`` (e.g. in vNVDIMM label emulation and live
5074 migration). Also, we will map the backend-file with MAP\_SYNC
5075 flag, which ensures the file metadata is in sync for
5076 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC
5077 requires support from both the host kernel (since Linux kernel
5078 4.15) and the filesystem of ``mem-path`` mounted with DAX
5079 option.
5080
Stefan Hajnoczi86635aa2021-01-04 17:13:19 +00005081 The ``readonly`` option specifies whether the backing file is opened
5082 read-only or read-write (default).
5083
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005084 ``-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``
5085 Creates a memory backend object, which can be used to back the
5086 guest RAM. Memory backend objects offer more control than the
5087 ``-m`` option that is traditionally used to define guest RAM.
5088 Please refer to ``memory-backend-file`` for a description of the
5089 options.
5090
5091 ``-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``
5092 Creates an anonymous memory file backend object, which allows
5093 QEMU to share the memory with an external process (e.g. when
5094 using vhost-user). The memory is allocated with memfd and
5095 optional sealing. (Linux only)
5096
5097 The ``seal`` option creates a sealed-file, that will block
5098 further resizing the memory ('on' by default).
5099
5100 The ``hugetlb`` option specify the file to be created resides in
5101 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction
5102 with the ``hugetlb`` option, the ``hugetlbsize`` option specify
5103 the hugetlb page size on systems that support multiple hugetlb
5104 page sizes (it must be a power of 2 value supported by the
5105 system).
5106
5107 In some versions of Linux, the ``hugetlb`` option is
5108 incompatible with the ``seal`` option (requires at least Linux
5109 4.16).
5110
5111 Please refer to ``memory-backend-file`` for a description of the
5112 other options.
5113
5114 The ``share`` boolean option is on by default with memfd.
5115
5116 ``-object rng-builtin,id=id``
5117 Creates a random number generator backend which obtains entropy
5118 from QEMU builtin functions. The ``id`` parameter is a unique ID
5119 that will be used to reference this entropy backend from the
5120 ``virtio-rng`` device. By default, the ``virtio-rng`` device
5121 uses this RNG backend.
5122
5123 ``-object rng-random,id=id,filename=/dev/random``
5124 Creates a random number generator backend which obtains entropy
5125 from a device on the host. The ``id`` parameter is a unique ID
5126 that will be used to reference this entropy backend from the
5127 ``virtio-rng`` device. The ``filename`` parameter specifies
5128 which file to obtain entropy from and if omitted defaults to
5129 ``/dev/urandom``.
5130
5131 ``-object rng-egd,id=id,chardev=chardevid``
5132 Creates a random number generator backend which obtains entropy
5133 from an external daemon running on the host. The ``id``
5134 parameter is a unique ID that will be used to reference this
5135 entropy backend from the ``virtio-rng`` device. The ``chardev``
5136 parameter is the unique ID of a character device backend that
5137 provides the connection to the RNG daemon.
5138
5139 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off``
5140 Creates a TLS anonymous credentials object, which can be used to
5141 provide TLS support on network backends. The ``id`` parameter is
5142 a unique ID which network backends will use to access the
5143 credentials. The ``endpoint`` is either ``server`` or ``client``
5144 depending on whether the QEMU network backend that uses the
5145 credentials will be acting as a client or as a server. If
5146 ``verify-peer`` is enabled (the default) then once the handshake
5147 is completed, the peer credentials will be verified, though this
5148 is a no-op for anonymous credentials.
5149
5150 The dir parameter tells QEMU where to find the credential files.
5151 For server endpoints, this directory may contain a file
5152 dh-params.pem providing diffie-hellman parameters to use for the
5153 TLS server. If the file is missing, QEMU will generate a set of
5154 DH parameters at startup. This is a computationally expensive
5155 operation that consumes random pool entropy, so it is
5156 recommended that a persistent set of parameters be generated
5157 upfront and saved.
5158
5159 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]``
5160 Creates a TLS Pre-Shared Keys (PSK) credentials object, which
5161 can be used to provide TLS support on network backends. The
5162 ``id`` parameter is a unique ID which network backends will use
5163 to access the credentials. The ``endpoint`` is either ``server``
5164 or ``client`` depending on whether the QEMU network backend that
5165 uses the credentials will be acting as a client or as a server.
5166 For clients only, ``username`` is the username which will be
5167 sent to the server. If omitted it defaults to "qemu".
5168
5169 The dir parameter tells QEMU where to find the keys file. It is
5170 called "dir/keys.psk" and contains "username:key" pairs. This
5171 file can most easily be created using the GnuTLS ``psktool``
5172 program.
5173
5174 For server endpoints, dir may also contain a file dh-params.pem
5175 providing diffie-hellman parameters to use for the TLS server.
5176 If the file is missing, QEMU will generate a set of DH
5177 parameters at startup. This is a computationally expensive
5178 operation that consumes random pool entropy, so it is
5179 recommended that a persistent set of parameters be generated up
5180 front and saved.
5181
5182 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id``
5183 Creates a TLS anonymous credentials object, which can be used to
5184 provide TLS support on network backends. The ``id`` parameter is
5185 a unique ID which network backends will use to access the
5186 credentials. The ``endpoint`` is either ``server`` or ``client``
5187 depending on whether the QEMU network backend that uses the
5188 credentials will be acting as a client or as a server. If
5189 ``verify-peer`` is enabled (the default) then once the handshake
5190 is completed, the peer credentials will be verified. With x509
5191 certificates, this implies that the clients must be provided
5192 with valid client certificates too.
5193
5194 The dir parameter tells QEMU where to find the credential files.
5195 For server endpoints, this directory may contain a file
5196 dh-params.pem providing diffie-hellman parameters to use for the
5197 TLS server. If the file is missing, QEMU will generate a set of
5198 DH parameters at startup. This is a computationally expensive
5199 operation that consumes random pool entropy, so it is
5200 recommended that a persistent set of parameters be generated
5201 upfront and saved.
5202
5203 For x509 certificate credentials the directory will contain
5204 further files providing the x509 certificates. The certificates
5205 must be stored in PEM format, in filenames ca-cert.pem,
5206 ca-crl.pem (optional), server-cert.pem (only servers),
5207 server-key.pem (only servers), client-cert.pem (only clients),
5208 and client-key.pem (only clients).
5209
5210 For the server-key.pem and client-key.pem files which contain
5211 sensitive private keys, it is possible to use an encrypted
5212 version by providing the passwordid parameter. This provides the
5213 ID of a previously created ``secret`` object containing the
5214 password for decryption.
5215
5216 The priority parameter allows to override the global default
5217 priority used by gnutls. This can be useful if the system
5218 administrator needs to use a weaker set of crypto priorities for
5219 QEMU without potentially forcing the weakness onto all
5220 applications. Or conversely if one wants wants a stronger
5221 default for QEMU than for all other applications, they can do
5222 this through this parameter. Its format is a gnutls priority
5223 string as described at
5224 https://gnutls.org/manual/html_node/Priority-Strings.html.
5225
Philippe Mathieu-Daudé993aec22018-10-11 20:21:11 +02005226 ``-object tls-cipher-suites,id=id,priority=priority``
5227 Creates a TLS cipher suites object, which can be used to control
5228 the TLS cipher/protocol algorithms that applications are permitted
5229 to use.
5230
5231 The ``id`` parameter is a unique ID which frontends will use to
5232 access the ordered list of permitted TLS cipher suites from the
5233 host.
5234
5235 The ``priority`` parameter allows to override the global default
5236 priority used by gnutls. This can be useful if the system
5237 administrator needs to use a weaker set of crypto priorities for
5238 QEMU without potentially forcing the weakness onto all
5239 applications. Or conversely if one wants wants a stronger
5240 default for QEMU than for all other applications, they can do
5241 this through this parameter. Its format is a gnutls priority
5242 string as described at
5243 https://gnutls.org/manual/html_node/Priority-Strings.html.
5244
Philippe Mathieu-Daudé69699f32020-05-14 15:15:47 +02005245 An example of use of this object is to control UEFI HTTPS Boot.
5246 The tls-cipher-suites object exposes the ordered list of permitted
5247 TLS cipher suites from the host side to the guest firmware, via
5248 fw_cfg. The list is represented as an array of IANA_TLS_CIPHER
5249 objects. The firmware uses the IANA_TLS_CIPHER array for configuring
5250 guest-side TLS.
5251
5252 In the following example, the priority at which the host-side policy
5253 is retrieved is given by the ``priority`` property.
5254 Given that QEMU uses GNUTLS, ``priority=@SYSTEM`` may be used to
5255 refer to /etc/crypto-policies/back-ends/gnutls.config.
5256
5257 .. parsed-literal::
5258
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005259 # |qemu_system| \\
5260 -object tls-cipher-suites,id=mysuite0,priority=@SYSTEM \\
Philippe Mathieu-Daudé69699f32020-05-14 15:15:47 +02005261 -fw_cfg name=etc/edk2/https/ciphers,gen_id=mysuite0
5262
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005263 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]``
5264 Interval t can't be 0, this filter batches the packet delivery:
5265 all packets arriving in a given interval on netdev netdevid are
5266 delayed until the end of the interval. Interval is in
5267 microseconds. ``status`` is optional that indicate whether the
5268 netfilter is on (enabled) or off (disabled), the default status
5269 for netfilter will be 'on'.
5270
5271 queue all\|rx\|tx is an option that can be applied to any
5272 netfilter.
5273
5274 ``all``: the filter is attached both to the receive and the
5275 transmit queue of the netdev (default).
5276
5277 ``rx``: the filter is attached to the receive queue of the
5278 netdev, where it will receive packets sent to the netdev.
5279
5280 ``tx``: the filter is attached to the transmit queue of the
5281 netdev, where it will receive packets sent by the netdev.
5282
5283 position head\|tail\|id=<id> is an option to specify where the
5284 filter should be inserted in the filter list. It can be applied
5285 to any netfilter.
5286
5287 ``head``: the filter is inserted at the head of the filter list,
5288 before any existing filters.
5289
5290 ``tail``: the filter is inserted at the tail of the filter list,
5291 behind any existing filters (default).
5292
5293 ``id=<id>``: the filter is inserted before or behind the filter
5294 specified by <id>, see the insert option below.
5295
5296 insert behind\|before is an option to specify where to insert
5297 the new filter relative to the one specified with
5298 position=id=<id>. It can be applied to any netfilter.
5299
5300 ``before``: insert before the specified filter.
5301
5302 ``behind``: insert behind the specified filter (default).
5303
5304 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
5305 filter-mirror on netdev netdevid,mirror net packet to
5306 chardevchardevid, if it has the vnet\_hdr\_support flag,
5307 filter-mirror will mirror packet with vnet\_hdr\_len.
5308
5309 ``-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]``
5310 filter-redirector on netdev netdevid,redirect filter's net
5311 packet to chardev chardevid,and redirect indev's packet to
5312 filter.if it has the vnet\_hdr\_support flag, filter-redirector
5313 will redirect packet with vnet\_hdr\_len. Create a
5314 filter-redirector we need to differ outdev id from indev id, id
5315 can not be the same. we can just use indev or outdev, but at
5316 least one of indev or outdev need to be specified.
5317
5318 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
5319 Filter-rewriter is a part of COLO project.It will rewrite tcp
5320 packet to secondary from primary to keep secondary tcp
5321 connection,and rewrite tcp packet to primary from secondary make
5322 tcp packet can be handled by client.if it has the
5323 vnet\_hdr\_support flag, we can parse packet with vnet header.
5324
5325 usage: colo secondary: -object
5326 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object
5327 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object
5328 filter-rewriter,id=rew0,netdev=hn0,queue=all
5329
5330 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]``
5331 Dump the network traffic on netdev dev to the file specified by
5332 filename. At most len bytes (64k by default) per packet are
5333 stored. The file format is libpcap, so it can be analyzed with
5334 tools such as tcpdump or Wireshark.
5335
Zhang Chena2e5cb72020-06-24 09:20:41 +08005336 ``-object colo-compare,id=id,primary_in=chardevid,secondary_in=chardevid,outdev=chardevid,iothread=id[,vnet_hdr_support][,notify_dev=id][,compare_timeout=@var{ms}][,expired_scan_cycle=@var{ms}][,max_queue_size=@var{size}]``
Zhang Chen2b28a7e2020-06-24 09:20:42 +08005337 Colo-compare gets packet from primary\_in chardevid and
5338 secondary\_in, then compare whether the payload of primary packet
5339 and secondary packet are the same. If same, it will output
5340 primary packet to out\_dev, else it will notify COLO-framework to do
5341 checkpoint and send primary packet to out\_dev. In order to
5342 improve efficiency, we need to put the task of comparison in
5343 another iothread. If it has the vnet\_hdr\_support flag,
5344 colo compare will send/recv packet with vnet\_hdr\_len.
5345 The compare\_timeout=@var{ms} determines the maximum time of the
5346 colo-compare hold the packet. The expired\_scan\_cycle=@var{ms}
5347 is to set the period of scanning expired primary node network packets.
5348 The max\_queue\_size=@var{size} is to set the max compare queue
5349 size depend on user environment.
5350 If user want to use Xen COLO, need to add the notify\_dev to
Zhang Chen9cc43c92020-03-18 16:23:19 +08005351 notify Xen colo-frame to do checkpoint.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005352
Zhang Chen2b28a7e2020-06-24 09:20:42 +08005353 COLO-compare must be used with the help of filter-mirror,
5354 filter-redirector and filter-rewriter.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005355
5356 ::
5357
5358 KVM COLO
5359
5360 primary:
5361 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
5362 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005363 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off
5364 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off
5365 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005366 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005367 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005368 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
5369 -object iothread,id=iothread1
5370 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
5371 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
5372 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
5373 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
5374
5375 secondary:
5376 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
5377 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
5378 -chardev socket,id=red0,host=3.3.3.3,port=9003
5379 -chardev socket,id=red1,host=3.3.3.3,port=9004
5380 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
5381 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
5382
5383
5384 Xen COLO
5385
5386 primary:
5387 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
5388 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005389 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off
5390 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off
5391 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005392 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005393 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005394 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005395 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005396 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
5397 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
5398 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
5399 -object iothread,id=iothread1
5400 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
5401
5402 secondary:
5403 -netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
5404 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
5405 -chardev socket,id=red0,host=3.3.3.3,port=9003
5406 -chardev socket,id=red1,host=3.3.3.3,port=9004
5407 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
5408 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
5409
5410 If you want to know the detail of above command line, you can
5411 read the colo-compare git log.
5412
5413 ``-object cryptodev-backend-builtin,id=id[,queues=queues]``
Stefan Weil1e458f12022-10-30 11:59:44 +01005414 Creates a cryptodev backend which executes crypto operations from
5415 the QEMU cipher APIs. The id parameter is a unique ID that will
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005416 be used to reference this cryptodev backend from the
5417 ``virtio-crypto`` device. The queues parameter is optional,
5418 which specify the queue number of cryptodev backend, the default
5419 of queues is 1.
5420
Peter Maydell09ce5f22020-02-28 15:36:13 +00005421 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005422
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005423 # |qemu_system| \\
5424 [...] \\
5425 -object cryptodev-backend-builtin,id=cryptodev0 \\
5426 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005427 [...]
5428
5429 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]``
5430 Creates a vhost-user cryptodev backend, backed by a chardev
5431 chardevid. The id parameter is a unique ID that will be used to
5432 reference this cryptodev backend from the ``virtio-crypto``
5433 device. The chardev should be a unix domain socket backed one.
5434 The vhost-user uses a specifically defined protocol to pass
5435 vhost ioctl replacement messages to an application on the other
5436 end of the socket. The queues parameter is optional, which
5437 specify the queue number of cryptodev backend for multiqueue
5438 vhost-user, the default of queues is 1.
5439
Peter Maydell09ce5f22020-02-28 15:36:13 +00005440 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005441
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005442 # |qemu_system| \\
5443 [...] \\
5444 -chardev socket,id=chardev0,path=/path/to/socket \\
5445 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \\
5446 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005447 [...]
5448
5449 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00005450 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005451 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]``
5452 Defines a secret to store a password, encryption key, or some
5453 other sensitive data. The sensitive data can either be passed
5454 directly via the data parameter, or indirectly via the file
5455 parameter. Using the data parameter is insecure unless the
5456 sensitive data is encrypted.
5457
5458 The sensitive data can be provided in raw format (the default),
5459 or base64. When encoded as JSON, the raw format only supports
5460 valid UTF-8 characters, so base64 is recommended for sending
5461 binary data. QEMU will convert from which ever format is
5462 provided to the format it needs internally. eg, an RBD password
5463 can be provided in raw format, even though it will be base64
5464 encoded when passed onto the RBD sever.
5465
5466 For added protection, it is possible to encrypt the data
5467 associated with a secret using the AES-256-CBC cipher. Use of
5468 encryption is indicated by providing the keyid and iv
5469 parameters. The keyid parameter provides the ID of a previously
5470 defined secret that contains the AES-256 decryption key. This
5471 key should be 32-bytes long and be base64 encoded. The iv
5472 parameter provides the random initialization vector used for
5473 encryption of this particular secret and should be a base64
5474 encrypted string of the 16-byte IV.
5475
5476 The simplest (insecure) usage is to provide the secret inline
5477
Peter Maydell09ce5f22020-02-28 15:36:13 +00005478 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005479
5480 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw
5481
5482 The simplest secure usage is to provide the secret via a file
5483
5484 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object
5485 secret,id=sec0,file=mypasswd.txt,format=raw
5486
5487 For greater security, AES-256-CBC should be used. To illustrate
5488 usage, consider the openssl command line tool which can encrypt
5489 the data. Note that when encrypting, the plaintext must be
5490 padded to the cipher block size (32 bytes) using the standard
5491 PKCS#5/6 compatible padding algorithm.
5492
5493 First a master key needs to be created in base64 encoding:
5494
5495 ::
5496
5497 # openssl rand -base64 32 > key.b64
5498 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
5499
5500 Each secret to be encrypted needs to have a random
5501 initialization vector generated. These do not need to be kept
5502 secret
5503
5504 ::
5505
5506 # openssl rand -base64 16 > iv.b64
5507 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
5508
5509 The secret to be defined can now be encrypted, in this case
5510 we're telling openssl to base64 encode the result, but it could
5511 be left as raw bytes if desired.
5512
5513 ::
5514
5515 # SECRET=$(printf "letmein" |
5516 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
5517
5518 When launching QEMU, create a master secret pointing to
5519 ``key.b64`` and specify that to be used to decrypt the user
5520 password. Pass the contents of ``iv.b64`` to the second secret
5521
Peter Maydell09ce5f22020-02-28 15:36:13 +00005522 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005523
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005524 # |qemu_system| \\
5525 -object secret,id=secmaster0,format=base64,file=key.b64 \\
5526 -object secret,id=sec0,keyid=secmaster0,format=base64,\\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005527 data=$SECRET,iv=$(<iv.b64)
5528
Dov Murik55cdf562021-11-11 10:00:43 +00005529 ``-object sev-guest,id=id,cbitpos=cbitpos,reduced-phys-bits=val,[sev-device=string,policy=policy,handle=handle,dh-cert-file=file,session-file=file,kernel-hashes=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005530 Create a Secure Encrypted Virtualization (SEV) guest object,
5531 which can be used to provide the guest memory encryption support
5532 on AMD processors.
5533
5534 When memory encryption is enabled, one of the physical address
5535 bit (aka the C-bit) is utilized to mark if a memory page is
5536 protected. The ``cbitpos`` is used to provide the C-bit
5537 position. The C-bit position is Host family dependent hence user
5538 must provide this value. On EPYC, the value should be 47.
5539
5540 When memory encryption is enabled, we loose certain bits in
5541 physical address space. The ``reduced-phys-bits`` is used to
5542 provide the number of bits we loose in physical address space.
5543 Similar to C-bit, the value is Host family dependent. On EPYC,
Tom Lendacky326e3012022-09-30 10:14:28 -05005544 a guest will lose a maximum of 1 bit, so the value should be 1.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005545
5546 The ``sev-device`` provides the device file to use for
5547 communicating with the SEV firmware running inside AMD Secure
5548 Processor. The default device is '/dev/sev'. If hardware
5549 supports memory encryption then /dev/sev devices are created by
5550 CCP driver.
5551
5552 The ``policy`` provides the guest policy to be enforced by the
5553 SEV firmware and restrict what configuration and operational
5554 commands can be performed on this guest by the hypervisor. The
5555 policy should be provided by the guest owner and is bound to the
5556 guest and cannot be changed throughout the lifetime of the
5557 guest. The default is 0.
5558
5559 If guest ``policy`` allows sharing the key with another SEV
5560 guest then ``handle`` can be use to provide handle of the guest
5561 from which to share the key.
5562
5563 The ``dh-cert-file`` and ``session-file`` provides the guest
5564 owner's Public Diffie-Hillman key defined in SEV spec. The PDH
5565 and session parameters are used for establishing a cryptographic
5566 session with the guest owner to negotiate keys used for
5567 attestation. The file must be encoded in base64.
5568
Dov Murik55cdf562021-11-11 10:00:43 +00005569 The ``kernel-hashes`` adds the hashes of given kernel/initrd/
5570 cmdline to a designated guest firmware page for measured Linux
5571 boot with -kernel. The default is off. (Since 6.2)
5572
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005573 e.g to launch a SEV guest
5574
Peter Maydell09ce5f22020-02-28 15:36:13 +00005575 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005576
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005577 # |qemu_system_x86| \\
5578 ...... \\
Tom Lendacky326e3012022-09-30 10:14:28 -05005579 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \\
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005580 -machine ...,memory-encryption=sev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005581 .....
5582
5583 ``-object authz-simple,id=id,identity=string``
5584 Create an authorization object that will control access to
5585 network services.
5586
5587 The ``identity`` parameter is identifies the user and its format
5588 depends on the network service that authorization object is
5589 associated with. For authorizing based on TLS x509 certificates,
5590 the identity must be the x509 distinguished name. Note that care
5591 must be taken to escape any commas in the distinguished name.
5592
5593 An example authorization object to validate a x509 distinguished
5594 name would look like:
5595
Peter Maydell09ce5f22020-02-28 15:36:13 +00005596 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005597
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005598 # |qemu_system| \\
5599 ... \\
5600 -object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,O=Example Org,,L=London,,ST=London,,C=GB' \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005601 ...
5602
5603 Note the use of quotes due to the x509 distinguished name
5604 containing whitespace, and escaping of ','.
5605
Daniel P. Berrangé4d7beea2020-11-04 13:57:21 +00005606 ``-object authz-listfile,id=id,filename=path,refresh=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005607 Create an authorization object that will control access to
5608 network services.
5609
5610 The ``filename`` parameter is the fully qualified path to a file
5611 containing the access control list rules in JSON format.
5612
5613 An example set of rules that match against SASL usernames might
5614 look like:
5615
5616 ::
5617
5618 {
5619 "rules": [
5620 { "match": "fred", "policy": "allow", "format": "exact" },
5621 { "match": "bob", "policy": "allow", "format": "exact" },
5622 { "match": "danb", "policy": "deny", "format": "glob" },
5623 { "match": "dan*", "policy": "allow", "format": "exact" },
5624 ],
5625 "policy": "deny"
5626 }
5627
5628 When checking access the object will iterate over all the rules
5629 and the first rule to match will have its ``policy`` value
5630 returned as the result. If no rules match, then the default
5631 ``policy`` value is returned.
5632
5633 The rules can either be an exact string match, or they can use
5634 the simple UNIX glob pattern matching to allow wildcards to be
5635 used.
5636
5637 If ``refresh`` is set to true the file will be monitored and
5638 automatically reloaded whenever its content changes.
5639
5640 As with the ``authz-simple`` object, the format of the identity
5641 strings being matched depends on the network service, but is
5642 usually a TLS x509 distinguished name, or a SASL username.
5643
5644 An example authorization object to validate a SASL username
5645 would look like:
5646
Peter Maydell09ce5f22020-02-28 15:36:13 +00005647 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005648
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005649 # |qemu_system| \\
5650 ... \\
Daniel P. Berrangé4d7beea2020-11-04 13:57:21 +00005651 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=on \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005652 ...
5653
5654 ``-object authz-pam,id=id,service=string``
5655 Create an authorization object that will control access to
5656 network services.
5657
5658 The ``service`` parameter provides the name of a PAM service to
5659 use for authorization. It requires that a file
5660 ``/etc/pam.d/service`` exist to provide the configuration for
5661 the ``account`` subsystem.
5662
5663 An example authorization object to validate a TLS x509
5664 distinguished name would look like:
5665
Peter Maydell09ce5f22020-02-28 15:36:13 +00005666 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005667
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005668 # |qemu_system| \\
5669 ... \\
5670 -object authz-pam,id=auth0,service=qemu-vnc \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005671 ...
5672
5673 There would then be a corresponding config file for PAM at
5674 ``/etc/pam.d/qemu-vnc`` that contains:
5675
5676 ::
5677
5678 account requisite pam_listfile.so item=user sense=allow \
5679 file=/etc/qemu/vnc.allow
5680
5681 Finally the ``/etc/qemu/vnc.allow`` file would contain the list
Stefan Weil1e458f12022-10-30 11:59:44 +01005682 of x509 distinguished names that are permitted access
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005683
5684 ::
5685
5686 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
5687
Stefano Garzarella1793ad02021-07-21 11:42:10 +02005688 ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink,aio-max-batch=aio-max-batch``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005689 Creates a dedicated event loop thread that devices can be
5690 assigned to. This is known as an IOThread. By default device
5691 emulation happens in vCPU threads or the main event loop thread.
5692 This can become a scalability bottleneck. IOThreads allow device
5693 emulation and I/O to run on other host CPUs.
5694
5695 The ``id`` parameter is a unique ID that will be used to
5696 reference this IOThread from ``-device ...,iothread=id``.
5697 Multiple devices can be assigned to an IOThread. Note that not
5698 all devices support an ``iothread`` parameter.
5699
5700 The ``query-iothreads`` QMP command lists IOThreads and reports
5701 their thread IDs so that the user can configure host CPU
5702 pinning/affinity.
5703
5704 IOThreads use an adaptive polling algorithm to reduce event loop
5705 latency. Instead of entering a blocking system call to monitor
5706 file descriptors and then pay the cost of being woken up when an
5707 event occurs, the polling algorithm spins waiting for events for
5708 a short time. The algorithm's default parameters are suitable
5709 for many cases but can be adjusted based on knowledge of the
5710 workload and/or host device latency.
5711
5712 The ``poll-max-ns`` parameter is the maximum number of
5713 nanoseconds to busy wait for events. Polling can be disabled by
5714 setting this value to 0.
5715
5716 The ``poll-grow`` parameter is the multiplier used to increase
5717 the polling time when the algorithm detects it is missing events
5718 due to not polling long enough.
5719
5720 The ``poll-shrink`` parameter is the divisor used to decrease
5721 the polling time when the algorithm detects it is spending too
5722 long polling without encountering events.
5723
Stefano Garzarella1793ad02021-07-21 11:42:10 +02005724 The ``aio-max-batch`` parameter is the maximum number of requests
5725 in a batch for the AIO engine, 0 means that the engine will use
5726 its default.
5727
5728 The IOThread parameters can be modified at run-time using the
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005729 ``qom-set`` command (where ``iothread1`` is the IOThread's
5730 ``id``):
5731
5732 ::
5733
5734 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
5735ERST
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01005736
5737
Stefan Weil3dbf2c72010-01-16 18:19:44 +01005738HXCOMM This is the last statement. Insert new options before this line!
Paolo Bonzinifd5fc4b2021-05-17 07:34:21 -04005739
5740#undef DEF
5741#undef DEFHEADING
5742#undef ARCHHEADING