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;
15
15
use utils:: time:: TimestampUs ;
16
16
#[ cfg( target_arch = "aarch64" ) ]
17
17
use vm_memory:: GuestAddress ;
18
- #[ cfg( target_arch = "aarch64" ) ]
19
- use vm_superio:: Rtc ;
20
18
21
19
use crate :: arch:: { ConfigurationError , configure_system_for_boot, load_kernel} ;
22
20
#[ cfg( target_arch = "aarch64" ) ]
@@ -628,9 +626,7 @@ fn attach_legacy_devices_aarch64(
628
626
. map_err ( VmmError :: RegisterMMIODevice ) ?;
629
627
}
630
628
631
- let rtc = RTCDevice ( Rtc :: with_events (
632
- & crate :: devices:: legacy:: rtc_pl031:: METRICS ,
633
- ) ) ;
629
+ let rtc = RTCDevice :: new ( ) ;
634
630
vmm. mmio_device_manager
635
631
. register_mmio_rtc ( & mut vmm. resource_allocator , rtc, None )
636
632
. map_err ( VmmError :: RegisterMMIODevice )
Original file line number Diff line number Diff line change @@ -449,9 +449,7 @@ impl<'a> Persist<'a> for MMIODeviceManager {
449
449
) ?;
450
450
}
451
451
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 ( ) ;
455
453
constructor_args
456
454
. resource_allocator
457
455
. allocate_mmio_memory (
Original file line number Diff line number Diff line change 4
4
use std:: convert:: TryInto ;
5
5
6
6
use serde:: Serialize ;
7
+ use vm_superio:: Rtc ;
7
8
use vm_superio:: rtc_pl031:: RtcEvents ;
8
9
9
10
use crate :: logger:: { IncMetric , SharedIncMetric , warn} ;
@@ -59,7 +60,19 @@ pub static METRICS: RTCDeviceMetrics = RTCDeviceMetrics::new();
59
60
60
61
/// Wrapper over vm_superio's RTC implementation.
61
62
#[ 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
+ Self :: new ( )
68
+ }
69
+ }
70
+
71
+ impl RTCDevice {
72
+ pub fn new ( ) -> RTCDevice {
73
+ RTCDevice ( Rtc :: with_events ( & METRICS ) )
74
+ }
75
+ }
63
76
64
77
impl std:: ops:: Deref for RTCDevice {
65
78
type Target = vm_superio:: Rtc < & ' static RTCDeviceMetrics > ;
You can’t perform that action at this time.
0 commit comments