Skip to content

nvme: improve shadow doorbell support #1582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4630,7 +4630,6 @@ dependencies = [
"chipset_device",
"device_emulators",
"disk_backend",
"event-listener",
"futures",
"futures-concurrency",
"guestmem",
Expand Down
1 change: 0 additions & 1 deletion vm/devices/storage/nvme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ mesh.workspace = true
pal_async.workspace = true
task_control.workspace = true
async-trait.workspace = true
event-listener.workspace = true
futures.workspace = true
futures-concurrency.workspace = true
parking_lot.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions vm/devices/storage/nvme/src/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ impl NvmeController {
if addr >= 0x1000 {
// Doorbell write.
let base = addr - 0x1000;
let index = base >> DOORBELL_STRIDE_BITS;
if (index << DOORBELL_STRIDE_BITS) != base {
let db_id = base >> DOORBELL_STRIDE_BITS;
if (db_id << DOORBELL_STRIDE_BITS) != base {
return IoResult::Err(InvalidRegister);
}
let Ok(data) = data.try_into() else {
return IoResult::Err(IoError::InvalidAccessSize);
};
let data = u32::from_ne_bytes(data);
self.workers.doorbell(index, data);
let value = u32::from_ne_bytes(data);
self.workers.doorbell(db_id, value);
return IoResult::Ok;
}

Expand Down
Loading