Commit graph

15 commits

Author SHA1 Message Date
Daniel Verkamp
809b1a718c devices: vfio: make global container state explicit
The vfio code previously managed singleton instances of VfioContainer
using thread-local variables hidden inside the implementation of
vfio_get_container().

Make the caller hold onto a VfioContainerManager rather than implicitly
mutating global state inside a library function in the vfio crate. This
also removes the possibility of accidentally creating new VfioContainer
instances by calling from a different thread, since the containers were
previously thread-local rather than truly global for some reason.

This requires threading the vfio_container_manager variable through a
few function calls, but this also helps clarify ownership and lifetime
of the objects involved.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I2ba1be561c48143ff14e391c23bad1c6783b73ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5601348
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
2024-06-06 23:31:16 +00:00
Daniel Verkamp
52b8e42869 Cargo.toml: avoid "*" versions for external crates
Ensure that every Cargo.toml dependency on a third-party crates.io crate
specifies at least a major version, or a minor version for 0.x crates,
to ensure that if a new major version is published, it cannot cause API
breaks.

The versions are selected to match the ones already in Cargo.lock, so
this should have no functional change, but it will help prevent new "*"
versions from being introduced via copy-and-paste.

For rationale, see the Cargo FAQ:
<https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies>

`minijail`, `audio_streams`, and `cras` are left as "*" for now, since
they have unusual situations (imported from a submodule and/or replaced
at build time with ebuild magic).

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=verify Cargo.lock is unchanged

Change-Id: Ifa18199f812f01d2d10bfb4146b3353c1a76527c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5555656
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-05-22 01:01:42 +00:00
Kaiyi Li
c28067d1d9 Reformat comments
Test: presubmit
Change-Id: I39c261d9985989873b698213c5d8b653fc13757b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5299850
Auto-Submit: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-02-15 23:30:13 +00:00
Daniel Verkamp
d5cd443dc7 Fix some cargo doc warnings in Windows-only code
Change-Id: I0ff72840853db764db6dfc8145581447dff8795d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4883336
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2023-09-22 00:59:46 +00:00
Judy Hsiao
72b1801216 devices: pci: remove AC97 codes
Remove the AC97 codes on crosvm as it's replaced by virtio-snd

BUG=b:281092802
BUG=b:237681055
TEST=./tools/run_tests

Change-Id: Id7390930c355f7bcfe19f5e62bd678c31f79551e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4747399
Reviewed-by: Richard Zhang <rizhang@google.com>
Reviewed-by: Jorge Moreira Broche <jemoreira@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Judy Hsiao <judyhsiao@google.com>
Auto-Submit: Judy Hsiao <judyhsiao@google.com>
2023-08-11 03:29:31 +00:00
Noah Gold
9815bf96d3 crosvm_cli: reserve new control server exit code.
Support for the control socket on Windows is coming soon.

BUG=b:276361599
TEST=builds

Change-Id: Ia785836d3829d2638547d92d9f0c7396b3117f33
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4534416
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-05-16 23:05:32 +00:00
Daniel Verkamp
22f2151663 crosvm_cli: implement exit_context() for Option
The anyhow context() can already work with Options; extend the
exit_context function so it can be used on Option as well.

BUG=None
TEST=tools/dev_container tools/presubmit crosvm_unit_tests_mingw64

Change-Id: I2c79c92b9705bc82f3cb06f9e64a89ea60bce774
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4363323
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-03-28 20:13:06 +00:00
Idan Raiter
bb9c6fba45 vhost-user: snd: Implement Windows broker & device setup
Creates sound configurations in the broker, depending on if the
vhost-user flag for sound is set. Follows the same pattern as the GPU
device.

BUG=b:269174100
TEST=downstream

Change-Id: I6ae4b5d5e0fa50e169e7f477cf268f4bf7f05050
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4246715
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2023-02-28 21:34:01 +00:00
Idan Raiter
eda45f7648 crosvm_cli: Add missing Windows exit codes
A few codes were added downstream and are not here.

BUG=b:269174100
TEST=presubmit

Change-Id: I6599cbc356fe77b6b9094361a620aada2d173e5b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4246714
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2023-02-22 20:02:20 +00:00
Zihan Chen
28ce4e5423 crosvm: Uprev rust toolchain and dev container
- Rust toolchain is updated to 1.65.0
- Catapult dashboard upload tool is added to dev_container
- Bindgen is updated to latest version to support custom derive
- Derive Eq when PartialEq is derived as required by new Clippy

TEST=CQ, bindgen-all-the-things

FIXED=b:260784028
BUG=b:257303497

Change-Id: I2034cd09e0aed84d4e9b30f2e85d84d94a442ea4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4228427
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2023-02-08 20:26:30 +00:00
Daniel Verkamp
ac0fc378a3 Fix remaining Chrome/Chromium OS instances
These should be written as ChromeOS and ChromiumOS (without the space)
to match the updated branding. The copyright headers were already
migrated to the new style (https://crrev.com/c/3894243), but there were
some more instances left over.

BUG=None
TEST=tools/cargo-doc

Change-Id: I8c76aea2eb33b2e370ab71ee9b5cc0a4cfd00585
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4129934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-01-03 22:14:30 +00:00
Richard Zhang
ac6c68a9fc virtio-snd: Upstream Window's virtio-snd Playback impl
TEST=presubmits and this code works downstream
BUG=b:258298873

Change-Id: I7369fb08af474d107d056da8538de86bbc03eeb8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015562
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Richard Zhang <rizhang@google.com>
2022-12-07 21:33:49 +00:00
Noah Gold
000e85f9eb crosvm_cli: improve documentation for exit codes.
Some of the bit processing is a little hard to follow, so we've improved
the doc comment to further clarify the bit positions & meanings.

BUG=b:258279354
TEST=n/a

Change-Id: Ic103ff1a1377be6ddf2e5492d750733b80bddb6f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015004
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
2022-11-11 20:46:19 +00:00
Noah Gold
81549b21d9 devices: add err code for disk image open failed.
Adds a new error code for when we fail to open a disk image. Also adds
an exit code we were missing upstream.

BUG=b:253348635
TEST=intentionally messed up the disk image path and verified we get
this error.

Change-Id: I197b4c5d80682dd1ee2a42d02df852276d204c17
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3961530
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-10-20 20:27:58 +00:00
Noah Gold
adc5e6fd3f src: move exit module to new crosvm_cli crate.
Since we have "main" like functions in the devices crate for vhost-user
devices, we need to use ExitContext & Exit there. This wasn't possible
with the existing location in the crosvm/main crate because crosvm ->
devices so we can't have devices -> crosvm. This CL moves exit to a new
crate, crosvm_cli, where it can be used by all interested consumers.

BUG=b:253348635
TEST=builds

Change-Id: Ia06d9dee2cd5826ea20a7fb3a0c2a53c58e2ff1d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3960854
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-20 20:27:58 +00:00