qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Recommendations?


From: Stefan Hajnoczi
Subject: Re: Feature Recommendations?
Date: Tue, 5 Nov 2019 17:39:52 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]