From mboxrd@z Thu Jan 1 00:00:00 1970 From: "tiejun.chen" Subject: Re: [PATCH 5/7 v3] KVM: PPC: exit to user space on "ehpriv" instruction Date: Tue, 9 Apr 2013 16:28:34 +0800 Message-ID: <5163D132.9080309@windriver.com> References: <1365417138-8202-1-git-send-email-Bharat.Bhushan@freescale.com> <1365417138-8202-2-git-send-email-Bharat.Bhushan@freescale.com> <1365417138-8202-3-git-send-email-Bharat.Bhushan@freescale.com> <1365417138-8202-4-git-send-email-Bharat.Bhushan@freescale.com> <1365417138-8202-5-git-send-email-Bharat.Bhushan@freescale.com> <1365417138-8202-6-git-send-email-Bharat.Bhushan@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , , , Bharat Bhushan To: Bharat Bhushan Return-path: In-Reply-To: <1365417138-8202-6-git-send-email-Bharat.Bhushan@freescale.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 04/08/2013 06:32 PM, Bharat Bhushan wrote: > From: Bharat Bhushan > > "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 > --- > 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; > } >