vmm: Add mergeable=on|off option to --pmem flag

In order to let the user indicate if the persistent memory pages should
be marked as mergeable or not, a new option is being introduced.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-11-19 15:47:31 -08:00 committed by Rob Bradford
parent e4e8062dda
commit 0f9afc3017
3 changed files with 10 additions and 1 deletions

View File

@ -171,7 +171,7 @@ fn main() {
.long("pmem")
.help(
"Persistent memory parameters \"file=<backing_file_path>,\
size=<persistent_memory_size>,iommu=on|off\"",
size=<persistent_memory_size>,iommu=on|off,mergeable=on|off\"",
)
.takes_value(true)
.min_values(1)

View File

@ -322,6 +322,9 @@ components:
iommu:
type: boolean
default: false
mergeable:
type: boolean
default: false
ConsoleConfig:
required:

View File

@ -455,6 +455,8 @@ pub struct PmemConfig {
pub size: u64,
#[serde(default)]
pub iommu: bool,
#[serde(default)]
pub mergeable: bool,
}
impl PmemConfig {
@ -465,6 +467,7 @@ impl PmemConfig {
let mut file_str: &str = "";
let mut size_str: &str = "";
let mut iommu_str: &str = "";
let mut mergeable_str: &str = "";
for param in params_list.iter() {
if param.starts_with("file=") {
@ -473,6 +476,8 @@ impl PmemConfig {
size_str = &param[5..];
} else if param.starts_with("iommu=") {
iommu_str = &param[6..];
} else if param.starts_with("mergeable=") {
mergeable_str = &param[10..];
}
}
@ -484,6 +489,7 @@ impl PmemConfig {
file: PathBuf::from(file_str),
size: parse_size(size_str)?,
iommu: parse_on_off(iommu_str)?,
mergeable: parse_on_off(mergeable_str)?,
})
}
}