All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: hvmemul_rep_movs() vs MMIO
Date: Fri, 20 Sep 2013 13:47:09 +0100	[thread overview]
Message-ID: <20130920124709.GC65886@ocelot.phlegethon.org> (raw)
In-Reply-To: <523C5EB302000078000F4EA6@nat28.tlf.novell.com>

At 13:41 +0100 on 20 Sep (1379684515), Jan Beulich wrote:
> >>> On 20.09.13 at 14:05, Tim Deegan <tim@xen.org> wrote:
> > At 12:46 +0100 on 20 Sep (1379681171), Jan Beulich wrote:
> >> Tim,
> >> 
> >> was it really intended for "x86/hvm: use unlocked p2m lookups in
> >> hvmemul_rep_movs()" to special case p2m_mmio_dm but not
> >> p2m_mmio_direct?
> > 
> > Hmm.  It certainly doesn't seem to handle that case very well now, but
> > I'm not sure the code before was any better.  AFAICT it would have
> > passed mmio_direct accesses to hvmemul_do_mmio(), which would send them
> > to qemu.
> 
> Hmm, wait - if MMIO of a passed through device, other than for
> its port I/O, doesn't get intercepted at all, but instead gets taken
> care of by there being a valid gfn->mfn translation in place, then
> indeed before and after your change things aren't handled well.
> Perhaps we should bail from there if either side is p2m_mmio_direct
> as well as if both sides are p2m_mmio_dm:

Sounds OK to me.  Clearly mmio-mmio string operations aren't something
we need to make go fast. :)

Reviewed-by: Tim Deegan <tim@xen.org>

> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -799,6 +799,10 @@ static int hvmemul_rep_movs(
>      (void) get_gfn_query_unlocked(current->domain, sgpa >> PAGE_SHIFT, &sp2mt);
>      (void) get_gfn_query_unlocked(current->domain, dgpa >> PAGE_SHIFT, &dp2mt);
>  
> +    if ( sp2mt == p2m_mmio_direct || dp2mt == p2m_mmio_direct ||
> +         (sp2mt == p2m_mmio_dm && dp2mt == p2m_mmio_dm) )
> +        return X86EMUL_UNHANDLEABLE;
> +
>      if ( sp2mt == p2m_mmio_dm )
>          return hvmemul_do_mmio(
>              sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ, df, NULL);
> 
> Jan
> 

  reply	other threads:[~2013-09-20 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 11:46 hvmemul_rep_movs() vs MMIO Jan Beulich
2013-09-20 12:05 ` Tim Deegan
2013-09-20 12:41   ` Jan Beulich
2013-09-20 12:47     ` Tim Deegan [this message]
2013-09-20 12:53       ` Jan Beulich

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=20130920124709.GC65886@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.