* RAM bank with features
@ 2011-01-28 14:28 Sergey Mironov
2011-01-28 14:46 ` Russell King - ARM Linux
0 siblings, 1 reply; 3+ messages in thread
From: Sergey Mironov @ 2011-01-28 14:28 UTC (permalink / raw)
To: linux-arm-kernel
Hello, community. I am porting Linux to arm1176-based SoC. Our system
has 2 RAM banks. First one (EM0) is quite common, but another (EM1)
has some "features" :
1) Critical one. There are devices that can't use DMA buffers outside EM1.
2) CPU can read and write to it, but can't execute instructions.
What is the finest way of implementing those restrictions? I thought
about defining custom memory zone, but I can't see how to link zones
with platform_device.dev.dma_mask.
Also, is it possible to allocate user pages from EM1 but prevent users
from executing code from them? Say, tell allocator to mark them with
L_PTE_* flag?
Thanks,
Sergey.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RAM bank with features
2011-01-28 14:28 RAM bank with features Sergey Mironov
@ 2011-01-28 14:46 ` Russell King - ARM Linux
2011-01-29 15:16 ` Sergey Mironov
0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2011-01-28 14:46 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 28, 2011 at 05:28:29PM +0300, Sergey Mironov wrote:
> Hello, community. I am porting Linux to arm1176-based SoC. Our system
> has 2 RAM banks. First one (EM0) is quite common, but another (EM1)
> has some "features" :
> 1) Critical one. There are devices that can't use DMA buffers outside EM1.
> 2) CPU can read and write to it, but can't execute instructions.
>
> What is the finest way of implementing those restrictions? I thought
> about defining custom memory zone, but I can't see how to link zones
> with platform_device.dev.dma_mask.
Sigh. When will hardware people get the idea that adding silly
restrictions just makes things impossible.
1. You can't restrict the system such that code only executes from EM0
and still use EM1 in the general memory pool.
2. You can only restrict DMA buffers from physical address zero to a
limit determined by a bitmask in Linux. If this means EM1 is at
a lower physical address, you lose.
I think your best solution is going to be to totally ignore EM1, and tell
the hardware people that they're being silly. It's really not worth the
hastle.
> Also, is it possible to allocate user pages from EM1 but prevent users
> from executing code from them? Say, tell allocator to mark them with
> L_PTE_* flag?
How would userspace programs execute their code if their pages were
allocated from EM1?
^ permalink raw reply [flat|nested] 3+ messages in thread
* RAM bank with features
2011-01-28 14:46 ` Russell King - ARM Linux
@ 2011-01-29 15:16 ` Sergey Mironov
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Mironov @ 2011-01-29 15:16 UTC (permalink / raw)
To: linux-arm-kernel
2011/1/28 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Fri, Jan 28, 2011 at 05:28:29PM +0300, Sergey Mironov wrote:
>> Hello, community. I am porting Linux to arm1176-based SoC. Our system
>> has 2 RAM banks. First one (EM0) is quite common, but another (EM1)
>> has some "features" :
>> 1) Critical one. There are devices that can't use DMA buffers outside EM1.
>> 2) CPU can read and write to it, but can't execute instructions.
>>
>> What is the finest way of implementing those restrictions? I thought
>> about defining custom memory zone, but I can't see how to link zones
>> with platform_device.dev.dma_mask.
>
> Sigh. ?When will hardware people get the idea that adding silly
> restrictions just makes things impossible.
>
> 1. You can't restrict the system such that code only executes from EM0
> ? and still use EM1 in the general memory pool.
>
> 2. You can only restrict DMA buffers from physical address zero to a
> ? limit determined by a bitmask in Linux. ?If this means EM1 is at
> ? a lower physical address, you lose.
>
> I think your best solution is going to be to totally ignore EM1, and tell
> the hardware people that they're being silly. ?It's really not worth the
> hastle.
>
>> Also, is it possible to allocate user pages from EM1 but prevent users
>> from executing code from them? Say, tell allocator to mark them with
>> L_PTE_* flag?
>
> How would userspace programs execute their code if their pages were
> allocated from EM1?
>
Thanks for answer. Yes, ignoring EM1 was my very first attempt, but
DMA restrictions force me to use this bank. I just have to do it to
work with some devices. Fortunately 1) those devices are all custom
(that is I am the person who is responsible for their drivers and thus
I probably can make static mappings from EM1 to virtual mem range and
pass addresses with platform_data). 2) EM1 has higher addresses than
EM0, so I may try bitmask solution too. What I told about custom zones
is bad idea as I think now.
Read-write-only user pages in EM1 - well, looks like it is truly impossible..
Thanks again!
Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-29 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-28 14:28 RAM bank with features Sergey Mironov
2011-01-28 14:46 ` Russell King - ARM Linux
2011-01-29 15:16 ` Sergey Mironov
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).