xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Andre Przywara <andre.przywara@linaro.org>
Cc: julien.grall@linaro.org, stefano.stabellini@eu.citrix.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v2] ARM/multiboot: use more flexible node naming
Date: Tue, 17 Sep 2013 23:12:05 +0100	[thread overview]
Message-ID: <1379455925.11304.221.camel@hastur.hellion.org.uk> (raw)
In-Reply-To: <5238C5A7.1090403@linaro.org>

On Tue, 2013-09-17 at 23:12 +0200, Andre Przywara wrote:
> On 09/17/2013 04:53 PM, Ian Campbell wrote:
> > On Wed, 2013-09-11 at 16:06 +0200, Andre Przywara wrote:
> >> For the current "multiboot" on ARM support we look for a compatible
> >> string of "xen,multiboot-module" in the device tree, and then
> >> use "xen,linux-zimage" and "xen,linux-initrd" to differentiate
> >> between the two supported module types.
> >> To meet the more generic multiboot proposal in the device tree [1],
> >> allow Xen to be more flexible in the compatible naming and also use
> >> the new generic base name "boot,module".
> >> The mapping to either Dom0 kernel or RAM disk works by providing a
> >> more specific name ("xen,dom0-kernel" and "xen,ramdisk", preferably).
> >> For compatibility reasons the older names above are still recognized.
> >>
> >> Changes from v1:
> >> * whitespace / coding style fixes (sorry for that mess!)
> >> * removed module enumeration by using module@address
> >>    (this violates the EPAPR device tree spec).
> >> * added __initconst to names array
> >>
> >> [1] http://lists.xen.org/archives/html/xen-devel/2013-09/msg00083.html
> >>
> >> Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
> >> ---
> >>   xen/common/device_tree.c | 44 +++++++++++++++++++++++++++++++++++++-------
> >>   1 file changed, 37 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> >> index eed77ce..3ae593f 100644
> >> --- a/xen/common/device_tree.c
> >> +++ b/xen/common/device_tree.c
> >> @@ -433,22 +433,50 @@ static void __init process_cpu_node(const void *fdt, int node,
> >>       cpumask_set_cpu(start, &cpu_possible_map);
> >>   }
> >>
> >> +static const char * const __initconst kernel_module_names[] = {
> >> +    "xen,linux-zimage",
> >> +    "xen,dom0-kernel",
> >> +    "boot,kernel",
> >
> > I'm wondering about this..
> >
> > The current "xen,linux-zimage" node does more than simply identifying
> > the location in memory of the kernel, it actually tells us that the boot
> > protocol used by that kernel is the Linux zImage protocol.
> >
> > For "xen,dom0-kernel" and "boot,kernel" we don't get that -- so how do
> > we know how the kernel in question wants to be called?
> 
> Good point. Yes, we could fix this by looking for magics (ARM zImage has 
> one at 0x24, along with start and end address).

Yes, we already do that thankfully.

> Hopefully BSD has something similar or we have to use it the lack of a 
> magic to detect those kernels.

I'm not sure, they may just be normal ELF kernels?

> How do we solve this on x86? Is that because the Dom0 kernel is PV there 
> that we know how to boot this?

Essentially yes. dom0 and domU kernels are an ELF file with a set of Xen
specific notes which tell us things like the virtual base address etc so
we can build the initial PTs etc

The x86 bzImage is actually just a wrapper around that (compressed) ELF
file, so we have some code which knows about that and can extract the
ELF.

The x86 kernels havea separate Xen entry point which we enter in 32-bit
mode so there's no need for real mode etc.

>  After all Xen just sees a multiboot 
> module, which is actually nothing more like a binary blob in that protocol.
> Actually I modeled this along the x86 scheme: Multiboot provides no 
> further information about the image other than an order (first is 
> kernel, second is initrd). So as this order thing does not work in DT, I 
> wanted to use compatible strings to at least determine the type of binary.

Makes sense.

> > I guess there is a magic number in the kernel itself, so maybe this is
> > OK? Any futyre kernel (I'm thinking *BSD here...) would either need to
> > be identifiable by magic number or use only a specific compatible value
> > which indicates this...
> 
> Right, my idea was just to do that: use specific compatible values 
> whenever possible or hope for support in Xen to detect the right way of 
> booting. So the early mapping code could just live with boot,dom0-kernel 
> or even boot,module without knowing anything about a specific boot 
> protocol at all. Later on when we actually launch the kernel, we use 
> more specific values to pick the right protocol.

Right, that makes sense.

> Kind of moot discussion probably until we actually have a "second" 
> kernel for real.

True. I think I've convinced myself we aren't painting ourselves into a
corner...

> > Should we mark this as deprecated in the docs?
> >
> > Speaking of which, this patch doesn't seem to ouch the docs tree ;-)
> 
> Actually I thought people would slap me earlier for that ;-)

I must have been napping ;-)

> I wanted to wait until we settle with this general device tree booting 
> proposal thing before writing the docs. But on the other hand this is 
> just an excuse, so I will respin the patch...

Thanks!
Ian.

> 
> Regards,
> Andre.
> 
> >
> > I know the doc should live somewhere else, but lets try and keep it up
> > to date until we move it...
> >
> >>           process_multiboot_node(fdt, node, name, address_cells, size_cells);
> >> +    else if ( device_tree_node_compatible(fdt, node, "boot,module" ) )
> >> +        process_multiboot_node(fdt, node, name, address_cells, size_cells);
> >>
> >>       return 0;
> >>   }
> >
> >
> 

  reply	other threads:[~2013-09-17 22:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 14:06 [PATCH v2] ARM/multiboot: use more flexible node naming Andre Przywara
2013-09-17 14:53 ` Ian Campbell
2013-09-17 15:06   ` Julien Grall
2013-09-17 15:09     ` Ian Campbell
2013-09-17 21:12   ` Andre Przywara
2013-09-17 22:12     ` Ian Campbell [this message]
2013-09-18  9:36       ` Egger, Christoph

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=1379455925.11304.221.camel@hastur.hellion.org.uk \
    --to=ian.campbell@citrix.com \
    --cc=andre.przywara@linaro.org \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --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 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).