PPC: e500: Only expose even TLB sizes in initial TLB
PATCH 1/1 PPC: e500: Only expose even TLB sizes in initial TLB
When booting our e500 machine, we automatically generate a big TLB entry in TLB1 that covers all of the code we need to run in there until the guest can handle its TLB on its own.
However, e500v2 can only handle MAS1.0 sizes. However, we keep our TLB information in MAS2.0 layout, which means we have twice as many TLB sizes to choose from. That also means we can run into a situation where we try to add a TLB size that could not fit into the MAS1.0 size bits.
Fix it by making sure we always have the lower bit set to 0. That way we are always guaranteed to have MAS1.0 compatible TLB size information.
--- hw/ppc/e500.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
hw/ppc/e500.c +4 -0
@@ -362,6 +362,10 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)the device tree top */ dt_end = bi->dt_base + bi->dt_size; ps =booke206_page_size_to_tlb (dt_end) +1 ; +if (ps &1 ) { +/* e500v2 can only do even TLB size bits */ + ps++; + } size = (ps <<MAS1_TSIZE_SHIFT ); tlb->mas1 =MAS1_VALID | size; tlb->mas2 =0 ;
Signature · 1 line
1.6.0.2
Quoted 22 lines · Alexander Graf
When booting our e500 machine, we automatically generate a big TLB entry in TLB1 that covers all of the code we need to run in there until the guest can handle its TLB on its own.
However, e500v2 can only handle MAS1.0 sizes. However, we keep our TLB information in MAS2.0 layout, which means we have twice as many TLB sizes to choose from. That also means we can run into a situation where we try to add a TLB size that could not fit into the MAS1.0 size bits.
Fix it by making sure we always have the lower bit set to 0. That way we are always guaranteed to have MAS1.0 compatible TLB size information.
Signed-off-by Alexander Graf <[email protected]>--- hw/ppc/e500.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)hw/ppc/e500.c +0
-0
hw/ppc/e500.c static void mmubooke_create_initial_mapping(CPUPPCState *env) · line 371
Quoted 10 lines
hw/ppc/e500.c +4
-0@@ -362,6 +362,10 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)the device tree top */ dt_end = bi->dt_base + bi->dt_size; ps =booke206_page_size_to_tlb (dt_end) +1 ; +if (ps &1 ) { +/* e500v2 can only do even TLB size bits */ + ps++; + } size = (ps <<MAS1_TSIZE_SHIFT ); tlb->mas1 =MAS1_VALID | size; tlb->mas2 =0 ;
Applied (actually as part of the PPC pull).
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 27 lines · Aurelien Jarno
Quoted 26 lines · Alexander Graf
When booting our e500 machine, we automatically generate a big TLB entry in TLB1 that covers all of the code we need to run in there until the guest can handle its TLB on its own.
However, e500v2 can only handle MAS1.0 sizes. However, we keep our TLB information in MAS2.0 layout, which means we have twice as many TLB sizes to choose from. That also means we can run into a situation where we try to add a TLB size that could not fit into the MAS1.0 size bits.
Fix it by making sure we always have the lower bit set to 0. That way we are always guaranteed to have MAS1.0 compatible TLB size information.
Signed-off-by Alexander Graf <[email protected]>---
hw/ppc/e500.c| 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)hw/ppc/e500.c +1
-0@@ -362,6 +362,10 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)the device tree top */ dt_end = bi->dt_base + bi->dt_size; ps =booke206_page_size_to_tlb (dt_end) +1 ; +if (ps &1 ) {
Quoted 8 lines
hw/ppc/e500.c static void mmubooke_create_initial_mapping(CPUPPCState *env) · line 371
Quoted 6 lines
hw/ppc/e500.c +3
-0+/* e500v2 can only do even TLB size bits */ + ps++; + } size = (ps <<MAS1_TSIZE_SHIFT ); tlb->mas1 =MAS1_VALID | size; tlb->mas2 =0 ;Applied (actually as part of the PPC pull).
Yes, these were quite critical bugfixes that I folded into the pull request. Sorry for not noting it anywhere :).
Alex
Quoted 5 lines
Signature · 3 lines
-- Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net