@@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ #[ cfg( feature = "hw-interrupts" ) ]
18+ use std:: sync:: Arc ;
1719use std:: sync:: LazyLock ;
1820#[ cfg( feature = "hw-interrupts" ) ]
1921use std:: sync:: atomic:: { AtomicBool , Ordering } ;
20- #[ cfg( feature = "hw-interrupts" ) ]
21- use std:: sync:: Arc ;
2222
2323use hyperlight_common:: outb:: OutBAction ;
2424#[ cfg( gdb) ]
@@ -154,10 +154,11 @@ impl KvmVm {
154154 // When the timer thread writes to this EventFd, the in-kernel
155155 // PIC will assert IRQ0, which is delivered as the vector the
156156 // guest configured during PIC remap (typically vector 0x20).
157- let eventfd = EventFd :: new ( 0 )
158- . map_err ( |e| CreateVmError :: InitializeVm (
159- kvm_ioctls:: Error :: new ( e. raw_os_error ( ) . unwrap_or ( libc:: EIO ) ) . into ( )
160- ) ) ?;
157+ let eventfd = EventFd :: new ( 0 ) . map_err ( |e| {
158+ CreateVmError :: InitializeVm (
159+ kvm_ioctls:: Error :: new ( e. raw_os_error ( ) . unwrap_or ( libc:: EIO ) ) . into ( ) ,
160+ )
161+ } ) ?;
161162 vm_fd
162163 . register_irqfd ( & eventfd, 0 )
163164 . map_err ( |e| CreateVmError :: InitializeVm ( e. into ( ) ) ) ?;
@@ -267,9 +268,8 @@ impl VirtualMachine for KvmVm {
267268 // The guest is configuring the timer period.
268269 // Extract the period in microseconds (LE u32).
269270 if data. len ( ) >= 4 {
270- let period_us = u32:: from_le_bytes (
271- data[ ..4 ] . try_into ( ) . unwrap ( ) ,
272- ) as u64 ;
271+ let period_us =
272+ u32:: from_le_bytes ( data[ ..4 ] . try_into ( ) . unwrap ( ) ) as u64 ;
273273 if period_us > 0 && self . timer_thread . is_none ( ) {
274274 let eventfd = self
275275 . timer_irq_eventfd
0 commit comments