Commit Graph

9441 Commits

Author SHA1 Message Date
wuxinyue
19d0196291 virtio-devices: block: Reduce latency in completion handling
Signal the guest before processing queue submissions to enable
earlier guest side completion event handling, reducing end-to-end
latency for block device operations.

FIO benchmarks show up to 7.4% bandwidth improvement at 16
iodepth and 4k block size with NVMe devices.

Signed-off-by: wuxinyue <wuxinyue.wxy@antgroup.com>
2026-03-10 09:06:20 +00:00
dependabot[bot]
40768086b9 build: Bump the non-rust-vmm group across 2 directories with 15 updates
Bumps the non-rust-vmm group with 9 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [libc](https://github.com/rust-lang/libc) | `0.2.182` | `0.2.183` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.21.0` | `1.22.0` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.40` | `0.8.42` |
| [getrandom](https://github.com/rust-random/getrandom) | `0.4.1` | `0.4.2` |
| [jiff](https://github.com/BurntSushi/jiff) | `0.2.22` | `0.2.23` |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | `3.4.0` | `3.5.0` |
| [quote](https://github.com/dtolnay/quote) | `1.0.44` | `1.0.45` |
| [uds_windows](https://github.com/haraldh/rust_uds_windows) | `1.1.0` | `1.2.0` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.14` | `0.7.15` |

Bumps the non-rust-vmm group with 6 updates in the /fuzz directory:

| Package | From | To |
| --- | --- | --- |
| [libc](https://github.com/rust-lang/libc) | `0.2.182` | `0.2.183` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.21.0` | `1.22.0` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.40` | `0.8.42` |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | `3.4.0` | `3.5.0` |
| [quote](https://github.com/dtolnay/quote) | `1.0.44` | `1.0.45` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.14` | `0.7.15` |



Updates `libc` from 0.2.182 to 0.2.183
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.183/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.182...0.2.183)

Updates `uuid` from 1.21.0 to 1.22.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/v1.21.0...v1.22.0)

Updates `zerocopy` from 0.8.40 to 0.8.42
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.40...v0.8.42)

Updates `getrandom` from 0.4.1 to 0.4.2
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.4.1...v0.4.2)

Updates `jiff` from 0.2.22 to 0.2.23
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.22...jiff-static-0.2.23)

Updates `jiff-static` from 0.2.22 to 0.2.23
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.22...jiff-static-0.2.23)

Updates `proc-macro-crate` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/bkchr/proc-macro-crate/releases)
- [Commits](https://github.com/bkchr/proc-macro-crate/compare/v3.4.0...v3.5.0)

Updates `quote` from 1.0.44 to 1.0.45
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.44...1.0.45)

Updates `rand_core` from 0.9.5 to 0.10.0
- [Release notes](https://github.com/rust-random/rand_core/releases)
- [Changelog](https://github.com/rust-random/rand_core/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand_core/commits/v0.10.0)

Updates `toml_datetime` from 0.7.5+spec-1.1.0 to 1.0.0+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.7.5...toml_datetime-v1.0.0)

Updates `toml_edit` from 0.23.10+spec-1.0.0 to 0.25.4+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.23.10...v0.25.4)

Updates `uds_windows` from 1.1.0 to 1.2.0
- [Release notes](https://github.com/haraldh/rust_uds_windows/releases)
- [Changelog](https://github.com/haraldh/rust_uds_windows/blob/master/CHANGELOG.md)
- [Commits](https://github.com/haraldh/rust_uds_windows/compare/v1.1.0...v1.2.0)

Updates `winnow` from 0.7.14 to 0.7.15
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.7.14...v0.7.15)

Updates `zerocopy-derive` from 0.8.40 to 0.8.42
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.40...v0.8.42)

Updates `libc` from 0.2.182 to 0.2.183
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.183/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.182...0.2.183)

Updates `uuid` from 1.21.0 to 1.22.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/v1.21.0...v1.22.0)

Updates `zerocopy` from 0.8.40 to 0.8.42
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.40...v0.8.42)

Updates `rand` from 0.9.2 to 0.10.0
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_core-0.9.2...0.10.0)

