SIGN IN SIGN UP

crosvm, devices: introduce VirtioDeviceModule

See device_module.rs docs.

This should make the code easier to read, but, the main motivation is to
make it easier to split up the code base later. The main crate and
devices crates are too big and cause serious build time bloat. If we can
better modularize the code, then we can split off bigger pieces into
separate crates without it turning into spaghetti.

I've done some quick prototyping locally to verify this pattern works
for all the virtio devices, at least on the Linux side. The GPU and
associated devices, like media and wayland, are the trickiest part and
require a bit more API that I'm excluding from this CL to start with.

If this works out, we can easily have something similar for vhost-user.
Also, not as easy, but more interesting, we could have something similar
for platform devices, e.g., we could provide hooks to insert stuff into
the FDT.

Change-Id: Id8f6164db73aaafe511fc8ab9dc7cf50ae817214
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/7880571
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
F
Frederick Mayle committed
164237cf559ee5ef030be6fa8f966e5b9565d51a
Parent: 56c59a6
Committed by crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com <crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com> on 7/22/2026, 9:02:32 PM