From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: pranavkumar@linaro.org, stefano.stabellini@eu.citrix.com,
tim@xen.org, Anup Patel <anup.patel@linaro.org>,
xen-devel@lists.xen.org
Subject: Re: [PATCH 07/16] xen: arm: Handle cpus nodes with #address-calls > 1
Date: Wed, 20 Nov 2013 16:46:57 +0000 [thread overview]
Message-ID: <528CE781.8040104@linaro.org> (raw)
In-Reply-To: <1384965471.6071.89.camel@kazak.uk.xensource.com>
On 11/20/2013 04:37 PM, Ian Campbell wrote:
> On Wed, 2013-11-20 at 16:31 +0000, Julien Grall wrote:
>> On 11/20/2013 02:48 PM, Ian Campbell wrote:
>>> The APM X-Gene Mustang board DTS has #address-cells = 2.
>>>
>>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>>> ---
>>> xen/arch/arm/smpboot.c | 25 +++++++++++++++++++++----
>>> 1 file changed, 21 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
>>> index 6c90fa6..ce832ae 100644
>>> --- a/xen/arch/arm/smpboot.c
>>> +++ b/xen/arch/arm/smpboot.c
>>> @@ -125,18 +125,35 @@ void __init smp_init_cpus(void)
>>>
>>> dt_for_each_child_node( cpus, cpu )
>>> {
>>> + const __be32 *prop;
>>> + u64 addr, size;
>>> u32 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", NULL);
>>> + if ( !prop )
>>> {
>>> - printk(XENLOG_WARNING "cpu node `%s`: missing reg property\n",
>>> + printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n",
>>> dt_node_full_name(cpu));
>>> continue;
>>> }
>>>
>>> + dt_get_range(&prop, cpu, &addr, &size);
>>
>> You can use dt_read_number here.
>
> As in
> dt_read_number(&prop, dt_n_addr_cells(cpu)
> ? Is there a helper which will take (&prop, cpu, &addr) and figure out
> the size etc internally, that's really what I was looking for.
Except dt_get_range, no. I would prefer the solution with dt_read_number
because it more clear that we want only a number. A cpu is not defined
by a range.
In the both case, you will also need to check the size of the property.
A bad crafted device tree can have reg smaller than #address-cells +
#size-cells.
--
Julien Grall
next prev parent reply other threads:[~2013-11-20 16:46 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 14:45 [PATCH+RFC+HACK 00/16] xen: arm initial support for xgene arm64 platform Ian Campbell
2013-11-20 14:48 ` [PATCH 01/16] xen: arm64: Add 8250 earlyprintk support Ian Campbell
2013-11-20 16:17 ` Julien Grall
2013-11-20 14:48 ` [PATCH 02/16] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
2013-11-20 16:23 ` Julien Grall
2013-11-20 19:07 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 03/16] xen: arm64: Add APM implementor id to processor implementers Ian Campbell
2013-11-20 16:23 ` Julien Grall
2013-11-20 19:10 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 04/16] xen: arm: include ns16550 driver on arm64 too Ian Campbell
2013-11-20 16:24 ` Julien Grall
2013-11-20 19:10 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 05/16] xen: arm: Enable 1:1 workaround for APM X-Gene Storm Ian Campbell
2013-11-20 19:10 ` Stefano Stabellini
2013-11-21 10:24 ` Ian Campbell
2013-11-20 14:48 ` [PATCH 06/16] xen: arm: early logging of command line Ian Campbell
2013-11-20 16:25 ` Julien Grall
2013-11-20 19:06 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 07/16] xen: arm: Handle cpus nodes with #address-calls > 1 Ian Campbell
2013-11-20 16:31 ` Julien Grall
2013-11-20 16:37 ` Ian Campbell
2013-11-20 16:46 ` Julien Grall [this message]
2013-11-20 14:48 ` [PATCH 08/16] xen: arm: Make register bit definitions unsigned Ian Campbell
2013-11-20 19:29 ` Stefano Stabellini
2013-11-21 10:29 ` Ian Campbell
2013-11-20 14:48 ` [PATCH 09/16] xen: arm: explicitly map 64 bit release address Ian Campbell
2013-11-20 19:31 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 10/16] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
2013-11-20 17:31 ` Julien Grall
2013-11-20 17:37 ` Ian Campbell
2013-11-21 13:40 ` Julien Grall
2013-11-20 19:22 ` Stefano Stabellini
2013-11-21 10:32 ` Ian Campbell
2013-11-20 14:48 ` [PATCH 11/16] xen: arm: Add debug keyhandler to dump the physical GIC state Ian Campbell
2013-11-20 17:36 ` Julien Grall
2013-11-20 17:48 ` Ian Campbell
2013-11-20 19:17 ` Stefano Stabellini
2013-11-21 10:35 ` Ian Campbell
2013-11-20 14:48 ` [PATCH 12/16] xen: arm: improve early memory map readability Ian Campbell
2013-11-20 17:16 ` Julien Grall
2013-11-20 14:48 ` [PATCH 13/16] RFC: xen: arm: handle 40-bit addresses in the p2m Ian Campbell
2013-11-21 19:17 ` Stefano Stabellini
2013-11-22 9:49 ` Ian Campbell
2013-11-20 14:48 ` [PATCH 14/16] RFC: xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
2013-11-21 18:44 ` Stefano Stabellini
2013-11-20 14:48 ` [PATCH 15/16] HACK: xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000 Ian Campbell
2013-11-20 14:48 ` [PATCH 16/16] HACK: xen: arm: map PCI controller ranges region MMIOs to dom0 Ian Campbell
2013-11-21 14:32 ` Julien Grall
2013-11-21 14:57 ` Ian Campbell
2013-11-21 15:42 ` Julien Grall
2013-11-21 15:53 ` Ian Campbell
2013-11-21 15:05 ` [PATCH+RFC+HACK 00/16] xen: arm initial support for xgene arm64 platform George Dunlap
2013-11-21 15:27 ` Stefano Stabellini
2013-11-21 15:38 ` Ian Campbell
2013-11-21 17:14 ` George Dunlap
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=528CE781.8040104@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=anup.patel@linaro.org \
--cc=pranavkumar@linaro.org \
--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 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.