0
Fork 0
mirror of https://github.com/Droid-VM/crosvm.git synced 2026-11-17 06:58:03 +00:00
Commit graph

98 commits

Author SHA1 Message Date
Elie Kheirallah
17f268191a Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (38 commits)
  aarch64: fix potential initrd size subtraction underflow
  Uprev pkg-config to 0.3.31
  crosvm: upgrade zerocopy to 0.8
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  devices: virtio-snd: simplify zerocopy usage in vios backend
  x86_64: fix potential setup_data overlap of mptable
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  hypervisor: aarch64: Add context to errors in snapshot
  Roll recipe dependencies (trivial).
  devices: virtio-wl: add missing padding in CtrlVfdNewCtxNamed
  devices: virtio-wl: add size check for CtrlVfdNewCtxNamed
  devices: vfio: avoid extra copy in read_config()
  devices: virtio-scsi: simplify write_config()
  Revert "rutabaga_gfx: Add rutabaga_resource_wait_sync interface"
  Roll recipe dependencies (trivial).
  Rename gfxabort to be agnostic of graphics stack
  devices: virtio-scsi: use read_from_prefix() in parse_command()
  ...

Bug: 398839628
Test: atest --test-mapping external/crosvm
Change-Id: I1214e25a5c34a735925c605b8440c870abb0d31b
2025-02-25 18:10:03 +00:00
Daniel Verkamp
f20af151e2 crosvm: upgrade zerocopy to 0.8
BUG=b:372549215
TEST=tools/dev_container tools/presubmit

Change-Id: I3fcc524d1c6c41ae92c51cecb6e4d856c3d60670
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6255229
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2025-02-24 11:35:51 -08:00
Frederick Mayle
7ac4c9ad6b ANDROID: simplify crosvm_defaults
* All non-crosvm users of crosvm_defaults are gone, so we don't need a
  separate internal defaults module.
* Edition is set automatically by cargo_embargo.
* authfs only needs visibility on libfuse_rust, which is done via
  cargo_embargo.

Bug: 269356487
Test: m
Change-Id: I3091e76e86435021bc3b1c5deb77a5b5d514ca32
2025-02-10 18:41:03 -08:00
Frederick Mayle
f51ffa9d45 ANDROID: fix cargo_embargo diffs + new apex_avail setup
https://r.android.com/3484205 changed the Android.bp files directly to
fix an issue with setting apex_available on test modules. This commit
refixes the issue in a different way that works better with
cargo_embargo.

Instead of setting apex_available via the rust_defaults, which is used
for every module type, we use cargo_embargo's apex_available config
option, which only applies to non-test modules.

Bug: 269356487
Test: m
Change-Id: Ib7a10e23342ead86553232a7014747b46ffefaf2
2025-02-10 17:56:28 -08:00
Andrew Walbran
85f25f9403 Keep using old version of zerocopy.
Bug: 372549215
Test: m crosvm
Change-Id: I1cb74195c62fc9e05d0772a9a13dc90476324977
Merged-In: I1cb74195c62fc9e05d0772a9a13dc90476324977
2024-12-11 08:04:00 +00:00
Devin Moore
64d5dea560 Running cargo_embargo after the merge
Create a new patch file for power_monitor
Fix rutabaga_gfx and disk Android.bp.patch files.

Test: m
Bug: 335312770
Change-Id: Ie08db8cabf55b38976be0343a8a41b7111a8d0f1
2024-06-25 22:54:34 +00:00
Devin Moore
b79815ee3a Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (472 commits)
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  hypervisor: add test for AVX state.
  ext2: Support so many directory entires that require multiple blocks
  ext2: Ignore host-side lost+found
  devices: virtio-blk: don't stop the worker thread on sleep/reset
  device: fs: Implement FS_IOC_PATHXATTR ioctl
  device: fs: Implement FS_IOC_SETPERMISSION ioctl
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  hypervisor: x86_64: add custom type for FPU regs
  Roll recipe dependencies (trivial).
  ...

Test: launch_cvd and Treehugger
Bug: 335312770
Change-Id: I7b388bcb43fdd60177a5b76470bd3526698cd421
2024-06-24 22:29:20 +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
Frederick Mayle
c223989d84 Merge remote-tracking branch 'aosp/upstream-main'
Had to update the rust version to compile the new nix version.

