Re: [Xen-devel] [PATCH v6 6/8] arm/gic-v3: Refactor gicv3_init into generic and dt specific parts

2016-02-03 Thread Ian Campbell
On Sat, 2016-01-30 at 17:03 +0800, Shannon Zhao wrote:
> 
> On 2016/1/28 18:27, Stefano Stabellini wrote:
> > On Thu, 28 Jan 2016, Shannon Zhao wrote:
> > > > From: Shannon Zhao 
> > > > 
> > > > Refactor gic-v3 related functions into dt and generic parts. This
> > > > will be
> > > > helpful when adding acpi support for gic-v3.
> > > > 
> > > > Signed-off-by: Shannon Zhao 
> > Reviewed-by: Stefano Stabellini 
> > 
> Thanks a lot!
> 
> Hi Ian, Would you please pick the last five patches(4-8)?

Done. I nearly missed the hidden v6 but Stefano pointed it out to me.

0f5f9d8 pl011: Refactor pl011 driver to dt and common initialization parts
57c5953 arm/uart: Rename dt-uart.c to arm-uart.c
b3aeac4 arm/gic-v3: Refactor gicv3_init into generic and dt specific parts
57ab13c arm/gic-v2: Refactor gicv2_init into generic and dt specific parts
eaf1de3 arm/smpboot: Move dt specific code in smp to seperate functions

There was one minor conflict with a MAINTAINERS change, but I trivially
resolved it.


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v6 6/8] arm/gic-v3: Refactor gicv3_init into generic and dt specific parts

2016-01-30 Thread Shannon Zhao


On 2016/1/28 18:27, Stefano Stabellini wrote:
> On Thu, 28 Jan 2016, Shannon Zhao wrote:
>> > From: Shannon Zhao 
>> > 
>> > Refactor gic-v3 related functions into dt and generic parts. This will be
>> > helpful when adding acpi support for gic-v3.
>> > 
>> > Signed-off-by: Shannon Zhao 
> Reviewed-by: Stefano Stabellini 
> 
Thanks a lot!

Hi Ian, Would you please pick the last five patches(4-8)? Regarding the
first three patches, I'll update them and send as an individual set.

Thanks,
-- 
Shannon


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v6 6/8] arm/gic-v3: Refactor gicv3_init into generic and dt specific parts

2016-01-28 Thread Stefano Stabellini
On Thu, 28 Jan 2016, Shannon Zhao wrote:
> From: Shannon Zhao 
> 
> Refactor gic-v3 related functions into dt and generic parts. This will be
> helpful when adding acpi support for gic-v3.
> 
> Signed-off-by: Shannon Zhao 

Reviewed-by: Stefano Stabellini 


