[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 23/24] ARM: vITS: create ITS subnodes for Dom0 DT
Dom0 expects all ITSes in the system to be propagated to be able to use MSIs. Create Dom0 DT nodes for each hardware ITS, keeping the register frame address the same, as the doorbell address that the Dom0 drivers program into the BARs has to match the hardware. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/gic-its.c | 68 +++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/gic-v3.c | 4 ++- xen/include/asm-arm/gic-its.h | 13 +++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic-its.c b/xen/arch/arm/gic-its.c index 5129d6e..bb0b80a 100644 --- a/xen/arch/arm/gic-its.c +++ b/xen/arch/arm/gic-its.c @@ -748,6 +748,74 @@ void gicv3_lpi_set_enable(struct host_its *its, its_send_cmd_sync(its, 0); } +int gicv3_its_make_dt_nodes(struct list_head *its_list, + const struct domain *d, + const struct dt_device_node *gic, + void *fdt) +{ + uint32_t len; + int res; + const void *prop = NULL; + const struct dt_device_node *its = NULL; + const struct host_its *its_data; + + if ( list_empty(its_list) ) + return 0; + + /* The sub-nodes require the ranges property */ + prop = dt_get_property(gic, "ranges", &len); + if ( !prop ) + { + printk(XENLOG_ERR "Can't find ranges property for the gic node\n"); + return -FDT_ERR_XEN(ENOENT); + } + + res = fdt_property(fdt, "ranges", prop, len); + if ( res ) + return res; + + list_for_each_entry(its_data, its_list, entry) + { + its = its_data->dt_node; + + res = fdt_begin_node(fdt, its->name); + if ( res ) + return res; + + res = fdt_property_string(fdt, "compatible", "arm,gic-v3-its"); + if ( res ) + return res; + + res = fdt_property(fdt, "msi-controller", NULL, 0); + if ( res ) + return res; + + if ( its->phandle ) + { + res = fdt_property_cell(fdt, "phandle", its->phandle); + if ( res ) + return res; + } + + /* Use the same reg regions as the ITS node in host DTB. */ + prop = dt_get_property(its, "reg", &len); + if ( !prop ) + { + printk(XENLOG_ERR "GICv3: Can't find ITS reg property.\n"); + res = -FDT_ERR_XEN(ENOENT); + return res; + } + + res = fdt_property(fdt, "reg", prop, len); + if ( res ) + return res; + + fdt_end_node(fdt); + } + + return res; +} + void gicv3_its_dt_init(const struct dt_device_node *node) { const struct dt_device_node *its = NULL; diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 57009c6..9fba3eb 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1176,8 +1176,10 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, res = fdt_property(fdt, "reg", new_cells, len); xfree(new_cells); + if ( res ) + return res; - return res; + return gicv3_its_make_dt_nodes(&host_its_list, d, gic, fdt); } static const hw_irq_controller gicv3_host_irq_type = { diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h index b58e092..e20b5bc 100644 --- a/xen/include/asm-arm/gic-its.h +++ b/xen/include/asm-arm/gic-its.h @@ -130,6 +130,12 @@ void gicv3_its_setup_collection(int cpu); int vgic_v3_its_init_virtual(struct domain *d, struct host_its *hw_its, paddr_t guest_addr); +/* Given a list of ITSes, create the appropriate DT nodes for a domain. */ +int gicv3_its_make_dt_nodes(struct list_head *its_list, + const struct domain *d, + const struct dt_device_node *gic, + void *fdt); + /* Map a device on the host by allocating an ITT on the host (ITS). * "bits" specifies how many events (interrupts) this device will need. * Setting "valid" to false deallocates the device. @@ -217,6 +223,13 @@ static inline int vgic_v3_its_init_virtual(struct domain *d, { return 0; } +static inline int gicv3_its_make_dt_nodes(struct list_head *its_list, + const struct domain *d, + const struct dt_device_node *gic, + void *fdt) +{ + return 0; +} #endif /* CONFIG_HAS_ITS */ -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |