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