OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zong Li <zong.li@sifive.com>
To: opensbi@lists.infradead.org, anup@brainfault.org
Cc: Zong Li <zong.li@sifive.com>
Subject: [PATCH 0/3] Support OpenSBI firmware header
Date: Mon, 31 Aug 2026 19:22:08 -0700	[thread overview]
Message-ID: <20260901022211.2619560-1-zong.li@sifive.com> (raw)

This series adds OpenSBI firmware header. The motivation is when a
system where the previous booting stage runs on a dedicated boot
processor, it can load and patch the OpenSBI image in DRAM and then
release the application hart that runs OpenSBI, but it can never execute
on that hart and therefore cannot place anything in its registers, such
as $a0, $a1 and $a2

Every OpenSBI firmware image, regardless of its type (FW_DYNAMIC,
FW_JUMP or FW_PAYLOAD), starts with a fixed 128-byte header. The header
serves two purposes:

1. it lets the previous booting stage recognize an OpenSBI firmware
   image and find out what it was built for, and
2. it gives the previous booting stage a well-known place inside the
   image to hand over the boot arguments by patching a few words,
   instead of setting up the *a0*, *a1* and *a2* registers.

This series also provides a document 'docs/firmware/fw_header.md' to
describe the layout of the 128-byte OpenSBI firmware header, the
a0/a1/a2 override flags, what a previous booting stage is expected to put
in each register, and an example of how to patch the header.

Thanks Anup for discussing it and providing the ideas

Zong Li (3):
  firmware: fw_base.S: add a formatted OpenSBI firmware header
  firmware: fw_base.S: override a0, a1 and a2 from the firmware header
  docs: firmware: document the OpenSBI firmware header

 docs/firmware/fw.md        |   9 +++
 docs/firmware/fw_header.md | 127 +++++++++++++++++++++++++++++++++++++
 firmware/fw_base.S         | 100 +++++++++++++++++++++++++++++
 3 files changed, 236 insertions(+)
 create mode 100644 docs/firmware/fw_header.md

-- 
2.43.7


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

             reply	other threads:[~2026-09-01  2:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  2:22 Zong Li [this message]
2026-09-01  2:22 ` [PATCH 1/3] firmware: fw_base.S: add a formatted OpenSBI firmware header Zong Li
2026-09-01  2:22 ` [PATCH 2/3] firmware: fw_base.S: override a0, a1 and a2 from the " Zong Li
2026-09-01  2:22 ` [PATCH 3/3] docs: firmware: document the OpenSBI " Zong Li

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=20260901022211.2619560-1-zong.li@sifive.com \
    --to=zong.li@sifive.com \
    --cc=anup@brainfault.org \
    --cc=opensbi@lists.infradead.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