On 04/08/2013 06:32 PM, Bharat Bhushan wrote:
From: Bharat Bhushan <bharat.bhus...@freescale.com>

"ehpriv" instruction is used for setting software breakpoints
by user space. This patch adds support to exit to user space
with "run->debug" have relevant information.

Signed-off-by: Bharat Bhushan <bharat.bhus...@freescale.com>
---
  arch/powerpc/kvm/e500_emulate.c |   10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index e78f353..cefdd38 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -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)
@@ -130,6 +131,15 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
                        emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
                        break;

+               case XOP_EHPRIV:
+                       run->exit_reason = KVM_EXIT_DEBUG;

IIRC, the ehpriv instruction should generate a Hypervisor Privilege Exception to trap into the Hypervisor proactive. And we can use this ability to design something conveniently. And so, that is not only for the debug mechanism like you did.

So here if 'run->exit_reason' is fixed to KVM_EXIT_DEBUG, how to distinguish other scenarios? So as I understand, we should use 'ehpriv oc' exactly then resolve 'oc' further to go different cases, right?

Tiejun

+                       run->debug.arch.address = vcpu->arch.pc;
+                       run->debug.arch.status = 0;
+                       kvmppc_account_exit(vcpu, DEBUG_EXITS);
+                       emulated = EMULATE_EXIT_USER;
+                       *advance = 0;
+                       break;
+
                default:
                        emulated = EMULATE_FAIL;
                }


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to