mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:07:45 +00:00
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.
This commit is contained in:
parent
7a6d5a7b8b
commit
b91df26d4a
43 changed files with 125 additions and 71 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue