public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 26/27] KVM: PPC: Add KVM intercept handlers
Date: Fri, 16 Apr 2010 16:48:59 +1000	[thread overview]
Message-ID: <1271400539.13059.181.camel@pasglop> (raw)
In-Reply-To: <1271369518-11247-27-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>

On Fri, 2010-04-16 at 00:11 +0200, Alexander Graf wrote:
> When an interrupt occurs we don't know yet if we're in guest context or
> in host context. When in guest context, KVM needs to handle it.
> 
> So let's pull the same trick we did on Book3S_64: Just add a macro to
> determine if we're in guest context or not and if so jump on to KVM code.
> 
Acked-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>

> Signed-off-by: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
> ---
>  arch/powerpc/kernel/head_32.S |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
> index e025e89..98c4b29 100644
> --- a/arch/powerpc/kernel/head_32.S
> +++ b/arch/powerpc/kernel/head_32.S
> @@ -33,6 +33,7 @@
>  #include <asm/asm-offsets.h>
>  #include <asm/ptrace.h>
>  #include <asm/bug.h>
> +#include <asm/kvm_book3s_asm.h>
>  
>  /* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
>  #define LOAD_BAT(n, reg, RA, RB)	\
> @@ -303,6 +304,7 @@ __secondary_hold_acknowledge:
>   */
>  #define EXCEPTION(n, label, hdlr, xfer)		\
>  	. = n;					\
> +	DO_KVM n;				\
>  label:						\
>  	EXCEPTION_PROLOG;			\
>  	addi	r3,r1,STACK_FRAME_OVERHEAD;	\
> @@ -358,6 +360,7 @@ i##n:								\
>   *	-- paulus.
>   */
>  	. = 0x200
> +	DO_KVM  0x200
>  	mtspr	SPRN_SPRG_SCRATCH0,r10
>  	mtspr	SPRN_SPRG_SCRATCH1,r11
>  	mfcr	r10
> @@ -381,6 +384,7 @@ i##n:								\
>  
>  /* Data access exception. */
>  	. = 0x300
> +	DO_KVM  0x300
>  DataAccess:
>  	EXCEPTION_PROLOG
>  	mfspr	r10,SPRN_DSISR
> @@ -397,6 +401,7 @@ DataAccess:
>  
>  /* Instruction access exception. */
>  	. = 0x400
> +	DO_KVM  0x400
>  InstructionAccess:
>  	EXCEPTION_PROLOG
>  	andis.	r0,r9,0x4000		/* no pte found? */
> @@ -413,6 +418,7 @@ InstructionAccess:
>  
>  /* Alignment exception */
>  	. = 0x600
> +	DO_KVM  0x600
>  Alignment:
>  	EXCEPTION_PROLOG
>  	mfspr	r4,SPRN_DAR
> @@ -427,6 +433,7 @@ Alignment:
>  
>  /* Floating-point unavailable */
>  	. = 0x800
> +	DO_KVM  0x800
>  FPUnavailable:
>  BEGIN_FTR_SECTION
>  /*
> @@ -450,6 +457,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE)
>  
>  /* System call */
>  	. = 0xc00
> +	DO_KVM  0xc00
>  SystemCall:
>  	EXCEPTION_PROLOG
>  	EXC_XFER_EE_LITE(0xc00, DoSyscall)
> @@ -467,9 +475,11 @@ SystemCall:
>   * by executing an altivec instruction.
>   */
>  	. = 0xf00
> +	DO_KVM  0xf00
>  	b	PerformanceMonitor
>  
>  	. = 0xf20
> +	DO_KVM  0xf20
>  	b	AltiVecUnavailable
>  
>  /*
> @@ -882,6 +892,10 @@ __secondary_start:
>  	RFI
>  #endif /* CONFIG_SMP */
>  
> +#ifdef CONFIG_KVM_BOOK3S_HANDLER
> +#include "../kvm/book3s_rmhandlers.S"
> +#endif
> +
>  /*
>   * Those generic dummy functions are kept for CPUs not
>   * included in CONFIG_6xx

  parent reply	other threads:[~2010-04-16  6:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 22:11 [PATCH 00/27] Book3S_32 (PPC32) KVM support Alexander Graf
     [not found] ` <1271369518-11247-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-15 22:11   ` [PATCH 01/27] KVM: PPC: Name generic 64-bit code generic Alexander Graf
2010-04-21  9:29     ` Avi Kivity
2010-04-15 22:11   ` [PATCH 02/27] KVM: PPC: Add host MMU Support Alexander Graf
2010-04-15 22:11   ` [PATCH 03/27] KVM: PPC: Add SR swapping code Alexander Graf
2010-04-15 22:11   ` [PATCH 04/27] KVM: PPC: Add generic segment switching code Alexander Graf
2010-04-15 22:11   ` [PATCH 09/27] KVM: PPC: Improve indirect svcpu accessors Alexander Graf
2010-04-15 22:11   ` [PATCH 10/27] KVM: PPC: Use KVM_BOOK3S_HANDLER Alexander Graf
2010-04-15 22:11   ` [PATCH 11/27] KVM: PPC: Use CONFIG_PPC_BOOK3S define Alexander Graf
2010-04-15 22:11   ` [PATCH 13/27] KVM: PPC: Use now shadowed vcpu fields Alexander Graf
2010-04-15 22:11   ` [PATCH 14/27] KVM: PPC: Extract MMU init Alexander Graf
2010-04-15 22:11   ` [PATCH 15/27] KVM: PPC: Make real mode handler generic Alexander Graf
2010-04-15 22:11   ` [PATCH 16/27] KVM: PPC: Make highmem code generic Alexander Graf
2010-04-15 22:11   ` [PATCH 17/27] KVM: PPC: Make SLB switching code the new segment framework Alexander Graf
2010-04-15 22:11   ` [PATCH 18/27] KVM: PPC: Release clean pages as clean Alexander Graf
2010-04-15 22:11   ` [PATCH 23/27] KVM: PPC: Export MMU variables Alexander Graf
     [not found]     ` <1271369518-11247-24-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-16  6:47       ` Benjamin Herrenschmidt
2010-04-16  9:07         ` Alexander Graf
     [not found]           ` <41F9F369-9F53-43E8-AC1F-1C67DD918991-l3A5Bk7waGM@public.gmane.org>
2010-04-16  9:22             ` Benjamin Herrenschmidt
2010-04-16  9:25               ` Alexander Graf
2010-04-16  9:31                 ` Alexander Graf
     [not found]                   ` <8EEEAFCF-CB31-4BD9-A917-08B5B6E40400-l3A5Bk7waGM@public.gmane.org>
2010-04-16 11:18                     ` Alexander Graf
2010-04-15 22:11   ` [PATCH 24/27] PPC: Export SWITCH_FRAME_SIZE Alexander Graf
2010-04-16  6:48     ` Benjamin Herrenschmidt
2010-04-15 22:11   ` [PATCH 25/27] KVM: PPC: Check max IRQ prio Alexander Graf
2010-04-21  9:42   ` [PATCH 00/27] Book3S_32 (PPC32) KVM support Avi Kivity
2010-04-15 22:11 ` [PATCH 05/27] PPC: Split context init/destroy functions Alexander Graf
2010-04-16  6:46   ` Benjamin Herrenschmidt
2010-04-15 22:11 ` [PATCH 06/27] KVM: PPC: Add kvm_book3s_64.h Alexander Graf
2010-04-15 22:11 ` [PATCH 07/27] KVM: PPC: Add kvm_book3s_32.h Alexander Graf
2010-04-15 22:11 ` [PATCH 08/27] KVM: PPC: Add fields to shadow vcpu Alexander Graf
2010-04-15 22:11 ` [PATCH 12/27] PPC: Add STLU Alexander Graf
2010-04-16  6:47   ` Benjamin Herrenschmidt
2010-04-15 22:11 ` [PATCH 19/27] KVM: PPC: Remove fetch fail code Alexander Graf
2010-04-15 22:11 ` [PATCH 20/27] KVM: PPC: Add SVCPU to Book3S_32 Alexander Graf
2010-04-15 22:11 ` [PATCH 21/27] KVM: PPC: Emulate segment fault Alexander Graf
2010-04-15 22:11 ` [PATCH 22/27] KVM: PPC: Add Book3S compatibility code Alexander Graf
2010-04-15 22:11 ` [PATCH 26/27] KVM: PPC: Add KVM intercept handlers Alexander Graf
     [not found]   ` <1271369518-11247-27-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-04-16  6:48     ` Benjamin Herrenschmidt [this message]
2010-04-15 22:11 ` [PATCH 27/27] KVM: PPC: Enable Book3S_32 KVM building 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=1271400539.13059.181.camel@pasglop \
    --to=benh-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
    --cc=agraf-l3A5Bk7waGM@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.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: 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