Re: [PATCH] Fix alignment of early reservation for EBDA

From: Alexander van Heukelum
Date: Mon Feb 25 2008 - 11:54:58 EST


On Sun, 24 Feb 2008 18:18:16 -0800, "H. Peter Anvin" <hpa@xxxxxxxxx>
said:
> Alexander van Heukelum wrote:
> > early res: 3 [9f000-9ffff] EBDA
> >
> > Is it really necessary to force the allocation to a page boundary?
>
> It is, but that rounding gets done in reserve_bootmem() anyway, so there
> is no need for the arch-specific code to do it.
>
> The 32-bit EBDA code hard-codes a size of 4K, which is probably equally
> wrong; my gut feel is that the right thing to do is to reserve from the
> EBDA up to the 640K mark (some BIOSes use an area like that for SMM
> stuff), possibly with some sanity checking.

Then, how about reserving everything from the end of conventional memory
up to the 1Mb mark? Like this:

/*
* The BIOS places the EBDA/XBDA at the top of conventional
* memory, and usually decreases the reported amount of
* conventional memory (int 0x12) too.
*/
static __init void reserve_ebda(void)
{
unsigned int lowmem, ebda_addr;

/* end of low (conventional) memory */
lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
lowmem <<= 10;

/* start of EBDA area */
ebda_addr = *(unsigned short *)__va(BIOS_EBDA_SEGMENT);
ebda_addr <<= 4;

/* Fixup: bios puts an EBDA in the top 64K segment */
/* of conventional memory, but does not adjust lowmem. */
if ((lowmem - ebda_addr) <= 0x10000)
lowmem = ebda_addr;

/* Fixup: bios does not report an EBDA at all. */
/* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
if ((ebda_addr == 0) && (lowmem >= 0x9f000))
lowmem = 0x9f000;

/* Paranoia: should never happen, but... */
if (lowmem >= 0x100000)
lowmem = 0xa0000;

/* reserve all memory between lowmem and the 1MB mark */
reserve_early(lowmem, 0x100000, "BIOS reserved");
}

Greetings,
Alexander
--
Alexander van Heukelum
heukelum@xxxxxxxxxxx

--
http://www.fastmail.fm - Choose from over 50 domains or use your own

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/