Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/drivers/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,13 @@ impl VirtioConsoleDriver {
pub fn handle_interrupt(&mut self) {
let status = self.isr_stat.acknowledge();

#[cfg(not(feature = "pci"))]
if status.contains(virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
}

#[cfg(feature = "pci")]
if status.contains(virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
if status.contains(cfg_select! {
feature = "pci" => virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT,
_ => virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION,
}) && self.com_cfg.does_device_need_reset()
{
info!("Device resets are not possible! Aborting");
todo!("Implement possibility to reset device on the fly...")
}

crate::console::CONSOLE_WAKER.lock().wake();
Expand Down
17 changes: 7 additions & 10 deletions src/drivers/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,13 @@ impl VirtioFsDriver {
pub fn handle_interrupt(&mut self) {
let status = self.isr_stat.acknowledge();

#[cfg(not(feature = "pci"))]
if status.contains(virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
}

#[cfg(feature = "pci")]
if status.contains(virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
if status.contains(cfg_select! {
feature = "pci" => virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT,
_ => virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION,
}) && self.com_cfg.does_device_need_reset()
{
info!("Device resets are not possible! Aborting");
todo!("Implement possibility to reset device on the fly...")
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/drivers/net/virtio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,16 +522,13 @@ impl NetworkDriver for VirtioNetDriver<Init> {
fn handle_interrupt(&mut self) {
let status = self.isr_stat.acknowledge();

#[cfg(not(feature = "pci"))]
if status.contains(virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
}

#[cfg(feature = "pci")]
if status.contains(virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
if status.contains(cfg_select! {
feature = "pci" => virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT,
_ => virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION,
}) && self.com_cfg.does_device_need_reset()
{
info!("Device resets are not possible! Aborting");
todo!("Implement possibility to reset device on the fly...")
}

wake_network_waker();
Expand Down
8 changes: 8 additions & 0 deletions src/drivers/virtio/transport/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ impl ComCfg {
.update(|status| status | DeviceStatus::DRIVER_OK);
}

pub fn does_device_need_reset(&self) -> bool {
self.com_cfg
.as_ptr()
.status()
.read()
.contains(DeviceStatus::DEVICE_NEEDS_RESET)
}

pub fn print_information(&mut self) {
let ptr = self.com_cfg.as_ptr();

Expand Down
7 changes: 7 additions & 0 deletions src/drivers/virtio/transport/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ impl ComCfg {
.device_status()
.update(|s| s | DeviceStatus::DRIVER_OK);
}

pub fn does_device_need_reset(&self) -> bool {
let status = self.com_cfg.as_ptr().device_status().read();
status.contains(DeviceStatus::DEVICE_NEEDS_RESET)
}
}

/// Notification Structure to handle virtqueue notification settings.
Expand Down Expand Up @@ -483,6 +488,8 @@ impl IsrStatus {
}

pub fn acknowledge(&mut self) -> IsrStatusRaw {
//[D]river read of ISR status causes the device to de-assert an interrupt.
// VIRTIO spec. v1.4 sec. 4.1.4.5
self.isr_stat.as_ptr().read()
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/drivers/vsock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,13 @@ impl VirtioVsockDriver {
pub fn handle_interrupt(&mut self) {
let status = self.isr_stat.acknowledge();

#[cfg(not(feature = "pci"))]
if status.contains(virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
}

#[cfg(feature = "pci")]
if status.contains(virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT) {
info!("Configuration changes are not possible! Aborting");
todo!("Implement possibility to change config on the fly...")
if status.contains(cfg_select! {
feature = "pci" => virtio::pci::IsrStatus::DEVICE_CONFIGURATION_INTERRUPT,
_ => virtio::mmio::InterruptStatus::CONFIGURATION_CHANGE_NOTIFICATION,
}) && self.com_cfg.does_device_need_reset()
{
info!("Device resets are not possible! Aborting");
todo!("Implement possibility to reset device on the fly...")
}
}

Expand Down
Loading