Commit graph

40 commits

Author SHA1 Message Date
Daniel Verkamp
c970dd44f4 bindgen: update to Linux 6.6 headers
The obsolete KVM_SET_MEMORY_ALIAS ioctl was removed from the kernel; it
was already unused in crosvm, so remove the corresponding ioctl macro.

Change-Id: I1ecfce4b8df886680154c567f82ab7f006fbfd1f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5178535
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2024-01-09 00:37:43 +00:00
Daniel Verkamp
ae33ac2934 bindgen: regenerate all bindings with bindgen 0.68.1
This removes some auto-generated safety comments, but should otherwise
be a no-op.

Change-Id: Ibfcf75c6e296367fe1a6114ce2047fb79e34041b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5178534
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-01-09 00:37:43 +00:00
Vikram Auradkar
2768f223ee clippy: enforce safety block comments
BUG=b:316174930
TEST=none

Change-Id: I5c7811b2c548155aa003e4b71a54bbc16e2f2588
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5120567
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-12-14 18:21:54 +00:00
Vikram Auradkar
96b82c0294 clippy: enforce safety doc comment
BUG=b:316168567
TEST=none

Change-Id: I4e0a74e509ed4ef672fb9f334654a50aa5e257f1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5118513
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-12-14 17:46:29 +00:00
Pierre-Clément Tosi
fdb527c202 vfio: Add support for pKVM-VFIO pvIOMMUs
Teach crosvm to spawn para-virtualized IOMMUs emulated by pKVM, which
are used by protected VMs to control the DMA translation regime of their
assigned (physical) devices without relying on the (untrusted) host or
VMM.

Implement a virtual topology with a 1-to-1 mapping between VFIO devices
and pvIOMMUs (i.e. no support for multiple devices per pvIOMMU nor for
multiple pvIOMMUs per device).

To allow guests to refer to individual pvIOMMUs in calls to the
hypervisor (for example, to map/unmap DMA), they are given an ID, which
the uAPI defines as the FD returned from one of its ioctls.

Like the rest of pKVM, this feature is specific to Android on AArch64.

Note: This makes use of a uAPI that is currently only available on some
      experimental (non-production) Android kernels and is likely to
      change!

TEST=tools/run_tests
BUG=b:306110430

Change-Id: I00c065754cffa39307272ad00698647e56404894
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5009546
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-15 10:50:46 +00:00
Daniel Verkamp
e62287c914 vfio_sys: undo non-upstream change and add it with --raw-line
The VFIO_PCI_ACPI_NTFY_IRQ_INDEX constant is not present in upstream
Linux, so regenerating the vfio_sys bindings removes it. Add it as part
of the bindgen --raw-line so it doesn't get lost when updating the
bindings.

This returns VFIO_PCI_NUM_IRQS to its original upstream value, but this
shouldn't matter since its value is not used anywhere.

BUG=b:244205651
TEST=vfio_sys/bindgen.sh

Change-Id: Ib2ed4f473a9196c786329337b1036087ccf8dfb6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4927832
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Grzegorz Jaszczyk <jaszczyk@google.com>
2023-10-11 18:06:09 +00: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
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
Daniel Verkamp
41f57f8f89 Apply nightly rustfmt import style
As usual, some unsorted and grouped imports have appeared.

Change-Id: I79b51e4c52cee38f5b8c238e46dfe3193c753554
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4847980
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-09-06 22:13:26 +00:00
Grzegorz Jaszczyk
298be81446 acpi: x86: add support for ACPI Notify() forwarding
In order to replicate the ACPI notification from the host to the guest
pass-through devices:
1) allocate GPE and eventfd per pci-vfio device
2) generate proper aml code for ACPI GPE handler. The example of generated aml:

    Scope (_GPE)
    {
        Method (_E00, 0, NotSerialized)  // _Exx: Edge-Triggered GPE, xx=0x00-0xFF
        {
            Local0 = \_SB.PC00.PE08.NOTY
            Notify (\_SB.PC00.PE08, Local0)
        }
    }

