1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1: | 3 | The following changes since commit d5341e09135b871199073572f53bc11ae9b44897: |
4 | 4 | ||
5 | Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100) | 5 | Merge tag 'pull-tcg-20220331' of https://gitlab.com/rth7680/qemu into staging (2022-03-31 18:36:08 +0100) |
6 | 6 | ||
7 | are available in the Git repository at: | 7 | are available in the Git repository at: |
8 | 8 | ||
9 | git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122 | 9 | git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20220401 |
10 | 10 | ||
11 | for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3: | 11 | for you to fetch changes up to 8ff8ac63298611c8373b294ec936475b1a33f63f: |
12 | 12 | ||
13 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000) | 13 | target/riscv: rvv: Add missing early exit condition for whole register load/store (2022-04-01 08:40:55 +1000) |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | Seventh RISC-V PR for QEMU 6.2 | 16 | Sixth RISC-V PR for QEMU 7.0 |
17 | 17 | ||
18 | - Deprecate IF_NONE for SiFive OTP | 18 | This is a last minute RISC-V PR for 7.0. |
19 | - Don't reset SiFive OTP content | 19 | |
20 | It includes a fix to avoid leaking no translation TLB entries. This | ||
21 | incorrectly cached uncachable baremetal entries. This would break Linux | ||
22 | boot while single stepping. As the fix is pretty straight forward (flush | ||
23 | the cache more often) it's being pulled in for 7.0. | ||
24 | |||
25 | At the same time I have included a RISC-V vector extension fixup patch. | ||
20 | 26 | ||
21 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
22 | Philippe Mathieu-Daudé (1): | 28 | Palmer Dabbelt (1): |
23 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset | 29 | target/riscv: Avoid leaking "no translation" TLB entries |
24 | 30 | ||
25 | Thomas Huth (1): | 31 | Yueh-Ting (eop) Chen (1): |
26 | hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE | 32 | target/riscv: rvv: Add missing early exit condition for whole register load/store |
27 | 33 | ||
28 | docs/about/deprecated.rst | 6 ++++++ | 34 | target/riscv/csr.c | 14 ++++++++------ |
29 | hw/misc/sifive_u_otp.c | 22 +++++++++++++--------- | 35 | target/riscv/insn_trans/trans_rvv.c.inc | 5 +++++ |
30 | 2 files changed, 19 insertions(+), 9 deletions(-) | 36 | 2 files changed, 13 insertions(+), 6 deletions(-) |
31 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Palmer Dabbelt <palmer@rivosinc.com> |
---|---|---|---|
2 | 2 | ||
3 | Once a "One Time Programmable" is programmed, it shouldn't be reset. | 3 | The ISA doesn't allow bare mappings to be cached, as the caches are |
4 | translations and bare mppings are not translated. We cache these | ||
5 | translations in QEMU in order to utilize the TLB code, but that leaks | ||
6 | out to the guest. | ||
4 | 7 | ||
5 | Do not re-initialize the OTP content in the DeviceReset handler, | 8 | Suggested-by: phantom@zju.edu.cn # no name in the From field |
6 | initialize it once in the DeviceRealize one. | 9 | Fixes: 1e0d985fa9 ("target/riscv: Only flush TLB if SATP.ASID changes") |
7 | 10 | Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> | |
8 | Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP") | ||
9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
11 | Message-Id: <20211119104757.331579-1-f4bug@amsat.org> | 12 | Message-Id: <20220330165913.8836-1-palmer@rivosinc.com> |
12 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 13 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
13 | --- | 14 | --- |
14 | hw/misc/sifive_u_otp.c | 13 +++++-------- | 15 | target/riscv/csr.c | 14 ++++++++------ |
15 | 1 file changed, 5 insertions(+), 8 deletions(-) | 16 | 1 file changed, 8 insertions(+), 6 deletions(-) |
16 | 17 | ||
17 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | 18 | diff --git a/target/riscv/csr.c b/target/riscv/csr.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/misc/sifive_u_otp.c | 20 | --- a/target/riscv/csr.c |
20 | +++ b/hw/misc/sifive_u_otp.c | 21 | +++ b/target/riscv/csr.c |
21 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 22 | @@ -XXX,XX +XXX,XX @@ static RISCVException read_satp(CPURISCVState *env, int csrno, |
22 | 23 | static RISCVException write_satp(CPURISCVState *env, int csrno, | |
23 | if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) { | 24 | target_ulong val) |
24 | error_setg(errp, "failed to read the initial flash content"); | 25 | { |
25 | + return; | 26 | - target_ulong vm, mask, asid; |
26 | } | 27 | + target_ulong vm, mask; |
28 | |||
29 | if (!riscv_feature(env, RISCV_FEATURE_MMU)) { | ||
30 | return RISCV_EXCP_NONE; | ||
31 | @@ -XXX,XX +XXX,XX @@ static RISCVException write_satp(CPURISCVState *env, int csrno, | ||
32 | if (riscv_cpu_mxl(env) == MXL_RV32) { | ||
33 | vm = validate_vm(env, get_field(val, SATP32_MODE)); | ||
34 | mask = (val ^ env->satp) & (SATP32_MODE | SATP32_ASID | SATP32_PPN); | ||
35 | - asid = (val ^ env->satp) & SATP32_ASID; | ||
36 | } else { | ||
37 | vm = validate_vm(env, get_field(val, SATP64_MODE)); | ||
38 | mask = (val ^ env->satp) & (SATP64_MODE | SATP64_ASID | SATP64_PPN); | ||
39 | - asid = (val ^ env->satp) & SATP64_ASID; | ||
40 | } | ||
41 | |||
42 | if (vm && mask) { | ||
43 | if (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)) { | ||
44 | return RISCV_EXCP_ILLEGAL_INST; | ||
45 | } else { | ||
46 | - if (asid) { | ||
47 | - tlb_flush(env_cpu(env)); | ||
48 | - } | ||
49 | + /* | ||
50 | + * The ISA defines SATP.MODE=Bare as "no translation", but we still | ||
51 | + * pass these through QEMU's TLB emulation as it improves | ||
52 | + * performance. Flushing the TLB on SATP writes with paging | ||
53 | + * enabled avoids leaking those invalid cached mappings. | ||
54 | + */ | ||
55 | + tlb_flush(env_cpu(env)); | ||
56 | env->satp = val; | ||
27 | } | 57 | } |
28 | } | 58 | } |
29 | -} | ||
30 | - | ||
31 | -static void sifive_u_otp_reset(DeviceState *dev) | ||
32 | -{ | ||
33 | - SiFiveUOTPState *s = SIFIVE_U_OTP(dev); | ||
34 | |||
35 | /* Initialize all fuses' initial value to 0xFFs */ | ||
36 | memset(s->fuse, 0xff, sizeof(s->fuse)); | ||
37 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_reset(DeviceState *dev) | ||
38 | serial_data = s->serial; | ||
39 | if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD, | ||
40 | &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) { | ||
41 | - error_report("write error index<%d>", index); | ||
42 | + error_setg(errp, "failed to write index<%d>", index); | ||
43 | + return; | ||
44 | } | ||
45 | |||
46 | serial_data = ~(s->serial); | ||
47 | if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD, | ||
48 | &serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) { | ||
49 | - error_report("write error index<%d>", index + 1); | ||
50 | + error_setg(errp, "failed to write index<%d>", index + 1); | ||
51 | + return; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_class_init(ObjectClass *klass, void *data) | ||
56 | |||
57 | device_class_set_props(dc, sifive_u_otp_properties); | ||
58 | dc->realize = sifive_u_otp_realize; | ||
59 | - dc->reset = sifive_u_otp_reset; | ||
60 | } | ||
61 | |||
62 | static const TypeInfo sifive_u_otp_info = { | ||
63 | -- | 59 | -- |
64 | 2.31.1 | 60 | 2.35.1 |
65 | |||
66 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: "Yueh-Ting (eop) Chen" <eop.chen@sifive.com> |
---|---|---|---|
2 | 2 | ||
3 | Configuring a drive with "if=none" is meant for creation of a backend | 3 | According to v-spec (section 7.9): |
4 | only, it should not get automatically assigned to a device frontend. | 4 | The instructions operate with an effective vector length, evl=NFIELDS*VLEN/EEW, |
5 | Use "if=pflash" for the One-Time-Programmable device instead (like | 5 | regardless of current settings in vtype and vl. The usual property that no |
6 | it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c). | 6 | elements are written if vstart ≥ vl does not apply to these instructions. |
7 | Instead, no elements are written if vstart ≥ evl. | ||
7 | 8 | ||
8 | Since the old way of configuring the device has already been published | 9 | Signed-off-by: eop Chen <eop.chen@sifive.com> |
9 | with the previous QEMU versions, we cannot remove this immediately, but | 10 | Reviewed-by: Frank Chang <frank.chang@sifive.com> |
10 | have to deprecate it and support it for at least two more releases. | ||
11 | |||
12 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
13 | Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
15 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
16 | Message-id: 20211119102549.217755-1-thuth@redhat.com | 12 | Message-Id: <164762720573.18409.3931931227997483525-0@git.sr.ht> |
17 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 13 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
18 | --- | 14 | --- |
19 | docs/about/deprecated.rst | 6 ++++++ | 15 | target/riscv/insn_trans/trans_rvv.c.inc | 5 +++++ |
20 | hw/misc/sifive_u_otp.c | 9 ++++++++- | 16 | 1 file changed, 5 insertions(+) |
21 | 2 files changed, 14 insertions(+), 1 deletion(-) | ||
22 | 17 | ||
23 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst | 18 | diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc |
24 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/docs/about/deprecated.rst | 20 | --- a/target/riscv/insn_trans/trans_rvv.c.inc |
26 | +++ b/docs/about/deprecated.rst | 21 | +++ b/target/riscv/insn_trans/trans_rvv.c.inc |
27 | @@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``. | 22 | @@ -XXX,XX +XXX,XX @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf, |
28 | However, short-form booleans are deprecated and full explicit ``arg_name=on`` | 23 | gen_helper_ldst_whole *fn, DisasContext *s, |
29 | form is preferred. | 24 | bool is_store) |
30 | 25 | { | |
31 | +``-drive if=none`` for the sifive_u OTP device (since 6.2) | 26 | + uint32_t evl = (s->cfg_ptr->vlen / 8) * nf / (1 << s->sew); |
32 | +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | 27 | + TCGLabel *over = gen_new_label(); |
28 | + tcg_gen_brcondi_tl(TCG_COND_GEU, cpu_vstart, evl, over); | ||
33 | + | 29 | + |
34 | +Using ``-drive if=none`` to configure the OTP device of the sifive_u | 30 | TCGv_ptr dest; |
35 | +RISC-V machine is deprecated. Use ``-drive if=pflash`` instead. | 31 | TCGv base; |
36 | + | 32 | TCGv_i32 desc; |
37 | 33 | @@ -XXX,XX +XXX,XX @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf, | |
38 | QEMU Machine Protocol (QMP) commands | 34 | if (!is_store) { |
39 | ------------------------------------ | 35 | mark_vs_dirty(s); |
40 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | 36 | } |
41 | index XXXXXXX..XXXXXXX 100644 | 37 | + gen_set_label(over); |
42 | --- a/hw/misc/sifive_u_otp.c | 38 | |
43 | +++ b/hw/misc/sifive_u_otp.c | 39 | return true; |
44 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 40 | } |
45 | TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE); | ||
46 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); | ||
47 | |||
48 | - dinfo = drive_get_next(IF_NONE); | ||
49 | + dinfo = drive_get_next(IF_PFLASH); | ||
50 | + if (!dinfo) { | ||
51 | + dinfo = drive_get_next(IF_NONE); | ||
52 | + if (dinfo) { | ||
53 | + warn_report("using \"-drive if=none\" for the OTP is deprecated, " | ||
54 | + "use \"-drive if=pflash\" instead."); | ||
55 | + } | ||
56 | + } | ||
57 | if (dinfo) { | ||
58 | int ret; | ||
59 | uint64_t perm; | ||
60 | -- | 41 | -- |
61 | 2.31.1 | 42 | 2.35.1 |
62 | |||
63 | diff view generated by jsdifflib |