Updates `proc-macro-crate` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/bkchr/proc-macro-crate/releases)
- [Commits](https://github.com/bkchr/proc-macro-crate/compare/v3.4.0...v3.5.0)

Updates `quote` from 1.0.44 to 1.0.45
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.44...1.0.45)

Updates `rand_core` from 0.9.5 to 0.10.0
- [Release notes](https://github.com/rust-random/rand_core/releases)
- [Changelog](https://github.com/rust-random/rand_core/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand_core/commits/v0.10.0)

Updates `toml_datetime` from 0.7.5+spec-1.1.0 to 1.0.0+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.7.5...toml_datetime-v1.0.0)

Updates `toml_edit` from 0.23.10+spec-1.0.0 to 0.25.4+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.23.10...v0.25.4)

Updates `winnow` from 0.7.14 to 0.7.15
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.7.14...v0.7.15)

Updates `zerocopy-derive` from 0.8.40 to 0.8.42
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.40...v0.8.42)

---
updated-dependencies:
- dependency-name: libc
  dependency-version: 0.2.183
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: uuid
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: getrandom
  dependency-version: 0.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: jiff
  dependency-version: 0.2.23
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: jiff-static
  dependency-version: 0.2.23
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: proc-macro-crate
  dependency-version: 3.5.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: quote
  dependency-version: 1.0.45
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rand_core
  dependency-version: 0.10.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: toml_datetime
  dependency-version: 1.0.0+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-major
  dependency-group: non-rust-vmm
- dependency-name: toml_edit
  dependency-version: 0.25.4+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: uds_windows
  dependency-version: 1.2.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: winnow
  dependency-version: 0.7.15
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.42
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libc
  dependency-version: 0.2.183
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: uuid
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rand
  dependency-version: 0.10.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: proc-macro-crate
  dependency-version: 3.5.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: quote
  dependency-version: 1.0.45
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rand_core
  dependency-version: 0.10.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: toml_datetime
  dependency-version: 1.0.0+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-major
  dependency-group: non-rust-vmm
- dependency-name: toml_edit
  dependency-version: 0.25.4+spec-1.1.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: winnow
  dependency-version: 0.7.15
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.42
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-10 01:03:26 +00:00
sohakpt
a179f67b20 main: Fix formatting issue in arguments
Signed-off-by: sohakpt <sohakpt@outlook.com>
2026-03-09 22:17:08 +00:00
Wei Liu
26fac58a7c docs: CONTRIBUTING.md: Use the up to date link for DCO
Since the project claims to follow Linux's process, update the link to
point to Linux's process, instead of relying on an archived page which
contains outdated information.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2026-03-09 22:11:30 +00:00
Anatol Belski
fd6891db62 block: qcow: Extend unit tests
Add tests for multiqueue concurrent reads, raw and QCOW2 backing
files, three layer backing chains, COW on partial cluster writes,
discard with backing fallthrough, cross cluster boundary operations,
reads beyond virtual size, and resize.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Anatol Belski
57e89b04f6 block: qcow: Refactor BackingFile for ownership based decomposition
Replace the clone based BackingFileOps trait with a BackingKind enum
so backing files can be decomposed into their concrete owned types.

BackingFile::new() for QCOW2 backings now calls parse_qcow() directly
instead of building a full QcowFile. Remove Clone for BackingFile and
QcowFile.

Prerequisite for the qcow_sync rewrite which decomposes a BackingFile
into a raw fd or QcowMetadata for lock free I/O.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Anatol Belski
a4a5b19f64 block: qcow: Add resize() to QcowMetadata
Add resize() and grow_l1_table() so the metadata layer can grow
the virtual disk size. Only grow is supported.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Anatol Belski
9d686b0866 block: qcow: Add QcowMetadata with RwLock
Introduce QcowMetadata, a thread safe wrapper around QCOW2 metadata
tables and caches using RwLock.

Provides cluster resolution for reads and writes, and deallocate
operations for discard.

