From: Ian Campbell <ian.campbell@citrix.com>
To: vijay.kilari@gmail.com
Cc: stefano.stabellini@eu.citrix.com,
Prasun.Kapoor@caviumnetworks.com,
Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
tim@xen.org, xen-devel@lists.xen.org, julien.grall@citrix.com,
stefano.stabellini@citrix.com, manish.jaggi@caviumnetworks.com
Subject: Re: [RFC PATCH v3 17/18] xen/arm: ITS: Generate ITS node for Dom0
Date: Mon, 29 Jun 2015 14:06:19 +0100 [thread overview]
Message-ID: <1435583179.32500.324.camel@citrix.com> (raw)
In-Reply-To: <1434974517-12136-18-git-send-email-vijay.kilari@gmail.com>
On Mon, 2015-06-22 at 17:31 +0530, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>
> Parse host dt and generate ITS node for Dom0.
> ITS node resides inside GIC node so when GIC node
> is encountered look for ITS node.
>
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> ---
> xen/arch/arm/domain_build.c | 50 +++++++++++++++++++++++++++++++++++-
> xen/arch/arm/gic-v3-its.c | 57 +++++++++++++++++++++++++++++++++++++++++
> xen/include/asm-arm/gic-its.h | 2 ++
> 3 files changed, 108 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index e9cb8a9..0de5a8b 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -20,6 +20,7 @@
> #include <asm/cpufeature.h>
>
> #include <asm/gic.h>
> +#include <asm/gic-its.h>
> #include <xen/irq.h>
> #include "kernel.h"
>
> @@ -803,6 +804,34 @@ static int make_cpus_node(const struct domain *d, void *fdt,
> return res;
> }
>
> +static int make_its_node(const struct domain *d, void *fdt,
> + const struct dt_device_node *node)
> +{
> + int res = 0;
> +
> + DPRINT("Create GIC ITS node\n");
> +
> + res = its_make_dt_node(d, node, fdt);
> + if ( res )
> + return res;
> +
> + /*
> + * The value of the property "phandle" in the property "interrupts"
> + * to know on which interrupt controller the interrupt is wired.
> + */
> + if ( node->phandle )
> + {
> + DPRINT(" Set phandle = 0x%x\n", node->phandle);
> + res = fdt_property_cell(fdt, "phandle", node->phandle);
> + if ( res )
> + return res;
> + }
> +
> + res = fdt_end_node(fdt);
> +
> + return res;
> +}
> +
> static int make_gic_node(const struct domain *d, void *fdt,
> const struct dt_device_node *node)
> {
> @@ -1119,7 +1148,13 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
> DT_MATCH_TIMER,
> { /* sentinel */ },
> };
> + static const struct dt_device_match gits_matches[] __initconst =
> + {
> + DT_MATCH_GIC_ITS,
> + { /* sentinel */ },
> + };
> struct dt_device_node *child;
> + struct dt_device_node *gic_child;
> int res;
> const char *name;
> const char *path;
> @@ -1143,7 +1178,20 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
> /* Replace these nodes with our own. Note that the original may be
> * used_by DOMID_XEN so this check comes first. */
> if ( device_get_class(node) == DEVICE_GIC )
> - return make_gic_node(d, kinfo->fdt, node);
> + {
> + if ( !make_gic_node(d, kinfo->fdt, node) )
> + {
> + dt_for_each_child_node(node, gic_child)
> + {
> + if ( gic_child != NULL )
> + {
> + if ( dt_match_node(gits_matches, gic_child) )
> + return make_its_node(d, kinfo->fdt, gic_child);
This will create multiple ITS nodes, we only want one and we need the
msi-parent properties everywhere else to be changed to point to it.
> + }
> + }
> + }
> + return 0;
> + }
> if ( dt_match_node(timer_matches, node) )
> return make_timer_node(d, kinfo->fdt, node);
>
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 8aa1ec5..fc853d4 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -27,6 +27,8 @@
> #include <xen/sched.h>
> #include <xen/errno.h>
> #include <xen/delay.h>
> +#include <xen/device_tree.h>
> +#include <xen/libfdt/libfdt.h>
> #include <xen/list.h>
> #include <xen/sizes.h>
> #include <xen/vmap.h>
> @@ -1205,6 +1207,61 @@ static void its_cpu_init_collection(void)
> spin_unlock(&its_lock);
> }
>
> +int its_make_dt_node(const struct domain *d,
> + const struct dt_device_node *node, void *fdt)
> +{
> + struct its_node *its;
> + const struct dt_device_node *gic;
> + const void *compatible = NULL;
> + u32 len;
> + __be32 *new_cells, *tmp;
> + int res = 0;
> +
> + /* Will pass only first ITS node info */
> + /* TODO: Handle multi node */
> + its = list_first_entry(&its_nodes, struct its_node, entry);
I think this should be done at the top level by not walking all children
and by blacklisting all ITS nodes to be replaced by our own.
It's also not clear why list_first_entry should be NULL for all but the
first, but nevermind.
> + if ( !its )
> + {
> + dprintk(XENLOG_ERR, "ITS node not found\n");
> + return -FDT_ERR_XEN(ENOENT);
> + }
> +
> + gic = its->dt_node;
> +
> + compatible = dt_get_property(gic, "compatible", &len);
> + if ( !compatible )
> + {
> + dprintk(XENLOG_ERR, "Can't find compatible property for the its node\n");
> + return -FDT_ERR_XEN(ENOENT);
> + }
> +
> + res = fdt_begin_node(fdt, "gic-its");
> + if ( res )
> + return res;
> +
> + res = fdt_property(fdt, "compatible", compatible, len);
> + if ( res )
> + return res;
> +
> + res = fdt_property(fdt, "msi-controller", NULL, 0);
> + if ( res )
> + return res;
> +
> + len = dt_cells_to_size(dt_n_addr_cells(node) + dt_n_size_cells(node));
> +
> + new_cells = xzalloc_bytes(len);
> + if ( new_cells == NULL )
> + return -FDT_ERR_XEN(ENOMEM);
> + tmp = new_cells;
> +
> + dt_set_range(&tmp, node, its->phys_base, its->phys_size);
> +
> + res = fdt_property(fdt, "reg", new_cells, len);
> + xfree(new_cells);
> +
> + return res;
> +}
> +
> static int its_force_quiescent(void __iomem *base)
> {
> u32 count = 1000000; /* 1s */
> diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h
> index 7e25f5b..c4c2a07 100644
> --- a/xen/include/asm-arm/gic-its.h
> +++ b/xen/include/asm-arm/gic-its.h
> @@ -274,6 +274,8 @@ static inline uint32_t its_decode_devid(struct domain *d, its_cmd_block *cmd)
> return (cmd->raw_cmd[0] >> 32);
> }
>
> +int its_make_dt_node(const struct domain *d,
> + const struct dt_device_node *node, void *fdt);
> int its_cpu_init(void);
> int its_init(struct rdist_prop *rdist);
> void its_domain_init(struct domain *d);
next prev parent reply other threads:[~2015-06-29 13:06 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-22 12:01 [RFC PATCH v3 00/18] Add ITS support vijay.kilari
2015-06-22 12:01 ` [RFC PATCH v3 01/18] xen/arm: Add bitmap_find_next_zero_area helper function vijay.kilari
2015-06-22 14:14 ` Julien Grall
2015-06-22 12:01 ` [RFC PATCH v3 02/18] xen: Add log2 functionality vijay.kilari
2015-06-22 13:17 ` Jan Beulich
2015-06-24 13:05 ` Vijay Kilari
2015-06-24 13:21 ` Jan Beulich
2015-06-22 12:01 ` [RFC PATCH v3 03/18] xen: console: Add ratelimit support for error message vijay.kilari
2015-06-22 13:21 ` Jan Beulich
2015-06-25 13:14 ` Vijay Kilari
2015-06-25 13:21 ` Andrew Cooper
2015-06-25 13:31 ` Jan Beulich
2015-06-22 12:01 ` [RFC PATCH v3 04/18] xen/arm: gicv3: Refactor redistributor information vijay.kilari
2015-06-22 15:00 ` Julien Grall
2015-06-29 11:09 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 05/18] xen/arm: ITS: Port ITS driver to xen vijay.kilari
2015-06-22 17:16 ` Julien Grall
2015-06-26 9:19 ` Vijay Kilari
2015-06-26 9:52 ` Julien Grall
2015-06-29 11:39 ` Ian Campbell
2015-06-29 15:43 ` Vijay Kilari
2015-06-29 15:47 ` Vijay Kilari
2015-06-29 16:49 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 06/18] xen/arm: ITS: Add helper functions to manage its_devices vijay.kilari
2015-06-23 10:21 ` Julien Grall
2015-06-22 12:01 ` [RFC PATCH v3 07/18] xen/arm: ITS: implement hw_irq_controller for LPIs vijay.kilari
2015-06-23 14:32 ` Julien Grall
2015-06-26 12:54 ` Vijay Kilari
2015-06-26 15:05 ` Julien Grall
2015-06-29 11:53 ` Ian Campbell
2015-06-29 12:46 ` Julien Grall
2015-07-02 12:15 ` Vijay Kilari
2015-06-26 14:25 ` Vijay Kilari
2015-06-26 15:15 ` Julien Grall
2015-06-29 11:59 ` Ian Campbell
2015-07-02 12:21 ` Vijay Kilari
2015-07-02 12:35 ` Ian Campbell
2015-07-02 12:44 ` Vijay Kilari
2015-07-02 12:59 ` Ian Campbell
2015-07-02 16:11 ` Julien Grall
2015-06-22 12:01 ` [RFC PATCH v3 08/18] xen/arm: vITS: Add virtual ITS driver vijay.kilari
2015-06-23 16:39 ` Julien Grall
2015-07-02 13:33 ` Vijay Kilari
2015-07-02 14:30 ` Ian Campbell
2015-06-24 9:20 ` Julien Grall
2015-06-29 12:13 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 09/18] xen/arm: ITS: Add virtual ITS commands support vijay.kilari
2015-06-24 10:29 ` Julien Grall
2015-06-29 12:16 ` Ian Campbell
2015-06-29 12:18 ` Ian Campbell
2015-06-29 12:23 ` Ian Campbell
2015-07-03 6:50 ` Vijay Kilari
2015-07-03 8:41 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 10/18] xen/arm: ITS: Add APIs to add and assign device vijay.kilari
2015-06-24 11:38 ` Julien Grall
2015-06-29 12:25 ` Ian Campbell
2015-06-29 12:29 ` Ian Campbell
2015-07-02 8:40 ` Vijay Kilari
2015-07-02 9:01 ` Ian Campbell
2015-07-02 10:30 ` Julien Grall
2015-06-22 12:01 ` [RFC PATCH v3 11/18] xen/arm: ITS: Add GITS registers emulation vijay.kilari
2015-06-26 12:51 ` Julien Grall
2015-07-08 12:11 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 12/18] xen/arm: ITS: Add GICR register emulation vijay.kilari
2015-06-22 12:01 ` [RFC PATCH v3 13/18] xen/arm: ITS: Add irq descriptors for LPIs vijay.kilari
2015-06-29 12:58 ` Ian Campbell
2015-06-29 13:11 ` Julien Grall
2015-07-07 11:00 ` Vijay Kilari
2015-07-07 11:16 ` Julien Grall
2015-07-07 15:50 ` Ian Campbell
2015-07-07 15:52 ` Julien Grall
2015-07-07 16:04 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 14/18] xen/arm: ITS: Initialize physical ITS vijay.kilari
2015-06-22 12:01 ` [RFC PATCH v3 15/18] xen/arm: ITS: Add domain specific ITS initialization vijay.kilari
2015-06-29 13:01 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 16/18] xen/arm: ITS: Handle LPI interrupts vijay.kilari
2015-06-29 13:03 ` Ian Campbell
2015-06-22 12:01 ` [RFC PATCH v3 17/18] xen/arm: ITS: Generate ITS node for Dom0 vijay.kilari
2015-06-29 13:06 ` Ian Campbell [this message]
2015-07-07 5:31 ` Vijay Kilari
2015-07-07 8:21 ` Julien Grall
2015-07-07 10:25 ` Vijay Kilari
2015-07-07 11:07 ` Julien Grall
2015-06-22 12:01 ` [RFC PATCH v3 18/18] xen/arm: ITS: Map ITS translation space vijay.kilari
2015-06-22 13:52 ` [RFC PATCH v3 00/18] Add ITS support Julien Grall
2015-06-22 13:56 ` Ian Campbell
2015-06-24 10:02 ` Ian Campbell
2015-06-29 13:11 ` Ian Campbell
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=1435583179.32500.324.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Prasun.Kapoor@caviumnetworks.com \
--cc=Vijaya.Kumar@caviumnetworks.com \
--cc=julien.grall@citrix.com \
--cc=manish.jaggi@caviumnetworks.com \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=vijay.kilari@gmail.com \
--cc=xen-devel@lists.xen.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 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).