[SeaBIOS] [PATCH] qemu: handle e820 ram entries

Igor Mammedov imammedo at redhat.com
Mon Oct 14 15:42:11 CEST 2013


On Mon, 14 Oct 2013 10:28:08 +0200
Gerd Hoffmann <kraxel at redhat.com> wrote:

> Check the e820 entries we get from qemu for ram entries and handle them
> accordingly:
> 
>  (1) Entries overlapping with the lowmem range will be ignored.
>      At least initially qemu will not send such entries for
>      compatibility reasons.  That may change in the future though
>      if qemu needs a more recent seabios versions anyway for some
>      reason.  So better be prepared.
>  (2) Adjust RamSizeOver4G variable if we find it being too small.
>      Needed for guests with more that 1TB (this is the max amount
>      of memory the three-byte cmmos interface can represent).
> 
> Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
Reviewed-By: Igor Mammedov <imammedo at redhat.com>

> ---
>  src/fw/paravirt.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
> index c118480..c1469ae 100644
> --- a/src/fw/paravirt.c
> +++ b/src/fw/paravirt.c
> @@ -285,6 +285,15 @@ qemu_cfg_legacy(void)
>          int i;
>          for (i = 0; i < count32; i++) {
>              qemu_cfg_read(&entry, sizeof(entry));
> +            if (entry.type == E820_RAM) {
> +                if (entry.address < RamSize)
> +                    // ignore, we got it from cmos already and
> +                    // adding this again would ruin any reservations
> +                    // done so far
> +                    continue;
> +                if (0x100000000LL + RamSizeOver4G < entry.address + entry.length)
> +                    RamSizeOver4G = entry.address + entry.length - 0x100000000LL;
> +            }
>              add_e820(entry.address, entry.length, entry.type);
>          }
>      } else if (runningOnKVM()) {




More information about the SeaBIOS mailing list