From: Eric Auger <eric.auger@linaro.org>
To: eric.auger@st.com, christoffer.dall@linaro.org,
qemu-devel@nongnu.org, kim.phillips@freescale.com,
a.rigo@virtualopensystems.com
Cc: peter.maydell@linaro.org, eric.auger@linaro.org,
patches@linaro.org, agraf@suse.de, stuart.yoder@freescale.com,
alex.williamson@redhat.com, christophe.barnichon@st.com,
a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu
Subject: [Qemu-devel] [RFC v3 00/10] KVM platform device passthrough
Date: Mon, 2 Jun 2014 08:49:24 +0100 [thread overview]
Message-ID: <1401695374-4287-1-git-send-email-eric.auger@linaro.org> (raw)
This RFC series aims at enabling KVM platform device passthrough.
It implements a VFIO platform device and offers the capability to
instantiate this VFIO device in mach-virt.
The VFIO platform device uses an host VFIO platform driver which must
be bound to the assigned device prior to the QEMU system start.
- the guest can directly access the device register space
- assigned device IRQs are transparently routed to the guest by
QEMU/KVM (2 methods currently are supported)
- iommu is transparently programmed to prevent the device from
accessing physical pages outside of the guest address space
The patch series is made of the following patch files
1) provides a mach_virt implementation where a VFIO device is
instantiated at a fixed location
2) addresses A.Williamson's comment to have the platform device code
separated from the PCI device code. The VFIO device is moved in a
new directory hw/vfio/
3) provides a VFIO platform device that supports MMIO direct accesses.
the vfio device was reworked to factorize at best the code between
the PCI device and the platform device.
4) simplifies pci device trace calls using common "name" field
5) provides initial IRQ support. The device IRQ now are routed to the
guest. IRQ handling is based on eventfds handled on user side.
End of interrupt is detected by trapping guest access to MMIO.
Functional but suffers from some performance limitations.
6) enables the QEMU end-user to dynamically assign the device
from command line, using -device option. Request a minimal
knowledge from the end-user (vfio driver name and compatibility).
From that point on the VFIO platform device becomes fully generic.
a single compat string is supported. A single MMIO region is
supported.
7) regions are IOMMU mapped as executable. This feature is requested
for some DMA devices that fetch code from some regions (typically
the PL330).
8) Add support for multi compat strings. This feature is requested
for Primecell devices
9) forces eventfd notifying mechanism
10) Introduces a new way of IRQ routing (based on KVM irqfd/GSI
routing). This method is far more performant than the one
introduced in 4) since eventfds are handled on host kernel side
and also interrupt completion is trapped at GIC level.
v1 (Kim Phillips):
Initial versions for 1, 2, 3
v1->v2 changes (Kim Phillips, Eric Auger):
- reworked split between PCI and platform (3)
- IRQ initial support (5)
- dynamic instantiation (6)
v2->v3 changes (Alvise Rigo, Eric Auger):
- Following Alex recommandations, further efforts to factorize the
code between PCI, platform usage of VFIOPlatform and VFIORegion
as base classes (3, 4)
- cleanup following Kim's comments
- multiple IRQ support mechanics should be in place although not
tested
- Better handling of MMIO multiple regions
- New features and fixes by Alvise (7, 8, 9)
- irqfd support (10)
This patch has the following dependencies on kernel side:
- [RFC Patch v5 0/11] VFIO support for platform devices
http://www.spinics.net/lists/kvm/msg102309.html
- [Patch] ARM: KVM: Handle IPA unmapping on memory region deletion
https://patches.linaro.org/27691/
- [PATCH v2] ARM: KVM: add irqfd and irq routing support
https://patches.linaro.org/29896/
- [PATCH] ARM: KVM: Enable the KVM-VFIO device
https://lists.cs.columbia.edu/pipermail/kvmarm/2014-March/008629.html
- [PATCH] ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping
https://lists.cs.columbia.edu/pipermail/kvmarm/2014-March/008630.html
The patch series was tested on Calxeda Midway (ARMv7) where one xgmac
is assigned to KVM host while the second one is assigned to the guest.
Tentative Plan:
- further IRQ handling optimizations (removal of maintenance IRQ)
- unbind/migration/reset problematics
- multi-instantiation testing
- multiple IRQ testing
- management of platform devices with more complex device tree node
Here are the instructions to test on a Calxeda Midway:
https://wiki.linaro.org/LEG/Engineering/Virtualization/Platform_Device_Passthrough_on_Midway
git://git.linaro.org/people/eric.auger/linux.git (branch irqfd_integ_v2)
git://git.linaro.org/people/eric.auger/qemu.git (branch vfio-dev-integ-RFCv3)
Best Regards
Eric
Alvise Rigo (3):
Add EXEC_FLAG to VFIO DMA mappings
Add AMBA devices support to VFIO
Always use eventfd as notifying mechanism
Eric Auger (4):
vfio: simplifed DPRINTF calls using device name
vfio: Add initial IRQ support in platform device
virt: Assign a VFIO platform device with -device option
vfio: Add irqfd support in platform device
Kim Phillips (3):
hw/arm/virt: add a xgmac device
vfio: move hw/misc/vfio.c to hw/vfio/pci.c
vfio: add vfio-platform support
LICENSE | 2 +-
MAINTAINERS | 2 +-
hw/Makefile.objs | 1 +
hw/arm/virt.c | 238 +++++-
hw/intc/arm_gic_kvm.c | 1 +
hw/misc/Makefile.objs | 1 -
hw/vfio/Makefile.objs | 5 +
hw/vfio/common.c | 854 ++++++++++++++++++++++
hw/{misc/vfio.c => vfio/pci.c} | 1562 ++++++++++------------------------------
hw/vfio/platform.c | 733 +++++++++++++++++++
hw/vfio/vfio-common.h | 153 ++++
linux-headers/linux/vfio.h | 3 +
12 files changed, 2378 insertions(+), 1177 deletions(-)
create mode 100644 hw/vfio/Makefile.objs
create mode 100644 hw/vfio/common.c
rename hw/{misc/vfio.c => vfio/pci.c} (65%)
create mode 100644 hw/vfio/platform.c
create mode 100644 hw/vfio/vfio-common.h
--
1.8.3.2
next reply other threads:[~2014-06-02 7:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 7:49 Eric Auger [this message]
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 01/10] hw/arm/virt: add a xgmac device Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 02/10] vfio: move hw/misc/vfio.c to hw/vfio/pci.c Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 03/10] vfio: add vfio-platform support Eric Auger
2014-06-25 21:21 ` Alexander Graf
2014-06-26 7:47 ` Eric Auger
2014-06-26 9:56 ` Alexander Graf
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 04/10] vfio: simplifed DPRINTF calls using device name Eric Auger
2014-06-25 21:22 ` Alexander Graf
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 05/10] vfio: Add initial IRQ support in platform device Eric Auger
2014-06-25 21:28 ` Alexander Graf
2014-06-25 21:40 ` Alex Williamson
2014-06-26 8:41 ` Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 06/10] virt: Assign a VFIO platform device with -device option Eric Auger
2014-06-25 21:30 ` Alexander Graf
2014-06-26 8:53 ` Eric Auger
2014-06-26 9:25 ` Alexander Graf
2014-06-26 9:30 ` Eric Auger
2014-06-25 22:28 ` Peter Maydell
2014-06-25 22:28 ` Alexander Graf
2014-06-26 7:39 ` Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 07/10] Add EXEC_FLAG to VFIO DMA mappings Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 08/10] Add AMBA devices support to VFIO Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 09/10] Always use eventfd as notifying mechanism Eric Auger
2014-06-02 7:49 ` [Qemu-devel] [RFC v3 10/10] vfio: Add irqfd support in platform device Eric Auger
2014-06-25 21:35 ` Alexander Graf
2014-06-25 21:54 ` Alex Williamson
2014-06-25 22:02 ` Alexander Graf
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=1401695374-4287-1-git-send-email-eric.auger@linaro.org \
--to=eric.auger@linaro.org \
--cc=a.motakis@virtualopensystems.com \
--cc=a.rigo@virtualopensystems.com \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=christophe.barnichon@st.com \
--cc=eric.auger@st.com \
--cc=kim.phillips@freescale.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stuart.yoder@freescale.com \
/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).