From: Marcelo Tosatti <mtosatti@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
Scott Wood <scottwood@freescale.com>
Subject: Re: [PATCH 19/38] KVM: PPC: e500mc: add load inst fixup
Date: Thu, 8 Mar 2012 19:36:45 -0300 [thread overview]
Message-ID: <20120308223645.GB24183@amt.cnet> (raw)
In-Reply-To: <1330474206-14794-20-git-send-email-agraf@suse.de>
On Wed, Feb 29, 2012 at 01:09:47AM +0100, Alexander Graf wrote:
> There's always a chance we're unable to read a guest instruction. The guest
> could have its TLB mapped execute-, but not readable, something odd happens
> and our TLB gets flushed. So it's a good idea to be prepared for that case
> and have a fallback that allows us to fix things up in that case.
>
> Add fixup code that keeps guest code from potentially crashing our host kernel.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>
> ---
>
> v1 -> v2:
>
> - fix whitespace
Still broken.
> - use explicit preempt counts
> ---
> arch/powerpc/kvm/bookehv_interrupts.S | 30 +++++++++++++++++++++++++++++-
> 1 files changed, 29 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
> index 63023ae..f7dc3f6 100644
> --- a/arch/powerpc/kvm/bookehv_interrupts.S
> +++ b/arch/powerpc/kvm/bookehv_interrupts.S
> @@ -28,6 +28,7 @@
> #include <asm/asm-compat.h>
> #include <asm/asm-offsets.h>
> #include <asm/bitsperlong.h>
> +#include <asm/thread_info.h>
>
> #include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
>
> @@ -171,9 +172,36 @@
> PPC_STL r30, VCPU_GPR(r30)(r4)
> PPC_STL r31, VCPU_GPR(r31)(r4)
> mtspr SPRN_EPLC, r8
> +
> + /* disable preemption, so we are sure we hit the fixup handler */
> +#ifdef CONFIG_PPC64
> + clrrdi r8,r1,THREAD_SHIFT
> +#else
> + rlwinm r8,r1,0,0,31-THREAD_SHIFT /* current thread_info */
> +#endif
> + li r7, 1
> + stw r7, TI_PREEMPT(r8)
> +
> isync
> - lwepx r9, 0, r5
> +
> + /*
> + * In case the read goes wrong, we catch it and write an invalid value
> + * in LAST_INST instead.
> + */
> +1: lwepx r9, 0, r5
> +2:
> +.section .fixup, "ax"
> +3: li r9, KVM_INST_FETCH_FAILED
> + b 2b
> +.previous
> +.section __ex_table,"a"
> + PPC_LONG_ALIGN
> + PPC_LONG 1b,3b
> +.previous
> +
> mtspr SPRN_EPLC, r3
> + li r7, 0
> + stw r7, TI_PREEMPT(r8)
> stw r9, VCPU_LAST_INST(r4)
> .endif
next prev parent reply other threads:[~2012-03-08 22:47 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 0:09 [PATCH 00/38] KVM: PPC: e500mc support v3 Alexander Graf
2012-02-29 0:09 ` [PATCH 01/38] powerpc/booke: Set CPU_FTR_DEBUG_LVL_EXC on 32-bit Alexander Graf
2012-02-29 0:09 ` [PATCH 02/38] powerpc/e500: split CPU_FTRS_ALWAYS/CPU_FTRS_POSSIBLE Alexander Graf
2012-02-29 0:09 ` [PATCH 03/38] KVM: PPC: factor out lpid allocator from book3s_64_mmu_hv Alexander Graf
2012-02-29 0:09 ` [PATCH 04/38] KVM: PPC: booke: add booke-level vcpu load/put Alexander Graf
2012-02-29 0:09 ` [PATCH 05/38] KVM: PPC: booke: Move vm core init/destroy out of booke.c Alexander Graf
2012-02-29 0:09 ` [PATCH 06/38] KVM: PPC: e500: rename e500_tlb.h to e500.h Alexander Graf
2012-02-29 0:09 ` [PATCH 07/38] KVM: PPC: e500: merge <asm/kvm_e500.h> into arch/powerpc/kvm/e500.h Alexander Graf
2012-02-29 0:09 ` [PATCH 08/38] KVM: PPC: e500: clean up arch/powerpc/kvm/e500.h Alexander Graf
2012-02-29 0:09 ` [PATCH 09/38] KVM: PPC: e500: refactor core-specific TLB code Alexander Graf
2012-02-29 0:09 ` [PATCH 10/38] KVM: PPC: e500: Track TLB1 entries with a bitmap Alexander Graf
2012-02-29 0:09 ` [PATCH 11/38] KVM: PPC: e500: emulate tlbilx Alexander Graf
2012-02-29 0:09 ` [PATCH 12/38] powerpc/booke: Provide exception macros with interrupt name Alexander Graf
2012-03-21 18:04 ` Kumar Gala
2012-03-21 18:19 ` Scott Wood
2012-03-21 20:20 ` Kumar Gala
2012-02-29 0:09 ` [PATCH 13/38] KVM: PPC: booke: category E.HV (GS-mode) support Alexander Graf
2012-03-05 9:04 ` Bhushan Bharat-R65777
2012-03-05 9:57 ` tiejun.chen
2012-02-29 0:09 ` [PATCH 14/38] KVM: PPC: booke: standard PPC floating point support Alexander Graf
2012-02-29 0:09 ` [PATCH 15/38] KVM: PPC: e500mc support Alexander Graf
2012-02-29 0:09 ` [PATCH 16/38] KVM: PPC: e500mc: Add doorbell emulation support Alexander Graf
2012-02-29 0:09 ` [PATCH 17/38] KVM: PPC: e500mc: implicitly set MSR_GS Alexander Graf
2012-02-29 0:09 ` [PATCH 18/38] KVM: PPC: e500mc: Move r1/r2 restoration very early Alexander Graf
2012-02-29 0:09 ` [PATCH 19/38] KVM: PPC: e500mc: add load inst fixup Alexander Graf
2012-03-08 22:36 ` Marcelo Tosatti [this message]
2012-03-12 19:39 ` Alexander Graf
2012-02-29 0:09 ` [PATCH 20/38] KVM: PPC: rename CONFIG_KVM_E500 -> CONFIG_KVM_E500V2 Alexander Graf
2012-02-29 0:09 ` [PATCH 21/38] KVM: PPC: make e500v2 kvm and e500mc cpu mutually exclusive Alexander Graf
2012-02-29 0:09 ` [PATCH 22/38] KVM: PPC: booke: remove leftover debugging Alexander Graf
2012-02-29 0:09 ` [PATCH 23/38] KVM: PPC: booke: deliver program int on emulation failure Alexander Graf
2012-02-29 0:09 ` [PATCH 24/38] KVM: PPC: booke: rework rescheduling checks Alexander Graf
2012-02-29 0:09 ` [PATCH 25/38] KVM: PPC: booke: BOOKE_IRQPRIO_MAX is n+1 Alexander Graf
2012-02-29 0:09 ` [PATCH 26/38] KVM: PPC: bookehv: fix exit timing Alexander Graf
2012-02-29 0:09 ` [PATCH 27/38] KVM: PPC: bookehv: remove negation for CONFIG_64BIT Alexander Graf
2012-02-29 0:09 ` [PATCH 28/38] KVM: PPC: bookehv: remove SET_VCPU Alexander Graf
2012-02-29 0:09 ` [PATCH 29/38] KVM: PPC: bookehv: disable MAS register updates early Alexander Graf
2012-02-29 0:09 ` [PATCH 30/38] KVM: PPC: bookehv: add comment about shadow_msr Alexander Graf
2012-02-29 0:09 ` [PATCH 31/38] KVM: PPC: booke: Readd debug abort code for machine check Alexander Graf
2012-02-29 0:10 ` [PATCH 32/38] KVM: PPC: booke: add GS documentation for program interrupt Alexander Graf
2012-02-29 0:10 ` [PATCH 33/38] KVM: PPC: bookehv: remove unused code Alexander Graf
2012-02-29 0:10 ` [PATCH 34/38] KVM: PPC: e500: fix typo in tlb code Alexander Graf
2012-02-29 0:10 ` [PATCH 35/38] KVM: PPC: booke: Support perfmon interrupts Alexander Graf
2012-02-29 0:10 ` [PATCH 36/38] KVM: PPC: booke: expose good state on irq reinject Alexander Graf
2012-02-29 0:10 ` [PATCH 37/38] KVM: PPC: booke: Reinject performance monitor interrupts Alexander Graf
2012-02-29 0:10 ` [PATCH 38/38] KVM: PPC: Booke: only prepare to enter when we enter 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=20120308223645.GB24183@amt.cnet \
--to=mtosatti@redhat.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=scottwood@freescale.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox