qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Brad <brad@comstyle.com>
To: malc <av1474@comtv.ru>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] Add ppc_init_cacheline_sizes() function for OpenBSD.
Date: Thu, 26 May 2011 19:32:13 -0400	[thread overview]
Message-ID: <4DDEE2FD.2010405@comstyle.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1105261714210.1988@linmac>

On 26/05/11 9:15 AM, malc wrote:
> On Thu, 26 May 2011, Brad wrote:
>
>> ----- Original message -----
>>> On Wed, 25 May 2011, Brad wrote:
>>>
>>>> Add ppc_init_cacheline_sizes() function for OpenBSD to fix compilation
>>>> of PowerPC host support for OpenBSD/powerpc based architectures.
>>>>
>>>> Signed-off-by: Brad Smith<brad@comstyle.com>
>>>>
>>>> ---
>>>> cache-utils.c |     11 +++++++++--
>>>> 1 files changed, 9 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/cache-utils.c b/cache-utils.c
>>>> index 2db5af2..c319705 100644
>>>> --- a/cache-utils.c
>>>> +++ b/cache-utils.c
>>>> @@ -55,9 +55,16 @@ static void ppc_init_cacheline_sizes(void)
>>>> qemu_cache_conf.icache_bsize = cacheline;
>>>> }
>>>> }
>>>> -#endif
>>>>
>>>> -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>>>> +#elif defined(__OpenBSD__)
>>>> +
>>>> +static void ppc_init_cacheline_sizes(void)
>>>> +{
>>>> +       qemu_cache_conf.dcache_bsize = 32;
>>>> +       qemu_cache_conf.icache_bsize = 32;
>>>> +}
>>>> +
>>>> +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>>>> #include<errno.h>
>>>> #include<stdio.h>
>>>> #include<stdlib.h>
>>>>
>>>
>>> This can't be right for most ppc64's.
>>
>> Well this is what OpenBSD currently does and runs on G5's in 32-bit mode only.
>>
>
> Mode of operation does not, to the best of my knowledge, change the
> hardware limits, the cache line size will still be 128 on those G5s.

Well this is the behavior of our kernel no matter what the CPU type is.

from sys/arch/powerpc/cpu.h..


#define CACHELINE       32              /* Note that this value is 
really hardwired */


static __inline void
syncicache(void *from, int len)
{
	int l;
	char *p = from;

	len = len + (((u_int32_t) from) & (CACHELINESIZE - 1));
	l = len;

	do {
		__asm __volatile ("dcbst 0,%0" :: "r"(p));
		p += CACHELINESIZE;
	} while ((l -= CACHELINESIZE) > 0);
	__asm __volatile ("sync");
	p = from;
	l = len;
	do {
		__asm __volatile ("icbi 0,%0" :: "r"(p));
		p += CACHELINESIZE;
	} while ((l -= CACHELINESIZE) > 0);
	__asm __volatile ("isync");
}

static __inline void
invdcache(void *from, int len)
{
	int l;
	char *p = from;

	len = len + (((u_int32_t) from) & (CACHELINESIZE - 1));
	l = len;

	do {
		__asm __volatile ("dcbi 0,%0" :: "r"(p));
		p += CACHELINESIZE;
	} while ((l -= CACHELINESIZE) > 0);
	__asm __volatile ("sync");
}

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

  reply	other threads:[~2011-05-26 23:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  3:05 [Qemu-devel] [PATCH 1/3] Add ppc_init_cacheline_sizes() function for OpenBSD Brad
2011-05-26 11:21 ` malc
2011-05-26 12:58   ` Brad
2011-05-26 13:15     ` malc
2011-05-26 23:32       ` Brad [this message]
2011-05-27  0:20         ` malc
2011-05-29 16:56           ` Brad

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=4DDEE2FD.2010405@comstyle.com \
    --to=brad@comstyle.com \
    --cc=av1474@comtv.ru \
    --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 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).