Skip to content

Commit

Permalink
mshv-ioctls: Add ioctls def for SEV-SNP AP create
Browse files Browse the repository at this point in the history
This would be used by SEV-SNP guest during SMP bringup to create AP
threads.

Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
  • Loading branch information
jinankjain authored and Muminul Islam Russell committed Jul 6, 2023
1 parent 7f9041e commit d48031a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mshv-ioctls/src/ioctls/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ impl VmFd {
Err(errno::Error::last())
}
}
/// Create AP threads for SEV-SNP guest
pub fn sev_snp_ap_create(&self, data: &mshv_sev_snp_ap_create) -> Result<()> {
// SAFETY: IOCTL with correct types
let ret = unsafe { ioctl_with_ref(self, MSHV_SEV_SNP_AP_CREATE(), data) };
if ret == 0 {
Ok(())
} else {
Err(errno::Error::last())
}
}
/// Creates/modifies a guest physical memory.
pub fn map_user_memory(&self, user_memory_region: mshv_user_mem_region) -> Result<()> {
// SAFETY: IOCTL with correct types
Expand Down
6 changes: 6 additions & 0 deletions mshv-ioctls/src/mshv_ioctls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,9 @@ ioctl_iow_nr!(
);
ioctl_iowr_nr!(MSHV_READ_GPA, MSHV_IOCTL, 0x32, mshv_read_write_gpa);
ioctl_iow_nr!(MSHV_WRITE_GPA, MSHV_IOCTL, 0x33, mshv_read_write_gpa);
ioctl_iow_nr!(
MSHV_SEV_SNP_AP_CREATE,
MSHV_IOCTL,
0x34,
mshv_sev_snp_ap_create
);

0 comments on commit d48031a

Please sign in to comment.