vmm: Add option for enabling SGX EPC regions

Introducing the new CLI option --sgx-epc along with the OpenAPI
structure SgxEpcConfig, so that a user can now enable one or multiple
SGX Enclave Page Cache sections within a contiguous region from the
guest address space.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-07-08 09:18:45 +02:00
committed by Samuel Ortiz
parent 1842865823
commit d9244e9f4c
3 changed files with 104 additions and 2 deletions

View File

@@ -79,7 +79,12 @@ fn create_app<'a, 'b>(
default_rng: &'a str,
api_server_path: &'a str,
) -> App<'a, 'b> {
App::new("cloud-hypervisor")
#[cfg(target_arch = "x86_64")]
let mut app: App;
#[cfg(target_arch = "aarch64")]
let app: App;
app = App::new("cloud-hypervisor")
// 'BUILT_VERSION' is set by the build script 'build.rs' at
// compile time
.version(env!("BUILT_VERSION"))
@@ -258,7 +263,21 @@ fn create_app<'a, 'b>(
.takes_value(true)
.possible_values(&["true", "false"])
.default_value("true"),
)
);
#[cfg(target_arch = "x86_64")]
{
app = app.arg(
Arg::with_name("sgx-epc")
.long("sgx-epc")
.help(config::SgxEpcConfig::SYNTAX)
.takes_value(true)
.min_values(1)
.group("vm-config"),
);
}
app
}
fn start_vmm(cmd_arguments: ArgMatches) {
@@ -533,6 +552,8 @@ mod unit_tests {
devices: None,
vsock: None,
iommu: false,
#[cfg(target_arch = "x86_64")]
sgx_epc: None,
};
aver_eq!(tb, expected_vm_config, result_vm_config);