From 0f9afc30172a3bd3fe5f9635690ac53332a4a24d Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 19 Nov 2019 15:47:31 -0800 Subject: [PATCH] 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 --- src/main.rs | 2 +- vmm/src/api/openapi/cloud-hypervisor.yaml | 3 +++ vmm/src/config.rs | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b91348848..ec3da26bf 100755 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,7 @@ fn main() { .long("pmem") .help( "Persistent memory parameters \"file=,\ - size=,iommu=on|off\"", + size=,iommu=on|off,mergeable=on|off\"", ) .takes_value(true) .min_values(1) diff --git a/vmm/src/api/openapi/cloud-hypervisor.yaml b/vmm/src/api/openapi/cloud-hypervisor.yaml index c77368a03..aa9f0d882 100644 --- a/vmm/src/api/openapi/cloud-hypervisor.yaml +++ b/vmm/src/api/openapi/cloud-hypervisor.yaml @@ -322,6 +322,9 @@ components: iommu: type: boolean default: false + mergeable: + type: boolean + default: false ConsoleConfig: required: diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 34194ed09..aab40ed0f 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -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 = ¶m[5..]; } else if param.starts_with("iommu=") { iommu_str = ¶m[6..]; + } else if param.starts_with("mergeable=") { + mergeable_str = ¶m[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)?, }) } }