From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu Date: Thu, 26 Jul 2012 09:09:37 -0600 Message-ID: <1343315377.3125.20.camel@ul30vt> References: <20120725165948.17260.82862.stgit@bling.home> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, aik@ozlabs.ru, benh@kernel.crashing.org To: qemu-devel@nongnu.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52298 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189Ab2GZPJn (ORCPT ); Thu, 26 Jul 2012 11:09:43 -0400 In-Reply-To: <20120725165948.17260.82862.stgit@bling.home> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2012-07-25 at 11:03 -0600, Alex Williamson wrote: > This adds PCI based device assignment to Qemu using the Linux VFIO > userspace driver interface. After setting up VFIO device access, > devices can be added to Qemu guests using the vfio-pci device > option: > > -device vfio-pci,host=1:10.1,id=net0 > > or for hotplug: > > (qemu) device_add vfio-pci,host=1:10.1,id=net0 > (qemu) device_del net0 > > This patch adds support for assigning host physical PCI devices, > with or without KVM[1] for x86 hosts and guests. Support for > POWER hosts and guests is working and expected to follow shortly. > Other platforms wishing to make use of this need to do the following: > - Add a VFIO IOMMU interface to the host kernel driver or make us of > an existing one if possible (pre-req: linux host IOMMU support) > - Add corresponding mapping calls for your IOMMU in qemu, see > x86 and POWER for examples. > > And if you care about PCI legacy interrupts: > - Add support for EOI notification (TBD for everyone) > > While not requiring KVM support, VFIO based device assignment still > supports acceleration through KVM. MMIO regions with sufficient > alignment are mapped directly into the guest addres space and > platforms supporting direct interrupt injection through eventfds can > bypass Qemu userspace. This support is included and automatically > enabled when KVM and KVM irqchip is enabled. These allow VFIO > based assignment to meet the same performance levels as KVM based > assignment in the qemu-kvm tree. > > Sending this as an RFC for review as we're waiting on VFIO to be > accepted into the Linux kernel. I'm hoping it will be accepted > for Linux v3.6. Pending Linux VFIO acceptance, I'd like to get > this support in for 1.2 and work on generic Qemu EOI infrastructure > in-tree. This patch is based on current qemu.git merged with MST's > latest pull request. Thanks, > > Alex > > [1] The proposed level IRQFD/EOIFD KVM interface is currently > required to support legacy PCI INTx interrupts. Qemu support for > this is included here. Qemu infrastructure for EOI notification > is not yet in place to do this without KVM. Device which rely only > on MSI/MSIX work in unaccelerated Qemu. I forgot to mention that anyone wanting to test this out can use the vfio-for-qemu branch of my git tree here: git://github.com/awilliam/qemu-vfio.git Thanks, Alex