qemu-doc.texi 93 KB

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