forked from virtee/sev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated launch library to use current IOCTls and gmem
Updated the launch library to use INIT2 IOCTL and deprecate the old INIT IOCTLs. Created new functions to register encrypted memory for SNP. Updated SEV test to use INIT2. Updated the SNP launch test to use GMEM and support KVM GMEM for launch. Signed-off-by: DGonzalezVillal <[email protected]>
- Loading branch information
1 parent
14132cc
commit 0dfe735
Showing
10 changed files
with
274 additions
and
162 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! SEV and SEV-SNP shared types for interacting with the KVM SEV guest management API. | ||
/// Structure passed into KVM_SEV_INIT2 command. | ||
#[derive(Default)] | ||
#[repr(C, packed)] | ||
pub struct Init2 { | ||
/// Initial value of features field in VMSA. (Must be 0 for SEV) | ||
vmsa_features: u64, | ||
|
||
/// Always set to 0 | ||
flags: u32, | ||
|
||
/// Maximum guest GHCB version allowed. (Currently 0 for SEV and 1 for SEV-ES and SEV-SNP) | ||
ghcb_version: u16, | ||
|
||
pad1: u16, | ||
|
||
pad2: [u32; 8], | ||
} | ||
|
||
impl Init2 { | ||
/// Default INIT2 values for SEV | ||
pub fn init_default_sev() -> Self { | ||
Self { | ||
vmsa_features: 0, | ||
flags: 0, | ||
ghcb_version: 0, | ||
pad1: Default::default(), | ||
pad2: Default::default(), | ||
} | ||
} | ||
|
||
/// Default INIT2 values for SEV-ES | ||
pub fn init_default_es() -> Self { | ||
Self { | ||
vmsa_features: 0x1, | ||
flags: 0, | ||
ghcb_version: 1, | ||
pad1: Default::default(), | ||
pad2: Default::default(), | ||
} | ||
} | ||
|
||
/// Default INIT2 values for SEV-SNP | ||
pub fn init_default_snp() -> Self { | ||
Self { | ||
vmsa_features: 0, | ||
flags: 0, | ||
ghcb_version: 2, | ||
pad1: Default::default(), | ||
pad2: Default::default(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.