public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Mihai Caraman <mihai.caraman@freescale.com>,
	<kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>,
	<linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 2/2] KVM: PPC: Book3E: Get vcpu's last instruction for emulation
Date: Tue, 9 Jul 2013 19:12:31 -0500	[thread overview]
Message-ID: <1373415151.8183.213@snotra> (raw)
In-Reply-To: <D6991806-B666-4043-8D74-1465B855DE3B@suse.de> (from agraf@suse.de on Tue Jul  9 16:45:10 2013)

On 07/09/2013 04:45:10 PM, Alexander Graf wrote:
> 
> On 28.06.2013, at 11:20, Mihai Caraman wrote:
> 
> > +	/* Get page size */
> > +	if (MAS0_GET_TLBSEL(mfspr(SPRN_MAS0)) == 0)
> > +		psize_shift = PAGE_SHIFT;
> > +	else
> > +		psize_shift = MAS1_GET_TSIZE(mas1) + 10;
> > +
> > +	mas7_mas3 = (((u64) mfspr(SPRN_MAS7)) << 32) |
> > +		    mfspr(SPRN_MAS3);
> > +	addr = (mas7_mas3 & (~0ULL << psize_shift)) |
> > +	       (geaddr & ((1ULL << psize_shift) - 1ULL));
> > +
> > +	/* Map a page and get guest's instruction */
> > +	page = pfn_to_page(addr >> PAGE_SHIFT);
> 
> While looking at this I just realized that you're missing a check  
> here. What if our IP is in some PCI BAR? Or can't we execute from  
> those?

We at least need to check pfn_valid() first.  That'll just keep us from  
accessing a bad pointer in the host kernel, though -- it won't make the  
emulation actually work.  If we need that, we'll probably need to  
create a temporary TLB entry manually.

-Scott

  reply	other threads:[~2013-07-10  0:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28  9:20 [PATCH 1/2] KVM: PPC: e500mc: Revert "add load inst fixup" Mihai Caraman
2013-06-28  9:20 ` [PATCH 2/2] KVM: PPC: Book3E: Get vcpu's last instruction for emulation Mihai Caraman
2013-07-08 13:39   ` Alexander Graf
2013-07-09 17:13     ` Scott Wood
2013-07-09 17:44       ` Alexander Graf
2013-07-09 18:46         ` Scott Wood
2013-07-09 21:44           ` Alexander Graf
2013-07-10  0:06             ` Scott Wood
2013-07-10 10:15               ` Alexander Graf
2013-07-10 18:42                 ` Scott Wood
2013-07-10 22:50                   ` Alexander Graf
2013-07-11  0:15                     ` Scott Wood
2013-07-11  0:17                       ` Alexander Graf
2013-07-09 21:45   ` Alexander Graf
2013-07-10  0:12     ` Scott Wood [this message]
2013-07-10 10:18       ` Alexander Graf
2013-07-10 18:37         ` Scott Wood
2013-07-10 22:48           ` Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2013-06-06 16:11 [PATCH 1/2] KVM: PPC: e500mc: Revert "add load inst fixup" Mihai Caraman
2013-06-06 16:11 ` [PATCH 2/2] KVM: PPC: Book3E: Get vcpu's last instruction for emulation Mihai Caraman

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=1373415151.8183.213@snotra \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mihai.caraman@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