Extract parse_qcow() from QcowFile so both QcowFile and QcowDiskSync
can share the parsing and validation logic.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Anatol Belski
63db385c3c block: qcow: Extract utility functions into util.rs
Move L1 and L2 table entry helpers, division utilities and related
constants from mod.rs into a dedicated util.rs submodule. Both
mod.rs and metadata.rs import from util.

No functional changes.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Anatol Belski
210514cbf3 block: qcow: Extract QcowHeader and related types into header.rs
Move QcowHeader, associated types, constants and helper functions
into a new header.rs submodule. Public types are re-exported from
mod.rs.

No functional changes.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-09 13:02:07 +00:00
Andrei Vagin
2698cfed98 virtio-devices: console: Fix descriptor chain processing
Both process_input_queue and process_output_queue were only processing
the first descriptor of a chain, leading to data loss if the driver used
chained descriptors.

This change iterates through all descriptors in a chain. It also moves
the flush call out of the descriptor loops to improve performance.

Signed-off-by: Andrei Vagin <avagin@google.com>
2026-03-09 05:19:11 +00:00
Andrei Vagin
49156c720c virtio-devices: console: Use 0 as the 'len' for the transmit queue
For a transmit queue (guest to host), the host only reads from the
guest-provided buffers and does not write to them. According to the
virtio specification (e.g., Section 2.6.8 in Virtio 1.1), the 'len'
field in the used ring has to be set to the number of bytes written to
the buffers. Therefore, it should be 0 for the console transmit queue.

Signed-off-by: Andrei Vagin <avagin@google.com>
2026-03-09 05:19:11 +00:00
Andrei Vagin
9f569c7b8d virtio-devices: console: Fix atomic corruption in ConsoleResizer
The update_console_size method was using fetch_and on the acked_features
atomic, which modified the atomic and cleared other feature bits.
Changed it to use a non-destructive load and bitwise AND.

Signed-off-by: Andrei Vagin <avagin@google.com>
2026-03-09 05:19:11 +00:00
Victor Vieux
01e4053bef docs: Add disk locking documentation
Add docs/disk_locking.md explaining advisory OFD locking, the
lock_granularity parameter, byte-range vs whole-file semantics,
and fallback behavior.

Signed-off-by: Victor Vieux <vieux@repl.it>
2026-03-08 10:07:03 +00:00
Victor Vieux
7c690ffec0 vmm: config: Expose disk lock granularity option
Add a per-disk lock_granularity parameter that lets users choose
between byte-range OFD locks and whole-file OFD locks:

  --disk path=/foo.img,lock_granularity=byte-range
  --disk path=/bar.img,lock_granularity=full

Byte-range is the default and matches QEMU behavior, working
best with storage backends where whole-file OFD locks are treated
as mandatory. The full option restores the original whole-file
locking for environments that depend on it.

The LockGranularityChoice enum and its FromStr impl live in the
block crate alongside the existing LockGranularity type. The
Block device converts the user-facing choice to the internal
LockGranularity at lock time, keeping device_manager.rs simple.

Closes: #7553

Signed-off-by: Victor Vieux <vieux@repl.it>
2026-03-08 10:07:03 +00:00
Anatol Belski
da0d0a2090 virtio-devices: Rename VIRTIO_F_IOMMU_PLATFORM
Rename the transport feature bit constant from
VIRTIO_F_IOMMU_PLATFORM to VIRTIO_F_ACCESS_PLATFORM across
the entire virtio-devices crate.

The virtio specification as of v1.1 carries bit 33 as
VIRTIO_F_ACCESS_PLATFORM. The Linux kernel UAPI header
<linux/virtio_config.h> carries VIRTIO_F_IOMMU_PLATFORM
only as a backward-compatible alias.

This is a pure rename with no functional or behavioral
change.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-08 09:56:01 +00:00
Anatol Belski
313d980538 vm-virtio: Remove stale comment from watchdog device ID
Device ID 35 for virtio watchdog was officially allocated and
merged into the Linux kernel UAPI headers as VIRTIO_ID_WATCHDOG
in kernel 5.15. The virtio specification v1.2 also lists device
ID 35 for the watchdog device type. Leaving the comment is
therefore misleading.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-08 09:56:01 +00:00
Anatol Belski
355cbad09a virtio-devices: iommu: Fix VirtioIommuConfig reserved field size
Fix the _reserved field in VirtioIommuConfig from [u8; 7] to
[u8; 3], correcting the struct size from 44 bytes to the
spec-mandated 40 bytes.

