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 @@ -13,8 +13,6 @@ use event_manager::{MutEventSubscriber, SubscriberOps};
13
13
use linux_loader:: cmdline:: Cmdline as LoaderKernelCmdline ;
14
14
use userfaultfd:: Uffd ;
15
15
use utils:: time:: TimestampUs ;
16
- #[ cfg( target_arch = "aarch64" ) ]
17
- use vm_superio:: Rtc ;
18
16
19
17
use crate :: arch:: { ConfigurationError , configure_system_for_boot, load_kernel} ;
20
18
#[ cfg( target_arch = "aarch64" ) ]
@@ -568,9 +566,7 @@ fn attach_legacy_devices_aarch64(
568
566
. map_err ( VmmError :: RegisterMMIODevice ) ?;
569
567
}
570
568
571
- let rtc = RTCDevice ( Rtc :: with_events (
572
- & crate :: devices:: legacy:: rtc_pl031:: METRICS ,
573
- ) ) ;
569
+ let rtc = RTCDevice :: new ( ) ;
574
570
vmm. mmio_device_manager
575
571
. register_mmio_rtc ( & mut vmm. resource_allocator , rtc, None )
576
572
. 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