Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Mile Davidovic <Mile.Davidovic@micronasnit.com>
Cc: linux-mips@linux-mips.org
Subject: Re: Uncached mmap
Date: Mon, 13 Nov 2006 16:40:54 +0000	[thread overview]
Message-ID: <20061113164054.GA31476@linux-mips.org> (raw)
In-Reply-To: <002101c70738$a4974ad0$5c00a8c0@niit.micronasnit.com>

On Mon, Nov 13, 2006 at 04:30:26PM +0100, Mile Davidovic wrote:

> ptr = (unsigned char*)mmap(0,lineSize,PROT_READ|PROT_WRITE,MAP_SHARED,fd0,0);
> ...
> for (i = 0; i < 12; i++) 
>    *ptr++ = 0xaa;
> 
> this loop will not write all bytes correctly (every 4 bytes will have 0xaa as
> value), here is dump from Lauterbach debugger:
> ___address__|_0________4________8________C________0123456789ABCDEF
>   D:83660000|>FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF ................
>   D:83660010| 000000AA 000000AA 000000AA 0000AA02 ................

Is 83660000 a proper physical address or a virtual address?  A common
mistake is mapping a KSEG _virtual_ address to a userspace _virtual_
address.  Obviously mapping anything virtual to something else virtual
doesn't work ...

> and if I use bigger loop
> for (i = 0; i < 20; i++) 
>    *ptr++ = 0xaa;
> My linux will be crashed on 13 write. So, this is reason why I thought that
> byte access is not allowed on mmaped uncached memory. 

Let me guess, you filled up some write queue which now is waiting for
an acknowledge which never arrives.

> Is it possible that problem with byte access is related with device mmap
> function?

That is fairly simple code.

  Ralf

  parent reply	other threads:[~2006-11-13 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-13  9:18 Uncached mmap Mile Davidovic
2006-11-13  9:18 ` Mile Davidovic
2006-11-13 12:32 ` Ralf Baechle
2006-11-13 15:30   ` Mile Davidovic
2006-11-13 15:30     ` Mile Davidovic
2006-11-13 16:40     ` Ralf Baechle [this message]
2006-11-14 10:58       ` Mile Davidovic
2006-11-14 10:58         ` Mile Davidovic
2006-11-14 11:07         ` Mile Davidovic
2006-11-14 11:07           ` Mile Davidovic

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=20061113164054.GA31476@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=Mile.Davidovic@micronasnit.com \
    --cc=linux-mips@linux-mips.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