public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: tgingold@free.fr
To: Avi Kivity <avi@redhat.com>
Cc: "Zhang, Yang" <yang.zhang@intel.com>,
	"kvm-ia64@vger.kernel.org" <kvm-ia64@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Zhang, Xiantao" <xiantao.zhang@intel.com>
Subject: Re: [PATCH] KVM: Qemu: Flush i-cache after ide-dma operation in IA64
Date: Thu, 02 Apr 2009 17:41:18 +0200	[thread overview]
Message-ID: <1238686878.49d4dc9e051aa@imp.free.fr> (raw)
In-Reply-To: <49D47D7F.2040904@redhat.com>

Quoting Avi Kivity <avi@redhat.com>:

> Zhang, Yang wrote:
> > The data from dma will include instructions. In order to exeuting the right
> > instruction, we should to flush the i-cache to ensure those data can be see
> > by cpu.
> >
> >
> >
> > diff --git a/qemu/cache-utils.h b/qemu/cache-utils.h
> > index b45fde4..5e11d12 100644
> > --- a/qemu/cache-utils.h
> > +++ b/qemu/cache-utils.h
> > @@ -33,8 +33,22 @@ static inline void flush_icache_range(unsigned long
> start, unsigned long stop)
> >      asm volatile ("sync" : : : "memory");
> >      asm volatile ("isync" : : : "memory");
> >  }
> > +#define qemu_sync_idcache flush_icache_range
> > +#else
> >
> > +#ifdef __ia64__
> > +static inline void qemu_sync_idcache(unsigned long start, unsigned long
> stop)
> > +{
> > +    while (start < stop) {
> > +	    asm volatile ("fc %0" :: "r"(start));
> > +	    start += 32;
> > +    }
> > +    asm volatile (";;sync.i;;srlz.i;;");
> > +}
> >

As I hit the same issue a year ago, here is my understanding:

> What about smp?

fc will broadcast to the coherence domain the cache invalidation.  So it is
SMP-ready for usual machines.

> I'm surprised the guest doesn't do this by itself?

It doesn't had to do it.  The PCI transaction will automatically invalidate
caches - but qemu doesn't emulate this (and doesn't need to do on x86).

Tristan.

  reply	other threads:[~2009-04-02 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02  2:01 [PATCH] KVM: Qemu: Flush i-cache after ide-dma operation in IA64 Zhang, Yang
2009-04-02  8:55 ` Avi Kivity
2009-04-02 15:41   ` tgingold [this message]
2009-04-02 15:53     ` Avi Kivity
2009-04-02 15:59       ` Avi Kivity
2009-04-03  1:22         ` Zhang, Xiantao
2009-04-03  1:13       ` Zhang, Xiantao
2009-04-03  1:31   ` Zhang, Xiantao
2009-04-03 11:06     ` Avi Kivity
2009-04-06 16:31 ` Hollis Blanchard

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=1238686878.49d4dc9e051aa@imp.free.fr \
    --to=tgingold@free.fr \
    --cc=avi@redhat.com \
    --cc=kvm-ia64@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=xiantao.zhang@intel.com \
    --cc=yang.zhang@intel.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