dragonball: fix clippy warning for aarch64

Added aarch64 check.

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
This commit is contained in:
wllenyj 2022-10-12 15:22:10 +08:00
parent a343c570e4
commit 1f1901e059
5 changed files with 14 additions and 10 deletions

View File

@ -795,13 +795,14 @@ impl DeviceManager {
fn allocate_mmio_device_resource( fn allocate_mmio_device_resource(
&self, &self,
) -> std::result::Result<DeviceResources, StartMicroVmError> { ) -> std::result::Result<DeviceResources, StartMicroVmError> {
let mut requests = Vec::new(); let requests = vec![
requests.push(ResourceConstraint::MmioAddress { ResourceConstraint::MmioAddress {
range: None, range: None,
align: MMIO_DEFAULT_CFG_SIZE, align: MMIO_DEFAULT_CFG_SIZE,
size: MMIO_DEFAULT_CFG_SIZE, size: MMIO_DEFAULT_CFG_SIZE,
}); },
requests.push(ResourceConstraint::LegacyIrq { irq: None }); ResourceConstraint::LegacyIrq { irq: None },
];
self.res_manager self.res_manager
.allocate_device_resources(&requests, false) .allocate_device_resources(&requests, false)

View File

@ -39,6 +39,7 @@ impl Vcpu {
/// vcpu thread to vmm thread. /// vcpu thread to vmm thread.
/// * `create_ts` - A timestamp used by the vcpu to calculate its lifetime. /// * `create_ts` - A timestamp used by the vcpu to calculate its lifetime.
/// * `support_immediate_exit` - whether kvm uses supports immediate_exit flag. /// * `support_immediate_exit` - whether kvm uses supports immediate_exit flag.
#[allow(clippy::too_many_arguments)]
pub fn new_aarch64( pub fn new_aarch64(
id: u8, id: u8,
vcpu_fd: Arc<VcpuFd>, vcpu_fd: Arc<VcpuFd>,

View File

@ -851,7 +851,7 @@ pub mod tests {
let kvm = Kvm::new().unwrap(); let kvm = Kvm::new().unwrap();
let vm = Arc::new(kvm.create_vm().unwrap()); let vm = Arc::new(kvm.create_vm().unwrap());
let kvm_context = KvmContext::new(Some(kvm.as_raw_fd())).unwrap(); let _kvm_context = KvmContext::new(Some(kvm.as_raw_fd())).unwrap();
let vcpu_fd = Arc::new(vm.create_vcpu(0).unwrap()); let vcpu_fd = Arc::new(vm.create_vcpu(0).unwrap());
let io_manager = IoManagerCached::new(Arc::new(ArcSwap::new(Arc::new(IoManager::new())))); let io_manager = IoManagerCached::new(Arc::new(ArcSwap::new(Arc::new(IoManager::new()))));
let reset_event_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap(); let reset_event_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap();

View File

@ -774,7 +774,7 @@ impl VcpuManager {
self.reset_event_fd.as_ref().unwrap().try_clone().unwrap(), self.reset_event_fd.as_ref().unwrap().try_clone().unwrap(),
self.vcpu_state_event.try_clone().unwrap(), self.vcpu_state_event.try_clone().unwrap(),
self.vcpu_state_sender.clone(), self.vcpu_state_sender.clone(),
request_ts.clone(), request_ts,
self.support_immediate_exit, self.support_immediate_exit,
) )
.map_err(VcpuManagerError::Vcpu) .map_err(VcpuManagerError::Vcpu)

View File

@ -35,6 +35,7 @@ use crate::event_manager::EventManager;
/// * `device_info` - A hashmap containing the attached devices for building FDT device nodes. /// * `device_info` - A hashmap containing the attached devices for building FDT device nodes.
/// * `gic_device` - The GIC device. /// * `gic_device` - The GIC device.
/// * `initrd` - Information about an optional initrd. /// * `initrd` - Information about an optional initrd.
#[allow(clippy::borrowed_box)]
fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>( fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>(
guest_mem: &M, guest_mem: &M,
cmdline: &str, cmdline: &str,
@ -58,8 +59,9 @@ fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>(
#[cfg(target_arch = "aarch64")] #[cfg(target_arch = "aarch64")]
impl Vm { impl Vm {
/// Gets a reference to the irqchip of the VM /// Gets a reference to the irqchip of the VM
#[allow(clippy::borrowed_box)]
pub fn get_irqchip(&self) -> &Box<dyn GICDevice> { pub fn get_irqchip(&self) -> &Box<dyn GICDevice> {
&self.irqchip_handle.as_ref().unwrap() self.irqchip_handle.as_ref().unwrap()
} }
/// Creates the irq chip in-kernel device model. /// Creates the irq chip in-kernel device model.