Skip to contentSkip to conversation

kvmppc/e500: fix tlbcfg emulation

PATCH In review Liu Yu 3 participants 4 messages Jan 20, 2010 – Jan 21, 2010

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 3/3 kvmppc/e500: fix tlbcfg emulation

---
 arch/powerpc/kvm/e500_emulate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/e500_emulate.c +2 -2
index 95f8ec8..97337dd 100644
@@ -165,7 +165,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
 
 	case SPRN_TLB0CFG:
 	{
-		ulong tmp = SPRN_TLB0CFG;
+		ulong tmp = mfspr(SPRN_TLB0CFG);
 
 		tmp &= ~0xfffUL;
 		tmp |= vcpu_e500->guest_tlb_size[0];
@@ -175,7 +175,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
 
 	case SPRN_TLB1CFG:
 	{
-		ulong tmp = SPRN_TLB1CFG;
+		ulong tmp = mfspr(SPRN_TLB1CFG);
 
 		tmp &= ~0xfffUL;
 		tmp |= vcpu_e500->guest_tlb_size[1];
Signature · 1 line
1.6.4
#1 lore raw
Quoted 10 lines · Liu Yu

---
arch/powerpc/kvm/e500_emulate.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/e500_emulate.c +0 -0
index 95f8ec8..97337dd 100644

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt) · line 168

Quoted 5 lines
arch/powerpc/kvm/e500_emulate.c +1 -1
@@ -165,7 +165,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
 
 	case SPRN_TLB0CFG:
 	{
-		ulong tmp = SPRN_TLB0CFG;
+		ulong tmp = mfspr(SPRN_TLB0CFG);

Does this SPR value change? I hope not :-). If not, better read it once on init and then use it from there.

Alex

#2 lore raw
In reply to Liu Yu
Quoted 26 lines

-----Original Message-----
From: Alexander Graf [mailto:[email protected]]
Sent: Wednesday, January 20, 2010 6:47 PM
To: Liu Yu-B13201
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 3/3] kvmppc/e500: fix tlbcfg emulation
Importance: High

Review

Quoted 6 lines · Liu Yu

---
arch/powerpc/kvm/e500_emulate.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kvm/e500_emulate.c

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_mfspr(struct

Quoted 4 lines

index 95f8ec8..97337dd 100644

arch/powerpc/kvm/e500_emulate.c +0 -0
@@ -165,7 +165,7 @@ int kvmppc_core_emulate_mfspr(struct 

kvm_vcpu *vcpu, int sprn, int rt)

Quoted 1 line
Quoted 8 lines

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt) · line 168

Quoted 4 lines
	case SPRN_TLB0CFG:
	{
arch/powerpc/kvm/e500_emulate.c +1 -1
-		ulong tmp = SPRN_TLB0CFG;
+		ulong tmp = mfspr(SPRN_TLB0CFG);

Does this SPR value change? I hope not :-). If not, better read it once on init and then use it from there.

Out of curiousity. Does read it once in order to get better performance? If yes, I think read from register is faster than read from mem.

#3 lore raw
In reply to Liu Yu
Quoted 35 lines · On 21.01.2010, at 04:22, Liu Yu-B13201 wrote:
Quoted 26 lines

-----Original Message-----
From: Alexander Graf [mailto:[email protected]]
Sent: Wednesday, January 20, 2010 6:47 PM
To: Liu Yu-B13201
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 3/3] kvmppc/e500: fix tlbcfg emulation
Importance: High

Review

Quoted 6 lines · Liu Yu

---
arch/powerpc/kvm/e500_emulate.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/powerpc/kvm/e500_emulate.c

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_mfspr(struct

Quoted 4 lines

index 95f8ec8..97337dd 100644

arch/powerpc/kvm/e500_emulate.c +0 -0
@@ -165,7 +165,7 @@ int kvmppc_core_emulate_mfspr(struct 

kvm_vcpu *vcpu, int sprn, int rt)

Quoted 1 line
Quoted 8 lines

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt) · line 168

Quoted 4 lines
	case SPRN_TLB0CFG:
	{
arch/powerpc/kvm/e500_emulate.c +1 -1
-		ulong tmp = SPRN_TLB0CFG;
+		ulong tmp = mfspr(SPRN_TLB0CFG);

Does this SPR value change? I hope not :-). If not, better read it once on init and then use it from there.

Quoted 2 lines

Out of curiousity. Does read it once in order to get better performance? If yes, I think read from register is faster than read from mem.

Well, performance and clean structure. Nothing should keep us from having different parameters in the guest than we have in the host.

Also, as soon as nesting comes into play, reads from memory are definitely faster.

But if you think it's not worth the effort, keep it as it is.

Alex