@@ -97,11 +97,27 @@ impl Kvm {
97
97
/// AArch64 specific call to get the host Intermediate Physical Address space limit.
98
98
///
99
99
/// Returns 0 if the capability is not available and an integer >= 32 otherwise.
100
- #[ cfg( any ( target_arch = "aarch64" ) ) ]
100
+ #[ cfg( target_arch = "aarch64" ) ]
101
101
pub fn get_host_ipa_limit ( & self ) -> i32 {
102
102
self . check_extension_int ( Cap :: ArmVmIPASize )
103
103
}
104
104
105
+ /// AArch64 specific call to get the number of supported hardware breakpoints.
106
+ ///
107
+ /// Returns 0 if the capability is not available and a positive integer otherwise.
108
+ #[ cfg( target_arch = "aarch64" ) ]
109
+ pub fn get_guest_debug_hw_bps ( & self ) -> i32 {
110
+ self . check_extension_int ( Cap :: DebugHwBps )
111
+ }
112
+
113
+ /// AArch64 specific call to get the number of supported hardware watchpoints.
114
+ ///
115
+ /// Returns 0 if the capability is not available and a positive integer otherwise.
116
+ #[ cfg( target_arch = "aarch64" ) ]
117
+ pub fn get_guest_debug_hw_wps ( & self ) -> i32 {
118
+ self . check_extension_int ( Cap :: DebugHwWps )
119
+ }
120
+
105
121
/// Wrapper over `KVM_CHECK_EXTENSION`.
106
122
///
107
123
/// Returns 0 if the capability is not available and a positive integer otherwise.
@@ -571,7 +587,7 @@ mod tests {
571
587
}
572
588
573
589
#[ test]
574
- #[ cfg( any ( target_arch = "aarch64" ) ) ]
590
+ #[ cfg( target_arch = "aarch64" ) ]
575
591
fn test_get_host_ipa_limit ( ) {
576
592
let kvm = Kvm :: new ( ) . unwrap ( ) ;
577
593
let host_ipa_limit = kvm. get_host_ipa_limit ( ) ;
@@ -584,6 +600,17 @@ mod tests {
584
600
}
585
601
}
586
602
603
+ #[ test]
604
+ #[ cfg( target_arch = "aarch64" ) ]
605
+ fn test_guest_debug_hw_capacity ( ) {
606
+ let kvm = Kvm :: new ( ) . unwrap ( ) ;
607
+ // The number of supported breakpoints and watchpoints may vary on
608
+ // different platforms.
609
+ // It could be 0 if no supported, or any positive integer otherwise.
610
+ assert ! ( kvm. get_guest_debug_hw_bps( ) >= 0 ) ;
611
+ assert ! ( kvm. get_guest_debug_hw_wps( ) >= 0 ) ;
612
+ }
613
+
587
614
#[ test]
588
615
fn test_kvm_getters ( ) {
589
616
let kvm = Kvm :: new ( ) . unwrap ( ) ;
0 commit comments