diff options
author | Liav A <liavalb@gmail.com> | 2021-06-05 09:00:18 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-17 16:53:25 +0200 |
commit | b91df26d4a14c2721d1920e76552012864c97790 (patch) | |
tree | f9b83151fe424057cbc7bbdd1e1b389387a601b7 /Kernel/VirtIO | |
parent | 7a6d5a7b8bae2e2058c72b662c4cccec99374b11 (diff) | |
download | serenity-b91df26d4a14c2721d1920e76552012864c97790.zip |
Kernel/Interrupts: Return boolean on whether we handled the interrupt
If we are in a shared interrupt handler, the called handlers might
indicate it was not their interrupt, so we should not increment the
call counter of these handlers.
Diffstat (limited to 'Kernel/VirtIO')
-rw-r--r-- | Kernel/VirtIO/VirtIO.cpp | 13 | ||||
-rw-r--r-- | Kernel/VirtIO/VirtIO.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Kernel/VirtIO/VirtIO.cpp b/Kernel/VirtIO/VirtIO.cpp index fcc20071fd..ba6b95f1a6 100644 --- a/Kernel/VirtIO/VirtIO.cpp +++ b/Kernel/VirtIO/VirtIO.cpp @@ -342,11 +342,13 @@ u8 VirtIODevice::isr_status() return config_read8(*m_isr_cfg, 0); } -void VirtIODevice::handle_irq(const RegisterState&) +bool VirtIODevice::handle_irq(const RegisterState&) { u8 isr_type = isr_status(); - if ((isr_type & (QUEUE_INTERRUPT | DEVICE_CONFIG_INTERRUPT)) == 0) + if ((isr_type & (QUEUE_INTERRUPT | DEVICE_CONFIG_INTERRUPT)) == 0) { dbgln_if(VIRTIO_DEBUG, "{}: Handling interrupt with unknown type: {}", m_class_name, isr_type); + return false; + } if (isr_type & DEVICE_CONFIG_INTERRUPT) { dbgln_if(VIRTIO_DEBUG, "{}: VirtIO Device config interrupt!", m_class_name); if (!handle_device_config_change()) { @@ -357,11 +359,14 @@ void VirtIODevice::handle_irq(const RegisterState&) if (isr_type & QUEUE_INTERRUPT) { dbgln_if(VIRTIO_DEBUG, "{}: VirtIO Queue interrupt!", m_class_name); for (size_t i = 0; i < m_queues.size(); i++) { - if (get_queue(i).new_data_available()) - return handle_queue_update(i); + if (get_queue(i).new_data_available()) { + handle_queue_update(i); + return true; + } } dbgln_if(VIRTIO_DEBUG, "{}: Got queue interrupt but all queues are up to date!", m_class_name); } + return true; } void VirtIODevice::supply_chain_and_notify(u16 queue_index, VirtIOQueueChain& chain) diff --git a/Kernel/VirtIO/VirtIO.h b/Kernel/VirtIO/VirtIO.h index 9fe71637a7..9b49926722 100644 --- a/Kernel/VirtIO/VirtIO.h +++ b/Kernel/VirtIO/VirtIO.h @@ -222,7 +222,7 @@ private: void reset_device(); u8 isr_status(); - virtual void handle_irq(const RegisterState&) override; + virtual bool handle_irq(const RegisterState&) override; NonnullOwnPtrVector<VirtIOQueue> m_queues; NonnullOwnPtrVector<Configuration> m_configs; |