From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org, sodaville@linutronix.de,
x86@kernel.org, devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH 02/11] x86: Add device tree support
Date: Sun, 28 Nov 2010 14:49:07 +0100 [thread overview]
Message-ID: <20101128134907.GA30784@www.tglx.de> (raw)
In-Reply-To: <1290807736.32570.143.camel@pasglop>
* Benjamin Herrenschmidt | 2010-11-27 08:42:16 [+1100]:
>On Thu, 2010-11-25 at 18:39 +0100, Sebastian Andrzej Siewior wrote:
>> This patch adds minimal support for device tree support on x86. It will
>> be passed to the kernel via setup_data which requires atleast boot
>> protocol 2.09.
>> Memory size, restricted memory regions, boot arguments are gathered the
>> traditional way so things like cmd_line are just here to let the code
>> compile.
>> The current plan is use the device tree as an extension and to gather
>> informations from it which can not be enumerated and have to be
>> hardcoded otherwise. This includes things like
>> - which devices are on this I2C/ SPI bus?
>> - how are the interrupts wired to IO APIC?
>> - where could my hpet be?
>
>How do that work with platforms like OLPC that have a real OF ?
OLPC's openfirmware is embedded into the bootpage where ofw_magic is set
to OLPC_OFW_SIG (0x2057464F). I don't touch this, the device tree is
passed via setup_data. So you could use both at the same time.
>One thing we did on powerpc which among other things allow kexec to work
>on such platforms when we kill OF at boot (it might stay alive on OLPC),
>is to basically detect very early in asm that we are coming from OF,
>have a trampoline that extract the DT and turns it into a flat dtb, then
>continue to the main kernel entry using the dtb method.
>
>That way, one can kexec using the dtb method over and there's one single
>entry point for device-tree use.
>
>Are you doing something similar for x86 ?
Similar. We get most critical parameters from the so called bootpage
(the traditional x86 way) which also contains a pointer to the device
tree (we don't have open firmware or something else where we call back).
We plan to relocate the device tree (before it is unflattered) so the
bootloader does not need to know about the memory layout the kernel is
having.
On kexec, the bootpage is built from scratch AFAIK. So the kexec loader
needs to suck the dtb from /proc and can add it to the bootpage.
>> Dirk is working on some patches which provide generic infrastructure for
>> linking the dtb into the kernel. Once this is it its final shape, we
>> will relocate the device tree unconditionally. This will remove the
>> requirement for the boot loader to locate the device tree within lowmem.
>
>Linking the dtb into the kernel is something we prefer not doing on
>powerpc and I'm curious why you think that applies better on x86...
This is only for the case where we do not get a dtb from the bootloader
Microblaze also links dtb into the kernel in that case.
>We -do- have ways to include it in the zImage wrapper. However, this is
>different in subtle ways because of the way our zImage wrapper building
>works. Basically, we always build all the per-platform .o's of the
>wrapper that apply to supported platforms by the kernel. The
>binding/linking together of the final wrapper with a kernel image, an
>optional dtb and optional initrd is performed by a shell script that can
>be used outside of the normal build context.
The reason why you have multiple .o wrapper files is because the specific
platform code is not simply passing the device tree but also adding /
updating nodes like MAC address, bus clocks, ... which are coming from
the (different) bd_t struct or something else. The simpleboot target is
covering the case where you just pass the embedded dtb to kernel without
changing it.
On x86 we want to have the bootloader passing us the final dtb. The
in-kernel dtb is more like a generic simpleboot target.
>That means that it's possible for a distro for example to install a
>kernel image, all the wrapper .o files and that script, and at runtime
>rebuild zImage wrappers with the appropriate dtb without having the
>whole built kernel tree at hand.
For the distro reason the in-kernel dtb supports multiple dtbs. So a
distro kernel can include all of them into .init.data section and the
user can specify on the command line which device tree he wants. x86 gets
its command line via the bootpage so it is available before we have a
device tree. Microblaze should also be able to use this mechanism.
>The direction taken by ARM (and possibly newer powerpc platforms as
>well) is to have the dtb be passed by the bootloader. Typically
>bootloaders like uboot provide a way to flash the dtb separately so it
>can be udpated (*).
Yes, we want this as well. But what about the old ARMs where the
bootloader did not have dtb support? What about minimal bootloader which
just initialize the CPU and memory and jump then into the kernel? So the
in-kernel dtb is a simple way to solve this. However I don't know what
to do about updating the MAC address where it is not yet set.
>(*) That brings a separate topic we shall discuss: A consistent way for
>versionning the device-tree would be really useful.
This isn't a problem unless you move nodes or deprecate them, right? Or
do you think about another reason to versionning the device-tree?.
>
>Cheers,
>Ben.
Sebastian
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Benjamin Herrenschmidt
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
Sebastian Andrzej Siewior
<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 02/11] x86: Add device tree support
Date: Sun, 28 Nov 2010 14:49:07 +0100 [thread overview]
Message-ID: <20101128134907.GA30784@www.tglx.de> (raw)
In-Reply-To: <1290807736.32570.143.camel@pasglop>
* Benjamin Herrenschmidt | 2010-11-27 08:42:16 [+1100]:
>On Thu, 2010-11-25 at 18:39 +0100, Sebastian Andrzej Siewior wrote:
>> This patch adds minimal support for device tree support on x86. It will
>> be passed to the kernel via setup_data which requires atleast boot
>> protocol 2.09.
>> Memory size, restricted memory regions, boot arguments are gathered the
>> traditional way so things like cmd_line are just here to let the code
>> compile.
>> The current plan is use the device tree as an extension and to gather
>> informations from it which can not be enumerated and have to be
>> hardcoded otherwise. This includes things like
>> - which devices are on this I2C/ SPI bus?
>> - how are the interrupts wired to IO APIC?
>> - where could my hpet be?
>
>How do that work with platforms like OLPC that have a real OF ?
OLPC's openfirmware is embedded into the bootpage where ofw_magic is set
to OLPC_OFW_SIG (0x2057464F). I don't touch this, the device tree is
passed via setup_data. So you could use both at the same time.
>One thing we did on powerpc which among other things allow kexec to work
>on such platforms when we kill OF at boot (it might stay alive on OLPC),
>is to basically detect very early in asm that we are coming from OF,
>have a trampoline that extract the DT and turns it into a flat dtb, then
>continue to the main kernel entry using the dtb method.
>
>That way, one can kexec using the dtb method over and there's one single
>entry point for device-tree use.
>
>Are you doing something similar for x86 ?
Similar. We get most critical parameters from the so called bootpage
(the traditional x86 way) which also contains a pointer to the device
tree (we don't have open firmware or something else where we call back).
We plan to relocate the device tree (before it is unflattered) so the
bootloader does not need to know about the memory layout the kernel is
having.
On kexec, the bootpage is built from scratch AFAIK. So the kexec loader
needs to suck the dtb from /proc and can add it to the bootpage.
>> Dirk is working on some patches which provide generic infrastructure for
>> linking the dtb into the kernel. Once this is it its final shape, we
>> will relocate the device tree unconditionally. This will remove the
>> requirement for the boot loader to locate the device tree within lowmem.
>
>Linking the dtb into the kernel is something we prefer not doing on
>powerpc and I'm curious why you think that applies better on x86...
This is only for the case where we do not get a dtb from the bootloader
Microblaze also links dtb into the kernel in that case.
>We -do- have ways to include it in the zImage wrapper. However, this is
>different in subtle ways because of the way our zImage wrapper building
>works. Basically, we always build all the per-platform .o's of the
>wrapper that apply to supported platforms by the kernel. The
>binding/linking together of the final wrapper with a kernel image, an
>optional dtb and optional initrd is performed by a shell script that can
>be used outside of the normal build context.
The reason why you have multiple .o wrapper files is because the specific
platform code is not simply passing the device tree but also adding /
updating nodes like MAC address, bus clocks, ... which are coming from
the (different) bd_t struct or something else. The simpleboot target is
covering the case where you just pass the embedded dtb to kernel without
changing it.
On x86 we want to have the bootloader passing us the final dtb. The
in-kernel dtb is more like a generic simpleboot target.
>That means that it's possible for a distro for example to install a
>kernel image, all the wrapper .o files and that script, and at runtime
>rebuild zImage wrappers with the appropriate dtb without having the
>whole built kernel tree at hand.
For the distro reason the in-kernel dtb supports multiple dtbs. So a
distro kernel can include all of them into .init.data section and the
user can specify on the command line which device tree he wants. x86 gets
its command line via the bootpage so it is available before we have a
device tree. Microblaze should also be able to use this mechanism.
>The direction taken by ARM (and possibly newer powerpc platforms as
>well) is to have the dtb be passed by the bootloader. Typically
>bootloaders like uboot provide a way to flash the dtb separately so it
>can be udpated (*).
Yes, we want this as well. But what about the old ARMs where the
bootloader did not have dtb support? What about minimal bootloader which
just initialize the CPU and memory and jump then into the kernel? So the
in-kernel dtb is a simple way to solve this. However I don't know what
to do about updating the MAC address where it is not yet set.
>(*) That brings a separate topic we shall discuss: A consistent way for
>versionning the device-tree would be really useful.
This isn't a problem unless you move nodes or deprecate them, right? Or
do you think about another reason to versionning the device-tree?.
>
>Cheers,
>Ben.
Sebastian
next prev parent reply other threads:[~2010-11-28 13:49 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-25 17:39 Add device tree support for x86 Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 01/11] x86/kernel: remove conditional early remap in parse_e820_ext Sebastian Andrzej Siewior
2010-12-08 8:38 ` [sodaville] " Sebastian Andrzej Siewior
2010-12-08 14:15 ` Thomas Gleixner
2010-12-15 23:28 ` H. Peter Anvin
2010-12-16 9:55 ` Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 02/11] x86: Add device tree support Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 22:53 ` Sam Ravnborg
2010-11-25 22:53 ` Sam Ravnborg
2010-11-26 9:06 ` Sebastian Andrzej Siewior
2010-11-26 9:06 ` Sebastian Andrzej Siewior
2010-11-26 21:42 ` Benjamin Herrenschmidt
2010-11-26 21:42 ` Benjamin Herrenschmidt
2010-11-28 13:49 ` Sebastian Andrzej Siewior [this message]
2010-11-28 13:49 ` Sebastian Andrzej Siewior
2010-11-28 22:28 ` Benjamin Herrenschmidt
2010-11-28 22:28 ` Benjamin Herrenschmidt
2010-12-30 8:26 ` Grant Likely
2010-12-30 8:26 ` Grant Likely
2010-12-30 8:45 ` Rob Landley
2010-12-30 20:58 ` Grant Likely
2010-12-30 20:58 ` Grant Likely
2011-01-03 16:05 ` [sodaville] " H. Peter Anvin
2011-01-03 16:19 ` H. Peter Anvin
2011-01-03 17:52 ` Grant Likely
2011-01-03 17:52 ` Grant Likely
2011-01-03 18:06 ` H. Peter Anvin
2011-01-03 18:10 ` H. Peter Anvin
2011-01-03 18:10 ` H. Peter Anvin
2010-12-30 20:57 ` Grant Likely
2010-12-30 20:57 ` Grant Likely
2010-12-31 0:51 ` [sodaville] " H. Peter Anvin
2010-12-31 0:51 ` H. Peter Anvin
2010-11-25 17:39 ` [PATCH 03/11] x86/dtb: Add a device tree for CE4100 Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-26 21:57 ` Benjamin Herrenschmidt
2010-11-26 21:57 ` Benjamin Herrenschmidt
2010-11-28 16:04 ` Sebastian Andrzej Siewior
2010-11-28 16:04 ` Sebastian Andrzej Siewior
2010-11-28 22:53 ` Benjamin Herrenschmidt
2010-11-28 22:53 ` Benjamin Herrenschmidt
2010-11-29 1:34 ` Mitch Bradley
2010-11-29 18:26 ` [sodaville] " H. Peter Anvin
2010-11-29 20:03 ` Benjamin Herrenschmidt
2010-11-29 19:44 ` Sebastian Andrzej Siewior
2010-11-29 19:44 ` Sebastian Andrzej Siewior
2010-12-02 0:40 ` David Gibson
2010-12-02 0:40 ` David Gibson
2010-11-29 19:07 ` Scott Wood
2010-11-29 19:07 ` Scott Wood
2010-11-29 20:05 ` Benjamin Herrenschmidt
2010-11-29 20:32 ` Mitch Bradley
2010-11-29 20:44 ` Benjamin Herrenschmidt
2010-11-29 20:44 ` Benjamin Herrenschmidt
2010-11-29 21:32 ` Mitch Bradley
2010-11-29 21:32 ` Mitch Bradley
2010-11-29 23:47 ` Alan Cox
2010-11-30 2:50 ` Benjamin Herrenschmidt
2010-11-30 2:50 ` Benjamin Herrenschmidt
2010-11-30 11:20 ` Sebastian Andrzej Siewior
2010-11-30 11:20 ` Sebastian Andrzej Siewior
2010-11-29 23:42 ` Alan Cox
2010-11-30 21:18 ` [sodaville] " H. Peter Anvin
2010-11-30 11:51 ` Sebastian Andrzej Siewior
2010-11-30 11:51 ` Sebastian Andrzej Siewior
2010-11-30 20:31 ` Benjamin Herrenschmidt
2010-11-30 20:31 ` Benjamin Herrenschmidt
2010-11-29 23:58 ` David Gibson
2010-11-29 23:58 ` David Gibson
2010-11-29 19:36 ` [sodaville] " Sebastian Andrzej Siewior
2010-11-29 20:14 ` Benjamin Herrenschmidt
2010-11-29 2:22 ` David Gibson
2010-11-29 2:22 ` David Gibson
2010-11-25 17:39 ` [PATCH 04/11] x86/dtb: add irq host abstraction Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 19:30 ` Jon Loeliger
2010-11-26 14:19 ` Sebastian Andrzej Siewior
2010-11-26 14:19 ` Sebastian Andrzej Siewior
2010-11-26 21:36 ` Benjamin Herrenschmidt
2010-11-26 21:36 ` Benjamin Herrenschmidt
2010-12-01 10:31 ` [sodaville] " Sebastian Andrzej Siewior
2010-12-01 10:31 ` Sebastian Andrzej Siewior
2010-11-27 3:11 ` Jon Loeliger
2010-11-27 3:11 ` Jon Loeliger
2010-11-25 17:39 ` [PATCH 05/11] x86/dtb: add early parsing of APIC and IO APIC Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 06/11] x86/dtb: add support hpet Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 07/11] x86/dtb: add support for PCI devices backed by dtb nodes Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-27 22:33 ` Benjamin Herrenschmidt
2010-11-27 22:33 ` Benjamin Herrenschmidt
2010-11-28 14:04 ` Sebastian Andrzej Siewior
2010-11-28 14:04 ` Sebastian Andrzej Siewior
2010-11-28 22:32 ` Benjamin Herrenschmidt
2010-11-28 22:32 ` Benjamin Herrenschmidt
2010-12-02 16:17 ` Sebastian Andrzej Siewior
2010-12-02 16:17 ` Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 08/11] x86/dtb: Add generic bus probe Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 17:39 ` [PATCH 09/11] x86/ioapic: Add OF bindings for IO-APIC Sebastian Andrzej Siewior
2010-11-25 17:39 ` Sebastian Andrzej Siewior
2010-11-25 17:40 ` [PATCH 10/11] x86/io_apic: add simply id set Sebastian Andrzej Siewior
2010-11-25 21:04 ` Yinghai Lu
2010-11-26 11:03 ` Sebastian Andrzej Siewior
2010-11-26 16:50 ` [PATCH] x86/io_apic: split setup_ioapic_ids_from_mpc() into a non-checkign version Sebastian Andrzej Siewior
2010-12-06 13:33 ` [tip:x86/apic] x86: io_apic: Split setup_ioapic_ids_from_mpc() tip-bot for Sebastian Andrzej Siewior
2010-12-07 8:59 ` [PATCH -v2] x86, ioapic: Don't write io_apic ID if it is not changed Yinghai Lu
2010-12-09 20:56 ` [tip:x86/apic-cleanups] x86, ioapic: Avoid writing io_apic id if already correct tip-bot for Yinghai Lu
2010-11-25 17:40 ` [PATCH 11/11] x86/ce4100: use OF for ioapic Sebastian Andrzej Siewior
-- strict thread matches above, loose matches on Subject: below --
2011-02-22 20:07 Device tree on x86, part v4 Sebastian Andrzej Siewior
2011-02-22 20:07 ` [PATCH 02/11] x86: Add device tree support Sebastian Andrzej Siewior
2011-02-22 20:07 ` Sebastian Andrzej Siewior
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=20101128134907.GA30784@www.tglx.de \
--to=bigeasy@linutronix.de \
--cc=benh@kernel.crashing.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sodaville@linutronix.de \
--cc=x86@kernel.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.