From: Jun Sun <jsun@junsun.net>
To: Paul Mundt <lethal@linux-sh.org>, linux-kernel@vger.kernel.org
Subject: Re: reserve memory in low physical address - possible?
Date: Thu, 2 Nov 2006 10:40:53 -0800 [thread overview]
Message-ID: <20061102184053.GA8842@srv.junsun.net> (raw)
In-Reply-To: <20061031150612.GA14272@srv.junsun.net>
On Tue, Oct 31, 2006 at 07:06:12AM -0800, Jun Sun wrote:
> On Tue, Oct 31, 2006 at 05:12:39PM +0900, Paul Mundt wrote:
> > On Mon, Oct 30, 2006 at 11:22:03PM -0800, Jun Sun wrote:
> > > I understand it is possible to reserve some memory at the end by
> > > specifying "mem=xxxM" option in kernel command line. I looked into
> > > "memmap=xxxM" option but it appears not helpful for what I want.
> > >
> > memmap takes multiple arguments, including the start address for the
> > memory map. You could also bump min_low_pfn manually if memmap= isn't
> > suitable for you, something like:
> >
> > magic_space = PFN_UP(init_pg_tables_end);
> > min_low_pfn = magic_space + magic_size;
> >
> > (assuming magic_size is rounded up already), should work fine. Though
> > memmap= already takes care of most of this for you, could you explain why
> > it's unsuitable?
>
> That is fair question. I got that conclusion by a quick test with
> "memmap=" and kernel did not boot. :)
>
> Now think about it, it could be because the loader (or the real-mode
> part of kernel) has not been modified to deal with the initial gap.
> Can someone confirm that and give some hints on how to do this?
>
I finally managed to boot a kernel only uses the second 256MB memory
on a 512MB system. In case someone wants to do the same in the future,
I post my solution here.
http://junsun.net/linux/patches/generic/hacks/061102-reserve-low-memory.patch
http://junsun.net/linux/patches/generic/hacks/061102-vmplayer-no-module-2.6.16.config
The objective is to reserve the first 256MB staring from 0 and hide it from
kernel in a 512MB system. In other words, kernel only uses the second
256MB memory.
Several notes related to this hack:
* In the config, I set CONFIG_PHYSICAL_START to 0x10000000 (256MB)
See the .config file in the same directory. My target is vmplayer.
(BTW, this config disables module and is quite useful for fast devel)
* The patch will change __PAGE_OFFSET from 0xC0000000 to 0xB0000000 so that
the virtual address of kernel would still start from 0xC0000000 region.
(This may be necessary? Pro's and Con's?)
* Since we lose out the first 16MB DMA zone, many drivers will complain.
The patch increase MAX_DMA_ADDRESS to 1GB, which effectively cover
all memory area. If you have floppy or other ISA devices doing DMA,
this change may break your system.
* Specify the memory map through kernel command line:
memmap=exactmap memmap=0x0fef0000@0x10000000
Note
. the memory region must include the kernel itself
. also, grub does not seem to understand memmap option (BUG!!). It
would still load initrd to the end of memory. So you better
specify the size of memory to cover (almost) end of the second
256MB. Otherwise, you will see complains about not finding
"LABEL=/" root device.
. Tricky enough, you cannot specify the whole 256MB as the size
because the first 0x1000 block in the last 1M+ is used for ACPI
data and NVS. (What are they for anyway?) When I tried to
include them in memmap spec, the system failed to start (BusLogic
driver errors)
Jun
next prev parent reply other threads:[~2006-11-02 18:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-31 7:22 Jun Sun
2006-10-31 8:12 ` Paul Mundt
2006-10-31 15:06 ` Jun Sun
2006-11-02 18:40 ` Jun Sun [this message]
2006-10-31 12:32 ` Richard B. Johnson
2006-10-31 15:40 ` Jun Sun
2006-10-31 16:01 ` Alan Cox
2006-10-31 12:45 ` Mark Hounschell
2006-10-31 15:14 ` Jun Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061102184053.GA8842@srv.junsun.net \
--to=jsun@junsun.net \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®