1# q35 - VirtIO guest (graphical console) 2# ========================================================= 3# 4# Usage: 5# 6# $ qemu-system-x86_64 \ 7# -nodefaults \ 8# -readconfig q35-virtio-graphical.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 VirtIO devices 14# tailored towards optimal performance with modern guests, 15# and will be 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 other useful 34# devices, more specifically: 35# 36# 00:01.0 VGA compatible controller 37# 00:1b.0 Audio device 38# 00.1c.* PCI bridge (PCI Express Root Ports) 39# 01:00.0 SCSI storage controller 40# 02:00.0 Ethernet controller 41# 03:00.0 USB controller 42# 43# More information about these devices is available below. 44 45 46# Machine options 47# ========================================================= 48# 49# We use the q35 machine type and enable KVM acceleration 50# for better performance. 51# 52# Using less than 1 GiB of memory is probably not going to 53# yield good performance in the guest, and might even lead 54# to obscure boot issues in some cases. 55 56[machine] 57 type = "q35" 58 accel = "kvm" 59 60[memory] 61 size = "1024" 62 63 64# PCI bridge (PCI Express Root Ports) 65# ========================================================= 66# 67# We create eight PCI Express Root Ports, and we plug them 68# all into separate functions of the same slot. Some of 69# them will be used by devices, the rest will remain 70# available for hotplug. 71 72[device "pcie.1"] 73 driver = "pcie-root-port" 74 bus = "pcie.0" 75 addr = "1c.0" 76 port = "1" 77 chassis = "1" 78 multifunction = "on" 79 80[device "pcie.2"] 81 driver = "pcie-root-port" 82 bus = "pcie.0" 83 addr = "1c.1" 84 port = "2" 85 chassis = "2" 86 87[device "pcie.3"] 88 driver = "pcie-root-port" 89 bus = "pcie.0" 90 addr = "1c.2" 91 port = "3" 92 chassis = "3" 93 94[device "pcie.4"] 95 driver = "pcie-root-port" 96 bus = "pcie.0" 97 addr = "1c.3" 98 port = "4" 99 chassis = "4" 100 101[device "pcie.5"] 102 driver = "pcie-root-port" 103 bus = "pcie.0" 104 addr = "1c.4" 105 port = "5" 106 chassis = "5" 107 108[device "pcie.6"] 109 driver = "pcie-root-port" 110 bus = "pcie.0" 111 addr = "1c.5" 112 port = "6" 113 chassis = "6" 114 115[device "pcie.7"] 116 driver = "pcie-root-port" 117 bus = "pcie.0" 118 addr = "1c.6" 119 port = "7" 120 chassis = "7" 121 122[device "pcie.8"] 123 driver = "pcie-root-port" 124 bus = "pcie.0" 125 addr = "1c.7" 126 port = "8" 127 chassis = "8" 128 129 130# SCSI storage controller (and storage) 131# ========================================================= 132# 133# We use virtio-scsi here so that we can (hot)plug a large 134# number of disks without running into issues; a SCSI disk, 135# backed by a qcow2 disk image on the host's filesystem, is 136# attached to it. 137# 138# We also create an optical disk, mostly for installation 139# purposes: once the guest OS has been successfully 140# installed, the guest will no longer boot from optical 141# media. If you don't want, or no longer want, to have an 142# optical disk in the guest you can safely comment out 143# all relevant sections below. 144 145[device "scsi"] 146 driver = "virtio-scsi-pci" 147 bus = "pcie.1" 148 addr = "00.0" 149 150[device "scsi-disk"] 151 driver = "scsi-hd" 152 bus = "scsi.0" 153 drive = "disk" 154 bootindex = "1" 155 156[drive "disk"] 157 file = "guest.qcow2" # CHANGE ME 158 format = "qcow2" 159 if = "none" 160 161[device "scsi-optical-disk"] 162 driver = "scsi-cd" 163 bus = "scsi.0" 164 drive = "optical-disk" 165 bootindex = "2" 166 167[drive "optical-disk"] 168 file = "install.iso" # CHANGE ME 169 format = "raw" 170 if = "none" 171 172 173# Ethernet controller 174# ========================================================= 175# 176# We use virtio-net for improved performance over emulated 177# hardware; on the host side, we take advantage of user 178# networking so that the QEMU process doesn't require any 179# additional privileges. 180 181[netdev "hostnet"] 182 type = "user" 183 184[device "net"] 185 driver = "virtio-net-pci" 186 netdev = "hostnet" 187 bus = "pcie.2" 188 addr = "00.0" 189 190 191# USB controller (and input devices) 192# ========================================================= 193# 194# We add a virtualization-friendly USB 3.0 controller and 195# a USB tablet so that graphical guests can be controlled 196# appropriately. A USB keyboard is not needed, as q35 197# guests get a PS/2 one added automatically. 198 199[device "usb"] 200 driver = "nec-usb-xhci" 201 bus = "pcie.3" 202 addr = "00.0" 203 204[device "tablet"] 205 driver = "usb-tablet" 206 bus = "usb.0" 207 208 209# VGA compatible controller 210# ========================================================= 211# 212# We plug the QXL video card directly into the PCI Express 213# Root Bus as it is a legacy PCI device; this way, we can 214# reduce the number of PCI Express controllers in the 215# guest. 216# 217# If you're running the guest on a remote, potentially 218# headless host, you will probably want to append something 219# like 220# 221# -display vnc=127.0.0.1:0 222# 223# to the command line in order to prevent QEMU from 224# creating a graphical display window on the host and 225# enable remote access instead. 226 227[device "video"] 228 driver = "qxl-vga" 229 bus = "pcie.0" 230 addr = "01.0" 231 232 233# Audio device 234# ========================================================= 235# 236# Like the video card, the sound card is a legacy PCI 237# device and as such can be plugged directly into the PCI 238# Express Root Bus. 239 240[device "sound"] 241 driver = "ich9-intel-hda" 242 bus = "pcie.0" 243 addr = "1b.0" 244 245[device "duplex"] 246 driver = "hda-duplex" 247 bus = "sound.0" 248 cad = "0" 249