All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: Handle translated addresses for hardware domains in GICv2
@ 2015-02-20  9:38 Frediano Ziglio
  2015-02-23 16:30 ` Julien Grall
  2015-02-24 16:00 ` Ian Campbell
  0 siblings, 2 replies; 16+ messages in thread
From: Frediano Ziglio @ 2015-02-20  9:38 UTC (permalink / raw)
  To: Ian Campbell, Stefano Stabellini, Tim Deegan, Julien Grall,
	frediano.ziglio
  Cc: zoltan.kiss, xen-devel

Translated address could have an offset applied to them.
Replicate same value for device node to avoid improper address
computation in the OS.

Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
---
 xen/arch/arm/gic-v2.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Submit again after release. This patch was developed as a specific
platform patch but it applies to all platforms.

Previous discussions at
- http://lists.xen.org/archives/html/xen-devel/2014-11/msg00406.html
- http://lists.xen.org/archives/html/xen-devel/2014-11/msg00520.html

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 31fb81a..4d1924e 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -590,7 +590,7 @@ static int gicv2_make_dt_node(const struct domain *d,
     const struct dt_device_node *gic = dt_interrupt_controller;
     const void *compatible = NULL;
     u32 len;
-    __be32 *new_cells, *tmp;
+    const __be32 *regs;
     int res = 0;
 
     compatible = dt_get_property(gic, "compatible", &len);
@@ -617,18 +617,18 @@ static int gicv2_make_dt_node(const struct domain *d,
     if ( res )
         return res;
 
+    /* copy GICC and GICD regions */
+    regs = dt_get_property(gic, "reg", &len);
+    if ( !regs )
+    {
+        dprintk(XENLOG_ERR, "Can't find reg property for the gic node\n");
+        return -FDT_ERR_XEN(ENOENT);
+    }
+
     len = dt_cells_to_size(dt_n_addr_cells(node) + dt_n_size_cells(node));
     len *= 2; /* GIC has two memory regions: Distributor + CPU interface */
-    new_cells = xzalloc_bytes(len);
-    if ( new_cells == NULL )
-        return -FDT_ERR_XEN(ENOMEM);
-
-    tmp = new_cells;
-    dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE);
-    dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2);
 
-    res = fdt_property(fdt, "reg", new_cells, len);
-    xfree(new_cells);
+    res = fdt_property(fdt, "reg", regs, len);
 
     return res;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-03-02 15:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20  9:38 [PATCH] xen/arm: Handle translated addresses for hardware domains in GICv2 Frediano Ziglio
2015-02-23 16:30 ` Julien Grall
2015-02-24 16:01   ` Ian Campbell
2015-02-24 16:21     ` Julien Grall
2015-02-24 17:00       ` Ian Campbell
2015-02-24 17:09         ` Julien Grall
2015-02-24 16:00 ` Ian Campbell
2015-02-25 11:14   ` Frediano Ziglio
2015-02-25 13:03     ` Julien Grall
2015-02-25 13:21       ` Frediano Ziglio
2015-02-27 13:53         ` Julien Grall
2015-02-27 13:57           ` Ian Campbell
2015-02-27 14:00             ` Julien Grall
2015-02-27 14:08               ` Frediano Ziglio
2015-03-02 14:50                 ` Ian Campbell
2015-03-02 15:00                   ` Frediano Ziglio

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.