Seventh RISC-V PR for QEMU 6.2

- Deprecate IF_NONE for SiFive OTP
  - Don't reset SiFive OTP content
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEE9sSsRtSTSGjTuM6PIeENKd+XcFQFAmGbPewACgkQIeENKd+X
 cFTl1Qf/dTZHH/bgzanGvoU6Wx3cnUUGZ/wRvYlk2+FJ4ZtZiSEo7DcGVv1qgX+v
 z/2y6EhXWeuCDB/5fp6JDnwObMxDXwQm9huNzH4gM0JJgRZjXFnj2RLs/rD9OBs7
 OWG7zs4xYxWuEW/4WFzrWYiLRBA1lc6f/NpLnP7pOv3PvNrc3ax8N34WH9sfAi4E
 JYLnquBetNDsg9+0BEkXR8IJDI4fKfDEOWpptuWWNau3gnHeeRjEltAtvfWrQykK
 ZaESAthuJ2i+zAfD6EK2dtH5XCWot6+0SdeopgTM2iLVHgBPNfgP9iAx25a1fXF0
 SywYo03Jzu9wGvaYhzrjWZjn8OLJuA==
 =d0D3
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Richard Henderson 2021-11-22 08:53:05 +01:00
commit edf1aa8d44
2 changed files with 19 additions and 9 deletions

View File

@ -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
------------------------------------

View File

@ -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_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 = {