Skip to contentSkip to conversation

KVM/PPC: emulate ehpriv

PATCH In review Tiejun Chen 3 participants 3 messages Apr 19, 2013

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

PATCH 1/1 KVM/PPC: emulate ehpriv

We can provide this emulation to simplify more extension later.

---
 arch/powerpc/include/asm/disassemble.h |    4 ++++
 arch/powerpc/kvm/e500_emulate.c        |   17 +++++++++++++++++
 2 files changed, 21 insertions(+)
arch/powerpc/include/asm/disassemble.h +4 -0
index 9b198d1..856f8de 100644
@@ -77,4 +77,8 @@ static inline unsigned int get_d(u32 inst)
 	return inst & 0xffff;
 }
 
+static inline unsigned int get_oc(u32 inst)
+{
+	return (inst >> 11) & 0x7fff;
+}
 #endif /* __ASM_PPC_DISASSEMBLE_H__ */
arch/powerpc/kvm/e500_emulate.c +17 -0
index e78f353..36492cf 100644
@@ -26,6 +26,7 @@
 #define XOP_TLBRE   946
 #define XOP_TLBWE   978
 #define XOP_TLBILX  18
+#define XOP_EHPRIV  270
 
 #ifdef CONFIG_KVM_E500MC
 static int dbell2prio(ulong param)
@@ -80,6 +81,18 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu *vcpu, int rb)
 
 	return EMULATE_DONE;
 }
+
+static int kvmppc_e500_emul_ehpriv(struct kvm_run *run, struct kvm_vcpu *vcpu,
+					unsigned int inst)
+{
+	int emulated = EMULATE_DONE;
+
+	switch (get_oc(inst)) {
+	default:
+		emulated = EMULATE_FAIL;
+	}
+	return emulated;
+}
 #endif
 
 int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -130,6 +143,10 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 			emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
 			break;
 
+		case XOP_EHPRIV:
+			emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst);
+			break;
+
 		default:
 			emulated = EMULATE_FAIL;
 		}
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · Tiejun Chen

We can provide this emulation to simplify more extension later.

Works for me, but this should really be part of a series that makes use of ehpriv.

Alex

Quoted 65 lines

---
arch/powerpc/include/asm/disassemble.h | 4 ++++
arch/powerpc/kvm/e500_emulate.c | 17 +++++++++++++++++

2 files changed, 21 insertions(+)
arch/powerpc/include/asm/disassemble.h +4 -0
index 9b198d1..856f8de 100644
@@ -77,4 +77,8 @@ static inline unsigned int get_d(u32 inst)
 	return inst & 0xffff;
 }
 
+static inline unsigned int get_oc(u32 inst)
+{
+	return (inst >> 11) & 0x7fff;
+}
 #endif /* __ASM_PPC_DISASSEMBLE_H__ */
arch/powerpc/kvm/e500_emulate.c +17 -0
index e78f353..36492cf 100644
@@ -26,6 +26,7 @@
 #define XOP_TLBRE   946
 #define XOP_TLBWE   978
 #define XOP_TLBILX  18
+#define XOP_EHPRIV  270
 
 #ifdef CONFIG_KVM_E500MC
 static int dbell2prio(ulong param)
@@ -80,6 +81,18 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu *vcpu, int rb)
 
 	return EMULATE_DONE;
 }
+
+static int kvmppc_e500_emul_ehpriv(struct kvm_run *run, struct kvm_vcpu *vcpu,
+					unsigned int inst)
+{
+	int emulated = EMULATE_DONE;
+
+	switch (get_oc(inst)) {
+	default:
+		emulated = EMULATE_FAIL;
+	}
+	return emulated;
+}
 #endif
 
 int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -130,6 +143,10 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
 			emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
 			break;
 
+		case XOP_EHPRIV:
+			emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst);
+			break;
+
 		default:
 			emulated = EMULATE_FAIL;
 		}
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Alexander Graf [mailto:[email protected]]
Sent: Friday, April 19, 2013 5:44 PM
To: Tiejun Chen
Cc: [email protected] mailing list; [email protected]; Bhushan Bharat- R65777
Subject: Re: [PATCH] KVM/PPC: emulate ehpriv

Quoted 6 lines
Quoted 1 line · Tiejun Chen

We can provide this emulation to simplify more extension later.

Works for me, but this should really be part of a series that makes use of ehpriv.

Alex, this already planned to be in my debug patches. I know you are busy and I am just waiting for other patches to be reviewed :)

-Bharat

Quoted 73 lines

Alex

Quoted 33 lines

---
arch/powerpc/include/asm/disassemble.h | 4 ++++
arch/powerpc/kvm/e500_emulate.c | 17 +++++++++++++++++

2 files changed, 21 insertions(+)
arch/powerpc/include/asm/disassemble.h +3 -0
index 9b198d1..856f8de 100644
@@ -77,4 +77,8 @@ static inline unsigned int get_d(u32 inst)
 	return inst & 0xffff;
 }
 
+static inline unsigned int get_oc(u32 inst) {
+	return (inst >> 11) & 0x7fff;
+}
 #endif /* __ASM_PPC_DISASSEMBLE_H__ */ diff --git

a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c index e78f353..36492cf 100644

arch/powerpc/kvm/e500_emulate.c +1 -0
@@ -26,6 +26,7 @@
 #define XOP_TLBRE   946
 #define XOP_TLBWE   978
 #define XOP_TLBILX  18
+#define XOP_EHPRIV  270
 
 #ifdef CONFIG_KVM_E500MC
 static int dbell2prio(ulong param)

arch/powerpc/kvm/e500_emulate.c static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu · line 86

Quoted 6 lines
arch/powerpc/kvm/e500_emulate.c +2 -0
@@ -80,6 +81,18 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu
 *vcpu, int rb)
 
 	return EMULATE_DONE;
 }
+
+static int kvmppc_e500_emul_ehpriv(struct kvm_run *run, struct kvm_vcpu

*vcpu,

arch/powerpc/kvm/e500_emulate.c int kvmppc_core_emulate_op(struct kvm_run *run, struct

Quoted 14 lines
arch/powerpc/kvm/e500_emulate.c +10 -0
+					unsigned int inst)
+{
+	int emulated = EMULATE_DONE;
+
+	switch (get_oc(inst)) {
+	default:
+		emulated = EMULATE_FAIL;
+	}
+	return emulated;
+}
 #endif
 

int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,

arch/powerpc/kvm/e500_emulate.c +0 -0
@@ -130,6 +143,10 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct

kvm_vcpu *vcpu,

Quoted 13 lines
arch/powerpc/kvm/e500_emulate.c +4 -1
 			emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
 			break;
 
+		case XOP_EHPRIV:
+			emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst);
+			break;
+
 		default:
 			emulated = EMULATE_FAIL;
 		}
--

1.7.9.5