]> git.proxmox.com Git - mirror_qemu.git/blame - qemu-doc.texi
authz: fix usage of bool in listfile.c
[mirror_qemu.git] / qemu-doc.texi
CommitLineData
386405f7 1\input texinfo @c -*- texinfo -*-
debc7065
FB
2@c %**start of header
3@setfilename qemu-doc.info
44cb280d 4@include version.texi
e080e785
SW
5
6@documentlanguage en
7@documentencoding UTF-8
8
44cb280d 9@settitle QEMU version @value{VERSION} User Documentation
debc7065
FB
10@exampleindent 0
11@paragraphindent 0
12@c %**end of header
386405f7 13
664785ac
TH
14@set qemu_system qemu-system-x86_64
15@set qemu_system_x86 qemu-system-x86_64
16
a1a32b05
SW
17@ifinfo
18@direntry
19* QEMU: (qemu-doc). The QEMU Emulator User Documentation.
20@end direntry
21@end ifinfo
22
0806e3f6 23@iftex
386405f7
FB
24@titlepage
25@sp 7
44cb280d 26@center @titlefont{QEMU version @value{VERSION}}
debc7065
FB
27@sp 1
28@center @titlefont{User Documentation}
386405f7
FB
29@sp 3
30@end titlepage
0806e3f6 31@end iftex
386405f7 32
debc7065
FB
33@ifnottex
34@node Top
35@top
36
37@menu
38* Introduction::
debc7065
FB
39* QEMU PC System emulator::
40* QEMU System emulator for non PC targets::
83195237 41* QEMU User space emulator::
483c6ad4 42* System requirements::
e8412576 43* Security::
78e87797 44* Implementation notes::
eb22aeca 45* Deprecated features::
369e8f5b 46* Recently removed features::
45b47130 47* Supported build platforms::
7544a042 48* License::
debc7065
FB
49* Index::
50@end menu
51@end ifnottex
52
53@contents
54
55@node Introduction
386405f7
FB
56@chapter Introduction
57
debc7065
FB
58@menu
59* intro_features:: Features
60@end menu
61
62@node intro_features
322d0c66 63@section Features
386405f7 64
1f673135
FB
65QEMU is a FAST! processor emulator using dynamic translation to
66achieve good emulation speed.
1eb20527 67
1f3e7e41 68@cindex operating modes
1eb20527 69QEMU has two operating modes:
0806e3f6 70
d7e5edca 71@itemize
7544a042 72@cindex system emulation
1f3e7e41 73@item Full system emulation. In this mode, QEMU emulates a full system (for
3f9f3aa1
FB
74example a PC), including one or several processors and various
75peripherals. It can be used to launch different Operating Systems
76without rebooting the PC or to debug system code.
1eb20527 77
7544a042 78@cindex user mode emulation
1f3e7e41 79@item User mode emulation. In this mode, QEMU can launch
83195237 80processes compiled for one CPU on another CPU. It can be used to
70b7fba9 81launch the Wine Windows API emulator (@url{https://www.winehq.org}) or
1f673135 82to ease cross-compilation and cross-debugging.
1eb20527
FB
83
84@end itemize
85
1f3e7e41
PB
86QEMU has the following features:
87
88@itemize
89@item QEMU can run without a host kernel driver and yet gives acceptable
90performance. It uses dynamic translation to native code for reasonable speed,
91with support for self-modifying code and precise exceptions.
92
93@item It is portable to several operating systems (GNU/Linux, *BSD, Mac OS X,
94Windows) and architectures.
95
96@item It performs accurate software emulation of the FPU.
97@end itemize
322d0c66 98
1f3e7e41 99QEMU user mode emulation has the following features:
52c00a5f 100@itemize
1f3e7e41
PB
101@item Generic Linux system call converter, including most ioctls.
102
103@item clone() emulation using native CPU clone() to use Linux scheduler for threads.
104
105@item Accurate signal handling by remapping host signals to target signals.
106@end itemize
107
108QEMU full system emulation has the following features:
109@itemize
110@item
111QEMU uses a full software MMU for maximum portability.
112
113@item
326c4c3c 114QEMU can optionally use an in-kernel accelerator, like kvm. The accelerators
1f3e7e41
PB
115execute most of the guest code natively, while
116continuing to emulate the rest of the machine.
117
118@item
119Various hardware devices can be emulated and in some cases, host
120devices (e.g. serial and parallel ports, USB, drives) can be used
121transparently by the guest Operating System. Host device passthrough
122can be used for talking to external physical peripherals (e.g. a
123webcam, modem or tape drive).
124
125@item
126Symmetric multiprocessing (SMP) support. Currently, an in-kernel
127accelerator is required to use more than one host CPU for emulation.
128
52c00a5f 129@end itemize
386405f7 130
0806e3f6 131
debc7065 132@node QEMU PC System emulator
3f9f3aa1 133@chapter QEMU PC System emulator
7544a042 134@cindex system emulation (PC)
1eb20527 135
debc7065
FB
136@menu
137* pcsys_introduction:: Introduction
138* pcsys_quickstart:: Quick Start
139* sec_invocation:: Invocation
a40db1b3
PM
140* pcsys_keys:: Keys in the graphical frontends
141* mux_keys:: Keys in the character backend multiplexer
debc7065 142* pcsys_monitor:: QEMU Monitor
2544e9e4 143* cpu_models:: CPU models
debc7065
FB
144* disk_images:: Disk Images
145* pcsys_network:: Network emulation
576fd0a1 146* pcsys_other_devs:: Other Devices
debc7065
FB
147* direct_linux_boot:: Direct Linux Boot
148* pcsys_usb:: USB emulation
f858dcae 149* vnc_security:: VNC security
5d19a6ea 150* network_tls:: TLS setup for network services
debc7065
FB
151* gdb_usage:: GDB usage
152* pcsys_os_specific:: Target OS specific information
153@end menu
154
155@node pcsys_introduction
0806e3f6
FB
156@section Introduction
157
158@c man begin DESCRIPTION
159
3f9f3aa1
FB
160The QEMU PC System emulator simulates the
161following peripherals:
0806e3f6
FB
162
163@itemize @minus
5fafdf24 164@item
15a34c63 165i440FX host PCI bridge and PIIX3 PCI to ISA bridge
0806e3f6 166@item
15a34c63
FB
167Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
168extensions (hardware level, including all non standard modes).
0806e3f6
FB
169@item
170PS/2 mouse and keyboard
5fafdf24 171@item
15a34c63 1722 PCI IDE interfaces with hard disk and CD-ROM support
1f673135
FB
173@item
174Floppy disk
5fafdf24 175@item
3a2eeac0 176PCI and ISA network adapters
0806e3f6 177@item
05d5818c
FB
178Serial ports
179@item
23076bb3
CM
180IPMI BMC, either and internal or external one
181@item
c0fe3827
FB
182Creative SoundBlaster 16 sound card
183@item
184ENSONIQ AudioPCI ES1370 sound card
185@item
e5c9a13e
AZ
186Intel 82801AA AC97 Audio compatible sound card
187@item
7d72e762
GH
188Intel HD Audio Controller and HDA codec
189@item
2d983446 190Adlib (OPL2) - Yamaha YM3812 compatible chip
b389dbfb 191@item
26463dbc
AZ
192Gravis Ultrasound GF1 sound card
193@item
cc53d26d 194CS4231A compatible sound card
195@item
a92ff8c1 196PCI UHCI, OHCI, EHCI or XHCI USB controller and a virtual USB-1.1 hub.
0806e3f6
FB
197@end itemize
198
3f9f3aa1
FB
199SMP is supported with up to 255 CPUs.
200
a8ad4159 201QEMU uses the PC BIOS from the Seabios project and the Plex86/Bochs LGPL
15a34c63
FB
202VGA BIOS.
203
c0fe3827
FB
204QEMU uses YM3812 emulation by Tatsuyuki Satoh.
205
2d983446 206QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
26463dbc 207by Tibor "TS" Schütz.
423d65f4 208
1a1a0e20 209Note that, by default, GUS shares IRQ(7) with parallel ports and so
b65ee4fa 210QEMU must be told to not have parallel ports to have working GUS.
720036a5 211
212@example
664785ac 213@value{qemu_system_x86} dos.img -soundhw gus -parallel none
720036a5 214@end example
215
216Alternatively:
217@example
664785ac 218@value{qemu_system_x86} dos.img -device gus,irq=5
720036a5 219@end example
220
221Or some other unclaimed IRQ.
222
cc53d26d 223CS4231A is the chip used in Windows Sound System and GUSMAX products
224
0806e3f6
FB
225@c man end
226
debc7065 227@node pcsys_quickstart
1eb20527 228@section Quick Start
7544a042 229@cindex quick start
1eb20527 230
664785ac
TH
231Download and uncompress a hard disk image with Linux installed (e.g.
232@file{linux.img}) and type:
0806e3f6
FB
233
234@example
664785ac 235@value{qemu_system} linux.img
0806e3f6
FB
236@end example
237
238Linux should boot and give you a prompt.
239
6cc721cf 240@node sec_invocation
ec410fc9
FB
241@section Invocation
242
243@example
0806e3f6 244@c man begin SYNOPSIS
664785ac 245@command{@value{qemu_system}} [@var{options}] [@var{disk_image}]
0806e3f6 246@c man end
ec410fc9
FB
247@end example
248
0806e3f6 249@c man begin OPTIONS
d2c639d6
BS
250@var{disk_image} is a raw hard disk image for IDE hard disk 0. Some
251targets do not need a disk image.
ec410fc9 252
5824d651 253@include qemu-options.texi
ec410fc9 254
3e11db9a
FB
255@c man end
256
e896d0f9
MA
257@subsection Device URL Syntax
258@c TODO merge this with section Disk Images
259
260@c man begin NOTES
261
262In addition to using normal file images for the emulated storage devices,
263QEMU can also use networked resources such as iSCSI devices. These are
264specified using a special URL syntax.
265
266@table @option
267@item iSCSI
268iSCSI support allows QEMU to access iSCSI resources directly and use as
269images for the guest storage. Both disk and cdrom images are supported.
270
271Syntax for specifying iSCSI LUNs is
272``iscsi://<target-ip>[:<port>]/<target-iqn>/<lun>''
273
274By default qemu will use the iSCSI initiator-name
275'iqn.2008-11.org.linux-kvm[:<name>]' but this can also be set from the command
276line or a configuration file.
277
278Since version Qemu 2.4 it is possible to specify a iSCSI request timeout to detect
279stalled requests and force a reestablishment of the session. The timeout
280is specified in seconds. The default is 0 which means no timeout. Libiscsi
2811.15.0 or greater is required for this feature.
282
283Example (without authentication):
284@example
664785ac 285@value{qemu_system} -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \
e896d0f9
MA
286 -cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \
287 -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
288@end example
289
290Example (CHAP username/password via URL):
291@example
664785ac 292@value{qemu_system} -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1
e896d0f9
MA
293@end example
294
295Example (CHAP username/password via environment variables):
296@example
297LIBISCSI_CHAP_USERNAME="user" \
298LIBISCSI_CHAP_PASSWORD="password" \
664785ac 299@value{qemu_system} -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
e896d0f9
MA
300@end example
301
302@item NBD
303QEMU supports NBD (Network Block Devices) both using TCP protocol as well
0c61ebb0 304as Unix Domain Sockets. With TCP, the default port is 10809.
e896d0f9 305
0c61ebb0
EB
306Syntax for specifying a NBD device using TCP, in preferred URI form:
307``nbd://<server-ip>[:<port>]/[<export>]''
308
309Syntax for specifying a NBD device using Unix Domain Sockets; remember
310that '?' is a shell glob character and may need quoting:
311``nbd+unix:///[<export>]?socket=<domain-socket>''
312
313Older syntax that is also recognized:
e896d0f9
MA
314``nbd:<server-ip>:<port>[:exportname=<export>]''
315
316Syntax for specifying a NBD device using Unix Domain Sockets
317``nbd:unix:<domain-socket>[:exportname=<export>]''
318
319Example for TCP
320@example
664785ac 321@value{qemu_system} --drive file=nbd:192.0.2.1:30000
e896d0f9
MA
322@end example
323
324Example for Unix Domain Sockets
325@example
664785ac 326@value{qemu_system} --drive file=nbd:unix:/tmp/nbd-socket
e896d0f9
MA
327@end example
328
329@item SSH
330QEMU supports SSH (Secure Shell) access to remote disks.
331
332Examples:
333@example
664785ac
TH
334@value{qemu_system} -drive file=ssh://user@@host/path/to/disk.img
335@value{qemu_system} -drive file.driver=ssh,file.user=user,file.host=host,file.port=22,file.path=/path/to/disk.img
e896d0f9
MA
336@end example
337
338Currently authentication must be done using ssh-agent. Other
339authentication methods may be supported in future.
340
341@item Sheepdog
342Sheepdog is a distributed storage system for QEMU.
343QEMU supports using either local sheepdog devices or remote networked
344devices.
345
346Syntax for specifying a sheepdog device
347@example
348sheepdog[+tcp|+unix]://[host:port]/vdiname[?socket=path][#snapid|#tag]
349@end example
350
351Example
352@example
664785ac 353@value{qemu_system} --drive file=sheepdog://192.0.2.1:30000/MyVirtualMachine
e896d0f9
MA
354@end example
355
356See also @url{https://sheepdog.github.io/sheepdog/}.
357
358@item GlusterFS
359GlusterFS is a user space distributed file system.
360QEMU supports the use of GlusterFS volumes for hosting VM disk images using
361TCP, Unix Domain Sockets and RDMA transport protocols.
362
363Syntax for specifying a VM disk image on GlusterFS volume is
364@example
365
366URI:
367gluster[+type]://[host[:port]]/volume/path[?socket=...][,debug=N][,logfile=...]
368
369JSON:
370'json:@{"driver":"qcow2","file":@{"driver":"gluster","volume":"testvol","path":"a.img","debug":N,"logfile":"...",
371@ "server":[@{"type":"tcp","host":"...","port":"..."@},
372@ @{"type":"unix","socket":"..."@}]@}@}'
373@end example
374
375
376Example
377@example
378URI:
664785ac 379@value{qemu_system} --drive file=gluster://192.0.2.1/testvol/a.img,
e896d0f9
MA
380@ file.debug=9,file.logfile=/var/log/qemu-gluster.log
381
382JSON:
664785ac 383@value{qemu_system} 'json:@{"driver":"qcow2",
e896d0f9
MA
384@ "file":@{"driver":"gluster",
385@ "volume":"testvol","path":"a.img",
386@ "debug":9,"logfile":"/var/log/qemu-gluster.log",
387@ "server":[@{"type":"tcp","host":"1.2.3.4","port":24007@},
388@ @{"type":"unix","socket":"/var/run/glusterd.socket"@}]@}@}'
664785ac 389@value{qemu_system} -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
e896d0f9
MA
390@ file.debug=9,file.logfile=/var/log/qemu-gluster.log,
391@ file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
392@ file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
393@end example
394
395See also @url{http://www.gluster.org}.
396
397@item HTTP/HTTPS/FTP/FTPS
398QEMU supports read-only access to files accessed over http(s) and ftp(s).
399
400Syntax using a single filename:
401@example
402<protocol>://[<username>[:<password>]@@]<host>/<path>
403@end example
404
405where:
406@table @option
407@item protocol
408'http', 'https', 'ftp', or 'ftps'.
409
410@item username
411Optional username for authentication to the remote server.
412
413@item password
414Optional password for authentication to the remote server.
415
416@item host
417Address of the remote server.
418
419@item path
420Path on the remote server, including any query string.
421@end table
422
423The following options are also supported:
424@table @option
425@item url
426The full URL when passing options to the driver explicitly.
427
428@item readahead
429The amount of data to read ahead with each range request to the remote server.
430This value may optionally have the suffix 'T', 'G', 'M', 'K', 'k' or 'b'. If it
431does not have a suffix, it will be assumed to be in bytes. The value must be a
432multiple of 512 bytes. It defaults to 256k.
433
434@item sslverify
435Whether to verify the remote server's certificate when connecting over SSL. It
436can have the value 'on' or 'off'. It defaults to 'on'.
437
438@item cookie
439Send this cookie (it can also be a list of cookies separated by ';') with
440each outgoing request. Only supported when using protocols such as HTTP
441which support cookies, otherwise ignored.
442
443@item timeout
444Set the timeout in seconds of the CURL connection. This timeout is the time
445that CURL waits for a response from the remote server to get the size of the
446image to be downloaded. If not set, the default timeout of 5 seconds is used.
447@end table
448
449Note that when passing options to qemu explicitly, @option{driver} is the value
450of <protocol>.
451
452Example: boot from a remote Fedora 20 live ISO image
453@example
93bbbdf6 454@value{qemu_system_x86} --drive media=cdrom,file=https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly
e896d0f9 455
93bbbdf6 456@value{qemu_system_x86} --drive media=cdrom,file.driver=http,file.url=http://archives.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly
e896d0f9
MA
457@end example
458
459Example: boot from a remote Fedora 20 cloud image using a local overlay for
460writes, copy-on-read, and a readahead of 64k
461@example
93bbbdf6 462qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"http",, "file.url":"http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2",, "file.readahead":"64k"@}' /tmp/Fedora-x86_64-20-20131211.1-sda.qcow2
e896d0f9 463
664785ac 464@value{qemu_system_x86} -drive file=/tmp/Fedora-x86_64-20-20131211.1-sda.qcow2,copy-on-read=on
e896d0f9
MA
465@end example
466
467Example: boot from an image stored on a VMware vSphere server with a self-signed
468certificate using a local overlay for writes, a readahead of 64k and a timeout
469of 10 seconds.
470@example
471qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"https",, "file.url":"https://user:password@@vsphere.example.com/folder/test/test-flat.vmdk?dcPath=Datacenter&dsName=datastore1",, "file.sslverify":"off",, "file.readahead":"64k",, "file.timeout":10@}' /tmp/test.qcow2
472
664785ac 473@value{qemu_system_x86} -drive file=/tmp/test.qcow2
e896d0f9
MA
474@end example
475
476@end table
477
478@c man end
479
debc7065 480@node pcsys_keys
a40db1b3 481@section Keys in the graphical frontends
3e11db9a
FB
482
483@c man begin OPTIONS
484
de1db2a1
BH
485During the graphical emulation, you can use special key combinations to change
486modes. The default key mappings are shown below, but if you use @code{-alt-grab}
487then the modifier is Ctrl-Alt-Shift (instead of Ctrl-Alt) and if you use
488@code{-ctrl-grab} then the modifier is the right Ctrl key (instead of Ctrl-Alt):
489
a1b74fe8 490@table @key
f9859310 491@item Ctrl-Alt-f
7544a042 492@kindex Ctrl-Alt-f
a1b74fe8 493Toggle full screen
a0a821a4 494
d6a65ba3
JK
495@item Ctrl-Alt-+
496@kindex Ctrl-Alt-+
497Enlarge the screen
498
499@item Ctrl-Alt--
500@kindex Ctrl-Alt--
501Shrink the screen
502
c4a735f9 503@item Ctrl-Alt-u
7544a042 504@kindex Ctrl-Alt-u
c4a735f9 505Restore the screen's un-scaled dimensions
506
f9859310 507@item Ctrl-Alt-n
7544a042 508@kindex Ctrl-Alt-n
a0a821a4
FB
509Switch to virtual console 'n'. Standard console mappings are:
510@table @emph
511@item 1
512Target system display
513@item 2
514Monitor
515@item 3
516Serial port
a1b74fe8
FB
517@end table
518
f9859310 519@item Ctrl-Alt
7544a042 520@kindex Ctrl-Alt
a0a821a4
FB
521Toggle mouse and keyboard grab.
522@end table
523
7544a042
SW
524@kindex Ctrl-Up
525@kindex Ctrl-Down
526@kindex Ctrl-PageUp
527@kindex Ctrl-PageDown
3e11db9a
FB
528In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
529@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
530
a40db1b3
PM
531@c man end
532
533@node mux_keys
534@section Keys in the character backend multiplexer
535
536@c man begin OPTIONS
537
538During emulation, if you are using a character backend multiplexer
539(which is the default if you are using @option{-nographic}) then
540several commands are available via an escape sequence. These
541key sequences all start with an escape character, which is @key{Ctrl-a}
542by default, but can be changed with @option{-echr}. The list below assumes
543you're using the default.
ec410fc9
FB
544
545@table @key
a1b74fe8 546@item Ctrl-a h
7544a042 547@kindex Ctrl-a h
ec410fc9 548Print this help
3b46e624 549@item Ctrl-a x
7544a042 550@kindex Ctrl-a x
366dfc52 551Exit emulator
3b46e624 552@item Ctrl-a s
7544a042 553@kindex Ctrl-a s
1f47a922 554Save disk data back to file (if -snapshot)
20d8a3ed 555@item Ctrl-a t
7544a042 556@kindex Ctrl-a t
d2c639d6 557Toggle console timestamps
a1b74fe8 558@item Ctrl-a b
7544a042 559@kindex Ctrl-a b
1f673135 560Send break (magic sysrq in Linux)
a1b74fe8 561@item Ctrl-a c
7544a042 562@kindex Ctrl-a c
a40db1b3
PM
563Rotate between the frontends connected to the multiplexer (usually
564this switches between the monitor and the console)
a1b74fe8 565@item Ctrl-a Ctrl-a
a40db1b3
PM
566@kindex Ctrl-a Ctrl-a
567Send the escape character to the frontend
ec410fc9 568@end table
0806e3f6
FB
569@c man end
570
571@ignore
572
1f673135
FB
573@c man begin SEEALSO
574The HTML documentation of QEMU for more precise information and Linux
575user mode emulator invocation.
576@c man end
577
578@c man begin AUTHOR
579Fabrice Bellard
580@c man end
581
582@end ignore
583
debc7065 584@node pcsys_monitor
1f673135 585@section QEMU Monitor
7544a042 586@cindex QEMU monitor
1f673135
FB
587
588The QEMU monitor is used to give complex commands to the QEMU
589emulator. You can use it to:
590
591@itemize @minus
592
593@item
e598752a 594Remove or insert removable media images
89dfe898 595(such as CD-ROM or floppies).
1f673135 596
5fafdf24 597@item
1f673135
FB
598Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
599from a disk file.
600
601@item Inspect the VM state without an external debugger.
602
603@end itemize
604
605@subsection Commands
606
607The following commands are available:
608
2313086a 609@include qemu-monitor.texi
0806e3f6 610
2cd8af2d
PB
611@include qemu-monitor-info.texi
612
1f673135
FB
613@subsection Integer expressions
614
615The monitor understands integers expressions for every integer
616argument. You can use register names to get the value of specifics
617CPU registers by prefixing them with @emph{$}.
ec410fc9 618
2544e9e4
DB
619@node cpu_models
620@section CPU models
621
622@include docs/qemu-cpu-models.texi
623
1f47a922
FB
624@node disk_images
625@section Disk Images
626
ee29bdb6
PB
627QEMU supports many disk image formats, including growable disk images
628(their size increase as non empty sectors are written), compressed and
629encrypted disk images.
1f47a922 630
debc7065
FB
631@menu
632* disk_images_quickstart:: Quick start for disk image creation
633* disk_images_snapshot_mode:: Snapshot mode
13a2e80f 634* vm_snapshots:: VM snapshots
debc7065
FB
635@end menu
636
637@node disk_images_quickstart
acd935ef
FB
638@subsection Quick start for disk image creation
639
640You can create a disk image with the command:
1f47a922 641@example
acd935ef 642qemu-img create myimage.img mysize
1f47a922 643@end example
acd935ef
FB
644where @var{myimage.img} is the disk image filename and @var{mysize} is its
645size in kilobytes. You can add an @code{M} suffix to give the size in
646megabytes and a @code{G} suffix for gigabytes.
647
e13c59fa
PM
648@c When this document is converted to rst we should make this into
649@c a proper linked reference to the qemu-img documentation again:
650See the qemu-img invocation documentation for more information.
1f47a922 651
debc7065 652@node disk_images_snapshot_mode
1f47a922
FB
653@subsection Snapshot mode
654
655If you use the option @option{-snapshot}, all disk images are
656considered as read only. When sectors in written, they are written in
657a temporary file created in @file{/tmp}. You can however force the
acd935ef
FB
658write back to the raw disk images by using the @code{commit} monitor
659command (or @key{C-a s} in the serial console).
1f47a922 660
13a2e80f
FB
661@node vm_snapshots
662@subsection VM snapshots
663
664VM snapshots are snapshots of the complete virtual machine including
665CPU state, RAM, device state and the content of all the writable
666disks. In order to use VM snapshots, you must have at least one non
667removable and writable block device using the @code{qcow2} disk image
668format. Normally this device is the first virtual hard drive.
669
670Use the monitor command @code{savevm} to create a new VM snapshot or
671replace an existing one. A human readable name can be assigned to each
19d36792 672snapshot in addition to its numerical ID.
13a2e80f
FB
673
674Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
675a VM snapshot. @code{info snapshots} lists the available snapshots
676with their associated information:
677
678@example
679(qemu) info snapshots
680Snapshot devices: hda
681Snapshot list (from hda):
682ID TAG VM SIZE DATE VM CLOCK
6831 start 41M 2006-08-06 12:38:02 00:00:14.954
6842 40M 2006-08-06 12:43:29 00:00:18.633
6853 msys 40M 2006-08-06 12:44:04 00:00:23.514
686@end example
687
688A VM snapshot is made of a VM state info (its size is shown in
689@code{info snapshots}) and a snapshot of every writable disk image.
690The VM state info is stored in the first @code{qcow2} non removable
691and writable block device. The disk image snapshots are stored in
692every disk image. The size of a snapshot in a disk image is difficult
693to evaluate and is not shown by @code{info snapshots} because the
694associated disk sectors are shared among all the snapshots to save
19d36792
FB
695disk space (otherwise each snapshot would need a full copy of all the
696disk images).
13a2e80f
FB
697
698When using the (unrelated) @code{-snapshot} option
699(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
700but they are deleted as soon as you exit QEMU.
701
702VM snapshots currently have the following known limitations:
703@itemize
5fafdf24 704@item
13a2e80f
FB
705They cannot cope with removable devices if they are removed or
706inserted after a snapshot is done.
5fafdf24 707@item
13a2e80f
FB
708A few device drivers still have incomplete snapshot support so their
709state is not saved or restored properly (in particular USB).
710@end itemize
711
debc7065 712@node pcsys_network
9d4fb82e
FB
713@section Network emulation
714
0e0266c2
TH
715QEMU can simulate several network cards (e.g. PCI or ISA cards on the PC
716target) and can connect them to a network backend on the host or an emulated
717hub. The various host network backends can either be used to connect the NIC of
718the guest to a real network (e.g. by using a TAP devices or the non-privileged
719user mode network stack), or to other guest instances running in another QEMU
720process (e.g. by using the socket host network backend).
9d4fb82e 721
41d03949
FB
722@subsection Using TAP network interfaces
723
724This is the standard way to connect QEMU to a real network. QEMU adds
725a virtual network device on your host (called @code{tapN}), and you
726can then configure it as if it was a real ethernet card.
9d4fb82e 727
8f40c388
FB
728@subsubsection Linux host
729
9d4fb82e
FB
730As an example, you can download the @file{linux-test-xxx.tar.gz}
731archive and copy the script @file{qemu-ifup} in @file{/etc} and
732configure properly @code{sudo} so that the command @code{ifconfig}
733contained in @file{qemu-ifup} can be executed as root. You must verify
41d03949 734that your host kernel supports the TAP network interfaces: the
9d4fb82e
FB
735device @file{/dev/net/tun} must be present.
736
ee0f4751
FB
737See @ref{sec_invocation} to have examples of command lines using the
738TAP network interfaces.
9d4fb82e 739
8f40c388
FB
740@subsubsection Windows host
741
742There is a virtual ethernet driver for Windows 2000/XP systems, called
743TAP-Win32. But it is not included in standard QEMU for Windows,
744so you will need to get it separately. It is part of OpenVPN package,
70b7fba9 745so download OpenVPN from : @url{https://openvpn.net/}.
8f40c388 746
9d4fb82e
FB
747@subsection Using the user mode network stack
748
41d03949
FB
749By using the option @option{-net user} (default configuration if no
750@option{-net} option is specified), QEMU uses a completely user mode
4be456f1 751network stack (you don't need root privilege to use the virtual
41d03949 752network). The virtual network configuration is the following:
9d4fb82e
FB
753
754@example
755
0e0266c2 756 guest (10.0.2.15) <------> Firewall/DHCP server <-----> Internet
41d03949 757 | (10.0.2.2)
9d4fb82e 758 |
2518bd0d 759 ----> DNS server (10.0.2.3)
3b46e624 760 |
2518bd0d 761 ----> SMB server (10.0.2.4)
9d4fb82e
FB
762@end example
763
764The QEMU VM behaves as if it was behind a firewall which blocks all
765incoming connections. You can use a DHCP client to automatically
41d03949
FB
766configure the network in the QEMU VM. The DHCP server assign addresses
767to the hosts starting from 10.0.2.15.
9d4fb82e
FB
768
769In order to check that the user mode network is working, you can ping
770the address 10.0.2.2 and verify that you got an address in the range
77110.0.2.x from the QEMU virtual DHCP server.
772
37cbfcce
GH
773Note that ICMP traffic in general does not work with user mode networking.
774@code{ping}, aka. ICMP echo, to the local router (10.0.2.2) shall work,
775however. If you're using QEMU on Linux >= 3.0, it can use unprivileged ICMP
776ping sockets to allow @code{ping} to the Internet. The host admin has to set
777the ping_group_range in order to grant access to those sockets. To allow ping
778for GID 100 (usually users group):
779
780@example
781echo 100 100 > /proc/sys/net/ipv4/ping_group_range
782@end example
b415a407 783
9bf05444
FB
784When using the built-in TFTP server, the router is also the TFTP
785server.
786
c8c6afa8
TH
787When using the @option{'-netdev user,hostfwd=...'} option, TCP or UDP
788connections can be redirected from the host to the guest. It allows for
789example to redirect X11, telnet or SSH connections.
443f1376 790
0e0266c2
TH
791@subsection Hubs
792
793QEMU can simulate several hubs. A hub can be thought of as a virtual connection
794between several network devices. These devices can be for example QEMU virtual
795ethernet cards or virtual Host ethernet devices (TAP devices). You can connect
796guest NICs or host network backends to such a hub using the @option{-netdev
797hubport} or @option{-nic hubport} options. The legacy @option{-net} option
798also connects the given device to the emulated hub with ID 0 (i.e. the default
799hub) unless you specify a netdev with @option{-net nic,netdev=xxx} here.
41d03949 800
0e0266c2 801@subsection Connecting emulated networks between QEMU instances
41d03949 802
0e0266c2
TH
803Using the @option{-netdev socket} (or @option{-nic socket} or
804@option{-net socket}) option, it is possible to create emulated
805networks that span several QEMU instances.
806See the description of the @option{-netdev socket} option in the
807@ref{sec_invocation,,Invocation chapter} to have a basic example.
41d03949 808
576fd0a1 809@node pcsys_other_devs
6cbf4c8c
CM
810@section Other Devices
811
812@subsection Inter-VM Shared Memory device
813
5400c02b
MA
814On Linux hosts, a shared memory device is available. The basic syntax
815is:
6cbf4c8c
CM
816
817@example
664785ac 818@value{qemu_system_x86} -device ivshmem-plain,memdev=@var{hostmem}
5400c02b
MA
819@end example
820
821where @var{hostmem} names a host memory backend. For a POSIX shared
822memory backend, use something like
823
824@example
825-object memory-backend-file,size=1M,share,mem-path=/dev/shm/ivshmem,id=@var{hostmem}
6cbf4c8c
CM
826@end example
827
828If desired, interrupts can be sent between guest VMs accessing the same shared
829memory region. Interrupt support requires using a shared memory server and
830using a chardev socket to connect to it. The code for the shared memory server
831is qemu.git/contrib/ivshmem-server. An example syntax when using the shared
832memory server is:
833
834@example
a75eb03b 835# First start the ivshmem server once and for all
50d34c4e 836ivshmem-server -p @var{pidfile} -S @var{path} -m @var{shm-name} -l @var{shm-size} -n @var{vectors}
a75eb03b
DM
837
838# Then start your qemu instances with matching arguments
664785ac 839@value{qemu_system_x86} -device ivshmem-doorbell,vectors=@var{vectors},chardev=@var{id}
50d34c4e 840 -chardev socket,path=@var{path},id=@var{id}
6cbf4c8c
CM
841@end example
842
843When using the server, the guest will be assigned a VM ID (>=0) that allows guests
844using the same server to communicate via interrupts. Guests can read their
1309cf44 845VM ID from a device register (see ivshmem-spec.txt).
6cbf4c8c 846
62a830b6
MA
847@subsubsection Migration with ivshmem
848
5400c02b
MA
849With device property @option{master=on}, the guest will copy the shared
850memory on migration to the destination host. With @option{master=off},
851the guest will not be able to migrate with the device attached. In the
852latter case, the device should be detached and then reattached after
853migration using the PCI hotplug support.
6cbf4c8c 854
62a830b6
MA
855At most one of the devices sharing the same memory can be master. The
856master must complete migration before you plug back the other devices.
857
7d4f4bda
MAL
858@subsubsection ivshmem and hugepages
859
860Instead of specifying the <shm size> using POSIX shm, you may specify
861a memory backend that has hugepage support:
862
863@example
664785ac 864@value{qemu_system_x86} -object memory-backend-file,size=1G,mem-path=/dev/hugepages/my-shmem-file,share,id=mb1
5400c02b 865 -device ivshmem-plain,memdev=mb1
7d4f4bda
MAL
866@end example
867
868ivshmem-server also supports hugepages mount points with the
869@option{-m} memory path argument.
870
9d4fb82e
FB
871@node direct_linux_boot
872@section Direct Linux Boot
1f673135
FB
873
874This section explains how to launch a Linux kernel inside QEMU without
875having to make a full bootable image. It is very useful for fast Linux
ee0f4751 876kernel testing.
1f673135 877
ee0f4751 878The syntax is:
1f673135 879@example
664785ac 880@value{qemu_system} -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"
1f673135
FB
881@end example
882
ee0f4751
FB
883Use @option{-kernel} to provide the Linux kernel image and
884@option{-append} to give the kernel command line arguments. The
885@option{-initrd} option can be used to provide an INITRD image.
1f673135 886
ee0f4751
FB
887If you do not need graphical output, you can disable it and redirect
888the virtual serial port and the QEMU monitor to the console with the
889@option{-nographic} option. The typical command line is:
1f673135 890@example
664785ac 891@value{qemu_system} -kernel bzImage -hda rootdisk.img \
3804da9d 892 -append "root=/dev/hda console=ttyS0" -nographic
1f673135
FB
893@end example
894
ee0f4751
FB
895Use @key{Ctrl-a c} to switch between the serial console and the
896monitor (@pxref{pcsys_keys}).
1f673135 897
debc7065 898@node pcsys_usb
b389dbfb
FB
899@section USB emulation
900
a92ff8c1
TH
901QEMU can emulate a PCI UHCI, OHCI, EHCI or XHCI USB controller. You can
902plug virtual USB devices or real host USB devices (only works with certain
903host operating systems). QEMU will automatically create and connect virtual
904USB hubs as necessary to connect multiple USB devices.
b389dbfb 905
0aff66b5
PB
906@menu
907* usb_devices::
908* host_usb_devices::
909@end menu
910@node usb_devices
911@subsection Connecting USB devices
b389dbfb 912
a92ff8c1
TH
913USB devices can be connected with the @option{-device usb-...} command line
914option or the @code{device_add} monitor command. Available devices are:
b389dbfb 915
db380c06 916@table @code
a92ff8c1 917@item usb-mouse
0aff66b5 918Virtual Mouse. This will override the PS/2 mouse emulation when activated.
a92ff8c1 919@item usb-tablet
c6d46c20 920Pointer device that uses absolute coordinates (like a touchscreen).
b65ee4fa 921This means QEMU is able to report the mouse position without having
0aff66b5 922to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
a92ff8c1
TH
923@item usb-storage,drive=@var{drive_id}
924Mass storage device backed by @var{drive_id} (@pxref{disk_images})
925@item usb-uas
926USB attached SCSI device, see
70b7fba9 927@url{https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt,usb-storage.txt}
a92ff8c1
TH
928for details
929@item usb-bot
930Bulk-only transport storage device, see
70b7fba9 931@url{https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/usb-storage.txt,usb-storage.txt}
a92ff8c1 932for details here, too
1ee53067 933@item usb-mtp,rootdir=@var{dir}
a92ff8c1
TH
934Media transfer protocol device, using @var{dir} as root of the file tree
935that is presented to the guest.
936@item usb-host,hostbus=@var{bus},hostaddr=@var{addr}
937Pass through the host device identified by @var{bus} and @var{addr}
938@item usb-host,vendorid=@var{vendor},productid=@var{product}
939Pass through the host device identified by @var{vendor} and @var{product} ID
940@item usb-wacom-tablet
f6d2a316
AZ
941Virtual Wacom PenPartner tablet. This device is similar to the @code{tablet}
942above but it can be used with the tslib library because in addition to touch
943coordinates it reports touch pressure.
a92ff8c1 944@item usb-kbd
47b2d338 945Standard USB keyboard. Will override the PS/2 keyboard (if present).
a92ff8c1 946@item usb-serial,chardev=@var{id}
db380c06 947Serial converter. This emulates an FTDI FT232BM chip connected to host character
a92ff8c1
TH
948device @var{id}.
949@item usb-braille,chardev=@var{id}
2e4d9fb1 950Braille device. This will use BrlAPI to display the braille output on a real
a92ff8c1
TH
951or fake device referenced by @var{id}.
952@item usb-net[,netdev=@var{id}]
953Network adapter that supports CDC ethernet and RNDIS protocols. @var{id}
954specifies a netdev defined with @code{-netdev @dots{},id=@var{id}}.
9ad97e65 955For instance, user-mode networking can be used with
6c9f886c 956@example
664785ac 957@value{qemu_system} [...] -netdev user,id=net0 -device usb-net,netdev=net0
6c9f886c 958@end example
a92ff8c1
TH
959@item usb-ccid
960Smartcard reader device
961@item usb-audio
962USB audio device
0aff66b5 963@end table
b389dbfb 964
0aff66b5 965@node host_usb_devices
b389dbfb
FB
966@subsection Using host USB devices on a Linux host
967
968WARNING: this is an experimental feature. QEMU will slow down when
969using it. USB devices requiring real time streaming (i.e. USB Video
970Cameras) are not supported yet.
971
972@enumerate
5fafdf24 973@item If you use an early Linux 2.4 kernel, verify that no Linux driver
b389dbfb
FB
974is actually using the USB device. A simple way to do that is simply to
975disable the corresponding kernel module by renaming it from @file{mydriver.o}
976to @file{mydriver.o.disabled}.
977
978@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
979@example
980ls /proc/bus/usb
981001 devices drivers
982@end example
983
984@item Since only root can access to the USB devices directly, you can either launch QEMU as root or change the permissions of the USB devices you want to use. For testing, the following suffices:
985@example
986chown -R myuid /proc/bus/usb
987@end example
988
989@item Launch QEMU and do in the monitor:
5fafdf24 990@example
b389dbfb
FB
991info usbhost
992 Device 1.2, speed 480 Mb/s
993 Class 00: USB device 1234:5678, USB DISK
994@end example
995You should see the list of the devices you can use (Never try to use
996hubs, it won't work).
997
998@item Add the device in QEMU by using:
5fafdf24 999@example
a92ff8c1 1000device_add usb-host,vendorid=0x1234,productid=0x5678
b389dbfb
FB
1001@end example
1002
a92ff8c1
TH
1003Normally the guest OS should report that a new USB device is plugged.
1004You can use the option @option{-device usb-host,...} to do the same.
b389dbfb
FB
1005
1006@item Now you can try to use the host USB device in QEMU.
1007
1008@end enumerate
1009
1010When relaunching QEMU, you may have to unplug and plug again the USB
1011device to make it work again (this is a bug).
1012
f858dcae
TS
1013@node vnc_security
1014@section VNC security
1015
1016The VNC server capability provides access to the graphical console
1017of the guest VM across the network. This has a number of security
1018considerations depending on the deployment scenarios.
1019
1020@menu
1021* vnc_sec_none::
1022* vnc_sec_password::
1023* vnc_sec_certificate::
1024* vnc_sec_certificate_verify::
1025* vnc_sec_certificate_pw::
2f9606b3
AL
1026* vnc_sec_sasl::
1027* vnc_sec_certificate_sasl::
2f9606b3 1028* vnc_setup_sasl::
f858dcae
TS
1029@end menu
1030@node vnc_sec_none
1031@subsection Without passwords
1032
1033The simplest VNC server setup does not include any form of authentication.
1034For this setup it is recommended to restrict it to listen on a UNIX domain
1035socket only. For example
1036
1037@example
664785ac 1038@value{qemu_system} [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc
f858dcae
TS
1039@end example
1040
1041This ensures that only users on local box with read/write access to that
1042path can access the VNC server. To securely access the VNC server from a
1043remote machine, a combination of netcat+ssh can be used to provide a secure
1044tunnel.
1045
1046@node vnc_sec_password
1047@subsection With passwords
1048
1049The VNC protocol has limited support for password based authentication. Since
1050the protocol limits passwords to 8 characters it should not be considered
1051to provide high security. The password can be fairly easily brute-forced by
1052a client making repeat connections. For this reason, a VNC server using password
1053authentication should be restricted to only listen on the loopback interface
0f66998f
PM
1054or UNIX domain sockets. Password authentication is not supported when operating
1055in FIPS 140-2 compliance mode as it requires the use of the DES cipher. Password
1056authentication is requested with the @code{password} option, and then once QEMU
1057is running the password is set with the monitor. Until the monitor is used to
1058set the password all clients will be rejected.
f858dcae
TS
1059
1060@example
664785ac 1061@value{qemu_system} [...OPTIONS...] -vnc :1,password -monitor stdio
f858dcae
TS
1062(qemu) change vnc password
1063Password: ********
1064(qemu)
1065@end example
1066
1067@node vnc_sec_certificate
1068@subsection With x509 certificates
1069
1070The QEMU VNC server also implements the VeNCrypt extension allowing use of
1071TLS for encryption of the session, and x509 certificates for authentication.
1072The use of x509 certificates is strongly recommended, because TLS on its
1073own is susceptible to man-in-the-middle attacks. Basic x509 certificate
1074support provides a secure session, but no authentication. This allows any
1075client to connect, and provides an encrypted session.
1076
1077@example
664785ac 1078@value{qemu_system} [...OPTIONS...] \
756b9da7
DB
1079 -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=no \
1080 -vnc :1,tls-creds=tls0 -monitor stdio
f858dcae
TS
1081@end example
1082
1083In the above example @code{/etc/pki/qemu} should contain at least three files,
1084@code{ca-cert.pem}, @code{server-cert.pem} and @code{server-key.pem}. Unprivileged
1085users will want to use a private directory, for example @code{$HOME/.pki/qemu}.
1086NB the @code{server-key.pem} file should be protected with file mode 0600 to
1087only be readable by the user owning it.
1088
1089@node vnc_sec_certificate_verify
1090@subsection With x509 certificates and client verification
1091
1092Certificates can also provide a means to authenticate the client connecting.
1093The server will request that the client provide a certificate, which it will
1094then validate against the CA certificate. This is a good choice if deploying
756b9da7
DB
1095in an environment with a private internal certificate authority. It uses the
1096same syntax as previously, but with @code{verify-peer} set to @code{yes}
1097instead.
f858dcae
TS
1098
1099@example
664785ac 1100@value{qemu_system} [...OPTIONS...] \
756b9da7
DB
1101 -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
1102 -vnc :1,tls-creds=tls0 -monitor stdio
f858dcae
TS
1103@end example
1104
1105
1106@node vnc_sec_certificate_pw
1107@subsection With x509 certificates, client verification and passwords
1108
1109Finally, the previous method can be combined with VNC password authentication
1110to provide two layers of authentication for clients.
1111
1112@example
664785ac 1113@value{qemu_system} [...OPTIONS...] \
756b9da7
DB
1114 -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
1115 -vnc :1,tls-creds=tls0,password -monitor stdio
f858dcae
TS
1116(qemu) change vnc password
1117Password: ********
1118(qemu)
1119@end example
1120
2f9606b3
AL
1121
1122@node vnc_sec_sasl
1123@subsection With SASL authentication
1124
1125The SASL authentication method is a VNC extension, that provides an
1126easily extendable, pluggable authentication method. This allows for
1127integration with a wide range of authentication mechanisms, such as
1128PAM, GSSAPI/Kerberos, LDAP, SQL databases, one-time keys and more.
1129The strength of the authentication depends on the exact mechanism
1130configured. If the chosen mechanism also provides a SSF layer, then
1131it will encrypt the datastream as well.
1132
1133Refer to the later docs on how to choose the exact SASL mechanism
1134used for authentication, but assuming use of one supporting SSF,
1135then QEMU can be launched with:
1136
1137@example
664785ac 1138@value{qemu_system} [...OPTIONS...] -vnc :1,sasl -monitor stdio
2f9606b3
AL
1139@end example
1140
1141@node vnc_sec_certificate_sasl
1142@subsection With x509 certificates and SASL authentication
1143
1144If the desired SASL authentication mechanism does not supported
1145SSF layers, then it is strongly advised to run it in combination
1146with TLS and x509 certificates. This provides securely encrypted
1147data stream, avoiding risk of compromising of the security
1148credentials. This can be enabled, by combining the 'sasl' option
1149with the aforementioned TLS + x509 options:
1150
1151@example
664785ac 1152@value{qemu_system} [...OPTIONS...] \
756b9da7
DB
1153 -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
1154 -vnc :1,tls-creds=tls0,sasl -monitor stdio
2f9606b3
AL
1155@end example
1156
5d19a6ea
DB
1157@node vnc_setup_sasl
1158
1159@subsection Configuring SASL mechanisms
1160
1161The following documentation assumes use of the Cyrus SASL implementation on a
1162Linux host, but the principles should apply to any other SASL implementation
1163or host. When SASL is enabled, the mechanism configuration will be loaded from
1164system default SASL service config /etc/sasl2/qemu.conf. If running QEMU as an
1165unprivileged user, an environment variable SASL_CONF_PATH can be used to make
1166it search alternate locations for the service config file.
1167
1168If the TLS option is enabled for VNC, then it will provide session encryption,
1169otherwise the SASL mechanism will have to provide encryption. In the latter
1170case the list of possible plugins that can be used is drastically reduced. In
1171fact only the GSSAPI SASL mechanism provides an acceptable level of security
1172by modern standards. Previous versions of QEMU referred to the DIGEST-MD5
1173mechanism, however, it has multiple serious flaws described in detail in
1174RFC 6331 and thus should never be used any more. The SCRAM-SHA-1 mechanism
1175provides a simple username/password auth facility similar to DIGEST-MD5, but
1176does not support session encryption, so can only be used in combination with
1177TLS.
2f9606b3 1178
5d19a6ea 1179When not using TLS the recommended configuration is
f858dcae 1180
5d19a6ea
DB
1181@example
1182mech_list: gssapi
1183keytab: /etc/qemu/krb5.tab
1184@end example
1185
1186This says to use the 'GSSAPI' mechanism with the Kerberos v5 protocol, with
1187the server principal stored in /etc/qemu/krb5.tab. For this to work the
1188administrator of your KDC must generate a Kerberos principal for the server,
1189with a name of 'qemu/somehost.example.com@@EXAMPLE.COM' replacing
1190'somehost.example.com' with the fully qualified host name of the machine
1191running QEMU, and 'EXAMPLE.COM' with the Kerberos Realm.
1192
1193When using TLS, if username+password authentication is desired, then a
1194reasonable configuration is
1195
1196@example
1197mech_list: scram-sha-1
1198sasldb_path: /etc/qemu/passwd.db
1199@end example
1200
1201The @code{saslpasswd2} program can be used to populate the @code{passwd.db}
1202file with accounts.
1203
1204Other SASL configurations will be left as an exercise for the reader. Note that
1205all mechanisms, except GSSAPI, should be combined with use of TLS to ensure a
1206secure data channel.
1207
1208
1209@node network_tls
1210@section TLS setup for network services
1211
1212Almost all network services in QEMU have the ability to use TLS for
1213session data encryption, along with x509 certificates for simple
1214client authentication. What follows is a description of how to
1215generate certificates suitable for usage with QEMU, and applies to
1216the VNC server, character devices with the TCP backend, NBD server
1217and client, and migration server and client.
1218
1219At a high level, QEMU requires certificates and private keys to be
1220provided in PEM format. Aside from the core fields, the certificates
1221should include various extension data sets, including v3 basic
1222constraints data, key purpose, key usage and subject alt name.
1223
1224The GnuTLS package includes a command called @code{certtool} which can
1225be used to easily generate certificates and keys in the required format
1226with expected data present. Alternatively a certificate management
1227service may be used.
1228
1229At a minimum it is necessary to setup a certificate authority, and
1230issue certificates to each server. If using x509 certificates for
1231authentication, then each client will also need to be issued a
1232certificate.
1233
1234Assuming that the QEMU network services will only ever be exposed to
1235clients on a private intranet, there is no need to use a commercial
1236certificate authority to create certificates. A self-signed CA is
1237sufficient, and in fact likely to be more secure since it removes
1238the ability of malicious 3rd parties to trick the CA into mis-issuing
1239certs for impersonating your services. The only likely exception
1240where a commercial CA might be desirable is if enabling the VNC
1241websockets server and exposing it directly to remote browser clients.
1242In such a case it might be useful to use a commercial CA to avoid
1243needing to install custom CA certs in the web browsers.
1244
1245The recommendation is for the server to keep its certificates in either
1246@code{/etc/pki/qemu} or for unprivileged users in @code{$HOME/.pki/qemu}.
f858dcae
TS
1247
1248@menu
5d19a6ea
DB
1249* tls_generate_ca::
1250* tls_generate_server::
1251* tls_generate_client::
1252* tls_creds_setup::
e1a6dc91 1253* tls_psk::
f858dcae 1254@end menu
5d19a6ea
DB
1255@node tls_generate_ca
1256@subsection Setup the Certificate Authority
f858dcae
TS
1257
1258This step only needs to be performed once per organization / organizational
1259unit. First the CA needs a private key. This key must be kept VERY secret
1260and secure. If this key is compromised the entire trust chain of the certificates
1261issued with it is lost.
1262
1263@example
1264# certtool --generate-privkey > ca-key.pem
1265@end example
1266
5d19a6ea
DB
1267To generate a self-signed certificate requires one core piece of information,
1268the name of the organization. A template file @code{ca.info} should be
1269populated with the desired data to avoid having to deal with interactive
1270prompts from certtool:
f858dcae
TS
1271@example
1272# cat > ca.info <<EOF
1273cn = Name of your organization
1274ca
1275cert_signing_key
1276EOF
1277# certtool --generate-self-signed \
1278 --load-privkey ca-key.pem
1279 --template ca.info \
1280 --outfile ca-cert.pem
1281@end example
1282
5d19a6ea
DB
1283The @code{ca} keyword in the template sets the v3 basic constraints extension
1284to indicate this certificate is for a CA, while @code{cert_signing_key} sets
1285the key usage extension to indicate this will be used for signing other keys.
1286The generated @code{ca-cert.pem} file should be copied to all servers and
1287clients wishing to utilize TLS support in the VNC server. The @code{ca-key.pem}
1288must not be disclosed/copied anywhere except the host responsible for issuing
1289certificates.
f858dcae 1290
5d19a6ea
DB
1291@node tls_generate_server
1292@subsection Issuing server certificates
f858dcae
TS
1293
1294Each server (or host) needs to be issued with a key and certificate. When connecting
1295the certificate is sent to the client which validates it against the CA certificate.
5d19a6ea
DB
1296The core pieces of information for a server certificate are the hostnames and/or IP
1297addresses that will be used by clients when connecting. The hostname / IP address
1298that the client specifies when connecting will be validated against the hostname(s)
1299and IP address(es) recorded in the server certificate, and if no match is found
1300the client will close the connection.
1301
1302Thus it is recommended that the server certificate include both the fully qualified
1303and unqualified hostnames. If the server will have permanently assigned IP address(es),
1304and clients are likely to use them when connecting, they may also be included in the
1305certificate. Both IPv4 and IPv6 addresses are supported. Historically certificates
1306only included 1 hostname in the @code{CN} field, however, usage of this field for
1307validation is now deprecated. Instead modern TLS clients will validate against the
1308Subject Alt Name extension data, which allows for multiple entries. In the future
1309usage of the @code{CN} field may be discontinued entirely, so providing SAN
1310extension data is strongly recommended.
1311
1312On the host holding the CA, create template files containing the information
1313for each server, and use it to issue server certificates.
f858dcae
TS
1314
1315@example
5d19a6ea 1316# cat > server-hostNNN.info <<EOF
f858dcae 1317organization = Name of your organization
5d19a6ea
DB
1318cn = hostNNN.foo.example.com
1319dns_name = hostNNN
1320dns_name = hostNNN.foo.example.com
1321ip_address = 10.0.1.87
1322ip_address = 192.8.0.92
1323ip_address = 2620:0:cafe::87
1324ip_address = 2001:24::92
f858dcae
TS
1325tls_www_server
1326encryption_key
1327signing_key
1328EOF
5d19a6ea 1329# certtool --generate-privkey > server-hostNNN-key.pem
f858dcae
TS
1330# certtool --generate-certificate \
1331 --load-ca-certificate ca-cert.pem \
1332 --load-ca-privkey ca-key.pem \
5d19a6ea
DB
1333 --load-privkey server-hostNNN-key.pem \
1334 --template server-hostNNN.info \
1335 --outfile server-hostNNN-cert.pem
f858dcae
TS
1336@end example
1337
5d19a6ea
DB
1338The @code{dns_name} and @code{ip_address} fields in the template are setting
1339the subject alt name extension data. The @code{tls_www_server} keyword is the
1340key purpose extension to indicate this certificate is intended for usage in
1341a web server. Although QEMU network services are not in fact HTTP servers
1342(except for VNC websockets), setting this key purpose is still recommended.
1343The @code{encryption_key} and @code{signing_key} keyword is the key usage
1344extension to indicate this certificate is intended for usage in the data
1345session.
1346
1347The @code{server-hostNNN-key.pem} and @code{server-hostNNN-cert.pem} files
1348should now be securely copied to the server for which they were generated,
1349and renamed to @code{server-key.pem} and @code{server-cert.pem} when added
1350to the @code{/etc/pki/qemu} directory on the target host. The @code{server-key.pem}
1351file is security sensitive and should be kept protected with file mode 0600
1352to prevent disclosure.
1353
1354@node tls_generate_client
1355@subsection Issuing client certificates
f858dcae 1356
5d19a6ea
DB
1357The QEMU x509 TLS credential setup defaults to enabling client verification
1358using certificates, providing a simple authentication mechanism. If this
1359default is used, each client also needs to be issued a certificate. The client
1360certificate contains enough metadata to uniquely identify the client with the
1361scope of the certificate authority. The client certificate would typically
1362include fields for organization, state, city, building, etc.
1363
1364Once again on the host holding the CA, create template files containing the
1365information for each client, and use it to issue client certificates.
f858dcae 1366
f858dcae
TS
1367
1368@example
5d19a6ea 1369# cat > client-hostNNN.info <<EOF
f858dcae
TS
1370country = GB
1371state = London
5d19a6ea 1372locality = City Of London
63c693f8 1373organization = Name of your organization
5d19a6ea 1374cn = hostNNN.foo.example.com
f858dcae
TS
1375tls_www_client
1376encryption_key
1377signing_key
1378EOF
5d19a6ea 1379# certtool --generate-privkey > client-hostNNN-key.pem
f858dcae
TS
1380# certtool --generate-certificate \
1381 --load-ca-certificate ca-cert.pem \
1382 --load-ca-privkey ca-key.pem \
5d19a6ea
DB
1383 --load-privkey client-hostNNN-key.pem \
1384 --template client-hostNNN.info \
1385 --outfile client-hostNNN-cert.pem
f858dcae
TS
1386@end example
1387
5d19a6ea
DB
1388The subject alt name extension data is not required for clients, so the
1389the @code{dns_name} and @code{ip_address} fields are not included.
1390The @code{tls_www_client} keyword is the key purpose extension to indicate
1391this certificate is intended for usage in a web client. Although QEMU
1392network clients are not in fact HTTP clients, setting this key purpose is
1393still recommended. The @code{encryption_key} and @code{signing_key} keyword
1394is the key usage extension to indicate this certificate is intended for
1395usage in the data session.
1396
1397The @code{client-hostNNN-key.pem} and @code{client-hostNNN-cert.pem} files
1398should now be securely copied to the client for which they were generated,
1399and renamed to @code{client-key.pem} and @code{client-cert.pem} when added
1400to the @code{/etc/pki/qemu} directory on the target host. The @code{client-key.pem}
1401file is security sensitive and should be kept protected with file mode 0600
1402to prevent disclosure.
1403
1404If a single host is going to be using TLS in both a client and server
1405role, it is possible to create a single certificate to cover both roles.
1406This would be quite common for the migration and NBD services, where a
1407QEMU process will be started by accepting a TLS protected incoming migration,
1408and later itself be migrated out to another host. To generate a single
1409certificate, simply include the template data from both the client and server
1410instructions in one.
2f9606b3 1411
5d19a6ea
DB
1412@example
1413# cat > both-hostNNN.info <<EOF
1414country = GB
1415state = London
1416locality = City Of London
1417organization = Name of your organization
1418cn = hostNNN.foo.example.com
1419dns_name = hostNNN
1420dns_name = hostNNN.foo.example.com
1421ip_address = 10.0.1.87
1422ip_address = 192.8.0.92
1423ip_address = 2620:0:cafe::87
1424ip_address = 2001:24::92
1425tls_www_server
1426tls_www_client
1427encryption_key
1428signing_key
1429EOF
1430# certtool --generate-privkey > both-hostNNN-key.pem
1431# certtool --generate-certificate \
1432 --load-ca-certificate ca-cert.pem \
1433 --load-ca-privkey ca-key.pem \
1434 --load-privkey both-hostNNN-key.pem \
1435 --template both-hostNNN.info \
1436 --outfile both-hostNNN-cert.pem
1437@end example
c6a9a9f5 1438
5d19a6ea
DB
1439When copying the PEM files to the target host, save them twice,
1440once as @code{server-cert.pem} and @code{server-key.pem}, and
1441again as @code{client-cert.pem} and @code{client-key.pem}.
1442
1443@node tls_creds_setup
1444@subsection TLS x509 credential configuration
1445
1446QEMU has a standard mechanism for loading x509 credentials that will be
1447used for network services and clients. It requires specifying the
1448@code{tls-creds-x509} class name to the @code{--object} command line
1449argument for the system emulators. Each set of credentials loaded should
1450be given a unique string identifier via the @code{id} parameter. A single
1451set of TLS credentials can be used for multiple network backends, so VNC,
1452migration, NBD, character devices can all share the same credentials. Note,
1453however, that credentials for use in a client endpoint must be loaded
1454separately from those used in a server endpoint.
1455
1456When specifying the object, the @code{dir} parameters specifies which
1457directory contains the credential files. This directory is expected to
1458contain files with the names mentioned previously, @code{ca-cert.pem},
1459@code{server-key.pem}, @code{server-cert.pem}, @code{client-key.pem}
1460and @code{client-cert.pem} as appropriate. It is also possible to
1461include a set of pre-generated Diffie-Hellman (DH) parameters in a file
1462@code{dh-params.pem}, which can be created using the
1463@code{certtool --generate-dh-params} command. If omitted, QEMU will
1464dynamically generate DH parameters when loading the credentials.
1465
1466The @code{endpoint} parameter indicates whether the credentials will
1467be used for a network client or server, and determines which PEM
1468files are loaded.
1469
1470The @code{verify} parameter determines whether x509 certificate
1471validation should be performed. This defaults to enabled, meaning
1472clients will always validate the server hostname against the
1473certificate subject alt name fields and/or CN field. It also
1474means that servers will request that clients provide a certificate
1475and validate them. Verification should never be turned off for
1476client endpoints, however, it may be turned off for server endpoints
1477if an alternative mechanism is used to authenticate clients. For
1478example, the VNC server can use SASL to authenticate clients
1479instead.
1480
1481To load server credentials with client certificate validation
1482enabled
2f9606b3
AL
1483
1484@example
664785ac 1485@value{qemu_system} -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server
2f9606b3
AL
1486@end example
1487
5d19a6ea 1488while to load client credentials use
2f9606b3
AL
1489
1490@example
664785ac 1491@value{qemu_system} -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=client
2f9606b3
AL
1492@end example
1493
5d19a6ea
DB
1494Network services which support TLS will all have a @code{tls-creds}
1495parameter which expects the ID of the TLS credentials object. For
1496example with VNC:
2f9606b3 1497
5d19a6ea 1498@example
664785ac 1499@value{qemu_system} -vnc 0.0.0.0:0,tls-creds=tls0
5d19a6ea 1500@end example
2f9606b3 1501
e1a6dc91
RJ
1502@node tls_psk
1503@subsection TLS Pre-Shared Keys (PSK)
1504
1505Instead of using certificates, you may also use TLS Pre-Shared Keys
1506(TLS-PSK). This can be simpler to set up than certificates but is
1507less scalable.
1508
1509Use the GnuTLS @code{psktool} program to generate a @code{keys.psk}
1510file containing one or more usernames and random keys:
1511
1512@example
1513mkdir -m 0700 /tmp/keys
1514psktool -u rich -p /tmp/keys/keys.psk
1515@end example
1516
1517TLS-enabled servers such as qemu-nbd can use this directory like so:
1518
1519@example
1520qemu-nbd \
1521 -t -x / \
1522 --object tls-creds-psk,id=tls0,endpoint=server,dir=/tmp/keys \
1523 --tls-creds tls0 \
1524 image.qcow2
1525@end example
1526
1527When connecting from a qemu-based client you must specify the
1528directory containing @code{keys.psk} and an optional @var{username}
1529(defaults to ``qemu''):
1530
1531@example
1532qemu-img info \
1533 --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=rich,endpoint=client \
1534 --image-opts \
1535 file.driver=nbd,file.host=localhost,file.port=10809,file.tls-creds=tls0,file.export=/
1536@end example
1537
0806e3f6 1538@node gdb_usage
da415d54
FB
1539@section GDB usage
1540
1541QEMU has a primitive support to work with gdb, so that you can do
0806e3f6 1542'Ctrl-C' while the virtual machine is running and inspect its state.
da415d54 1543
b65ee4fa 1544In order to use gdb, launch QEMU with the '-s' option. It will wait for a
da415d54
FB
1545gdb connection:
1546@example
664785ac 1547@value{qemu_system} -s -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"
da415d54
FB
1548Connected to host network interface: tun0
1549Waiting gdb connection on port 1234
1550@end example
1551
1552Then launch gdb on the 'vmlinux' executable:
1553@example
1554> gdb vmlinux
1555@end example
1556
1557In gdb, connect to QEMU:
1558@example
6c9bf893 1559(gdb) target remote localhost:1234
da415d54
FB
1560@end example
1561
1562Then you can use gdb normally. For example, type 'c' to launch the kernel:
1563@example
1564(gdb) c
1565@end example
1566
0806e3f6
FB
1567Here are some useful tips in order to use gdb on system code:
1568
1569@enumerate
1570@item
1571Use @code{info reg} to display all the CPU registers.
1572@item
1573Use @code{x/10i $eip} to display the code at the PC position.
1574@item
1575Use @code{set architecture i8086} to dump 16 bit code. Then use
294e8637 1576@code{x/10i $cs*16+$eip} to dump the code at the PC position.
0806e3f6
FB
1577@end enumerate
1578
60897d36
EI
1579Advanced debugging options:
1580
b6af0975 1581The default single stepping behavior is step with the IRQs and timer service routines off. It is set this way because when gdb executes a single step it expects to advance beyond the current instruction. With the IRQs and timer service routines on, a single step might jump into the one of the interrupt or exception vectors instead of executing the current instruction. This means you may hit the same breakpoint a number of times before executing the instruction gdb wants to have executed. Because there are rare circumstances where you want to single step into an interrupt vector the behavior can be controlled from GDB. There are three commands you can query and set the single step behavior:
94d45e44 1582@table @code
60897d36
EI
1583@item maintenance packet qqemu.sstepbits
1584
1585This will display the MASK bits used to control the single stepping IE:
1586@example
1587(gdb) maintenance packet qqemu.sstepbits
1588sending: "qqemu.sstepbits"
1589received: "ENABLE=1,NOIRQ=2,NOTIMER=4"
1590@end example
1591@item maintenance packet qqemu.sstep
1592
1593This will display the current value of the mask used when single stepping IE:
1594@example
1595(gdb) maintenance packet qqemu.sstep
1596sending: "qqemu.sstep"
1597received: "0x7"
1598@end example
1599@item maintenance packet Qqemu.sstep=HEX_VALUE
1600
1601This will change the single step mask, so if wanted to enable IRQs on the single step, but not timers, you would use:
1602@example
1603(gdb) maintenance packet Qqemu.sstep=0x5
1604sending: "qemu.sstep=0x5"
1605received: "OK"
1606@end example
94d45e44 1607@end table
60897d36 1608
debc7065 1609@node pcsys_os_specific
1a084f3d
FB
1610@section Target OS specific information
1611
1612@subsection Linux
1613
15a34c63
FB
1614To have access to SVGA graphic modes under X11, use the @code{vesa} or
1615the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1616color depth in the guest and the host OS.
1a084f3d 1617
e3371e62
FB
1618When using a 2.6 guest Linux kernel, you should add the option
1619@code{clock=pit} on the kernel command line because the 2.6 Linux
1620kernels make very strict real time clock checks by default that QEMU
1621cannot simulate exactly.
1622
7c3fc84d
FB
1623When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1624not activated because QEMU is slower with this patch. The QEMU
1625Accelerator Module is also much slower in this case. Earlier Fedora
4be456f1 1626Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporate this
7c3fc84d
FB
1627patch by default. Newer kernels don't have it.
1628
1a084f3d
FB
1629@subsection Windows
1630
1631If you have a slow host, using Windows 95 is better as it gives the
1632best speed. Windows 2000 is also a good choice.
1633
e3371e62
FB
1634@subsubsection SVGA graphic modes support
1635
1636QEMU emulates a Cirrus Logic GD5446 Video
15a34c63
FB
1637card. All Windows versions starting from Windows 95 should recognize
1638and use this graphic card. For optimal performances, use 16 bit color
1639depth in the guest and the host OS.
1a084f3d 1640
3cb0853a
FB
1641If you are using Windows XP as guest OS and if you want to use high
1642resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
16431280x1024x16), then you should use the VESA VBE virtual graphic card
1644(option @option{-std-vga}).
1645
e3371e62
FB
1646@subsubsection CPU usage reduction
1647
1648Windows 9x does not correctly use the CPU HLT
15a34c63
FB
1649instruction. The result is that it takes host CPU cycles even when
1650idle. You can install the utility from
70b7fba9 1651@url{https://web.archive.org/web/20060212132151/http://www.user.cityline.ru/~maxamn/amnhltm.zip}
3ba34a70 1652to solve this problem. Note that no such tool is needed for NT, 2000 or XP.
1a084f3d 1653
9d0a8e6f 1654@subsubsection Windows 2000 disk full problem
e3371e62 1655
9d0a8e6f
FB
1656Windows 2000 has a bug which gives a disk full problem during its
1657installation. When installing it, use the @option{-win2k-hack} QEMU
1658option to enable a specific workaround. After Windows 2000 is
1659installed, you no longer need this option (this option slows down the
1660IDE transfers).
e3371e62 1661
6cc721cf
FB
1662@subsubsection Windows 2000 shutdown
1663
1664Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1665can. It comes from the fact that Windows 2000 does not automatically
1666use the APM driver provided by the BIOS.
1667
1668In order to correct that, do the following (thanks to Struan
1669Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1670Add/Troubleshoot a device => Add a new device & Next => No, select the
1671hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1672(again) a few times. Now the driver is installed and Windows 2000 now
5fafdf24 1673correctly instructs QEMU to shutdown at the appropriate moment.
6cc721cf
FB
1674
1675@subsubsection Share a directory between Unix and Windows
1676
c8c6afa8
TH
1677See @ref{sec_invocation} about the help of the option
1678@option{'-netdev user,smb=...'}.
6cc721cf 1679
2192c332 1680@subsubsection Windows XP security problem
e3371e62
FB
1681
1682Some releases of Windows XP install correctly but give a security
1683error when booting:
1684@example
1685A problem is preventing Windows from accurately checking the
1686license for this computer. Error code: 0x800703e6.
1687@end example
e3371e62 1688
2192c332
FB
1689The workaround is to install a service pack for XP after a boot in safe
1690mode. Then reboot, and the problem should go away. Since there is no
1691network while in safe mode, its recommended to download the full
1692installation of SP1 or SP2 and transfer that via an ISO or using the
1693vvfat block device ("-hdb fat:directory_which_holds_the_SP").
e3371e62 1694
a0a821a4
FB
1695@subsection MS-DOS and FreeDOS
1696
1697@subsubsection CPU usage reduction
1698
1699DOS does not correctly use the CPU HLT instruction. The result is that
3ba34a70 1700it takes host CPU cycles even when idle. You can install the utility from
70b7fba9 1701@url{https://web.archive.org/web/20051222085335/http://www.vmware.com/software/dosidle210.zip}
3ba34a70 1702to solve this problem.
a0a821a4 1703
debc7065 1704@node QEMU System emulator for non PC targets
3f9f3aa1
FB
1705@chapter QEMU System emulator for non PC targets
1706
1707QEMU is a generic emulator and it emulates many non PC
1708machines. Most of the options are similar to the PC emulator. The
4be456f1 1709differences are mentioned in the following sections.
3f9f3aa1 1710
debc7065 1711@menu
7544a042 1712* PowerPC System emulator::
24d4de45
TS
1713* Sparc32 System emulator::
1714* Sparc64 System emulator::
1715* MIPS System emulator::
1716* ARM System emulator::
1717* ColdFire System emulator::
7544a042
SW
1718* Cris System emulator::
1719* Microblaze System emulator::
1720* SH4 System emulator::
3aeaea65 1721* Xtensa System emulator::
debc7065
FB
1722@end menu
1723
7544a042
SW
1724@node PowerPC System emulator
1725@section PowerPC System emulator
1726@cindex system emulation (PowerPC)
1a084f3d 1727
b2ce76a0 1728Use the executable @file{qemu-system-ppc} to simulate a complete 40P (PREP)
15a34c63 1729or PowerMac PowerPC system.
1a084f3d 1730
b671f9ed 1731QEMU emulates the following PowerMac peripherals:
1a084f3d 1732
15a34c63 1733@itemize @minus
5fafdf24 1734@item
006f3a48 1735UniNorth or Grackle PCI Bridge
15a34c63
FB
1736@item
1737PCI VGA compatible card with VESA Bochs Extensions
5fafdf24 1738@item
15a34c63 17392 PMAC IDE interfaces with hard disk and CD-ROM support
5fafdf24 1740@item
15a34c63
FB
1741NE2000 PCI adapters
1742@item
1743Non Volatile RAM
1744@item
1745VIA-CUDA with ADB keyboard and mouse.
1a084f3d
FB
1746@end itemize
1747
b2ce76a0 1748QEMU emulates the following 40P (PREP) peripherals:
52c00a5f
FB
1749
1750@itemize @minus
5fafdf24 1751@item
15a34c63
FB
1752PCI Bridge
1753@item
1754PCI VGA compatible card with VESA Bochs Extensions
5fafdf24 1755@item
52c00a5f
FB
17562 IDE interfaces with hard disk and CD-ROM support
1757@item
1758Floppy disk
5fafdf24 1759@item
b2ce76a0 1760PCnet network adapters
52c00a5f
FB
1761@item
1762Serial port
1763@item
1764PREP Non Volatile RAM
15a34c63
FB
1765@item
1766PC compatible keyboard and mouse.
52c00a5f
FB
1767@end itemize
1768
70b7fba9 1769Since version 0.9.1, QEMU uses OpenBIOS @url{https://www.openbios.org/}
b2ce76a0
TH
1770for the g3beige and mac99 PowerMac and the 40p machines. OpenBIOS is a free
1771(GPL v2) portable firmware implementation. The goal is to implement a 100%
006f3a48 1772IEEE 1275-1994 (referred to as Open Firmware) compliant firmware.
992e5acd 1773
15a34c63
FB
1774@c man begin OPTIONS
1775
1776The following options are specific to the PowerPC emulation:
1777
1778@table @option
1779
4e257e5e 1780@item -g @var{W}x@var{H}[x@var{DEPTH}]
15a34c63 1781
340fb41b 1782Set the initial VGA graphic mode. The default is 800x600x32.
15a34c63 1783
4e257e5e 1784@item -prom-env @var{string}
95efd11c
BS
1785
1786Set OpenBIOS variables in NVRAM, for example:
1787
1788@example
1789qemu-system-ppc -prom-env 'auto-boot?=false' \
1790 -prom-env 'boot-device=hd:2,\yaboot' \
1791 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
1792@end example
1793
15a34c63
FB
1794@end table
1795
5fafdf24 1796@c man end
15a34c63
FB
1797
1798
52c00a5f 1799More information is available at
3f9f3aa1 1800@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
52c00a5f 1801
24d4de45
TS
1802@node Sparc32 System emulator
1803@section Sparc32 System emulator
7544a042 1804@cindex system emulation (Sparc32)
e80cfcfc 1805
34a3d239
BS
1806Use the executable @file{qemu-system-sparc} to simulate the following
1807Sun4m architecture machines:
1808@itemize @minus
1809@item
1810SPARCstation 4
1811@item
1812SPARCstation 5
1813@item
1814SPARCstation 10
1815@item
1816SPARCstation 20
1817@item
1818SPARCserver 600MP
1819@item
1820SPARCstation LX
1821@item
1822SPARCstation Voyager
1823@item
1824SPARCclassic
1825@item
1826SPARCbook
1827@end itemize
1828
1829The emulation is somewhat complete. SMP up to 16 CPUs is supported,
1830but Linux limits the number of usable CPUs to 4.
e80cfcfc 1831
6a4e1771 1832QEMU emulates the following sun4m peripherals:
e80cfcfc
FB
1833
1834@itemize @minus
3475187d 1835@item
6a4e1771 1836IOMMU
e80cfcfc 1837@item
33632788 1838TCX or cgthree Frame buffer
5fafdf24 1839@item
e80cfcfc
FB
1840Lance (Am7990) Ethernet
1841@item
34a3d239 1842Non Volatile RAM M48T02/M48T08
e80cfcfc 1843@item
3475187d
FB
1844Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1845and power/reset logic
1846@item
1847ESP SCSI controller with hard disk and CD-ROM support
1848@item
6a3b9cc9 1849Floppy drive (not on SS-600MP)
a2502b58
BS
1850@item
1851CS4231 sound device (only on SS-5, not working yet)
e80cfcfc
FB
1852@end itemize
1853
6a3b9cc9
BS
1854The number of peripherals is fixed in the architecture. Maximum
1855memory size depends on the machine type, for SS-5 it is 256MB and for
7d85892b 1856others 2047MB.
3475187d 1857
30a604f3 1858Since version 0.8.2, QEMU uses OpenBIOS
70b7fba9 1859@url{https://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
0986ac3b
FB
1860firmware implementation. The goal is to implement a 100% IEEE
18611275-1994 (referred to as Open Firmware) compliant firmware.
3475187d
FB
1862
1863A sample Linux 2.6 series kernel and ram disk image are available on
34a3d239 1864the QEMU web site. There are still issues with NetBSD and OpenBSD, but
9bb9f217 1865most kernel versions work. Please note that currently older Solaris kernels
34a3d239
BS
1866don't work probably due to interface issues between OpenBIOS and
1867Solaris.
3475187d
FB
1868
1869@c man begin OPTIONS
1870
a2502b58 1871The following options are specific to the Sparc32 emulation:
3475187d
FB
1872
1873@table @option
1874
4e257e5e 1875@item -g @var{W}x@var{H}x[x@var{DEPTH}]
3475187d 1876
33632788
MCA
1877Set the initial graphics mode. For TCX, the default is 1024x768x8 with the
1878option of 1024x768x24. For cgthree, the default is 1024x768x8 with the option
1879of 1152x900x8 for people who wish to use OBP.
3475187d 1880
4e257e5e 1881@item -prom-env @var{string}
66508601
BS
1882
1883Set OpenBIOS variables in NVRAM, for example:
1884
1885@example
1886qemu-system-sparc -prom-env 'auto-boot?=false' \
1887 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
1888@end example
1889
6a4e1771 1890@item -M [SS-4|SS-5|SS-10|SS-20|SS-600MP|LX|Voyager|SPARCClassic] [|SPARCbook]
a2502b58
BS
1891
1892Set the emulated machine type. Default is SS-5.
1893
3475187d
FB
1894@end table
1895
5fafdf24 1896@c man end
3475187d 1897
24d4de45
TS
1898@node Sparc64 System emulator
1899@section Sparc64 System emulator
7544a042 1900@cindex system emulation (Sparc64)
e80cfcfc 1901
34a3d239
BS
1902Use the executable @file{qemu-system-sparc64} to simulate a Sun4u
1903(UltraSPARC PC-like machine), Sun4v (T1 PC-like machine), or generic
9bb9f217
MCA
1904Niagara (T1) machine. The Sun4u emulator is mostly complete, being
1905able to run Linux, NetBSD and OpenBSD in headless (-nographic) mode. The
a2664ca0
AT
1906Sun4v emulator is still a work in progress.
1907
1908The Niagara T1 emulator makes use of firmware and OS binaries supplied in the S10image/ directory
1909of the OpenSPARC T1 project @url{http://download.oracle.com/technetwork/systems/opensparc/OpenSPARCT1_Arch.1.5.tar.bz2}
1910and is able to boot the disk.s10hw2 Solaris image.
1911@example
1912qemu-system-sparc64 -M niagara -L /path-to/S10image/ \
1913 -nographic -m 256 \
1914 -drive if=pflash,readonly=on,file=/S10image/disk.s10hw2
1915@end example
1916
b756921a 1917
c7ba218d 1918QEMU emulates the following peripherals:
83469015
FB
1919
1920@itemize @minus
1921@item
5fafdf24 1922UltraSparc IIi APB PCI Bridge
83469015
FB
1923@item
1924PCI VGA compatible card with VESA Bochs Extensions
1925@item
34a3d239
BS
1926PS/2 mouse and keyboard
1927@item
83469015
FB
1928Non Volatile RAM M48T59
1929@item
1930PC-compatible serial ports
c7ba218d
BS
1931@item
19322 PCI IDE interfaces with hard disk and CD-ROM support
34a3d239
BS
1933@item
1934Floppy disk
83469015
FB
1935@end itemize
1936
c7ba218d
BS
1937@c man begin OPTIONS
1938
1939The following options are specific to the Sparc64 emulation:
1940
1941@table @option
1942
4e257e5e 1943@item -prom-env @var{string}
34a3d239
BS
1944
1945Set OpenBIOS variables in NVRAM, for example:
1946
1947@example
1948qemu-system-sparc64 -prom-env 'auto-boot?=false'
1949@end example
1950
a2664ca0 1951@item -M [sun4u|sun4v|niagara]
c7ba218d
BS
1952
1953Set the emulated machine type. The default is sun4u.
1954
1955@end table
1956
1957@c man end
1958
24d4de45
TS
1959@node MIPS System emulator
1960@section MIPS System emulator
7544a042 1961@cindex system emulation (MIPS)
9d0a8e6f 1962
f7d257cb
SM
1963@menu
1964* nanoMIPS System emulator ::
1965@end menu
1966
d9aedc32
TS
1967Four executables cover simulation of 32 and 64-bit MIPS systems in
1968both endian options, @file{qemu-system-mips}, @file{qemu-system-mipsel}
1969@file{qemu-system-mips64} and @file{qemu-system-mips64el}.
88cb0a02 1970Five different machine types are emulated:
24d4de45
TS
1971
1972@itemize @minus
1973@item
1974A generic ISA PC-like machine "mips"
1975@item
1976The MIPS Malta prototype board "malta"
1977@item
d9aedc32 1978An ACER Pica "pica61". This machine needs the 64-bit emulator.
6bf5b4e8 1979@item
f0fc6f8f 1980MIPS emulator pseudo board "mipssim"
88cb0a02
AJ
1981@item
1982A MIPS Magnum R4000 machine "magnum". This machine needs the 64-bit emulator.
24d4de45
TS
1983@end itemize
1984
1985The generic emulation is supported by Debian 'Etch' and is able to
1986install Debian into a virtual disk image. The following devices are
1987emulated:
3f9f3aa1
FB
1988
1989@itemize @minus
5fafdf24 1990@item
6bf5b4e8 1991A range of MIPS CPUs, default is the 24Kf
3f9f3aa1
FB
1992@item
1993PC style serial port
1994@item
24d4de45
TS
1995PC style IDE disk
1996@item
3f9f3aa1
FB
1997NE2000 network card
1998@end itemize
1999
24d4de45
TS
2000The Malta emulation supports the following devices:
2001
2002@itemize @minus
2003@item
0b64d008 2004Core board with MIPS 24Kf CPU and Galileo system controller
24d4de45
TS
2005@item
2006PIIX4 PCI/USB/SMbus controller
2007@item
2008The Multi-I/O chip's serial device
2009@item
3a2eeac0 2010PCI network cards (PCnet32 and others)
24d4de45
TS
2011@item
2012Malta FPGA serial device
2013@item
1f605a76 2014Cirrus (default) or any other PCI VGA graphics card
24d4de45
TS
2015@end itemize
2016
ba182a18
AM
2017The Boston board emulation supports the following devices:
2018
2019@itemize @minus
2020@item
2021Xilinx FPGA, which includes a PCIe root port and an UART
2022@item
2023Intel EG20T PCH connects the I/O peripherals, but only the SATA bus is emulated
2024@end itemize
2025
24d4de45
TS
2026The ACER Pica emulation supports:
2027
2028@itemize @minus
2029@item
2030MIPS R4000 CPU
2031@item
2032PC-style IRQ and DMA controllers
2033@item
2034PC Keyboard
2035@item
2036IDE controller
2037@end itemize
3f9f3aa1 2038
88cb0a02
AJ
2039The MIPS Magnum R4000 emulation supports:
2040
2041@itemize @minus
2042@item
2043MIPS R4000 CPU
2044@item
2045PC-style IRQ controller
2046@item
2047PC Keyboard
2048@item
2049SCSI controller
2050@item
2051G364 framebuffer
2052@end itemize
2053
3a1b94d9
AM
2054The Fulong 2E emulation supports:
2055
2056@itemize @minus
2057@item
2058Loongson 2E CPU
2059@item
2060Bonito64 system controller as North Bridge
2061@item
2062VT82C686 chipset as South Bridge
2063@item
2064RTL8139D as a network card chipset
2065@end itemize
2066
53d21e7b
AM
2067The mipssim pseudo board emulation provides an environment similar
2068to what the proprietary MIPS emulator uses for running Linux.
2069It supports:
2070
2071@itemize @minus
2072@item
2073A range of MIPS CPUs, default is the 24Kf
2074@item
2075PC style serial port
2076@item
2077MIPSnet network emulation
2078@end itemize
2079
f7d257cb
SM
2080@node nanoMIPS System emulator
2081@subsection nanoMIPS System emulator
2082@cindex system emulation (nanoMIPS)
2083
2084Executable @file{qemu-system-mipsel} also covers simulation of
208532-bit nanoMIPS system in little endian mode:
2086
2087@itemize @minus
2088@item
2089nanoMIPS I7200 CPU
2090@end itemize
2091
2092Example of @file{qemu-system-mipsel} usage for nanoMIPS is shown below:
2093
2094Download @code{<disk_image_file>} from @url{https://mipsdistros.mips.com/LinuxDistro/nanomips/buildroot/index.html}.
2095
2096Download @code{<kernel_image_file>} from @url{https://mipsdistros.mips.com/LinuxDistro/nanomips/kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/index.html}.
2097
2098Start system emulation of Malta board with nanoMIPS I7200 CPU:
2099@example
2100qemu-system-mipsel -cpu I7200 -kernel @code{<kernel_image_file>} \
2101 -M malta -serial stdio -m @code{<memory_size>} -hda @code{<disk_image_file>} \
2102 -append "mem=256m@@0x0 rw console=ttyS0 vga=cirrus vesa=0x111 root=/dev/sda"
2103@end example
2104
88cb0a02 2105
24d4de45
TS
2106@node ARM System emulator
2107@section ARM System emulator
7544a042 2108@cindex system emulation (ARM)
3f9f3aa1
FB
2109
2110Use the executable @file{qemu-system-arm} to simulate a ARM
2111machine. The ARM Integrator/CP board is emulated with the following
2112devices:
2113
2114@itemize @minus
2115@item
9ee6e8bb 2116ARM926E, ARM1026E, ARM946E, ARM1136 or Cortex-A8 CPU
3f9f3aa1
FB
2117@item
2118Two PL011 UARTs
5fafdf24 2119@item
3f9f3aa1 2120SMC 91c111 Ethernet adapter
00a9bf19
PB
2121@item
2122PL110 LCD controller
2123@item
2124PL050 KMI with PS/2 keyboard and mouse.
a1bb27b1
PB
2125@item
2126PL181 MultiMedia Card Interface with SD card.
00a9bf19
PB
2127@end itemize
2128
2129The ARM Versatile baseboard is emulated with the following devices:
2130
2131@itemize @minus
2132@item
9ee6e8bb 2133ARM926E, ARM1136 or Cortex-A8 CPU
00a9bf19
PB
2134@item
2135PL190 Vectored Interrupt Controller
2136@item
2137Four PL011 UARTs
5fafdf24 2138@item
00a9bf19
PB
2139SMC 91c111 Ethernet adapter
2140@item
2141PL110 LCD controller
2142@item
2143PL050 KMI with PS/2 keyboard and mouse.
2144@item
2145PCI host bridge. Note the emulated PCI bridge only provides access to
2146PCI memory space. It does not provide access to PCI IO space.
4be456f1
TS
2147This means some devices (eg. ne2k_pci NIC) are not usable, and others
2148(eg. rtl8139 NIC) are only usable when the guest drivers use the memory
00a9bf19 2149mapped control registers.
e6de1bad
PB
2150@item
2151PCI OHCI USB controller.
2152@item
2153LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
a1bb27b1
PB
2154@item
2155PL181 MultiMedia Card Interface with SD card.
3f9f3aa1
FB
2156@end itemize
2157
21a88941
PB
2158Several variants of the ARM RealView baseboard are emulated,
2159including the EB, PB-A8 and PBX-A9. Due to interactions with the
2160bootloader, only certain Linux kernel configurations work out
2161of the box on these boards.
2162
2163Kernels for the PB-A8 board should have CONFIG_REALVIEW_HIGH_PHYS_OFFSET
2164enabled in the kernel, and expect 512M RAM. Kernels for The PBX-A9 board
2165should have CONFIG_SPARSEMEM enabled, CONFIG_REALVIEW_HIGH_PHYS_OFFSET
2166disabled and expect 1024M RAM.
2167
40c5c6cd 2168The following devices are emulated:
d7739d75
PB
2169
2170@itemize @minus
2171@item
f7c70325 2172ARM926E, ARM1136, ARM11MPCore, Cortex-A8 or Cortex-A9 MPCore CPU
d7739d75
PB
2173@item
2174ARM AMBA Generic/Distributed Interrupt Controller
2175@item
2176Four PL011 UARTs
5fafdf24 2177@item
0ef849d7 2178SMC 91c111 or SMSC LAN9118 Ethernet adapter
d7739d75
PB
2179@item
2180PL110 LCD controller
2181@item
2182PL050 KMI with PS/2 keyboard and mouse
2183@item
2184PCI host bridge
2185@item
2186PCI OHCI USB controller
2187@item
2188LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
a1bb27b1
PB
2189@item
2190PL181 MultiMedia Card Interface with SD card.
d7739d75
PB
2191@end itemize
2192
b00052e4
AZ
2193The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
2194and "Terrier") emulation includes the following peripherals:
2195
2196@itemize @minus
2197@item
2198Intel PXA270 System-on-chip (ARM V5TE core)
2199@item
2200NAND Flash memory
2201@item
2202IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
2203@item
2204On-chip OHCI USB controller
2205@item
2206On-chip LCD controller
2207@item
2208On-chip Real Time Clock
2209@item
2210TI ADS7846 touchscreen controller on SSP bus
2211@item
2212Maxim MAX1111 analog-digital converter on I@math{^2}C bus
2213@item
2214GPIO-connected keyboard controller and LEDs
2215@item
549444e1 2216Secure Digital card connected to PXA MMC/SD host
b00052e4
AZ
2217@item
2218Three on-chip UARTs
2219@item
2220WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
2221@end itemize
2222
02645926
AZ
2223The Palm Tungsten|E PDA (codename "Cheetah") emulation includes the
2224following elements:
2225
2226@itemize @minus
2227@item
2228Texas Instruments OMAP310 System-on-chip (ARM 925T core)
2229@item
2230ROM and RAM memories (ROM firmware image can be loaded with -option-rom)
2231@item
2232On-chip LCD controller
2233@item
2234On-chip Real Time Clock
2235@item
2236TI TSC2102i touchscreen controller / analog-digital converter / Audio
2237CODEC, connected through MicroWire and I@math{^2}S busses
2238@item
2239GPIO-connected matrix keypad
2240@item
2241Secure Digital card connected to OMAP MMC/SD host
2242@item
2243Three on-chip UARTs
2244@end itemize
2245
c30bb264
AZ
2246Nokia N800 and N810 internet tablets (known also as RX-34 and RX-44 / 48)
2247emulation supports the following elements:
2248
2249@itemize @minus
2250@item
2251Texas Instruments OMAP2420 System-on-chip (ARM 1136 core)
2252@item
2253RAM and non-volatile OneNAND Flash memories
2254@item
2255Display connected to EPSON remote framebuffer chip and OMAP on-chip
2256display controller and a LS041y3 MIPI DBI-C controller
2257@item
2258TI TSC2301 (in N800) and TI TSC2005 (in N810) touchscreen controllers
2259driven through SPI bus
2260@item
2261National Semiconductor LM8323-controlled qwerty keyboard driven
2262through I@math{^2}C bus
2263@item
2264Secure Digital card connected to OMAP MMC/SD host
2265@item
2266Three OMAP on-chip UARTs and on-chip STI debugging console
2267@item
2268Mentor Graphics "Inventra" dual-role USB controller embedded in a TI
2269TUSB6010 chip - only USB host mode is supported
2270@item
2271TI TMP105 temperature sensor driven through I@math{^2}C bus
2272@item
2273TI TWL92230C power management companion with an RTC on I@math{^2}C bus
2274@item
2275Nokia RETU and TAHVO multi-purpose chips with an RTC, connected
2276through CBUS
2277@end itemize
2278
9ee6e8bb
PB
2279The Luminary Micro Stellaris LM3S811EVB emulation includes the following
2280devices:
2281
2282@itemize @minus
2283@item
2284Cortex-M3 CPU core.
2285@item
228664k Flash and 8k SRAM.
2287@item
2288Timers, UARTs, ADC and I@math{^2}C interface.
2289@item
2290OSRAM Pictiva 96x16 OLED with SSD0303 controller on I@math{^2}C bus.
2291@end itemize
2292
2293The Luminary Micro Stellaris LM3S6965EVB emulation includes the following
2294devices:
2295
2296@itemize @minus
2297@item
2298Cortex-M3 CPU core.
2299@item
2300256k Flash and 64k SRAM.
2301@item
2302Timers, UARTs, ADC, I@math{^2}C and SSI interfaces.
2303@item
2304OSRAM Pictiva 128x64 OLED with SSD0323 controller connected via SSI.
2305@end itemize
2306
57cd6e97
AZ
2307The Freecom MusicPal internet radio emulation includes the following
2308elements:
2309
2310@itemize @minus
2311@item
2312Marvell MV88W8618 ARM core.
2313@item
231432 MB RAM, 256 KB SRAM, 8 MB flash.
2315@item
2316Up to 2 16550 UARTs
2317@item
2318MV88W8xx8 Ethernet controller
2319@item
2320MV88W8618 audio controller, WM8750 CODEC and mixer
2321@item
e080e785 2322128×64 display with brightness control
57cd6e97
AZ
2323@item
23242 buttons, 2 navigation wheels with button function
2325@end itemize
2326
997641a8 2327The Siemens SX1 models v1 and v2 (default) basic emulation.
40c5c6cd 2328The emulation includes the following elements:
997641a8
AZ
2329
2330@itemize @minus
2331@item
2332Texas Instruments OMAP310 System-on-chip (ARM 925T core)
2333@item
2334ROM and RAM memories (ROM firmware image can be loaded with -pflash)
2335V1
23361 Flash of 16MB and 1 Flash of 8MB
2337V2
23381 Flash of 32MB
2339@item
2340On-chip LCD controller
2341@item
2342On-chip Real Time Clock
2343@item
2344Secure Digital card connected to OMAP MMC/SD host
2345@item
2346Three on-chip UARTs
2347@end itemize
2348
3f9f3aa1
FB
2349A Linux 2.6 test image is available on the QEMU web site. More
2350information is available in the QEMU mailing-list archive.
9d0a8e6f 2351
d2c639d6
BS
2352@c man begin OPTIONS
2353
2354The following options are specific to the ARM emulation:
2355
2356@table @option
2357
2358@item -semihosting
2359Enable semihosting syscall emulation.
2360
2361On ARM this implements the "Angel" interface.
2362
2363Note that this allows guest direct access to the host filesystem,
2364so should only be used with trusted guest OS.
2365
2366@end table
2367
abc67eb6
TH
2368@c man end
2369
24d4de45
TS
2370@node ColdFire System emulator
2371@section ColdFire System emulator
7544a042
SW
2372@cindex system emulation (ColdFire)
2373@cindex system emulation (M68K)
209a4e69
PB
2374
2375Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
2376The emulator is able to boot a uClinux kernel.
707e011b
PB
2377
2378The M5208EVB emulation includes the following devices:
2379
2380@itemize @minus
5fafdf24 2381@item
707e011b
PB
2382MCF5208 ColdFire V2 Microprocessor (ISA A+ with EMAC).
2383@item
2384Three Two on-chip UARTs.
2385@item
2386Fast Ethernet Controller (FEC)
2387@end itemize
2388
2389The AN5206 emulation includes the following devices:
209a4e69
PB
2390
2391@itemize @minus
5fafdf24 2392@item
209a4e69
PB
2393MCF5206 ColdFire V2 Microprocessor.
2394@item
2395Two on-chip UARTs.
2396@end itemize
2397
d2c639d6
BS
2398@c man begin OPTIONS
2399
7544a042 2400The following options are specific to the ColdFire emulation:
d2c639d6
BS
2401
2402@table @option
2403
2404@item -semihosting
2405Enable semihosting syscall emulation.
2406
2407On M68K this implements the "ColdFire GDB" interface used by libgloss.
2408
2409Note that this allows guest direct access to the host filesystem,
2410so should only be used with trusted guest OS.
2411
2412@end table
2413
abc67eb6
TH
2414@c man end
2415
7544a042
SW
2416@node Cris System emulator
2417@section Cris System emulator
2418@cindex system emulation (Cris)
2419
2420TODO
2421
2422@node Microblaze System emulator
2423@section Microblaze System emulator
2424@cindex system emulation (Microblaze)
2425
2426TODO
2427
2428@node SH4 System emulator
2429@section SH4 System emulator
2430@cindex system emulation (SH4)
2431
2432TODO
2433
3aeaea65
MF
2434@node Xtensa System emulator
2435@section Xtensa System emulator
2436@cindex system emulation (Xtensa)
2437
2438Two executables cover simulation of both Xtensa endian options,
2439@file{qemu-system-xtensa} and @file{qemu-system-xtensaeb}.
2440Two different machine types are emulated:
2441
2442@itemize @minus
2443@item
2444Xtensa emulator pseudo board "sim"
2445@item
2446Avnet LX60/LX110/LX200 board
2447@end itemize
2448
b5e4946f 2449The sim pseudo board emulation provides an environment similar
3aeaea65
MF
2450to one provided by the proprietary Tensilica ISS.
2451It supports:
2452
2453@itemize @minus
2454@item
2455A range of Xtensa CPUs, default is the DC232B
2456@item
2457Console and filesystem access via semihosting calls
2458@end itemize
2459
2460The Avnet LX60/LX110/LX200 emulation supports:
2461
2462@itemize @minus
2463@item
2464A range of Xtensa CPUs, default is the DC232B
2465@item
246616550 UART
2467@item
2468OpenCores 10/100 Mbps Ethernet MAC
2469@end itemize
2470
2471@c man begin OPTIONS
2472
2473The following options are specific to the Xtensa emulation:
2474
2475@table @option
2476
2477@item -semihosting
2478Enable semihosting syscall emulation.
2479
2480Xtensa semihosting provides basic file IO calls, such as open/read/write/seek/select.
2481Tensilica baremetal libc for ISS and linux platform "sim" use this interface.
2482
2483Note that this allows guest direct access to the host filesystem,
2484so should only be used with trusted guest OS.
2485
2486@end table
3f2ce724 2487
abc67eb6
TH
2488@c man end
2489
5fafdf24
TS
2490@node QEMU User space emulator
2491@chapter QEMU User space emulator
83195237
FB
2492
2493@menu
2494* Supported Operating Systems ::
0722cc42 2495* Features::
83195237 2496* Linux User space emulator::
84778508 2497* BSD User space emulator ::
83195237
FB
2498@end menu
2499
2500@node Supported Operating Systems
2501@section Supported Operating Systems
2502
2503The following OS are supported in user space emulation:
2504
2505@itemize @minus
2506@item
4be456f1 2507Linux (referred as qemu-linux-user)
83195237 2508@item
84778508 2509BSD (referred as qemu-bsd-user)
83195237
FB
2510@end itemize
2511
0722cc42
PB
2512@node Features
2513@section Features
2514
2515QEMU user space emulation has the following notable features:
2516
2517@table @strong
2518@item System call translation:
2519QEMU includes a generic system call translator. This means that
2520the parameters of the system calls can be converted to fix
2521endianness and 32/64-bit mismatches between hosts and targets.
2522IOCTLs can be converted too.
2523
2524@item POSIX signal handling:
2525QEMU can redirect to the running program all signals coming from
2526the host (such as @code{SIGALRM}), as well as synthesize signals from
2527virtual CPU exceptions (for example @code{SIGFPE} when the program
2528executes a division by zero).
2529
2530QEMU relies on the host kernel to emulate most signal system
2531calls, for example to emulate the signal mask. On Linux, QEMU
2532supports both normal and real-time signals.
2533
2534@item Threading:
2535On Linux, QEMU can emulate the @code{clone} syscall and create a real
2536host thread (with a separate virtual CPU) for each emulated thread.
2537Note that not all targets currently emulate atomic operations correctly.
2538x86 and ARM use a global lock in order to preserve their semantics.
2539@end table
2540
2541QEMU was conceived so that ultimately it can emulate itself. Although
2542it is not very useful, it is an important test to show the power of the
2543emulator.
2544
83195237
FB
2545@node Linux User space emulator
2546@section Linux User space emulator
386405f7 2547
debc7065
FB
2548@menu
2549* Quick Start::
2550* Wine launch::
2551* Command line options::
79737e4a 2552* Other binaries::
debc7065
FB
2553@end menu
2554
2555@node Quick Start
83195237 2556@subsection Quick Start
df0f11a0 2557
1f673135 2558In order to launch a Linux process, QEMU needs the process executable
5fafdf24 2559itself and all the target (x86) dynamic libraries used by it.
386405f7 2560
1f673135 2561@itemize
386405f7 2562
1f673135
FB
2563@item On x86, you can just try to launch any process by using the native
2564libraries:
386405f7 2565
5fafdf24 2566@example
1f673135
FB
2567qemu-i386 -L / /bin/ls
2568@end example
386405f7 2569
1f673135
FB
2570@code{-L /} tells that the x86 dynamic linker must be searched with a
2571@file{/} prefix.
386405f7 2572
b65ee4fa
SW
2573@item Since QEMU is also a linux process, you can launch QEMU with
2574QEMU (NOTE: you can only do that if you compiled QEMU from the sources):
386405f7 2575
5fafdf24 2576@example
1f673135
FB
2577qemu-i386 -L / qemu-i386 -L / /bin/ls
2578@end example
386405f7 2579
1f673135
FB
2580@item On non x86 CPUs, you need first to download at least an x86 glibc
2581(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
2582@code{LD_LIBRARY_PATH} is not set:
df0f11a0 2583
1f673135 2584@example
5fafdf24 2585unset LD_LIBRARY_PATH
1f673135 2586@end example
1eb87257 2587
1f673135 2588Then you can launch the precompiled @file{ls} x86 executable:
1eb87257 2589
1f673135
FB
2590@example
2591qemu-i386 tests/i386/ls
2592@end example
4c3b5a48 2593You can look at @file{scripts/qemu-binfmt-conf.sh} so that
1f673135
FB
2594QEMU is automatically launched by the Linux kernel when you try to
2595launch x86 executables. It requires the @code{binfmt_misc} module in the
2596Linux kernel.
1eb87257 2597
1f673135
FB
2598@item The x86 version of QEMU is also included. You can try weird things such as:
2599@example
debc7065
FB
2600qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
2601 /usr/local/qemu-i386/bin/ls-i386
1f673135 2602@end example
1eb20527 2603
1f673135 2604@end itemize
1eb20527 2605
debc7065 2606@node Wine launch
83195237 2607@subsection Wine launch
1eb20527 2608
1f673135 2609@itemize
386405f7 2610
1f673135
FB
2611@item Ensure that you have a working QEMU with the x86 glibc
2612distribution (see previous section). In order to verify it, you must be
2613able to do:
386405f7 2614
1f673135
FB
2615@example
2616qemu-i386 /usr/local/qemu-i386/bin/ls-i386
2617@end example
386405f7 2618
1f673135 2619@item Download the binary x86 Wine install
5fafdf24 2620(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
386405f7 2621
1f673135 2622@item Configure Wine on your account. Look at the provided script
debc7065 2623@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
1f673135 2624@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
386405f7 2625
1f673135 2626@item Then you can try the example @file{putty.exe}:
386405f7 2627
1f673135 2628@example
debc7065
FB
2629qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
2630 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1f673135 2631@end example
386405f7 2632
1f673135 2633@end itemize
fd429f2f 2634
debc7065 2635@node Command line options
83195237 2636@subsection Command line options
1eb20527 2637
1f673135 2638@example
8485140f 2639@command{qemu-i386} [@option{-h]} [@option{-d]} [@option{-L} @var{path}] [@option{-s} @var{size}] [@option{-cpu} @var{model}] [@option{-g} @var{port}] [@option{-B} @var{offset}] [@option{-R} @var{size}] @var{program} [@var{arguments}...]
1f673135 2640@end example
1eb20527 2641
1f673135
FB
2642@table @option
2643@item -h
2644Print the help
3b46e624 2645@item -L path
1f673135
FB
2646Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
2647@item -s size
2648Set the x86 stack size in bytes (default=524288)
34a3d239 2649@item -cpu model
c8057f95 2650Select CPU model (-cpu help for list and additional feature selection)
f66724c9
SW
2651@item -E @var{var}=@var{value}
2652Set environment @var{var} to @var{value}.
2653@item -U @var{var}
2654Remove @var{var} from the environment.
379f6698
PB
2655@item -B offset
2656Offset guest address by the specified number of bytes. This is useful when
1f5c3f8c
SW
2657the address region required by guest applications is reserved on the host.
2658This option is currently only supported on some hosts.
68a1c816
PB
2659@item -R size
2660Pre-allocate a guest virtual address space of the given size (in bytes).
0d6753e5 2661"G", "M", and "k" suffixes may be used when specifying the size.
386405f7
FB
2662@end table
2663
1f673135 2664Debug options:
386405f7 2665
1f673135 2666@table @option
989b697d
PM
2667@item -d item1,...
2668Activate logging of the specified items (use '-d help' for a list of log items)
1f673135
FB
2669@item -p pagesize
2670Act as if the host page size was 'pagesize' bytes
34a3d239
BS
2671@item -g port
2672Wait gdb connection to port
1b530a6d
AJ
2673@item -singlestep
2674Run the emulation in single step mode.
1f673135 2675@end table
386405f7 2676
b01bcae6
AZ
2677Environment variables:
2678
2679@table @env
2680@item QEMU_STRACE
2681Print system calls and arguments similar to the 'strace' program
2682(NOTE: the actual 'strace' program will not work because the user
2683space emulator hasn't implemented ptrace). At the moment this is
2684incomplete. All system calls that don't have a specific argument
2685format are printed with information for six arguments. Many
2686flag-style arguments don't have decoders and will show up as numbers.
5cfdf930 2687@end table
b01bcae6 2688
79737e4a 2689@node Other binaries
83195237 2690@subsection Other binaries
79737e4a 2691
7544a042
SW
2692@cindex user mode (Alpha)
2693@command{qemu-alpha} TODO.
2694
2695@cindex user mode (ARM)
2696@command{qemu-armeb} TODO.
2697
2698@cindex user mode (ARM)
79737e4a
PB
2699@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
2700binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
2701configurations), and arm-uclinux bFLT format binaries.
2702
7544a042
SW
2703@cindex user mode (ColdFire)
2704@cindex user mode (M68K)
e6e5906b
PB
2705@command{qemu-m68k} is capable of running semihosted binaries using the BDM
2706(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
2707coldfire uClinux bFLT format binaries.
2708
79737e4a
PB
2709The binary format is detected automatically.
2710
7544a042
SW
2711@cindex user mode (Cris)
2712@command{qemu-cris} TODO.
2713
2714@cindex user mode (i386)
2715@command{qemu-i386} TODO.
2716@command{qemu-x86_64} TODO.
2717
2718@cindex user mode (Microblaze)
2719@command{qemu-microblaze} TODO.
2720
2721@cindex user mode (MIPS)
8639c5c9
AM
2722@command{qemu-mips} executes 32-bit big endian MIPS binaries (MIPS O32 ABI).
2723
2724@command{qemu-mipsel} executes 32-bit little endian MIPS binaries (MIPS O32 ABI).
2725
2726@command{qemu-mips64} executes 64-bit big endian MIPS binaries (MIPS N64 ABI).
2727
2728@command{qemu-mips64el} executes 64-bit little endian MIPS binaries (MIPS N64 ABI).
2729
2730@command{qemu-mipsn32} executes 32-bit big endian MIPS binaries (MIPS N32 ABI).
2731
2732@command{qemu-mipsn32el} executes 32-bit little endian MIPS binaries (MIPS N32 ABI).
7544a042 2733
e671711c
MV
2734@cindex user mode (NiosII)
2735@command{qemu-nios2} TODO.
2736
7544a042
SW
2737@cindex user mode (PowerPC)
2738@command{qemu-ppc64abi32} TODO.
2739@command{qemu-ppc64} TODO.
2740@command{qemu-ppc} TODO.
2741
2742@cindex user mode (SH4)
2743@command{qemu-sh4eb} TODO.
2744@command{qemu-sh4} TODO.
2745
2746@cindex user mode (SPARC)
34a3d239
BS
2747@command{qemu-sparc} can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
2748
a785e42e
BS
2749@command{qemu-sparc32plus} can execute Sparc32 and SPARC32PLUS binaries
2750(Sparc64 CPU, 32 bit ABI).
2751
2752@command{qemu-sparc64} can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
2753SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
2754
84778508
BS
2755@node BSD User space emulator
2756@section BSD User space emulator
2757
2758@menu
2759* BSD Status::
2760* BSD Quick Start::
2761* BSD Command line options::
2762@end menu
2763
2764@node BSD Status
2765@subsection BSD Status
2766
2767@itemize @minus
2768@item
2769target Sparc64 on Sparc64: Some trivial programs work.
2770@end itemize
2771
2772@node BSD Quick Start
2773@subsection Quick Start
2774
2775In order to launch a BSD process, QEMU needs the process executable
2776itself and all the target dynamic libraries used by it.
2777
2778@itemize
2779
2780@item On Sparc64, you can just try to launch any process by using the native
2781libraries:
2782
2783@example
2784qemu-sparc64 /bin/ls
2785@end example
2786
2787@end itemize
2788
2789@node BSD Command line options
2790@subsection Command line options
2791
2792@example
8485140f 2793@command{qemu-sparc64} [@option{-h]} [@option{-d]} [@option{-L} @var{path}] [@option{-s} @var{size}] [@option{-bsd} @var{type}] @var{program} [@var{arguments}...]
84778508
BS
2794@end example
2795
2796@table @option
2797@item -h
2798Print the help
2799@item -L path
2800Set the library root path (default=/)
2801@item -s size
2802Set the stack size in bytes (default=524288)
f66724c9
SW
2803@item -ignore-environment
2804Start with an empty environment. Without this option,
40c5c6cd 2805the initial environment is a copy of the caller's environment.
f66724c9
SW
2806@item -E @var{var}=@var{value}
2807Set environment @var{var} to @var{value}.
2808@item -U @var{var}
2809Remove @var{var} from the environment.
84778508
BS
2810@item -bsd type
2811Set the type of the emulated BSD Operating system. Valid values are
2812FreeBSD, NetBSD and OpenBSD (default).
2813@end table
2814
2815Debug options:
2816
2817@table @option
989b697d
PM
2818@item -d item1,...
2819Activate logging of the specified items (use '-d help' for a list of log items)
84778508
BS
2820@item -p pagesize
2821Act as if the host page size was 'pagesize' bytes
1b530a6d
AJ
2822@item -singlestep
2823Run the emulation in single step mode.
84778508
BS
2824@end table
2825
483c6ad4
BP
2826@node System requirements
2827@chapter System requirements
2828
2829@section KVM kernel module
2830
2831On x86_64 hosts, the default set of CPU features enabled by the KVM accelerator
2832require the host to be running Linux v4.5 or newer.
2833
2834The OpteronG[345] CPU models require KVM support for RDTSCP, which was
2835added with Linux 4.5 which is supported by the major distros. And even
2836if RHEL7 has kernel 3.10, KVM there has the required functionality there
2837to make it close to a 4.5 or newer kernel.
47eacb4f 2838
e8412576
SH
2839@include docs/security.texi
2840
78e87797
PB
2841@include qemu-tech.texi
2842
44c67847 2843@include qemu-deprecated.texi
efe2add7 2844
45b47130
DB
2845@node Supported build platforms
2846@appendix Supported build platforms
2847
2848QEMU aims to support building and executing on multiple host OS platforms.
2849This appendix outlines which platforms are the major build targets. These
2850platforms are used as the basis for deciding upon the minimum required
2851versions of 3rd party software QEMU depends on. The supported platforms
2852are the targets for automated testing performed by the project when patches
2853are submitted for review, and tested before and after merge.
2854
2855If a platform is not listed here, it does not imply that QEMU won't work.
2856If an unlisted platform has comparable software versions to a listed platform,
2857there is every expectation that it will work. Bug reports are welcome for
2858problems encountered on unlisted platforms unless they are clearly older
2859vintage than what is described here.
2860
2861Note that when considering software versions shipped in distros as support
2862targets, QEMU considers only the version number, and assumes the features in
2863that distro match the upstream release with the same version. In other words,
2864if a distro backports extra features to the software in their distro, QEMU
2865upstream code will not add explicit support for those backports, unless the
2866feature is auto-detectable in a manner that works for the upstream releases
2867too.
2868
2869The Repology site @url{https://repology.org} is a useful resource to identify
2870currently shipped versions of software in various operating systems, though
2871it does not cover all distros listed below.
2872
2873@section Linux OS
2874
2875For distributions with frequent, short-lifetime releases, the project will
2876aim to support all versions that are not end of life by their respective
2877vendors. For the purposes of identifying supported software versions, the
2878project will look at Fedora, Ubuntu, and openSUSE distros. Other short-
2879lifetime distros will be assumed to ship similar software versions.
2880
2881For distributions with long-lifetime releases, the project will aim to support
2882the most recent major version at all times. Support for the previous major
2883version will be dropped 2 years after the new major version is released. For
2884the purposes of identifying supported software versions, the project will look
2885at RHEL, Debian, Ubuntu LTS, and SLES distros. Other long-lifetime distros will
2886be assumed to ship similar software versions.
2887
2888@section Windows
2889
2890The project supports building with current versions of the MinGW toolchain,
2891hosted on Linux.
2892
2893@section macOS
2894
2895The project supports building with the two most recent versions of macOS, with
2896the current homebrew package set available.
2897
2898@section FreeBSD
2899
2900The project aims to support the all the versions which are not end of life.
2901
2902@section NetBSD
2903
2904The project aims to support the most recent major version at all times. Support
2905for the previous major version will be dropped 2 years after the new major
2906version is released.
2907
2908@section OpenBSD
2909
2910The project aims to support the all the versions which are not end of life.
2911
7544a042
SW
2912@node License
2913@appendix License
2914
2915QEMU is a trademark of Fabrice Bellard.
2916
2f8d8f01
TH
2917QEMU is released under the
2918@url{https://www.gnu.org/licenses/gpl-2.0.txt,GNU General Public License},
2919version 2. Parts of QEMU have specific licenses, see file
70b7fba9 2920@url{https://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE,LICENSE}.
7544a042 2921
debc7065 2922@node Index
7544a042
SW
2923@appendix Index
2924@menu
2925* Concept Index::
2926* Function Index::
2927* Keystroke Index::
2928* Program Index::
2929* Data Type Index::
2930* Variable Index::
2931@end menu
2932
2933@node Concept Index
2934@section Concept Index
2935This is the main index. Should we combine all keywords in one index? TODO
debc7065
FB
2936@printindex cp
2937
7544a042
SW
2938@node Function Index
2939@section Function Index
2940This index could be used for command line options and monitor functions.
2941@printindex fn
2942
2943@node Keystroke Index
2944@section Keystroke Index
2945
2946This is a list of all keystrokes which have a special function
2947in system emulation.
2948
2949@printindex ky
2950
2951@node Program Index
2952@section Program Index
2953@printindex pg
2954
2955@node Data Type Index
2956@section Data Type Index
2957
2958This index could be used for qdev device names and options.
2959
2960@printindex tp
2961
2962@node Variable Index
2963@section Variable Index
2964@printindex vr
2965
debc7065 2966@bye