I am running debian unstable on an i386 based system.
I have decided to try and do this with the mem= bootparam.
I keep getting a kernel crash after testing the memory with kernel 2.4.26,
as if I am overwriting memory that is being used by the system.
What I am doing is mapping the physical memory with
phys_adr is the actual physical address, ie on my system its 0xc800000 - b/c
mem=200m.
adr = ioremap(phys_adr, size) to map the physical memory.
while(size > 0){
mem_map_reserve(virt_to_page(adr));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
I had to change this function to work with mem= bootparam for some reason.
It was almost identical to my bigphys version:
And in my mmap function:
vma->vm_flags |= VM_LOCKED;
return remap_page_range(vma->vm_start, phys_adr, vma->vm_end -
vma->vm_start, vma->vm_page_prot);
I had originally had here:
vma->vm_flags |= VM_LOCKED;
return remap_page_range(vma->vm_start, virt_to_phys(vma->vm_start),
vma->vm_end - vma->vm_start, vma->vm_page_prot);
But the virt_to_phys(vma->vm_start) was not returning the actual physical
address, it was returning something else...
When I am done with the memory, I call:
iounmap(adr);
This is basically the same code for both kernel 2.6.5 and kernel 2.4.26, and
I can't figure out why its not working!,
Help!!
Thank you so much,
Nachum Kanovsky
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Muli Ben-Yehuda
Sent: Friday, May 07, 2004 1:55 PM
To: Gilad Ben-Yossef
Cc: Nachum Kanovsky; [EMAIL PROTECTED]
Subject: Re: Debian Kernel 2.6 & bigphysarea
Nachum Kanovsky wrote:
> > Can anyone tell me how to go about allocating large physical memory
> > for use by dma and usermode programs. I used to use
> > bigphysarea_alloc, mem_map_reserve - and then for mapping I would
> > set the vma to VM_LOCKED and I would call remap_page_range.
> >
> > What do I do with kernel 2.6 for this?
How big is big, and more importantly, does it need to be physically
contiguous?
On Thu, May 06, 2004 at 05:12:53PM +0300, Gilad Ben-Yossef wrote:
> I'm might be smoking crack here, but I seem to remember that
> bigphysarea was
> an outside patch and not part of Linus vanilla kernel. Not sure about it
> though.
That's what I recall as well.
> BTW, one extremly ugly trick you can do without this patch is to use
> the
> kernel boot parameter "mem=" to create a "hole" in the memory map that is
> managed by the kernel (same thing that happens for video card "stolen"
> memroy, really) and simply mem_map_reserve and remap_page_range it. But I
> wouldn't recomend going this way for anything which is not an embedded
system
> that you have absolute control over and even then it's ugly.
You also need to be sure your arch doesn't have weird memory setups with
holes that must not be writen to above what you give mem, since the kernel
believes you and does not protect you from using these holes. Also, at least
on one arch, the kernel will happily scribble above what you give mem.
Cheers,
Muli
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
================================================================To unsubscribe, send
mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]