1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | The following changes since commit 361d5397355276e3007825cc17217c1e4d4320f7: |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1: | 3 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2023-07-17 15:49:27 +0100) |
4 | |||
5 | Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100) | ||
6 | 4 | ||
7 | are available in the Git repository at: | 5 | are available in the Git repository at: |
8 | 6 | ||
9 | git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122 | 7 | https://github.com/alistair23/qemu.git tags/pull-riscv-to-apply-20230719-1 |
10 | 8 | ||
11 | for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3: | 9 | for you to fetch changes up to 32be32509987fbe42cf5c2fd3cea3c2ad6eae179: |
12 | 10 | ||
13 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000) | 11 | target/riscv: Fix LMUL check to use VLEN (2023-07-19 14:37:26 +1000) |
14 | 12 | ||
15 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
16 | Seventh RISC-V PR for QEMU 6.2 | 14 | Fourth RISC-V PR for 8.1 |
17 | 15 | ||
18 | - Deprecate IF_NONE for SiFive OTP | 16 | * Fix LMUL check to use VLEN |
19 | - Don't reset SiFive OTP content | 17 | * Fix typo field in NUMA error_report |
18 | * check priv_ver before auto-enable zca/zcd/zcf | ||
19 | * Fix disas output of upper immediates | ||
20 | * tidy CPU firmware section | ||
20 | 21 | ||
21 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
22 | Philippe Mathieu-Daudé (1): | 23 | Christoph Müllner (1): |
23 | hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset | 24 | riscv/disas: Fix disas output of upper immediates |
24 | 25 | ||
25 | Thomas Huth (1): | 26 | Daniel Henrique Barboza (2): |
26 | hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE | 27 | docs/system/target-riscv.rst: tidy CPU firmware section |
28 | target/riscv/cpu.c: check priv_ver before auto-enable zca/zcd/zcf | ||
27 | 29 | ||
28 | docs/about/deprecated.rst | 6 ++++++ | 30 | Rob Bradford (1): |
29 | hw/misc/sifive_u_otp.c | 22 +++++++++++++--------- | 31 | target/riscv: Fix LMUL check to use VLEN |
30 | 2 files changed, 19 insertions(+), 9 deletions(-) | ||
31 | 32 | ||
33 | Zhao Liu (1): | ||
34 | hw/riscv: Fix typo field in error_report | ||
35 | |||
36 | docs/system/target-riscv.rst | 24 ++++++++++++++++-------- | ||
37 | disas/riscv.h | 2 ++ | ||
38 | disas/riscv.c | 19 ++++++++++++++++--- | ||
39 | hw/riscv/numa.c | 4 ++-- | ||
40 | target/riscv/cpu.c | 3 ++- | ||
41 | target/riscv/vector_helper.c | 4 ++-- | ||
42 | 6 files changed, 40 insertions(+), 16 deletions(-) | ||
43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
1 | 2 | ||
3 | This is how the content of the "RISC-V CPU firmware" section is | ||
4 | displayed after the html is generated: | ||
5 | |||
6 | "When using the sifive_u or virt machine there are three different | ||
7 | firmware boot options: 1. -bios default - This is the default behaviour | ||
8 | if no -bios option is included. (...) 3. -bios <file> - Tells QEMU to | ||
9 | load the specified file as the firmware." | ||
10 | |||
11 | It's all in the same paragraph, in a numbered list, and no special | ||
12 | formatting for the options. | ||
13 | |||
14 | Tidy it a bit by adding line breaks between items and its description. | ||
15 | Remove the numbered list. And apply formatting for the options cited in | ||
16 | the middle of the text. | ||
17 | |||
18 | Cc: qemu-trivial@nongnu.org | ||
19 | Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
20 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
21 | Message-Id: <20230712143728.383528-1-dbarboza@ventanamicro.com> | ||
22 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
23 | --- | ||
24 | docs/system/target-riscv.rst | 24 ++++++++++++++++-------- | ||
25 | 1 file changed, 16 insertions(+), 8 deletions(-) | ||
26 | |||
27 | diff --git a/docs/system/target-riscv.rst b/docs/system/target-riscv.rst | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/docs/system/target-riscv.rst | ||
30 | +++ b/docs/system/target-riscv.rst | ||
31 | @@ -XXX,XX +XXX,XX @@ RISC-V CPU firmware | ||
32 | |||
33 | When using the ``sifive_u`` or ``virt`` machine there are three different | ||
34 | firmware boot options: | ||
35 | -1. ``-bios default`` - This is the default behaviour if no -bios option | ||
36 | -is included. This option will load the default OpenSBI firmware automatically. | ||
37 | -The firmware is included with the QEMU release and no user interaction is | ||
38 | -required. All a user needs to do is specify the kernel they want to boot | ||
39 | -with the -kernel option | ||
40 | -2. ``-bios none`` - QEMU will not automatically load any firmware. It is up | ||
41 | -to the user to load all the images they need. | ||
42 | -3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmware. | ||
43 | + | ||
44 | +* ``-bios default`` | ||
45 | + | ||
46 | +This is the default behaviour if no ``-bios`` option is included. This option | ||
47 | +will load the default OpenSBI firmware automatically. The firmware is included | ||
48 | +with the QEMU release and no user interaction is required. All a user needs to | ||
49 | +do is specify the kernel they want to boot with the ``-kernel`` option | ||
50 | + | ||
51 | +* ``-bios none`` | ||
52 | + | ||
53 | +QEMU will not automatically load any firmware. It is up to the user to load all | ||
54 | +the images they need. | ||
55 | + | ||
56 | +* ``-bios <file>`` | ||
57 | + | ||
58 | +Tells QEMU to load the specified file as the firmware. | ||
59 | -- | ||
60 | 2.40.1 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Christoph Müllner <christoph.muellner@vrull.eu> |
---|---|---|---|
2 | 2 | ||
3 | Configuring a drive with "if=none" is meant for creation of a backend | 3 | The GNU assembler produces the following output for instructions |
4 | only, it should not get automatically assigned to a device frontend. | 4 | with upper immediates: |
5 | Use "if=pflash" for the One-Time-Programmable device instead (like | 5 | 00002597 auipc a1,0x2 |
6 | it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c). | 6 | 000024b7 lui s1,0x2 |
7 | 6409 lui s0,0x2 # c.lui | ||
7 | 8 | ||
8 | Since the old way of configuring the device has already been published | 9 | The immediate operands of upper immediates are not shifted. |
9 | with the previous QEMU versions, we cannot remove this immediately, but | ||
10 | have to deprecate it and support it for at least two more releases. | ||
11 | 10 | ||
12 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 11 | However, the QEMU disassembler prints them shifted: |
13 | Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 12 | 00002597 auipc a1,8192 |
14 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 13 | 000024b7 lui s1,8192 |
15 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 14 | 6409 lui s0,8192 # c.lui |
16 | Message-id: 20211119102549.217755-1-thuth@redhat.com | 15 | |
16 | The current implementation extracts the immediate bits and shifts the by 12, | ||
17 | so the internal representation of the immediate is the actual immediate. | ||
18 | However, the immediates are later printed using rv_fmt_rd_imm or | ||
19 | rv_fmt_rd_offset, which don't undo the shift. | ||
20 | |||
21 | Let's fix this by using specific output formats for instructions | ||
22 | with upper immediates, that take care of the shift. | ||
23 | |||
24 | Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> | ||
25 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
26 | Message-Id: <20230711075051.1531007-1-christoph.muellner@vrull.eu> | ||
17 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 27 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
18 | --- | 28 | --- |
19 | docs/about/deprecated.rst | 6 ++++++ | 29 | disas/riscv.h | 2 ++ |
20 | hw/misc/sifive_u_otp.c | 9 ++++++++- | 30 | disas/riscv.c | 19 ++++++++++++++++--- |
21 | 2 files changed, 14 insertions(+), 1 deletion(-) | 31 | 2 files changed, 18 insertions(+), 3 deletions(-) |
22 | 32 | ||
23 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst | 33 | diff --git a/disas/riscv.h b/disas/riscv.h |
24 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/docs/about/deprecated.rst | 35 | --- a/disas/riscv.h |
26 | +++ b/docs/about/deprecated.rst | 36 | +++ b/disas/riscv.h |
27 | @@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``. | 37 | @@ -XXX,XX +XXX,XX @@ enum { |
28 | However, short-form booleans are deprecated and full explicit ``arg_name=on`` | 38 | #define rv_fmt_pred_succ "O\tp,s" |
29 | form is preferred. | 39 | #define rv_fmt_rs1_rs2 "O\t1,2" |
30 | 40 | #define rv_fmt_rd_imm "O\t0,i" | |
31 | +``-drive if=none`` for the sifive_u OTP device (since 6.2) | 41 | +#define rv_fmt_rd_uimm "O\t0,Ui" |
32 | +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | 42 | #define rv_fmt_rd_offset "O\t0,o" |
33 | + | 43 | +#define rv_fmt_rd_uoffset "O\t0,Uo" |
34 | +Using ``-drive if=none`` to configure the OTP device of the sifive_u | 44 | #define rv_fmt_rd_rs1_rs2 "O\t0,1,2" |
35 | +RISC-V machine is deprecated. Use ``-drive if=pflash`` instead. | 45 | #define rv_fmt_frd_rs1 "O\t3,1" |
36 | + | 46 | #define rv_fmt_frd_rs1_rs2 "O\t3,1,2" |
37 | 47 | diff --git a/disas/riscv.c b/disas/riscv.c | |
38 | QEMU Machine Protocol (QMP) commands | ||
39 | ------------------------------------ | ||
40 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | 48 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/misc/sifive_u_otp.c | 49 | --- a/disas/riscv.c |
43 | +++ b/hw/misc/sifive_u_otp.c | 50 | +++ b/disas/riscv.c |
44 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 51 | @@ -XXX,XX +XXX,XX @@ static const rv_comp_data rvcp_fsgnjx_q[] = { |
45 | TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE); | 52 | |
46 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); | 53 | const rv_opcode_data rvi_opcode_data[] = { |
47 | 54 | { "illegal", rv_codec_illegal, rv_fmt_none, NULL, 0, 0, 0 }, | |
48 | - dinfo = drive_get_next(IF_NONE); | 55 | - { "lui", rv_codec_u, rv_fmt_rd_imm, NULL, 0, 0, 0 }, |
49 | + dinfo = drive_get_next(IF_PFLASH); | 56 | - { "auipc", rv_codec_u, rv_fmt_rd_offset, NULL, 0, 0, 0 }, |
50 | + if (!dinfo) { | 57 | + { "lui", rv_codec_u, rv_fmt_rd_uimm, NULL, 0, 0, 0 }, |
51 | + dinfo = drive_get_next(IF_NONE); | 58 | + { "auipc", rv_codec_u, rv_fmt_rd_uoffset, NULL, 0, 0, 0 }, |
52 | + if (dinfo) { | 59 | { "jal", rv_codec_uj, rv_fmt_rd_offset, rvcp_jal, 0, 0, 0 }, |
53 | + warn_report("using \"-drive if=none\" for the OTP is deprecated, " | 60 | { "jalr", rv_codec_i, rv_fmt_rd_rs1_offset, rvcp_jalr, 0, 0, 0 }, |
54 | + "use \"-drive if=pflash\" instead."); | 61 | { "beq", rv_codec_sb, rv_fmt_rs1_rs2_offset, rvcp_beq, 0, 0, 0 }, |
55 | + } | 62 | @@ -XXX,XX +XXX,XX @@ const rv_opcode_data rvi_opcode_data[] = { |
56 | + } | 63 | rv_op_addi }, |
57 | if (dinfo) { | 64 | { "c.addi16sp", rv_codec_ci_16sp, rv_fmt_rd_rs1_imm, NULL, rv_op_addi, |
58 | int ret; | 65 | rv_op_addi, rv_op_addi, rvcd_imm_nz }, |
59 | uint64_t perm; | 66 | - { "c.lui", rv_codec_ci_lui, rv_fmt_rd_imm, NULL, rv_op_lui, rv_op_lui, |
67 | + { "c.lui", rv_codec_ci_lui, rv_fmt_rd_uimm, NULL, rv_op_lui, rv_op_lui, | ||
68 | rv_op_lui, rvcd_imm_nz }, | ||
69 | { "c.srli", rv_codec_cb_sh6, rv_fmt_rd_rs1_imm, NULL, rv_op_srli, | ||
70 | rv_op_srli, rv_op_srli, rvcd_imm_nz }, | ||
71 | @@ -XXX,XX +XXX,XX @@ static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec) | ||
72 | dec->pc + dec->imm); | ||
73 | append(buf, tmp, buflen); | ||
74 | break; | ||
75 | + case 'U': | ||
76 | + fmt++; | ||
77 | + snprintf(tmp, sizeof(tmp), "%d", dec->imm >> 12); | ||
78 | + append(buf, tmp, buflen); | ||
79 | + if (*fmt == 'o') { | ||
80 | + while (strlen(buf) < tab * 2) { | ||
81 | + append(buf, " ", buflen); | ||
82 | + } | ||
83 | + snprintf(tmp, sizeof(tmp), "# 0x%" PRIx64, | ||
84 | + dec->pc + dec->imm); | ||
85 | + append(buf, tmp, buflen); | ||
86 | + } | ||
87 | + break; | ||
88 | case 'c': { | ||
89 | const char *name = csr_name(dec->imm & 0xfff); | ||
90 | if (name) { | ||
60 | -- | 91 | -- |
61 | 2.31.1 | 92 | 2.40.1 |
62 | 93 | ||
63 | 94 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
1 | 2 | ||
3 | Commit bd30559568 made changes in how we're checking and disabling | ||
4 | extensions based on env->priv_ver. One of the changes was to move the | ||
5 | extension disablement code to the end of realize(), being able to | ||
6 | disable extensions after we've auto-enabled some of them. | ||
7 | |||
8 | An unfortunate side effect of this change started to happen with CPUs | ||
9 | that has an older priv version, like sifive-u54. Starting on commit | ||
10 | 2288a5ce43e5 we're auto-enabling zca, zcd and zcf if RVC is enabled, | ||
11 | but these extensions are priv version 1.12.0. When running a cpu that | ||
12 | has an older priv ver (like sifive-u54) the user is spammed with | ||
13 | warnings like these: | ||
14 | |||
15 | qemu-system-riscv64: warning: disabling zca extension for hart 0x0000000000000000 because privilege spec version does not match | ||
16 | qemu-system-riscv64: warning: disabling zcd extension for hart 0x0000000000000000 because privilege spec version does not match | ||
17 | |||
18 | The warnings are part of the code that disables the extension, but in this | ||
19 | case we're throwing user warnings for stuff that we enabled on our own, | ||
20 | without user intervention. Users are left wondering what they did wrong. | ||
21 | |||
22 | A quick 8.1 fix for this nuisance is to check the CPU priv spec before | ||
23 | auto-enabling zca/zcd/zcf. A more appropriate fix will include a more | ||
24 | robust framework that will account for both priv_ver and user choice | ||
25 | when auto-enabling/disabling extensions, but for 8.1 we'll make it do | ||
26 | with this simple check. | ||
27 | |||
28 | It's also worth noticing that this is the only case where we're | ||
29 | auto-enabling extensions based on a criteria (in this case RVC) that | ||
30 | doesn't match the priv spec of the extensions we're enabling. There's no | ||
31 | need for more 8.1 band-aids. | ||
32 | |||
33 | Cc: Conor Dooley <conor@kernel.org> | ||
34 | Fixes: 2288a5ce43e5 ("target/riscv: add cfg properties for Zc* extension") | ||
35 | Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
36 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
37 | Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> | ||
38 | Tested-by: Conor Dooley <conor.dooley@microchip.com> | ||
39 | Message-Id: <20230717154141.60898-1-dbarboza@ventanamicro.com> | ||
40 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
41 | --- | ||
42 | target/riscv/cpu.c | 3 ++- | ||
43 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
44 | |||
45 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/riscv/cpu.c | ||
48 | +++ b/target/riscv/cpu.c | ||
49 | @@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) | ||
50 | } | ||
51 | } | ||
52 | |||
53 | - if (riscv_has_ext(env, RVC)) { | ||
54 | + /* zca, zcd and zcf has a PRIV 1.12.0 restriction */ | ||
55 | + if (riscv_has_ext(env, RVC) && env->priv_ver >= PRIV_VERSION_1_12_0) { | ||
56 | cpu->cfg.ext_zca = true; | ||
57 | if (riscv_has_ext(env, RVF) && env->misa_mxl_max == MXL_RV32) { | ||
58 | cpu->cfg.ext_zcf = true; | ||
59 | -- | ||
60 | 2.40.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Zhao Liu <zhao1.liu@intel.com> | ||
1 | 2 | ||
3 | "smp.cpus" means the number of online CPUs and "smp.max_cpus" means the | ||
4 | total number of CPUs. | ||
5 | |||
6 | riscv_numa_get_default_cpu_node_id() checks "smp.cpus" and the | ||
7 | "available CPUs" description in the next error message also indicates | ||
8 | online CPUs. | ||
9 | |||
10 | So report "smp.cpus" in error_report() instand of "smp.max_cpus". | ||
11 | |||
12 | Since "smp.cpus" is "unsigned int", use "%u". | ||
13 | |||
14 | Signed-off-by: Zhao Liu <zhao1.liu@intel.com> | ||
15 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
16 | Message-Id: <20230718080712.503333-1-zhao1.liu@linux.intel.com> | ||
17 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
18 | --- | ||
19 | hw/riscv/numa.c | 4 ++-- | ||
20 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/hw/riscv/numa.c b/hw/riscv/numa.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/hw/riscv/numa.c | ||
25 | +++ b/hw/riscv/numa.c | ||
26 | @@ -XXX,XX +XXX,XX @@ int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx) | ||
27 | |||
28 | if (ms->numa_state->num_nodes > ms->smp.cpus) { | ||
29 | error_report("Number of NUMA nodes (%d)" | ||
30 | - " cannot exceed the number of available CPUs (%d).", | ||
31 | - ms->numa_state->num_nodes, ms->smp.max_cpus); | ||
32 | + " cannot exceed the number of available CPUs (%u).", | ||
33 | + ms->numa_state->num_nodes, ms->smp.cpus); | ||
34 | exit(EXIT_FAILURE); | ||
35 | } | ||
36 | if (ms->numa_state->num_nodes) { | ||
37 | -- | ||
38 | 2.40.1 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Rob Bradford <rbradford@rivosinc.com> |
---|---|---|---|
2 | 2 | ||
3 | Once a "One Time Programmable" is programmed, it shouldn't be reset. | 3 | The previous check was failing with: |
4 | 4 | ||
5 | Do not re-initialize the OTP content in the DeviceReset handler, | 5 | VLEN=128 ELEN = 64 SEW = 16 and LMUL = 1/8 which is a |
6 | initialize it once in the DeviceRealize one. | 6 | valid combination. |
7 | 7 | ||
8 | Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP") | 8 | Fix the check to allow valid combinations when VLEN is a multiple of |
9 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | ELEN. |
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | |
11 | Message-Id: <20211119104757.331579-1-f4bug@amsat.org> | 11 | From the specification: |
12 | |||
13 | "In general, the requirement is to support LMUL ≥ SEWMIN/ELEN, where | ||
14 | SEWMIN is the narrowest supported SEW value and ELEN is the widest | ||
15 | supported SEW value. In the standard extensions, SEWMIN=8. For standard | ||
16 | vector extensions with ELEN=32, fractional LMULs of 1/2 and 1/4 must be | ||
17 | supported. For standard vector extensions with ELEN=64, fractional LMULs | ||
18 | of 1/2, 1/4, and 1/8 must be supported." Elsewhere in the specification | ||
19 | it makes clear that VLEN>=ELEN. | ||
20 | |||
21 | From inspection this new check allows: | ||
22 | |||
23 | VLEN=ELEN=64 1/2, 1/4, 1/8 for SEW >=8 | ||
24 | VLEN=ELEN=32 1/2, 1/4 for SEW >=8 | ||
25 | |||
26 | Fixes: d9b7609a1fb2 ("target/riscv: rvv-1.0: configure instructions") | ||
27 | Signed-off-by: Rob Bradford <rbradford@rivosinc.com> | ||
28 | Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> | ||
29 | Message-Id: <20230718131316.12283-2-rbradford@rivosinc.com> | ||
12 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 30 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
13 | --- | 31 | --- |
14 | hw/misc/sifive_u_otp.c | 13 +++++-------- | 32 | target/riscv/vector_helper.c | 4 ++-- |
15 | 1 file changed, 5 insertions(+), 8 deletions(-) | 33 | 1 file changed, 2 insertions(+), 2 deletions(-) |
16 | 34 | ||
17 | diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c | 35 | diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c |
18 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/misc/sifive_u_otp.c | 37 | --- a/target/riscv/vector_helper.c |
20 | +++ b/hw/misc/sifive_u_otp.c | 38 | +++ b/target/riscv/vector_helper.c |
21 | @@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp) | 39 | @@ -XXX,XX +XXX,XX @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1, |
22 | 40 | xlen - 1 - R_VTYPE_RESERVED_SHIFT); | |
23 | if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) { | 41 | |
24 | error_setg(errp, "failed to read the initial flash content"); | 42 | if (lmul & 4) { |
25 | + return; | 43 | - /* Fractional LMUL. */ |
26 | } | 44 | + /* Fractional LMUL - check LMUL * VLEN >= SEW */ |
45 | if (lmul == 4 || | ||
46 | - cpu->cfg.elen >> (8 - lmul) < sew) { | ||
47 | + cpu->cfg.vlen >> (8 - lmul) < sew) { | ||
48 | vill = true; | ||
27 | } | 49 | } |
28 | } | 50 | } |
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 | -- | 51 | -- |
64 | 2.31.1 | 52 | 2.40.1 |
65 | 53 | ||
66 | 54 | diff view generated by jsdifflib |