* [PATCH v2 0/1] Add vtype.vill FIELD macro definition @ 2024-12-11 15:48 Chao Liu 2024-12-11 15:48 ` [PATCH v2 1/1] target/riscv: add VILL field for vtype register " Chao Liu 0 siblings, 1 reply; 4+ messages in thread From: Chao Liu @ 2024-12-11 15:48 UTC (permalink / raw) To: bmeng.cn, liwei1518, palmer, richard.henderson, alistair.francis Cc: dbarboza, zhiwei_liu, qemu-riscv, qemu-devel, zqz00548, Chao Liu Hi, all: I improve compatibility with RV32 and RV64 by adjusting the FIELD definition of vtype.vill. PATCH v1: https://lore.kernel.org/qemu-devel/cover.1733922709.git.lc00631@tecorigin.com/T Chao Liu (1): target/riscv: add VILL field for vtype register macro definition target/riscv/cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.47.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/1] target/riscv: add VILL field for vtype register macro definition 2024-12-11 15:48 [PATCH v2 0/1] Add vtype.vill FIELD macro definition Chao Liu @ 2024-12-11 15:48 ` Chao Liu 2024-12-11 15:55 ` Richard Henderson 0 siblings, 1 reply; 4+ messages in thread From: Chao Liu @ 2024-12-11 15:48 UTC (permalink / raw) To: bmeng.cn, liwei1518, palmer, richard.henderson, alistair.francis Cc: dbarboza, zhiwei_liu, qemu-riscv, qemu-devel, zqz00548, Chao Liu Signed-off-by: Chao Liu <lc00631@tecorigin.com> --- target/riscv/cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 284b112821..0d74ee4581 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -170,7 +170,8 @@ FIELD(VTYPE, VSEW, 3, 3) FIELD(VTYPE, VTA, 6, 1) FIELD(VTYPE, VMA, 7, 1) FIELD(VTYPE, VEDIV, 8, 2) -FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 11) +FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 12) +FIELD(VTYPE, VILL, sizeof(target_ulong) * 8 - 1, 1) typedef struct PMUCTRState { /* Current value of a counter */ -- 2.47.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] target/riscv: add VILL field for vtype register macro definition 2024-12-11 15:48 ` [PATCH v2 1/1] target/riscv: add VILL field for vtype register " Chao Liu @ 2024-12-11 15:55 ` Richard Henderson 2024-12-11 16:36 ` Chao Liu 0 siblings, 1 reply; 4+ messages in thread From: Richard Henderson @ 2024-12-11 15:55 UTC (permalink / raw) To: Chao Liu, bmeng.cn, liwei1518, palmer, alistair.francis Cc: dbarboza, zhiwei_liu, qemu-riscv, qemu-devel, zqz00548 On 12/11/24 09:48, Chao Liu wrote: > Signed-off-by: Chao Liu <lc00631@tecorigin.com> > --- > target/riscv/cpu.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h > index 284b112821..0d74ee4581 100644 > --- a/target/riscv/cpu.h > +++ b/target/riscv/cpu.h > @@ -170,7 +170,8 @@ FIELD(VTYPE, VSEW, 3, 3) > FIELD(VTYPE, VTA, 6, 1) > FIELD(VTYPE, VMA, 7, 1) > FIELD(VTYPE, VEDIV, 8, 2) > -FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 11) > +FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 12) > +FIELD(VTYPE, VILL, sizeof(target_ulong) * 8 - 1, 1) Still incorrect, for the same reason. We support execution of rv32 cpus with qemu-system-riscv64, where sizeof(target_ulong) is always 8. We support SXL/UXL, which changes the behaviour at runtime. And, really, why do you want to add a define that is never used? r~ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] target/riscv: add VILL field for vtype register macro definition 2024-12-11 15:55 ` Richard Henderson @ 2024-12-11 16:36 ` Chao Liu 0 siblings, 0 replies; 4+ messages in thread From: Chao Liu @ 2024-12-11 16:36 UTC (permalink / raw) To: Richard Henderson, bmeng.cn, liwei1518, palmer, alistair.francis Cc: dbarboza, zhiwei_liu, qemu-riscv, qemu-devel, zqz00548 On 2024/12/11 23:55, Richard Henderson wrote: > On 12/11/24 09:48, Chao Liu wrote: >> Signed-off-by: Chao Liu <lc00631@tecorigin.com> >> --- >> target/riscv/cpu.h | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h >> index 284b112821..0d74ee4581 100644 >> --- a/target/riscv/cpu.h >> +++ b/target/riscv/cpu.h >> @@ -170,7 +170,8 @@ FIELD(VTYPE, VSEW, 3, 3) >> FIELD(VTYPE, VTA, 6, 1) >> FIELD(VTYPE, VMA, 7, 1) >> FIELD(VTYPE, VEDIV, 8, 2) >> -FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 11) >> +FIELD(VTYPE, RESERVED, 10, sizeof(target_ulong) * 8 - 12) >> +FIELD(VTYPE, VILL, sizeof(target_ulong) * 8 - 1, 1) > > Still incorrect, for the same reason. > > We support execution of rv32 cpus with qemu-system-riscv64, where > sizeof(target_ulong) is always 8. We support SXL/UXL, which changes > the behaviour at runtime. > > And, really, why do you want to add a define that is never used? > > > r~ Thank you for your reply, I have understood it now. Initially, by reading the RISC-V architecture manual and the QEMU source code, I noticed that the definition of vtype.vill was missing. After your explanation, I reviewed the source code again and found that QEMU defines the vill field within the CPURISCVState. According to MXL_RV64 and MXL_RV32, when reading vtype, vill is incorporated into it. Therefore, there is no need to add this definition, as it is not actually being used. However, I still have one question: since the goal is to enable qemu-system-riscv64 to support RV32, it seems somewhat unreasonable to have vtype.RESERVED fixed at "sizeof(target_ulong) * 8 - 12" and let the compiler calculate its bit width. The vtype.RESERVED field is [11:62] under RV64 and [11:30] under RV32. Currently, it is used in the following context: //target/riscv/vector_helper.c:34 target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1, target_ulong s2) { ... target_ulong reserved = s2 & MAKE_64BIT_MASK(R_VTYPE_RESERVED_SHIFT, xlen - 1 - R_VTYPE_RESERVED_SHIFT); ... Regards, Chao ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-11 16:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-12-11 15:48 [PATCH v2 0/1] Add vtype.vill FIELD macro definition Chao Liu 2024-12-11 15:48 ` [PATCH v2 1/1] target/riscv: add VILL field for vtype register " Chao Liu 2024-12-11 15:55 ` Richard Henderson 2024-12-11 16:36 ` Chao Liu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.