The virtio specification v1.2, Section 5.13.4 defines struct
virtio_iommu_config as 40 bytes total.

The kernel UAPI header linux/virtio_iommu.h matches this
layout with __u8 reserved[3] since kernel 5.17. Prior to that,
the struct was 36 bytes with no bypass field at all.

The incorrect [u8; 7] made the packed struct 44 bytes. Since
the struct is exposed to the guest, the guest saw a 44 byte
device specific configuration region instead of 40 bytes.
While well behaved guest drivers only access fields at known
offsets and would not observe data corruption from the extra
4 zero bytes at the tail, the oversized config region is a
spec violation.

The write_config path is not affected because it validates
the exact offset of the bypass field before allowing writes,
and the bypass field sits at offset 36 regardless of the
trailing reserved size.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-08 09:56:01 +00:00
dependabot[bot]
e5be2196f5 build: Bump docker/build-push-action from 6 to 7
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6 to 7.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-07 00:50:03 +00:00
Rob Bradford
072e980e08 vmm: serial_manager: Use OwnedFd for the epoll FD
Replace the use of a conventional File for managing the lifetime.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
e7e5fefb29 vmm: serial_manager: Improve event variable name
Name the variable after what the intention on the caller side not the
callee name.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
4c2b2110c9 vmm: serial_manager: Reorder epoll event setup
It makes most sense to create the epoll FD and add the kill event before
identifying the transport specific fd.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
9d712a10a6 vmm: Improve naming of ConsoleInfo struct members
These aren't FDs and we don't need to know that they are the main ones.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
9cb49a244e vmm: device_manager: Be consistent with transport variable name
Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
f3d2d6c669 vmm: serial_manager: Be consistent with ConsoleTransport variable
Ensure that the same variable name is used for the transport.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
48dcfc5fd0 vmm: Rename ConsoleOutput to ConsoleTransport
This is not just used for determine the output but also the input to the
console where this can be bidirectional.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Rob Bradford
5e2539ae16 vmm: serial_manager: Use more appropriately named variable
This isn't an fd - rather it's the UnixListener struct.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-06 21:04:14 +00:00
Anatol Belski
4ebbbe2294 vmm: igvm: Use sort_by_key instead of sort_by
Do the necessary replacement to satisfy clippy::unnecessary_sort_by.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
e61349c10e vmm: gdb: Use map_or instead of map().unwrap_or()
Do the necessary replacement to satisfy clippy::map_unwrap_or.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
3c62fabfc3 vmm: Collapse nested if into match arm guards
Do the necessary replacements to satisfy clippy::collapsible_match.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
f1c33afc8e virtio-devices: vsock: Simplify discarded accept result
Do the necessary replacements to satisfy clippy::map_unwrap_or.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
89107d2db4 arch: x86_64: Allow unused_unsafe on cpuid match arms
The nightly compiler used by cargo fuzz no longer requires unsafe
for __cpuid intrinsics, but stable still does.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
ff39c35ac2 arch: x86_64: Collapse nested if into match arm guards
Do the necessary replacements to satisfy clippy::collapsible_match.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
Anatol Belski
b7b38df99c block: raw: Use map_or instead of map().unwrap_or()
Do the necessary replacements to satisfy clippy::map_unwrap_or.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 12:32:38 +00:00
dependabot[bot]
5925a013af build: Bump docker/setup-buildx-action from 3 to 4
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-06 01:43:36 +00:00
Wei Liu
2495fdc0e7 vmm: Print out the version information at launch
It is useful to see this information in the log while debugging issues.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2026-03-06 00:40:51 +00:00
Anatol Belski
1f93fef66f vmm: Remove dead QcowDeviceCreate error variant
The variant has been unused since commit 12e20effd which
replaced direct QcowFile creation with QcowDiskSync.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-06 00:05:33 +00:00
dependabot[bot]
a758f8bd82 build: Bump docker/login-action from 3 to 4
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-05 00:51:33 +00:00
Rob Bradford
67945b31e5 tests: Add integration test for nested virtualization
Since we run integration tests on Intel & AMD this should test the
behaviour of `--cpus nested={on|off}` correctly.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-04 13:17:36 +00:00
Rob Bradford
f57b7c5b86 arch: x86_64: Correctly disable nested virtualization on AMD
The loop that is for programming the APIC ID and disabling nested
virtualization was prematurely breaking out on AMD platforms as the 0x1
leaf is also valid on AMD. This lead to the code attempting to disable
SVM in the 0x8000_0001 leaf never being reached.

