target/riscv: implement RVA22S64 profile
v2 cover target/riscv: implement RVA22S64 profile
Based-on: [email protected]
("[PATCH for-9.0 v12 00/18] riscv: rv64i/rva22u64 CPUs, RVA22U64 profile support")
Hi,
In this second version the most notable change is a new patch where we added a 'parent' field in the profile description. This feature was suggested by Drew in the v1 review.
RVA22S64 is then declared as having RVA22U64 as parent, plus any other extensions, named features and other contraints that are specific to RVA22S64.
Another notable change is the removal of riscv_cpu_validate_svade(). The helper (a single assignment) is now open-coded in riscv_cpu_update_named_features().
Series based on top of:
"[PATCH for-9.0 v12 00/18] riscv: rv64i/rva22u64 CPUs, RVA22U64 profile support"
Patches missing acks: 2, 6, 7
Changes from v1:
- patch 1:
- removed riscv_cpu_validate_svade()
- patch 2:
- add RISCV_PROFILE_ATTR_UNUSED check when validating priv_spec
- patch 5:
- removed stray blank line
- patch 6 (new):
- add 'parent' in profile description
- patch 7:
- declare RVA22U64 as parent of RVA22S64
- v1 link: https://lore.kernel.org/qemu-riscv/[email protected]/
Daniel Henrique Barboza (8):
target/riscv: implement svade target/riscv: add priv ver restriction to profiles target/riscv/cpu.c: finalize satp_mode earlier target/riscv/cpu.c: add riscv_cpu_is_32bit() target/riscv: add satp_mode profile support target/riscv: add 'parent' in profile description target/riscv: add RVA22S64 profile target/riscv: add rva22s64 cpu
target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 67 ++++++++++++++++++++++++---- target/riscv/cpu.h | 5 +++ target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 90 +++++++++++++++++++++++++++++++++++++- 5 files changed, 154 insertions(+), 10 deletions(-)
Signature · 1 line
2.41.0
PATCH v2 1/8 target/riscv: implement svade
'svade' is a RVA22S64 profile requirement, a profile we're going to add shortly. It is a named feature (i.e. not a formal extension, not defined in riscv,isa DT at this moment) defined in [1] as:
"Page-fault exceptions are raised when a page is accessed when A bit is clear, or written when D bit is clear.".
As far as the spec goes, 'svade' is one of the two distinct modes of handling PTE_A and PTE_D. The other way, i.e. update PTE_A/PTE_D when they're cleared, is defined by the 'svadu' extension. Checking cpu_helper.c, get_physical_address(), we can verify that QEMU is compliant with that: we will update PTE_A/PTE_D if 'svadu' is enabled, or throw a page-fault exception if 'svadu' isn't enabled.
So, as far as we're concerned, 'svade' translates to 'svadu must be disabled'.
We'll implement it like 'zic64b': an internal flag that profiles can enable. The flag will not be exposed to users.
[1] https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc
--- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 5 +++++ 3 files changed, 7 insertions(+)
target/riscv/cpu.c +1 -0
@@ -1445,6 +1445,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = { };const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = { +MULTI_EXT_CFG_BOOL ("svade" , svade, true),MULTI_EXT_CFG_BOOL ("zic64b" , zic64b, true),DEFINE_PROP_END_OF_LIST (),
target/riscv/cpu_cfg.h +1 -0
@@ -116,6 +116,7 @@ struct RISCVCPUConfig {bool ext_smepmp;bool rvv_ta_all_1s;bool rvv_ma_all_1s; +bool svade;bool zic64b;uint32_t mvendorid;
target/riscv/tcg/tcg-cpu.c +5 -0
@@ -188,6 +188,9 @@ static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, uint32_t feat_offset) cpu->cfg.cbop_blocksize =64 ; cpu->cfg.cboz_blocksize =64 ;break ; +case CPU_CFG_OFFSET (svade): + cpu->cfg.ext_svadu = false; +break ;default :g_assert_not_reached (); }
@@ -381,6 +384,8 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu) cpu->cfg.zic64b = cpu->cfg.cbom_blocksize ==64 && cpu->cfg.cbop_blocksize ==64 && cpu->cfg.cboz_blocksize ==64 ; + + cpu->cfg.svade = !cpu->cfg.ext_svadu; }static void riscv_cpu_validate_g (RISCVCPU *cpu)
Signature · 1 line
2.41.0
PATCH v2 2/8 target/riscv: add priv ver restriction to profiles
In reply to Daniel Henrique BarbozaSome profiles, like RVA22S64, has a priv_spec requirement.
Make this requirement explicit for all profiles. We'll validate this requirement finalize() time and, in case the user chooses an incompatible priv_spec while activating a profile, a warning will be shown.
--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 2 ++ target/riscv/tcg/tcg-cpu.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+)
target/riscv/cpu.c +1 -0
@@ -1537,6 +1537,7 @@ Property riscv_cpu_options[] = {static RISCVCPUProfile RVA22U64 = { .name ="rva22u64" , .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .priv_spec =RISCV_PROFILE_ATTR_UNUSED , .ext_offsets = {CPU_CFG_OFFSET (ext_zicsr),CPU_CFG_OFFSET (ext_zihintpause),CPU_CFG_OFFSET (ext_zba),CPU_CFG_OFFSET (ext_zbb),
target/riscv/cpu.h +2 -0
@@ -81,10 +81,12 @@ typedef struct riscv_cpu_profile {uint32_t misa_ext;bool enabled;bool user_set; +int priv_spec;const int32_t ext_offsets[]; } RISCVCPUProfile;#define RISCV_PROFILE_EXT_LIST_END -1 +#define RISCV_PROFILE_ATTR_UNUSED -1extern RISCVCPUProfile *riscv_profiles[];
target/riscv/tcg/tcg-cpu.c +31 -0
@@ -74,6 +74,20 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit, } } +static const char *cpu_priv_ver_to_str (int priv_ver) +{ +switch (priv_ver) { +case PRIV_VERSION_1_10_0 : +return "v1.10.0" ; +case PRIV_VERSION_1_11_0 : +return "v1.11.0" ; +case PRIV_VERSION_1_12_0 : +return "v1.12.0" ; + } + +g_assert_not_reached (); +} +static void riscv_cpu_synchronize_from_tb (CPUState *cs,const TranslationBlock *tb) {
@@ -755,11 +769,24 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)static void riscv_cpu_validate_profile (RISCVCPU *cpu,RISCVCPUProfile *profile) { +CPURISCVState *env = &cpu->env;const char *warn_msg ="Profile %s mandates disabled extension %s" ;bool send_warn = profile->user_set && profile->enabled;bool profile_impl = true;int i; +if (profile->priv_spec !=RISCV_PROFILE_ATTR_UNUSED && + profile->priv_spec != env->priv_ver) { + profile_impl = false; + +if (send_warn) { +warn_report ("Profile %s requires priv spec %s, " +"but priv ver %s was set" , profile->name, +cpu_priv_ver_to_str (profile->priv_spec), +cpu_priv_ver_to_str (env->priv_ver)); + } + } +for (i =0 ; misa_bits[i] !=0 ; i++) {uint32_t bit = misa_bits[i];
@@ -1048,6 +1075,10 @@ static void cpu_set_profile(Object *obj, Visitor *v, const char *name, profile->user_set = true; profile->enabled = value; +if (profile->enabled) { + cpu->env.priv_ver = profile->priv_spec; + } +for (i =0 ; misa_bits[i] !=0 ; i++) {uint32_t bit = misa_bits[i];
Signature · 1 line
2.41.0
Re: [PATCH for-9.0 v2 2/8] target/riscv: add priv ver restriction to profiles
Quoted 7 lines · Daniel Henrique Barboza
Some profiles, like RVA22S64, has a
priv_specrequirement.Make this requirement explicit for all profiles. We'll validate this requirement
finalize()time and, in case the user chooses an incompatiblepriv_specwhile activating a profile, a warning will be shown.
Quoted 7 lines
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 2 ++ target/riscv/tcg/tcg-cpu.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+)
PATCH v2 3/8 target/riscv/cpu.c: finalize satp_mode earlier
In reply to Daniel Henrique BarbozaProfiles will need to validate satp_mode during their own finalize methods. This will occur inside riscv_tcg_cpu_finalize_features() for TCG. Given that satp_mode does not have any pre-req from the accelerator finalize() method, it's safe to finalize it earlier.
--- target/riscv/cpu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
target/riscv/cpu.c +8 -8
@@ -1056,6 +1056,14 @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Error **errp) {Error *local_err =NULL ; +#ifndef CONFIG_USER_ONLY +riscv_cpu_satp_mode_finalize (cpu, &local_err); +if (local_err !=NULL ) { +error_propagate (errp, local_err); +return ; + } +#endif +/* * KVM accel does not have a specialized finalize() * callback because its extensions are validated
@@ -1068,14 +1076,6 @@ void riscv_cpu_finalize_features(RISCVCPU *cpu, Error **errp)return ; } } - -#ifndef CONFIG_USER_ONLY -riscv_cpu_satp_mode_finalize (cpu, &local_err); -if (local_err !=NULL ) { -error_propagate (errp, local_err); -return ; - } -#endif }static void riscv_cpu_realize (DeviceState *dev,Error **errp)
Signature · 1 line
2.41.0
PATCH v2 4/8 target/riscv/cpu.c: add riscv_cpu_is_32bit()
In reply to Daniel Henrique BarbozaNext patch will need to retrieve if a given RISCVCPU is 32 or 64 bit. The existing helper riscv_is_32bit() (hw/riscv/boot.c) will always check the first CPU of a given hart array, not any given CPU.
Create a helper to retrieve the info for any given CPU, not the first CPU of the hart array. The helper is using the same 32 bit check that riscv_cpu_satp_mode_finalize() was doing.
--- target/riscv/cpu.c | 7 ++++++- target/riscv/cpu.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
target/riscv/cpu.c +6 -1
@@ -53,6 +53,11 @@ const uint32_t misa_bits[] = {RVI, RVE, RVM, RVA, RVF, RVD, RVV,#define BYTE (x) (x)#endif +bool riscv_cpu_is_32bit (RISCVCPU *cpu) +{ +return riscv_cpu_mxl (&cpu->env) ==MXL_RV32 ; +} +#define ISA_EXT_DATA_ENTRY (_name, _min_ver, _prop) \ {#_name, _min_ver, CPU_CFG_OFFSET(_prop)}
@@ -980,7 +985,7 @@ static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info)#ifndef CONFIG_USER_ONLY static void riscv_cpu_satp_mode_finalize (RISCVCPU *cpu,Error **errp) { -bool rv32 =riscv_cpu_mxl (&cpu->env) ==MXL_RV32 ; +bool rv32 =riscv_cpu_is_32bit (cpu);uint8_t satp_mode_map_max, satp_mode_supported_max;/* The CPU wants the OS to decide which satp mode to use */
target/riscv/cpu.h +1 -0
@@ -695,6 +695,7 @@ void cpu_get_tb_cpu_state(CPURISCVState *env, vaddr *pc, uint64_t *cs_base, uint32_t *pflags);void riscv_cpu_update_mask (CPURISCVState *env); +bool riscv_cpu_is_32bit (RISCVCPU *cpu); RISCVException riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value,
Signature · 1 line
2.41.0
Re: [PATCH for-9.0 v2 4/8] target/riscv/cpu.c: add riscv_cpu_is_32bit()
Quoted 8 lines · Daniel Henrique Barboza
Next patch will need to retrieve if a given RISCVCPU is 32 or 64 bit. The existing helper
riscv_is_32bit()(hw/riscv/boot.c) will always check the first CPU of a given hart array, not any given CPU.Create a helper to retrieve the info for any given CPU, not the first CPU of the hart array. The helper is using the same 32 bit check that
riscv_cpu_satp_mode_finalize()was doing.
Quoted 6 lines
Signed-off-by Daniel Henrique Barboza <[email protected]>Reviewed-by Andrew Jones <[email protected]>--- target/riscv/cpu.c | 7 ++++++- target/riscv/cpu.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
PATCH v2 5/8 target/riscv: add satp_mode profile support
In reply to Daniel Henrique Barboza'satp_mode' is a requirement for supervisor profiles like RVA22S64. User-mode/application profiles like RVA22U64 doesn't care.
Add 'satp_mode' to the profile description. If a profile requires it, set it during cpu_set_profile(). We'll also check it during finalize() to validate if the running config implements the profile.
--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+)
target/riscv/cpu.c +1 -0
@@ -1543,6 +1543,7 @@ static RISCVCPUProfile RVA22U64 = { .name = "rva22u64", .misa_ext = RVI | RVM | RVA | RVF | RVD | RVC | RVU, .priv_spec = RISCV_PROFILE_ATTR_UNUSED, + .satp_mode = RISCV_PROFILE_ATTR_UNUSED, .ext_offsets = {CPU_CFG_OFFSET (ext_zicsr),CPU_CFG_OFFSET (ext_zihintpause), CPU_CFG_OFFSET(ext_zba), CPU_CFG_OFFSET(ext_zbb),
target/riscv/cpu.h +1 -0
@@ -82,6 +82,7 @@ typedef struct riscv_cpu_profile {bool enabled;bool user_set;int priv_spec; +int satp_mode;const int32_t ext_offsets[]; } RISCVCPUProfile;
target/riscv/tcg/tcg-cpu.c +40 -0
@@ -766,6 +766,31 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)riscv_cpu_disable_priv_spec_isa_exts (cpu); } +#ifndef CONFIG_USER_ONLY +static bool riscv_cpu_validate_profile_satp (RISCVCPU *cpu, +RISCVCPUProfile *profile, +bool send_warn) +{ +int satp_max =satp_mode_max_from_map (cpu->cfg.satp_mode.supported); + +if (profile->satp_mode > satp_max) { +if (send_warn) { +bool is_32bit =riscv_cpu_is_32bit (cpu); +const char *req_satp =satp_mode_str (profile->satp_mode, is_32bit); +const char *cur_satp =satp_mode_str (satp_max, is_32bit); + +warn_report ("Profile %s requires satp mode %s, " +"but satp mode %s was set" , profile->name, + req_satp, cur_satp); + } + +return false; + } + +return true; +} +#endif +static void riscv_cpu_validate_profile (RISCVCPU *cpu,RISCVCPUProfile *profile) {
@@ -775,6 +800,13 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu,bool profile_impl = true;int i; +#ifndef CONFIG_USER_ONLY +if (profile->satp_mode !=RISCV_PROFILE_ATTR_UNUSED ) { + profile_impl =riscv_cpu_validate_profile_satp (cpu, profile, + send_warn); + } +#endif +if (profile->priv_spec !=RISCV_PROFILE_ATTR_UNUSED && profile->priv_spec != env->priv_ver) { profile_impl = false;
@@ -1079,6 +1111,14 @@ static void cpu_set_profile(Object *obj, Visitor *v, const char *name, cpu->env.priv_ver = profile->priv_spec; } +#ifndef CONFIG_USER_ONLY +if (profile->satp_mode !=RISCV_PROFILE_ATTR_UNUSED ) { +const char *satp_prop =satp_mode_str (profile->satp_mode, +riscv_cpu_is_32bit (cpu)); +object_property_set_bool (obj, satp_prop, profile->enabled,NULL ); + } +#endif +for (i =0 ; misa_bits[i] !=0 ; i++) {uint32_t bit = misa_bits[i];
Signature · 1 line
2.41.0
PATCH v2 6/8 target/riscv: add 'parent' in profile description
In reply to Daniel Henrique BarbozaCertain S-mode profiles, like RVA22S64 and RVA23S64, mandate all the mandatory extensions of their respective U-mode profiles. RVA22S64 includes all mandatory extensions of RVA22U64, and the same happens with RVA23 profiles.
Add a 'parent' field to allow profiles to enable other profiles. This will allow us to describe S-mode profiles by specifying their parent U-mode profile, then adding just the S-mode specific extensions.
We're naming the field 'parent' to consider the possibility of other uses (e.g. a s-mode profile including a previous s-mode profile) in the future.
--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)
target/riscv/cpu.c +1 -0
@@ -1540,6 +1540,7 @@ Property riscv_cpu_options[] = {* having a cfg offset) at this moment. */ static RISCVCPUProfile RVA22U64 = { + .parent =NULL , .name ="rva22u64" , .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , .priv_spec =RISCV_PROFILE_ATTR_UNUSED ,
target/riscv/cpu.h +1 -0
@@ -77,6 +77,7 @@ const char *riscv_get_misa_ext_description(uint32_t bit);#define CPU_CFG_OFFSET (_prop) offsetof(struct RISCVCPUConfig, _prop) typedef struct riscv_cpu_profile { + struct riscv_cpu_profile *parent; const char *name; uint32_t misa_ext; bool enabled;
target/riscv/tcg/tcg-cpu.c +13 -1
@@ -797,7 +797,7 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu,CPURISCVState *env = &cpu->env;const char *warn_msg ="Profile %s mandates disabled extension %s" ;bool send_warn = profile->user_set && profile->enabled; -bool profile_impl = true; +bool parent_enabled, profile_impl = true;int i;#ifndef CONFIG_USER_ONLY
@@ -850,6 +850,13 @@ static void riscv_cpu_validate_profile(RISCVCPU *cpu, } profile->enabled = profile_impl; + +if (profile->parent !=NULL ) { + parent_enabled =object_property_get_bool (OBJECT (cpu), + profile->parent->name, +NULL ); + profile->enabled = profile->enabled && parent_enabled; + } }static void riscv_cpu_validate_profiles (RISCVCPU *cpu)
@@ -1107,6 +1114,11 @@ static void cpu_set_profile(Object *obj, Visitor *v, const char *name, profile->user_set = true; profile->enabled = value; +if (profile->parent !=NULL ) { +object_property_set_bool (obj, profile->parent->name, + profile->enabled,NULL ); + } +if (profile->enabled) { cpu->env.priv_ver = profile->priv_spec; }
Signature · 1 line
2.41.0
Re: [PATCH for-9.0 v2 6/8] target/riscv: add 'parent' in profile description
Quoted 13 lines · Daniel Henrique Barboza
Certain S-mode profiles, like RVA22S64 and RVA23S64, mandate all the mandatory extensions of their respective U-mode profiles. RVA22S64 includes all mandatory extensions of RVA22U64, and the same happens with RVA23 profiles.
Add a 'parent' field to allow profiles to enable other profiles. This will allow us to describe S-mode profiles by specifying their parent U-mode profile, then adding just the S-mode specific extensions.
We're naming the field 'parent' to consider the possibility of other uses (e.g. a s-mode profile including a previous s-mode profile) in the future.
Quoted 8 lines
Suggested-by Andrew Jones <[email protected]>Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)
PATCH v2 7/8 target/riscv: add RVA22S64 profile
In reply to Daniel Henrique BarbozaThe RVA22S64 profile consists of the following:
- all mandatory extensions of RVA22U64;
- priv spec v1.12.0;
- satp mode sv39;
- Ssccptr, a cache related named feature that we're assuming always enable since we don't implement a cache;
- Other named features already implemented: Sstvecd, Sstvala, Sscounterenw;
- the new Svade named feature that was recently added.
Most of the work is already done, so this patch is enough to implement the profile.
After this patch, the 'rva22s64' user flag alone can be used with the rva64i CPU to boot Linux:
-cpu rv64i,rva22s64=true
This is the /proc/cpuinfo with this profile enabled:
# cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_zihintpause_zihpm_zfhmin_zca_zcd_zba_zbb_zbs_zkt_svinval_svpbmt mmu : sv39
--- target/riscv/cpu.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
target/riscv/cpu.c +32 -0
@@ -1560,8 +1560,40 @@ static RISCVCPUProfile RVA22U64 = { } }; +/* +* As with RVA22U64, RVA22S64 also defines 'named features'. +* +* Cache related features that we consider enabled since we don't +* implement cache: Ssccptr +* +* Other named features that we already implement: Sstvecd, Sstvala, +* Sscounterenw +* +* Named features that we need to enable: svade +* +* The remaining features/extensions comes from RVA22U64. +*/ +static RISCVCPUProfile RVA22S64 = { + .parent = &RVA22U64 , + .name ="rva22s64" , + .misa_ext =RVS , + .priv_spec =PRIV_VERSION_1_12_0 , + .satp_mode =VM_1_10_SV39 , + .ext_offsets = { +/* rva22s64 exts */ +CPU_CFG_OFFSET (ext_zifencei),CPU_CFG_OFFSET (ext_svpbmt), +CPU_CFG_OFFSET (ext_svinval), + +/* rva22s64 named features */ +CPU_CFG_OFFSET (svade), + +RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , + &RVA22S64 ,NULL , };
Signature · 1 line
2.41.0
Re: [PATCH for-9.0 v2 7/8] target/riscv: add RVA22S64 profile
Quoted 27 lines · Daniel Henrique Barboza
The RVA22S64 profile consists of the following:
- all mandatory extensions of RVA22U64;
- priv spec v1.12.0;
- satp mode sv39;
- Ssccptr, a cache related named feature that we're assuming always enable since we don't implement a cache;
- Other named features already implemented: Sstvecd, Sstvala, Sscounterenw;
- the new Svade named feature that was recently added.Most of the work is already done, so this patch is enough to implement the profile.
After this patch, the 'rva22s64' user flag alone can be used with the rva64i CPU to boot Linux:
-cpu rv64i,rva22s64=true
This is the
/proc/cpuinfowith this profile enabled:# cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_zihintpause_zihpm_zfhmin_zca_zcd_zba_zbb_zbs_zkt_svinval_svpbmt mmu : sv39
Quoted 5 lines
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
PATCH v2 8/8 target/riscv: add rva22s64 cpu
In reply to Daniel Henrique BarbozaAdd a new profile CPU 'rva22s64' to work as an alias of
-cpu rv64i,rva22s64
Like the existing rva22u64 CPU already does with the RVA22U64 profile.
--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 8 ++++++++ 2 files changed, 9 insertions(+)
target/riscv/cpu-qom.h +1 -0
@@ -36,6 +36,7 @@#define TYPE_RISCV_CPU_BASE128 RISCV_CPU_TYPE_NAME("x-rv128")#define TYPE_RISCV_CPU_RV64I RISCV_CPU_TYPE_NAME("rv64i")#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64") +#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex")#define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c")#define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31")
target/riscv/cpu.c +8 -0
@@ -1624,6 +1624,13 @@ static void rva22u64_profile_cpu_init(Object *obj) RVA22U64.enabled = true; } + +static void rva22s64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA22S64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)
@@ -1968,6 +1975,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_DYNAMIC_CPU (TYPE_RISCV_CPU_BASE128 , rv128_base_cpu_init),DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64I , rv64i_bare_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 , rva22u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22S64, rva22s64_profile_cpu_init), #endif };
Signature · 1 line
2.41.0