Skip to content

Commit b502fbf

Browse files
authored
chore: Update virtio-drivers to commit 61ece509c4 and modify max_queue_size implementation (#748)
1 parent d770de5 commit b502fbf

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

kernel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num
4747
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"]}
4848
system_error = { path = "crates/system_error" }
4949
unified-init = { path = "crates/unified-init" }
50-
virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers.git", rev = "f1d1cbb" }
50+
virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers.git", rev = "61ece509c4" }
5151
fdt = "=0.1.5"
5252
uefi = { version = "=0.26.0", features = ["alloc"] }
5353
uefi-raw = "=0.5.0"

kernel/src/driver/virtio/transport_pci.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,11 @@ impl Transport for PciTransport {
276276
}
277277
}
278278

279-
fn max_queue_size(&self) -> u32 {
280-
// Safe because the common config pointer is valid and we checked in get_bar_region that it
281-
// was aligned.
282-
unsafe { volread!(self.common_cfg, queue_size) }.into()
279+
fn max_queue_size(&mut self, queue: u16) -> u32 {
280+
unsafe {
281+
volwrite!(self.common_cfg, queue_select, queue);
282+
volread!(self.common_cfg, queue_size).into()
283+
}
283284
}
284285

285286
fn notify(&mut self, queue: u16) {
@@ -304,6 +305,12 @@ impl Transport for PciTransport {
304305
}
305306
}
306307

308+
fn get_status(&self) -> DeviceStatus {
309+
// Safe because the common config pointer is valid and we checked in get_bar_region that it
310+
// was aligned.
311+
unsafe { DeviceStatus::from_bits_truncate(volread!(self.common_cfg, device_status).into()) }
312+
}
313+
307314
fn set_guest_page_size(&mut self, _guest_page_size: u32) {
308315
// No-op, the PCI transport doesn't care.
309316
}

0 commit comments

Comments
 (0)