mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-05 01:12:36 +00:00
vmm: Address Rust 1.51.0 clippy issue (upper_case_acroynms)
warning: name `LocalAPIC` contains a capitalized acronym --> vmm/src/cpu.rs:197:8 | 197 | struct LocalAPIC { | ^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `LocalApic` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
7c302373ed
commit
9762c8bc28
@ -17,7 +17,7 @@ use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemoryMmap, Guest
|
|||||||
|
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct PCIRangeEntry {
|
struct PciRangeEntry {
|
||||||
pub base_address: u64,
|
pub base_address: u64,
|
||||||
pub segment: u16,
|
pub segment: u16,
|
||||||
pub start: u8,
|
pub start: u8,
|
||||||
@ -188,7 +188,7 @@ pub fn create_acpi_tables(
|
|||||||
mcfg.append(0u64);
|
mcfg.append(0u64);
|
||||||
|
|
||||||
// 32-bit PCI enhanced configuration mechanism
|
// 32-bit PCI enhanced configuration mechanism
|
||||||
mcfg.append(PCIRangeEntry {
|
mcfg.append(PciRangeEntry {
|
||||||
base_address: arch::layout::PCI_MMCONFIG_START.0,
|
base_address: arch::layout::PCI_MMCONFIG_START.0,
|
||||||
segment: 0,
|
segment: 0,
|
||||||
start: 0,
|
start: 0,
|
||||||
|
@ -261,7 +261,7 @@ pub fn start_http_thread(
|
|||||||
) -> Result<thread::JoinHandle<Result<()>>> {
|
) -> Result<thread::JoinHandle<Result<()>>> {
|
||||||
std::fs::remove_file(path).unwrap_or_default();
|
std::fs::remove_file(path).unwrap_or_default();
|
||||||
let socket_path = PathBuf::from(path);
|
let socket_path = PathBuf::from(path);
|
||||||
let mut server = HttpServer::new(socket_path).map_err(Error::CreatingAPIServer)?;
|
let mut server = HttpServer::new(socket_path).map_err(Error::CreateApiServer)?;
|
||||||
|
|
||||||
// Retrieve seccomp filter for API thread
|
// Retrieve seccomp filter for API thread
|
||||||
let api_seccomp_filter =
|
let api_seccomp_filter =
|
||||||
|
@ -55,7 +55,7 @@ pub enum Error {
|
|||||||
/// Error parsing network options
|
/// Error parsing network options
|
||||||
ParseNetwork(OptionParserError),
|
ParseNetwork(OptionParserError),
|
||||||
/// Error parsing RNG options
|
/// Error parsing RNG options
|
||||||
ParseRNG(OptionParserError),
|
ParseRng(OptionParserError),
|
||||||
/// Error parsing balloon options
|
/// Error parsing balloon options
|
||||||
ParseBalloon(OptionParserError),
|
ParseBalloon(OptionParserError),
|
||||||
/// Error parsing filesystem parameters
|
/// Error parsing filesystem parameters
|
||||||
@ -195,7 +195,7 @@ impl fmt::Display for Error {
|
|||||||
ParseMemoryZoneIdMissing => write!(f, "Error parsing --memory-zone: id missing"),
|
ParseMemoryZoneIdMissing => write!(f, "Error parsing --memory-zone: id missing"),
|
||||||
ParseNetwork(o) => write!(f, "Error parsing --net: {}", o),
|
ParseNetwork(o) => write!(f, "Error parsing --net: {}", o),
|
||||||
ParseDisk(o) => write!(f, "Error parsing --disk: {}", o),
|
ParseDisk(o) => write!(f, "Error parsing --disk: {}", o),
|
||||||
ParseRNG(o) => write!(f, "Error parsing --rng: {}", o),
|
ParseRng(o) => write!(f, "Error parsing --rng: {}", o),
|
||||||
ParseBalloon(o) => write!(f, "Error parsing --balloon: {}", o),
|
ParseBalloon(o) => write!(f, "Error parsing --balloon: {}", o),
|
||||||
ParseRestore(o) => write!(f, "Error parsing --restore: {}", o),
|
ParseRestore(o) => write!(f, "Error parsing --restore: {}", o),
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
@ -1036,7 +1036,7 @@ impl RngConfig {
|
|||||||
pub fn parse(rng: &str) -> Result<Self> {
|
pub fn parse(rng: &str) -> Result<Self> {
|
||||||
let mut parser = OptionParser::new();
|
let mut parser = OptionParser::new();
|
||||||
parser.add("src").add("iommu");
|
parser.add("src").add("iommu");
|
||||||
parser.parse(rng).map_err(Error::ParseRNG)?;
|
parser.parse(rng).map_err(Error::ParseRng)?;
|
||||||
|
|
||||||
let src = PathBuf::from(
|
let src = PathBuf::from(
|
||||||
parser
|
parser
|
||||||
@ -1045,7 +1045,7 @@ impl RngConfig {
|
|||||||
);
|
);
|
||||||
let iommu = parser
|
let iommu = parser
|
||||||
.convert::<Toggle>("iommu")
|
.convert::<Toggle>("iommu")
|
||||||
.map_err(Error::ParseRNG)?
|
.map_err(Error::ParseRng)?
|
||||||
.unwrap_or(Toggle(false))
|
.unwrap_or(Toggle(false))
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ pub enum Error {
|
|||||||
BusError(vm_device::BusError),
|
BusError(vm_device::BusError),
|
||||||
|
|
||||||
/// Asking for more vCPUs that we can have
|
/// Asking for more vCPUs that we can have
|
||||||
DesiredVCPUCountExceedsMax,
|
DesiredVCpuCountExceedsMax,
|
||||||
|
|
||||||
/// Failed to get KVM vcpu lapic.
|
/// Failed to get KVM vcpu lapic.
|
||||||
VcpuGetLapic(anyhow::Error),
|
VcpuGetLapic(anyhow::Error),
|
||||||
@ -173,15 +173,15 @@ pub enum Error {
|
|||||||
UnexpectedVmExit,
|
UnexpectedVmExit,
|
||||||
|
|
||||||
/// Failed to allocate MMIO address
|
/// Failed to allocate MMIO address
|
||||||
AllocateMMIOAddress,
|
AllocateMmmioAddress,
|
||||||
|
|
||||||
/// Error populating CPUID with KVM HyperV emulation details
|
/// Error populating CPUID with KVM HyperV emulation details
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
CpuidKVMHyperV(vmm_sys_util::fam::Error),
|
CpuidKvmHyperV(vmm_sys_util::fam::Error),
|
||||||
|
|
||||||
/// Error populating CPUID with KVM HyperV emulation details
|
/// Error populating CPUID with KVM HyperV emulation details
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
CpuidSGX(arch::x86_64::Error),
|
CpuidSgx(arch::x86_64::Error),
|
||||||
|
|
||||||
/// Error populating CPUID with CPU identification
|
/// Error populating CPUID with CPU identification
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
@ -194,7 +194,7 @@ pub type Result<T> = result::Result<T, Error>;
|
|||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
struct LocalAPIC {
|
struct LocalApic {
|
||||||
pub r#type: u8,
|
pub r#type: u8,
|
||||||
pub length: u8,
|
pub length: u8,
|
||||||
pub processor_id: u8,
|
pub processor_id: u8,
|
||||||
@ -204,7 +204,7 @@ struct LocalAPIC {
|
|||||||
|
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct IOAPIC {
|
struct Ioapic {
|
||||||
pub r#type: u8,
|
pub r#type: u8,
|
||||||
pub length: u8,
|
pub length: u8,
|
||||||
pub ioapic_id: u8,
|
pub ioapic_id: u8,
|
||||||
@ -585,7 +585,7 @@ impl CpuManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, CPU_MANAGER_ACPI_SIZE as u64, None)
|
.allocate_mmio_addresses(None, CPU_MANAGER_ACPI_SIZE as u64, None)
|
||||||
.ok_or(Error::AllocateMMIOAddress)?;
|
.ok_or(Error::AllocateMmmioAddress)?;
|
||||||
let cpu_manager = Arc::new(Mutex::new(CpuManager {
|
let cpu_manager = Arc::new(Mutex::new(CpuManager {
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
interrupt_controller: device_manager.interrupt_controller().clone(),
|
interrupt_controller: device_manager.interrupt_controller().clone(),
|
||||||
@ -680,7 +680,7 @@ impl CpuManager {
|
|||||||
|
|
||||||
if let Some(sgx_epc_sections) = sgx_epc_sections {
|
if let Some(sgx_epc_sections) = sgx_epc_sections {
|
||||||
arch::x86_64::update_cpuid_sgx(&mut cpuid, sgx_epc_sections)
|
arch::x86_64::update_cpuid_sgx(&mut cpuid, sgx_epc_sections)
|
||||||
.map_err(Error::CpuidSGX)?;
|
.map_err(Error::CpuidSgx)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set CPU physical bits
|
// Set CPU physical bits
|
||||||
@ -721,14 +721,14 @@ impl CpuManager {
|
|||||||
edx: 0x7648204d, // "M Hv"
|
edx: 0x7648204d, // "M Hv"
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.map_err(Error::CpuidKVMHyperV)?;
|
.map_err(Error::CpuidKvmHyperV)?;
|
||||||
cpuid
|
cpuid
|
||||||
.push(CpuIdEntry {
|
.push(CpuIdEntry {
|
||||||
function: 0x40000001,
|
function: 0x40000001,
|
||||||
eax: 0x31237648, // "Hv#1"
|
eax: 0x31237648, // "Hv#1"
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.map_err(Error::CpuidKVMHyperV)?;
|
.map_err(Error::CpuidKvmHyperV)?;
|
||||||
cpuid
|
cpuid
|
||||||
.push(CpuIdEntry {
|
.push(CpuIdEntry {
|
||||||
function: 0x40000002,
|
function: 0x40000002,
|
||||||
@ -736,7 +736,7 @@ impl CpuManager {
|
|||||||
ebx: 0xa0000, // "Version"
|
ebx: 0xa0000, // "Version"
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.map_err(Error::CpuidKVMHyperV)?;
|
.map_err(Error::CpuidKvmHyperV)?;
|
||||||
cpuid
|
cpuid
|
||||||
.push(CpuIdEntry {
|
.push(CpuIdEntry {
|
||||||
function: 0x4000_0003,
|
function: 0x4000_0003,
|
||||||
@ -746,14 +746,14 @@ impl CpuManager {
|
|||||||
| 1 << 9, // AccessPartitionReferenceTsc
|
| 1 << 9, // AccessPartitionReferenceTsc
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.map_err(Error::CpuidKVMHyperV)?;
|
.map_err(Error::CpuidKvmHyperV)?;
|
||||||
for i in 0x4000_0004..=0x4000_000a {
|
for i in 0x4000_0004..=0x4000_000a {
|
||||||
cpuid
|
cpuid
|
||||||
.push(CpuIdEntry {
|
.push(CpuIdEntry {
|
||||||
function: i,
|
function: i,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.map_err(Error::CpuidKVMHyperV)?;
|
.map_err(Error::CpuidKvmHyperV)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +817,7 @@ impl CpuManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if desired_vcpus > self.config.max_vcpus {
|
if desired_vcpus > self.config.max_vcpus {
|
||||||
return Err(Error::DesiredVCPUCountExceedsMax);
|
return Err(Error::DesiredVCpuCountExceedsMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only create vCPUs in excess of all the allocated vCPUs.
|
// Only create vCPUs in excess of all the allocated vCPUs.
|
||||||
@ -970,7 +970,7 @@ impl CpuManager {
|
|||||||
/// Start up as many vCPUs threads as needed to reach `desired_vcpus`
|
/// Start up as many vCPUs threads as needed to reach `desired_vcpus`
|
||||||
fn activate_vcpus(&mut self, desired_vcpus: u8, inserting: bool) -> Result<()> {
|
fn activate_vcpus(&mut self, desired_vcpus: u8, inserting: bool) -> Result<()> {
|
||||||
if desired_vcpus > self.config.max_vcpus {
|
if desired_vcpus > self.config.max_vcpus {
|
||||||
return Err(Error::DesiredVCPUCountExceedsMax);
|
return Err(Error::DesiredVCpuCountExceedsMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
let vcpu_thread_barrier = Arc::new(Barrier::new(
|
let vcpu_thread_barrier = Arc::new(Barrier::new(
|
||||||
@ -1144,7 +1144,7 @@ impl CpuManager {
|
|||||||
madt.write(36, arch::layout::APIC_START);
|
madt.write(36, arch::layout::APIC_START);
|
||||||
|
|
||||||
for cpu in 0..self.config.max_vcpus {
|
for cpu in 0..self.config.max_vcpus {
|
||||||
let lapic = LocalAPIC {
|
let lapic = LocalApic {
|
||||||
r#type: 0,
|
r#type: 0,
|
||||||
length: 8,
|
length: 8,
|
||||||
processor_id: cpu,
|
processor_id: cpu,
|
||||||
@ -1158,7 +1158,7 @@ impl CpuManager {
|
|||||||
madt.append(lapic);
|
madt.append(lapic);
|
||||||
}
|
}
|
||||||
|
|
||||||
madt.append(IOAPIC {
|
madt.append(Ioapic {
|
||||||
r#type: 1,
|
r#type: 1,
|
||||||
length: 12,
|
length: 12,
|
||||||
ioapic_id: 0,
|
ioapic_id: 0,
|
||||||
@ -1187,7 +1187,7 @@ impl CpuManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
struct CPU {
|
struct Cpu {
|
||||||
cpu_id: u8,
|
cpu_id: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,9 +1195,9 @@ struct CPU {
|
|||||||
const MADT_CPU_ENABLE_FLAG: usize = 0;
|
const MADT_CPU_ENABLE_FLAG: usize = 0;
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for CPU {
|
impl Aml for Cpu {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||||
let lapic = LocalAPIC {
|
let lapic = LocalApic {
|
||||||
r#type: 0,
|
r#type: 0,
|
||||||
length: 8,
|
length: 8,
|
||||||
processor_id: self.cpu_id,
|
processor_id: self.cpu_id,
|
||||||
@ -1207,7 +1207,7 @@ impl Aml for CPU {
|
|||||||
|
|
||||||
let mut mat_data: Vec<u8> = Vec::new();
|
let mut mat_data: Vec<u8> = Vec::new();
|
||||||
mat_data.resize(std::mem::size_of_val(&lapic), 0);
|
mat_data.resize(std::mem::size_of_val(&lapic), 0);
|
||||||
unsafe { *(mat_data.as_mut_ptr() as *mut LocalAPIC) = lapic };
|
unsafe { *(mat_data.as_mut_ptr() as *mut LocalApic) = lapic };
|
||||||
|
|
||||||
aml::Device::new(
|
aml::Device::new(
|
||||||
format!("C{:03}", self.cpu_id).as_str().into(),
|
format!("C{:03}", self.cpu_id).as_str().into(),
|
||||||
@ -1252,12 +1252,12 @@ impl Aml for CPU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
struct CPUNotify {
|
struct CpuNotify {
|
||||||
cpu_id: u8,
|
cpu_id: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for CPUNotify {
|
impl Aml for CpuNotify {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||||
let object = aml::Path::new(&format!("C{:03}", self.cpu_id));
|
let object = aml::Path::new(&format!("C{:03}", self.cpu_id));
|
||||||
aml::If::new(
|
aml::If::new(
|
||||||
@ -1269,12 +1269,12 @@ impl Aml for CPUNotify {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
struct CPUMethods {
|
struct CpuMethods {
|
||||||
max_vcpus: u8,
|
max_vcpus: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
impl Aml for CPUMethods {
|
impl Aml for CpuMethods {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||||
let mut bytes = Vec::new();
|
let mut bytes = Vec::new();
|
||||||
bytes.extend_from_slice(
|
bytes.extend_from_slice(
|
||||||
@ -1305,7 +1305,7 @@ impl Aml for CPUMethods {
|
|||||||
|
|
||||||
let mut cpu_notifies = Vec::new();
|
let mut cpu_notifies = Vec::new();
|
||||||
for cpu_id in 0..self.max_vcpus {
|
for cpu_id in 0..self.max_vcpus {
|
||||||
cpu_notifies.push(CPUNotify { cpu_id });
|
cpu_notifies.push(CpuNotify { cpu_id });
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut cpu_notifies_refs: Vec<&dyn aml::Aml> = Vec::new();
|
let mut cpu_notifies_refs: Vec<&dyn aml::Aml> = Vec::new();
|
||||||
@ -1455,14 +1455,14 @@ impl Aml for CpuManager {
|
|||||||
let hid = aml::Name::new("_HID".into(), &"ACPI0010");
|
let hid = aml::Name::new("_HID".into(), &"ACPI0010");
|
||||||
let uid = aml::Name::new("_CID".into(), &aml::EisaName::new("PNP0A05"));
|
let uid = aml::Name::new("_CID".into(), &aml::EisaName::new("PNP0A05"));
|
||||||
// Bundle methods together under a common object
|
// Bundle methods together under a common object
|
||||||
let methods = CPUMethods {
|
let methods = CpuMethods {
|
||||||
max_vcpus: self.config.max_vcpus,
|
max_vcpus: self.config.max_vcpus,
|
||||||
};
|
};
|
||||||
let mut cpu_data_inner: Vec<&dyn aml::Aml> = vec![&hid, &uid, &methods];
|
let mut cpu_data_inner: Vec<&dyn aml::Aml> = vec![&hid, &uid, &methods];
|
||||||
|
|
||||||
let mut cpu_devices = Vec::new();
|
let mut cpu_devices = Vec::new();
|
||||||
for cpu_id in 0..self.config.max_vcpus {
|
for cpu_id in 0..self.config.max_vcpus {
|
||||||
let cpu_device = CPU { cpu_id };
|
let cpu_device = Cpu { cpu_id };
|
||||||
|
|
||||||
cpu_devices.push(cpu_device);
|
cpu_devices.push(cpu_device);
|
||||||
}
|
}
|
||||||
|
@ -278,10 +278,10 @@ pub enum DeviceManagerError {
|
|||||||
BusError(vm_device::BusError),
|
BusError(vm_device::BusError),
|
||||||
|
|
||||||
/// Failed to allocate IO port
|
/// Failed to allocate IO port
|
||||||
AllocateIOPort,
|
AllocateIoPort,
|
||||||
|
|
||||||
/// Failed to allocate MMIO address
|
/// Failed to allocate MMIO address
|
||||||
AllocateMMIOAddress,
|
AllocateMmioAddress,
|
||||||
|
|
||||||
// Failed to make hotplug notification
|
// Failed to make hotplug notification
|
||||||
HotPlugNotification(io::Error),
|
HotPlugNotification(io::Error),
|
||||||
@ -432,13 +432,13 @@ const DEVICE_MANAGER_ACPI_SIZE: usize = 0x10;
|
|||||||
pub fn get_win_size() -> (u16, u16) {
|
pub fn get_win_size() -> (u16, u16) {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct WS {
|
struct WindowSize {
|
||||||
rows: u16,
|
rows: u16,
|
||||||
cols: u16,
|
cols: u16,
|
||||||
xpixel: u16,
|
xpixel: u16,
|
||||||
ypixel: u16,
|
ypixel: u16,
|
||||||
}
|
}
|
||||||
let ws: WS = WS::default();
|
let ws: WindowSize = WindowSize::default();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::ioctl(0, TIOCGWINSZ, &ws);
|
libc::ioctl(0, TIOCGWINSZ, &ws);
|
||||||
@ -983,7 +983,7 @@ impl DeviceManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, DEVICE_MANAGER_ACPI_SIZE as u64, None)
|
.allocate_mmio_addresses(None, DEVICE_MANAGER_ACPI_SIZE as u64, None)
|
||||||
.ok_or(DeviceManagerError::AllocateIOPort)?;
|
.ok_or(DeviceManagerError::AllocateIoPort)?;
|
||||||
let device_manager = DeviceManager {
|
let device_manager = DeviceManager {
|
||||||
address_manager: Arc::clone(&address_manager),
|
address_manager: Arc::clone(&address_manager),
|
||||||
console: Arc::new(Console::default()),
|
console: Arc::new(Console::default()),
|
||||||
@ -1394,7 +1394,7 @@ impl DeviceManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_io_addresses(Some(GuestAddress(0x3c0)), 0x8, None)
|
.allocate_io_addresses(Some(GuestAddress(0x3c0)), 0x8, None)
|
||||||
.ok_or(DeviceManagerError::AllocateIOPort)?;
|
.ok_or(DeviceManagerError::AllocateIoPort)?;
|
||||||
|
|
||||||
self.address_manager
|
self.address_manager
|
||||||
.io_bus
|
.io_bus
|
||||||
@ -1420,7 +1420,7 @@ impl DeviceManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, devices::acpi::GED_DEVICE_ACPI_SIZE as u64, None)
|
.allocate_mmio_addresses(None, devices::acpi::GED_DEVICE_ACPI_SIZE as u64, None)
|
||||||
.ok_or(DeviceManagerError::AllocateMMIOAddress)?;
|
.ok_or(DeviceManagerError::AllocateMmioAddress)?;
|
||||||
let ged_device = Arc::new(Mutex::new(devices::AcpiGEDDevice::new(
|
let ged_device = Arc::new(Mutex::new(devices::AcpiGEDDevice::new(
|
||||||
interrupt_group,
|
interrupt_group,
|
||||||
ged_irq,
|
ged_irq,
|
||||||
@ -1449,7 +1449,7 @@ impl DeviceManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_io_addresses(Some(GuestAddress(0xb008)), 0x4, None)
|
.allocate_io_addresses(Some(GuestAddress(0xb008)), 0x4, None)
|
||||||
.ok_or(DeviceManagerError::AllocateIOPort)?;
|
.ok_or(DeviceManagerError::AllocateIoPort)?;
|
||||||
|
|
||||||
self.address_manager
|
self.address_manager
|
||||||
.io_bus
|
.io_bus
|
||||||
@ -1638,7 +1638,7 @@ impl DeviceManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_io_addresses(Some(GuestAddress(0x3f8)), 0x8, None)
|
.allocate_io_addresses(Some(GuestAddress(0x3f8)), 0x8, None)
|
||||||
.ok_or(DeviceManagerError::AllocateIOPort)?;
|
.ok_or(DeviceManagerError::AllocateIoPort)?;
|
||||||
|
|
||||||
self.address_manager
|
self.address_manager
|
||||||
.io_bus
|
.io_bus
|
||||||
|
@ -143,7 +143,7 @@ pub enum Error {
|
|||||||
|
|
||||||
/// Error creating API server
|
/// Error creating API server
|
||||||
#[error("Error creating API server {0:?}")]
|
#[error("Error creating API server {0:?}")]
|
||||||
CreatingAPIServer(micro_http::ServerError),
|
CreateApiServer(micro_http::ServerError),
|
||||||
}
|
}
|
||||||
pub type Result<T> = result::Result<T, Error>;
|
pub type Result<T> = result::Result<T, Error>;
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ pub enum Error {
|
|||||||
NoSlotAvailable,
|
NoSlotAvailable,
|
||||||
|
|
||||||
/// Not enough space in the hotplug RAM region
|
/// Not enough space in the hotplug RAM region
|
||||||
InsufficientHotplugRAM,
|
InsufficientHotplugRam,
|
||||||
|
|
||||||
/// The requested hotplug memory addition is not a valid size
|
/// The requested hotplug memory addition is not a valid size
|
||||||
InvalidSize,
|
InvalidSize,
|
||||||
@ -267,7 +267,7 @@ pub enum Error {
|
|||||||
SnapshotCopy(GuestMemoryError),
|
SnapshotCopy(GuestMemoryError),
|
||||||
|
|
||||||
/// Failed to allocate MMIO address
|
/// Failed to allocate MMIO address
|
||||||
AllocateMMIOAddress,
|
AllocateMmioAddress,
|
||||||
}
|
}
|
||||||
|
|
||||||
const ENABLE_FLAG: usize = 0;
|
const ENABLE_FLAG: usize = 0;
|
||||||
@ -741,7 +741,7 @@ impl MemoryManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, MEMORY_MANAGER_ACPI_SIZE as u64, None)
|
.allocate_mmio_addresses(None, MEMORY_MANAGER_ACPI_SIZE as u64, None)
|
||||||
.ok_or(Error::AllocateMMIOAddress)?;
|
.ok_or(Error::AllocateMmioAddress)?;
|
||||||
|
|
||||||
#[cfg(not(feature = "tdx"))]
|
#[cfg(not(feature = "tdx"))]
|
||||||
let log_dirty = true;
|
let log_dirty = true;
|
||||||
@ -1160,7 +1160,7 @@ impl MemoryManager {
|
|||||||
let start_addr = MemoryManager::start_addr(self.guest_memory.memory().last_addr(), true)?;
|
let start_addr = MemoryManager::start_addr(self.guest_memory.memory().last_addr(), true)?;
|
||||||
|
|
||||||
if start_addr.checked_add(size.try_into().unwrap()).unwrap() > self.start_of_device_area() {
|
if start_addr.checked_add(size.try_into().unwrap()).unwrap() > self.start_of_device_area() {
|
||||||
return Err(Error::InsufficientHotplugRAM);
|
return Err(Error::InsufficientHotplugRam);
|
||||||
}
|
}
|
||||||
|
|
||||||
let region = self.add_ram_region(start_addr, size)?;
|
let region = self.add_ram_region(start_addr, size)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user