Now only break out early if the CPU vendor is Intel.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-03-04 13:17:36 +00:00
Muminul Islam
7c48aafb65 tests: Add CVM HTTP API shutdown and delete tests
Add test_api_http_shutdown and test_api_http_delete to the
common_cvm module using GuestFactory with 4 CPUs. Both tests
reuse existing _test_api_shutdown and _test_api_delete helpers
to extend API coverage to confidential VMs.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
f6829561e5 tests: Use GuestFactory in CVM simple launch test
Replace manual Guest field assignments with
GuestFactory::new_confidential_guest_factory() in
test_focal_simple_launch for consistent CVM guest creation.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
b8a6afd332 tests: Add CVM HTTP API create/boot test
Add test_api_http_create_boot to the common_cvm module using
GuestFactory::new_confidential_guest_factory() with 4 CPUs.
This extends API create/boot coverage to confidential VMs.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
7a0019514f tests: Make api_create_body() parameterless
Refactor api_create_body() to read cpu_count, kernel_path,
and kernel_cmdline from Guest fields instead of taking them
as parameters. This makes Guest the single source of truth
for VM configuration.

Update all call sites in HTTP and DBus API tests to use the
new parameterless signature. Switch guest creation to use
GuestFactory for consistent 4-CPU configuration.

Replace manual CPU and memory assertions with
validate_cpu_count() and validate_memory() helpers.
Replace thread::sleep with wait_vm_boot() in
_test_api_create_boot for proper boot synchronization.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
f443bae9d9 tests: Support CVM in api_create_body()
Refactor api_create_body() to branch based on GuestVmType.
For confidential VMs, the JSON body now includes:
- platform config with sev_snp enabled
- IGVM payload with host_data instead of kernel
- nested virtualization disabled in CPU config

Replace the monolithic format! macro with incremental
push_str calls for clearer JSON construction.

Also improve error handling in GuestCommand by replacing
an unwrap() with a descriptive expect() on the IGVM path.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
85159c9255 tests: Add factory pattern to create guest instances
Introduce GuestFactory struct that encapsulates GuestVmType,
boot timeout, and nested virtualization defaults. This avoids
repeatedly specifying VM type and associated defaults when
constructing Guest instances in integration tests.

Two factory constructors are provided:
- new_regular_guest_factory: default timeout, nested enabled
- new_confidential_guest_factory: CVM timeout, nested disabled

Multiple create_guest variants allow customizing CPU count,
memory size, and nested virtualization while inheriting the
factory's VM type and timeout settings.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
f2d3c17e1f test_infra: set default kernel path and cmdline in Guest
Initialize kernel_path and kernel_cmdline with standard
direct boot defaults in the Guest constructor instead of
None. This removes boilerplate from individual tests that
use the common direct kernel boot configuration.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
Muminul Islam
838a4f86c4 tests: move shared constants and helpers to test_infra
Move test constants (MAX_NUM_PCI_SEGMENTS,
DIRECT_KERNEL_BOOT_CMDLINE, CONSOLE_TEST_STRING),
arch-specific image name modules (x86_64, aarch64),
and helper functions (direct_kernel_boot_path, edk2_path)
from integration.rs to test_infra/src/lib.rs.

