1# q35 - VirtIO guest (serial console) 2# ========================================================= 3# 4# Usage: 5# 6# $ qemu-system-x86_64 \ 7# -nodefaults \ 8# -readconfig q35-virtio-serial.cfg \ 9# -display none -serial mon:stdio 10# 11# You will probably need to tweak the lines marked as 12# CHANGE ME before being able to use this configuration! 13# 14# The guest will have a selection of VirtIO devices 15# tailored towards optimal performance with modern guests, 16# and will be accessed through the serial console. 17# 18# --------------------------------------------------------- 19# 20# Using -nodefaults is required to have full control over 21# the virtual hardware: when it's specified, QEMU will 22# populate the board with only the builtin peripherals 23# plus a small selection of core PCI devices and 24# controllers; the user will then have to explicitly add 25# further devices. 26# 27# The core PCI devices show up in the guest as: 28# 29# 00:00.0 Host bridge 30# 00:1f.0 ISA bridge / LPC 31# 00:1f.2 SATA (AHCI) controller 32# 00:1f.3 SMBus controller 33# 34# This configuration file adds a number of other useful 35# devices, more specifically: 36# 37# 00.1c.* PCI bridge (PCI Express Root Ports) 38# 01:00.0 SCSI storage controller 39# 02:00.0 Ethernet controller 40# 41# More information about these devices is available below. 42# 43# We use '-display none' to prevent QEMU from creating a 44# graphical display window, which would serve no use in 45# this specific configuration, and '-serial mon:stdio' to 46# multiplex the guest's serial console and the QEMU monitor 47# to the host's stdio; use 'Ctrl+A h' to learn how to 48# switch between the two and more. 49 50 51# Machine options 52# ========================================================= 53# 54# We use the q35 machine type and enable KVM acceleration 55# for better performance. 56# 57# Using less than 1 GiB of memory is probably not going to 58# yield good performance in the guest, and might even lead 59# to obscure boot issues in some cases. 60 61[machine] 62 type = "q35" 63 accel = "kvm" 64 65[memory] 66 size = "1024" 67 68 69# PCI bridge (PCI Express Root Ports) 70# ========================================================= 71# 72# We create eight PCI Express Root Ports, and we plug them 73# all into separate functions of the same slot. Some of 74# them will be used by devices, the rest will remain 75# available for hotplug. 76 77[device "pcie.1"] 78 driver = "pcie-root-port" 79 bus = "pcie.0" 80 addr = "1c.0" 81 port = "1" 82 chassis = "1" 83 multifunction = "on" 84 85[device "pcie.2"] 86 driver = "pcie-root-port" 87 bus = "pcie.0" 88 addr = "1c.1" 89 port = "2" 90 chassis = "2" 91 92[device "pcie.3"] 93 driver = "pcie-root-port" 94 bus = "pcie.0" 95 addr = "1c.2" 96 port = "3" 97 chassis = "3" 98 99[device "pcie.4"] 100 driver = "pcie-root-port" 101 bus = "pcie.0" 102 addr = "1c.3" 103 port = "4" 104 chassis = "4" 105 106[device "pcie.5"] 107 driver = "pcie-root-port" 108 bus = "pcie.0" 109 addr = "1c.4" 110 port = "5" 111 chassis = "5" 112 113[device "pcie.6"] 114 driver = "pcie-root-port" 115 bus = "pcie.0" 116 addr = "1c.5" 117 port = "6" 118 chassis = "6" 119 120[device "pcie.7"] 121 driver = "pcie-root-port" 122 bus = "pcie.0" 123 addr = "1c.6" 124 port = "7" 125 chassis = "7" 126 127[device "pcie.8"] 128 driver = "pcie-root-port" 129 bus = "pcie.0" 130 addr = "1c.7" 131 port = "8" 132 chassis = "8" 133 134 135# SCSI storage controller (and storage) 136# ========================================================= 137# 138# We use virtio-scsi here so that we can (hot)plug a large 139# number of disks without running into issues; a SCSI disk, 140# backed by a qcow2 disk image on the host's filesystem, is 141# attached to it. 142# 143# We also create an optical disk, mostly for installation 144# purposes: once the guest OS has been succesfully 145# installed, the guest will no longer boot from optical 146# media. If you don't want, or no longer want, to have an 147# optical disk in the guest you can safely comment out 148# all relevant sections below. 149 150[device "scsi"] 151 driver = "virtio-scsi-pci" 152 bus = "pcie.1" 153 addr = "00.0" 154 155[device "scsi-disk"] 156 driver = "scsi-hd" 157 bus = "scsi.0" 158 drive = "disk" 159 bootindex = "1" 160 161[drive "disk"] 162 file = "guest.qcow2" # CHANGE ME 163 format = "qcow2" 164 if = "none" 165 166[device "scsi-optical-disk"] 167 driver = "scsi-cd" 168 bus = "scsi.0" 169 drive = "optical-disk" 170 bootindex = "2" 171 172[drive "optical-disk"] 173 file = "install.iso" # CHANGE ME 174 format = "raw" 175 if = "none" 176 177 178# Ethernet controller 179# ========================================================= 180# 181# We use virtio-net for improved performance over emulated 182# hardware; on the host side, we take advantage of user 183# networking so that the QEMU process doesn't require any 184# additional privileges. 185 186[netdev "hostnet"] 187 type = "user" 188 189[device "net"] 190 driver = "virtio-net-pci" 191 netdev = "hostnet" 192 bus = "pcie.2" 193 addr = "00.0" 194