KVM: PPC: e500: tlbsx: fix tlb0 esel
Subsystems (2)
PATCH 1/5 KVM: PPC: e500: tlbsx: fix tlb0 esel
It should contain the way, not the absolute TLB0 index.
--- arch/powerpc/kvm/e500_tlb.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kvm/e500_tlb.c +3 -0
@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ; + vcpu_e500->mas0 =MAS0_TLBSEL (tlbsel) |MAS0_ESEL (esel) |MAS0_NV (vcpu_e500->gtlb_nv[tlbsel]); vcpu_e500->mas1 = gtlbe->mas1;
Signature · 1 line
1.7.4.1
Quoted 12 lines · Scott Wood
It should contain the way, not the absolute TLB0 index.
Signed-off-by Scott Wood <[email protected]>---
arch/powerpc/kvm/e500_tlb.c| 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/powerpc/kvm/e500_tlb.c +0
-0
arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) · line 792
Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c +2
-0@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ;
Is it guaranteed that MAS0_ESEL always returns at most the TLB1 index nr?
Alex
Quoted 4 lines
arch/powerpc/kvm/e500_tlb.c +1
-0+ vcpu_e500->mas0 =MAS0_TLBSEL (tlbsel) |MAS0_ESEL (esel) |MAS0_NV (vcpu_e500->gtlb_nv[tlbsel]); vcpu_e500->mas1 = gtlbe->mas1;
Quoted 17 lines · On Mon, 18 Jul 2011 11:16:10 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Scott Wood
It should contain the way, not the absolute TLB0 index.
Signed-off-by Scott Wood <[email protected]>---
arch/powerpc/kvm/e500_tlb.c| 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/powerpc/kvm/e500_tlb.c +0
-0@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }
Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) · line 792
Quoted 3 lines
arch/powerpc/kvm/e500_tlb.c +2
-0if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ;Is it guaranteed that
MAS0_ESELalways returns at most the TLB1 index nr?
What's the relevance of TLB1 here?
For TLB0, esel is supposed to contain the way, not the index into the full TLB.
-Scott
Quoted 26 lines · Scott Wood
Quoted 17 lines · On Mon, 18 Jul 2011 11:16:10 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Scott Wood
It should contain the way, not the absolute TLB0 index.
Signed-off-by Scott Wood <[email protected]>---
arch/powerpc/kvm/e500_tlb.c| 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/powerpc/kvm/e500_tlb.c +0
-0@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) · line 792
Quoted 3 lines
arch/powerpc/kvm/e500_tlb.c +2
-0if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ;Is it guaranteed that
MAS0_ESELalways returns at most the TLB1 index nr?
Quoted 4 lines
What's the relevance of TLB1 here?
For TLB0, esel is supposed to contain the way, not the index into the full TLB.
Well, for both esel is supposed to contain the way, just that for TLB1 it happens to be the index, or am I misunderstanding something here? The question was basically why we need to mask out on TLB0, but not on TLB1.
Alex
Quoted 29 lines · On Mon, 18 Jul 2011 18:30:51 +0200 Alexander Graf <[email protected]> wrote:
Quoted 26 lines · Scott Wood
Quoted 22 lines · On Mon, 18 Jul 2011 11:16:10 +0200 Alexander Graf <[email protected]> wrote:
Quoted 12 lines · Scott Wood
It should contain the way, not the absolute TLB0 index.
Signed-off-by Scott Wood <[email protected]>---
arch/powerpc/kvm/e500_tlb.c| 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/powerpc/kvm/e500_tlb.c +0
-0arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) · line 792
Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c +2
-0@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ;Is it guaranteed that
MAS0_ESELalways returns at most the TLB1 index nr?
Quoted 7 lines
Quoted 4 lines
What's the relevance of TLB1 here?
For TLB0, esel is supposed to contain the way, not the index into the full TLB.
Well, for both esel is supposed to contain the way, just that for TLB1 it happens to be the index, or am I misunderstanding something here? The question was basically why we need to mask out on TLB0, but not on TLB1.
It would be a no-op on TLB1, because there's only one "set".
-Scott
Quoted 34 lines · Scott Wood
Quoted 31 lines · On Mon, 18 Jul 2011 18:30:51 +0200 Alexander Graf <[email protected]> wrote:
Quoted 28 lines · Scott Wood
Quoted 17 lines · On Mon, 18 Jul 2011 11:16:10 +0200 Alexander Graf <[email protected]> wrote:
Quoted 14 lines · Scott Wood
It should contain the way, not the absolute TLB0 index.
Signed-off-by Scott Wood <[email protected]>---
arch/powerpc/kvm/e500_tlb.c| 3 +++1 files changed, 3 insertions(+), 0 deletions(-)arch/powerpc/kvm/e500_tlb.c +0
-0@@ -788,6 +788,9 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) }Quoted 5 lines
arch/powerpc/kvm/e500_tlb.c int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb) · line 792
Quoted 3 lines
arch/powerpc/kvm/e500_tlb.c +2
-0if (gtlbe) { +if (tlbsel =0 ) + esel &=KVM_E500_TLB0_WAY_NUM -1 ;Is it guaranteed that
MAS0_ESELalways returns at most the TLB1 index nr?What's the relevance of TLB1 here?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
For TLB0, esel is supposed to contain the way, not the index into the full TLB.
Well, for both esel is supposed to contain the way, just that for TLB1 it happens to be the index, or am I misunderstanding something here? The question was basically why we need to mask out on TLB0, but not on TLB1.
It would be a no-op on TLB1, because there's only one "set".
I guess I'm merely not understanding why we have the non-way bits set in TLB0 entries, but not in TLB1 ones :). Do we pass in the real array index?
Alex
Quoted 1 line · On Mon, 18 Jul 2011 23:37:50 +0200 Alexander Graf <[email protected]> wrote:
I guess I'm merely not understanding why we have the non-way bits set in TLB0 entries, but not in TLB1 ones :). Do we pass in the real array index?
KVM internally uses the full TLB index (and unfortunately calls it esel) in some places, such as kvmppc_e500_tlb_index. But we don't want to leak that to the guest.
-Scott
Quoted 8 lines · Scott Wood
Quoted 1 line · On Mon, 18 Jul 2011 23:37:50 +0200 Alexander Graf <[email protected]> wrote:
I guess I'm merely not understanding why we have the non-way bits set in TLB0 entries, but not in TLB1 ones :). Do we pass in the real array index?
KVM internally uses the full TLB index (and unfortunately calls it esel) in some places, such as
kvmppc_e500_tlb_index. But we don't want to leak that to the guest.
That's what I figured. So can we guarantee that internally esel for TLB1 is always < TLB1_NUM_ENTRIES? If so, we don't need to mask it. If not, we should.
Alex
Quoted 6 lines · On Mon, 18 Jul 2011 23:49:57 +0200 Alexander Graf <[email protected]> wrote:
Quoted 3 lines · Scott Wood
On Mon, 18 Jul 2011 23:37:50 +0200
Alexander Graf <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I guess I'm merely not understanding why we have the non-way bits set in TLB0 entries, but not in TLB1 ones :). Do we pass in the real array index?
KVM internally uses the full TLB index (and unfortunately calls it esel) in some places, such as
kvmppc_e500_tlb_index. But we don't want to leak that to the guest.That's what I figured. So can we guarantee that internally esel for TLB1 is always <
TLB1_NUM_ENTRIES? If so, we don't need to mask it. If not, we should.
Yes, kvmppc_e500_tlb_index will always return an entry number that is less than the number of entries in that tlb.
-Scott
Quoted 11 lines · Scott Wood
Quoted 8 lines · On Mon, 18 Jul 2011 23:49:57 +0200 Alexander Graf <[email protected]> wrote:
Quoted 5 lines · Scott Wood
Quoted 1 line · On Mon, 18 Jul 2011 23:37:50 +0200 Alexander Graf <[email protected]> wrote:
I guess I'm merely not understanding why we have the non-way bits set in TLB0 entries, but not in TLB1 ones :). Do we pass in the real array index?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
KVM internally uses the full TLB index (and unfortunately calls it esel) in some places, such as
kvmppc_e500_tlb_index. But we don't want to leak that to the guest.That's what I figured. So can we guarantee that internally esel for TLB1 is always <
TLB1_NUM_ENTRIES? If so, we don't need to mask it. If not, we should.Yes,
kvmppc_e500_tlb_indexwill always return an entry number that is less than the number of entries in that tlb.
Ok :). Good then. Slightly confusing code though ;).
Alex