linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: "Suraj Jitindar Singh" <sjitindarsingh@gmail.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org,
	Suraj Jitindar Singh <surajjs@au1.ibm.com>
Subject: Re: [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()
Date: Thu, 13 Jun 2019 11:50:48 +1000	[thread overview]
Message-ID: <688dfb940de8259630f249391c6cfd6e41c3bdee.camel@neuling.org> (raw)
In-Reply-To: <1560386385.1924.2.camel@gmail.com>


> > > 3:
> > >         /* Emulate H_SET_DABR/X on P8 for the sake of compat mode
> > > guests */
> > >         rlwimi  r5, r4, 5, DAWRX_DR | DAWRX_DW
> > > c00000000010b03c:       74 2e 85 50     rlwimi  r5,r4,5,25,26
> > >         rlwimi  r5, r4, 2, DAWRX_WT
> > > c00000000010b040:       f6 16 85 50     rlwimi  r5,r4,2,27,27
> > >         clrrdi  r4, r4, 3
> > > c00000000010b044:       24 07 84 78     rldicr  r4,r4,0,60
> > >         std     r4, VCPU_DAWR(r3)
> > > c00000000010b048:       c0 13 83 f8     std     r4,5056(r3)
> > >         std     r5, VCPU_DAWRX(r3)
> > > c00000000010b04c:       c8 13 a3 f8     std     r5,5064(r3)
> > >         mtspr   SPRN_DAWR, r4
> > > c00000000010b050:       a6 2b 94 7c     mtspr   180,r4
> > >         mtspr   SPRN_DAWRX, r5
> > > c00000000010b054:       a6 2b bc 7c     mtspr   188,r5
> > >         li      r3, 0
> > > c00000000010b058:       00 00 60 38     li      r3,0
> > >         blr
> > > c00000000010b05c:       20 00 80 4e     blr
> > 
> > It's the `mtspr   SPRN_DAWR, r4` as you're HV=0.  I'm not sure how
> > nested works
> > in that regard. Is the level above suppose to trap and emulate
> > that?  
> > 
> 
> Yeah so as a nested hypervisor we need to avoid that call to mtspr
> SPRN_DAWR since it's HV privileged and we run with HV = 0.
> 
> The fix will be to check kvmhv_on_pseries() before doing the write. In
> fact we should avoid the write any time we call the function from _not_
> real mode.
> 
> I'll submit a fix for the KVM side. Doesn't look like this is anything
> to do with Mikey's patch, was always broken as far as I can tell.

Thanks Suraj.

Mikey


      reply	other threads:[~2019-06-13  1:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  7:22 [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr() Michael Neuling
2019-06-12  7:42 ` Christophe Leroy
2019-06-12  9:23   ` Paul Mackerras
2019-06-12  9:28     ` Christophe Leroy
2019-06-12  7:43 ` Cédric Le Goater
2019-06-13  0:16   ` Michael Neuling
2019-06-13  0:39     ` Suraj Jitindar Singh
2019-06-13  1:50       ` Michael Neuling [this message]

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=688dfb940de8259630f249391c6cfd6e41c3bdee.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=clg@kaod.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=sjitindarsingh@gmail.com \
    --cc=surajjs@au1.ibm.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;
as well as URLs for NNTP newsgroup(s).