From nobody Thu Mar 28 22:14:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486747838495910.4342150158348; Fri, 10 Feb 2017 09:30:38 -0800 (PST) Received: from localhost ([::1]:45144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccF1o-00043v-VS for importer@patchew.org; Fri, 10 Feb 2017 12:30:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccEwk-0008FC-MT for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccEwh-00086o-Qg for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccEwh-00085v-FD for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:19 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A844B7FB92 for ; Fri, 10 Feb 2017 17:25:19 +0000 (UTC) Received: from inaba.usersys.redhat.com ([10.34.129.229]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AHPFch000898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 10 Feb 2017 12:25:18 -0500 From: Andrea Bolognani To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2017 18:25:05 +0100 Message-Id: <1486747506-15876-2-git-send-email-abologna@redhat.com> In-Reply-To: <1486747506-15876-1-git-send-email-abologna@redhat.com> References: <1486747506-15876-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 10 Feb 2017 17:25:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 1/2] q35: Improve sample configuration files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcel@redhat.com, drjones@redhat.com, lersek@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of having a single sample configuration file, we now have several: * q35-emulated.cfg documents the default devices QEMU adds to a q35 guest and the additional devices that are pretty much guaranteed to be present in a physical q35-based machine; * q35-virtio-graphical.cfg can be used to start a fully-featured (USB, graphical console, audio, etc.) guest that uses VirtIO instead of emulated devices; * q35-virtio-serial.cfg is similar but has a minimal set of devices and uses the serial console. All configuration files are fully commented and neatly organized. Reviewed-by: Marcel Apfelbaum --- docs/q35-chipset.cfg | 152 ---------------------- docs/q35-emulated.cfg | 288 ++++++++++++++++++++++++++++++++++++++= ++++ docs/q35-virtio-graphical.cfg | 248 ++++++++++++++++++++++++++++++++++++ docs/q35-virtio-serial.cfg | 193 ++++++++++++++++++++++++++++ 4 files changed, 729 insertions(+), 152 deletions(-) delete mode 100644 docs/q35-chipset.cfg create mode 100644 docs/q35-emulated.cfg create mode 100644 docs/q35-virtio-graphical.cfg create mode 100644 docs/q35-virtio-serial.cfg diff --git a/docs/q35-chipset.cfg b/docs/q35-chipset.cfg deleted file mode 100644 index e4ddb7d..0000000 --- a/docs/q35-chipset.cfg +++ /dev/null @@ -1,152 +0,0 @@ -################################################################ -# -# qemu -M q35 creates a bare machine with just the very essential -# chipset devices being present: -# -# 00.0 - Host bridge -# 1f.0 - ISA bridge / LPC -# 1f.2 - SATA (AHCI) controller -# 1f.3 - SMBus controller -# -# This config file documents the other devices and how they are -# created. You can simply use "-readconfig $thisfile" to create -# them all. Here is a overview: -# -# 19.0 - Ethernet controller (not created, our e1000 emulation -# doesn't emulate the ich9 device). -# 1a.* - USB Controller #2 (ehci + uhci companions) -# 1b.0 - HD Audio Controller -# 1c.* - PCI Express Ports -# 1d.* - USB Controller #1 (ehci + uhci companions, -# "qemu -M q35 -usb" creates these too) -# 1e.0 - PCI Bridge -# - -[device "ich9-ehci-2"] - driver =3D "ich9-usb-ehci2" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1a.7" - -[device "ich9-uhci-4"] - driver =3D "ich9-usb-uhci4" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1a.0" - masterbus =3D "ich9-ehci-2.0" - firstport =3D "0" - -[device "ich9-uhci-5"] - driver =3D "ich9-usb-uhci5" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1a.1" - masterbus =3D "ich9-ehci-2.0" - firstport =3D "2" - -[device "ich9-uhci-6"] - driver =3D "ich9-usb-uhci6" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1a.2" - masterbus =3D "ich9-ehci-2.0" - firstport =3D "4" - - -[device "ich9-hda-audio"] - driver =3D "ich9-intel-hda" - bus =3D "pcie.0" - addr =3D "1b.0" - - -[device "ich9-pcie-port-1"] - driver =3D "ioh3420" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1c.0" - port =3D "1" - chassis =3D "1" - -[device "ich9-pcie-port-2"] - driver =3D "ioh3420" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1c.1" - port =3D "2" - chassis =3D "2" - -[device "ich9-pcie-port-3"] - driver =3D "ioh3420" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1c.2" - port =3D "3" - chassis =3D "3" - -[device "ich9-pcie-port-4"] - driver =3D "ioh3420" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1c.3" - port =3D "4" - chassis =3D "4" - -## -# Example PCIe switch with two downstream ports -# -#[device "pcie-switch-upstream-port-1"] -# driver =3D "x3130-upstream" -# bus =3D "ich9-pcie-port-4" -# addr =3D "00.0" -# -#[device "pcie-switch-downstream-port-1-1"] -# driver =3D "xio3130-downstream" -# multifunction =3D "on" -# bus =3D "pcie-switch-upstream-port-1" -# addr =3D "00.0" -# port =3D "1" -# chassis =3D "5" -# -#[device "pcie-switch-downstream-port-1-2"] -# driver =3D "xio3130-downstream" -# multifunction =3D "on" -# bus =3D "pcie-switch-upstream-port-1" -# addr =3D "00.1" -# port =3D "1" -# chassis =3D "6" - -[device "ich9-ehci-1"] - driver =3D "ich9-usb-ehci1" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1d.7" - -[device "ich9-uhci-1"] - driver =3D "ich9-usb-uhci1" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1d.0" - masterbus =3D "ich9-ehci-1.0" - firstport =3D "0" - -[device "ich9-uhci-2"] - driver =3D "ich9-usb-uhci2" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1d.1" - masterbus =3D "ich9-ehci-1.0" - firstport =3D "2" - -[device "ich9-uhci-3"] - driver =3D "ich9-usb-uhci3" - multifunction =3D "on" - bus =3D "pcie.0" - addr =3D "1d.2" - masterbus =3D "ich9-ehci-1.0" - firstport =3D "4" - - -[device "ich9-pci-bridge"] - driver =3D "i82801b11-bridge" - bus =3D "pcie.0" - addr =3D "1e.0" diff --git a/docs/q35-emulated.cfg b/docs/q35-emulated.cfg new file mode 100644 index 0000000..c6416d6 --- /dev/null +++ b/docs/q35-emulated.cfg @@ -0,0 +1,288 @@ +# q35 - Emulated guest (graphical console) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Usage: +# +# $ qemu-system-x86_64 \ +# -nodefaults \ +# -readconfig q35-emulated.cfg +# +# You will probably need to tweak the lines marked as +# CHANGE ME before being able to use this configuration! +# +# The guest will have a selection of emulated devices that +# closely resembles that of a physical machine, and will be +# accessed through a graphical console. +# +# --------------------------------------------------------- +# +# Using -nodefaults is required to have full control over +# the virtual hardware: when it's specified, QEMU will +# populate the board with only the builtin peripherals +# plus a small selection of core PCI devices and +# controllers; the user will then have to explicitly add +# further devices. +# +# The core PCI devices show up in the guest as: +# +# 00:00.0 Host bridge +# 00:1f.0 ISA bridge / LPC +# 00:1f.2 SATA (AHCI) controller +# 00:1f.3 SMBus controller +# +# This configuration file adds a number of devices that +# are pretty much guaranteed to be present in every single +# physical machine based on q35, more specifically: +# +# 00:01.0 VGA compatible controller +# 00:19.0 Ethernet controller +# 00:1a.* USB controller (#2) +# 00:1b.0 Audio device +# 00:1c.* PCI bridge (PCI Express Root Ports) +# 00:1d.* USB Controller (#1) +# 00:1e.0 PCI bridge (legacy PCI bridge) +# +# More information about these devices is available below. + + +# Machine options +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use the q35 machine type and enable KVM acceleration +# for better performance. +# +# Using less than 1 GiB of memory is probably not going to +# yield good performance in the guest, and might even lead +# to obscure boot issues in some cases. +# +# Unfortunately, there is no way to configure the CPU model +# in this file, so it will have to be provided on the +# command line. + +[machine] + type =3D "q35" + accel =3D "kvm" + +[memory] + size =3D "1024" + + +# PCI bridge (PCI Express Root Ports) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We add four PCI Express Root Ports, all sharing the same +# slot on the PCI Express Root Bus. These ports support +# hotplug. + +[device "ich9-pcie-port-1"] + driver =3D "ioh3420" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1c.0" + port =3D "1" + chassis =3D "1" + +[device "ich9-pcie-port-2"] + driver =3D "ioh3420" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1c.1" + port =3D "2" + chassis =3D "2" + +[device "ich9-pcie-port-3"] + driver =3D "ioh3420" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1c.2" + port =3D "3" + chassis =3D "3" + +[device "ich9-pcie-port-4"] + driver =3D "ioh3420" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1c.3" + port =3D "4" + chassis =3D "4" + + +# PCI bridge (legacy PCI bridge) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# This bridge can be used to build an independent topology +# for legacy PCI devices. PCI Express devices should be +# plugged into PCI Express slots instead, so ideally there +# will be no devices connected to this bridge. + +[device "ich9-pci-bridge"] + driver =3D "i82801b11-bridge" + bus =3D "pcie.0" + addr =3D "1e.0" + + +# SATA storage +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# An implicit SATA controller is created automatically for +# every single q35 guest; here we create a disk, backed by +# a qcow2 disk image on the host's filesystem, and attach +# it to that controller so that the guest can use it. +# +# We also create an optical disk, mostly for installation +# purposes: once the guest OS has been succesfully +# installed, the guest will no longer boot from optical +# media. If you don't want, or no longer want, to have an +# optical disk in the guest you can safely comment out +# all relevant sections below. + +[device "sata-disk"] + driver =3D "ide-hd" + bus =3D "ide.0" + drive =3D "disk" + bootindex =3D "1" + +[drive "disk"] + file =3D "guest.qcow2" # CHANGE ME + format =3D "qcow2" + if =3D "none" + +[device "sata-optical-disk"] + driver =3D "ide-cd" + bus =3D "ide.1" + drive =3D "optical-disk" + bootindex =3D "2" + +[drive "optical-disk"] + file =3D "install.iso" # CHANGE ME + format =3D "raw" + if =3D "none" + + +# USB controller (#1) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# EHCI controller + UHCI companion controllers. + +[device "ich9-ehci-1"] + driver =3D "ich9-usb-ehci1" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1d.7" + +[device "ich9-uhci-1"] + driver =3D "ich9-usb-uhci1" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1d.0" + masterbus =3D "ich9-ehci-1.0" + firstport =3D "0" + +[device "ich9-uhci-2"] + driver =3D "ich9-usb-uhci2" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1d.1" + masterbus =3D "ich9-ehci-1.0" + firstport =3D "2" + +[device "ich9-uhci-3"] + driver =3D "ich9-usb-uhci3" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1d.2" + masterbus =3D "ich9-ehci-1.0" + firstport =3D "4" + + +# USB controller (#2) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# EHCI controller + UHCI companion controllers. + +[device "ich9-ehci-2"] + driver =3D "ich9-usb-ehci2" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1a.7" + +[device "ich9-uhci-4"] + driver =3D "ich9-usb-uhci4" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1a.0" + masterbus =3D "ich9-ehci-2.0" + firstport =3D "0" + +[device "ich9-uhci-5"] + driver =3D "ich9-usb-uhci5" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1a.1" + masterbus =3D "ich9-ehci-2.0" + firstport =3D "2" + +[device "ich9-uhci-6"] + driver =3D "ich9-usb-uhci6" + multifunction =3D "on" + bus =3D "pcie.0" + addr =3D "1a.2" + masterbus =3D "ich9-ehci-2.0" + firstport =3D "4" + + +# Ethernet controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We add a Gigabit Ethernet interface to the guest; on the +# host side, we take advantage of user networking so that +# the QEMU process doesn't require any additional +# privileges. + +[netdev "hostnet"] + type =3D "user" + +[device "net"] + driver =3D "e1000" + netdev =3D "hostnet" + bus =3D "pcie.0" + addr =3D "19.0" + + +# VGA compatible controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use stdvga instead of Cirrus as it supports more video +# modes and is closer to what actual hardware looks like. +# +# If you're running the guest on a remote, potentially +# headless host, you will probably want to append something +# like +# +# -display vnc=3D127.0.0.1:0 +# +# to the command line in order to prevent QEMU from +# creating a graphical display window on the host and +# enable remote access instead. + +[device "video"] + driver =3D "VGA" + bus =3D "pcie.0" + addr =3D "01.0" + + +# Audio device +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# The sound card is a legacy PCI device that is plugged +# directly into the PCI Express Root Bus. + +[device "ich9-hda-audio"] + driver =3D "ich9-intel-hda" + bus =3D "pcie.0" + addr =3D "1b.0" + +[device "ich9-hda-duplex"] + driver =3D "hda-duplex" + bus =3D "ich9-hda-audio.0" + cad =3D "0" diff --git a/docs/q35-virtio-graphical.cfg b/docs/q35-virtio-graphical.cfg new file mode 100644 index 0000000..28bde2f --- /dev/null +++ b/docs/q35-virtio-graphical.cfg @@ -0,0 +1,248 @@ +# q35 - VirtIO guest (graphical console) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Usage: +# +# $ qemu-system-x86_64 \ +# -nodefaults \ +# -readconfig q35-virtio-graphical.cfg +# +# You will probably need to tweak the lines marked as +# CHANGE ME before being able to use this configuration! +# +# The guest will have a selection of VirtIO devices +# tailored towards optimal performance with modern guests, +# and will be accessed through a graphical console. +# +# --------------------------------------------------------- +# +# Using -nodefaults is required to have full control over +# the virtual hardware: when it's specified, QEMU will +# populate the board with only the builtin peripherals +# plus a small selection of core PCI devices and +# controllers; the user will then have to explicitly add +# further devices. +# +# The core PCI devices show up in the guest as: +# +# 00:00.0 Host bridge +# 00:1f.0 ISA bridge / LPC +# 00:1f.2 SATA (AHCI) controller +# 00:1f.3 SMBus controller +# +# This configuration file adds a number of other useful +# devices, more specifically: +# +# 00:01.0 VGA compatible controller +# 00:1b.0 Audio device +# 00.1c.* PCI bridge (PCI Express Root Ports) +# 01:00.0 SCSI storage controller +# 02:00.0 Ethernet controller +# 03:00.0 USB controller +# +# More information about these devices is available below. + + +# Machine options +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use the q35 machine type and enable KVM acceleration +# for better performance. +# +# Using less than 1 GiB of memory is probably not going to +# yield good performance in the guest, and might even lead +# to obscure boot issues in some cases. + +[machine] + type =3D "q35" + accel =3D "kvm" + +[memory] + size =3D "1024" + + +# PCI bridge (PCI Express Root Ports) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We create eight PCI Express Root Ports, and we plug them +# all into separate functions of the same slot. Some of +# them will be used by devices, the rest will remain +# available for hotplug. + +[device "pcie.1"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.0" + port =3D "1" + chassis =3D "1" + multifunction =3D "on" + +[device "pcie.2"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.1" + port =3D "2" + chassis =3D "2" + +[device "pcie.3"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.2" + port =3D "3" + chassis =3D "3" + +[device "pcie.4"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.3" + port =3D "4" + chassis =3D "4" + +[device "pcie.5"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.4" + port =3D "5" + chassis =3D "5" + +[device "pcie.6"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.5" + port =3D "6" + chassis =3D "6" + +[device "pcie.7"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.6" + port =3D "7" + chassis =3D "7" + +[device "pcie.8"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.7" + port =3D "8" + chassis =3D "8" + + +# SCSI storage controller (and storage) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-scsi here so that we can (hot)plug a large +# number of disks without running into issues; a SCSI disk, +# backed by a qcow2 disk image on the host's filesystem, is +# attached to it. +# +# We also create an optical disk, mostly for installation +# purposes: once the guest OS has been succesfully +# installed, the guest will no longer boot from optical +# media. If you don't want, or no longer want, to have an +# optical disk in the guest you can safely comment out +# all relevant sections below. + +[device "scsi"] + driver =3D "virtio-scsi-pci" + bus =3D "pcie.1" + addr =3D "00.0" + +[device "scsi-disk"] + driver =3D "scsi-hd" + bus =3D "scsi.0" + drive =3D "disk" + bootindex =3D "1" + +[drive "disk"] + file =3D "guest.qcow2" # CHANGE ME + format =3D "qcow2" + if =3D "none" + +[device "scsi-optical-disk"] + driver =3D "scsi-cd" + bus =3D "scsi.0" + drive =3D "optical-disk" + bootindex =3D "2" + +[drive "optical-disk"] + file =3D "install.iso" # CHANGE ME + format =3D "raw" + if =3D "none" + + +# Ethernet controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-net for improved performance over emulated +# hardware; on the host side, we take advantage of user +# networking so that the QEMU process doesn't require any +# additional privileges. + +[netdev "hostnet"] + type =3D "user" + +[device "net"] + driver =3D "virtio-net-pci" + netdev =3D "hostnet" + bus =3D "pcie.2" + addr =3D "00.0" + + +# USB controller (and input devices) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We add a virtualization-friendly USB 3.0 controller and +# a USB tablet so that graphical guests can be controlled +# appropriately. A USB keyboard is not needed, as q35 +# guests get a PS/2 one added automatically. + +[device "usb"] + driver =3D "nec-usb-xhci" + bus =3D "pcie.3" + addr =3D "00.0" + +[device "tablet"] + driver =3D "usb-tablet" + bus =3D "usb.0" + + +# VGA compatible controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We plug the QXL video card directly into the PCI Express +# Root Bus as it is a legacy PCI device; this way, we can +# reduce the number of PCI Express controllers in the +# guest. +# +# If you're running the guest on a remote, potentially +# headless host, you will probably want to append something +# like +# +# -display vnc=3D127.0.0.1:0 +# +# to the command line in order to prevent QEMU from +# creating a graphical display window on the host and +# enable remote access instead. + +[device "video"] + driver =3D "qxl-vga" + bus =3D "pcie.0" + addr =3D "01.0" + + +# Audio device +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Like the video card, the sound card is a legacy PCI +# device and as such can be plugged directly into the PCI +# Express Root Bus. + +[device "sound"] + driver =3D "ich9-intel-hda" + bus =3D "pcie.0" + addr =3D "1b.0" + +[device "duplex"] + driver =3D "hda-duplex" + bus =3D "sound.0" + cad =3D "0" diff --git a/docs/q35-virtio-serial.cfg b/docs/q35-virtio-serial.cfg new file mode 100644 index 0000000..c33c9cc --- /dev/null +++ b/docs/q35-virtio-serial.cfg @@ -0,0 +1,193 @@ +# q35 - VirtIO guest (serial console) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Usage: +# +# $ qemu-system-x86_64 \ +# -nodefaults \ +# -readconfig q35-virtio-serial.cfg \ +# -display none -serial mon:stdio +# +# You will probably need to tweak the lines marked as +# CHANGE ME before being able to use this configuration! +# +# The guest will have a selection of VirtIO devices +# tailored towards optimal performance with modern guests, +# and will be accessed through the serial console. +# +# --------------------------------------------------------- +# +# Using -nodefaults is required to have full control over +# the virtual hardware: when it's specified, QEMU will +# populate the board with only the builtin peripherals +# plus a small selection of core PCI devices and +# controllers; the user will then have to explicitly add +# further devices. +# +# The core PCI devices show up in the guest as: +# +# 00:00.0 Host bridge +# 00:1f.0 ISA bridge / LPC +# 00:1f.2 SATA (AHCI) controller +# 00:1f.3 SMBus controller +# +# This configuration file adds a number of other useful +# devices, more specifically: +# +# 00.1c.* PCI bridge (PCI Express Root Ports) +# 01:00.0 SCSI storage controller +# 02:00.0 Ethernet controller +# +# More information about these devices is available below. +# +# We use '-display none' to prevent QEMU from creating a +# graphical display window, which would serve no use in +# this specific configuration, and '-serial mon:stdio' to +# multiplex the guest's serial console and the QEMU monitor +# to the host's stdio; use 'Ctrl+A h' to learn how to +# switch between the two and more. + + +# Machine options +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use the q35 machine type and enable KVM acceleration +# for better performance. +# +# Using less than 1 GiB of memory is probably not going to +# yield good performance in the guest, and might even lead +# to obscure boot issues in some cases. + +[machine] + type =3D "q35" + accel =3D "kvm" + +[memory] + size =3D "1024" + + +# PCI bridge (PCI Express Root Ports) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We create eight PCI Express Root Ports, and we plug them +# all into separate functions of the same slot. Some of +# them will be used by devices, the rest will remain +# available for hotplug. + +[device "pcie.1"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.0" + port =3D "1" + chassis =3D "1" + multifunction =3D "on" + +[device "pcie.2"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.1" + port =3D "2" + chassis =3D "2" + +[device "pcie.3"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.2" + port =3D "3" + chassis =3D "3" + +[device "pcie.4"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.3" + port =3D "4" + chassis =3D "4" + +[device "pcie.5"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.4" + port =3D "5" + chassis =3D "5" + +[device "pcie.6"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.5" + port =3D "6" + chassis =3D "6" + +[device "pcie.7"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.6" + port =3D "7" + chassis =3D "7" + +[device "pcie.8"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.7" + port =3D "8" + chassis =3D "8" + + +# SCSI storage controller (and storage) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-scsi here so that we can (hot)plug a large +# number of disks without running into issues; a SCSI disk, +# backed by a qcow2 disk image on the host's filesystem, is +# attached to it. +# +# We also create an optical disk, mostly for installation +# purposes: once the guest OS has been succesfully +# installed, the guest will no longer boot from optical +# media. If you don't want, or no longer want, to have an +# optical disk in the guest you can safely comment out +# all relevant sections below. + +[device "scsi"] + driver =3D "virtio-scsi-pci" + bus =3D "pcie.1" + addr =3D "00.0" + +[device "scsi-disk"] + driver =3D "scsi-hd" + bus =3D "scsi.0" + drive =3D "disk" + bootindex =3D "1" + +[drive "disk"] + file =3D "guest.qcow2" # CHANGE ME + format =3D "qcow2" + if =3D "none" + +[device "scsi-optical-disk"] + driver =3D "scsi-cd" + bus =3D "scsi.0" + drive =3D "optical-disk" + bootindex =3D "2" + +[drive "optical-disk"] + file =3D "install.iso" # CHANGE ME + format =3D "raw" + if =3D "none" + + +# Ethernet controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-net for improved performance over emulated +# hardware; on the host side, we take advantage of user +# networking so that the QEMU process doesn't require any +# additional privileges. + +[netdev "hostnet"] + type =3D "user" + +[device "net"] + driver =3D "virtio-net-pci" + netdev =3D "hostnet" + bus =3D "pcie.2" + addr =3D "00.0" --=20 2.7.4 From nobody Thu Mar 28 22:14:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486748087824631.2757972995402; Fri, 10 Feb 2017 09:34:47 -0800 (PST) Received: from localhost ([::1]:45158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccF5q-0007mD-FL for importer@patchew.org; Fri, 10 Feb 2017 12:34:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccEwm-0008H7-HK for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccEwj-00087U-7j for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58892) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccEwi-00086x-UE for qemu-devel@nongnu.org; Fri, 10 Feb 2017 12:25:21 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2794361B86 for ; Fri, 10 Feb 2017 17:25:21 +0000 (UTC) Received: from inaba.usersys.redhat.com ([10.34.129.229]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AHPFci000898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 10 Feb 2017 12:25:19 -0500 From: Andrea Bolognani To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2017 18:25:06 +0100 Message-Id: <1486747506-15876-3-git-send-email-abologna@redhat.com> In-Reply-To: <1486747506-15876-1-git-send-email-abologna@redhat.com> References: <1486747506-15876-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 10 Feb 2017 17:25:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 2/2] mach-virt: Provide sample configuration files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcel@redhat.com, drjones@redhat.com, lersek@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These are very much like the sample configuration files for q35, and can be used both as documentation and as a starting point for creating your own guest. Two sample configuration files are provided: * mach-virt-graphical.cfg can be used to start a fully-featured (USB, graphical console, etc.) guest that uses VirtIO devices; * mach-virt-serial.cfg is similar but has a minimal set of devices and uses the serial console. All configuration files are fully commented and neatly organized. Reviewed-by: Andrew Jones Reviewed-by: Laszlo Ersek --- docs/mach-virt-graphical.cfg | 281 +++++++++++++++++++++++++++++++++++++++= ++++ docs/mach-virt-serial.cfg | 243 +++++++++++++++++++++++++++++++++++++ 2 files changed, 524 insertions(+) create mode 100644 docs/mach-virt-graphical.cfg create mode 100644 docs/mach-virt-serial.cfg diff --git a/docs/mach-virt-graphical.cfg b/docs/mach-virt-graphical.cfg new file mode 100644 index 0000000..0fdf684 --- /dev/null +++ b/docs/mach-virt-graphical.cfg @@ -0,0 +1,281 @@ +# mach-virt - VirtIO guest (graphical console) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Usage: +# +# $ qemu-system-aarch64 \ +# -nodefaults \ +# -readconfig mach-virt-graphical.cfg \ +# -cpu host +# +# You will probably need to tweak the lines marked as +# CHANGE ME before being able to use this configuration! +# +# The guest will have a selection of VirtIO devices +# tailored towards optimal performance with modern guests, +# and will be accessed through a graphical console. +# +# --------------------------------------------------------- +# +# Using -nodefaults is required to have full control over +# the virtual hardware: when it's specified, QEMU will +# populate the board with only the builtin peripherals, +# such as the PL011 UART, plus a PCI Express Root Bus; the +# user will then have to explicitly add further devices. +# +# The PCI Express Root Bus shows up in the guest as: +# +# 00:00.0 Host bridge +# +# This configuration file adds a number of other useful +# devices, more specifically: +# +# 00:01.0 Display controller +# 00.1c.* PCI bridge (PCI Express Root Ports) +# 01:00.0 SCSI storage controller +# 02:00.0 Ethernet controller +# 03:00.0 USB controller +# +# More information about these devices is available below. + + +# Machine options +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use the virt machine type and enable KVM acceleration +# for better performance. +# +# Using less than 1 GiB of memory is probably not going to +# yield good performance in the guest, and might even lead +# to obscure boot issues in some cases. +# +# Unfortunately, there is no way to configure the CPU model +# in this file, so it will have to be provided on the +# command line, but we can configure the guest to use the +# same GIC version as the host. + +[machine] + type =3D "virt" + accel =3D "kvm" + gic-version =3D "host" + +[memory] + size =3D "1024" + + +# Firmware configuration +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# There are two parts to the firmware: a read-only image +# containing the executable code, which is shared between +# guests, and a read/write variable store that is owned +# by one specific guest, exclusively, and is used to +# record information such as the UEFI boot order. +# +# For any new guest, its permanent, private variable store +# should initially be copied from the template file +# provided along with the firmware binary. +# +# Depending on the OS distribution you're using on the +# host, the name of the package containing the firmware +# binary and variable store template, as well as the paths +# to the files themselves, will be different. For example: +# +# Fedora +# edk2-aarch64 (pkg) +# /usr/share/edk2/aarch64/QEMU_EFI-pflash.raw (bin) +# /usr/share/edk2/aarch64/vars-template-pflash.raw (var) +# +# RHEL +# AAVMF (pkg) +# /usr/share/AAVMF/AAVMF_CODE.fd (bin) +# /usr/share/AAVMF/AAVMF_VARS.fd (var) +# +# Debian/Ubuntu +# qemu-efi (pkg) +# /usr/share/AAVMF/AAVMF_CODE.fd (bin) +# /usr/share/AAVMF/AAVMF_VARS.fd (var) + +[drive "uefi-binary"] + file =3D "/usr/share/AAVMF/AAVMF_CODE.fd" # CHANGE ME + format =3D "raw" + if =3D "pflash" + unit =3D "0" + readonly =3D "on" + +[drive "uefi-varstore"] + file =3D "guest_VARS.fd" # CHANGE ME + format =3D "raw" + if =3D "pflash" + unit =3D "1" + + +# PCI bridge (PCI Express Root Ports) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We create eight PCI Express Root Ports, and we plug them +# all into separate functions of the same slot. Some of +# them will be used by devices, the rest will remain +# available for hotplug. + +[device "pcie.1"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.0" + port =3D "1" + chassis =3D "1" + multifunction =3D "on" + +[device "pcie.2"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.1" + port =3D "2" + chassis =3D "2" + +[device "pcie.3"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.2" + port =3D "3" + chassis =3D "3" + +[device "pcie.4"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.3" + port =3D "4" + chassis =3D "4" + +[device "pcie.5"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.4" + port =3D "5" + chassis =3D "5" + +[device "pcie.6"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.5" + port =3D "6" + chassis =3D "6" + +[device "pcie.7"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.6" + port =3D "7" + chassis =3D "7" + +[device "pcie.8"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.7" + port =3D "8" + chassis =3D "8" + + +# SCSI storage controller (and storage) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-scsi here so that we can (hot)plug a large +# number of disks without running into issues; a SCSI disk, +# backed by a qcow2 disk image on the host's filesystem, is +# attached to it. +# +# We also create an optical disk, mostly for installation +# purposes: once the guest OS has been succesfully +# installed, the guest will no longer boot from optical +# media. If you don't want, or no longer want, to have an +# optical disk in the guest you can safely comment out +# all relevant sections below. + +[device "scsi"] + driver =3D "virtio-scsi-pci" + bus =3D "pcie.1" + addr =3D "00.0" + +[device "scsi-disk"] + driver =3D "scsi-hd" + bus =3D "scsi.0" + drive =3D "disk" + bootindex =3D "1" + +[drive "disk"] + file =3D "guest.qcow2" # CHANGE ME + format =3D "qcow2" + if =3D "none" + +[device "scsi-optical-disk"] + driver =3D "scsi-cd" + bus =3D "scsi.0" + drive =3D "optical-disk" + bootindex =3D "2" + +[drive "optical-disk"] + file =3D "install.iso" # CHANGE ME + format =3D "raw" + if =3D "none" + + +# Ethernet controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-net for improved performance over emulated +# hardware; on the host side, we take advantage of user +# networking so that the QEMU process doesn't require any +# additional privileges. + +[netdev "hostnet"] + type =3D "user" + +[device "net"] + driver =3D "virtio-net-pci" + netdev =3D "hostnet" + bus =3D "pcie.2" + addr =3D "00.0" + + +# USB controller (and input devices) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We add a virtualization-friendly USB 3.0 controller and +# a USB keyboard / USB tablet combo so that graphical +# guests can be controlled appropriately. + +[device "usb"] + driver =3D "nec-usb-xhci" + bus =3D "pcie.3" + addr =3D "00.0" + +[device "keyboard"] + driver =3D "usb-kbd" + bus =3D "usb.0" + +[device "tablet"] + driver =3D "usb-tablet" + bus =3D "usb.0" + + +# Display controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-gpu because the legacy VGA framebuffer is +# very troublesome on aarch64, and virtio-gpu is the only +# video device that doesn't implement it. +# +# If you're running the guest on a remote, potentially +# headless host, you will probably want to append something +# like +# +# -display vnc=3D127.0.0.1:0 +# +# to the command line in order to prevent QEMU from +# creating a graphical display window on the host and +# enable remote access instead. + +[device "video"] + driver =3D "virtio-gpu" + bus =3D "pcie.0" + addr =3D "01.0" diff --git a/docs/mach-virt-serial.cfg b/docs/mach-virt-serial.cfg new file mode 100644 index 0000000..aee9f1c --- /dev/null +++ b/docs/mach-virt-serial.cfg @@ -0,0 +1,243 @@ +# mach-virt - VirtIO guest (serial console) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# Usage: +# +# $ qemu-system-aarch64 \ +# -nodefaults \ +# -readconfig mach-virt-serial.cfg \ +# -display none -serial mon:stdio \ +# -cpu host +# +# You will probably need to tweak the lines marked as +# CHANGE ME before being able to use this configuration! +# +# The guest will have a selection of VirtIO devices +# tailored towards optimal performance with modern guests, +# and will be accessed through the serial console. +# +# --------------------------------------------------------- +# +# Using -nodefaults is required to have full control over +# the virtual hardware: when it's specified, QEMU will +# populate the board with only the builtin peripherals, +# such as the PL011 UART, plus a PCI Express Root Bus; the +# user will then have to explicitly add further devices. +# +# The PCI Express Root Bus shows up in the guest as: +# +# 00:00.0 Host bridge +# +# This configuration file adds a number of other useful +# devices, more specifically: +# +# 00.1c.* PCI bridge (PCI Express Root Ports) +# 01:00.0 SCSI storage controller +# 02:00.0 Ethernet controller +# +# More information about these devices is available below. +# +# We use '-display none' to prevent QEMU from creating a +# graphical display window, which would serve no use in +# this specific configuration, and '-serial mon:stdio' to +# multiplex the guest's serial console and the QEMU monitor +# to the host's stdio; use 'Ctrl+A h' to learn how to +# switch between the two and more. + + +# Machine options +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use the virt machine type and enable KVM acceleration +# for better performance. +# +# Using less than 1 GiB of memory is probably not going to +# yield good performance in the guest, and might even lead +# to obscure boot issues in some cases. +# +# Unfortunately, there is no way to configure the CPU model +# in this file, so it will have to be provided on the +# command line, but we can configure the guest to use the +# same GIC version as the host. + +[machine] + type =3D "virt" + accel =3D "kvm" + gic-version =3D "host" + +[memory] + size =3D "1024" + + +# Firmware configuration +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# There are two parts to the firmware: a read-only image +# containing the executable code, which is shared between +# guests, and a read/write variable store that is owned +# by one specific guest, exclusively, and is used to +# record information such as the UEFI boot order. +# +# For any new guest, its permanent, private variable store +# should initially be copied from the template file +# provided along with the firmware binary. +# +# Depending on the OS distribution you're using on the +# host, the name of the package containing the firmware +# binary and variable store template, as well as the paths +# to the files themselves, will be different. For example: +# +# Fedora +# edk2-aarch64 (pkg) +# /usr/share/edk2/aarch64/QEMU_EFI-pflash.raw (bin) +# /usr/share/edk2/aarch64/vars-template-pflash.raw (var) +# +# RHEL +# AAVMF (pkg) +# /usr/share/AAVMF/AAVMF_CODE.fd (bin) +# /usr/share/AAVMF/AAVMF_VARS.fd (var) +# +# Debian/Ubuntu +# qemu-efi (pkg) +# /usr/share/AAVMF/AAVMF_CODE.fd (bin) +# /usr/share/AAVMF/AAVMF_VARS.fd (var) + +[drive "uefi-binary"] + file =3D "/usr/share/AAVMF/AAVMF_CODE.fd" # CHANGE ME + format =3D "raw" + if =3D "pflash" + unit =3D "0" + readonly =3D "on" + +[drive "uefi-varstore"] + file =3D "guest_VARS.fd" # CHANGE ME + format =3D "raw" + if =3D "pflash" + unit =3D "1" + + +# PCI bridge (PCI Express Root Ports) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We create eight PCI Express Root Ports, and we plug them +# all into separate functions of the same slot. Some of +# them will be used by devices, the rest will remain +# available for hotplug. + +[device "pcie.1"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.0" + port =3D "1" + chassis =3D "1" + multifunction =3D "on" + +[device "pcie.2"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.1" + port =3D "2" + chassis =3D "2" + +[device "pcie.3"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.2" + port =3D "3" + chassis =3D "3" + +[device "pcie.4"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.3" + port =3D "4" + chassis =3D "4" + +[device "pcie.5"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.4" + port =3D "5" + chassis =3D "5" + +[device "pcie.6"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.5" + port =3D "6" + chassis =3D "6" + +[device "pcie.7"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.6" + port =3D "7" + chassis =3D "7" + +[device "pcie.8"] + driver =3D "pcie-root-port" + bus =3D "pcie.0" + addr =3D "1c.7" + port =3D "8" + chassis =3D "8" + + +# SCSI storage controller (and storage) +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-scsi here so that we can (hot)plug a large +# number of disks without running into issues; a SCSI disk, +# backed by a qcow2 disk image on the host's filesystem, is +# attached to it. +# +# We also create an optical disk, mostly for installation +# purposes: once the guest OS has been succesfully +# installed, the guest will no longer boot from optical +# media. If you don't want, or no longer want, to have an +# optical disk in the guest you can safely comment out +# all relevant sections below. + +[device "scsi"] + driver =3D "virtio-scsi-pci" + bus =3D "pcie.1" + addr =3D "00.0" + +[device "scsi-disk"] + driver =3D "scsi-hd" + bus =3D "scsi.0" + drive =3D "disk" + bootindex =3D "1" + +[drive "disk"] + file =3D "guest.qcow2" # CHANGE ME + format =3D "qcow2" + if =3D "none" + +[device "scsi-optical-disk"] + driver =3D "scsi-cd" + bus =3D "scsi.0" + drive =3D "optical-disk" + bootindex =3D "2" + +[drive "optical-disk"] + file =3D "install.iso" # CHANGE ME + format =3D "raw" + if =3D "none" + + +# Ethernet controller +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D +# +# We use virtio-net for improved performance over emulated +# hardware; on the host side, we take advantage of user +# networking so that the QEMU process doesn't require any +# additional privileges. + +[netdev "hostnet"] + type =3D "user" + +[device "net"] + driver =3D "virtio-net-pci" + netdev =3D "hostnet" + bus =3D "pcie.2" + addr =3D "00.0" --=20 2.7.4