Skip to content

fix(x86): expose flat low RAM and skip EBDA ACPI on firmware boot - #581

Merged
Lencerf merged 1 commit into
google:mainfrom
Lencerf:push-mxqlqrxupnnm
Dec 4, 2026
Merged

Lencerf merged 1 commit into
google:mainfrom
Lencerf:push-mxqlqrxupnnm

Conversation

@Lencerf

@Lencerf Lencerf commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

In x86 Board::create_ram() and Board::create_firmware_data(), the direct-boot low-memory layout (reserving [0x0, 0x500) for IVT/BDA and placing ACPI tables in [0x80000, 0xA0000)) was gated on spec.coco.is_none(). When booting non-CoCo UEFI firmware (such as OVMF/AVMF), those entries were exported via fw_cfg etc/e820 and ACPI tables were written into EBDA RAM even though firmware loads ACPI from fw_cfg and owns the low memory map.

This broke upstream EDK2 in two ways:

  • OvmfPkg PlatformGetLowMemoryCB requires the low E820_RAM region to start at address 0 (EDK2 commit 0a0919607ceb). Starting etc/e820 with a Reserved entry left LowMemory at 0, falling back to CMOS (16 MiB) and underflowing PeiInstallPeiMemory.
  • DXE GetMemoryMap() asserts that Reserved GCD entries are 4 KiB page-aligned, rejecting the 0x500-byte entry.

Replace the spec.coco.is_none() checks with !self.is_firmware_boot(), which checks whether the payload has a firmware image (CoCo guests always boot via firmware), so firmware boots expose a single [0, low_mem_size) RAM region in etc/e820.

In x86 Board::create_ram() and Board::create_firmware_data(), the
direct-boot low-memory layout (reserving [0x0, 0x500) for IVT/BDA and
placing ACPI tables in [0x80000, 0xA0000)) was gated on
spec.coco.is_none(). When booting non-CoCo UEFI firmware (such as
OVMF/AVMF), those entries were exported via fw_cfg etc/e820 and ACPI
tables were written into EBDA RAM even though firmware loads ACPI from
fw_cfg and owns the low memory map.

This broke upstream EDK2 in two ways:
- OvmfPkg PlatformGetLowMemoryCB requires the low E820_RAM region to
  start at address 0 (EDK2 commit 0a0919607ceb). Starting etc/e820 with
  a Reserved entry left LowMemory at 0, falling back to CMOS (16 MiB)
  and underflowing PeiInstallPeiMemory.
- DXE GetMemoryMap() asserts that Reserved GCD entries are 4 KiB
  page-aligned, rejecting the 0x500-byte entry.

Replace the spec.coco.is_none() checks with !self.is_firmware_boot(),
which checks whether the payload has a firmware image (CoCo guests
always boot via firmware), so firmware boots expose a single
[0, low_mem_size) RAM region in etc/e820.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 47403048042

Coverage decreased (-0.02%) to 48.214%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 8 uncovered changes across 1 file (0 of 8 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
alioth/src/board/board_amd64/board_amd64.rs 8 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 17096
Covered Lines: 8024
Line Coverage: 46.93%
Relevant Branches: 1992
Covered Branches: 1179
Branch Coverage: 59.19%
Branches in Coverage %: Yes
Coverage Strength: 964.08 hits per line

💛 - Coveralls

@Lencerf
Lencerf added this pull request to the merge queue Dec 4, 2026
Merged via the queue into google:main with commit 11bb930 Dec 4, 2026
20 checks passed
@Lencerf
Lencerf deleted the push-mxqlqrxupnnm branch December 4, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants