qemu-devel.nongnu.org archive mirror
 help / color / mirror / 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	[thread overview]
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
src/fw/acpi.c:build_mcfg_q35().

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:
http://developer.amd.com/wordpress/media/2012/10/pci%20-%20pci%20express%20configuration%20space%20access.pdf
https://wiki.osdev.org/PCI_Express#Enhanced_Configuration_Mechanism

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

SeaBIOS source code:
https://git.seabios.org/cgit/seabios.git

QEMU source code:
https://git.qemu.org/?p=qemu.git;a=summary

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.

Stefan

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

  parent reply	other threads:[~2019-11-05 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03 10:59 Feature Recommendations? 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 publicly 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* 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 \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).