* [PATCH v5 1/2] target/riscv: Add BOSC's Xiangshan Kunminghu CPU
@ 2025-06-17 7:40 Ran Wang
2025-06-19 7:51 ` Nutty Liu
0 siblings, 1 reply; 2+ messages in thread
From: Ran Wang @ 2025-06-17 7:40 UTC (permalink / raw)
To: alistair23
Cc: 3543977024, palmer, alistair.francis, liwei1518, dbarboza,
zhiwei_liu, qemu-riscv, qemu-devel, wangran, Yu Hu
From: Huang Borong <3543977024@qq.com>
Add a CPU entry for the Xiangshan Kunminghu CPU, an open-source,
high-performance RISC-V processor. More details can be found at:
https://github.com/OpenXiangShan/XiangShan
Note: The ISA extensions supported by the Xiangshan Kunminghu CPU are
categorized based on four RISC-V specifications: Volume I: Unprivileged
Architecture, Volume II: Privileged Architecture, AIA, and RVA23. The
extensions within each category are organized according to the chapter
order in the specifications.
Signed-off-by: Yu Hu <819258943@qq.com>
Signed-off-by: Ran Wang <wangran@bosc.ac.cn>
Signed-off-by: Borong Huang <3543977024@qq.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
target/riscv/cpu-qom.h | 1 +
target/riscv/cpu.c | 64 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h
index 1ee05eb393..75f4e43408 100644
--- a/target/riscv/cpu-qom.h
+++ b/target/riscv/cpu-qom.h
@@ -55,6 +55,7 @@
#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")
#define TYPE_RISCV_CPU_TT_ASCALON RISCV_CPU_TYPE_NAME("tt-ascalon")
#define TYPE_RISCV_CPU_XIANGSHAN_NANHU RISCV_CPU_TYPE_NAME("xiangshan-nanhu")
+#define TYPE_RISCV_CPU_XIANGSHAN_KMH RISCV_CPU_TYPE_NAME("xiangshan-kunminghu")
#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host")
OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 758f254c15..c5ddd2e281 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -3206,6 +3206,70 @@ static const TypeInfo riscv_cpu_type_infos[] = {
.cfg.max_satp_mode = VM_1_10_SV39,
),
+ DEFINE_RISCV_CPU(TYPE_RISCV_CPU_XIANGSHAN_KMH, TYPE_RISCV_VENDOR_CPU,
+ .misa_mxl_max = MXL_RV64,
+ .misa_ext = RVG | RVC | RVB | RVS | RVU | RVH | RVV,
+ .priv_spec = PRIV_VERSION_1_13_0,
+
+ /*
+ * The RISC-V Instruction Set Manual: Volume I
+ * Unprivileged Architecture
+ */
+ .cfg.ext_zicntr = true,
+ .cfg.ext_zihpm = true,
+ .cfg.ext_zihintntl = true,
+ .cfg.ext_zihintpause = true,
+ .cfg.ext_zimop = true,
+ .cfg.ext_zcmop = true,
+ .cfg.ext_zicond = true,
+ .cfg.ext_zawrs = true,
+ .cfg.ext_zacas = true,
+ .cfg.ext_zfh = true,
+ .cfg.ext_zfa = true,
+ .cfg.ext_zcb = true,
+ .cfg.ext_zbc = true,
+ .cfg.ext_zvfh = true,
+ .cfg.ext_zkn = true,
+ .cfg.ext_zks = true,
+ .cfg.ext_zkt = true,
+ .cfg.ext_zvbb = true,
+ .cfg.ext_zvkt = true,
+
+ /*
+ * The RISC-V Instruction Set Manual: Volume II
+ * Privileged Architecture
+ */
+ .cfg.ext_smstateen = true,
+ .cfg.ext_smcsrind = true,
+ .cfg.ext_sscsrind = true,
+ .cfg.ext_svnapot = true,
+ .cfg.ext_svpbmt = true,
+ .cfg.ext_svinval = true,
+ .cfg.ext_sstc = true,
+ .cfg.ext_sscofpmf = true,
+ .cfg.ext_ssdbltrp = true,
+ .cfg.ext_ssnpm = true,
+ .cfg.ext_smnpm = true,
+ .cfg.ext_smmpm = true,
+ .cfg.ext_sspm = true,
+ .cfg.ext_supm = true,
+
+ /* The RISC-V Advanced Interrupt Architecture */
+ .cfg.ext_smaia = true,
+ .cfg.ext_ssaia = true,
+
+ /* RVA23 Profiles */
+ .cfg.ext_zicbom = true,
+ .cfg.ext_zicbop = true,
+ .cfg.ext_zicboz = true,
+ .cfg.ext_svade = true,
+
+ .cfg.mmu = true,
+ .cfg.pmp = true,
+
+ .cfg.max_satp_mode = VM_1_10_SV48,
+ ),
+
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU,
.cfg.max_satp_mode = VM_1_10_SV57,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v5 1/2] target/riscv: Add BOSC's Xiangshan Kunminghu CPU
2025-06-17 7:40 [PATCH v5 1/2] target/riscv: Add BOSC's Xiangshan Kunminghu CPU Ran Wang
@ 2025-06-19 7:51 ` Nutty Liu
0 siblings, 0 replies; 2+ messages in thread
From: Nutty Liu @ 2025-06-19 7:51 UTC (permalink / raw)
To: Ran Wang, alistair23
Cc: 3543977024, palmer, alistair.francis, liwei1518, dbarboza,
zhiwei_liu, qemu-riscv, qemu-devel, Yu Hu
On 6/17/2025 3:40 PM, Ran Wang wrote:
> From: Huang Borong <3543977024@qq.com>
>
> Add a CPU entry for the Xiangshan Kunminghu CPU, an open-source,
> high-performance RISC-V processor. More details can be found at:
> https://github.com/OpenXiangShan/XiangShan
>
> Note: The ISA extensions supported by the Xiangshan Kunminghu CPU are
> categorized based on four RISC-V specifications: Volume I: Unprivileged
> Architecture, Volume II: Privileged Architecture, AIA, and RVA23. The
> extensions within each category are organized according to the chapter
> order in the specifications.
>
> Signed-off-by: Yu Hu <819258943@qq.com>
> Signed-off-by: Ran Wang <wangran@bosc.ac.cn>
> Signed-off-by: Borong Huang <3543977024@qq.com>
> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/cpu-qom.h | 1 +
> target/riscv/cpu.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 65 insertions(+)
>
> diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h
> index 1ee05eb393..75f4e43408 100644
> --- a/target/riscv/cpu-qom.h
> +++ b/target/riscv/cpu-qom.h
> @@ -55,6 +55,7 @@
> #define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")
> #define TYPE_RISCV_CPU_TT_ASCALON RISCV_CPU_TYPE_NAME("tt-ascalon")
> #define TYPE_RISCV_CPU_XIANGSHAN_NANHU RISCV_CPU_TYPE_NAME("xiangshan-nanhu")
> +#define TYPE_RISCV_CPU_XIANGSHAN_KMH RISCV_CPU_TYPE_NAME("xiangshan-kunminghu")
> #define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host")
>
> OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 758f254c15..c5ddd2e281 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -3206,6 +3206,70 @@ static const TypeInfo riscv_cpu_type_infos[] = {
> .cfg.max_satp_mode = VM_1_10_SV39,
> ),
>
> + DEFINE_RISCV_CPU(TYPE_RISCV_CPU_XIANGSHAN_KMH, TYPE_RISCV_VENDOR_CPU,
> + .misa_mxl_max = MXL_RV64,
> + .misa_ext = RVG | RVC | RVB | RVS | RVU | RVH | RVV,
> + .priv_spec = PRIV_VERSION_1_13_0,
> +
> + /*
> + * The RISC-V Instruction Set Manual: Volume I
> + * Unprivileged Architecture
> + */
> + .cfg.ext_zicntr = true,
> + .cfg.ext_zihpm = true,
> + .cfg.ext_zihintntl = true,
> + .cfg.ext_zihintpause = true,
> + .cfg.ext_zimop = true,
> + .cfg.ext_zcmop = true,
> + .cfg.ext_zicond = true,
> + .cfg.ext_zawrs = true,
> + .cfg.ext_zacas = true,
> + .cfg.ext_zfh = true,
> + .cfg.ext_zfa = true,
> + .cfg.ext_zcb = true,
> + .cfg.ext_zbc = true,
> + .cfg.ext_zvfh = true,
> + .cfg.ext_zkn = true,
> + .cfg.ext_zks = true,
> + .cfg.ext_zkt = true,
> + .cfg.ext_zvbb = true,
> + .cfg.ext_zvkt = true,
> +
> + /*
> + * The RISC-V Instruction Set Manual: Volume II
> + * Privileged Architecture
> + */
> + .cfg.ext_smstateen = true,
> + .cfg.ext_smcsrind = true,
> + .cfg.ext_sscsrind = true,
> + .cfg.ext_svnapot = true,
> + .cfg.ext_svpbmt = true,
> + .cfg.ext_svinval = true,
> + .cfg.ext_sstc = true,
> + .cfg.ext_sscofpmf = true,
> + .cfg.ext_ssdbltrp = true,
> + .cfg.ext_ssnpm = true,
> + .cfg.ext_smnpm = true,
> + .cfg.ext_smmpm = true,
> + .cfg.ext_sspm = true,
> + .cfg.ext_supm = true,
> +
> + /* The RISC-V Advanced Interrupt Architecture */
> + .cfg.ext_smaia = true,
> + .cfg.ext_ssaia = true,
> +
> + /* RVA23 Profiles */
> + .cfg.ext_zicbom = true,
> + .cfg.ext_zicbop = true,
> + .cfg.ext_zicboz = true,
> + .cfg.ext_svade = true,
> +
> + .cfg.mmu = true,
> + .cfg.pmp = true,
> +
> + .cfg.max_satp_mode = VM_1_10_SV48,
> + ),
> +
> #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU,
> .cfg.max_satp_mode = VM_1_10_SV57,
Reviewed-by: Nutty Liu<liujingqi@lanxincomputing.com>
Thanks,
Nutty
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-19 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 7:40 [PATCH v5 1/2] target/riscv: Add BOSC's Xiangshan Kunminghu CPU Ran Wang
2025-06-19 7:51 ` Nutty Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).