All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Maurizio Caloro <mauric@gmx.ch>,
	qemu-devel@nongnu.org, Brad Smith <brad@comstyle.com>
Subject: Re: [Qemu-devel] Help - `flush_icache_range' MacPPC
Date: Wed, 8 Feb 2012 17:54:33 -0600	[thread overview]
Message-ID: <4F330B39.5050609@freescale.com> (raw)
In-Reply-To: <6904B6A7-A433-4661-BDB6-A9803F666F6D@suse.de>

On 02/08/2012 05:42 PM, Alexander Graf wrote:
> 
> On 09.02.2012, at 00:29, Scott Wood wrote:
> 
>> On 02/07/2012 04:57 PM, Alexander Graf wrote:
>>> Eh, this patch:
>>>
>>> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
>>> index f5d9bf3..f9793e6 100644
>>> --- a/tcg/ppc/tcg-target.c
>>> +++ b/tcg/ppc/tcg-target.c
>>> @@ -1260,6 +1260,17 @@ static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args,
>>>     tcg_out_bc (s, (BC | BI (7, CR_EQ) | BO_COND_TRUE), args[5]);
>>> }
>>>
>>> +#ifdef __NetBSD__
>>> +static void flush_icache_range(unsigned long begin, unsigned long end)
>>> +{
>>> +    unsigned int i = begin & ~15UL;
>>> +    for (; i < end; i+=16) {
>>> +        asm("icbi 0,%0" : : "r"(i));
>>> +    }
>>> +    asm("isync");
>>> +}
>>> +#endif
>>
>> What about flushing the data cache first, as the other
>> flush_icache_range does?
> 
> I actually wrote this one from scratch. Ahem.
> 
> So why are we flushing the dcache on the other one? Does the icache
> always fill from memory or can it check if something's in the dcache
> and fetch it from there? If it's the former, then a dcache flush is
> crucial, right.

The icache is allowed to fill directly from memory, without snooping
dcache.  Where it actually fetches from and whether it snoops any data
cache is implementation-dependent.  On our implementations, instruction
fetches do not snoop data cache.  The fetch could hit in main memory, or
in a shared cache such as L3/CPC (e500mc) or L2 (e500v2).

>> Why isn't the cache-utils.h version of flush_icache_range being seen?
>> It's only ppc_init_cacheline_sizes() that is OS-conditional -- shouldn't
>> that be what the undefined reference is for?  Is _ARCH_PPC failing to be
>> defined?
> 
> Oh, there is a cache flush function already there! Hah! I completely missed out on that one.
> 
> I would assume it's either because _ARCH_PPC is failing to be picked
> up (include order?) or because the header file is just not included.
> My motivation in digging into ppc NetBSD issues is rather small
> though.

It looks like GCC sets _ARCH_PPC.  Apparently this isn't happening on
this user's toolchain.

-Scott

  reply	other threads:[~2012-02-08 23:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 12:52 [Qemu-devel] Help - `flush_icache_range' MacPPC Maurizio Caloro
2012-02-07 18:03 ` malc
2012-02-07 20:01 ` Alexander Graf
2012-02-07 21:12   ` malc
2012-02-07 22:05     ` Alexander Graf
2012-02-07 22:12       ` malc
2012-02-07 22:22         ` Alexander Graf
2012-02-07 22:29         ` Brad Smith
2012-02-07 22:33           ` Alexander Graf
2012-02-07 22:56           ` Alexander Graf
2012-02-07 22:57           ` Alexander Graf
2012-02-07 23:57             ` Maurizio Caloro
2012-02-08 23:29             ` Scott Wood
2012-02-08 23:42               ` Alexander Graf
2012-02-08 23:54                 ` Scott Wood [this message]
2012-02-08 23:58                   ` Alexander Graf

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=4F330B39.5050609@freescale.com \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=brad@comstyle.com \
    --cc=mauric@gmx.ch \
    --cc=qemu-devel@nongnu.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.