Adds the broker_ipc crate, which is used for communication & setup tasks
shared between the broker (Windows orchestrator for crosvm & vhost-user
devices) and all other crosvm processes.
BUG=b:232318124
TEST=builds
Change-Id: I17d529305dd348a50574e6c3c082808e97ffff45
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3648474
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
See USAGE for documentation.
This tool will be needed to upload to the upstream repository, as
we will no longer be able to use repo.
Currently, for testing it still points to the chromiumos repository.
BUG=b:221088786
TEST=Follow USAGE
Change-Id: I4a8d88a8354942f0ddfb7f9420ef1cf7f5885867
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687419
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This builder re-creates ci/build_merge_into_chromeos and just calls
the merge_bot script.
Eventually this could be better integrated with Luci UI. For now,
this is feature parity with Kokoro.
BUG=b:233913643
TEST=recipe.py run merge_into_chromeos
Change-Id: Ia5de775cad943687be654c3a054f1150ba9adbb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3673786
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The bot cannot resolve those automatically. To ease the process, we
will upload the merge anyway, so the oncall can download and resolve
the conflict.
Dry runs are not created when there are conflicts, they are bound
to fail and there is nothing the oncall can do about conflicts
until the actual merge is generated.
BUG=b:234847583
TEST=MERGE_BOT_TEST=1 ./tools/chromeos/merge_bot update-merges / update-dry-runs
Change-Id: I409e6b99284ff8a98b504b390c35329875d6a8b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3689544
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
We will be merging from the upstream repo into the cros repo. The
script can be run from both an upstream and a cros checkout, it
will setup the required remotes.
The CLI changes a little. We now require a revision to merge from
needs to be specified, since the script is not setting up the
upstream remote.
CI jobs will simply use HEAD, as the version to merge is already
checked out by the CI system.
BUG=b:233913643
TEST=
./merge_bot update-merges HEAD
./merge_bot update-merges origin/main
./merge_bot update-dry-runs HEAD
Change-Id: I247e1edc3ad951becf5d59b63efd74914bb2205f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687222
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Recipes can be tested with unit tests, run locally or run on a build
bot. The documentation shows how to do this.
BUG=None
TEST=None
Change-Id: Iec139de5c38d45765c9da0d95e8ac076c5df1dfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3682200
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Introduce `State` enum to handle vvu-proxy's lifecycle.
This state will be used to support recovery from sibling disconnection in the follow-up CL.
BUG=b:216407443
TEST=run VVU
Change-Id: I47f9c69abb9d08520ec90a4a9a87fc4d230c96a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591105
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
vhost-user implementations of the net device can currently not
specify a MAC for the guest, even though they would support this.
This adds the corresponding feature to the allowlist and increases
the queue size to 1k to avoid situations where the device runs out
of available descriptors.
BUG=None
TEST=./tools/run_tests
Change-Id: Iefe8ce21215b36c65ee2516428249c41bf13f285
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3683380
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Kevin Hamacher <hamacher@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
To explain use of various devices, let's have a separate chapter.
BUG=none
TEST=mdbook build
Change-Id: I0fe9926f9e6b97731a3a19d7b5f59b0eb2d1cf73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3607792
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Name the enums instead of bool so that it's easier to reason, and factor
out the MSR loop.
BUG=b:229770963
TEST=build
Change-Id: I7d2306472bdf7482479b40b0ef00f378754a811f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3685671
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Pull the declaration of the `EventToken` enum up to the top level of the
base crate, replacing the identical implementations inside sys/windows
and sys/unix.
Use the `EventToken` name consistently throughout the tree to remove the
unix-flavored "poll" nomenclature.
BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all
Change-Id: I0ba42037b533b796797a7a3f6d8d7e71a5592aba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3642673
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
This adds support for parsing hex `m=0x1234abcd` octal `0o755` and
binary `m=0o1100` values according the their prefix. Negative numbers
can also be specified by adding a `-` after the prefix.
Note that negative values like `m=-0x1234` don't work, largely as an
artifact of the way the Num trait works. This could probably be fixed,
but given hex, octal, and binary numbers tend to be used in unsigned
situations most of the time this shouldn't be an issue.
The main motivation for this is the debugcon serial device, which
accepts an argument which is an x86 IO port. These are much more
naturally described in hex.
BUG=b:233610263
Change-Id: Ic68bacd772de6aebfaad0de7b8aa6faf5d4c1555
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3671595
Commit-Queue: Mike Gerow <gerow@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The main distinction between PollContext and EpollContext was that the
latter was safe to use from multiple threads. This was not true of the
more widely-used PollContext for two reasons:
1. The `events` array was stored inside the `PollContext` structure,
whereas `EpollContext` required the caller to pass their own storage
for events.
2. `PollContext` had a hangup detection feature used to debug busy
looping cases that result from a failure to remove hungup file
descriptors from the context.
Point 1 is resolved by returning a `SmallVec` of events that avoids
allocation for the normal case (and in fact it should avoid allocation
in all cases on Linux, where the maximum number of events returned from
a single `epoll_wait()` call is limited to the same size as the
preallocated `SmallVec`). This simplifies the API and also means that
there is no need for per-context storage.
Point 2 can't easily be resolved, since it would require the `wait` call
to mutate shared state (this could be done by adding a mutex around the
shared data, but that seems like too much overhead for the value of the
feature). Instead, this patch just removes the hangup detection code.
BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all
Change-Id: Ia48c46de96976da27cb5387e3e5e8fcf92d0e85b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3633111
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Example help output (note that in main crosvm device help is broken)
```
Usage: crosvm device <command> [<args>]
Devices
Options:
--help display usage information
Commands:
block Block device
net Net device
console Console device
fs FS Device
gpu GPU device
vsock Vsock device
wl Wayland device
```
crosvm device wl help:
```
Usage: crosvm device wl --socket <PATH> --vm-socket <PATH> [--wayland-sock <PATH[,name=NAME]...>] [--resource-bridge <PATH>]
Wayland device
Options:
--socket path to bind a listening vhost-user socket
--vm-socket path to a socket for wayland-specific messages
--wayland-sock path to one or more Wayland sockets. The unnamed socket is
used for displaying virtual screens while the named ones are
used for IPC
--resource-bridge path to the GPU resource bridge
--help display usage information
```
Change-Id: Ie976b5545644c10b24cb3cdfcb17b213641064f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3668920
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
This reverts commit e84d9c1d7c.
Reason for revert: vfio-pci fails on ManaTEE with an out-of-range BAR index (8), so further investigation is required
Original change's description:
> devices: pci: PciBarIndex API cleanup
>
> Everything that takes a PCI BAR index should use the appropriate
> PciBarIndex type rather than u8 (or usize) for better type safety and
> descriptiveness.
>
> BUG=b:232838930
> TEST=tools/presubmit
>
> Change-Id: I0a918a6da6327c963fb297ba765563774a7e5e49
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3664282
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
> Reviewed-by: Anton Romanov <romanton@google.com>
Bug: b:232838930
Change-Id: Id5d19e779289e47045af67fa51c301ba2b79ee7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687516
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Once we have opened /dev/vfio/vfio we can leverage new_from_container().
BUG=None
TEST=cargo build
Change-Id: Ib309ab708cf561ec5dde8a606164a7df9a1bc4aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3675886
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This reverts commit 56c0d02760.
Reason for revert: Break ARCVM after suspend/resume
BUG=b:234067421
TEST=Checked that ARCVM kept working after suspend/resume
Original change's description:
> crosvm: remove balloon stats request timeout
>
> It was done to avoid deadlock when stats are requested before guest is
> up. Implement a stub BalloonStats::NotReady replier until host is up so
> that timeout is no longer necessary.
>
> BUG=b:232289535
> TEST=few tast crostini/arc tests
>
> Change-Id: I6731b4ee9eaecdd65aebdd3f530f0932b0660c85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3652887
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Anton Romanov <romanton@google.com>
> Auto-Submit: Anton Romanov <romanton@google.com>
Bug: b:232289535
Change-Id: Iffafaef1e1136ebc050d69d001d384eedd0a2319
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3686789
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Hikaru Nishida <hikalium@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Hikaru Nishida <hikalium@chromium.org>
Move this function to a place closer from its call site - this will make
the following CL less cluttered.
BUG=None
TEST=cargo build
Change-Id: I2837af9bb1f721967d7b7676140a8bd11973a34b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600171
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Use the newly introduced async queue structs to manage the vhost-user
console device queues. This allows the device to restart its queues
after they are stopped or reset. The previous implementation was losing
the input and output streams as the queue was stopped.
BUG=b:228385297
BUG=b:228912920
TEST=vhost-user console device is working (with input) on Linux.
Change-Id: Ie968af7cfa77734c86c088da3a52f4d6937c3d0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600170
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Add a structure that facilitates managing the state and resources of a
queue running on an async executor. This is to be first used by the
console device, but the goal is also to extend these helpers and use
them on as many devices as possible.
BUG=b:228385297
BUG=b:228912920
TEST=cargo build
Change-Id: I72a3df7d9bf900cff38b189380d3c8ec4f098a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600169
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
These files are not used, and libslirp-rs is not a functional crate.
Only context.rs is used in heavily forked form as a part of crosvm's `net_util`.
BUG=b:213151463
TEST=n/a
Change-Id: I6536cde7ff2beed655e83c3d920c6940ed4969a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3650467
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
With this and some pending hacks, dEQP works inside sibling
guest with VVU.
Device can be started with "crosvm device gpu --vfio <PCI ID>"
BUG=b:213532598
TEST=manual - run dEQP from a sibling guest when using VVU.
Change-Id: I97fa0e44c36cd5be13b6d31592878bdc19e48aed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3682201
Auto-Submit: Lepton Wu <lepton@chromium.org>
Commit-Queue: Lepton Wu <lepton@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This crossplatform API returns the number of logical cores on the
system.
Remove the older `get_vcpu_count()` that was mis-named and replace its
use with `number_of_logical_cores()`.
TEST=Compiled
Change-Id: I4c46deb35e8354ad2313230d26c94c0f7558e06f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3684930
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
The `haxm` implementation depends on `win_util` and `winapi` crates
which are only required on Windows. The `tempfile` crate is used in
testing.
Move `kvm` and `kvm_sys` dependencies for non-windows builds.
BUG=b:213151459
TEST=Compiled on linux.
Change-Id: I55b8ee4ac5da953a17e8bdd063e5ed488e3f53f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3684929
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Kokoro would maintain a local main branch in the local checkout,
so pushing --all will push the latest HEAD of main.
Luci will instead put us on a detached HEAD, with the local
main branch unmaintained. So we have been pushing the same old
version of crosvm.
Update the force push to submit HEAD to the remote main.
BUG=b:233913820
TEST=./recipes.py run push_to_github (requires authentication with
github to run)
Change-Id: I8282498382968768d66d9c807b9e86d191977beb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3681989
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This has only a tiny change outside of unix-specific code so shouldn't
complicate windows upstreaming
Change-Id: Iae68e761d730ed7497b4586b9b9a948524224d8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3671093
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Skip logging an error when the translate request tube closes. That
happens whenever the process on the other side of the tube closes, and
isn't an error in and of itself.
BUG=None
TEST=exit crosvm and observe no virtio-iommu error message
Change-Id: I5f0460182a96d00f8c348224c838554710fc5451
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3659815
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Make sure the endpoint is removed from the endpoint and domain maps when
a vfio device is removed.
BUG=b:232161488
TEST=Boot a guest, hotplug in and out a vfio-pci device repeatedly
Change-Id: Ie9838b412cac22a9e14bb6e986be39303aeb01e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3676692
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Refactor shared state so that it can be shared between multiple async
callbacks. This moves all state from the Worker to a dedicated State
struct, which allows it to be passed via Rc<RefCell<>> to the various
async callbacks. The collection of endpoints can also be passed as part
of the shared state, rather than as its own dedicated argument.
There should be no behavioral changes in this CL.
BUG=b:232161488
TEST=Boot a guest, hotplug in and out a vfio-pci device repeatedly
Change-Id: I1e65ef3e4048bf0889fdee0f18fa5b58be264666
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3659554
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Check that the same mapper isn't used for multiple domains. This ensures
that there won't be mapping collisions/leaks if the guest tries to use
the same mapper with multiple domains.
BUG=None
TEST=Boot ManaTEE with devices managed by viommu
Change-Id: I45889e6fe020c3a24b355fc05a8f74734bece78a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3641221
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Remove incomplete support for detaching a virtio endpoint from domains
with multiple endpoints. We could technically handle this by checking
domain mappings when handling TranslateRequests, but there are no use
cases for this at the moment.
BUG=None
TEST=Boot ManaTEE with devices managed by viommu
Change-Id: I9d1cb86f246f7d8639058eaaf158f6538f1c1c57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3676697
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Refactor create_vfio_device so that it returns the created viommu
related mapper, if any. This allows add_vfio_device to be written more
cleanly.
BUG=None
TEST=Boot ManaTEE with devices managed by viommu
Change-Id: Ieaa345ed5f9146fde8e305fc7bc37001ff708683
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3676698
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Don't use box and just use an array.
BUG=b:229770963
TEST=build
Change-Id: I8121e4809e418d7f3e1aa876d567e543ee50693c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3675887
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
For vfio devices which we expect to have granular, dynamic IOMMU
mappings (i.e. passthrough devices using viommu/coiommu), use the
ChromeOS specific VFIO_TYPE1v3_IOMMU if available, as it is optimized
for that use case.
BUG=b:217479627
TEST=boot ManaTEE, observe reduced hypervisor memory usage after IO
Change-Id: I7b3a04adb5049c165885917fa29cedf2ccdee1d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3675885
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
When creating shared memory, 'name' can have one of two meanings. It
could either be a debugging tag with no semantic meaning, or it could
uniquely identify a shared memory object within some namespace. Linux
memfd uses name in the first meaning, whereas Windows (and Linux shm)
uses it in the second meaning.
Currently, crosvm has no use cases for the named shared memory of the
second type, so it is not supported. Make it clear that the SharedMemory
APIs treats name as a debugging-only name. Remove the "anon" and "named"
constructors, since they had no semantic meaning. Also require a name
when constructing a SharedMemory, since there's no reason not to provide
one to make debugging easier.
The only semantic change is setting the name of GuestMemory's underlying
shmem to "crosvm_guest", which it was until recently. This fixes some
ManaTEE tests which use the name to determine CrOS guest memory usage.
BUG=None
TEST=compiles
Change-Id: I78d5046df04d6f19640abbbc67af6bd433a177b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3676695
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>