From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org, tsahee@gmx.com, tim@xen.org,
stefano.stabellini@citrix.com, patches@linaro.org
Subject: Re: [PATCH] xen/dts: Don't translate invalid address
Date: Mon, 06 Jan 2014 16:18:07 +0000 [thread overview]
Message-ID: <52CAD73F.6050006@linaro.org> (raw)
In-Reply-To: <1389021866.31766.51.camel@kazak.uk.xensource.com>
On 01/06/2014 03:24 PM, Ian Campbell wrote:
> On Fri, 2013-12-13 at 02:31 +0000, Julien Grall wrote:
>> ePAR specifies that if the property "ranges" doesn't exist in a bus node:
>>
>> "it is assumed that no mapping exists between children of node and the parent
>> address space".
>>
>> Modify dt_number_of_address to check if the list of ranges are valid. Return
>> 0 (ie there is zero range) if the list is not valid.
>>
>> This patch has been tested on the Arndale where the bug can occur with the
>> '/hdmi' node.
>>
>> Reported-by: <tsahee@gmx.com>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>
>> ---
>>
>> This patch is a bug fix for Xen 4.4. Without it, Xen can't boot on the Arndale
>> because it's unable to translate a wrong address.
>> ---
>> xen/common/device_tree.c | 31 +++++++++++++++++++++++++++----
>> 1 file changed, 27 insertions(+), 4 deletions(-)
>>
>> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
>> index 84e709d..9b9a348 100644
>> --- a/xen/common/device_tree.c
>> +++ b/xen/common/device_tree.c
>> @@ -93,7 +93,7 @@ struct dt_bus
>> {
>> const char *name;
>> const char *addresses;
>> - int (*match)(const struct dt_device_node *parent);
>> + bool_t (*match)(const struct dt_device_node *parent);
>> void (*count_cells)(const struct dt_device_node *child,
>> int *addrc, int *sizec);
>> u64 (*map)(__be32 *addr, const __be32 *range, int na, int ns, int pna);
>> @@ -793,6 +793,18 @@ int dt_n_size_cells(const struct dt_device_node *np)
>> /*
>> * Default translator (generic bus)
>> */
>> +static bool_t dt_bus_default_match(const struct dt_device_node *parent)
>> +{
>> + /* Root node doesn't have "ranges" property */
>> + if ( parent->parent == NULL )
>
> Calling the parameter "parent" led to me confusedly wondering why it was
> the grandparent which mattered. I suppose "parent" in this sense means
> the "parent bus" as opposed to parent node? Or does it just fall out of
> the fact that in the caller it is the parent which is passed through?
>
> Can we call it something else, like "bus" or "node" or something else
> appropriate?
Right, the name is confusing. It took me few minutes, even if I wrote
the code, to understand it :). I blindly copied the code from Linux
of_bus structure.
The best name would be "node", because the function is trying to find if
the parameters is a bus or not.
>> + return 1;
>> +
>> + /* The default bus is only used when the "ranges" property exists.
>> + * Otherwise we can't translate the address
>> + */
>> + return (dt_get_property(parent, "ranges", NULL) != NULL);
>> +}
>> +
>> static void dt_bus_default_count_cells(const struct dt_device_node *dev,
>> int *addrc, int *sizec)
>> {
>> @@ -819,7 +831,7 @@ static u64 dt_bus_default_map(__be32 *addr, const __be32 *range,
>> * If the number of address cells is larger than 2 we assume the
>> * mapping doesn't specify a physical address. Rather, the address
>> * specifies an identifier that must match exactly.
>> - */
>> + */
>
> Spurious w/s change.
>
> Other that those two changes the patch looks good.
I will fix it.
--
Julien Grall
prev parent reply other threads:[~2014-01-06 16:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 2:31 [PATCH] xen/dts: Don't translate invalid address Julien Grall
2014-01-05 21:19 ` Julien Grall
2014-01-06 15:24 ` Ian Campbell
2014-01-06 16:18 ` Julien Grall [this message]
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=52CAD73F.6050006@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=tsahee@gmx.com \
--cc=xen-devel@lists.xenproject.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.