The metrics protos have been deleted upstream, so those `out` files are
deleted (and we don't need to `sed` them in the script).

Added default_team for `hypervisor` to satisify a lint error, will add
it everywhere else later.

* aosp/upstream-main: (86 commits)
  Roll recipe dependencies (trivial).
  devices: vhost-user: fix test flake
  Roll recipe dependencies (trivial).
  Cargo.lock: switch to tokio 1.29.1
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  cros_async: Tokio IoSource for windows
  cros_async: Add AsyncFd to Tokio linux implementation
  cros_async: Blocking tokio executor for linux
  devices: Fix nested executor invocation in async virtio-console
  cros_async: Move `concurrency` to Overlapped enum
  Roll recipe dependencies (trivial).
  Create a minimal virtualization and hypervisor integration test.
  gpu_display: add max_num_displays to GpuParameters.
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Refactor android display backend
  e2e_tests: wait for restore to complete before sending commands
  ...

Bug: 332584046
Test: TH
Change-Id: I25dd0124d719a59c312ba31f060c1b37f1d2a1b6
2024-04-15 13:00:06 -07:00
Jiyong Park
5f7ae3703d Rerun android-merge-2-cargo-embargo.sh
Rerun the tool to update the comments in the bp file. Also re-generate
the patch file for rutabaga_gfx. Below were what I did.

0. sync to ToT
1. delete rutabaga_gfx/patches/Android.bp.patch
2. stash rutabaga_gfx/Android.bp to somewhere else
3. run ./android-merge-2-cargo-embargo.sh (without the step 1)
4. create a temp commit
5. re-apply #2 and manually update the comment
6. git diff > rutabaga_gfx_patches/Android.bp.patch
7. amend the commit #4 with the changes in #5 and #6.

Bug: N/A
Test: N/A

Change-Id: Ieb9c8c6a811e9fd09b52910f504c454eaec9b80f
2024-03-12 16:40:32 +09:00
Devin Moore
62e8315f86 Merge remote-tracking branch 'aosp/upstream-main' into merge
+ cargo embargo Android.bp file changes
+ a couple of small conflicts in rutabaga_gfx

* aosp/upstream-main: (181 commits)
  hypervisor: tests: require windows for haxm
  gpu_display: improve event device error logging.
  gpu: disable fixed_blob_mapping by default for gfxstream
  tools/install-mingw64-deps: remove unused winetricks vars
  Roll recipe dependencies (trivial).
  Make period have the precision of nanoseconds
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  e2e_tests: print prebuilt revision on initialize_once
  crypto: add generic crate for snapshot encryption.
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  cros_tracing_types: statically initialize Mutex
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  crosvm: Delay hotplug until PCIe slot is not busy
  devices: add notifier for hotplug command complete
  ...

Test: launch_cvd
Bug: 324080172
Change-Id: If3e3db7f87c61f1fa3d3ce38af90ac38ccb9727c
2024-03-08 17:39:04 +00:00
Pujun Lun
a2e4721e3a gpu_display_win: upstream mouse input handling code.
MouseInputManager supports touchscreen mode and relative mode (i.e.
captured mouse cursor). The relative mode uses Windows raw input
events. Since only one window in an application can receive those
events, we register the raw input device with the MessageOnlyWindow
and reroute the raw input events to the current foreground GUI
window.

BUG=b:254702853
TEST=presubmit

Change-Id: I18e4d62777bdf0e7d39267426d1301fa6211af31
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5318692
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2024-02-29 19:29:19 +00:00
Pawan Wagh
c8efbbac3c Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (39 commits)
  devices: virtcpufreq: Add scaling factor to UClamp applied
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  seccomp: Add a policy for pvclock device
  e2e_tests: Update use_local_build.sh to include the initrd env var
  aarch64: fdt: Update compatible string for virt cpufreq
  hypervisor: x86: Add MSR allowlist and restore MSRs 1 at a time
  jail: seccomp: fix missing syscall for fs on arm
  Roll recipe dependencies (trivial).
  Clone host CPU capacity/clusters for --host-cpu-topology
  Roll recipe dependencies (trivial).
  swap: prevent guest memory in the main process munmap(2)ed
  swap: do not panic if main process dies while swapping in
  swap: do not panic on tube errors
  Roll recipe dependencies (trivial).
  devices: disable read-only memslots based on hypervisor
  hypervisor: kvm: Fix xsave size when Xsave2 is not supported
  jail: seccomp: add missing battery syscalls on non-x86
  book: Use v6.6 termina kernel in custom_kernel_rootfs
  linux_input_sys: simplify input event decoders
  ...

Bug: 319252379
Test: atest --test-mapping external/crosvm
Change-Id: I68e9777dfa707df75af64e1b66e2229bdd7b88a7
2024-01-16 21:04:50 +00:00
Daniel Verkamp
96ee59fbec linux_input_sys: simplify input event decoders
zerocopy's FromBytes::read_from() function does not require the input to
be aligned, so the Aligner stuff is unnecessary.

BUG=b:312312646
TEST=tools/dev_container tools/presubmit

Change-Id: I4a07496ec6f7d518e572c1400030fd6136d8ef28
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046344
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-01-11 02:44:19 +00:00
Frederick Mayle
4693681746 Merge commit 'aosp/upstream-main' (4 of n)
* commit '8aabb8d9': (268 commits)
  Update to syn-2
  devices: vsock: add connection logging for Windows.
  cros_tracing: fix interface drift.
  devices: virtio: scsi: Raise error when trying to modify a read-only disk
  e2e_tests: scsi: Add test cases for discard operations.
  docs: Add SCSI section.
  base: unix: return Vec<SafeDecriptor> from recv_with_fds()
  base: unix: rework ScmSocket send/recv functions
  Only support cpufreq on arm/aarch64
  base: add IoBuf/IoBufMut mut slice conversions
  vmm_vhost: eliminate locking in SlaveReqHandler and merge traits
  vmm_vhost: simplify Slave
  vmm_vhost: eliminate locking in MasterReqHandler and merge traits
  Don't expose `base::platform` as a public interface
  usb: refactor transfer structs for multi backends
  devices: virtio: scsi: Change the queue size.
  devices: vhost-user: console: clean up arg parsing
  hypervisor/README.md: add qualcomm contacts for gunyah
  vmm_vhost: remove type parameter from PlatformConnection
  vmm_vhost: simplify backend request connection creation
  ...

Bug: 307396704
Test: .
Change-Id: I35c8de63abb6ae8e20df78060e16dbb77e1454a9
2023-12-19 10:49:43 -08:00
Pujun Lun
1a8f413d7d gpu_display: add KeyboardInputManager to handle key events on Windows.
BUG=b:306407787

Change-Id: I28286cb6f999da56020fba2e79d4ad9a1875c8eb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5026248
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2023-11-17 01:34:38 +00:00
Pujun Lun
57ae9b5996 linux_input_sys: add a "repeat" option to key events.
It will be used in the upcoming Windows implementation. The
behavior should remain unchanged for other platforms.

BUG=b:306407787

Change-Id: I7f925055e2d3d9e03f64096cbf590c7ac897a00c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5028148
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2023-11-16 16:39:02 +00:00
Frederick Mayle
ed50c9986c Revert^2 "Merge remote-tracking branch 'aosp/upstream-main'"
70cd6bf4d6

Change-Id: I6d4e43c5ab6aa3c01ab42ce8def24db5a419249d
2023-10-15 18:27:41 +00:00
Frederick Mayle
70cd6bf4d6 Revert "Merge remote-tracking branch 'aosp/upstream-main'"
Revert submission 2786927-fmayle-zerocopy-update

Reason for revert: broke build

Reverted changes: /q/submissionid:2786927-fmayle-zerocopy-update

Change-Id: I80fb748084467e5f70d9c182bcbb34a687dc7c3f
2023-10-15 03:50:34 +00:00
Frederick Mayle
ccb77cd8f1 Merge remote-tracking branch 'aosp/upstream-main'
* aosp/upstream-main: (49 commits)
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  data_model: replace loop with Vec::resize_with()
  vfio_sys: undo non-upstream change and add it with --raw-line
  rustfmt: add rules for imports
  devices: usb: clean up zerocopy usage
  devices: xhci: clean up wildcard imports
  Rename "unix" to "linux" in code and docs
  Replace #[cfg(unix)] with #[cfg(any(target_os = "android", target_os = "linux"))]
  bindgen: regenerate bindings with bindgen 0.68.1
  crosvm: Remove DataInit
  kvm_sys: Update bindings
  Roll recipe dependencies (trivial).
  crosvm: Uprev zerocopy to 0.7.x
  Roll recipe dependencies (trivial).
  devices: virtio: scsi: Implement READ_CAPACITY, READ_6, READ_10, and WRITE_10
  devices: virtio: scsi: Return Result<(), ExecuteError> in emulate() methods.
  Roll recipe dependencies (trivial).
  Cargo.toml: remove chromeos from base and devices
  Roll recipe dependencies (trivial).
  ...

Bug: 303132091
Test: TH
Change-Id: I82e2f6e59013c353e94646509310f9ed5dd1ab98
2023-10-12 14:18:37 -07:00
Zihan Chen
cbba480ebe crosvm: Uprev zerocopy to 0.7.x
zerocopy 0.7.x has finally released as a stable version, uprev it
to allow some remaining structs to be derivable.

TEST=CQ

BUG=b:300969352
FIXED=b:300969352

Change-Id: I90f0dfb09494f875fef1cd11bfcbd48030846092
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4878761
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2023-10-10 17:34:32 +00:00
Elie Kheirallah
bd865eb659 Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (41 commits)
  Rename struct Window to GuiWindow.
  Replace thread messages with a message router window.
  devices: virtio: snd: Always generate new StreamSource in Prepare
  Roll recipe dependencies (trivial).
  virtio_sys: fix ID for pvclock.
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  plugin: add cfg checks for net feature
  base: windows: tube: simplify reading of MsgHeader
  Roll recipe dependencies (trivial).
  e2e_tests/guest_under_test: Fix Makefile
  Fix some cargo doc warnings in Windows-only code
  devices: usb: Demote the "cycle bit mismatch" message to debug
  tools: fix unit test filter
  devices: virtio: scsi: Implement TEST_UNIT_READY and REPORT_LUNS.
  devices: virtio: scsi: Implement INQUIRY command
  devices: virtio: scsi: Introduce Sense
  devices: virtio: scsi: Receive commands from virtqueue
  devices: virtio: scsi: Make scsi option experimental
  cros_tracing_analyser: Add events for flamegraph
  ...

Bug: 301274839
Test: atest --test-mapping external/crosvm
Change-Id: I150b81ce68fd5d95a8faaafdb5cc1f0cb03d9b6c
2023-09-25 20:04:10 +00:00
Daniel Verkamp
03dd1feab7 Cargo.toml: depend on zerocopy 0.6 explicitly
Previously all of the zerocopy imports just used "*", but there are
API changes in zerocopy 0.7, so ensure we get a compatible version by
depending on 0.6 everywhere.

This is a no-op since Cargo.lock already specifies a 0.6.x version, but
it will prevent accidentally upgrading to 0.7.x without updating to the
new API.

BUG=b:301283548
TEST=cargo build

Change-Id: Ifd702d982a09b5083dddd666dc6f3052cba22214
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4878502
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-09-20 21:28:58 +00:00
Devin Moore
050161a036 Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (36 commits)
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  audio_streams_conformance_test: fix incorrect usage of `argh`
  swap: Add seccomp of swap_monitor for arm and aarch64
  Roll recipe dependencies (trivial).
  Remove target_arch = "x86" checks
  Roll recipe dependencies (trivial).
  devices: x86_64: add bootindex
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  devices: virtio-blk: retain sparse across resize
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  devices: virtio: gpu: move Event clone closer to usage
  deviecs: virtio: gpu: delete unused field VirtioGpu::event_devices
  devices: virtio: gpu: delete cursor queue fence completion deadcode
  gpu_display: delete unused field and method GpuDisplay::is_x
  gpu_display: simplify GpuDisplay::open_x signature
  docs: Add a link to how to run tryjob.
  ...

Test: launch_cvd
Bug: 296912647

Change-Id: I407cd3fdbeca02ce27c468c8c3d24f0ed6e20ca6
2023-08-21 22:48:32 +00:00
Richard Zhang
e8b7fcbef4 linux_input_sys: Move event code constants from virtio_input (devices
crate)

There were already copies of these constants. This change moves these
constants to a crate with less dependencies so that it can be shared
more widely across the codebase.

BUG=b:296435866
TEST=builds, presubmits

Change-Id: I468cf4f23edc510a7fdd5ed0f030d33f1b05a8a1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4791583
Reviewed-by: Dmitry Polenur <dpolenur@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Richard Zhang <rizhang@google.com>
2023-08-17 21:31:24 +00:00
Frederick Mayle
82d28fc3d7 Merge remote-tracking branch 'aosp/upstream-main'
* aosp/upstream-main: (56 commits)
  swap: add trim command
  swap: introduce BackgroundJobControl for background jobs
  aarch64: Allow hypervisor to initialize boot context
  arch: Create GuestMemory with MemoryRegionOptions
  vm_memory: guest_memory: Add MemoryRegionOptions
  vm_memory: Convert GuestMemory::with_regions to use struct argument
  hypervisor: Allow for hypervisor-specific DT additions
  tools: Add PGO support
  x86_64: clarify cpuid leaf 0x15 TSC calibration
  testvm: Rebuild VM images
  crosvm: restore vCPUs during "cold restore"
  Roll recipe dependencies (trivial).
  crosvm_cli: implement exit_context() for Option
  Roll recipe dependencies (trivial).
  dev_container: Add strace to dependency
  tools: Collect syscall frequency stats via bench
  Roll recipe dependencies (trivial).
  rutabaga_gfx: gfxstream: enable stronger versioning
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  ...

Test: booted CF
Bug: 275386231
Change-Id: Id702d13eddc837a0eadaff38e7098434130db7ac
2023-03-31 11:17:23 -07:00
Zihan Chen
bbc4f68ebb crosvm: Convert DataInit to zerocopy 10/n
We are down to only 30 `unsafe impl DataInit` across our repo now!

TEST=CQ

BUG=b:204409584

Change-Id: I1b6cf95b2a15eac194f3b464330009fd898a0bfa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4356907
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-24 18:12:38 +00:00
Frederick Mayle
cb2b2c9b9e ANDROID: add layer of indirection to crosvm_defaults module
Bug: 269356487
Test: m
Change-Id: I1079c5602219eb647875c23d383f26695142ab84
2023-02-15 15:57:00 -08:00
Frederick Mayle
2de0adb3ab ANDROID: run cargo_embargo + post merge fixes
jail/seccomp/gen_android.sh:

    Path update because the "seccomp" dir was moved to "jail/seccomp".

jail/seccomp/x86_64/gpu_common.policy:

    Modified policy to avoid duplicate syscall error. Upstream isn't
    seeing the same issue because they precompile the policies and
    minijail has a bug where duplicates are allowed for precompiled
    policies but not runtime-compiled policies (http://b/268567700).

Bug: 268120263
Test: TH, etc
Change-Id: If0821bb43c9972da8353d345500b099d45d80fbe
2023-02-14 14:42:54 -08:00
Frederick Mayle
0712050989 Merge remote-tracking branch 'aosp/upstream-main'
* aosp/upstream-main: (71 commits)
  jail: create jail crate from jail_helpers.rs
  base/src: Fix and update mmap.rs doctests
  Migrate run_tests2 to run_tests
  infra: Shorten path/to/binary in binary size report
  Roll recipe dependencies (trivial).
  x86_64: initialize boot_params::ext_cmd_line_ptr
  infra: Fully commit to python3
  devices: virtio: rng: add stop impl for Rng
  devices: Clean up DataInit (7/n)
  infra: Stop generating dry runs for ChromeOS merges
  rust-toolchain: Add llvm-tools-preview
  devices: fix virtio-input not interrupting statusq.
  devices: vhost: user: move run_handler method from handler to listener
  devices: add SleepGuard abstraction for snapshot/restore
  Roll recipe dependencies (trivial).
  crosvm: Partially convert DataInit to zerocopy (6/n)
  Make libvda-stub the default
  infra/config: Update builders to use test profiles
  devices: virtio: add sleep_virtio_devices and impl
  vfio_sys: Update bindgen to derive zerocopy
  ...

Bug: 268120263
Test: TH, etc
Change-Id: I15670a9a2e2c14fc8fda2f6bb06ffdf4362542af
2023-02-14 14:42:27 -08:00
Zihan Chen
30f58a81aa crosvm: Partially convert DataInit to zerocopy (6/n)
This CL removed many uses of DataInit in devices. Some paddings
are manually added/fixed to allow AsBytes to derive without ABI
changes.

TESTED=CQ

BUG=b:204409584

Change-Id: I1f8c2d5304fc8e685cc3e5166c73481f6a3f78f7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4235224
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-02-10 01:52:24 +00:00
Steven Moreland
f62b102b1c Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (39 commits)
  devices: serial: implement out_timestamp for all platforms
  contributing: update code formatting guidelines
  Cargo.toml: add links to some features
  docs: book: replace features.md with a link to docs
  kiwi: clean anti_tamper and metrics related code
  tools: make dev_container runnable on downstream repo
  devices: add serialize for Arc<Mutex<T>>, fix acpi suspendable.
  Roll recipe dependencies (trivial).
  devices: shorten log statement
  cros_container: Remove incremental setup
  devices: battery: move monitor code out of sys
  power_monitor: refactor to use ReadNotifier
  devices: tweak snapshot restore deserialization code
  devices: wake devices if sleep fails during restore
  devices: cleanup restore request handler
  devices: cleanup snapshot request handler
  power_monitor: switch to proto_build_tools
  Fix remaining Chrome/Chromium OS instances
  Roll recipe dependencies (trivial).
  crosvm: reduce kiwi feature flag usage
  ...

Bug: 264314481
Test: atest MicrodroidTestApp

Change-Id: I4331d3df353f3364d703c3381fae3df944ae3616
2023-01-04 22:22:07 +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
Frederick Mayle
921c91b72f Revert^2 "Merge remote-tracking branch 'aosp/upstream-main'"
a35c0be7ae

Change-Id: Ieaa69bc90e50a2ef93faf4cc0f0ca618681b3e82
2022-12-07 02:26:40 +00:00
Adrian Roos
a35c0be7ae Revert "Merge remote-tracking branch 'aosp/upstream-main'"
Revert submission 2329297-crosvm-merge-2022-12-05

Reason for revert: breaks tests

Reverted Changes:
Id9d9e5b5e:ANDROID: ./run_cargo_embargo.sh after merge
If53fb2281:ANDROID: Temporarily disable "merge" dependency
Iaca689af2:Merge remote-tracking branch 'aosp/upstream-main'
I94fab94ec:ANDROID: update import script to use cargo_embargo...
Ia4bc6077c:ANDROID: add cargo_embargo config, delete cargo2an...
Ie2d211046:ANDROID: switch to cargo_embargo generated Android...

Bug: 260604615
Change-Id: I89d2100fe585a752d6092087d509a24dd4e71245
Fixes: 261559546
2022-12-06 11:16:09 +00:00
Frederick Mayle
6357c3ab7d Merge remote-tracking branch 'aosp/upstream-main'
Bug: 260604615
Test: TH + AVF test mapping

* aosp/upstream-main: (122 commits)
  Roll recipe dependencies (trivial).
  devices: virtio: snd: Use async stream creation
  audio_streams,cros_async: Add async create stream methods
  crosvm: Add restore functionality
  devices: Add thread to handle device snapshot in unix.
  devices: virtio: queue: remove avail_len check
  libvda: Ignore tests when using libvda-stub
  base: timer: remove timeout from timer
  devices: virtio: block: introduce per-device async-executor option for block device
  crosvm: add CPU clusters to "--cpu" option
  Roll recipe dependencies (trivial).
  e2e_tests: stay in the current directory
  Roll recipe dependencies (trivial).
  rutabaga_gfx: Add external blob flag to gfxstream
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  p9: Add readlink support to 9p
  Require council review for changes to Cargo.lock
  p9: use MaybeOwned to avoid extra clone in do_walk
  ...

Change-Id: Iaca689af2cb88ea6e98a71e4d97195fc0bb6a587
2022-12-05 17:52:19 -08:00
Frederick Mayle
9a7b1b87f3 ANDROID: switch to cargo_embargo generated Android.bp files
The scripts need to be updated to use the new tool. That will come in a
later CL.

Summary of Android.bp changes:

* Deleted apex_available fields.
    - The default is "//apex_available:platform", so no change in
      behavior.
* Deleted "// has rustc warnings" comments.
    - Will re-add support for reporting warnings later, in a different
      form.
* Added cargo_pkg_version always.
    - New tool is better at detecting the pkg version. No behavior
      change expected.
* Removed "libprebuilts" deps.
    - This lib is used to download prebuilt binaries. Including it
      before was a mistake.
* Deleted auto-generated "rust_defaults".
    - They made the Android.bp files shorter, but more difficult to read
      and added complexity to the tool.
* More accurate "crate_name" in "rust_test" modules.
* disk/patches/Android.bp.patch is a bit smaller.
    - "qcow" and "android-sparse" features flags are enabled via the
      root package, so the tool infers more of this correctly, including
      enabling the features in the unit tests (!!).
* third_party/vmm_vhost/Android.bp sets the "default" feature flag.
    - "default" just implies the existing flags. No behavior change.

Bug: 261486161
Test: TH
Change-Id: Ie2d211046ff228b44abf362afed008b4a64d6245
2022-12-05 17:51:47 -08:00
Daniel Verkamp
2ddb12f0e2 Rust 1.65: Fix clippy bool_to_int_with_if lints
BUG=b:260784028
TEST=tools/clippy

Change-Id: Icacaff64624a925ad89ccf042d63d297b1bc855b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4064716
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-30 19:46:59 +00:00
Steven Moreland
5d21898fac Merge remote-tracking branch 'aosp/upstream-main' into merge
* aosp/upstream-main: (52 commits)
  gpu: move resource bridge related code to a separate struct.
  DIR_METADATA: Add ChromeOS CQ HW/VM V2 test plans.
  infra: Always docker pull dev container in CQ
  dev_container: Add --pull option to force trigger docker pull
  dev_container: Fix vscode integration
  rutabaga_gfx: nuke fake capset
  health-check: enforce blank line after copyright
  Roll recipe dependencies (trivial).
  aarch64: Expose MTE to guests
  health-check: Add version check for mdformat
  crosvm: unix: install memfd panic hook
  infra: Add led usage examples to README.md
  Update all copyright headers to match new style
  Update copyright header check to cover all files
  hypervisor: change the last KvmVm::new argument to a struct
  Roll recipe dependencies (trivial).
  devices: vfio: include path in group open error
  cmdline: Fix unbalanced brackets
  devices: Implement MasterReqHandler for Windows
  Roll recipe dependencies (trivial).
  ...

Bug: 246345534
Test: boot, test mapping
Change-Id: I8350c2e204c6709d6f5621fbcf5ebbd5620a157e
2022-09-14 21:21:32 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00
Frederick Mayle
7a84feecfa ANDROID: crosvm: Run cargo2android after merge
Some tests are being removed. Notes on each below.

  * aarch64: has tests, but not mentioned in cargo.out, likely because we aren't cross compiling
  * anti_tamper: no tests
  * bit_field: no tests
  * broker_ipc: no tests
  * common/balloon_control: no tests
  * common/sync:  no tests
  * crosvm_control: no tests
  * gpu_display: tests guarded by unused feature flag
  * kvm_sys: no tests (in src/lib.rs, there are tests in basic.rs, but that has a separate target)
  * libcras_stub: no tests
  * linux_input_sys: no tests
  * metrics: no tests
  * net_sys: no tests
  * power_monitor: no tests
  * protos:  no tests
  * system_api_stub: no tests
  * tracing:  no tests
  * usb_sys: no tests
  * vfio_sys: no tests
  * virtio_sys:  no tests

I spot checked a few to see if there were relevant changes in the merge
(e.g. if the tests got deleted) and didn't find any (e.g. libcras_stub
has never had code, let alone tests).

Test: virtualization tests on CF
Bug: 243039383
Change-Id: I653b4f7669c18560663f3d62dcce64cce8276c94
2022-08-23 01:48:40 +00:00
Steven Moreland
bd20aa69a6 ANDROID: add back test files
Due to a cargo2android bug and various tool
changes, these were not included sometimes.

In two cases (serde_keyvalue_derive and arg_helpers),
we don't have the required dependencies for these
tests setup, b/c the component is a rust_proc_macro.

In the case of rutabaga_gfx, no change is made here
because it does not compile with the in-tree cargo
install.

Bug: 242733327
Test: build only
Change-Id: Ib0a1f80b62286cd5e77f7ff116f839ace34ebc81
2022-08-18 18:24:27 +00:00
Steven Moreland
db76d1dce1 Merge remote-tracking branch 'aosp/upstream-main' into merge
Bug: 242341118
Test: boot cf

* aosp/upstream-main: (64 commits)
  crosvm: fix build with gfxstream on Unix
  devices: debugcon: add docs and switch def port to 0x402
  tools/health-check: Remove legacy checks used by Luci
  Add Cargo.lock check to tools/health-check
  Add Cargo.lock files to version control again
  infra: Disable coverage collection on armhf
  x86_64: Fix incorrect _OSC in DSDT
  infra: Use new health check script
  tools/health-check: Revamp script to run on git delta only
  Revert "infra: Disable coverage collection"
  devices: vhost-user: blk: Support multiple queues
  devices: virtio: video: extract some device codes to functions
  devices: snd: Use serde for Params deserialization
  vm_control: skip VfioDmabufUnmap when possible
  run_tests: Enable profile collection from remote tests
  infra: Remove build_coverage recipe
  gpu_display: switch from UnixStream to StreamChannel.
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  ...

Change-Id: I362c152058920ebb591a6b2fcd76321c8faf9cfd
2022-08-17 00:17:28 +00:00
Steven Moreland
c3ce8f368b ANDROID: all2android.sh - clean output
Restore to clean output state.

all2android.sh should not change the ToT build files. It's unclear
currently why the tests were generated in some cases. The bug is
filed to make sure we generate all tests and run them, though
for minimal merges, we need to keep this delta at zero.

Bug: 242733327
Test: n/a
Change-Id: Ic9e295f19e7055116c0495361df358ee48520cf2
2022-08-17 00:10:45 +00:00
Elie Kheirallah
abafb2dbb2 Merge remote-tracking branch 'aosp/upstream-main' into aosp/upstream-main
* aosp/upstream-main: (44 commits)
  Reformat imports with tools/fmt --nightly
  main: print parsing errors to stderr
  vm_control: use HotplugCommand for hotplug devices
  devices: pci: impl pci root worker
  config: convert --file-backed-mapping to serde_keyvalue
  Roll recipe dependencies (trivial).
  media: ffmpeg: Free AvPacket through av_free_packet.
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  x86_64: configure MSRs needed by intel_pstate in initramfs
  Roll recipe dependencies (trivial).
  Roll recipe dependencies (trivial).
  x86_64: add new option enable-hwp to expose HWP feature to guests
  media: ffmpeg: add pixel format wrapper and iterator
  virtio: video: decoder: ffmpeg: use zero-copy for input buffers
  Revert "crosvm: Embed seccomp filters into binary"
  devices: vhost: user: snd:: Implement VVU snd
  audio: Support null backend for Vhost User Snd
  ...

Bug: 241784778
Test: m && TH
Test: launch_cvd
Change-Id: I17fbe1468ad4d539fc716e34d4b408431436cb70
2022-08-11 22:07:10 +00:00
Noah Gold
256ac75f1f Revert "x display: ST event emulation for MT events"
This reverts commit d98f01af14.

NOTE: we are intentionally keeping the changes to use new tracking IDs
per contact, and the conversion of wayland to send MT events, as those
are not really part of the simulation change, and should be fine to keep.

Following discussion w/ drmasquatch@ offline re comments on the OCL, it
seems like there are other ways we could solve for the original
problem without introducing a simulation layer. Given the complexity
introduced and the fact that not all consumers necessarily want this
compat layer, a revert seems like the best step. Some options for fixing
the original problem in the future:

* Modify gpu_display_wl to produce ST events based on a CLI flag.
  This is pretty easy, and involves enhancing
  `--display-window-mouse` to take whether the events should be ST
  or MT, and then generating the ST events in the display backends
  as specified. The same flag also needs to create a ST device
  rather than a MT device so that the ST events will be accepted
  by the guest kernel.
* Modify the virtio-input kernel driver. This might be the right
  place to add a compat layer, if one is needed more broadly. It
  will also fix the problem everywhere.

Original CL: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3330723
TEST=builds
BUG=b:191173095

Change-Id: Iad07b6b5a06a3884dc352c49847b2b3c268ee5bd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3814100
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Noah Gold <nkgold@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-08-09 00:11:50 +00:00
Devin Moore
b921e9a017 Merge remote-tracking branch 'aosp/upstream-main' into new_merge_8_2
Keep the devices::virtio::Console type for Android.
Add symlink to Android's external/minigbm
Fis up GpuParamater usage in sys/unix/config.rs

* aosp/upstream-main: (115 commits)
  devices: clippy warning fixes
  balloon: fix support for optional queues
  balloon: Tweak async code for optional queues
  Roll recipe dependencies (trivial).
  resources: optimize region coalescing
  devices: vvu-proxy: Rename offset variable for shared memory bar
  gpu: add refresh_rate and hidden to the display parameters
  tools/run_tests: Add lcov generation
  Roll recipe dependencies (trivial).
  base: syslog: Fix android build
  crosvm: windows: remove unused check_ac97_backend
  integration_tests: Simple backwards compatibility test
  config: Remove instances of ac97 vios
  devices: vvu: split proxy bar
  crosvm: use VirtioDeviceBuilder for creating block devices
  virtio: block: factorize disk opening code
  virtio: vhost-user: block: leverage BlockAsync for device creation
  docs: book: add caveats section to VVU docs
  crosvm: add serial support to "devices" command
  doc: Fix minor typos in some docs
  ...

Test: m and TH
Bug: 240700174

Change-Id: I0ca80cd3746e5882c54f33784d7ec65b8b83b5ac
2022-08-03 18:04:24 +00:00
Dennis Kempin
4fea399df9 Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.

Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.

BUG=b:239937122
TEST=CQ

Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-28 00:15:50 +00:00
Frederick Mayle
2188ee8e42 crosvm: Limit apex visibility of crosvm modules
This undoes some of the changes made in https://r.android.com/2138858.
Rust modules now are apex_available by default, but we don't want that
for crosvm's crates.

Test: ./all2android.sh
Bug: 238440998
Change-Id: I7226d929a10ffd6a48fa5413c7710ef0eaf2185c
2022-07-14 17:23:32 +00:00
Frederick Mayle
f7b8566e2d Merge remote-tracking branch 'aosp/upstream-main' into AOSP
The "virtio-iommu" flag was dropped because of a cmdline arg
refactoring. I'm reintroducing it in a separate commit.

The many "apex_available" changes are a result of cargo2android's
defaults changing in https://r.android.com/2128853.

Had to enable a feature flag for serde_keyvalue now that more of the
library is used in android-enabled code paths.

Added the "no_presubmit" flag to the root crate, which controls whether
the tests are considered unit tests. Necessary because some of the tests
now check if "/dev/kvm" exists (and it doesn't in TH host tests).

* aosp/upstream-main: (125 commits)
  crosvm: implement lock-guest-memory feature.
  hypervisor: enable TSC cpuid leaf synthesis for haxm.
  x86_64: add TSC leaf synthesis.
  virtio: Enable build and tests for some virtio mods
  ffmpeg: specify supported resolution range for input formats
  vcpu: refactor scheduler config into a new function
  tools: Set host as default target
  seccomp: add arm policy for Goldfish battery
  hypervisor: update CpuIdEntry uses for haxm and whpx
  crosvm: rename DevicesCommand to DeviceCommand
  vm_control: use Protection in mapping requests
  tools: Make run_tests python3.8 compatible
  base: Upstream stream_channel
  base: add nanoseconds to log timestamps.
  devices: virtio: snd: Support num_{output,input}_devices
  crosvm: Add documentation for crosvm_control
  devices: virtio: console: use ReadNotifier trait for polling
  devices: virtio: console: add async console device shared with vhost-user
  base: Add safety comments in net.rs
  examples/baremetal: exit instead of hanging
  ...

Test: TODO
Bug: 236873276
Change-Id: I2bd8fe8580cf2bdee1dbe0d20594e4090afc4125
2022-06-29 21:43:06 +00:00