[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/32] target/riscv: Reuse the conversion function of priv_spec
From: |
Alistair Francis |
Subject: |
[PULL 15/32] target/riscv: Reuse the conversion function of priv_spec |
Date: |
Thu, 27 Jun 2024 20:00:36 +1000 |
From: Jim Shu <jim.shu@sifive.com>
Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c
could also use it.
Signed-off-by: Jim Shu <jim.shu@sifive.com>
Signed-off-by: Fea.Wang <fea.wang@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20240606135454.119186-2-fea.wang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/cpu.h | 1 +
target/riscv/cpu.c | 2 +-
target/riscv/tcg/tcg-cpu.c | 13 ++++---------
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 6fe0d712b4..b4c9e13774 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -830,4 +830,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool
is_32_bit);
/* Implemented in th_csr.c */
void th_register_custom_csrs(RISCVCPU *cpu);
+const char *priv_spec_to_str(int priv_version);
#endif /* RISCV_CPU_H */
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 69a08e8c2c..fd0f09c468 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1790,7 +1790,7 @@ static int priv_spec_from_str(const char *priv_spec_str)
return priv_version;
}
-static const char *priv_spec_to_str(int priv_version)
+const char *priv_spec_to_str(int priv_version)
{
switch (priv_version) {
case PRIV_VERSION_1_10_0:
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index fa8a17cc60..4c6141f947 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu,
uint32_t bit,
static const char *cpu_priv_ver_to_str(int priv_ver)
{
- switch (priv_ver) {
- case PRIV_VERSION_1_10_0:
- return "v1.10.0";
- case PRIV_VERSION_1_11_0:
- return "v1.11.0";
- case PRIV_VERSION_1_12_0:
- return "v1.12.0";
- }
+ const char *priv_spec_str = priv_spec_to_str(priv_ver);
- g_assert_not_reached();
+ g_assert(priv_spec_str);
+
+ return priv_spec_str;
}
static void riscv_cpu_synchronize_from_tb(CPUState *cs,
--
2.45.2
- [PULL 08/32] hw/riscv/virt.c: aplic DT: rename prop to 'riscv, delegation', (continued)
- [PULL 08/32] hw/riscv/virt.c: aplic DT: rename prop to 'riscv, delegation', Alistair Francis, 2024/06/27
- [PULL 06/32] hw/riscv/virt.c: rename aplic nodename to 'interrupt-controller', Alistair Francis, 2024/06/27
- [PULL 09/32] hw/riscv/virt.c: change imsic nodename to 'interrupt-controller', Alistair Francis, 2024/06/27
- [PULL 10/32] hw/riscv/virt.c: imsics DT: add 'qemu, imsics' to 'compatible', Alistair Francis, 2024/06/27
- [PULL 11/32] hw/riscv/virt.c: imsics DT: add '#msi-cells', Alistair Francis, 2024/06/27
- [PULL 13/32] target/riscv/kvm: handle the exit with debug reason, Alistair Francis, 2024/06/27
- [PULL 14/32] target/riscv/kvm: define TARGET_KVM_HAVE_GUEST_DEBUG, Alistair Francis, 2024/06/27
- [PULL 12/32] target/riscv/kvm: add software breakpoints support, Alistair Francis, 2024/06/27
- [PULL 16/32] target/riscv: Define macros and variables for ss1p13, Alistair Francis, 2024/06/27
- [PULL 17/32] target/riscv: Add 'P1P13' bit in SMSTATEEN0, Alistair Francis, 2024/06/27
- [PULL 15/32] target/riscv: Reuse the conversion function of priv_spec,
Alistair Francis <=
- [PULL 18/32] target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32, Alistair Francis, 2024/06/27
- [PULL 19/32] target/riscv: Reserve exception codes for sw-check and hw-err, Alistair Francis, 2024/06/27
- [PULL 20/32] target/riscv: Support the version for ss1p13, Alistair Francis, 2024/06/27
- [PULL 21/32] hw/riscv/virt.c: Make block devices default to virtio, Alistair Francis, 2024/06/27
- [PULL 22/32] target/riscv: Fix froundnx.h nanbox check, Alistair Francis, 2024/06/27
- [PULL 23/32] target/riscv: fix instructions count handling in icount mode, Alistair Francis, 2024/06/27
- [PULL 27/32] target/riscv: Add multi extension implied rules, Alistair Francis, 2024/06/27
- [PULL 25/32] target/riscv: Introduce extension implied rule helpers, Alistair Francis, 2024/06/27
- [PULL 26/32] target/riscv: Add MISA extension implied rules, Alistair Francis, 2024/06/27
- [PULL 24/32] target/riscv: Introduce extension implied rules definition, Alistair Francis, 2024/06/27