target/arm: update the cortex-a15 MIDR to latest rev
RFC PATCH 1/1 target/arm: update the cortex-a15 MIDR to latest rev
QEMU doesn't model micro-architectural details which includes most chip errata. The ARM_ERRATA_798181 work around in the Linux kernel (see erratum_a15_798181_init) currently detects QEMU's cortex-a15 as broken and triggers additional expensive TLB flushes as a result.
Change the MIDR to report what the latest silicon would (r4p0) as well as setting the IMPDEF revidr bit to indicate these flushes are not needed. This cuts about 5s from my Debian kernel boot with the latest 6.0rc1 kernel (29s->24s).
--- target/arm/cpu_tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/cpu_tcg.c +3 -1
@@ -588,7 +588,9 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A15 ; - cpu->midr =0x412fc0f1 ; +/* r4p0 cpu, not requiring expensive tlb flush errata */ + cpu->midr =0x414fc0f0 ; + cpu->revidr =0x200 ; cpu->reset_fpsid =0x410430f0 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x11111111 ;
Signature · 1 line
2.34.1
Quoted 12 lines · Alex Bennée
QEMU doesn't model micro-architectural details which includes most chip errata. The
ARM_ERRATA_798181work around in the Linux kernel (seeerratum_a15_798181_init) currently detects QEMU's cortex-a15 as broken and triggers additional expensive TLB flushes as a result.Change the MIDR to report what the latest silicon would (r4p0) as well as setting the IMPDEF revidr bit to indicate these flushes are not needed. This cuts about 5s from my Debian kernel boot with the latest 6.0rc1 kernel (29s->24s).
Quoted 6 lines
Signed-off-by Alex Bennée <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Anders Roxell <[email protected]>--- target/arm/cpu_tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 7 lines · Alex Bennée
QEMU doesn't model micro-architectural details which includes most chip errata. The
ARM_ERRATA_798181work around in the Linux kernel (seeerratum_a15_798181_init) currently detects QEMU's cortex-a15 as broken and triggers additional expensive TLB flushes as a result.
Quoted 8 lines
Change the MIDR to report what the latest silicon would (r4p0) as well as setting the IMPDEF revidr bit to indicate these flushes are not needed. This cuts about 5s from my Debian kernel boot with the latest 6.0rc1 kernel (29s->24s).
Signed-off-by Alex Bennée <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Anders Roxell <[email protected]>
Quoted 22 lines
--- target/arm/cpu_tcg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)target/arm/cpu_tcg.c +3
-2@@ -588,7 +588,9 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A15 ; - cpu->midr =0x412fc0f1 ; +/* r4p0 cpu, not requiring expensive tlb flush errata */ + cpu->midr =0x414fc0f0 ; + cpu->revidr =0x200 ; cpu->reset_fpsid =0x410430f0 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x11111111 ; --2.34.1
Quoted 5 lines · Alex Bennée
index
3099b38e32..59d5278868100644
target/arm/cpu_tcg.c static void cortex_a15_initfn(Object *obj) · line 596
Quoted 10 lines
target/arm/cpu_tcg.c +3
-1@@ -588,7 +588,9 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A15 ; - cpu->midr =0x412fc0f1 ; +/* r4p0 cpu, not requiring expensive tlb flush errata */ + cpu->midr =0x414fc0f0 ; + cpu->revidr =0x200 ; cpu->reset_fpsid =0x410430f0 ; cpu->isar.mvfr0 =0x10110222 ; cpu->isar.mvfr1 =0x11111111 ;
This will work correctly with Linux, but after I checked the Cortex-A15 MPCore r2/r3/r4 Software Developers Errata Notice again, I think that setting revidr here is not fully correct:
With an r3p3 CPU, bit 9 of revidr (0x200) indicates that no workaround is necessary, but with r4p0 and higher, this bit is marked as reserved and both the Documentation and the Linux source code assume the hardware works correctly.
So I think this should either be 0x413fc0f3/0x200 or 0x414fc0f0/0.
Arnd