Amit Shah wrote:
> [This still doesn't include some fixes to review comments.
> I'm posting this just so that people can use this to test
> or base their work off the latest patch.]
> 
> From: Or Sagi <[EMAIL PROTECTED]>
> From: Nir Peleg <[EMAIL PROTECTED]>
> From: Amit Shah <[EMAIL PROTECTED]>
> From: Ben-Ami Yassour <[EMAIL PROTECTED]>
> From: Glauber de Oliveira Costa <[EMAIL PROTECTED]>
> 
> With this patch, we can assign a device on the host machine to a
> guest.
> 
> A new command-line option, -pcidevice is added.
> For example, to invoke it for a device sitting at PCI bus:dev.fn
> 04:08.0 with host IRQ 18, use this:
> 
>         -pcidevice host=04:08.0
> 
> The host driver for the device, if any, is to be removed before
> assigning the device.
> 
> This works only with the in-kernel irqchip method; to use the
> userspace irqchip, a kernel module (irqhook) and some extra changes
> are needed.
> 
> Signed-off-by: Amit Shah <[EMAIL PROTECTED]>
> ---
>  libkvm/libkvm-x86.c  |   14 ++++++++++++++
>  libkvm/libkvm.h      |   27 +++++++++++++++++++++++++++
>  qemu/Makefile.target |    1 +
>  qemu/hw/isa.h        |    2 ++
>  qemu/hw/pc.c         |    9 +++++++++
>  qemu/hw/pci.c        |   12 ++++++++++++
>  qemu/hw/pci.h        |    1 +
>  qemu/hw/piix_pci.c   |   19 +++++++++++++++++++
>  qemu/qemu-kvm-x86.c  |    3 +++
>  qemu/vl.c            |   18 ++++++++++++++++++
>  10 files changed, 106 insertions(+), 0 deletions(-)
> 
> diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
> index a8cca15..6157f75 100644
> --- a/libkvm/libkvm-x86.c
> +++ b/libkvm/libkvm-x86.c
> @@ -53,6 +53,20 @@ static int kvm_init_tss(kvm_context_t kvm)
>       return 0;
>  }
> 
> +#ifdef KVM_CAP_DEVICE_ASSIGNMENT
> +int kvm_assign_pci_device(kvm_context_t kvm,
> +                       struct kvm_assigned_pci_dev *assigned_dev)
> +{
> +     return ioctl(kvm->vm_fd, KVM_ASSIGN_PCI_DEVICE, assigned_dev);
> +}
> +
> +int kvm_assign_irq(kvm_context_t kvm,
> +                struct kvm_assigned_irq *assigned_irq)
> +{
> +     return ioctl(kvm->vm_fd, KVM_ASSIGN_IRQ, assigned_irq);
> +}
> +#endif

Could you move this part to libkvm.c? it should be shared by all archs,
I think. 
Xiantao 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to