aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-22 08:53:05 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-22 08:53:05 +0100
commitedf1aa8d44d5070828ac10c5b82dbc6caf29e7d3 (patch)
tree501b5aa7d1b621ac6587cd6550a644ba68d16ee9
parentc5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1 (diff)
parent526e7443027c71fe7b04c29df529e1f9f425f9e3 (diff)
downloadqemu-edf1aa8d44d5070828ac10c5b82dbc6caf29e7d3.zip
qemu-edf1aa8d44d5070828ac10c5b82dbc6caf29e7d3.tar.gz
qemu-edf1aa8d44d5070828ac10c5b82dbc6caf29e7d3.tar.bz2
Merge tag 'pull-riscv-to-apply-20211122' of github.com:alistair23/qemu into staging
Seventh RISC-V PR for QEMU 6.2 - Deprecate IF_NONE for SiFive OTP - Don't reset SiFive OTP content # gpg: Signature made Mon 22 Nov 2021 07:51:24 AM CET # gpg: using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054 # gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [full] * tag 'pull-riscv-to-apply-20211122' of github.com:alistair23/qemu: hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--docs/about/deprecated.rst6
-rw-r--r--hw/misc/sifive_u_otp.c22
2 files changed, 19 insertions, 9 deletions
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index c03fcf9..ff7488c 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -192,6 +192,12 @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
However, short-form booleans are deprecated and full explicit ``arg_name=on``
form is preferred.
+``-drive if=none`` for the sifive_u OTP device (since 6.2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Using ``-drive if=none`` to configure the OTP device of the sifive_u
+RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
index 18aa0bd..52fdb75 100644
--- a/hw/misc/sifive_u_otp.c
+++ b/hw/misc/sifive_u_otp.c
@@ -209,7 +209,14 @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE);
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
- dinfo = drive_get_next(IF_NONE);
+ dinfo = drive_get_next(IF_PFLASH);
+ if (!dinfo) {
+ dinfo = drive_get_next(IF_NONE);
+ if (dinfo) {
+ warn_report("using \"-drive if=none\" for the OTP is deprecated, "
+ "use \"-drive if=pflash\" instead.");
+ }
+ }
if (dinfo) {
int ret;
uint64_t perm;
@@ -235,14 +242,10 @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
error_setg(errp, "failed to read the initial flash content");
+ return;
}
}
}
-}
-
-static void sifive_u_otp_reset(DeviceState *dev)
-{
- SiFiveUOTPState *s = SIFIVE_U_OTP(dev);
/* Initialize all fuses' initial value to 0xFFs */
memset(s->fuse, 0xff, sizeof(s->fuse));
@@ -259,13 +262,15 @@ static void sifive_u_otp_reset(DeviceState *dev)
serial_data = s->serial;
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
- error_report("write error index<%d>", index);
+ error_setg(errp, "failed to write index<%d>", index);
+ return;
}
serial_data = ~(s->serial);
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
- error_report("write error index<%d>", index + 1);
+ error_setg(errp, "failed to write index<%d>", index + 1);
+ return;
}
}
@@ -279,7 +284,6 @@ static void sifive_u_otp_class_init(ObjectClass *klass, void *data)
device_class_set_props(dc, sifive_u_otp_properties);
dc->realize = sifive_u_otp_realize;
- dc->reset = sifive_u_otp_reset;
}
static const TypeInfo sifive_u_otp_info = {