The eventfd is registered by host kernel via VFIO_DEVICE_SET_IRQS
ioctl. Crosvm upon receiving early provided, per pci-vfio eventfd,
stores the notification value and triggers GPE associated to pci-vfio
device.

Guest kernel upon handling GPE (thanks to generated aml [ad 2)],
triggers Notify on required pass-through device and therefore replicates
the ACPI Notification on the guest side [Accessing \_SB.PC00.PE08.NOTY
pointed by VCFG opregion result with trap to crosvm, which returns
previously stored notify value].

Kernel counterpart: CL:4538472

BUG=b:244205651
TEST=Observe replication of ACPI notification in the guest kernel

Change-Id: Iaf66097acd84f3066f6ff70d382f83ecaeea9a00
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4538483
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-07-27 11:30:18 +00:00
Grzegorz Jaszczyk
972ece840b vfio_pci: improve ACPI DSM forwarding support
This commit introduces several improvements:
- introduce const for DSM and PM VCFG's indexes
- introduce const and use them for AML DsmMethod generation,
  additionally add some comments which will ease understanding the
  snippet in the future
- improve error handling by getting rid of unwrap/expect usage since the
  errors are not unrecoverable
- pass &[u8] instead of Vec<u8> into acpi_dsm()
- add vfio_acpi_dsm into VFIO_EXTRA of vfio_sys/bindgen.sh

BUG=None
TEST=Build

Change-Id: I0c426ad7fc784f6dc165d65082c2d2d11435d8d9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4186658
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
2023-07-21 22:26:53 +00:00
Victor Ding
eb6ac34ede vfio_pci: add support for ACPI _DSM forwarding
Allow devices to host's ACPI _DSM via the recently proposed
VFIO_DEVICE_ACPI_DSM IOCTL

Co-authored-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>

BUG=b:194391459, b:289878032
TEST=host's ACPI _DSM method can be triggered from guest

Change-Id: I8de8cfbc85cdf6f9f15e53d4c5a4d4a3aa564ebd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3822005
Reviewed-by: Grzegorz Jaszczyk <jaszczyk@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-07-21 22:26:53 +00:00
Daniel Verkamp
14b7dda9f9 vfio_sys: clean up wildcard re-exports
Change-Id: I055ebf6772ce23d54e0526b8bbcf4f699e26eb8e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4637611
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-07-13 19:59:28 +00:00
Zihan Chen
c244741015 crosvm: Deprecate DataInit
- The remaning DataInit are all left due to limitations of the
current stable version of zerocopy
- Only 5 files still use DataInit
- DataInit is marked as deprecated to prevent future introduction
- Other mentions of DataInit across the repository are cleaned up

TEST=CQ

BUG=b:204409584
FIXED=b:204409584

Change-Id: Id7126e58cff63eaa67138de429375382a3ffbc55
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4680289
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-07-12 21:34:20 +00:00
Daniel Verkamp
2712fc59b1 bindgen: update kernel bindings to Linux 6.1
Switch to the ChromeOS v6.1 branch and regenerate all affected bindings
in the crosvm tree.

Some minor fixes were required in users of the bindings:
- KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 is available in the kernel now
  and was removed from the manually-added section of kvm_sys.
- The KVM system_event now contains an anonymous union, requiring a few
  renames.
- IORING_OP_* were moved into an enum, which required the enum name to
  be prefixed to the uses of those values.

BUG=None
TEST=tools/presubmit --all

Change-Id: I84568fb76658832130e2e9a631495ba82fd4c3ed
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4285742
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-02-23 21:31:44 +00:00
Zihan Chen
f5a0980efa vfio_sys: Update bindgen to derive zerocopy
TEST=CQ

BUG=b:204409584

