target/riscv: RVA23 profile support
cover target/riscv: RVA23 profile support
Hi,
After adding 'supm' and 'sspm' we're finally ready to add official RVA23 support after adding a couple of trivial pieces:
- add ssu64xl, another 'named feature' for something that we already implement in TCG;
- declare RVB in RVA22U64. This is more a cosmetic change to make it straightforward to implement RVA23U64 as a child of RVA22.
Adding RVA23U and RVA23S is done in the same model as we did with RVA22 profiles, including a CPU for each of them for easier consumption.
Patches based on alistair/riscv-to-apply.next.
Daniel Henrique Barboza (4):
target/riscv: add ssu64xl
target/riscv: use RVB in RVA22U64
target/riscv: add RVA23U64 profile
target/riscv: add RVA23S64 profile
target/riscv/cpu-qom.h | 2 + target/riscv/cpu.c | 83 ++++++++++++++++++++++++++++-- tests/data/acpi/riscv64/virt/RHCT | Bin 390 -> 400 bytes 3 files changed, 82 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.1
PATCH 1/4 target/riscv: add ssu64xl
ssu64xl is defined in RVA22 as:
"sstatus.UXL must be capable of holding the value 2 (i.e., UXLEN=64 must be supported)."
This is always true in TCG and it's mandatory for RVA23, so claim support for it.
--- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 390 -> 398 bytes 2 files changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
@@ -213,6 +213,7 @@ const RISCVIsaExtData isa_edata_arr[] = {ISA_EXT_DATA_ENTRY (sstc,PRIV_VERSION_1_12_0 , ext_sstc),ISA_EXT_DATA_ENTRY (sstvala,PRIV_VERSION_1_12_0 , has_priv_1_12),ISA_EXT_DATA_ENTRY (sstvecd,PRIV_VERSION_1_12_0 , has_priv_1_12), +ISA_EXT_DATA_ENTRY (ssu64xl,PRIV_VERSION_1_12_0 , has_priv_1_12),ISA_EXT_DATA_ENTRY (supm,PRIV_VERSION_1_13_0 , ext_supm),ISA_EXT_DATA_ENTRY (svade,PRIV_VERSION_1_11_0 , ext_svade), ISA_EXT_DATA_ENTRY(svadu, PRIV_VERSION_1_12_0, ext_svadu),
tests/data/acpi/riscv64/virt/RHCT binary +0 -0
Signature · 1 line
2.47.1
PATCH 2/4 target/riscv: use RVB in RVA22U64
In reply to Daniel Henrique BarbozaFrom the time we added RVA22U64 until now the spec didn't declare 'RVB' as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec
[1] added the following in the 'RVA22U64 Mandatory Extensions' section:
"B Bit-manipulation instructions
Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent."
It is also equivalent to QEMU (see riscv_cpu_validate_b() in target/riscv/tcg/tcg-cpu.c).
Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs.
To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from 'ext_offsets' and make it a bit shorter.
(bios-tables-test change: zba/zbb/zbs no longer on riscv,isa)
[1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile
[2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profile
--- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-)
target/riscv/cpu.c +2 -3
@@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = {static RISCVCPUProfile RVA22U64 = { .parent =NULL , .name ="rva22u64" , - .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVB |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), -CPU_CFG_OFFSET (ext_zbs),CPU_CFG_OFFSET (ext_zfhmin), +CPU_CFG_OFFSET (ext_zfhmin),CPU_CFG_OFFSET (ext_zkt),CPU_CFG_OFFSET (ext_zicntr),CPU_CFG_OFFSET (ext_zihpm),CPU_CFG_OFFSET (ext_zicbom),CPU_CFG_OFFSET (ext_zicbop),CPU_CFG_OFFSET (ext_zicboz),
tests/data/acpi/riscv64/virt/RHCT binary +0 -0
Signature · 1 line
2.47.1
Re: [PATCH 2/4] target/riscv: use RVB in RVA22U64
Quoted 14 lines · Daniel Henrique Barboza
From the time we added RVA22U64 until now the spec didn't declare 'RVB' as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec
[1] added the following in the 'RVA22U64 Mandatory Extensions' section:"B Bit-manipulation instructions
Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent."
It is also equivalent to QEMU (see
riscv_cpu_validate_b()intarget/riscv/tcg/tcg-cpu.c).
Quoted 8 lines
Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs.
To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from '
ext_offsets' and make it a bit shorter.(bios-tables-test change: zba/zbb/zbs no longer on riscv,isa)
We should still have zba/zbb/zbs on the ISA string. I don't think Linux yet supports expanding a 'B' bundle into them and other SW may also have not really cared about 'B' being designed to represent preexisting extensions after having already learned how to detect those extensions.
Anyway, what keeps them from being added? I don't see QEMU code for that. I do expect a bios tables change though, since the ISA string should now have 'B' added to it.
Thanks,
drew
Quoted 45 lines
[1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile
[2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profileSigned-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-)target/riscv/cpu.c +2
-3@@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = {static RISCVCPUProfile RVA22U64 = { .parent =NULL , .name ="rva22u64" , - .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVB |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), -CPU_CFG_OFFSET (ext_zbs),CPU_CFG_OFFSET (ext_zfhmin), +CPU_CFG_OFFSET (ext_zfhmin),CPU_CFG_OFFSET (ext_zkt),CPU_CFG_OFFSET (ext_zicntr),CPU_CFG_OFFSET (ext_zihpm),CPU_CFG_OFFSET (ext_zicbom),CPU_CFG_OFFSET (ext_zicbop),CPU_CFG_OFFSET (ext_zicboz),tests/data/acpi/riscv64/virt/RHCT binary +0
-0Signature · 2 lines
-- 2.47.1
Re: [PATCH 2/4] target/riscv: use RVB in RVA22U64
Quoted 22 lines · Andrew Jones
Quoted 21 lines · Daniel Henrique Barboza
From the time we added RVA22U64 until now the spec didn't declare 'RVB'
as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec
[1] added the following in the 'RVA22U64 Mandatory Extensions' section:"B Bit-manipulation instructions
Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent."
It is also equivalent to QEMU (see
riscv_cpu_validate_b()intarget/riscv/tcg/tcg-cpu.c).Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs.
To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from '
ext_offsets' and make it a bit shorter.
Quoted 7 lines
Quoted 1 line
(bios-tables-test change: zba/zbb/zbs no longer on riscv,isa)
We should still have zba/zbb/zbs on the ISA string. I don't think Linux yet supports expanding a 'B' bundle into them and other SW may also have not really cared about 'B' being designed to represent preexisting extensions after having already learned how to detect those extensions.
This has to do with how bios-tables-test works. The test doesn't boot the CPU up to realize() and finalize() and, with this change, we ended up removing zba/zbb/zbs from it because we won't reach riscv_cpu_validate_b() to add them back.
I guess that in the end, aside from having a smaller ext list, there's not much to gain from removing zba/zbb/zbs from the profile definition. We can just add RVB and keep them.
Thanks,
Daniel
Quoted 53 lines
Anyway, what keeps them from being added? I don't see QEMU code for that. I do expect a bios tables change though, since the ISA string should now have 'B' added to it.
Thanks,
drewQuoted 45 lines
[1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile
[2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profileSigned-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-)target/riscv/cpu.c +2
-3@@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = {static RISCVCPUProfile RVA22U64 = { .parent =NULL , .name ="rva22u64" , - .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVB |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), -CPU_CFG_OFFSET (ext_zbs),CPU_CFG_OFFSET (ext_zfhmin), +CPU_CFG_OFFSET (ext_zfhmin),CPU_CFG_OFFSET (ext_zkt),CPU_CFG_OFFSET (ext_zicntr),CPU_CFG_OFFSET (ext_zihpm),CPU_CFG_OFFSET (ext_zicbom),CPU_CFG_OFFSET (ext_zicbop),CPU_CFG_OFFSET (ext_zicboz),tests/data/acpi/riscv64/virt/RHCT binary +0
-0Signature · 2 lines
-- 2.47.1
Re: [PATCH 2/4] target/riscv: use RVB in RVA22U64
Quoted 33 lines · Daniel Henrique Barboza
Quoted 22 lines · Andrew Jones
Quoted 21 lines · Daniel Henrique Barboza
From the time we added RVA22U64 until now the spec didn't declare 'RVB'
as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec
[1] added the following in the 'RVA22U64 Mandatory Extensions' section:"B Bit-manipulation instructions
Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent."
It is also equivalent to QEMU (see
riscv_cpu_validate_b()intarget/riscv/tcg/tcg-cpu.c).Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs.
To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from '
ext_offsets' and make it a bit shorter.Quoted 7 lines
Quoted 1 line
(bios-tables-test change: zba/zbb/zbs no longer on riscv,isa)
We should still have zba/zbb/zbs on the ISA string. I don't think Linux yet supports expanding a 'B' bundle into them and other SW may also have not really cared about 'B' being designed to represent preexisting extensions after having already learned how to detect those extensions.
Quoted 4 lines
This has to do with how bios-tables-test works. The test doesn't boot the CPU up to
realize()andfinalize()and, with this change, we ended up removing zba/zbb/zbs from it because we won't reachriscv_cpu_validate_b()to add them back.
If we can't do a riscv_cpu_finalize_features() (and/or whatever else we need to do) to ensure we have a complete ISA string, then I think we should modify the test to somehow never check the ISA string entry of the RHCT table.
Quoted 4 lines
I guess that in the end, aside from having a smaller ext list, there's not much to gain from removing zba/zbb/zbs from the profile definition. We can just add RVB and keep them.
While it doesn't really matter if we add them or not, I still think the test should be modified such that we don't have to try to out-smart it with profile and cpu definitions. Getting it to work would be best, but getting it to ignore is also good since we wouldn't need to bother modifying it every time we touch a cpu config.
Thanks,
drew
Quoted 60 lines
Thanks,
Daniel
Quoted 53 lines
Anyway, what keeps them from being added? I don't see QEMU code for that. I do expect a bios tables change though, since the ISA string should now have 'B' added to it.
Thanks,
drewQuoted 45 lines
[1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile
[2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profileSigned-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-)target/riscv/cpu.c +2
-3@@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = {static RISCVCPUProfile RVA22U64 = { .parent =NULL , .name ="rva22u64" , - .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVB |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), -CPU_CFG_OFFSET (ext_zbs),CPU_CFG_OFFSET (ext_zfhmin), +CPU_CFG_OFFSET (ext_zfhmin),CPU_CFG_OFFSET (ext_zkt),CPU_CFG_OFFSET (ext_zicntr),CPU_CFG_OFFSET (ext_zihpm),CPU_CFG_OFFSET (ext_zicbom),CPU_CFG_OFFSET (ext_zicbop),CPU_CFG_OFFSET (ext_zicboz),tests/data/acpi/riscv64/virt/RHCT binary +0
-0Signature · 2 lines
-- 2.47.1
Re: [PATCH 2/4] target/riscv: use RVB in RVA22U64
Quoted 49 lines · Andrew Jones
Quoted 33 lines · Daniel Henrique Barboza
Quoted 22 lines · Andrew Jones
Quoted 21 lines · Daniel Henrique Barboza
From the time we added RVA22U64 until now the spec didn't declare 'RVB'
as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec
[1] added the following in the 'RVA22U64 Mandatory Extensions' section:"B Bit-manipulation instructions
Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent."
It is also equivalent to QEMU (see
riscv_cpu_validate_b()intarget/riscv/tcg/tcg-cpu.c).Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs.
To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from '
ext_offsets' and make it a bit shorter.Quoted 7 lines
Quoted 1 line
(bios-tables-test change: zba/zbb/zbs no longer on riscv,isa)
We should still have zba/zbb/zbs on the ISA string. I don't think Linux yet supports expanding a 'B' bundle into them and other SW may also have not really cared about 'B' being designed to represent preexisting extensions after having already learned how to detect those extensions.
Quoted 4 lines
This has to do with how bios-tables-test works. The test doesn't boot the CPU up to
realize()andfinalize()and, with this change, we ended up removing zba/zbb/zbs from it because we won't reachriscv_cpu_validate_b()to add them back.If we can't do a
riscv_cpu_finalize_features()(and/or whatever else we need to do) to ensure we have a complete ISA string, then I think we should modify the test to somehow never check the ISA string entry of the RHCT table.Quoted 4 lines
I guess that in the end, aside from having a smaller ext list, there's not much to gain from removing zba/zbb/zbs from the profile definition. We can just add RVB and keep them.
Quoted 5 lines
While it doesn't really matter if we add them or not, I still think the test should be modified such that we don't have to try to out-smart it with profile and cpu definitions. Getting it to work would be best, but getting it to ignore is also good since we wouldn't need to bother modifying it every time we touch a cpu config.
In theory the test is using rva22 cpus on purpose to try to minimize this kind of thing. Back then we were worried that the changes in rv64 CPU would trigger too much test changes. In practice every time we add some new riscv,isa DT entry, due to an innate QEMU feature that we're now advertising and whatnot, this test will break.
One thing that crossed my mind but I didn't get to implement it is to provide a static riscv,isa based on accelerator, e.g. if we're running '-accel qtest' then we would always return the same riscv,isa regardless of the changes made in the common emulation. I'm not sure the implications of doing that but it's something that I think it's worth exploring. Otherwise we'll have to keep updating this ACPI bios table test from time to time.
Thanks,
Daniel
Quoted 64 lines
Thanks,
drewQuoted 60 lines
Thanks,
Daniel
Quoted 53 lines
Anyway, what keeps them from being added? I don't see QEMU code for that. I do expect a bios tables change though, since the ISA string should now have 'B' added to it.
Thanks,
drewQuoted 45 lines
[1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile
[2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profileSigned-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-)target/riscv/cpu.c +2
-3@@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = {static RISCVCPUProfile RVA22U64 = { .parent =NULL , .name ="rva22u64" , - .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVU , + .misa_ext =RVI |RVM |RVA |RVF |RVD |RVC |RVB |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), -CPU_CFG_OFFSET (ext_zbs),CPU_CFG_OFFSET (ext_zfhmin), +CPU_CFG_OFFSET (ext_zfhmin),CPU_CFG_OFFSET (ext_zkt),CPU_CFG_OFFSET (ext_zicntr),CPU_CFG_OFFSET (ext_zihpm),CPU_CFG_OFFSET (ext_zicbom),CPU_CFG_OFFSET (ext_zicbop),CPU_CFG_OFFSET (ext_zicboz),tests/data/acpi/riscv64/virt/RHCT binary +0
-0Signature · 2 lines
-- 2.47.1
PATCH 3/4 target/riscv: add RVA23U64 profile
In reply to Daniel Henrique BarbozaAdd RVA23U64 as described in [1]. This profile does not share all mandatory RVA22U64 extensions so we can't use RVA22U64 as a parent. We need to declare all mandatory extensions from scratch.
A new "rva23u64" CPU is also added.
[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
target/riscv/cpu-qom.h +1 -0
@@ -40,6 +40,7 @@#define TYPE_RISCV_CPU_RV64E RISCV_CPU_TYPE_NAME("rv64e")#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") +#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64")#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 +34 -0
@@ -2394,9 +2394,35 @@ static RISCVCPUProfile RVA22S64 = { } }; +/* +* All mandatory extensions from RVA22U64 are present +* in RVA23U64 so set RVA22 as a parent. We need to +* declare just the newly added mandatory extensions. +*/ +static RISCVCPUProfile RVA23U64 = { + .parent = &RVA22U64 , + .name ="rva23u64" , + .misa_ext =RVV , + .priv_spec =RISCV_PROFILE_ATTR_UNUSED , + .satp_mode =RISCV_PROFILE_ATTR_UNUSED , + .ext_offsets = { +CPU_CFG_OFFSET (ext_zvfhmin),CPU_CFG_OFFSET (ext_zvbb), +CPU_CFG_OFFSET (ext_zvkt),CPU_CFG_OFFSET (ext_zihintntl), +CPU_CFG_OFFSET (ext_zicond),CPU_CFG_OFFSET (ext_zimop), +CPU_CFG_OFFSET (ext_zcmop),CPU_CFG_OFFSET (ext_zcb), +CPU_CFG_OFFSET (ext_zfa),CPU_CFG_OFFSET (ext_zawrs), + +/* mandatory named features for this profile */ +CPU_CFG_OFFSET (ext_supm), + +RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , + &RVA23U64 ,NULL , };
@@ -2883,6 +2909,13 @@ static void rva22s64_profile_cpu_init(Object *obj) RVA22S64.enabled = true; } + +static void rva23u64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23U64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)
@@ -3162,6 +3195,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64E ,MXL_RV64 , rv64e_bare_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, MXL_RV64, rva23u64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };
Signature · 1 line
2.47.1
Re: [PATCH 3/4] target/riscv: add RVA23U64 profile
Quoted 3 lines · Daniel Henrique Barboza
Add RVA23U64 as described in [1]. This profile does not share all mandatory RVA22U64 extensions so we can't use RVA22U64 as a parent. We need to declare all mandatory extensions from scratch.
But it does share all mandatory extensions of rva22u64 and you do use it as a parent :-)
Thanks,
drew
Quoted 89 lines
A new "rva23u64" CPU is also added.
[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -40,6 +40,7 @@#define TYPE_RISCV_CPU_RV64E RISCV_CPU_TYPE_NAME("rv64e")#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") +#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64")#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 +34
-0@@ -2394,9 +2394,35 @@ static RISCVCPUProfile RVA22S64 = { } }; +/* +* All mandatory extensions from RVA22U64 are present +* in RVA23U64 so set RVA22 as a parent. We need to +* declare just the newly added mandatory extensions. +*/ +static RISCVCPUProfile RVA23U64 = { + .parent = &RVA22U64 , + .name ="rva23u64" , + .misa_ext =RVV , + .priv_spec =RISCV_PROFILE_ATTR_UNUSED , + .satp_mode =RISCV_PROFILE_ATTR_UNUSED , + .ext_offsets = { +CPU_CFG_OFFSET (ext_zvfhmin),CPU_CFG_OFFSET (ext_zvbb), +CPU_CFG_OFFSET (ext_zvkt),CPU_CFG_OFFSET (ext_zihintntl), +CPU_CFG_OFFSET (ext_zicond),CPU_CFG_OFFSET (ext_zimop), +CPU_CFG_OFFSET (ext_zcmop),CPU_CFG_OFFSET (ext_zcb), +CPU_CFG_OFFSET (ext_zfa),CPU_CFG_OFFSET (ext_zawrs), + +/* mandatory named features for this profile */ +CPU_CFG_OFFSET (ext_supm), + +RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , + &RVA23U64 ,NULL , };@@ -2883,6 +2909,13 @@ static void rva22s64_profile_cpu_init(Object *obj) RVA22S64.enabled = true; } + +static void rva23u64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23U64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3162,6 +3195,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64E ,MXL_RV64 , rv64e_bare_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, MXL_RV64, rva23u64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1
Re: [PATCH 3/4] target/riscv: add RVA23U64 profile
Quoted 7 lines · Andrew Jones
Quoted 3 lines · Daniel Henrique Barboza
Add RVA23U64 as described in [1]. This profile does not share all mandatory RVA22U64 extensions so we can't use RVA22U64 as a parent. We need to declare all mandatory extensions from scratch.
But it does share all mandatory extensions of rva22u64 and you do use it as a parent :-)
Oooops. Forgot to update the commit msg :D
Daniel
Quoted 93 lines
Thanks,
drewQuoted 89 lines
A new "rva23u64" CPU is also added.
[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -40,6 +40,7 @@#define TYPE_RISCV_CPU_RV64E RISCV_CPU_TYPE_NAME("rv64e")#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") +#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64")#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 +34
-0@@ -2394,9 +2394,35 @@ static RISCVCPUProfile RVA22S64 = { } }; +/* +* All mandatory extensions from RVA22U64 are present +* in RVA23U64 so set RVA22 as a parent. We need to +* declare just the newly added mandatory extensions. +*/ +static RISCVCPUProfile RVA23U64 = { + .parent = &RVA22U64 , + .name ="rva23u64" , + .misa_ext =RVV , + .priv_spec =RISCV_PROFILE_ATTR_UNUSED , + .satp_mode =RISCV_PROFILE_ATTR_UNUSED , + .ext_offsets = { +CPU_CFG_OFFSET (ext_zvfhmin),CPU_CFG_OFFSET (ext_zvbb), +CPU_CFG_OFFSET (ext_zvkt),CPU_CFG_OFFSET (ext_zihintntl), +CPU_CFG_OFFSET (ext_zicond),CPU_CFG_OFFSET (ext_zimop), +CPU_CFG_OFFSET (ext_zcmop),CPU_CFG_OFFSET (ext_zcb), +CPU_CFG_OFFSET (ext_zfa),CPU_CFG_OFFSET (ext_zawrs), + +/* mandatory named features for this profile */ +CPU_CFG_OFFSET (ext_supm), + +RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , + &RVA23U64 ,NULL , };@@ -2883,6 +2909,13 @@ static void rva22s64_profile_cpu_init(Object *obj) RVA22S64.enabled = true; } + +static void rva23u64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23U64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3162,6 +3195,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64E ,MXL_RV64 , rv64e_bare_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, MXL_RV64, rva23u64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1
PATCH 4/4 target/riscv: add RVA23S64 profile
In reply to Daniel Henrique BarbozaAdd RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile.
A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb):
rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_ za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_ zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_ sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_ sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_ supm_svade_svinval_svnapot_svpbmt
[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
target/riscv/cpu-qom.h +1 -0
@@ -41,6 +41,7 @@#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64")#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 +43 -0
65 lines not on this page · raw message
Signature · 1 line
2.47.1
Re: [PATCH 4/4] target/riscv: add RVA23S64 profile
Quoted 9 lines · Daniel Henrique Barboza
Add RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile.
A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb):
rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_
yeah, zba/zbb/zbs are still here as expected. So patch 2's bios table change was likely just the 'b', which we see at the start.
Quoted 44 lines
zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_supm_svade_svinval_svnapot_svpbmt[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -41,6 +41,7 @@#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64")#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 +11
-0@@ -2419,10 +2419,45 @@ static RISCVCPUProfile RVA23U64 = { } }; +/* +* As with RVA23U64, RVA23S64 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, Ssu64xl +* +* The remaining features/extensions comes from RVA23U64. +*/
target/riscv/cpu.c static RISCVCPUProfile RVA23U64 = { · line 2442
Quoted 10 lines
target/riscv/cpu.c +10
-0+static RISCVCPUProfile RVA23S64 = { + .parent = &RVA23U64 , + .name ="rva23s64" , + .misa_ext =RVS , + .priv_spec =PRIV_VERSION_1_13_0 , + .satp_mode =VM_1_10_SV39 , + .ext_offsets = { +/* These were present in RVA22S64 */ +CPU_CFG_OFFSET (ext_svade),CPU_CFG_OFFSET (ext_svpbmt), +CPU_CFG_OFFSET (ext_svinval),
I guess we can't inherit from both rva23u64 and rva22s64, which is what we'd like to do.
What about zifencei?
Quoted 47 lines
target/riscv/cpu.c +22
-0+ +/* New in RVA23S64 */ +CPU_CFG_OFFSET (ext_svnapot),CPU_CFG_OFFSET (ext_sstc), +CPU_CFG_OFFSET (ext_sscofpmf), + +/* Named features: Sha, ssu64xl, ssnpm */ +CPU_CFG_OFFSET (ext_sha), +CPU_CFG_OFFSET (ext_ssnpm), + + RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , &RVA23U64 , + &RVA23S64 ,NULL , };@@ -2916,6 +2951,13 @@ static void rva23u64_profile_cpu_init(Object *obj) RVA23U64.enabled = true; } + +static void rva23s64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23S64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3196,6 +3238,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA23U64 ,MXL_RV64 , rva23u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, MXL_RV64, rva23s64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1
Thanks,
drew
Re: [PATCH 4/4] target/riscv: add RVA23S64 profile
Quoted 63 lines · Andrew Jones
Quoted 9 lines · Daniel Henrique Barboza
Add RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile.
A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb):
rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_yeah, zba/zbb/zbs are still here as expected. So patch 2's bios table change was likely just the 'b', which we see at the start.
Quoted 49 lines
zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_supm_svade_svinval_svnapot_svpbmt[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -41,6 +41,7 @@#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64")#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 +16
-0@@ -2419,10 +2419,45 @@ static RISCVCPUProfile RVA23U64 = { } }; +/* +* As with RVA23U64, RVA23S64 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, Ssu64xl +* +* The remaining features/extensions comes from RVA23U64. +*/ +static RISCVCPUProfile RVA23S64 = { + .parent = &RVA23U64 , + .name ="rva23s64" , + .misa_ext =RVS , + .priv_spec =PRIV_VERSION_1_13_0 ,
Quoted 8 lines
target/riscv/cpu.c static RISCVCPUProfile RVA23U64 = { · line 2442
Quoted 5 lines
target/riscv/cpu.c +5
-0+ .satp_mode = VM_1_10_SV39, + .ext_offsets = { +/* These were present in RVA22S64 */ +CPU_CFG_OFFSET (ext_svade),CPU_CFG_OFFSET (ext_svpbmt), + CPU_CFG_OFFSET(ext_svinval),I guess we can't inherit from both rva23u64 and rva22s64, which is what we'd like to do.
Not at this moment, although it wouldn't be hard to pull it off if we want.
Quoted 2 lines
What about zifencei?
Oh dear I forgot about it. I'll add it in v2. Good catch.
Daniel
Quoted 51 lines
Quoted 48 lines
target/riscv/cpu.c +22
-0+ +/* New in RVA23S64 */ +CPU_CFG_OFFSET (ext_svnapot),CPU_CFG_OFFSET (ext_sstc), +CPU_CFG_OFFSET (ext_sscofpmf), + +/* Named features: Sha, ssu64xl, ssnpm */ +CPU_CFG_OFFSET (ext_sha), +CPU_CFG_OFFSET (ext_ssnpm), + + RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , &RVA23U64 , + &RVA23S64 ,NULL , };@@ -2916,6 +2951,13 @@ static void rva23u64_profile_cpu_init(Object *obj) RVA23U64.enabled = true; } + +static void rva23s64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23S64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3196,6 +3238,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA23U64 ,MXL_RV64 , rva23u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, MXL_RV64, rva23s64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1Thanks,
drew
Re: [PATCH 4/4] target/riscv: add RVA23S64 profile
In reply to Daniel Henrique BarbozaQuoted 61 lines · Daniel Henrique Barboza
Add RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile.
A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb):
rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_supm_svade_svinval_svnapot_svpbmt[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -41,6 +41,7 @@#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64")#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 +19
-0@@ -2419,10 +2419,45 @@ static RISCVCPUProfile RVA23U64 = { } }; +/* +* As with RVA23U64, RVA23S64 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, Ssu64xl +* +* The remaining features/extensions comes from RVA23U64. +*/ +static RISCVCPUProfile RVA23S64 = { + .parent = &RVA23U64 , + .name ="rva23s64" , + .misa_ext =RVS , + .priv_spec =PRIV_VERSION_1_13_0 , + .satp_mode =VM_1_10_SV39 , + .ext_offsets = { +/* These were present in RVA22S64 */
target/riscv/cpu.c static RISCVCPUProfile RVA23U64 = { · line 2450
Quoted 10 lines
target/riscv/cpu.c +10
-0+CPU_CFG_OFFSET (ext_svade),CPU_CFG_OFFSET (ext_svpbmt), +CPU_CFG_OFFSET (ext_svinval), + +/* New in RVA23S64 */ +CPU_CFG_OFFSET (ext_svnapot),CPU_CFG_OFFSET (ext_sstc), +CPU_CFG_OFFSET (ext_sscofpmf), + +/* Named features: Sha, ssu64xl, ssnpm */ +CPU_CFG_OFFSET (ext_sha), + CPU_CFG_OFFSET(ext_ssnpm),
Why are we calling ssnpm a named feature? And same question for supm in the last patch.
Thanks,
drew
Quoted 39 lines
target/riscv/cpu.c +14
-0+ + RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , &RVA23U64 , + &RVA23S64 ,NULL , };@@ -2916,6 +2951,13 @@ static void rva23u64_profile_cpu_init(Object *obj) RVA23U64.enabled = true; } + +static void rva23s64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23S64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3196,6 +3238,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA23U64 ,MXL_RV64 , rva23u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, MXL_RV64, rva23s64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1
Re: [PATCH 4/4] target/riscv: add RVA23S64 profile
Quoted 67 lines · Andrew Jones
Quoted 66 lines · Daniel Henrique Barboza
Add RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile.
A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb):
rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_supm_svade_svinval_svnapot_svpbmt[1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc
Signed-off-by Daniel Henrique Barboza <[email protected]>--- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)target/riscv/cpu-qom.h +1
-0@@ -41,6 +41,7 @@#define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64")#define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64")#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64")#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 +24
-0@@ -2419,10 +2419,45 @@ static RISCVCPUProfile RVA23U64 = { } }; +/* +* As with RVA23U64, RVA23S64 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, Ssu64xl +* +* The remaining features/extensions comes from RVA23U64. +*/ +static RISCVCPUProfile RVA23S64 = { + .parent = &RVA23U64 , + .name ="rva23s64" , + .misa_ext =RVS , + .priv_spec =PRIV_VERSION_1_13_0 , + .satp_mode =VM_1_10_SV39 , + .ext_offsets = { +/* These were present in RVA22S64 */ +CPU_CFG_OFFSET (ext_svade),CPU_CFG_OFFSET (ext_svpbmt), +CPU_CFG_OFFSET (ext_svinval), + +/* New in RVA23S64 */ +CPU_CFG_OFFSET (ext_svnapot),CPU_CFG_OFFSET (ext_sstc),
Quoted 8 lines
target/riscv/cpu.c static RISCVCPUProfile RVA23U64 = { · line 2450
Quoted 5 lines
target/riscv/cpu.c +5
-0+CPU_CFG_OFFSET (ext_sscofpmf), + +/* Named features: Sha, ssu64xl, ssnpm */ +CPU_CFG_OFFSET (ext_sha), + CPU_CFG_OFFSET(ext_ssnpm),Why are we calling ssnpm a named feature? And same question for supm in the last patch.
They're both defined in RVA23 as follows:
- Supm Pointer masking, with the execution environment providing a means to select PMLEN=0 and PMLEN=7 at minimum.
- Ssnpm Pointer masking, with senvcfg.PMM and henvcfg.PMM supporting, at minimum, settings PMLEN=0 and PMLEN=7.
This is consistent to what we usually call a named feature, i.e. a special name for a particular setting for an existing extension.
Granted, both are working as actual extensions in QEMU, so I guess we can treat them as such regardless of what the spec says.
Thanks,
Daniel
Quoted 43 lines
Thanks,
drewQuoted 39 lines
target/riscv/cpu.c +14
-0+ + RISCV_PROFILE_EXT_LIST_END + } +}; +RISCVCPUProfile *riscv_profiles[] = { &RVA22U64 , &RVA22S64 , &RVA23U64 , + &RVA23S64 ,NULL , };@@ -2916,6 +2951,13 @@ static void rva23u64_profile_cpu_init(Object *obj) RVA23U64.enabled = true; } + +static void rva23s64_profile_cpu_init (Object *obj) +{ +rv64i_bare_cpu_init (obj); + +RVA23S64 .enabled = true; +}#endif static const gchar *riscv_gdb_arch_name (CPUState *cs)@@ -3196,6 +3238,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22U64 ,MXL_RV64 , rva22u64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA22S64 ,MXL_RV64 , rva22s64_profile_cpu_init),DEFINE_PROFILE_CPU (TYPE_RISCV_CPU_RVA23U64 ,MXL_RV64 , rva23u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, MXL_RV64, rva23s64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };Signature · 1 line
2.47.1