Skip to content

Commit 75b83b3

Browse files
authored
Merge pull request #377 from 00xc/sev_features
svsm: drop `VmsaRegProt` support, add missing SEV features and other improvements
2 parents 8442d27 + 82e0ecb commit 75b83b3

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

igvmbuilder/src/cmd_options.rs

+4
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,8 @@ pub enum SevExtraFeatures {
8989
DebugSwap,
9090
PreventHostIBS,
9191
SNPBTBIsolation,
92+
VmplSSS,
93+
SecureTscEn,
94+
VmsaRegProt,
95+
SmtProtection,
9296
}

igvmbuilder/src/vmsa.rs

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ pub fn construct_vmsa(
125125
SevExtraFeatures::DebugSwap => features.set_debug_swap(true),
126126
SevExtraFeatures::PreventHostIBS => features.set_prevent_host_ibs(true),
127127
SevExtraFeatures::SNPBTBIsolation => features.set_snp_btb_isolation(true),
128+
SevExtraFeatures::VmplSSS => features.set_vmpl_supervisor_shadow_stack(true),
129+
SevExtraFeatures::SecureTscEn => features.set_secure_tsc(true),
130+
SevExtraFeatures::VmsaRegProt => features.set_vmsa_reg_protection(true),
131+
SevExtraFeatures::SmtProtection => features.set_smt_protection(true),
128132
}
129133
}
130134

kernel/src/sev/status.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ bitflags! {
2222
const DBGSWP = 1 << 7;
2323
const PREV_HOST_IBS = 1 << 8;
2424
const BTB_ISOLATION = 1 << 9;
25+
const VMPL_SSS = 1 << 10;
2526
const SECURE_TSC = 1 << 11;
2627
const VMSA_REG_PROT = 1 << 16;
28+
const SMT_PROT = 1 << 17;
2729
}
2830
}
2931

@@ -163,7 +165,7 @@ pub fn sev_status_verify() {
163165
| SEVStatusFlags::REST_INJ
164166
| SEVStatusFlags::PREV_HOST_IBS
165167
| SEVStatusFlags::BTB_ISOLATION
166-
| SEVStatusFlags::VMSA_REG_PROT;
168+
| SEVStatusFlags::SMT_PROT;
167169

168170
let status = sev_flags();
169171
let required_check = status & required;

kernel/src/svsm.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use svsm::platform::{SvsmPlatformCell, SVSM_PLATFORM};
4545
use svsm::requests::{request_loop, request_processing_main, update_mappings};
4646
use svsm::serial::SerialPort;
4747
use svsm::sev::utils::{rmp_adjust, RMPFlags};
48-
use svsm::sev::{init_hypervisor_ghcb_features, secrets_page, secrets_page_mut, sev_status_init};
48+
use svsm::sev::{init_hypervisor_ghcb_features, secrets_page, secrets_page_mut};
4949
use svsm::svsm_console::SVSMIOPort;
5050
use svsm::svsm_paging::{init_page_table, invalidate_early_boot_memory};
5151
use svsm::task::exec_user;
@@ -300,7 +300,6 @@ pub extern "C" fn svsm_start(li: &KernelLaunchInfo, vb_addr: usize) {
300300
let platform = platform_cell.as_mut_dyn_ref();
301301

302302
init_cpuid_table(VirtAddr::from(launch_info.cpuid_page));
303-
dump_cpuid_table();
304303

305304
let secrets_page_virt = VirtAddr::from(launch_info.secrets_page);
306305
secrets_page_mut().copy_from(secrets_page_virt);
@@ -309,7 +308,7 @@ pub extern "C" fn svsm_start(li: &KernelLaunchInfo, vb_addr: usize) {
309308
cr0_init();
310309
cr4_init();
311310
efer_init();
312-
sev_status_init();
311+
platform.env_setup();
313312

314313
memory_init(&launch_info);
315314
migrate_valid_bitmap().expect("Failed to migrate valid-bitmap");
@@ -361,6 +360,9 @@ pub extern "C" fn svsm_start(li: &KernelLaunchInfo, vb_addr: usize) {
361360

362361
log::info!("COCONUT Secure Virtual Machine Service Module (SVSM)");
363362

363+
dump_cpuid_table();
364+
platform.env_setup_late();
365+
364366
let mem_info = memory_info();
365367
print_memory_info(&mem_info);
366368

0 commit comments

Comments
 (0)