2006-11-27 16:31:24

by Jon Ringle

[permalink] [raw]
Subject: Reserving a fixed physical address page of RAM.

Hi,

I need to reserve a page of memory at a specific area of RAM that will
be used as a "shared memory" with another processor over PCI. How can I
ensure that the this area of RAM gets reseved so that the Linux's memory
management (kmalloc() and friends) don't use it?

Some things that I've considered are iotable_init() and ioremap().
However, I've seen these used for memory mapped IO devices which are
outside of the RAM memory. Can I use them for reseving RAM too?

I appreciate any advice in this regard.

Thanks,

Jon


2006-11-28 00:39:56

by Robert Hancock

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

Jon Ringle wrote:
> Hi,
>
> I need to reserve a page of memory at a specific area of RAM that will
> be used as a "shared memory" with another processor over PCI. How can I
> ensure that the this area of RAM gets reseved so that the Linux's memory
> management (kmalloc() and friends) don't use it?
>
> Some things that I've considered are iotable_init() and ioremap().
> However, I've seen these used for memory mapped IO devices which are
> outside of the RAM memory. Can I use them for reseving RAM too?
>
> I appreciate any advice in this regard.

Sounds to me like dma_alloc_coherent is what you want..

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/

2006-11-28 03:36:21

by Jon Ringle

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

Robert Hancock wrote:
> Jon Ringle wrote:
>> Hi,
>>
>> I need to reserve a page of memory at a specific area of RAM that will
>> be used as a "shared memory" with another processor over PCI. How can I
>> ensure that the this area of RAM gets reseved so that the Linux's memory
>> management (kmalloc() and friends) don't use it?
>>
>> Some things that I've considered are iotable_init() and ioremap().
>> However, I've seen these used for memory mapped IO devices which are
>> outside of the RAM memory. Can I use them for reseving RAM too?
>>
>> I appreciate any advice in this regard.
>
> Sounds to me like dma_alloc_coherent is what you want..
>
It looks promising, however, I need to reserve a physical address area
that is well known (so that the code running on the other processor
knows where in PCI memory to write to). It appears that
dma_alloc_coherent returns the address that it allocated. Instead I need
something where I can tell it what physical address and range I want to use.

Jon

2006-11-28 05:21:05

by Robert Hancock

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

Jon Ringle wrote:
> Robert Hancock wrote:
>> Jon Ringle wrote:
>>> Hi,
>>>
>>> I need to reserve a page of memory at a specific area of RAM that will
>>> be used as a "shared memory" with another processor over PCI. How can I
>>> ensure that the this area of RAM gets reseved so that the Linux's memory
>>> management (kmalloc() and friends) don't use it?
>>>
>>> Some things that I've considered are iotable_init() and ioremap().
>>> However, I've seen these used for memory mapped IO devices which are
>>> outside of the RAM memory. Can I use them for reseving RAM too?
>>>
>>> I appreciate any advice in this regard.
>>
>> Sounds to me like dma_alloc_coherent is what you want..
>>
> It looks promising, however, I need to reserve a physical address area
> that is well known (so that the code running on the other processor
> knows where in PCI memory to write to). It appears that
> dma_alloc_coherent returns the address that it allocated. Instead I need
> something where I can tell it what physical address and range I want to
> use.

I don't think this is possible in the general case, as there's no
mechanism for moving things out of the way if they might be in use. Your
best solution is likely to use dma_alloc_coherent and pass the bus
address returned into the other processor to tell it where to write..

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/


2006-11-28 05:34:31

by Dave Airlie

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

On 11/28/06, Jon Ringle <[email protected]> wrote:
> Robert Hancock wrote:
> > Jon Ringle wrote:
> >> Hi,
> >>
> >> I need to reserve a page of memory at a specific area of RAM that will
> >> be used as a "shared memory" with another processor over PCI. How can I
> >> ensure that the this area of RAM gets reseved so that the Linux's memory
> >> management (kmalloc() and friends) don't use it?
> >>
> >> Some things that I've considered are iotable_init() and ioremap().
> >> However, I've seen these used for memory mapped IO devices which are
> >> outside of the RAM memory. Can I use them for reseving RAM too?
> >>
> >> I appreciate any advice in this regard.
> >
> > Sounds to me like dma_alloc_coherent is what you want..
> >
> It looks promising, however, I need to reserve a physical address area
> that is well known (so that the code running on the other processor
> knows where in PCI memory to write to). It appears that
> dma_alloc_coherent returns the address that it allocated. Instead I need
> something where I can tell it what physical address and range I want to use.
>

