[Top] [All Lists]

Re: is there dummy r/w in mips kernel API

To: loody <>
Subject: Re: is there dummy r/w in mips kernel API
From: Alan Stern <>
Date: Sun, 2 Jan 2011 09:49:01 -0500 (EST)
Cc: Linux MIPS Mailing List <>, <>
In-reply-to: <>
Original-recipient: rfc822;
On Sun, 2 Jan 2011, loody wrote:

> Dear all:
> I am trying porting usb on mips platform.
> Due to hw limitation, I have to do the dummy read to make sure data
> has been written to the memory, so I announce an volatile parameter,
> tmp, such that cpu will read the same address back to me.
> Below is what I try to do in usb driver:
>                         wmb ();
>     389c:       0000000f        sync
>                         dummy->hw_token = token;
>     38a0:       ae740008        sw      s4,8(s3)
>                         tmp = dummy->hw_token;
>     38a4:       afb40010        sw      s4,16(sp)
> as you can see, the compiler is so smart that he read the register
> content instead of re-read the memory for accelerating the read speed.
> unfortunately, that isn't I want. Is there already exist kernel API can help 
> me?
> appreciate your help,

You can try doing:

                tmp = ACCESS_ONCE(dummy->hw_token);

Alan Stern

<Prev in Thread] Current Thread [Next in Thread>