xref: /openbmc/qemu/docs/config/q35-emulated.cfg (revision a9ded601)
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  accel = "kvm"
65
66[memory]
67  size = "1024"
68
69
70# PCI bridge (PCI Express Root Ports)
71# =========================================================
72#
73# We add four PCI Express Root Ports, all sharing the same
74# slot on the PCI Express  Root Bus. These ports support
75# hotplug.
76
77[device "ich9-pcie-port-1"]
78  driver = "ioh3420"
79  multifunction = "on"
80  bus = "pcie.0"
81  addr = "1c.0"
82  port = "1"
83  chassis = "1"
84
85[device "ich9-pcie-port-2"]
86  driver = "ioh3420"
87  multifunction = "on"
88  bus = "pcie.0"
89  addr = "1c.1"
90  port = "2"
91  chassis = "2"
92
93[device "ich9-pcie-port-3"]
94  driver = "ioh3420"
95  multifunction = "on"
96  bus = "pcie.0"
97  addr = "1c.2"
98  port = "3"
99  chassis = "3"
100
101[device "ich9-pcie-port-4"]
102  driver = "ioh3420"
103  multifunction = "on"
104  bus = "pcie.0"
105  addr = "1c.3"
106  port = "4"
107  chassis = "4"
108
109
110# PCI bridge (legacy PCI bridge)
111# =========================================================
112#
113# This bridge can be used to build an independent topology
114# for legacy PCI devices. PCI Express devices should be
115# plugged into PCI Express slots instead, so ideally there
116# will be no devices connected to this bridge.
117
118[device "ich9-pci-bridge"]
119  driver = "i82801b11-bridge"
120  bus = "pcie.0"
121  addr = "1e.0"
122
123
124# SATA storage
125# =========================================================
126#
127# An implicit SATA controller is created automatically for
128# every single q35 guest; here we create a disk, backed by
129# a qcow2 disk image on the host's filesystem, and attach
130# it to that controller so that the guest can use it.
131#
132# We also create an optical disk, mostly for installation
133# purposes: once the guest OS has been succesfully
134# installed, the guest will no longer boot from optical
135# media. If you don't want, or no longer want, to have an
136# optical disk in the guest you can safely comment out
137# all relevant sections below.
138
139[device "sata-disk"]
140  driver = "ide-hd"
141  bus = "ide.0"
142  drive = "disk"
143  bootindex = "1"
144
145[drive "disk"]
146  file = "guest.qcow2"                          # CHANGE ME
147  format = "qcow2"
148  if = "none"
149
150[device "sata-optical-disk"]
151  driver = "ide-cd"
152  bus = "ide.1"
153  drive = "optical-disk"
154  bootindex = "2"
155
156[drive "optical-disk"]
157  file = "install.iso"                          # CHANGE ME
158  format = "raw"
159  if = "none"
160
161
162# USB controller (#1)
163# =========================================================
164#
165# EHCI controller + UHCI companion controllers.
166
167[device "ich9-ehci-1"]
168  driver = "ich9-usb-ehci1"
169  multifunction = "on"
170  bus = "pcie.0"
171  addr = "1d.7"
172
173[device "ich9-uhci-1"]
174  driver = "ich9-usb-uhci1"
175  multifunction = "on"
176  bus = "pcie.0"
177  addr = "1d.0"
178  masterbus = "ich9-ehci-1.0"
179  firstport = "0"
180
181[device "ich9-uhci-2"]
182  driver = "ich9-usb-uhci2"
183  multifunction = "on"
184  bus = "pcie.0"
185  addr = "1d.1"
186  masterbus = "ich9-ehci-1.0"
187  firstport = "2"
188
189[device "ich9-uhci-3"]
190  driver = "ich9-usb-uhci3"
191  multifunction = "on"
192  bus = "pcie.0"
193  addr = "1d.2"
194  masterbus = "ich9-ehci-1.0"
195  firstport = "4"
196
197
198# USB controller (#2)
199# =========================================================
200#
201# EHCI controller + UHCI companion controllers.
202
203[device "ich9-ehci-2"]
204  driver = "ich9-usb-ehci2"
205  multifunction = "on"
206  bus = "pcie.0"
207  addr = "1a.7"
208
209[device "ich9-uhci-4"]
210  driver = "ich9-usb-uhci4"
211  multifunction = "on"
212  bus = "pcie.0"
213  addr = "1a.0"
214  masterbus = "ich9-ehci-2.0"
215  firstport = "0"
216
217[device "ich9-uhci-5"]
218  driver = "ich9-usb-uhci5"
219  multifunction = "on"
220  bus = "pcie.0"
221  addr = "1a.1"
222  masterbus = "ich9-ehci-2.0"
223  firstport = "2"
224
225[device "ich9-uhci-6"]
226  driver = "ich9-usb-uhci6"
227  multifunction = "on"
228  bus = "pcie.0"
229  addr = "1a.2"
230  masterbus = "ich9-ehci-2.0"
231  firstport = "4"
232
233
234# Ethernet controller
235# =========================================================
236#
237# We add a Gigabit Ethernet interface to the guest; on the
238# host side, we take advantage of user networking so that
239# the QEMU process doesn't require any additional
240# privileges.
241
242[netdev "hostnet"]
243  type = "user"
244
245[device "net"]
246  driver = "e1000"
247  netdev = "hostnet"
248  bus = "pcie.0"
249  addr = "19.0"
250
251
252# VGA compatible controller
253# =========================================================
254#
255# We use stdvga instead of Cirrus as it supports more video
256# modes and is closer to what actual hardware looks like.
257#
258# If you're running the guest on a remote, potentially
259# headless host, you will probably want to append something
260# like
261#
262#   -display vnc=127.0.0.1:0
263#
264# to the command line in order to prevent QEMU from
265# creating a graphical display window on the host and
266# enable remote access instead.
267
268[device "video"]
269  driver = "VGA"
270  bus = "pcie.0"
271  addr = "01.0"
272
273
274# Audio device
275# =========================================================
276#
277# The sound card is a legacy PCI device that is plugged
278# directly into the PCI Express Root Bus.
279
280[device "ich9-hda-audio"]
281  driver = "ich9-intel-hda"
282  bus = "pcie.0"
283  addr = "1b.0"
284
285[device "ich9-hda-duplex"]
286  driver = "hda-duplex"
287  bus = "ich9-hda-audio.0"
288  cad = "0"
289