From: vijay.kilari@gmail.com
To: Ian.Campbell@citrix.com, julien.grall@citrix.com,
stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: [PATCH v4 16/17] xen/arm: ITS: Generate ITS node for Dom0
Date: Fri, 10 Jul 2015 13:12:51 +0530 [thread overview]
Message-ID: <1436514172-3263-17-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1436514172-3263-1-git-send-email-vijay.kilari@gmail.com>
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>
---
v4: - Generate only one ITS node for Dom0
- Replace msi-parent references to single its phandle
---
xen/arch/arm/domain_build.c | 78 +++++++++++++++++++++++++++++++++++++++++
xen/arch/arm/gic-v3-its.c | 57 ++++++++++++++++++++++++++++++
xen/include/asm-arm/gic-its.h | 2 ++
3 files changed, 137 insertions(+)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e9cb8a9..5c62437 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"
@@ -61,6 +62,9 @@ custom_param("dom0_mem", parse_dom0_mem);
*/
#define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry))
+#ifdef CONFIG_ARM_64
+static fdt32_t its_phandle;
+#endif
struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
{
if ( opt_dom0_max_vcpus == 0 )
@@ -468,6 +472,18 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
continue;
}
+#ifdef CONFIG_ARM_64
+ /*
+ * Replace all msi-parent phandle references to single ITS node
+ * generated for Dom0
+ */
+ if ( dt_property_name_is_equal(prop, "msi-parent") )
+ {
+ fdt_property(kinfo->fdt, prop->name, (void *)&its_phandle,
+ sizeof(its_phandle));
+ continue;
+ }
+#endif
res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len);
xfree(new_data);
@@ -803,6 +819,38 @@ static int make_cpus_node(const struct domain *d, void *fdt,
return res;
}
+#ifdef CONFIG_ARM_64
+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;
+ }
+
+ its_phandle = cpu_to_fdt32(node->phandle);
+
+ res = fdt_end_node(fdt);
+
+ return res;
+}
+#endif
+
static int make_gic_node(const struct domain *d, void *fdt,
const struct dt_device_node *node)
{
@@ -1119,6 +1167,14 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
DT_MATCH_TIMER,
{ /* sentinel */ },
};
+#ifdef CONFIG_ARM_64
+ static const struct dt_device_match gits_matches[] __initconst =
+ {
+ DT_MATCH_GIC_ITS,
+ { /* sentinel */ },
+ };
+ struct dt_device_node *gic_child;
+#endif
struct dt_device_node *child;
int res;
const char *name;
@@ -1143,7 +1199,29 @@ 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 )
+ {
+#ifdef CONFIG_ARM_64
+ if ( !make_gic_node(d, kinfo->fdt, node) )
+ {
+ res = 0;
+ dt_for_each_child_node(node, gic_child)
+ {
+ if ( gic_child != NULL )
+ {
+ if ( dt_match_node(gits_matches, gic_child) )
+ {
+ res = make_its_node(d, kinfo->fdt, gic_child);
+ break;
+ }
+ }
+ }
+ return res;
+ }
+ return 0;
+#else
return make_gic_node(d, kinfo->fdt, node);
+#endif
+ }
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 b159b0b..4193624 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>
@@ -1227,6 +1229,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);
+ 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 cbe7596..1bb9825 100644
--- a/xen/include/asm-arm/gic-its.h
+++ b/xen/include/asm-arm/gic-its.h
@@ -258,6 +258,8 @@ struct gic_its_info {
u32 its_get_id_bits(void);
u32 its_get_dev_bits(void);
u32 its_get_nr_events(void);
+int its_make_dt_node(const struct domain *d,
+ const struct dt_device_node *node, void *fdt);
int its_lpi_init(u32 id_bits);
int its_init(struct rdist_prop *rdists);
int its_cpu_init(void);
--
1.7.9.5
next prev parent reply other threads:[~2015-07-10 7:42 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 7:42 [PATCH v4 00/17] Add ITS support vijay.kilari
2015-07-10 7:42 ` [PATCH v4 01/17] xen/arm: Add bitmap_find_next_zero_area helper function vijay.kilari
2015-07-10 9:01 ` Jan Beulich
2015-07-10 9:28 ` Vijay Kilari
2015-07-10 9:30 ` Vijay Kilari
2015-07-10 9:45 ` Vijay Kilari
2015-07-10 10:07 ` Jan Beulich
2015-07-10 7:42 ` [PATCH v4 02/17] xen: Add log2 functionality vijay.kilari
2015-07-10 7:42 ` [PATCH v4 03/17] xen/arm: ITS: Port ITS driver to Xen vijay.kilari
2015-07-10 13:01 ` Ian Campbell
2015-07-15 10:23 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 04/17] xen/arm: ITS: Add helper functions to manage its_devices vijay.kilari
2015-07-10 13:05 ` Ian Campbell
2015-07-15 10:37 ` Julien Grall
2015-07-15 14:21 ` Vijay Kilari
2015-07-15 14:28 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 05/17] xen/arm: ITS: implement hw_irq_controller for LPIs vijay.kilari
2015-07-10 13:46 ` Ian Campbell
2015-07-11 14:40 ` Vijay Kilari
2015-07-11 18:08 ` Julien Grall
2015-07-13 9:17 ` Ian Campbell
2015-07-13 21:18 ` Julien Grall
2015-07-15 7:16 ` Vijay Kilari
2015-07-15 8:26 ` Julien Grall
2015-07-15 9:32 ` Ian Campbell
2015-07-15 9:49 ` Julien Grall
2015-07-15 10:01 ` Ian Campbell
2015-07-15 14:15 ` Vijay Kilari
2015-07-15 14:22 ` Julien Grall
2015-07-15 14:28 ` Ian Campbell
2015-07-15 17:01 ` Vijay Kilari
2015-07-16 14:49 ` Ian Campbell
2015-07-16 15:21 ` Marc Zyngier
2015-07-16 16:18 ` Ian Campbell
2015-07-16 16:27 ` Marc Zyngier
2015-07-16 16:37 ` Ian Campbell
2015-07-18 10:13 ` Julien Grall
2015-07-20 11:52 ` Ian Campbell
2015-07-20 12:22 ` Ian Campbell
2015-07-15 18:19 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 06/17] xen/arm: ITS: Add virtual ITS driver vijay.kilari
2015-07-10 13:54 ` Ian Campbell
2015-07-11 14:48 ` Vijay Kilari
2015-07-13 9:27 ` Ian Campbell
2015-07-10 14:15 ` Ian Campbell
2015-07-11 14:48 ` Vijay Kilari
2015-07-13 9:25 ` Ian Campbell
2015-07-15 12:17 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 07/17] xen/arm: ITS: Add virtual ITS commands support vijay.kilari
2015-07-10 14:35 ` Ian Campbell
2015-07-11 14:49 ` Vijay Kilari
2015-07-13 9:22 ` Ian Campbell
2015-07-13 11:15 ` Vijay Kilari
2015-07-13 11:37 ` Ian Campbell
2015-07-17 15:01 ` Vijay Kilari
2015-07-15 13:02 ` Julien Grall
2015-07-15 13:56 ` Ian Campbell
2015-07-15 12:57 ` Julien Grall
2015-07-17 14:12 ` Vijay Kilari
2015-07-17 15:15 ` Julien Grall
2015-07-17 15:34 ` Ian Campbell
2015-07-17 15:44 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 08/17] xen/arm: ITS: Add APIs to add and assign device vijay.kilari
2015-07-10 14:52 ` Ian Campbell
2015-07-15 13:14 ` Julien Grall
2015-07-16 13:40 ` Vijay Kilari
2015-07-16 14:38 ` Julien Grall
2015-07-15 14:15 ` Julien Grall
2015-07-18 9:44 ` Vijay Kilari
2015-07-18 10:06 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 09/17] xen/arm: ITS: Add GITS registers emulation vijay.kilari
2015-07-10 14:56 ` Ian Campbell
2015-07-15 16:13 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 10/17] xen/arm: ITS: Enable physical and virtual ITS driver compilation vijay.kilari
2015-07-15 16:16 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 11/17] xen/arm: ITS: Add GICR register emulation vijay.kilari
2015-07-10 15:10 ` Ian Campbell
2015-07-11 18:25 ` Julien Grall
2015-07-13 9:28 ` Ian Campbell
2015-07-13 9:53 ` Ian Campbell
2015-07-13 16:53 ` Stefano Stabellini
2015-07-15 17:32 ` Julien Grall
2015-07-16 14:15 ` Vijay Kilari
2015-07-16 14:41 ` Julien Grall
2015-07-16 14:46 ` Vijay Kilari
2015-07-16 14:58 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 12/17] xen/arm: ITS: Initialize LPI irq descriptors and route vijay.kilari
2015-07-10 15:30 ` Ian Campbell
2015-07-20 13:07 ` Vijay Kilari
2015-07-20 13:25 ` Julien Grall
2015-07-22 13:31 ` Vijay Kilari
2015-07-22 13:39 ` Julien Grall
2015-07-22 14:17 ` Julien Grall
2015-07-13 17:03 ` Stefano Stabellini
2015-07-13 17:13 ` Stefano Stabellini
2015-07-13 17:36 ` Julien Grall
2015-07-15 18:13 ` Julien Grall
2015-07-16 8:06 ` Julien Grall
2015-07-16 8:37 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 13/17] xen/arm: ITS: Initialize physical ITS vijay.kilari
2015-07-13 17:06 ` Stefano Stabellini
2015-07-10 7:42 ` [PATCH v4 14/17] xen/arm: ITS: Add domain specific ITS initialization vijay.kilari
2015-07-10 15:41 ` Ian Campbell
2015-07-15 17:41 ` Julien Grall
2015-07-10 7:42 ` [PATCH v4 15/17] xen/arm: ITS: Map ITS translation space vijay.kilari
2015-07-10 15:43 ` Ian Campbell
2015-07-15 9:01 ` Julien Grall
2015-07-10 7:42 ` vijay.kilari [this message]
2015-07-13 16:32 ` [PATCH v4 16/17] xen/arm: ITS: Generate ITS node for Dom0 Stefano Stabellini
2015-07-13 17:31 ` Julien Grall
2015-07-13 17:36 ` Stefano Stabellini
2015-07-10 7:42 ` [PATCH v4 17/17] xen/arm: ITS: Add pci devices in ThunderX vijay.kilari
2015-07-10 15:45 ` 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=1436514172-3263-17-git-send-email-vijay.kilari@gmail.com \
--to=vijay.kilari@gmail.com \
--cc=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=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).