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") .long("pmem")
.help( .help(
"Persistent memory parameters \"file=<backing_file_path>,\ "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) .takes_value(true)
.min_values(1) .min_values(1)

View File

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

View File

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