This centralizes shared test definitions so they can be
reused across multiple test crates instead of being
confined to integration.rs.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-03-03 09:09:34 +00:00
dependabot[bot]
511e682909 build: Bump the non-rust-vmm group across 2 directories with 12 updates
Bumps the non-rust-vmm group with 9 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [serde_with](https://github.com/jonasbb/serde_with) | `3.16.1` | `3.17.0` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.39` | `0.8.40` |
| [jiff](https://github.com/BurntSushi/jiff) | `0.2.21` | `0.2.22` |
| libredox | `0.1.12` | `0.1.14` |
| [libz-sys](https://github.com/rust-lang/libz-sys) | `1.1.23` | `1.1.24` |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | `0.2.16` | `0.2.17` |
| [piper](https://github.com/smol-rs/piper) | `0.2.4` | `0.2.5` |
| [regex-syntax](https://github.com/rust-lang/regex) | `0.8.9` | `0.8.10` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.25.0` | `3.26.0` |

Bumps the non-rust-vmm group with 2 updates in the /fuzz directory: [serde_with](https://github.com/jonasbb/serde_with) and [zerocopy](https://github.com/google/zerocopy).


Updates `serde_with` from 3.16.1 to 3.17.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

Updates `zerocopy` from 0.8.39 to 0.8.40
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.39...v0.8.40)

Updates `jiff` from 0.2.21 to 0.2.22
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.21...jiff-static-0.2.22)

Updates `jiff-static` from 0.2.21 to 0.2.22
- [Release notes](https://github.com/BurntSushi/jiff/releases)
- [Changelog](https://github.com/BurntSushi/jiff/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/jiff/compare/jiff-static-0.2.21...jiff-static-0.2.22)

Updates `libredox` from 0.1.12 to 0.1.14

Updates `libz-sys` from 1.1.23 to 1.1.24
- [Release notes](https://github.com/rust-lang/libz-sys/releases)
- [Commits](https://github.com/rust-lang/libz-sys/compare/1.1.23...1.1.24)

Updates `pin-project-lite` from 0.2.16 to 0.2.17
- [Release notes](https://github.com/taiki-e/pin-project-lite/releases)
- [Changelog](https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.2.16...v0.2.17)

Updates `piper` from 0.2.4 to 0.2.5
- [Release notes](https://github.com/smol-rs/piper/releases)
- [Changelog](https://github.com/smol-rs/piper/blob/main/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/piper/compare/v0.2.4...v0.2.5)

Updates `regex-syntax` from 0.8.9 to 0.8.10
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.8.9...regex-syntax-0.8.10)

Updates `serde_with_macros` from 3.16.1 to 3.17.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

Updates `tempfile` from 3.25.0 to 3.26.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits/v3.26.0)

Updates `zerocopy-derive` from 0.8.39 to 0.8.40
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.39...v0.8.40)

Updates `serde_with` from 3.16.1 to 3.17.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

Updates `zerocopy` from 0.8.39 to 0.8.40
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.39...v0.8.40)

Updates `serde_with_macros` from 3.16.1 to 3.17.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

Updates `zerocopy-derive` from 0.8.39 to 0.8.40
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.39...v0.8.40)

---
updated-dependencies:
- dependency-name: serde_with
  dependency-version: 3.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.40
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: jiff
  dependency-version: 0.2.22
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: jiff-static
  dependency-version: 0.2.22
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libredox
  dependency-version: 0.1.14
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: libz-sys
  dependency-version: 1.1.24
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: pin-project-lite
  dependency-version: 0.2.17
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: piper
  dependency-version: 0.2.5
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: regex-syntax
  dependency-version: 0.8.10
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: serde_with_macros
  dependency-version: 3.17.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: tempfile
  dependency-version: 3.26.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.40
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: serde_with
  dependency-version: 3.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy
  dependency-version: 0.8.40
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: serde_with_macros
  dependency-version: 3.17.0
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: zerocopy-derive
  dependency-version: 0.8.40
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-03 02:08:01 +00:00
Anatol Belski
aae7594a67 tests: Add direct I/O block device alignment test
Boot a VM with a 4k sector loop device passed with direct=on and
image_type=raw.  Assert that the guest sees a 4096 byte logical
sector and that a DIO write/read roundtrip at 4096 byte alignment
succeeds.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-02 18:26:55 +00:00