Skip to contentSkip to conversation

KVM: PPC: 440: Implement mtdcrx

PATCH In review Alexander Graf 2 participants 4 messages Aug 15, 2012 – Aug 16, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 KVM: PPC: 440: Implement mtdcrx

---
 arch/powerpc/kvm/44x_emulate.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kvm/44x_emulate.c +3 -0
index c8c6157..ea57631 100644
@@ -28,6 +28,7 @@
 #include "44x_tlb.h"
 
 #define XOP_MFDCR   323
+#define XOP_MTDCRX  387
 #define XOP_MTDCR   451
 #define XOP_TLBSX   914
 #define XOP_ICCCI   966
@@ -84,6 +85,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 
 			break;
 
+		case XOP_MTDCRX:
+			dcrn = kvmppc_get_gpr(vcpu, ra);
 		case XOP_MTDCR:
 			/* emulate some access in kernel */
 			switch (dcrn) {
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 2/2 KVM: PPC: 440: Implement mfdcrx

---
 arch/powerpc/kvm/44x_emulate.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kvm/44x_emulate.c +3 -0
index ea57631..30ea3a7 100644
@@ -27,6 +27,7 @@
 #include "booke.h"
 #include "44x_tlb.h"
 
+#define XOP_MFDCRX  259
 #define XOP_MFDCR   323
 #define XOP_MTDCRX  387
 #define XOP_MTDCR   451
@@ -50,6 +51,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	case 31:
 		switch (get_xop(inst)) {
 
+		case XOP_MFDCRX:
+			dcrn = kvmppc_get_gpr(vcpu, ra);
 		case XOP_MFDCR:
 			/* The guest may access CPR0 registers to determine the timebase
 			 * frequency, and it must know the real host frequency because it
Signature · 1 line
1.6.0.2
#2 lore raw
In reply to Alexander Graf
Quoted 18 lines · Alexander Graf
---
 arch/powerpc/kvm/44x_emulate.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kvm/44x_emulate.c +1 -0
index c8c6157..ea57631 100644
@@ -28,6 +28,7 @@
 #include "44x_tlb.h"
 
 #define XOP_MFDCR   323
+#define XOP_MTDCRX  387
 #define XOP_MTDCR   451
 #define XOP_TLBSX   914
 #define XOP_ICCCI   966

arch/powerpc/kvm/44x_emulate.c int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, · line 90

Quoted 6 lines
arch/powerpc/kvm/44x_emulate.c +2 -0
@@ -84,6 +85,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 
 			break;
 
+		case XOP_MTDCRX:
+			dcrn = kvmppc_get_gpr(vcpu, ra);
 		case XOP_MTDCR:

It's customary to put a /* fallthrough */ comment to shut down any alarms that may be firing off in readers' minds.

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 20 lines · Avi Kivity
Quoted 19 lines · Alexander Graf

---
arch/powerpc/kvm/44x_emulate.c | 3 +++

1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kvm/44x_emulate.c +1 -0
index c8c6157..ea57631 100644
@@ -28,6 +28,7 @@
 #include "44x_tlb.h"
 
 #define XOP_MFDCR   323
+#define XOP_MTDCRX  387
 #define XOP_MTDCR   451
 #define XOP_TLBSX   914
 #define XOP_ICCCI   966
@@ -84,6 +85,8 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 
Quoted 8 lines

arch/powerpc/kvm/44x_emulate.c int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, · line 90

Quoted 5 lines
arch/powerpc/kvm/44x_emulate.c +2 -0
 			break;
 
+		case XOP_MTDCRX:
+			dcrn = kvmppc_get_gpr(vcpu, ra);
 		case XOP_MTDCR:

It's customary to put a /* fallthrough */ comment to shut down any alarms that may be firing off in readers' minds.

Yeah, I moved this over into function calls now. Makes the code easier to read :). And hopefully the compiler is smart enough to optimize it the same way.

Alex