diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index d876b075..1ee10e78 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -47,7 +47,7 @@ num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num smoltcp = { version = "=0.11.0", default-features = false, features = ["log", "alloc", "socket-raw", "socket-udp", "socket-tcp", "socket-icmp", "socket-dhcpv4", "socket-dns", "proto-ipv4", "proto-ipv6"]} system_error = { path = "crates/system_error" } unified-init = { path = "crates/unified-init" } -virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers.git", rev = "f1d1cbb" } +virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers.git", rev = "61ece509c4" } fdt = "=0.1.5" uefi = { version = "=0.26.0", features = ["alloc"] } uefi-raw = "=0.5.0" diff --git a/kernel/src/driver/virtio/transport_pci.rs b/kernel/src/driver/virtio/transport_pci.rs index ca7b1223..ab6fee4b 100644 --- a/kernel/src/driver/virtio/transport_pci.rs +++ b/kernel/src/driver/virtio/transport_pci.rs @@ -276,10 +276,11 @@ impl Transport for PciTransport { } } - fn max_queue_size(&self) -> u32 { - // Safe because the common config pointer is valid and we checked in get_bar_region that it - // was aligned. - unsafe { volread!(self.common_cfg, queue_size) }.into() + fn max_queue_size(&mut self, queue: u16) -> u32 { + unsafe { + volwrite!(self.common_cfg, queue_select, queue); + volread!(self.common_cfg, queue_size).into() + } } fn notify(&mut self, queue: u16) { @@ -304,6 +305,12 @@ impl Transport for PciTransport { } } + fn get_status(&self) -> DeviceStatus { + // Safe because the common config pointer is valid and we checked in get_bar_region that it + // was aligned. + unsafe { DeviceStatus::from_bits_truncate(volread!(self.common_cfg, device_status).into()) } + } + fn set_guest_page_size(&mut self, _guest_page_size: u32) { // No-op, the PCI transport doesn't care. }