pub fn register_mmio_rtc(&mut self, vm: &VmFd) -> Result<()> {
        if self.irq > self.last_irq {
            return Err(Error::IrqsExhausted);
        }

        // Attaching the RTC device.
        let rtc_evt = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;
        let device = devices::legacy::RTC::new(rtc_evt.try_clone().map_err(Error::EventFd)?);
        vm.register_irqfd(&rtc_evt, self.irq)
            .map_err(Error::RegisterIrqFd)?;

        self.bus
            .insert(Arc::new(Mutex::new(device)), self.mmio_base, MMIO_LEN)
            .map_err(|err| Error::BusError(err))?;

        let ret = self.mmio_base;
        self.id_to_dev_info.insert(
            (DeviceType::RTC, "rtc".to_string()),
            MMIODeviceInfo {
                addr: ret,
                len: MMIO_LEN,
                irq: self.irq,
            },
        );

        self.mmio_base += MMIO_LEN;
        self.irq += 1;

        Ok(())
    }
/// Register a MMIO RTC device.
Register a MMIO RTC device.
Register a MMIO RTC device .
pub fn register_mmio_rtc(&mut self, vm: &VmFd) -> Result<()> {
        if self.irq > self.last_irq {
            return Err(Error::IrqsExhausted);
        }
        // Attaching the RTC device.
        let rtc_evt = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;
        let device = devices::legacy::RTC::new(rtc_evt.try_clone().map_err(Error::EventFd)?);
        vm.register_irqfd(&rtc_evt, self.irq)
            .map_err(Error::RegisterIrqFd)?;
        self.bus
            .insert(Arc::new(Mutex::new(device)), self.mmio_base, MMIO_LEN)
            .map_err(|err| Error::BusError(err))?;
        let ret = self.mmio_base;
        self.id_to_dev_info.insert(
            (DeviceType::RTC, "rtc".to_string()),
            MMIODeviceInfo {
                addr: ret,
                len: MMIO_LEN,
                irq: self.irq,
            },
        );
        self.mmio_base += MMIO_LEN;
        self.irq += 1;
        Ok(())
    }
pub fn register_mmio_rtc ( & mut self , vm : & VmFd ) -> Result < ( ) > { if self . irq > self . last_irq { return Err ( Error :: IrqsExhausted ) ; } // Attaching the RTC device. let rtc_evt = EventFd :: new ( utils :: eventfd :: EFD_NONBLOCK ) . map_err ( Error :: EventFd ) ? ; let device = devices :: legacy :: RTC :: new ( rtc_evt . try_clone ( ) . map_err ( Error :: EventFd ) ? ) ; vm . register_irqfd ( & rtc_evt , self . irq ) . map_err ( Error :: RegisterIrqFd ) ? ; self . bus . insert ( Arc :: new ( Mutex :: new ( device ) ) , self . mmio_base , MMIO_LEN ) . map_err ( | err | Error :: BusError ( err ) ) ? ; let ret = self . mmio_base ; self . id_to_dev_info . insert ( ( DeviceType :: RTC , " " . to_string ( ) ) , MMIODeviceInfo { addr : ret , len : MMIO_LEN , irq : self . irq , } , ) ; self . mmio_base += MMIO_LEN ; self . irq += 1 ; Ok ( ( ) ) }
Register a MMIO RTC device.
Register a MMIO RTC device .
&mut self
vm
&VmFd