All of lore.kernel.org
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Prem Mallappa <prem.mallappa@broadcom.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 2/9] devicetree: Added new APIs to make use of more fdt functions
Date: Fri, 9 Sep 2016 18:02:46 +0200	[thread overview]
Message-ID: <abdb9f53-2d2e-51ef-62ca-1b0d493cb0fc@redhat.com> (raw)
In-Reply-To: <20160822161740.4252-3-prem.mallappa@broadcom.com>

Hi Prem,

> SMMUv3 needs device tree entry like below
To me the commit message should be more explicit and mention appendprop
functionality
> 
>      interrupt-names = "gerror", "priq", "eventq", "cmdq-sync";
> 
> This patch introduces helper function to add entries like above
> 
> Signed-off-by: Prem Mallappa <prem.mallappa@broadcom.com>
> ---
>  device_tree.c                | 35 +++++++++++++++++++++++++++++++++++
>  include/sysemu/device_tree.h | 18 ++++++++++++++++++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/device_tree.c b/device_tree.c
> index 6e06320..5d5966e 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -297,6 +297,24 @@ int qemu_fdt_setprop(void *fdt, const char *node_path,
>      return r;
>  }
>  
> +int qemu_fdt_appendprop(void *fdt, const char *node_path,
> +                     const char *property, const void *val, int size)
> +{
> +    int r;
> +
> +    r = fdt_appendprop(fdt, findnode_nofail(fdt, node_path), property,
> +                       val, size);
> +    if (r < 0) {
> +        error_report("%s: Couldn't set %s/%s: %s", __func__, node_path,
> +                     property, fdt_strerror(r));
> +        exit(1);
> +    }
> +
> +    return r;
> +}
> +
> +
spare void lines
> +
>  int qemu_fdt_setprop_cell(void *fdt, const char *node_path,
>                            const char *property, uint32_t val)
>  {
> @@ -319,6 +337,23 @@ int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
>      return qemu_fdt_setprop(fdt, node_path, property, &val, sizeof(val));
>  }
>  
> +int qemu_fdt_appendprop_string(void *fdt, const char *node_path,
> +                            const char *property, const char *string)
> +{
> +    int r;
> +
> +    r = fdt_appendprop_string(fdt, findnode_nofail(fdt, node_path),
> +                              property, string);
> +    if (r < 0) {
> +        error_report("%s: Couldn't set %s/%s = %s: %s", __func__,
> +                     node_path, property, string, fdt_strerror(r));
> +        exit(1);
> +    }
> +
> +    return r;
> +}
> +
same
> +
>  int qemu_fdt_setprop_string(void *fdt, const char *node_path,
>                              const char *property, const char *string)
>  {
> diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
> index 705650a..5a0a297 100644
> --- a/include/sysemu/device_tree.h
> +++ b/include/sysemu/device_tree.h
> @@ -45,12 +45,16 @@ char **qemu_fdt_node_path(void *fdt, const char *name, char *compat,
>  
>  int qemu_fdt_setprop(void *fdt, const char *node_path,
>                       const char *property, const void *val, int size);
> +int qemu_fdt_appendprop(void *fdt, const char *node_path,
> +                     const char *property, const void *val, int size);
>  int qemu_fdt_setprop_cell(void *fdt, const char *node_path,
>                            const char *property, uint32_t val);
>  int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
>                           const char *property, uint64_t val);
>  int qemu_fdt_setprop_string(void *fdt, const char *node_path,
>                              const char *property, const char *string);
> +int qemu_fdt_appendprop_string(void *fdt, const char *node_path,
> +                               const char *property, const char *string);
>  int qemu_fdt_setprop_phandle(void *fdt, const char *node_path,
>                               const char *property,
>                               const char *target_node_path);
> @@ -98,6 +102,20 @@ int qemu_fdt_add_subnode(void *fdt, const char *name);
>                           sizeof(qdt_tmp));                                    \
>      } while (0)
>  
> +
same
> +#define qemu_fdt_appendprop_cells(fdt, node_path, property, ...)              \
> +    do {                                                                      \
> +        uint32_t qdt_tmp[] = { __VA_ARGS__ };                                 \
> +        int i;                                                                \
> +                                                                              \
> +        for (i = 0; i < ARRAY_SIZE(qdt_tmp); i++) {                           \
> +            qdt_tmp[i] = cpu_to_be32(qdt_tmp[i]);                             \
> +        }                                                                     \
> +        qemu_fdt_appendprop(fdt, node_path, property, qdt_tmp,                \
> +                         sizeof(qdt_tmp));                                    \
> +    } while (0)
> +
> +
same here.

While I understand the benefits I think we could manage without this new
API by using qemu_fdt_setprop and populating the uint32_t array separately.

I understood the QEMU API for manipulating flattened trees was not
supposed to grow too much but I don't have a strong option here. You
should CC David Gibson I think.

Thanks

Eric


>  void qemu_fdt_dumpdtb(void *fdt, int size);
>  
>  /**
> 

  reply	other threads:[~2016-09-09 16:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22 16:17 [Qemu-devel] [PATCH v2 0/9] SMMUv3 Emulation support Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 1/9] log: Add new IOMMU type Prem Mallappa
2016-09-09 15:36   ` Auger Eric
2016-09-12 20:23     ` Prem Mallappa
2016-09-25 14:58       ` Edgar E. Iglesias
2016-09-26  6:54         ` Auger Eric
2016-09-26 18:30           ` Edgar E. Iglesias
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 2/9] devicetree: Added new APIs to make use of more fdt functions Prem Mallappa
2016-09-09 16:02   ` Auger Eric [this message]
2016-09-12 20:21     ` Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 3/9] hw: arm: SMMUv3 emulation model Prem Mallappa
2016-09-25 16:37   ` Edgar E. Iglesias
2016-09-26  5:27     ` Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 4/9] hw: arm: Added SMMUv3 files for build Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 5/9] hw: arm: Add SMMUv3 to virt platform, create DTS accordingly Prem Mallappa
2016-09-09 16:31   ` Auger Eric
2016-09-12 20:20     ` Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 6/9] [optional] hw: misc: added testdev for smmu Prem Mallappa
2017-03-27 15:24   ` Philippe Mathieu-Daudé
2017-03-27 15:41   ` Andrew Jones
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 7/9] [optional] tests: libqos: generic pci probing helpers Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 8/9] [optional] tests: SMMUv3 unit tests Prem Mallappa
2016-08-22 16:17 ` [Qemu-devel] [PATCH v2 9/9] [optional] arm: smmu-v3: ACPI IORT initial support Prem Mallappa
2016-09-09 15:24   ` Auger Eric
2016-09-12 20:42     ` Prem Mallappa
2016-09-23 13:10       ` Auger Eric
2016-09-23 14:07         ` Prem Mallappa
2016-09-23 16:38           ` Auger Eric
2016-08-31 21:44 ` [Qemu-devel] [PATCH v2 0/9] SMMUv3 Emulation support Auger Eric
2016-09-01  5:24   ` Prem Mallappa
2017-03-08 17:46 ` Auger Eric
2017-03-27 11:44   ` Edgar E. Iglesias
2017-03-27 12:18     ` Auger Eric
2017-03-27 12:28       ` Edgar E. Iglesias

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=abdb9f53-2d2e-51ef-62ca-1b0d493cb0fc@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=prem.mallappa@broadcom.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.