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

Permit guest execution without a calling area #190

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ pub fn update_mappings() -> Result<(), SvsmError> {
None => ret = Err(SvsmError::MissingVMSA),
}

match locked.caa_phys() {
Some(paddr) => this_cpu_mut().map_guest_caa(paddr)?,
None => ret = Err(SvsmError::MissingCAA),
if let Some(paddr) = locked.caa_phys() {
this_cpu_mut().map_guest_caa(paddr)?
}

locked.set_updated();
Expand Down
13 changes: 7 additions & 6 deletions src/svsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,15 @@ pub fn copy_tables_to_fw(fw_meta: &SevFWMetaData) -> Result<(), SvsmError> {
zero_caa_page(caa_page)
}

fn prepare_fw_launch(fw_meta: &SevFWMetaData) -> Result<(), SvsmError> {
let caa = fw_meta.caa_page.unwrap();
fn prepare_fw_launch(fw_metadata: Option<&SevFWMetaData>) -> Result<(), SvsmError> {
let cpu = this_cpu_mut();

if let Some(fw_meta) = fw_metadata {
let caa = fw_meta.caa_page.unwrap();
cpu.update_guest_caa(caa);
}

cpu.alloc_guest_vmsa()?;
cpu.update_guest_caa(caa);
update_mappings()?;

Ok(())
Expand Down Expand Up @@ -482,9 +485,7 @@ pub extern "C" fn svsm_main() {

guest_request_driver_init();

if let Some(ref fw_meta) = fw_metadata {
prepare_fw_launch(fw_meta).expect("Failed to setup guest VMSA");
}
prepare_fw_launch(fw_metadata.as_ref()).expect("Failed to setup guest VMSA/CAA");

virt_log_usage();

Expand Down
Loading