RE: [PATCH 5/6] device assignment: support for assigning PCI devices to guests

Han, Weidong
2008-10-28T15:36:16Z

muli@il.ibm.com wrote:
> From: Muli Ben-Yehuda <muli@il.ibm.com>
>
> This patch has been contributed to by the following people:
>
> Or Sagi <ors@tutis.com>
> Nir Peleg <nir@tutis.com>
> Amit Shah <amit.shah@redhat.com>
> Ben-Ami Yassour <benami@il.ibm.com>
> Weidong Han <weidong.han@intel.com>
> Glauber de Oliveira Costa <gcosta@redhat.com>
> Muli Ben-Yehuda <muli@il.ibm.com>
>
> With this patch, we can assign a device on the host machine to a
> guest.
>
> A new command-line option, -pcidevice is added.
> To invoke it for a device sitting at PCI bus:dev.fn 04:08.0, use this:
>
> -pcidevice host=04:08.0
>
> * The host driver for the device, if any, is to be removed before
> assigning the device (else device assignment will fail).
>
> * A device that shares IRQ with another host device cannot currently
> be assigned.
>
> * The RAW_IO capability is needed for this to work
>
> This works only with the in-kernel irqchip method; to use the
> userspace irqchip, a kernel module (irqhook) and some extra changes
> are needed.
>
> [muli: lots of small fixes from Muli and Weidong Han addressing all v7
> review comments]
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
> ---
> qemu/Makefile.target | 3 +
> qemu/hw/device-assignment.c | 641
> +++++++++++++++++++++++++++++++++++++++++++
> qemu/hw/device-assignment.h | 117 ++++++++ qemu/hw/pc.c
> | 16 + qemu/hw/pci.c | 7 +
> qemu/qemu-kvm.c | 14 +
> qemu/qemu-kvm.h | 8 +
> qemu/vl.c | 28 ++
> 8 files changed, 834 insertions(+), 0 deletions(-)
> create mode 100644 qemu/hw/device-assignment.c
> create mode 100644 qemu/hw/device-assignment.h
>
> diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
> index c5f3f29..5e66832 100644
> --- a/qemu/qemu-kvm.c
> +++ b/qemu/qemu-kvm.c
> @@ -20,6 +20,7 @@ int kvm_pit = 1;
> #include "console.h"
> #include "block.h"
> #include "compatfd.h"
> +#include "hw/device-assignment.h"

It's not necessary.

>
> #include "qemu-kvm.h"
> #include <libkvm.h>
> @@ -27,6 +28,7 @@ int kvm_pit = 1;
> #include <sys/utsname.h>
> #include <sys/syscall.h>
> #include <sys/mman.h>
> +#include <sys/io.h>

It's not necessary.

Regards,
Weidong