xref: /openbmc/qemu/docs/config/q35-emulated.cfg (revision 4dba9141)
1# q35 - Emulated guest (graphical console)
2# =========================================================
3#
4# Usage:
5#
6#   $ qemu-system-x86_64 \
7#     -nodefaults \
8#     -readconfig q35-emulated.cfg
9#
10# You will probably need to tweak the lines marked as
11# CHANGE ME before being able to use this configuration!
12#
13# The guest will have a selection of emulated devices that
14# closely resembles that of a physical machine, and will be
15# accessed through a graphical console.
16#
17# ---------------------------------------------------------
18#
19# Using -nodefaults is required to have full control over
20# the virtual hardware: when it's specified, QEMU will
21# populate the board with only the builtin peripherals
22# plus a small selection of core PCI devices and
23# controllers; the user will then have to explicitly add
24# further devices.
25#
26# The core PCI devices show up in the guest as:
27#
28#   00:00.0 Host bridge
29#   00:1f.0 ISA bridge / LPC
30#   00:1f.2 SATA (AHCI) controller
31#   00:1f.3 SMBus controller
32#
33# This configuration file adds a number of devices that
34# are pretty much guaranteed to be present in every single
35# physical machine based on q35, more specifically:
36#
37#   00:01.0 VGA compatible controller
38#   00:19.0 Ethernet controller
39#   00:1a.* USB controller (#2)
40#   00:1b.0 Audio device
41#   00:1c.* PCI bridge (PCI Express Root Ports)
42#   00:1d.* USB Controller (#1)
43#   00:1e.0 PCI bridge (legacy PCI bridge)
44#
45# More information about these devices is available below.
46
47
48# Machine options
49# =========================================================
50#
51# We use the q35 machine type and enable KVM acceleration
52# for better performance.
53#
54# Using less than 1 GiB of memory is probably not going to
55# yield good performance in the guest, and might even lead
56# to obscure boot issues in some cases.
57#
58# Unfortunately, there is no way to configure the CPU model
59# in this file, so it will have to be provided on the
60# command line.
61
62[machine]
63  type = "q35"
64
65[accel]
66  accel = "kvm"
67
68[memory]
69  size = "1024"
70
71
72# PCI bridge (PCI Express Root Ports)
73# =========================================================
74#
75# We add four PCI Express Root Ports, all sharing the same
76# slot on the PCI Express  Root Bus. These ports support
77# hotplug.
78
79[device "ich9-pcie-port-1"]
80  driver = "ioh3420"
81  multifunction = "on"
82  bus = "pcie.0"
83  addr = "1c.0"
84  port = "1"
85  chassis = "1"
86
87[device "ich9-pcie-port-2"]
88  driver = "ioh3420"
89  multifunction = "on"
90  bus = "pcie.0"
91  addr = "1c.1"
92  port = "2"
93  chassis = "2"
94
95[device "ich9-pcie-port-3"]
96  driver = "ioh3420"
97  multifunction = "on"
98  bus = "pcie.0"
99  addr = "1c.2"
100  port = "3"
101  chassis = "3"
102
103[device "ich9-pcie-port-4"]
104  driver = "ioh3420"
105  multifunction = "on"
106  bus = "pcie.0"
107  addr = "1c.3"
108  port = "4"
109  chassis = "4"
110
111
112# PCI bridge (legacy PCI bridge)
113# =========================================================
114#
115# This bridge can be used to build an independent topology
116# for legacy PCI devices. PCI Express devices should be
117# plugged into PCI Express slots instead, so ideally there
118# will be no devices connected to this bridge.
119
120[device "ich9-pci-bridge"]
121  driver = "i82801b11-bridge"
122  bus = "pcie.0"
123  addr = "1e.0"
124
125
126# SATA storage
127# =========================================================
128#
129# An implicit SATA controller is created automatically for
130# every single q35 guest; here we create a disk, backed by
131# a qcow2 disk image on the host's filesystem, and attach
132# it to that controller so that the guest can use it.
133#
134# We also create an optical disk, mostly for installation
135# purposes: once the guest OS has been successfully
136# installed, the guest will no longer boot from optical
137# media. If you don't want, or no longer want, to have an
138# optical disk in the guest you can safely comment out
139# all relevant sections below.
140
141[device "sata-disk"]
142  driver = "ide-hd"
143  bus = "ide.0"
144  drive = "disk"
145  bootindex = "1"
146
147[drive "disk"]
148  file = "guest.qcow2"                          # CHANGE ME
149  format = "qcow2"
150  if = "none"
151
152[device "sata-optical-disk"]
153  driver = "ide-cd"
154  bus = "ide.1"
155  drive = "optical-disk"
156  bootindex = "2"
157
158[drive "optical-disk"]
159  file = "install.iso"                          # CHANGE ME
160  format = "raw"
161  if = "none"
162
163
164# USB controller (#1)
165# =========================================================
166#
167# EHCI controller + UHCI companion controllers.
168
169[device "ich9-ehci-1"]
170  driver = "ich9-usb-ehci1"
171  multifunction = "on"
172  bus = "pcie.0"
173  addr = "1d.7"
174
175[device "ich9-uhci-1"]
176  driver = "ich9-usb-uhci1"
177  multifunction = "on"
178  bus = "pcie.0"
179  addr = "1d.0"
180  masterbus = "ich9-ehci-1.0"
181  firstport = "0"
182
183[device "ich9-uhci-2"]
184  driver = "ich9-usb-uhci2"
185  multifunction = "on"
186  bus = "pcie.0"
187  addr = "1d.1"
188  masterbus = "ich9-ehci-1.0"
189  firstport = "2"
190
191[device "ich9-uhci-3"]
192  driver = "ich9-usb-uhci3"
193  multifunction = "on"
194  bus = "pcie.0"
195  addr = "1d.2"
196  masterbus = "ich9-ehci-1.0"
197  firstport = "4"
198
199
200# USB controller (#2)
201# =========================================================
202#
203# EHCI controller + UHCI companion controllers.
204
205[device "ich9-ehci-2"]
206  driver = "ich9-usb-ehci2"
207  multifunction = "on"
208  bus = "pcie.0"
209  addr = "1a.7"
210
211[device "ich9-uhci-4"]
212  driver = "ich9-usb-uhci4"
213  multifunction = "on"
214  bus = "pcie.0"
215  addr = "1a.0"
216  masterbus = "ich9-ehci-2.0"
217  firstport = "0"
218
219[device "ich9-uhci-5"]
220  driver = "ich9-usb-uhci5"
221  multifunction = "on"
222  bus = "pcie.0"
223  addr = "1a.1"
224  masterbus = "ich9-ehci-2.0"
225  firstport = "2"
226
227[device "ich9-uhci-6"]
228  driver = "ich9-usb-uhci6"
229  multifunction = "on"
230  bus = "pcie.0"
231  addr = "1a.2"
232  masterbus = "ich9-ehci-2.0"
233  firstport = "4"
234
235
236# Ethernet controller
237# =========================================================
238#
239# We add a Gigabit Ethernet interface to the guest; on the
240# host side, we take advantage of user networking so that
241# the QEMU process doesn't require any additional
242# privileges.
243
244[netdev "hostnet"]
245  type = "user"
246
247[device "net"]
248  driver = "e1000"
249  netdev = "hostnet"
250  bus = "pcie.0"
251  addr = "19.0"
252
253
254# VGA compatible controller
255# =========================================================
256#
257# We use stdvga instead of Cirrus as it supports more video
258# modes and is closer to what actual hardware looks like.
259#
260# If you're running the guest on a remote, potentially
261# headless host, you will probably want to append something
262# like
263#
264#   -display vnc=127.0.0.1:0
265#
266# to the command line in order to prevent QEMU from
267# creating a graphical display window on the host and
268# enable remote access instead.
269
270[device "video"]
271  driver = "VGA"
272  bus = "pcie.0"
273  addr = "01.0"
274
275
276# Audio device
277# =========================================================
278#
279# The sound card is a legacy PCI device that is plugged
280# directly into the PCI Express Root Bus.
281
282[device "ich9-hda-audio"]
283  driver = "ich9-intel-hda"
284  bus = "pcie.0"
285  addr = "1b.0"
286
287[device "ich9-hda-duplex"]
288  driver = "hda-duplex"
289  bus = "ich9-hda-audio.0"
290  cad = "0"
291  audiodev = "audiodev0"
292
293[audiodev "audiodev0"]
294  driver = "none"                      # CHANGE ME
295