From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Date: Fri, 22 Nov 2013 17:22:50 +0000 Message-ID: <528F92EA.6040209@linaro.org> References: <1385137474-31245-9-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1385137474-31245-9-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , xen-devel@lists.xen.org Cc: pranavkumar@linaro.org, tim@xen.org, Anup Patel , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On 11/22/2013 04:24 PM, Ian Campbell wrote: > The APM X-Gene Mustang board DTS has #address-cells = 2. > > Signed-off-by: Ian Campbell > --- > v2: Use dt_read_number, check the property length > --- > xen/arch/arm/smpboot.c | 34 +++++++++++++++++++++++++++++----- > 1 file changed, 29 insertions(+), 5 deletions(-) > > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c > index 6c90fa6..b6a1307 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -125,18 +125,42 @@ void __init smp_init_cpus(void) > > dt_for_each_child_node( cpus, cpu ) > { > - u32 hwid; > + const __be32 *prop; > + u64 addr; > + u32 reg_len, hwid; > > if ( !dt_device_type_is_equal(cpu, "cpu") ) > continue; > > - if ( !dt_property_read_u32(cpu, "reg", &hwid) ) > + if ( dt_n_size_cells(cpu) != 0 ) > + printk(XENLOG_WARNING "cpu node `%s`: #size-cells %d\n", > + dt_node_full_name(cpu), dt_n_size_cells(cpu)); > + > + prop = dt_get_property(cpu, "reg", ®_len); > + if ( !prop ) > + { > + printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n", > + dt_node_full_name(cpu)); > + continue; > + } > + > + if ( reg_len < dt_n_addr_cells(cpu) ) dt_n_addr_cells is the number of cells not in bytes. You must use dt_cells_to_size(dt_nr_addr_cells(cpu)), perhaps an helper would be useful here. -- Julien Grall