target-mips: fix MIPS64R6-generic configuration
PATCH 1/1 target-mips: fix MIPS64R6-generic configuration
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.
--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
target-mips/mips-defs.h +1 -1
@@ -11,7 +11,7 @@#if defined(TARGET_MIPS64 )#define TARGET_LONG_BITS 64#define TARGET_PHYS_ADDR_SPACE_BITS 48 -#define TARGET_VIRT_ADDR_SPACE_BITS 42 +#define TARGET_VIRT_ADDR_SPACE_BITS 48#else #define TARGET_LONG_BITS 32#define TARGET_PHYS_ADDR_SPACE_BITS 40
target-mips/translate_init.c +9 -9
@@ -655,14 +655,14 @@ static const mips_def_t mips_defs[] = (2 <<CP0C1_DS ) | (4 <<CP0C1_DL ) | (3 <<CP0C1_DA ) | (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), .CP0_Config2 = MIPS_CONFIG2, - .CP0_Config3 =MIPS_CONFIG3 | (1 <<CP0C3_RXI ) | (1 <<CP0C3_BP ) | - (1 <<CP0C3_BI ) | (1 <<CP0C3_ULRI ) | (1 <<CP0C3_LPA ) | - (1U << CP0C3_M), - .CP0_Config4 =MIPS_CONFIG4 | (0xfc << CP0C4_KScrExist) | - (3 << CP0C4_IE) | (1 << CP0C4_M), + .CP0_Config3 =MIPS_CONFIG3 | (1U <<CP0C3_M ) | (1 <<CP0C3_MSAP ) | + (1 <<CP0C3_BP ) | (1 <<CP0C3_BI ) | (1 <<CP0C3_ULRI ) | + (1 << CP0C3_RXI) | (1 << CP0C3_LPA), + .CP0_Config4 =MIPS_CONFIG4 | (1U <<CP0C4_M ) | (3 <<CP0C4_IE ) | + (0xfc << CP0C4_KScrExist), .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_LLB), - .CP0_Config5_rw_bitmask = (1 <<CP0C5_SBRI ) | (1 <<CP0C5_FRE ) | - (1 << CP0C5_UFE), + .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 <<CP0C5_SBRI ) | + (1 << CP0C5_FRE) | (1 << CP0C5_UFE), .CP0_LLAddr_rw_bitmask = 0, .CP0_LLAddr_shift = 0, .SYNCI_Step = 32,
@@ -674,9 +674,9 @@ static const mips_def_t mips_defs[] = .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_F64) | (1 << FCR0_L) | (1 <<FCR0_W ) | (1 <<FCR0_D ) | (1 <<FCR0_S ) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV), - .SEGBITS = 42, + .SEGBITS = 48, .PABITS = 48, - .insn_flags = CPU_MIPS64R6, + .insn_flags = CPU_MIPS64R6 | ASE_MSA, .mmu_type = MMU_TYPE_R4000, }, {
Signature · 1 line
1.7.5.4
Leon Alrae
AppliedQuoted 11 lines · Yongbok Kim
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.Signed-off-by Yongbok Kim <[email protected]>--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
Applied to mips-next, thanks.
Leon
Quoted 11 lines · Yongbok Kim
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.Signed-off-by Yongbok Kim <[email protected]>--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
That said given we are getting closer to the I6400 CPU model, shouldn't we try to directly model a I6400 core (even if we have to disable some features like IEEE 754-2008 FP) instead of a generic MIPS64R6 core?
Quoted 55 lines
target-mips/mips-defs.h +1
-1@@ -11,7 +11,7 @@#if defined(TARGET_MIPS64 )#define TARGET_LONG_BITS 64#define TARGET_PHYS_ADDR_SPACE_BITS 48 -#define TARGET_VIRT_ADDR_SPACE_BITS 42 +#define TARGET_VIRT_ADDR_SPACE_BITS 48#else #define TARGET_LONG_BITS 32#define TARGET_PHYS_ADDR_SPACE_BITS 40target-mips/translate_init.c +9
-9@@ -655,14 +655,14 @@ static const mips_def_t mips_defs[] = (2 <<CP0C1_DS ) | (4 <<CP0C1_DL ) | (3 <<CP0C1_DA ) | (0 << CP0C1_PC) | (1 << CP0C1_WR) | (1 << CP0C1_EP), .CP0_Config2 = MIPS_CONFIG2, - .CP0_Config3 =MIPS_CONFIG3 | (1 <<CP0C3_RXI ) | (1 <<CP0C3_BP ) | - (1 <<CP0C3_BI ) | (1 <<CP0C3_ULRI ) | (1 <<CP0C3_LPA ) | - (1U << CP0C3_M), - .CP0_Config4 =MIPS_CONFIG4 | (0xfc << CP0C4_KScrExist) | - (3 << CP0C4_IE) | (1 << CP0C4_M), + .CP0_Config3 =MIPS_CONFIG3 | (1U <<CP0C3_M ) | (1 <<CP0C3_MSAP ) | + (1 <<CP0C3_BP ) | (1 <<CP0C3_BI ) | (1 <<CP0C3_ULRI ) | + (1 << CP0C3_RXI) | (1 << CP0C3_LPA), + .CP0_Config4 =MIPS_CONFIG4 | (1U <<CP0C4_M ) | (3 <<CP0C4_IE ) | + (0xfc << CP0C4_KScrExist), .CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_LLB), - .CP0_Config5_rw_bitmask = (1 <<CP0C5_SBRI ) | (1 <<CP0C5_FRE ) | - (1 << CP0C5_UFE), + .CP0_Config5_rw_bitmask = (1 << CP0C5_MSAEn) | (1 <<CP0C5_SBRI ) | + (1 << CP0C5_FRE) | (1 << CP0C5_UFE), .CP0_LLAddr_rw_bitmask = 0, .CP0_LLAddr_shift = 0, .SYNCI_Step = 32,@@ -674,9 +674,9 @@ static const mips_def_t mips_defs[] = .CP1_fcr0 = (1 << FCR0_FREP) | (1 << FCR0_F64) | (1 << FCR0_L) | (1 <<FCR0_W ) | (1 <<FCR0_D ) | (1 <<FCR0_S ) | (0x00 << FCR0_PRID) | (0x0 << FCR0_REV), - .SEGBITS = 42, + .SEGBITS = 48, .PABITS = 48, - .insn_flags = CPU_MIPS64R6, + .insn_flags = CPU_MIPS64R6 | ASE_MSA, .mmu_type = MMU_TYPE_R4000, }, {Signature · 1 line
1.7.5.4
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Quoted 13 lines · Aurelien Jarno
Quoted 11 lines · Yongbok Kim
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.Signed-off-by Yongbok Kim <[email protected]>--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
Quoted 6 lines
Reviewed-by Aurelien Jarno <[email protected]>That said given we are getting closer to the I6400 CPU model, shouldn't we try to directly model a I6400 core (even if we have to disable some features like IEEE 754-2008 FP) instead of a generic MIPS64R6 core?
I fully agree with that but detailed specification of I6400 has not been published yet, therefore for the time being we will need to use the generic core name. However we could rename mips32r5-generic into P5600 with such restrictions - Hardware page table walk, Virtualization, EVA. What do you think?
Regards,
Yongbok
Quoted 16 lines · Yongbok Kim
Quoted 15 lines · Aurelien Jarno
Quoted 11 lines · Yongbok Kim
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.Signed-off-by Yongbok Kim <[email protected]>--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)Reviewed-by Aurelien Jarno <[email protected]>
Quoted 7 lines
Quoted 4 lines
That said given we are getting closer to the I6400 CPU model, shouldn't we try to directly model a I6400 core (even if we have to disable some features like IEEE 754-2008 FP) instead of a generic MIPS64R6 core?
I fully agree with that but detailed specification of I6400 has not been published yet, therefore for the time being we will need to use the generic
Oh ok.
Quoted 3 lines
core name. However we could rename mips32r5-generic into P5600 with such restrictions - Hardware page table walk, Virtualization, EVA. What do you think?
I think it's a good idea, as long as we keep the config register in sync with what is actually implemented.
That also reminds me that we should look at implementing hardware page table walk. That should be relatively easy to implement, and provide a huge performance boost (exceptions cost a lot on QEMU).
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
Quoted 25 lines · Aurelien Jarno
Quoted 16 lines · Yongbok Kim
Quoted 15 lines · Aurelien Jarno
Quoted 11 lines · Yongbok Kim
Fix core configuration for MIPS64R6-generic to make it as close as I6400.
I6400 core has 48-bit of Virtual Address available (SEGBITS). MIPS SIMD Architecture is available.
Rearrange order of bits to match the specification.Signed-off-by Yongbok Kim <[email protected]>--- target-mips/mips-defs.h | 2 +- target-mips/translate_init.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)Reviewed-by Aurelien Jarno <[email protected]>Quoted 7 lines
Quoted 4 lines
That said given we are getting closer to the I6400 CPU model, shouldn't we try to directly model a I6400 core (even if we have to disable some features like IEEE 754-2008 FP) instead of a generic MIPS64R6 core?
I fully agree with that but detailed specification of I6400 has not been published yet, therefore for the time being we will need to use the generic
Quoted 9 lines
Oh ok.
Quoted 3 lines
core name. However we could rename mips32r5-generic into P5600 with such restrictions - Hardware page table walk, Virtualization, EVA. What do you think?
I think it's a good idea, as long as we keep the config register in sync with what is actually implemented.
I will form a patch to do that.
Quoted 4 lines
That also reminds me that we should look at implementing hardware page table walk. That should be relatively easy to implement, and provide a huge performance boost (exceptions cost a lot on QEMU).
Actually I have implemented HTW (for MIPS32 only) but due to lack of resources, I couldn't upstream it for 2.4. Please have a look at below commits.
https://github.com/yongbok/prpl-qemu/commit/b39e60b4039bb72ab5eccabfb75f6e6389d89bfd
https://github.com/yongbok/prpl-qemu/commit/4fd75126c1d78d84a91c659de17a5bc45efdef27
Regards,
Yongbok