linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mmap KSEG1
@ 2009-12-04 17:52 Ed Okerson
  2009-12-04 18:12 ` David Daney
  2009-12-04 18:33 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Ed Okerson @ 2009-12-04 17:52 UTC (permalink / raw)
  To: linux-mips

Is it possible to mmap an address in KSEG1 so a user space app can
read/write to an IO device uncached?

Ed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mmap KSEG1
  2009-12-04 17:52 mmap KSEG1 Ed Okerson
@ 2009-12-04 18:12 ` David Daney
  2009-12-04 18:33 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: David Daney @ 2009-12-04 18:12 UTC (permalink / raw)
  To: Ed Okerson; +Cc: linux-mips

Ed Okerson wrote:
> Is it possible to mmap an address in KSEG1 so a user space app can
> read/write to an IO device uncached?
> 

It depends on your definition of 'possible'.  The mips32/64 architecture 
specification has a 'C' field in the EntryLo register that controls 
cachability, so given an appropriate device driver it should be doable.

Calling  __ioremap() with the appropriate flags should allow you to set 
the 'C' bits.

Depending on your requirements, you might be able to get by using 
/dev/mem and some 'sync' instructions, instead of establishing an 
uncached mapping.


David Daney

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mmap KSEG1
  2009-12-04 17:52 mmap KSEG1 Ed Okerson
  2009-12-04 18:12 ` David Daney
@ 2009-12-04 18:33 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2009-12-04 18:33 UTC (permalink / raw)
  To: Ed Okerson; +Cc: linux-mips

On Fri, Dec 04, 2009 at 11:52:03AM -0600, Ed Okerson wrote:
> Is it possible to mmap an address in KSEG1 so a user space app can
> read/write to an IO device uncached?

well not exactly to KSEG1, since that is kernel exclusive address space,
but it's possible to map the physical address of the device:

Try

fd = open("/dev/mem", O_RDWR|O_SYNC);
io = mmap (NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, ioaddr);

where ioaddr is the physical address of the io device.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-04 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-04 17:52 mmap KSEG1 Ed Okerson
2009-12-04 18:12 ` David Daney
2009-12-04 18:33 ` Thomas Bogendoerfer

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).