chore: Update virtio-drivers to commit 61ece509c4 and modify max_queue_size implementation (#748)

This commit is contained in:
LoGin 2024-04-21 13:30:29 +08:00 committed by GitHub
parent d770de5d53
commit b502fbf0b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -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"

View File

@ -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.
}