[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RESEND 1/6] target/riscv: Introduce extension implied rules defin
From: |
frank . chang |
Subject: |
[PATCH RESEND 1/6] target/riscv: Introduce extension implied rules definition |
Date: |
Wed, 5 Jun 2024 14:31:49 +0800 |
From: Frank Chang <frank.chang@sifive.com>
RISCVCPUImpliedExtsRule is created to store the implied rules.
'is_misa' flag is used to distinguish whether the rule is derived
from the MISA or other extensions.
'ext' stores the MISA bit if 'is_misa' is true. Otherwise, it stores
the offset of the extension defined in RISCVCPUConfig. 'ext' will also
serve as the key of the hash tables to look up the rule in the following
commit.
Signed-off-by: Frank Chang <frank.chang@sifive.com>
---
target/riscv/cpu.c | 8 ++++++++
target/riscv/cpu.h | 18 ++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index cee6fc4a9a..c7e5cec7ef 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -2242,6 +2242,14 @@ RISCVCPUProfile *riscv_profiles[] = {
NULL,
};
+RISCVCPUImpliedExtsRule *riscv_misa_implied_rules[] = {
+ NULL
+};
+
+RISCVCPUImpliedExtsRule *riscv_ext_implied_rules[] = {
+ NULL
+};
+
static Property riscv_cpu_properties[] = {
DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 1501868008..b5a036cf27 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -122,6 +122,24 @@ typedef enum {
EXT_STATUS_DIRTY,
} RISCVExtStatus;
+typedef struct riscv_cpu_implied_exts_rule RISCVCPUImpliedExtsRule;
+
+struct riscv_cpu_implied_exts_rule {
+ /* Bitmask indicates the rule enabled status for the harts. */
+ uint64_t enabled;
+ /* True if this is a MISA implied rule. */
+ bool is_misa;
+ /* ext is MISA bit if is_misa flag is true, else extension offset. */
+ const uint32_t ext;
+ const uint32_t implied_misas;
+ const uint32_t implied_exts[];
+};
+
+extern RISCVCPUImpliedExtsRule *riscv_misa_implied_rules[];
+extern RISCVCPUImpliedExtsRule *riscv_ext_implied_rules[];
+
+#define RISCV_IMPLIED_EXTS_RULE_END -1
+
#define MMU_USER_IDX 3
#define MAX_RISCV_PMPS (16)
--
2.43.2
- [PATCH RESEND 0/6] Introduce extension implied rules, frank . chang, 2024/06/05
- [PATCH RESEND 1/6] target/riscv: Introduce extension implied rules definition,
frank . chang <=
- [PATCH RESEND 3/6] target/riscv: Add MISA implied rules, frank . chang, 2024/06/05
- [PATCH RESEND 2/6] target/riscv: Introduce extension implied rule helpers, frank . chang, 2024/06/05
- [PATCH RESEND 4/6] target/riscv: Add standard extension implied rules, frank . chang, 2024/06/05
- [PATCH RESEND 5/6] target/riscv: Add Zc extension implied rule, frank . chang, 2024/06/05
- [PATCH RESEND 6/6] target/riscv: Remove extension auto-update check statements, frank . chang, 2024/06/05