File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ use userfaultfd::Uffd;
1515use utils:: time:: TimestampUs ;
1616#[ cfg( target_arch = "aarch64" ) ]
1717use vm_memory:: GuestAddress ;
18- #[ cfg( target_arch = "aarch64" ) ]
19- use vm_superio:: Rtc ;
2018
2119use crate :: arch:: { ConfigurationError , configure_system_for_boot, load_kernel} ;
2220#[ cfg( target_arch = "aarch64" ) ]
@@ -628,9 +626,7 @@ fn attach_legacy_devices_aarch64(
628626 . map_err ( VmmError :: RegisterMMIODevice ) ?;
629627 }
630628
631- let rtc = RTCDevice ( Rtc :: with_events (
632- & crate :: devices:: legacy:: rtc_pl031:: METRICS ,
633- ) ) ;
629+ let rtc = RTCDevice :: new ( ) ;
634630 vmm. mmio_device_manager
635631 . register_mmio_rtc ( & mut vmm. resource_allocator , rtc, None )
636632 . map_err ( VmmError :: RegisterMMIODevice )
Original file line number Diff line number Diff line change @@ -449,9 +449,7 @@ impl<'a> Persist<'a> for MMIODeviceManager {
449449 ) ?;
450450 }
451451 if state. type_ == DeviceType :: Rtc {
452- let rtc = RTCDevice ( vm_superio:: Rtc :: with_events (
453- & crate :: devices:: legacy:: rtc_pl031:: METRICS ,
454- ) ) ;
452+ let rtc = RTCDevice :: new ( ) ;
455453 constructor_args
456454 . resource_allocator
457455 . allocate_mmio_memory (
Original file line number Diff line number Diff line change 44use std:: convert:: TryInto ;
55
66use serde:: Serialize ;
7+ use vm_superio:: Rtc ;
78use vm_superio:: rtc_pl031:: RtcEvents ;
89
910use crate :: logger:: { IncMetric , SharedIncMetric , warn} ;
@@ -59,7 +60,19 @@ pub static METRICS: RTCDeviceMetrics = RTCDeviceMetrics::new();
5960
6061/// Wrapper over vm_superio's RTC implementation.
6162#[ derive( Debug ) ]
62- pub struct RTCDevice ( pub vm_superio:: Rtc < & ' static RTCDeviceMetrics > ) ;
63+ pub struct RTCDevice ( vm_superio:: Rtc < & ' static RTCDeviceMetrics > ) ;
64+
65+ impl Default for RTCDevice {
66+ fn default ( ) -> Self {
67+ RTCDevice ( Rtc :: with_events ( & METRICS ) )
68+ }
69+ }
70+
71+ impl RTCDevice {
72+ pub fn new ( ) -> RTCDevice {
73+ Default :: default ( )
74+ }
75+ }
6376
6477impl std:: ops:: Deref for RTCDevice {
6578 type Target = vm_superio:: Rtc < & ' static RTCDeviceMetrics > ;
You can’t perform that action at this time.
0 commit comments