1
From: Alistair Francis <alistair.francis@wdc.com>
1
The following changes since commit ad10b4badc1dd5b28305f9b9f1168cf0aa3ae946:
2
2
3
The following changes since commit 2ba341b3694cf3cff7b8a1df4cc765900d5c4f60:
3
Merge tag 'pull-error-2024-05-27' of https://repo.or.cz/qemu/armbru into staging (2024-05-27 06:40:42 -0700)
4
5
Merge tag 'kraxel-20221013-pull-request' of https://gitlab.com/kraxel/qemu into staging (2022-10-13 13:55:53 -0400)
6
4
7
are available in the Git repository at:
5
are available in the Git repository at:
8
6
9
https://github.com/alistair23/qemu.git tags/pull-riscv-to-apply-20221014
7
https://github.com/alistair23/qemu.git tags/pull-riscv-to-apply-20240528
10
8
11
for you to fetch changes up to 47566421f029b0a489b63f8195b3ff944e017056:
9
for you to fetch changes up to 1806da76cb81088ea026ca3441551782b850e393:
12
10
13
target/riscv: pmp: Fixup TLB size calculation (2022-10-14 14:36:19 +1000)
11
target/riscv: raise an exception when CSRRS/CSRRC writes a read-only CSR (2024-05-28 12:20:27 +1000)
14
12
15
----------------------------------------------------------------
13
----------------------------------------------------------------
16
Third RISC-V PR for QEMU 7.2
14
RISC-V PR for 9.1
17
15
18
* Update qtest comment
16
* APLICs add child earlier than realize
19
* Fix coverity issue with Ibex SPI
17
* Fix exposure of Zkr
20
* Move load_image_to_fw_cfg() to common location
18
* Raise exceptions on wrs.nto
21
* Enable booting S-mode firmware from pflash on virt machine
19
* Implement SBI debug console (DBCN) calls for KVM
22
* Add disas support for vector instructions
20
* Support 64-bit addresses for initrd
23
* Priority level fixes for PLIC
21
* Change RISCV_EXCP_SEMIHOST exception number to 63
24
* Fixup TLB size calculation when using PMP
22
* Tolerate KVM disable ext errors
23
* Set tval in breakpoints
24
* Add support for Zve32x extension
25
* Add support for Zve64x extension
26
* Relax vector register check in RISCV gdbstub
27
* Fix the element agnostic Vector function problem
28
* Fix Zvkb extension config
29
* Implement dynamic establishment of custom decoder
30
* Add th.sxstatus CSR emulation
31
* Fix Zvfhmin checking for vfwcvt.f.f.v and vfncvt.f.f.w instructions
32
* Check single width operator for vector fp widen instructions
33
* Check single width operator for vfncvt.rod.f.f.w
34
* Remove redudant SEW checking for vector fp narrow/widen instructions
35
* Prioritize pmp errors in raise_mmu_exception()
36
* Do not set mtval2 for non guest-page faults
37
* Remove experimental prefix from "B" extension
38
* Fixup CBO extension register calculation
39
* Fix the hart bit setting of AIA
40
* Fix reg_width in ricsv_gen_dynamic_vector_feature()
41
* Decode all of the pmpcfg and pmpaddr CSRs
42
* Raise an exception when CSRRS/CSRRC writes a read-only CSR
25
43
26
----------------------------------------------------------------
44
----------------------------------------------------------------
27
Alistair Francis (1):
45
Alexei Filippov (1):
28
target/riscv: pmp: Fixup TLB size calculation
46
target/riscv: do not set mtval2 for non guest-page faults
29
47
30
Bin Meng (1):
48
Alistair Francis (2):
31
hw/riscv: Update comment for qtest check in riscv_find_firmware()
49
target/riscv: rvzicbo: Fixup CBO extension register calculation
50
disas/riscv: Decode all of the pmpcfg and pmpaddr CSRs
32
51
33
Jim Shu (2):
52
Andrew Jones (2):
34
hw/intc: sifive_plic: fix hard-coded max priority level
53
target/riscv/kvm: Fix exposure of Zkr
35
hw/intc: sifive_plic: change interrupt priority register to WARL field
54
target/riscv: Raise exceptions on wrs.nto
36
55
37
Sunil V L (3):
56
Cheng Yang (1):
38
hw/arm, loongarch: Move load_image_to_fw_cfg() to common location
57
hw/riscv/boot.c: Support 64-bit address for initrd
39
hw/riscv: virt: Move create_fw_cfg() prior to loading kernel
40
hw/riscv: virt: Enable booting S-mode firmware from pflash
41
58
42
Wilfred Mallawa (2):
59
Christoph Müllner (1):
43
hw/ssi: ibex_spi: fixup coverity issue
60
riscv: thead: Add th.sxstatus CSR emulation
44
hw/ssi: ibex_spi: fixup/add rw1c functionality
45
61
46
Yang Liu (1):
62
Clément Léger (1):
47
disas/riscv.c: rvv: Add disas support for vector instructions
63
target/riscv: change RISCV_EXCP_SEMIHOST exception number to 63
48
64
49
include/hw/nvram/fw_cfg.h | 21 +
65
Daniel Henrique Barboza (6):
50
include/hw/riscv/boot.h | 1 +
66
target/riscv/kvm: implement SBI debug console (DBCN) calls
51
include/hw/ssi/ibex_spi_host.h | 4 +-
67
target/riscv/kvm: tolerate KVM disable ext errors
52
disas/riscv.c | 1432 +++++++++++++++++++++++++++++++++++++++-
68
target/riscv/debug: set tval=pc in breakpoint exceptions
53
hw/arm/boot.c | 49 --
69
trans_privileged.c.inc: set (m|s)tval on ebreak breakpoint
54
hw/intc/sifive_plic.c | 25 +-
70
target/riscv: prioritize pmp errors in raise_mmu_exception()
55
hw/loongarch/virt.c | 33 -
71
riscv, gdbstub.c: fix reg_width in ricsv_gen_dynamic_vector_feature()
56
hw/nvram/fw_cfg.c | 32 +
72
57
hw/riscv/boot.c | 33 +-
73
Huang Tao (2):
58
hw/riscv/virt.c | 32 +-
74
target/riscv: Fix the element agnostic function problem
59
hw/ssi/ibex_spi_host.c | 166 +++--
75
target/riscv: Implement dynamic establishment of custom decoder
60
target/riscv/pmp.c | 12 +
76
61
12 files changed, 1675 insertions(+), 165 deletions(-)
77
Jason Chien (3):
78
target/riscv: Add support for Zve32x extension
79
target/riscv: Add support for Zve64x extension
80
target/riscv: Relax vector register check in RISCV gdbstub
81
82
Max Chou (4):
83
target/riscv: rvv: Fix Zvfhmin checking for vfwcvt.f.f.v and vfncvt.f.f.w instructions
84
target/riscv: rvv: Check single width operator for vector fp widen instructions
85
target/riscv: rvv: Check single width operator for vfncvt.rod.f.f.w
86
target/riscv: rvv: Remove redudant SEW checking for vector fp narrow/widen instructions
87
88
Rob Bradford (1):
89
target/riscv: Remove experimental prefix from "B" extension
90
91
Yangyu Chen (1):
92
target/riscv/cpu.c: fix Zvkb extension config
93
94
Yong-Xuan Wang (1):
95
target/riscv/kvm.c: Fix the hart bit setting of AIA
96
97
Yu-Ming Chang (1):
98
target/riscv: raise an exception when CSRRS/CSRRC writes a read-only CSR
99
100
yang.zhang (1):
101
hw/intc/riscv_aplic: APLICs should add child earlier than realize
102
103
MAINTAINERS | 1 +
104
target/riscv/cpu.h | 11 ++
105
target/riscv/cpu_bits.h | 2 +-
106
target/riscv/cpu_cfg.h | 2 +
107
target/riscv/helper.h | 1 +
108
target/riscv/sbi_ecall_interface.h | 17 +++
109
target/riscv/tcg/tcg-cpu.h | 15 +++
110
disas/riscv.c | 65 +++++++++-
111
hw/intc/riscv_aplic.c | 8 +-
112
hw/riscv/boot.c | 4 +-
113
target/riscv/cpu.c | 10 +-
114
target/riscv/cpu_helper.c | 37 +++---
115
target/riscv/csr.c | 71 +++++++++--
116
target/riscv/debug.c | 3 +
117
target/riscv/gdbstub.c | 8 +-
118
target/riscv/kvm/kvm-cpu.c | 157 ++++++++++++++++++++++++-
119
target/riscv/op_helper.c | 17 ++-
120
target/riscv/tcg/tcg-cpu.c | 50 +++++---
121
target/riscv/th_csr.c | 79 +++++++++++++
122
target/riscv/translate.c | 31 +++--
123
target/riscv/vector_internals.c | 22 ++++
124
target/riscv/insn_trans/trans_privileged.c.inc | 2 +
125
target/riscv/insn_trans/trans_rvv.c.inc | 46 +++++---
126
target/riscv/insn_trans/trans_rvzawrs.c.inc | 29 +++--
127
target/riscv/insn_trans/trans_rvzicbo.c.inc | 16 ++-
128
target/riscv/meson.build | 1 +
129
26 files changed, 596 insertions(+), 109 deletions(-)
130
create mode 100644 target/riscv/th_csr.c
131
diff view generated by jsdifflib
New patch
1
From: "yang.zhang" <yang.zhang@hexintek.com>
1
2
3
Since only root APLICs can have hw IRQ lines, aplic->parent should
4
be initialized first.
5
6
Fixes: e8f79343cf ("hw/intc: Add RISC-V AIA APLIC device emulation")
7
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
8
Signed-off-by: yang.zhang <yang.zhang@hexintek.com>
9
Cc: qemu-stable <qemu-stable@nongnu.org>
10
Message-ID: <20240409014445.278-1-gaoshanliukou@163.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
hw/intc/riscv_aplic.c | 8 ++++----
14
1 file changed, 4 insertions(+), 4 deletions(-)
15
16
diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/intc/riscv_aplic.c
19
+++ b/hw/intc/riscv_aplic.c
20
@@ -XXX,XX +XXX,XX @@ DeviceState *riscv_aplic_create(hwaddr addr, hwaddr size,
21
qdev_prop_set_bit(dev, "msimode", msimode);
22
qdev_prop_set_bit(dev, "mmode", mmode);
23
24
+ if (parent) {
25
+ riscv_aplic_add_child(parent, dev);
26
+ }
27
+
28
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
29
30
if (!is_kvm_aia(msimode)) {
31
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
32
}
33
34
- if (parent) {
35
- riscv_aplic_add_child(parent, dev);
36
- }
37
-
38
if (!msimode) {
39
for (i = 0; i < num_harts; i++) {
40
CPUState *cpu = cpu_by_arch_id(hartid_base + i);
41
--
42
2.45.1
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <ajones@ventanamicro.com>
1
2
3
The Zkr extension may only be exposed to KVM guests if the VMM
4
implements the SEED CSR. Use the same implementation as TCG.
5
6
Without this patch, running with a KVM which does not forward the
7
SEED CSR access to QEMU will result in an ILL exception being
8
injected into the guest (this results in Linux guests crashing on
9
boot). And, when running with a KVM which does forward the access,
10
QEMU will crash, since QEMU doesn't know what to do with the exit.
11
12
Fixes: 3108e2f1c69d ("target/riscv/kvm: update KVM exts to Linux 6.8")
13
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
14
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
15
Cc: qemu-stable <qemu-stable@nongnu.org>
16
Message-ID: <20240422134605.534207-2-ajones@ventanamicro.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
19
target/riscv/cpu.h | 3 +++
20
target/riscv/csr.c | 18 ++++++++++++++----
21
target/riscv/kvm/kvm-cpu.c | 25 +++++++++++++++++++++++++
22
3 files changed, 42 insertions(+), 4 deletions(-)
23
24
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/riscv/cpu.h
27
+++ b/target/riscv/cpu.h
28
@@ -XXX,XX +XXX,XX @@ void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops);
29
30
void riscv_cpu_register_gdb_regs_for_features(CPUState *cs);
31
32
+target_ulong riscv_new_csr_seed(target_ulong new_value,
33
+ target_ulong write_mask);
34
+
35
uint8_t satp_mode_max_from_map(uint32_t map);
36
const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
37
38
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/riscv/csr.c
41
+++ b/target/riscv/csr.c
42
@@ -XXX,XX +XXX,XX @@ static RISCVException write_upmbase(CPURISCVState *env, int csrno,
43
#endif
44
45
/* Crypto Extension */
46
-static RISCVException rmw_seed(CPURISCVState *env, int csrno,
47
- target_ulong *ret_value,
48
- target_ulong new_value,
49
- target_ulong write_mask)
50
+target_ulong riscv_new_csr_seed(target_ulong new_value,
51
+ target_ulong write_mask)
52
{
53
uint16_t random_v;
54
Error *random_e = NULL;
55
@@ -XXX,XX +XXX,XX @@ static RISCVException rmw_seed(CPURISCVState *env, int csrno,
56
rval = random_v | SEED_OPST_ES16;
57
}
58
59
+ return rval;
60
+}
61
+
62
+static RISCVException rmw_seed(CPURISCVState *env, int csrno,
63
+ target_ulong *ret_value,
64
+ target_ulong new_value,
65
+ target_ulong write_mask)
66
+{
67
+ target_ulong rval;
68
+
69
+ rval = riscv_new_csr_seed(new_value, write_mask);
70
+
71
if (ret_value) {
72
*ret_value = rval;
73
}
74
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/target/riscv/kvm/kvm-cpu.c
77
+++ b/target/riscv/kvm/kvm-cpu.c
78
@@ -XXX,XX +XXX,XX @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
79
return ret;
80
}
81
82
+static int kvm_riscv_handle_csr(CPUState *cs, struct kvm_run *run)
83
+{
84
+ target_ulong csr_num = run->riscv_csr.csr_num;
85
+ target_ulong new_value = run->riscv_csr.new_value;
86
+ target_ulong write_mask = run->riscv_csr.write_mask;
87
+ int ret = 0;
88
+
89
+ switch (csr_num) {
90
+ case CSR_SEED:
91
+ run->riscv_csr.ret_value = riscv_new_csr_seed(new_value, write_mask);
92
+ break;
93
+ default:
94
+ qemu_log_mask(LOG_UNIMP,
95
+ "%s: un-handled CSR EXIT for CSR %lx\n",
96
+ __func__, csr_num);
97
+ ret = -1;
98
+ break;
99
+ }
100
+
101
+ return ret;
102
+}
103
+
104
int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
105
{
106
int ret = 0;
107
@@ -XXX,XX +XXX,XX @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
108
case KVM_EXIT_RISCV_SBI:
109
ret = kvm_riscv_handle_sbi(cs, run);
110
break;
111
+ case KVM_EXIT_RISCV_CSR:
112
+ ret = kvm_riscv_handle_csr(cs, run);
113
+ break;
114
default:
115
qemu_log_mask(LOG_UNIMP, "%s: un-handled exit reason %d\n",
116
__func__, run->exit_reason);
117
--
118
2.45.1
diff view generated by jsdifflib
1
From: Sunil V L <sunilvl@ventanamicro.com>
1
From: Andrew Jones <ajones@ventanamicro.com>
2
2
3
To boot S-mode firmware payload like EDK2 from persistent
3
Implementing wrs.nto to always just return is consistent with the
4
flash storage, qemu needs to pass the flash address as the
4
specification, as the instruction is permitted to terminate the
5
next_addr in fw_dynamic_info to the opensbi.
5
stall for any reason, but it's not useful for virtualization, where
6
we'd like the guest to trap to the hypervisor in order to allow
7
scheduling of the lock holding VCPU. Change to always immediately
8
raise exceptions when the appropriate conditions are present,
9
otherwise continue to just return. Note, immediately raising
10
exceptions is also consistent with the specification since the
11
time limit that should expire prior to the exception is
12
implementation-specific.
6
13
7
When both -kernel and -pflash options are provided in command line,
14
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
8
the kernel (and initrd if -initrd) will be copied to fw_cfg table.
15
Reviewed-by: Christoph Müllner <christoph.muellner@vrull.eu>
9
The S-mode FW will load the kernel/initrd from fw_cfg table.
16
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
10
11
If only pflash is given but not -kernel, then it is the job of
12
of the S-mode firmware to locate and load the kernel.
13
14
In either case, update the kernel_entry with the flash address
15
so that the opensbi can jump to the entry point of the S-mode
16
firmware.
17
18
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
19
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
20
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
17
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
21
Message-Id: <20221004092351.18209-4-sunilvl@ventanamicro.com>
18
Message-ID: <20240424142808.62936-2-ajones@ventanamicro.com>
22
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
19
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
23
---
20
---
24
include/hw/riscv/boot.h | 1 +
21
target/riscv/helper.h | 1 +
25
hw/riscv/boot.c | 29 +++++++++++++++++++++++++++++
22
target/riscv/op_helper.c | 11 ++++++++
26
hw/riscv/virt.c | 18 +++++++++++++++++-
23
target/riscv/insn_trans/trans_rvzawrs.c.inc | 29 ++++++++++++++-------
27
3 files changed, 47 insertions(+), 1 deletion(-)
24
3 files changed, 32 insertions(+), 9 deletions(-)
28
25
29
diff --git a/include/hw/riscv/boot.h b/include/hw/riscv/boot.h
26
diff --git a/target/riscv/helper.h b/target/riscv/helper.h
30
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
31
--- a/include/hw/riscv/boot.h
28
--- a/target/riscv/helper.h
32
+++ b/include/hw/riscv/boot.h
29
+++ b/target/riscv/helper.h
33
@@ -XXX,XX +XXX,XX @@ void riscv_rom_copy_firmware_info(MachineState *machine, hwaddr rom_base,
30
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_6(csrrw_i128, tl, env, int, tl, tl, tl, tl)
34
uint32_t reset_vec_size,
31
DEF_HELPER_1(sret, tl, env)
35
uint64_t kernel_entry);
32
DEF_HELPER_1(mret, tl, env)
36
void riscv_setup_direct_kernel(hwaddr kernel_addr, hwaddr fdt_addr);
33
DEF_HELPER_1(wfi, void, env)
37
+void riscv_setup_firmware_boot(MachineState *machine);
34
+DEF_HELPER_1(wrs_nto, void, env)
38
35
DEF_HELPER_1(tlb_flush, void, env)
39
#endif /* RISCV_BOOT_H */
36
DEF_HELPER_1(tlb_flush_all, void, env)
40
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
37
/* Native Debug */
38
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
41
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/riscv/boot.c
40
--- a/target/riscv/op_helper.c
43
+++ b/hw/riscv/boot.c
41
+++ b/target/riscv/op_helper.c
44
@@ -XXX,XX +XXX,XX @@ void riscv_setup_direct_kernel(hwaddr kernel_addr, hwaddr fdt_addr)
42
@@ -XXX,XX +XXX,XX @@ void helper_wfi(CPURISCVState *env)
45
riscv_cpu->env.fdt_addr = fdt_addr;
46
}
43
}
47
}
44
}
48
+
45
49
+void riscv_setup_firmware_boot(MachineState *machine)
46
+void helper_wrs_nto(CPURISCVState *env)
50
+{
47
+{
51
+ if (machine->kernel_filename) {
48
+ if (env->virt_enabled && (env->priv == PRV_S || env->priv == PRV_U) &&
52
+ FWCfgState *fw_cfg;
49
+ get_field(env->hstatus, HSTATUS_VTW) &&
53
+ fw_cfg = fw_cfg_find();
50
+ !get_field(env->mstatus, MSTATUS_TW)) {
54
+
51
+ riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC());
55
+ assert(fw_cfg);
52
+ } else if (env->priv != PRV_M && get_field(env->mstatus, MSTATUS_TW)) {
56
+ /*
53
+ riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
57
+ * Expose the kernel, the command line, and the initrd in fw_cfg.
58
+ * We don't process them here at all, it's all left to the
59
+ * firmware.
60
+ */
61
+ load_image_to_fw_cfg(fw_cfg,
62
+ FW_CFG_KERNEL_SIZE, FW_CFG_KERNEL_DATA,
63
+ machine->kernel_filename,
64
+ true);
65
+ load_image_to_fw_cfg(fw_cfg,
66
+ FW_CFG_INITRD_SIZE, FW_CFG_INITRD_DATA,
67
+ machine->initrd_filename, false);
68
+
69
+ if (machine->kernel_cmdline) {
70
+ fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
71
+ strlen(machine->kernel_cmdline) + 1);
72
+ fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA,
73
+ machine->kernel_cmdline);
74
+ }
75
+ }
54
+ }
76
+}
55
+}
77
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
56
+
57
void helper_tlb_flush(CPURISCVState *env)
58
{
59
CPUState *cs = env_cpu(env);
60
diff --git a/target/riscv/insn_trans/trans_rvzawrs.c.inc b/target/riscv/insn_trans/trans_rvzawrs.c.inc
78
index XXXXXXX..XXXXXXX 100644
61
index XXXXXXX..XXXXXXX 100644
79
--- a/hw/riscv/virt.c
62
--- a/target/riscv/insn_trans/trans_rvzawrs.c.inc
80
+++ b/hw/riscv/virt.c
63
+++ b/target/riscv/insn_trans/trans_rvzawrs.c.inc
81
@@ -XXX,XX +XXX,XX @@ static void virt_machine_done(Notifier *notifier, void *data)
64
@@ -XXX,XX +XXX,XX @@
82
s->fw_cfg = create_fw_cfg(machine);
65
* this program. If not, see <http://www.gnu.org/licenses/>.
83
rom_set_fw(s->fw_cfg);
66
*/
84
67
85
- if (machine->kernel_filename) {
68
-static bool trans_wrs(DisasContext *ctx)
86
+ if (drive_get(IF_PFLASH, 0, 1)) {
69
+static bool trans_wrs_sto(DisasContext *ctx, arg_wrs_sto *a)
87
+ /*
70
{
88
+ * S-mode FW like EDK2 will be kept in second plash (unit 1).
71
if (!ctx->cfg_ptr->ext_zawrs) {
89
+ * When both kernel, initrd and pflash options are provided in the
72
return false;
90
+ * command line, the kernel and initrd will be copied to the fw_cfg
73
@@ -XXX,XX +XXX,XX @@ static bool trans_wrs(DisasContext *ctx)
91
+ * table and opensbi will jump to the flash address which is the
74
return true;
92
+ * entry point of S-mode FW. It is the job of the S-mode FW to load
75
}
93
+ * the kernel and initrd using fw_cfg table.
76
94
+ *
77
-#define GEN_TRANS_WRS(insn) \
95
+ * If only pflash is given but not -kernel, then it is the job of
78
-static bool trans_ ## insn(DisasContext *ctx, arg_ ## insn *a) \
96
+ * of the S-mode firmware to locate and load the kernel.
79
-{ \
97
+ * In either case, the next_addr for opensbi will be the flash address.
80
- (void)a; \
98
+ */
81
- return trans_wrs(ctx); \
99
+ riscv_setup_firmware_boot(machine);
82
-}
100
+ kernel_entry = virt_memmap[VIRT_FLASH].base +
83
+static bool trans_wrs_nto(DisasContext *ctx, arg_wrs_nto *a)
101
+ virt_memmap[VIRT_FLASH].size / 2;
84
+{
102
+ } else if (machine->kernel_filename) {
85
+ if (!ctx->cfg_ptr->ext_zawrs) {
103
kernel_start_addr = riscv_calc_kernel_start_addr(&s->soc[0],
86
+ return false;
104
firmware_end_addr);
87
+ }
105
88
89
-GEN_TRANS_WRS(wrs_nto)
90
-GEN_TRANS_WRS(wrs_sto)
91
+ /*
92
+ * Depending on the mode of execution, mstatus.TW and hstatus.VTW, wrs.nto
93
+ * should raise an exception when the implementation-specific bounded time
94
+ * limit has expired. Our time limit is zero, so we either return
95
+ * immediately, as does our implementation of wrs.sto, or raise an
96
+ * exception, as handled by the wrs.nto helper.
97
+ */
98
+#ifndef CONFIG_USER_ONLY
99
+ gen_helper_wrs_nto(tcg_env);
100
+#endif
101
+
102
+ /* We only get here when helper_wrs_nto() doesn't raise an exception. */
103
+ return trans_wrs_sto(ctx, NULL);
104
+}
106
--
105
--
107
2.37.3
106
2.45.1
107
108
diff view generated by jsdifflib
New patch
1
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2
3
SBI defines a Debug Console extension "DBCN" that will, in time, replace
4
the legacy console putchar and getchar SBI extensions.
5
6
The appeal of the DBCN extension is that it allows multiple bytes to be
7
read/written in the SBI console in a single SBI call.
8
9
As far as KVM goes, the DBCN calls are forwarded by an in-kernel KVM
10
module to userspace. But this will only happens if the KVM module
11
actually supports this SBI extension and we activate it.
12
13
We'll check for DBCN support during init time, checking if get-reg-list
14
is advertising KVM_RISCV_SBI_EXT_DBCN. In that case, we'll enable it via
15
kvm_set_one_reg() during kvm_arch_init_vcpu().
16
17
Finally, change kvm_riscv_handle_sbi() to handle the incoming calls for
18
SBI_EXT_DBCN, reading and writing as required.
19
20
A simple KVM guest with 'earlycon=sbi', running in an emulated RISC-V
21
host, takes around 20 seconds to boot without using DBCN. With this
22
patch we're taking around 14 seconds to boot due to the speed-up in the
23
terminal output. There's no change in boot time if the guest isn't
24
using earlycon.
25
26
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
27
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
28
Message-ID: <20240425155012.581366-1-dbarboza@ventanamicro.com>
29
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
30
---
31
target/riscv/sbi_ecall_interface.h | 17 +++++
32
target/riscv/kvm/kvm-cpu.c | 111 +++++++++++++++++++++++++++++
33
2 files changed, 128 insertions(+)
34
35
diff --git a/target/riscv/sbi_ecall_interface.h b/target/riscv/sbi_ecall_interface.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/riscv/sbi_ecall_interface.h
38
+++ b/target/riscv/sbi_ecall_interface.h
39
@@ -XXX,XX +XXX,XX @@
40
41
/* clang-format off */
42
43
+#define SBI_SUCCESS 0
44
+#define SBI_ERR_FAILED -1
45
+#define SBI_ERR_NOT_SUPPORTED -2
46
+#define SBI_ERR_INVALID_PARAM -3
47
+#define SBI_ERR_DENIED -4
48
+#define SBI_ERR_INVALID_ADDRESS -5
49
+#define SBI_ERR_ALREADY_AVAILABLE -6
50
+#define SBI_ERR_ALREADY_STARTED -7
51
+#define SBI_ERR_ALREADY_STOPPED -8
52
+#define SBI_ERR_NO_SHMEM -9
53
+
54
/* SBI Extension IDs */
55
#define SBI_EXT_0_1_SET_TIMER 0x0
56
#define SBI_EXT_0_1_CONSOLE_PUTCHAR 0x1
57
@@ -XXX,XX +XXX,XX @@
58
#define SBI_EXT_IPI 0x735049
59
#define SBI_EXT_RFENCE 0x52464E43
60
#define SBI_EXT_HSM 0x48534D
61
+#define SBI_EXT_DBCN 0x4442434E
62
63
/* SBI function IDs for BASE extension */
64
#define SBI_EXT_BASE_GET_SPEC_VERSION 0x0
65
@@ -XXX,XX +XXX,XX @@
66
#define SBI_EXT_HSM_HART_STOP 0x1
67
#define SBI_EXT_HSM_HART_GET_STATUS 0x2
68
69
+/* SBI function IDs for DBCN extension */
70
+#define SBI_EXT_DBCN_CONSOLE_WRITE 0x0
71
+#define SBI_EXT_DBCN_CONSOLE_READ 0x1
72
+#define SBI_EXT_DBCN_CONSOLE_WRITE_BYTE 0x2
73
+
74
#define SBI_HSM_HART_STATUS_STARTED 0x0
75
#define SBI_HSM_HART_STATUS_STOPPED 0x1
76
#define SBI_HSM_HART_STATUS_START_PENDING 0x2
77
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/riscv/kvm/kvm-cpu.c
80
+++ b/target/riscv/kvm/kvm-cpu.c
81
@@ -XXX,XX +XXX,XX @@ static KVMCPUConfig kvm_v_vlenb = {
82
KVM_REG_RISCV_VECTOR_CSR_REG(vlenb)
83
};
84
85
+static KVMCPUConfig kvm_sbi_dbcn = {
86
+ .name = "sbi_dbcn",
87
+ .kvm_reg_id = KVM_REG_RISCV | KVM_REG_SIZE_U64 |
88
+ KVM_REG_RISCV_SBI_EXT | KVM_RISCV_SBI_EXT_DBCN
89
+};
90
+
91
static void kvm_riscv_update_cpu_cfg_isa_ext(RISCVCPU *cpu, CPUState *cs)
92
{
93
CPURISCVState *env = &cpu->env;
94
@@ -XXX,XX +XXX,XX @@ static int uint64_cmp(const void *a, const void *b)
95
return 0;
96
}
97
98
+static void kvm_riscv_check_sbi_dbcn_support(RISCVCPU *cpu,
99
+ KVMScratchCPU *kvmcpu,
100
+ struct kvm_reg_list *reglist)
101
+{
102
+ struct kvm_reg_list *reg_search;
103
+
104
+ reg_search = bsearch(&kvm_sbi_dbcn.kvm_reg_id, reglist->reg, reglist->n,
105
+ sizeof(uint64_t), uint64_cmp);
106
+
107
+ if (reg_search) {
108
+ kvm_sbi_dbcn.supported = true;
109
+ }
110
+}
111
+
112
static void kvm_riscv_read_vlenb(RISCVCPU *cpu, KVMScratchCPU *kvmcpu,
113
struct kvm_reg_list *reglist)
114
{
115
@@ -XXX,XX +XXX,XX @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu, KVMScratchCPU *kvmcpu)
116
if (riscv_has_ext(&cpu->env, RVV)) {
117
kvm_riscv_read_vlenb(cpu, kvmcpu, reglist);
118
}
119
+
120
+ kvm_riscv_check_sbi_dbcn_support(cpu, kvmcpu, reglist);
121
}
122
123
static void riscv_init_kvm_registers(Object *cpu_obj)
124
@@ -XXX,XX +XXX,XX @@ static int kvm_vcpu_set_machine_ids(RISCVCPU *cpu, CPUState *cs)
125
return ret;
126
}
127
128
+static int kvm_vcpu_enable_sbi_dbcn(RISCVCPU *cpu, CPUState *cs)
129
+{
130
+ target_ulong reg = 1;
131
+
132
+ if (!kvm_sbi_dbcn.supported) {
133
+ return 0;
134
+ }
135
+
136
+ return kvm_set_one_reg(cs, kvm_sbi_dbcn.kvm_reg_id, &reg);
137
+}
138
+
139
int kvm_arch_init_vcpu(CPUState *cs)
140
{
141
int ret = 0;
142
@@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs)
143
kvm_riscv_update_cpu_misa_ext(cpu, cs);
144
kvm_riscv_update_cpu_cfg_isa_ext(cpu, cs);
145
146
+ ret = kvm_vcpu_enable_sbi_dbcn(cpu, cs);
147
+
148
return ret;
149
}
150
151
@@ -XXX,XX +XXX,XX @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs)
152
return true;
153
}
154
155
+static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
156
+{
157
+ g_autofree uint8_t *buf = NULL;
158
+ RISCVCPU *cpu = RISCV_CPU(cs);
159
+ target_ulong num_bytes;
160
+ uint64_t addr;
161
+ unsigned char ch;
162
+ int ret;
163
+
164
+ switch (run->riscv_sbi.function_id) {
165
+ case SBI_EXT_DBCN_CONSOLE_READ:
166
+ case SBI_EXT_DBCN_CONSOLE_WRITE:
167
+ num_bytes = run->riscv_sbi.args[0];
168
+
169
+ if (num_bytes == 0) {
170
+ run->riscv_sbi.ret[0] = SBI_SUCCESS;
171
+ run->riscv_sbi.ret[1] = 0;
172
+ break;
173
+ }
174
+
175
+ addr = run->riscv_sbi.args[1];
176
+
177
+ /*
178
+ * Handle the case where a 32 bit CPU is running in a
179
+ * 64 bit addressing env.
180
+ */
181
+ if (riscv_cpu_mxl(&cpu->env) == MXL_RV32) {
182
+ addr |= (uint64_t)run->riscv_sbi.args[2] << 32;
183
+ }
184
+
185
+ buf = g_malloc0(num_bytes);
186
+
187
+ if (run->riscv_sbi.function_id == SBI_EXT_DBCN_CONSOLE_READ) {
188
+ ret = qemu_chr_fe_read_all(serial_hd(0)->be, buf, num_bytes);
189
+ if (ret < 0) {
190
+ error_report("SBI_EXT_DBCN_CONSOLE_READ: error when "
191
+ "reading chardev");
192
+ exit(1);
193
+ }
194
+
195
+ cpu_physical_memory_write(addr, buf, ret);
196
+ } else {
197
+ cpu_physical_memory_read(addr, buf, num_bytes);
198
+
199
+ ret = qemu_chr_fe_write_all(serial_hd(0)->be, buf, num_bytes);
200
+ if (ret < 0) {
201
+ error_report("SBI_EXT_DBCN_CONSOLE_WRITE: error when "
202
+ "writing chardev");
203
+ exit(1);
204
+ }
205
+ }
206
+
207
+ run->riscv_sbi.ret[0] = SBI_SUCCESS;
208
+ run->riscv_sbi.ret[1] = ret;
209
+ break;
210
+ case SBI_EXT_DBCN_CONSOLE_WRITE_BYTE:
211
+ ch = run->riscv_sbi.args[0];
212
+ ret = qemu_chr_fe_write(serial_hd(0)->be, &ch, sizeof(ch));
213
+
214
+ if (ret < 0) {
215
+ error_report("SBI_EXT_DBCN_CONSOLE_WRITE_BYTE: error when "
216
+ "writing chardev");
217
+ exit(1);
218
+ }
219
+
220
+ run->riscv_sbi.ret[0] = SBI_SUCCESS;
221
+ run->riscv_sbi.ret[1] = 0;
222
+ break;
223
+ default:
224
+ run->riscv_sbi.ret[0] = SBI_ERR_NOT_SUPPORTED;
225
+ }
226
+}
227
+
228
static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
229
{
230
int ret = 0;
231
@@ -XXX,XX +XXX,XX @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
232
}
233
ret = 0;
234
break;
235
+ case SBI_EXT_DBCN:
236
+ kvm_riscv_handle_sbi_dbcn(cs, run);
237
+ break;
238
default:
239
qemu_log_mask(LOG_UNIMP,
240
"%s: un-handled SBI EXIT, specific reasons is %lu\n",
241
--
242
2.45.1
diff view generated by jsdifflib
1
From: Bin Meng <bmeng.cn@gmail.com>
1
From: Cheng Yang <yangcheng.work@foxmail.com>
2
2
3
Since commit 4211fc553234 ("roms/opensbi: Remove ELF images"), the
3
Use qemu_fdt_setprop_u64() instead of qemu_fdt_setprop_cell()
4
comment for qtest check in riscv_find_firmware() is out of date.
4
to set the address of initrd in FDT to support 64-bit address.
5
Update it to reflect the latest status.
6
5
7
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6
Signed-off-by: Cheng Yang <yangcheng.work@foxmail.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-Id: <BN7PR08MB435525C92550BAC5467BE672BF219@BN7PR08MB4355.namprd08.prod.outlook.com>
8
Message-ID: <tencent_A4482251DD0890F312758FA6B33F60815609@qq.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
10
---
12
hw/riscv/boot.c | 4 ++--
11
hw/riscv/boot.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
12
1 file changed, 2 insertions(+), 2 deletions(-)
14
13
15
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
14
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/riscv/boot.c
16
--- a/hw/riscv/boot.c
18
+++ b/hw/riscv/boot.c
17
+++ b/hw/riscv/boot.c
19
@@ -XXX,XX +XXX,XX @@ char *riscv_find_firmware(const char *firmware_filename)
18
@@ -XXX,XX +XXX,XX @@ static void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
20
if (filename == NULL) {
19
/* Some RISC-V machines (e.g. opentitan) don't have a fdt. */
21
if (!qtest_enabled()) {
20
if (fdt) {
22
/*
21
end = start + size;
23
- * We only ship plain binary bios images in the QEMU source.
22
- qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start", start);
24
- * With Spike machine that uses ELF images as the default bios,
23
- qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", end);
25
+ * We only ship OpenSBI binary bios images in the QEMU source.
24
+ qemu_fdt_setprop_u64(fdt, "/chosen", "linux,initrd-start", start);
26
+ * For machines that use images other than the default bios,
25
+ qemu_fdt_setprop_u64(fdt, "/chosen", "linux,initrd-end", end);
27
* running QEMU test will complain hence let's suppress the error
26
}
28
* report for QEMU testing.
27
}
29
*/
28
30
--
29
--
31
2.37.3
30
2.45.1
diff view generated by jsdifflib
New patch
1
From: Clément Léger <cleger@rivosinc.com>
1
2
3
The current semihost exception number (16) is a reserved number (range
4
[16-17]). The upcoming double trap specification uses that number for
5
the double trap exception. Since the privileged spec (Table 22) defines
6
ranges for custom uses change the semihosting exception number to 63
7
which belongs to the range [48-63] in order to avoid any future
8
collisions with reserved exception.
9
10
Signed-off-by: Clément Léger <cleger@rivosinc.com>
11
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Message-ID: <20240422135840.1959967-1-cleger@rivosinc.com>
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
---
16
target/riscv/cpu_bits.h | 2 +-
17
1 file changed, 1 insertion(+), 1 deletion(-)
18
19
diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/riscv/cpu_bits.h
22
+++ b/target/riscv/cpu_bits.h
23
@@ -XXX,XX +XXX,XX @@ typedef enum RISCVException {
24
RISCV_EXCP_INST_PAGE_FAULT = 0xc, /* since: priv-1.10.0 */
25
RISCV_EXCP_LOAD_PAGE_FAULT = 0xd, /* since: priv-1.10.0 */
26
RISCV_EXCP_STORE_PAGE_FAULT = 0xf, /* since: priv-1.10.0 */
27
- RISCV_EXCP_SEMIHOST = 0x10,
28
RISCV_EXCP_INST_GUEST_PAGE_FAULT = 0x14,
29
RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT = 0x15,
30
RISCV_EXCP_VIRT_INSTRUCTION_FAULT = 0x16,
31
RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT = 0x17,
32
+ RISCV_EXCP_SEMIHOST = 0x3f,
33
} RISCVException;
34
35
#define RISCV_EXCP_INT_FLAG 0x80000000
36
--
37
2.45.1
38
39
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Running a KVM guest using a 6.9-rc3 kernel, in a 6.8 host that has zkr
4
enabled, will fail with a kernel oops SIGILL right at the start. The
5
reason is that we can't expose zkr without implementing the SEED CSR.
6
Disabling zkr in the guest would be a workaround, but if the KVM doesn't
7
allow it we'll error out and never boot.
8
9
In hindsight this is too strict. If we keep proceeding, despite not
10
disabling the extension in the KVM vcpu, we'll not add the extension in
11
the riscv,isa. The guest kernel will be unaware of the extension, i.e.
12
it doesn't matter if the KVM vcpu has it enabled underneath or not. So
13
it's ok to keep booting in this case.
14
15
Change our current logic to not error out if we fail to disable an
16
extension in kvm_set_one_reg(), but show a warning and keep booting. It
17
is important to throw a warning because we must make the user aware that
18
the extension is still available in the vcpu, meaning that an
19
ill-behaved guest can ignore the riscv,isa settings and use the
20
extension.
21
22
The case we're handling happens with an EINVAL error code. If we fail to
23
disable the extension in KVM for any other reason, error out.
24
25
We'll also keep erroring out when we fail to enable an extension in KVM,
26
since adding the extension in riscv,isa at this point will cause a guest
27
malfunction because the extension isn't enabled in the vcpu.
28
29
Suggested-by: Andrew Jones <ajones@ventanamicro.com>
30
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
31
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
32
Cc: qemu-stable <qemu-stable@nongnu.org>
33
Message-ID: <20240422171425.333037-2-dbarboza@ventanamicro.com>
34
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
35
---
36
target/riscv/kvm/kvm-cpu.c | 12 ++++++++----
37
1 file changed, 8 insertions(+), 4 deletions(-)
38
39
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/riscv/kvm/kvm-cpu.c
42
+++ b/target/riscv/kvm/kvm-cpu.c
43
@@ -XXX,XX +XXX,XX @@ static void kvm_riscv_update_cpu_cfg_isa_ext(RISCVCPU *cpu, CPUState *cs)
44
reg = kvm_cpu_cfg_get(cpu, multi_ext_cfg);
45
ret = kvm_set_one_reg(cs, id, &reg);
46
if (ret != 0) {
47
- error_report("Unable to %s extension %s in KVM, error %d",
48
- reg ? "enable" : "disable",
49
- multi_ext_cfg->name, ret);
50
- exit(EXIT_FAILURE);
51
+ if (!reg && ret == -EINVAL) {
52
+ warn_report("KVM cannot disable extension %s",
53
+ multi_ext_cfg->name);
54
+ } else {
55
+ error_report("Unable to enable extension %s in KVM, error %d",
56
+ multi_ext_cfg->name, ret);
57
+ exit(EXIT_FAILURE);
58
+ }
59
}
60
}
61
}
62
--
63
2.45.1
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
We're not setting (s/m)tval when triggering breakpoints of type 2
4
(mcontrol) and 6 (mcontrol6). According to the debug spec section
5
5.7.12, "Match Control Type 6":
6
7
"The Privileged Spec says that breakpoint exceptions that occur on
8
instruction fetches, loads, or stores update the tval CSR with either
9
zero or the faulting virtual address. The faulting virtual address for
10
an mcontrol6 trigger with action = 0 is the address being accessed and
11
which caused that trigger to fire."
12
13
A similar text is also found in the Debug spec section 5.7.11 w.r.t.
14
mcontrol.
15
16
Note that what we're doing ATM is not violating the spec, but it's
17
simple enough to set mtval/stval and it makes life easier for any
18
software that relies on this info.
19
20
Given that we always use action = 0, save the faulting address for the
21
mcontrol and mcontrol6 trigger breakpoints into env->badaddr, which is
22
used as as scratch area for traps with address information. 'tval' is
23
then set during riscv_cpu_do_interrupt().
24
25
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
26
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
27
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
28
Message-ID: <20240416230437.1869024-2-dbarboza@ventanamicro.com>
29
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
30
---
31
target/riscv/cpu_helper.c | 1 +
32
target/riscv/debug.c | 3 +++
33
2 files changed, 4 insertions(+)
34
35
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/riscv/cpu_helper.c
38
+++ b/target/riscv/cpu_helper.c
39
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
40
tval = env->bins;
41
break;
42
case RISCV_EXCP_BREAKPOINT:
43
+ tval = env->badaddr;
44
if (cs->watchpoint_hit) {
45
tval = cs->watchpoint_hit->hitaddr;
46
cs->watchpoint_hit = NULL;
47
diff --git a/target/riscv/debug.c b/target/riscv/debug.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/riscv/debug.c
50
+++ b/target/riscv/debug.c
51
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs)
52
if ((ctrl & TYPE2_EXEC) && (bp->pc == pc)) {
53
/* check U/S/M bit against current privilege level */
54
if ((ctrl >> 3) & BIT(env->priv)) {
55
+ env->badaddr = pc;
56
return true;
57
}
58
}
59
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs)
60
if (env->virt_enabled) {
61
/* check VU/VS bit against current privilege level */
62
if ((ctrl >> 23) & BIT(env->priv)) {
63
+ env->badaddr = pc;
64
return true;
65
}
66
} else {
67
/* check U/S/M bit against current privilege level */
68
if ((ctrl >> 3) & BIT(env->priv)) {
69
+ env->badaddr = pc;
70
return true;
71
}
72
}
73
--
74
2.45.1
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Privileged spec section 4.1.9 mentions:
4
5
"When a trap is taken into S-mode, stval is written with
6
exception-specific information to assist software in handling the trap.
7
(...)
8
9
If stval is written with a nonzero value when a breakpoint,
10
address-misaligned, access-fault, or page-fault exception occurs on an
11
instruction fetch, load, or store, then stval will contain the faulting
12
virtual address."
13
14
A similar text is found for mtval in section 3.1.16.
15
16
Setting mtval/stval in this scenario is optional, but some softwares read
17
these regs when handling ebreaks.
18
19
Write 'badaddr' in all ebreak breakpoints to write the appropriate
20
'tval' during riscv_do_cpu_interrrupt().
21
22
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
23
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
24
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
25
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
26
Message-ID: <20240416230437.1869024-3-dbarboza@ventanamicro.com>
27
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
28
---
29
target/riscv/insn_trans/trans_privileged.c.inc | 2 ++
30
1 file changed, 2 insertions(+)
31
32
diff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/riscv/insn_trans/trans_privileged.c.inc
35
+++ b/target/riscv/insn_trans/trans_privileged.c.inc
36
@@ -XXX,XX +XXX,XX @@ static bool trans_ebreak(DisasContext *ctx, arg_ebreak *a)
37
if (pre == 0x01f01013 && ebreak == 0x00100073 && post == 0x40705013) {
38
generate_exception(ctx, RISCV_EXCP_SEMIHOST);
39
} else {
40
+ tcg_gen_st_tl(tcg_constant_tl(ebreak_addr), tcg_env,
41
+ offsetof(CPURISCVState, badaddr));
42
generate_exception(ctx, RISCV_EXCP_BREAKPOINT);
43
}
44
return true;
45
--
46
2.45.1
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@wdc.com>
1
From: Jason Chien <jason.chien@sifive.com>
2
2
3
Since commit 4047368938f6 "accel/tcg: Introduce tlb_set_page_full" we
3
Add support for Zve32x extension and replace some checks for Zve32f with
4
have been seeing this assert
4
Zve32x, since Zve32f depends on Zve32x.
5
5
6
../accel/tcg/cputlb.c:1294: tlb_set_page_with_attrs: Assertion `is_power_of_2(size)' failed.
6
Signed-off-by: Jason Chien <jason.chien@sifive.com>
7
Reviewed-by: Frank Chang <frank.chang@sifive.com>
8
Reviewed-by: Max Chou <max.chou@sifive.com>
9
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
10
Message-ID: <20240328022343.6871-2-jason.chien@sifive.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/cpu_cfg.h | 1 +
14
target/riscv/cpu.c | 2 ++
15
target/riscv/cpu_helper.c | 2 +-
16
target/riscv/csr.c | 2 +-
17
target/riscv/tcg/tcg-cpu.c | 16 ++++++++--------
18
target/riscv/insn_trans/trans_rvv.c.inc | 4 ++--
19
6 files changed, 15 insertions(+), 12 deletions(-)
7
20
8
When running Tock on the OpenTitan machine.
21
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
9
10
The issue is that pmp_get_tlb_size() would return a TLB size that wasn't
11
a power of 2. The size was also smaller then TARGET_PAGE_SIZE.
12
13
This patch ensures that any TLB size less then TARGET_PAGE_SIZE is
14
rounded down to 1 to ensure it's a valid size.
15
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
Reviewed-by: LIU Zhiwei<zhiwei_liu@linux.alibaba.com>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Message-id: 20221012011449.506928-1-alistair.francis@opensource.wdc.com
20
Message-Id: <20221012011449.506928-1-alistair.francis@opensource.wdc.com>
21
---
22
target/riscv/pmp.c | 12 ++++++++++++
23
1 file changed, 12 insertions(+)
24
25
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
26
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
27
--- a/target/riscv/pmp.c
23
--- a/target/riscv/cpu_cfg.h
28
+++ b/target/riscv/pmp.c
24
+++ b/target/riscv/cpu_cfg.h
29
@@ -XXX,XX +XXX,XX @@ bool pmp_is_range_in_tlb(CPURISCVState *env, hwaddr tlb_sa,
25
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
26
bool ext_zhinx;
27
bool ext_zhinxmin;
28
bool ext_zve32f;
29
+ bool ext_zve32x;
30
bool ext_zve64f;
31
bool ext_zve64d;
32
bool ext_zvbb;
33
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/riscv/cpu.c
36
+++ b/target/riscv/cpu.c
37
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
38
ISA_EXT_DATA_ENTRY(zvbb, PRIV_VERSION_1_12_0, ext_zvbb),
39
ISA_EXT_DATA_ENTRY(zvbc, PRIV_VERSION_1_12_0, ext_zvbc),
40
ISA_EXT_DATA_ENTRY(zve32f, PRIV_VERSION_1_10_0, ext_zve32f),
41
+ ISA_EXT_DATA_ENTRY(zve32x, PRIV_VERSION_1_10_0, ext_zve32x),
42
ISA_EXT_DATA_ENTRY(zve64f, PRIV_VERSION_1_10_0, ext_zve64f),
43
ISA_EXT_DATA_ENTRY(zve64d, PRIV_VERSION_1_10_0, ext_zve64d),
44
ISA_EXT_DATA_ENTRY(zvfbfmin, PRIV_VERSION_1_12_0, ext_zvfbfmin),
45
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
46
MULTI_EXT_CFG_BOOL("zfh", ext_zfh, false),
47
MULTI_EXT_CFG_BOOL("zfhmin", ext_zfhmin, false),
48
MULTI_EXT_CFG_BOOL("zve32f", ext_zve32f, false),
49
+ MULTI_EXT_CFG_BOOL("zve32x", ext_zve32x, false),
50
MULTI_EXT_CFG_BOOL("zve64f", ext_zve64f, false),
51
MULTI_EXT_CFG_BOOL("zve64d", ext_zve64d, false),
52
MULTI_EXT_CFG_BOOL("zvfbfmin", ext_zvfbfmin, false),
53
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/target/riscv/cpu_helper.c
56
+++ b/target/riscv/cpu_helper.c
57
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc,
58
*pc = env->xl == MXL_RV32 ? env->pc & UINT32_MAX : env->pc;
59
*cs_base = 0;
60
61
- if (cpu->cfg.ext_zve32f) {
62
+ if (cpu->cfg.ext_zve32x) {
63
/*
64
* If env->vl equals to VLMAX, we can use generic vector operation
65
* expanders (GVEC) to accerlate the vector operations.
66
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/riscv/csr.c
69
+++ b/target/riscv/csr.c
70
@@ -XXX,XX +XXX,XX @@ static RISCVException fs(CPURISCVState *env, int csrno)
71
72
static RISCVException vs(CPURISCVState *env, int csrno)
73
{
74
- if (riscv_cpu_cfg(env)->ext_zve32f) {
75
+ if (riscv_cpu_cfg(env)->ext_zve32x) {
76
#if !defined(CONFIG_USER_ONLY)
77
if (!env->debugger && !riscv_cpu_vector_enabled(env)) {
78
return RISCV_EXCP_ILLEGAL_INST;
79
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/target/riscv/tcg/tcg-cpu.c
82
+++ b/target/riscv/tcg/tcg-cpu.c
83
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
84
return;
30
}
85
}
31
86
32
if (*tlb_size != 0) {
87
- if (cpu->cfg.ext_zve32f && !riscv_has_ext(env, RVF)) {
33
+ /*
88
- error_setg(errp, "Zve32f/Zve64f extensions require F extension");
34
+ * At this point we have a tlb_size that is the smallest possible size
89
- return;
35
+ * That fits within a TARGET_PAGE_SIZE and the PMP region.
90
+ /* The Zve32f extension depends on the Zve32x extension */
36
+ *
91
+ if (cpu->cfg.ext_zve32f) {
37
+ * If the size is less then TARGET_PAGE_SIZE we drop the size to 1.
92
+ if (!riscv_has_ext(env, RVF)) {
38
+ * This means the result isn't cached in the TLB and is only used for
93
+ error_setg(errp, "Zve32f/Zve64f extensions require F extension");
39
+ * a single translation.
94
+ return;
40
+ */
41
+ if (*tlb_size < TARGET_PAGE_SIZE) {
42
+ *tlb_size = 1;
43
+ }
95
+ }
44
+
96
+ cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true);
45
return true;
46
}
97
}
47
98
99
if (cpu->cfg.ext_zvfh) {
100
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
101
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zvbc), true);
102
}
103
104
- /*
105
- * In principle Zve*x would also suffice here, were they supported
106
- * in qemu
107
- */
108
if ((cpu->cfg.ext_zvbb || cpu->cfg.ext_zvkb || cpu->cfg.ext_zvkg ||
109
cpu->cfg.ext_zvkned || cpu->cfg.ext_zvknha || cpu->cfg.ext_zvksed ||
110
- cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32f) {
111
+ cpu->cfg.ext_zvksh) && !cpu->cfg.ext_zve32x) {
112
error_setg(errp,
113
"Vector crypto extensions require V or Zve* extensions");
114
return;
115
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
116
index XXXXXXX..XXXXXXX 100644
117
--- a/target/riscv/insn_trans/trans_rvv.c.inc
118
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
119
@@ -XXX,XX +XXX,XX @@ static bool do_vsetvl(DisasContext *s, int rd, int rs1, TCGv s2)
120
{
121
TCGv s1, dst;
122
123
- if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) {
124
+ if (!require_rvv(s) || !s->cfg_ptr->ext_zve32x) {
125
return false;
126
}
127
128
@@ -XXX,XX +XXX,XX @@ static bool do_vsetivli(DisasContext *s, int rd, TCGv s1, TCGv s2)
129
{
130
TCGv dst;
131
132
- if (!require_rvv(s) || !s->cfg_ptr->ext_zve32f) {
133
+ if (!require_rvv(s) || !s->cfg_ptr->ext_zve32x) {
134
return false;
135
}
136
48
--
137
--
49
2.37.3
138
2.45.1
diff view generated by jsdifflib
1
From: Sunil V L <sunilvl@ventanamicro.com>
1
From: Jason Chien <jason.chien@sifive.com>
2
2
3
To enable both -kernel and -pflash options, the fw_cfg needs to be
3
Add support for Zve64x extension. Enabling Zve64f enables Zve64x and
4
created prior to loading the kernel.
4
enabling Zve64x enables Zve32x according to their dependency.
5
5
6
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
6
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2107
7
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
7
Signed-off-by: Jason Chien <jason.chien@sifive.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Frank Chang <frank.chang@sifive.com>
9
Message-Id: <20221004092351.18209-3-sunilvl@ventanamicro.com>
9
Reviewed-by: Max Chou <max.chou@sifive.com>
10
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
11
Message-ID: <20240328022343.6871-3-jason.chien@sifive.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
13
---
12
hw/riscv/virt.c | 14 +++++++-------
14
target/riscv/cpu_cfg.h | 1 +
13
1 file changed, 7 insertions(+), 7 deletions(-)
15
target/riscv/cpu.c | 2 ++
16
target/riscv/tcg/tcg-cpu.c | 17 +++++++++++------
17
3 files changed, 14 insertions(+), 6 deletions(-)
14
18
15
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
19
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/riscv/virt.c
21
--- a/target/riscv/cpu_cfg.h
18
+++ b/hw/riscv/virt.c
22
+++ b/target/riscv/cpu_cfg.h
19
@@ -XXX,XX +XXX,XX @@ static void virt_machine_done(Notifier *notifier, void *data)
23
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
20
RISCV64_BIOS_BIN, start_addr, NULL);
24
bool ext_zve32x;
25
bool ext_zve64f;
26
bool ext_zve64d;
27
+ bool ext_zve64x;
28
bool ext_zvbb;
29
bool ext_zvbc;
30
bool ext_zvkb;
31
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/target/riscv/cpu.c
34
+++ b/target/riscv/cpu.c
35
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
36
ISA_EXT_DATA_ENTRY(zve32x, PRIV_VERSION_1_10_0, ext_zve32x),
37
ISA_EXT_DATA_ENTRY(zve64f, PRIV_VERSION_1_10_0, ext_zve64f),
38
ISA_EXT_DATA_ENTRY(zve64d, PRIV_VERSION_1_10_0, ext_zve64d),
39
+ ISA_EXT_DATA_ENTRY(zve64x, PRIV_VERSION_1_10_0, ext_zve64x),
40
ISA_EXT_DATA_ENTRY(zvfbfmin, PRIV_VERSION_1_12_0, ext_zvfbfmin),
41
ISA_EXT_DATA_ENTRY(zvfbfwma, PRIV_VERSION_1_12_0, ext_zvfbfwma),
42
ISA_EXT_DATA_ENTRY(zvfh, PRIV_VERSION_1_12_0, ext_zvfh),
43
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
44
MULTI_EXT_CFG_BOOL("zve32x", ext_zve32x, false),
45
MULTI_EXT_CFG_BOOL("zve64f", ext_zve64f, false),
46
MULTI_EXT_CFG_BOOL("zve64d", ext_zve64d, false),
47
+ MULTI_EXT_CFG_BOOL("zve64x", ext_zve64x, false),
48
MULTI_EXT_CFG_BOOL("zvfbfmin", ext_zvfbfmin, false),
49
MULTI_EXT_CFG_BOOL("zvfbfwma", ext_zvfbfwma, false),
50
MULTI_EXT_CFG_BOOL("zvfh", ext_zvfh, false),
51
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/target/riscv/tcg/tcg-cpu.c
54
+++ b/target/riscv/tcg/tcg-cpu.c
55
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
56
57
/* The Zve64d extension depends on the Zve64f extension */
58
if (cpu->cfg.ext_zve64d) {
59
+ if (!riscv_has_ext(env, RVD)) {
60
+ error_setg(errp, "Zve64d/V extensions require D extension");
61
+ return;
62
+ }
63
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64f), true);
21
}
64
}
22
65
23
+ /*
66
- /* The Zve64f extension depends on the Zve32f extension */
24
+ * Init fw_cfg. Must be done before riscv_load_fdt, otherwise the device
67
+ /* The Zve64f extension depends on the Zve64x and Zve32f extensions */
25
+ * tree cannot be altered and we get FDT_ERR_NOSPACE.
68
if (cpu->cfg.ext_zve64f) {
26
+ */
69
+ cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve64x), true);
27
+ s->fw_cfg = create_fw_cfg(machine);
70
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32f), true);
28
+ rom_set_fw(s->fw_cfg);
29
+
30
if (machine->kernel_filename) {
31
kernel_start_addr = riscv_calc_kernel_start_addr(&s->soc[0],
32
firmware_end_addr);
33
@@ -XXX,XX +XXX,XX @@ static void virt_machine_done(Notifier *notifier, void *data)
34
start_addr = virt_memmap[VIRT_FLASH].base;
35
}
71
}
36
72
37
- /*
73
- if (cpu->cfg.ext_zve64d && !riscv_has_ext(env, RVD)) {
38
- * Init fw_cfg. Must be done before riscv_load_fdt, otherwise the device
74
- error_setg(errp, "Zve64d/V extensions require D extension");
39
- * tree cannot be altered and we get FDT_ERR_NOSPACE.
75
- return;
40
- */
76
+ /* The Zve64x extension depends on the Zve32x extension */
41
- s->fw_cfg = create_fw_cfg(machine);
77
+ if (cpu->cfg.ext_zve64x) {
42
- rom_set_fw(s->fw_cfg);
78
+ cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zve32x), true);
43
-
79
}
44
/* Compute the fdt load address in dram */
80
45
fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
81
/* The Zve32f extension depends on the Zve32x extension */
46
machine->ram_size, machine->fdt);
82
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
83
return;
84
}
85
86
- if ((cpu->cfg.ext_zvbc || cpu->cfg.ext_zvknhb) && !cpu->cfg.ext_zve64f) {
87
+ if ((cpu->cfg.ext_zvbc || cpu->cfg.ext_zvknhb) && !cpu->cfg.ext_zve64x) {
88
error_setg(
89
errp,
90
- "Zvbc and Zvknhb extensions require V or Zve64{f,d} extensions");
91
+ "Zvbc and Zvknhb extensions require V or Zve64x extensions");
92
return;
93
}
94
47
--
95
--
48
2.37.3
96
2.45.1
diff view generated by jsdifflib
New patch
1
From: Jason Chien <jason.chien@sifive.com>
1
2
3
In current implementation, the gdbstub allows reading vector registers
4
only if V extension is supported. However, all vector extensions and
5
vector crypto extensions have the vector registers and they all depend
6
on Zve32x. The gdbstub should check for Zve32x instead.
7
8
Signed-off-by: Jason Chien <jason.chien@sifive.com>
9
Reviewed-by: Frank Chang <frank.chang@sifive.com>
10
Reviewed-by: Max Chou <max.chou@sifive.com>
11
Message-ID: <20240328022343.6871-4-jason.chien@sifive.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
target/riscv/gdbstub.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/riscv/gdbstub.c
20
+++ b/target/riscv/gdbstub.c
21
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs)
22
gdb_find_static_feature("riscv-32bit-fpu.xml"),
23
0);
24
}
25
- if (env->misa_ext & RVV) {
26
+ if (cpu->cfg.ext_zve32x) {
27
gdb_register_coprocessor(cs, riscv_gdb_get_vector,
28
riscv_gdb_set_vector,
29
ricsv_gen_dynamic_vector_feature(cs, cs->gdb_num_regs),
30
--
31
2.45.1
diff view generated by jsdifflib
New patch
1
From: Huang Tao <eric.huang@linux.alibaba.com>
1
2
3
In RVV and vcrypto instructions, the masked and tail elements are set to 1s
4
using vext_set_elems_1s function if the vma/vta bit is set. It is the element
5
agnostic policy.
6
7
However, this function can't deal the big endian situation. This patch fixes
8
the problem by adding handling of such case.
9
10
Signed-off-by: Huang Tao <eric.huang@linux.alibaba.com>
11
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
13
Cc: qemu-stable <qemu-stable@nongnu.org>
14
Message-ID: <20240325021654.6594-1-eric.huang@linux.alibaba.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/vector_internals.c | 22 ++++++++++++++++++++++
18
1 file changed, 22 insertions(+)
19
20
diff --git a/target/riscv/vector_internals.c b/target/riscv/vector_internals.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/riscv/vector_internals.c
23
+++ b/target/riscv/vector_internals.c
24
@@ -XXX,XX +XXX,XX @@ void vext_set_elems_1s(void *base, uint32_t is_agnostic, uint32_t cnt,
25
if (tot - cnt == 0) {
26
return ;
27
}
28
+
29
+ if (HOST_BIG_ENDIAN) {
30
+ /*
31
+ * Deal the situation when the elements are insdie
32
+ * only one uint64 block including setting the
33
+ * masked-off element.
34
+ */
35
+ if (((tot - 1) ^ cnt) < 8) {
36
+ memset(base + H1(tot - 1), -1, tot - cnt);
37
+ return;
38
+ }
39
+ /*
40
+ * Otherwise, at least cross two uint64_t blocks.
41
+ * Set first unaligned block.
42
+ */
43
+ if (cnt % 8 != 0) {
44
+ uint32_t j = ROUND_UP(cnt, 8);
45
+ memset(base + H1(j - 1), -1, j - cnt);
46
+ cnt = j;
47
+ }
48
+ /* Set other 64bit aligend blocks */
49
+ }
50
memset(base + cnt, -1, tot - cnt);
51
}
52
53
--
54
2.45.1
diff view generated by jsdifflib
New patch
1
From: Yangyu Chen <cyy@cyyself.name>
1
2
3
This code has a typo that writes zvkb to zvkg, causing users can't
4
enable zvkb through the config. This patch gets this fixed.
5
6
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
7
Fixes: ea61ef7097d0 ("target/riscv: Move vector crypto extensions to riscv_cpu_extensions")
8
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Max Chou <max.chou@sifive.com>
11
Reviewed-by:  Weiwei Li <liwei1518@gmail.com>
12
Message-ID: <tencent_7E34EEF0F90B9A68BF38BEE09EC6D4877C0A@qq.com>
13
Cc: qemu-stable <qemu-stable@nongnu.org>
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
---
16
target/riscv/cpu.c | 2 +-
17
1 file changed, 1 insertion(+), 1 deletion(-)
18
19
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/riscv/cpu.c
22
+++ b/target/riscv/cpu.c
23
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
24
/* Vector cryptography extensions */
25
MULTI_EXT_CFG_BOOL("zvbb", ext_zvbb, false),
26
MULTI_EXT_CFG_BOOL("zvbc", ext_zvbc, false),
27
- MULTI_EXT_CFG_BOOL("zvkb", ext_zvkg, false),
28
+ MULTI_EXT_CFG_BOOL("zvkb", ext_zvkb, false),
29
MULTI_EXT_CFG_BOOL("zvkg", ext_zvkg, false),
30
MULTI_EXT_CFG_BOOL("zvkned", ext_zvkned, false),
31
MULTI_EXT_CFG_BOOL("zvknha", ext_zvknha, false),
32
--
33
2.45.1
34
35
diff view generated by jsdifflib
New patch
1
From: Huang Tao <eric.huang@linux.alibaba.com>
1
2
3
In this patch, we modify the decoder to be a freely composable data
4
structure instead of a hardcoded one. It can be dynamically builded up
5
according to the extensions.
6
This approach has several benefits:
7
1. Provides support for heterogeneous cpu architectures. As we add decoder in
8
RISCVCPU, each cpu can have their own decoder, and the decoders can be
9
different due to cpu's features.
10
2. Improve the decoding efficiency. We run the guard_func to see if the decoder
11
can be added to the dynamic_decoder when building up the decoder. Therefore,
12
there is no need to run the guard_func when decoding each instruction. It can
13
improve the decoding efficiency
14
3. For vendor or dynamic cpus, it allows them to customize their own decoder
15
functions to improve decoding efficiency, especially when vendor-defined
16
instruction sets increase. Because of dynamic building up, it can skip the other
17
decoder guard functions when decoding.
18
4. Pre patch for allowing adding a vendor decoder before decode_insn32() with minimal
19
overhead for users that don't need this particular vendor decoder.
20
21
Signed-off-by: Huang Tao <eric.huang@linux.alibaba.com>
22
Suggested-by: Christoph Muellner <christoph.muellner@vrull.eu>
23
Co-authored-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
26
Message-ID: <20240506023607.29544-1-eric.huang@linux.alibaba.com>
27
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
28
---
29
target/riscv/cpu.h | 1 +
30
target/riscv/tcg/tcg-cpu.h | 15 +++++++++++++++
31
target/riscv/cpu.c | 1 +
32
target/riscv/tcg/tcg-cpu.c | 15 +++++++++++++++
33
target/riscv/translate.c | 31 +++++++++++++++----------------
34
5 files changed, 47 insertions(+), 16 deletions(-)
35
36
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/riscv/cpu.h
39
+++ b/target/riscv/cpu.h
40
@@ -XXX,XX +XXX,XX @@ struct ArchCPU {
41
uint32_t pmu_avail_ctrs;
42
/* Mapping of events to counters */
43
GHashTable *pmu_event_ctr_map;
44
+ const GPtrArray *decoders;
45
};
46
47
/**
48
diff --git a/target/riscv/tcg/tcg-cpu.h b/target/riscv/tcg/tcg-cpu.h
49
index XXXXXXX..XXXXXXX 100644
50
--- a/target/riscv/tcg/tcg-cpu.h
51
+++ b/target/riscv/tcg/tcg-cpu.h
52
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp);
53
void riscv_tcg_cpu_finalize_features(RISCVCPU *cpu, Error **errp);
54
bool riscv_cpu_tcg_compatible(RISCVCPU *cpu);
55
56
+struct DisasContext;
57
+struct RISCVCPUConfig;
58
+typedef struct RISCVDecoder {
59
+ bool (*guard_func)(const struct RISCVCPUConfig *);
60
+ bool (*riscv_cpu_decode_fn)(struct DisasContext *, uint32_t);
61
+} RISCVDecoder;
62
+
63
+typedef bool (*riscv_cpu_decode_fn)(struct DisasContext *, uint32_t);
64
+
65
+extern const size_t decoder_table_size;
66
+
67
+extern const RISCVDecoder decoder_table[];
68
+
69
+void riscv_tcg_cpu_finalize_dynamic_decoder(RISCVCPU *cpu);
70
+
71
#endif
72
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/riscv/cpu.c
75
+++ b/target/riscv/cpu.c
76
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Error **errp)
77
error_propagate(errp, local_err);
78
return;
79
}
80
+ riscv_tcg_cpu_finalize_dynamic_decoder(cpu);
81
} else if (kvm_enabled()) {
82
riscv_kvm_cpu_finalize_features(cpu, &local_err);
83
if (local_err != NULL) {
84
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
85
index XXXXXXX..XXXXXXX 100644
86
--- a/target/riscv/tcg/tcg-cpu.c
87
+++ b/target/riscv/tcg/tcg-cpu.c
88
@@ -XXX,XX +XXX,XX @@ void riscv_tcg_cpu_finalize_features(RISCVCPU *cpu, Error **errp)
89
}
90
}
91
92
+void riscv_tcg_cpu_finalize_dynamic_decoder(RISCVCPU *cpu)
93
+{
94
+ GPtrArray *dynamic_decoders;
95
+ dynamic_decoders = g_ptr_array_sized_new(decoder_table_size);
96
+ for (size_t i = 0; i < decoder_table_size; ++i) {
97
+ if (decoder_table[i].guard_func &&
98
+ decoder_table[i].guard_func(&cpu->cfg)) {
99
+ g_ptr_array_add(dynamic_decoders,
100
+ (gpointer)decoder_table[i].riscv_cpu_decode_fn);
101
+ }
102
+ }
103
+
104
+ cpu->decoders = dynamic_decoders;
105
+}
106
+
107
bool riscv_cpu_tcg_compatible(RISCVCPU *cpu)
108
{
109
return object_dynamic_cast(OBJECT(cpu), TYPE_RISCV_CPU_HOST) == NULL;
110
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
111
index XXXXXXX..XXXXXXX 100644
112
--- a/target/riscv/translate.c
113
+++ b/target/riscv/translate.c
114
@@ -XXX,XX +XXX,XX @@
115
#include "exec/helper-info.c.inc"
116
#undef HELPER_H
117
118
+#include "tcg/tcg-cpu.h"
119
+
120
/* global register indices */
121
static TCGv cpu_gpr[32], cpu_gprh[32], cpu_pc, cpu_vl, cpu_vstart;
122
static TCGv_i64 cpu_fpr[32]; /* assume F and D extensions */
123
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
124
/* FRM is known to contain a valid value. */
125
bool frm_valid;
126
bool insn_start_updated;
127
+ const GPtrArray *decoders;
128
} DisasContext;
129
130
static inline bool has_ext(DisasContext *ctx, uint32_t ext)
131
@@ -XXX,XX +XXX,XX @@ static inline int insn_len(uint16_t first_word)
132
return (first_word & 3) == 3 ? 4 : 2;
133
}
134
135
+const RISCVDecoder decoder_table[] = {
136
+ { always_true_p, decode_insn32 },
137
+ { has_xthead_p, decode_xthead},
138
+ { has_XVentanaCondOps_p, decode_XVentanaCodeOps},
139
+};
140
+
141
+const size_t decoder_table_size = ARRAY_SIZE(decoder_table);
142
+
143
static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
144
{
145
- /*
146
- * A table with predicate (i.e., guard) functions and decoder functions
147
- * that are tested in-order until a decoder matches onto the opcode.
148
- */
149
- static const struct {
150
- bool (*guard_func)(const RISCVCPUConfig *);
151
- bool (*decode_func)(DisasContext *, uint32_t);
152
- } decoders[] = {
153
- { always_true_p, decode_insn32 },
154
- { has_xthead_p, decode_xthead },
155
- { has_XVentanaCondOps_p, decode_XVentanaCodeOps },
156
- };
157
-
158
ctx->virt_inst_excp = false;
159
ctx->cur_insn_len = insn_len(opcode);
160
/* Check for compressed insn */
161
@@ -XXX,XX +XXX,XX @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
162
ctx->base.pc_next + 2));
163
ctx->opcode = opcode32;
164
165
- for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i) {
166
- if (decoders[i].guard_func(ctx->cfg_ptr) &&
167
- decoders[i].decode_func(ctx, opcode32)) {
168
+ for (guint i = 0; i < ctx->decoders->len; ++i) {
169
+ riscv_cpu_decode_fn func = g_ptr_array_index(ctx->decoders, i);
170
+ if (func(ctx, opcode32)) {
171
return;
172
}
173
}
174
@@ -XXX,XX +XXX,XX @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
175
ctx->itrigger = FIELD_EX32(tb_flags, TB_FLAGS, ITRIGGER);
176
ctx->zero = tcg_constant_tl(0);
177
ctx->virt_inst_excp = false;
178
+ ctx->decoders = cpu->decoders;
179
}
180
181
static void riscv_tr_tb_start(DisasContextBase *db, CPUState *cpu)
182
--
183
2.45.1
diff view generated by jsdifflib
New patch
1
From: Christoph Müllner <christoph.muellner@vrull.eu>
1
2
3
The th.sxstatus CSR can be used to identify available custom extension
4
on T-Head CPUs. The CSR is documented here:
5
https://github.com/T-head-Semi/thead-extension-spec/blob/master/xtheadsxstatus.adoc
6
7
An important property of this patch is, that the th.sxstatus MAEE field
8
is not set (indicating that XTheadMae is not available).
9
XTheadMae is a memory attribute extension (similar to Svpbmt) which is
10
implemented in many T-Head CPUs (C906, C910, etc.) and utilizes bits
11
in PTEs that are marked as reserved. QEMU maintainers prefer to not
12
implement XTheadMae, so we need give kernels a mechanism to identify
13
if XTheadMae is available in a system or not. And this patch introduces
14
this mechanism in QEMU in a way that's compatible with real HW
15
(i.e., probing the th.sxstatus.MAEE bit).
16
17
Further context can be found on the list:
18
https://lists.gnu.org/archive/html/qemu-devel/2024-02/msg00775.html
19
20
Reviewed-by: LIU Zhiwei <zhiwe_liu@linux.alibaba.com>
21
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
22
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
23
Message-ID: <20240429073656.2486732-1-christoph.muellner@vrull.eu>
24
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
25
---
26
MAINTAINERS | 1 +
27
target/riscv/cpu.h | 3 ++
28
target/riscv/cpu.c | 1 +
29
target/riscv/th_csr.c | 79 ++++++++++++++++++++++++++++++++++++++++
30
target/riscv/meson.build | 1 +
31
5 files changed, 85 insertions(+)
32
create mode 100644 target/riscv/th_csr.c
33
34
diff --git a/MAINTAINERS b/MAINTAINERS
35
index XXXXXXX..XXXXXXX 100644
36
--- a/MAINTAINERS
37
+++ b/MAINTAINERS
38
@@ -XXX,XX +XXX,XX @@ L: qemu-riscv@nongnu.org
39
S: Supported
40
F: target/riscv/insn_trans/trans_xthead.c.inc
41
F: target/riscv/xthead*.decode
42
+F: target/riscv/th_*
43
F: disas/riscv-xthead*
44
45
RISC-V XVentanaCondOps extension
46
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
47
index XXXXXXX..XXXXXXX 100644
48
--- a/target/riscv/cpu.h
49
+++ b/target/riscv/cpu.h
50
@@ -XXX,XX +XXX,XX @@ target_ulong riscv_new_csr_seed(target_ulong new_value,
51
uint8_t satp_mode_max_from_map(uint32_t map);
52
const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
53
54
+/* Implemented in th_csr.c */
55
+void th_register_custom_csrs(RISCVCPU *cpu);
56
+
57
#endif /* RISCV_CPU_H */
58
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/riscv/cpu.c
61
+++ b/target/riscv/cpu.c
62
@@ -XXX,XX +XXX,XX @@ static void rv64_thead_c906_cpu_init(Object *obj)
63
cpu->cfg.mvendorid = THEAD_VENDOR_ID;
64
#ifndef CONFIG_USER_ONLY
65
set_satp_mode_max_supported(cpu, VM_1_10_SV39);
66
+ th_register_custom_csrs(cpu);
67
#endif
68
69
/* inherited from parent obj via riscv_cpu_init() */
70
diff --git a/target/riscv/th_csr.c b/target/riscv/th_csr.c
71
new file mode 100644
72
index XXXXXXX..XXXXXXX
73
--- /dev/null
74
+++ b/target/riscv/th_csr.c
75
@@ -XXX,XX +XXX,XX @@
76
+/*
77
+ * T-Head-specific CSRs.
78
+ *
79
+ * Copyright (c) 2024 VRULL GmbH
80
+ *
81
+ * This program is free software; you can redistribute it and/or modify it
82
+ * under the terms and conditions of the GNU General Public License,
83
+ * version 2 or later, as published by the Free Software Foundation.
84
+ *
85
+ * This program is distributed in the hope it will be useful, but WITHOUT
86
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
87
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
88
+ * more details.
89
+ *
90
+ * You should have received a copy of the GNU General Public License along with
91
+ * this program. If not, see <http://www.gnu.org/licenses/>.
92
+ */
93
+
94
+#include "qemu/osdep.h"
95
+#include "cpu.h"
96
+#include "cpu_vendorid.h"
97
+
98
+#define CSR_TH_SXSTATUS 0x5c0
99
+
100
+/* TH_SXSTATUS bits */
101
+#define TH_SXSTATUS_UCME BIT(16)
102
+#define TH_SXSTATUS_MAEE BIT(21)
103
+#define TH_SXSTATUS_THEADISAEE BIT(22)
104
+
105
+typedef struct {
106
+ int csrno;
107
+ int (*insertion_test)(RISCVCPU *cpu);
108
+ riscv_csr_operations csr_ops;
109
+} riscv_csr;
110
+
111
+static RISCVException smode(CPURISCVState *env, int csrno)
112
+{
113
+ if (riscv_has_ext(env, RVS)) {
114
+ return RISCV_EXCP_NONE;
115
+ }
116
+
117
+ return RISCV_EXCP_ILLEGAL_INST;
118
+}
119
+
120
+static int test_thead_mvendorid(RISCVCPU *cpu)
121
+{
122
+ if (cpu->cfg.mvendorid != THEAD_VENDOR_ID) {
123
+ return -1;
124
+ }
125
+
126
+ return 0;
127
+}
128
+
129
+static RISCVException read_th_sxstatus(CPURISCVState *env, int csrno,
130
+ target_ulong *val)
131
+{
132
+ /* We don't set MAEE here, because QEMU does not implement MAEE. */
133
+ *val = TH_SXSTATUS_UCME | TH_SXSTATUS_THEADISAEE;
134
+ return RISCV_EXCP_NONE;
135
+}
136
+
137
+static riscv_csr th_csr_list[] = {
138
+ {
139
+ .csrno = CSR_TH_SXSTATUS,
140
+ .insertion_test = test_thead_mvendorid,
141
+ .csr_ops = { "th.sxstatus", smode, read_th_sxstatus }
142
+ }
143
+};
144
+
145
+void th_register_custom_csrs(RISCVCPU *cpu)
146
+{
147
+ for (size_t i = 0; i < ARRAY_SIZE(th_csr_list); i++) {
148
+ int csrno = th_csr_list[i].csrno;
149
+ riscv_csr_operations *csr_ops = &th_csr_list[i].csr_ops;
150
+ if (!th_csr_list[i].insertion_test(cpu)) {
151
+ riscv_set_csr_ops(csrno, csr_ops);
152
+ }
153
+ }
154
+}
155
diff --git a/target/riscv/meson.build b/target/riscv/meson.build
156
index XXXXXXX..XXXXXXX 100644
157
--- a/target/riscv/meson.build
158
+++ b/target/riscv/meson.build
159
@@ -XXX,XX +XXX,XX @@ riscv_system_ss.add(files(
160
'monitor.c',
161
'machine.c',
162
'pmu.c',
163
+ 'th_csr.c',
164
'time_helper.c',
165
'riscv-qmp-cmds.c',
166
))
167
--
168
2.45.1
169
170
diff view generated by jsdifflib
New patch
1
From: Max Chou <max.chou@sifive.com>
1
2
3
According v spec 18.4, only the vfwcvt.f.f.v and vfncvt.f.f.w
4
instructions will be affected by Zvfhmin extension.
5
And the vfwcvt.f.f.v and vfncvt.f.f.w instructions only support the
6
conversions of
7
8
* From 1*SEW(16/32) to 2*SEW(32/64)
9
* From 2*SEW(32/64) to 1*SEW(16/32)
10
11
Signed-off-by: Max Chou <max.chou@sifive.com>
12
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
13
Cc: qemu-stable <qemu-stable@nongnu.org>
14
Message-ID: <20240322092600.1198921-2-max.chou@sifive.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/insn_trans/trans_rvv.c.inc | 20 ++++++++++++++++++--
18
1 file changed, 18 insertions(+), 2 deletions(-)
19
20
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/riscv/insn_trans/trans_rvv.c.inc
23
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
24
@@ -XXX,XX +XXX,XX @@ static bool require_rvf(DisasContext *s)
25
}
26
}
27
28
+static bool require_rvfmin(DisasContext *s)
29
+{
30
+ if (s->mstatus_fs == EXT_STATUS_DISABLED) {
31
+ return false;
32
+ }
33
+
34
+ switch (s->sew) {
35
+ case MO_16:
36
+ return s->cfg_ptr->ext_zvfhmin;
37
+ case MO_32:
38
+ return s->cfg_ptr->ext_zve32f;
39
+ default:
40
+ return false;
41
+ }
42
+}
43
+
44
static bool require_scale_rvf(DisasContext *s)
45
{
46
if (s->mstatus_fs == EXT_STATUS_DISABLED) {
47
@@ -XXX,XX +XXX,XX @@ static bool require_scale_rvfmin(DisasContext *s)
48
}
49
50
switch (s->sew) {
51
- case MO_8:
52
- return s->cfg_ptr->ext_zvfhmin;
53
case MO_16:
54
return s->cfg_ptr->ext_zve32f;
55
case MO_32:
56
@@ -XXX,XX +XXX,XX @@ static bool opxfv_widen_check(DisasContext *s, arg_rmr *a)
57
static bool opffv_widen_check(DisasContext *s, arg_rmr *a)
58
{
59
return opfv_widen_check(s, a) &&
60
+ require_rvfmin(s) &&
61
require_scale_rvfmin(s) &&
62
(s->sew != MO_8);
63
}
64
@@ -XXX,XX +XXX,XX @@ static bool opfxv_narrow_check(DisasContext *s, arg_rmr *a)
65
static bool opffv_narrow_check(DisasContext *s, arg_rmr *a)
66
{
67
return opfv_narrow_check(s, a) &&
68
+ require_rvfmin(s) &&
69
require_scale_rvfmin(s) &&
70
(s->sew != MO_8);
71
}
72
--
73
2.45.1
diff view generated by jsdifflib
New patch
1
From: Max Chou <max.chou@sifive.com>
1
2
3
The require_scale_rvf function only checks the double width operator for
4
the vector floating point widen instructions, so most of the widen
5
checking functions need to add require_rvf for single width operator.
6
7
The vfwcvt.f.x.v and vfwcvt.f.xu.v instructions convert single width
8
integer to double width float, so the opfxv_widen_check function doesn’t
9
need require_rvf for the single width operator(integer).
10
11
Signed-off-by: Max Chou <max.chou@sifive.com>
12
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
13
Cc: qemu-stable <qemu-stable@nongnu.org>
14
Message-ID: <20240322092600.1198921-3-max.chou@sifive.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/insn_trans/trans_rvv.c.inc | 5 +++++
18
1 file changed, 5 insertions(+)
19
20
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/riscv/insn_trans/trans_rvv.c.inc
23
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
24
@@ -XXX,XX +XXX,XX @@ GEN_OPFVF_TRANS(vfrsub_vf, opfvf_check)
25
static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a)
26
{
27
return require_rvv(s) &&
28
+ require_rvf(s) &&
29
require_scale_rvf(s) &&
30
(s->sew != MO_8) &&
31
vext_check_isa_ill(s) &&
32
@@ -XXX,XX +XXX,XX @@ GEN_OPFVV_WIDEN_TRANS(vfwsub_vv, opfvv_widen_check)
33
static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a)
34
{
35
return require_rvv(s) &&
36
+ require_rvf(s) &&
37
require_scale_rvf(s) &&
38
(s->sew != MO_8) &&
39
vext_check_isa_ill(s) &&
40
@@ -XXX,XX +XXX,XX @@ GEN_OPFVF_WIDEN_TRANS(vfwsub_vf)
41
static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a)
42
{
43
return require_rvv(s) &&
44
+ require_rvf(s) &&
45
require_scale_rvf(s) &&
46
(s->sew != MO_8) &&
47
vext_check_isa_ill(s) &&
48
@@ -XXX,XX +XXX,XX @@ GEN_OPFWV_WIDEN_TRANS(vfwsub_wv)
49
static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a)
50
{
51
return require_rvv(s) &&
52
+ require_rvf(s) &&
53
require_scale_rvf(s) &&
54
(s->sew != MO_8) &&
55
vext_check_isa_ill(s) &&
56
@@ -XXX,XX +XXX,XX @@ GEN_OPFVV_TRANS(vfredmin_vs, freduction_check)
57
static bool freduction_widen_check(DisasContext *s, arg_rmrr *a)
58
{
59
return reduction_widen_check(s, a) &&
60
+ require_rvf(s) &&
61
require_scale_rvf(s) &&
62
(s->sew != MO_8);
63
}
64
--
65
2.45.1
66
67
diff view generated by jsdifflib
New patch
1
From: Max Chou <max.chou@sifive.com>
1
2
3
The opfv_narrow_check needs to check the single width float operator by
4
require_rvf.
5
6
Signed-off-by: Max Chou <max.chou@sifive.com>
7
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
8
Cc: qemu-stable <qemu-stable@nongnu.org>
9
Message-ID: <20240322092600.1198921-4-max.chou@sifive.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
target/riscv/insn_trans/trans_rvv.c.inc | 1 +
13
1 file changed, 1 insertion(+)
14
15
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/insn_trans/trans_rvv.c.inc
18
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
19
@@ -XXX,XX +XXX,XX @@ static bool opffv_narrow_check(DisasContext *s, arg_rmr *a)
20
static bool opffv_rod_narrow_check(DisasContext *s, arg_rmr *a)
21
{
22
return opfv_narrow_check(s, a) &&
23
+ require_rvf(s) &&
24
require_scale_rvf(s) &&
25
(s->sew != MO_8);
26
}
27
--
28
2.45.1
diff view generated by jsdifflib
New patch
1
From: Max Chou <max.chou@sifive.com>
1
2
3
If the checking functions check both the single and double width
4
operators at the same time, then the single width operator checking
5
functions (require_rvf[min]) will check whether the SEW is 8.
6
7
Signed-off-by: Max Chou <max.chou@sifive.com>
8
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
9
Cc: qemu-stable <qemu-stable@nongnu.org>
10
Message-ID: <20240322092600.1198921-5-max.chou@sifive.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/insn_trans/trans_rvv.c.inc | 16 ++++------------
14
1 file changed, 4 insertions(+), 12 deletions(-)
15
16
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/insn_trans/trans_rvv.c.inc
19
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
20
@@ -XXX,XX +XXX,XX @@ static bool opfvv_widen_check(DisasContext *s, arg_rmrr *a)
21
return require_rvv(s) &&
22
require_rvf(s) &&
23
require_scale_rvf(s) &&
24
- (s->sew != MO_8) &&
25
vext_check_isa_ill(s) &&
26
vext_check_dss(s, a->rd, a->rs1, a->rs2, a->vm);
27
}
28
@@ -XXX,XX +XXX,XX @@ static bool opfvf_widen_check(DisasContext *s, arg_rmrr *a)
29
return require_rvv(s) &&
30
require_rvf(s) &&
31
require_scale_rvf(s) &&
32
- (s->sew != MO_8) &&
33
vext_check_isa_ill(s) &&
34
vext_check_ds(s, a->rd, a->rs2, a->vm);
35
}
36
@@ -XXX,XX +XXX,XX @@ static bool opfwv_widen_check(DisasContext *s, arg_rmrr *a)
37
return require_rvv(s) &&
38
require_rvf(s) &&
39
require_scale_rvf(s) &&
40
- (s->sew != MO_8) &&
41
vext_check_isa_ill(s) &&
42
vext_check_dds(s, a->rd, a->rs1, a->rs2, a->vm);
43
}
44
@@ -XXX,XX +XXX,XX @@ static bool opfwf_widen_check(DisasContext *s, arg_rmrr *a)
45
return require_rvv(s) &&
46
require_rvf(s) &&
47
require_scale_rvf(s) &&
48
- (s->sew != MO_8) &&
49
vext_check_isa_ill(s) &&
50
vext_check_dd(s, a->rd, a->rs2, a->vm);
51
}
52
@@ -XXX,XX +XXX,XX @@ static bool opffv_widen_check(DisasContext *s, arg_rmr *a)
53
{
54
return opfv_widen_check(s, a) &&
55
require_rvfmin(s) &&
56
- require_scale_rvfmin(s) &&
57
- (s->sew != MO_8);
58
+ require_scale_rvfmin(s);
59
}
60
61
#define GEN_OPFV_WIDEN_TRANS(NAME, CHECK, HELPER, FRM) \
62
@@ -XXX,XX +XXX,XX @@ static bool opffv_narrow_check(DisasContext *s, arg_rmr *a)
63
{
64
return opfv_narrow_check(s, a) &&
65
require_rvfmin(s) &&
66
- require_scale_rvfmin(s) &&
67
- (s->sew != MO_8);
68
+ require_scale_rvfmin(s);
69
}
70
71
static bool opffv_rod_narrow_check(DisasContext *s, arg_rmr *a)
72
{
73
return opfv_narrow_check(s, a) &&
74
require_rvf(s) &&
75
- require_scale_rvf(s) &&
76
- (s->sew != MO_8);
77
+ require_scale_rvf(s);
78
}
79
80
#define GEN_OPFV_NARROW_TRANS(NAME, CHECK, HELPER, FRM) \
81
@@ -XXX,XX +XXX,XX @@ static bool freduction_widen_check(DisasContext *s, arg_rmrr *a)
82
{
83
return reduction_widen_check(s, a) &&
84
require_rvf(s) &&
85
- require_scale_rvf(s) &&
86
- (s->sew != MO_8);
87
+ require_scale_rvf(s);
88
}
89
90
GEN_OPFVV_WIDEN_TRANS(vfwredusum_vs, freduction_widen_check)
91
--
92
2.45.1
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
raise_mmu_exception(), as is today, is prioritizing guest page faults by
4
checking first if virt_enabled && !first_stage, and then considering the
5
regular inst/load/store faults.
6
7
There's no mention in the spec about guest page fault being a higher
8
priority that PMP faults. In fact, privileged spec section 3.7.1 says:
9
10
"Attempting to fetch an instruction from a PMP region that does not have
11
execute permissions raises an instruction access-fault exception.
12
Attempting to execute a load or load-reserved instruction which accesses
13
a physical address within a PMP region without read permissions raises a
14
load access-fault exception. Attempting to execute a store,
15
store-conditional, or AMO instruction which accesses a physical address
16
within a PMP region without write permissions raises a store
17
access-fault exception."
18
19
So, in fact, we're doing it wrong - PMP faults should always be thrown,
20
regardless of also being a first or second stage fault.
21
22
The way riscv_cpu_tlb_fill() and get_physical_address() work is
23
adequate: a TRANSLATE_PMP_FAIL error is immediately reported and
24
reflected in the 'pmp_violation' flag. What we need is to change
25
raise_mmu_exception() to prioritize it.
26
27
Reported-by: Joseph Chan <jchan@ventanamicro.com>
28
Fixes: 82d53adfbb ("target/riscv/cpu_helper.c: Invalid exception on MMU translation stage")
29
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
30
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
31
Message-ID: <20240413105929.7030-1-alexei.filippov@syntacore.com>
32
Cc: qemu-stable <qemu-stable@nongnu.org>
33
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
34
---
35
target/riscv/cpu_helper.c | 22 ++++++++++++----------
36
1 file changed, 12 insertions(+), 10 deletions(-)
37
38
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/riscv/cpu_helper.c
41
+++ b/target/riscv/cpu_helper.c
42
@@ -XXX,XX +XXX,XX @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address,
43
44
switch (access_type) {
45
case MMU_INST_FETCH:
46
- if (env->virt_enabled && !first_stage) {
47
+ if (pmp_violation) {
48
+ cs->exception_index = RISCV_EXCP_INST_ACCESS_FAULT;
49
+ } else if (env->virt_enabled && !first_stage) {
50
cs->exception_index = RISCV_EXCP_INST_GUEST_PAGE_FAULT;
51
} else {
52
- cs->exception_index = pmp_violation ?
53
- RISCV_EXCP_INST_ACCESS_FAULT : RISCV_EXCP_INST_PAGE_FAULT;
54
+ cs->exception_index = RISCV_EXCP_INST_PAGE_FAULT;
55
}
56
break;
57
case MMU_DATA_LOAD:
58
- if (two_stage && !first_stage) {
59
+ if (pmp_violation) {
60
+ cs->exception_index = RISCV_EXCP_LOAD_ACCESS_FAULT;
61
+ } else if (two_stage && !first_stage) {
62
cs->exception_index = RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT;
63
} else {
64
- cs->exception_index = pmp_violation ?
65
- RISCV_EXCP_LOAD_ACCESS_FAULT : RISCV_EXCP_LOAD_PAGE_FAULT;
66
+ cs->exception_index = RISCV_EXCP_LOAD_PAGE_FAULT;
67
}
68
break;
69
case MMU_DATA_STORE:
70
- if (two_stage && !first_stage) {
71
+ if (pmp_violation) {
72
+ cs->exception_index = RISCV_EXCP_STORE_AMO_ACCESS_FAULT;
73
+ } else if (two_stage && !first_stage) {
74
cs->exception_index = RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT;
75
} else {
76
- cs->exception_index = pmp_violation ?
77
- RISCV_EXCP_STORE_AMO_ACCESS_FAULT :
78
- RISCV_EXCP_STORE_PAGE_FAULT;
79
+ cs->exception_index = RISCV_EXCP_STORE_PAGE_FAULT;
80
}
81
break;
82
default:
83
--
84
2.45.1
diff view generated by jsdifflib
New patch
1
From: Alexei Filippov <alexei.filippov@syntacore.com>
1
2
3
Previous patch fixed the PMP priority in raise_mmu_exception() but we're still
4
setting mtval2 incorrectly. In riscv_cpu_tlb_fill(), after pmp check in 2 stage
5
translation part, mtval2 will be set in case of successes 2 stage translation but
6
failed pmp check.
7
8
In this case we gonna set mtval2 via env->guest_phys_fault_addr in context of
9
riscv_cpu_tlb_fill(), as this was a guest-page-fault, but it didn't and mtval2
10
should be zero, according to RISCV privileged spec sect. 9.4.4: When a guest
11
page-fault is taken into M-mode, mtval2 is written with either zero or guest
12
physical address that faulted, shifted by 2 bits. *For other traps, mtval2
13
is set to zero...*
14
15
Signed-off-by: Alexei Filippov <alexei.filippov@syntacore.com>
16
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
17
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
18
Message-ID: <20240503103052.6819-1-alexei.filippov@syntacore.com>
19
Cc: qemu-stable <qemu-stable@nongnu.org>
20
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
21
---
22
target/riscv/cpu_helper.c | 12 ++++++------
23
1 file changed, 6 insertions(+), 6 deletions(-)
24
25
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/target/riscv/cpu_helper.c
28
+++ b/target/riscv/cpu_helper.c
29
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
30
__func__, pa, ret, prot_pmp, tlb_size);
31
32
prot &= prot_pmp;
33
- }
34
-
35
- if (ret != TRANSLATE_SUCCESS) {
36
+ } else {
37
/*
38
* Guest physical address translation failed, this is a HS
39
* level exception
40
*/
41
first_stage_error = false;
42
- env->guest_phys_fault_addr = (im_address |
43
- (address &
44
- (TARGET_PAGE_SIZE - 1))) >> 2;
45
+ if (ret != TRANSLATE_PMP_FAIL) {
46
+ env->guest_phys_fault_addr = (im_address |
47
+ (address &
48
+ (TARGET_PAGE_SIZE - 1))) >> 2;
49
+ }
50
}
51
}
52
} else {
53
--
54
2.45.1
diff view generated by jsdifflib
1
From: Jim Shu <jim.shu@sifive.com>
1
From: Rob Bradford <rbradford@rivosinc.com>
2
2
3
PLIC spec [1] requires interrupt source priority registers are WARL
3
This extension has now been ratified:
4
field and the number of supported priority is power-of-2 to simplify SW
4
https://jira.riscv.org/browse/RVS-2006 so the "x-" prefix can be
5
discovery.
5
removed.
6
6
7
Existing QEMU RISC-V machine (e.g. shakti_c) don't strictly follow PLIC
7
Since this is now a ratified extension add it to the list of extensions
8
spec, whose number of supported priority is not power-of-2. Just change
8
included in the "max" CPU variant.
9
each bit of interrupt priority register to WARL field when the number of
10
supported priority is power-of-2.
11
9
12
[1] https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc#interrupt-priorities
10
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
13
11
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
14
Signed-off-by: Jim Shu <jim.shu@sifive.com>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Reviewed-by: Clément Chigot <chigot@adacore.com>
13
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
16
Acked-by: Alistair Francis <alistair.francis@wdc.com>
14
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
17
Message-Id: <20221003041440.2320-3-jim.shu@sifive.com>
15
Message-ID: <20240514110217.22516-1-rbradford@rivosinc.com>
18
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
19
---
17
---
20
hw/intc/sifive_plic.c | 21 +++++++++++++++++++--
18
target/riscv/cpu.c | 2 +-
21
1 file changed, 19 insertions(+), 2 deletions(-)
19
target/riscv/tcg/tcg-cpu.c | 2 +-
20
2 files changed, 2 insertions(+), 2 deletions(-)
22
21
23
diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c
22
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
24
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/intc/sifive_plic.c
24
--- a/target/riscv/cpu.c
26
+++ b/hw/intc/sifive_plic.c
25
+++ b/target/riscv/cpu.c
27
@@ -XXX,XX +XXX,XX @@ static void sifive_plic_write(void *opaque, hwaddr addr, uint64_t value,
26
@@ -XXX,XX +XXX,XX @@ static const MISAExtInfo misa_ext_info_arr[] = {
28
if (addr_between(addr, plic->priority_base, plic->num_sources << 2)) {
27
MISA_EXT_INFO(RVJ, "x-j", "Dynamic translated languages"),
29
uint32_t irq = ((addr - plic->priority_base) >> 2) + 1;
28
MISA_EXT_INFO(RVV, "v", "Vector operations"),
30
29
MISA_EXT_INFO(RVG, "g", "General purpose (IMAFD_Zicsr_Zifencei)"),
31
- if (value <= plic->num_priorities) {
30
- MISA_EXT_INFO(RVB, "x-b", "Bit manipulation (Zba_Zbb_Zbs)")
32
+ if (((plic->num_priorities + 1) & plic->num_priorities) == 0) {
31
+ MISA_EXT_INFO(RVB, "b", "Bit manipulation (Zba_Zbb_Zbs)")
33
+ /*
32
};
34
+ * if "num_priorities + 1" is power-of-2, make each register bit of
33
35
+ * interrupt priority WARL (Write-Any-Read-Legal). Just filter
34
static void riscv_cpu_validate_misa_mxl(RISCVCPUClass *mcc)
36
+ * out the access to unsupported priority bits.
35
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
37
+ */
36
index XXXXXXX..XXXXXXX 100644
38
+ plic->source_priority[irq] = value % (plic->num_priorities + 1);
37
--- a/target/riscv/tcg/tcg-cpu.c
39
+ sifive_plic_update(plic);
38
+++ b/target/riscv/tcg/tcg-cpu.c
40
+ } else if (value <= plic->num_priorities) {
39
@@ -XXX,XX +XXX,XX @@ static void riscv_init_max_cpu_extensions(Object *obj)
41
plic->source_priority[irq] = value;
40
const RISCVCPUMultiExtConfig *prop;
42
sifive_plic_update(plic);
41
43
}
42
/* Enable RVG, RVJ and RVV that are disabled by default */
44
@@ -XXX,XX +XXX,XX @@ static void sifive_plic_write(void *opaque, hwaddr addr, uint64_t value,
43
- riscv_cpu_set_misa_ext(env, env->misa_ext | RVG | RVJ | RVV);
45
uint32_t contextid = (addr & (plic->context_stride - 1));
44
+ riscv_cpu_set_misa_ext(env, env->misa_ext | RVB | RVG | RVJ | RVV);
46
45
47
if (contextid == 0) {
46
for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
48
- if (value <= plic->num_priorities) {
47
isa_ext_update_enabled(cpu, prop->offset, true);
49
+ if (((plic->num_priorities + 1) & plic->num_priorities) == 0) {
50
+ /*
51
+ * if "num_priorities + 1" is power-of-2, each register bit of
52
+ * interrupt priority is WARL (Write-Any-Read-Legal). Just
53
+ * filter out the access to unsupported priority bits.
54
+ */
55
+ plic->target_priority[addrid] = value %
56
+ (plic->num_priorities + 1);
57
+ sifive_plic_update(plic);
58
+ } else if (value <= plic->num_priorities) {
59
plic->target_priority[addrid] = value;
60
sifive_plic_update(plic);
61
}
62
--
48
--
63
2.37.3
49
2.45.1
diff view generated by jsdifflib
1
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
1
From: Alistair Francis <alistair23@gmail.com>
2
2
3
This patch addresses the coverity issues specified in [1],
3
When running the instruction
4
as suggested, `FIELD_DP32()`/`FIELD_EX32()` macros have been
5
implemented to clean up the code.
6
4
7
[1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg887713.html
5
```
6
cbo.flush 0(x0)
7
```
8
8
9
Fixes: Coverity CID 1488107
9
QEMU would segfault.
10
10
11
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
11
The issue was in cpu_gpr[a->rs1] as QEMU does not have cpu_gpr[0]
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
allocated.
13
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
13
14
Message-Id: <20220930033241.206581-2-wilfred.mallawa@opensource.wdc.com>
14
In order to fix this let's use the existing get_address()
15
helper. This also has the benefit of performing pointer mask
16
calculations on the address specified in rs1.
17
18
The pointer masking specificiation specifically states:
19
20
"""
21
Cache Management Operations: All instructions in Zicbom, Zicbop and Zicboz
22
"""
23
24
So this is the correct behaviour and we previously have been incorrectly
25
not masking the address.
26
27
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
28
Reported-by: Fabian Thomas <fabian.thomas@cispa.de>
29
Fixes: e05da09b7cfd ("target/riscv: implement Zicbom extension")
30
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
31
Cc: qemu-stable <qemu-stable@nongnu.org>
32
Message-ID: <20240514023910.301766-1-alistair.francis@wdc.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
33
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
34
---
17
hw/ssi/ibex_spi_host.c | 132 +++++++++++++++++++++--------------------
35
target/riscv/insn_trans/trans_rvzicbo.c.inc | 16 ++++++++++++----
18
1 file changed, 68 insertions(+), 64 deletions(-)
36
1 file changed, 12 insertions(+), 4 deletions(-)
19
37
20
diff --git a/hw/ssi/ibex_spi_host.c b/hw/ssi/ibex_spi_host.c
38
diff --git a/target/riscv/insn_trans/trans_rvzicbo.c.inc b/target/riscv/insn_trans/trans_rvzicbo.c.inc
21
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/ssi/ibex_spi_host.c
40
--- a/target/riscv/insn_trans/trans_rvzicbo.c.inc
23
+++ b/hw/ssi/ibex_spi_host.c
41
+++ b/target/riscv/insn_trans/trans_rvzicbo.c.inc
24
@@ -XXX,XX +XXX,XX @@ static inline uint8_t div4_round_up(uint8_t dividend)
42
@@ -XXX,XX +XXX,XX @@
25
43
static bool trans_cbo_clean(DisasContext *ctx, arg_cbo_clean *a)
26
static void ibex_spi_rxfifo_reset(IbexSPIHostState *s)
27
{
44
{
28
+ uint32_t data = s->regs[IBEX_SPI_HOST_STATUS];
45
REQUIRE_ZICBOM(ctx);
29
/* Empty the RX FIFO and assert RXEMPTY */
46
- gen_helper_cbo_clean_flush(tcg_env, cpu_gpr[a->rs1]);
30
fifo8_reset(&s->rx_fifo);
47
+ TCGv src = get_address(ctx, a->rs1, 0);
31
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_RXFULL_MASK;
48
+
32
- s->regs[IBEX_SPI_HOST_STATUS] |= R_STATUS_RXEMPTY_MASK;
49
+ gen_helper_cbo_clean_flush(tcg_env, src);
33
+ data = FIELD_DP32(data, STATUS, RXFULL, 0);
50
return true;
34
+ data = FIELD_DP32(data, STATUS, RXEMPTY, 1);
35
+ s->regs[IBEX_SPI_HOST_STATUS] = data;
36
}
51
}
37
52
38
static void ibex_spi_txfifo_reset(IbexSPIHostState *s)
53
static bool trans_cbo_flush(DisasContext *ctx, arg_cbo_flush *a)
39
{
54
{
40
+ uint32_t data = s->regs[IBEX_SPI_HOST_STATUS];
55
REQUIRE_ZICBOM(ctx);
41
/* Empty the TX FIFO and assert TXEMPTY */
56
- gen_helper_cbo_clean_flush(tcg_env, cpu_gpr[a->rs1]);
42
fifo8_reset(&s->tx_fifo);
57
+ TCGv src = get_address(ctx, a->rs1, 0);
43
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_TXFULL_MASK;
58
+
44
- s->regs[IBEX_SPI_HOST_STATUS] |= R_STATUS_TXEMPTY_MASK;
59
+ gen_helper_cbo_clean_flush(tcg_env, src);
45
+ data = FIELD_DP32(data, STATUS, TXFULL, 0);
60
return true;
46
+ data = FIELD_DP32(data, STATUS, TXEMPTY, 1);
47
+ s->regs[IBEX_SPI_HOST_STATUS] = data;
48
}
61
}
49
62
50
static void ibex_spi_host_reset(DeviceState *dev)
63
static bool trans_cbo_inval(DisasContext *ctx, arg_cbo_inval *a)
51
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_reset(DeviceState *dev)
52
*/
53
static void ibex_spi_host_irq(IbexSPIHostState *s)
54
{
64
{
55
- bool error_en = s->regs[IBEX_SPI_HOST_INTR_ENABLE]
65
REQUIRE_ZICBOM(ctx);
56
- & R_INTR_ENABLE_ERROR_MASK;
66
- gen_helper_cbo_inval(tcg_env, cpu_gpr[a->rs1]);
57
- bool event_en = s->regs[IBEX_SPI_HOST_INTR_ENABLE]
67
+ TCGv src = get_address(ctx, a->rs1, 0);
58
- & R_INTR_ENABLE_SPI_EVENT_MASK;
59
- bool err_pending = s->regs[IBEX_SPI_HOST_INTR_STATE]
60
- & R_INTR_STATE_ERROR_MASK;
61
- bool status_pending = s->regs[IBEX_SPI_HOST_INTR_STATE]
62
- & R_INTR_STATE_SPI_EVENT_MASK;
63
+ uint32_t intr_test_reg = s->regs[IBEX_SPI_HOST_INTR_TEST];
64
+ uint32_t intr_en_reg = s->regs[IBEX_SPI_HOST_INTR_ENABLE];
65
+ uint32_t intr_state_reg = s->regs[IBEX_SPI_HOST_INTR_STATE];
66
+
68
+
67
+ uint32_t err_en_reg = s->regs[IBEX_SPI_HOST_ERROR_ENABLE];
69
+ gen_helper_cbo_inval(tcg_env, src);
68
+ uint32_t event_en_reg = s->regs[IBEX_SPI_HOST_EVENT_ENABLE];
70
return true;
69
+ uint32_t err_status_reg = s->regs[IBEX_SPI_HOST_ERROR_STATUS];
71
}
70
+ uint32_t status_reg = s->regs[IBEX_SPI_HOST_STATUS];
72
73
static bool trans_cbo_zero(DisasContext *ctx, arg_cbo_zero *a)
74
{
75
REQUIRE_ZICBOZ(ctx);
76
- gen_helper_cbo_zero(tcg_env, cpu_gpr[a->rs1]);
77
+ TCGv src = get_address(ctx, a->rs1, 0);
71
+
78
+
72
+
79
+ gen_helper_cbo_zero(tcg_env, src);
73
+ bool error_en = FIELD_EX32(intr_en_reg, INTR_ENABLE, ERROR);
80
return true;
74
+ bool event_en = FIELD_EX32(intr_en_reg, INTR_ENABLE, SPI_EVENT);
75
+ bool err_pending = FIELD_EX32(intr_state_reg, INTR_STATE, ERROR);
76
+ bool status_pending = FIELD_EX32(intr_state_reg, INTR_STATE, SPI_EVENT);
77
+
78
int err_irq = 0, event_irq = 0;
79
80
/* Error IRQ enabled and Error IRQ Cleared */
81
if (error_en && !err_pending) {
82
/* Event enabled, Interrupt Test Error */
83
- if (s->regs[IBEX_SPI_HOST_INTR_TEST] & R_INTR_TEST_ERROR_MASK) {
84
+ if (FIELD_EX32(intr_test_reg, INTR_TEST, ERROR)) {
85
err_irq = 1;
86
- } else if ((s->regs[IBEX_SPI_HOST_ERROR_ENABLE]
87
- & R_ERROR_ENABLE_CMDBUSY_MASK) &&
88
- s->regs[IBEX_SPI_HOST_ERROR_STATUS]
89
- & R_ERROR_STATUS_CMDBUSY_MASK) {
90
+ } else if (FIELD_EX32(err_en_reg, ERROR_ENABLE, CMDBUSY) &&
91
+ FIELD_EX32(err_status_reg, ERROR_STATUS, CMDBUSY)) {
92
/* Wrote to COMMAND when not READY */
93
err_irq = 1;
94
- } else if ((s->regs[IBEX_SPI_HOST_ERROR_ENABLE]
95
- & R_ERROR_ENABLE_CMDINVAL_MASK) &&
96
- s->regs[IBEX_SPI_HOST_ERROR_STATUS]
97
- & R_ERROR_STATUS_CMDINVAL_MASK) {
98
+ } else if (FIELD_EX32(err_en_reg, ERROR_ENABLE, CMDINVAL) &&
99
+ FIELD_EX32(err_status_reg, ERROR_STATUS, CMDINVAL)) {
100
/* Invalid command segment */
101
err_irq = 1;
102
- } else if ((s->regs[IBEX_SPI_HOST_ERROR_ENABLE]
103
- & R_ERROR_ENABLE_CSIDINVAL_MASK) &&
104
- s->regs[IBEX_SPI_HOST_ERROR_STATUS]
105
- & R_ERROR_STATUS_CSIDINVAL_MASK) {
106
+ } else if (FIELD_EX32(err_en_reg, ERROR_ENABLE, CSIDINVAL) &&
107
+ FIELD_EX32(err_status_reg, ERROR_STATUS, CSIDINVAL)) {
108
/* Invalid value for CSID */
109
err_irq = 1;
110
}
111
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_irq(IbexSPIHostState *s)
112
113
/* Event IRQ Enabled and Event IRQ Cleared */
114
if (event_en && !status_pending) {
115
- if (s->regs[IBEX_SPI_HOST_INTR_TEST] & R_INTR_TEST_SPI_EVENT_MASK) {
116
+ if (FIELD_EX32(intr_test_reg, INTR_STATE, SPI_EVENT)) {
117
/* Event enabled, Interrupt Test Event */
118
event_irq = 1;
119
- } else if ((s->regs[IBEX_SPI_HOST_EVENT_ENABLE]
120
- & R_EVENT_ENABLE_READY_MASK) &&
121
- (s->regs[IBEX_SPI_HOST_STATUS] & R_STATUS_READY_MASK)) {
122
+ } else if (FIELD_EX32(event_en_reg, EVENT_ENABLE, READY) &&
123
+ FIELD_EX32(status_reg, STATUS, READY)) {
124
/* SPI Host ready for next command */
125
event_irq = 1;
126
- } else if ((s->regs[IBEX_SPI_HOST_EVENT_ENABLE]
127
- & R_EVENT_ENABLE_TXEMPTY_MASK) &&
128
- (s->regs[IBEX_SPI_HOST_STATUS] & R_STATUS_TXEMPTY_MASK)) {
129
+ } else if (FIELD_EX32(event_en_reg, EVENT_ENABLE, TXEMPTY) &&
130
+ FIELD_EX32(status_reg, STATUS, TXEMPTY)) {
131
/* SPI TXEMPTY, TXFIFO drained */
132
event_irq = 1;
133
- } else if ((s->regs[IBEX_SPI_HOST_EVENT_ENABLE]
134
- & R_EVENT_ENABLE_RXFULL_MASK) &&
135
- (s->regs[IBEX_SPI_HOST_STATUS] & R_STATUS_RXFULL_MASK)) {
136
+ } else if (FIELD_EX32(event_en_reg, EVENT_ENABLE, RXFULL) &&
137
+ FIELD_EX32(status_reg, STATUS, RXFULL)) {
138
/* SPI RXFULL, RXFIFO full */
139
event_irq = 1;
140
}
141
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_irq(IbexSPIHostState *s)
142
143
static void ibex_spi_host_transfer(IbexSPIHostState *s)
144
{
145
- uint32_t rx, tx;
146
+ uint32_t rx, tx, data;
147
/* Get num of one byte transfers */
148
- uint8_t segment_len = ((s->regs[IBEX_SPI_HOST_COMMAND] & R_COMMAND_LEN_MASK)
149
- >> R_COMMAND_LEN_SHIFT);
150
+ uint8_t segment_len = FIELD_EX32(s->regs[IBEX_SPI_HOST_COMMAND],
151
+ COMMAND, LEN);
152
+
153
while (segment_len > 0) {
154
if (fifo8_is_empty(&s->tx_fifo)) {
155
/* Assert Stall */
156
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_transfer(IbexSPIHostState *s)
157
--segment_len;
158
}
159
160
+ data = s->regs[IBEX_SPI_HOST_STATUS];
161
/* Assert Ready */
162
- s->regs[IBEX_SPI_HOST_STATUS] |= R_STATUS_READY_MASK;
163
+ data = FIELD_DP32(data, STATUS, READY, 1);
164
/* Set RXQD */
165
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_RXQD_MASK;
166
- s->regs[IBEX_SPI_HOST_STATUS] |= (R_STATUS_RXQD_MASK
167
- & div4_round_up(segment_len));
168
+ data = FIELD_DP32(data, STATUS, RXQD, div4_round_up(segment_len));
169
/* Set TXQD */
170
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_TXQD_MASK;
171
- s->regs[IBEX_SPI_HOST_STATUS] |= (fifo8_num_used(&s->tx_fifo) / 4)
172
- & R_STATUS_TXQD_MASK;
173
+ data = FIELD_DP32(data, STATUS, TXQD, fifo8_num_used(&s->tx_fifo) / 4);
174
/* Clear TXFULL */
175
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_TXFULL_MASK;
176
- /* Assert TXEMPTY and drop remaining bytes that exceed segment_len */
177
- ibex_spi_txfifo_reset(s);
178
+ data = FIELD_DP32(data, STATUS, TXFULL, 0);
179
/* Reset RXEMPTY */
180
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_RXEMPTY_MASK;
181
+ data = FIELD_DP32(data, STATUS, RXEMPTY, 0);
182
+ /* Update register status */
183
+ s->regs[IBEX_SPI_HOST_STATUS] = data;
184
+ /* Drop remaining bytes that exceed segment_len */
185
+ ibex_spi_txfifo_reset(s);
186
187
ibex_spi_host_irq(s);
188
}
81
}
189
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
190
{
191
IbexSPIHostState *s = opaque;
192
uint32_t val32 = val64;
193
- uint32_t shift_mask = 0xff;
194
+ uint32_t shift_mask = 0xff, status = 0;
195
uint8_t txqd_len;
196
197
trace_ibex_spi_host_write(addr, size, val64);
198
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
199
s->regs[addr] = val32;
200
201
/* STALL, IP not enabled */
202
- if (!(s->regs[IBEX_SPI_HOST_CONTROL] & R_CONTROL_SPIEN_MASK)) {
203
+ if (!(FIELD_EX32(s->regs[IBEX_SPI_HOST_CONTROL],
204
+ CONTROL, SPIEN))) {
205
return;
206
}
207
208
/* SPI not ready, IRQ Error */
209
- if (!(s->regs[IBEX_SPI_HOST_STATUS] & R_STATUS_READY_MASK)) {
210
+ if (!(FIELD_EX32(s->regs[IBEX_SPI_HOST_STATUS],
211
+ STATUS, READY))) {
212
s->regs[IBEX_SPI_HOST_ERROR_STATUS] |= R_ERROR_STATUS_CMDBUSY_MASK;
213
ibex_spi_host_irq(s);
214
return;
215
}
216
+
217
/* Assert Not Ready */
218
s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_READY_MASK;
219
220
- if (((val32 & R_COMMAND_DIRECTION_MASK) >> R_COMMAND_DIRECTION_SHIFT)
221
- != BIDIRECTIONAL_TRANSFER) {
222
- qemu_log_mask(LOG_UNIMP,
223
+ if (FIELD_EX32(val32, COMMAND, DIRECTION) != BIDIRECTIONAL_TRANSFER) {
224
+ qemu_log_mask(LOG_UNIMP,
225
"%s: Rx Only/Tx Only are not supported\n", __func__);
226
}
227
228
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
229
return;
230
}
231
/* Byte ordering is set by the IP */
232
- if ((s->regs[IBEX_SPI_HOST_STATUS] &
233
- R_STATUS_BYTEORDER_MASK) == 0) {
234
+ status = s->regs[IBEX_SPI_HOST_STATUS];
235
+ if (FIELD_EX32(status, STATUS, BYTEORDER) == 0) {
236
/* LE: LSB transmitted first (default for ibex processor) */
237
shift_mask = 0xff << (i * 8);
238
} else {
239
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
240
241
fifo8_push(&s->tx_fifo, (val32 & shift_mask) >> (i * 8));
242
}
243
-
244
+ status = s->regs[IBEX_SPI_HOST_STATUS];
245
/* Reset TXEMPTY */
246
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_TXEMPTY_MASK;
247
+ status = FIELD_DP32(status, STATUS, TXEMPTY, 0);
248
/* Update TXQD */
249
- txqd_len = (s->regs[IBEX_SPI_HOST_STATUS] &
250
- R_STATUS_TXQD_MASK) >> R_STATUS_TXQD_SHIFT;
251
+ txqd_len = FIELD_EX32(status, STATUS, TXQD);
252
/* Partial bytes (size < 4) are padded, in words. */
253
txqd_len += 1;
254
- s->regs[IBEX_SPI_HOST_STATUS] &= ~R_STATUS_TXQD_MASK;
255
- s->regs[IBEX_SPI_HOST_STATUS] |= txqd_len;
256
+ status = FIELD_DP32(status, STATUS, TXQD, txqd_len);
257
/* Assert Ready */
258
- s->regs[IBEX_SPI_HOST_STATUS] |= R_STATUS_READY_MASK;
259
+ status = FIELD_DP32(status, STATUS, READY, 1);
260
+ /* Update register status */
261
+ s->regs[IBEX_SPI_HOST_STATUS] = status;
262
break;
263
case IBEX_SPI_HOST_ERROR_ENABLE:
264
s->regs[addr] = val32;
265
--
82
--
266
2.37.3
83
2.45.1
diff view generated by jsdifflib
1
From: Jim Shu <jim.shu@sifive.com>
1
From: Yong-Xuan Wang <yongxuan.wang@sifive.com>
2
2
3
The maximum priority level is hard-coded when writing to interrupt
3
In AIA spec, each hart (or each hart within a group) has a unique hart
4
priority register. However, when writing to priority threshold register,
4
number to locate the memory pages of interrupt files in the address
5
the maximum priority level is from num_priorities Property which is
5
space. The number of bits required to represent any hart number is equal
6
configured by platform.
6
to ceil(log2(hmax + 1)), where hmax is the largest hart number among
7
groups.
7
8
8
Also change interrupt priority register to use num_priorities Property
9
However, if the largest hart number among groups is a power of 2, QEMU
9
in maximum priority level.
10
will pass an inaccurate hart-index-bit setting to Linux. For example, when
11
the guest OS has 4 harts, only ceil(log2(3 + 1)) = 2 bits are sufficient
12
to represent 4 harts, but we passes 3 to Linux. The code needs to be
13
updated to ensure accurate hart-index-bit settings.
10
14
11
Signed-off-by: Emmanuel Blot <emmanuel.blot@sifive.com>
15
Additionally, a Linux patch[1] is necessary to correctly recover the hart
12
Signed-off-by: Jim Shu <jim.shu@sifive.com>
16
index when the guest OS has only 1 hart, where the hart-index-bit is 0.
13
Reviewed-by: Frank Chang <frank.chang@sifive.com>
17
14
Acked-by: Alistair Francis <alistair.francis@wdc.com>
18
[1] https://lore.kernel.org/lkml/20240415064905.25184-1-yongxuan.wang@sifive.com/t/
15
Message-Id: <20221003041440.2320-2-jim.shu@sifive.com>
19
20
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
21
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
22
Cc: qemu-stable <qemu-stable@nongnu.org>
23
Message-ID: <20240515091129.28116-1-yongxuan.wang@sifive.com>
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
24
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
---
25
---
18
hw/intc/sifive_plic.c | 6 ++++--
26
target/riscv/kvm/kvm-cpu.c | 9 ++++++++-
19
1 file changed, 4 insertions(+), 2 deletions(-)
27
1 file changed, 8 insertions(+), 1 deletion(-)
20
28
21
diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c
29
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
22
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/intc/sifive_plic.c
31
--- a/target/riscv/kvm/kvm-cpu.c
24
+++ b/hw/intc/sifive_plic.c
32
+++ b/target/riscv/kvm/kvm-cpu.c
25
@@ -XXX,XX +XXX,XX @@ static void sifive_plic_write(void *opaque, hwaddr addr, uint64_t value,
33
@@ -XXX,XX +XXX,XX @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
26
if (addr_between(addr, plic->priority_base, plic->num_sources << 2)) {
34
}
27
uint32_t irq = ((addr - plic->priority_base) >> 2) + 1;
35
}
28
36
29
- plic->source_priority[irq] = value & 7;
37
- hart_bits = find_last_bit(&max_hart_per_socket, BITS_PER_LONG) + 1;
30
- sifive_plic_update(plic);
38
+
31
+ if (value <= plic->num_priorities) {
39
+ if (max_hart_per_socket > 1) {
32
+ plic->source_priority[irq] = value;
40
+ max_hart_per_socket--;
33
+ sifive_plic_update(plic);
41
+ hart_bits = find_last_bit(&max_hart_per_socket, BITS_PER_LONG) + 1;
34
+ }
42
+ } else {
35
} else if (addr_between(addr, plic->pending_base,
43
+ hart_bits = 0;
36
plic->num_sources >> 3)) {
44
+ }
37
qemu_log_mask(LOG_GUEST_ERROR,
45
+
46
ret = kvm_device_access(aia_fd, KVM_DEV_RISCV_AIA_GRP_CONFIG,
47
KVM_DEV_RISCV_AIA_CONFIG_HART_BITS,
48
&hart_bits, true, NULL);
38
--
49
--
39
2.37.3
50
2.45.1
diff view generated by jsdifflib
1
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2
2
3
This patch adds the `rw1c` functionality to the respective
3
Commit 33a24910ae changed 'reg_width' to use 'vlenb', i.e. vector length
4
registers. The status fields are cleared when the respective
4
in bytes, when in this context we want 'reg_width' as the length in
5
field is set.
5
bits.
6
6
7
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
7
Fix 'reg_width' back to the value in bits like 7cb59921c05a
8
("target/riscv/gdbstub.c: use 'vlenb' instead of shifting 'vlen'") set
9
beforehand.
10
11
While we're at it, rename 'reg_width' to 'bitsize' to provide a bit more
12
clarity about what the variable represents. 'bitsize' is also used in
13
riscv_gen_dynamic_csr_feature() with the same purpose, i.e. as an input to
14
gdb_feature_builder_append_reg().
15
16
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
17
Cc: Alex Bennée <alex.bennee@linaro.org>
18
Reported-by: Robin Dapp <rdapp.gcc@gmail.com>
19
Fixes: 33a24910ae ("target/riscv: Use GDBFeature for dynamic XML")
20
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
21
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
22
Acked-by: Alex Bennée <alex.bennee@linaro.org>
23
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
24
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-Id: <20220930033241.206581-3-wilfred.mallawa@opensource.wdc.com>
25
Cc: qemu-stable <qemu-stable@nongnu.org>
26
Message-ID: <20240517203054.880861-2-dbarboza@ventanamicro.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
27
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
28
---
12
include/hw/ssi/ibex_spi_host.h | 4 ++--
29
target/riscv/gdbstub.c | 6 +++---
13
hw/ssi/ibex_spi_host.c | 36 +++++++++++++++++++++++++++++++---
30
1 file changed, 3 insertions(+), 3 deletions(-)
14
2 files changed, 35 insertions(+), 5 deletions(-)
15
31
16
diff --git a/include/hw/ssi/ibex_spi_host.h b/include/hw/ssi/ibex_spi_host.h
32
diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
17
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/ssi/ibex_spi_host.h
34
--- a/target/riscv/gdbstub.c
19
+++ b/include/hw/ssi/ibex_spi_host.h
35
+++ b/target/riscv/gdbstub.c
20
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@ static GDBFeature *riscv_gen_dynamic_csr_feature(CPUState *cs, int base_reg)
21
OBJECT_CHECK(IbexSPIHostState, (obj), TYPE_IBEX_SPI_HOST)
37
static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
22
23
/* SPI Registers */
24
-#define IBEX_SPI_HOST_INTR_STATE (0x00 / 4) /* rw */
25
+#define IBEX_SPI_HOST_INTR_STATE (0x00 / 4) /* rw1c */
26
#define IBEX_SPI_HOST_INTR_ENABLE (0x04 / 4) /* rw */
27
#define IBEX_SPI_HOST_INTR_TEST (0x08 / 4) /* wo */
28
#define IBEX_SPI_HOST_ALERT_TEST (0x0c / 4) /* wo */
29
@@ -XXX,XX +XXX,XX @@
30
#define IBEX_SPI_HOST_TXDATA (0x28 / 4)
31
32
#define IBEX_SPI_HOST_ERROR_ENABLE (0x2c / 4) /* rw */
33
-#define IBEX_SPI_HOST_ERROR_STATUS (0x30 / 4) /* rw */
34
+#define IBEX_SPI_HOST_ERROR_STATUS (0x30 / 4) /* rw1c */
35
#define IBEX_SPI_HOST_EVENT_ENABLE (0x34 / 4) /* rw */
36
37
/* FIFO Len in Bytes */
38
diff --git a/hw/ssi/ibex_spi_host.c b/hw/ssi/ibex_spi_host.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/ssi/ibex_spi_host.c
41
+++ b/hw/ssi/ibex_spi_host.c
42
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
43
{
38
{
44
IbexSPIHostState *s = opaque;
39
RISCVCPU *cpu = RISCV_CPU(cs);
45
uint32_t val32 = val64;
40
- int reg_width = cpu->cfg.vlenb;
46
- uint32_t shift_mask = 0xff, status = 0;
41
+ int bitsize = cpu->cfg.vlenb << 3;
47
+ uint32_t shift_mask = 0xff, status = 0, data = 0;
42
GDBFeatureBuilder builder;
48
uint8_t txqd_len;
43
int i;
49
44
50
trace_ibex_spi_host_write(addr, size, val64);
45
@@ -XXX,XX +XXX,XX @@ static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
51
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
46
52
47
/* First define types and totals in a whole VL */
53
switch (addr) {
48
for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) {
54
/* Skipping any R/O registers */
49
- int count = reg_width / vec_lanes[i].size;
55
- case IBEX_SPI_HOST_INTR_STATE...IBEX_SPI_HOST_INTR_ENABLE:
50
+ int count = bitsize / vec_lanes[i].size;
56
+ case IBEX_SPI_HOST_INTR_STATE:
51
gdb_feature_builder_append_tag(
57
+ /* rw1c status register */
52
&builder, "<vector id=\"%s\" type=\"%s\" count=\"%d\"/>",
58
+ if (FIELD_EX32(val32, INTR_STATE, ERROR)) {
53
vec_lanes[i].id, vec_lanes[i].gdb_type, count);
59
+ data = FIELD_DP32(data, INTR_STATE, ERROR, 0);
54
@@ -XXX,XX +XXX,XX @@ static GDBFeature *ricsv_gen_dynamic_vector_feature(CPUState *cs, int base_reg)
60
+ }
55
/* Define vector registers */
61
+ if (FIELD_EX32(val32, INTR_STATE, SPI_EVENT)) {
56
for (i = 0; i < 32; i++) {
62
+ data = FIELD_DP32(data, INTR_STATE, SPI_EVENT, 0);
57
gdb_feature_builder_append_reg(&builder, g_strdup_printf("v%d", i),
63
+ }
58
- reg_width, i, "riscv_vector", "vector");
64
+ s->regs[addr] = data;
59
+ bitsize, i, "riscv_vector", "vector");
65
+ break;
60
}
66
+ case IBEX_SPI_HOST_INTR_ENABLE:
61
67
s->regs[addr] = val32;
62
gdb_feature_builder_end(&builder);
68
break;
69
case IBEX_SPI_HOST_INTR_TEST:
70
@@ -XXX,XX +XXX,XX @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
71
* When an error occurs, the corresponding bit must be cleared
72
* here before issuing any further commands
73
*/
74
- s->regs[addr] = val32;
75
+ status = s->regs[addr];
76
+ /* rw1c status register */
77
+ if (FIELD_EX32(val32, ERROR_STATUS, CMDBUSY)) {
78
+ status = FIELD_DP32(status, ERROR_STATUS, CMDBUSY, 0);
79
+ }
80
+ if (FIELD_EX32(val32, ERROR_STATUS, OVERFLOW)) {
81
+ status = FIELD_DP32(status, ERROR_STATUS, OVERFLOW, 0);
82
+ }
83
+ if (FIELD_EX32(val32, ERROR_STATUS, UNDERFLOW)) {
84
+ status = FIELD_DP32(status, ERROR_STATUS, UNDERFLOW, 0);
85
+ }
86
+ if (FIELD_EX32(val32, ERROR_STATUS, CMDINVAL)) {
87
+ status = FIELD_DP32(status, ERROR_STATUS, CMDINVAL, 0);
88
+ }
89
+ if (FIELD_EX32(val32, ERROR_STATUS, CSIDINVAL)) {
90
+ status = FIELD_DP32(status, ERROR_STATUS, CSIDINVAL, 0);
91
+ }
92
+ if (FIELD_EX32(val32, ERROR_STATUS, ACCESSINVAL)) {
93
+ status = FIELD_DP32(status, ERROR_STATUS, ACCESSINVAL, 0);
94
+ }
95
+ s->regs[addr] = status;
96
break;
97
case IBEX_SPI_HOST_EVENT_ENABLE:
98
/* Controls which classes of SPI events raise an interrupt. */
99
--
63
--
100
2.37.3
64
2.45.1
65
66
diff view generated by jsdifflib
1
From: Yang Liu <liuyang22@iscas.ac.cn>
1
From: Alistair Francis <alistair23@gmail.com>
2
2
3
Tested with https://github.com/ksco/rvv-decoder-tests
3
Previously we only listed a single pmpcfg CSR and the first 16 pmpaddr
4
CSRs. This patch fixes this to list all 16 pmpcfg and all 64 pmpaddr
5
CSRs are part of the disassembly.
4
6
5
Expected checkpatch errors for consistency and brevity reasons:
7
Reported-by: Eric DeVolder <eric_devolder@yahoo.com>
6
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7
ERROR: line over 90 characters
9
Fixes: ea10325917 ("RISC-V Disassembler")
8
ERROR: trailing statements should be on next line
10
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
9
ERROR: braces {} are necessary for all arms of this statement
11
Cc: qemu-stable <qemu-stable@nongnu.org>
10
12
Message-ID: <20240514051615.330979-1-alistair.francis@wdc.com>
11
Signed-off-by: Yang Liu <liuyang22@iscas.ac.cn>
12
Acked-by: Alistair Francis <alistair.francis@wdc.com>
13
Message-Id: <20220928051842.16207-1-liuyang22@iscas.ac.cn>
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
---
14
---
16
disas/riscv.c | 1432 ++++++++++++++++++++++++++++++++++++++++++++++++-
15
disas/riscv.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++-
17
1 file changed, 1430 insertions(+), 2 deletions(-)
16
1 file changed, 64 insertions(+), 1 deletion(-)
18
17
19
diff --git a/disas/riscv.c b/disas/riscv.c
18
diff --git a/disas/riscv.c b/disas/riscv.c
20
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
21
--- a/disas/riscv.c
20
--- a/disas/riscv.c
22
+++ b/disas/riscv.c
21
+++ b/disas/riscv.c
23
@@ -XXX,XX +XXX,XX @@ typedef enum {
24
rv_codec_css_sqsp,
25
rv_codec_k_bs,
26
rv_codec_k_rnum,
27
+ rv_codec_v_r,
28
+ rv_codec_v_ldst,
29
+ rv_codec_v_i,
30
+ rv_codec_vsetvli,
31
+ rv_codec_vsetivli,
32
} rv_codec;
33
34
typedef enum {
35
@@ -XXX,XX +XXX,XX @@ typedef enum {
36
rv_op_zip = 396,
37
rv_op_xperm4 = 397,
38
rv_op_xperm8 = 398,
39
+ rv_op_vle8_v = 399,
40
+ rv_op_vle16_v = 400,
41
+ rv_op_vle32_v = 401,
42
+ rv_op_vle64_v = 402,
43
+ rv_op_vse8_v = 403,
44
+ rv_op_vse16_v = 404,
45
+ rv_op_vse32_v = 405,
46
+ rv_op_vse64_v = 406,
47
+ rv_op_vlm_v = 407,
48
+ rv_op_vsm_v = 408,
49
+ rv_op_vlse8_v = 409,
50
+ rv_op_vlse16_v = 410,
51
+ rv_op_vlse32_v = 411,
52
+ rv_op_vlse64_v = 412,
53
+ rv_op_vsse8_v = 413,
54
+ rv_op_vsse16_v = 414,
55
+ rv_op_vsse32_v = 415,
56
+ rv_op_vsse64_v = 416,
57
+ rv_op_vluxei8_v = 417,
58
+ rv_op_vluxei16_v = 418,
59
+ rv_op_vluxei32_v = 419,
60
+ rv_op_vluxei64_v = 420,
61
+ rv_op_vloxei8_v = 421,
62
+ rv_op_vloxei16_v = 422,
63
+ rv_op_vloxei32_v = 423,
64
+ rv_op_vloxei64_v = 424,
65
+ rv_op_vsuxei8_v = 425,
66
+ rv_op_vsuxei16_v = 426,
67
+ rv_op_vsuxei32_v = 427,
68
+ rv_op_vsuxei64_v = 428,
69
+ rv_op_vsoxei8_v = 429,
70
+ rv_op_vsoxei16_v = 430,
71
+ rv_op_vsoxei32_v = 431,
72
+ rv_op_vsoxei64_v = 432,
73
+ rv_op_vle8ff_v = 433,
74
+ rv_op_vle16ff_v = 434,
75
+ rv_op_vle32ff_v = 435,
76
+ rv_op_vle64ff_v = 436,
77
+ rv_op_vl1re8_v = 437,
78
+ rv_op_vl1re16_v = 438,
79
+ rv_op_vl1re32_v = 439,
80
+ rv_op_vl1re64_v = 440,
81
+ rv_op_vl2re8_v = 441,
82
+ rv_op_vl2re16_v = 442,
83
+ rv_op_vl2re32_v = 443,
84
+ rv_op_vl2re64_v = 444,
85
+ rv_op_vl4re8_v = 445,
86
+ rv_op_vl4re16_v = 446,
87
+ rv_op_vl4re32_v = 447,
88
+ rv_op_vl4re64_v = 448,
89
+ rv_op_vl8re8_v = 449,
90
+ rv_op_vl8re16_v = 450,
91
+ rv_op_vl8re32_v = 451,
92
+ rv_op_vl8re64_v = 452,
93
+ rv_op_vs1r_v = 453,
94
+ rv_op_vs2r_v = 454,
95
+ rv_op_vs4r_v = 455,
96
+ rv_op_vs8r_v = 456,
97
+ rv_op_vadd_vv = 457,
98
+ rv_op_vadd_vx = 458,
99
+ rv_op_vadd_vi = 459,
100
+ rv_op_vsub_vv = 460,
101
+ rv_op_vsub_vx = 461,
102
+ rv_op_vrsub_vx = 462,
103
+ rv_op_vrsub_vi = 463,
104
+ rv_op_vwaddu_vv = 464,
105
+ rv_op_vwaddu_vx = 465,
106
+ rv_op_vwadd_vv = 466,
107
+ rv_op_vwadd_vx = 467,
108
+ rv_op_vwsubu_vv = 468,
109
+ rv_op_vwsubu_vx = 469,
110
+ rv_op_vwsub_vv = 470,
111
+ rv_op_vwsub_vx = 471,
112
+ rv_op_vwaddu_wv = 472,
113
+ rv_op_vwaddu_wx = 473,
114
+ rv_op_vwadd_wv = 474,
115
+ rv_op_vwadd_wx = 475,
116
+ rv_op_vwsubu_wv = 476,
117
+ rv_op_vwsubu_wx = 477,
118
+ rv_op_vwsub_wv = 478,
119
+ rv_op_vwsub_wx = 479,
120
+ rv_op_vadc_vvm = 480,
121
+ rv_op_vadc_vxm = 481,
122
+ rv_op_vadc_vim = 482,
123
+ rv_op_vmadc_vvm = 483,
124
+ rv_op_vmadc_vxm = 484,
125
+ rv_op_vmadc_vim = 485,
126
+ rv_op_vsbc_vvm = 486,
127
+ rv_op_vsbc_vxm = 487,
128
+ rv_op_vmsbc_vvm = 488,
129
+ rv_op_vmsbc_vxm = 489,
130
+ rv_op_vand_vv = 490,
131
+ rv_op_vand_vx = 491,
132
+ rv_op_vand_vi = 492,
133
+ rv_op_vor_vv = 493,
134
+ rv_op_vor_vx = 494,
135
+ rv_op_vor_vi = 495,
136
+ rv_op_vxor_vv = 496,
137
+ rv_op_vxor_vx = 497,
138
+ rv_op_vxor_vi = 498,
139
+ rv_op_vsll_vv = 499,
140
+ rv_op_vsll_vx = 500,
141
+ rv_op_vsll_vi = 501,
142
+ rv_op_vsrl_vv = 502,
143
+ rv_op_vsrl_vx = 503,
144
+ rv_op_vsrl_vi = 504,
145
+ rv_op_vsra_vv = 505,
146
+ rv_op_vsra_vx = 506,
147
+ rv_op_vsra_vi = 507,
148
+ rv_op_vnsrl_wv = 508,
149
+ rv_op_vnsrl_wx = 509,
150
+ rv_op_vnsrl_wi = 510,
151
+ rv_op_vnsra_wv = 511,
152
+ rv_op_vnsra_wx = 512,
153
+ rv_op_vnsra_wi = 513,
154
+ rv_op_vmseq_vv = 514,
155
+ rv_op_vmseq_vx = 515,
156
+ rv_op_vmseq_vi = 516,
157
+ rv_op_vmsne_vv = 517,
158
+ rv_op_vmsne_vx = 518,
159
+ rv_op_vmsne_vi = 519,
160
+ rv_op_vmsltu_vv = 520,
161
+ rv_op_vmsltu_vx = 521,
162
+ rv_op_vmslt_vv = 522,
163
+ rv_op_vmslt_vx = 523,
164
+ rv_op_vmsleu_vv = 524,
165
+ rv_op_vmsleu_vx = 525,
166
+ rv_op_vmsleu_vi = 526,
167
+ rv_op_vmsle_vv = 527,
168
+ rv_op_vmsle_vx = 528,
169
+ rv_op_vmsle_vi = 529,
170
+ rv_op_vmsgtu_vx = 530,
171
+ rv_op_vmsgtu_vi = 531,
172
+ rv_op_vmsgt_vx = 532,
173
+ rv_op_vmsgt_vi = 533,
174
+ rv_op_vminu_vv = 534,
175
+ rv_op_vminu_vx = 535,
176
+ rv_op_vmin_vv = 536,
177
+ rv_op_vmin_vx = 537,
178
+ rv_op_vmaxu_vv = 538,
179
+ rv_op_vmaxu_vx = 539,
180
+ rv_op_vmax_vv = 540,
181
+ rv_op_vmax_vx = 541,
182
+ rv_op_vmul_vv = 542,
183
+ rv_op_vmul_vx = 543,
184
+ rv_op_vmulh_vv = 544,
185
+ rv_op_vmulh_vx = 545,
186
+ rv_op_vmulhu_vv = 546,
187
+ rv_op_vmulhu_vx = 547,
188
+ rv_op_vmulhsu_vv = 548,
189
+ rv_op_vmulhsu_vx = 549,
190
+ rv_op_vdivu_vv = 550,
191
+ rv_op_vdivu_vx = 551,
192
+ rv_op_vdiv_vv = 552,
193
+ rv_op_vdiv_vx = 553,
194
+ rv_op_vremu_vv = 554,
195
+ rv_op_vremu_vx = 555,
196
+ rv_op_vrem_vv = 556,
197
+ rv_op_vrem_vx = 557,
198
+ rv_op_vwmulu_vv = 558,
199
+ rv_op_vwmulu_vx = 559,
200
+ rv_op_vwmulsu_vv = 560,
201
+ rv_op_vwmulsu_vx = 561,
202
+ rv_op_vwmul_vv = 562,
203
+ rv_op_vwmul_vx = 563,
204
+ rv_op_vmacc_vv = 564,
205
+ rv_op_vmacc_vx = 565,
206
+ rv_op_vnmsac_vv = 566,
207
+ rv_op_vnmsac_vx = 567,
208
+ rv_op_vmadd_vv = 568,
209
+ rv_op_vmadd_vx = 569,
210
+ rv_op_vnmsub_vv = 570,
211
+ rv_op_vnmsub_vx = 571,
212
+ rv_op_vwmaccu_vv = 572,
213
+ rv_op_vwmaccu_vx = 573,
214
+ rv_op_vwmacc_vv = 574,
215
+ rv_op_vwmacc_vx = 575,
216
+ rv_op_vwmaccsu_vv = 576,
217
+ rv_op_vwmaccsu_vx = 577,
218
+ rv_op_vwmaccus_vx = 578,
219
+ rv_op_vmv_v_v = 579,
220
+ rv_op_vmv_v_x = 580,
221
+ rv_op_vmv_v_i = 581,
222
+ rv_op_vmerge_vvm = 582,
223
+ rv_op_vmerge_vxm = 583,
224
+ rv_op_vmerge_vim = 584,
225
+ rv_op_vsaddu_vv = 585,
226
+ rv_op_vsaddu_vx = 586,
227
+ rv_op_vsaddu_vi = 587,
228
+ rv_op_vsadd_vv = 588,
229
+ rv_op_vsadd_vx = 589,
230
+ rv_op_vsadd_vi = 590,
231
+ rv_op_vssubu_vv = 591,
232
+ rv_op_vssubu_vx = 592,
233
+ rv_op_vssub_vv = 593,
234
+ rv_op_vssub_vx = 594,
235
+ rv_op_vaadd_vv = 595,
236
+ rv_op_vaadd_vx = 596,
237
+ rv_op_vaaddu_vv = 597,
238
+ rv_op_vaaddu_vx = 598,
239
+ rv_op_vasub_vv = 599,
240
+ rv_op_vasub_vx = 600,
241
+ rv_op_vasubu_vv = 601,
242
+ rv_op_vasubu_vx = 602,
243
+ rv_op_vsmul_vv = 603,
244
+ rv_op_vsmul_vx = 604,
245
+ rv_op_vssrl_vv = 605,
246
+ rv_op_vssrl_vx = 606,
247
+ rv_op_vssrl_vi = 607,
248
+ rv_op_vssra_vv = 608,
249
+ rv_op_vssra_vx = 609,
250
+ rv_op_vssra_vi = 610,
251
+ rv_op_vnclipu_wv = 611,
252
+ rv_op_vnclipu_wx = 612,
253
+ rv_op_vnclipu_wi = 613,
254
+ rv_op_vnclip_wv = 614,
255
+ rv_op_vnclip_wx = 615,
256
+ rv_op_vnclip_wi = 616,
257
+ rv_op_vfadd_vv = 617,
258
+ rv_op_vfadd_vf = 618,
259
+ rv_op_vfsub_vv = 619,
260
+ rv_op_vfsub_vf = 620,
261
+ rv_op_vfrsub_vf = 621,
262
+ rv_op_vfwadd_vv = 622,
263
+ rv_op_vfwadd_vf = 623,
264
+ rv_op_vfwadd_wv = 624,
265
+ rv_op_vfwadd_wf = 625,
266
+ rv_op_vfwsub_vv = 626,
267
+ rv_op_vfwsub_vf = 627,
268
+ rv_op_vfwsub_wv = 628,
269
+ rv_op_vfwsub_wf = 629,
270
+ rv_op_vfmul_vv = 630,
271
+ rv_op_vfmul_vf = 631,
272
+ rv_op_vfdiv_vv = 632,
273
+ rv_op_vfdiv_vf = 633,
274
+ rv_op_vfrdiv_vf = 634,
275
+ rv_op_vfwmul_vv = 635,
276
+ rv_op_vfwmul_vf = 636,
277
+ rv_op_vfmacc_vv = 637,
278
+ rv_op_vfmacc_vf = 638,
279
+ rv_op_vfnmacc_vv = 639,
280
+ rv_op_vfnmacc_vf = 640,
281
+ rv_op_vfmsac_vv = 641,
282
+ rv_op_vfmsac_vf = 642,
283
+ rv_op_vfnmsac_vv = 643,
284
+ rv_op_vfnmsac_vf = 644,
285
+ rv_op_vfmadd_vv = 645,
286
+ rv_op_vfmadd_vf = 646,
287
+ rv_op_vfnmadd_vv = 647,
288
+ rv_op_vfnmadd_vf = 648,
289
+ rv_op_vfmsub_vv = 649,
290
+ rv_op_vfmsub_vf = 650,
291
+ rv_op_vfnmsub_vv = 651,
292
+ rv_op_vfnmsub_vf = 652,
293
+ rv_op_vfwmacc_vv = 653,
294
+ rv_op_vfwmacc_vf = 654,
295
+ rv_op_vfwnmacc_vv = 655,
296
+ rv_op_vfwnmacc_vf = 656,
297
+ rv_op_vfwmsac_vv = 657,
298
+ rv_op_vfwmsac_vf = 658,
299
+ rv_op_vfwnmsac_vv = 659,
300
+ rv_op_vfwnmsac_vf = 660,
301
+ rv_op_vfsqrt_v = 661,
302
+ rv_op_vfrsqrt7_v = 662,
303
+ rv_op_vfrec7_v = 663,
304
+ rv_op_vfmin_vv = 664,
305
+ rv_op_vfmin_vf = 665,
306
+ rv_op_vfmax_vv = 666,
307
+ rv_op_vfmax_vf = 667,
308
+ rv_op_vfsgnj_vv = 668,
309
+ rv_op_vfsgnj_vf = 669,
310
+ rv_op_vfsgnjn_vv = 670,
311
+ rv_op_vfsgnjn_vf = 671,
312
+ rv_op_vfsgnjx_vv = 672,
313
+ rv_op_vfsgnjx_vf = 673,
314
+ rv_op_vfslide1up_vf = 674,
315
+ rv_op_vfslide1down_vf = 675,
316
+ rv_op_vmfeq_vv = 676,
317
+ rv_op_vmfeq_vf = 677,
318
+ rv_op_vmfne_vv = 678,
319
+ rv_op_vmfne_vf = 679,
320
+ rv_op_vmflt_vv = 680,
321
+ rv_op_vmflt_vf = 681,
322
+ rv_op_vmfle_vv = 682,
323
+ rv_op_vmfle_vf = 683,
324
+ rv_op_vmfgt_vf = 684,
325
+ rv_op_vmfge_vf = 685,
326
+ rv_op_vfclass_v = 686,
327
+ rv_op_vfmerge_vfm = 687,
328
+ rv_op_vfmv_v_f = 688,
329
+ rv_op_vfcvt_xu_f_v = 689,
330
+ rv_op_vfcvt_x_f_v = 690,
331
+ rv_op_vfcvt_f_xu_v = 691,
332
+ rv_op_vfcvt_f_x_v = 692,
333
+ rv_op_vfcvt_rtz_xu_f_v = 693,
334
+ rv_op_vfcvt_rtz_x_f_v = 694,
335
+ rv_op_vfwcvt_xu_f_v = 695,
336
+ rv_op_vfwcvt_x_f_v = 696,
337
+ rv_op_vfwcvt_f_xu_v = 697,
338
+ rv_op_vfwcvt_f_x_v = 698,
339
+ rv_op_vfwcvt_f_f_v = 699,
340
+ rv_op_vfwcvt_rtz_xu_f_v = 700,
341
+ rv_op_vfwcvt_rtz_x_f_v = 701,
342
+ rv_op_vfncvt_xu_f_w = 702,
343
+ rv_op_vfncvt_x_f_w = 703,
344
+ rv_op_vfncvt_f_xu_w = 704,
345
+ rv_op_vfncvt_f_x_w = 705,
346
+ rv_op_vfncvt_f_f_w = 706,
347
+ rv_op_vfncvt_rod_f_f_w = 707,
348
+ rv_op_vfncvt_rtz_xu_f_w = 708,
349
+ rv_op_vfncvt_rtz_x_f_w = 709,
350
+ rv_op_vredsum_vs = 710,
351
+ rv_op_vredand_vs = 711,
352
+ rv_op_vredor_vs = 712,
353
+ rv_op_vredxor_vs = 713,
354
+ rv_op_vredminu_vs = 714,
355
+ rv_op_vredmin_vs = 715,
356
+ rv_op_vredmaxu_vs = 716,
357
+ rv_op_vredmax_vs = 717,
358
+ rv_op_vwredsumu_vs = 718,
359
+ rv_op_vwredsum_vs = 719,
360
+ rv_op_vfredusum_vs = 720,
361
+ rv_op_vfredosum_vs = 721,
362
+ rv_op_vfredmin_vs = 722,
363
+ rv_op_vfredmax_vs = 723,
364
+ rv_op_vfwredusum_vs = 724,
365
+ rv_op_vfwredosum_vs = 725,
366
+ rv_op_vmand_mm = 726,
367
+ rv_op_vmnand_mm = 727,
368
+ rv_op_vmandn_mm = 728,
369
+ rv_op_vmxor_mm = 729,
370
+ rv_op_vmor_mm = 730,
371
+ rv_op_vmnor_mm = 731,
372
+ rv_op_vmorn_mm = 732,
373
+ rv_op_vmxnor_mm = 733,
374
+ rv_op_vcpop_m = 734,
375
+ rv_op_vfirst_m = 735,
376
+ rv_op_vmsbf_m = 736,
377
+ rv_op_vmsif_m = 737,
378
+ rv_op_vmsof_m = 738,
379
+ rv_op_viota_m = 739,
380
+ rv_op_vid_v = 740,
381
+ rv_op_vmv_x_s = 741,
382
+ rv_op_vmv_s_x = 742,
383
+ rv_op_vfmv_f_s = 743,
384
+ rv_op_vfmv_s_f = 744,
385
+ rv_op_vslideup_vx = 745,
386
+ rv_op_vslideup_vi = 746,
387
+ rv_op_vslide1up_vx = 747,
388
+ rv_op_vslidedown_vx = 748,
389
+ rv_op_vslidedown_vi = 749,
390
+ rv_op_vslide1down_vx = 750,
391
+ rv_op_vrgather_vv = 751,
392
+ rv_op_vrgatherei16_vv = 752,
393
+ rv_op_vrgather_vx = 753,
394
+ rv_op_vrgather_vi = 754,
395
+ rv_op_vcompress_vm = 755,
396
+ rv_op_vmv1r_v = 756,
397
+ rv_op_vmv2r_v = 757,
398
+ rv_op_vmv4r_v = 758,
399
+ rv_op_vmv8r_v = 759,
400
+ rv_op_vzext_vf2 = 760,
401
+ rv_op_vzext_vf4 = 761,
402
+ rv_op_vzext_vf8 = 762,
403
+ rv_op_vsext_vf2 = 763,
404
+ rv_op_vsext_vf4 = 764,
405
+ rv_op_vsext_vf8 = 765,
406
+ rv_op_vsetvli = 766,
407
+ rv_op_vsetivli = 767,
408
+ rv_op_vsetvl = 768,
409
} rv_op;
410
411
/* structures */
412
@@ -XXX,XX +XXX,XX @@ typedef struct {
413
uint8_t rl;
414
uint8_t bs;
415
uint8_t rnum;
416
+ uint8_t vm;
417
+ uint32_t vzimm;
418
} rv_decode;
419
420
typedef struct {
421
@@ -XXX,XX +XXX,XX @@ static const char rv_freg_name_sym[32][5] = {
422
"fs8", "fs9", "fs10", "fs11", "ft8", "ft9", "ft10", "ft11",
423
};
424
425
+static const char rv_vreg_name_sym[32][4] = {
426
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
427
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
428
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
429
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
430
+};
431
+
432
/* instruction formats */
433
434
#define rv_fmt_none "O\t"
435
@@ -XXX,XX +XXX,XX @@ static const char rv_freg_name_sym[32][5] = {
436
#define rv_fmt_rs2_offset "O\t2,o"
437
#define rv_fmt_rs1_rs2_bs "O\t1,2,b"
438
#define rv_fmt_rd_rs1_rnum "O\t0,1,n"
439
+#define rv_fmt_ldst_vd_rs1_vm "O\tD,(1)m"
440
+#define rv_fmt_ldst_vd_rs1_rs2_vm "O\tD,(1),2m"
441
+#define rv_fmt_ldst_vd_rs1_vs2_vm "O\tD,(1),Fm"
442
+#define rv_fmt_vd_vs2_vs1 "O\tD,F,E"
443
+#define rv_fmt_vd_vs2_vs1_vl "O\tD,F,El"
444
+#define rv_fmt_vd_vs2_vs1_vm "O\tD,F,Em"
445
+#define rv_fmt_vd_vs2_rs1_vl "O\tD,F,1l"
446
+#define rv_fmt_vd_vs2_fs1_vl "O\tD,F,4l"
447
+#define rv_fmt_vd_vs2_rs1_vm "O\tD,F,1m"
448
+#define rv_fmt_vd_vs2_fs1_vm "O\tD,F,4m"
449
+#define rv_fmt_vd_vs2_imm_vl "O\tD,F,il"
450
+#define rv_fmt_vd_vs2_imm_vm "O\tD,F,im"
451
+#define rv_fmt_vd_vs2_uimm_vm "O\tD,F,um"
452
+#define rv_fmt_vd_vs1_vs2_vm "O\tD,E,Fm"
453
+#define rv_fmt_vd_rs1_vs2_vm "O\tD,1,Fm"
454
+#define rv_fmt_vd_fs1_vs2_vm "O\tD,4,Fm"
455
+#define rv_fmt_vd_vs1 "O\tD,E"
456
+#define rv_fmt_vd_rs1 "O\tD,1"
457
+#define rv_fmt_vd_fs1 "O\tD,4"
458
+#define rv_fmt_vd_imm "O\tD,i"
459
+#define rv_fmt_vd_vs2 "O\tD,F"
460
+#define rv_fmt_vd_vs2_vm "O\tD,Fm"
461
+#define rv_fmt_rd_vs2_vm "O\t0,Fm"
462
+#define rv_fmt_rd_vs2 "O\t0,F"
463
+#define rv_fmt_fd_vs2 "O\t3,F"
464
+#define rv_fmt_vd_vm "O\tDm"
465
+#define rv_fmt_vsetvli "O\t0,1,v"
466
+#define rv_fmt_vsetivli "O\t0,u,v"
467
468
/* pseudo-instruction constraints */
469
470
@@ -XXX,XX +XXX,XX @@ const rv_opcode_data opcode_data[] = {
471
{ "unzip", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
472
{ "zip", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
473
{ "xperm4", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
474
- { "xperm8", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 }
475
+ { "xperm8", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
476
+ { "vle8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle8_v, rv_op_vle8_v, 0 },
477
+ { "vle16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle16_v, rv_op_vle16_v, 0 },
478
+ { "vle32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle32_v, rv_op_vle32_v, 0 },
479
+ { "vle64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle64_v, rv_op_vle64_v, 0 },
480
+ { "vse8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse8_v, rv_op_vse8_v, 0 },
481
+ { "vse16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse16_v, rv_op_vse16_v, 0 },
482
+ { "vse32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse32_v, rv_op_vse32_v, 0 },
483
+ { "vse64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vse64_v, rv_op_vse64_v, 0 },
484
+ { "vlm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vlm_v, rv_op_vlm_v, 0 },
485
+ { "vsm.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vsm_v, rv_op_vsm_v, 0 },
486
+ { "vlse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse8_v, rv_op_vlse8_v, 0 },
487
+ { "vlse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse16_v, rv_op_vlse16_v, 0 },
488
+ { "vlse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse32_v, rv_op_vlse32_v, 0 },
489
+ { "vlse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vlse64_v, rv_op_vlse64_v, 0 },
490
+ { "vsse8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse8_v, rv_op_vsse8_v, 0 },
491
+ { "vsse16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse16_v, rv_op_vsse16_v, 0 },
492
+ { "vsse32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse32_v, rv_op_vsse32_v, 0 },
493
+ { "vsse64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_rs2_vm, NULL, rv_op_vsse64_v, rv_op_vsse64_v, 0 },
494
+ { "vluxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei8_v, rv_op_vluxei8_v, 0 },
495
+ { "vluxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei16_v, rv_op_vluxei16_v, 0 },
496
+ { "vluxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei32_v, rv_op_vluxei32_v, 0 },
497
+ { "vluxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vluxei64_v, rv_op_vluxei64_v, 0 },
498
+ { "vloxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei8_v, rv_op_vloxei8_v, 0 },
499
+ { "vloxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei16_v, rv_op_vloxei16_v, 0 },
500
+ { "vloxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei32_v, rv_op_vloxei32_v, 0 },
501
+ { "vloxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vloxei64_v, rv_op_vloxei64_v, 0 },
502
+ { "vsuxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei8_v, rv_op_vsuxei8_v, 0 },
503
+ { "vsuxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei16_v, rv_op_vsuxei16_v, 0 },
504
+ { "vsuxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei32_v, rv_op_vsuxei32_v, 0 },
505
+ { "vsuxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsuxei64_v, rv_op_vsuxei64_v, 0 },
506
+ { "vsoxei8.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei8_v, rv_op_vsoxei8_v, 0 },
507
+ { "vsoxei16.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei16_v, rv_op_vsoxei16_v, 0 },
508
+ { "vsoxei32.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei32_v, rv_op_vsoxei32_v, 0 },
509
+ { "vsoxei64.v", rv_codec_v_r, rv_fmt_ldst_vd_rs1_vs2_vm, NULL, rv_op_vsoxei64_v, rv_op_vsoxei64_v, 0 },
510
+ { "vle8ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle8ff_v, rv_op_vle8ff_v, 0 },
511
+ { "vle16ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle16ff_v, rv_op_vle16ff_v, 0 },
512
+ { "vle32ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle32ff_v, rv_op_vle32ff_v, 0 },
513
+ { "vle64ff.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vle64ff_v, rv_op_vle64ff_v, 0 },
514
+ { "vl1re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re8_v, rv_op_vl1re8_v, 0 },
515
+ { "vl1re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re16_v, rv_op_vl1re16_v, 0 },
516
+ { "vl1re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re32_v, rv_op_vl1re32_v, 0 },
517
+ { "vl1re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl1re64_v, rv_op_vl1re64_v, 0 },
518
+ { "vl2re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re8_v, rv_op_vl2re8_v, 0 },
519
+ { "vl2re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re16_v, rv_op_vl2re16_v, 0 },
520
+ { "vl2re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re32_v, rv_op_vl2re32_v, 0 },
521
+ { "vl2re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl2re64_v, rv_op_vl2re64_v, 0 },
522
+ { "vl4re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re8_v, rv_op_vl4re8_v, 0 },
523
+ { "vl4re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re16_v, rv_op_vl4re16_v, 0 },
524
+ { "vl4re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re32_v, rv_op_vl4re32_v, 0 },
525
+ { "vl4re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl4re64_v, rv_op_vl4re64_v, 0 },
526
+ { "vl8re8.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re8_v, rv_op_vl8re8_v, 0 },
527
+ { "vl8re16.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re16_v, rv_op_vl8re16_v, 0 },
528
+ { "vl8re32.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re32_v, rv_op_vl8re32_v, 0 },
529
+ { "vl8re64.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vl8re64_v, rv_op_vl8re64_v, 0 },
530
+ { "vs1r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs1r_v, rv_op_vs1r_v, 0 },
531
+ { "vs2r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs2r_v, rv_op_vs2r_v, 0 },
532
+ { "vs4r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs4r_v, rv_op_vs4r_v, 0 },
533
+ { "vs8r.v", rv_codec_v_ldst, rv_fmt_ldst_vd_rs1_vm, NULL, rv_op_vs8r_v, rv_op_vs8r_v, 0 },
534
+ { "vadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vadd_vv, rv_op_vadd_vv, 0 },
535
+ { "vadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vadd_vx, rv_op_vadd_vx, 0 },
536
+ { "vadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vadd_vi, rv_op_vadd_vi, 0 },
537
+ { "vsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsub_vv, rv_op_vsub_vv, 0 },
538
+ { "vsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsub_vx, rv_op_vsub_vx, 0 },
539
+ { "vrsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrsub_vx, rv_op_vrsub_vx, 0 },
540
+ { "vrsub.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vrsub_vi, rv_op_vrsub_vi, 0 },
541
+ { "vwaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwaddu_vv, rv_op_vwaddu_vv, 0 },
542
+ { "vwaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwaddu_vx, rv_op_vwaddu_vx, 0 },
543
+ { "vwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwadd_vv, rv_op_vwadd_vv, 0 },
544
+ { "vwadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwadd_vx, rv_op_vwadd_vx, 0 },
545
+ { "vwsubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsubu_vv, rv_op_vwsubu_vv, 0 },
546
+ { "vwsubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsubu_vx, rv_op_vwsubu_vx, 0 },
547
+ { "vwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsub_vv, rv_op_vwsub_vv, 0 },
548
+ { "vwsub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsub_vx, rv_op_vwsub_vx, 0 },
549
+ { "vwaddu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwaddu_wv, rv_op_vwaddu_wv, 0 },
550
+ { "vwaddu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwaddu_wx, rv_op_vwaddu_wx, 0 },
551
+ { "vwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwadd_wv, rv_op_vwadd_wv, 0 },
552
+ { "vwadd.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwadd_wx, rv_op_vwadd_wx, 0 },
553
+ { "vwsubu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsubu_wv, rv_op_vwsubu_wv, 0 },
554
+ { "vwsubu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsubu_wx, rv_op_vwsubu_wx, 0 },
555
+ { "vwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwsub_wv, rv_op_vwsub_wv, 0 },
556
+ { "vwsub.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwsub_wx, rv_op_vwsub_wx, 0 },
557
+ { "vadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vadc_vvm, rv_op_vadc_vvm, 0 },
558
+ { "vadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vadc_vxm, rv_op_vadc_vxm, 0 },
559
+ { "vadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vadc_vim, rv_op_vadc_vim, 0 },
560
+ { "vmadc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmadc_vvm, rv_op_vmadc_vvm, 0 },
561
+ { "vmadc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmadc_vxm, rv_op_vmadc_vxm, 0 },
562
+ { "vmadc.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vmadc_vim, rv_op_vmadc_vim, 0 },
563
+ { "vsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vsbc_vvm, rv_op_vsbc_vvm, 0 },
564
+ { "vsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vsbc_vxm, rv_op_vsbc_vxm, 0 },
565
+ { "vmsbc.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmsbc_vvm, rv_op_vmsbc_vvm, 0 },
566
+ { "vmsbc.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmsbc_vxm, rv_op_vmsbc_vxm, 0 },
567
+ { "vand.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vand_vv, rv_op_vand_vv, 0 },
568
+ { "vand.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vand_vx, rv_op_vand_vx, 0 },
569
+ { "vand.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vand_vi, rv_op_vand_vi, 0 },
570
+ { "vor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vor_vv, rv_op_vor_vv, 0 },
571
+ { "vor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vor_vx, rv_op_vor_vx, 0 },
572
+ { "vor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vor_vi, rv_op_vor_vi, 0 },
573
+ { "vxor.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vxor_vv, rv_op_vxor_vv, 0 },
574
+ { "vxor.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vxor_vx, rv_op_vxor_vx, 0 },
575
+ { "vxor.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vxor_vi, rv_op_vxor_vi, 0 },
576
+ { "vsll.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsll_vv, rv_op_vsll_vv, 0 },
577
+ { "vsll.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsll_vx, rv_op_vsll_vx, 0 },
578
+ { "vsll.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsll_vi, rv_op_vsll_vi, 0 },
579
+ { "vsrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsrl_vv, rv_op_vsrl_vv, 0 },
580
+ { "vsrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsrl_vx, rv_op_vsrl_vx, 0 },
581
+ { "vsrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsrl_vi, rv_op_vsrl_vi, 0 },
582
+ { "vsra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsra_vv, rv_op_vsra_vv, 0 },
583
+ { "vsra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsra_vx, rv_op_vsra_vx, 0 },
584
+ { "vsra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vsra_vi, rv_op_vsra_vi, 0 },
585
+ { "vnsrl.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnsrl_wv, rv_op_vnsrl_wv, 0 },
586
+ { "vnsrl.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnsrl_wx, rv_op_vnsrl_wx, 0 },
587
+ { "vnsrl.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnsrl_wi, rv_op_vnsrl_wi, 0 },
588
+ { "vnsra.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnsra_wv, rv_op_vnsra_wv, 0 },
589
+ { "vnsra.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnsra_wx, rv_op_vnsra_wx, 0 },
590
+ { "vnsra.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnsra_wi, rv_op_vnsra_wi, 0 },
591
+ { "vmseq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmseq_vv, rv_op_vmseq_vv, 0 },
592
+ { "vmseq.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmseq_vx, rv_op_vmseq_vx, 0 },
593
+ { "vmseq.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmseq_vi, rv_op_vmseq_vi, 0 },
594
+ { "vmsne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsne_vv, rv_op_vmsne_vv, 0 },
595
+ { "vmsne.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsne_vx, rv_op_vmsne_vx, 0 },
596
+ { "vmsne.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsne_vi, rv_op_vmsne_vi, 0 },
597
+ { "vmsltu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsltu_vv, rv_op_vmsltu_vv, 0 },
598
+ { "vmsltu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsltu_vx, rv_op_vmsltu_vx, 0 },
599
+ { "vmslt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmslt_vv, rv_op_vmslt_vv, 0 },
600
+ { "vmslt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmslt_vx, rv_op_vmslt_vx, 0 },
601
+ { "vmsleu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsleu_vv, rv_op_vmsleu_vv, 0 },
602
+ { "vmsleu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsleu_vx, rv_op_vmsleu_vx, 0 },
603
+ { "vmsleu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsleu_vi, rv_op_vmsleu_vi, 0 },
604
+ { "vmsle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmsle_vv, rv_op_vmsle_vv, 0 },
605
+ { "vmsle.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsle_vx, rv_op_vmsle_vx, 0 },
606
+ { "vmsle.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsle_vi, rv_op_vmsle_vi, 0 },
607
+ { "vmsgtu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsgtu_vx, rv_op_vmsgtu_vx, 0 },
608
+ { "vmsgtu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsgtu_vi, rv_op_vmsgtu_vi, 0 },
609
+ { "vmsgt.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmsgt_vx, rv_op_vmsgt_vx, 0 },
610
+ { "vmsgt.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vmsgt_vi, rv_op_vmsgt_vi, 0 },
611
+ { "vminu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vminu_vv, rv_op_vminu_vv, 0 },
612
+ { "vminu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vminu_vx, rv_op_vminu_vx, 0 },
613
+ { "vmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmin_vv, rv_op_vmin_vv, 0 },
614
+ { "vmin.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmin_vx, rv_op_vmin_vx, 0 },
615
+ { "vmaxu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmaxu_vv, rv_op_vmaxu_vv, 0 },
616
+ { "vmaxu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmaxu_vx, rv_op_vmaxu_vx, 0 },
617
+ { "vmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmax_vv, rv_op_vmax_vv, 0 },
618
+ { "vmax.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmax_vx, rv_op_vmax_vx, 0 },
619
+ { "vmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmul_vv, rv_op_vmul_vv, 0 },
620
+ { "vmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmul_vx, rv_op_vmul_vx, 0 },
621
+ { "vmulh.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulh_vv, rv_op_vmulh_vv, 0 },
622
+ { "vmulh.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulh_vx, rv_op_vmulh_vx, 0 },
623
+ { "vmulhu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulhu_vv, rv_op_vmulhu_vv, 0 },
624
+ { "vmulhu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulhu_vx, rv_op_vmulhu_vx, 0 },
625
+ { "vmulhsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmulhsu_vv, rv_op_vmulhsu_vv, 0 },
626
+ { "vmulhsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vmulhsu_vx, rv_op_vmulhsu_vx, 0 },
627
+ { "vdivu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vdivu_vv, rv_op_vdivu_vv, 0 },
628
+ { "vdivu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vdivu_vx, rv_op_vdivu_vx, 0 },
629
+ { "vdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vdiv_vv, rv_op_vdiv_vv, 0 },
630
+ { "vdiv.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vdiv_vx, rv_op_vdiv_vx, 0 },
631
+ { "vremu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vremu_vv, rv_op_vremu_vv, 0 },
632
+ { "vremu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vremu_vx, rv_op_vremu_vx, 0 },
633
+ { "vrem.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrem_vv, rv_op_vrem_vv, 0 },
634
+ { "vrem.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrem_vx, rv_op_vrem_vx, 0 },
635
+ { "vwmulu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmulu_vv, rv_op_vwmulu_vv, 0 },
636
+ { "vwmulu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmulu_vx, rv_op_vwmulu_vx, 0 },
637
+ { "vwmulsu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmulsu_vv, rv_op_vwmulsu_vv, 0 },
638
+ { "vwmulsu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmulsu_vx, rv_op_vwmulsu_vx, 0 },
639
+ { "vwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwmul_vv, rv_op_vwmul_vv, 0 },
640
+ { "vwmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vwmul_vx, rv_op_vwmul_vx, 0 },
641
+ { "vmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vmacc_vv, rv_op_vmacc_vv, 0 },
642
+ { "vmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vmacc_vx, rv_op_vmacc_vx, 0 },
643
+ { "vnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vnmsac_vv, rv_op_vnmsac_vv, 0 },
644
+ { "vnmsac.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vnmsac_vx, rv_op_vnmsac_vx, 0 },
645
+ { "vmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vmadd_vv, rv_op_vmadd_vv, 0 },
646
+ { "vmadd.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vmadd_vx, rv_op_vmadd_vx, 0 },
647
+ { "vnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vnmsub_vv, rv_op_vnmsub_vv, 0 },
648
+ { "vnmsub.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vnmsub_vx, rv_op_vnmsub_vx, 0 },
649
+ { "vwmaccu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmaccu_vv, rv_op_vwmaccu_vv, 0 },
650
+ { "vwmaccu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccu_vx, rv_op_vwmaccu_vx, 0 },
651
+ { "vwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmacc_vv, rv_op_vwmacc_vv, 0 },
652
+ { "vwmacc.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmacc_vx, rv_op_vwmacc_vx, 0 },
653
+ { "vwmaccsu.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vwmaccsu_vv, rv_op_vwmaccsu_vv, 0 },
654
+ { "vwmaccsu.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccsu_vx, rv_op_vwmaccsu_vx, 0 },
655
+ { "vwmaccus.vx", rv_codec_v_r, rv_fmt_vd_rs1_vs2_vm, NULL, rv_op_vwmaccus_vx, rv_op_vwmaccus_vx, 0 },
656
+ { "vmv.v.v", rv_codec_v_r, rv_fmt_vd_vs1, NULL, rv_op_vmv_v_v, rv_op_vmv_v_v, 0 },
657
+ { "vmv.v.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, rv_op_vmv_v_x, rv_op_vmv_v_x, 0 },
658
+ { "vmv.v.i", rv_codec_v_i, rv_fmt_vd_imm, NULL, rv_op_vmv_v_i, rv_op_vmv_v_i, 0 },
659
+ { "vmerge.vvm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vl, NULL, rv_op_vmerge_vvm, rv_op_vmerge_vvm, 0 },
660
+ { "vmerge.vxm", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vl, NULL, rv_op_vmerge_vxm, rv_op_vmerge_vxm, 0 },
661
+ { "vmerge.vim", rv_codec_v_i, rv_fmt_vd_vs2_imm_vl, NULL, rv_op_vmerge_vim, rv_op_vmerge_vim, 0 },
662
+ { "vsaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsaddu_vv, rv_op_vsaddu_vv, 0 },
663
+ { "vsaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsaddu_vx, rv_op_vsaddu_vx, 0 },
664
+ { "vsaddu.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vsaddu_vi, rv_op_vsaddu_vi, 0 },
665
+ { "vsadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsadd_vv, rv_op_vsadd_vv, 0 },
666
+ { "vsadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsadd_vx, rv_op_vsadd_vx, 0 },
667
+ { "vsadd.vi", rv_codec_v_i, rv_fmt_vd_vs2_imm_vm, NULL, rv_op_vsadd_vi, rv_op_vsadd_vi, 0 },
668
+ { "vssubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssubu_vv, rv_op_vssubu_vv, 0 },
669
+ { "vssubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssubu_vx, rv_op_vssubu_vx, 0 },
670
+ { "vssub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssub_vv, rv_op_vssub_vv, 0 },
671
+ { "vssub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssub_vx, rv_op_vssub_vx, 0 },
672
+ { "vaadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vaadd_vv, rv_op_vaadd_vv, 0 },
673
+ { "vaadd.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vaadd_vx, rv_op_vaadd_vx, 0 },
674
+ { "vaaddu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vaaddu_vv, rv_op_vaaddu_vv, 0 },
675
+ { "vaaddu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vaaddu_vx, rv_op_vaaddu_vx, 0 },
676
+ { "vasub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vasub_vv, rv_op_vasub_vv, 0 },
677
+ { "vasub.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vasub_vx, rv_op_vasub_vx, 0 },
678
+ { "vasubu.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vasubu_vv, rv_op_vasubu_vv, 0 },
679
+ { "vasubu.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vasubu_vx, rv_op_vasubu_vx, 0 },
680
+ { "vsmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vsmul_vv, rv_op_vsmul_vv, 0 },
681
+ { "vsmul.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vsmul_vx, rv_op_vsmul_vx, 0 },
682
+ { "vssrl.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssrl_vv, rv_op_vssrl_vv, 0 },
683
+ { "vssrl.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssrl_vx, rv_op_vssrl_vx, 0 },
684
+ { "vssrl.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vssrl_vi, rv_op_vssrl_vi, 0 },
685
+ { "vssra.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vssra_vv, rv_op_vssra_vv, 0 },
686
+ { "vssra.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vssra_vx, rv_op_vssra_vx, 0 },
687
+ { "vssra.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vssra_vi, rv_op_vssra_vi, 0 },
688
+ { "vnclipu.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnclipu_wv, rv_op_vnclipu_wv, 0 },
689
+ { "vnclipu.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnclipu_wx, rv_op_vnclipu_wx, 0 },
690
+ { "vnclipu.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnclipu_wi, rv_op_vnclipu_wi, 0 },
691
+ { "vnclip.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vnclip_wv, rv_op_vnclip_wv, 0 },
692
+ { "vnclip.wx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vnclip_wx, rv_op_vnclip_wx, 0 },
693
+ { "vnclip.wi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vnclip_wi, rv_op_vnclip_wi, 0 },
694
+ { "vfadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfadd_vv, rv_op_vfadd_vv, 0 },
695
+ { "vfadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfadd_vf, rv_op_vfadd_vf, 0 },
696
+ { "vfsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsub_vv, rv_op_vfsub_vv, 0 },
697
+ { "vfsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsub_vf, rv_op_vfsub_vf, 0 },
698
+ { "vfrsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfrsub_vf, rv_op_vfrsub_vf, 0 },
699
+ { "vfwadd.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwadd_vv, rv_op_vfwadd_vv, 0 },
700
+ { "vfwadd.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwadd_vf, rv_op_vfwadd_vf, 0 },
701
+ { "vfwadd.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwadd_wv, rv_op_vfwadd_wv, 0 },
702
+ { "vfwadd.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwadd_wf, rv_op_vfwadd_wf, 0 },
703
+ { "vfwsub.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwsub_vv, rv_op_vfwsub_vv, 0 },
704
+ { "vfwsub.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwsub_vf, rv_op_vfwsub_vf, 0 },
705
+ { "vfwsub.wv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwsub_wv, rv_op_vfwsub_wv, 0 },
706
+ { "vfwsub.wf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwsub_wf, rv_op_vfwsub_wf, 0 },
707
+ { "vfmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmul_vv, rv_op_vfmul_vv, 0 },
708
+ { "vfmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmul_vf, rv_op_vfmul_vf, 0 },
709
+ { "vfdiv.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfdiv_vv, rv_op_vfdiv_vv, 0 },
710
+ { "vfdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfdiv_vf, rv_op_vfdiv_vf, 0 },
711
+ { "vfrdiv.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfrdiv_vf, rv_op_vfrdiv_vf, 0 },
712
+ { "vfwmul.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwmul_vv, rv_op_vfwmul_vv, 0 },
713
+ { "vfwmul.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfwmul_vf, rv_op_vfwmul_vf, 0 },
714
+ { "vfmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmacc_vv, rv_op_vfmacc_vv, 0 },
715
+ { "vfmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmacc_vf, rv_op_vfmacc_vf, 0 },
716
+ { "vfnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmacc_vv, rv_op_vfnmacc_vv, 0 },
717
+ { "vfnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmacc_vf, rv_op_vfnmacc_vf, 0 },
718
+ { "vfmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmsac_vv, rv_op_vfmsac_vv, 0 },
719
+ { "vfmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmsac_vf, rv_op_vfmsac_vf, 0 },
720
+ { "vfnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmsac_vv, rv_op_vfnmsac_vv, 0 },
721
+ { "vfnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmsac_vf, rv_op_vfnmsac_vf, 0 },
722
+ { "vfmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmadd_vv, rv_op_vfmadd_vv, 0 },
723
+ { "vfmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmadd_vf, rv_op_vfmadd_vf, 0 },
724
+ { "vfnmadd.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmadd_vv, rv_op_vfnmadd_vv, 0 },
725
+ { "vfnmadd.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmadd_vf, rv_op_vfnmadd_vf, 0 },
726
+ { "vfmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfmsub_vv, rv_op_vfmsub_vv, 0 },
727
+ { "vfmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfmsub_vf, rv_op_vfmsub_vf, 0 },
728
+ { "vfnmsub.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfnmsub_vv, rv_op_vfnmsub_vv, 0 },
729
+ { "vfnmsub.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfnmsub_vf, rv_op_vfnmsub_vf, 0 },
730
+ { "vfwmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwmacc_vv, rv_op_vfwmacc_vv, 0 },
731
+ { "vfwmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwmacc_vf, rv_op_vfwmacc_vf, 0 },
732
+ { "vfwnmacc.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwnmacc_vv, rv_op_vfwnmacc_vv, 0 },
733
+ { "vfwnmacc.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwnmacc_vf, rv_op_vfwnmacc_vf, 0 },
734
+ { "vfwmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwmsac_vv, rv_op_vfwmsac_vv, 0 },
735
+ { "vfwmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwmsac_vf, rv_op_vfwmsac_vf, 0 },
736
+ { "vfwnmsac.vv", rv_codec_v_r, rv_fmt_vd_vs1_vs2_vm, NULL, rv_op_vfwnmsac_vv, rv_op_vfwnmsac_vv, 0 },
737
+ { "vfwnmsac.vf", rv_codec_v_r, rv_fmt_vd_fs1_vs2_vm, NULL, rv_op_vfwnmsac_vf, rv_op_vfwnmsac_vf, 0 },
738
+ { "vfsqrt.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfsqrt_v, rv_op_vfsqrt_v, 0 },
739
+ { "vfrsqrt7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfrsqrt7_v, rv_op_vfrsqrt7_v, 0 },
740
+ { "vfrec7.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vfrec7_v, rv_op_vfrec7_v, 0 },
741
+ { "vfmin.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmin_vv, rv_op_vfmin_vv, 0 },
742
+ { "vfmin.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmin_vf, rv_op_vfmin_vf, 0 },
743
+ { "vfmax.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfmax_vv, rv_op_vfmax_vv, 0 },
744
+ { "vfmax.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfmax_vf, rv_op_vfmax_vf, 0 },
745
+ { "vfsgnj.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnj_vv, rv_op_vfsgnj_vv, 0 },
746
+ { "vfsgnj.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnj_vf, rv_op_vfsgnj_vf, 0 },
747
+ { "vfsgnjn.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnjn_vv, rv_op_vfsgnjn_vv, 0 },
748
+ { "vfsgnjn.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnjn_vf, rv_op_vfsgnjn_vf, 0 },
749
+ { "vfsgnjx.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfsgnjx_vv, rv_op_vfsgnjx_vv, 0 },
750
+ { "vfsgnjx.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfsgnjx_vf, rv_op_vfsgnjx_vf, 0 },
751
+ { "vfslide1up.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfslide1up_vf, rv_op_vfslide1up_vf, 0 },
752
+ { "vfslide1down.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vfslide1down_vf, rv_op_vfslide1down_vf, 0 },
753
+ { "vmfeq.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfeq_vv, rv_op_vmfeq_vv, 0 },
754
+ { "vmfeq.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfeq_vf, rv_op_vmfeq_vf, 0 },
755
+ { "vmfne.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfne_vv, rv_op_vmfne_vv, 0 },
756
+ { "vmfne.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfne_vf, rv_op_vmfne_vf, 0 },
757
+ { "vmflt.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmflt_vv, rv_op_vmflt_vv, 0 },
758
+ { "vmflt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmflt_vf, rv_op_vmflt_vf, 0 },
759
+ { "vmfle.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmfle_vv, rv_op_vmfle_vv, 0 },
760
+ { "vmfle.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfle_vf, rv_op_vmfle_vf, 0 },
761
+ { "vmfgt.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfgt_vf, rv_op_vmfgt_vf, 0 },
762
+ { "vmfge.vf", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vm, NULL, rv_op_vmfge_vf, rv_op_vmfge_vf, 0 },
763
+ { "vfclass.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfclass_v, rv_op_vfclass_v, 0 },
764
+ { "vfmerge.vfm", rv_codec_v_r, rv_fmt_vd_vs2_fs1_vl, NULL, rv_op_vfmerge_vfm, rv_op_vfmerge_vfm, 0 },
765
+ { "vfmv.v.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, rv_op_vfmv_v_f, rv_op_vfmv_v_f, 0 },
766
+ { "vfcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_xu_f_v, rv_op_vfcvt_xu_f_v, 0 },
767
+ { "vfcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_x_f_v, rv_op_vfcvt_x_f_v, 0 },
768
+ { "vfcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_f_xu_v, rv_op_vfcvt_f_xu_v, 0 },
769
+ { "vfcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_f_x_v, rv_op_vfcvt_f_x_v, 0 },
770
+ { "vfcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_rtz_xu_f_v, rv_op_vfcvt_rtz_xu_f_v, 0 },
771
+ { "vfcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfcvt_rtz_x_f_v, rv_op_vfcvt_rtz_x_f_v, 0 },
772
+ { "vfwcvt.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_xu_f_v, rv_op_vfwcvt_xu_f_v, 0 },
773
+ { "vfwcvt.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_x_f_v, rv_op_vfwcvt_x_f_v, 0 },
774
+ { "vfwcvt.f.xu.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_xu_v, rv_op_vfwcvt_f_xu_v, 0 },
775
+ { "vfwcvt.f.x.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_x_v, rv_op_vfwcvt_f_x_v, 0 },
776
+ { "vfwcvt.f.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_f_f_v, rv_op_vfwcvt_f_f_v, 0 },
777
+ { "vfwcvt.rtz.xu.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_rtz_xu_f_v, rv_op_vfwcvt_rtz_xu_f_v, 0 },
778
+ { "vfwcvt.rtz.x.f.v", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfwcvt_rtz_x_f_v, rv_op_vfwcvt_rtz_x_f_v, 0 },
779
+ { "vfncvt.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_xu_f_w, rv_op_vfncvt_xu_f_w, 0 },
780
+ { "vfncvt.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_x_f_w, rv_op_vfncvt_x_f_w, 0 },
781
+ { "vfncvt.f.xu.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_xu_w, rv_op_vfncvt_f_xu_w, 0 },
782
+ { "vfncvt.f.x.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_x_w, rv_op_vfncvt_f_x_w, 0 },
783
+ { "vfncvt.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_f_f_w, rv_op_vfncvt_f_f_w, 0 },
784
+ { "vfncvt.rod.f.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rod_f_f_w, rv_op_vfncvt_rod_f_f_w, 0 },
785
+ { "vfncvt.rtz.xu.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rtz_xu_f_w, rv_op_vfncvt_rtz_xu_f_w, 0 },
786
+ { "vfncvt.rtz.x.f.w", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vfncvt_rtz_x_f_w, rv_op_vfncvt_rtz_x_f_w, 0 },
787
+ { "vredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredsum_vs, rv_op_vredsum_vs, 0 },
788
+ { "vredand.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredand_vs, rv_op_vredand_vs, 0 },
789
+ { "vredor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredor_vs, rv_op_vredor_vs, 0 },
790
+ { "vredxor.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredxor_vs, rv_op_vredxor_vs, 0 },
791
+ { "vredminu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredminu_vs, rv_op_vredminu_vs, 0 },
792
+ { "vredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmin_vs, rv_op_vredmin_vs, 0 },
793
+ { "vredmaxu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmaxu_vs, rv_op_vredmaxu_vs, 0 },
794
+ { "vredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vredmax_vs, rv_op_vredmax_vs, 0 },
795
+ { "vwredsumu.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwredsumu_vs, rv_op_vwredsumu_vs, 0 },
796
+ { "vwredsum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vwredsum_vs, rv_op_vwredsum_vs, 0 },
797
+ { "vfredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredusum_vs, rv_op_vfredusum_vs, 0 },
798
+ { "vfredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredosum_vs, rv_op_vfredosum_vs, 0 },
799
+ { "vfredmin.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredmin_vs, rv_op_vfredmin_vs, 0 },
800
+ { "vfredmax.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfredmax_vs, rv_op_vfredmax_vs, 0 },
801
+ { "vfwredusum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwredusum_vs, rv_op_vfwredusum_vs, 0 },
802
+ { "vfwredosum.vs", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vfwredosum_vs, rv_op_vfwredosum_vs, 0 },
803
+ { "vmand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmand_mm, rv_op_vmand_mm, 0 },
804
+ { "vmnand.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmnand_mm, rv_op_vmnand_mm, 0 },
805
+ { "vmandn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmandn_mm, rv_op_vmandn_mm, 0 },
806
+ { "vmxor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmxor_mm, rv_op_vmxor_mm, 0 },
807
+ { "vmor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmor_mm, rv_op_vmor_mm, 0 },
808
+ { "vmnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmnor_mm, rv_op_vmnor_mm, 0 },
809
+ { "vmorn.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmorn_mm, rv_op_vmorn_mm, 0 },
810
+ { "vmxnor.mm", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vmxnor_mm, rv_op_vmxnor_mm, 0 },
811
+ { "vcpop.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, rv_op_vcpop_m, rv_op_vcpop_m, 0 },
812
+ { "vfirst.m", rv_codec_v_r, rv_fmt_rd_vs2_vm, NULL, rv_op_vfirst_m, rv_op_vfirst_m, 0 },
813
+ { "vmsbf.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsbf_m, rv_op_vmsbf_m, 0 },
814
+ { "vmsif.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsif_m, rv_op_vmsif_m, 0 },
815
+ { "vmsof.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vmsof_m, rv_op_vmsof_m, 0 },
816
+ { "viota.m", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_viota_m, rv_op_viota_m, 0 },
817
+ { "vid.v", rv_codec_v_r, rv_fmt_vd_vm, NULL, rv_op_vid_v, rv_op_vid_v, 0 },
818
+ { "vmv.x.s", rv_codec_v_r, rv_fmt_rd_vs2, NULL, rv_op_vmv_x_s, rv_op_vmv_x_s, 0 },
819
+ { "vmv.s.x", rv_codec_v_r, rv_fmt_vd_rs1, NULL, rv_op_vmv_s_x, rv_op_vmv_s_x, 0 },
820
+ { "vfmv.f.s", rv_codec_v_r, rv_fmt_fd_vs2, NULL, rv_op_vfmv_f_s, rv_op_vfmv_f_s, 0 },
821
+ { "vfmv.s.f", rv_codec_v_r, rv_fmt_vd_fs1, NULL, rv_op_vfmv_s_f, rv_op_vfmv_s_f, 0 },
822
+ { "vslideup.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslideup_vx, rv_op_vslideup_vx, 0 },
823
+ { "vslideup.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vslideup_vi, rv_op_vslideup_vi, 0 },
824
+ { "vslide1up.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslide1up_vx, rv_op_vslide1up_vx, 0 },
825
+ { "vslidedown.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslidedown_vx, rv_op_vslidedown_vx, 0 },
826
+ { "vslidedown.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vslidedown_vi, rv_op_vslidedown_vi, 0 },
827
+ { "vslide1down.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vslide1down_vx, rv_op_vslide1down_vx, 0 },
828
+ { "vrgather.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrgather_vv, rv_op_vrgather_vv, 0 },
829
+ { "vrgatherei16.vv", rv_codec_v_r, rv_fmt_vd_vs2_vs1_vm, NULL, rv_op_vrgatherei16_vv, rv_op_vrgatherei16_vv, 0 },
830
+ { "vrgather.vx", rv_codec_v_r, rv_fmt_vd_vs2_rs1_vm, NULL, rv_op_vrgather_vx, rv_op_vrgather_vx, 0 },
831
+ { "vrgather.vi", rv_codec_v_i, rv_fmt_vd_vs2_uimm_vm, NULL, rv_op_vrgather_vi, rv_op_vrgather_vi, 0 },
832
+ { "vcompress.vm", rv_codec_v_r, rv_fmt_vd_vs2_vs1, NULL, rv_op_vcompress_vm, rv_op_vcompress_vm, 0 },
833
+ { "vmv1r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv1r_v, rv_op_vmv1r_v, 0 },
834
+ { "vmv2r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv2r_v, rv_op_vmv2r_v, 0 },
835
+ { "vmv4r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv4r_v, rv_op_vmv4r_v, 0 },
836
+ { "vmv8r.v", rv_codec_v_r, rv_fmt_vd_vs2, NULL, rv_op_vmv8r_v, rv_op_vmv8r_v, 0 },
837
+ { "vzext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf2, rv_op_vzext_vf2, 0 },
838
+ { "vzext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf4, rv_op_vzext_vf4, 0 },
839
+ { "vzext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vzext_vf8, rv_op_vzext_vf8, 0 },
840
+ { "vsext.vf2", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf2, rv_op_vsext_vf2, 0 },
841
+ { "vsext.vf4", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf4, rv_op_vsext_vf4, 0 },
842
+ { "vsext.vf8", rv_codec_v_r, rv_fmt_vd_vs2_vm, NULL, rv_op_vsext_vf8, rv_op_vsext_vf8, 0 },
843
+ { "vsetvli", rv_codec_vsetvli, rv_fmt_vsetvli, NULL, rv_op_vsetvli, rv_op_vsetvli, 0 },
844
+ { "vsetivli", rv_codec_vsetivli, rv_fmt_vsetivli, NULL, rv_op_vsetivli, rv_op_vsetivli, 0 },
845
+ { "vsetvl", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, rv_op_vsetvl, rv_op_vsetvl, 0 }
846
};
847
848
/* CSR names */
849
@@ -XXX,XX +XXX,XX @@ static const char *csr_name(int csrno)
22
@@ -XXX,XX +XXX,XX @@ static const char *csr_name(int csrno)
850
case 0x0003: return "fcsr";
23
case 0x0383: return "mibound";
851
case 0x0004: return "uie";
24
case 0x0384: return "mdbase";
852
case 0x0005: return "utvec";
25
case 0x0385: return "mdbound";
853
+ case 0x0008: return "vstart";
26
- case 0x03a0: return "pmpcfg3";
854
+ case 0x0009: return "vxsat";
27
+ case 0x03a0: return "pmpcfg0";
855
+ case 0x000a: return "vxrm";
28
+ case 0x03a1: return "pmpcfg1";
856
+ case 0x000f: return "vcsr";
29
+ case 0x03a2: return "pmpcfg2";
857
case 0x0015: return "seed";
30
+ case 0x03a3: return "pmpcfg3";
858
case 0x0040: return "uscratch";
31
+ case 0x03a4: return "pmpcfg4";
859
case 0x0041: return "uepc";
32
+ case 0x03a5: return "pmpcfg5";
33
+ case 0x03a6: return "pmpcfg6";
34
+ case 0x03a7: return "pmpcfg7";
35
+ case 0x03a8: return "pmpcfg8";
36
+ case 0x03a9: return "pmpcfg9";
37
+ case 0x03aa: return "pmpcfg10";
38
+ case 0x03ab: return "pmpcfg11";
39
+ case 0x03ac: return "pmpcfg12";
40
+ case 0x03ad: return "pmpcfg13";
41
+ case 0x03ae: return "pmpcfg14";
42
+ case 0x03af: return "pmpcfg15";
43
case 0x03b0: return "pmpaddr0";
44
case 0x03b1: return "pmpaddr1";
45
case 0x03b2: return "pmpaddr2";
860
@@ -XXX,XX +XXX,XX @@ static const char *csr_name(int csrno)
46
@@ -XXX,XX +XXX,XX @@ static const char *csr_name(int csrno)
861
case 0x0c00: return "cycle";
47
case 0x03bd: return "pmpaddr13";
862
case 0x0c01: return "time";
48
case 0x03be: return "pmpaddr14";
863
case 0x0c02: return "instret";
49
case 0x03bf: return "pmpaddr15";
864
+ case 0x0c20: return "vl";
50
+ case 0x03c0: return "pmpaddr16";
865
+ case 0x0c21: return "vtype";
51
+ case 0x03c1: return "pmpaddr17";
866
+ case 0x0c22: return "vlenb";
52
+ case 0x03c2: return "pmpaddr18";
867
case 0x0c80: return "cycleh";
53
+ case 0x03c3: return "pmpaddr19";
868
case 0x0c81: return "timeh";
54
+ case 0x03c4: return "pmpaddr20";
869
case 0x0c82: return "instreth";
55
+ case 0x03c5: return "pmpaddr21";
870
@@ -XXX,XX +XXX,XX @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
56
+ case 0x03c6: return "pmpaddr22";
871
break;
57
+ case 0x03c7: return "pmpaddr23";
872
case 1:
58
+ case 0x03c8: return "pmpaddr24";
873
switch (((inst >> 12) & 0b111)) {
59
+ case 0x03c9: return "pmpaddr25";
874
+ case 0:
60
+ case 0x03ca: return "pmpaddr26";
875
+ switch (((inst >> 20) & 0b111111111111)) {
61
+ case 0x03cb: return "pmpaddr27";
876
+ case 40: op = rv_op_vl1re8_v; break;
62
+ case 0x03cc: return "pmpaddr28";
877
+ case 552: op = rv_op_vl2re8_v; break;
63
+ case 0x03cd: return "pmpaddr29";
878
+ case 1576: op = rv_op_vl4re8_v; break;
64
+ case 0x03ce: return "pmpaddr30";
879
+ case 3624: op = rv_op_vl8re8_v; break;
65
+ case 0x03cf: return "pmpaddr31";
880
+ }
66
+ case 0x03d0: return "pmpaddr32";
881
+ switch (((inst >> 26) & 0b111)) {
67
+ case 0x03d1: return "pmpaddr33";
882
+ case 0:
68
+ case 0x03d2: return "pmpaddr34";
883
+ switch (((inst >> 20) & 0b11111)) {
69
+ case 0x03d3: return "pmpaddr35";
884
+ case 0: op = rv_op_vle8_v; break;
70
+ case 0x03d4: return "pmpaddr36";
885
+ case 11: op = rv_op_vlm_v; break;
71
+ case 0x03d5: return "pmpaddr37";
886
+ case 16: op = rv_op_vle8ff_v; break;
72
+ case 0x03d6: return "pmpaddr38";
887
+ }
73
+ case 0x03d7: return "pmpaddr39";
888
+ break;
74
+ case 0x03d8: return "pmpaddr40";
889
+ case 1: op = rv_op_vluxei8_v; break;
75
+ case 0x03d9: return "pmpaddr41";
890
+ case 2: op = rv_op_vlse8_v; break;
76
+ case 0x03da: return "pmpaddr42";
891
+ case 3: op = rv_op_vloxei8_v; break;
77
+ case 0x03db: return "pmpaddr43";
892
+ }
78
+ case 0x03dc: return "pmpaddr44";
893
+ break;
79
+ case 0x03dd: return "pmpaddr45";
894
case 2: op = rv_op_flw; break;
80
+ case 0x03de: return "pmpaddr46";
895
case 3: op = rv_op_fld; break;
81
+ case 0x03df: return "pmpaddr47";
896
case 4: op = rv_op_flq; break;
82
+ case 0x03e0: return "pmpaddr48";
897
+ case 5:
83
+ case 0x03e1: return "pmpaddr49";
898
+ switch (((inst >> 20) & 0b111111111111)) {
84
+ case 0x03e2: return "pmpaddr50";
899
+ case 40: op = rv_op_vl1re16_v; break;
85
+ case 0x03e3: return "pmpaddr51";
900
+ case 552: op = rv_op_vl2re16_v; break;
86
+ case 0x03e4: return "pmpaddr52";
901
+ case 1576: op = rv_op_vl4re16_v; break;
87
+ case 0x03e5: return "pmpaddr53";
902
+ case 3624: op = rv_op_vl8re16_v; break;
88
+ case 0x03e6: return "pmpaddr54";
903
+ }
89
+ case 0x03e7: return "pmpaddr55";
904
+ switch (((inst >> 26) & 0b111)) {
90
+ case 0x03e8: return "pmpaddr56";
905
+ case 0:
91
+ case 0x03e9: return "pmpaddr57";
906
+ switch (((inst >> 20) & 0b11111)) {
92
+ case 0x03ea: return "pmpaddr58";
907
+ case 0: op = rv_op_vle16_v; break;
93
+ case 0x03eb: return "pmpaddr59";
908
+ case 16: op = rv_op_vle16ff_v; break;
94
+ case 0x03ec: return "pmpaddr60";
909
+ }
95
+ case 0x03ed: return "pmpaddr61";
910
+ break;
96
+ case 0x03ee: return "pmpaddr62";
911
+ case 1: op = rv_op_vluxei16_v; break;
97
+ case 0x03ef: return "pmpaddr63";
912
+ case 2: op = rv_op_vlse16_v; break;
98
case 0x0780: return "mtohost";
913
+ case 3: op = rv_op_vloxei16_v; break;
99
case 0x0781: return "mfromhost";
914
+ }
100
case 0x0782: return "mreset";
915
+ break;
916
+ case 6:
917
+ switch (((inst >> 20) & 0b111111111111)) {
918
+ case 40: op = rv_op_vl1re32_v; break;
919
+ case 552: op = rv_op_vl2re32_v; break;
920
+ case 1576: op = rv_op_vl4re32_v; break;
921
+ case 3624: op = rv_op_vl8re32_v; break;
922
+ }
923
+ switch (((inst >> 26) & 0b111)) {
924
+ case 0:
925
+ switch (((inst >> 20) & 0b11111)) {
926
+ case 0: op = rv_op_vle32_v; break;
927
+ case 16: op = rv_op_vle32ff_v; break;
928
+ }
929
+ break;
930
+ case 1: op = rv_op_vluxei32_v; break;
931
+ case 2: op = rv_op_vlse32_v; break;
932
+ case 3: op = rv_op_vloxei32_v; break;
933
+ }
934
+ break;
935
+ case 7:
936
+ switch (((inst >> 20) & 0b111111111111)) {
937
+ case 40: op = rv_op_vl1re64_v; break;
938
+ case 552: op = rv_op_vl2re64_v; break;
939
+ case 1576: op = rv_op_vl4re64_v; break;
940
+ case 3624: op = rv_op_vl8re64_v; break;
941
+ }
942
+ switch (((inst >> 26) & 0b111)) {
943
+ case 0:
944
+ switch (((inst >> 20) & 0b11111)) {
945
+ case 0: op = rv_op_vle64_v; break;
946
+ case 16: op = rv_op_vle64ff_v; break;
947
+ }
948
+ break;
949
+ case 1: op = rv_op_vluxei64_v; break;
950
+ case 2: op = rv_op_vlse64_v; break;
951
+ case 3: op = rv_op_vloxei64_v; break;
952
+ }
953
+ break;
954
}
955
break;
956
case 3:
957
@@ -XXX,XX +XXX,XX @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
958
break;
959
case 9:
960
switch (((inst >> 12) & 0b111)) {
961
+ case 0:
962
+ switch (((inst >> 20) & 0b111111111111)) {
963
+ case 40: op = rv_op_vs1r_v; break;
964
+ case 552: op = rv_op_vs2r_v; break;
965
+ case 1576: op = rv_op_vs4r_v; break;
966
+ case 3624: op = rv_op_vs8r_v; break;
967
+ }
968
+ switch (((inst >> 26) & 0b111)) {
969
+ case 0:
970
+ switch (((inst >> 20) & 0b11111)) {
971
+ case 0: op = rv_op_vse8_v; break;
972
+ case 11: op = rv_op_vsm_v; break;
973
+ }
974
+ break;
975
+ case 1: op = rv_op_vsuxei8_v; break;
976
+ case 2: op = rv_op_vsse8_v; break;
977
+ case 3: op = rv_op_vsoxei8_v; break;
978
+ }
979
+ break;
980
case 2: op = rv_op_fsw; break;
981
case 3: op = rv_op_fsd; break;
982
case 4: op = rv_op_fsq; break;
983
+ case 5:
984
+ switch (((inst >> 26) & 0b111)) {
985
+ case 0:
986
+ switch (((inst >> 20) & 0b11111)) {
987
+ case 0: op = rv_op_vse16_v; break;
988
+ }
989
+ break;
990
+ case 1: op = rv_op_vsuxei16_v; break;
991
+ case 2: op = rv_op_vsse16_v; break;
992
+ case 3: op = rv_op_vsoxei16_v; break;
993
+ }
994
+ break;
995
+ case 6:
996
+ switch (((inst >> 26) & 0b111)) {
997
+ case 0:
998
+ switch (((inst >> 20) & 0b11111)) {
999
+ case 0: op = rv_op_vse32_v; break;
1000
+ }
1001
+ break;
1002
+ case 1: op = rv_op_vsuxei32_v; break;
1003
+ case 2: op = rv_op_vsse32_v; break;
1004
+ case 3: op = rv_op_vsoxei32_v; break;
1005
+ }
1006
+ break;
1007
+ case 7:
1008
+ switch (((inst >> 26) & 0b111)) {
1009
+ case 0:
1010
+ switch (((inst >> 20) & 0b11111)) {
1011
+ case 0: op = rv_op_vse64_v; break;
1012
+ }
1013
+ break;
1014
+ case 1: op = rv_op_vsuxei64_v; break;
1015
+ case 2: op = rv_op_vsse64_v; break;
1016
+ case 3: op = rv_op_vsoxei64_v; break;
1017
+ }
1018
+ break;
1019
}
1020
break;
1021
case 11:
1022
@@ -XXX,XX +XXX,XX @@ static void decode_inst_opcode(rv_decode *dec, rv_isa isa)
1023
break;
1024
}
1025
break;
1026
+ case 21:
1027
+ switch (((inst >> 12) & 0b111)) {
1028
+ case 0:
1029
+ switch (((inst >> 26) & 0b111111)) {
1030
+ case 0: op = rv_op_vadd_vv; break;
1031
+ case 2: op = rv_op_vsub_vv; break;
1032
+ case 4: op = rv_op_vminu_vv; break;
1033
+ case 5: op = rv_op_vmin_vv; break;
1034
+ case 6: op = rv_op_vmaxu_vv; break;
1035
+ case 7: op = rv_op_vmax_vv; break;
1036
+ case 9: op = rv_op_vand_vv; break;
1037
+ case 10: op = rv_op_vor_vv; break;
1038
+ case 11: op = rv_op_vxor_vv; break;
1039
+ case 12: op = rv_op_vrgather_vv; break;
1040
+ case 14: op = rv_op_vrgatherei16_vv; break;
1041
+ case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vvm; break;
1042
+ case 17: op = rv_op_vmadc_vvm; break;
1043
+ case 18: if (((inst >> 25) & 1) == 0) op = rv_op_vsbc_vvm; break;
1044
+ case 19: op = rv_op_vmsbc_vvm; break;
1045
+ case 23:
1046
+ if (((inst >> 20) & 0b111111) == 32)
1047
+ op = rv_op_vmv_v_v;
1048
+ else if (((inst >> 25) & 1) == 0)
1049
+ op = rv_op_vmerge_vvm;
1050
+ break;
1051
+ case 24: op = rv_op_vmseq_vv; break;
1052
+ case 25: op = rv_op_vmsne_vv; break;
1053
+ case 26: op = rv_op_vmsltu_vv; break;
1054
+ case 27: op = rv_op_vmslt_vv; break;
1055
+ case 28: op = rv_op_vmsleu_vv; break;
1056
+ case 29: op = rv_op_vmsle_vv; break;
1057
+ case 32: op = rv_op_vsaddu_vv; break;
1058
+ case 33: op = rv_op_vsadd_vv; break;
1059
+ case 34: op = rv_op_vssubu_vv; break;
1060
+ case 35: op = rv_op_vssub_vv; break;
1061
+ case 37: op = rv_op_vsll_vv; break;
1062
+ case 39: op = rv_op_vsmul_vv; break;
1063
+ case 40: op = rv_op_vsrl_vv; break;
1064
+ case 41: op = rv_op_vsra_vv; break;
1065
+ case 42: op = rv_op_vssrl_vv; break;
1066
+ case 43: op = rv_op_vssra_vv; break;
1067
+ case 44: op = rv_op_vnsrl_wv; break;
1068
+ case 45: op = rv_op_vnsra_wv; break;
1069
+ case 46: op = rv_op_vnclipu_wv; break;
1070
+ case 47: op = rv_op_vnclip_wv; break;
1071
+ case 48: op = rv_op_vwredsumu_vs; break;
1072
+ case 49: op = rv_op_vwredsum_vs; break;
1073
+ }
1074
+ break;
1075
+ case 1:
1076
+ switch (((inst >> 26) & 0b111111)) {
1077
+ case 0: op = rv_op_vfadd_vv; break;
1078
+ case 1: op = rv_op_vfredusum_vs; break;
1079
+ case 2: op = rv_op_vfsub_vv; break;
1080
+ case 3: op = rv_op_vfredosum_vs; break;
1081
+ case 4: op = rv_op_vfmin_vv; break;
1082
+ case 5: op = rv_op_vfredmin_vs; break;
1083
+ case 6: op = rv_op_vfmax_vv; break;
1084
+ case 7: op = rv_op_vfredmax_vs; break;
1085
+ case 8: op = rv_op_vfsgnj_vv; break;
1086
+ case 9: op = rv_op_vfsgnjn_vv; break;
1087
+ case 10: op = rv_op_vfsgnjx_vv; break;
1088
+ case 16:
1089
+ switch (((inst >> 15) & 0b11111)) {
1090
+ case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_f_s; break;
1091
+ }
1092
+ break;
1093
+ case 18:
1094
+ switch (((inst >> 15) & 0b11111)) {
1095
+ case 0: op = rv_op_vfcvt_xu_f_v; break;
1096
+ case 1: op = rv_op_vfcvt_x_f_v; break;
1097
+ case 2: op = rv_op_vfcvt_f_xu_v; break;
1098
+ case 3: op = rv_op_vfcvt_f_x_v; break;
1099
+ case 6: op = rv_op_vfcvt_rtz_xu_f_v; break;
1100
+ case 7: op = rv_op_vfcvt_rtz_x_f_v; break;
1101
+ case 8: op = rv_op_vfwcvt_xu_f_v; break;
1102
+ case 9: op = rv_op_vfwcvt_x_f_v; break;
1103
+ case 10: op = rv_op_vfwcvt_f_xu_v; break;
1104
+ case 11: op = rv_op_vfwcvt_f_x_v; break;
1105
+ case 12: op = rv_op_vfwcvt_f_f_v; break;
1106
+ case 14: op = rv_op_vfwcvt_rtz_xu_f_v; break;
1107
+ case 15: op = rv_op_vfwcvt_rtz_x_f_v; break;
1108
+ case 16: op = rv_op_vfncvt_xu_f_w; break;
1109
+ case 17: op = rv_op_vfncvt_x_f_w; break;
1110
+ case 18: op = rv_op_vfncvt_f_xu_w; break;
1111
+ case 19: op = rv_op_vfncvt_f_x_w; break;
1112
+ case 20: op = rv_op_vfncvt_f_f_w; break;
1113
+ case 21: op = rv_op_vfncvt_rod_f_f_w; break;
1114
+ case 22: op = rv_op_vfncvt_rtz_xu_f_w; break;
1115
+ case 23: op = rv_op_vfncvt_rtz_x_f_w; break;
1116
+ }
1117
+ break;
1118
+ case 19:
1119
+ switch (((inst >> 15) & 0b11111)) {
1120
+ case 0: op = rv_op_vfsqrt_v; break;
1121
+ case 4: op = rv_op_vfrsqrt7_v; break;
1122
+ case 5: op = rv_op_vfrec7_v; break;
1123
+ case 16: op = rv_op_vfclass_v; break;
1124
+ }
1125
+ break;
1126
+ case 24: op = rv_op_vmfeq_vv; break;
1127
+ case 25: op = rv_op_vmfle_vv; break;
1128
+ case 27: op = rv_op_vmflt_vv; break;
1129
+ case 28: op = rv_op_vmfne_vv; break;
1130
+ case 32: op = rv_op_vfdiv_vv; break;
1131
+ case 36: op = rv_op_vfmul_vv; break;
1132
+ case 40: op = rv_op_vfmadd_vv; break;
1133
+ case 41: op = rv_op_vfnmadd_vv; break;
1134
+ case 42: op = rv_op_vfmsub_vv; break;
1135
+ case 43: op = rv_op_vfnmsub_vv; break;
1136
+ case 44: op = rv_op_vfmacc_vv; break;
1137
+ case 45: op = rv_op_vfnmacc_vv; break;
1138
+ case 46: op = rv_op_vfmsac_vv; break;
1139
+ case 47: op = rv_op_vfnmsac_vv; break;
1140
+ case 48: op = rv_op_vfwadd_vv; break;
1141
+ case 49: op = rv_op_vfwredusum_vs; break;
1142
+ case 50: op = rv_op_vfwsub_vv; break;
1143
+ case 51: op = rv_op_vfwredosum_vs; break;
1144
+ case 52: op = rv_op_vfwadd_wv; break;
1145
+ case 54: op = rv_op_vfwsub_wv; break;
1146
+ case 56: op = rv_op_vfwmul_vv; break;
1147
+ case 60: op = rv_op_vfwmacc_vv; break;
1148
+ case 61: op = rv_op_vfwnmacc_vv; break;
1149
+ case 62: op = rv_op_vfwmsac_vv; break;
1150
+ case 63: op = rv_op_vfwnmsac_vv; break;
1151
+ }
1152
+ break;
1153
+ case 2:
1154
+ switch (((inst >> 26) & 0b111111)) {
1155
+ case 0: op = rv_op_vredsum_vs; break;
1156
+ case 1: op = rv_op_vredand_vs; break;
1157
+ case 2: op = rv_op_vredor_vs; break;
1158
+ case 3: op = rv_op_vredxor_vs; break;
1159
+ case 4: op = rv_op_vredminu_vs; break;
1160
+ case 5: op = rv_op_vredmin_vs; break;
1161
+ case 6: op = rv_op_vredmaxu_vs; break;
1162
+ case 7: op = rv_op_vredmax_vs; break;
1163
+ case 8: op = rv_op_vaaddu_vv; break;
1164
+ case 9: op = rv_op_vaadd_vv; break;
1165
+ case 10: op = rv_op_vasubu_vv; break;
1166
+ case 11: op = rv_op_vasub_vv; break;
1167
+ case 16:
1168
+ switch (((inst >> 15) & 0b11111)) {
1169
+ case 0: if ((inst >> 25) & 1) op = rv_op_vmv_x_s; break;
1170
+ case 16: op = rv_op_vcpop_m; break;
1171
+ case 17: op = rv_op_vfirst_m; break;
1172
+ }
1173
+ break;
1174
+ case 18:
1175
+ switch (((inst >> 15) & 0b11111)) {
1176
+ case 2: op = rv_op_vzext_vf8; break;
1177
+ case 3: op = rv_op_vsext_vf8; break;
1178
+ case 4: op = rv_op_vzext_vf4; break;
1179
+ case 5: op = rv_op_vsext_vf4; break;
1180
+ case 6: op = rv_op_vzext_vf2; break;
1181
+ case 7: op = rv_op_vsext_vf2; break;
1182
+ }
1183
+ break;
1184
+ case 20:
1185
+ switch (((inst >> 15) & 0b11111)) {
1186
+ case 1: op = rv_op_vmsbf_m; break;
1187
+ case 2: op = rv_op_vmsof_m; break;
1188
+ case 3: op = rv_op_vmsif_m; break;
1189
+ case 16: op = rv_op_viota_m; break;
1190
+ case 17: if (((inst >> 20) & 0b11111) == 0) op = rv_op_vid_v; break;
1191
+ }
1192
+ break;
1193
+ case 23: if ((inst >> 25) & 1) op = rv_op_vcompress_vm; break;
1194
+ case 24: if ((inst >> 25) & 1) op = rv_op_vmandn_mm; break;
1195
+ case 25: if ((inst >> 25) & 1) op = rv_op_vmand_mm; break;
1196
+ case 26: if ((inst >> 25) & 1) op = rv_op_vmor_mm; break;
1197
+ case 27: if ((inst >> 25) & 1) op = rv_op_vmxor_mm; break;
1198
+ case 28: if ((inst >> 25) & 1) op = rv_op_vmorn_mm; break;
1199
+ case 29: if ((inst >> 25) & 1) op = rv_op_vmnand_mm; break;
1200
+ case 30: if ((inst >> 25) & 1) op = rv_op_vmnor_mm; break;
1201
+ case 31: if ((inst >> 25) & 1) op = rv_op_vmxnor_mm; break;
1202
+ case 32: op = rv_op_vdivu_vv; break;
1203
+ case 33: op = rv_op_vdiv_vv; break;
1204
+ case 34: op = rv_op_vremu_vv; break;
1205
+ case 35: op = rv_op_vrem_vv; break;
1206
+ case 36: op = rv_op_vmulhu_vv; break;
1207
+ case 37: op = rv_op_vmul_vv; break;
1208
+ case 38: op = rv_op_vmulhsu_vv; break;
1209
+ case 39: op = rv_op_vmulh_vv; break;
1210
+ case 41: op = rv_op_vmadd_vv; break;
1211
+ case 43: op = rv_op_vnmsub_vv; break;
1212
+ case 45: op = rv_op_vmacc_vv; break;
1213
+ case 47: op = rv_op_vnmsac_vv; break;
1214
+ case 48: op = rv_op_vwaddu_vv; break;
1215
+ case 49: op = rv_op_vwadd_vv; break;
1216
+ case 50: op = rv_op_vwsubu_vv; break;
1217
+ case 51: op = rv_op_vwsub_vv; break;
1218
+ case 52: op = rv_op_vwaddu_wv; break;
1219
+ case 53: op = rv_op_vwadd_wv; break;
1220
+ case 54: op = rv_op_vwsubu_wv; break;
1221
+ case 55: op = rv_op_vwsub_wv; break;
1222
+ case 56: op = rv_op_vwmulu_vv; break;
1223
+ case 58: op = rv_op_vwmulsu_vv; break;
1224
+ case 59: op = rv_op_vwmul_vv; break;
1225
+ case 60: op = rv_op_vwmaccu_vv; break;
1226
+ case 61: op = rv_op_vwmacc_vv; break;
1227
+ case 63: op = rv_op_vwmaccsu_vv; break;
1228
+ }
1229
+ break;
1230
+ case 3:
1231
+ switch (((inst >> 26) & 0b111111)) {
1232
+ case 0: op = rv_op_vadd_vi; break;
1233
+ case 3: op = rv_op_vrsub_vi; break;
1234
+ case 9: op = rv_op_vand_vi; break;
1235
+ case 10: op = rv_op_vor_vi; break;
1236
+ case 11: op = rv_op_vxor_vi; break;
1237
+ case 12: op = rv_op_vrgather_vi; break;
1238
+ case 14: op = rv_op_vslideup_vi; break;
1239
+ case 15: op = rv_op_vslidedown_vi; break;
1240
+ case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vim; break;
1241
+ case 17: op = rv_op_vmadc_vim; break;
1242
+ case 23:
1243
+ if (((inst >> 20) & 0b111111) == 32)
1244
+ op = rv_op_vmv_v_i;
1245
+ else if (((inst >> 25) & 1) == 0)
1246
+ op = rv_op_vmerge_vim;
1247
+ break;
1248
+ case 24: op = rv_op_vmseq_vi; break;
1249
+ case 25: op = rv_op_vmsne_vi; break;
1250
+ case 28: op = rv_op_vmsleu_vi; break;
1251
+ case 29: op = rv_op_vmsle_vi; break;
1252
+ case 30: op = rv_op_vmsgtu_vi; break;
1253
+ case 31: op = rv_op_vmsgt_vi; break;
1254
+ case 32: op = rv_op_vsaddu_vi; break;
1255
+ case 33: op = rv_op_vsadd_vi; break;
1256
+ case 37: op = rv_op_vsll_vi; break;
1257
+ case 39:
1258
+ switch (((inst >> 15) & 0b11111)) {
1259
+ case 0: op = rv_op_vmv1r_v; break;
1260
+ case 1: op = rv_op_vmv2r_v; break;
1261
+ case 3: op = rv_op_vmv4r_v; break;
1262
+ case 7: op = rv_op_vmv8r_v; break;
1263
+ }
1264
+ break;
1265
+ case 40: op = rv_op_vsrl_vi; break;
1266
+ case 41: op = rv_op_vsra_vi; break;
1267
+ case 42: op = rv_op_vssrl_vi; break;
1268
+ case 43: op = rv_op_vssra_vi; break;
1269
+ case 44: op = rv_op_vnsrl_wi; break;
1270
+ case 45: op = rv_op_vnsra_wi; break;
1271
+ case 46: op = rv_op_vnclipu_wi; break;
1272
+ case 47: op = rv_op_vnclip_wi; break;
1273
+ }
1274
+ break;
1275
+ case 4:
1276
+ switch (((inst >> 26) & 0b111111)) {
1277
+ case 0: op = rv_op_vadd_vx; break;
1278
+ case 2: op = rv_op_vsub_vx; break;
1279
+ case 3: op = rv_op_vrsub_vx; break;
1280
+ case 4: op = rv_op_vminu_vx; break;
1281
+ case 5: op = rv_op_vmin_vx; break;
1282
+ case 6: op = rv_op_vmaxu_vx; break;
1283
+ case 7: op = rv_op_vmax_vx; break;
1284
+ case 9: op = rv_op_vand_vx; break;
1285
+ case 10: op = rv_op_vor_vx; break;
1286
+ case 11: op = rv_op_vxor_vx; break;
1287
+ case 12: op = rv_op_vrgather_vx; break;
1288
+ case 14: op = rv_op_vslideup_vx; break;
1289
+ case 15: op = rv_op_vslidedown_vx; break;
1290
+ case 16: if (((inst >> 25) & 1) == 0) op = rv_op_vadc_vxm; break;
1291
+ case 17: op = rv_op_vmadc_vxm; break;
1292
+ case 18: if (((inst >> 25) & 1) == 0) op = rv_op_vsbc_vxm; break;
1293
+ case 19: op = rv_op_vmsbc_vxm; break;
1294
+ case 23:
1295
+ if (((inst >> 20) & 0b111111) == 32)
1296
+ op = rv_op_vmv_v_x;
1297
+ else if (((inst >> 25) & 1) == 0)
1298
+ op = rv_op_vmerge_vxm;
1299
+ break;
1300
+ case 24: op = rv_op_vmseq_vx; break;
1301
+ case 25: op = rv_op_vmsne_vx; break;
1302
+ case 26: op = rv_op_vmsltu_vx; break;
1303
+ case 27: op = rv_op_vmslt_vx; break;
1304
+ case 28: op = rv_op_vmsleu_vx; break;
1305
+ case 29: op = rv_op_vmsle_vx; break;
1306
+ case 30: op = rv_op_vmsgtu_vx; break;
1307
+ case 31: op = rv_op_vmsgt_vx; break;
1308
+ case 32: op = rv_op_vsaddu_vx; break;
1309
+ case 33: op = rv_op_vsadd_vx; break;
1310
+ case 34: op = rv_op_vssubu_vx; break;
1311
+ case 35: op = rv_op_vssub_vx; break;
1312
+ case 37: op = rv_op_vsll_vx; break;
1313
+ case 39: op = rv_op_vsmul_vx; break;
1314
+ case 40: op = rv_op_vsrl_vx; break;
1315
+ case 41: op = rv_op_vsra_vx; break;
1316
+ case 42: op = rv_op_vssrl_vx; break;
1317
+ case 43: op = rv_op_vssra_vx; break;
1318
+ case 44: op = rv_op_vnsrl_wx; break;
1319
+ case 45: op = rv_op_vnsra_wx; break;
1320
+ case 46: op = rv_op_vnclipu_wx; break;
1321
+ case 47: op = rv_op_vnclip_wx; break;
1322
+ }
1323
+ break;
1324
+ case 5:
1325
+ switch (((inst >> 26) & 0b111111)) {
1326
+ case 0: op = rv_op_vfadd_vf; break;
1327
+ case 2: op = rv_op_vfsub_vf; break;
1328
+ case 4: op = rv_op_vfmin_vf; break;
1329
+ case 6: op = rv_op_vfmax_vf; break;
1330
+ case 8: op = rv_op_vfsgnj_vf; break;
1331
+ case 9: op = rv_op_vfsgnjn_vf; break;
1332
+ case 10: op = rv_op_vfsgnjx_vf; break;
1333
+ case 14: op = rv_op_vfslide1up_vf; break;
1334
+ case 15: op = rv_op_vfslide1down_vf; break;
1335
+ case 16:
1336
+ switch (((inst >> 20) & 0b11111)) {
1337
+ case 0: if ((inst >> 25) & 1) op = rv_op_vfmv_s_f; break;
1338
+ }
1339
+ break;
1340
+ case 23:
1341
+ if (((inst >> 25) & 1) == 0)
1342
+ op = rv_op_vfmerge_vfm;
1343
+ else if (((inst >> 20) & 0b111111) == 32)
1344
+ op = rv_op_vfmv_v_f;
1345
+ break;
1346
+ case 24: op = rv_op_vmfeq_vf; break;
1347
+ case 25: op = rv_op_vmfle_vf; break;
1348
+ case 27: op = rv_op_vmflt_vf; break;
1349
+ case 28: op = rv_op_vmfne_vf; break;
1350
+ case 29: op = rv_op_vmfgt_vf; break;
1351
+ case 31: op = rv_op_vmfge_vf; break;
1352
+ case 32: op = rv_op_vfdiv_vf; break;
1353
+ case 33: op = rv_op_vfrdiv_vf; break;
1354
+ case 36: op = rv_op_vfmul_vf; break;
1355
+ case 39: op = rv_op_vfrsub_vf; break;
1356
+ case 40: op = rv_op_vfmadd_vf; break;
1357
+ case 41: op = rv_op_vfnmadd_vf; break;
1358
+ case 42: op = rv_op_vfmsub_vf; break;
1359
+ case 43: op = rv_op_vfnmsub_vf; break;
1360
+ case 44: op = rv_op_vfmacc_vf; break;
1361
+ case 45: op = rv_op_vfnmacc_vf; break;
1362
+ case 46: op = rv_op_vfmsac_vf; break;
1363
+ case 47: op = rv_op_vfnmsac_vf; break;
1364
+ case 48: op = rv_op_vfwadd_vf; break;
1365
+ case 50: op = rv_op_vfwsub_vf; break;
1366
+ case 52: op = rv_op_vfwadd_wf; break;
1367
+ case 54: op = rv_op_vfwsub_wf; break;
1368
+ case 56: op = rv_op_vfwmul_vf; break;
1369
+ case 60: op = rv_op_vfwmacc_vf; break;
1370
+ case 61: op = rv_op_vfwnmacc_vf; break;
1371
+ case 62: op = rv_op_vfwmsac_vf; break;
1372
+ case 63: op = rv_op_vfwnmsac_vf; break;
1373
+ }
1374
+ break;
1375
+ case 6:
1376
+ switch (((inst >> 26) & 0b111111)) {
1377
+ case 8: op = rv_op_vaaddu_vx; break;
1378
+ case 9: op = rv_op_vaadd_vx; break;
1379
+ case 10: op = rv_op_vasubu_vx; break;
1380
+ case 11: op = rv_op_vasub_vx; break;
1381
+ case 14: op = rv_op_vslide1up_vx; break;
1382
+ case 15: op = rv_op_vslide1down_vx; break;
1383
+ case 16:
1384
+ switch (((inst >> 20) & 0b11111)) {
1385
+ case 0: if ((inst >> 25) & 1) op = rv_op_vmv_s_x; break;
1386
+ }
1387
+ break;
1388
+ case 32: op = rv_op_vdivu_vx; break;
1389
+ case 33: op = rv_op_vdiv_vx; break;
1390
+ case 34: op = rv_op_vremu_vx; break;
1391
+ case 35: op = rv_op_vrem_vx; break;
1392
+ case 36: op = rv_op_vmulhu_vx; break;
1393
+ case 37: op = rv_op_vmul_vx; break;
1394
+ case 38: op = rv_op_vmulhsu_vx; break;
1395
+ case 39: op = rv_op_vmulh_vx; break;
1396
+ case 41: op = rv_op_vmadd_vx; break;
1397
+ case 43: op = rv_op_vnmsub_vx; break;
1398
+ case 45: op = rv_op_vmacc_vx; break;
1399
+ case 47: op = rv_op_vnmsac_vx; break;
1400
+ case 48: op = rv_op_vwaddu_vx; break;
1401
+ case 49: op = rv_op_vwadd_vx; break;
1402
+ case 50: op = rv_op_vwsubu_vx; break;
1403
+ case 51: op = rv_op_vwsub_vx; break;
1404
+ case 52: op = rv_op_vwaddu_wx; break;
1405
+ case 53: op = rv_op_vwadd_wx; break;
1406
+ case 54: op = rv_op_vwsubu_wx; break;
1407
+ case 55: op = rv_op_vwsub_wx; break;
1408
+ case 56: op = rv_op_vwmulu_vx; break;
1409
+ case 58: op = rv_op_vwmulsu_vx; break;
1410
+ case 59: op = rv_op_vwmul_vx; break;
1411
+ case 60: op = rv_op_vwmaccu_vx; break;
1412
+ case 61: op = rv_op_vwmacc_vx; break;
1413
+ case 62: op = rv_op_vwmaccus_vx; break;
1414
+ case 63: op = rv_op_vwmaccsu_vx; break;
1415
+ }
1416
+ break;
1417
+ case 7:
1418
+ if (((inst >> 31) & 1) == 0) {
1419
+ op = rv_op_vsetvli;
1420
+ } else if ((inst >> 30) & 1) {
1421
+ op = rv_op_vsetivli;
1422
+ } else if (((inst >> 25) & 0b11111) == 0) {
1423
+ op = rv_op_vsetvl;
1424
+ }
1425
+ break;
1426
+ }
1427
+ break;
1428
case 22:
1429
switch (((inst >> 12) & 0b111)) {
1430
case 0: op = rv_op_addid; break;
1431
@@ -XXX,XX +XXX,XX @@ static uint32_t operand_cimmq(rv_inst inst)
1432
((inst << 57) >> 62) << 6;
1433
}
1434
1435
+static uint32_t operand_vimm(rv_inst inst)
1436
+{
1437
+ return (int64_t)(inst << 44) >> 59;
1438
+}
1439
+
1440
+static uint32_t operand_vzimm11(rv_inst inst)
1441
+{
1442
+ return (inst << 33) >> 53;
1443
+}
1444
+
1445
+static uint32_t operand_vzimm10(rv_inst inst)
1446
+{
1447
+ return (inst << 34) >> 54;
1448
+}
1449
+
1450
static uint32_t operand_bs(rv_inst inst)
1451
{
1452
return (inst << 32) >> 62;
1453
@@ -XXX,XX +XXX,XX @@ static uint32_t operand_rnum(rv_inst inst)
1454
return (inst << 40) >> 60;
1455
}
1456
1457
+static uint32_t operand_vm(rv_inst inst)
1458
+{
1459
+ return (inst << 38) >> 63;
1460
+}
1461
+
1462
/* decode operands */
1463
1464
static void decode_inst_operands(rv_decode *dec, rv_isa isa)
1465
@@ -XXX,XX +XXX,XX @@ static void decode_inst_operands(rv_decode *dec, rv_isa isa)
1466
dec->rs1 = operand_rs1(inst);
1467
dec->rnum = operand_rnum(inst);
1468
break;
1469
+ case rv_codec_v_r:
1470
+ dec->rd = operand_rd(inst);
1471
+ dec->rs1 = operand_rs1(inst);
1472
+ dec->rs2 = operand_rs2(inst);
1473
+ dec->vm = operand_vm(inst);
1474
+ break;
1475
+ case rv_codec_v_ldst:
1476
+ dec->rd = operand_rd(inst);
1477
+ dec->rs1 = operand_rs1(inst);
1478
+ dec->vm = operand_vm(inst);
1479
+ break;
1480
+ case rv_codec_v_i:
1481
+ dec->rd = operand_rd(inst);
1482
+ dec->rs2 = operand_rs2(inst);
1483
+ dec->imm = operand_vimm(inst);
1484
+ dec->vm = operand_vm(inst);
1485
+ break;
1486
+ case rv_codec_vsetvli:
1487
+ dec->rd = operand_rd(inst);
1488
+ dec->rs1 = operand_rs1(inst);
1489
+ dec->vzimm = operand_vzimm11(inst);
1490
+ break;
1491
+ case rv_codec_vsetivli:
1492
+ dec->rd = operand_rd(inst);
1493
+ dec->imm = operand_vimm(inst);
1494
+ dec->vzimm = operand_vzimm10(inst);
1495
+ break;
1496
};
1497
}
1498
1499
@@ -XXX,XX +XXX,XX @@ static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec)
1500
snprintf(tmp, sizeof(tmp), "%d", dec->imm);
1501
append(buf, tmp, buflen);
1502
break;
1503
+ case 'u':
1504
+ snprintf(tmp, sizeof(tmp), "%u", ((uint32_t)dec->imm & 0b11111));
1505
+ append(buf, tmp, buflen);
1506
+ break;
1507
case 'o':
1508
snprintf(tmp, sizeof(tmp), "%d", dec->imm);
1509
append(buf, tmp, buflen);
1510
@@ -XXX,XX +XXX,XX @@ static void format_inst(char *buf, size_t buflen, size_t tab, rv_decode *dec)
1511
append(buf, ".rl", buflen);
1512
}
1513
break;
1514
+ case 'l':
1515
+ append(buf, ",v0", buflen);
1516
+ break;
1517
+ case 'm':
1518
+ if (dec->vm == 0) {
1519
+ append(buf, ",v0.t", buflen);
1520
+ }
1521
+ break;
1522
+ case 'D':
1523
+ append(buf, rv_vreg_name_sym[dec->rd], buflen);
1524
+ break;
1525
+ case 'E':
1526
+ append(buf, rv_vreg_name_sym[dec->rs1], buflen);
1527
+ break;
1528
+ case 'F':
1529
+ append(buf, rv_vreg_name_sym[dec->rs2], buflen);
1530
+ break;
1531
+ case 'G':
1532
+ append(buf, rv_vreg_name_sym[dec->rs3], buflen);
1533
+ break;
1534
+ case 'v': {
1535
+ char nbuf[32] = {0};
1536
+ const int sew = 1 << (((dec->vzimm >> 3) & 0b111) + 3);
1537
+ sprintf(nbuf, "%d", sew);
1538
+ const int lmul = dec->vzimm & 0b11;
1539
+ const int flmul = (dec->vzimm >> 2) & 1;
1540
+ const char *vta = (dec->vzimm >> 6) & 1 ? "ta" : "tu";
1541
+ const char *vma = (dec->vzimm >> 7) & 1 ? "ma" : "mu";
1542
+ append(buf, "e", buflen);
1543
+ append(buf, nbuf, buflen);
1544
+ append(buf, ",m", buflen);
1545
+ if (flmul) {
1546
+ switch (lmul) {
1547
+ case 3:
1548
+ sprintf(nbuf, "f2");
1549
+ break;
1550
+ case 2:
1551
+ sprintf(nbuf, "f4");
1552
+ break;
1553
+ case 1:
1554
+ sprintf(nbuf, "f8");
1555
+ break;
1556
+ }
1557
+ append(buf, nbuf, buflen);
1558
+ } else {
1559
+ sprintf(nbuf, "%d", 1 << lmul);
1560
+ append(buf, nbuf, buflen);
1561
+ }
1562
+ append(buf, ",", buflen);
1563
+ append(buf, vta, buflen);
1564
+ append(buf, ",", buflen);
1565
+ append(buf, vma, buflen);
1566
+ break;
1567
+ }
1568
default:
1569
break;
1570
}
1571
@@ -XXX,XX +XXX,XX @@ disasm_inst(char *buf, size_t buflen, rv_isa isa, uint64_t pc, rv_inst inst)
1572
decode_inst_operands(&dec, isa);
1573
decode_inst_decompress(&dec, isa);
1574
decode_inst_lift_pseudo(&dec);
1575
- format_inst(buf, buflen, 16, &dec);
1576
+ format_inst(buf, buflen, 24, &dec);
1577
}
1578
1579
#define INST_FMT_2 "%04" PRIx64 " "
1580
--
101
--
1581
2.37.3
102
2.45.1
diff view generated by jsdifflib
1
From: Sunil V L <sunilvl@ventanamicro.com>
1
From: Yu-Ming Chang <yumin686@andestech.com>
2
2
3
load_image_to_fw_cfg() is duplicated by both arm and loongarch. The same
3
Both CSRRS and CSRRC always read the addressed CSR and cause any read side
4
function will be required by riscv too. So, it's time to refactor and
4
effects regardless of rs1 and rd fields. Note that if rs1 specifies a register
5
move this function to a common path.
5
holding a zero value other than x0, the instruction will still attempt to write
6
the unmodified value back to the CSR and will cause any attendant side effects.
6
7
7
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
8
So if CSRRS or CSRRC tries to write a read-only CSR with rs1 which specifies
8
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
9
a register holding a zero value, an illegal instruction exception should be
10
raised.
11
12
Signed-off-by: Yu-Ming Chang <yumin686@andestech.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Song Gao <gaosong@loongson.cn>
14
Message-ID: <20240403070823.80897-1-yumin686@andestech.com>
11
Message-Id: <20221004092351.18209-2-sunilvl@ventanamicro.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
16
---
14
include/hw/nvram/fw_cfg.h | 21 +++++++++++++++++
17
target/riscv/cpu.h | 4 ++++
15
hw/arm/boot.c | 49 ---------------------------------------
18
target/riscv/csr.c | 51 ++++++++++++++++++++++++++++++++++++----
16
hw/loongarch/virt.c | 33 --------------------------
19
target/riscv/op_helper.c | 6 ++---
17
hw/nvram/fw_cfg.c | 32 +++++++++++++++++++++++++
20
3 files changed, 53 insertions(+), 8 deletions(-)
18
4 files changed, 53 insertions(+), 82 deletions(-)
19
21
20
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
22
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
21
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/nvram/fw_cfg.h
24
--- a/target/riscv/cpu.h
23
+++ b/include/hw/nvram/fw_cfg.h
25
+++ b/target/riscv/cpu.h
24
@@ -XXX,XX +XXX,XX @@ bool fw_cfg_dma_enabled(void *opaque);
26
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc,
25
*/
27
void riscv_cpu_update_mask(CPURISCVState *env);
26
const char *fw_cfg_arch_key_name(uint16_t key);
28
bool riscv_cpu_is_32bit(RISCVCPU *cpu);
27
29
28
+/**
30
+RISCVException riscv_csrr(CPURISCVState *env, int csrno,
29
+ * load_image_to_fw_cfg() - Load an image file into an fw_cfg entry identified
31
+ target_ulong *ret_value);
30
+ * by key.
32
RISCVException riscv_csrrw(CPURISCVState *env, int csrno,
31
+ * @fw_cfg: The firmware config instance to store the data in.
33
target_ulong *ret_value,
32
+ * @size_key: The firmware config key to store the size of the loaded
34
target_ulong new_value, target_ulong write_mask);
33
+ * data under, with fw_cfg_add_i32().
35
@@ -XXX,XX +XXX,XX @@ typedef RISCVException (*riscv_csr_op_fn)(CPURISCVState *env, int csrno,
34
+ * @data_key: The firmware config key to store the loaded data under,
36
target_ulong new_value,
35
+ * with fw_cfg_add_bytes().
37
target_ulong write_mask);
36
+ * @image_name: The name of the image file to load. If it is NULL, the
38
37
+ * function returns without doing anything.
39
+RISCVException riscv_csrr_i128(CPURISCVState *env, int csrno,
38
+ * @try_decompress: Whether the image should be decompressed (gunzipped) before
40
+ Int128 *ret_value);
39
+ * adding it to fw_cfg. If decompression fails, the image is
41
RISCVException riscv_csrrw_i128(CPURISCVState *env, int csrno,
40
+ * loaded as-is.
42
Int128 *ret_value,
41
+ *
43
Int128 new_value, Int128 write_mask);
42
+ * In case of failure, the function prints an error message to stderr and the
44
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
43
+ * process exits with status 1.
44
+ */
45
+void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
46
+ uint16_t data_key, const char *image_name,
47
+ bool try_decompress);
48
+
49
#endif
50
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
51
index XXXXXXX..XXXXXXX 100644
45
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/boot.c
46
--- a/target/riscv/csr.c
53
+++ b/hw/arm/boot.c
47
+++ b/target/riscv/csr.c
54
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
48
@@ -XXX,XX +XXX,XX @@ static RISCVException rmw_seed(CPURISCVState *env, int csrno,
49
50
static inline RISCVException riscv_csrrw_check(CPURISCVState *env,
51
int csrno,
52
- bool write_mask)
53
+ bool write)
54
{
55
/* check privileges and return RISCV_EXCP_ILLEGAL_INST if check fails */
56
bool read_only = get_field(csrno, 0xC00) == 3;
57
@@ -XXX,XX +XXX,XX @@ static inline RISCVException riscv_csrrw_check(CPURISCVState *env,
55
}
58
}
59
60
/* read / write check */
61
- if (write_mask && read_only) {
62
+ if (write && read_only) {
63
return RISCV_EXCP_ILLEGAL_INST;
64
}
65
66
@@ -XXX,XX +XXX,XX @@ static RISCVException riscv_csrrw_do64(CPURISCVState *env, int csrno,
67
return RISCV_EXCP_NONE;
56
}
68
}
57
69
58
-/**
70
+RISCVException riscv_csrr(CPURISCVState *env, int csrno,
59
- * load_image_to_fw_cfg() - Load an image file into an fw_cfg entry identified
71
+ target_ulong *ret_value)
60
- * by key.
61
- * @fw_cfg: The firmware config instance to store the data in.
62
- * @size_key: The firmware config key to store the size of the loaded
63
- * data under, with fw_cfg_add_i32().
64
- * @data_key: The firmware config key to store the loaded data under,
65
- * with fw_cfg_add_bytes().
66
- * @image_name: The name of the image file to load. If it is NULL, the
67
- * function returns without doing anything.
68
- * @try_decompress: Whether the image should be decompressed (gunzipped) before
69
- * adding it to fw_cfg. If decompression fails, the image is
70
- * loaded as-is.
71
- *
72
- * In case of failure, the function prints an error message to stderr and the
73
- * process exits with status 1.
74
- */
75
-static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
76
- uint16_t data_key, const char *image_name,
77
- bool try_decompress)
78
-{
79
- size_t size = -1;
80
- uint8_t *data;
81
-
82
- if (image_name == NULL) {
83
- return;
84
- }
85
-
86
- if (try_decompress) {
87
- size = load_image_gzipped_buffer(image_name,
88
- LOAD_IMAGE_MAX_GUNZIP_BYTES, &data);
89
- }
90
-
91
- if (size == (size_t)-1) {
92
- gchar *contents;
93
- gsize length;
94
-
95
- if (!g_file_get_contents(image_name, &contents, &length, NULL)) {
96
- error_report("failed to load \"%s\"", image_name);
97
- exit(1);
98
- }
99
- size = length;
100
- data = (uint8_t *)contents;
101
- }
102
-
103
- fw_cfg_add_i32(fw_cfg, size_key, size);
104
- fw_cfg_add_bytes(fw_cfg, data_key, data, size);
105
-}
106
-
107
static int do_arm_linux_init(Object *obj, void *opaque)
108
{
109
if (object_dynamic_cast(obj, TYPE_ARM_LINUX_BOOT_IF)) {
110
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
111
index XXXXXXX..XXXXXXX 100644
112
--- a/hw/loongarch/virt.c
113
+++ b/hw/loongarch/virt.c
114
@@ -XXX,XX +XXX,XX @@ static void reset_load_elf(void *opaque)
115
}
116
}
117
118
-/* Load an image file into an fw_cfg entry identified by key. */
119
-static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
120
- uint16_t data_key, const char *image_name,
121
- bool try_decompress)
122
-{
123
- size_t size = -1;
124
- uint8_t *data;
125
-
126
- if (image_name == NULL) {
127
- return;
128
- }
129
-
130
- if (try_decompress) {
131
- size = load_image_gzipped_buffer(image_name,
132
- LOAD_IMAGE_MAX_GUNZIP_BYTES, &data);
133
- }
134
-
135
- if (size == (size_t)-1) {
136
- gchar *contents;
137
- gsize length;
138
-
139
- if (!g_file_get_contents(image_name, &contents, &length, NULL)) {
140
- error_report("failed to load \"%s\"", image_name);
141
- exit(1);
142
- }
143
- size = length;
144
- data = (uint8_t *)contents;
145
- }
146
-
147
- fw_cfg_add_i32(fw_cfg, size_key, size);
148
- fw_cfg_add_bytes(fw_cfg, data_key, data, size);
149
-}
150
-
151
static void fw_cfg_add_kernel_info(FWCfgState *fw_cfg)
152
{
153
/*
154
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
155
index XXXXXXX..XXXXXXX 100644
156
--- a/hw/nvram/fw_cfg.c
157
+++ b/hw/nvram/fw_cfg.c
158
@@ -XXX,XX +XXX,XX @@
159
#include "qapi/error.h"
160
#include "hw/acpi/aml-build.h"
161
#include "hw/pci/pci_bus.h"
162
+#include "hw/loader.h"
163
164
#define FW_CFG_FILE_SLOTS_DFLT 0x20
165
166
@@ -XXX,XX +XXX,XX @@ FWCfgState *fw_cfg_find(void)
167
return FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
168
}
169
170
+void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
171
+ uint16_t data_key, const char *image_name,
172
+ bool try_decompress)
173
+{
72
+{
174
+ size_t size = -1;
73
+ RISCVException ret = riscv_csrrw_check(env, csrno, false);
175
+ uint8_t *data;
74
+ if (ret != RISCV_EXCP_NONE) {
176
+
75
+ return ret;
177
+ if (image_name == NULL) {
178
+ return;
179
+ }
76
+ }
180
+
77
+
181
+ if (try_decompress) {
78
+ return riscv_csrrw_do64(env, csrno, ret_value, 0, 0);
182
+ size = load_image_gzipped_buffer(image_name,
79
+}
183
+ LOAD_IMAGE_MAX_GUNZIP_BYTES, &data);
80
+
81
RISCVException riscv_csrrw(CPURISCVState *env, int csrno,
82
target_ulong *ret_value,
83
target_ulong new_value, target_ulong write_mask)
84
{
85
- RISCVException ret = riscv_csrrw_check(env, csrno, write_mask);
86
+ RISCVException ret = riscv_csrrw_check(env, csrno, true);
87
if (ret != RISCV_EXCP_NONE) {
88
return ret;
89
}
90
@@ -XXX,XX +XXX,XX @@ static RISCVException riscv_csrrw_do128(CPURISCVState *env, int csrno,
91
return RISCV_EXCP_NONE;
92
}
93
94
+RISCVException riscv_csrr_i128(CPURISCVState *env, int csrno,
95
+ Int128 *ret_value)
96
+{
97
+ RISCVException ret;
98
+
99
+ ret = riscv_csrrw_check(env, csrno, false);
100
+ if (ret != RISCV_EXCP_NONE) {
101
+ return ret;
184
+ }
102
+ }
185
+
103
+
186
+ if (size == (size_t)-1) {
104
+ if (csr_ops[csrno].read128) {
187
+ gchar *contents;
105
+ return riscv_csrrw_do128(env, csrno, ret_value,
188
+ gsize length;
106
+ int128_zero(), int128_zero());
189
+
190
+ if (!g_file_get_contents(image_name, &contents, &length, NULL)) {
191
+ error_report("failed to load \"%s\"", image_name);
192
+ exit(1);
193
+ }
194
+ size = length;
195
+ data = (uint8_t *)contents;
196
+ }
107
+ }
197
+
108
+
198
+ fw_cfg_add_i32(fw_cfg, size_key, size);
109
+ /*
199
+ fw_cfg_add_bytes(fw_cfg, data_key, data, size);
110
+ * Fall back to 64-bit version for now, if the 128-bit alternative isn't
111
+ * at all defined.
112
+ * Note, some CSRs don't need to extend to MXLEN (64 upper bits non
113
+ * significant), for those, this fallback is correctly handling the
114
+ * accesses
115
+ */
116
+ target_ulong old_value;
117
+ ret = riscv_csrrw_do64(env, csrno, &old_value,
118
+ (target_ulong)0,
119
+ (target_ulong)0);
120
+ if (ret == RISCV_EXCP_NONE && ret_value) {
121
+ *ret_value = int128_make64(old_value);
122
+ }
123
+ return ret;
200
+}
124
+}
201
125
+
202
static void fw_cfg_class_init(ObjectClass *klass, void *data)
126
RISCVException riscv_csrrw_i128(CPURISCVState *env, int csrno,
127
Int128 *ret_value,
128
Int128 new_value, Int128 write_mask)
203
{
129
{
130
RISCVException ret;
131
132
- ret = riscv_csrrw_check(env, csrno, int128_nz(write_mask));
133
+ ret = riscv_csrrw_check(env, csrno, true);
134
if (ret != RISCV_EXCP_NONE) {
135
return ret;
136
}
137
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
138
index XXXXXXX..XXXXXXX 100644
139
--- a/target/riscv/op_helper.c
140
+++ b/target/riscv/op_helper.c
141
@@ -XXX,XX +XXX,XX @@ target_ulong helper_csrr(CPURISCVState *env, int csr)
142
}
143
144
target_ulong val = 0;
145
- RISCVException ret = riscv_csrrw(env, csr, &val, 0, 0);
146
+ RISCVException ret = riscv_csrr(env, csr, &val);
147
148
if (ret != RISCV_EXCP_NONE) {
149
riscv_raise_exception(env, ret, GETPC());
150
@@ -XXX,XX +XXX,XX @@ target_ulong helper_csrrw(CPURISCVState *env, int csr,
151
target_ulong helper_csrr_i128(CPURISCVState *env, int csr)
152
{
153
Int128 rv = int128_zero();
154
- RISCVException ret = riscv_csrrw_i128(env, csr, &rv,
155
- int128_zero(),
156
- int128_zero());
157
+ RISCVException ret = riscv_csrr_i128(env, csr, &rv);
158
159
if (ret != RISCV_EXCP_NONE) {
160
riscv_raise_exception(env, ret, GETPC());
204
--
161
--
205
2.37.3
162
2.45.1
diff view generated by jsdifflib