Change-Id: I7ba94cfc1f61b9ef1ed13c1c1d775127ea18649e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4234070
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-02-09 23:07:28 +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
Daniel Verkamp
11a94b98a8 crosvm bindgen: regenerate with missing_safety_doc
Regenerate all of the automated bindgen bindings by running
tools/bindgen-all-the-things after commit 54311a8da9 ("crosvm bindgen:
Allow missing_safety_doc").

BUG=b:157245930
BUG=chromium:908640
TEST=tools/presubmit --all

Change-Id: I334f2ddc071acbf634f0d771d88650ee348cd5a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4025271
Reviewed-by: Zihan Chen <zihanchen@google.com>
Reviewed-by: Clarissa Garvey <clarissagarvey@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-11-15 20:43:50 +00:00
Victor Ding
ec820fc4ae vfio_pci: add support for runtime power management
Allow devices to perform runtime power management via
VFIO_DEVICE_FEATURE IOCTL.

BUG=b:194390621
TEST=host's VFIO_DEVICE_FEATURE can be triggered from guest

Change-Id: Id649a1e5fe317dfb315f841a152ec8b81fab8e7c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3822004
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Victor Ding <victording@chromium.org>
2022-10-10 10:56:05 +00:00
Daniel Verkamp
74f1ca4e78 bindgen: update bindings to Linux 5.15
This requires a few tweaks to non-generated code:
- VIRTIO_ID_VIDEO_ENC/DEC -> ENCODER/DECODER
- io_uring unnamed union layout change

Change-Id: I58e118efa5c6bf28ff56d211fec5603651cb60bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3893753
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-14 22:09:30 +00:00
Daniel Verkamp
7c6d8bec3f health-check: enforce blank line after copyright
While we are tweaking all of the copyright headers, let's take the
opportunity to ensure there is always a blank line after the copyright
header for consistency. (Almost all files already follow this style.)

This includes a slightly ugly regex to allow the end of a C-style
comment block after the end of the copyright:

/*
 * Example comment block
 */   <-- this line

Change-Id: Idfd0855861e5ecb3d33afae942fdba908af0dcff
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892521
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-09-13 22:24:35 +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
Dmytro Maluka
517b009996 direct_irq: support forwarding of ACPI fixed events
Userspace counterpart for the kernel irq-forward module change
CL:3599199 which adds support for physical ACPI fixed events
forwarding, very similar to physical GPE forwarding.

The mentioned kernel change also modifies the ioctl interface to unify
both types of ACPI events forwarding, but in a backward compatible way,
so this commit is not necessary to keep GPE forwarding working, but it
is required for adding support for fixed events forwarding.

BUG=b:228445196
TEST=ManaTEE boots.

Change-Id: If0bc07040144dd08d9f8917647b356eec310bcb7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3791193
Commit-Queue: Dmytro Maluka <dmaluka@google.com>
Tested-by: Dmytro Maluka <dmy@semihalf.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-08-09 09:24:31 +00:00
Dmytro Maluka
d61e24be2c Revert "direct_irq: Add support for host wakeup capable IRQs"
This reverts commit 0ac97979b6.

Reason for revert: This static configuration for wakeup IRQs is
no longer needed since we have a mechanism for automatic dynamic
configuration of wakeup IRQs based on requests from ChromeOS VM.

BUG=b:228449597
TEST=Boot ManaTEE and verify wakeup from touchpad and other devices.

Change-Id: Ifce6919d3c3ab9e677ee0a6566aba4d720168db5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593741
Reviewed-by: Tomasz Nowicki <tnowicki@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Micah Morton <mortonm@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2022-05-19 14:28:46 +00:00
Daniel Verkamp
45b0920767 doc: add a top-level comment to all crates
This provides at least a minimal one-line description to show what each
crate is about.

BUG=None
TEST=tools/cargo-doc

Change-Id: I26732e8c29062e622d5be09bdc120a49d564b9fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630422
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 20:46:57 +00:00
Woody Chow
91296bdee0 devices: vvu: virtio-iommu support in virtio-vhost-user
Make vvu use devices use VFIO to manage their virt queues. This
alleviates the need to use noiommu mode. However, it is still necessary
to use `vfio_iommu_type1.allow_unsafe_interrupts=1`.

BUG=b:202151642,b:215310597
TEST=launch sibling with vvu + virtio-iommu

Cq-Depend: chromium:3565728, chromium:3565260
Change-Id: If418524598c40a37d41c0ffaa1dcc0f8ee11fcb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3501052
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-04-08 01:39:22 +00:00
Dmytro Maluka
0ac97979b6 direct_irq: Add support for host wakeup capable IRQs
Add userspace counterpart to host kernel change CL:3571844 to support
physical wakeup of the machine from suspend via forwarded interrupts
from wakeup-capable devices owned by CrOS (touchpad, keyboard etc).

Add --direct-wake-irq param for marking forwarded IRQs as wakeup
capable.

BUG=b:227735609
TEST=put DUT in s2idle and wakeup by keyboard and LID open

Change-Id: I28fe26a06ca88920e55caf1121c5774711db2160
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572121
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2022-04-07 10:40:41 +00:00
Daniel Verkamp
c30abefc07 vfio_sys: regenerate bindings
BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: Ia1dc0daeb8d642ca94336c671639691930a246f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339852
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-06 19:20:35 +00:00
Tomasz Nowicki
e6fb841b3f direct_irq: allow to register eventfd for GPE
In ACPI world multiple GPEs (HW wires signaling arbitrary event)
can be associated with single SCI. Any pending GPE causes SCI
to be fired and appropriate GPE handler dispatched. In order
to pass-through GPE to the guest and take virtualization actions,
host kernel provides mechanism to bind physical GPE with SCI eventfd and
forward that information the the event listener (crosvm or KVM most likely).

Add userspace counterpart to host kernel GPE forwarding module
implemented in CL:3488959.

BUG=b:205072342
TEST=see CL:3492224

Change-Id: I1179baa78339bdd78f3fabf0139eb6f61f90eb2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439889
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2022-03-21 09:16:37 +00:00
Dennis Kempin
ef516189db Refactoring: Move common/base into base
Executes the script in https://crrev.com/c/3530502

BUG=b:223206469
TEST=presubmit

Change-Id: Ibeffdc8de0b2270f070e60bb2de8d9fdc78a2a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3530503
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-03-17 00:01:27 +00:00
Anton Romanov
bed40ad547 crosvm: migrate to Rust 2021 edition
BUG=none
TEST=cq

Change-Id: I0059c970879b78bfd40b6ce58b10debcf154b50f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508322
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-03-09 01:16:03 +00:00
Vikram Auradkar
ae5118f5c7 Enable windows tests for a few crates
Run tests for sys_util_core, poll_token_derive and balloon_control on
windows.

Using dotfiles to disable/serialize test runs of a subset of crates does
not work well with third party crates as it forces us to commit the dot
file to the crate.

The patch modifies and uses the script that runs linux tests.
This patch also allows us to
- build/test child crate even if parent crate has disabled build/test.
- avoid building crosvm if it is not explicitly specified.

RIP short lived .windows_build_test_skip. You allowed us to run noop
kokoro tests.

Test: py .\tools\impl\test_runner.py --arch x86_64
Bug: b:215610772
Change-Id: Icc6d04ffd7c0c33d4f60aeac16fc7d23881c387d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3459809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-18 03:18:58 +00:00
Vikram Auradkar
0108238474 Upstream windows build/test script
The patch also adds files to skip building and testing crates on
windows. When we run
```
tools/windows/build_test.py --skip_file_name .windows_build_test_skip
```

the build/test succeeds without actually doing anything as build/test
for all crates is skipped by creating '.windows_build_test_skip'.

Bug: 213170957
Test: Ran script on downstream repo
Change-Id: Iebd2cea463ee722be4feaed88229e1fb5e9fd6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3417918
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-01-28 00:55:08 +00:00
Dennis Kempin
8a1c50d5cd Refactoring: Move various general purpose crates to common/
This change contains the results of running

./tools/contib/cargo_refactor.py

This will break the next uprev, and needs to be synchronizized
with the corresponding ebuild changes in https://crrev.com/c/3248925

BUG=b:195126527
TEST=./tools/run_tests

Change-Id: Ied15a1841887bb8f59fba65b912b81acf69beb73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3248129
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-10-29 22:31:43 +00:00
Peter Fang
01527e39b3 devices: vfio: add support for VFIO_REGION_INFO_CAP_MSIX_MAPPABLE
For MSIX-capable PCI devices, some BAR regions are described using
VFIO_REGION_INFO_CAP_MSIX_MAPPABLE:

  The MSIX mappable capability informs that MSIX data of a BAR can be
  mmapped which allows direct access to non-MSIX registers which
  happened to be within the same system page.

Add support for this capability so that VfioRegion stores the correct
mmaps information.

Also, fix a couple break conditions to avoid breaking out early.

BUG=b:184904868
TEST=boot Linux kernel and verify MSIX-capable passthru devices work
properly

Change-Id: Ie451b154ccd4779f1694a1ffed0bd02127f5ecdb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2972487
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2021-08-13 23:24:01 +00:00
Tomasz Jeznach
417ee187da crosvm-direct: interrupt passthrough kernel interface.
Kernel interface to the host interrupt passthrough driver.
User space part of the interrupt handler registers eventfd
objects for trigger notifications and interrupt resample
requests.

BUG=b:173824544
TEST=None

Change-Id: I1b8f443655e7232e668c7d3bea78fbebf150e169
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2733580
Tested-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2021-03-31 02:12:55 +00:00
Michael Hoyle
6b19695c81 Add "base" crate and transition crosvm usages to it from sys_util
For now, this crate simply re-exports all of sys_util, but it will
be updated to provide new interfaces when needed. This is the
first step to making crosvm not directly depend on sys_util, so
that we can make the interface changes we need without fear of
negatively affecting (i.e. completely breaking) other usages
within chromeos.

BUG=b:162363783
TEST=./build_test

Change-Id: I7d0aa3d8a1f66af1c7fee8fd649723ef17027150
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2325168
Tested-by: Michael Hoyle <mikehoyle@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2020-08-06 18:19:44 +00:00
Xiong Zhang
85abeff27f vfio: Implement bar mappable
if device bar is mappable, map bar's gpa to hpa in EPT, guest vcpu
could access this bar directly through EPT without trapping. This
could improve performance.

vm.add_mmio_memory could help do this, here vfio_pci send
RegisterMmapMemory request through vm_control socket to do this.

BUG=chromium:992270
TEST=none

Change-Id: I3b4274372f7dcd32e18084d55f037b6fe45ed422
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1581147
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-12-06 08:47:29 +00:00
Daniel Verkamp
04a82c7be1 devices: vfio: fix clippy warnings
Fix boxed_local, const_static_lifetime, useless_format, and
redundant_closure clippy warnings in the VFIO code.

This fixes all clippy warnings except a single instance of
let_and_return in VfioPciDevice::keep_fds(), since that code is modified
in an upcoming patch.

BUG=None
TEST=./build_test.py
TEST=bin/clippy

Change-Id: I548adbc6b92448fc0db82ed72214d73b0eabaf5c
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1822697
Reviewed-by: Xiong  Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: Xiong  Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2019-10-17 00:17:05 +00:00
Xiong Zhang
3c8f32dfb0 vfio_sys: Add vfio.h to vfio_sys
Import kernel include/uapi/linux/vfio.h, it define ioctl interface.

BUG=none
TEST=none

Change-Id: If8e0dae22cb566ae32dfd61d6f2b147f56727611
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1580456
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-08-16 23:16:53 +00:00