> v6: keep vsize check in gicv3_init_v2
> ---
>  xen/arch/arm/gic-v3.c | 84 
> +++
>  1 file changed, 45 insertions(+), 39 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index a245b56..fa61231 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1138,26 +1138,14 @@ static int __init cmp_rdist(const void *a, const void 
> *b)
>  return ( l->base < r->base) ? -1 : 0;
>  }
>  
> +static paddr_t __initdata dbase = INVALID_PADDR;
> +static paddr_t __initdata vbase = INVALID_PADDR, vsize = 0;
> +static paddr_t __initdata cbase = INVALID_PADDR, csize = 0;
> +
>  /* If the GICv3 supports GICv2, initialize it */
> -static void __init gicv3_init_v2(const struct dt_device_node *node,
> - paddr_t dbase)
> +static void __init gicv3_init_v2(void)
>  {
> -int res;
> -paddr_t cbase, csize;
> -paddr_t vbase, vsize;
> -
> -/*
> - * For GICv3 supporting GICv2, GICC and GICV base address will be
> - * provided.
> - */
> -res = dt_device_get_address(node, 1 + gicv3.rdist_count,
> -, );
> -if ( res )
> -return;
> -
> -res = dt_device_get_address(node, 1 + gicv3.rdist_count + 2,
> -, );
> -if ( res )
> +if ( cbase == INVALID_PADDR || vbase == INVALID_PADDR )
>  return;
>  
>  /*
> @@ -1180,20 +1168,11 @@ static void __init gicv3_init_v2(const struct 
> dt_device_node *node,
>  vgic_v2_setup_hw(dbase, cbase, csize, vbase, 0);
>  }
>  
> -/* Set up the GIC */
> -static int __init gicv3_init(void)
> +static void __init gicv3_dt_init(void)
>  {
>  struct rdist_region *rdist_regs;
>  int res, i;
> -uint32_t reg;
>  const struct dt_device_node *node = gicv3_info.node;
> -paddr_t dbase;
> -
> -if ( !cpu_has_gicv3 )
> -{
> -dprintk(XENLOG_ERR, "GICv3: driver requires system register 
> support\n");
> -return -ENODEV;
> -}
>  
>  res = dt_device_get_address(node, 0, , NULL);
>  if ( res )
> @@ -1203,14 +1182,6 @@ static int __init gicv3_init(void)
>  panic("GICv3:  Found unaligned distributor address %"PRIpaddr"",
>dbase);
>  
> -gicv3.map_dbase = ioremap_nocache(dbase, SZ_64K);
> -if ( !gicv3.map_dbase )
> -panic("GICv3: Failed to ioremap for GIC distributor\n");
> -
> -reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK;
> -if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )
> - panic("GICv3: no distributor detected\n");
> -
>  if ( !dt_property_read_u32(node, "#redistributor-regions",
>  _count) )
>  gicv3.rdist_count = 1;
> @@ -1248,6 +1219,41 @@ static int __init gicv3_init(void)
>  panic("GICv3: Cannot find the maintenance IRQ");
>  gicv3_info.maintenance_irq = res;
>  
> +/*
> + * For GICv3 supporting GICv2, GICC and GICV base address will be
> + * provided.
> + */
> +res = dt_device_get_address(node, 1 + gicv3.rdist_count,
> +, );
> +if ( res )
> +return;
> +
> +dt_device_get_address(node, 1 + gicv3.rdist_count + 2,
> +  , );
> +}
> +
> +/* Set up the GIC */
> +static int __init gicv3_init(void)
> +{
> +int res, i;
> +uint32_t reg;
> +
> +if ( !cpu_has_gicv3 )
> +{
> +dprintk(XENLOG_ERR, "GICv3: driver requires system register 
> support\n");
> +return -ENODEV;
> +}
> +
> +gicv3_dt_init();
> +
> +gicv3.map_dbase = ioremap_nocache(dbase, SZ_64K);
> +if ( !gicv3.map_dbase )
> +panic("GICv3: Failed to ioremap for GIC distributor\n");
> +
> +reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK;
> +if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )
> + panic("GICv3: no distributor detected\n");
> +
>  for ( i = 0; i < gicv3.rdist_count; i++ )
>  {
>  /* map dbase & rdist regions */
> @@ -1277,7 +1283,7 @@ static int __init gicv3_init(void)
>  
>  vgic_v3_setup_hw(dbase, gicv3.rdist_count, gicv3.rdist_regions,
>   gicv3.rdist_stride);
> -gicv3_init_v2(node, dbase);
> +gicv3_init_v2();
>  
>  spin_lock_init();
>  
> @@ -1317,7 +1323,7 @@ static const struct gic_hw_operations gicv3_ops = {
>  .make_hwdom_dt_node  = gicv3_make_hwdom_dt_node,
>  };
>  
> -static int __init gicv3_preinit(struct dt_device_node *node, const void 
> *data)
> +static int __init gicv3_dt_preinit(struct dt_device_node *node, const void 
> *data)
>  

[Xen-devel] [PATCH v6 6/8] arm/gic-v3: Refactor gicv3_init into generic and dt specific parts

2016-01-27 Thread Shannon Zhao
From: Shannon Zhao 

Refactor gic-v3 related functions into dt and generic parts. This will be
helpful when adding acpi support for gic-v3.

Signed-off-by: Shannon Zhao 
---
v6: keep vsize check in gicv3_init_v2
---
 xen/arch/arm/gic-v3.c | 84 +++
 1 file changed, 45 insertions(+), 39 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index a245b56..fa61231 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1138,26 +1138,14 @@ static int __init cmp_rdist(const void *a, const void 
*b)
 return ( l->base < r->base) ? -1 : 0;
 }
 
+static paddr_t __initdata dbase = INVALID_PADDR;
+static paddr_t __initdata vbase = INVALID_PADDR, vsize = 0;
+static paddr_t __initdata cbase = INVALID_PADDR, csize = 0;
+
 /* If the GICv3 supports GICv2, initialize it */
-static void __init gicv3_init_v2(const struct dt_device_node *node,
- paddr_t dbase)
+static void __init gicv3_init_v2(void)
 {
-int res;
-paddr_t cbase, csize;
-paddr_t vbase, vsize;
-
-/*
- * For GICv3 supporting GICv2, GICC and GICV base address will be
- * provided.
- */
-res = dt_device_get_address(node, 1 + gicv3.rdist_count,
-, );
-if ( res )
-return;
-
-res = dt_device_get_address(node, 1 + gicv3.rdist_count + 2,
-, );
-if ( res )
+if ( cbase == INVALID_PADDR || vbase == INVALID_PADDR )
 return;
 
 /*
@@ -1180,20 +1168,11 @@ static void __init gicv3_init_v2(const struct 
dt_device_node *node,
 vgic_v2_setup_hw(dbase, cbase, csize, vbase, 0);
 }
 
-/* Set up the GIC */
-static int __init gicv3_init(void)
+static void __init gicv3_dt_init(void)
 {
 struct rdist_region *rdist_regs;
 int res, i;
-uint32_t reg;
 const struct dt_device_node *node = gicv3_info.node;
-paddr_t dbase;
-
-if ( !cpu_has_gicv3 )
-{
-dprintk(XENLOG_ERR, "GICv3: driver requires system register 
support\n");
-return -ENODEV;
-}
 
 res = dt_device_get_address(node, 0, , NULL);
 if ( res )
@@ -1203,14 +1182,6 @@ static int __init gicv3_init(void)
 panic("GICv3:  Found unaligned distributor address %"PRIpaddr"",
   dbase);
 
-gicv3.map_dbase = ioremap_nocache(dbase, SZ_64K);
-if ( !gicv3.map_dbase )
-panic("GICv3: Failed to ioremap for GIC distributor\n");
-
-reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK;
-if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )
- panic("GICv3: no distributor detected\n");
-
 if ( !dt_property_read_u32(node, "#redistributor-regions",
 _count) )
 gicv3.rdist_count = 1;
@@ -1248,6 +1219,41 @@ static int __init gicv3_init(void)
 panic("GICv3: Cannot find the maintenance IRQ");
 gicv3_info.maintenance_irq = res;
 
+/*
+ * For GICv3 supporting GICv2, GICC and GICV base address will be
+ * provided.
+ */
+res = dt_device_get_address(node, 1 + gicv3.rdist_count,
+, );
+if ( res )
+return;
+
+dt_device_get_address(node, 1 + gicv3.rdist_count + 2,
+  , );
+}
+
+/* Set up the GIC */
+static int __init gicv3_init(void)
+{
+int res, i;
+uint32_t reg;
+
+if ( !cpu_has_gicv3 )
+{
+dprintk(XENLOG_ERR, "GICv3: driver requires system register 
support\n");
+return -ENODEV;
+}
+
+gicv3_dt_init();
+
+gicv3.map_dbase = ioremap_nocache(dbase, SZ_64K);
+if ( !gicv3.map_dbase )
+panic("GICv3: Failed to ioremap for GIC distributor\n");
+
+reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK;
+if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 )
+ panic("GICv3: no distributor detected\n");
+
 for ( i = 0; i < gicv3.rdist_count; i++ )
 {
 /* map dbase & rdist regions */
@@ -1277,7 +1283,7 @@ static int __init gicv3_init(void)
 
 vgic_v3_setup_hw(dbase, gicv3.rdist_count, gicv3.rdist_regions,
  gicv3.rdist_stride);
-gicv3_init_v2(node, dbase);
+gicv3_init_v2();
 
 spin_lock_init();
 
@@ -1317,7 +1323,7 @@ static const struct gic_hw_operations gicv3_ops = {
 .make_hwdom_dt_node  = gicv3_make_hwdom_dt_node,
 };
 
-static int __init gicv3_preinit(struct dt_device_node *node, const void *data)
+static int __init gicv3_dt_preinit(struct dt_device_node *node, const void 
*data)
 {
 gicv3_info.hw_version = GIC_V3;
 gicv3_info.node = node;
@@ -1335,7 +1341,7 @@ static const struct dt_device_match gicv3_dt_match[] 
__initconst =
 
 DT_DEVICE_START(gicv3, "GICv3", DEVICE_GIC)
 .dt_match = gicv3_dt_match,
-.init = gicv3_preinit,
+.init = gicv3_dt_preinit,
 DT_DEVICE_END
 
 /*
-- 
2.0.4



___
Xen-devel mailing