[SeaBIOS] [RFC 2/3] Transitions to and from 64 bits

Marc Marí markmb at redhat.com
Mon Sep 21 14:38:00 CET 2015


On Mon, 21 Sep 2015 15:57:56 +0200
Gerd Hoffmann <kraxel at redhat.com> wrote:

>   Hi,
> 
> > +/****************************************************************
> > + * Page table
> > + ****************************************************************/
> > +void *gen_identity_page_table(u64 max_addr)
> > +{
> > +    /* Map directly all the addresses */
> > +    u32 pt_entries = (max_addr + 0xFFF) >> 12;
> > +    u32 pdt_entries = (pt_entries + 0x1FF) >> 9;
> > +    u32 pdpt_entries = (pdt_entries + 0x1FF) >> 9;
> > +    u32 pml4_entries = (pdpt_entries + 0x1FF) >> 9;
> 
> You can use hugepages.  Then you'll need _alot_ less memory for the
> pagetables, and the copying probably goes faster too.

True. Tried with 2M. The memory used went down from 8M to 24K more or
less, and the time for the copying went down by 4ms (from 15ms to
11ms). The other option is 1GB. I'll test later if it's enabled in QEMU
CPUs.

> You might consider mapping the nvdimm below 4G instead of entering
> long mode.

The QEMU NVDIMM driver maps it directly above 4G to avoid the trouble
of looking for empty spaces in the below 4G section. I didn't want to
rework the driver or add more complexity to it.

If you were talking about just enabling paging and map the NVDIMM to
below 4G, it would work for just a few gigs above 4G (don't remember
exactly the number). So better give it all.

And SeaBIOS may need 64 bit support for other things in the future, so
this might be useful later.

Thanks
Marc



More information about the SeaBIOS mailing list