vmm: Fix AArch64 clippy warnings of vmm and other crates

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2020-08-23 15:45:44 +08:00 committed by Sebastien Boeuf
parent 46b8f38987
commit afc98a5ec9
7 changed files with 9 additions and 11 deletions

View File

@ -47,8 +47,7 @@ impl Gic {
impl InterruptController for Gic { impl InterruptController for Gic {
fn enable(&self) -> Result<()> { fn enable(&self) -> Result<()> {
&self self.interrupt_source_group
.interrupt_source_group
.enable() .enable()
.map_err(Error::EnableInterrupt)?; .map_err(Error::EnableInterrupt)?;
Ok(()) Ok(())

View File

@ -949,6 +949,7 @@ impl cpu::Vcpu for KvmVcpu {
#[allow(unused_variables)] #[allow(unused_variables)]
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
fn set_state(&self, state: &CpuState) -> cpu::Result<()> { fn set_state(&self, state: &CpuState) -> cpu::Result<()> {
warn!("CPU state was not restored");
Ok(()) Ok(())
} }
} }

View File

@ -2,8 +2,6 @@
// //
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
#[cfg(target_arch = "aarch64")]
use arch;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
use std::collections::btree_map::BTreeMap; use std::collections::btree_map::BTreeMap;
use std::result; use std::result;
@ -65,6 +63,7 @@ impl GsiAllocator {
} }
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
#[allow(clippy::new_without_default)]
/// New GSI allocator /// New GSI allocator
pub fn new() -> Self { pub fn new() -> Self {
GsiAllocator { GsiAllocator {

View File

@ -981,12 +981,10 @@ impl CpuManager {
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
pub fn get_mpidrs(&self) -> Vec<u64> { pub fn get_mpidrs(&self) -> Vec<u64> {
let vcpu_mpidrs = self self.vcpus
.vcpus
.iter() .iter()
.map(|cpu| cpu.lock().unwrap().get_mpidr()) .map(|cpu| cpu.lock().unwrap().get_mpidr())
.collect(); .collect()
vcpu_mpidrs
} }
#[cfg(feature = "acpi")] #[cfg(feature = "acpi")]

View File

@ -1356,7 +1356,7 @@ impl DeviceManager {
self.address_manager self.address_manager
.mmio_bus .mmio_bus
.insert(rtc_device.clone(), addr.0, MMIO_LEN) .insert(rtc_device, addr.0, MMIO_LEN)
.map_err(DeviceManagerError::BusError)?; .map_err(DeviceManagerError::BusError)?;
self.id_to_dev_info.insert( self.id_to_dev_info.insert(

View File

@ -604,6 +604,7 @@ impl MemoryManager {
// If the next area is hotplugged RAM, the start address needs to be aligned // If the next area is hotplugged RAM, the start address needs to be aligned
// to 128MiB boundary, and a gap of 256MiB need to be set before it. // to 128MiB boundary, and a gap of 256MiB need to be set before it.
// On x86_64, it must also start at the 64bit start. // On x86_64, it must also start at the 64bit start.
#[allow(clippy::let_and_return)]
fn start_addr(mem_end: GuestAddress, with_gap: bool) -> GuestAddress { fn start_addr(mem_end: GuestAddress, with_gap: bool) -> GuestAddress {
let start_addr = if with_gap { let start_addr = if with_gap {
GuestAddress((mem_end.0 + 1 + (256 << 20)) & !((128 << 20) - 1)) GuestAddress((mem_end.0 + 1 + (256 << 20)) & !((128 << 20) - 1))

View File

@ -401,7 +401,7 @@ impl Vm {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
vm.enable_split_irq().unwrap(); vm.enable_split_irq().unwrap();
let vm_snapshot = get_vm_snapshot(snapshot).map_err(Error::Restore)?; let vm_snapshot = get_vm_snapshot(snapshot).map_err(Error::Restore)?;
let config = vm_snapshot.config.clone(); let config = vm_snapshot.config;
if let Some(state) = vm_snapshot.state { if let Some(state) = vm_snapshot.state {
vm.set_state(&state) vm.set_state(&state)
.map_err(|e| Error::Restore(MigratableError::Restore(e.into())))?; .map_err(|e| Error::Restore(MigratableError::Restore(e.into())))?;
@ -1576,7 +1576,7 @@ mod tests {
&CString::new("console=tty0").unwrap(), &CString::new("console=tty0").unwrap(),
vec![0], vec![0],
&dev_info, &dev_info,
&gic, &*gic,
&None, &None,
&None, &None,
) )