From: Sunil V L <sunilvl@ventanamicro.com>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: "Jonathan Corbet" <corbet@lwn.net>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, "Björn Töpel" <bjorn@rivosinc.com>,
"Atish Kumar Patra" <atishp@rivosinc.com>
Subject: Re: [PATCH 1/2] Documentation: riscv: Add early boot document
Date: Tue, 20 Jun 2023 12:48:44 +0530 [thread overview]
Message-ID: <ZJFS1K/LltE57MJ4@sunil-laptop> (raw)
In-Reply-To: <CAHVXubjOUeEtnFnERjT2YOG+h5=2YX7kxeEBFSStO3WZvcv36A@mail.gmail.com>
Hey Alex,
Many thanks for writing this up!
On Mon, Jun 19, 2023 at 11:49:13AM +0200, Alexandre Ghiti wrote:
> @Sunil V L Something about ACPI is more than welcome :)
>
> And thanks to @Björn Töpel and @Atish Kumar Patra for helping in
> writing this document!
>
> On Mon, Jun 19, 2023 at 11:47 AM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
> >
> > This document describes the constraints and requirements of the early
> > boot process in a RISC-V kernel.
> >
> > Szigned-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> > ---
> > Documentation/riscv/boot-image-header.rst | 3 -
> > Documentation/riscv/boot.rst | 181 ++++++++++++++++++++++
> > Documentation/riscv/index.rst | 1 +
> > 3 files changed, 182 insertions(+), 3 deletions(-)
> > create mode 100644 Documentation/riscv/boot.rst
> >
> > diff --git a/Documentation/riscv/boot-image-header.rst b/Documentation/riscv/boot-image-header.rst
> > index d7752533865f..a4a45310c4c4 100644
> > --- a/Documentation/riscv/boot-image-header.rst
> > +++ b/Documentation/riscv/boot-image-header.rst
> > @@ -7,9 +7,6 @@ Boot image header in RISC-V Linux
> >
> > This document only describes the boot image header details for RISC-V Linux.
> >
> > -TODO:
> > - Write a complete booting guide.
> > -
> > The following 64-byte header is present in decompressed Linux kernel image::
> >
> > u32 code0; /* Executable code */
> > diff --git a/Documentation/riscv/boot.rst b/Documentation/riscv/boot.rst
> > new file mode 100644
> > index 000000000000..b02230818b79
> > --- /dev/null
> > +++ b/Documentation/riscv/boot.rst
> > @@ -0,0 +1,181 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +=============================================
> > +Early boot requirements/constraints on RISC-V
> > +=============================================
> > +
> > +:Author: Alexandre Ghiti <alexghiti@rivosinc.com>
> > +:Date: 23 May 2023
> > +
> > +This document describes what the RISC-V kernel expects from the previous stages
> > +and the firmware, but also the constraints that any developer must have in mind
> > +when touching the early boot process, e.g. before the final virtual mapping is
> > +setup.
> > +
> > +Pre-kernel boot (Expectations from firmware)
> > +============================================
> > +
> > +Registers state
> > +---------------
> > +
> > +The RISC-V kernel expects:
> > +
> > + * `$a0` to contain the hartid of the current core.
> > + * `$a1` to contain the address of the device tree in memory.
> > +
> > +CSR state
> > +---------
> > +
> > +The RISC-V kernel expects:
> > +
> > + * `$satp = 0`: the MMU must be disabled.
> > +
> > +Reserved memory for resident firmware
> > +-------------------------------------
> > +
> > +The RISC-V kernel expects the firmware to mark any resident memory with the
> > +`no-map` flag, thus the kernel won't map those regions in the direct mapping
> > +(avoiding issues with hibernation, speculative accesses and probably other
> > +subsystems).
> > +
> > +Kernel location
> > +---------------
> > +
> > +The RISC-V kernel expects to be placed at a PMD boundary (2MB for rv64 and 4MB
> > +for rv32). Note though that the EFI stub will physically relocate the kernel if
> > +that's not the case.
> > +
> > +Device-tree
> > +-----------
> > +
> > +The RISC-V kernel always expects a device tree, it is:
> > +
In general, the firmware can pass either DT or ACPI (not both at the
same time) to the OS. So, I think the statement that kernel always
expects DT probably causes confusion. Can we mention some thing like
below?
The firmware can pass either DeviceTree or ACPI tables to the RISC-V
kernel.
The DeviceTree is either passed directly to the kernel from the
previous stage using the `$a1` register, or when booting with UEFI, it
can be passed using the EFI configuration table.
The ACPI tables are passed to the kernel using the EFI configuration
table. In this case, a tiny DeviceTree is still created by the EFI
stub. Please refer to "EFI stub and device" tree section below for
details of the tiny DeviceTree.
Thanks,
Sunil
next prev parent reply other threads:[~2023-06-20 7:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 9:47 [PATCH 1/2] Documentation: riscv: Add early boot document Alexandre Ghiti
2023-06-19 9:47 ` [PATCH 2/2] Documentation: riscv: Update boot image header since EFI stub is supported Alexandre Ghiti
2023-06-19 18:58 ` Atish Patra
2023-06-19 9:49 ` [PATCH 1/2] Documentation: riscv: Add early boot document Alexandre Ghiti
2023-06-20 7:18 ` Sunil V L [this message]
2023-06-20 8:14 ` Alexandre Ghiti
2023-06-19 11:00 ` Björn Töpel
2023-06-19 12:25 ` Conor Dooley
2023-06-19 14:04 ` Alexandre Ghiti
2023-06-19 16:00 ` Conor Dooley
2023-06-19 16:48 ` Jonathan Corbet
2023-06-20 9:57 ` Conor Dooley
2023-06-20 9:09 ` Alexandre Ghiti
2023-06-20 10:33 ` Conor Dooley
2023-06-20 12:00 ` Alexandre Ghiti
2023-06-20 7:41 ` Sunil V L
2023-06-20 8:24 ` Alexandre Ghiti
2023-06-20 10:31 ` Song Shuai
2023-06-20 12:06 ` Alexandre Ghiti
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=ZJFS1K/LltE57MJ4@sunil-laptop \
--to=sunilvl@ventanamicro.com \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@rivosinc.com \
--cc=bjorn@rivosinc.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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