mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Set a default maximum physical address size
When using PVH for booting (which we use for all firmwares and direct kernel boot) the Linux kernel does not configure LA57 correctly. As such we need to limit the address space to the maximum 4-level paging address space. If the user knows that their guest image can take advantage of the 5-level addressing and they need it for their workload then they can increase the physical address space appropriately. This PR removes the TDX specific handling as the new address space limit is below the one that that code specified. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
+15
-4
@@ -20,6 +20,12 @@ use virtio_devices::{RateLimiterConfig, TokenBucketConfig};
|
||||
|
||||
pub const DEFAULT_VCPUS: u8 = 1;
|
||||
pub const DEFAULT_MEMORY_MB: u64 = 512;
|
||||
|
||||
// When booting with PVH boot the maximum physical addressable size
|
||||
// is a 46 bit address space even when the host supports with 5-level
|
||||
// paging.
|
||||
pub const DEFAULT_MAX_PHYS_BITS: u8 = 46;
|
||||
|
||||
pub const DEFAULT_RNG_SOURCE: &str = "/dev/urandom";
|
||||
pub const DEFAULT_NUM_QUEUES_VUNET: usize = 2;
|
||||
pub const DEFAULT_QUEUE_SIZE_VUNET: u16 = 256;
|
||||
@@ -410,6 +416,10 @@ impl FromStr for CpuTopology {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_cpuconfig_max_phys_bits() -> u8 {
|
||||
DEFAULT_MAX_PHYS_BITS
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||
pub struct CpusConfig {
|
||||
pub boot_vcpus: u8,
|
||||
@@ -418,8 +428,8 @@ pub struct CpusConfig {
|
||||
pub topology: Option<CpuTopology>,
|
||||
#[serde(default)]
|
||||
pub kvm_hyperv: bool,
|
||||
#[serde(default)]
|
||||
pub max_phys_bits: Option<u8>,
|
||||
#[serde(default = "default_cpuconfig_max_phys_bits")]
|
||||
pub max_phys_bits: u8,
|
||||
}
|
||||
|
||||
impl CpusConfig {
|
||||
@@ -449,7 +459,8 @@ impl CpusConfig {
|
||||
.0;
|
||||
let max_phys_bits = parser
|
||||
.convert::<u8>("max_phys_bits")
|
||||
.map_err(Error::ParseCpus)?;
|
||||
.map_err(Error::ParseCpus)?
|
||||
.unwrap_or(DEFAULT_MAX_PHYS_BITS);
|
||||
|
||||
Ok(CpusConfig {
|
||||
boot_vcpus,
|
||||
@@ -468,7 +479,7 @@ impl Default for CpusConfig {
|
||||
max_vcpus: DEFAULT_VCPUS,
|
||||
topology: None,
|
||||
kvm_hyperv: false,
|
||||
max_phys_bits: None,
|
||||
max_phys_bits: DEFAULT_MAX_PHYS_BITS,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user