qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: Baptiste Reynal <b.reynal@virtualopensystems.com>,
	qemu-devel@nongnu.org, kvmarm@lists.cs.columbia.edu
Cc: Peter Maydell <peter.maydell@linaro.org>, tech@virtualopensystems.com
Subject: Re: [Qemu-devel] [RFC PATCH 3/4] hw/arm/sysbus-fdt: vfio device property for interrupts
Date: Thu, 15 Jan 2015 16:57:46 +0100	[thread overview]
Message-ID: <54B7E37A.4030308@linaro.org> (raw)
In-Reply-To: <1421068903-8981-4-git-send-email-b.reynal@virtualopensystems.com>

Hi Baptiste
On 01/12/2015 02:21 PM, Baptiste Reynal wrote:
> Use the VFIO device property API to retrieve interrupt
> information (type and flags) during device node creation.
> 
> Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
> ---
>  hw/arm/sysbus-fdt.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
> index efdeea7..087e788 100644
> --- a/hw/arm/sysbus-fdt.c
> +++ b/hw/arm/sysbus-fdt.c
> @@ -31,6 +31,7 @@
>  #include "hw/vfio/vfio-pl330.h"
>  
>  #include <libfdt.h>
> +#include <linux/vfio.h>
>  
>  /*
>   * internal struct that contains the information to create dynamic
> @@ -66,7 +67,7 @@ typedef struct NodeCreationPair {
>   * Helper function, generate interrupts property for a given node
might be worth adding something like "based on host device tree node"
>   */
>  static int set_interrupts_fdt_node(char *nodename, SysBusDevice *sbdev,
> -        void *opaque, int type, int flags)
> +        void *opaque)
>  {
>      PlatformBusFdtData *data = opaque;
>      PlatformBusDevice *pbus = data->pbus;
> @@ -76,23 +77,32 @@ static int set_interrupts_fdt_node(char *nodename, SysBusDevice *sbdev,
>      int i, ret;
>      VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
>      VFIODevice *vbasedev = &vdev->vbasedev;
> +    struct vfio_dev_property *irq_prop;
> +
> +    irq_prop = vfio_get_dev_property(vbasedev->fd, "interrupts",
> +            VFIO_DEV_PROPERTY_TYPE_U32);
> +
> +    if (irq_prop == NULL) {
> +        return -1;
> +    }
>  
>      irq_attr = g_new(uint32_t, vbasedev->num_irqs*3);
>  
>      for (i = 0; i < vbasedev->num_irqs; i++) {
>          irq_number = platform_bus_get_irqn(pbus, sbdev , i)
>                           + data->irq_start;
> -        irq_attr[3*i] = cpu_to_be32(type);
> +        irq_attr[3*i] = cpu_to_be32(((__u32 *) irq_prop->data)[3*i]);
>          irq_attr[3*i+1] = cpu_to_be32(irq_number);
> -        irq_attr[3*i+2] = cpu_to_be32(flags);
> +        irq_attr[3*i+2] = cpu_to_be32(((__u32 *) irq_prop->data)[3*i+2]);
>      }
>  
> -   ret = qemu_fdt_setprop(fdt, nodename, "interrupts",
> -                     irq_attr, vbasedev->num_irqs*3*sizeof(uint32_t));
> +    ret = qemu_fdt_setprop(fdt, nodename, "interrupts",
> +            irq_attr, vbasedev->num_irqs*3*sizeof(uint32_t));
delta may be removed?
>  
>      g_free(irq_attr);
> +    g_free(irq_prop);
>  
> -   return ret;
> +    return ret;
delta may be removed?
Best Regards
Eric
>  }
>  
>  /**
> @@ -168,7 +178,7 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
>          goto fail;
>      }
>  
> -    ret = set_interrupts_fdt_node(nodename, sbdev, opaque, 0, 0x4);
> +    ret = set_interrupts_fdt_node(nodename, sbdev, opaque);
>  
>      if (ret < 0) {
>          error_report("could not set interrupts property of node %s",
> @@ -248,7 +258,7 @@ static int add_arm_pl330_fdt_node(SysBusDevice *sbdev, void *opaque)
>          goto fail;
>      }
>  
> -    ret = set_interrupts_fdt_node(nodename, sbdev, opaque, 0, 0x4);
> +    ret = set_interrupts_fdt_node(nodename, sbdev, opaque);
>  
>      if (ret < 0) {
>          error_report("could not set interrupts property of node %s",
> 

  reply	other threads:[~2015-01-15 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 13:21 [Qemu-devel] [RFC PATCH 0/4] VFIO platform: Use device properties API Baptiste Reynal
2015-01-12 13:21 ` [Qemu-devel] [RFC PATCH 1/4] linux-headers update Baptiste Reynal
2015-01-12 13:21 ` [Qemu-devel] [RFC PATCH 2/4] hw/vfio/common.c : vfio_get_dev_property Baptiste Reynal
2015-01-12 15:36   ` Alex Williamson
2015-01-12 13:21 ` [Qemu-devel] [RFC PATCH 3/4] hw/arm/sysbus-fdt: vfio device property for interrupts Baptiste Reynal
2015-01-15 15:57   ` Eric Auger [this message]
2015-01-12 13:21 ` [Qemu-devel] [RFC PATCH 4/4] hw/arm/sysbus-fdt: arm, pl330 vfio device property Baptiste Reynal
2015-01-15 16:16   ` Eric Auger

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=54B7E37A.4030308@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=b.reynal@virtualopensystems.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tech@virtualopensystems.com \
    /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).