From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjm4a-0002I6-VO for qemu-devel@nongnu.org; Mon, 12 May 2014 04:59:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wjm4R-0007MO-S2 for qemu-devel@nongnu.org; Mon, 12 May 2014 04:59:00 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:60019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wjm4R-0007MA-J8 for qemu-devel@nongnu.org; Mon, 12 May 2014 04:58:51 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 May 2014 09:58:49 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 00FD61B08061 for ; Mon, 12 May 2014 09:59:01 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4C8wlqJ1900868 for ; Mon, 12 May 2014 08:58:47 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4C8wksm007431 for ; Mon, 12 May 2014 02:58:47 -0600 Message-ID: <53708D46.8060507@de.ibm.com> Date: Mon, 12 May 2014 10:58:46 +0200 From: Christian Borntraeger MIME-Version: 1.0 References: <1399554218-8262-1-git-send-email-cornelia.huck@de.ibm.com> <1399554218-8262-5-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1399554218-8262-5-git-send-email-cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 4/4] s390x/virtio-ccw: Wire up irq routing and irqfds. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck , qemu-devel@nongnu.org Cc: Paolo Bonzini , agraf@suse.de 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 > Signed-off-by: Cornelia Huck Small things, otherwise Reviewed-by: Christian Borntraeger [...] > --- /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