From: Green Wan <green.wan@sifive.com>
Cc: qemu-riscv@nongnu.org,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
qemu-devel@nongnu.org, Green Wan <green.wan@sifive.com>,
Alistair Francis <Alistair.Francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
bmeng.cn@gmail.com
Subject: [RFC PATCH v2 0/2] Add write-once and file-backed features to OTP
Date: Fri, 31 Jul 2020 10:47:06 +0800 [thread overview]
Message-ID: <20200731024708.32725-1-green.wan@sifive.com> (raw)
First patch is to add file-backed implementation to allow users to assign
an OTP image file to machine. Users can assign the property, "otp-file",
to machine to enable it. File-backed feature is set to "NULL" string in
default. Any filename other than "NULL" is used as OTP image file.
For example, '-M sifive_u,otp-file="otp.img"'
To keep data up-to-date due to an unexpected crash or CTRL+a-x exit, every
read/write command to OTP memory involves file open, mmap and close
operation to the image file.
Second patch is to add 'write-once' feature to block second write to the
OTP memory. Only keep the 'written' state for non-control register range
from 0x38 to 16KB.
Tested on sifive_u for both qemu and u-boot.
Green Wan (2):
hw/riscv: sifive_u: Add file-backed OTP.
hw/riscv: sifive_u: Add write-once protection.
hw/riscv/sifive_u.c | 26 ++++++++
hw/riscv/sifive_u_otp.c | 103 ++++++++++++++++++++++++++++++++
include/hw/riscv/sifive_u.h | 2 +
include/hw/riscv/sifive_u_otp.h | 2 +
4 files changed, 133 insertions(+)
--
2.17.1
next reply other threads:[~2020-07-31 2:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 2:47 Green Wan [this message]
2020-07-31 2:47 ` [RFC PATCH v2 1/2] hw/riscv: sifive_u: Add file-backed OTP Green Wan
2020-08-10 22:13 ` Alistair Francis
2020-08-13 4:12 ` Green Wan
2020-08-13 21:24 ` Alistair Francis
2020-08-18 17:12 ` Green Wan
2020-07-31 2:47 ` [RFC PATCH v2 2/2] hw/riscv: sifive_u: Add write-once protection Green Wan
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=20200731024708.32725-1-green.wan@sifive.com \
--to=green.wan@sifive.com \
--cc=Alistair.Francis@wdc.com \
--cc=bmeng.cn@gmail.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
/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).