From: Bhushan Bharat-R65777 <R65777@freescale.com> To: Alexander Graf <agraf@suse.de> Cc: "kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org> Subject: RE: [PATCH 3/3] KVM: PPC: booke: Added debug handler Date: Tue, 7 Aug 2012 16:02:12 +0000 [thread overview] Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D03DF31BE@039-SN2MPN1-022.039d.mgd.msft.net> (raw) In-Reply-To: <D65633A8-635A-4992-8F13-3E4FE72151DB@suse.de> > -----Original Message----- > From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-owner@vger.kernel.org] On > Behalf Of Alexander Graf > Sent: Tuesday, August 07, 2012 4:18 PM > To: Bhushan Bharat-R65777 > Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Bhushan Bharat-R65777 > Subject: Re: [PATCH 3/3] KVM: PPC: booke: Added debug handler > > > On 03.08.2012, at 09:08, Bharat Bhushan wrote: > > > Installed debug handler will be used for guest debug support and debug > > facility emulation features (patches for these features will follow > > this patch). > > > > Signed-off-by: Liu Yu <yu.liu@freescale.com> > > [bharat.bhushan@freescale.com: Substantial changes] > > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> > > > > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> > > --- > > arch/powerpc/include/asm/kvm_host.h | 1 + > > arch/powerpc/kernel/asm-offsets.c | 1 + > > arch/powerpc/kvm/booke_interrupts.S | 45 +++++++++++++++++++++++++++++++++++ > > 3 files changed, 47 insertions(+), 0 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/kvm_host.h > > b/arch/powerpc/include/asm/kvm_host.h > > index dcee499..bd78523 100644 > > --- a/arch/powerpc/include/asm/kvm_host.h > > +++ b/arch/powerpc/include/asm/kvm_host.h > > @@ -494,6 +494,7 @@ struct kvm_vcpu_arch { > > u32 tlbcfg[4]; > > u32 mmucfg; > > u32 epr; > > + u32 crit_save; > > #endif > > gpa_t paddr_accessed; > > gva_t vaddr_accessed; > > diff --git a/arch/powerpc/kernel/asm-offsets.c > > b/arch/powerpc/kernel/asm-offsets.c > > index 85b05c4..92f149b 100644 > > --- a/arch/powerpc/kernel/asm-offsets.c > > +++ b/arch/powerpc/kernel/asm-offsets.c > > @@ -563,6 +563,7 @@ int main(void) > > DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); > > DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); > > DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); > > + DEFINE(VCPU_CRIT_SAVE, offsetof(struct kvm_vcpu, arch.crit_save)); > > #endif /* CONFIG_PPC_BOOK3S */ > > #endif /* CONFIG_KVM */ > > > > diff --git a/arch/powerpc/kvm/booke_interrupts.S > > b/arch/powerpc/kvm/booke_interrupts.S > > index 3539805..890673c 100644 > > --- a/arch/powerpc/kvm/booke_interrupts.S > > +++ b/arch/powerpc/kvm/booke_interrupts.S > > @@ -73,6 +73,51 @@ _GLOBAL(kvmppc_handler_\ivor_nr) > > bctr > > .endm > > > > +.macro KVM_DBG_HANDLER ivor_nr scratch srr0 > > This is a lot of asm code. Any chance to share a good share of it with the > generic handler? Yes it is a lot of code but I am finding it difficult. Thanks -Bharat > > > Alex > > > +_GLOBAL(kvmppc_handler_\ivor_nr) > > + mtspr \scratch, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + stw r3, VCPU_CRIT_SAVE(r4) > > + mfcr r3 > > + mfspr r4, SPRN_CSRR1 > > + andi. r4, r4, MSR_PR > > + bne 1f > > + /* debug interrupt happened in enter/exit path */ > > + mfspr r4, SPRN_CSRR1 > > + rlwinm r4, r4, 0, ~MSR_DE > > + mtspr SPRN_CSRR1, r4 > > + lis r4, 0xffff > > + ori r4, r4, 0xffff > > + mtspr SPRN_DBSR, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + mtcr r3 > > + lwz r3, VCPU_CRIT_SAVE(r4) > > + mfspr r4, \scratch > > + rfci > > +1: /* debug interrupt happened in guest */ > > + mfspr r4, \scratch > > + mtcr r3 > > + mr r3, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + stw r3, VCPU_GPR(R4)(r4) > > + stw r5, VCPU_GPR(R5)(r4) > > + stw r6, VCPU_GPR(R6)(r4) > > + lwz r3, VCPU_CRIT_SAVE(r4) > > + mfspr r5, \srr0 > > + stw r3, VCPU_GPR(R3)(r4) > > + stw r5, VCPU_PC(r4) > > + mfctr r5 > > + lis r6, kvmppc_resume_host@h > > + stw r5, VCPU_CTR(r4) > > + li r5, \ivor_nr > > + ori r6, r6, kvmppc_resume_host@l > > + mtctr r6 > > + bctr > > +.endm > > + > > .macro KVM_HANDLER_ADDR ivor_nr > > .long kvmppc_handler_\ivor_nr > > .endm > > -- > > 1.7.0.4 > > > > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body > of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Bhushan Bharat-R65777 <R65777@freescale.com> To: Alexander Graf <agraf@suse.de> Cc: "kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org> Subject: RE: [PATCH 3/3] KVM: PPC: booke: Added debug handler Date: Tue, 07 Aug 2012 16:02:12 +0000 [thread overview] Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D03DF31BE@039-SN2MPN1-022.039d.mgd.msft.net> (raw) In-Reply-To: <D65633A8-635A-4992-8F13-3E4FE72151DB@suse.de> > -----Original Message----- > From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-owner@vger.kernel.org] On > Behalf Of Alexander Graf > Sent: Tuesday, August 07, 2012 4:18 PM > To: Bhushan Bharat-R65777 > Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Bhushan Bharat-R65777 > Subject: Re: [PATCH 3/3] KVM: PPC: booke: Added debug handler > > > On 03.08.2012, at 09:08, Bharat Bhushan wrote: > > > Installed debug handler will be used for guest debug support and debug > > facility emulation features (patches for these features will follow > > this patch). > > > > Signed-off-by: Liu Yu <yu.liu@freescale.com> > > [bharat.bhushan@freescale.com: Substantial changes] > > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> > > > > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> > > --- > > arch/powerpc/include/asm/kvm_host.h | 1 + > > arch/powerpc/kernel/asm-offsets.c | 1 + > > arch/powerpc/kvm/booke_interrupts.S | 45 +++++++++++++++++++++++++++++++++++ > > 3 files changed, 47 insertions(+), 0 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/kvm_host.h > > b/arch/powerpc/include/asm/kvm_host.h > > index dcee499..bd78523 100644 > > --- a/arch/powerpc/include/asm/kvm_host.h > > +++ b/arch/powerpc/include/asm/kvm_host.h > > @@ -494,6 +494,7 @@ struct kvm_vcpu_arch { > > u32 tlbcfg[4]; > > u32 mmucfg; > > u32 epr; > > + u32 crit_save; > > #endif > > gpa_t paddr_accessed; > > gva_t vaddr_accessed; > > diff --git a/arch/powerpc/kernel/asm-offsets.c > > b/arch/powerpc/kernel/asm-offsets.c > > index 85b05c4..92f149b 100644 > > --- a/arch/powerpc/kernel/asm-offsets.c > > +++ b/arch/powerpc/kernel/asm-offsets.c > > @@ -563,6 +563,7 @@ int main(void) > > DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); > > DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); > > DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); > > + DEFINE(VCPU_CRIT_SAVE, offsetof(struct kvm_vcpu, arch.crit_save)); > > #endif /* CONFIG_PPC_BOOK3S */ > > #endif /* CONFIG_KVM */ > > > > diff --git a/arch/powerpc/kvm/booke_interrupts.S > > b/arch/powerpc/kvm/booke_interrupts.S > > index 3539805..890673c 100644 > > --- a/arch/powerpc/kvm/booke_interrupts.S > > +++ b/arch/powerpc/kvm/booke_interrupts.S > > @@ -73,6 +73,51 @@ _GLOBAL(kvmppc_handler_\ivor_nr) > > bctr > > .endm > > > > +.macro KVM_DBG_HANDLER ivor_nr scratch srr0 > > This is a lot of asm code. Any chance to share a good share of it with the > generic handler? Yes it is a lot of code but I am finding it difficult. Thanks -Bharat > > > Alex > > > +_GLOBAL(kvmppc_handler_\ivor_nr) > > + mtspr \scratch, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + stw r3, VCPU_CRIT_SAVE(r4) > > + mfcr r3 > > + mfspr r4, SPRN_CSRR1 > > + andi. r4, r4, MSR_PR > > + bne 1f > > + /* debug interrupt happened in enter/exit path */ > > + mfspr r4, SPRN_CSRR1 > > + rlwinm r4, r4, 0, ~MSR_DE > > + mtspr SPRN_CSRR1, r4 > > + lis r4, 0xffff > > + ori r4, r4, 0xffff > > + mtspr SPRN_DBSR, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + mtcr r3 > > + lwz r3, VCPU_CRIT_SAVE(r4) > > + mfspr r4, \scratch > > + rfci > > +1: /* debug interrupt happened in guest */ > > + mfspr r4, \scratch > > + mtcr r3 > > + mr r3, r4 > > + mfspr r4, SPRN_SPRG_THREAD > > + lwz r4, THREAD_KVM_VCPU(r4) > > + stw r3, VCPU_GPR(R4)(r4) > > + stw r5, VCPU_GPR(R5)(r4) > > + stw r6, VCPU_GPR(R6)(r4) > > + lwz r3, VCPU_CRIT_SAVE(r4) > > + mfspr r5, \srr0 > > + stw r3, VCPU_GPR(R3)(r4) > > + stw r5, VCPU_PC(r4) > > + mfctr r5 > > + lis r6, kvmppc_resume_host@h > > + stw r5, VCPU_CTR(r4) > > + li r5, \ivor_nr > > + ori r6, r6, kvmppc_resume_host@l > > + mtctr r6 > > + bctr > > +.endm > > + > > .macro KVM_HANDLER_ADDR ivor_nr > > .long kvmppc_handler_\ivor_nr > > .endm > > -- > > 1.7.0.4 > > > > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body > of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-08-07 16:02 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-03 7:08 [PATCH 1/3] booke: Added ONE_REG interface for IAC/DAC debug registers Bharat Bhushan 2012-08-03 7:20 ` Bharat Bhushan 2012-08-03 7:08 ` [PATCH 2/3] KVM: PPC: booke: Allow multiple exception types Bharat Bhushan 2012-08-03 7:20 ` Bharat Bhushan 2012-08-07 10:46 ` Alexander Graf 2012-08-07 10:46 ` Alexander Graf 2012-08-10 6:38 ` Bhushan Bharat-R65777 2012-08-10 9:19 ` Alexander Graf 2012-08-10 9:19 ` Alexander Graf 2012-08-10 10:41 ` Bhushan Bharat-R65777 2012-08-10 10:57 ` Alexander Graf 2012-08-10 10:57 ` Alexander Graf 2012-08-10 10:59 ` Bhushan Bharat-R65777 2012-08-10 10:59 ` Bhushan Bharat-R65777 2012-08-03 7:08 ` [PATCH 3/3] KVM: PPC: booke: Added debug handler Bharat Bhushan 2012-08-03 7:20 ` Bharat Bhushan 2012-08-07 10:47 ` Alexander Graf 2012-08-07 10:47 ` Alexander Graf 2012-08-07 16:02 ` Bhushan Bharat-R65777 [this message] 2012-08-07 16:02 ` Bhushan Bharat-R65777 2012-08-07 20:44 ` Scott Wood 2012-08-07 20:44 ` Scott Wood 2012-08-08 1:02 ` Bhushan Bharat-R65777 2012-08-08 1:02 ` Bhushan Bharat-R65777 2012-08-08 11:10 ` Alexander Graf 2012-08-08 11:10 ` Alexander Graf 2012-08-10 6:55 ` Bhushan Bharat-R65777 2012-08-10 9:21 ` Alexander Graf 2012-08-10 9:21 ` Alexander Graf 2012-08-07 10:30 ` [PATCH 1/3] booke: Added ONE_REG interface for IAC/DAC debug registers Alexander Graf 2012-08-07 10:30 ` Alexander Graf
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6A3DF150A5B70D4F9B66A25E3F7C888D03DF31BE@039-SN2MPN1-022.039d.mgd.msft.net \ --to=r65777@freescale.com \ --cc=agraf@suse.de \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.