All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Cc: Frank Blaschka <frank.blaschka@de.ibm.com>,
	qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com,
	alex.williamson@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/3 RPC] kvm: extend kvm_irqchip_add_msi_route to work on s390
Date: Thu, 30 Oct 2014 18:37:56 +0100	[thread overview]
Message-ID: <20141030183756.40449dbd.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1413990720-39602-4-git-send-email-blaschka@linux.vnet.ibm.com>

On Wed, 22 Oct 2014 17:12:00 +0200
Frank Blaschka <blaschka@linux.vnet.ibm.com> wrote:

> From: Frank Blaschka <frank.blaschka@de.ibm.com>
> 
> 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 <frank.blaschka@de.ibm.com>
> ---
>  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;
> +}

  reply	other threads:[~2014-10-31 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 15:11 [Qemu-devel] [PATCH 0/3 RFC] add PCI support for the s390 platform Frank Blaschka
2014-10-22 15:11 ` [Qemu-devel] [PATCH 1/3 RFC] s390: Add PCI bus support Frank Blaschka
2014-10-22 15:11 ` [Qemu-devel] [PATCH 2/3 RFC] s390: implement pci instructions Frank Blaschka
2014-10-23 13:12   ` Thomas Huth
2014-10-22 15:12 ` [Qemu-devel] [PATCH 3/3 RPC] kvm: extend kvm_irqchip_add_msi_route to work on s390 Frank Blaschka
2014-10-30 17:37   ` Cornelia Huck [this message]
2014-11-02 21:10 ` [Qemu-devel] [PATCH 0/3 RFC] add PCI support for the s390 platform Alexander Graf

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=20141030183756.40449dbd.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=blaschka@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=frank.blaschka@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.