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