Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage2: add TD Partitioning support #419

Merged
merged 13 commits into from
Oct 23, 2024

Commits on Oct 18, 2024

  1. igvmbuilder: Insert a zero CPUID page for TDP platforms

    Since both the stage2 bootloader and the SVSM kernel dump the CPUID
    page, there needs to be a page present at the respective GPA on TDP
    platforms. Insert a normal zero page at the CPUID page location so that
    dump_cpuid_table() can work as expected.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    737fb11 View commit details
    Browse the repository at this point in the history
  2. igvmbuilder: Insert a zero secrets page for TDP platforms

    Since the SVSM kernel touches the secrets page in svsm_start(), there
    needs to be a page present at the respective GPA on TDP platforms.
    Insert a normal zero page at the secrets page location so that the SVSM
    kernel can touch it without issues.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    082a840 View commit details
    Browse the repository at this point in the history
  3. Cargo.toml: Clean up

    Clean up formatting and crate ordering.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    7a5b260 View commit details
    Browse the repository at this point in the history
  4. Cargo.toml: Add tdx-tdcall crate

    Add the tdx-tdcall crate in preparation for the upcoming TDX enabling
    changes.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    53eccbe View commit details
    Browse the repository at this point in the history
  5. stage1: Fix stage2 launch info size

    Stage2LaunchInfo has been increased to 48 bytes. Make the according
    changes in stage1 trampoline.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    15053ba View commit details
    Browse the repository at this point in the history
  6. stage1: Revert lds change

    Setting the initial location counter has no effect since all of the
    addresses before edata are derived based on the subsequent locations.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    2def94b View commit details
    Browse the repository at this point in the history
  7. platform: tdp: Add I/O port driver

    Add GHCI-based PIO driver to TdpPlatform. This implementation translates
    all of the in/out operations to TDVMCALL operations as required by the
    GHCI spec.
    
    Additionally, move console initialization to env_setup() to enable it as
    early as possible.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    0882589 View commit details
    Browse the repository at this point in the history
  8. stage2: Add logging before jumping into kernel

    Make stage2 a tad more verbose by signaling when it's about ready to
    jump into the SVSM kernel.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    9783f45 View commit details
    Browse the repository at this point in the history
  9. platform: tdp: Fix phys_addr_sizes

    phys_addr_sizes should be the entirety of CPUID leaf 0x80000008.EAX, not
    just the Physical Address Bits field.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 18, 2024
    Configuration menu
    Copy the full SHA
    60a4b2c View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2024

  1. types: Introduce PAGE_SHIFT_1G/PAGE_SIZE_1G

    This is in preparation for the upcoming changes to
    PageTable::virt_to_phys(). Since 1G huge pages are architecturally
    permissible when translating a virtual address, PAGE_SIZE_1G is now a
    valid page size even though it's currently not actively used anywhere.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    c12ea27 View commit details
    Browse the repository at this point in the history
  2. mm/pagetable: Introduce PageFrame

    PageFrame is an enum describing not only a physical address, but also
    the page frame to which it belongs.
    
    - PageFrame::address(): return its internal PhysAddr
    - PageFrame::start(): return the beginning of the page frame
    - PageFrame::end(): return the end of the page frame
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    134bbad View commit details
    Browse the repository at this point in the history
  3. mm/pagetable: Introduce virt_to_frame()

    virt_to_frame() not only returns the translated physical address, but
    also returns the size of the underlying page through PageFrame.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    789257e View commit details
    Browse the repository at this point in the history
  4. platform: tdp: Implement page validation interfaces

    On TDP platforms, page validation means page acceptance. Implement
    validate_{physical, virtual}_page_range() using the tdx-tdcall crate for
    this TDCALL operation. Page invalidation simply means zeroing out the
    page on TDP platforms.
    
    Signed-off-by: Peter Fang <[email protected]>
    peterfang committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    a422374 View commit details
    Browse the repository at this point in the history