From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org, tim@xen.org,
ian.jackson@eu.citrix.com, stefano.stabellini@citrix.com,
patches@linaro.org
Subject: Re: [PATCH] libxc/arm: align to page size the base address of the device tree
Date: Wed, 20 Nov 2013 16:16:51 +0000 [thread overview]
Message-ID: <528CE073.2040808@linaro.org> (raw)
In-Reply-To: <1384954226.6071.27.camel@kazak.uk.xensource.com>
On 11/20/2013 01:30 PM, Ian Campbell wrote:
> On Wed, 2013-11-20 at 13:17 +0000, Julien Grall wrote:
>>
>> On 11/20/2013 01:13 PM, Ian Campbell wrote:
>>> On Wed, 2013-11-20 at 13:04 +0000, Julien Grall wrote:
>>>>
>>>> On 11/20/2013 09:48 AM, Ian Campbell wrote:
>>>>> On Tue, 2013-11-19 at 18:52 +0000, Julien Grall wrote:
>>>>>> xc_dom_alloc_segment requires start address to be page align.
>>>>>
>>>>> I wonder why I didn't see this? It seems very unlikely that my dtb would
>>>>> be exactly page sized, yet it works... Ah, I have >128M of RAM in my
>>>>> guest so the base would be 128M. Well spotted.
>>>>>
>>>>> I think it would be slightly preferable to round dtbsize up to a page.
>>>>> e.g. the following. What do you think?
>>>>>
>>>>
>>>> Sounds good to me. I wrote my patch in the other way because I though
>>>> RAM size can be non-page aligned.
>>>
>>> That would be concern except the sizes are defined immediately above as
>>> shifts based on page numbers.
>>>
>>>>
>>>>> 8>------------------
>>>>>
>>>>> From 079a2815d86567de1cbb541541d08a0b9ac3d18d Mon Sep 17 00:00:00 2001
>>>>> From: Ian Campbell <ian.campbell@citrix.com>
>>>>> Date: Wed, 20 Nov 2013 09:45:32 +0000
>>>>> Subject: [PATCH] libxl: arm: ensure DTB is page aligned
>>>>>
>>>>> xc_dom_alloc_segment requires this. Since rambase and ramend are both page
>>>>> aligned, rounding up the DTB is sufficient.
>>>>>
>>>>> Reported-by: Julien Grall <julien.grall@linaro.org>
>>>>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>>>>> ---
>>>>> tools/libxc/xc_dom_arm.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
>>>>> index ffe575b..a40e04d 100644
>>>>> --- a/tools/libxc/xc_dom_arm.c
>>>>> +++ b/tools/libxc/xc_dom_arm.c
>>>>> @@ -282,7 +282,7 @@ int arch_setup_meminit(struct xc_dom_image *dom)
>>>>> {
>>>>> const uint64_t rambase = dom->rambase_pfn << XC_PAGE_SHIFT;
>>>>> const uint64_t ramend = rambase + ( dom->total_pages << XC_PAGE_SHIFT );
>>>>> - const uint64_t dtbsize = ( dom->devicetree_size + 3 ) & ~0x3;
>>>>> + const uint64_t dtbsize = ROUNDUP(dom->devicetree_size, XC_PAGE_SHIFT);
>>>>
>>>> XC_PAGE_SHIFT only contains the shift. You should use XC_PAGE_SIZE.
>>>
>>> That's not how ROUNDUP is defined in libxc:
>>> #define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
>>>
>>> so it expects _w (width?) to be the shift.
>>
>> Oh right, I though it was defined as in xen. In any case, I think you
>> should use XC_DOM_PAGE_SHIFT(dom).
>
> Those macros are almost unused in libxc. I suspect they are leftovers
> from ia64 support, that being the only platform which we've supported
> which had the possibility of non-4k pages.
Sorry, I have only checked xc_dom_core.c
For your patch:
Acked-by: Julien Grall <julien.grall@linaro.org>
--
Julien Grall
next prev parent reply other threads:[~2013-11-20 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 18:52 [PATCH] libxc/arm: align to page size the base address of the device tree Julien Grall
2013-11-20 9:48 ` Ian Campbell
2013-11-20 13:04 ` Julien Grall
2013-11-20 13:13 ` Ian Campbell
2013-11-20 13:17 ` Julien Grall
2013-11-20 13:30 ` Ian Campbell
2013-11-20 16:16 ` Julien Grall [this message]
2013-11-21 11:10 ` Ian Campbell
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=528CE073.2040808@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).