qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] KVM: add kvm_arch_irqchip_add_msi_route


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 2/3] KVM: add kvm_arch_irqchip_add_msi_route
Date: Fri, 21 Jun 2013 12:33:44 +0200

On 21.06.2013, at 11:22, Alexey Kardashevskiy wrote:

> At the moment kvm_irqchip_add_msi_route() adds routing entries for every
> MSI IRQ we want to use with IRQFD.
> 
> However on PPC64-pSeries no routing is required as QEMU is already doing
> MSIMessage to IRQ converson. When the guest needs to allocate some
> MSI vectors, it asks a hypervisor (QEMU) which returns IRQs and does all
> the MSIMessage allocation/initialization in QEMU.
> 
> The patch adds callbacks to let a specific platform define how exactly
> the routing is configured.
> 
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> ---
> include/sysemu/kvm.h |    1 +
> kvm-all.c            |    5 +++++
> target-arm/kvm.c     |    6 ++++++
> target-i386/kvm.c    |    6 ++++++
> target-ppc/kvm.c     |   10 ++++++++++
> target-s390x/kvm.c   |    6 ++++++
> 6 files changed, 34 insertions(+)
> 
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 8b19322..9d5459d 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -215,6 +215,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void 
> *addr);
> int kvm_arch_on_sigbus(int code, void *addr);
> 
> void kvm_arch_init_irq_routing(KVMState *s);
> +int kvm_arch_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
> 
> int kvm_set_irq(KVMState *s, int irq, int level);
> int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg);
> diff --git a/kvm-all.c b/kvm-all.c
> index 91aa7ff..a92cc04 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1187,6 +1187,11 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage 
> msg)
>     struct kvm_irq_routing_entry kroute;
>     int virq;
> 
> +    virq = kvm_arch_irqchip_add_msi_route(s, msg);
> +    if (virq >= 0) {
> +        return virq;
> +    }
> +
>     if (!kvm_gsi_routing_enabled()) {
>         return -ENOSYS;
>     }
> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
> index 7a90d38..1a9bec1 100644
> --- a/target-arm/kvm.c
> +++ b/target-arm/kvm.c
> @@ -22,6 +22,7 @@
> #include "kvm_arm.h"
> #include "cpu.h"
> #include "hw/arm/arm.h"
> +#include "hw/pci/msi.h"
> 
> const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
>     KVM_CAP_LAST_INFO
> @@ -497,3 +498,8 @@ void kvm_arch_remove_all_hw_breakpoints(void)
> void kvm_arch_init_irq_routing(KVMState *s)
> {
> }
> +
> +int kvm_arch_irqchip_add_msi_route(KVMState *s, MSIMessage msg)
> +{
> +    return -1;
> +}
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 7ba98cd..96bb85c 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -33,6 +33,7 @@
> #include "exec/ioport.h"
> #include "hyperv.h"
> #include "hw/pci/pci.h"
> +#include "hw/pci/msi.h"
> 
> //#define DEBUG_KVM
> 
> @@ -2207,6 +2208,11 @@ void kvm_arch_init_irq_routing(KVMState *s)
>     kvm_gsi_routing_allowed = true;
> }
> 
> +int kvm_arch_irqchip_add_msi_route(KVMState *s, MSIMessage msg)
> +{
> +    return -1;
> +}
> +
> /* Classic KVM device assignment interface. Will remain x86 only. */
> int kvm_device_pci_assign(KVMState *s, PCIHostDeviceAddress *dev_addr,
>                           uint32_t flags, uint32_t *dev_id)
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index b60b684..d6da146 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -35,6 +35,7 @@
> #include "hw/sysbus.h"
> #include "hw/ppc/spapr.h"
> #include "hw/ppc/spapr_vio.h"
> +#include "hw/pci/msi.h"
> #include "sysemu/watchdog.h"
> 
> //#define DEBUG_KVM
> @@ -1973,3 +1974,12 @@ int kvm_arch_on_sigbus(int code, void *addr)
> void kvm_arch_init_irq_routing(KVMState *s)
> {
> }
> +
> +int kvm_arch_irqchip_add_msi_route(KVMState *s, MSIMessage msg)
> +{
> +    if (!kvm_msi_via_irqfd_allowed)
> +        return -1;
> +
> +    msg.address -= spapr->msi_win_addr;
> +    return (msg.address >> 2) + msg.data;

This breaks BookE.


Alex




reply via email to

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