linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: BOOKE KVM calling load_up_fpu from C?
Date: Tue, 12 Feb 2013 14:46:07 +1100	[thread overview]
Message-ID: <16381.1360640767@ale.ozlabs.ibm.com> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D0659EC4A@039-SN2MPN1-023.039d.mgd.msft.net>

Bhushan Bharat-R65777 <R65777@freescale.com> wrote:

> 
> 
> > -----Original Message-----
> > From: Linuxppc-dev [mailto:linuxppc-dev-
> > bounces+bharat.bhushan=freescale.com@lists.ozlabs.org] On Behalf Of Michael
> > Neuling
> > Sent: Tuesday, February 12, 2013 8:59 AM
> > To: Wood Scott-B07421
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Subject: BOOKE KVM calling load_up_fpu from C?
> > 
> > Scott,
> > 
> > I was looking at changing how load_up_fpu works and I found this in
> > arch/powerpc/kvm/booke.h:
> > 
> > static inline void kvmppc_load_guest_fp(struct kvm_vcpu *vcpu) { #ifdef
> > CONFIG_PPC_FPU
> > 	if (vcpu->fpu_active && !(current->thread.regs->msr & MSR_FP)) {
> > 		load_up_fpu();
> > 		current->thread.regs->msr |= MSR_FP;
> > 	}
> > #endif
> > }
> > 
> > I'm wondering how this is suppose to work since load_up_fpu is suppose to have
> > MSR in R12?
> 
> Is not the load_up_fpu() does mfmsr:
> 
> _GLOBAL(load_up_fpu)
>         mfmsr   r5
>         ori     r5,r5,MSR_FP
> #ifdef CONFIG_VSX
> BEGIN_FTR_SECTION
>         oris    r5,r5,MSR_VSX@h
> END_FTR_SECTION_IFSET(CPU_FTR_VSX)
> #endif
>         SYNC
>         MTMSRD(r5)                      /* enable use of fpu now */
>         isync
> <snip>

Look further down...

#ifdef CONFIG_PPC32
	mfspr	r5,SPRN_SPRG_THREAD		/* current task's THREAD (phys) */
	lwz	r4,THREAD_FPEXC_MODE(r5)
	ori	r9,r9,MSR_FP		/* enable FP for current */
	or	r9,r9,r4
#else
	ld	r4,PACACURRENT(r13)
	addi	r5,r4,THREAD		/* Get THREAD */
	lwz	r4,THREAD_FPEXC_MODE(r5)
	ori	r12,r12,MSR_FP
	or	r12,r12,r4
	std	r12,_MSR(r1)
#endif

R12 is loaded with SRR1 in the exception prolog before load_up_fpu is
called.  It's the MSR of the user process, not the current MSR.

Mikey

  reply	other threads:[~2013-02-12  3:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  3:29 BOOKE KVM calling load_up_fpu from C? Michael Neuling
2013-02-12  3:37 ` Bhushan Bharat-R65777
2013-02-12  3:46   ` Michael Neuling [this message]
2013-02-12  3:58     ` Bhushan Bharat-R65777
2013-02-12  4:16       ` Michael Neuling
2013-02-12  9:01         ` Bhushan Bharat-R65777
2013-02-12 18:33           ` Scott Wood
2013-02-12 22:51             ` Michael Neuling
2013-02-13  1:18             ` Bhushan Bharat-R65777
2013-02-13  1:23               ` Scott Wood
2013-02-13  1:26                 ` Bhushan Bharat-R65777
2013-02-13  4:17                 ` Bhushan Bharat-R65777
2013-02-13 17:37                   ` Scott Wood

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=16381.1360640767@ale.ozlabs.ibm.com \
    --to=mikey@neuling.org \
    --cc=B07421@freescale.com \
    --cc=R65777@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).