[U-Boot] MIPS UHI spec

Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
This is also the spec I would like to use to implement a syscall interface. Previous post on the topic:
http://lists.denx.de/pipermail/u-boot/2014-December/198007.html
Only a subset of the operations would be implemented for u-boot and would be strictly limited to sit on top of the functionality that is already exposed to standalone applications with GPL exceptions. Some of the operations need a bit of wrapper code around the API functions i.e. The write operation would only be handled for FD 1 and 2 and would be implemented as a loop sending each byte of the buffer via putc.
UHI also provides a semi-hosting solution for u-boot itself which it could use to obtain files over the EJTAG interface.
Initial implementation of the syscall interface will be posted relatively soon.
Thanks, Matthew

On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
Thanks, Paul

2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
U-Boot mainline code is almost ready for DT handover. I have prepared a patch [1] which completes it by implementing my proposal.
[1] http://git.denx.de/?p=u-boot/u-boot-mips.git;a=commitdiff;h=3464e8de491c640d...

Hi,
On Thu, Feb 26, 2015 at 4:37 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
+1. I would like to see this happen as well.
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
U-Boot mainline code is almost ready for DT handover. I have prepared a patch [1] which completes it by implementing my proposal.
Hmm... we decided to follow the ARM convention here ($a0 = 0, $a1 = -1, $a2 = physical address of DTB), which is also what the BMIPS platform (submitted by Kevin) is using for DT handover. Is there already a platform using the protocol you described? It's still early enough that we could change the DT handover for Pistachio, but it would be good to agree on something soon.
Thanks, Andrew

2015-02-26 19:23 GMT+01:00 Andrew Bresticker abrestic@chromium.org:
Hi,
On Thu, Feb 26, 2015 at 4:37 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
+1. I would like to see this happen as well.
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
U-Boot mainline code is almost ready for DT handover. I have prepared a patch [1] which completes it by implementing my proposal.
Hmm... we decided to follow the ARM convention here ($a0 = 0, $a1 = -1, $a2 = physical address of DTB), which is also what the BMIPS platform (submitted by Kevin) is using for DT handover. Is there already a platform using the protocol you described?
no, but with its publication the MIPS UHI spec is kind of official. AFAIK patches to support UHI in gcc, gdb, U-Boot etc. are already submitted or prepared. Matthew suggested that new boot protocols should be compliant with UHI. I think the ARM convention does not fit to UHI.
It's still early enough that we could change the DT handover for Pistachio, but it would be good to agree on something soon.
Thanks, Andrew

On Fri, Feb 27, 2015 at 2:44 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 19:23 GMT+01:00 Andrew Bresticker abrestic@chromium.org:
Hi,
On Thu, Feb 26, 2015 at 4:37 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
+1. I would like to see this happen as well.
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
U-Boot mainline code is almost ready for DT handover. I have prepared a patch [1] which completes it by implementing my proposal.
Hmm... we decided to follow the ARM convention here ($a0 = 0, $a1 = -1, $a2 = physical address of DTB), which is also what the BMIPS platform (submitted by Kevin) is using for DT handover. Is there already a platform using the protocol you described?
no, but with its publication the MIPS UHI spec is kind of official. AFAIK patches to support UHI in gcc, gdb, U-Boot etc. are already submitted or prepared. Matthew suggested that new boot protocols should be compliant with UHI. I think the ARM convention does not fit to UHI.
Ok, I think we can change the boot protocol on Pistachio to match UHI then.
-Andrew

Hi Daniel,
On Thu, Feb 26, 2015 at 4:37 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
Just to be clear, is $a1 expected to be the physical or virtual (KSEG0) address of the DTB?
Thanks, Andrew

Am 09.03.2015 um 18:04 schrieb Andrew Bresticker:
Hi Daniel,
On Thu, Feb 26, 2015 at 4:37 AM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
Just to be clear, is $a1 expected to be the physical or virtual (KSEG0) address of the DTB?
U-Boot currently uses KSEG0 addresses for kernel entry and initramfs. Therefore the DTB address would be also KSEG0. But I'm not sure if it is correct for MIPS64. Shouldn't the kernel sanitize the DTB address anyway like it's done with initramfs? Maybe Matthew or others could comment.

On 26/02/15 12:37, Daniel Schwierzeck wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
I was just looking at Andrew's patch: http://patchwork.linux-mips.org/patch/9549/
How would the other registers (i.e. $a2 and $a3) be defined for this boot interface? I'm guessing any future extensions are envisioned to use a different negative value of $a0, in which case treating them as unused/undefined is fine, but perhaps that should be spelt out in the UHI spec?
Cheers James
U-Boot mainline code is almost ready for DT handover. I have prepared a patch [1] which completes it by implementing my proposal.
[1] http://git.denx.de/?p=u-boot/u-boot-mips.git;a=commitdiff;h=3464e8de491c640d...

