qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, agraf@suse.de
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	[thread overview]
Message-ID: <53708D46.8060507@de.ibm.com> (raw)
In-Reply-To: <1399554218-8262-5-git-send-email-cornelia.huck@de.ibm.com>

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 <thuth@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>

Small things, otherwise

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>


[...]
> --- /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

  reply	other threads:[~2014-05-12  8:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 13:03 [Qemu-devel] [PATCH v5 0/4] irqfds for s390x Cornelia Huck
2014-05-08 13:03 ` [Qemu-devel] [PATCH v5 1/4] s390x: split flic into kvm and non-kvm parts Cornelia Huck
2014-05-08 13:43   ` Alexander Graf
2014-05-08 13:56     ` Cornelia Huck
2014-05-12  8:01   ` Christian Borntraeger
2014-05-12  8:09     ` Cornelia Huck
2014-05-12  8:11       ` Christian Borntraeger
2014-05-08 13:03 ` [Qemu-devel] [PATCH v5 2/4] s390x: Add I/O adapter registration Cornelia Huck
2014-05-12  8:36   ` Christian Borntraeger
2014-05-08 13:03 ` [Qemu-devel] [PATCH v5 3/4] s390x/virtio-ccw: reference-counted indicators Cornelia Huck
2014-05-12  8:17   ` Christian Borntraeger
2014-05-08 13:03 ` [Qemu-devel] [PATCH v5 4/4] s390x/virtio-ccw: Wire up irq routing and irqfds Cornelia Huck
2014-05-12  8:58   ` Christian Borntraeger [this message]
2014-05-12 13:24     ` Cornelia Huck
2014-05-15 13:19   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53708D46.8060507@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=cornelia.huck@de.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).