Repository: firecracker-microvm/firecracker
File: src/vmm/src/device_manager/mmio.rs (Rust)

Code before:
                            }
                        }
                    }
                    TYPE_NET => {
                        let net = virtio.as_mut_any().downcast_mut::<Net>().unwrap();
                        // If device is activated, kick the net queue(s) to make up for any
                        // pending or in-flight epoll events we may have not captured in snapshot.
                        // No need to kick Ratelimiters because they are restored 'unblocked' so
                        // any inflight `timer_fd` events can be safely discarded.
                        if net.is_activated() {
                            info!("kick net {}.", id);
                            net.process_virtio_queues();
                        }
                    }
                    TYPE_VSOCK => {
                        // Vsock has complicated protocol that isn't resilient to any packet loss,
                        // so for Vsock we don't support connection persistence through snapshot.
                        // Any in-flight packets or events are simply lost.
                        // Vsock is restored 'empty'.
                        // The only reason we still `kick` it is to make guest process
                        // `TRANSPORT_RESET_EVENT` event we sent during snapshot creation.
                        let vsock = virtio
                            .as_mut_any()
                            .downcast_mut::<crate::devices::virtio::vsock::Vsock<
                                crate::devices::virtio::vsock::VsockUnixBackend,
                            >>()
                            .unwrap();
                        if vsock.is_activated() {
                            info!("kick vsock {id}.");
                            vsock.signal_used_queue().unwrap();
                        }
                    }
                    TYPE_RNG => {
                        let entropy = virtio.as_mut_any().downcast_mut::<Entropy>().unwrap();
                        if entropy.is_activated() {
                            info!("kick entropy {id}.");
                            entropy.process_virtio_queues();
                        }
                    }
                    _ => (),
                }
                Ok(())
            });
    }
}

#[cfg(target_arch = "aarch64")]
impl DeviceInfoForFDT for MMIODeviceInfo {
    fn addr(&self) -> u64 {
        self.addr
    }

Review comment (suggestion):
```suggestion
                            .downcast_mut::<Vsock<VsockUnixBackend>>()
```

Code after:
                            }
                        }
                    }
                    TYPE_NET => {
                        let net = virtio.as_mut_any().downcast_mut::<Net>().unwrap();
                        // If device is activated, kick the net queue(s) to make up for any
                        // pending or in-flight epoll events we may have not captured in snapshot.
                        // No need to kick Ratelimiters because they are restored 'unblocked' so
                        // any inflight `timer_fd` events can be safely discarded.
                        if net.is_activated() {
                            info!("kick net {}.", id);
                            net.process_virtio_queues();
                        }
                    }
                    TYPE_VSOCK => {
                        // Vsock has complicated protocol that isn't resilient to any packet loss,
                        // so for Vsock we don't support connection persistence through snapshot.
                        // Any in-flight packets or events are simply lost.
                        // Vsock is restored 'empty'.
                        // The only reason we still `kick` it is to make guest process
                        // `TRANSPORT_RESET_EVENT` event we sent during snapshot creation.
                        let vsock = virtio
                            .as_mut_any()
                            .downcast_mut::<Vsock<VsockUnixBackend>>()
                            .unwrap();
                        if vsock.is_activated() {
                            info!("kick vsock {id}.");
                            vsock.signal_used_queue().unwrap();
                        }
                    }
                    TYPE_RNG => {
                        let entropy = virtio.as_mut_any().downcast_mut::<Entropy>().unwrap();
                        if entropy.is_activated() {
                            info!("kick entropy {id}.");
                            entropy.process_virtio_queues();
                        }
                    }
                    _ => (),
                }
                Ok(())
            });
    }
}

#[cfg(target_arch = "aarch64")]
impl DeviceInfoForFDT for MMIODeviceInfo {
    fn addr(&self) -> u64 {
        self.addr
    }
    fn irq(&self) -> u32 {
        self.irqs[0]