blob: 52143cfb8fd2ad67d5bf063ceaeb5e0261fcf161 [file] [log] [blame]
Peter Maydelld95f2602023-12-12 16:23:13 +00001HXCOMM See docs/devel/docs.rst for the format of this file.
2HXCOMM
Peter Maydell3c95fde2020-03-06 17:17:44 +00003HXCOMM Use DEFHEADING() to define headings in both help text and rST.
4HXCOMM Text between SRST and ERST is copied to the rST version and
5HXCOMM discarded from C version.
Blue Swirlad960902010-03-29 19:23:52 +00006HXCOMM DEF(option, HAS_ARG/0, opt_enum, opt_help, arch_mask) is used to
7HXCOMM construct option structures, enums and help message for specified
8HXCOMM architectures.
Peter Maydell3c95fde2020-03-06 17:17:44 +00009HXCOMM HXCOMM can be used for comments, discarded from both rST and C.
blueswir15824d652009-03-28 06:44:27 +000010
Markus Armbrusterde6b4f92017-10-02 16:03:00 +020011DEFHEADING(Standard options:)
blueswir15824d652009-03-28 06:44:27 +000012
13DEF("help", 0, QEMU_OPTION_h,
Blue Swirlad960902010-03-29 19:23:52 +000014 "-h or -help display this help and exit\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000015SRST
16``-h``
17 Display help and exit
18ERST
blueswir15824d652009-03-28 06:44:27 +000019
pbrook9bd7e6d2009-04-07 22:58:45 +000020DEF("version", 0, QEMU_OPTION_version,
Blue Swirlad960902010-03-29 19:23:52 +000021 "-version display version information and exit\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000022SRST
23``-version``
24 Display version information and exit
25ERST
pbrook9bd7e6d2009-04-07 22:58:45 +000026
Jan Kiszka80f52a62011-07-23 12:39:46 +020027DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
28 "-machine [type=]name[,prop[=value][,...]]\n"
Peter Maydell585f6032012-10-04 16:22:01 +010029 " selects emulated machine ('-machine help' for list)\n"
Jan Kiszka80f52a62011-07-23 12:39:46 +020030 " property accel=accel1[:accel2[:...]] selects accelerator\n"
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +020031 " supported accelerators are kvm, xen, hvf, nvmm, whpx or tcg (default: tcg)\n"
Don Slutzd1048be2014-11-21 11:18:52 -050032 " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
Luiz Capitulino8490fc72012-09-05 16:50:16 -030033 " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
Le Tana52a7fd2014-08-16 13:55:40 +080034 " mem-merge=on|off controls memory merge support (default: on)\n"
Tony Krowiak2eb1cd02015-03-12 13:53:51 +010035 " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
Alexander Graf9850c602015-02-23 13:56:42 +010036 " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
Xiao Guangrong87252e12015-12-02 15:20:58 +080037 " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
Greg Kurz902c0532016-02-18 12:32:25 +010038 " nvdimm=on|off controls NVDIMM support (default=off)\n"
Tao Xu244b3f42019-12-13 09:19:22 +080039 " memory-encryption=@var{} memory encryption object to use (default=none)\n"
Igor Mammedov8db0b202021-01-21 11:15:04 -050040 " hmat=on|off controls ACPI HMAT support (default=off)\n"
Jonathan Cameron03b39fc2022-06-08 15:54:33 +010041 " memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n"
Cédric Le Goater57702892022-11-07 17:13:48 +010042 " 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 +020043 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +000044SRST
45``-machine [type=]name[,prop=value[,...]]``
46 Select the emulated machine by name. Use ``-machine help`` to list
47 available machines.
48
49 For architectures which aim to support live migration compatibility
50 across releases, each release will introduce a new versioned machine
51 type. For example, the 2.8.0 release introduced machine types
52 "pc-i440fx-2.8" and "pc-q35-2.8" for the x86\_64/i686 architectures.
53
54 To allow live migration of guests from QEMU version 2.8.0, to QEMU
55 version 2.9.0, the 2.9.0 version must support the "pc-i440fx-2.8"
56 and "pc-q35-2.8" machines too. To allow users live migrating VMs to
57 skip multiple intermediate releases when upgrading, new releases of
58 QEMU will support machine types from many previous versions.
59
60 Supported machine properties are:
61
62 ``accel=accels1[:accels2[:...]]``
63 This is used to enable an accelerator. Depending on the target
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +020064 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available.
Peter Maydelle2fcbf42020-03-06 10:07:14 +000065 By default, tcg is used. If there is more than one accelerator
66 specified, the next one is used if the previous one fails to
67 initialize.
68
69 ``vmport=on|off|auto``
70 Enables emulation of VMWare IO port, for vmmouse etc. auto says
71 to select the value based on accel. For accel=xen the default is
72 off otherwise the default is on.
73
74 ``dump-guest-core=on|off``
75 Include guest memory in a core dump. The default is on.
76
77 ``mem-merge=on|off``
78 Enables or disables memory merge support. This feature, when
79 supported by the host, de-duplicates identical memory pages
80 among VMs instances (enabled by default).
81
82 ``aes-key-wrap=on|off``
83 Enables or disables AES key wrapping support on s390-ccw hosts.
84 This feature controls whether AES wrapping keys will be created
85 to allow execution of AES cryptographic functions. The default
86 is on.
87
88 ``dea-key-wrap=on|off``
89 Enables or disables DEA key wrapping support on s390-ccw hosts.
90 This feature controls whether DEA wrapping keys will be created
91 to allow execution of DEA cryptographic functions. The default
92 is on.
93
94 ``nvdimm=on|off``
95 Enables or disables NVDIMM support. The default is off.
96
Peter Maydelle2fcbf42020-03-06 10:07:14 +000097 ``memory-encryption=``
98 Memory encryption object to use. The default is none.
99
100 ``hmat=on|off``
101 Enables or disables ACPI Heterogeneous Memory Attribute Table
102 (HMAT) support. The default is off.
Igor Mammedov8db0b202021-01-21 11:15:04 -0500103
Peter Maydell95355822021-07-19 11:52:57 +0100104 ``memory-backend='id'``
Igor Mammedov8db0b202021-01-21 11:15:04 -0500105 An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options.
106 Allows to use a memory backend as main RAM.
107
108 For example:
109 ::
Peter Maydell95355822021-07-19 11:52:57 +0100110
111 -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on
112 -machine memory-backend=pc.ram
113 -m 512M
Igor Mammedov8db0b202021-01-21 11:15:04 -0500114
115 Migration compatibility note:
Peter Maydell95355822021-07-19 11:52:57 +0100116
117 * as backend id one shall use value of 'default-ram-id', advertised by
118 machine type (available via ``query-machines`` QMP command), if migration
119 to/from old QEMU (<5.0) is expected.
120 * for machine types 4.0 and older, user shall
121 use ``x-use-canonical-path-for-ramblock-id=off`` backend option
122 if migration to/from old QEMU (<5.0) is expected.
123
Igor Mammedov8db0b202021-01-21 11:15:04 -0500124 For example:
125 ::
Peter Maydell95355822021-07-19 11:52:57 +0100126
127 -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off
128 -machine memory-backend=pc.ram
129 -m 512M
Jonathan Cameron03b39fc2022-06-08 15:54:33 +0100130
131 ``cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]``
132 Define a CXL Fixed Memory Window (CFMW).
133
134 Described in the CXL 2.0 ECN: CEDT CFMWS & QTG _DSM.
135
136 They are regions of Host Physical Addresses (HPA) on a system which
137 may be interleaved across one or more CXL host bridges. The system
138 software will assign particular devices into these windows and
139 configure the downstream Host-managed Device Memory (HDM) decoders
140 in root ports, switch ports and devices appropriately to meet the
141 interleave requirements before enabling the memory devices.
142
143 ``targets.X=target`` provides the mapping to CXL host bridges
Stefan Weil2cb40d42022-11-10 20:08:25 +0100144 which may be identified by the id provided in the -device entry.
Jonathan Cameron03b39fc2022-06-08 15:54:33 +0100145 Multiple entries are needed to specify all the targets when
146 the fixed memory window represents interleaved memory. X is the
147 target index from 0.
148
149 ``size=size`` sets the size of the CFMW. This must be a multiple of
150 256MiB. The region will be aligned to 256MiB but the location is
151 platform and configuration dependent.
152
153 ``interleave-granularity=granularity`` sets the granularity of
Yuquan Wangaa88f992024-04-07 16:35:39 +0800154 interleave. Default 256 (bytes). Only 256, 512, 1k, 2k,
155 4k, 8k and 16k granularities supported.
Jonathan Cameron03b39fc2022-06-08 15:54:33 +0100156
157 Example:
158
159 ::
160
Yuquan Wangaa88f992024-04-07 16:35:39 +0800161 -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000162ERST
blueswir15824d652009-03-28 06:44:27 +0000163
Sean Christophersondfce81f2021-09-28 10:40:58 +0200164DEF("M", HAS_ARG, QEMU_OPTION_M,
Yang Zhong11058122021-11-01 12:20:05 -0400165 " sgx-epc.0.memdev=memid,sgx-epc.0.node=numaid\n",
Sean Christophersondfce81f2021-09-28 10:40:58 +0200166 QEMU_ARCH_ALL)
167
168SRST
Yang Zhong11058122021-11-01 12:20:05 -0400169``sgx-epc.0.memdev=@var{memid},sgx-epc.0.node=@var{numaid}``
Sean Christophersondfce81f2021-09-28 10:40:58 +0200170 Define an SGX EPC section.
171ERST
Jan Kiszka80f52a62011-07-23 12:39:46 +0200172
blueswir15824d652009-03-28 06:44:27 +0000173DEF("cpu", HAS_ARG, QEMU_OPTION_cpu,
Peter Maydell585f6032012-10-04 16:22:01 +0100174 "-cpu cpu select CPU ('-cpu help' for list)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000175SRST
176``-cpu model``
177 Select CPU model (``-cpu help`` for list and additional feature
178 selection)
179ERST
blueswir15824d652009-03-28 06:44:27 +0000180
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000181DEF("accel", HAS_ARG, QEMU_OPTION_accel,
Paolo Bonzinife174132019-11-13 15:16:44 +0100182 "-accel [accel=]accelerator[,prop[=value][,...]]\n"
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +0200183 " select accelerator (kvm, xen, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
Paolo Bonzini46472d82019-11-13 10:56:53 +0100184 " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
Paolo Bonzini11bc4a12019-11-13 10:56:53 +0100185 " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
Paolo Bonzini23b08982019-11-13 10:56:53 +0100186 " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
Peter Maydell3cfb0452023-04-17 17:40:32 +0100187 " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n"
Richard Hendersona35b3e12020-10-28 20:50:29 -0700188 " split-wx=on|off (enable TCG split w^x mapping)\n"
Paolo Bonzinife174132019-11-13 15:16:44 +0100189 " tb-size=n (TCG translation block cache size)\n"
Peter Xu2ea5cb02021-05-06 12:05:47 -0400190 " dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n"
Shameer Kolothumc8f2eb52023-09-05 10:12:46 +0100191 " eager-split-size=n (KVM Eager Page Split chunk size, default 0, disabled. ARM only)\n"
Chenyi Qiange2e69f62022-09-29 15:20:14 +0800192 " notify-vmexit=run|internal-error|disable,notify-window=n (enable notify VM exit and set notify window, x86 only)\n"
Daan De Meyeraef158b2023-10-21 15:40:15 +0200193 " thread=single|multi (enable multi-threaded TCG)\n"
194 " device=path (KVM device path, default /dev/kvm)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000195SRST
196``-accel name[,prop=value[,...]]``
197 This is used to enable an accelerator. Depending on the target
Philippe Mathieu-Daudéb91b0fc2023-06-24 00:52:29 +0200198 architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available. By
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000199 default, tcg is used. If there is more than one accelerator
200 specified, the next one is used if the previous one fails to
201 initialize.
202
203 ``igd-passthru=on|off``
204 When Xen is in use, this option controls whether Intel
205 integrated graphics devices can be passed through to the guest
206 (default=off)
207
208 ``kernel-irqchip=on|off|split``
209 Controls KVM in-kernel irqchip support. The default is full
210 acceleration of the interrupt controllers. On x86, split irqchip
211 reduces the kernel attack surface, at a performance cost for
212 non-MSI interrupts. Disabling the in-kernel irqchip completely
213 is not recommended except for debugging purposes.
214
215 ``kvm-shadow-mem=size``
216 Defines the size of the KVM shadow MMU.
217
Peter Maydell3cfb0452023-04-17 17:40:32 +0100218 ``one-insn-per-tb=on|off``
219 Makes the TCG accelerator put only one guest instruction into
220 each translation block. This slows down emulation a lot, but
221 can be useful in some situations, such as when trying to analyse
222 the logs produced by the ``-d`` option.
223
Richard Hendersona35b3e12020-10-28 20:50:29 -0700224 ``split-wx=on|off``
225 Controls the use of split w^x mapping for the TCG code generation
226 buffer. Some operating systems require this to be enabled, and in
227 such a case this will default on. On other operating systems, this
228 will default off, but one may enable this for testing or debugging.
229
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000230 ``tb-size=n``
231 Controls the size (in MiB) of the TCG translation block cache.
232
233 ``thread=single|multi``
234 Controls number of TCG threads. When the TCG is multi-threaded
Michael Tokarevcba42d62021-03-09 14:15:10 +0300235 there will be one thread per vCPU therefore taking advantage of
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000236 additional host cores. The default is to enable multi-threading
237 where both the back-end and front-ends support it and no
238 incompatible TCG features have been enabled (e.g.
239 icount/replay).
Peter Xu2ea5cb02021-05-06 12:05:47 -0400240
241 ``dirty-ring-size=n``
242 When the KVM accelerator is used, it controls the size of the per-vCPU
243 dirty page ring buffer (number of entries for each vCPU). It should
244 be a value that is power of two, and it should be 1024 or bigger (but
245 still less than the maximum value that the kernel supports). 4096
246 could be a good initial value if you have no idea which is the best.
247 Set this value to 0 to disable the feature. By default, this feature
248 is disabled (dirty-ring-size=0). When enabled, KVM will instead
249 record dirty pages in a bitmap.
250
Shameer Kolothumc8f2eb52023-09-05 10:12:46 +0100251 ``eager-split-size=n``
252 KVM implements dirty page logging at the PAGE_SIZE granularity and
253 enabling dirty-logging on a huge-page requires breaking it into
254 PAGE_SIZE pages in the first place. KVM on ARM does this splitting
255 lazily by default. There are performance benefits in doing huge-page
256 split eagerly, especially in situations where TLBI costs associated
257 with break-before-make sequences are considerable and also if guest
258 workloads are read intensive. The size here specifies how many pages
259 to break at a time and needs to be a valid block size which is
260 1GB/2MB/4KB, 32MB/16KB and 512MB/64KB for 4KB/16KB/64KB PAGE_SIZE
261 respectively. Be wary of specifying a higher size as it will have an
262 impact on the memory. By default, this feature is disabled
263 (eager-split-size=0).
264
Chenyi Qiange2e69f62022-09-29 15:20:14 +0800265 ``notify-vmexit=run|internal-error|disable,notify-window=n``
266 Enables or disables notify VM exit support on x86 host and specify
267 the corresponding notify window to trigger the VM exit if enabled.
268 ``run`` option enables the feature. It does nothing and continue
269 if the exit happens. ``internal-error`` option enables the feature.
270 It raises a internal error. ``disable`` option doesn't enable the feature.
271 This feature can mitigate the CPU stuck issue due to event windows don't
272 open up for a specified of time (i.e. notify-window).
273 Default: notify-vmexit=run,notify-window=0.
274
Daan De Meyeraef158b2023-10-21 15:40:15 +0200275 ``device=path``
276 Sets the path to the KVM device node. Defaults to ``/dev/kvm``. This
277 option can be used to pass the KVM device to use via a file descriptor
278 by setting the value to ``/dev/fdset/NN``.
279
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000280ERST
KONRAD Frederic8d4e9142017-02-23 18:29:08 +0000281
blueswir15824d652009-03-28 06:44:27 +0000282DEF("smp", HAS_ARG, QEMU_OPTION_smp,
Pierre Morel5de1aff2023-10-16 20:39:06 +0200283 "-smp [[cpus=]n][,maxcpus=maxcpus][,drawers=drawers][,books=books][,sockets=sockets]\n"
Zhao Liu68074872024-04-24 23:49:26 +0800284 " [,dies=dies][,clusters=clusters][,modules=modules][,cores=cores]\n"
285 " [,threads=threads]\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800286 " set the number of initial CPUs to 'n' [default=1]\n"
Daniel P. Berrangéce8ee7c2021-06-22 15:30:43 +0100287 " maxcpus= maximum number of total CPUs, including\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -0700288 " offline CPUs for hotplug, etc\n"
Pierre Morel5de1aff2023-10-16 20:39:06 +0200289 " drawers= number of drawers on the machine board\n"
290 " books= number of books in one drawer\n"
291 " sockets= number of sockets in one book\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800292 " dies= number of dies in one socket\n"
Yanan Wang864c3b52021-12-28 17:22:09 +0800293 " clusters= number of clusters in one die\n"
Zhao Liu68074872024-04-24 23:49:26 +0800294 " modules= number of modules in one cluster\n"
295 " cores= number of cores in one module\n"
Yanan Wang0d871782021-12-28 17:22:08 +0800296 " threads= number of threads in one core\n"
297 "Note: Different machines may have different subsets of the CPU topology\n"
298 " parameters supported, so the actual meaning of the supported parameters\n"
299 " will vary accordingly. For example, for a machine type that supports a\n"
300 " three-level CPU hierarchy of sockets/cores/threads, the parameters will\n"
301 " sequentially mean as below:\n"
302 " sockets means the number of sockets on the machine board\n"
303 " cores means the number of cores in one socket\n"
304 " threads means the number of threads in one core\n"
305 " For a particular machine type board, an expected CPU topology hierarchy\n"
306 " can be defined through the supported sub-option. Unsupported parameters\n"
307 " can also be provided in addition to the sub-option, but their values\n"
308 " must be set as 1 in the purpose of correct parsing.\n",
309 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000310SRST
Zhao Liu68074872024-04-24 23:49:26 +0800311``-smp [[cpus=]n][,maxcpus=maxcpus][,drawers=drawers][,books=books][,sockets=sockets][,dies=dies][,clusters=clusters][,modules=modules][,cores=cores][,threads=threads]``
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100312 Simulate a SMP system with '\ ``n``\ ' CPUs initially present on
313 the machine type board. On boards supporting CPU hotplug, the optional
314 '\ ``maxcpus``\ ' parameter can be set to enable further CPUs to be
Yanan Wang7d8c5a32021-09-29 10:58:05 +0800315 added at runtime. When both parameters are omitted, the maximum number
316 of CPUs will be calculated from the provided topology members and the
317 initial CPU count will match the maximum number. When only one of them
318 is given then the omitted one will be set to its counterpart's value.
319 Both parameters may be specified, but the maximum number of CPUs must
Yanan Wang0d871782021-12-28 17:22:08 +0800320 be equal to or greater than the initial CPU count. Product of the
321 CPU topology hierarchy must be equal to the maximum number of CPUs.
322 Both parameters are subject to an upper limit that is determined by
323 the specific machine type chosen.
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100324
Yanan Wang0d871782021-12-28 17:22:08 +0800325 To control reporting of CPU topology information, values of the topology
326 parameters can be specified. Machines may only support a subset of the
327 parameters and different machines may have different subsets supported
328 which vary depending on capacity of the corresponding CPU targets. So
329 for a particular machine type board, an expected topology hierarchy can
330 be defined through the supported sub-option. Unsupported parameters can
331 also be provided in addition to the sub-option, but their values must be
332 set as 1 in the purpose of correct parsing.
Daniel P. Berrangé80d78352021-06-22 16:17:09 +0100333
334 Either the initial CPU count, or at least one of the topology parameters
Yanan Wangc2511b12021-09-29 10:58:02 +0800335 must be specified. The specified parameters must be greater than zero,
336 explicit configuration like "cpus=0" is not allowed. Values for any
337 omitted parameters will be computed from those which are given.
Yanan Wang0d871782021-12-28 17:22:08 +0800338
339 For example, the following sub-option defines a CPU topology hierarchy
340 (2 sockets totally on the machine, 2 cores per socket, 2 threads per
341 core) for a machine that only supports sockets/cores/threads.
342 Some members of the option can be omitted but their values will be
343 automatically computed:
344
345 ::
346
347 -smp 8,sockets=2,cores=2,threads=2,maxcpus=8
348
349 The following sub-option defines a CPU topology hierarchy (2 sockets
Zhao Liu68074872024-04-24 23:49:26 +0800350 totally on the machine, 2 dies per socket, 2 modules per die, 2 cores per
351 module, 2 threads per core) for PC machines which support sockets/dies
352 /modules/cores/threads. Some members of the option can be omitted but
353 their values will be automatically computed:
Yanan Wang0d871782021-12-28 17:22:08 +0800354
355 ::
356
Zhao Liu68074872024-04-24 23:49:26 +0800357 -smp 32,sockets=2,dies=2,modules=2,cores=2,threads=2,maxcpus=32
Yanan Wang0d871782021-12-28 17:22:08 +0800358
Yanan Wangd55c3162022-01-07 16:32:27 +0800359 The following sub-option defines a CPU topology hierarchy (2 sockets
360 totally on the machine, 2 clusters per socket, 2 cores per cluster,
361 2 threads per core) for ARM virt machines which support sockets/clusters
362 /cores/threads. Some members of the option can be omitted but their values
363 will be automatically computed:
364
365 ::
366
367 -smp 16,sockets=2,clusters=2,cores=2,threads=2,maxcpus=16
368
Yanan Wangc2511b12021-09-29 10:58:02 +0800369 Historically preference was given to the coarsest topology parameters
370 when computing missing values (ie sockets preferred over cores, which
371 were preferred over threads), however, this behaviour is considered
Yanan Wang4a0af292021-09-29 10:58:09 +0800372 liable to change. Prior to 6.2 the preference was sockets over cores
373 over threads. Since 6.2 the preference is cores over sockets over threads.
Yanan Wang0d871782021-12-28 17:22:08 +0800374
375 For example, the following option defines a machine board with 2 sockets
376 of 1 core before 6.2 and 1 socket of 2 cores after 6.2:
377
378 ::
379
380 -smp 2
Yicong Yang97f4eff2022-12-29 14:55:09 +0800381
382 Note: The cluster topology will only be generated in ACPI and exposed
383 to guest if it's explicitly specified in -smp.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000384ERST
blueswir15824d652009-03-28 06:44:27 +0000385
aliguori268a3622009-04-21 22:30:27 +0000386DEF("numa", HAS_ARG, QEMU_OPTION_numa,
Tao Xu244b3f42019-12-13 09:19:22 +0800387 "-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
388 "-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=node]\n"
Igor Mammedov2d19c652017-11-28 15:53:58 +0100389 "-numa dist,src=source,dst=destination,val=distance\n"
Liu Jingqi9b12dfa2019-12-13 09:19:23 +0800390 "-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]\n"
Liu Jingqic412a482019-12-13 09:19:24 +0800391 "-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"
392 "-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 +0100393 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000394SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000395``-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
396 \
397``-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node][,initiator=initiator]``
398 \
399``-numa dist,src=source,dst=destination,val=distance``
400 \
401``-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]``
402 \
Stefan Weil2cb40d42022-11-10 20:08:25 +0100403``-numa hmat-lb,initiator=node,target=node,hierarchy=hierarchy,data-type=type[,latency=lat][,bandwidth=bw]``
Peter Maydell09ce5f22020-02-28 15:36:13 +0000404 \
405``-numa hmat-cache,node-id=node,size=size,level=level[,associativity=str][,policy=str][,line=size]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000406 Define a NUMA node and assign RAM and VCPUs to it. Set the NUMA
407 distance from a source node to a destination node. Set the ACPI
408 Heterogeneous Memory Attributes for the given nodes.
409
410 Legacy VCPU assignment uses '\ ``cpus``\ ' option where firstcpu and
411 lastcpu are CPU indexes. Each '\ ``cpus``\ ' option represent a
412 contiguous range of CPU indexes (or a single VCPU if lastcpu is
413 omitted). A non-contiguous set of VCPUs can be represented by
414 providing multiple '\ ``cpus``\ ' options. If '\ ``cpus``\ ' is
415 omitted on all nodes, VCPUs are automatically split between them.
416
417 For example, the following option assigns VCPUs 0, 1, 2 and 5 to a
418 NUMA node:
419
420 ::
421
422 -numa node,cpus=0-2,cpus=5
423
424 '\ ``cpu``\ ' option is a new alternative to '\ ``cpus``\ ' option
425 which uses '\ ``socket-id|core-id|thread-id``\ ' properties to
426 assign CPU objects to a node using topology layout properties of
427 CPU. The set of properties is machine specific, and depends on used
428 machine type/'\ ``smp``\ ' options. It could be queried with
429 '\ ``hotpluggable-cpus``\ ' monitor command. '\ ``node-id``\ '
430 property specifies node to which CPU object will be assigned, it's
431 required for node to be declared with '\ ``node``\ ' option before
432 it's used with '\ ``cpu``\ ' option.
433
434 For example:
435
436 ::
437
438 -M pc \
439 -smp 1,sockets=2,maxcpus=2 \
440 -numa node,nodeid=0 -numa node,nodeid=1 \
441 -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
442
Yohei Kojima4f513982023-04-24 10:22:45 +0100443 '\ ``memdev``\ ' option assigns RAM from a given memory backend
444 device to a node. It is recommended to use '\ ``memdev``\ ' option
445 over legacy '\ ``mem``\ ' option. This is because '\ ``memdev``\ '
446 option provides better performance and more control over the
447 backend's RAM (e.g. '\ ``prealloc``\ ' parameter of
448 '\ ``-memory-backend-ram``\ ' allows memory preallocation).
Igor Mammedov32a354d2020-06-09 09:56:35 -0400449
Yohei Kojima4f513982023-04-24 10:22:45 +0100450 For compatibility reasons, legacy '\ ``mem``\ ' option is
451 supported in 5.0 and older machine types. Note that '\ ``mem``\ '
452 and '\ ``memdev``\ ' are mutually exclusive. If one node uses
453 '\ ``memdev``\ ', the rest nodes have to use '\ ``memdev``\ '
454 option, and vice versa.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000455
Yohei Kojima4f513982023-04-24 10:22:45 +0100456 Users must specify memory for all NUMA nodes by '\ ``memdev``\ '
457 (or legacy '\ ``mem``\ ' if available). In QEMU 5.2, the support
458 for '\ ``-numa node``\ ' without memory specified was removed.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000459
460 '\ ``initiator``\ ' is an additional option that points to an
461 initiator NUMA node that has best performance (the lowest latency or
462 largest bandwidth) to this NUMA node. Note that this option can be
463 set only when the machine property 'hmat' is set to 'on'.
464
465 Following example creates a machine with 2 NUMA nodes, node 0 has
466 CPU. node 1 has only memory, and its initiator is node 0. Note that
467 because node 0 has CPU, by default the initiator of node 0 is itself
468 and must be itself.
469
470 ::
471
472 -machine hmat=on \
473 -m 2G,slots=2,maxmem=4G \
474 -object memory-backend-ram,size=1G,id=m0 \
475 -object memory-backend-ram,size=1G,id=m1 \
476 -numa node,nodeid=0,memdev=m0 \
477 -numa node,nodeid=1,memdev=m1,initiator=0 \
478 -smp 2,sockets=2,maxcpus=2 \
479 -numa cpu,node-id=0,socket-id=0 \
480 -numa cpu,node-id=0,socket-id=1
481
482 source and destination are NUMA node IDs. distance is the NUMA
483 distance from source to destination. The distance from a node to
484 itself is always 10. If any pair of nodes is given a distance, then
485 all pairs must be given distances. Although, when distances are only
486 given in one direction for each pair of nodes, then the distances in
487 the opposite directions are assumed to be the same. If, however, an
488 asymmetrical pair of distances is given for even one node pair, then
489 all node pairs must be provided distance values for both directions,
490 even when they are symmetrical. When a node is unreachable from
491 another node, set the pair's distance to 255.
492
493 Note that the -``numa`` option doesn't allocate any of the specified
494 resources, it just assigns existing resources to NUMA nodes. This
495 means that one still has to use the ``-m``, ``-smp`` options to
496 allocate RAM and VCPUs respectively.
497
498 Use '\ ``hmat-lb``\ ' to set System Locality Latency and Bandwidth
499 Information between initiator and target NUMA nodes in ACPI
500 Heterogeneous Attribute Memory Table (HMAT). Initiator NUMA node can
501 create memory requests, usually it has one or more processors.
502 Target NUMA node contains addressable memory.
503
504 In '\ ``hmat-lb``\ ' option, node are NUMA node IDs. hierarchy is
505 the memory hierarchy of the target NUMA node: if hierarchy is
506 'memory', the structure represents the memory performance; if
507 hierarchy is 'first-level\|second-level\|third-level', this
508 structure represents aggregated performance of memory side caches
509 for each domain. type of 'data-type' is type of data represented by
510 this structure instance: if 'hierarchy' is 'memory', 'data-type' is
511 'access\|read\|write' latency or 'access\|read\|write' bandwidth of
512 the target memory; if 'hierarchy' is
513 'first-level\|second-level\|third-level', 'data-type' is
514 'access\|read\|write' hit latency or 'access\|read\|write' hit
515 bandwidth of the target memory side cache.
516
517 lat is latency value in nanoseconds. bw is bandwidth value, the
518 possible value and units are NUM[M\|G\|T], mean that the bandwidth
519 value are NUM byte per second (or MB/s, GB/s or TB/s depending on
520 used suffix). Note that if latency or bandwidth value is 0, means
521 the corresponding latency or bandwidth information is not provided.
522
523 In '\ ``hmat-cache``\ ' option, node-id is the NUMA-id of the memory
524 belongs. size is the size of memory side cache in bytes. level is
525 the cache level described in this structure, note that the cache
526 level 0 should not be used with '\ ``hmat-cache``\ ' option.
527 associativity is the cache associativity, the possible value is
528 'none/direct(direct-mapped)/complex(complex cache indexing)'. policy
529 is the write policy. line is the cache Line size in bytes.
530
531 For example, the following options describe 2 NUMA nodes. Node 0 has
532 2 cpus and a ram, node 1 has only a ram. The processors in node 0
533 access memory in node 0 with access-latency 5 nanoseconds,
534 access-bandwidth is 200 MB/s; The processors in NUMA node 0 access
535 memory in NUMA node 1 with access-latency 10 nanoseconds,
536 access-bandwidth is 100 MB/s. And for memory side cache information,
537 NUMA node 0 and 1 both have 1 level memory cache, size is 10KB,
538 policy is write-back, the cache Line size is 8 bytes:
539
540 ::
541
542 -machine hmat=on \
543 -m 2G \
544 -object memory-backend-ram,size=1G,id=m0 \
545 -object memory-backend-ram,size=1G,id=m1 \
Yanan Wang848dd262021-09-28 20:11:34 +0800546 -smp 2,sockets=2,maxcpus=2 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000547 -numa node,nodeid=0,memdev=m0 \
548 -numa node,nodeid=1,memdev=m1,initiator=0 \
549 -numa cpu,node-id=0,socket-id=0 \
550 -numa cpu,node-id=0,socket-id=1 \
551 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-latency,latency=5 \
552 -numa hmat-lb,initiator=0,target=0,hierarchy=memory,data-type=access-bandwidth,bandwidth=200M \
553 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-latency,latency=10 \
554 -numa hmat-lb,initiator=0,target=1,hierarchy=memory,data-type=access-bandwidth,bandwidth=100M \
555 -numa hmat-cache,node-id=0,size=10K,level=1,associativity=direct,policy=write-back,line=8 \
556 -numa hmat-cache,node-id=1,size=10K,level=1,associativity=direct,policy=write-back,line=8
557ERST
aliguori268a3622009-04-21 22:30:27 +0000558
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100559DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd,
560 "-add-fd fd=fd,set=set[,opaque=opaque]\n"
561 " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000562SRST
563``-add-fd fd=fd,set=set[,opaque=opaque]``
564 Add a file descriptor to an fd set. Valid options are:
565
566 ``fd=fd``
567 This option defines the file descriptor of which a duplicate is
568 added to fd set. The file descriptor cannot be stdin, stdout, or
569 stderr.
570
571 ``set=set``
572 This option defines the ID of the fd set to add the file
573 descriptor to.
574
575 ``opaque=opaque``
576 This option defines a free-form string that can be used to
577 describe fd.
578
579 You can open an image using pre-opened file descriptors from an fd
580 set:
581
582 .. parsed-literal::
583
Laszlo Ersek353a06b2020-09-08 19:21:11 +0200584 |qemu_system| \\
585 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\
586 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000587 -drive file=/dev/fdset/2,index=0,media=disk
588ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100589
590DEF("set", HAS_ARG, QEMU_OPTION_set,
591 "-set group.id.arg=value\n"
592 " set <arg> parameter for item <id> of type <group>\n"
593 " i.e. -set drive.$id.file=/path/to/image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000594SRST
595``-set group.id.arg=value``
596 Set parameter arg for item id of type group
597ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100598
599DEF("global", HAS_ARG, QEMU_OPTION_global,
Paolo Bonzini3751d7c2015-04-09 14:16:19 +0200600 "-global driver.property=value\n"
601 "-global driver=driver,property=property,value=value\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100602 " set a global default for a driver property\n",
603 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000604SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +0000605``-global driver.prop=value``
606 \
607``-global driver=driver,property=property,value=value``
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000608 Set default value of driver's property prop to value, e.g.:
609
610 .. parsed-literal::
611
612 |qemu_system_x86| -global ide-hd.physical_block_size=4096 disk-image.img
613
614 In particular, you can use this to set driver properties for devices
615 which are created automatically by the machine model. To create a
616 device which is not created automatically and set properties on it,
617 use -``device``.
618
619 -global driver.prop=value is shorthand for -global
620 driver=driver,property=prop,value=value. The longhand syntax works
621 even when driver contains a dot.
622ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100623
624DEF("boot", HAS_ARG, QEMU_OPTION_boot,
625 "-boot [order=drives][,once=drives][,menu=on|off]\n"
Amos Kongc8a6ae82013-03-19 14:23:27 +0800626 " [,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100627 " 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)\n"
628 " 'sp_name': the file's name that would be passed to bios as logo picture, if menu=on\n"
629 " 'sp_time': the period that splash picture last if menu=on, unit is ms\n"
630 " 'rb_timeout': the timeout before guest reboot when boot failed, unit is ms\n",
631 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000632SRST
633``-boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_timeout][,strict=on|off]``
634 Specify boot order drives as a string of drive letters. Valid drive
635 letters depend on the target architecture. The x86 PC uses: a, b
636 (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p
637 (Etherboot from network adapter 1-4), hard disk boot is the default.
638 To apply a particular boot order only on the first startup, specify
639 it via ``once``. Note that the ``order`` or ``once`` parameter
640 should not be used together with the ``bootindex`` property of
641 devices, since the firmware implementations normally do not support
642 both at the same time.
643
644 Interactive boot menus/prompts can be enabled via ``menu=on`` as far
645 as firmware/BIOS supports them. The default is non-interactive boot.
646
647 A splash picture could be passed to bios, enabling user to show it
648 as logo, when option splash=sp\_name is given and menu=on, If
649 firmware/BIOS supports them. Currently Seabios for X86 system
650 support it. limitation: The splash file could be a jpeg file or a
651 BMP file in 24 BPP format(true color). The resolution should be
652 supported by the SVGA mode, so the recommended is 320x240, 640x480,
653 800x640.
654
655 A timeout could be passed to bios, guest will pause for rb\_timeout
656 ms when boot failed, then reboot. If rb\_timeout is '-1', guest will
657 not reboot, qemu passes '-1' to bios by default. Currently Seabios
658 for X86 system support it.
659
660 Do strict boot via ``strict=on`` as far as firmware/BIOS supports
661 it. This only effects when boot priority is changed by bootindex
662 options. The default is non-strict boot.
663
Peter Maydell09ce5f22020-02-28 15:36:13 +0000664 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000665
666 # try to boot from network first, then from hard disk
667 |qemu_system_x86| -boot order=nc
668 # boot from CD-ROM first, switch back to default order after reboot
669 |qemu_system_x86| -boot once=d
670 # boot with a splash picture for 5 seconds.
671 |qemu_system_x86| -boot menu=on,splash=/root/boot.bmp,splash-time=5000
672
673 Note: The legacy format '-boot drives' is still supported but its
674 use is discouraged as it may be removed from future versions.
675ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100676
677DEF("m", HAS_ARG, QEMU_OPTION_m,
Michael Tokarev89f3ea22016-11-10 17:51:32 +0300678 "-m [size=]megs[,slots=n,maxmem=size]\n"
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100679 " configure guest RAM\n"
Alexander Graf0daba1f2015-06-05 11:05:03 +0200680 " size: initial amount of guest memory\n"
Igor Mammedovc270fb92014-06-02 15:25:02 +0200681 " slots: number of hotplug slots (default: none)\n"
Matthew Rosatob6fe0122014-08-28 11:25:33 -0400682 " maxmem: maximum amount of guest memory (default: none)\n"
Thomas Hutha635bcf2023-07-03 09:56:46 +0200683 " Note: Some architectures might enforce a specific granularity\n",
Igor Mammedov6e1d3c12013-11-27 01:27:35 +0100684 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000685SRST
686``-m [size=]megs[,slots=n,maxmem=size]``
687 Sets guest startup RAM size to megs megabytes. Default is 128 MiB.
688 Optionally, a suffix of "M" or "G" can be used to signify a value in
689 megabytes or gigabytes respectively. Optional pair slots, maxmem
690 could be used to set amount of hotpluggable memory slots and maximum
691 amount of memory. Note that maxmem must be aligned to the page size.
692
693 For example, the following command-line sets the guest startup RAM
694 size to 1GB, creates 3 slots to hotplug additional memory and sets
695 the maximum memory the guest can reach to 4GB:
696
697 .. parsed-literal::
698
699 |qemu_system| -m 1G,slots=3,maxmem=4G
700
701 If slots and maxmem are not specified, memory hotplug won't be
702 enabled and the guest startup RAM will never increase.
703ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100704
705DEF("mem-path", HAS_ARG, QEMU_OPTION_mempath,
706 "-mem-path FILE provide backing storage for guest RAM\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000707SRST
708``-mem-path path``
709 Allocate guest RAM from a temporarily created file in path.
710ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100711
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100712DEF("mem-prealloc", 0, QEMU_OPTION_mem_prealloc,
713 "-mem-prealloc preallocate guest memory (use with -mem-path)\n",
714 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000715SRST
716``-mem-prealloc``
717 Preallocate memory when using -mem-path.
718ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100719
720DEF("k", HAS_ARG, QEMU_OPTION_k,
721 "-k language use keyboard layout (for example 'fr' for French)\n",
722 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000723SRST
724``-k language``
725 Use keyboard layout language (for example ``fr`` for French). This
726 option is only needed where it is not easy to get raw PC keycodes
727 (e.g. on Macs, with some X11 servers or with a VNC or curses
728 display). You don't normally need to use it on PC/Linux or
729 PC/Windows hosts.
730
731 The available layouts are:
732
733 ::
734
735 ar de-ch es fo fr-ca hu ja mk no pt-br sv
736 da en-gb et fr fr-ch is lt nl pl ru th
737 de en-us fi fr-be hr it lv nl-be pt sl tr
738
739 The default is ``en-us``.
740ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +0100741
742
Paolo Bonzini039a6832022-04-27 12:27:46 +0200743DEF("audio", HAS_ARG, QEMU_OPTION_audio,
Paolo Bonzini1ebdbff2023-09-21 10:23:58 +0200744 "-audio [driver=]driver[,prop[=value][,...]]\n"
745 " specifies default audio backend when `audiodev` is not\n"
746 " used to create a machine or sound device;"
747 " options are the same as for -audiodev\n"
Paolo Bonzini039a6832022-04-27 12:27:46 +0200748 "-audio [driver=]driver,model=value[,prop[=value][,...]]\n"
749 " specifies the audio backend and device to use;\n"
750 " apart from 'model', options are the same as for -audiodev.\n"
751 " use '-audio model=help' to show possible devices.\n",
752 QEMU_ARCH_ALL)
753SRST
Paolo Bonzini1ebdbff2023-09-21 10:23:58 +0200754``-audio [driver=]driver[,model=value][,prop[=value][,...]]``
755 If the ``model`` option is specified, ``-audio`` is a shortcut
756 for configuring both the guest audio hardware and the host audio
757 backend in one go. The guest hardware model can be set with
758 ``model=modelname``. Use ``model=help`` to list the available
759 device types.
Paolo Bonzini039a6832022-04-27 12:27:46 +0200760
761 The following two example do exactly the same, to show how ``-audio``
762 can be used to shorten the command line length:
763
764 .. parsed-literal::
765
766 |qemu_system| -audiodev pa,id=pa -device sb16,audiodev=pa
767 |qemu_system| -audio pa,model=sb16
Paolo Bonzini1ebdbff2023-09-21 10:23:58 +0200768
769 If the ``model`` option is not specified, ``-audio`` is used to
770 configure a default audio backend that will be used whenever the
771 ``audiodev`` property is not set on a device or machine. In
772 particular, ``-audio none`` ensures that no audio is produced even
773 for machines that have embedded sound hardware.
774
775 In both cases, the driver option is the same as with the corresponding
776 ``-audiodev`` option below. Use ``driver=help`` to list the available
777 drivers.
778
Paolo Bonzini039a6832022-04-27 12:27:46 +0200779ERST
780
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100781DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
782 "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
783 " specifies the audio backend to use\n"
Claudio Fontana5e03b6d2022-09-08 10:14:41 +0200784 " Use ``-audiodev help`` to list the available drivers\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100785 " id= identifier of the backend\n"
786 " timer-period= timer period in microseconds\n"
Kővágó, Zoltán8efac072019-10-13 21:57:58 +0200787 " in|out.mixing-engine= use mixing engine to mix streams inside QEMU\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100788 " in|out.fixed-settings= use fixed settings for host audio\n"
789 " in|out.frequency= frequency to use with fixed settings\n"
790 " in|out.channels= number of channels to use with fixed settings\n"
791 " in|out.format= sample format to use with fixed settings\n"
Volker Rümelin49f77e62020-03-08 20:33:21 +0100792 " valid values: s8, s16, s32, u8, u16, u32, f32\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100793 " in|out.voices= number of voices to use\n"
Stefan Hajnoczi86247252019-09-18 10:53:33 +0100794 " in|out.buffer-length= length of buffer in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100795 "-audiodev none,id=id,[,prop[=value][,...]]\n"
796 " dummy driver that discards all output\n"
797#ifdef CONFIG_AUDIO_ALSA
798 "-audiodev alsa,id=id[,prop[=value][,...]]\n"
799 " in|out.dev= name of the audio device to use\n"
Stefan Hajnoczidfc54342019-09-18 10:53:35 +0100800 " in|out.period-length= length of period in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100801 " in|out.try-poll= attempt to use poll mode\n"
802 " threshold= threshold (in microseconds) when playback starts\n"
803#endif
804#ifdef CONFIG_AUDIO_COREAUDIO
805 "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
806 " in|out.buffer-count= number of buffers\n"
807#endif
808#ifdef CONFIG_AUDIO_DSOUND
809 "-audiodev dsound,id=id[,prop[=value][,...]]\n"
810 " latency= add extra latency to playback in microseconds\n"
811#endif
812#ifdef CONFIG_AUDIO_OSS
813 "-audiodev oss,id=id[,prop[=value][,...]]\n"
814 " in|out.dev= path of the audio device to use\n"
815 " in|out.buffer-count= number of buffers\n"
816 " in|out.try-poll= attempt to use poll mode\n"
817 " try-mmap= try using memory mapped access\n"
818 " exclusive= open device in exclusive mode\n"
819 " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
820#endif
821#ifdef CONFIG_AUDIO_PA
822 "-audiodev pa,id=id[,prop[=value][,...]]\n"
823 " server= PulseAudio server address\n"
824 " in|out.name= source/sink device name\n"
Stefan Hajnoczi14d4f012019-10-04 13:56:41 +0100825 " in|out.latency= desired latency in microseconds\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100826#endif
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200827#ifdef CONFIG_AUDIO_PIPEWIRE
828 "-audiodev pipewire,id=id[,prop[=value][,...]]\n"
829 " in|out.name= source/sink device name\n"
830 " in|out.stream-name= name of pipewire stream\n"
831 " in|out.latency= desired latency in microseconds\n"
832#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100833#ifdef CONFIG_AUDIO_SDL
834 "-audiodev sdl,id=id[,prop[=value][,...]]\n"
Volker Rümelin5a0926c2021-01-10 11:02:19 +0100835 " in|out.buffer-count= number of buffers\n"
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100836#endif
Alexandre Ratchov663df1c2022-09-07 15:23:42 +0200837#ifdef CONFIG_AUDIO_SNDIO
838 "-audiodev sndio,id=id[,prop[=value][,...]]\n"
839#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100840#ifdef CONFIG_SPICE
841 "-audiodev spice,id=id[,prop[=value][,...]]\n"
842#endif
Marc-André Lureau739362d2021-03-09 17:15:28 +0400843#ifdef CONFIG_DBUS_DISPLAY
844 "-audiodev dbus,id=id[,prop[=value][,...]]\n"
845#endif
Kővágó, Zoltánf0b3d812019-03-08 23:34:14 +0100846 "-audiodev wav,id=id[,prop[=value][,...]]\n"
847 " path= path of wav file to record\n",
848 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000849SRST
850``-audiodev [driver=]driver,id=id[,prop[=value][,...]]``
851 Adds a new audio backend driver identified by id. There are global
852 and driver specific properties. Some values can be set differently
853 for input and output, they're marked with ``in|out.``. You can set
854 the input's property with ``in.prop`` and the output's property with
855 ``out.prop``. For example:
856
857 ::
858
859 -audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
860 -audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
861
862 NOTE: parameter validation is known to be incomplete, in many cases
863 specifying an invalid option causes QEMU to print an error message
864 and continue emulation without sound.
865
866 Valid global options are:
867
868 ``id=identifier``
869 Identifies the audio backend.
870
871 ``timer-period=period``
872 Sets the timer period used by the audio subsystem in
873 microseconds. Default is 10000 (10 ms).
874
875 ``in|out.mixing-engine=on|off``
876 Use QEMU's mixing engine to mix all streams inside QEMU and
877 convert audio formats when not supported by the backend. When
878 off, fixed-settings must be off too. Note that disabling this
879 option means that the selected backend must support multiple
880 streams and the audio formats used by the virtual cards,
881 otherwise you'll get no sound. It's not recommended to disable
882 this option unless you want to use 5.1 or 7.1 audio, as mixing
883 engine only supports mono and stereo audio. Default is on.
884
885 ``in|out.fixed-settings=on|off``
886 Use fixed settings for host audio. When off, it will change
887 based on how the guest opens the sound card. In this case you
888 must not specify frequency, channels or format. Default is on.
889
890 ``in|out.frequency=frequency``
891 Specify the frequency to use when using fixed-settings. Default
892 is 44100Hz.
893
894 ``in|out.channels=channels``
895 Specify the number of channels to use when using fixed-settings.
896 Default is 2 (stereo).
897
898 ``in|out.format=format``
899 Specify the sample format to use when using fixed-settings.
900 Valid values are: ``s8``, ``s16``, ``s32``, ``u8``, ``u16``,
Volker Rümelin49f77e62020-03-08 20:33:21 +0100901 ``u32``, ``f32``. Default is ``s16``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +0000902
903 ``in|out.voices=voices``
904 Specify the number of voices to use. Default is 1.
905
906 ``in|out.buffer-length=usecs``
907 Sets the size of the buffer in microseconds.
908
909``-audiodev none,id=id[,prop[=value][,...]]``
910 Creates a dummy backend that discards all outputs. This backend has
911 no backend specific properties.
912
913``-audiodev alsa,id=id[,prop[=value][,...]]``
914 Creates backend using the ALSA. This backend is only available on
915 Linux.
916
917 ALSA specific options are:
918
919 ``in|out.dev=device``
920 Specify the ALSA device to use for input and/or output. Default
921 is ``default``.
922
923 ``in|out.period-length=usecs``
924 Sets the period length in microseconds.
925
926 ``in|out.try-poll=on|off``
927 Attempt to use poll mode with the device. Default is on.
928
929 ``threshold=threshold``
930 Threshold (in microseconds) when playback starts. Default is 0.
931
932``-audiodev coreaudio,id=id[,prop[=value][,...]]``
933 Creates a backend using Apple's Core Audio. This backend is only
934 available on Mac OS and only supports playback.
935
936 Core Audio specific options are:
937
938 ``in|out.buffer-count=count``
939 Sets the count of the buffers.
940
941``-audiodev dsound,id=id[,prop[=value][,...]]``
942 Creates a backend using Microsoft's DirectSound. This backend is
943 only available on Windows and only supports playback.
944
945 DirectSound specific options are:
946
947 ``latency=usecs``
948 Add extra usecs microseconds latency to playback. Default is
949 10000 (10 ms).
950
951``-audiodev oss,id=id[,prop[=value][,...]]``
952 Creates a backend using OSS. This backend is available on most
953 Unix-like systems.
954
955 OSS specific options are:
956
957 ``in|out.dev=device``
958 Specify the file name of the OSS device to use. Default is
959 ``/dev/dsp``.
960
961 ``in|out.buffer-count=count``
962 Sets the count of the buffers.
963
964 ``in|out.try-poll=on|of``
965 Attempt to use poll mode with the device. Default is on.
966
967 ``try-mmap=on|off``
968 Try using memory mapped device access. Default is off.
969
970 ``exclusive=on|off``
971 Open the device in exclusive mode (vmix won't work in this
972 case). Default is off.
973
974 ``dsp-policy=policy``
975 Sets the timing policy (between 0 and 10, where smaller number
976 means smaller latency but higher CPU usage). Use -1 to use
977 buffer sizes specified by ``buffer`` and ``buffer-count``. This
978 option is ignored if you do not have OSS 4. Default is 5.
979
980``-audiodev pa,id=id[,prop[=value][,...]]``
981 Creates a backend using PulseAudio. This backend is available on
982 most systems.
983
984 PulseAudio specific options are:
985
986 ``server=server``
987 Sets the PulseAudio server to connect to.
988
989 ``in|out.name=sink``
990 Use the specified source/sink for recording/playback.
991
992 ``in|out.latency=usecs``
993 Desired latency in microseconds. The PulseAudio server will try
994 to honor this value but actual latencies may be lower or higher.
995
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200996``-audiodev pipewire,id=id[,prop[=value][,...]]``
Marc-André Lureau20c51242023-05-06 20:37:26 +0400997 Creates a backend using PipeWire. This backend is available on
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +0200998 most systems.
999
Marc-André Lureau20c51242023-05-06 20:37:26 +04001000 PipeWire specific options are:
Dorinda Basseyc2d3d1c2023-04-17 12:56:54 +02001001
1002 ``in|out.latency=usecs``
1003 Desired latency in microseconds.
1004
1005 ``in|out.name=sink``
1006 Use the specified source/sink for recording/playback.
1007
1008 ``in|out.stream-name``
1009 Specify the name of pipewire stream.
1010
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001011``-audiodev sdl,id=id[,prop[=value][,...]]``
1012 Creates a backend using SDL. This backend is available on most
1013 systems, but you should use your platform's native backend if
Volker Rümelin5a0926c2021-01-10 11:02:19 +01001014 possible.
1015
1016 SDL specific options are:
1017
1018 ``in|out.buffer-count=count``
1019 Sets the count of the buffers.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001020
Alexandre Ratchov663df1c2022-09-07 15:23:42 +02001021``-audiodev sndio,id=id[,prop[=value][,...]]``
1022 Creates a backend using SNDIO. This backend is available on
1023 OpenBSD and most other Unix-like systems.
1024
1025 Sndio specific options are:
1026
1027 ``in|out.dev=device``
1028 Specify the sndio device to use for input and/or output. Default
1029 is ``default``.
1030
1031 ``in|out.latency=usecs``
1032 Sets the desired period length in microseconds.
1033
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001034``-audiodev spice,id=id[,prop[=value][,...]]``
1035 Creates a backend that sends audio through SPICE. This backend
1036 requires ``-spice`` and automatically selected in that case, so
1037 usually you can ignore this option. This backend has no backend
1038 specific properties.
1039
1040``-audiodev wav,id=id[,prop[=value][,...]]``
1041 Creates a backend that writes audio to a WAV file.
1042
1043 Backend specific options are:
1044
1045 ``path=path``
1046 Write recorded audio into the specified file. Default is
1047 ``qemu.wav``.
1048ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001049
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001050DEF("device", HAS_ARG, QEMU_OPTION_device,
1051 "-device driver[,prop[=value][,...]]\n"
1052 " add device (based on driver)\n"
1053 " prop=value,... sets driver properties\n"
1054 " use '-device help' to print all possible drivers\n"
1055 " use '-device driver,help' to print all possible properties\n",
1056 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001057SRST
1058``-device driver[,prop[=value][,...]]``
1059 Add device driver. prop=value sets driver properties. Valid
1060 properties depend on the driver. To get help on possible drivers and
1061 properties, use ``-device help`` and ``-device driver,help``.
1062
1063 Some drivers are:
1064
Corey Minyard789101b2020-07-17 11:37:02 -05001065``-device ipmi-bmc-sim,id=id[,prop[=value][,...]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001066 Add an IPMI BMC. This is a simulation of a hardware management
1067 interface processor that normally sits on a system. It provides a
1068 watchdog and the ability to reset and power control the system. You
1069 need to connect this to an IPMI interface to make it useful
1070
1071 The IPMI slave address to use for the BMC. The default is 0x20. This
1072 address is the BMC's address on the I2C network of management
1073 controllers. If you don't know what this means, it is safe to ignore
1074 it.
1075
1076 ``id=id``
1077 The BMC id for interfaces to use this device.
1078
1079 ``slave_addr=val``
1080 Define slave address to use for the BMC. The default is 0x20.
1081
1082 ``sdrfile=file``
1083 file containing raw Sensor Data Records (SDR) data. The default
1084 is none.
1085
1086 ``fruareasize=val``
1087 size of a Field Replaceable Unit (FRU) area. The default is
1088 1024.
1089
1090 ``frudatafile=file``
1091 file containing raw Field Replaceable Unit (FRU) inventory data.
1092 The default is none.
1093
1094 ``guid=uuid``
1095 value for the GUID for the BMC, in standard UUID format. If this
1096 is set, get "Get GUID" command to the BMC will return it.
1097 Otherwise "Get GUID" will return an error.
1098
1099``-device ipmi-bmc-extern,id=id,chardev=id[,slave_addr=val]``
1100 Add a connection to an external IPMI BMC simulator. Instead of
1101 locally emulating the BMC like the above item, instead connect to an
1102 external entity that provides the IPMI services.
1103
1104 A connection is made to an external BMC simulator. If you do this,
1105 it is strongly recommended that you use the "reconnect=" chardev
1106 option to reconnect to the simulator if the connection is lost. Note
1107 that if this is not used carefully, it can be a security issue, as
1108 the interface has the ability to send resets, NMIs, and power off
1109 the VM. It's best if QEMU makes a connection to an external
1110 simulator running on a secure port on localhost, so neither the
1111 simulator nor QEMU is exposed to any outside network.
1112
1113 See the "lanserv/README.vm" file in the OpenIPMI library for more
1114 details on the external interface.
1115
1116``-device isa-ipmi-kcs,bmc=id[,ioport=val][,irq=val]``
Stefan Weil1e458f12022-10-30 11:59:44 +01001117 Add a KCS IPMI interface on the ISA bus. This also adds a
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001118 corresponding ACPI and SMBIOS entries, if appropriate.
1119
1120 ``bmc=id``
1121 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern
1122 above.
1123
1124 ``ioport=val``
1125 Define the I/O address of the interface. The default is 0xca0
1126 for KCS.
1127
1128 ``irq=val``
1129 Define the interrupt to use. The default is 5. To disable
1130 interrupts, set this to 0.
1131
1132``-device isa-ipmi-bt,bmc=id[,ioport=val][,irq=val]``
1133 Like the KCS interface, but defines a BT interface. The default port
1134 is 0xe4 and the default interrupt is 5.
Corey Minyard323679d2019-09-23 13:50:33 -05001135
1136``-device pci-ipmi-kcs,bmc=id``
Stefan Weil1e458f12022-10-30 11:59:44 +01001137 Add a KCS IPMI interface on the PCI bus.
Corey Minyard323679d2019-09-23 13:50:33 -05001138
1139 ``bmc=id``
1140 The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above.
1141
1142``-device pci-ipmi-bt,bmc=id``
1143 Like the KCS interface, but defines a BT interface on the PCI bus.
Peter Xu7395b3e2021-07-07 11:41:14 -04001144
1145``-device intel-iommu[,option=...]``
1146 This is only supported by ``-machine q35``, which will enable Intel VT-d
1147 emulation within the guest. It supports below options:
1148
1149 ``intremap=on|off`` (default: auto)
1150 This enables interrupt remapping feature. It's required to enable
1151 complete x2apic. Currently it only supports kvm kernel-irqchip modes
1152 ``off`` or ``split``, while full kernel-irqchip is not yet supported.
1153 The default value is "auto", which will be decided by the mode of
1154 kernel-irqchip.
1155
1156 ``caching-mode=on|off`` (default: off)
1157 This enables caching mode for the VT-d emulated device. When
1158 caching-mode is enabled, each guest DMA buffer mapping will generate an
1159 IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
1160 a synchronous way. It is required for ``-device vfio-pci`` to work
1161 with the VT-d device, because host assigned devices requires to setup
1162 the DMA mapping on the host before guest DMA starts.
1163
1164 ``device-iotlb=on|off`` (default: off)
1165 This enables device-iotlb capability for the emulated VT-d device. So
1166 far virtio/vhost should be the only real user for this parameter,
1167 paired with ats=on configured for the device.
1168
1169 ``aw-bits=39|48`` (default: 39)
1170 This decides the address width of IOVA address space. The address
1171 space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
1172 4-level IOMMU page tables.
1173
1174 Please also refer to the wiki page for general scenarios of VT-d
1175 emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
1176
Eric Auger69501292024-03-07 14:43:05 +01001177``-device virtio-iommu-pci[,option=...]``
1178 This is only supported by ``-machine q35`` (x86_64) and ``-machine virt`` (ARM).
1179 It supports below options:
1180
1181 ``granule=val`` (possible values are 4k, 8k, 16k, 64k and host; default: host)
1182 This decides the default granule to be be exposed by the
1183 virtio-iommu. If host, the granule matches the host page size.
1184
Eric Augerf7ada752024-03-07 14:43:10 +01001185 ``aw-bits=val`` (val between 32 and 64, default depends on machine)
1186 This decides the address width of the IOVA address space.
1187
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001188ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001189
1190DEF("name", HAS_ARG, QEMU_OPTION_name,
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001191 "-name string1[,process=string2][,debug-threads=on|off]\n"
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001192 " set the name of the guest\n"
Roman Bolshakov479a5742018-12-17 23:26:01 +03001193 " string1 sets the window title and string2 the process name\n"
1194 " When debug-threads is enabled, individual threads are given a separate name\n"
Dr. David Alan Gilbert8f480de2014-01-30 10:20:31 +00001195 " NOTE: The thread names are for debugging and not a stable API.\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001196 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001197SRST
1198``-name name``
1199 Sets the name of the guest. This name will be displayed in the SDL
1200 window caption. The name will also be used for the VNC server. Also
1201 optionally set the top visible process name in Linux. Naming of
1202 individual threads can also be enabled on Linux to aid debugging.
1203ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001204
1205DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
1206 "-uuid %08x-%04x-%04x-%04x-%012x\n"
1207 " specify machine UUID\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001208SRST
1209``-uuid uuid``
1210 Set system UUID.
1211ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001212
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001213DEFHEADING()
1214
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02001215DEFHEADING(Block device options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01001216
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001217SRST
1218The QEMU block device handling options have a long history and
1219have gone through several iterations as the feature set and complexity
1220of the block layer have grown. Many online guides to QEMU often
1221reference older and deprecated options, which can lead to confusion.
1222
Alex Bennéec1654c32023-04-24 10:22:37 +01001223The most explicit way to describe disks is to use a combination of
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001224``-device`` to specify the hardware device and ``-blockdev`` to
1225describe the backend. The device defines what the guest sees and the
Alex Bennéec1654c32023-04-24 10:22:37 +01001226backend describes how QEMU handles the data. It is the only guaranteed
1227stable interface for describing block devices and as such is
1228recommended for management tools and scripting.
1229
1230The ``-drive`` option combines the device and backend into a single
1231command line option which is a more human friendly. There is however no
1232interface stability guarantee although some older board models still
1233need updating to work with the modern blockdev forms.
1234
1235Older options like ``-hda`` are essentially macros which expand into
1236``-drive`` options for various drive interfaces. The original forms
1237bake in a lot of assumptions from the days when QEMU was emulating a
1238legacy PC, they are not recommended for modern configurations.
Alex Bennée5af2b0f2022-08-22 17:56:08 +01001239
1240ERST
1241
blueswir15824d652009-03-28 06:44:27 +00001242DEF("fda", HAS_ARG, QEMU_OPTION_fda,
Blue Swirlad960902010-03-29 19:23:52 +00001243 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
1244DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001245SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001246``-fda file``
1247 \
1248``-fdb file``
Thomas Huth923e9312020-11-16 15:47:36 +01001249 Use file as floppy disk 0/1 image (see the :ref:`disk images` chapter in
1250 the System Emulation Users Guide).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001251ERST
blueswir15824d652009-03-28 06:44:27 +00001252
1253DEF("hda", HAS_ARG, QEMU_OPTION_hda,
Thomas Huthbcd8e242023-08-29 15:29:48 +02001254 "-hda/-hdb file use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL)
Blue Swirlad960902010-03-29 19:23:52 +00001255DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00001256DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
Thomas Huthbcd8e242023-08-29 15:29:48 +02001257 "-hdc/-hdd file use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL)
Blue Swirlad960902010-03-29 19:23:52 +00001258DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001259SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00001260``-hda file``
1261 \
1262``-hdb file``
1263 \
1264``-hdc file``
1265 \
1266``-hdd file``
Thomas Huthbcd8e242023-08-29 15:29:48 +02001267 Use file as hard disk 0, 1, 2 or 3 image on the default bus of the
1268 emulated machine (this is for example the IDE bus on most x86 machines,
1269 but it can also be SCSI, virtio or something else on other target
1270 architectures). See also the :ref:`disk images` chapter in the System
1271 Emulation Users Guide.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001272ERST
blueswir15824d652009-03-28 06:44:27 +00001273
1274DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
Thomas Huthbcd8e242023-08-29 15:29:48 +02001275 "-cdrom file use 'file' as CD-ROM image\n",
Blue Swirlad960902010-03-29 19:23:52 +00001276 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001277SRST
1278``-cdrom file``
Thomas Huthbcd8e242023-08-29 15:29:48 +02001279 Use file as CD-ROM image on the default bus of the emulated machine
1280 (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom``
1281 at the same time there). On systems that support it, you can use the
1282 host CD-ROM by using ``/dev/cdrom`` as filename.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001283ERST
blueswir15824d652009-03-28 06:44:27 +00001284
Markus Armbruster42e5f392017-02-28 22:27:07 +01001285DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
1286 "-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]\n"
1287 " [,cache.direct=on|off][,cache.no-flush=on|off]\n"
Kevin Wolfc9b749d2019-10-15 12:29:58 +02001288 " [,read-only=on|off][,auto-read-only=on|off]\n"
1289 " [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
Markus Armbruster42e5f392017-02-28 22:27:07 +01001290 " [,driver specific parameters...]\n"
1291 " configure a block backend\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001292SRST
1293``-blockdev option[,option[,option[,...]]]``
1294 Define a new block driver node. Some of the options apply to all
1295 block drivers, other options are only accepted for a specific block
1296 driver. See below for a list of generic options and options for the
1297 most common block drivers.
1298
1299 Options that expect a reference to another node (e.g. ``file``) can
1300 be given in two ways. Either you specify the node name of an already
1301 existing node (file=node-name), or you define a new node inline,
1302 adding options for the referenced node after a dot
1303 (file.filename=path,file.aio=native).
1304
1305 A block driver node created with ``-blockdev`` can be used for a
1306 guest device by specifying its node name for the ``drive`` property
1307 in a ``-device`` argument that defines a block device.
1308
1309 ``Valid options for any block driver node:``
1310 ``driver``
1311 Specifies the block driver to use for the given node.
1312
1313 ``node-name``
1314 This defines the name of the block driver node by which it
1315 will be referenced later. The name must be unique, i.e. it
1316 must not match the name of a different block driver node, or
1317 (if you use ``-drive`` as well) the ID of a drive.
1318
1319 If no node name is specified, it is automatically generated.
1320 The generated node name is not intended to be predictable
1321 and changes between QEMU invocations. For the top level, an
1322 explicit node name must be specified.
1323
1324 ``read-only``
1325 Open the node read-only. Guest write attempts will fail.
1326
1327 Note that some block drivers support only read-only access,
1328 either generally or in certain configurations. In this case,
1329 the default value ``read-only=off`` does not work and the
1330 option must be specified explicitly.
1331
1332 ``auto-read-only``
1333 If ``auto-read-only=on`` is set, QEMU may fall back to
1334 read-only usage even when ``read-only=off`` is requested, or
1335 even switch between modes as needed, e.g. depending on
1336 whether the image file is writable or whether a writing user
1337 is attached to the node.
1338
1339 ``force-share``
1340 Override the image locking system of QEMU by forcing the
1341 node to utilize weaker shared access for permissions where
1342 it would normally request exclusive access. When there is
1343 the potential for multiple instances to have the same file
1344 open (whether this invocation of QEMU is the first or the
1345 second instance), both instances must permit shared access
1346 for the second instance to succeed at opening the file.
1347
1348 Enabling ``force-share=on`` requires ``read-only=on``.
1349
1350 ``cache.direct``
1351 The host page cache can be avoided with ``cache.direct=on``.
1352 This will attempt to do disk IO directly to the guest's
1353 memory. QEMU may still perform an internal copy of the data.
1354
1355 ``cache.no-flush``
1356 In case you don't care about data integrity over host
1357 failures, you can use ``cache.no-flush=on``. This option
1358 tells QEMU that it never needs to write any data to the disk
1359 but can instead keep things in cache. If anything goes
1360 wrong, like your host losing power, the disk storage getting
1361 disconnected accidentally, etc. your image will most
1362 probably be rendered unusable.
1363
1364 ``discard=discard``
1365 discard is one of "ignore" (or "off") or "unmap" (or "on")
1366 and controls whether ``discard`` (also known as ``trim`` or
1367 ``unmap``) requests are ignored or passed to the filesystem.
1368 Some machine types may not support discard requests.
1369
1370 ``detect-zeroes=detect-zeroes``
1371 detect-zeroes is "off", "on" or "unmap" and enables the
1372 automatic conversion of plain zero writes by the OS to
1373 driver specific optimized zero write commands. You may even
1374 choose "unmap" if discard is set to "unmap" to allow a zero
1375 write to be converted to an ``unmap`` operation.
1376
1377 ``Driver-specific options for file``
1378 This is the protocol-level block driver for accessing regular
1379 files.
1380
1381 ``filename``
1382 The path to the image file in the local filesystem
1383
1384 ``aio``
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001385 Specifies the AIO backend (threads/native/io_uring,
1386 default: threads)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001387
1388 ``locking``
1389 Specifies whether the image file is protected with Linux OFD
1390 / POSIX locks. The default is to use the Linux Open File
1391 Descriptor API if available, otherwise no lock is applied.
1392 (auto/on/off, default: auto)
1393
1394 Example:
1395
1396 ::
1397
1398 -blockdev driver=file,node-name=disk,filename=disk.img
1399
1400 ``Driver-specific options for raw``
1401 This is the image format block driver for raw images. It is
1402 usually stacked on top of a protocol level block driver such as
1403 ``file``.
1404
1405 ``file``
1406 Reference to or definition of the data source block driver
1407 node (e.g. a ``file`` driver node)
1408
1409 Example 1:
1410
1411 ::
1412
1413 -blockdev driver=file,node-name=disk_file,filename=disk.img
1414 -blockdev driver=raw,node-name=disk,file=disk_file
1415
1416 Example 2:
1417
1418 ::
1419
1420 -blockdev driver=raw,node-name=disk,file.driver=file,file.filename=disk.img
1421
1422 ``Driver-specific options for qcow2``
1423 This is the image format block driver for qcow2 images. It is
1424 usually stacked on top of a protocol level block driver such as
1425 ``file``.
1426
1427 ``file``
1428 Reference to or definition of the data source block driver
1429 node (e.g. a ``file`` driver node)
1430
1431 ``backing``
1432 Reference to or definition of the backing file block device
1433 (default is taken from the image file). It is allowed to
1434 pass ``null`` here in order to disable the default backing
1435 file.
1436
1437 ``lazy-refcounts``
1438 Whether to enable the lazy refcounts feature (on/off;
1439 default is taken from the image file)
1440
1441 ``cache-size``
1442 The maximum total size of the L2 table and refcount block
1443 caches in bytes (default: the sum of l2-cache-size and
1444 refcount-cache-size)
1445
1446 ``l2-cache-size``
1447 The maximum size of the L2 table cache in bytes (default: if
1448 cache-size is not specified - 32M on Linux platforms, and 8M
1449 on non-Linux platforms; otherwise, as large as possible
1450 within the cache-size, while permitting the requested or the
1451 minimal refcount cache size)
1452
1453 ``refcount-cache-size``
1454 The maximum size of the refcount block cache in bytes
1455 (default: 4 times the cluster size; or if cache-size is
1456 specified, the part of it which is not used for the L2
1457 cache)
1458
1459 ``cache-clean-interval``
1460 Clean unused entries in the L2 and refcount caches. The
1461 interval is in seconds. The default value is 600 on
1462 supporting platforms, and 0 on other platforms. Setting it
1463 to 0 disables this feature.
1464
1465 ``pass-discard-request``
1466 Whether discard requests to the qcow2 device should be
1467 forwarded to the data source (on/off; default: on if
1468 discard=unmap is specified, off otherwise)
1469
1470 ``pass-discard-snapshot``
1471 Whether discard requests for the data source should be
1472 issued when a snapshot operation (e.g. deleting a snapshot)
1473 frees clusters in the qcow2 file (on/off; default: on)
1474
1475 ``pass-discard-other``
1476 Whether discard requests for the data source should be
1477 issued on other occasions where a cluster gets freed
1478 (on/off; default: off)
1479
Jean-Louis Dupond42a28902023-06-05 10:45:24 +02001480 ``discard-no-unref``
Jean-Louis Dupondb2b10902023-10-03 14:52:37 +02001481 When enabled, data clusters will remain preallocated when they are
1482 no longer used, e.g. because they are discarded or converted to
1483 zero clusters. As usual, whether the old data is discarded or kept
1484 on the protocol level (i.e. in the image file) depends on the
1485 setting of the pass-discard-request option. Keeping the clusters
1486 preallocated prevents qcow2 fragmentation that would otherwise be
1487 caused by freeing and re-allocating them later. Besides potential
Jean-Louis Dupond42a28902023-06-05 10:45:24 +02001488 performance degradation, such fragmentation can lead to increased
1489 allocation of clusters past the end of the image file,
1490 resulting in image files whose file length can grow much larger
1491 than their guest disk size would suggest.
1492 If image file length is of concern (e.g. when storing qcow2
1493 images directly on block devices), you should consider enabling
1494 this option.
1495
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001496 ``overlap-check``
1497 Which overlap checks to perform for writes to the image
1498 (none/constant/cached/all; default: cached). For details or
1499 finer granularity control refer to the QAPI documentation of
1500 ``blockdev-add``.
1501
1502 Example 1:
1503
1504 ::
1505
1506 -blockdev driver=file,node-name=my_file,filename=/tmp/disk.qcow2
1507 -blockdev driver=qcow2,node-name=hda,file=my_file,overlap-check=none,cache-size=16777216
1508
1509 Example 2:
1510
1511 ::
1512
1513 -blockdev driver=qcow2,node-name=disk,file.driver=http,file.filename=http://example.com/image.qcow2
1514
1515 ``Driver-specific options for other drivers``
1516 Please refer to the QAPI documentation of the ``blockdev-add``
1517 QMP command.
1518ERST
Markus Armbruster42e5f392017-02-28 22:27:07 +01001519
blueswir15824d652009-03-28 06:44:27 +00001520DEF("drive", HAS_ARG, QEMU_OPTION_drive,
1521 "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
Stefan Hajnoczi92196b22011-08-04 12:26:52 +01001522 " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
Kevin Wolf572023f2018-06-13 11:01:30 +02001523 " [,snapshot=on|off][,rerror=ignore|stop|report]\n"
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001524 " [,werror=ignore|stop|report|enospc][,id=name]\n"
1525 " [,aio=threads|native|io_uring]\n"
Stefan Hajnoczifb0490f2011-11-17 13:40:32 +00001526 " [,readonly=on|off][,copy-on-read=on|off]\n"
Peter Lieven2f7133b2014-07-28 21:53:02 +02001527 " [,discard=ignore|unmap][,detect-zeroes=on|off|unmap]\n"
Benoît Canet3e9fab62013-09-02 14:14:40 +02001528 " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n"
1529 " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n"
1530 " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
1531 " [[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]\n"
Benoît Canet2024c1d2013-09-02 14:14:41 +02001532 " [[,iops_size=is]]\n"
Alberto Garcia76f4afb2015-06-08 18:17:44 +02001533 " [[,group=g]]\n"
Blue Swirlad960902010-03-29 19:23:52 +00001534 " use 'file' as a drive image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001535SRST
1536``-drive option[,option[,option[,...]]]``
1537 Define a new drive. This includes creating a block driver node (the
1538 backend) as well as a guest device, and is mostly a shortcut for
1539 defining the corresponding ``-blockdev`` and ``-device`` options.
1540
1541 ``-drive`` accepts all options that are accepted by ``-blockdev``.
1542 In addition, it knows the following options:
1543
1544 ``file=file``
Thomas Huth923e9312020-11-16 15:47:36 +01001545 This option defines which disk image (see the :ref:`disk images`
1546 chapter in the System Emulation Users Guide) to use with this drive.
1547 If the filename contains comma, you must double it (for instance,
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001548 "file=my,,file" to use file "my,file").
1549
1550 Special files such as iSCSI devices can be specified using
1551 protocol specific URLs. See the section for "Device URL Syntax"
1552 for more information.
1553
1554 ``if=interface``
1555 This option defines on which type on interface the drive is
1556 connected. Available types are: ide, scsi, sd, mtd, floppy,
1557 pflash, virtio, none.
1558
1559 ``bus=bus,unit=unit``
1560 These options define where is connected the drive by defining
1561 the bus number and the unit id.
1562
1563 ``index=index``
Laurent Vivier35aab302022-02-02 15:34:22 +01001564 This option defines where the drive is connected by using an
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001565 index in the list of available connectors of a given interface
1566 type.
1567
1568 ``media=media``
1569 This option defines the type of the media: disk or cdrom.
1570
1571 ``snapshot=snapshot``
1572 snapshot is "on" or "off" and controls snapshot mode for the
1573 given drive (see ``-snapshot``).
1574
1575 ``cache=cache``
1576 cache is "none", "writeback", "unsafe", "directsync" or
1577 "writethrough" and controls how the host cache is used to access
1578 block data. This is a shortcut that sets the ``cache.direct``
1579 and ``cache.no-flush`` options (as in ``-blockdev``), and
1580 additionally ``cache.writeback``, which provides a default for
1581 the ``write-cache`` option of block guest devices (as in
1582 ``-device``). The modes correspond to the following settings:
1583
Peter Maydell09ce5f22020-02-28 15:36:13 +00001584 ============= =============== ============ ==============
1585 \ cache.writeback cache.direct cache.no-flush
1586 ============= =============== ============ ==============
1587 writeback on off off
1588 none on on off
1589 writethrough off off off
1590 directsync off on off
1591 unsafe on off on
1592 ============= =============== ============ ==============
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001593
1594 The default mode is ``cache=writeback``.
1595
1596 ``aio=aio``
Stefano Garzarellaad1e6912020-09-24 17:15:11 +02001597 aio is "threads", "native", or "io_uring" and selects between pthread
1598 based disk I/O, native Linux AIO, or Linux io_uring API.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001599
1600 ``format=format``
1601 Specify which disk format will be used rather than detecting the
1602 format. Can be used to specify format=raw to avoid interpreting
1603 an untrusted format header.
1604
1605 ``werror=action,rerror=action``
1606 Specify which action to take on write and read errors. Valid
1607 actions are: "ignore" (ignore the error and try to continue),
1608 "stop" (pause QEMU), "report" (report the error to the guest),
1609 "enospc" (pause QEMU only if the host disk is full; report the
1610 error to the guest otherwise). The default setting is
1611 ``werror=enospc`` and ``rerror=report``.
1612
1613 ``copy-on-read=copy-on-read``
1614 copy-on-read is "on" or "off" and enables whether to copy read
1615 backing file sectors into the image file.
1616
1617 ``bps=b,bps_rd=r,bps_wr=w``
1618 Specify bandwidth throttling limits in bytes per second, either
1619 for all request types or for reads or writes only. Small values
1620 can lead to timeouts or hangs inside the guest. A safe minimum
1621 for disks is 2 MB/s.
1622
1623 ``bps_max=bm,bps_rd_max=rm,bps_wr_max=wm``
1624 Specify bursts in bytes per second, either for all request types
1625 or for reads or writes only. Bursts allow the guest I/O to spike
1626 above the limit temporarily.
1627
1628 ``iops=i,iops_rd=r,iops_wr=w``
1629 Specify request rate limits in requests per second, either for
1630 all request types or for reads or writes only.
1631
1632 ``iops_max=bm,iops_rd_max=rm,iops_wr_max=wm``
1633 Specify bursts in requests per second, either for all request
1634 types or for reads or writes only. Bursts allow the guest I/O to
1635 spike above the limit temporarily.
1636
1637 ``iops_size=is``
1638 Let every is bytes of a request count as a new request for iops
1639 throttling purposes. Use this option to prevent guests from
1640 circumventing iops limits by sending fewer but larger requests.
1641
1642 ``group=g``
1643 Join a throttling quota group with given name g. All drives that
1644 are members of the same group are accounted for together. Use
1645 this option to prevent guests from circumventing throttling
1646 limits by using many small disks instead of a single larger
1647 disk.
1648
1649 By default, the ``cache.writeback=on`` mode is used. It will report
1650 data writes as completed as soon as the data is present in the host
1651 page cache. This is safe as long as your guest OS makes sure to
1652 correctly flush disk caches where needed. If your guest OS does not
1653 handle volatile disk write caches correctly and your host crashes or
1654 loses power, then the guest may experience data corruption.
1655
1656 For such guests, you should consider using ``cache.writeback=off``.
1657 This means that the host page cache will be used to read and write
1658 data, but write notification will be sent to the guest only after
1659 QEMU has made sure to flush each write to the disk. Be aware that
1660 this has a major impact on performance.
1661
1662 When using the ``-snapshot`` option, unsafe caching is always used.
1663
1664 Copy-on-read avoids accessing the same backing file sectors
1665 repeatedly and is useful when the backing file is over a slow
1666 network. By default copy-on-read is off.
1667
1668 Instead of ``-cdrom`` you can use:
1669
1670 .. parsed-literal::
1671
1672 |qemu_system| -drive file=file,index=2,media=cdrom
1673
1674 Instead of ``-hda``, ``-hdb``, ``-hdc``, ``-hdd``, you can use:
1675
1676 .. parsed-literal::
1677
1678 |qemu_system| -drive file=file,index=0,media=disk
1679 |qemu_system| -drive file=file,index=1,media=disk
1680 |qemu_system| -drive file=file,index=2,media=disk
1681 |qemu_system| -drive file=file,index=3,media=disk
1682
1683 You can open an image using pre-opened file descriptors from an fd
1684 set:
1685
1686 .. parsed-literal::
1687
Laszlo Ersek353a06b2020-09-08 19:21:11 +02001688 |qemu_system| \\
1689 -add-fd fd=3,set=2,opaque="rdwr:/path/to/file" \\
1690 -add-fd fd=4,set=2,opaque="rdonly:/path/to/file" \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001691 -drive file=/dev/fdset/2,index=0,media=disk
1692
1693 You can connect a CDROM to the slave of ide0:
1694
1695 .. parsed-literal::
1696
1697 |qemu_system_x86| -drive file=file,if=ide,index=1,media=cdrom
1698
1699 If you don't specify the "file=" argument, you define an empty
1700 drive:
1701
1702 .. parsed-literal::
1703
1704 |qemu_system_x86| -drive if=ide,index=1,media=cdrom
1705
1706 Instead of ``-fda``, ``-fdb``, you can use:
1707
1708 .. parsed-literal::
1709
1710 |qemu_system_x86| -drive file=file,index=0,if=floppy
1711 |qemu_system_x86| -drive file=file,index=1,if=floppy
1712
1713 By default, interface is "ide" and index is automatically
1714 incremented:
1715
1716 .. parsed-literal::
1717
John Snowa234ec32023-02-02 17:31:21 -05001718 |qemu_system_x86| -drive file=a -drive file=b
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001719
1720 is interpreted like:
1721
1722 .. parsed-literal::
1723
1724 |qemu_system_x86| -hda a -hdb b
1725ERST
blueswir15824d652009-03-28 06:44:27 +00001726
1727DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
Blue Swirlad960902010-03-29 19:23:52 +00001728 "-mtdblock file use 'file' as on-board Flash memory image\n",
1729 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001730SRST
1731``-mtdblock file``
1732 Use file as on-board Flash memory image.
1733ERST
blueswir15824d652009-03-28 06:44:27 +00001734
1735DEF("sd", HAS_ARG, QEMU_OPTION_sd,
Blue Swirlad960902010-03-29 19:23:52 +00001736 "-sd file use 'file' as SecureDigital card image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001737SRST
1738``-sd file``
1739 Use file as SecureDigital card image.
1740ERST
blueswir15824d652009-03-28 06:44:27 +00001741
blueswir15824d652009-03-28 06:44:27 +00001742DEF("snapshot", 0, QEMU_OPTION_snapshot,
Blue Swirlad960902010-03-29 19:23:52 +00001743 "-snapshot write to temporary files instead of disk image files\n",
1744 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001745SRST
1746``-snapshot``
1747 Write to temporary files instead of disk image files. In this case,
1748 the raw disk image you use is not written back. You can however
Thomas Huth923e9312020-11-16 15:47:36 +01001749 force the write back by pressing C-a s (see the :ref:`disk images`
1750 chapter in the System Emulation Users Guide).
Alex Bennéec1654c32023-04-24 10:22:37 +01001751
1752 .. warning::
1753 snapshot is incompatible with ``-blockdev`` (instead use qemu-img
1754 to manually create snapshot images to attach to your blockdev).
1755 If you have mixed ``-blockdev`` and ``-drive`` declarations you
1756 can use the 'snapshot' property on your drive declarations
1757 instead of this global option.
1758
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001759ERST
blueswir15824d652009-03-28 06:44:27 +00001760
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301761DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev,
Greg Kurzb44a6b02019-05-17 17:34:49 +02001762 "-fsdev local,id=id,path=path,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001763 " [,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode]\n"
Pradeep Jagadeeshb8bbdb82017-02-28 10:31:46 +01001764 " [[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]\n"
1765 " [[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]\n"
1766 " [[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]\n"
1767 " [[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02001768 " [[,throttling.iops-size=is]]\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001769 "-fsdev proxy,id=id,socket=socket[,writeout=immediate][,readonly=on]\n"
1770 "-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=immediate][,readonly=on]\n"
Greg Kurzb44a6b02019-05-17 17:34:49 +02001771 "-fsdev synth,id=id\n",
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301772 QEMU_ARCH_ALL)
1773
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001774SRST
Paolo Bonzini991c1802020-11-13 03:10:52 -05001775``-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 +00001776 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001777``-fsdev proxy,id=id,socket=socket[,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001778 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001779``-fsdev proxy,id=id,sock_fd=sock_fd[,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001780 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001781``-fsdev synth,id=id[,readonly=on]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001782 Define a new file system device. Valid options are:
1783
1784 ``local``
1785 Accesses to the filesystem are done by QEMU.
1786
1787 ``proxy``
Christian Schoenebeck71d72ec2023-06-26 13:49:06 +02001788 Accesses to the filesystem are done by virtfs-proxy-helper(1). This
1789 option is deprecated (since QEMU 8.1) and will be removed in a future
1790 version of QEMU. Use ``local`` instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001791
1792 ``synth``
1793 Synthetic filesystem, only used by QTests.
1794
1795 ``id=id``
1796 Specifies identifier for this device.
1797
1798 ``path=path``
1799 Specifies the export path for the file system device. Files
1800 under this path will be available to the 9p client on the guest.
1801
1802 ``security_model=security_model``
1803 Specifies the security model to be used for this export path.
1804 Supported security models are "passthrough", "mapped-xattr",
1805 "mapped-file" and "none". In "passthrough" security model, files
1806 are stored using the same credentials as they are created on the
1807 guest. This requires QEMU to run as root. In "mapped-xattr"
1808 security model, some of the file attributes like uid, gid, mode
1809 bits and link target are stored as file attributes. For
1810 "mapped-file" these attributes are stored in the hidden
1811 .virtfs\_metadata directory. Directories exported by this
1812 security model cannot interact with other unix tools. "none"
1813 security model is same as passthrough except the sever won't
1814 report failures if it fails to set file attributes like
1815 ownership. Security model is mandatory only for local fsdriver.
1816 Other fsdrivers (like proxy) don't take security model as a
1817 parameter.
1818
1819 ``writeout=writeout``
1820 This is an optional argument. The only supported value is
1821 "immediate". This means that host page cache will be used to
1822 read and write data but write notification will be sent to the
1823 guest only when the data has been reported as written by the
1824 storage subsystem.
1825
Paolo Bonzini991c1802020-11-13 03:10:52 -05001826 ``readonly=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001827 Enables exporting 9p share as a readonly mount for guests. By
1828 default read-write access is given.
1829
1830 ``socket=socket``
1831 Enables proxy filesystem driver to use passed socket file for
1832 communicating with virtfs-proxy-helper(1).
1833
1834 ``sock_fd=sock_fd``
1835 Enables proxy filesystem driver to use passed socket descriptor
1836 for communicating with virtfs-proxy-helper(1). Usually a helper
1837 like libvirt will create socketpair and pass one of the fds as
1838 sock\_fd.
1839
1840 ``fmode=fmode``
1841 Specifies the default mode for newly created files on the host.
1842 Works only with security models "mapped-xattr" and
1843 "mapped-file".
1844
1845 ``dmode=dmode``
1846 Specifies the default mode for newly created directories on the
1847 host. Works only with security models "mapped-xattr" and
1848 "mapped-file".
1849
1850 ``throttling.bps-total=b,throttling.bps-read=r,throttling.bps-write=w``
1851 Specify bandwidth throttling limits in bytes per second, either
1852 for all request types or for reads or writes only.
1853
1854 ``throttling.bps-total-max=bm,bps-read-max=rm,bps-write-max=wm``
1855 Specify bursts in bytes per second, either for all request types
1856 or for reads or writes only. Bursts allow the guest I/O to spike
1857 above the limit temporarily.
1858
1859 ``throttling.iops-total=i,throttling.iops-read=r, throttling.iops-write=w``
1860 Specify request rate limits in requests per second, either for
1861 all request types or for reads or writes only.
1862
1863 ``throttling.iops-total-max=im,throttling.iops-read-max=irm, throttling.iops-write-max=iwm``
1864 Specify bursts in requests per second, either for all request
1865 types or for reads or writes only. Bursts allow the guest I/O to
1866 spike above the limit temporarily.
1867
1868 ``throttling.iops-size=is``
1869 Let every is bytes of a request count as a new request for iops
1870 throttling purposes.
1871
1872 -fsdev option is used along with -device driver "virtio-9p-...".
1873
1874``-device virtio-9p-type,fsdev=id,mount_tag=mount_tag``
1875 Options for virtio-9p-... driver are:
1876
1877 ``type``
1878 Specifies the variant to be used. Supported values are "pci",
1879 "ccw" or "device", depending on the machine type.
1880
1881 ``fsdev=id``
1882 Specifies the id value specified along with -fsdev option.
1883
1884 ``mount_tag=mount_tag``
1885 Specifies the tag name to be used by the guest to mount this
1886 export point.
1887ERST
Gautham R Shenoy74db9202010-04-29 17:44:43 +05301888
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05301889DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
Greg Kurzb44a6b02019-05-17 17:34:49 +02001890 "-virtfs local,path=path,mount_tag=tag,security_model=mapped-xattr|mapped-file|passthrough|none\n"
Paolo Bonzini991c1802020-11-13 03:10:52 -05001891 " [,id=id][,writeout=immediate][,readonly=on][,fmode=fmode][,dmode=dmode][,multidevs=remap|forbid|warn]\n"
1892 "-virtfs proxy,mount_tag=tag,socket=socket[,id=id][,writeout=immediate][,readonly=on]\n"
1893 "-virtfs proxy,mount_tag=tag,sock_fd=sock_fd[,id=id][,writeout=immediate][,readonly=on]\n"
1894 "-virtfs synth,mount_tag=tag[,id=id][,readonly=on]\n",
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05301895 QEMU_ARCH_ALL)
1896
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001897SRST
Paolo Bonzini991c1802020-11-13 03:10:52 -05001898``-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 +00001899 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001900``-virtfs proxy,socket=socket,mount_tag=mount_tag [,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001901 \
Paolo Bonzini991c1802020-11-13 03:10:52 -05001902``-virtfs proxy,sock_fd=sock_fd,mount_tag=mount_tag [,writeout=writeout][,readonly=on]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00001903 \
1904``-virtfs synth,mount_tag=mount_tag``
Christian Schoenebeck65abaa02020-05-14 08:06:43 +02001905 Define a new virtual filesystem device and expose it to the guest using
1906 a virtio-9p-device (a.k.a. 9pfs), which essentially means that a certain
1907 directory on host is made directly accessible by guest as a pass-through
1908 file system by using the 9P network protocol for communication between
1909 host and guests, if desired even accessible, shared by several guests
Stefan Weil2cb40d42022-11-10 20:08:25 +01001910 simultaneously.
Christian Schoenebeck65abaa02020-05-14 08:06:43 +02001911
1912 Note that ``-virtfs`` is actually just a convenience shortcut for its
1913 generalized form ``-fsdev -device virtio-9p-pci``.
1914
1915 The general form of pass-through file system options are:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001916
1917 ``local``
1918 Accesses to the filesystem are done by QEMU.
1919
1920 ``proxy``
1921 Accesses to the filesystem are done by virtfs-proxy-helper(1).
Christian Schoenebeck71d72ec2023-06-26 13:49:06 +02001922 This option is deprecated (since QEMU 8.1) and will be removed in a
1923 future version of QEMU. Use ``local`` instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001924
1925 ``synth``
1926 Synthetic filesystem, only used by QTests.
1927
1928 ``id=id``
1929 Specifies identifier for the filesystem device
1930
1931 ``path=path``
1932 Specifies the export path for the file system device. Files
1933 under this path will be available to the 9p client on the guest.
1934
1935 ``security_model=security_model``
1936 Specifies the security model to be used for this export path.
1937 Supported security models are "passthrough", "mapped-xattr",
1938 "mapped-file" and "none". In "passthrough" security model, files
1939 are stored using the same credentials as they are created on the
1940 guest. This requires QEMU to run as root. In "mapped-xattr"
1941 security model, some of the file attributes like uid, gid, mode
1942 bits and link target are stored as file attributes. For
1943 "mapped-file" these attributes are stored in the hidden
1944 .virtfs\_metadata directory. Directories exported by this
1945 security model cannot interact with other unix tools. "none"
1946 security model is same as passthrough except the sever won't
1947 report failures if it fails to set file attributes like
1948 ownership. Security model is mandatory only for local fsdriver.
1949 Other fsdrivers (like proxy) don't take security model as a
1950 parameter.
1951
1952 ``writeout=writeout``
1953 This is an optional argument. The only supported value is
1954 "immediate". This means that host page cache will be used to
1955 read and write data but write notification will be sent to the
1956 guest only when the data has been reported as written by the
1957 storage subsystem.
1958
Paolo Bonzini991c1802020-11-13 03:10:52 -05001959 ``readonly=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00001960 Enables exporting 9p share as a readonly mount for guests. By
1961 default read-write access is given.
1962
1963 ``socket=socket``
1964 Enables proxy filesystem driver to use passed socket file for
1965 communicating with virtfs-proxy-helper(1). Usually a helper like
1966 libvirt will create socketpair and pass one of the fds as
1967 sock\_fd.
1968
1969 ``sock_fd``
1970 Enables proxy filesystem driver to use passed 'sock\_fd' as the
1971 socket descriptor for interfacing with virtfs-proxy-helper(1).
1972
1973 ``fmode=fmode``
1974 Specifies the default mode for newly created files on the host.
1975 Works only with security models "mapped-xattr" and
1976 "mapped-file".
1977
1978 ``dmode=dmode``
1979 Specifies the default mode for newly created directories on the
1980 host. Works only with security models "mapped-xattr" and
1981 "mapped-file".
1982
1983 ``mount_tag=mount_tag``
1984 Specifies the tag name to be used by the guest to mount this
1985 export point.
1986
1987 ``multidevs=multidevs``
1988 Specifies how to deal with multiple devices being shared with a
1989 9p export. Supported behaviours are either "remap", "forbid" or
1990 "warn". The latter is the default behaviour on which virtfs 9p
1991 expects only one device to be shared with the same export, and
1992 if more than one device is shared and accessed via the same 9p
1993 export then only a warning message is logged (once) by qemu on
1994 host side. In order to avoid file ID collisions on guest you
1995 should either create a separate virtfs export for each device to
1996 be shared with guests (recommended way) or you might use "remap"
1997 instead which allows you to share multiple devices with only one
1998 export instead, which is achieved by remapping the original
1999 inode numbers from host to guest in a way that would prevent
2000 such collisions. Remapping inodes in such use cases is required
2001 because the original device IDs from host are never passed and
2002 exposed on guest. Instead all files of an export shared with
2003 virtfs always share the same device id on guest. So two files
2004 with identical inode numbers but from actually different devices
2005 on host would otherwise cause a file ID collision and hence
2006 potential misbehaviours on guest. "forbid" on the other hand
2007 assumes like "warn" that only one device is shared by the same
2008 export, however it will not only log a warning message but also
2009 deny access to additional devices on guest. Note though that
2010 "forbid" does currently not block all possible file access
2011 operations (e.g. readdir() would still return entries from other
2012 devices).
2013ERST
Gautham R Shenoy3d54abc2010-04-29 17:45:03 +05302014
Markus Armbruster61d70482017-10-02 16:03:03 +02002015DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi,
Daniel P. Berrangéc3b3a6c2022-12-01 04:25:05 -05002016 "-iscsi [user=user][,password=password][,password-secret=secret-id]\n"
2017 " [,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE]\n"
Markus Armbruster61d70482017-10-02 16:03:03 +02002018 " [,initiator-name=initiator-iqn][,id=target-iqn]\n"
2019 " [,timeout=timeout]\n"
2020 " iSCSI session parameters\n", QEMU_ARCH_ALL)
2021
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002022SRST
2023``-iscsi``
2024 Configure iSCSI session parameters.
2025ERST
Markus Armbruster44743142017-10-02 16:03:04 +02002026
blueswir15824d652009-03-28 06:44:27 +00002027DEFHEADING()
2028
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002029DEFHEADING(USB convenience options:)
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002030
2031DEF("usb", 0, QEMU_OPTION_usb,
Stefan Hajnoczi73f46fe2019-08-15 15:14:28 +01002032 "-usb enable on-board USB host controller (if not enabled by default)\n",
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002033 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002034SRST
2035``-usb``
2036 Enable USB emulation on machine types with an on-board USB host
2037 controller (if not enabled by default). Note that on-board USB host
2038 controllers may not support USB 3.0. In this case
2039 ``-device qemu-xhci`` can be used instead on machines with PCI.
2040ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002041
2042DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
2043 "-usbdevice name add the host or guest USB device 'name'\n",
2044 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002045SRST
2046``-usbdevice devname``
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002047 Add the USB device devname, and enable an on-board USB controller
2048 if possible and necessary (just like it can be done via
2049 ``-machine usb=on``). Note that this option is mainly intended for
2050 the user's convenience only. More fine-grained control can be
2051 achieved by selecting a USB host controller (if necessary) and the
2052 desired USB device via the ``-device`` option instead. For example,
2053 instead of using ``-usbdevice mouse`` it is possible to use
2054 ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse
2055 to a USB 3.0 controller instead (at least on machines that support
2056 PCI and do not have an USB controller enabled by default yet).
2057 For more details, see the chapter about
Thomas Huth923e9312020-11-16 15:47:36 +01002058 :ref:`Connecting USB devices` in the System Emulation Users Guide.
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002059 Possible devices for devname are:
2060
2061 ``braille``
2062 Braille device. This will use BrlAPI to display the braille
2063 output on a real or fake device (i.e. it also creates a
2064 corresponding ``braille`` chardev automatically beside the
2065 ``usb-braille`` USB device).
2066
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002067 ``keyboard``
2068 Standard USB keyboard. Will override the PS/2 keyboard (if present).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002069
2070 ``mouse``
2071 Virtual Mouse. This will override the PS/2 mouse emulation when
2072 activated.
2073
2074 ``tablet``
2075 Pointer device that uses absolute coordinates (like a
2076 touchscreen). This means QEMU is able to report the mouse
2077 position without having to grab the mouse. Also overrides the
2078 PS/2 mouse emulation when activated.
2079
Thomas Huthc2a34ab2021-03-10 18:33:23 +01002080 ``wacom-tablet``
2081 Wacom PenPartner USB tablet.
2082
2083
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002084ERST
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002085
Markus Armbruster10adb8b2013-02-13 19:49:43 +01002086DEFHEADING()
2087
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002088DEFHEADING(Display options:)
blueswir15824d652009-03-28 06:44:27 +00002089
Jes Sorensen1472a952011-03-16 13:33:31 +01002090DEF("display", HAS_ARG, QEMU_OPTION_display,
Thomas Huth88b40c62019-10-23 14:01:28 +02002091#if defined(CONFIG_SPICE)
Marc-André Lureaud8aec9d2019-02-21 12:07:03 +01002092 "-display spice-app[,gl=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002093#endif
2094#if defined(CONFIG_SDL)
Thomas Hutha743d602022-05-19 17:56:23 +02002095 "-display sdl[,gl=on|core|es|off][,grab-mod=<mod>][,show-cursor=on|off]\n"
2096 " [,window-close=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002097#endif
Robert Hof04ec5a2016-07-26 18:17:11 +08002098#if defined(CONFIG_GTK)
Thomas Huth95f439b2021-06-30 18:32:31 +02002099 "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
Felix xq Queißnerc34a9332022-07-12 15:37:53 +02002100 " [,show-tabs=on|off][,show-cursor=on|off][,window-close=on|off]\n"
BALATON Zoltane26c9402024-02-09 01:05:06 +01002101 " [,show-menubar=on|off][,zoom-to-fit=on|off]\n"
Thomas Huth88b40c62019-10-23 14:01:28 +02002102#endif
2103#if defined(CONFIG_VNC)
2104 "-display vnc=<display>[,<optargs>]\n"
2105#endif
2106#if defined(CONFIG_CURSES)
2107 "-display curses[,charset=<encoding>]\n"
2108#endif
Gustavo Noronha Silvaf844cdb2022-03-06 21:11:18 +09002109#if defined(CONFIG_COCOA)
Gustavo Noronha Silva4797adc2022-03-06 21:11:19 +09002110 "-display cocoa[,full-grab=on|off][,swap-opt-cmd=on|off]\n"
Akihiko Odaki9ab87152023-12-14 15:31:35 +09002111 " [,show-cursor=on|off][,left-command-key=on|off]\n"
Akihiko Odakid502dfc2023-12-14 15:31:36 +09002112 " [,full-screen=on|off][,zoom-to-fit=on|off]\n"
Gustavo Noronha Silvaf844cdb2022-03-06 21:11:18 +09002113#endif
Thomas Huth88b40c62019-10-23 14:01:28 +02002114#if defined(CONFIG_OPENGL)
2115 "-display egl-headless[,rendernode=<file>]\n"
2116#endif
Marc-André Lureau142ca622021-07-15 11:53:53 +04002117#if defined(CONFIG_DBUS_DISPLAY)
2118 "-display dbus[,addr=<dbusaddr>]\n"
2119 " [,gl=on|core|es|off][,rendernode=<file>]\n"
2120#endif
Thomas Huth88b40c62019-10-23 14:01:28 +02002121 "-display none\n"
2122 " select display backend type\n"
2123 " The default display is equivalent to\n "
2124#if defined(CONFIG_GTK)
2125 "\"-display gtk\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002126#elif defined(CONFIG_SDL)
Thomas Huth88b40c62019-10-23 14:01:28 +02002127 "\"-display sdl\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002128#elif defined(CONFIG_COCOA)
Thomas Huth88b40c62019-10-23 14:01:28 +02002129 "\"-display cocoa\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002130#elif defined(CONFIG_VNC)
Thomas Huth88b40c62019-10-23 14:01:28 +02002131 "\"-vnc localhost:0,to=99,id=default\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002132#else
Thomas Huth88b40c62019-10-23 14:01:28 +02002133 "\"-display none\"\n"
Robert Hof04ec5a2016-07-26 18:17:11 +08002134#endif
2135 , QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002136SRST
2137``-display type``
Thomas Huth707d93d2022-05-19 17:56:25 +02002138 Select type of display to use. Use ``-display help`` to list the available
2139 display types. Valid values for type are
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002140
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002141 ``spice-app[,gl=on|off]``
2142 Start QEMU as a Spice server and launch the default Spice client
2143 application. The Spice server will redirect the serial consoles
2144 and QEMU monitors. (Since 4.0)
2145
Marc-André Lureau142ca622021-07-15 11:53:53 +04002146 ``dbus``
2147 Export the display over D-Bus interfaces. (Since 7.0)
2148
2149 The connection is registered with the "org.qemu" name (and queued when
2150 already owned).
2151
2152 ``addr=<dbusaddr>`` : D-Bus bus address to connect to.
2153
Marc-André Lureau99997822021-10-10 00:16:57 +04002154 ``p2p=yes|no`` : Use peer-to-peer connection, accepted via QMP ``add_client``.
2155
2156 ``gl=on|off|core|es`` : Use OpenGL for rendering (the D-Bus interface
2157 will share framebuffers with DMABUF file descriptors).
Marc-André Lureau142ca622021-07-15 11:53:53 +04002158
Thomas Huth95f439b2021-06-30 18:32:31 +02002159 ``sdl``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002160 Display video output via SDL (usually in a separate graphics
2161 window; see the SDL documentation for other possibilities).
Thomas Huth95f439b2021-06-30 18:32:31 +02002162 Valid parameters are:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002163
Thomas Huth8e8e8442021-08-25 11:20:21 +02002164 ``grab-mod=<mods>`` : Used to select the modifier keys for toggling
John Snow450e0f22021-10-04 17:52:36 -04002165 the mouse grabbing in conjunction with the "g" key. ``<mods>`` can be
2166 either ``lshift-lctrl-lalt`` or ``rctrl``.
Thomas Huth8e8e8442021-08-25 11:20:21 +02002167
Thomas Huth95f439b2021-06-30 18:32:31 +02002168 ``gl=on|off|core|es`` : Use OpenGL for displaying
2169
2170 ``show-cursor=on|off`` : Force showing the mouse cursor
2171
2172 ``window-close=on|off`` : Allow to quit qemu with window close button
2173
2174 ``gtk``
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002175 Display video output in a GTK window. This interface provides
2176 drop-down menus and other UI elements to configure and control
Thomas Huth95f439b2021-06-30 18:32:31 +02002177 the VM during runtime. Valid parameters are:
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002178
Thomas Huth95f439b2021-06-30 18:32:31 +02002179 ``full-screen=on|off`` : Start in fullscreen mode
2180
2181 ``gl=on|off`` : Use OpenGL for displaying
2182
2183 ``grab-on-hover=on|off`` : Grab keyboard input on mouse hover
2184
Felix xq Queißnerc34a9332022-07-12 15:37:53 +02002185 ``show-tabs=on|off`` : Display the tab bar for switching between the
2186 various graphical interfaces (e.g. VGA and
2187 virtual console character devices) by default.
2188
Thomas Huth95f439b2021-06-30 18:32:31 +02002189 ``show-cursor=on|off`` : Force showing the mouse cursor
2190
2191 ``window-close=on|off`` : Allow to quit qemu with window close button
2192
Bryce Millsdbccb1a2022-10-11 13:58:21 +00002193 ``show-menubar=on|off`` : Display the main window menubar, defaults to "on"
2194
Jan Kratochvilc35d9372023-06-28 18:23:36 +08002195 ``zoom-to-fit=on|off`` : Expand video output to the window size,
2196 defaults to "off"
2197
Thomas Huth95f439b2021-06-30 18:32:31 +02002198 ``curses[,charset=<encoding>]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002199 Display video output via curses. For graphics device models
2200 which support a text mode, QEMU can display this output using a
2201 curses/ncurses interface. Nothing is displayed when the graphics
2202 device is in graphical mode or if the graphics device does not
2203 support a text mode. Generally only the VGA device models
2204 support text mode. The font charset used by the guest can be
2205 specified with the ``charset`` option, for example
2206 ``charset=CP850`` for IBM CP850 encoding. The default is
2207 ``CP437``.
2208
Carwyn Ellis48941a52022-01-02 17:41:52 +00002209 ``cocoa``
2210 Display video output in a Cocoa window. Mac only. This interface
2211 provides drop-down menus and other UI elements to configure and
2212 control the VM during runtime. Valid parameters are:
2213
Akihiko Odakid502dfc2023-12-14 15:31:36 +09002214 ``full-grab=on|off`` : Capture all key presses, including system combos.
2215 This requires accessibility permissions, since it
2216 performs a global grab on key events.
2217 (default: off) See
2218 https://support.apple.com/en-in/guide/mac-help/mh32356/mac
2219
2220 ``swap-opt-cmd=on|off`` : Swap the Option and Command keys so that their
2221 key codes match their position on non-Mac
2222 keyboards and you can use Meta/Super and Alt
2223 where you expect them. (default: off)
2224
Carwyn Ellis48941a52022-01-02 17:41:52 +00002225 ``show-cursor=on|off`` : Force showing the mouse cursor
2226
2227 ``left-command-key=on|off`` : Disable forwarding left command key to host
2228
Akihiko Odakid502dfc2023-12-14 15:31:36 +09002229 ``full-screen=on|off`` : Start in fullscreen mode
2230
2231 ``zoom-to-fit=on|off`` : Expand video output to the window size,
2232 defaults to "off"
2233
Thomas Huth95f439b2021-06-30 18:32:31 +02002234 ``egl-headless[,rendernode=<file>]``
Ahmed Abouziedddc71752021-06-01 19:41:18 +02002235 Offload all OpenGL operations to a local DRI device. For any
2236 graphical display, this display needs to be paired with either
2237 VNC or SPICE displays.
2238
Thomas Huth95f439b2021-06-30 18:32:31 +02002239 ``vnc=<display>``
2240 Start a VNC server on display <display>
2241
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002242 ``none``
2243 Do not display video output. The guest will still see an
2244 emulated graphics card, but its output will not be displayed to
2245 the QEMU user. This option differs from the -nographic option in
2246 that it only affects what is done with video output; -nographic
2247 also changes the destination of the serial and parallel port
2248 data.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002249ERST
Jes Sorensen1472a952011-03-16 13:33:31 +01002250
blueswir15824d652009-03-28 06:44:27 +00002251DEF("nographic", 0, QEMU_OPTION_nographic,
Blue Swirlad960902010-03-29 19:23:52 +00002252 "-nographic disable graphical output and redirect serial I/Os to console\n",
2253 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002254SRST
2255``-nographic``
2256 Normally, if QEMU is compiled with graphical window support, it
2257 displays output such as guest graphics, guest console, and the QEMU
2258 monitor in a window. With this option, you can totally disable
2259 graphical output so that QEMU is a simple command line application.
2260 The emulated serial port is redirected on the console and muxed with
2261 the monitor (unless redirected elsewhere explicitly). Therefore, you
2262 can still use QEMU to debug a Linux kernel with a serial console.
2263 Use C-a h for help on switching between the console and monitor.
2264ERST
blueswir15824d652009-03-28 06:44:27 +00002265
Marc-André Lureau5324e3e2021-09-09 12:44:11 +04002266#ifdef CONFIG_SPICE
Gerd Hoffmann29b00402010-03-11 11:13:27 -03002267DEF("spice", HAS_ARG, QEMU_OPTION_spice,
Yonit Halperin27af7782012-08-21 13:54:20 +03002268 "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
2269 " [,x509-key-file=<file>][,x509-key-password=<file>]\n"
2270 " [,x509-cert-file=<file>][,x509-cacert-file=<file>]\n"
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002271 " [,x509-dh-key-file=<file>][,addr=addr]\n"
2272 " [,ipv4=on|off][,ipv6=on|off][,unix=on|off]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03002273 " [,tls-ciphers=<list>]\n"
2274 " [,tls-channel=[main|display|cursor|inputs|record|playback]]\n"
2275 " [,plaintext-channel=[main|display|cursor|inputs|record|playback]]\n"
Daniel P. Berrangé99522f62021-03-11 11:43:42 +00002276 " [,sasl=on|off][,disable-ticketing=on|off]\n"
Daniel P. Berrangé36debaf2022-12-01 04:22:11 -05002277 " [,password-secret=<secret-id>]\n"
Yonit Halperin27af7782012-08-21 13:54:20 +03002278 " [,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]\n"
2279 " [,jpeg-wan-compression=[auto|never|always]]\n"
2280 " [,zlib-glz-wan-compression=[auto|never|always]]\n"
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002281 " [,streaming-video=[off|all|filter]][,disable-copy-paste=on|off]\n"
2282 " [,disable-agent-file-xfer=on|off][,agent-mouse=[on|off]]\n"
Hans de Goede5ad24e52013-06-08 15:37:27 +02002283 " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
Marc-André Lureau7b525502017-02-12 15:21:18 +04002284 " [,gl=[on|off]][,rendernode=<file>]\n"
Thomas Hutha635bcf2023-07-03 09:56:46 +02002285 " enable spice\n"
2286 " at least one of {port, tls-port} is mandatory\n",
Yonit Halperin27af7782012-08-21 13:54:20 +03002287 QEMU_ARCH_ALL)
Marc-André Lureau5324e3e2021-09-09 12:44:11 +04002288#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002289SRST
2290``-spice option[,option[,...]]``
2291 Enable the spice remote desktop protocol. Valid options are
2292
2293 ``port=<nr>``
2294 Set the TCP port spice is listening on for plaintext channels.
2295
2296 ``addr=<addr>``
2297 Set the IP address spice is listening on. Default is any
2298 address.
2299
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002300 ``ipv4=on|off``; \ ``ipv6=on|off``; \ ``unix=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002301 Force using the specified IP version.
2302
Daniel P. Berrangé99522f62021-03-11 11:43:42 +00002303 ``password-secret=<secret-id>``
2304 Set the ID of the ``secret`` object containing the password
2305 you need to authenticate.
2306
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002307 ``sasl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002308 Require that the client use SASL to authenticate with the spice.
2309 The exact choice of authentication method used is controlled
2310 from the system / user's SASL configuration file for the 'qemu'
2311 service. This is typically found in /etc/sasl2/qemu.conf. If
2312 running QEMU as an unprivileged user, an environment variable
2313 SASL\_CONF\_PATH can be used to make it search alternate
2314 locations for the service config. While some SASL auth methods
2315 can also provide data encryption (eg GSSAPI), it is recommended
2316 that SASL always be combined with the 'tls' and 'x509' settings
2317 to enable use of SSL and server certificates. This ensures a
2318 data encryption preventing compromise of authentication
2319 credentials.
2320
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002321 ``disable-ticketing=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002322 Allow client connects without authentication.
2323
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002324 ``disable-copy-paste=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002325 Disable copy paste between the client and the guest.
2326
Daniel P. Berrangéa9daa362021-02-16 19:10:20 +00002327 ``disable-agent-file-xfer=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002328 Disable spice-vdagent based file-xfer between the client and the
2329 guest.
2330
2331 ``tls-port=<nr>``
2332 Set the TCP port spice is listening on for encrypted channels.
2333
2334 ``x509-dir=<dir>``
2335 Set the x509 file directory. Expects same filenames as -vnc
2336 $display,x509=$dir
2337
2338 ``x509-key-file=<file>``; \ ``x509-key-password=<file>``; \ ``x509-cert-file=<file>``; \ ``x509-cacert-file=<file>``; \ ``x509-dh-key-file=<file>``
2339 The x509 file names can also be configured individually.
2340
2341 ``tls-ciphers=<list>``
2342 Specify which ciphers to use.
2343
2344 ``tls-channel=[main|display|cursor|inputs|record|playback]``; \ ``plaintext-channel=[main|display|cursor|inputs|record|playback]``
2345 Force specific channel to be used with or without TLS
2346 encryption. The options can be specified multiple times to
2347 configure multiple channels. The special name "default" can be
2348 used to set the default mode. For channels which are not
2349 explicitly forced into one mode the spice client is allowed to
2350 pick tls/plaintext as he pleases.
2351
2352 ``image-compression=[auto_glz|auto_lz|quic|glz|lz|off]``
2353 Configure image compression (lossless). Default is auto\_glz.
2354
2355 ``jpeg-wan-compression=[auto|never|always]``; \ ``zlib-glz-wan-compression=[auto|never|always]``
2356 Configure wan image compression (lossy for slow links). Default
2357 is auto.
2358
2359 ``streaming-video=[off|all|filter]``
2360 Configure video stream detection. Default is off.
2361
2362 ``agent-mouse=[on|off]``
2363 Enable/disable passing mouse events via vdagent. Default is on.
2364
2365 ``playback-compression=[on|off]``
2366 Enable/disable audio stream compression (using celt 0.5.1).
2367 Default is on.
2368
2369 ``seamless-migration=[on|off]``
2370 Enable/disable spice seamless migration. Default is off.
2371
2372 ``gl=[on|off]``
2373 Enable/disable OpenGL context. Default is off.
2374
2375 ``rendernode=<file>``
2376 DRM render node for OpenGL rendering. If not specified, it will
2377 pick the first available. (Since 2.9)
2378ERST
Gerd Hoffmann29b00402010-03-11 11:13:27 -03002379
blueswir15824d652009-03-28 06:44:27 +00002380DEF("portrait", 0, QEMU_OPTION_portrait,
Blue Swirlad960902010-03-29 19:23:52 +00002381 "-portrait rotate graphical output 90 deg left (only PXA LCD)\n",
2382 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002383SRST
2384``-portrait``
2385 Rotate graphical output 90 deg left (only PXA LCD).
2386ERST
blueswir15824d652009-03-28 06:44:27 +00002387
Vasily Khoruzhick93128052011-06-17 13:04:36 +03002388DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
2389 "-rotate <deg> rotate graphical output some deg left (only PXA LCD)\n",
2390 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002391SRST
2392``-rotate deg``
2393 Rotate graphical output some deg left (only PXA LCD).
2394ERST
Vasily Khoruzhick93128052011-06-17 13:04:36 +03002395
blueswir15824d652009-03-28 06:44:27 +00002396DEF("vga", HAS_ARG, QEMU_OPTION_vga,
Gerd Hoffmanna94f0c52014-09-10 14:28:48 +02002397 "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
Blue Swirlad960902010-03-29 19:23:52 +00002398 " select video card type\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002399SRST
2400``-vga type``
2401 Select type of VGA card to emulate. Valid values for type are
2402
2403 ``cirrus``
2404 Cirrus Logic GD5446 Video card. All Windows versions starting
2405 from Windows 95 should recognize and use this graphic card. For
2406 optimal performances, use 16 bit color depth in the guest and
2407 the host OS. (This card was the default before QEMU 2.2)
2408
2409 ``std``
2410 Standard VGA card with Bochs VBE extensions. If your guest OS
2411 supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
2412 you want to use high resolution modes (>= 1280x1024x16) then you
2413 should use this option. (This card is the default since QEMU
2414 2.2)
2415
2416 ``vmware``
2417 VMWare SVGA-II compatible adapter. Use it if you have
2418 sufficiently recent XFree86/XOrg server or Windows guest with a
2419 driver for this card.
2420
2421 ``qxl``
2422 QXL paravirtual graphic card. It is VGA compatible (including
2423 VESA 2.0 VBE support). Works best with qxl guest drivers
2424 installed though. Recommended choice when using the spice
2425 protocol.
2426
2427 ``tcx``
2428 (sun4m only) Sun TCX framebuffer. This is the default
2429 framebuffer for sun4m machines and offers both 8-bit and 24-bit
2430 colour depths at a fixed resolution of 1024x768.
2431
2432 ``cg3``
2433 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
2434 framebuffer for sun4m machines available in both 1024x768
2435 (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
2436 wishing to run older Solaris versions.
2437
2438 ``virtio``
2439 Virtio VGA card.
2440
2441 ``none``
2442 Disable VGA card.
2443ERST
blueswir15824d652009-03-28 06:44:27 +00002444
2445DEF("full-screen", 0, QEMU_OPTION_full_screen,
Blue Swirlad960902010-03-29 19:23:52 +00002446 "-full-screen start in full screen\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002447SRST
2448``-full-screen``
2449 Start in full screen.
2450ERST
blueswir15824d652009-03-28 06:44:27 +00002451
John Snow60f9a4e2020-02-04 11:56:38 -05002452DEF("g", HAS_ARG, QEMU_OPTION_g ,
Blue Swirlad960902010-03-29 19:23:52 +00002453 "-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
Laurent Vivier8ac919a2019-10-26 18:45:43 +02002454 QEMU_ARCH_PPC | QEMU_ARCH_SPARC | QEMU_ARCH_M68K)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002455SRST
Peter Maydell09ce5f22020-02-28 15:36:13 +00002456``-g`` *width*\ ``x``\ *height*\ ``[x``\ *depth*\ ``]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002457 Set the initial graphical resolution and depth (PPC, SPARC only).
2458
2459 For PPC the default is 800x600x32.
2460
2461 For SPARC with the TCX graphics device, the default is 1024x768x8
2462 with the option of 1024x768x24. For cgthree, the default is
2463 1024x768x8 with the option of 1152x900x8 for people who wish to use
2464 OBP.
2465ERST
blueswir15824d652009-03-28 06:44:27 +00002466
Marc-André Lureau62611642023-10-25 17:05:08 +04002467#ifdef CONFIG_VNC
blueswir15824d652009-03-28 06:44:27 +00002468DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
Robert Hof04ec5a2016-07-26 18:17:11 +08002469 "-vnc <display> shorthand for -display vnc=<display>\n", QEMU_ARCH_ALL)
Marc-André Lureau62611642023-10-25 17:05:08 +04002470#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002471SRST
2472``-vnc display[,option[,option[,...]]]``
2473 Normally, if QEMU is compiled with graphical window support, it
2474 displays output such as guest graphics, guest console, and the QEMU
2475 monitor in a window. With this option, you can have QEMU listen on
2476 VNC display display and redirect the VGA display over the VNC
2477 session. It is very useful to enable the usb tablet device when
2478 using this option (option ``-device usb-tablet``). When using the
2479 VNC display, you must use the ``-k`` parameter to set the keyboard
2480 layout if you are not using en-us. Valid syntax for the display is
2481
2482 ``to=L``
2483 With this option, QEMU will try next available VNC displays,
Manos Pitsidianakis835f3642024-02-20 10:52:23 +02002484 until the number L, if the originally defined "-vnc display" is
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002485 not available, e.g. port 5900+display is already used by another
2486 application. By default, to=0.
2487
2488 ``host:d``
2489 TCP connections will only be allowed from host on display d. By
2490 convention the TCP port is 5900+d. Optionally, host can be
2491 omitted in which case the server will accept connections from
2492 any host.
2493
2494 ``unix:path``
2495 Connections will be allowed over UNIX domain sockets where path
2496 is the location of a unix socket to listen for connections on.
2497
2498 ``none``
2499 VNC is initialized but not started. The monitor ``change``
2500 command can be used to later start the VNC server.
2501
2502 Following the display value there may be one or more option flags
2503 separated by commas. Valid options are
2504
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002505 ``reverse=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002506 Connect to a listening VNC client via a "reverse" connection.
2507 The client is specified by the display. For reverse network
2508 connections (host:d,``reverse``), the d argument is a TCP port
2509 number, not a display number.
2510
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002511 ``websocket=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002512 Opens an additional TCP listening port dedicated to VNC
2513 Websocket connections. If a bare websocket option is given, the
2514 Websocket port is 5700+display. An alternative port can be
2515 specified with the syntax ``websocket``\ =port.
2516
2517 If host is specified connections will only be allowed from this
2518 host. It is possible to control the websocket listen address
2519 independently, using the syntax ``websocket``\ =host:port.
2520
Sergii Zasenko41582632023-07-24 13:03:53 +03002521 Websocket could be allowed over UNIX domain socket, using the syntax
2522 ``websocket``\ =unix:path, where path is the location of a unix socket
2523 to listen for connections on.
2524
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002525 If no TLS credentials are provided, the websocket connection
2526 runs in unencrypted mode. If TLS credentials are provided, the
2527 websocket connection requires encrypted client connections.
2528
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002529 ``password=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002530 Require that password based authentication is used for client
2531 connections.
2532
2533 The password must be set separately using the ``set_password``
Thomas Huth923e9312020-11-16 15:47:36 +01002534 command in the :ref:`QEMU monitor`. The
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002535 syntax to change your password is:
2536 ``set_password <protocol> <password>`` where <protocol> could be
2537 either "vnc" or "spice".
2538
2539 If you would like to change <protocol> password expiration, you
2540 should use ``expire_password <protocol> <expiration-time>``
2541 where expiration time could be one of the following options:
2542 now, never, +seconds or UNIX time of expiration, e.g. +60 to
2543 make password expire in 60 seconds, or 1335196800 to make
2544 password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for
2545 this date and time).
2546
2547 You can also use keywords "now" or "never" for the expiration
2548 time to allow <protocol> password to expire immediately or never
2549 expire.
2550
Daniel P. Berrangé6c6840e2021-03-11 11:43:41 +00002551 ``password-secret=<secret-id>``
2552 Require that password based authentication is used for client
2553 connections, using the password provided by the ``secret``
2554 object identified by ``secret-id``.
2555
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002556 ``tls-creds=ID``
2557 Provides the ID of a set of TLS credentials to use to secure the
2558 VNC server. They will apply to both the normal VNC server socket
2559 and the websocket socket (if enabled). Setting TLS credentials
2560 will cause the VNC server socket to enable the VeNCrypt auth
2561 mechanism. The credentials should have been previously created
2562 using the ``-object tls-creds`` argument.
2563
2564 ``tls-authz=ID``
2565 Provides the ID of the QAuthZ authorization object against which
2566 the client's x509 distinguished name will validated. This object
2567 is only resolved at time of use, so can be deleted and recreated
2568 on the fly while the VNC server is active. If missing, it will
2569 default to denying access.
2570
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002571 ``sasl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002572 Require that the client use SASL to authenticate with the VNC
2573 server. The exact choice of authentication method used is
2574 controlled from the system / user's SASL configuration file for
2575 the 'qemu' service. This is typically found in
2576 /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user,
2577 an environment variable SASL\_CONF\_PATH can be used to make it
2578 search alternate locations for the service config. While some
2579 SASL auth methods can also provide data encryption (eg GSSAPI),
2580 it is recommended that SASL always be combined with the 'tls'
2581 and 'x509' settings to enable use of SSL and server
2582 certificates. This ensures a data encryption preventing
2583 compromise of authentication credentials. See the
Thomas Huth923e9312020-11-16 15:47:36 +01002584 :ref:`VNC security` section in the System Emulation Users Guide
2585 for details on using SASL authentication.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002586
2587 ``sasl-authz=ID``
2588 Provides the ID of the QAuthZ authorization object against which
2589 the client's SASL username will validated. This object is only
2590 resolved at time of use, so can be deleted and recreated on the
2591 fly while the VNC server is active. If missing, it will default
2592 to denying access.
2593
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002594 ``acl=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002595 Legacy method for enabling authorization of clients against the
2596 x509 distinguished name and SASL username. It results in the
2597 creation of two ``authz-list`` objects with IDs of
2598 ``vnc.username`` and ``vnc.x509dname``. The rules for these
2599 objects must be configured with the HMP ACL commands.
2600
2601 This option is deprecated and should no longer be used. The new
2602 ``sasl-authz`` and ``tls-authz`` options are a replacement.
2603
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002604 ``lossy=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002605 Enable lossy compression methods (gradient, JPEG, ...). If this
2606 option is set, VNC client may receive lossy framebuffer updates
2607 depending on its encoding settings. Enabling this option can
2608 save a lot of bandwidth at the expense of quality.
2609
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002610 ``non-adaptive=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002611 Disable adaptive encodings. Adaptive encodings are enabled by
2612 default. An adaptive encoding will try to detect frequently
2613 updated screen regions, and send updates in these regions using
2614 a lossy encoding (like JPEG). This can be really helpful to save
2615 bandwidth when playing videos. Disabling adaptive encodings
2616 restores the original static behavior of encodings like Tight.
2617
2618 ``share=[allow-exclusive|force-shared|ignore]``
2619 Set display sharing policy. 'allow-exclusive' allows clients to
2620 ask for exclusive access. As suggested by the rfb spec this is
2621 implemented by dropping other connections. Connecting multiple
2622 clients in parallel requires all clients asking for a shared
2623 session (vncviewer: -shared switch). This is the default.
2624 'force-shared' disables exclusive client access. Useful for
2625 shared desktop sessions, where you don't want someone forgetting
2626 specify -shared disconnect everybody else. 'ignore' completely
2627 ignores the shared flag and allows everybody connect
2628 unconditionally. Doesn't conform to the rfb spec but is
2629 traditional QEMU behavior.
2630
2631 ``key-delay-ms``
2632 Set keyboard delay, for key down and key up events, in
2633 milliseconds. Default is 10. Keyboards are low-bandwidth
2634 devices, so this slowdown can help the device and guest to keep
2635 up and not lose events in case events are arriving in bulk.
2636 Possible causes for the latter are flaky network connections, or
2637 scripts for automated testing.
2638
2639 ``audiodev=audiodev``
2640 Use the specified audiodev when the VNC client requests audio
2641 transmission. When not using an -audiodev argument, this option
2642 must be omitted, otherwise is must be present and specify a
2643 valid audiodev.
Daniel P. Berrangé7b5fa0b2020-12-11 16:08:25 +00002644
Daniel P. Berrangé82a17d12021-02-16 19:10:23 +00002645 ``power-control=on|off``
Daniel P. Berrangé7b5fa0b2020-12-11 16:08:25 +00002646 Permit the remote client to issue shutdown, reboot or reset power
2647 control requests.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002648ERST
blueswir15824d652009-03-28 06:44:27 +00002649
Michael Ellermana3adb7a2011-12-19 17:19:31 +11002650ARCHHEADING(, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00002651
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002652ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
blueswir15824d652009-03-28 06:44:27 +00002653
blueswir15824d652009-03-28 06:44:27 +00002654DEF("win2k-hack", 0, QEMU_OPTION_win2k_hack,
Blue Swirlad960902010-03-29 19:23:52 +00002655 "-win2k-hack use it when installing Windows 2000 to avoid a disk full bug\n",
2656 QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002657SRST
2658``-win2k-hack``
2659 Use it when installing Windows 2000 to avoid a disk full bug. After
2660 Windows 2000 is installed, you no longer need this option (this
Paolo Bonzinid13f4032024-02-20 17:09:30 +01002661 option slows down the IDE transfers). Synonym of ``-global
2662 ide-device.win2k-install-hack=on``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002663ERST
blueswir15824d652009-03-28 06:44:27 +00002664
blueswir15824d652009-03-28 06:44:27 +00002665DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
Blue Swirlad960902010-03-29 19:23:52 +00002666 "-no-fd-bootchk disable boot signature checking for floppy disks\n",
2667 QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002668SRST
2669``-no-fd-bootchk``
2670 Disable boot signature checking for floppy disks in BIOS. May be
Paolo Bonzini84e945a2024-02-13 10:56:56 +01002671 needed to boot from old floppy disks. Synonym of ``-m fd-bootchk=off``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002672ERST
blueswir15824d652009-03-28 06:44:27 +00002673
blueswir15824d652009-03-28 06:44:27 +00002674DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
Michael Tokarev104bf022011-05-12 18:44:17 +04002675 "-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 +00002676 " ACPI table description\n", QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002677SRST
2678``-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]...]``
2679 Add ACPI table with specified header fields and context from
2680 specified files. For file=, take whole ACPI table from the specified
2681 files, including all ACPI headers (possible overridden by other
2682 options). For data=, only data portion of the table is used, all
2683 header information is specified in the command line. If a SLIC table
2684 is supplied to QEMU, then the SLIC's oem\_id and oem\_table\_id
2685 fields will override the same in the RSDT and the FADT (a.k.a.
2686 FACP), in order to ensure the field matches required by the
2687 Microsoft SLIC spec and the ACPI spec.
2688ERST
blueswir15824d652009-03-28 06:44:27 +00002689
aliguorib6f6e3d2009-04-17 18:59:56 +00002690DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
2691 "-smbios file=binary\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002692 " load SMBIOS entry from binary file\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002693 "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
2694 " [,uefi=on|off]\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002695 " specify SMBIOS type 0 fields\n"
aliguorib6f6e3d2009-04-17 18:59:56 +00002696 "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
2697 " [,uuid=uuid][,sku=str][,family=str]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002698 " specify SMBIOS type 1 fields\n"
2699 "-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
2700 " [,asset=str][,location=str]\n"
2701 " specify SMBIOS type 2 fields\n"
2702 "-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]\n"
2703 " [,sku=str]\n"
2704 " specify SMBIOS type 3 fields\n"
2705 "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n"
Ying Fangc906e032020-08-06 11:56:33 +08002706 " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n"
Heinrich Schuchardtb5831d72024-01-23 19:42:26 +01002707 " [,processor-family=%d,processor-id=%d]\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002708 " specify SMBIOS type 4 fields\n"
Hal Martinfd8caa22022-08-12 15:51:53 +02002709 "-smbios type=8[,external_reference=str][,internal_reference=str][,connector_type=%d][,port_type=%d]\n"
2710 " specify SMBIOS type 8 fields\n"
Daniel P. Berrangé48a7ff42020-09-23 14:38:04 +01002711 "-smbios type=11[,value=str][,path=filename]\n"
2712 " specify SMBIOS type 11 fields\n"
Gabriel L. Somlob155eb12015-02-05 11:45:30 -05002713 "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n"
Gabriel L. Somlo3ebd6cc2015-03-11 13:58:01 -04002714 " [,asset=str][,part=str][,speed=%d]\n"
Vincent Bernat05dfb442021-04-01 19:11:38 +02002715 " specify SMBIOS type 17 fields\n"
2716 "-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]\n"
2717 " specify SMBIOS type 41 fields\n",
Heinrich Schuchardte2ff0de2024-01-23 19:42:29 +01002718 QEMU_ARCH_I386 | QEMU_ARCH_ARM | QEMU_ARCH_LOONGARCH | QEMU_ARCH_RISCV)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002719SRST
2720``-smbios file=binary``
2721 Load SMBIOS entry from binary file.
2722
2723``-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]``
2724 Specify SMBIOS type 0 fields
2725
2726``-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str][,uuid=uuid][,sku=str][,family=str]``
2727 Specify SMBIOS type 1 fields
2728
2729``-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str][,asset=str][,location=str]``
2730 Specify SMBIOS type 2 fields
2731
2732``-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str][,sku=str]``
2733 Specify SMBIOS type 3 fields
2734
Heinrich Schuchardtb5831d72024-01-23 19:42:26 +01002735``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str][,processor-family=%d][,processor-id=%d]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002736 Specify SMBIOS type 4 fields
2737
Felix Wu04f143d2024-02-21 17:00:27 +00002738``-smbios type=9[,slot_designation=str][,slot_type=%d][,slot_data_bus_width=%d][,current_usage=%d][,slot_length=%d][,slot_id=%d][,slot_characteristics1=%d][,slot_characteristics12=%d][,pci_device=str]``
Felix Wu735eee02024-02-21 17:00:26 +00002739 Specify SMBIOS type 9 fields
2740
Daniel P. Berrangé48a7ff42020-09-23 14:38:04 +01002741``-smbios type=11[,value=str][,path=filename]``
2742 Specify SMBIOS type 11 fields
2743
2744 This argument can be repeated multiple times, and values are added in the order they are parsed.
2745 Applications intending to use OEM strings data are encouraged to use their application name as
2746 a prefix for the value string. This facilitates passing information for multiple applications
2747 concurrently.
2748
2749 The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax
2750 loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes.
2751
2752 Both the ``value`` and ``path`` options can be repeated multiple times and will be added to
2753 the SMBIOS table in the order in which they appear.
2754
2755 Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535
2756 bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the
2757 guest. Instead it should be used as a indicator to inform the guest where to locate the real
2758 data set, for example, by specifying the serial ID of a block device.
2759
2760 An example passing three strings is
2761
2762 .. parsed-literal::
2763
2764 -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\
2765 value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\
2766 path=/some/file/with/oemstringsdata.txt
2767
2768 In the guest OS this is visible with the ``dmidecode`` command
2769
2770 .. parsed-literal::
2771
2772 $ dmidecode -t 11
2773 Handle 0x0E00, DMI type 11, 5 bytes
2774 OEM Strings
2775 String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/
2776 String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os
2777 String 3: myapp:some extra data
2778
2779
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002780``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]``
2781 Specify SMBIOS type 17 fields
Vincent Bernat05dfb442021-04-01 19:11:38 +02002782
2783``-smbios type=41[,designation=str][,kind=str][,instance=%d][,pcidev=str]``
2784 Specify SMBIOS type 41 fields
2785
2786 This argument can be repeated multiple times. Its main use is to allow network interfaces be created
2787 as ``enoX`` on Linux, with X being the instance number, instead of the name depending on the interface
2788 position on the PCI bus.
2789
2790 Here is an example of use:
2791
2792 .. parsed-literal::
2793
2794 -netdev user,id=internet \\
2795 -device virtio-net-pci,mac=50:54:00:00:00:42,netdev=internet,id=internet-dev \\
2796 -smbios type=41,designation='Onboard LAN',instance=1,kind=ethernet,pcidev=internet-dev
2797
2798 In the guest OS, the device should then appear as ``eno1``:
2799
2800 ..parsed-literal::
2801
2802 $ ip -brief l
2803 lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
2804 eno1 UP 50:54:00:00:00:42 <BROADCAST,MULTICAST,UP,LOWER_UP>
2805
2806 Currently, the PCI device has to be attached to the root bus.
2807
Peter Maydelle2fcbf42020-03-06 10:07:14 +00002808ERST
aliguorib6f6e3d2009-04-17 18:59:56 +00002809
Markus Armbrusterc70a01e2013-02-13 19:49:40 +01002810DEFHEADING()
blueswir15824d652009-03-28 06:44:27 +00002811
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02002812DEFHEADING(Network options:)
blueswir15824d652009-03-28 06:44:27 +00002813
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002814DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
blueswir15824d652009-03-28 06:44:27 +00002815#ifdef CONFIG_SLIRP
Daniel P. Berrangé8b0dc242021-02-16 19:10:21 +00002816 "-netdev user,id=str[,ipv4=on|off][,net=addr[/mask]][,host=addr]\n"
2817 " [,ipv6=on|off][,ipv6-net=addr[/int]][,ipv6-host=addr]\n"
Samuel Thibault0b11c032016-03-20 12:29:54 +01002818 " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n"
Benjamin Drungf18d1372018-02-27 17:06:01 +01002819 " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n"
Fam Zheng0fca92b2018-09-14 15:26:16 +08002820 " [,tftp=dir][,tftp-server-name=name][,bootfile=f][,hostfwd=rule][,guestfwd=rule]"
Jan Kiszkaad196a92009-06-24 14:42:28 +02002821#ifndef _WIN32
Jan Kiszkac92ef6a2009-06-24 14:42:28 +02002822 "[,smb=dir[,smbserver=addr]]\n"
Jan Kiszkaad196a92009-06-24 14:42:28 +02002823#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002824 " configure a user mode network backend with ID 'str',\n"
2825 " its DHCP server and optional services\n"
blueswir15824d652009-03-28 06:44:27 +00002826#endif
2827#ifdef _WIN32
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002828 "-netdev tap,id=str,ifname=name\n"
2829 " configure a host TAP network backend with ID 'str'\n"
blueswir15824d652009-03-28 06:44:27 +00002830#else
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002831 "-netdev tap,id=str[,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile]\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10002832 " [,br=bridge][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002833 " [,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
Jason Wang69e87b32016-07-06 09:57:55 +08002834 " [,poll-us=n]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002835 " configure a host TAP network backend with ID 'str'\n"
Alexey Kardashevskiy584613e2016-09-13 17:11:54 +10002836 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002837 " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
2838 " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
2839 " to deconfigure it\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002840 " use '[down]script=no' to disable script execution\n"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05002841 " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
2842 " configure it\n"
blueswir15824d652009-03-28 06:44:27 +00002843 " use 'fd=h' to connect to an already opened TAP interface\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08002844 " use 'fds=x:y:...:z' to connect to already opened multiqueue capable TAP interfaces\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002845 " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n"
Michael S. Tsirkinf157ed22011-02-01 14:25:40 +02002846 " default is disabled 'sndbuf=0' to enable flow control set 'sndbuf=1048576')\n"
Bruce Rogersca1a8a02010-01-06 12:33:57 -07002847 " use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag\n"
2848 " 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 +02002849 " use vhost=on to enable experimental in kernel accelerator\n"
mst@redhat.com5430a282011-02-01 22:13:42 +02002850 " (only has effect for virtio guests which use MSIX)\n"
2851 " use vhostforce=on to force vhost on for non-MSIX virtio guests\n"
Michael S. Tsirkin82b0d802010-03-17 13:08:24 +02002852 " use 'vhostfd=h' to connect to an already opened vhost net device\n"
Jason Wang2ca81ba2013-02-20 18:04:01 +08002853 " use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
Jason Wangec396012013-02-22 22:57:52 +08002854 " use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
Michael Tokarevcba42d62021-03-09 14:15:10 +03002855 " use 'poll-us=n' to specify the maximum number of microseconds that could be\n"
Jason Wang69e87b32016-07-06 09:57:55 +08002856 " spent on busy polling for vhost net\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002857 "-netdev bridge,id=str[,br=bridge][,helper=helper]\n"
2858 " configure a host TAP network backend with ID 'str' that is\n"
2859 " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
2860 " using the program 'helper (default=" DEFAULT_BRIDGE_HELPER ")\n"
Mark McLoughlin0df0ff62009-06-18 18:21:34 +01002861#endif
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002862#ifdef __linux__
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002863 "-netdev l2tpv3,id=str,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport]\n"
Daniel P. Berrangé8b0dc242021-02-16 19:10:21 +00002864 " [,rxsession=rxsession],txsession=txsession[,ipv6=on|off][,udp=on|off]\n"
2865 " [,cookie64=on|off][,counter][,pincounter][,txcookie=txcookie]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002866 " [,rxcookie=rxcookie][,offset=offset]\n"
2867 " configure a network backend with ID 'str' connected to\n"
2868 " an Ethernet over L2TPv3 pseudowire.\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002869 " Linux kernel 3.3+ as well as most routers can talk\n"
Michael Tokarev2f47b402014-07-24 20:10:17 +04002870 " L2TPv3. This transport allows connecting a VM to a VM,\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002871 " VM to a router and even VM to Host. It is a nearly-universal\n"
Stefan Hajnoczi21843dc2020-02-29 11:17:27 +00002872 " standard (RFC3931). Note - this implementation uses static\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002873 " pre-configured tunnels (same as the Linux kernel).\n"
2874 " use 'src=' to specify source address\n"
2875 " use 'dst=' to specify destination address\n"
2876 " use 'udp=on' to specify udp encapsulation\n"
Gonglei39526512014-08-14 14:35:48 +08002877 " use 'srcport=' to specify source udp port\n"
Anton Ivanov3fb69aa2014-06-20 10:34:41 +01002878 " use 'dstport=' to specify destination udp port\n"
2879 " use 'ipv6=on' to force v6\n"
2880 " L2TPv3 uses cookies to prevent misconfiguration as\n"
2881 " well as a weak security measure\n"
2882 " use 'rxcookie=0x012345678' to specify a rxcookie\n"
2883 " use 'txcookie=0x012345678' to specify a txcookie\n"
2884 " use 'cookie64=on' to set cookie size to 64 bit, otherwise 32\n"
2885 " use 'counter=off' to force a 'cut-down' L2TPv3 with no counter\n"
2886 " use 'pincounter=on' to work around broken counter handling in peer\n"
2887 " use 'offset=X' to add an extra offset between header and data\n"
2888#endif
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002889 "-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]\n"
2890 " configure a network backend to connect to another network\n"
2891 " using a socket connection\n"
2892 "-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
2893 " configure a network backend to connect to a multicast maddr and port\n"
Mike Ryan3a75e742010-12-01 11:16:47 -08002894 " use 'localaddr=addr' to specify the host address to send packets from\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002895 "-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]\n"
2896 " configure a network backend to connect to another network\n"
2897 " using an UDP tunnel\n"
Laurent Vivier148fbf02023-01-19 11:16:45 +01002898 "-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"
2899 "-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path[,abstract=on|off][,tight=on|off][,reconnect=seconds]\n"
2900 "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor[,reconnect=seconds]\n"
Laurent Vivier5166fe02022-10-21 11:09:11 +02002901 " configure a network backend to connect to another network\n"
2902 " using a socket connection in stream mode.\n"
2903 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]\n"
2904 "-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]\n"
2905 " configure a network backend to connect to a multicast maddr and port\n"
2906 " use ``local.host=addr`` to specify the host address to send packets from\n"
2907 "-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 +02002908 "-netdev dgram,id=str,local.type=unix,local.path=path[,remote.type=unix,remote.path=path]\n"
Laurent Vivier5166fe02022-10-21 11:09:11 +02002909 "-netdev dgram,id=str,local.type=fd,local.str=file-descriptor\n"
2910 " configure a network backend to connect to another network\n"
2911 " using an UDP tunnel\n"
blueswir15824d652009-03-28 06:44:27 +00002912#ifdef CONFIG_VDE
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002913 "-netdev vde,id=str[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
2914 " configure a network backend to connect to port 'n' of a vde switch\n"
2915 " running on host and listening for incoming connections on 'socketpath'.\n"
blueswir15824d652009-03-28 06:44:27 +00002916 " Use group 'groupname' and mode 'octalmode' to change default\n"
2917 " ownership and permissions for communication port.\n"
2918#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002919#ifdef CONFIG_NETMAP
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002920 "-netdev netmap,id=str,ifname=name[,devname=nmname]\n"
Vincenzo Maffione58952132013-11-06 11:44:06 +01002921 " attach to the existing netmap-enabled network interface 'name', or to a\n"
2922 " VALE port (created on the fly) called 'name' ('nmname' is name of the \n"
2923 " netmap device, defaults to '/dev/netmap')\n"
2924#endif
Ilya Maximetscb039ef2023-09-13 20:34:37 +02002925#ifdef CONFIG_AF_XDP
2926 "-netdev af-xdp,id=str,ifname=name[,mode=native|skb][,force-copy=on|off]\n"
2927 " [,queues=n][,start-queue=m][,inhibit=on|off][,sock-fds=x:y:...:z]\n"
2928 " attach to the existing network interface 'name' with AF_XDP socket\n"
2929 " use 'mode=MODE' to specify an XDP program attach mode\n"
2930 " use 'force-copy=on|off' to force XDP copy mode even if device supports zero-copy (default: off)\n"
2931 " use 'inhibit=on|off' to inhibit loading of a default XDP program (default: off)\n"
2932 " with inhibit=on,\n"
2933 " use 'sock-fds' to provide file descriptors for already open AF_XDP sockets\n"
2934 " added to a socket map in XDP program. One socket per queue.\n"
2935 " use 'queues=n' to specify how many queues of a multiqueue interface should be used\n"
2936 " use 'start-queue=m' to specify the first queue that should be used\n"
2937#endif
Thomas Huth253dc142018-02-21 11:18:32 +01002938#ifdef CONFIG_POSIX
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002939 "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
2940 " configure a vhost-user network, backed by a chardev 'dev'\n"
Thomas Huth253dc142018-02-21 11:18:32 +01002941#endif
Cindy Lu108a6482020-07-01 22:55:37 +08002942#ifdef __linux__
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07002943 "-netdev vhost-vdpa,id=str[,vhostdev=/path/to/dev][,vhostfd=h]\n"
Cindy Lu108a6482020-07-01 22:55:37 +08002944 " configure a vhost-vdpa network,Establish a vhost-vdpa netdev\n"
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07002945 " use 'vhostdev=/path/to/dev' to open a vhost vdpa device\n"
2946 " use 'vhostfd=h' to connect to an already opened vhost vdpa device\n"
Cindy Lu108a6482020-07-01 22:55:37 +08002947#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03002948#ifdef CONFIG_VMNET
2949 "-netdev vmnet-host,id=str[,isolated=on|off][,net-uuid=uuid]\n"
2950 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n"
2951 " configure a vmnet network backend in host mode with ID 'str',\n"
2952 " isolate this interface from others with 'isolated',\n"
2953 " configure the address range and choose a subnet mask,\n"
2954 " specify network UUID 'uuid' to disable DHCP and interact with\n"
2955 " vmnet-host interfaces within this isolated network\n"
2956 "-netdev vmnet-shared,id=str[,isolated=on|off][,nat66-prefix=addr]\n"
2957 " [,start-address=addr,end-address=addr,subnet-mask=mask]\n"
2958 " configure a vmnet network backend in shared mode with ID 'str',\n"
2959 " configure the address range and choose a subnet mask,\n"
2960 " set IPv6 ULA prefix (of length 64) to use for internal network,\n"
2961 " isolate this interface from others with 'isolated'\n"
2962 "-netdev vmnet-bridged,id=str,ifname=name[,isolated=on|off]\n"
2963 " configure a vmnet network backend in bridged mode with ID 'str',\n"
2964 " use 'ifname=name' to select a physical network interface to be bridged,\n"
2965 " isolate this interface from others with 'isolated'\n"
2966#endif
Thomas Huth18d65d22018-01-15 20:50:55 +01002967 "-netdev hubport,id=str,hubid=n[,netdev=nd]\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002968 " configure a hub port on the hub with ID 'n'\n", QEMU_ARCH_ALL)
Thomas Huth78cd6f72018-02-21 11:18:36 +01002969DEF("nic", HAS_ARG, QEMU_OPTION_nic,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02002970 "-nic [tap|bridge|"
Thomas Huth78cd6f72018-02-21 11:18:36 +01002971#ifdef CONFIG_SLIRP
2972 "user|"
2973#endif
2974#ifdef __linux__
2975 "l2tpv3|"
2976#endif
2977#ifdef CONFIG_VDE
2978 "vde|"
2979#endif
2980#ifdef CONFIG_NETMAP
2981 "netmap|"
2982#endif
Ilya Maximetscb039ef2023-09-13 20:34:37 +02002983#ifdef CONFIG_AF_XDP
2984 "af-xdp|"
2985#endif
Thomas Huth78cd6f72018-02-21 11:18:36 +01002986#ifdef CONFIG_POSIX
2987 "vhost-user|"
2988#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03002989#ifdef CONFIG_VMNET
2990 "vmnet-host|vmnet-shared|vmnet-bridged|"
2991#endif
Thomas Huth78cd6f72018-02-21 11:18:36 +01002992 "socket][,option][,...][mac=macaddr]\n"
2993 " initialize an on-board / default host NIC (using MAC address\n"
2994 " macaddr) and connect it to the given host network backend\n"
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02002995 "-nic none use it alone to have zero network devices (the default is to\n"
Thomas Huth78cd6f72018-02-21 11:18:36 +01002996 " provided a 'user' network connection)\n",
2997 QEMU_ARCH_ALL)
Thomas Huth6a8b4a52015-05-15 16:58:24 +02002998DEF("net", HAS_ARG, QEMU_OPTION_net,
Thomas Huthaf1a5c32018-04-30 20:02:23 +02002999 "-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
Thomas Huth0e60a822017-12-19 16:28:55 +01003000 " configure or create an on-board (or machine default) NIC and\n"
Thomas Huthaf1a5c32018-04-30 20:02:23 +02003001 " connect it to hub 0 (please use -nic unless you need a hub)\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02003002 "-net ["
Mark McLoughlina1ea4582009-10-08 19:58:26 +01003003#ifdef CONFIG_SLIRP
3004 "user|"
3005#endif
3006 "tap|"
Corey Bryanta7c36ee2012-01-26 09:42:27 -05003007 "bridge|"
Mark McLoughlina1ea4582009-10-08 19:58:26 +01003008#ifdef CONFIG_VDE
3009 "vde|"
3010#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01003011#ifdef CONFIG_NETMAP
3012 "netmap|"
3013#endif
Ilya Maximetscb039ef2023-09-13 20:34:37 +02003014#ifdef CONFIG_AF_XDP
3015 "af-xdp|"
3016#endif
Vladislav Yaroshchukb0290db2022-03-17 20:28:38 +03003017#ifdef CONFIG_VMNET
3018 "vmnet-host|vmnet-shared|vmnet-bridged|"
3019#endif
Thomas Huthaf1a5c32018-04-30 20:02:23 +02003020 "socket][,option][,option][,...]\n"
Thomas Huth6a8b4a52015-05-15 16:58:24 +02003021 " old way to initialize a host network interface\n"
3022 " (use the -netdev option if possible instead)\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003023SRST
Ilya Maximetscb039ef2023-09-13 20:34:37 +02003024``-nic [tap|bridge|user|l2tpv3|vde|netmap|af-xdp|vhost-user|socket][,...][,mac=macaddr][,model=mn]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003025 This option is a shortcut for configuring both the on-board
3026 (default) guest NIC hardware and the host network backend in one go.
3027 The host backend options are the same as with the corresponding
3028 ``-netdev`` options below. The guest NIC model can be set with
3029 ``model=modelname``. Use ``model=help`` to list the available device
3030 types. The hardware MAC address can be set with ``mac=macaddr``.
3031
3032 The following two example do exactly the same, to show how ``-nic``
3033 can be used to shorten the command line length:
3034
3035 .. parsed-literal::
3036
3037 |qemu_system| -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
3038 |qemu_system| -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
3039
3040``-nic none``
3041 Indicate that no network devices should be configured. It is used to
3042 override the default configuration (default NIC with "user" host
3043 network backend) which is activated if no other networking options
3044 are provided.
3045
3046``-netdev user,id=id[,option][,option][,...]``
3047 Configure user mode host network backend which requires no
3048 administrator privilege to run. Valid options are:
3049
3050 ``id=id``
3051 Assign symbolic name for use in monitor commands.
3052
3053 ``ipv4=on|off and ipv6=on|off``
3054 Specify that either IPv4 or IPv6 must be enabled. If neither is
3055 specified both protocols are enabled.
3056
3057 ``net=addr[/mask]``
3058 Set IP network address the guest will see. Optionally specify
3059 the netmask, either in the form a.b.c.d or as number of valid
3060 top-most bits. Default is 10.0.2.0/24.
3061
3062 ``host=addr``
3063 Specify the guest-visible address of the host. Default is the
3064 2nd IP in the guest network, i.e. x.x.x.2.
3065
3066 ``ipv6-net=addr[/int]``
3067 Set IPv6 network address the guest will see (default is
3068 fec0::/64). The network prefix is given in the usual hexadecimal
3069 IPv6 address notation. The prefix size is optional, and is given
3070 as the number of valid top-most bits (default is 64).
3071
3072 ``ipv6-host=addr``
3073 Specify the guest-visible IPv6 address of the host. Default is
3074 the 2nd IPv6 in the guest network, i.e. xxxx::2.
3075
3076 ``restrict=on|off``
3077 If this option is enabled, the guest will be isolated, i.e. it
3078 will not be able to contact the host and no guest IP packets
3079 will be routed over the host to the outside. This option does
3080 not affect any explicitly set forwarding rules.
3081
3082 ``hostname=name``
3083 Specifies the client hostname reported by the built-in DHCP
3084 server.
3085
3086 ``dhcpstart=addr``
3087 Specify the first of the 16 IPs the built-in DHCP server can
3088 assign. Default is the 15th to 31st IP in the guest network,
3089 i.e. x.x.x.15 to x.x.x.31.
3090
3091 ``dns=addr``
3092 Specify the guest-visible address of the virtual nameserver. The
3093 address must be different from the host address. Default is the
3094 3rd IP in the guest network, i.e. x.x.x.3.
3095
3096 ``ipv6-dns=addr``
3097 Specify the guest-visible address of the IPv6 virtual
3098 nameserver. The address must be different from the host address.
3099 Default is the 3rd IP in the guest network, i.e. xxxx::3.
3100
3101 ``dnssearch=domain``
3102 Provides an entry for the domain-search list sent by the
3103 built-in DHCP server. More than one domain suffix can be
3104 transmitted by specifying this option multiple times. If
3105 supported, this will cause the guest to automatically try to
3106 append the given domain suffix(es) in case a domain name can not
3107 be resolved.
3108
3109 Example:
3110
3111 .. parsed-literal::
3112
3113 |qemu_system| -nic user,dnssearch=mgmt.example.org,dnssearch=example.org
3114
3115 ``domainname=domain``
3116 Specifies the client domain name reported by the built-in DHCP
3117 server.
3118
3119 ``tftp=dir``
3120 When using the user mode network stack, activate a built-in TFTP
3121 server. The files in dir will be exposed as the root of a TFTP
3122 server. The TFTP client on the guest must be configured in
3123 binary mode (use the command ``bin`` of the Unix TFTP client).
Michael Tokarevb30fa6b2024-02-08 09:00:50 +03003124 The built-in TFTP server is read-only; it does not implement any
3125 command for writing files. QEMU will not write to this directory.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003126
3127 ``tftp-server-name=name``
3128 In BOOTP reply, broadcast name as the "TFTP server name"
3129 (RFC2132 option 66). This can be used to advise the guest to
3130 load boot files or configurations from a different server than
3131 the host address.
3132
3133 ``bootfile=file``
3134 When using the user mode network stack, broadcast file as the
3135 BOOTP filename. In conjunction with ``tftp``, this can be used
3136 to network boot a guest from a local directory.
3137
3138 Example (using pxelinux):
3139
3140 .. parsed-literal::
3141
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003142 |qemu_system| -hda linux.img -boot n -device e1000,netdev=n1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003143 -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
3144
3145 ``smb=dir[,smbserver=addr]``
3146 When using the user mode network stack, activate a built-in SMB
3147 server so that Windows OSes can access to the host files in
3148 ``dir`` transparently. The IP address of the SMB server can be
3149 set to addr. By default the 4th IP in the guest network is used,
3150 i.e. x.x.x.4.
3151
3152 In the guest Windows OS, the line:
3153
3154 ::
3155
3156 10.0.2.4 smbserver
3157
3158 must be added in the file ``C:\WINDOWS\LMHOSTS`` (for windows
3159 9x/Me) or ``C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS`` (Windows
3160 NT/2000).
3161
3162 Then ``dir`` can be accessed in ``\\smbserver\qemu``.
3163
3164 Note that a SAMBA server must be installed on the host OS.
3165
3166 ``hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport``
3167 Redirect incoming TCP or UDP connections to the host port
3168 hostport to the guest IP address guestaddr on guest port
3169 guestport. If guestaddr is not specified, its value is x.x.x.15
3170 (default first address given by the built-in DHCP server). By
3171 specifying hostaddr, the rule can be bound to a specific host
3172 interface. If no connection type is set, TCP is used. This
3173 option can be given multiple times.
3174
3175 For example, to redirect host X11 connection from screen 1 to
3176 guest screen 0, use the following:
3177
Peter Maydell09ce5f22020-02-28 15:36:13 +00003178 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003179
3180 # on the host
3181 |qemu_system| -nic user,hostfwd=tcp:127.0.0.1:6001-:6000
3182 # this host xterm should open in the guest X11 server
3183 xterm -display :1
3184
3185 To redirect telnet connections from host port 5555 to telnet
3186 port on the guest, use the following:
3187
Peter Maydell09ce5f22020-02-28 15:36:13 +00003188 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003189
3190 # on the host
3191 |qemu_system| -nic user,hostfwd=tcp::5555-:23
3192 telnet localhost 5555
3193
3194 Then when you use on the host ``telnet localhost 5555``, you
3195 connect to the guest telnet server.
3196
3197 ``guestfwd=[tcp]:server:port-dev``; \ ``guestfwd=[tcp]:server:port-cmd:command``
3198 Forward guest TCP connections to the IP address server on port
3199 port to the character device dev or to a program executed by
3200 cmd:command which gets spawned for each connection. This option
3201 can be given multiple times.
3202
3203 You can either use a chardev directly and have that one used
3204 throughout QEMU's lifetime, like in the following example:
3205
Peter Maydell09ce5f22020-02-28 15:36:13 +00003206 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003207
3208 # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
3209 # the guest accesses it
3210 |qemu_system| -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
3211
3212 Or you can execute a command on every TCP connection established
3213 by the guest, so that QEMU behaves similar to an inetd process
3214 for that virtual server:
3215
Peter Maydell09ce5f22020-02-28 15:36:13 +00003216 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003217
3218 # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
3219 # and connect the TCP stream to its stdin/stdout
3220 |qemu_system| -nic 'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
3221
3222``-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper]``
3223 Configure a host TAP network backend with ID id.
3224
3225 Use the network script file to configure it and the network script
3226 dfile to deconfigure it. If name is not provided, the OS
3227 automatically provides one. The default network configure script is
3228 ``/etc/qemu-ifup`` and the default network deconfigure script is
3229 ``/etc/qemu-ifdown``. Use ``script=no`` or ``downscript=no`` to
3230 disable script execution.
3231
3232 If running QEMU as an unprivileged user, use the network helper
Tianjia Zhang8d73ec82020-07-27 12:59:25 +08003233 to configure the TAP interface and attach it to the bridge.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003234 The default network helper executable is
3235 ``/path/to/qemu-bridge-helper`` and the default bridge device is
3236 ``br0``.
3237
3238 ``fd``\ =h can be used to specify the handle of an already opened
3239 host TAP interface.
3240
3241 Examples:
3242
Peter Maydell09ce5f22020-02-28 15:36:13 +00003243 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003244
3245 #launch a QEMU instance with the default network script
3246 |qemu_system| linux.img -nic tap
3247
Peter Maydell09ce5f22020-02-28 15:36:13 +00003248 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003249
3250 #launch a QEMU instance with two NICs, each one connected
3251 #to a TAP device
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003252 |qemu_system| linux.img \\
3253 -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003254 -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
3255
Peter Maydell09ce5f22020-02-28 15:36:13 +00003256 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003257
3258 #launch a QEMU instance with the default network helper to
3259 #connect a TAP device to bridge br0
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003260 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003261 -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
3262
3263``-netdev bridge,id=id[,br=bridge][,helper=helper]``
3264 Connect a host TAP network interface to a host bridge device.
3265
3266 Use the network helper helper to configure the TAP interface and
3267 attach it to the bridge. The default network helper executable is
3268 ``/path/to/qemu-bridge-helper`` and the default bridge device is
3269 ``br0``.
3270
3271 Examples:
3272
Peter Maydell09ce5f22020-02-28 15:36:13 +00003273 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003274
3275 #launch a QEMU instance with the default network helper to
3276 #connect a TAP device to bridge br0
3277 |qemu_system| linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
3278
Peter Maydell09ce5f22020-02-28 15:36:13 +00003279 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003280
3281 #launch a QEMU instance with the default network helper to
3282 #connect a TAP device to bridge qemubr0
3283 |qemu_system| linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
3284
3285``-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port]``
3286 This host network backend can be used to connect the guest's network
3287 to another QEMU virtual machine using a TCP socket connection. If
3288 ``listen`` is specified, QEMU waits for incoming connections on port
3289 (host is optional). ``connect`` is used to connect to another QEMU
3290 instance using the ``listen`` option. ``fd``\ =h specifies an
3291 already opened TCP socket.
3292
3293 Example:
3294
Peter Maydell09ce5f22020-02-28 15:36:13 +00003295 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003296
3297 # launch a first QEMU instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003298 |qemu_system| linux.img \\
3299 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003300 -netdev socket,id=n1,listen=:1234
3301 # connect the network of this instance to the network of the first instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003302 |qemu_system| linux.img \\
3303 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003304 -netdev socket,id=n2,connect=127.0.0.1:1234
3305
3306``-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]]``
3307 Configure a socket host network backend to share the guest's network
3308 traffic with another QEMU virtual machines using a UDP multicast
3309 socket, effectively making a bus for every QEMU with same multicast
3310 address maddr and port. NOTES:
3311
3312 1. Several QEMU can be running on different hosts and share same bus
3313 (assuming correct multicast setup for these hosts).
3314
3315 2. mcast support is compatible with User Mode Linux (argument
3316 ``ethN=mcast``), see http://user-mode-linux.sf.net.
3317
3318 3. Use ``fd=h`` to specify an already opened UDP multicast socket.
3319
3320 Example:
3321
Peter Maydell09ce5f22020-02-28 15:36:13 +00003322 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003323
3324 # launch one QEMU instance
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003325 |qemu_system| linux.img \\
3326 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003327 -netdev socket,id=n1,mcast=230.0.0.1:1234
3328 # launch another QEMU instance on same "bus"
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003329 |qemu_system| linux.img \\
3330 -device e1000,netdev=n2,mac=52:54:00:12:34:57 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003331 -netdev socket,id=n2,mcast=230.0.0.1:1234
3332 # launch yet another QEMU instance on same "bus"
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003333 |qemu_system| linux.img \\
3334 -device e1000,netdev=n3,mac=52:54:00:12:34:58 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003335 -netdev socket,id=n3,mcast=230.0.0.1:1234
3336
3337 Example (User Mode Linux compat.):
3338
Peter Maydell09ce5f22020-02-28 15:36:13 +00003339 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003340
3341 # launch QEMU instance (note mcast address selected is UML's default)
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003342 |qemu_system| linux.img \\
3343 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003344 -netdev socket,id=n1,mcast=239.192.168.1:1102
3345 # launch UML
3346 /path/to/linux ubd0=/path/to/root_fs eth0=mcast
3347
3348 Example (send packets from host's 1.2.3.4):
3349
3350 .. parsed-literal::
3351
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003352 |qemu_system| linux.img \\
3353 -device e1000,netdev=n1,mac=52:54:00:12:34:56 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003354 -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
3355
Laurent Vivierbb1326a2024-07-04 14:48:31 +02003356``-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]``
3357 Configure a network backend to connect to another QEMU virtual machine or a proxy using a TCP/IP socket.
3358
3359 ``server=on|off``
3360 if ``on`` create a server socket
3361
3362 ``addr.host=host,addr.port=port``
3363 socket address to listen on (server=on) or connect to (server=off)
3364
3365 ``to=maxport``
3366 if present, this is range of possible addresses, with port between ``port`` and ``maxport``.
3367
3368 ``numeric=on|off``
3369 if ``on`` ``host`` and ``port`` are guaranteed to be numeric, otherwise a name resolution should be attempted (default: ``off``)
3370
3371 ``keep-alive=on|off``
3372 enable keep-alive when connecting to this socket. Not supported for passive sockets.
3373
3374 ``mptcp=on|off``
3375 enable multipath TCP
3376
3377 ``ipv4=on|off``
3378 whether to accept IPv4 addresses, default to try both IPv4 and IPv6
3379
3380 ``ipv6=on|off``
3381 whether to accept IPv6 addresses, default to try both IPv4 and IPv6
3382
3383 Example (two guests connected using a TCP/IP socket):
3384
3385 .. parsed-literal::
3386
3387 # first VM
3388 |qemu_system| linux.img \\
3389 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\
3390 -netdev stream,id=net0,server=on,addr.type=inet,addr.host=localhost,addr.port=1234
3391 # second VM
3392 |qemu_system| linux.img \\
3393 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\
3394 -netdev stream,id=net0,server=off,addr.type=inet,addr.host=localhost,addr.port=1234
3395
3396``-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=file-descriptor``
3397 Configure a network backend to connect to another QEMU virtual machine or a proxy using a stream oriented socket file descriptor.
3398
3399 ``server=on|off``
3400 if ``on`` create a server socket
3401
3402 ``addr.str=file-descriptor``
3403 file descriptor number to use as a socket
3404
3405``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=inet,local.host=addr]``
3406 Configure a network backend to connect to a multicast address.
3407
3408 ``remote.host=maddr,remote.port=port``
3409 multicast address
3410
3411 ``local.host=addr``
3412 specify the host address to send packets from
3413
3414 Example:
3415
3416 .. parsed-literal::
3417
3418 # launch one QEMU instance
3419 |qemu_system| linux.img \\
3420 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\
3421 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234
3422 # launch another QEMU instance on same "bus"
3423 |qemu_system| linux.img \\
3424 -device virtio-net,netdev=net0,mac=52:54:00:12:34:57 \\
3425 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234
3426 # launch yet another QEMU instance on same "bus"
3427 |qemu_system| linux.img \\
3428 -device virtio-net,netdev=net0,mac=52:54:00:12:34:58 \\
3429 -netdev dgram,id=net0,remote.type=inet,remote.host=224.0.0.1,remote.port=1234
3430
3431``-netdev dgram,id=str,remote.type=inet,remote.host=maddr,remote.port=port[,local.type=fd,local.str=file-descriptor]``
3432 Configure a network backend to connect to a multicast address using a UDP socket file descriptor.
3433
3434 ``remote.host=maddr,remote.port=port``
3435 multicast address
3436
3437 ``local.str=file-descriptor``
3438 File descriptor to use to send packets
3439
3440``-netdev dgram,id=str,local.type=inet,local.host=addr,local.port=port[,remote.type=inet,remote.host=addr,remote.port=port]``
3441 Configure a network backend to connect to another QEMU virtual
3442 machine or a proxy using a datagram oriented unix domain socket.
3443
3444 ``local.host=addr,local.port=port``
3445 IP address to use to send the packets from
3446
3447 ``remote.host=addr,remote.port=port``
3448 Destination IP address
3449
3450 Example (two guests connected using an UDP/IP socket):
3451
3452 .. parsed-literal::
3453
3454 # first VM
3455 |qemu_system| linux.img \\
3456 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\
3457 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1234,remote.type=inet,remote.host=localhost,remote.port=1235
3458 # second VM
3459 |qemu_system| linux.img \\
3460 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 \\
3461 -netdev dgram,id=net0,local.type=inet,local.host=localhost,local.port=1235,remote.type=inet,remote.host=localhost,remote.port=1234
3462
3463``-netdev dgram,id=str,local.type=fd,local.str=file-descriptor``
3464 Configure a network backend to connect to another QEMU virtual
3465 machine or a proxy using a datagram oriented socket file descriptor.
3466
3467 ``local.str=file-descriptor``
3468 File descriptor to use to send packets
3469
Zhao Liucb8de742024-07-08 17:26:30 +08003470``-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64=on|off][,counter=on|off][,pincounter=on|off][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003471 Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931)
3472 is a popular protocol to transport Ethernet (and other Layer 2) data
3473 frames between two systems. It is present in routers, firewalls and
3474 the Linux kernel (from version 3.3 onwards).
3475
3476 This transport allows a VM to communicate to another VM, router or
3477 firewall directly.
3478
3479 ``src=srcaddr``
3480 source address (mandatory)
3481
3482 ``dst=dstaddr``
3483 destination address (mandatory)
3484
Zhao Liucb8de742024-07-08 17:26:30 +08003485 ``udp=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003486 select udp encapsulation (default is ip).
3487
3488 ``srcport=srcport``
3489 source udp port.
3490
3491 ``dstport=dstport``
3492 destination udp port.
3493
Zhao Liucb8de742024-07-08 17:26:30 +08003494 ``ipv6=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003495 force v6, otherwise defaults to v4.
3496
3497 ``rxcookie=rxcookie``; \ ``txcookie=txcookie``
3498 Cookies are a weak form of security in the l2tpv3 specification.
3499 Their function is mostly to prevent misconfiguration. By default
3500 they are 32 bit.
3501
Zhao Liucb8de742024-07-08 17:26:30 +08003502 ``cookie64=on``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003503 Set cookie size to 64 bit instead of the default 32
3504
3505 ``counter=off``
3506 Force a 'cut-down' L2TPv3 with no counter as in
3507 draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
3508
3509 ``pincounter=on``
3510 Work around broken counter handling in peer. This may also help
3511 on networks which have packet reorder.
3512
3513 ``offset=offset``
3514 Add an extra offset between header and data
3515
3516 For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to
3517 the bridge br-lan on the remote Linux host 1.2.3.4:
3518
Peter Maydell09ce5f22020-02-28 15:36:13 +00003519 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003520
3521 # Setup tunnel on linux host using raw ip as encapsulation
3522 # on 1.2.3.4
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003523 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 +00003524 encap udp udp_sport 16384 udp_dport 16384
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003525 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003526 0xFFFFFFFF peer_session_id 0xFFFFFFFF
3527 ifconfig vmtunnel0 mtu 1500
3528 ifconfig vmtunnel0 up
3529 brctl addif br-lan vmtunnel0
3530
3531
3532 # on 4.3.2.1
3533 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
3534
Laszlo Ersek353a06b2020-09-08 19:21:11 +02003535 |qemu_system| linux.img -device e1000,netdev=n1 \\
Zhao Liucb8de742024-07-08 17:26:30 +08003536 -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp=on,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter=on
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003537
3538``-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]``
3539 Configure VDE backend to connect to PORT n of a vde switch running
3540 on host and listening for incoming connections on socketpath. Use
3541 GROUP groupname and MODE octalmode to change default ownership and
3542 permissions for communication port. This option is only available if
3543 QEMU has been compiled with vde support enabled.
3544
3545 Example:
3546
Peter Maydell09ce5f22020-02-28 15:36:13 +00003547 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003548
3549 # launch vde switch
3550 vde_switch -F -sock /tmp/myswitch
3551 # launch QEMU instance
3552 |qemu_system| linux.img -nic vde,sock=/tmp/myswitch
3553
Ilya Maximetscb039ef2023-09-13 20:34:37 +02003554``-netdev af-xdp,id=str,ifname=name[,mode=native|skb][,force-copy=on|off][,queues=n][,start-queue=m][,inhibit=on|off][,sock-fds=x:y:...:z]``
3555 Configure AF_XDP backend to connect to a network interface 'name'
3556 using AF_XDP socket. A specific program attach mode for a default
3557 XDP program can be forced with 'mode', defaults to best-effort,
3558 where the likely most performant mode will be in use. Number of queues
3559 'n' should generally match the number or queues in the interface,
3560 defaults to 1. Traffic arriving on non-configured device queues will
3561 not be delivered to the network backend.
3562
3563 .. parsed-literal::
3564
3565 # set number of queues to 4
3566 ethtool -L eth0 combined 4
3567 # launch QEMU instance
3568 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\
3569 -netdev af-xdp,id=n1,ifname=eth0,queues=4
3570
3571 'start-queue' option can be specified if a particular range of queues
3572 [m, m + n] should be in use. For example, this is may be necessary in
3573 order to use certain NICs in native mode. Kernel allows the driver to
3574 create a separate set of XDP queues on top of regular ones, and only
3575 these queues can be used for AF_XDP sockets. NICs that work this way
3576 may also require an additional traffic redirection with ethtool to these
3577 special queues.
3578
3579 .. parsed-literal::
3580
3581 # set number of queues to 1
3582 ethtool -L eth0 combined 1
3583 # redirect all the traffic to the second queue (id: 1)
3584 # note: drivers may require non-empty key/mask pair.
3585 ethtool -N eth0 flow-type ether \\
3586 dst 00:00:00:00:00:00 m FF:FF:FF:FF:FF:FE action 1
3587 ethtool -N eth0 flow-type ether \\
3588 dst 00:00:00:00:00:01 m FF:FF:FF:FF:FF:FE action 1
3589 # launch QEMU instance
3590 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\
3591 -netdev af-xdp,id=n1,ifname=eth0,queues=1,start-queue=1
3592
3593 XDP program can also be loaded externally. In this case 'inhibit' option
3594 should be set to 'on' and 'sock-fds' provided with file descriptors for
3595 already open but not bound XDP sockets already added to a socket map for
3596 corresponding queues. One socket per queue.
3597
3598 .. parsed-literal::
3599
3600 |qemu_system| linux.img -device virtio-net-pci,netdev=n1 \\
3601 -netdev af-xdp,id=n1,ifname=eth0,queues=3,inhibit=on,sock-fds=15:16:17
3602
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003603``-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n]``
3604 Establish a vhost-user netdev, backed by a chardev id. The chardev
3605 should be a unix domain socket backed one. The vhost-user uses a
3606 specifically defined protocol to pass vhost ioctl replacement
3607 messages to an application on the other end of the socket. On
3608 non-MSIX guests, the feature can be forced with vhostforce. Use
3609 'queues=n' to specify the number of queues to be created for
3610 multiqueue vhost-user.
3611
3612 Example:
3613
3614 ::
3615
3616 qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
3617 -numa node,memdev=mem \
3618 -chardev socket,id=chr0,path=/path/to/socket \
3619 -netdev type=vhost-user,id=net0,chardev=chr0 \
3620 -device virtio-net-pci,netdev=net0
3621
Si-Wei Liu8801ccd2022-10-08 00:58:58 -07003622``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]``
Cindy Lu108a6482020-07-01 22:55:37 +08003623 Establish a vhost-vdpa netdev.
3624
3625 vDPA device is a device that uses a datapath which complies with
3626 the virtio specifications with a vendor specific control path.
3627 vDPA devices can be both physically located on the hardware or
3628 emulated by software.
3629
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003630``-netdev hubport,id=id,hubid=hubid[,netdev=nd]``
3631 Create a hub port on the emulated hub with ID hubid.
3632
3633 The hubport netdev lets you connect a NIC to a QEMU emulated hub
3634 instead of a single netdev. Alternatively, you can also connect the
3635 hubport to another netdev with ID nd by using the ``netdev=nd``
3636 option.
3637
3638``-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v]``
3639 Legacy option to configure or create an on-board (or machine
3640 default) Network Interface Card(NIC) and connect it either to the
3641 emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.
3642 If model is omitted, then the default NIC model associated with the
3643 machine type is used. Note that the default NIC model may change in
3644 future QEMU releases, so it is highly recommended to always specify
3645 a model. Optionally, the MAC address can be changed to mac, the
3646 device address set to addr (PCI cards only), and a name can be
3647 assigned for use in monitor commands. Optionally, for PCI cards, you
3648 can specify the number v of MSI-X vectors that the card should have;
3649 this option currently only affects virtio cards; set v = 0 to
3650 disable MSI-X. If no ``-net`` option is specified, a single NIC is
3651 created. QEMU can emulate several different models of network card.
3652 Use ``-net nic,model=help`` for a list of available devices for your
3653 target.
3654
3655``-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name]``
3656 Configure a host network backend (with the options corresponding to
3657 the same ``-netdev`` option) and connect it to the emulated hub 0
3658 (the default hub). Use name to specify the name of the hub port.
3659ERST
blueswir15824d652009-03-28 06:44:27 +00003660
Matthew Booth7273a2d2009-10-30 13:41:12 +00003661DEFHEADING()
3662
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003663DEFHEADING(Character device options:)
Matthew Booth7273a2d2009-10-30 13:41:12 +00003664
3665DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
Lin Ma517b3d42016-08-17 01:13:52 +08003666 "-chardev help\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003667 "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Markus Armbrusterba858d12021-09-28 09:14:49 +02003668 "-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 +00003669 " [,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 +00003670 " [,logfile=PATH][,logappend=on|off][,tls-creds=ID][,tls-authz=ID] (tcp)\n"
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003671 "-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 +08003672 " [,mux=on|off][,logfile=PATH][,logappend=on|off][,abstract=on|off][,tight=on|off] (unix)\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003673 "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003674 " [,localport=localport][,ipv4=on|off][,ipv6=on|off][,mux=on|off]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003675 " [,logfile=PATH][,logappend=on|off]\n"
3676 "-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003677 "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003678 " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3679 "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003680 "-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 +00003681 "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003682#ifdef _WIN32
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003683 "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3684 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003685#else
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003686 "-chardev pty,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
3687 "-chardev stdio,id=id[,mux=on|off][,signal=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003688#endif
3689#ifdef CONFIG_BRLAPI
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003690 "-chardev braille,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003691#endif
3692#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
3693 || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003694 "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003695#endif
3696#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003697 "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
Matthew Booth7273a2d2009-10-30 13:41:12 +00003698#endif
Alon Levycbcc6332011-01-19 10:49:50 +02003699#if defined(CONFIG_SPICE)
Daniel P. Berranged0d77082016-01-11 12:44:41 +00003700 "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
3701 "-chardev spiceport,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
Alon Levycbcc6332011-01-19 10:49:50 +02003702#endif
Blue Swirlad960902010-03-29 19:23:52 +00003703 , QEMU_ARCH_ALL
Matthew Booth7273a2d2009-10-30 13:41:12 +00003704)
3705
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003706SRST
3707The general form of a character device option is:
3708
3709``-chardev backend,id=id[,mux=on|off][,options]``
3710 Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
3711 ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
Paolo Bonzini6f9f6302022-12-16 10:56:53 +01003712 ``pty``, ``stdio``, ``braille``, ``parallel``,
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003713 ``spicevmc``, ``spiceport``. The specific backend will determine the
3714 applicable options.
3715
3716 Use ``-chardev help`` to print all available chardev backend types.
3717
3718 All devices must have an id, which can be any string up to 127
3719 characters long. It is used to uniquely identify this device in
3720 other command line directives.
3721
3722 A character device may be used in multiplexing mode by multiple
3723 front-ends. Specify ``mux=on`` to enable this mode. A multiplexer is
3724 a "1:N" device, and here the "1" end is your specified chardev
3725 backend, and the "N" end is the various parts of QEMU that can talk
3726 to a chardev. If you create a chardev with ``id=myid`` and
3727 ``mux=on``, QEMU will create a multiplexer with your specified ID,
3728 and you can then configure multiple front ends to use that chardev
3729 ID for their input/output. Up to four different front ends can be
3730 connected to a single multiplexed chardev. (Without multiplexing
3731 enabled, a chardev can only be used by a single front end.) For
3732 instance you could use this to allow a single stdio chardev to be
3733 used by two serial ports and the QEMU monitor:
3734
3735 ::
3736
3737 -chardev stdio,mux=on,id=char0 \
3738 -mon chardev=char0,mode=readline \
3739 -serial chardev:char0 \
3740 -serial chardev:char0
3741
3742 You can have more than one multiplexer in a system configuration;
3743 for instance you could have a TCP port multiplexed between UART 0
3744 and UART 1, and stdio multiplexed between the QEMU monitor and a
3745 parallel port:
3746
3747 ::
3748
3749 -chardev stdio,mux=on,id=char0 \
3750 -mon chardev=char0,mode=readline \
3751 -parallel chardev:char0 \
3752 -chardev tcp,...,mux=on,id=char1 \
3753 -serial chardev:char1 \
3754 -serial chardev:char1
3755
3756 When you're using a multiplexed character device, some escape
Thomas Huth923e9312020-11-16 15:47:36 +01003757 sequences are interpreted in the input. See the chapter about
3758 :ref:`keys in the character backend multiplexer` in the
3759 System Emulation Users Guide for more details.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003760
3761 Note that some other command line options may implicitly create
3762 multiplexed character backends; for instance ``-serial mon:stdio``
3763 creates a multiplexed stdio backend connected to the serial port and
3764 the QEMU monitor, and ``-nographic`` also multiplexes the console
3765 and the monitor to stdio.
3766
3767 There is currently no support for multiplexing in the other
3768 direction (where a single QEMU front end takes input and output from
3769 multiple chardevs).
3770
3771 Every backend supports the ``logfile`` option, which supplies the
3772 path to a file to record all data transmitted via the backend. The
3773 ``logappend`` option controls whether the log file will be truncated
3774 or appended to when opened.
3775
3776The available backends are:
3777
3778``-chardev null,id=id``
3779 A void device. This device will not emit any data, and will drop any
3780 data it receives. The null backend does not take any options.
3781
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003782``-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 +00003783 Create a two-way stream socket, which can be either a TCP or a unix
3784 socket. A unix socket will be created if ``path`` is specified.
3785 Behaviour is undefined if TCP options are specified for a unix
3786 socket.
3787
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003788 ``server=on|off`` specifies that the socket shall be a listening socket.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003789
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003790 ``wait=on|off`` specifies that QEMU should not block waiting for a client
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003791 to connect to a listening socket.
3792
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003793 ``telnet=on|off`` specifies that traffic on the socket should interpret
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003794 telnet escape sequences.
3795
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003796 ``websocket=on|off`` specifies that the socket uses WebSocket protocol for
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003797 communication.
3798
3799 ``reconnect`` sets the timeout for reconnecting on non-server
3800 sockets when the remote end goes away. qemu will delay this many
3801 seconds and then attempt to reconnect. Zero disables reconnecting,
3802 and is the default.
3803
3804 ``tls-creds`` requests enablement of the TLS protocol for
3805 encryption, and specifies the id of the TLS credentials to use for
3806 the handshake. The credentials must be previously created with the
3807 ``-object tls-creds`` argument.
3808
3809 ``tls-auth`` provides the ID of the QAuthZ authorization object
3810 against which the client's x509 distinguished name will be
3811 validated. This object is only resolved at time of use, so can be
3812 deleted and recreated on the fly while the chardev server is active.
3813 If missing, it will default to denying access.
3814
3815 TCP and unix socket options are given below:
3816
Paolo Bonzinia9b13152021-02-25 11:47:52 +01003817 ``TCP options: port=port[,host=host][,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003818 ``host`` for a listening socket specifies the local address to
3819 be bound. For a connecting socket species the remote host to
3820 connect to. ``host`` is optional for listening sockets. If not
3821 specified it defaults to ``0.0.0.0``.
3822
3823 ``port`` for a listening socket specifies the local port to be
3824 bound. For a connecting socket specifies the port on the remote
3825 host to connect to. ``port`` can be given as either a port
3826 number or a service name. ``port`` is required.
3827
3828 ``to`` is only relevant to listening sockets. If it is
3829 specified, and ``port`` cannot be bound, QEMU will attempt to
3830 bind to subsequent ports up to and including ``to`` until it
3831 succeeds. ``to`` must be specified as a port number.
3832
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003833 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4
3834 or IPv6 must be used. If neither is specified the socket may
3835 use either protocol.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003836
Paolo Bonzinia9b13152021-02-25 11:47:52 +01003837 ``nodelay=on|off`` disables the Nagle algorithm.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003838
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003839 ``unix options: path=path[,abstract=on|off][,tight=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003840 ``path`` specifies the local path of the unix socket. ``path``
3841 is required.
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003842 ``abstract=on|off`` specifies the use of the abstract socket namespace,
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003843 rather than the filesystem. Optional, defaults to false.
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003844 ``tight=on|off`` sets the socket length of abstract sockets to their minimum,
xiaoqiang zhaoe3392732020-05-16 11:13:27 +08003845 rather than the full sun_path length. Optional, defaults to true.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003846
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003847``-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 +00003848 Sends all traffic from the guest to a remote host over UDP.
3849
3850 ``host`` specifies the remote host to connect to. If not specified
3851 it defaults to ``localhost``.
3852
3853 ``port`` specifies the port on the remote host to connect to.
3854 ``port`` is required.
3855
3856 ``localaddr`` specifies the local address to bind to. If not
3857 specified it defaults to ``0.0.0.0``.
3858
3859 ``localport`` specifies the local port to bind to. If not specified
3860 any available local port will be used.
3861
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00003862 ``ipv4=on|off`` and ``ipv6=on|off`` specify that either IPv4 or IPv6 must be used.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003863 If neither is specified the device may use either protocol.
3864
3865``-chardev msmouse,id=id``
3866 Forward QEMU's emulated msmouse events to the guest. ``msmouse``
3867 does not take any options.
3868
3869``-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]``
3870 Connect to a QEMU text console. ``vc`` may optionally be given a
3871 specific size.
3872
3873 ``width`` and ``height`` specify the width and height respectively
3874 of the console, in pixels.
3875
3876 ``cols`` and ``rows`` specify that the console be sized to fit a
3877 text console with the given dimensions.
3878
3879``-chardev ringbuf,id=id[,size=size]``
3880 Create a ring buffer with fixed size ``size``. size must be a power
3881 of two and defaults to ``64K``.
3882
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003883``-chardev file,id=id,path=path[,input-path=input-path]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003884 Log all traffic received from the guest to a file.
3885
3886 ``path`` specifies the path of the file to be opened. This file will
3887 be created if it does not already exist, and overwritten if it does.
3888 ``path`` is required.
3889
Peter Maydell5b18a6b2023-04-13 16:07:24 +01003890 If ``input-path`` is specified, this is the path of a second file
3891 which will be used for input. If ``input-path`` is not specified,
3892 no input will be available from the chardev.
3893
3894 Note that ``input-path`` is not supported on Windows hosts.
3895
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003896``-chardev pipe,id=id,path=path``
3897 Create a two-way connection to the guest. The behaviour differs
3898 slightly between Windows hosts and other hosts:
3899
3900 On Windows, a single duplex pipe will be created at
3901 ``\\.pipe\path``.
3902
3903 On other hosts, 2 pipes will be created called ``path.in`` and
3904 ``path.out``. Data written to ``path.in`` will be received by the
3905 guest. Data written by the guest can be read from ``path.out``. QEMU
3906 will not create these fifos, and requires them to be present.
3907
3908 ``path`` forms part of the pipe path as described above. ``path`` is
3909 required.
3910
3911``-chardev console,id=id``
3912 Send traffic from the guest to QEMU's standard output. ``console``
3913 does not take any options.
3914
3915 ``console`` is only available on Windows hosts.
3916
3917``-chardev serial,id=id,path=path``
3918 Send traffic from the guest to a serial device on the host.
3919
3920 On Unix hosts serial will actually accept any tty device, not only
3921 serial lines.
3922
3923 ``path`` specifies the name of the serial device to open.
3924
3925``-chardev pty,id=id``
3926 Create a new pseudo-terminal on the host and connect to it. ``pty``
3927 does not take any options.
3928
3929 ``pty`` is not available on Windows hosts.
3930
3931``-chardev stdio,id=id[,signal=on|off]``
3932 Connect to standard input and standard output of the QEMU process.
3933
3934 ``signal`` controls if signals are enabled on the terminal, that
3935 includes exiting QEMU with the key sequence Control-c. This option
3936 is enabled by default, use ``signal=off`` to disable it.
3937
3938``-chardev braille,id=id``
3939 Connect to a local BrlAPI server. ``braille`` does not take any
3940 options.
3941
Peter Maydell09ce5f22020-02-28 15:36:13 +00003942``-chardev parallel,id=id,path=path``
3943 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003944 ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
3945 hosts.
3946
3947 Connect to a local parallel port.
3948
3949 ``path`` specifies the path to the parallel port device. ``path`` is
3950 required.
3951
3952``-chardev spicevmc,id=id,debug=debug,name=name``
3953 ``spicevmc`` is only available when spice support is built in.
3954
3955 ``debug`` debug level for spicevmc
3956
3957 ``name`` name of spice channel to connect to
3958
3959 Connect to a spice virtual machine channel, such as vdiport.
3960
3961``-chardev spiceport,id=id,debug=debug,name=name``
3962 ``spiceport`` is only available when spice support is built in.
3963
3964 ``debug`` debug level for spicevmc
3965
3966 ``name`` name of spice port to connect to
3967
3968 Connect to a spice port, allowing a Spice client to handle the
3969 traffic identified by a name (preferably a fqdn).
3970ERST
Matthew Booth7273a2d2009-10-30 13:41:12 +00003971
3972DEFHEADING()
3973
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003974#ifdef CONFIG_TPM
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02003975DEFHEADING(TPM device options:)
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003976
3977DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
Stefan Berger92dcc232013-02-27 12:47:54 -05003978 "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
3979 " use path to provide path to a character device; default is /dev/tpm0\n"
3980 " use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
Amarnath Vallurif4ede812017-09-29 14:10:20 +03003981 " not provided it will be searched for in /sys/class/misc/tpm?/device\n"
3982 "-tpmdev emulator,id=id,chardev=dev\n"
3983 " configure the TPM device using chardev backend\n",
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05003984 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00003985SRST
3986The general form of a TPM device option is:
3987
3988``-tpmdev backend,id=id[,options]``
3989 The specific backend type will determine the applicable options. The
3990 ``-tpmdev`` option creates the TPM backend and requires a
3991 ``-device`` option that specifies the TPM frontend interface model.
3992
3993 Use ``-tpmdev help`` to print all available TPM backend types.
3994
3995The available backends are:
3996
3997``-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path``
3998 (Linux-host only) Enable access to the host's TPM using the
3999 passthrough driver.
4000
4001 ``path`` specifies the path to the host's TPM device, i.e., on a
4002 Linux host this would be ``/dev/tpm0``. ``path`` is optional and by
4003 default ``/dev/tpm0`` is used.
4004
4005 ``cancel-path`` specifies the path to the host TPM device's sysfs
4006 entry allowing for cancellation of an ongoing TPM command.
4007 ``cancel-path`` is optional and by default QEMU will search for the
4008 sysfs entry to use.
4009
4010 Some notes about using the host's TPM with the passthrough driver:
4011
4012 The TPM device accessed by the passthrough driver must not be used
4013 by any other application on the host.
4014
4015 Since the host's firmware (BIOS/UEFI) has already initialized the
4016 TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize
4017 the TPM again and may therefore not show a TPM-specific menu that
4018 would otherwise allow the user to configure the TPM, e.g., allow the
4019 user to enable/disable or activate/deactivate the TPM. Further, if
4020 TPM ownership is released from within a VM then the host's TPM will
4021 get disabled and deactivated. To enable and activate the TPM again
4022 afterwards, the host has to be rebooted and the user is required to
4023 enter the firmware's menu to enable and activate the TPM. If the TPM
4024 is left disabled and/or deactivated most TPM commands will fail.
4025
4026 To create a passthrough TPM use the following two options:
4027
4028 ::
4029
4030 -tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
4031
4032 Note that the ``-tpmdev`` id is ``tpm0`` and is referenced by
4033 ``tpmdev=tpm0`` in the device option.
4034
4035``-tpmdev emulator,id=id,chardev=dev``
4036 (Linux-host only) Enable access to a TPM emulator using Unix domain
4037 socket based chardev backend.
4038
4039 ``chardev`` specifies the unique ID of a character device backend
4040 that provides connection to the software TPM server.
4041
4042 To create a TPM emulator backend device with chardev socket backend:
4043
4044 ::
4045
4046 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
4047ERST
Stefan Bergerd1a0cf72013-02-27 12:47:49 -05004048
4049DEFHEADING()
4050
4051#endif
4052
Alex Bennée1235cf72022-07-25 15:05:20 +01004053DEFHEADING(Boot Image or Kernel specific:)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004054SRST
Alex Bennée1235cf72022-07-25 15:05:20 +01004055There are broadly 4 ways you can boot a system with QEMU.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004056
Alex Bennée1235cf72022-07-25 15:05:20 +01004057 - specify a firmware and let it control finding a kernel
4058 - specify a firmware and pass a hint to the kernel to boot
4059 - direct kernel image boot
4060 - manually load files into the guest's address space
4061
4062The third method is useful for quickly testing kernels but as there is
4063no firmware to pass configuration information to the kernel the
4064hardware must either be probeable, the kernel built for the exact
4065configuration or passed some configuration data (e.g. a DTB blob)
4066which tells the kernel what drivers it needs. This exact details are
4067often hardware specific.
4068
4069The final method is the most generic way of loading images into the
4070guest address space and used mostly for ``bare metal`` type
4071development where the reset vectors of the processor are taken into
4072account.
4073
4074ERST
4075
4076SRST
4077
4078For x86 machines and some other architectures ``-bios`` will generally
4079do the right thing with whatever it is given. For other machines the
4080more strict ``-pflash`` option needs an image that is sized for the
4081flash device for the given machine type.
4082
4083Please see the :ref:`system-targets-ref` section of the manual for
4084more detailed documentation.
4085
4086ERST
4087
4088DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
4089 "-bios file set the filename for the BIOS\n", QEMU_ARCH_ALL)
4090SRST
4091``-bios file``
4092 Set the filename for the BIOS.
4093ERST
4094
4095DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
4096 "-pflash file use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
4097SRST
4098``-pflash file``
4099 Use file as a parallel flash image.
4100ERST
4101
4102SRST
4103
4104The kernel options were designed to work with Linux kernels although
4105other things (like hypervisors) can be packaged up as a kernel
4106executable image. The exact format of a executable image is usually
4107architecture specific.
4108
4109The way in which the kernel is started (what address it is loaded at,
4110what if any information is passed to it via CPU registers, the state
4111of the hardware when it is started, and so on) is also architecture
4112specific. Typically it follows the specification laid down by the
4113Linux kernel for how kernels for that architecture must be started.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004114
4115ERST
blueswir15824d652009-03-28 06:44:27 +00004116
4117DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
Blue Swirlad960902010-03-29 19:23:52 +00004118 "-kernel bzImage use 'bzImage' as kernel image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004119SRST
4120``-kernel bzImage``
4121 Use bzImage as kernel image. The kernel can be either a Linux kernel
4122 or in multiboot format.
4123ERST
blueswir15824d652009-03-28 06:44:27 +00004124
4125DEF("append", HAS_ARG, QEMU_OPTION_append, \
Blue Swirlad960902010-03-29 19:23:52 +00004126 "-append cmdline use 'cmdline' as kernel command line\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004127SRST
4128``-append cmdline``
4129 Use cmdline as kernel command line
4130ERST
blueswir15824d652009-03-28 06:44:27 +00004131
4132DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
Blue Swirlad960902010-03-29 19:23:52 +00004133 "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL)
David Woodhouse1eeb4322024-01-30 19:01:43 +00004134SRST(initrd)
David Woodhousecc9d10b2023-10-19 15:30:23 +01004135
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004136``-initrd file``
4137 Use file as initial ram disk.
4138
4139``-initrd "file1 arg=foo,file2"``
4140 This syntax is only available with multiboot.
4141
David Woodhousecc9d10b2023-10-19 15:30:23 +01004142 Use file1 and file2 as modules and pass ``arg=foo`` as parameter to the
4143 first module. Commas can be provided in module parameters by doubling
4144 them on the command line to escape them:
4145
4146``-initrd "bzImage earlyprintk=xen,,keep root=/dev/xvda1,initrd.img"``
4147 Multiboot only. Use bzImage as the first module with
4148 "``earlyprintk=xen,keep root=/dev/xvda1``" as its command line,
4149 and initrd.img as the second module.
4150
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004151ERST
blueswir15824d652009-03-28 06:44:27 +00004152
Grant Likely412beee2012-03-02 11:56:38 +00004153DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \
Peter A. G. Crosthwaite379b5c72012-03-04 21:03:54 +10004154 "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004155SRST
4156``-dtb file``
4157 Use file as a device tree binary (dtb) image and pass it to the
4158 kernel on boot.
4159ERST
Grant Likely412beee2012-03-02 11:56:38 +00004160
Alex Bennée1235cf72022-07-25 15:05:20 +01004161SRST
4162
4163Finally you can also manually load images directly into the address
4164space of the guest. This is most useful for developers who already
4165know the layout of their guest and take care to ensure something sane
4166will happen when the reset vector executes.
4167
4168The generic loader can be invoked by using the loader device:
4169
4170``-device loader,addr=<addr>,data=<data>,data-len=<data-len>[,data-be=<data-be>][,cpu-num=<cpu-num>]``
4171
4172there is also the guest loader which operates in a similar way but
4173tweaks the DTB so a hypervisor loaded via ``-kernel`` can find where
4174the guest image is:
4175
4176``-device guest-loader,addr=<addr>[,kernel=<path>,[bootargs=<arguments>]][,initrd=<path>]``
4177
4178ERST
4179
blueswir15824d652009-03-28 06:44:27 +00004180DEFHEADING()
4181
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02004182DEFHEADING(Debug/Expert options:)
blueswir15824d652009-03-28 06:44:27 +00004183
Markus Armbruster6dd75472021-03-18 16:55:10 +01004184DEF("compat", HAS_ARG, QEMU_OPTION_compat,
Markus Armbrusterdbb675c2021-03-18 16:55:19 +01004185 "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n"
Markus Armbruster57df0df2021-10-28 12:25:20 +02004186 " Policy for handling deprecated management interfaces\n"
4187 "-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n"
4188 " Policy for handling unstable management interfaces\n",
Markus Armbruster6dd75472021-03-18 16:55:10 +01004189 QEMU_ARCH_ALL)
4190SRST
4191``-compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}]``
4192 Set policy for handling deprecated management interfaces (experimental):
4193
4194 ``deprecated-input=accept`` (default)
4195 Accept deprecated commands and arguments
4196 ``deprecated-input=reject``
4197 Reject deprecated commands and arguments
Markus Armbrusterdbb675c2021-03-18 16:55:19 +01004198 ``deprecated-input=crash``
4199 Crash on deprecated commands and arguments
Markus Armbruster6dd75472021-03-18 16:55:10 +01004200 ``deprecated-output=accept`` (default)
4201 Emit deprecated command results and events
4202 ``deprecated-output=hide``
4203 Suppress deprecated command results and events
4204
4205 Limitation: covers only syntactic aspects of QMP.
Markus Armbruster57df0df2021-10-28 12:25:20 +02004206
4207``-compat [unstable-input=@var{input-policy}][,unstable-output=@var{output-policy}]``
4208 Set policy for handling unstable management interfaces (experimental):
4209
4210 ``unstable-input=accept`` (default)
4211 Accept unstable commands and arguments
4212 ``unstable-input=reject``
4213 Reject unstable commands and arguments
4214 ``unstable-input=crash``
4215 Crash on unstable commands and arguments
4216 ``unstable-output=accept`` (default)
4217 Emit unstable command results and events
4218 ``unstable-output=hide``
4219 Suppress unstable command results and events
4220
4221 Limitation: covers only syntactic aspects of QMP.
Markus Armbruster6dd75472021-03-18 16:55:10 +01004222ERST
4223
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04004224DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
4225 "-fw_cfg [name=]<name>,file=<file>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02004226 " add named fw_cfg entry with contents from file\n"
Gabriel L. Somlo6407d762015-09-29 12:29:01 -04004227 "-fw_cfg [name=]<name>,string=<str>\n"
Markus Armbruster63d31452016-04-18 18:29:50 +02004228 " add named fw_cfg entry with contents from string\n",
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04004229 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004230SRST
4231``-fw_cfg [name=]name,file=file``
4232 Add named fw\_cfg entry with contents from file file.
Yihuan Panfd49b212023-12-13 22:17:07 +08004233 If the filename contains comma, you must double it (for instance,
4234 "file=my,,file" to use file "my,file").
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004235
4236``-fw_cfg [name=]name,string=str``
4237 Add named fw\_cfg entry with contents from string str.
Yihuan Panfd49b212023-12-13 22:17:07 +08004238 If the string contains comma, you must double it (for instance,
4239 "string=my,,string" to use file "my,string").
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004240
4241 The terminating NUL character of the contents of str will not be
4242 included as part of the fw\_cfg item data. To insert contents with
4243 embedded NUL characters, you have to use the file parameter.
4244
4245 The fw\_cfg entries are passed by QEMU through to the guest.
4246
4247 Example:
4248
4249 ::
4250
4251 -fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
4252
4253 creates an fw\_cfg entry named opt/com.mycompany/blob with contents
4254 from ./my\_blob.bin.
4255ERST
Gabriel L. Somlo81b2b812015-04-29 11:21:53 -04004256
blueswir15824d652009-03-28 06:44:27 +00004257DEF("serial", HAS_ARG, QEMU_OPTION_serial, \
Blue Swirlad960902010-03-29 19:23:52 +00004258 "-serial dev redirect the serial port to char device 'dev'\n",
4259 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004260SRST
4261``-serial dev``
4262 Redirect the virtual serial port to host character device dev. The
4263 default device is ``vc`` in graphical mode and ``stdio`` in non
4264 graphical mode.
4265
Steven Shen75583002024-03-05 09:30:16 +08004266 This option can be used several times to simulate multiple serial
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004267 ports.
4268
Peter Maydell747bfaf2024-01-22 16:36:07 +00004269 You can use ``-serial none`` to suppress the creation of default
4270 serial devices.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004271
4272 Available character devices are:
4273
4274 ``vc[:WxH]``
4275 Virtual console. Optionally, a width and height can be given in
4276 pixel with
4277
4278 ::
4279
4280 vc:800x600
4281
4282 It is also possible to specify width or height in characters:
4283
4284 ::
4285
4286 vc:80Cx24C
4287
4288 ``pty``
4289 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
4290
4291 ``none``
Peter Maydell747bfaf2024-01-22 16:36:07 +00004292 No device is allocated. Note that for machine types which
4293 emulate systems where a serial device is always present in
4294 real hardware, this may be equivalent to the ``null`` option,
4295 in that the serial device is still present but all output
4296 is discarded. For boards where the number of serial ports is
4297 truly variable, this suppresses the creation of the device.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004298
4299 ``null``
Peter Maydell747bfaf2024-01-22 16:36:07 +00004300 A guest will see the UART or serial device as present in the
4301 machine, but all output is discarded, and there is no input.
4302 Conceptually equivalent to redirecting the output to ``/dev/null``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004303
4304 ``chardev:id``
4305 Use a named character device defined with the ``-chardev``
4306 option.
4307
4308 ``/dev/XXX``
4309 [Linux only] Use host tty, e.g. ``/dev/ttyS0``. The host serial
4310 port parameters are set according to the emulated ones.
4311
4312 ``/dev/parportN``
4313 [Linux only, parallel port only] Use host parallel port N.
4314 Currently SPP and EPP parallel port features can be used.
4315
4316 ``file:filename``
4317 Write output to filename. No character can be read.
4318
4319 ``stdio``
4320 [Unix only] standard input/output
4321
4322 ``pipe:filename``
4323 name pipe filename
4324
4325 ``COMn``
4326 [Windows only] Use host serial port n
4327
4328 ``udp:[remote_host]:remote_port[@[src_ip]:src_port]``
4329 This implements UDP Net Console. When remote\_host or src\_ip
4330 are not specified they default to ``0.0.0.0``. When not using a
4331 specified src\_port a random port is automatically chosen.
4332
4333 If you just want a simple readonly console you can use
4334 ``netcat`` or ``nc``, by starting QEMU with:
4335 ``-serial udp::4555`` and nc as: ``nc -u -l -p 4555``. Any time
4336 QEMU writes something to that port it will appear in the
4337 netconsole session.
4338
4339 If you plan to send characters back via netconsole or you want
4340 to stop and start QEMU a lot of times, you should have QEMU use
4341 the same source port each time by using something like ``-serial
4342 udp::4555@:4556`` to QEMU. Another approach is to use a patched
4343 version of netcat which can listen to a TCP port and send and
4344 receive characters via udp. If you have a patched version of
4345 netcat which activates telnet remote echo and single char
4346 transfer, then you can use the following options to set up a
4347 netcat redirector to allow telnet on port 5555 to access the
4348 QEMU port.
4349
4350 ``QEMU Options:``
4351 -serial udp::4555@:4556
4352
4353 ``netcat options:``
4354 -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
4355
4356 ``telnet options:``
4357 localhost 5555
4358
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004359 ``tcp:[host]:port[,server=on|off][,wait=on|off][,nodelay=on|off][,reconnect=seconds]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004360 The TCP Net Console has two modes of operation. It can send the
4361 serial I/O to a location or wait for a connection from a
4362 location. By default the TCP Net Console is sent to host at the
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004363 port. If you use the ``server=on`` option QEMU will wait for a client
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004364 socket application to connect to the port before continuing,
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004365 unless the ``wait=on|off`` option was specified. The ``nodelay=on|off``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004366 option disables the Nagle buffering algorithm. The ``reconnect=on``
4367 option only applies if ``server=no`` is set, if the connection goes
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004368 down it will attempt to reconnect at the given interval. If host
4369 is omitted, 0.0.0.0 is assumed. Only one TCP connection at a
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004370 time is accepted. You can use ``telnet=on`` to connect to the
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004371 corresponding character device.
4372
4373 ``Example to send tcp console to 192.168.0.2 port 4444``
4374 -serial tcp:192.168.0.2:4444
4375
4376 ``Example to listen and wait on port 4444 for connection``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004377 -serial tcp::4444,server=on
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004378
4379 ``Example to not wait and listen on ip 192.168.0.100 port 4444``
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004380 -serial tcp:192.168.0.100:4444,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004381
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004382 ``telnet:host:port[,server=on|off][,wait=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004383 The telnet protocol is used instead of raw tcp sockets. The
4384 options work the same as if you had specified ``-serial tcp``.
4385 The difference is that the port acts like a telnet server or
4386 client using telnet option negotiation. This will also allow you
4387 to send the MAGIC\_SYSRQ sequence if you use a telnet that
4388 supports sending the break sequence. Typically in unix telnet
4389 you do it with Control-] and then type "send break" followed by
4390 pressing the enter key.
4391
Paolo Bonzinia9b13152021-02-25 11:47:52 +01004392 ``websocket:host:port,server=on[,wait=on|off][,nodelay=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004393 The WebSocket protocol is used instead of raw tcp socket. The
4394 port acts as a WebSocket server. Client mode is not supported.
4395
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004396 ``unix:path[,server=on|off][,wait=on|off][,reconnect=seconds]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004397 A unix domain socket is used instead of a tcp socket. The option
4398 works the same as if you had specified ``-serial tcp`` except
4399 the unix domain socket path is used for connections.
4400
4401 ``mon:dev_string``
4402 This is a special option to allow the monitor to be multiplexed
4403 onto another serial port. The monitor is accessed with key
4404 sequence of Control-a and then pressing c. dev\_string should be
4405 any one of the serial devices specified above. An example to
4406 multiplex the monitor onto a telnet server listening on port
4407 4444 would be:
4408
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00004409 ``-serial mon:telnet::4444,server=on,wait=off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004410
4411 When the monitor is multiplexed to stdio in this way, Ctrl+C
4412 will not terminate QEMU any more but will be passed to the guest
4413 instead.
4414
4415 ``braille``
4416 Braille device. This will use BrlAPI to display the braille
4417 output on a real or fake device.
4418
4419 ``msmouse``
4420 Three button serial mouse. Configure the guest to use Microsoft
4421 protocol.
4422ERST
blueswir15824d652009-03-28 06:44:27 +00004423
4424DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
Blue Swirlad960902010-03-29 19:23:52 +00004425 "-parallel dev redirect the parallel port to char device 'dev'\n",
4426 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004427SRST
4428``-parallel dev``
4429 Redirect the virtual parallel port to host device dev (same devices
4430 as the serial port). On Linux hosts, ``/dev/parportN`` can be used
4431 to use hardware devices connected on the corresponding host parallel
4432 port.
4433
4434 This option can be used several times to simulate up to 3 parallel
4435 ports.
4436
4437 Use ``-parallel none`` to disable all parallel ports.
4438ERST
blueswir15824d652009-03-28 06:44:27 +00004439
4440DEF("monitor", HAS_ARG, QEMU_OPTION_monitor, \
Blue Swirlad960902010-03-29 19:23:52 +00004441 "-monitor dev redirect the monitor to char device 'dev'\n",
4442 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004443SRST
4444``-monitor dev``
4445 Redirect the monitor to host device dev (same devices as the serial
4446 port). The default device is ``vc`` in graphical mode and ``stdio``
4447 in non graphical mode. Use ``-monitor none`` to disable the default
4448 monitor.
4449ERST
Gerd Hoffmann6ca55822009-12-08 13:11:52 +01004450DEF("qmp", HAS_ARG, QEMU_OPTION_qmp, \
Blue Swirlad960902010-03-29 19:23:52 +00004451 "-qmp dev like -monitor but opens in 'control' mode\n",
4452 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004453SRST
4454``-qmp dev``
Peter Maydell0ec44682023-05-15 17:22:45 +01004455 Like ``-monitor`` but opens in 'control' mode. For example, to make
4456 QMP available on localhost port 4444::
4457
4458 -qmp tcp:localhost:4444,server=on,wait=off
4459
4460 Not all options are configurable via this syntax; for maximum
4461 flexibility use the ``-mon`` option and an accompanying ``-chardev``.
4462
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004463ERST
Max Reitz4821cd42014-11-17 13:31:04 +01004464DEF("qmp-pretty", HAS_ARG, QEMU_OPTION_qmp_pretty, \
4465 "-qmp-pretty dev like -qmp but uses pretty JSON formatting\n",
4466 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004467SRST
4468``-qmp-pretty dev``
Peter Maydell0ec44682023-05-15 17:22:45 +01004469 Like ``-qmp`` but uses pretty JSON formatting.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004470ERST
blueswir15824d652009-03-28 06:44:27 +00004471
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01004472DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
Vicente Jimenez Aguilaref670722017-11-14 09:11:27 +01004473 "-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004474SRST
4475``-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]``
Peter Maydell0ec44682023-05-15 17:22:45 +01004476 Set up a monitor connected to the chardev ``name``.
4477 QEMU supports two monitors: the Human Monitor Protocol
4478 (HMP; for human interaction), and the QEMU Monitor Protocol
4479 (QMP; a JSON RPC-style protocol).
4480 The default is HMP; ``mode=control`` selects QMP instead.
4481 ``pretty`` is only valid when ``mode=control``,
Ali Shirvani16b3f3b2021-05-19 11:41:45 +04304482 turning on JSON pretty printing to ease
Daniel P. Berrangé283d8452021-02-19 17:56:13 +00004483 human reading and debugging.
Peter Maydell0ec44682023-05-15 17:22:45 +01004484
4485 For example::
4486
4487 -chardev socket,id=mon1,host=localhost,port=4444,server=on,wait=off \
4488 -mon chardev=mon1,mode=control,pretty=on
4489
4490 enables the QMP monitor on localhost port 4444 with pretty-printing.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004491ERST
Gerd Hoffmann22a0e042009-12-08 13:11:51 +01004492
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08004493DEF("debugcon", HAS_ARG, QEMU_OPTION_debugcon, \
Blue Swirlad960902010-03-29 19:23:52 +00004494 "-debugcon dev redirect the debug console to char device 'dev'\n",
4495 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004496SRST
4497``-debugcon dev``
4498 Redirect the debug console to host device dev (same devices as the
4499 serial port). The debug console is an I/O port which is typically
4500 port 0xe9; writing to that I/O port sends output to this device. The
4501 default device is ``vc`` in graphical mode and ``stdio`` in non
4502 graphical mode.
4503ERST
H. Peter Anvinc9f398e2009-12-29 13:51:36 -08004504
blueswir15824d652009-03-28 06:44:27 +00004505DEF("pidfile", HAS_ARG, QEMU_OPTION_pidfile, \
Blue Swirlad960902010-03-29 19:23:52 +00004506 "-pidfile file write PID to 'file'\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004507SRST
4508``-pidfile file``
4509 Store the QEMU process PID in file. It is useful if you launch QEMU
4510 from a script.
4511ERST
blueswir15824d652009-03-28 06:44:27 +00004512
Igor Mammedov047f7032018-05-11 19:24:43 +02004513DEF("preconfig", 0, QEMU_OPTION_preconfig, \
Markus Armbruster361ac942018-07-05 11:14:02 +02004514 "--preconfig pause QEMU before machine is initialized (experimental)\n",
Igor Mammedov047f7032018-05-11 19:24:43 +02004515 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004516SRST
4517``--preconfig``
4518 Pause QEMU for interactive configuration before the machine is
4519 created, which allows querying and configuring properties that will
4520 affect machine initialization. Use QMP command 'x-exit-preconfig' to
4521 exit the preconfig state and move to the next state (i.e. run guest
4522 if -S isn't used or pause the second time if -S is used). This
4523 option is experimental.
4524ERST
Igor Mammedov047f7032018-05-11 19:24:43 +02004525
blueswir15824d652009-03-28 06:44:27 +00004526DEF("S", 0, QEMU_OPTION_S, \
Blue Swirlad960902010-03-29 19:23:52 +00004527 "-S freeze CPU at startup (use 'c' to start execution)\n",
4528 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004529SRST
4530``-S``
4531 Do not start CPU at startup (you must type 'c' in the monitor).
4532ERST
blueswir15824d652009-03-28 06:44:27 +00004533
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004534DEF("overcommit", HAS_ARG, QEMU_OPTION_overcommit,
BALATON Zoltandfaa7d52018-07-16 21:12:08 +02004535 "-overcommit [mem-lock=on|off][cpu-pm=on|off]\n"
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004536 " run qemu with overcommit hints\n"
4537 " mem-lock=on|off controls memory lock support (default: off)\n"
4538 " cpu-pm=on|off controls cpu power management (default: off)\n",
4539 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004540SRST
4541``-overcommit mem-lock=on|off``
Peter Maydell09ce5f22020-02-28 15:36:13 +00004542 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004543``-overcommit cpu-pm=on|off``
4544 Run qemu with hints about host resource overcommit. The default is
4545 to assume that host overcommits all resources.
4546
4547 Locking qemu and guest memory can be enabled via ``mem-lock=on``
4548 (disabled by default). This works when host memory is not
Thomas Huthc8c9dc42020-12-10 16:58:07 +01004549 overcommitted and reduces the worst-case latency for guest.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004550
4551 Guest ability to manage power state of host cpus (increasing latency
4552 for other processes on the same host cpu, but decreasing latency for
4553 guest) can be enabled via ``cpu-pm=on`` (disabled by default). This
4554 works best when host CPU is not overcommitted. When used, host
4555 estimates of CPU cycle and power utilization will be incorrect, not
4556 taking into account guest idle time.
4557ERST
Michael S. Tsirkin6f131f12018-06-22 22:22:05 +03004558
aliguori59030a82009-04-05 18:43:41 +00004559DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
Peter Maydelle5910d42020-04-03 10:40:14 +01004560 "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n"
4561 " the guest without waiting for gdb to connect; use -S too\n"
4562 " if you want it to not start execution.)\n",
4563 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004564SRST
4565``-gdb dev``
Thomas Huth923e9312020-11-16 15:47:36 +01004566 Accept a gdb connection on device dev (see the :ref:`GDB usage` chapter
4567 in the System Emulation Users Guide). Note that this option does not pause QEMU
Peter Maydelle5910d42020-04-03 10:40:14 +01004568 execution -- if you want QEMU to not start the guest until you
4569 connect with gdb and issue a ``continue`` command, you will need to
4570 also pass the ``-S`` option to QEMU.
4571
4572 The most usual configuration is to listen on a local TCP socket::
4573
4574 -gdb tcp::3117
4575
4576 but you can specify other backends; UDP, pseudo TTY, or even stdio
4577 are all reasonable use cases. For example, a stdio connection
4578 allows you to start QEMU from within gdb and establish the
4579 connection via a pipe:
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004580
Peter Maydell09ce5f22020-02-28 15:36:13 +00004581 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004582
4583 (gdb) target remote | exec |qemu_system| -gdb stdio ...
4584ERST
blueswir15824d652009-03-28 06:44:27 +00004585
aliguori59030a82009-04-05 18:43:41 +00004586DEF("s", 0, QEMU_OPTION_s, \
Blue Swirlad960902010-03-29 19:23:52 +00004587 "-s shorthand for -gdb tcp::" DEFAULT_GDBSTUB_PORT "\n",
4588 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004589SRST
4590``-s``
4591 Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234
Thomas Huth923e9312020-11-16 15:47:36 +01004592 (see the :ref:`GDB usage` chapter in the System Emulation Users Guide).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004593ERST
blueswir15824d652009-03-28 06:44:27 +00004594
4595DEF("d", HAS_ARG, QEMU_OPTION_d, \
Peter Maydell989b6972013-02-26 17:52:40 +00004596 "-d item1,... enable logging of specified items (use '-d help' for a list of log items)\n",
Blue Swirlad960902010-03-29 19:23:52 +00004597 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004598SRST
4599``-d item1[,...]``
4600 Enable logging of specified items. Use '-d help' for a list of log
4601 items.
4602ERST
blueswir15824d652009-03-28 06:44:27 +00004603
Matthew Fernandezc235d732011-06-07 16:32:40 +00004604DEF("D", HAS_ARG, QEMU_OPTION_D, \
Peter Maydell989b6972013-02-26 17:52:40 +00004605 "-D logfile output log to logfile (default stderr)\n",
Matthew Fernandezc235d732011-06-07 16:32:40 +00004606 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004607SRST
4608``-D logfile``
4609 Output log in logfile instead of to stderr
4610ERST
Matthew Fernandezc235d732011-06-07 16:32:40 +00004611
Alex Bennée35145522016-03-15 14:30:20 +00004612DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \
4613 "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n",
4614 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004615SRST
4616``-dfilter range1[,...]``
4617 Filter debug output to that relevant to a range of target addresses.
4618 The filter spec can be either start+size, start-size or start..end
4619 where start end and size are the addresses and sizes required. For
4620 example:
4621
4622 ::
4623
4624 -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
4625
4626 Will dump output for any code in the 0x1000 sized block starting at
4627 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and
4628 another 0x1000 sized block starting at 0xffffffc00005f000.
4629ERST
Alex Bennée35145522016-03-15 14:30:20 +00004630
Richard Henderson9c09a252019-03-14 13:06:29 -07004631DEF("seed", HAS_ARG, QEMU_OPTION_seed, \
4632 "-seed number seed the pseudo-random number generator\n",
4633 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004634SRST
4635``-seed number``
4636 Force the guest to use a deterministic pseudo-random number
4637 generator, seeded with number. This does not affect crypto routines
4638 within the host.
4639ERST
Richard Henderson9c09a252019-03-14 13:06:29 -07004640
blueswir15824d652009-03-28 06:44:27 +00004641DEF("L", HAS_ARG, QEMU_OPTION_L, \
Blue Swirlad960902010-03-29 19:23:52 +00004642 "-L path set the directory for the BIOS, VGA BIOS and keymaps\n",
4643 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004644SRST
4645``-L path``
4646 Set the directory for the BIOS, VGA BIOS and keymaps.
4647
4648 To list all the data directories, use ``-L help``.
4649ERST
blueswir15824d652009-03-28 06:44:27 +00004650
blueswir15824d652009-03-28 06:44:27 +00004651DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \
Thomas Huth21abf012022-04-27 15:49:06 +02004652 "-enable-kvm enable KVM full virtualization support\n",
4653 QEMU_ARCH_ARM | QEMU_ARCH_I386 | QEMU_ARCH_MIPS | QEMU_ARCH_PPC |
4654 QEMU_ARCH_RISCV | QEMU_ARCH_S390X)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004655SRST
4656``-enable-kvm``
4657 Enable KVM full virtualization support. This option is only
4658 available if KVM support is enabled when compiling.
4659ERST
blueswir15824d652009-03-28 06:44:27 +00004660
aliguorie37630c2009-04-22 15:19:10 +00004661DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
Thomas Hutheeb36472022-04-27 15:31:56 +02004662 "-xen-domid id specify xen guest domain id\n",
4663 QEMU_ARCH_ARM | QEMU_ARCH_I386)
aliguorie37630c2009-04-22 15:19:10 +00004664DEF("xen-attach", 0, QEMU_OPTION_xen_attach,
4665 "-xen-attach attach to existing xen domain\n"
Anthony PERARD1077bca2018-09-14 12:18:30 +01004666 " libxl will use this when starting QEMU\n",
Thomas Hutheeb36472022-04-27 15:31:56 +02004667 QEMU_ARCH_ARM | QEMU_ARCH_I386)
Paul Durrant1c599472017-03-22 09:39:15 +00004668DEF("xen-domid-restrict", 0, QEMU_OPTION_xen_domid_restrict,
4669 "-xen-domid-restrict restrict set of available xen operations\n"
4670 " to specified domain id. (Does not affect\n"
4671 " xenpv machine type).\n",
Thomas Hutheeb36472022-04-27 15:31:56 +02004672 QEMU_ARCH_ARM | QEMU_ARCH_I386)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004673SRST
4674``-xen-domid id``
4675 Specify xen guest domain id (XEN only).
4676
4677``-xen-attach``
4678 Attach to existing xen domain. libxl will use this when starting
4679 QEMU (XEN only). Restrict set of available xen operations to
4680 specified domain id (XEN only).
4681ERST
aliguorie37630c2009-04-22 15:19:10 +00004682
blueswir15824d652009-03-28 06:44:27 +00004683DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
Blue Swirlad960902010-03-29 19:23:52 +00004684 "-no-reboot exit instead of rebooting\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004685SRST
4686``-no-reboot``
4687 Exit instead of rebooting.
4688ERST
blueswir15824d652009-03-28 06:44:27 +00004689
4690DEF("no-shutdown", 0, QEMU_OPTION_no_shutdown, \
Blue Swirlad960902010-03-29 19:23:52 +00004691 "-no-shutdown stop before shutdown\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004692SRST
4693``-no-shutdown``
4694 Don't exit QEMU on guest shutdown, but instead only stop the
4695 emulation. This allows for instance switching to monitor to commit
4696 changes to the disk image.
4697ERST
blueswir15824d652009-03-28 06:44:27 +00004698
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004699DEF("action", HAS_ARG, QEMU_OPTION_action,
Paolo Bonzinic27025e2021-01-20 14:30:27 +01004700 "-action reboot=reset|shutdown\n"
4701 " action when guest reboots [default=reset]\n"
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004702 "-action shutdown=poweroff|pause\n"
4703 " action when guest shuts down [default=poweroff]\n"
Ilya Leoshkevich0882caf2022-07-26 00:37:45 +02004704 "-action panic=pause|shutdown|exit-failure|none\n"
Paolo Bonzinic27025e2021-01-20 14:30:27 +01004705 " action when guest panics [default=shutdown]\n"
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004706 "-action watchdog=reset|shutdown|poweroff|inject-nmi|pause|debug|none\n"
4707 " action when watchdog fires [default=reset]\n",
4708 QEMU_ARCH_ALL)
4709SRST
4710``-action event=action``
4711 The action parameter serves to modify QEMU's default behavior when
4712 certain guest events occur. It provides a generic method for specifying the
4713 same behaviors that are modified by the ``-no-reboot`` and ``-no-shutdown``
4714 parameters.
4715
4716 Examples:
4717
Alejandro Jimenezc753e8e2020-12-11 17:31:52 -05004718 ``-action panic=none``
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004719 ``-action reboot=shutdown,shutdown=pause``
Paolo Bonzini5433af72022-09-10 13:44:47 +02004720 ``-device i6300esb -action watchdog=pause``
Alejandro Jimenez2a5ad602020-12-11 11:52:41 -05004721
4722ERST
4723
blueswir15824d652009-03-28 06:44:27 +00004724DEF("loadvm", HAS_ARG, QEMU_OPTION_loadvm, \
4725 "-loadvm [tag|id]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004726 " start right away with a saved state (loadvm in monitor)\n",
4727 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004728SRST
4729``-loadvm file``
4730 Start right away with a saved state (``loadvm`` in monitor)
4731ERST
blueswir15824d652009-03-28 06:44:27 +00004732
4733#ifndef _WIN32
4734DEF("daemonize", 0, QEMU_OPTION_daemonize, \
Blue Swirlad960902010-03-29 19:23:52 +00004735 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004736#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004737SRST
4738``-daemonize``
4739 Daemonize the QEMU process after initialization. QEMU will not
4740 detach from standard IO until it is ready to receive connections on
4741 any of its devices. This option is a useful way for external
4742 programs to launch QEMU without having to cope with initialization
4743 race conditions.
4744ERST
blueswir15824d652009-03-28 06:44:27 +00004745
4746DEF("option-rom", HAS_ARG, QEMU_OPTION_option_rom, \
Blue Swirlad960902010-03-29 19:23:52 +00004747 "-option-rom rom load a file, rom, into the option ROM space\n",
4748 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004749SRST
4750``-option-rom file``
4751 Load the contents of file as an option ROM. This option is useful to
4752 load things like EtherBoot.
4753ERST
blueswir15824d652009-03-28 06:44:27 +00004754
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02004755DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
Artem Pisarenko238d1242018-10-18 13:12:52 +06004756 "-rtc [base=utc|localtime|<datetime>][,clock=host|rt|vm][,driftfix=none|slew]\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004757 " set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
4758 QEMU_ARCH_ALL)
Jan Kiszka1ed2fc12009-09-15 13:36:04 +02004759
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004760SRST
4761``-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew]``
4762 Specify ``base`` as ``utc`` or ``localtime`` to let the RTC start at
4763 the current UTC or local time, respectively. ``localtime`` is
4764 required for correct date in MS-DOS or Windows. To start at a
4765 specific point in time, provide datetime in the format
4766 ``2006-06-17T16:01:21`` or ``2006-06-17``. The default base is UTC.
4767
4768 By default the RTC is driven by the host system time. This allows
4769 using of the RTC as accurate reference clock inside the guest,
4770 specifically if the host time is smoothly following an accurate
4771 external reference clock, e.g. via NTP. If you want to isolate the
4772 guest time from the host, you can set ``clock`` to ``rt`` instead,
4773 which provides a host monotonic clock if host support it. To even
4774 prevent the RTC from progressing during suspension, you can set
4775 ``clock`` to ``vm`` (virtual clock). '\ ``clock=vm``\ ' is
4776 recommended especially in icount mode in order to preserve
4777 determinism; however, note that in icount mode the speed of the
4778 virtual clock is variable and can in general differ from the host
4779 clock.
4780
4781 Enable ``driftfix`` (i386 targets only) if you experience time drift
4782 problems, specifically with Windows' ACPI HAL. This option will try
4783 to figure out how many timer interrupts were not processed by the
4784 Windows guest and will re-inject them.
4785ERST
blueswir15824d652009-03-28 06:44:27 +00004786
4787DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
Peter Maydellfa647902020-11-21 21:35:06 +00004788 "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=<filename>[,rrsnapshot=<snapshot>]]\n" \
aliguoribc14ca22009-04-05 18:43:37 +00004789 " enable virtual instruction counter with 2^N clock ticks per\n" \
Victor CLEMENTf1f4b572015-05-29 17:14:05 +02004790 " instruction, enable aligning the host and virtual clocks\n" \
Peter Maydellfa647902020-11-21 21:35:06 +00004791 " or disable real time cpu sleeping, and optionally enable\n" \
4792 " record-and-replay mode\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004793SRST
Peter Maydellfa647902020-11-21 21:35:06 +00004794``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004795 Enable virtual instruction counter. The virtual cpu will execute one
4796 instruction every 2^N ns of virtual time. If ``auto`` is specified
4797 then the virtual cpu speed will be automatically adjusted to keep
4798 virtual time within a few seconds of real time.
4799
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004800 Note that while this option can give deterministic behavior, it does
4801 not provide cycle accurate emulation. Modern CPUs contain
4802 superscalar out of order cores with complex cache hierarchies. The
4803 number of instructions executed often has little or no correlation
4804 with actual performance.
4805
Peter Maydellfa647902020-11-21 21:35:06 +00004806 When the virtual cpu is sleeping, the virtual time will advance at
4807 default speed unless ``sleep=on`` is specified. With
4808 ``sleep=on``, the virtual time will jump to the next timer
4809 deadline instantly whenever the virtual cpu goes to sleep mode and
4810 will not advance if no timer is enabled. This behavior gives
4811 deterministic execution times from the guest point of view.
4812 The default if icount is enabled is ``sleep=off``.
4813 ``sleep=on`` cannot be used together with either ``shift=auto``
4814 or ``align=on``.
4815
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004816 ``align=on`` will activate the delay algorithm which will try to
4817 synchronise the host clock and the virtual clock. The goal is to
4818 have a guest running at the real frequency imposed by the shift
4819 option. Whenever the guest clock is behind the host clock and if
4820 ``align=on`` is specified then we print a message to the user to
4821 inform about the delay. Currently this option does not work when
4822 ``shift`` is ``auto``. Note: The sync algorithm will work for those
4823 shift values for which the guest clock runs ahead of the host clock.
4824 Typically this happens when the shift value is high (how high
Peter Maydellfa647902020-11-21 21:35:06 +00004825 depends on the host machine). The default if icount is enabled
4826 is ``align=off``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004827
Peter Maydellfa647902020-11-21 21:35:06 +00004828 When the ``rr`` option is specified deterministic record/replay is
4829 enabled. The ``rrfile=`` option must also be provided to
4830 specify the path to the replay log. In record mode data is written
4831 to this file, and in replay mode it is read back.
4832 If the ``rrsnapshot`` option is given then it specifies a VM snapshot
4833 name. In record mode, a new VM snapshot with the given name is created
4834 at the start of execution recording. In replay mode this option
4835 specifies the snapshot name used to load the initial VM state.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004836ERST
blueswir15824d652009-03-28 06:44:27 +00004837
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01004838DEF("watchdog-action", HAS_ARG, QEMU_OPTION_watchdog_action, \
Markus Armbruster7ad92702017-10-02 16:03:07 +02004839 "-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none\n" \
Blue Swirlad960902010-03-29 19:23:52 +00004840 " action when watchdog fires [default=reset]\n",
4841 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004842SRST
4843``-watchdog-action action``
4844 The action controls what QEMU will do when the watchdog timer
4845 expires. The default is ``reset`` (forcefully reset the guest).
4846 Other possible actions are: ``shutdown`` (attempt to gracefully
4847 shutdown the guest), ``poweroff`` (forcefully poweroff the guest),
4848 ``inject-nmi`` (inject a NMI into the guest), ``pause`` (pause the
4849 guest), ``debug`` (print a debug message and continue), or ``none``
4850 (do nothing).
4851
4852 Note that the ``shutdown`` action requires that the guest responds
4853 to ACPI signals, which it may not be able to do in the sort of
4854 situations where the watchdog would have expired, and thus
4855 ``-watchdog-action shutdown`` is not recommended for production use.
4856
4857 Examples:
4858
Paolo Bonzini5433af72022-09-10 13:44:47 +02004859 ``-device i6300esb -watchdog-action pause``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004860
4861ERST
Richard W.M. Jones9dd986c2009-04-25 13:56:19 +01004862
blueswir15824d652009-03-28 06:44:27 +00004863DEF("echr", HAS_ARG, QEMU_OPTION_echr, \
Blue Swirlad960902010-03-29 19:23:52 +00004864 "-echr chr set terminal escape character instead of ctrl-a\n",
4865 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004866SRST
4867``-echr numeric_ascii_value``
4868 Change the escape character used for switching to the monitor when
4869 using monitor and serial sharing. The default is ``0x01`` when using
4870 the ``-nographic`` option. ``0x01`` is equal to pressing
4871 ``Control-a``. You can select a different character from the ascii
4872 control keys where 1 through 26 map to Control-a through Control-z.
4873 For instance you could use the either of the following to change the
4874 escape character to Control-t.
4875
4876 ``-echr 0x14``; \ ``-echr 20``
4877
4878ERST
blueswir15824d652009-03-28 06:44:27 +00004879
blueswir15824d652009-03-28 06:44:27 +00004880DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004881 "-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]\n" \
4882 "-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]\n" \
Michael Tokarev7c601802015-02-10 22:40:47 +03004883 "-incoming unix:socketpath\n" \
4884 " prepare for incoming migration, listen on\n" \
4885 " specified protocol and socket address\n" \
4886 "-incoming fd:fd\n" \
Steve Sistare385f5102023-09-08 07:22:11 -07004887 "-incoming file:filename[,offset=offset]\n" \
Michael Tokarev7c601802015-02-10 22:40:47 +03004888 "-incoming exec:cmdline\n" \
4889 " accept incoming migration on given file descriptor\n" \
Dr. David Alan Gilbert15970512015-05-29 19:52:52 +01004890 " or from given external command\n" \
4891 "-incoming defer\n" \
4892 " wait for the URI to be specified via migrate_incoming\n",
Blue Swirlad960902010-03-29 19:23:52 +00004893 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004894SRST
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004895``-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00004896 \
Daniel P. Berrangébf240952021-02-16 19:10:22 +00004897``-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004898 Prepare for incoming migration, listen on a given tcp port.
4899
4900``-incoming unix:socketpath``
4901 Prepare for incoming migration, listen on a given unix socket.
4902
4903``-incoming fd:fd``
Steve Sistare2a9e2e52023-09-08 07:22:10 -07004904 Accept incoming migration from a given file descriptor.
4905
Steve Sistare385f5102023-09-08 07:22:11 -07004906``-incoming file:filename[,offset=offset]``
4907 Accept incoming migration from a given file starting at offset.
4908 offset allows the common size suffixes, or a 0x prefix, but not both.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004909
4910``-incoming exec:cmdline``
4911 Accept incoming migration as an output from specified external
4912 command.
4913
4914``-incoming defer``
4915 Wait for the URI to be specified via migrate\_incoming. The monitor
4916 can be used to change settings (such as migration parameters) prior
4917 to issuing the migrate\_incoming to allow the migration to begin.
4918ERST
blueswir15824d652009-03-28 06:44:27 +00004919
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05304920DEF("only-migratable", 0, QEMU_OPTION_only_migratable, \
4921 "-only-migratable allow only migratable devices\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004922SRST
4923``-only-migratable``
4924 Only allow migratable devices. Devices will not be allowed to enter
4925 an unmigratable state.
4926ERST
Ashijeet Acharyad15c05f2017-01-16 17:01:51 +05304927
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01004928DEF("nodefaults", 0, QEMU_OPTION_nodefaults, \
Blue Swirlad960902010-03-29 19:23:52 +00004929 "-nodefaults don't create default devices\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004930SRST
4931``-nodefaults``
4932 Don't create default devices. Normally, QEMU sets the default
4933 devices like serial port, parallel port, virtual console, monitor
4934 device, VGA adapter, floppy and CD-ROM drive and others. The
4935 ``-nodefaults`` option will disable all those default devices.
4936ERST
Gerd Hoffmannd8c208d2009-12-08 13:11:46 +01004937
blueswir15824d652009-03-28 06:44:27 +00004938#ifndef _WIN32
blueswir15824d652009-03-28 06:44:27 +00004939DEF("runas", HAS_ARG, QEMU_OPTION_runas, \
Ian Jackson2c42f1e2017-09-15 18:10:44 +01004940 "-runas user change to user id user just before starting the VM\n" \
4941 " user can be numeric uid:gid instead\n",
Blue Swirlad960902010-03-29 19:23:52 +00004942 QEMU_ARCH_ALL)
blueswir15824d652009-03-28 06:44:27 +00004943#endif
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004944SRST
4945``-runas user``
4946 Immediately before starting guest execution, drop root privileges,
Thomas Huth95e0fb02024-05-06 13:20:58 +02004947 switching to the specified user. This option is deprecated, use
4948 ``-run-with user=...`` instead.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004949ERST
blueswir15824d652009-03-28 06:44:27 +00004950
blueswir15824d652009-03-28 06:44:27 +00004951DEF("prom-env", HAS_ARG, QEMU_OPTION_prom_env,
4952 "-prom-env variable=value\n"
Blue Swirlad960902010-03-29 19:23:52 +00004953 " set OpenBIOS nvram variables\n",
4954 QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004955SRST
4956``-prom-env variable=value``
4957 Set OpenBIOS nvram variable to given value (PPC, SPARC only).
4958
4959 ::
4960
4961 qemu-system-sparc -prom-env 'auto-boot?=false' \
4962 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
4963
4964 ::
4965
4966 qemu-system-ppc -prom-env 'auto-boot?=false' \
4967 -prom-env 'boot-device=hd:2,\yaboot' \
4968 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
4969ERST
blueswir15824d652009-03-28 06:44:27 +00004970DEF("semihosting", 0, QEMU_OPTION_semihosting,
Michael Wallef7bbcfb2014-04-22 20:18:42 +02004971 "-semihosting semihosting mode\n",
Markus Armbruster9d49bcf2021-05-03 10:40:33 +02004972 QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA |
Philippe Mathieu-Daudé6c301482024-03-27 12:10:58 +01004973 QEMU_ARCH_MIPS | QEMU_ARCH_RISCV)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004974SRST
4975``-semihosting``
Philippe Mathieu-Daudé6c301482024-03-27 12:10:58 +01004976 Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, RISC-V only).
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004977
Alex Bennée2da9d212023-01-24 18:01:13 +00004978 .. warning::
4979 Note that this allows guest direct access to the host filesystem, so
4980 should only be used with a trusted guest OS.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004981
4982 See the -semihosting-config option documentation for further
4983 information about the facilities this enables.
4984ERST
Liviu Ionescua38bb072014-12-11 12:07:48 +00004985DEF("semihosting-config", HAS_ARG, QEMU_OPTION_semihosting_config,
Peter Maydell52028612022-08-22 15:12:24 +01004986 "-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]\n" \
Leon Alraea59d31a2015-06-19 14:17:45 +01004987 " semihosting configuration\n",
Markus Armbruster9d49bcf2021-05-03 10:40:33 +02004988QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA |
Philippe Mathieu-Daudé6c301482024-03-27 12:10:58 +01004989QEMU_ARCH_MIPS | QEMU_ARCH_RISCV)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004990SRST
Peter Maydell52028612022-08-22 15:12:24 +01004991``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]``
Philippe Mathieu-Daudé6c301482024-03-27 12:10:58 +01004992 Enable and configure :ref:`Semihosting` (ARM, M68K, Xtensa, MIPS, RISC-V
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004993 only).
4994
Alex Bennée2da9d212023-01-24 18:01:13 +00004995 .. warning::
4996 Note that this allows guest direct access to the host filesystem, so
4997 should only be used with a trusted guest OS.
Keith Packarda10b9d92021-01-08 22:42:52 +00004998
Peter Maydelle2fcbf42020-03-06 10:07:14 +00004999 ``target=native|gdb|auto``
5000 Defines where the semihosting calls will be addressed, to QEMU
5001 (``native``) or to GDB (``gdb``). The default is ``auto``, which
5002 means ``gdb`` during debug sessions and ``native`` otherwise.
5003
5004 ``chardev=str1``
5005 Send the output to a chardev backend output for native or auto
5006 output when not in gdb
5007
Peter Maydell52028612022-08-22 15:12:24 +01005008 ``userspace=on|off``
5009 Allows code running in guest userspace to access the semihosting
5010 interface. The default is that only privileged guest code can
5011 make semihosting calls. Note that setting ``userspace=on`` should
5012 only be used if all guest code is trusted (for example, in
5013 bare-metal test case code).
5014
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005015 ``arg=str1,arg=str2,...``
5016 Allows the user to pass input arguments, and can be used
5017 multiple times to build up a list. The old-style
5018 ``-kernel``/``-append`` method of passing a command line is
5019 still supported for backward compatibility. If both the
5020 ``--semihosting-config arg`` and the ``-kernel``/``-append`` are
5021 specified, the former is passed to semihosting as it always
5022 takes precedence.
5023ERST
blueswir15824d652009-03-28 06:44:27 +00005024DEF("old-param", 0, QEMU_OPTION_old_param,
Blue Swirlad960902010-03-29 19:23:52 +00005025 "-old-param old param mode\n", QEMU_ARCH_ARM)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005026SRST
5027``-old-param``
5028 Old param mode (ARM only).
5029ERST
Stefan Weil95d5f082010-01-20 22:25:27 +01005030
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03005031DEF("sandbox", HAS_ARG, QEMU_OPTION_sandbox, \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01005032 "-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01005033 " [,spawn=allow|deny][,resourcecontrol=allow|deny]\n" \
Eduardo Otubo2b716fa2017-03-01 23:17:29 +01005034 " Enable seccomp mode 2 system call filter (default 'off').\n" \
5035 " use 'obsolete' to allow obsolete system calls that are provided\n" \
5036 " by the kernel, but typically no longer used by modern\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01005037 " C library implementations.\n" \
Philippe Mathieu-Daudéd42304b2021-03-03 19:46:43 +01005038 " use 'elevateprivileges' to allow or deny the QEMU process ability\n" \
5039 " to elevate privileges using set*uid|gid system calls.\n" \
Eduardo Otubo73a1e642017-03-13 22:13:27 +01005040 " The value 'children' will deny set*uid|gid system calls for\n" \
Eduardo Otubo995a2262017-03-13 22:16:01 +01005041 " main QEMU process but will allow forks and execves to run unprivileged\n" \
5042 " use 'spawn' to avoid QEMU to spawn new threads or processes by\n" \
Philippe Mathieu-Daudéd42304b2021-03-03 19:46:43 +01005043 " blocking *fork and execve\n" \
Eduardo Otubo24f8cdc2017-03-13 22:18:51 +01005044 " use 'resourcecontrol' to disable process affinity and schedular priority\n",
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03005045 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005046SRST
5047``-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string]``
5048 Enable Seccomp mode 2 system call filter. 'on' will enable syscall
5049 filtering and 'off' will disable it. The default is 'off'.
5050
5051 ``obsolete=string``
5052 Enable Obsolete system calls
5053
5054 ``elevateprivileges=string``
5055 Disable set\*uid\|gid system calls
5056
5057 ``spawn=string``
5058 Disable \*fork and execve
5059
5060 ``resourcecontrol=string``
5061 Disable process affinity and schedular priority
5062ERST
Eduardo Otubo7d76ad42012-08-14 18:44:08 -03005063
Gerd Hoffmann715a6642009-10-14 10:39:28 +02005064DEF("readconfig", HAS_ARG, QEMU_OPTION_readconfig,
Paolo Bonzinie960a7e2022-04-14 10:57:21 -04005065 "-readconfig <file>\n"
5066 " read config file\n", QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005067SRST
5068``-readconfig file``
5069 Read device configuration from file. This approach is useful when
5070 you want to spawn QEMU process with many command line options but
5071 you don't want to exceed the command line character limit.
5072ERST
Thomas Huth2feac452018-08-21 12:59:56 +02005073
Eduardo Habkostf29a5612012-05-02 13:07:29 -03005074DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
5075 "-no-user-config\n"
Eduardo Habkost3478eae2017-10-04 00:00:25 -03005076 " do not load default user-provided config files at startup\n",
Eduardo Habkostf29a5612012-05-02 13:07:29 -03005077 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005078SRST
5079``-no-user-config``
5080 The ``-no-user-config`` option makes QEMU not load any of the
5081 user-provided config files on sysconfdir.
5082ERST
Thomas Huth2feac452018-08-21 12:59:56 +02005083
Prerna Saxenaab6540d2010-08-09 11:48:32 +01005084DEF("trace", HAS_ARG, QEMU_OPTION_trace,
Paolo Bonzini10578a22016-01-07 16:55:26 +03005085 "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
Lluís23d15e82011-08-31 20:31:31 +02005086 " specify tracing options\n",
Prerna Saxenaab6540d2010-08-09 11:48:32 +01005087 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005088SRST
5089``-trace [[enable=]pattern][,events=file][,file=file]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00005090 .. include:: ../qemu-option-trace.rst.inc
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005091
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005092ERST
Lluís Vilanova42229a72017-07-24 17:28:22 +03005093DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02005094 "-plugin [file=]<file>[,<argname>=<argvalue>]\n"
Lluís Vilanova42229a72017-07-24 17:28:22 +03005095 " load a plugin\n",
5096 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005097SRST
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02005098``-plugin file=file[,argname=argvalue]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005099 Load a plugin.
5100
5101 ``file=file``
5102 Load the given plugin from a shared library file.
5103
Mahmoud Mandour3a445ac2021-07-30 15:58:05 +02005104 ``argname=argvalue``
5105 Argument passed to the plugin. (Can be given multiple times.)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005106ERST
Stefan Weil3dbf2c72010-01-16 18:19:44 +01005107
Markus Armbruster31e70d62013-02-13 19:49:37 +01005108HXCOMM Internal use
5109DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
5110DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL)
Anthony Liguoric7f0f3b2012-03-28 15:42:02 +02005111
Thomas Huth9ffcbe22023-07-03 09:44:47 +02005112#ifdef CONFIG_POSIX
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02005113DEF("run-with", HAS_ARG, QEMU_OPTION_run_with,
Thomas Huth95e0fb02024-05-06 13:20:58 +02005114 "-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]\n"
Thomas Huth9ffcbe22023-07-03 09:44:47 +02005115 " Set miscellaneous QEMU process lifecycle options:\n"
5116 " async-teardown=on enables asynchronous teardown (Linux only)\n"
Thomas Huth95e0fb02024-05-06 13:20:58 +02005117 " chroot=dir chroot to dir just before starting the VM\n"
5118 " user=username switch to the specified user before starting the VM\n"
5119 " user=uid:gid ditto, but use specified user-ID and group-ID instead\n",
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02005120 QEMU_ARCH_ALL)
5121SRST
Thomas Huth95e0fb02024-05-06 13:20:58 +02005122``-run-with [async-teardown=on|off][,chroot=dir][user=username|uid:gid]``
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02005123 Set QEMU process lifecycle options.
5124
5125 ``async-teardown=on`` enables asynchronous teardown. A new process called
5126 "cleanup/<QEMU_PID>" will be created at startup sharing the address
5127 space with the main QEMU process, using clone. It will wait for the
5128 main QEMU process to terminate completely, and then exit. This allows
5129 QEMU to terminate very quickly even if the guest was huge, leaving the
5130 teardown of the address space to the cleanup process. Since the cleanup
5131 process shares the same cgroups as the main QEMU process, accounting is
5132 performed correctly. This only works if the cleanup process is not
5133 forcefully killed with SIGKILL before the main QEMU process has
5134 terminated completely.
Thomas Huth9ffcbe22023-07-03 09:44:47 +02005135
5136 ``chroot=dir`` can be used for doing a chroot to the specified directory
5137 immediately before starting the guest execution. This is especially useful
5138 in combination with -runas.
Thomas Huth95e0fb02024-05-06 13:20:58 +02005139
5140 ``user=username`` or ``user=uid:gid`` can be used to drop root privileges
Boqiao Fude12ebf2024-07-15 17:04:32 +08005141 before starting guest execution. QEMU will use the ``setuid`` and ``setgid``
5142 system calls to switch to the specified identity. Note that the
5143 ``user=username`` syntax will also apply the full set of supplementary
5144 groups for the user, whereas the ``user=uid:gid`` will use only the
5145 ``gid`` group.
Claudio Imbrenda80bd81c2023-05-05 14:00:51 +02005146ERST
5147#endif
Claudio Imbrendac891c242022-08-12 15:34:53 +02005148
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04005149DEF("msg", HAS_ARG, QEMU_OPTION_msg,
Mario Smarduch2880ffb2020-06-26 13:19:00 -07005150 "-msg [timestamp[=on|off]][,guest-name=[on|off]]\n"
Markus Armbrusterdeda4972019-10-10 10:15:08 +02005151 " control error message format\n"
Mario Smarduch2880ffb2020-06-26 13:19:00 -07005152 " timestamp=on enables timestamps (default: off)\n"
5153 " guest-name=on enables guest name prefix but only if\n"
5154 " -name guest option is set (default: off)\n",
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04005155 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005156SRST
Mario Smarduch2880ffb2020-06-26 13:19:00 -07005157``-msg [timestamp[=on|off]][,guest-name[=on|off]]``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005158 Control error message format.
5159
5160 ``timestamp=on|off``
5161 Prefix messages with a timestamp. Default is off.
Mario Smarduch2880ffb2020-06-26 13:19:00 -07005162
5163 ``guest-name=on|off``
5164 Prefix messages with guest name but only if -name guest option is set
5165 otherwise the option is ignored. Default is off.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005166ERST
Seiji Aguchi5e2ac512013-07-03 23:02:46 -04005167
Amit Shahabfd9ce2014-06-20 18:56:08 +05305168DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
5169 "-dump-vmstate <file>\n"
5170 " Output vmstate information in JSON format to file.\n"
5171 " Use the scripts/vmstate-static-checker.py file to\n"
5172 " check for possible regressions in migration code\n"
Laurent Vivier23820532015-09-04 21:30:04 +02005173 " by comparing two such vmstate dumps.\n",
Amit Shahabfd9ce2014-06-20 18:56:08 +05305174 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005175SRST
5176``-dump-vmstate file``
5177 Dump json-encoded vmstate information for current machine type to
5178 file in file
5179ERST
Amit Shahabfd9ce2014-06-20 18:56:08 +05305180
Emilio G. Cota12df1892018-08-15 11:42:49 -04005181DEF("enable-sync-profile", 0, QEMU_OPTION_enable_sync_profile,
5182 "-enable-sync-profile\n"
5183 " enable synchronization profiling\n",
5184 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005185SRST
5186``-enable-sync-profile``
5187 Enable synchronization profiling.
5188ERST
Emilio G. Cota12df1892018-08-15 11:42:49 -04005189
Ilya Leoshkevich5584e2d2023-01-12 16:20:13 +01005190#if defined(CONFIG_TCG) && defined(CONFIG_LINUX)
5191DEF("perfmap", 0, QEMU_OPTION_perfmap,
5192 "-perfmap generate a /tmp/perf-${pid}.map file for perf\n",
5193 QEMU_ARCH_ALL)
5194SRST
5195``-perfmap``
5196 Generate a map file for Linux perf tools that will allow basic profiling
5197 information to be broken down into basic blocks.
5198ERST
5199
5200DEF("jitdump", 0, QEMU_OPTION_jitdump,
5201 "-jitdump generate a jit-${pid}.dump file for perf\n",
5202 QEMU_ARCH_ALL)
5203SRST
5204``-jitdump``
5205 Generate a dump file for Linux perf tools that maps basic blocks to symbol
5206 names, line numbers and JITted code.
5207ERST
5208#endif
5209
Paolo Bonzini43f187a2017-01-04 13:50:37 +01005210DEFHEADING()
Markus Armbrusterde6b4f92017-10-02 16:03:00 +02005211
5212DEFHEADING(Generic object creation:)
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01005213
5214DEF("object", HAS_ARG, QEMU_OPTION_object,
5215 "-object TYPENAME[,PROP1=VALUE1,...]\n"
5216 " create a new object of type TYPENAME setting properties\n"
5217 " in the order they are specified. Note that the 'id'\n"
5218 " property must be set. These objects are placed in the\n"
5219 " '/objects' path.\n",
5220 QEMU_ARCH_ALL)
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005221SRST
5222``-object typename[,prop1=value1,...]``
5223 Create a new object of type typename setting properties in the order
5224 they are specified. Note that the 'id' property must be set. These
5225 objects are placed in the '/objects' path.
5226
David Hildenbrande92666b2023-09-06 14:04:55 +02005227 ``-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align,offset=offset,readonly=on|off,rom=on|off|auto``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005228 Creates a memory file backend object, which can be used to back
5229 the guest RAM with huge pages.
5230
5231 The ``id`` parameter is a unique ID that will be used to
Robert Hoo56c9f002021-04-22 16:42:02 +08005232 reference this memory region in other parameters, e.g. ``-numa``,
5233 ``-device nvdimm``, etc.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005234
5235 The ``size`` option provides the size of the memory region, and
Robert Hoo56c9f002021-04-22 16:42:02 +08005236 accepts common suffixes, e.g. ``500M``.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005237
5238 The ``mem-path`` provides the path to either a shared memory or
5239 huge page filesystem mount.
5240
5241 The ``share`` boolean option determines whether the memory
5242 region is marked as private to QEMU, or shared. The latter
5243 allows a co-operating external process to access the QEMU memory
5244 region.
5245
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005246 Setting share=on might affect the ability to configure NUMA
5247 bindings for the memory backend under some circumstances, see
5248 Documentation/vm/numa\_memory\_policy.txt on the Linux kernel
5249 source tree for additional details.
5250
5251 Setting the ``discard-data`` boolean option to on indicates that
5252 file contents can be destroyed when QEMU exits, to avoid
5253 unnecessarily flushing data to the backing file. Note that
5254 ``discard-data`` is only an optimization, and QEMU might not
5255 discard file contents if it aborts unexpectedly or is terminated
5256 using SIGKILL.
5257
5258 The ``merge`` boolean option enables memory merge, also known as
5259 MADV\_MERGEABLE, so that Kernel Samepage Merging will consider
5260 the pages for memory deduplication.
5261
5262 Setting the ``dump`` boolean option to off excludes the memory
5263 from core dumps. This feature is also known as MADV\_DONTDUMP.
5264
5265 The ``prealloc`` boolean option enables memory preallocation.
5266
5267 The ``host-nodes`` option binds the memory range to a list of
5268 NUMA host nodes.
5269
5270 The ``policy`` option sets the NUMA policy to one of the
5271 following values:
5272
5273 ``default``
5274 default host policy
5275
5276 ``preferred``
5277 prefer the given host node list for allocation
5278
5279 ``bind``
5280 restrict memory allocation to the given host node list
5281
5282 ``interleave``
5283 interleave memory allocations across the given host node
5284 list
5285
5286 The ``align`` option specifies the base address alignment when
5287 QEMU mmap(2) ``mem-path``, and accepts common suffixes, eg
5288 ``2M``. Some backend store specified by ``mem-path`` requires an
5289 alignment different than the default one used by QEMU, eg the
5290 device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
5291 such cases, users can specify the required alignment via this
5292 option.
5293
Alexander Graf4b870dc2023-04-03 22:14:21 +00005294 The ``offset`` option specifies the offset into the target file
5295 that the region starts at. You can use this parameter to back
5296 multiple regions with a single file.
5297
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005298 The ``pmem`` option specifies whether the backing file specified
5299 by ``mem-path`` is in host persistent memory that can be
5300 accessed using the SNIA NVM programming model (e.g. Intel
5301 NVDIMM). If ``pmem`` is set to 'on', QEMU will take necessary
5302 operations to guarantee the persistence of its own writes to
5303 ``mem-path`` (e.g. in vNVDIMM label emulation and live
5304 migration). Also, we will map the backend-file with MAP\_SYNC
5305 flag, which ensures the file metadata is in sync for
5306 ``mem-path`` in case of host crash or a power failure. MAP\_SYNC
5307 requires support from both the host kernel (since Linux kernel
5308 4.15) and the filesystem of ``mem-path`` mounted with DAX
5309 option.
5310
Stefan Hajnoczi86635aa2021-01-04 17:13:19 +00005311 The ``readonly`` option specifies whether the backing file is opened
5312 read-only or read-write (default).
5313
David Hildenbrande92666b2023-09-06 14:04:55 +02005314 The ``rom`` option specifies whether to create Read Only Memory
5315 (ROM) that cannot be modified by the VM. Any write attempts to such
5316 ROM will be denied. Most use cases want proper RAM instead of ROM.
5317 However, selected use cases, like R/O NVDIMMs, can benefit from
5318 ROM. If set to ``on``, create ROM; if set to ``off``, create
5319 writable RAM; if set to ``auto`` (default), the value of the
5320 ``readonly`` option is used. This option is primarily helpful when
5321 we want to have writable RAM in configurations that would
5322 traditionally create ROM before the ``rom`` option was introduced:
5323 VM templating, where we want to open a file readonly
5324 (``readonly=on``) and mark the memory to be private for QEMU
5325 (``share=off``). For this use case, we need writable RAM instead
5326 of ROM, and want to also set ``rom=off``.
5327
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005328 ``-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``
5329 Creates a memory backend object, which can be used to back the
5330 guest RAM. Memory backend objects offer more control than the
5331 ``-m`` option that is traditionally used to define guest RAM.
5332 Please refer to ``memory-backend-file`` for a description of the
5333 options.
5334
5335 ``-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``
5336 Creates an anonymous memory file backend object, which allows
5337 QEMU to share the memory with an external process (e.g. when
5338 using vhost-user). The memory is allocated with memfd and
5339 optional sealing. (Linux only)
5340
5341 The ``seal`` option creates a sealed-file, that will block
5342 further resizing the memory ('on' by default).
5343
5344 The ``hugetlb`` option specify the file to be created resides in
5345 the hugetlbfs filesystem (since Linux 4.14). Used in conjunction
5346 with the ``hugetlb`` option, the ``hugetlbsize`` option specify
5347 the hugetlb page size on systems that support multiple hugetlb
5348 page sizes (it must be a power of 2 value supported by the
5349 system).
5350
5351 In some versions of Linux, the ``hugetlb`` option is
5352 incompatible with the ``seal`` option (requires at least Linux
5353 4.16).
5354
5355 Please refer to ``memory-backend-file`` for a description of the
5356 other options.
5357
5358 The ``share`` boolean option is on by default with memfd.
5359
Stefano Garzarella4e647fa2024-06-18 12:05:19 +02005360 ``-object memory-backend-shm,id=id,merge=on|off,dump=on|off,share=on|off,prealloc=on|off,size=size,host-nodes=host-nodes,policy=default|preferred|bind|interleave``
5361 Creates a POSIX shared memory backend object, which allows
5362 QEMU to share the memory with an external process (e.g. when
5363 using vhost-user).
5364
5365 ``memory-backend-shm`` is a more portable and less featureful version
5366 of ``memory-backend-memfd``. It can then be used in any POSIX system,
5367 especially when memfd is not supported.
5368
5369 Please refer to ``memory-backend-file`` for a description of the
5370 options.
5371
5372 The ``share`` boolean option is on by default with shm. Setting it to
5373 off will cause a failure during allocation because it is not supported
5374 by this backend.
5375
Eric Auger6e6d8ac2023-11-21 16:44:00 +08005376 ``-object iommufd,id=id[,fd=fd]``
5377 Creates an iommufd backend which allows control of DMA mapping
5378 through the ``/dev/iommu`` device.
5379
5380 The ``id`` parameter is a unique ID which frontends (such as
5381 vfio-pci of vdpa) will use to connect with the iommufd backend.
5382
5383 The ``fd`` parameter is an optional pre-opened file descriptor
5384 resulting from ``/dev/iommu`` opening. Usually the iommufd is shared
5385 across all subsystems, bringing the benefit of centralized
5386 reference counting.
5387
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005388 ``-object rng-builtin,id=id``
5389 Creates a random number generator backend which obtains entropy
5390 from QEMU builtin functions. The ``id`` parameter is a unique ID
5391 that will be used to reference this entropy backend from the
5392 ``virtio-rng`` device. By default, the ``virtio-rng`` device
5393 uses this RNG backend.
5394
5395 ``-object rng-random,id=id,filename=/dev/random``
5396 Creates a random number generator backend which obtains entropy
5397 from a device on the host. The ``id`` parameter is a unique ID
5398 that will be used to reference this entropy backend from the
5399 ``virtio-rng`` device. The ``filename`` parameter specifies
5400 which file to obtain entropy from and if omitted defaults to
5401 ``/dev/urandom``.
5402
5403 ``-object rng-egd,id=id,chardev=chardevid``
5404 Creates a random number generator backend which obtains entropy
5405 from an external daemon running on the host. The ``id``
5406 parameter is a unique ID that will be used to reference this
5407 entropy backend from the ``virtio-rng`` device. The ``chardev``
5408 parameter is the unique ID of a character device backend that
5409 provides the connection to the RNG daemon.
5410
5411 ``-object tls-creds-anon,id=id,endpoint=endpoint,dir=/path/to/cred/dir,verify-peer=on|off``
5412 Creates a TLS anonymous credentials object, which can be used to
5413 provide TLS support on network backends. The ``id`` parameter is
5414 a unique ID which network backends will use to access the
5415 credentials. The ``endpoint`` is either ``server`` or ``client``
5416 depending on whether the QEMU network backend that uses the
5417 credentials will be acting as a client or as a server. If
5418 ``verify-peer`` is enabled (the default) then once the handshake
5419 is completed, the peer credentials will be verified, though this
5420 is a no-op for anonymous credentials.
5421
5422 The dir parameter tells QEMU where to find the credential files.
5423 For server endpoints, this directory may contain a file
5424 dh-params.pem providing diffie-hellman parameters to use for the
5425 TLS server. If the file is missing, QEMU will generate a set of
5426 DH parameters at startup. This is a computationally expensive
5427 operation that consumes random pool entropy, so it is
5428 recommended that a persistent set of parameters be generated
5429 upfront and saved.
5430
5431 ``-object tls-creds-psk,id=id,endpoint=endpoint,dir=/path/to/keys/dir[,username=username]``
5432 Creates a TLS Pre-Shared Keys (PSK) credentials object, which
5433 can be used to provide TLS support on network backends. The
5434 ``id`` parameter is a unique ID which network backends will use
5435 to access the credentials. The ``endpoint`` is either ``server``
5436 or ``client`` depending on whether the QEMU network backend that
5437 uses the credentials will be acting as a client or as a server.
5438 For clients only, ``username`` is the username which will be
5439 sent to the server. If omitted it defaults to "qemu".
5440
5441 The dir parameter tells QEMU where to find the keys file. It is
5442 called "dir/keys.psk" and contains "username:key" pairs. This
5443 file can most easily be created using the GnuTLS ``psktool``
5444 program.
5445
5446 For server endpoints, dir may also contain a file dh-params.pem
5447 providing diffie-hellman parameters to use for the TLS server.
5448 If the file is missing, QEMU will generate a set of DH
5449 parameters at startup. This is a computationally expensive
5450 operation that consumes random pool entropy, so it is
5451 recommended that a persistent set of parameters be generated up
5452 front and saved.
5453
5454 ``-object tls-creds-x509,id=id,endpoint=endpoint,dir=/path/to/cred/dir,priority=priority,verify-peer=on|off,passwordid=id``
5455 Creates a TLS anonymous credentials object, which can be used to
5456 provide TLS support on network backends. The ``id`` parameter is
5457 a unique ID which network backends will use to access the
5458 credentials. The ``endpoint`` is either ``server`` or ``client``
5459 depending on whether the QEMU network backend that uses the
5460 credentials will be acting as a client or as a server. If
5461 ``verify-peer`` is enabled (the default) then once the handshake
5462 is completed, the peer credentials will be verified. With x509
5463 certificates, this implies that the clients must be provided
5464 with valid client certificates too.
5465
5466 The dir parameter tells QEMU where to find the credential files.
5467 For server endpoints, this directory may contain a file
5468 dh-params.pem providing diffie-hellman parameters to use for the
5469 TLS server. If the file is missing, QEMU will generate a set of
5470 DH parameters at startup. This is a computationally expensive
5471 operation that consumes random pool entropy, so it is
5472 recommended that a persistent set of parameters be generated
5473 upfront and saved.
5474
5475 For x509 certificate credentials the directory will contain
5476 further files providing the x509 certificates. The certificates
5477 must be stored in PEM format, in filenames ca-cert.pem,
5478 ca-crl.pem (optional), server-cert.pem (only servers),
5479 server-key.pem (only servers), client-cert.pem (only clients),
5480 and client-key.pem (only clients).
5481
5482 For the server-key.pem and client-key.pem files which contain
5483 sensitive private keys, it is possible to use an encrypted
5484 version by providing the passwordid parameter. This provides the
5485 ID of a previously created ``secret`` object containing the
5486 password for decryption.
5487
5488 The priority parameter allows to override the global default
5489 priority used by gnutls. This can be useful if the system
5490 administrator needs to use a weaker set of crypto priorities for
5491 QEMU without potentially forcing the weakness onto all
5492 applications. Or conversely if one wants wants a stronger
5493 default for QEMU than for all other applications, they can do
5494 this through this parameter. Its format is a gnutls priority
5495 string as described at
5496 https://gnutls.org/manual/html_node/Priority-Strings.html.
5497
Philippe Mathieu-Daudé993aec22018-10-11 20:21:11 +02005498 ``-object tls-cipher-suites,id=id,priority=priority``
5499 Creates a TLS cipher suites object, which can be used to control
5500 the TLS cipher/protocol algorithms that applications are permitted
5501 to use.
5502
5503 The ``id`` parameter is a unique ID which frontends will use to
5504 access the ordered list of permitted TLS cipher suites from the
5505 host.
5506
5507 The ``priority`` parameter allows to override the global default
5508 priority used by gnutls. This can be useful if the system
5509 administrator needs to use a weaker set of crypto priorities for
5510 QEMU without potentially forcing the weakness onto all
5511 applications. Or conversely if one wants wants a stronger
5512 default for QEMU than for all other applications, they can do
5513 this through this parameter. Its format is a gnutls priority
5514 string as described at
5515 https://gnutls.org/manual/html_node/Priority-Strings.html.
5516
Philippe Mathieu-Daudé69699f32020-05-14 15:15:47 +02005517 An example of use of this object is to control UEFI HTTPS Boot.
5518 The tls-cipher-suites object exposes the ordered list of permitted
5519 TLS cipher suites from the host side to the guest firmware, via
5520 fw_cfg. The list is represented as an array of IANA_TLS_CIPHER
5521 objects. The firmware uses the IANA_TLS_CIPHER array for configuring
5522 guest-side TLS.
5523
5524 In the following example, the priority at which the host-side policy
5525 is retrieved is given by the ``priority`` property.
5526 Given that QEMU uses GNUTLS, ``priority=@SYSTEM`` may be used to
5527 refer to /etc/crypto-policies/back-ends/gnutls.config.
5528
5529 .. parsed-literal::
5530
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005531 # |qemu_system| \\
5532 -object tls-cipher-suites,id=mysuite0,priority=@SYSTEM \\
Philippe Mathieu-Daudé69699f32020-05-14 15:15:47 +02005533 -fw_cfg name=etc/edk2/https/ciphers,gen_id=mysuite0
5534
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005535 ``-object filter-buffer,id=id,netdev=netdevid,interval=t[,queue=all|rx|tx][,status=on|off][,position=head|tail|id=<id>][,insert=behind|before]``
5536 Interval t can't be 0, this filter batches the packet delivery:
5537 all packets arriving in a given interval on netdev netdevid are
5538 delayed until the end of the interval. Interval is in
5539 microseconds. ``status`` is optional that indicate whether the
5540 netfilter is on (enabled) or off (disabled), the default status
5541 for netfilter will be 'on'.
5542
5543 queue all\|rx\|tx is an option that can be applied to any
5544 netfilter.
5545
5546 ``all``: the filter is attached both to the receive and the
5547 transmit queue of the netdev (default).
5548
5549 ``rx``: the filter is attached to the receive queue of the
5550 netdev, where it will receive packets sent to the netdev.
5551
5552 ``tx``: the filter is attached to the transmit queue of the
5553 netdev, where it will receive packets sent by the netdev.
5554
5555 position head\|tail\|id=<id> is an option to specify where the
5556 filter should be inserted in the filter list. It can be applied
5557 to any netfilter.
5558
5559 ``head``: the filter is inserted at the head of the filter list,
5560 before any existing filters.
5561
5562 ``tail``: the filter is inserted at the tail of the filter list,
5563 behind any existing filters (default).
5564
5565 ``id=<id>``: the filter is inserted before or behind the filter
5566 specified by <id>, see the insert option below.
5567
5568 insert behind\|before is an option to specify where to insert
5569 the new filter relative to the one specified with
5570 position=id=<id>. It can be applied to any netfilter.
5571
5572 ``before``: insert before the specified filter.
5573
5574 ``behind``: insert behind the specified filter (default).
5575
5576 ``-object filter-mirror,id=id,netdev=netdevid,outdev=chardevid,queue=all|rx|tx[,vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
5577 filter-mirror on netdev netdevid,mirror net packet to
5578 chardevchardevid, if it has the vnet\_hdr\_support flag,
5579 filter-mirror will mirror packet with vnet\_hdr\_len.
5580
5581 ``-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]``
5582 filter-redirector on netdev netdevid,redirect filter's net
5583 packet to chardev chardevid,and redirect indev's packet to
5584 filter.if it has the vnet\_hdr\_support flag, filter-redirector
5585 will redirect packet with vnet\_hdr\_len. Create a
5586 filter-redirector we need to differ outdev id from indev id, id
5587 can not be the same. we can just use indev or outdev, but at
5588 least one of indev or outdev need to be specified.
5589
5590 ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
5591 Filter-rewriter is a part of COLO project.It will rewrite tcp
5592 packet to secondary from primary to keep secondary tcp
5593 connection,and rewrite tcp packet to primary from secondary make
5594 tcp packet can be handled by client.if it has the
5595 vnet\_hdr\_support flag, we can parse packet with vnet header.
5596
5597 usage: colo secondary: -object
5598 filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object
5599 filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object
5600 filter-rewriter,id=rew0,netdev=hn0,queue=all
5601
5602 ``-object filter-dump,id=id,netdev=dev[,file=filename][,maxlen=len][,position=head|tail|id=<id>][,insert=behind|before]``
5603 Dump the network traffic on netdev dev to the file specified by
5604 filename. At most len bytes (64k by default) per packet are
5605 stored. The file format is libpcap, so it can be analyzed with
5606 tools such as tcpdump or Wireshark.
5607
Zhang Chena2e5cb72020-06-24 09:20:41 +08005608 ``-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 +08005609 Colo-compare gets packet from primary\_in chardevid and
5610 secondary\_in, then compare whether the payload of primary packet
5611 and secondary packet are the same. If same, it will output
5612 primary packet to out\_dev, else it will notify COLO-framework to do
5613 checkpoint and send primary packet to out\_dev. In order to
5614 improve efficiency, we need to put the task of comparison in
5615 another iothread. If it has the vnet\_hdr\_support flag,
5616 colo compare will send/recv packet with vnet\_hdr\_len.
5617 The compare\_timeout=@var{ms} determines the maximum time of the
5618 colo-compare hold the packet. The expired\_scan\_cycle=@var{ms}
5619 is to set the period of scanning expired primary node network packets.
5620 The max\_queue\_size=@var{size} is to set the max compare queue
5621 size depend on user environment.
5622 If user want to use Xen COLO, need to add the notify\_dev to
Zhang Chen9cc43c92020-03-18 16:23:19 +08005623 notify Xen colo-frame to do checkpoint.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005624
Zhang Chen2b28a7e2020-06-24 09:20:42 +08005625 COLO-compare must be used with the help of filter-mirror,
5626 filter-redirector and filter-rewriter.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005627
5628 ::
5629
5630 KVM COLO
5631
5632 primary:
Michael Tokarev7aa94e52024-01-07 14:24:59 +03005633 -netdev tap,id=hn0,vhost=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005634 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005635 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off
5636 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off
5637 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005638 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005639 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005640 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
5641 -object iothread,id=iothread1
5642 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
5643 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
5644 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
5645 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
5646
5647 secondary:
Michael Tokarev7aa94e52024-01-07 14:24:59 +03005648 -netdev tap,id=hn0,vhost=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005649 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
5650 -chardev socket,id=red0,host=3.3.3.3,port=9003
5651 -chardev socket,id=red1,host=3.3.3.3,port=9004
5652 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
5653 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
5654
5655
5656 Xen COLO
5657
5658 primary:
Michael Tokarev7aa94e52024-01-07 14:24:59 +03005659 -netdev tap,id=hn0,vhost=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005660 -device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005661 -chardev socket,id=mirror0,host=3.3.3.3,port=9003,server=on,wait=off
5662 -chardev socket,id=compare1,host=3.3.3.3,port=9004,server=on,wait=off
5663 -chardev socket,id=compare0,host=3.3.3.3,port=9001,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005664 -chardev socket,id=compare0-0,host=3.3.3.3,port=9001
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005665 -chardev socket,id=compare_out,host=3.3.3.3,port=9005,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005666 -chardev socket,id=compare_out0,host=3.3.3.3,port=9005
Daniel P. Berrangébfdc1262021-02-16 19:10:19 +00005667 -chardev socket,id=notify_way,host=3.3.3.3,port=9009,server=on,wait=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005668 -object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
5669 -object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
5670 -object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
5671 -object iothread,id=iothread1
Manos Pitsidianakis835f3642024-02-20 10:52:23 +02005672 -object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=notify_way,iothread=iothread1
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005673
5674 secondary:
Michael Tokarev7aa94e52024-01-07 14:24:59 +03005675 -netdev tap,id=hn0,vhost=off
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005676 -device e1000,netdev=hn0,mac=52:a4:00:12:78:66
5677 -chardev socket,id=red0,host=3.3.3.3,port=9003
5678 -chardev socket,id=red1,host=3.3.3.3,port=9004
5679 -object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
5680 -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
5681
5682 If you want to know the detail of above command line, you can
5683 read the colo-compare git log.
5684
5685 ``-object cryptodev-backend-builtin,id=id[,queues=queues]``
Stefan Weil1e458f12022-10-30 11:59:44 +01005686 Creates a cryptodev backend which executes crypto operations from
5687 the QEMU cipher APIs. The id parameter is a unique ID that will
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005688 be used to reference this cryptodev backend from the
5689 ``virtio-crypto`` device. The queues parameter is optional,
5690 which specify the queue number of cryptodev backend, the default
5691 of queues is 1.
5692
Peter Maydell09ce5f22020-02-28 15:36:13 +00005693 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005694
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005695 # |qemu_system| \\
5696 [...] \\
5697 -object cryptodev-backend-builtin,id=cryptodev0 \\
5698 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005699 [...]
5700
5701 ``-object cryptodev-vhost-user,id=id,chardev=chardevid[,queues=queues]``
5702 Creates a vhost-user cryptodev backend, backed by a chardev
5703 chardevid. The id parameter is a unique ID that will be used to
5704 reference this cryptodev backend from the ``virtio-crypto``
5705 device. The chardev should be a unix domain socket backed one.
5706 The vhost-user uses a specifically defined protocol to pass
5707 vhost ioctl replacement messages to an application on the other
5708 end of the socket. The queues parameter is optional, which
5709 specify the queue number of cryptodev backend for multiqueue
5710 vhost-user, the default of queues is 1.
5711
Peter Maydell09ce5f22020-02-28 15:36:13 +00005712 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005713
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005714 # |qemu_system| \\
5715 [...] \\
5716 -chardev socket,id=chardev0,path=/path/to/socket \\
5717 -object cryptodev-vhost-user,id=cryptodev0,chardev=chardev0 \\
5718 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005719 [...]
5720
5721 ``-object secret,id=id,data=string,format=raw|base64[,keyid=secretid,iv=string]``
Peter Maydell09ce5f22020-02-28 15:36:13 +00005722 \
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005723 ``-object secret,id=id,file=filename,format=raw|base64[,keyid=secretid,iv=string]``
5724 Defines a secret to store a password, encryption key, or some
5725 other sensitive data. The sensitive data can either be passed
5726 directly via the data parameter, or indirectly via the file
5727 parameter. Using the data parameter is insecure unless the
5728 sensitive data is encrypted.
5729
5730 The sensitive data can be provided in raw format (the default),
5731 or base64. When encoded as JSON, the raw format only supports
5732 valid UTF-8 characters, so base64 is recommended for sending
5733 binary data. QEMU will convert from which ever format is
5734 provided to the format it needs internally. eg, an RBD password
5735 can be provided in raw format, even though it will be base64
5736 encoded when passed onto the RBD sever.
5737
5738 For added protection, it is possible to encrypt the data
5739 associated with a secret using the AES-256-CBC cipher. Use of
5740 encryption is indicated by providing the keyid and iv
5741 parameters. The keyid parameter provides the ID of a previously
5742 defined secret that contains the AES-256 decryption key. This
5743 key should be 32-bytes long and be base64 encoded. The iv
5744 parameter provides the random initialization vector used for
5745 encryption of this particular secret and should be a base64
5746 encrypted string of the 16-byte IV.
5747
5748 The simplest (insecure) usage is to provide the secret inline
5749
Peter Maydell09ce5f22020-02-28 15:36:13 +00005750 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005751
5752 # |qemu_system| -object secret,id=sec0,data=letmein,format=raw
5753
5754 The simplest secure usage is to provide the secret via a file
5755
5756 # printf "letmein" > mypasswd.txt # QEMU\_SYSTEM\_MACRO -object
5757 secret,id=sec0,file=mypasswd.txt,format=raw
5758
5759 For greater security, AES-256-CBC should be used. To illustrate
5760 usage, consider the openssl command line tool which can encrypt
5761 the data. Note that when encrypting, the plaintext must be
5762 padded to the cipher block size (32 bytes) using the standard
5763 PKCS#5/6 compatible padding algorithm.
5764
5765 First a master key needs to be created in base64 encoding:
5766
5767 ::
5768
5769 # openssl rand -base64 32 > key.b64
5770 # KEY=$(base64 -d key.b64 | hexdump -v -e '/1 "%02X"')
5771
5772 Each secret to be encrypted needs to have a random
5773 initialization vector generated. These do not need to be kept
5774 secret
5775
5776 ::
5777
5778 # openssl rand -base64 16 > iv.b64
5779 # IV=$(base64 -d iv.b64 | hexdump -v -e '/1 "%02X"')
5780
5781 The secret to be defined can now be encrypted, in this case
5782 we're telling openssl to base64 encode the result, but it could
5783 be left as raw bytes if desired.
5784
5785 ::
5786
5787 # SECRET=$(printf "letmein" |
5788 openssl enc -aes-256-cbc -a -K $KEY -iv $IV)
5789
5790 When launching QEMU, create a master secret pointing to
5791 ``key.b64`` and specify that to be used to decrypt the user
5792 password. Pass the contents of ``iv.b64`` to the second secret
5793
Peter Maydell09ce5f22020-02-28 15:36:13 +00005794 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005795
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005796 # |qemu_system| \\
5797 -object secret,id=secmaster0,format=base64,file=key.b64 \\
5798 -object secret,id=sec0,keyid=secmaster0,format=base64,\\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005799 data=$SECRET,iv=$(<iv.b64)
5800
Dov Murik55cdf562021-11-11 10:00:43 +00005801 ``-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 +00005802 Create a Secure Encrypted Virtualization (SEV) guest object,
5803 which can be used to provide the guest memory encryption support
5804 on AMD processors.
5805
5806 When memory encryption is enabled, one of the physical address
5807 bit (aka the C-bit) is utilized to mark if a memory page is
5808 protected. The ``cbitpos`` is used to provide the C-bit
5809 position. The C-bit position is Host family dependent hence user
5810 must provide this value. On EPYC, the value should be 47.
5811
5812 When memory encryption is enabled, we loose certain bits in
5813 physical address space. The ``reduced-phys-bits`` is used to
5814 provide the number of bits we loose in physical address space.
5815 Similar to C-bit, the value is Host family dependent. On EPYC,
Tom Lendacky326e3012022-09-30 10:14:28 -05005816 a guest will lose a maximum of 1 bit, so the value should be 1.
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005817
5818 The ``sev-device`` provides the device file to use for
5819 communicating with the SEV firmware running inside AMD Secure
5820 Processor. The default device is '/dev/sev'. If hardware
5821 supports memory encryption then /dev/sev devices are created by
5822 CCP driver.
5823
5824 The ``policy`` provides the guest policy to be enforced by the
5825 SEV firmware and restrict what configuration and operational
5826 commands can be performed on this guest by the hypervisor. The
5827 policy should be provided by the guest owner and is bound to the
5828 guest and cannot be changed throughout the lifetime of the
5829 guest. The default is 0.
5830
5831 If guest ``policy`` allows sharing the key with another SEV
5832 guest then ``handle`` can be use to provide handle of the guest
5833 from which to share the key.
5834
5835 The ``dh-cert-file`` and ``session-file`` provides the guest
5836 owner's Public Diffie-Hillman key defined in SEV spec. The PDH
5837 and session parameters are used for establishing a cryptographic
5838 session with the guest owner to negotiate keys used for
5839 attestation. The file must be encoded in base64.
5840
Dov Murik55cdf562021-11-11 10:00:43 +00005841 The ``kernel-hashes`` adds the hashes of given kernel/initrd/
5842 cmdline to a designated guest firmware page for measured Linux
5843 boot with -kernel. The default is off. (Since 6.2)
5844
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005845 e.g to launch a SEV guest
5846
Peter Maydell09ce5f22020-02-28 15:36:13 +00005847 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005848
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005849 # |qemu_system_x86| \\
5850 ...... \\
Tom Lendacky326e3012022-09-30 10:14:28 -05005851 -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \\
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005852 -machine ...,memory-encryption=sev0 \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005853 .....
5854
5855 ``-object authz-simple,id=id,identity=string``
5856 Create an authorization object that will control access to
5857 network services.
5858
5859 The ``identity`` parameter is identifies the user and its format
5860 depends on the network service that authorization object is
5861 associated with. For authorizing based on TLS x509 certificates,
5862 the identity must be the x509 distinguished name. Note that care
5863 must be taken to escape any commas in the distinguished name.
5864
5865 An example authorization object to validate a x509 distinguished
5866 name would look like:
5867
Peter Maydell09ce5f22020-02-28 15:36:13 +00005868 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005869
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005870 # |qemu_system| \\
5871 ... \\
5872 -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 +00005873 ...
5874
5875 Note the use of quotes due to the x509 distinguished name
5876 containing whitespace, and escaping of ','.
5877
Daniel P. Berrangé4d7beea2020-11-04 13:57:21 +00005878 ``-object authz-listfile,id=id,filename=path,refresh=on|off``
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005879 Create an authorization object that will control access to
5880 network services.
5881
5882 The ``filename`` parameter is the fully qualified path to a file
5883 containing the access control list rules in JSON format.
5884
5885 An example set of rules that match against SASL usernames might
5886 look like:
5887
5888 ::
5889
5890 {
5891 "rules": [
5892 { "match": "fred", "policy": "allow", "format": "exact" },
5893 { "match": "bob", "policy": "allow", "format": "exact" },
5894 { "match": "danb", "policy": "deny", "format": "glob" },
5895 { "match": "dan*", "policy": "allow", "format": "exact" },
5896 ],
5897 "policy": "deny"
5898 }
5899
5900 When checking access the object will iterate over all the rules
5901 and the first rule to match will have its ``policy`` value
5902 returned as the result. If no rules match, then the default
5903 ``policy`` value is returned.
5904
5905 The rules can either be an exact string match, or they can use
5906 the simple UNIX glob pattern matching to allow wildcards to be
5907 used.
5908
5909 If ``refresh`` is set to true the file will be monitored and
5910 automatically reloaded whenever its content changes.
5911
5912 As with the ``authz-simple`` object, the format of the identity
5913 strings being matched depends on the network service, but is
5914 usually a TLS x509 distinguished name, or a SASL username.
5915
5916 An example authorization object to validate a SASL username
5917 would look like:
5918
Peter Maydell09ce5f22020-02-28 15:36:13 +00005919 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005920
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005921 # |qemu_system| \\
5922 ... \\
Daniel P. Berrangé4d7beea2020-11-04 13:57:21 +00005923 -object authz-simple,id=auth0,filename=/etc/qemu/vnc-sasl.acl,refresh=on \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005924 ...
5925
5926 ``-object authz-pam,id=id,service=string``
5927 Create an authorization object that will control access to
5928 network services.
5929
5930 The ``service`` parameter provides the name of a PAM service to
5931 use for authorization. It requires that a file
5932 ``/etc/pam.d/service`` exist to provide the configuration for
5933 the ``account`` subsystem.
5934
5935 An example authorization object to validate a TLS x509
5936 distinguished name would look like:
5937
Peter Maydell09ce5f22020-02-28 15:36:13 +00005938 .. parsed-literal::
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005939
Laszlo Ersek353a06b2020-09-08 19:21:11 +02005940 # |qemu_system| \\
5941 ... \\
5942 -object authz-pam,id=auth0,service=qemu-vnc \\
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005943 ...
5944
5945 There would then be a corresponding config file for PAM at
5946 ``/etc/pam.d/qemu-vnc`` that contains:
5947
5948 ::
5949
5950 account requisite pam_listfile.so item=user sense=allow \
5951 file=/etc/qemu/vnc.allow
5952
5953 Finally the ``/etc/qemu/vnc.allow`` file would contain the list
Stefan Weil1e458f12022-10-30 11:59:44 +01005954 of x509 distinguished names that are permitted access
Peter Maydelle2fcbf42020-03-06 10:07:14 +00005955
5956 ::
5957
5958 CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
5959
Stefano Garzarella1793ad02021-07-21 11:42:10 +02005960 ``-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 +00005961 Creates a dedicated event loop thread that devices can be
5962 assigned to. This is known as an IOThread. By default device
5963 emulation happens in vCPU threads or the main event loop thread.
5964 This can become a scalability bottleneck. IOThreads allow device
5965 emulation and I/O to run on other host CPUs.
5966
5967 The ``id`` parameter is a unique ID that will be used to
5968 reference this IOThread from ``-device ...,iothread=id``.
5969 Multiple devices can be assigned to an IOThread. Note that not
5970 all devices support an ``iothread`` parameter.
5971
5972 The ``query-iothreads`` QMP command lists IOThreads and reports
5973 their thread IDs so that the user can configure host CPU
5974 pinning/affinity.
5975
5976 IOThreads use an adaptive polling algorithm to reduce event loop
5977 latency. Instead of entering a blocking system call to monitor
5978 file descriptors and then pay the cost of being woken up when an
5979 event occurs, the polling algorithm spins waiting for events for
5980 a short time. The algorithm's default parameters are suitable
5981 for many cases but can be adjusted based on knowledge of the
5982 workload and/or host device latency.
5983
5984 The ``poll-max-ns`` parameter is the maximum number of
5985 nanoseconds to busy wait for events. Polling can be disabled by
5986 setting this value to 0.
5987
5988 The ``poll-grow`` parameter is the multiplier used to increase
5989 the polling time when the algorithm detects it is missing events
5990 due to not polling long enough.
5991
5992 The ``poll-shrink`` parameter is the divisor used to decrease
5993 the polling time when the algorithm detects it is spending too
5994 long polling without encountering events.
5995
Stefano Garzarella1793ad02021-07-21 11:42:10 +02005996 The ``aio-max-batch`` parameter is the maximum number of requests
5997 in a batch for the AIO engine, 0 means that the engine will use
5998 its default.
5999
6000 The IOThread parameters can be modified at run-time using the
Peter Maydelle2fcbf42020-03-06 10:07:14 +00006001 ``qom-set`` command (where ``iothread1`` is the IOThread's
6002 ``id``):
6003
6004 ::
6005
6006 (qemu) qom-set /objects/iothread1 poll-max-ns 100000
6007ERST
Daniel P. Berrangeb9174d42015-05-13 17:14:03 +01006008
6009
Stefan Weil3dbf2c72010-01-16 18:19:44 +01006010HXCOMM This is the last statement. Insert new options before this line!
Paolo Bonzinifd5fc4b2021-05-17 07:34:21 -04006011
6012#undef DEF
6013#undef DEFHEADING
6014#undef ARCHHEADING