James Hogan James.Hogan@imgtec.com writes:
On 26/02/15 12:37, Daniel Schwierzeck wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
I was just looking at Andrew's patch: http://patchwork.linux-mips.org/patch/9549/
How would the other registers (i.e. $a2 and $a3) be defined for this boot interface? I'm guessing any future extensions are envisioned to use a different negative value of $a0, in which case treating them as unused/undefined is fine, but perhaps that should be spelt out in the UHI spec?
Sounds sensible. Making it explicit may help prevent anyone extending this and presuming that they can give meaning to one of the unused registers.
Did anyone come to a conclusion on physical vs virtual address for the DTB? I forgot to reply to the thread, I would have thought the KSEG0 address would be the obvious choice so that it is immediately usable from ordinary memory accesses. However, that is only because I don't follow how the kernel would benefit from being given a physical address. It can't be remapped except for the case of segmentation control (I believe) so there seems little risk in using KSEG0.
Thanks, Matthew

On 16/03/15 11:53, Matthew Fortune wrote:
James Hogan James.Hogan@imgtec.com writes:
On 26/02/15 12:37, Daniel Schwierzeck wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
I was just looking at Andrew's patch: http://patchwork.linux-mips.org/patch/9549/
How would the other registers (i.e. $a2 and $a3) be defined for this boot interface? I'm guessing any future extensions are envisioned to use a different negative value of $a0, in which case treating them as unused/undefined is fine, but perhaps that should be spelt out in the UHI spec?
Sounds sensible. Making it explicit may help prevent anyone extending this and presuming that they can give meaning to one of the unused registers.
Did anyone come to a conclusion on physical vs virtual address for the DTB? I forgot to reply to the thread, I would have thought the KSEG0 address would be the obvious choice so that it is immediately usable from ordinary memory accesses. However, that is only because I don't follow how the kernel would benefit from being given a physical address. It can't be remapped except for the case of segmentation control (I believe) so there seems little risk in using KSEG0.
The only obvious cases of physical addresses being passed into MIPS Linux I can find by grepping for fw_arg[0123] are: bcm3384: for DT boot, expects physical address of dtb in arg2 fw/sni and lantiq: expect physical arg pointer in arg1.
Physical addresses are probably of more use for arches where only virtual addresses can be accessed after the MMU is turned on, and Linux is started with the MMU turned off.
I suppose the problems with using virtual addresses for MIPS would be: * limits it to low 256MB of RAM usually accessible in kseg0 and kseg1 * as you say, slightly less resistant to segmentation changes
I don't think either of those are really significant problems, though I can see the appeal of physical addresses for this sort of interface. If however the rest of the UHI boot APIs deal with directly usable pointers, then maybe its best to stick with that pattern for consistency.
Cheers James

On Mon, Mar 16, 2015 at 4:53 AM, Matthew Fortune Matthew.Fortune@imgtec.com wrote:
James Hogan James.Hogan@imgtec.com writes:
On 26/02/15 12:37, Daniel Schwierzeck wrote:
2015-02-26 11:17 GMT+01:00 Paul Burton paul.burton@imgtec.com:
On Thu, Feb 19, 2015 at 01:50:23PM +0000, Matthew Fortune wrote:
Hi Daniel,
The spec for MIPS Unified Hosting Interface is available here:
http://prplfoundation.org/wiki/MIPS_documentation
As we have previously discussed, this is an ideal place to define the handover of device tree data from bootloader to kernel. Using a0 == -2 and defining which register(s) you need for the actual data will fit nicely. I'll happily include whatever is decided into the next version of the spec.
this originates from an off-list discussion some months ago started by John Crispin.
(CC +John, Ralf, Jonas, linux-mips)
(CC +Andrew, Ezequiel, James, James)
On the talk of DT handover, this recent patchset adding support for a system doing so to Linux is relevant:
http://www.linux-mips.org/archives/linux-mips/2015-02/msg00312.html
I'm also working on a system for which I'll need to implement DT handover very soon. It would be very nice if we could agree on some standard way of doing so (and eventually if the code on the Linux side can be generic enough to allow a multiplatform kernel).
to be conformant with UHI I propose $a0 == -2 and $a1 == address of DT blob. It is a simple extension and should not interfere with the various legacy boot interfaces.
I was just looking at Andrew's patch: http://patchwork.linux-mips.org/patch/9549/
How would the other registers (i.e. $a2 and $a3) be defined for this boot interface? I'm guessing any future extensions are envisioned to use a different negative value of $a0, in which case treating them as unused/undefined is fine, but perhaps that should be spelt out in the UHI spec?
Sounds sensible. Making it explicit may help prevent anyone extending this and presuming that they can give meaning to one of the unused registers.
Did anyone come to a conclusion on physical vs virtual address for the DTB? I forgot to reply to the thread, I would have thought the KSEG0 address would be the obvious choice so that it is immediately usable from ordinary memory accesses. However, that is only because I don't follow how the kernel would benefit from being given a physical address. It can't be remapped except for the case of segmentation control (I believe) so there seems little risk in using KSEG0.
We've changed our bootloader to pass the DTB via KSEG0. V2 of the Pistachio platform patches I posted last week used this protocol.
Thanks, Andrew
participants (5)
-
Andrew Bresticker
-
Daniel Schwierzeck
-
James Hogan
-
Matthew Fortune
-
Paul Burton