[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 4/4] s390x/virtio-ccw: Wire up irq routing an
From: |
Christian Borntraeger |
Subject: |
Re: [Qemu-devel] [PATCH v5 4/4] s390x/virtio-ccw: Wire up irq routing and irqfds. |
Date: |
Mon, 12 May 2014 10:58:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 08/05/14 15:03, Cornelia Huck wrote:
> Make use of the new s390 adapter irq routing support to enable real
> in-kernel irqfds for virtio-ccw with adapter interrupts.
>
> Note that s390 doesn't provide the common KVM_CAP_IRQCHIP capability, but
> rather needs KVM_CAP_S390_IRQCHIP to be enabled. This is to ensure backward
> compatibility.
>
> Reviewed-by: Thomas Huth <address@hidden>
> Signed-off-by: Cornelia Huck <address@hidden>
Small things, otherwise
Reviewed-by: Christian Borntraeger <address@hidden>
[...]
> --- /dev/null
> +++ b/include/hw/s390x/adapter.h
> @@ -0,0 +1,23 @@
> +/*
> + * s390 adapter definitions
> + *
> + * Copyright 2013 IBM Corp.
2014 as well
[...]
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -365,6 +365,8 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage
> msg);
> int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg);
> void kvm_irqchip_release_virq(KVMState *s, int virq);
>
> +int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter);
> +
> int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,
> EventNotifier *rn, int virq);
> int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int
> virq);
> diff --git a/kvm-all.c b/kvm-all.c
> index 5cb7f26..51983bf 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -27,6 +27,7 @@
> #include "sysemu/sysemu.h"
> #include "hw/hw.h"
> #include "hw/pci/msi.h"
> +#include "hw/s390x/adapter.h"
> #include "exec/gdbstub.h"
> #include "sysemu/kvm.h"
> #include "qemu/bswap.h"
> @@ -1247,6 +1248,35 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, int
> fd, int rfd, int virq,
> return kvm_vm_ioctl(s, KVM_IRQFD, &irqfd);
> }
>
> +int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter)
> +{
> + struct kvm_irq_routing_entry kroute;
> + int virq;
> +
> + if (!kvm_gsi_routing_enabled()) {
> + return -ENOSYS;
> + }
> +
> + virq = kvm_irqchip_get_virq(s);
> + if (virq < 0) {
> + return virq;
> + }
> +
> + kroute.gsi = virq;
> + kroute.type = KVM_IRQ_ROUTING_S390_ADAPTER;
> + kroute.flags = 0;
> + kroute.u.adapter.summary_addr = adapter->summary_addr;
> + kroute.u.adapter.ind_addr = adapter->ind_addr;
> + kroute.u.adapter.summary_offset = adapter->summary_offset;
> + kroute.u.adapter.ind_offset = adapter->ind_offset;
> + kroute.u.adapter.adapter_id = adapter->adapter_id;
> +
> + kvm_add_routing_entry(s, &kroute);
> + kvm_irqchip_commit_routes(s);
> +
> + return virq;
> +}
> +
> #else /* !KVM_CAP_IRQ_ROUTING */
>
> void kvm_init_irq_routing(KVMState *s)
> @@ -1267,6 +1297,11 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage
> msg)
> return -ENOSYS;
> }
>
> +int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter)
> +{
> + return -ENOSYS;
> +}
> +
> static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool
> assign)
> {
> abort();
> @@ -1296,7 +1331,8 @@ static int kvm_irqchip_create(KVMState *s)
> int ret;
>
> if (!qemu_opt_get_bool(qemu_get_machine_opts(), "kernel_irqchip", true)
> ||
> - !kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
> + (!kvm_check_extension(s, KVM_CAP_IRQCHIP) &&
> + (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) {
> return 0;
> }
Do we need a comment here and/or in target-s390x/kvm.c why
kvm_halt_in_kernel_allowed does not work without breaking backward
compatibility on s390?
>
> diff --git a/kvm-stub.c b/kvm-stub.c
> index 8acda86..ac33d86 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -136,6 +136,11 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq,
> MSIMessage msg)
> return -ENOSYS;
> }
>
> +int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter)
> +{
> + return -ENOSYS;
> +}
> +
> int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,
> EventNotifier *rn, int virq)
> {
> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
> index b7b0edc..43859e9 100644
> --- a/target-s390x/kvm.c
> +++ b/target-s390x/kvm.c
> @@ -938,6 +938,11 @@ void kvm_s390_enable_css_support(S390CPU *cpu)
>
> void kvm_arch_init_irq_routing(KVMState *s)
> {
> + if (kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) {
> + kvm_irqfds_allowed = true;
> + kvm_gsi_routing_allowed = true;
> + kvm_halt_in_kernel_allowed = false;
> + }
Do we need a comment here and/or in kvm-all why kvm_halt_in_kernel_allowed does
not work without breaking backward compatibility on s390?
[...]
Should Paolo ack the common kvm changes? (CCed)
Christian