From: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
"cfu@mips.com" <cfu@mips.com>, "mst@redhat.com" <mst@redhat.com>,
"marcel.apfelbaum@gmail.com" <marcel.apfelbaum@gmail.com>,
"dbarboza@ventanamicro.com" <dbarboza@ventanamicro.com>,
"philmd@linaro.org" <philmd@linaro.org>,
"alistair23@gmail.com" <alistair23@gmail.com>,
"thuth@redhat.com" <thuth@redhat.com>,
Djordje Todorovic <Djordje.Todorovic@htecgroup.com>
Subject: [PATCH v5 1/7] target/riscv: Add big-endian CPU property
Date: Tue, 24 Mar 2026 16:40:15 +0000 [thread overview]
Message-ID: <20260324164007.549397-2-djordje.todorovic@htecgroup.com> (raw)
In-Reply-To: <20260324164007.549397-1-djordje.todorovic@htecgroup.com>
Add a "big-endian" boolean property to the RISC-V CPU configuration,
defaulting to false (little-endian). This property allows machine
models to configure individual HARTs for big-endian data operation.
The RISC-V ISA supports big-endian data accesses via the mstatus
SBE/MBE/UBE bits, while instructions remain always little-endian.
This property provides the configuration interface; subsequent
patches will connect it to the CPU state and translation logic.
Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com>
---
target/riscv/cpu.c | 1 +
target/riscv/cpu_cfg_fields.h.inc | 1 +
2 files changed, 2 insertions(+)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index e56470a374..4537305dfe 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -2641,6 +2641,7 @@ RISCVCPUImpliedExtsRule *riscv_multi_ext_implied_rules[] = {
static const Property riscv_cpu_properties[] = {
DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
+ DEFINE_PROP_BOOL("big-endian", RISCVCPU, cfg.big_endian, false),
{.name = "pmu-mask", .info = &prop_pmu_mask},
{.name = "pmu-num", .info = &prop_pmu_num}, /* Deprecated */
diff --git a/target/riscv/cpu_cfg_fields.h.inc b/target/riscv/cpu_cfg_fields.h.inc
index 70ec650abf..51436daabf 100644
--- a/target/riscv/cpu_cfg_fields.h.inc
+++ b/target/riscv/cpu_cfg_fields.h.inc
@@ -154,6 +154,7 @@ BOOL_FIELD(ext_xmipscbop)
BOOL_FIELD(ext_xmipscmov)
BOOL_FIELD(ext_xmipslsp)
+BOOL_FIELD(big_endian)
BOOL_FIELD(mmu)
BOOL_FIELD(pmp)
BOOL_FIELD(debug)
--
2.34.1
next prev parent reply other threads:[~2026-03-24 16:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 16:40 [PATCH v5 0/7] Add RISC-V big-endian target support Djordje Todorovic
2026-03-24 16:40 ` [PATCH v5 2/7] target/riscv: Set endianness MSTATUS bits at CPU reset Djordje Todorovic
2026-03-24 16:40 ` Djordje Todorovic [this message]
2026-03-25 7:26 ` [PATCH v5 1/7] target/riscv: Add big-endian CPU property Chao Liu
2026-03-25 10:47 ` Thomas Huth
2026-03-24 16:40 ` [PATCH v5 3/7] target/riscv: Implement runtime data endianness via MSTATUS bits Djordje Todorovic
2026-03-24 16:40 ` [PATCH v5 5/7] target/riscv: Fix page table walk endianness for big-endian harts Djordje Todorovic
2026-03-24 16:40 ` [PATCH v5 4/7] hw/riscv: Make boot code endianness-aware at runtime Djordje Todorovic
2026-03-24 16:40 ` [PATCH v5 6/7] target/riscv: Support runtime endianness in virtio via sysemu callback Djordje Todorovic
2026-03-24 16:40 ` [PATCH v5 7/7] target/riscv: Add test for RISC-V BE Djordje Todorovic
2026-03-25 10:51 ` Thomas Huth
2026-03-25 3:58 ` [PATCH v5 0/7] Add RISC-V big-endian target support Chao Liu
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=20260324164007.549397-2-djordje.todorovic@htecgroup.com \
--to=djordje.todorovic@htecgroup.com \
--cc=alistair23@gmail.com \
--cc=cfu@mips.com \
--cc=dbarboza@ventanamicro.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=thuth@redhat.com \
/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