linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hendricks <khendricks@ivey.uwo.ca>
To: Kostas Gewrgiou <gewrgiou@imbc.gr>
Cc: Michel Danzer <michdaen@iiic.ethz.ch>, linuxppc-dev@lists.linuxppc.org
Subject: Re: patch to get latest XFree 4.0 snapshot (xf3918) to work on pp cwith r128
Date: Wed, 8 Mar 2000 21:41:22 -0500	[thread overview]
Message-ID: <00030821502900.00501@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.21.0003052134430.12030-100000@idd-01.imbc.gr>


Hi Kostas,

There are three interesing tidbits about cache flushing.  One I picked up
recently on the  glibc apha and/or hacker mailing lists.

1. It seems some (many?) embedded ppc systems running linux do not have a cache
line size of 32! It is 8 or 16 or something funny.

2. AFAIK, cache flushing should never cause seg-faults since the associative
array used by the cache will ignore any address ranges not already in the cache.
If that page was never loaded it will not be in the cache.

3. 601 processors may barf(?) on some of these instructions.

So here is a piece of code I always steal when needing to do similar cache
flushing for the jdk and the metrowerks jit.  It is taken from the kernel
arch/ppc/kernel/head.S

I don't think we can access the machine type register in user space (but I am
very unsure about that).

/*
 * Write any modified data cache blocks out to memory
 * and invalidate the corresponding instruction cache blocks.
 * This is a no-op on the 601.
 *
 * flush_icache_range(unsigned long start, unsigned long stop)
 */
_GLOBAL(flush_icache_range)

	mfspr	r5,PVR
	rlwinm	r5,r5,16,16,31
	cmpi	0,r5,1
	beqlr				/* for 601, do nothing */

	li	r5,CACHE_LINE_SIZE-1
	andc	r3,r3,r5
	subf	r4,r3,r4
	add	r4,r4,r5
	srwi.	r4,r4,LG_CACHE_LINE_SIZE
	beqlr
	mtctr	r4
	mr	r6,r3
1:	dcbst	0,r3
	addi	r3,r3,CACHE_LINE_SIZE
	bdnz	1b
	sync				/* wait for dcbst's to get to ram */
	mtctr	r4
2:	icbi	0,r6
	addi	r6,r6,CACHE_LINE_SIZE
	bdnz	2b
	sync
	isync
	blr



I have no idea if the cacheline size and processor values are made available by
the kernel during runtime so that we could use those values.

I will try your changes and let you know.

Thanks,

Kevin


--
Kevin B. Hendricks Associate Professor of Operations and Information Technology
Richard Ivey School of Business, University of Western Ontario London, Ontario
N6A-3K7  CANADA    khendricks@ivey.uwo.ca, (519) 661-3874, fax: 519-661-3959

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  parent reply	other threads:[~2000-03-09  2:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.21.0003041753480.1870-100000@idd-01.imbc.gr>
2000-03-04 18:55 ` patch to get latest XFree 4.0 snapshot (xf3918) to work on pp cwith r128 Kevin Hendricks
2000-03-05 13:42   ` Michel Dänzer
2000-03-05 16:43     ` Kostas Gewrgiou
2000-03-05 16:58       ` Kevin B. Hendricks
2000-03-05 21:04         ` Kostas Gewrgiou
2000-03-05 21:20           ` Geert Uytterhoeven
2000-03-05 22:25             ` Kostas Gewrgiou
2000-03-06  6:54               ` Geert Uytterhoeven
2000-03-09  3:11               ` Kevin Hendricks
     [not found]                 ` <38C7A016.8C2ED4C8@iiic.ethz.ch>
     [not found]                   ` <v03110701b562ab7246aa@[129.100.29.243]>
2000-03-10 15:33                     ` patch to get latest XFree 4.0 snapshot (xf3918) to work on pp cwithr128 Kevin B. Hendricks
2000-03-10 17:25                       ` Kostas Gewrgiou
2000-03-10 18:17                         ` Kevin B. Hendricks
2000-03-10 19:21                           ` Michael Schmitz
2000-03-10 23:54                             ` patch to get latest XFree 4.0 snapshot (xf3918) to work on ppcwithr128 Michel Dänzer
2000-03-11 14:50                               ` Michael Schmitz
2000-03-12 14:52                                 ` patch to get latest XFree 4.0 snapshot (xf3918) to work onppcwithr128 Michel Dänzer
2000-03-10 19:43                       ` patch to get latest XFree 4.0 snapshot (xf3918) to work on pp cwithr128 David A. Gatwood
2000-03-11 14:38               ` Help! Getting aty128fb.c to work with newest sawtooth machines Kevin Hendricks
2000-03-13  9:19                 ` Kostas Gewrgiou
2000-03-14  1:12               ` patch to get latest XFree 4.0 snapshot (xf3918) to work on pp cwith r128 Kevin Hendricks
2000-03-09  2:41           ` Kevin Hendricks [this message]
2000-03-09 11:04             ` Gabriel Paubert
     [not found] <v03110700b562a526cc14@[129.100.29.243]>
2000-03-09 16:31 ` David A. Gatwood
2000-03-10 12:48   ` Gabriel Paubert
2000-03-10 13:14     ` Benjamin Herrenschmidt
2000-03-10 19:39     ` David A. Gatwood
2000-03-11 15:39       ` Gabriel Paubert

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=00030821502900.00501@localhost.localdomain \
    --to=khendricks@ivey.uwo.ca \
    --cc=gewrgiou@imbc.gr \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=michdaen@iiic.ethz.ch \
    /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).