Received: from eggs.gnu.org ([2001:4830:134:3::10]:51018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEFt-000614-OZ for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:40:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xjtff-0008Ks-FO for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:38:12 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:44640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xjtff-0008KN-6p for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:38:03 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Oct 2014 17:38:01 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7416D17D8024 for ; Thu, 30 Oct 2014 17:38:02 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9UHbwll9699596 for ; Thu, 30 Oct 2014 17:37:58 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9UHbwbj022400 for ; Thu, 30 Oct 2014 11:37:58 -0600 Date: Thu, 30 Oct 2014 18:37:56 +0100 From: Cornelia Huck Message-ID: <20141030183756.40449dbd.cornelia.huck@de.ibm.com> In-Reply-To: <1413990720-39602-4-git-send-email-blaschka@linux.vnet.ibm.com> References: <1413990720-39602-1-git-send-email-blaschka@linux.vnet.ibm.com> <1413990720-39602-4-git-send-email-blaschka@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3 RPC] kvm: extend kvm_irqchip_add_msi_route to work on s390 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Frank Blaschka Cc: Frank Blaschka , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, alex.williamson@redhat.com, pbonzini@redhat.com On Wed, 22 Oct 2014 17:12:00 +0200 Frank Blaschka wrote: > From: Frank Blaschka > > on s390 MSI-X irqs are presented as thin or adapter interrupts > for this we have to reorganize the routing entry to contain > valid information for the adapter interrupt code on s390. > To minimize impact on existing code we introduce an architecture > function to fixup the routing entry. > > Signed-off-by: Frank Blaschka > --- > include/sysemu/kvm.h | 4 ++++ > kvm-all.c | 2 ++ > target-arm/kvm.c | 5 +++++ > target-i386/kvm.c | 5 +++++ > target-mips/kvm.c | 5 +++++ > target-ppc/kvm.c | 5 +++++ > target-s390x/kvm.c | 25 +++++++++++++++++++++++++ > 7 files changed, 51 insertions(+) > > diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c > index 9280132..c3b3b0f 100644 > --- a/target-s390x/kvm.c > +++ b/target-s390x/kvm.c > @@ -43,6 +43,7 @@ > #include "trace.h" > #include "qapi-event.h" > #include "pci_ic.h" > +#include "hw/s390x/s390-pci-bus.h" > > /* #define DEBUG_KVM */ > > @@ -1639,3 +1640,27 @@ int kvm_s390_get_machine_props(S390MachineProps *prop) > { > return cpu_model_get(KVM_S390_VM_CPU_MACHINE, (uint64_t) prop); > } > + > +void kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, > + uint64_t address, uint32_t data) > +{ > + S390PCIBusDevice *pbdev; > + uint32_t fid = data >> ZPCI_MSI_VEC_BITS; > + uint32_t vec = data & ZPCI_MSI_VEC_MASK; I think this needs a comment so it is easier to understand why you're mucking around with PCI devices and I/O adapters here without referring to git blame :) > + > + pbdev = s390_pci_find_dev_by_fid(fid); > + if (!pbdev) { > + DPRINTF("add_msi_route no dev\n"); > + return; This feels wrong. Shouldn't this function fail if you can't find the pci device? The calling function can probably just release the virq again and return an error. > + } > + > + pbdev->routes.adapter.ind_offset = vec; > + > + route->type = KVM_IRQ_ROUTING_S390_ADAPTER; > + route->flags = 0; > + route->u.adapter.summary_addr = pbdev->routes.adapter.summary_addr; > + route->u.adapter.ind_addr = pbdev->routes.adapter.ind_addr; > + route->u.adapter.summary_offset = pbdev->routes.adapter.summary_offset; > + route->u.adapter.ind_offset = pbdev->routes.adapter.ind_offset; > + route->u.adapter.adapter_id = pbdev->routes.adapter.adapter_id; > +}