From: Alistair Francis <alistair23@gmail.com>
To: qemu-devel@nongnu.org
Cc: alistair23@gmail.com, Jason Chien <jason.chien@sifive.com>,
Frank Chang <frank.chang@sifive.com>,
Alistair Francis <alistair.francis@wdc.com>
Subject: [PULL v3 01/35] target/riscv: Add a property to set vl to ceil(AVL/2)
Date: Wed, 2 Oct 2024 15:50:14 +1000 [thread overview]
Message-ID: <20241002055048.556083-2-alistair.francis@wdc.com> (raw)
In-Reply-To: <20241002055048.556083-1-alistair.francis@wdc.com>
From: Jason Chien <jason.chien@sifive.com>
RVV spec allows implementations to set vl with values within
[ceil(AVL/2),VLMAX] when VLMAX < AVL < 2*VLMAX. This commit adds a
property "rvv_vl_half_avl" to enable setting vl = ceil(AVL/2). This
behavior helps identify compiler issues and bugs.
Signed-off-by: Jason Chien <jason.chien@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Message-ID: <20240722175004.23666-1-jason.chien@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/cpu_cfg.h | 1 +
target/riscv/cpu.c | 1 +
target/riscv/vector_helper.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
index 8b272fb826..96fe26d4ea 100644
--- a/target/riscv/cpu_cfg.h
+++ b/target/riscv/cpu_cfg.h
@@ -127,6 +127,7 @@ struct RISCVCPUConfig {
bool ext_smepmp;
bool rvv_ta_all_1s;
bool rvv_ma_all_1s;
+ bool rvv_vl_half_avl;
uint32_t mvendorid;
uint64_t marchid;
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 4bda754b01..cc5552500a 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -2661,6 +2661,7 @@ static Property riscv_cpu_properties[] = {
DEFINE_PROP_BOOL("rvv_ta_all_1s", RISCVCPU, cfg.rvv_ta_all_1s, false),
DEFINE_PROP_BOOL("rvv_ma_all_1s", RISCVCPU, cfg.rvv_ma_all_1s, false),
+ DEFINE_PROP_BOOL("rvv_vl_half_avl", RISCVCPU, cfg.rvv_vl_half_avl, false),
/*
* write_misa() is marked as experimental for now so mark
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 10a52ceb5b..072bd444b1 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -75,6 +75,8 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,
vlmax = vext_get_vlmax(cpu->cfg.vlenb, vsew, lmul);
if (s1 <= vlmax) {
vl = s1;
+ } else if (s1 < 2 * vlmax && cpu->cfg.rvv_vl_half_avl) {
+ vl = (s1 + 1) >> 1;
} else {
vl = vlmax;
}
--
2.46.2
next prev parent reply other threads:[~2024-10-02 5:51 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 5:50 [PULL v3 00/35] riscv-to-apply queue Alistair Francis
2024-10-02 5:50 ` Alistair Francis [this message]
2024-10-02 5:50 ` [PULL v3 02/35] tests/acpi: Add empty ACPI SRAT data file for RISC-V Alistair Francis
2024-10-02 5:50 ` [PULL v3 03/35] tests/qtest/bios-tables-test.c: Enable numamem testing " Alistair Francis
2024-10-02 5:50 ` [PULL v3 04/35] tests/acpi: Add expected ACPI SRAT AML file " Alistair Francis
2024-10-02 5:50 ` [PULL v3 05/35] target/riscv/tcg/tcg-cpu.c: consider MISA bit choice in implied rule Alistair Francis
2024-10-02 5:50 ` [PULL v3 06/35] target/riscv: fix za64rs enabling Alistair Francis
2024-10-02 5:50 ` [PULL v3 07/35] target: riscv: Enable Bit Manip for OpenTitan Ibex CPU Alistair Francis
2024-10-02 5:50 ` [PULL v3 08/35] target/riscv/kvm: Fix the group bit setting of AIA Alistair Francis
2024-10-02 5:50 ` [PULL v3 09/35] target/riscv: Stop timer with infinite timecmp Alistair Francis
2024-10-02 5:50 ` [PULL v3 10/35] target/riscv/cpu.c: Add 'fcsr' register to QEMU log as a part of F extension Alistair Francis
2024-10-02 5:50 ` [PULL v3 11/35] util/util/cpuinfo-riscv.c: fix riscv64 build on musl libc Alistair Francis
2024-10-02 5:50 ` [PULL v3 12/35] target/riscv: Preliminary textra trigger CSR writting support Alistair Francis
2024-10-02 5:50 ` [PULL v3 13/35] target/riscv: Add textra matching condition for the triggers Alistair Francis
2024-10-02 5:50 ` [PULL v3 14/35] hw/riscv: Respect firmware ELF entry point Alistair Francis
2024-10-02 5:50 ` [PULL v3 15/35] target: riscv: Add Svvptc extension support Alistair Francis
2024-10-02 5:50 ` [PULL v3 16/35] target/riscv32: Fix masking of physical address Alistair Francis
2024-10-02 5:50 ` [PULL v3 17/35] target/riscv/cpu_helper: Fix linking problem with semihosting disabled Alistair Francis
2024-10-02 5:50 ` [PULL v3 18/35] hw/intc: riscv-imsic: Fix interrupt state updates Alistair Francis
2024-10-02 5:50 ` [PULL v3 19/35] bsd-user: Implement RISC-V CPU initialization and main loop Alistair Francis
2024-10-02 5:50 ` [PULL v3 20/35] bsd-user: Add RISC-V CPU execution loop and syscall handling Alistair Francis
2024-10-02 5:50 ` [PULL v3 21/35] bsd-user: Implement RISC-V CPU register cloning and reset functions Alistair Francis
2024-10-02 5:50 ` [PULL v3 22/35] bsd-user: Implement RISC-V TLS register setup Alistair Francis
2024-10-02 5:50 ` [PULL v3 23/35] bsd-user: Add RISC-V ELF definitions and hardware capability detection Alistair Francis
2024-10-02 5:50 ` [PULL v3 24/35] bsd-user: Define RISC-V register structures and register copying Alistair Francis
2024-10-02 5:50 ` [PULL v3 25/35] bsd-user: Add RISC-V signal trampoline setup function Alistair Francis
2024-10-02 5:50 ` [PULL v3 26/35] bsd-user: Implement RISC-V sysarch system call emulation Alistair Francis
2024-10-02 5:50 ` [PULL v3 27/35] bsd-user: Add RISC-V thread setup and initialization support Alistair Francis
2024-10-02 5:50 ` [PULL v3 28/35] bsd-user: Define RISC-V VM parameters and helper functions Alistair Francis
2024-10-02 5:50 ` [PULL v3 29/35] bsd-user: Define RISC-V system call structures and constants Alistair Francis
2024-10-02 5:50 ` [PULL v3 30/35] bsd-user: Add generic RISC-V64 target definitions Alistair Francis
2024-10-02 5:50 ` [PULL v3 31/35] bsd-user: Define RISC-V signal handling structures and constants Alistair Francis
2024-10-02 5:50 ` [PULL v3 32/35] bsd-user: Implement RISC-V signal trampoline setup functions Alistair Francis
2024-10-02 5:50 ` [PULL v3 33/35] bsd-user: Implement 'get_mcontext' for RISC-V Alistair Francis
2024-10-02 5:50 ` [PULL v3 34/35] bsd-user: Implement set_mcontext and get_ucontext_sigreturn for RISCV Alistair Francis
2024-10-02 5:50 ` [PULL v3 35/35] bsd-user: Add RISC-V 64-bit Target Configuration and Debug XML Files Alistair Francis
2024-10-03 9:32 ` [PULL v3 00/35] riscv-to-apply queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241002055048.556083-2-alistair.francis@wdc.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=frank.chang@sifive.com \
--cc=jason.chien@sifive.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).