This change introduces feature audio_aaudio on top of the support of
virtio-snd-multiple-backend. The android_audio uses the Android
AAudio NDK library to play audio. A libaaudio_stub is provided for
building and testing on non-android environment.
Bug=b:325930215
Test=Play Youtube video on panther
Test=./tools/dev_container
Test=cargo build
Test=cargo build -F audio_aaudio,libaaudio_stub
Test=./tools/run_tests
Test=./tools/presubmit
Change-Id: I7c275433bf94d4a347720ce0ffa9127ffcb66a1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5556704
Reviewed-by: Jiyong Park <jiyong@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Auto-Submit: Mu-Le Lee <mulelee@google.com>
Commit-Queue: Mu-Le Lee <mulelee@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
After [crrev/c/5579863](http://crrev/c/5579863), a slot would reject any
hotplug requests until it is ready. To accomodate this, The manager adds
EmptyNotReady and OccupiedNotReady states to a slot, and waits for port
ready notification to send requests. Unit tests added. e2e tests are not
feasible since the current test VM does not accept commands until the
guest is ready.
TEST=presubmit tests
TEST=manual test: Add device before PCI enumeration, then remove and add
BUG=b:331529292
Change-Id: I7769667a9838fe8869b8855bc6b080d6e451fad2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5578630
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
This CL adds a notification event when a PCI slot is enabled by the
guest, and is ready for accepting hot plug events.
TEST=presubmit tests
BUG=b:331529292
Change-Id: I69cda392eb7bdfec5a4b731990c0c3816e8359ad
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5578629
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
When a PCIe slot is initiated, the power indicator defaults to OFF.
However, as a device behind the bridge can be added and initiated by
flipping PCIE_SLTSTA_PDS, then discovered by PCI enumeration, the power
indicator does not match the status of the card. Such an inconsistency
is problematic for subsequent hot plug requests. As a result, no hot
plug events shall be made until the port is enabled by the guest.
TEST=presubmit tests
BUG=b:331529292
Change-Id: Id1cee16ed97a2f13fca842d8b3437023968257c1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5579863
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
idanr@ has been writing and reviewing CLs in CrosVM & a downstream
product for over a year. In addition to his primary work, Idan has
completed a key refactoring project in upstream CrosVM where he
unified the GPU device stack (vhost-user/plain virtio), and has
upstreamed significant GPU code. Over the past month, he has been
consistently reviewing CLs in upstream CrosVM as is expected for
OWNERS. Idan regularly demonstrates good technical judgment for
changes in CrosVM, and has a holistic view of the codebase.
I believe the requirements for global CrosVM OWNERS have been
satisfied, and as such nominate idanr@ for the role.
BUG=none
TEST=idanr@ has been writing & reviewing code in CrosVM for some time
with good results.
Change-Id: I66b50034d6f481ba94d38fba07c03b6723bc31e4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5582033
Reviewed-by: Idan Raiter <idanr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
error[E0599]: no method named `uses_vulkano` found for struct `RutabagaGrallocBackendFlags` in the current scope
--> external/crosvm/rutabaga_gfx/src/rutabaga_gralloc/gralloc.rs:280:18
|
29 | pub struct RutabagaGrallocBackendFlags(pub u32);
| -------------------------------------- method `uses_vulkano` not found for this struct
...
280 | if flags.uses_vulkano() {
| ^^^^^^^^^^^^ help: there is a method with a similar name: `uses_vulkan`
BUG=336291294
TEST=cuttlefish_fastboot_flashing_test
Change-Id: Ie57505e576f948d7fe30a56733da3bbddbb8e2ac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5581104
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Transmuting from [u8; 16] to [u32; 4] was undefined behavior, since the
alignment of u32 is larger than that of u8.
Replace this conversion, as well as the corresponding conversion back to
an array, as `from_ne_bytes()` and `to_ne_bytes()` functions as wrappers
around the standard `u128` functions by the same names, and implement
`u128` <-> `WHV_UINT128` conversions in a safe, straightforward way
with casts of the union fields to the appropriate native types and
shifting.
BUG=None
TEST=tools/presubmit_clippy_mingw64 # with whpx feature
Change-Id: I4e3fa84ade61c7da6e66f3dbf6a110e81bf8b1fa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5577447
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Remove some members that are no longer working on
crosvm, add others to fill the void.
Change-Id: Ieb5f769be5678dde199f2f5f183c0dc4ec09332d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5577440
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
RutabagaGralloc is used for two things:
1) Allocating swapchain buffers
2) Using Vulkan to map buffers via hypervisor-specific syscalls
(2) is done in the main crosvm process, and could be sensitive
to performance considerations. The "cuttlefish_fastboot_flashing_test"
seems to fail when Vulkano is initialized. Maybe initializing Vulkan
takes too long, who knows.
Only Windows uses (2), and Linux doesn't really need it right now.
All Linux platforms could benefit from (1), so modify
RutabagaGralloc initialization so Vulkan is available for (1) but
not (2) on Linux.
BUG=336291294
TEST=cuttlefish_fastboot_flashing_test
Change-Id: Ic753298230f05e4c314f65b3efbb362c76e21cd9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5577398
Reviewed-by: Frederick Mayle <fmayle@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Virtio-snd on Windows will take a audio_client_guid on initialization.
A device index is also added so that logs can be differentiated between
multiple audio devices
TEST=ran emulator downstream
BUG=b:342181161
Change-Id: Ia156b3ad2a9cc447a7e350a1915762f23e25f9cb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5563959
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
It is only guaranteed that interrupt won't be delievered right after sti
only when FLAGS.IF is not set. With the added cli, all hypervisors don't
allow interrupt injection right after sti.
TEST=./tools/dev_container cargo nextest run --workspace --profile=default -E 'package(hypervisor) & binary(hypervisor_virtualization)' --retries 0 --no-capture
BUG=b:334055761
Change-Id: Ie7a5cc9ca7e4a597c6fe07b59772a1380b64d858
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5578134
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Judson Powers <judsonp@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
BUG=none
TEST=start a VM with pmem device
Change-Id: Ie720be3adf046e63a008bef9d518de1e20d7c5bb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5569434
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
1. Handle cursor scanout as well
2. Add set_android_surface_position to handle cursor move event
Bug: 327559087
Test: check cursor in vm
Change-Id: I5429cb88a0f7983df015e05745070bf71f7c15ad
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5569432
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Jiyong Park <jiyong@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
The interrupt window includes:
* sti
* mov ss
On real x86 processors, after certain instructions(mov ss/pop ss/sti), an interrupt is guaranteed not to be delivered for exactly one instruction, not just an indefinite amount of time.
For mov ss/pop ss, this is architecturally defined so that loading a new stack segment plus stack pointer together can be done atomically (without an interrupt handler running in the middle and using a half-initialized stack address).
For sti, this delay allows the kernel to do sti ret, without an interrupt handler running before we return from the current routine.
However, the virtualization instructions allow the hypervisor to inject interrupts. Therefore, it's the hypervisor/VMM's responsbility to not to deliver an interrupt on an unexpected places on the guest.
This test uses port IO to trigger VMEXIT before and after mov ss or sti, and tests the interruptibility under different occasions. It also tests when the interrupt will be delivered.
TEST=./tools/dev_container cargo nextest run --workspace --profile=default -E 'package(hypervisor) & binary(hypervisor_virtualization) & test(interruptible)' --retries 0 --no-capture
BUG=b:334055761
Change-Id: Ib800c5e8054b4bcc4b20899d2cea1b113081c0e7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5568137
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Judson Powers <judsonp@google.com>
This patch handles the asynchrony between the hypervisor and guest by
waiting for PCI_EXP_SLTCTL_CC signal, and scheduling subsequent events
carefully. This improves the robustness of hotplug when multiple such
events are scheduled consequetively before guest finished handling them.
BUG=b:331529292
TEST=Presubmit tests
TEST=manual function test: plug, unplug, plug before PCI enumeration
TEST=manual function test: plug, unplug, plug after PCI enumeration
Change-Id: Ie2544a83c31991429e73afe8eff5b3fc6241dcf1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5501022
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
When hot unplug on a PCI slot, the slot could already be off. In this
case, pressing attention button would trigger a hot plug attempt on the
guest. This CL adds a check on the slot state before the button press,
and skip the interrupt if it is already off.
BUG=b:331529292
TEST=./tools/dev_container ./tools/presubmit
Change-Id: I5c80e138cf2fb58003121f9efcc693ed26574a10
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5528836
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This CL delays the hot (un)plug complete signal until the first SLTSTA
write after the power indicator (PIC) is turned on or off. previously,
the signal was sent with the first SLTCTL change, when the PIC changes
to blinking. This shall be avoided as an attention button press (ABP)
while PIC blinking will cause the guest to try to cancel the previous
button press. (Ref to PCIe 4.0 spec 6.7.1.5) This was never intended.
The signal is deferred until the first SLTSTA write to prevent the
subsequent ABP to be accidentally cancelled.
BUG=b:331529292
TEST=presubmit tests
Change-Id: I2b72698ccd8985cb30f39e0e08be1ab0e6eaaac1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5528834
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Currently, hot plug and unplug before pcieport driver is load worked by
coincidence. Hotplug interrupt, PCIE_SLTSTA_ABP, and PCIE_SLTSTA_PDC
flags are mechanisms to notify guest a change in device presence, which
is not applicable before the port is enabled. Only the presence bit
PCIE_SLTSTA_PDS flip is needed. Refer to http://b/331529292/comment13
for more background.
hotplug e2e_tests are temporarily disabled as async handling is missing.
BUG=b:331529292
TEST=presubmit tests
TEST=hot plug, unplug, then plug before PCI enum with crrev/c/5501022
Change-Id: I1fdbe12c5db15eb1971f28c84bb5cc813a3abd3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5538828
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Add three e2e test cases for virtio-console with
multiport feature.
1. Verify portname in testVM.
2. Verfiy output log from testVM in each port
3. Verify output log from testVM in each port
and verfiy modified input log from HostVM
For case3, we need to prepare a backend monitor service,
which is used to get tx message from out fifo,
change them to uppercase and send rx message to in fifo.
BUG=b:339817865
TEST=tools/run_tests --dut=vm --no-parallel -vv
-E 'package(e2e_tests) & test(vhost_user_console)'
Signed-off-by: Junnan Wu <junnan01.wu@samsung.com>
Change-Id: I23633a3454e470a67a9c92f760048e69afd39a4c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5534197
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Create different ISRs that set different registers for interrupt 32
and 33.
* Set up the IDT.
* hlt on the guest to allow the test to inject both the interrupt 32 and
33.
* hlt again on the host to end the guest VM.
* Check the registers on the host to verify which ISR has been called.
TEST=./tools/dev_container cargo nextest run --workspace --profile=default -E 'package(hypervisor) & binary(hypervisor_virtualization)' --retries 0
BUG=b:334055761
Change-Id: I7aa649542f81b346f7334cbdec1092986afead35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5550432
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Judson Powers <judsonp@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>