Skip to content

Commit

Permalink
DM: Update the default e820 table to reserve 0xF0000~0x100000
Browse files Browse the repository at this point in the history
The region of MPtable/ACPI table/SMBios resides in
0xF0000 ~ 0x100000. They should be marked as RESERVED instead of
RAM type in e820 table.

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
  • Loading branch information
fyin1 authored and jren1 committed May 15, 2018
1 parent ee43f23 commit 223efeb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
31 changes: 23 additions & 8 deletions devicemodel/core/sw_load_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,30 @@ static char bootargs[STR_LEN];
* ctx->highmem = request_memory_size - ctx->lowmem_limit
*
* Begin End Type Length
* 0: 0 - lowmem RAM lowmem
* 1: lowmem - bff_fffff (reserved) 0xc00_00000-lowmem
* 2: 0xc00_00000 - dff_fffff PCI hole 512MB
* 3: 0xe00_00000 - fff_fffff (reserved) 512MB
* 2: 1_000_00000 - highmem RAM highmem-4G
* 0: 0 - 0xF0000 RAM 0xF0000
* 1 0xf0000 - 0x100000 (reserved) 0x10000
* 2 0x100000 - lowmem RAM lowmem - 0x100000
* 3: lowmem - bff_fffff (reserved) 0xc00_00000-lowmem
* 4: 0xc00_00000 - dff_fffff PCI hole 512MB
* 5: 0xe00_00000 - fff_fffff (reserved) 512MB
* 6: 1_000_00000 - highmem RAM highmem-4G
*/
const struct e820_entry e820_default_entries[NUM_E820_ENTRIES] = {
{ /* 0 to lowmem */
{ /* 0 to mptable/smbios/acpi */
.baseaddr = 0x00000000,
.length = 0x49000000,
.length = 0xF0000,
.type = E820_TYPE_RAM
},

{ /* mptable/smbios/acpi to lowmem */
.baseaddr = 0xF0000,
.length = 0x10000,
.type = E820_TYPE_RESERVED
},

{ /* lowmem to lowmem_limit*/
.baseaddr = 0x100000,
.length = 0x48f00000,
.type = E820_TYPE_RAM
},

Expand Down Expand Up @@ -126,7 +140,8 @@ acrn_create_e820_table(struct vmctx *ctx, struct e820_entry *e820)
memcpy(e820, e820_default_entries, sizeof(e820_default_entries));

if (ctx->lowmem > 0) {
e820[LOWRAM_E820_ENTRIES].length = ctx->lowmem;
e820[LOWRAM_E820_ENTRIES].length = ctx->lowmem -
e820[LOWRAM_E820_ENTRIES].baseaddr;
e820[LOWRAM_E820_ENTRIES+1].baseaddr = ctx->lowmem;
e820[LOWRAM_E820_ENTRIES+1].length =
ctx->lowmem_limit - ctx->lowmem;
Expand Down
6 changes: 3 additions & 3 deletions devicemodel/include/sw_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
#define E820_TYPE_ACPI_NVS 4 /* EFI 10 */
#define E820_TYPE_UNUSABLE 5 /* EFI 8 */

#define NUM_E820_ENTRIES 4
#define LOWRAM_E820_ENTRIES 0
#define HIGHRAM_E820_ENTRIES 3
#define NUM_E820_ENTRIES 6
#define LOWRAM_E820_ENTRIES 2
#define HIGHRAM_E820_ENTRIES 5

/* Defines a single entry in an E820 memory map. */
struct e820_entry {
Expand Down

0 comments on commit 223efeb

Please sign in to comment.