mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
numa: Add optional sgx_epc_sections field to NumaConfig
This new option allows the user to define a list of SGX EPC sections attached to a specific NUMA node. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
+14
-2
@@ -218,6 +218,7 @@ impl fmt::Display for Error {
|
||||
ParseRestore(o) => write!(f, "Error parsing --restore: {}", o),
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
ParseSgxEpc(o) => write!(f, "Error parsing --sgx-epc: {}", o),
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
ParseSgxEpcIdMissing => write!(f, "Error parsing --sgx-epc: id missing"),
|
||||
ParseNuma(o) => write!(f, "Error parsing --numa: {}", o),
|
||||
ParseRestoreSourceUrlMissing => {
|
||||
@@ -1647,19 +1648,23 @@ pub struct NumaConfig {
|
||||
pub distances: Option<Vec<NumaDistance>>,
|
||||
#[serde(default)]
|
||||
pub memory_zones: Option<Vec<String>>,
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[serde(default)]
|
||||
pub sgx_epc_sections: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
impl NumaConfig {
|
||||
pub const SYNTAX: &'static str = "Settings related to a given NUMA node \
|
||||
\"guest_numa_id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
memory_zones=<list_of_memory_zones>\"";
|
||||
memory_zones=<list_of_memory_zones>,sgx_epc_sections=<list_of_sgx_epc_sections>\"";
|
||||
pub fn parse(numa: &str) -> Result<Self> {
|
||||
let mut parser = OptionParser::new();
|
||||
parser
|
||||
.add("guest_numa_id")
|
||||
.add("cpus")
|
||||
.add("distances")
|
||||
.add("memory_zones");
|
||||
.add("memory_zones")
|
||||
.add("sgx_epc_sections");
|
||||
parser.parse(numa).map_err(Error::ParseNuma)?;
|
||||
|
||||
let guest_numa_id = parser
|
||||
@@ -1685,12 +1690,19 @@ impl NumaConfig {
|
||||
.convert::<StringList>("memory_zones")
|
||||
.map_err(Error::ParseNuma)?
|
||||
.map(|v| v.0);
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
let sgx_epc_sections = parser
|
||||
.convert::<StringList>("sgx_epc_sections")
|
||||
.map_err(Error::ParseNuma)?
|
||||
.map(|v| v.0);
|
||||
|
||||
Ok(NumaConfig {
|
||||
guest_numa_id,
|
||||
cpus,
|
||||
distances,
|
||||
memory_zones,
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
sgx_epc_sections,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user