kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Can we map a device address to two different memory locations?
@ 2011-05-27 10:49 sandeep kumar
  2011-05-27 15:34 ` Daniel Baluta
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: sandeep kumar @ 2011-05-27 10:49 UTC (permalink / raw)
  To: kernelnewbies

Hi all,
Memory mapping is done so that CPU can access the devices, which it cant
unless.

Now the question is can we memory map a one device resource(say some
iomemory) to two different memory locations?
the other way of seeing at this question is,
Will ioremap() gives different 'virtual addresses' when called multiple
times?

Please give reply..

-- 
With regards,
Sandeep Kumar Anantapalli,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110527/7b661180/attachment.html 

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

* Can we map a device address to two different memory locations?
  2011-05-27 10:49 Can we map a device address to two different memory locations? sandeep kumar
@ 2011-05-27 15:34 ` Daniel Baluta
  2011-05-27 17:24 ` Mulyadi Santosa
  2011-05-28 12:24 ` Peter Teoh
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel Baluta @ 2011-05-27 15:34 UTC (permalink / raw)
  To: kernelnewbies

On Fri, May 27, 2011 at 1:49 PM, sandeep kumar
<coolsandyforyou@gmail.com> wrote:
> Hi all,
> Memory mapping is done so that CPU can access the devices, which it cant
> unless.
>
> Now the question is can we memory map a one device resource(say some
> iomemory) to two different memory locations?
> the other way of seeing at this question is,
> Will ioremap() gives different 'virtual addresses' when called multiple
> times?

I can't see any reasons for which you can't do that.
The best way to find out, is to try it.

thanks,
Daniel.

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

* Can we map a device address to two different memory locations?
  2011-05-27 10:49 Can we map a device address to two different memory locations? sandeep kumar
  2011-05-27 15:34 ` Daniel Baluta
@ 2011-05-27 17:24 ` Mulyadi Santosa
  2011-05-27 17:48   ` anish singh
  2011-05-28 12:24 ` Peter Teoh
  2 siblings, 1 reply; 6+ messages in thread
From: Mulyadi Santosa @ 2011-05-27 17:24 UTC (permalink / raw)
  To: kernelnewbies

Hi...

On Fri, May 27, 2011 at 17:49, sandeep kumar <coolsandyforyou@gmail.com> wrote:
> Now the question is can we memory map a one device resource(say some
> iomemory) to two different memory locations?
> the other way of seeing at this question is,
> Will ioremap() gives different 'virtual addresses' when called multiple
> times?

I agree with Daniel, but I suggest you to think about it: in reading
operation, maybe it's ok, no concurrency issues need to be taken
care...but how about writing? unless we're sure they are atomically or
uninterruptible, i see a chance that race condition might happen here.

Actually it's similar when you map a file into two different VMA and
write into it, correct?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

* Can we map a device address to two different memory locations?
  2011-05-27 17:24 ` Mulyadi Santosa
@ 2011-05-27 17:48   ` anish singh
  2011-05-27 18:01     ` Mulyadi Santosa
  0 siblings, 1 reply; 6+ messages in thread
From: anish singh @ 2011-05-27 17:48 UTC (permalink / raw)
  To: kernelnewbies

On Fri, May 27, 2011 at 10:54 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com
> wrote:

> Hi...
>
> On Fri, May 27, 2011 at 17:49, sandeep kumar <coolsandyforyou@gmail.com>
> wrote:
> > Now the question is can we memory map a one device resource(say some
> > iomemory) to two different memory locations?
> > the other way of seeing at this question is,
> > Will ioremap() gives different 'virtual addresses' when called multiple
> > times?
>
> I agree with Daniel, but I suggest you to think about it: in reading
> operation, maybe it's ok, no concurrency issues need to be taken
> care...but how about writing? unless we're sure they are atomically or
> uninterruptible, i see a chance that race condition might happen here.
>
> Actually it's similar when you map a file into two different VMA and
> write into it, correct?
>
Don't you think it would also be reducing the memory map space in RAM
which is a critical resource and many other drivers would be denied
the mapping of there IO resources?
--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110527/c2a691aa/attachment.html 

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

* Can we map a device address to two different memory locations?
  2011-05-27 17:48   ` anish singh
@ 2011-05-27 18:01     ` Mulyadi Santosa
  0 siblings, 0 replies; 6+ messages in thread
From: Mulyadi Santosa @ 2011-05-27 18:01 UTC (permalink / raw)
  To: kernelnewbies

On Sat, May 28, 2011 at 00:48, anish singh <anish198519851985@gmail.com> wrote:
>
>
> On Fri, May 27, 2011 at 10:54 PM, Mulyadi Santosa
> <mulyadi.santosa@gmail.com> wrote:
>>
>> Hi...
>>
>> On Fri, May 27, 2011 at 17:49, sandeep kumar <coolsandyforyou@gmail.com>
>> wrote:
>> > Now the question is can we memory map a one device resource(say some
>> > iomemory) to two different memory locations?
>> > the other way of seeing at this question is,
>> > Will ioremap() gives different 'virtual addresses' when called multiple
>> > times?
>>
>> I agree with Daniel, but I suggest you to think about it: in reading
>> operation, maybe it's ok, no concurrency issues need to be taken
>> care...but how about writing? unless we're sure they are atomically or
>> uninterruptible, i see a chance that race condition might happen here.
>>
>> Actually it's similar when you map a file into two different VMA and
>> write into it, correct?
>
> Don't you think it would also be reducing the memory map space in RAM
> which is a critical resource and many other?drivers?would be denied
> the mapping of there IO resources?

Yeah, I agree too

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

* Can we map a device address to two different memory locations?
  2011-05-27 10:49 Can we map a device address to two different memory locations? sandeep kumar
  2011-05-27 15:34 ` Daniel Baluta
  2011-05-27 17:24 ` Mulyadi Santosa
@ 2011-05-28 12:24 ` Peter Teoh
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Teoh @ 2011-05-28 12:24 UTC (permalink / raw)
  To: kernelnewbies

the concept of "remap" is to map again, thus, if u call ioremap()
multiple times, u will just remove the previous mapping setup.   This
is implied in the source for ioremap() - delved down all the way to
where the PTE is setup.   the reason for this is because the MMU
translation process is hardware-based - each page table can only map
from one physical memory to another virtual memory, based on the PTE
values.   but it is possible to have same physical address mapping to
the different virtual address - but definitely not for kernel virtual
address, (which thus eliminate IO addresses) - the page tables have to
be different.   this is because all kernel virtual addresses share the
same page table.

more info:

http://www.kernel.org/doc/gorman/html/understand/understand006.html

On Fri, May 27, 2011 at 6:49 PM, sandeep kumar
<coolsandyforyou@gmail.com> wrote:
> Hi all,
> Memory mapping is done so that CPU can access the devices, which it cant
> unless.
>
> Now the question is can we memory map a one device resource(say some
> iomemory) to two different memory locations?
> the other way of seeing at this question is,
> Will ioremap() gives different 'virtual addresses' when called multiple
> times?
>
> Please give reply..
>
> --
> With regards,
> Sandeep Kumar Anantapalli,
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
Regards,
Peter Teoh

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

end of thread, other threads:[~2011-05-28 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-27 10:49 Can we map a device address to two different memory locations? sandeep kumar
2011-05-27 15:34 ` Daniel Baluta
2011-05-27 17:24 ` Mulyadi Santosa
2011-05-27 17:48   ` anish singh
2011-05-27 18:01     ` Mulyadi Santosa
2011-05-28 12:24 ` Peter Teoh

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