I've seen other projects just boot a 128M board with mem=120M and just
use the 8MB at 120 to talk to the other processor..

Dave.

2006-11-28 06:51:44

by Fawad Lateef

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

On 11/28/06, Dave Airlie <[email protected]> wrote:
> On 11/28/06, Jon Ringle <[email protected]> wrote:
<snip>
> > It looks promising, however, I need to reserve a physical address area
> > that is well known (so that the code running on the other processor
> > knows where in PCI memory to write to). It appears that
> > dma_alloc_coherent returns the address that it allocated. Instead I need
> > something where I can tell it what physical address and range I want to use.
> >
>
> I've seen other projects just boot a 128M board with mem=120M and just
> use the 8MB at 120 to talk to the other processor..
>

Yes, this can be used if required physical-memory exists in the last
part of RAM as if you use mem=<xxxM> then kernel will only use memory
less than or equal-to <xxxM> and above can be used by drivers (or any
kernel module) might be through ioremap which takes physical-address.

But if lets say we need only 1MB portion of specific physical-memory
region then AFAIK it must be done by hacking in kernel code during
memory-initialization (mem_init function) where it is marking/checking
pages as/are reserved; you can simply mark you required pages as
reserved too and set their count to some-value if you want to know
later which pages are reserved by you. (can do this reservation work
here: http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
CMIIW


--
Fawad Lateef

2006-11-28 10:14:46

by Jesper Juhl

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

On 28/11/06, Fawad Lateef <[email protected]> wrote:
> On 11/28/06, Dave Airlie <[email protected]> wrote:
> > On 11/28/06, Jon Ringle <[email protected]> wrote:
> <snip>
> > > It looks promising, however, I need to reserve a physical address area
> > > that is well known (so that the code running on the other processor
> > > knows where in PCI memory to write to). It appears that
> > > dma_alloc_coherent returns the address that it allocated. Instead I need
> > > something where I can tell it what physical address and range I want to use.
> > >
> >
> > I've seen other projects just boot a 128M board with mem=120M and just
> > use the 8MB at 120 to talk to the other processor..
> >
>
> Yes, this can be used if required physical-memory exists in the last
> part of RAM as if you use mem=<xxxM> then kernel will only use memory
> less than or equal-to <xxxM> and above can be used by drivers (or any
> kernel module) might be through ioremap which takes physical-address.
>
> But if lets say we need only 1MB portion of specific physical-memory
> region then AFAIK it must be done by hacking in kernel code during
> memory-initialization (mem_init function) where it is marking/checking
> pages as/are reserved; you can simply mark you required pages as
> reserved too and set their count to some-value if you want to know
> later which pages are reserved by you. (can do this reservation work
> here: http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
> CMIIW
>

Can you not use the 'memmap=' kernel option to reserve the specific
area you need?
(See Documentation/kernel-parameters.txt for details)

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html

2006-11-28 13:04:34

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.


On Mon, 27 Nov 2006, Jon Ringle wrote:

> Robert Hancock wrote:
>> Jon Ringle wrote:
>>> Hi,
>>>
>>> I need to reserve a page of memory at a specific area of RAM that will
>>> be used as a "shared memory" with another processor over PCI. How can I
>>> ensure that the this area of RAM gets reseved so that the Linux's memory
>>> management (kmalloc() and friends) don't use it?
>>>
>>> Some things that I've considered are iotable_init() and ioremap().
>>> However, I've seen these used for memory mapped IO devices which are
>>> outside of the RAM memory. Can I use them for reseving RAM too?
>>>
>>> I appreciate any advice in this regard.
>>
>> Sounds to me like dma_alloc_coherent is what you want..
>>
> It looks promising, however, I need to reserve a physical address area
> that is well known (so that the code running on the other processor
> knows where in PCI memory to write to). It appears that
> dma_alloc_coherent returns the address that it allocated. Instead I need
> something where I can tell it what physical address and range I want to use.
>
> Jon

First, "PCI memory" is some memory inside a board that is addressed through the
PCI bus. This address is allocated upon machine start and is available though
the PCI interface (check any of the PCI card drivers). If you want to access
this memory, you need to follow the same procedures that other boards use.

However, perhaps you don't mean "PCI memory". Perhaps you mean real memory
in the address-space, and you need to reserve it and give its physical address
to something inside a PCI-bus card, perhaps for DMA. In that case, you can
either memory-map some physical memory (get_dma_pages()) or you can tell the
kernel you have less memory than you really have, and use the memory the kernel
doesn't know about for your own private purposes. To access this private memory
you use ioremap() and friends. This can be memory-mapped to user-space as well
so you can perform DMA directly to user-space buffers. You can find the highest
address that the kernel uses by reading kernel variable num_physpages. This
tells the number of pages the kernel uses. The kernel does write to the next one
so you need to start using pages that are two higher than num_physpages.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.72 BogoMips).
New book: http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

2006-11-28 19:26:07

by Jon Ringle

[permalink] [raw]
Subject: RE: Reserving a fixed physical address page of RAM.

Robert Hancock wrote:
> Jon Ringle wrote:
> > Robert Hancock wrote:
> >> Jon Ringle wrote:
> >>> Hi,
> >>>
> >>> I need to reserve a page of memory at a specific area of RAM that
> >>> will be used as a "shared memory" with another processor
> over PCI.
> >>> How can I ensure that the this area of RAM gets reseved
> so that the
> >>> Linux's memory management (kmalloc() and friends) don't use it?
> >>>
> >>> Some things that I've considered are iotable_init() and ioremap().
> >>> However, I've seen these used for memory mapped IO
> devices which are
> >>> outside of the RAM memory. Can I use them for reseving RAM too?
> >>>
> >>> I appreciate any advice in this regard.
> >>
> >> Sounds to me like dma_alloc_coherent is what you want..
> >>
> > It looks promising, however, I need to reserve a physical
> address area
> > that is well known (so that the code running on the other processor
> > knows where in PCI memory to write to). It appears that
> > dma_alloc_coherent returns the address that it allocated. Instead I
> > need something where I can tell it what physical address
> and range I
> > want to use.
>
> I don't think this is possible in the general case, as
> there's no mechanism for moving things out of the way if they
> might be in use. Your best solution is likely to use
> dma_alloc_coherent and pass the bus address returned into the
> other processor to tell it where to write..

I can't do that because my mechanism to talk to the other processor is
exactly what I'm trying to setup. Catch-22 :)

2006-11-28 19:37:35

by Jon Ringle

[permalink] [raw]
Subject: RE: Reserving a fixed physical address page of RAM.

Jesper Juhl wrote:
> On 28/11/06, Fawad Lateef <[email protected]> wrote:
> > On 11/28/06, Dave Airlie <[email protected]> wrote:
> > > On 11/28/06, Jon Ringle <[email protected]> wrote:
> > <snip>
> > > > It looks promising, however, I need to reserve a
> physical address
> > > > area that is well known (so that the code running on the other
> > > > processor knows where in PCI memory to write to). It
> appears that
> > > > dma_alloc_coherent returns the address that it
> allocated. Instead
> > > > I need something where I can tell it what physical
> address and range I want to use.
> > > >
> > >
> > > I've seen other projects just boot a 128M board with mem=120M and
> > > just use the 8MB at 120 to talk to the other processor..
> > >
> >
> > Yes, this can be used if required physical-memory exists in
> the last
> > part of RAM as if you use mem=<xxxM> then kernel will only
> use memory
> > less than or equal-to <xxxM> and above can be used by
> drivers (or any
> > kernel module) might be through ioremap which takes
> physical-address.
> >
> > But if lets say we need only 1MB portion of specific
> physical-memory
> > region then AFAIK it must be done by hacking in kernel code during
> > memory-initialization (mem_init function) where it is
> marking/checking
> > pages as/are reserved; you can simply mark you required pages as
> > reserved too and set their count to some-value if you want to know
> > later which pages are reserved by you. (can do this reservation work
> > here: http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
> > CMIIW
> >
>
> Can you not use the 'memmap=' kernel option to reserve the
> specific area you need?
> (See Documentation/kernel-parameters.txt for details)

This looks like what I want, but after searching for this, I found that
memmap= is implemented for i386 and ia64 only. My arch is arm (processor
is an IXP455).

I'll explore the mem= option to see if it will work out.

Jon

2006-11-28 19:52:45

by Jon Ringle

[permalink] [raw]
Subject: RE: Reserving a fixed physical address page of RAM.

linux-os (Dick Johnson) wrote:
> On Mon, 27 Nov 2006, Jon Ringle wrote:
>
> > Robert Hancock wrote:
> >> Jon Ringle wrote:
> >>> Hi,
> >>>
> >>> I need to reserve a page of memory at a specific area of RAM that
> >>> will be used as a "shared memory" with another processor
> over PCI.
> >>> How can I ensure that the this area of RAM gets reseved
> so that the
> >>> Linux's memory management (kmalloc() and friends) don't use it?
> >>>
> >>> Some things that I've considered are iotable_init() and ioremap().
> >>> However, I've seen these used for memory mapped IO
> devices which are
> >>> outside of the RAM memory. Can I use them for reseving RAM too?
> >>>
> >>> I appreciate any advice in this regard.
> >>
> >> Sounds to me like dma_alloc_coherent is what you want..
> >>
> > It looks promising, however, I need to reserve a physical
> address area
> > that is well known (so that the code running on the other processor
> > knows where in PCI memory to write to). It appears that
> > dma_alloc_coherent returns the address that it allocated. Instead I
> > need something where I can tell it what physical address
> and range I want to use.
> >
> > Jon
>
> First, "PCI memory" is some memory inside a board that is
> addressed through the PCI bus. This address is allocated upon
> machine start and is available though the PCI interface
> (check any of the PCI card drivers). If you want to access
> this memory, you need to follow the same procedures that
> other boards use.

In my hardware setup, Linux is running in PCI option mode on a IXP455
processor and it exposes a segment of the IXP455's memory so that it is
available on the PCI bus. The other processor (a pentium M running
Windows OS) sees this exposed IXP455 memory as PCI memory from it's
perspective.

>
> However, perhaps you don't mean "PCI memory". Perhaps you
> mean real memory in the address-space, and you need to
> reserve it and give its physical address to something inside
> a PCI-bus card, perhaps for DMA. In that case, you can either
> memory-map some physical memory (get_dma_pages()) or you can
> tell the kernel you have less memory than you really have,
> and use the memory the kernel doesn't know about for your own
> private purposes. To access this private memory you use
> ioremap() and friends. This can be memory-mapped to
> user-space as well so you can perform DMA directly to
> user-space buffers. You can find the highest address that the
> kernel uses by reading kernel variable num_physpages. This
> tells the number of pages the kernel uses. The kernel does
> write to the next one so you need to start using pages that
> are two higher than num_physpages.

I'll take a look telling the kernel it has less memory that there
physically exists and use ioremap() to map it in.

Thanks,
Jon

2006-11-30 17:47:46

by Jon Ringle

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

Fawad Lateef wrote:
> On 11/30/06, Jon Ringle <[email protected]> wrote:
> > Fawad Lateef wrote:
> > > Yes, this can be used if required physical-memory exists
> in the last
> > > part of RAM as if you use mem=<xxxM> then kernel will only use
> > > memory less than or equal-to <xxxM> and above can be used
> by drivers
> > > (or any kernel module) might be through ioremap which takes
> > > physical-address.
> >
> > Seems that using mem= has to be in 1MB increments, where I
> only need 4K.
> >
>
> No AFAIK you can specify it in KBs (see
> http://sosdg.org/~coywolf/lxr/source/Documentation/kernel-para
> meters.txt#L869)

Yes, you can specify the mem= using K notation, but there is a test in
arch/arm/mm/mm-armv.c:create_mapping() that prevents the mapping from
being created if the boundaries are not MB aligned:

if (mem_types[md->type].prot_l1 == 0 &&
(virt & 0xfffff || (virt + off) & 0xfffff || (virt + length)
& 0xfffff)) {
printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can
not "
"be mapped using pages, ignoring.\n",
__pfn_to_phys(md->pfn), md->virtual);
return;
}

This is in linux-2.6.16.29.

>
> > >
> > > But if lets say we need only 1MB portion of specific
> physical-memory
> > > region then AFAIK it must be done by hacking in kernel
> code during
> > > memory-initialization (mem_init
> > > function) where it is marking/checking pages as/are reserved; you
> > > can simply mark you required pages as reserved too and set their
> > > count to some-value if you want to know later which pages are
> > > reserved by you. (can do this reservation work
> > > here:
> http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
> >
> > Do you think that the following would work to properly reserve the
> > memory. If it does, then I think I can just do a ioremap(0x0ffff000,
> > 0x1000) to obtain a virtual address. (Ofcourse I would actually use
> > symbolic names rather than the hardcoded addesses shown here).
> >
> > Index: linux/arch/arm/mm/init.c
> > ===================================================================
> > --- linux.orig/arch/arm/mm/init.c 2006-11-30
> 11:03:00.000000000
> > -0500
> > +++ linux/arch/arm/mm/init.c 2006-11-30 11:09:09.000000000 -0500
> > @@ -429,6 +429,10 @@
> > unsigned long addr;
> > void *vectors;
> >
> > +#ifdef CONFIG_MACH_VERTICAL_RSC4
> > + reserve_bootmem (0x0ffff000, 0x1000); #endif
> > +
> > /*
> > * Allocate the vector page early.
> > */
> >
> >
>
> I think you can do like this but can't say accurately because
> I havn't worked on arm architecture and also you havn't
> mentioned your kernel-version or function (in file
> arch/arm/mm/init.c) which you are going to do call reserve_bootmem !

Kernel version is 2.6.16.29 and the reserve_bootmem() call above is at
the top of the function devicemaps_init().

Jon

2006-11-30 18:32:01

by Jon Ringle

[permalink] [raw]
Subject: RE: Reserving a fixed physical address page of RAM.

Jon Ringle wrote:
> Fawad Lateef wrote:
> > On 11/30/06, Jon Ringle <[email protected]> wrote:
> > > Do you think that the following would work to properly
> reserve the
> > > memory. If it does, then I think I can just do a
> ioremap(0x0ffff000,
> > > 0x1000) to obtain a virtual address. (Ofcourse I would
> actually use
> > > symbolic names rather than the hardcoded addesses shown here).
> > >
> > > Index: linux/arch/arm/mm/init.c
> > >
> ===================================================================
> > > --- linux.orig/arch/arm/mm/init.c 2006-11-30
> > 11:03:00.000000000
> > > -0500
> > > +++ linux/arch/arm/mm/init.c 2006-11-30
> 11:09:09.000000000 -0500
> > > @@ -429,6 +429,10 @@
> > > unsigned long addr;
> > > void *vectors;
> > >
> > > +#ifdef CONFIG_MACH_VERTICAL_RSC4
> > > + reserve_bootmem (0x0ffff000, 0x1000); #endif
> > > +
> > > /*
> > > * Allocate the vector page early.
> > > */
> > >
> > >
> >
> > I think you can do like this but can't say accurately
> because I havn't
> > worked on arm architecture and also you havn't mentioned your
> > kernel-version or function (in file
> > arch/arm/mm/init.c) which you are going to do call reserve_bootmem !
>
> Kernel version is 2.6.16.29 and the reserve_bootmem() call
> above is at the top of the function devicemaps_init().

Is there some way I can verify that the above works? I've tried the
following to try to get info on the reservation:
# cat /proc/iomem
# cat /proc/meminfo
# cat /proc/slabinfo
# echo m > /proc/sysrq-trigger

The only one that hints that this might have worked is the `echo m >
/proc/sysrq-trigger` in that I see the reserved pages count one larger
than using a kernel without this patch. Does this mean that the page I
reserved won't get used by Linux for any purpose?

Jon

2006-11-30 18:32:19

by Fawad Lateef

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

On 11/30/06, Jon Ringle <[email protected]> wrote:
> Fawad Lateef wrote:
> > On 11/30/06, Jon Ringle <[email protected]> wrote:
> > > Fawad Lateef wrote:
> > > > Yes, this can be used if required physical-memory exists
> > in the last
> > > > part of RAM as if you use mem=<xxxM> then kernel will only use
> > > > memory less than or equal-to <xxxM> and above can be used
> > by drivers
> > > > (or any kernel module) might be through ioremap which takes
> > > > physical-address.
> > >
> > > Seems that using mem= has to be in 1MB increments, where I
> > only need 4K.
> > >
> >
> > No AFAIK you can specify it in KBs (see
> > http://sosdg.org/~coywolf/lxr/source/Documentation/kernel-para
> > meters.txt#L869)
>
> Yes, you can specify the mem= using K notation, but there is a test in
> arch/arm/mm/mm-armv.c:create_mapping() that prevents the mapping from
> being created if the boundaries are not MB aligned:
>
> if (mem_types[md->type].prot_l1 == 0 &&
> (virt & 0xfffff || (virt + off) & 0xfffff || (virt + length)
> & 0xfffff)) {
> printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can
> not "
> "be mapped using pages, ignoring.\n",
> __pfn_to_phys(md->pfn), md->virtual);
> return;
> }
>
> This is in linux-2.6.16.29.
>

Ohh ok, I don't know about this architecture related information.

> >
> > > >
> > > > But if lets say we need only 1MB portion of specific
> > physical-memory
> > > > region then AFAIK it must be done by hacking in kernel
> > code during
> > > > memory-initialization (mem_init
> > > > function) where it is marking/checking pages as/are reserved; you
> > > > can simply mark you required pages as reserved too and set their
> > > > count to some-value if you want to know later which pages are
> > > > reserved by you. (can do this reservation work
> > > > here:
> > http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
> > >
> > > Do you think that the following would work to properly reserve the
> > > memory. If it does, then I think I can just do a ioremap(0x0ffff000,
> > > 0x1000) to obtain a virtual address. (Ofcourse I would actually use
> > > symbolic names rather than the hardcoded addesses shown here).
> > >
> > > Index: linux/arch/arm/mm/init.c
> > > ===================================================================
> > > --- linux.orig/arch/arm/mm/init.c 2006-11-30
> > 11:03:00.000000000
> > > -0500
> > > +++ linux/arch/arm/mm/init.c 2006-11-30 11:09:09.000000000 -0500
> > > @@ -429,6 +429,10 @@
> > > unsigned long addr;
> > > void *vectors;
> > >
> > > +#ifdef CONFIG_MACH_VERTICAL_RSC4
> > > + reserve_bootmem (0x0ffff000, 0x1000); #endif
> > > +
> > > /*
> > > * Allocate the vector page early.
> > > */
> > >
> > >
> >
> > I think you can do like this but can't say accurately because
> > I havn't worked on arm architecture and also you havn't
> > mentioned your kernel-version or function (in file
> > arch/arm/mm/init.c) which you are going to do call reserve_bootmem !
>
> Kernel version is 2.6.16.29 and the reserve_bootmem() call above is at
> the top of the function devicemaps_init().
>

reserving_bootmem in devicemaps_init will work but I think it will be
better if you do this in mem_init function (here:
http://sosdg.org/~coywolf/lxr/source/arch/arm/mm/init.c?v=2.6.16;a=arm#L620),
so that all the paging and other map related stuff completes. (CMIIW)

--
Fawad Lateef

2006-11-30 18:56:48

by Fawad Lateef

[permalink] [raw]
Subject: Re: Reserving a fixed physical address page of RAM.

On 11/30/06, Jon Ringle <[email protected]> wrote:
> Jon Ringle wrote:
> > Fawad Lateef wrote:
<snip>
> > > >
> > > > Index: linux/arch/arm/mm/init.c
> > > >
> > ===================================================================
> > > > --- linux.orig/arch/arm/mm/init.c 2006-11-30
> > > 11:03:00.000000000
> > > > -0500
> > > > +++ linux/arch/arm/mm/init.c 2006-11-30
> > 11:09:09.000000000 -0500
> > > > @@ -429,6 +429,10 @@
> > > > unsigned long addr;
> > > > void *vectors;
> > > >
> > > > +#ifdef CONFIG_MACH_VERTICAL_RSC4
> > > > + reserve_bootmem (0x0ffff000, 0x1000); #endif
> > > > +
> > > > /*
> > > > * Allocate the vector page early.
> > > > */
> > > >
> > > >
> > >
> > > I think you can do like this but can't say accurately
> > because I havn't
> > > worked on arm architecture and also you havn't mentioned your
> > > kernel-version or function (in file
> > > arch/arm/mm/init.c) which you are going to do call reserve_bootmem !
> >
> > Kernel version is 2.6.16.29 and the reserve_bootmem() call
> > above is at the top of the function devicemaps_init().
>
> Is there some way I can verify that the above works? I've tried the
> following to try to get info on the reservation:
> # cat /proc/iomem
> # cat /proc/meminfo
> # cat /proc/slabinfo
> # echo m > /proc/sysrq-trigger
>
> The only one that hints that this might have worked is the `echo m >
> /proc/sysrq-trigger` in that I see the reserved pages count one larger
> than using a kernel without this patch. Does this mean that the page I
> reserved won't get used by Linux for any purpose?
>

I havn't looked at " # echo m /proc/sysrq-trigger" till now but I am
almost sure that it will reserve/work because calling reserve_bootmem
internally sets the bit representing physical memory page (CMIIW).


--
Fawad Lateef

2006-11-30 21:51:12

by Jon Ringle

[permalink] [raw]
Subject: RE: Reserving a fixed physical address page of RAM.

Fawad Lateef wrote:
> reserving_bootmem in devicemaps_init will work but I think it
> will be better if you do this in mem_init function (here:
> http://sosdg.org/~coywolf/lxr/source/arch/arm/mm/init.c?v=2.6.
> 16;a=arm#L620),
> so that all the paging and other map related stuff completes. (CMIIW)

Ok. That seems to work ok too. Thanks.

Jon