QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Dinah A Baum <dinahbaum@utexas.edu>
Cc: Julia Suvorova <jusual@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: Feature Recommendations?
Date: Tue, 5 Nov 2019 17:39:52 +0100
Message-ID: <20191105163952.GI166646@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAOyzTAivEpv1VXzPXVH3Za9Zcz1URFjnpFCZQrRB4K=Z-oy1Dw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2382 bytes --]

On Sun, Nov 03, 2019 at 04:59:31AM -0600, Dinah A Baum wrote:
> I am a university student whose Virtualization course has tasked me with
> contributing to an open source, virtualization related project. I have a
> little more than a month to complete this. I was wondering if you could
> recommend a feature you'd like added that could be done in this time frame.

Hi Dinah,
The SeaBIOS firmware used by x86 guests currently requires 2 vmexits per
PCI Configuration Space access.  It is possible to reduce the number of
vmexits and speed up boot time by doing this.

SeaBIOS uses the standard 0xcf8/0xcfc PIO registers to access PCI
configuration space in src/hw/pci.c.  See pci_config_writel(),
pci_config_readl(), and related functions.

There is code in SeaBIOS that actually already knows about the more
modern MMConfig (also known as ACPI MCFG) mechanism for accessing PCI
Configuration Space.  But this code currently only places this
information into the MCFG ACPI table that operating systems running
after SeaBIOS will use.  See src/fw/pciinit.c:mch_mmconfig_setup() and

The goal of this project is to modify src/hw/pci.c to use MMConfig when
available.  This will reduce the number of vmexits when a virtual
machine is started and therefore speed up boot.

General information on PCI Configuration Space access:

QEMU MCFG emulation code:
hw/pci/pcie_host.c:pcie_host_mmcfg_map(), pcie_mmcfg_data_write(), and

SeaBIOS source code:

QEMU source code:

To test a modified SeaBIOS in QEMU:

  $ git clone https://git.qemu.org/qemu.git
  $ cd qemu
  $ git submodule update --init roms/seabios
  $ ./configure --target-list=x86_64-softmmu && make -j$(nproc)
  $ cd roms/seabios
  $ ...modify the SeaBIOS code...
  $ cd ..
  $ make bios # this will build SeaBIOS
  $ cd ..
  $ x86_64-softmmu/qemu-system-x86_64 -M accel=kvm -m 1G -drive if=virtio,file=test.img,format=raw

This will launch a QEMU guest with 1 GB of RAM and a virtio-blk-pci
device.  Your SeaBIOS changes will be used when the firmware attempts to
boot from the virtio-blk-pci device.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 10:59 Dinah A Baum
2019-11-04 11:40 ` Alex Bennée
2019-11-05 16:39 ` Stefan Hajnoczi [this message]
2019-11-06 17:41 ` Eric Blake
2019-11-06 17:54   ` Peter Maydell

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105163952.GI166646@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=dinahbaum@utexas.edu \
    --cc=jusual@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git