Skip to content

Commit

Permalink
platform: move AP page table construction into common code
Browse files Browse the repository at this point in the history
The process of cloning page tables to create the page table hierarchy
for a new processor does not include platform-specific logic.  Therefore
it should not be implemented in the platform object.

Signed-off-by: Jon Lange <[email protected]>
  • Loading branch information
msft-jlange committed Oct 21, 2024
1 parent 9870390 commit 40cebea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions kernel/src/cpu/smp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use crate::utils::immut_after_init::immut_after_init_set_multithreaded;
fn start_cpu(platform: &dyn SvsmPlatform, apic_id: u32) -> Result<(), SvsmError> {
let start_rip: u64 = (start_ap as *const u8) as u64;
let percpu = PerCpu::alloc(apic_id)?;
let pgtable = this_cpu().get_pgtable().clone_shared()?;
percpu.setup(platform, pgtable)?;
platform.start_cpu(percpu, start_rip)?;

let percpu_shared = percpu.shared();
Expand Down
2 changes: 0 additions & 2 deletions kernel/src/platform/snp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ impl SvsmPlatform for SnpPlatform {
}

fn start_cpu(&self, cpu: &PerCpu, start_rip: u64) -> Result<(), SvsmError> {
let pgtable = this_cpu().get_pgtable().clone_shared()?;
cpu.setup(self, pgtable)?;
let (vmsa_pa, sev_features) = cpu.alloc_svsm_vmsa(*VTOM as u64, start_rip)?;

current_ghcb().ap_create(vmsa_pa, cpu.get_apic_id().into(), 0, sev_features)
Expand Down

0 comments on commit 40cebea

Please sign in to comment.